Linux.com

A few of my favorites

Posted by: Anonymous Coward on July 27, 2005 01:26 AM
I like to use "which" inside of backticks. Some programs require the full path to a file in order to work; for example:

~$ file grep
grep: can't stat `grep' (No such file or directory).

But if I use which inside of backticks it works fine:

~$ file `which grep`<nobr> <wbr></nobr>/bin/grep: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), stripped

I also sometimes forget the name of some program but can remember part of it such as a lot of programs will have "conf" in them somewhere. If I want to see all of the programs that have "conf" in them I use:

~$ locate conf | grep bin/

And it gives me all of the programs that have "conf" in their names that are in the<nobr> <wbr></nobr>/bin<nobr> <wbr></nobr>/sbin<nobr> <wbr></nobr>/usr/bin<nobr> <wbr></nobr>/usr/sbin directories.

Cheers,

netcat

#

Return to CLI Magic: Information, please