Carlos Gustavo Ruiz

Back to Notebook


How can I delete duplicate lines in a file in Unix?

seen is an associative-array that Awk will pass every line of the file to. If a line isn’t in the array then seen[$0] will evaluate to false. The ! is a logical NOT operator and will invert the false to true. Awk will print the lines where the expression evaluates to true. The ++ increments seen so that seen[$0] == 1 after the first time a line is found and then seen[$0] == 2, and so on. Awk evaluates everything but 0 and "" (empty string) to true. If a duplicate line is placed in seen then !seen[$0] will evaluate to false and the line will not be written to the output

How to use unicode characters in Windows command line?

In powershell type:

It will change the code page to UTF-8. Also, you need to use Lucida console fonts.

(I use this to build a hakyll project on Windows)

Another answer at Windows 10 terminal encoding.

Append Current Date To Filename in Bash Shell

To get the current date in mm_dd_yyyy format use the following date format syntax:

You can store this to a variable name:


Finally, you can create a filename as follows:

You can create a shell script as follows:

How to check spelling at the Linux command line with Aspell

To check the spelling of a file, just type:

How do I scroll in tmux?

Ctrl-b then [ then you can use your normal navigation keys to scroll around (eg. Up Arrow or PgDn). Press q to quit scroll mode.

How do you scroll up/down on linux server (terminal)?

SHIFT+Page Up and SHIFT+Page Down. If it doesn’t work try this and then it should:

Go the terminal program, and make sure Edit/Profile Preferences/Scrolling/Scrollback/Unlimited is checked.

chmod Numerical permissions

# Permision rwx Binary
7 read, write, and execute rwx 111
6 read and write rw- 110
5 read and execute r-x 101
4 read only r-- 100
3 write and execute -wx 011
2 write only -w- 010
1 execute only --x 001
0 none --- 000

A permission have 3 numbers: owner, group and anyone else. An example, 744 stands for; the owner can read, write and execute, group and anyone else can read only the file.

Download file following redirects

Quick notes about tar