Home » Linux Administration

My Favourite Grep / Bash Combo’s

19 February 2007 No Comment


Just a quick build up of my most commonly used bash commands

lsof | grep ‘searchterm’  – List open files and search for specific handle
history | grep ‘searchterm’ – Search for a term in my bash history (I now have this setup as an alias ‘ghistory’
ps -ef | grep ‘process’ – Much the same as ‘ps aux | grep’ but is HP-UX compatible, so force of habit really.
!ssh - Reuse the last ssh command in history (make sure you never use !rm, especially if you ever use rm -rf).
netstat -anp | grep ‘searchterm’ – Great for finding which processes are talking on which ports and to which ip addresses.

That’s it for the moment, I’ll keep them coming shortly.

Technorati Tags: , , , ,

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.