Year: 2013

Make sense of grep exit status in Bash scripts

If you want to use grep results in bash scripts then it can get confusing. Because if grep returns a result then its exit status is 0; if it does not return anything the exit status is 1.

So these two line mean, if my script my_clever_script.pl is currently not running.

 

http://www.gnu.org/software/grep/manual/html_node/Exit-Status.html

Find large hidden files in Linux console

ls output

with a formatted output:

Find large (1 Gig and more) files in Linux console

normal ls output

with a formatted output:

Compare file occurences between two folders in Linux console

Show which exists only in today, only in yesterday or differ in both

Same as above but sorted

Same as first line but dives into subdirectories