Show Menu
Cheatography

Advanced Bash Cheat Sheet (DRAFT) by

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

Monitoring

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

Filtering

egrep '(Tom|Dan) Savage' file
Print lines contain 'Tom Savage' or 'Dan Savage'
grep -irl 'keyword' *
Print all files name which contains keyword (case-i­nse­nsitive, search from current folder recurs­ively )
head -20 file | tail -10
Print lines 11 t0 20 of file

Editing

:put=r­ead­fil­e('­/pa­th/­to/­foo­/fo­o.c­')[2:7]
In vi, read lines 3 to 8 in foo.c and insert the lines to current file after current cursor line
 

Creating

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