How do I use the nohup command without getting nohup.out?

The nohup command only writes to nohup.out if the output would otherwise go to the terminal. If you have redirected the output of the command somewhere else – including /dev/null – that’s where it goes instead. nohup command >/dev/null 2>&1 # doesn’t create nohup.out Note that the >/dev/null 2>&1 sequence can be abbreviated to just … Read more

sed edit file in place

The -i option streams the edited content into a new file and then renames it behind the scenes, anyway. Example: sed -i ‘s/STRING_TO_REPLACE/STRING_TO_REPLACE_IT/g’ filename while on macOS you need: sed -i ” ‘s/STRING_TO_REPLACE/STRING_TO_REPLACE_IT/g’ filename

Concatenate multiple files but include filename as section headers

Was looking for the same thing, and found this to suggest: tail -n +1 file1.txt file2.txt file3.txt Output: ==> file1.txt <== <contents of file1.txt> ==> file2.txt <== <contents of file2.txt> ==> file3.txt <== <contents of file3.txt> If there is only a single file then the header will not be printed. If using GNU utils, you … Read more

Why is 1/1/1970 the “epoch time”?

Early versions of unix measured system time in 1/60 s intervals. This meant that a 32-bit unsigned integer could only represent a span of time less than 829 days. For this reason, the time represented by the number 0 (called the epoch) had to be set in the very recent past. As this was in … Read more

How to colorize diff on the command line

Man pages for diff suggest no solution for colorization from within itself. Please consider using colordiff. It’s a wrapper around diff that produces the same output as diff, except that it augments the output using colored syntax highlighting to increase readability: diff old new | colordiff or just: colordiff old new Installation: Ubuntu/Debian: sudo apt-get … Read more

What does ^M character mean in Vim?

Unix uses 0xA for a newline character. Windows uses a combination of two characters: 0xD 0xA. 0xD is the carriage return character. ^M happens to be the way vim displays 0xD (0x0D = 13, M is the 13th letter in the English alphabet). You can remove all the ^M characters by running the following: :%s/^M//g … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)