If you can see this check that
next section | prev section | up | prev page | next page |
When you work with many files, it can sometimes be difficult to remember where you have placed a file in the directory tree. The find command enables you to search through a directory and its subdirectories for files which meet a certain criteria. The command is flexible, in that it allows you to search by filename, owner, protection, size, date, or any combination. For example:
% find / -name myfile -printThe '/' is the name of the directory in which the command is to start searching, i.e. the root directory in this example. The '-name' option tells find the name of the file it is searching for. The '-print' option then echos to stdout the full path name of the file or files as they are found. You can include wildcards in your expression to describe a file name which contains certain characters. For example:
% find . -name 'my*' -printThe '.' specifies that the search should start from the current directory and proceed through any subdirectories. The 'my*' will find all files beginning with 'my', the expression has to be placed in single quotes so that the shell will interpret it correctly.
Here are some examples:
% find /home/john -newer myfile -printFind in the directory /home/john and its subdirectories any files that have been modified more recently that the file 'myfile' and echo to stdout.
% find / -user john -printFind all the files in the system belonging to the user 'john'.
% find . -name core -print -exec rm {} \;Find all the files named core in the current directory and subdirectories. Ever time a find is found, the command following the '-exec' is executed, in this case rm. Where the braces {} appear in the command they are replaced by the name of the file. The backslash-semicolon '\;' is required by find to terminate the -exec option.
Common options for the find command are:
Centos 7 intro: | Paths | BasicShell | Search |
Linux tutorials: | intro1 intro2 wildcard permission pipe vi essential admin net SELinux1 SELinux2 fwall DNS diag Apache1 Apache2 log Mail |
Caine 10.0: | Essentials | Basic | Search | Acquisition | SysIntro | grep | MBR | GPT | FAT | NTFS | FRMeta | FRTools | Browser | Mock Exam | |
Caine 13.0: | Essentials | Basic | Search | |
CPD: | Cygwin | Paths | Files and head/tail | Find and regex | Sort | Log Analysis |
Kali: | 1a | 1b | 1c | 2 | 3 | 4a | 4b | 5 | 6 | 7a | 8a | 8b | 9 | 10 | |
Kali 2020-4: | 1a | 1b | 1c | 2 | 3 | 4a | 4b | 5 | 6 | 7 | 8a | 8b | 9 | 10 | |
Useful: | Quiz | Forums | Privacy Policy | Terms and Conditions |
Linuxzoo created by Gordon Russell.
@ Copyright 2004-2024 Edinburgh Napier University