Tips Linux Explorers   All Things Linux Forum   Great Linux Links   Hometown   Email 


Imagine you just downloaded or installed a program and you have no clue where is is gone. There are several ways to perform search.

The most easy ones are:

$ whereis gkrellm


$ locate gkrellm

( if gkrellm is the program you're after )

Note: for locate to work you have to create a database for fast searching :

$ su
< password >
# updatedb

Cron will keep your database up to date on a daily basis.

Special characters: * \ [....] [!....] ?

* = matches a random string of characters
\ = the “escape sign”, the character or space after this sign is ignored
? = matches 1 random character
[a-d] = matches a, b, c, d
[!a-d] = does not match a, b, c, d
[a-dA-D] = matches a, b, c, d, A, B, C, D

Now let's do some Magic:

$ ls /etc/*conf

( Will list all files in the /etc dir that end with conf including conf )

$ ls /etc/[!g-z]*

( Will list all files in /etc/ that do not start with the letters g to z )

$ locate *doc

( Will produce a long list of the files ending on doc on your computer )

Because this list is very long, and we might want to keep it:

$ locate *doc >alldocs

( Will create a textfile called alldocs in your /home listing all the doc files crowding your computer. ( Notice the speed of you lovely Linux system ) )

$ ls /mnt/win_c/My\ Documents/*txt

( Will make a list of all your txt files it finds in your C:\windows\My Documents. )
Note: Linux does not like spaces in names ! So in My\ Documents, the \ tells it to ignore the next character. An other way to do it is “My Documents”.

Another, but somewhat complicated command for searching is "find". See for instructions how to use it: The Find Command


-- Apr 24 2003 ( Revised Dec 10 2005 ) --

Tips Linux Explorers   All Things Linux Forum   Great Linux Links   Hometown   Email