5pm web | code | del.icio.us | gmail | hulu | quick diff | pics | contact me
Google



>> Firefox High-Res Stream <<
Free TV : Ustream

Linux Command Line Tips

Find Files Containing Text

Find a file of a certain extension containing a certain text phrase in the current directory and its subdirectories. In the example below we are searching for select data_element in .php files.

find | grep .php | xargs grep -s "select data_element"

It can be quite useful to append a clear; to the start of this command to give a clean output each time it is run.

clear; find | grep .php | xargs grep -s "select data_element"

Need to review a long listing? Pipe the results to less. Press q to exit less.

clear; find | grep .php | xargs grep -s "select data_element" | less

Find Recently Modified Files

Want to see all the .php files modified in the last 5 days?

clear; find -mtime -5 -print | grep .php

Need to review a long listing? Pipe the results to less. Press q to exit less.

clear; find -mtime -5 -print | grep .php | less

Linux Screen Hot Keys

Key Combo Function
Ctrl+a " List active screens.
Ctrl+a c Create new screen.
Ctrl+a n View Next screen.
Ctrl+a p View Previous screen.
Ctrl+a Shift+D Try to detatch a frozen screen. This will not always exit cleanly.
Ctrl+a Ctrl+/ Same as above. Try to detatch a frozen screen. This will not always exit cleanly.
More Screen Commands