How to add a column heading with awk on Linux.

This very nice one-liner will print some information about your mounted drives on Linux and also print a column header to dress up the output. ┌──[[email protected]]─[~/Downloads] └──╼ ╼ $ df -Hla | grep "[0-9]% /" | awk -F, ‘NR==1 {print "Device","Capacity","Free","Usage","Percentage","Mount"} {gsub(/"/,""); print $1,$2,$4}’ | column -t Device Capacity Free Usage Percentage Mount dev 13G … Read more

How to search a file with grep for certain hexadecimal values.

The grep utility is very useful for searching for files and text snippets. It can also be used to search a file for certain values in hexadecimal. In the example below, I am searching for the text “JFIF” in hexadecimal in certain files. This will tell me that they are jpg image files. The hexadecimal … Read more