The “find” command in Linux is used to search for files and directories in a specified location, and it supports many options for filtering and manipulating the files that are found.
Here are some examples of how the “find” command can be used in Linux:
- To search for all files and directories in the current directory:
find .
- To search for all files with the .txt extension in the current directory and its subdirectories:
find . -name '*.txt'
- To search for all files that were modified in the last 24 hours:
find . -mtime -1
- To search for all empty files in the current directory and its subdirectories
find . -empty
- To search for all files and directories owned by a specific user
find /path/to/start/searching/ -user username
- To search for files and directories by its type
find /path/to/start/searching/ -type d -or -type f
Here, -type d
finds all directories and -type f
finds all files.
- To search for files and execute a command on the matching files
find /path/to/start/searching/ -name "*.txt" -exec chmod 755 {} \;
The find command is one of the most powerful command in Linux as it allow you to search files and directories, filter it based on multiple criteria, and execute some command on matched files. It could also be useful in shell script when you need to find files with specific criteria and take appropriate action on those files.
Other Linux Commands
- admin Command
- alias Command
- apt Command
- ar Command
- asa Command
- at Command
- awk Command
- basename Command
- bash Command
- batch Command
- bc Command
- bg Command
- break Command
- c99 Command
- cal Command
- cat Command
- cd Command
- cflow Command
- chgrp Command
- chmod Command
- chown Command
- chroot Command
- cksum Command
- clear Command
- cmp Command
- comm Command
- command Command
- compress Command
- continue Command
- cp Command
- crontab Command
- csplit Command
- ctags Command
- cut Command
- cxref Command
- datamash Command
- date Command
- dc Command
- dd Command
- delta Command
- df Command
- diff Command
- dir Command
- dirname Command
- dot Command
- du Command
- echo Command
- ed Command
- env Command
- eval Command
- ex Command
- exec Command
- exit Command
- expand Command
- export Command
- expr Command
- false Command
- fc Command
- fg Command
- file Command
- find Command
- flex Command
- fold Command
- fort77 Command
- fortune Command
- ftp Command
- fuser Command
- gawk Command
- gencat Command
- get Command
- getconf Command
- getopts Command
- grep Command
- groupadd Command
- groupdel Command
- groups Command
- hash Command
- head Command
- history Command
- hostname Command
- htop Command
- iconv Command
- id Command
- iostat Command
- ipcrm Command
- ipcs Command
- jobs Command
- join Command
- kill Command
- last Command
- less Command
- lex Command
- link Command
- ln Command
- locale Command
- localedef Command
- locate Command
- logger Command
- login Command
- logname Command
- logout Command
- lp Command
- ls Command
- m4 Command
- mailx Command
- make Command
- man Command
- mesg Command
- mkdir Command
- mkfifo Command
- mktemp Command
- more Command
- mount Command
- mtail Command
- mv Command
- nano Command
- netstat Command
- newgrp Command
- nice Command
- nl Command
- nm Command
- nohup Command
- od Command
- parallel Command
- passwd Command
- paste Command
- patch Command
- pathchk Command
- pax Command
- pgrep Command
- ping Command
- pkill Command
- pr Command
- print Command
- printf Command
- prs Command
- ps Command
- pstree Command
- pwd Command
- qalter Command
- qdel Command
- qhold Command
- qmove Command
- qmsg Command
- qrerun Command
- qrls Command
- qselect Command
- qsig Command
- qstat Command
- qsub Command
- read Command
- readlink Command
- readonly Command
- renice Command
- return Command
- rm Command
- rmdel Command
- rmdir Command
- rsync Command
- sact Command
- sar Command
- sccs Command
- sed Command
- seq Command
- set Command
- sh Command
- shift Command
- shopt Command
- sleep Command
- sort Command
- split Command
- ss Command
- stress Command
- strings Command
- strip Command
- stty Command
- suspend Command
- tabs Command
- tail Command
- talk Command
- tee Command
- test Command
- time Command
- times Command
- top Command
- touch Command
- tput Command
- tr Command
- traceroute Command
- trap Command
- true Command
- ts Command
- tsort Command
- tty Command
- type Command
- ulimit Command
- umask Command
- umount Command
- unalias Command
- uname Command
- uncompress Command
- unexpand Command
- unget Command
- uniq Command
- unlink Command
- unset Command
- unzip Command
- uptime Command
- useradd Command
- userdel Command
- uucp Command
- uudecode Command
- uuencode Command
- uustat Command
- uux Command
- val Command
- vi Command
- w Command
- wait Command
- wc Command
- what Command
- whereis Command
- which Command
- who Command
- write Command
- xargs Command
- yacc Command
- zcat Command
- zip Command
- Linux Commands and Examples
0 Comments