- FIND command in UNIX is used to find the files from the specified directory.
- Use the below command to find all the files named as “file.txt” from the specific directory. You need to provide the directory from which you are looking for the files.
Ex:
Use the below command to find the files from the current directory and also from the sub directories.
Ex:
From the above example the file “123.txt” is available in “sss” directory as well the “rrr” directory.
Note:
The “rrr” directory is the subdirectory under the directory “sss”.
- We can also find the files based on the file permissions.
- Use the below command to find the files based on the file permissions.
Ex:
- We can also find the files based on user type using the find command.
- Use the below command to find the files belongs to user “20994”
Ex:
Note:
Above example retrieves the files from current and sub directories which are belongs to user “20994”
- Also, we can find the files based on groups. Below example retrieves the files belongs to group “users”
Ex:
Note:
In the above example all the files are having the user as “20994 and group as “20994” as well.
- In some scenarios we might not be aware of the exact file names. If we know the start or end of the file name, then we can use the below command to find such files. Use wildcard “*” before or end of the filename according to your requirement.
Ex:
We can also search the files based on the content of the file using find command. In come scenarios where we might not be aware of the file name but we might be knowing some of the contents in the file. Use the below command in such scenarios.
Ex:
- In the above example, the search criteria is the keyword “example”. It retrieves the matching files from the current and sub directories which has the keyword as “example”.
- To find all the directories under the current directory. Below command retrieves only the directory lists under the directory “sss”
Ex:
To find the specific directory available from the current and sub directories.
Ex:
OTHER ADVANCED UNIX COMMANDS:
Below are the list of advanced UNIX commands used in UNIX operation system.
1 .GREP Command in Unix
2.Whoami Command in Unix
3.Passwd Command in Unix
4.Kill Command in Unix
5.Ps -Ef Command in Unix
6.Df -k Command in Unix
7.Bdf Command in Unix
8.ftp Command in Unix
9.Find Command in Unix
10.Date Command in Unix
11.Uptime Command in Unix
12.Clear Command in Unix
13.Shift Command in Unix
14.Sort Command in Unix
15.Crontab Command in Unix
16.Unix Command Line Arguments