Basically i am talking about Linux terminal and without installing any new programs. I will also not use any programming languages. I am not digging into regexp details, please refer to their documentations. Many programs have their own regexp and syntax so I usually pipe the output to the input of egrep or such to satisfy my needs. This document is for reference and only states how i use them. These are obviously not the only ways.
1. ls (dir also does things similar) : List the contents. Ls is the first command I use to search in Linux. Obviously the very basic but also, very useful if you know in which directory your file is. This command was written partly by Richard stallman himself. To do a simple search just type ls followed by the file name. Other examples: # To search file names with a fixed file-type (Using Wildcard)# Here I am searching for mp3 files in my current directory
ls -C *.mp3
* this matches everything that has a '.mp3' anywhere in the filename and puts it in a column (-C).
# To search for file whose filetype and first starting character I remember
# I am searching for mp3 files whose first character is y
ls | egrep '^[Yy].*.mp3$'
* this matches everything starting('^' for starting character) with a 'Y or y' and any number (here '*' for any number of times) of character (here '.' for any character) following it which ends in ".mp3" (here $ as end of line).
2. locate : Locate is a command line file search utility which finds file by it's name until regexp is used. Unlike ls, locate searches for files in all directories. But it has a major drawback. It uses a database('/var/lib/mlocate/mlocate.db') to search from, which might not be updated all the time. # To update the database use
updatedb3. who (also, finger and w) : While a little different, it searches for users who are logged into the computer right now. Finger provides a little more detail
# To find out who logged into the system after the computer booted type:
who -a -H
4. whatis (apropos and man) : These commands searches for discription about some binaries, files whose manual pages are available. It is very useful to find out if an application is installed which additionally displays descriptions (short description in whatis and broader and long description in apropos and a complete manual with man) of the application. whatis and apropos supports regex and wildcards. # To find out if ls is installed in your system with whatis type:
whatis ls
# To do the same with apropos
apropos -e ls