How to find a file in Unix, Linux, Aix, Solaris.

If you are not sure about the name of the file and which directory it stored in then you can use the find command to search for it.

The Find command is common to all variants of Unix, Aix, Solaris, and Linux. The variables may differ slightly depending on the Operating System.

Here is an example of how to find all files that ends with the letters db.

find . -name ‘*db’ -print | more

The period (.) sign represents the current working directory. Find will search the current directory and all it’s subdirectories.

-name – this preceeds the actual name of the file.

‘*db’ – the * sign is a wildcard, meaning any files name that ends with db. This is enclosed in single quote.

-print – this will print the result to screen. Depending on the version of Unix/Linux this switch may be optional.

| more – the pipe (|) sign followed by more stops the results from scrolling off the screen, util any key is pressed. This command is vary handy when many results are found.

About Andrew Lin

Hi, I have always wanted to creat a blog site but never had the time. I have been working in Information Technology for over 15 years. I specialize mainly in networks and server technologies and dabble a little with the programming aspects. Andrew Lin

View all posts by Andrew Lin →