Show Menu

Advanced Bash Cheat Sheet (DRAFT) by

This is a draft cheat sheet. It is a work in progress and is not finished yet.


watch -n 5 'ntpq -p'
Issue the 'ntpq -p' command every 5 seconds and display output


egrep '(Tom|Dan) Savage' file
Print lines contain 'Tom Savage' or 'Dan Savage'
grep -irl 'keyword' *
Print all files name which contains keyword (cas­e-i­nse­nsi­tive, search from current folder recu­rsi­vely )
head -20 file | tail -10
Print lines 11 t0 20 of file


In vi, read lines 3 to 8 in foo.c and insert the lines to current file after current cursor line


ln -sv target­/ex­ist­ing­/di­rectory new_li­nk_­to_­create
Create a soft link file to existing folder