nl
stringlengths
13
387
bash
stringlengths
1
532
Find all 1.txt, 2.txt and 3.txt files under current directory and change the permission to 444
find . \( -name 1.txt -o -name 2.txt -o -name 3.txt \) -print|xargs chmod 444
Find all 100MB+ files and delete them
find / -size +100M -exec rm -rf {} \;
Find all 100MB files in file system and delete them using rm command
find / -size +100M -exec rm -rf {} \;
Find all 15MB files
find / -size 15M
Find all 15MB files in entire file system
find / -size 15M
Find all 1US* files/directories under current directory
find . -name '1US*'
Find all 400 permission files under /data directory
find /data -type f -perm 400
Find all 400 permission files under /data directory
find /data -type f -perm 400 -print
Find all 400 permission files under /data directory and change their permission to 755
find /data -type f -perm 400 -print | xargs chmod 755
Find all 400 permission files under /data directory, print 'Modifying ' appended with file path for each of them and change their permission to 755
find /data -type f -perm 400 -exec echo Modifying {} \; -exec chmod 755 {} \;
Find all 400 permission files under /data directory with null character as the delimiter
find /data -type f -perm 400 -print0
Find all 50MB files
find / -size 50M
Find all 50MB files in file system
find / -size 50M
Find all 664 permission files/drectories under current directory tree
find . -perm -664
Find all 755 permission regular files under current directory tree
find . -type f -perm 755
Find all 777 permission directories under current directory and set permissions to 755
find . -type d -perm 777 -print -exec chmod 755 {} \;
Find all 777 permission files in entire file system and set permissions to 644
find / -type f -perm 0777 -print -exec chmod 644 {} \;
Find all 777 permission regular files and use chmod command to set permissions to 644
find / -type f -perm 0777 -print -exec chmod 644 {} \;
Find all ES* and FS_* files under current directory
find . -type f \( -iname "ES*" -o -iname "FS_*" \)
Find all Name* files under ../../$name-module and rename them by replacing 'Name' with $Name (will be expanded in the current shell) in their names
find ../../$name-module -print0 -name 'Name*' -type f | xargs -0 rename "s/Name/$Name/"
Find all aliencoders.[0-9]+ files/directories under /home/jassi/ directory
find /home/jassi/ -name "aliencoders.[0-9]+"
Find all aliencoders.[0-9]+ files under /home/jassi/ directory
find /home/jassi/ -type f -name "aliencoders.[0-9]+"
find all the backup files in the current folder and delete them
find . -type f -name "*.bak" -exec rm -f {} \;
find all the backup files in the current folder and delete them
find . -type f -name “FILE-TO-FIND” -delete;
find all the backup files in the current folder and delete them after user confirmation
find . -type f -name "*.bak" -exec rm -i {} \;
Find all broken symlinks under /path/to/search directory
find /path/to/search -type l -xtype l
Find all broken symlinks under /path/to/search directory
find /path/to/search -xtype l
Find all broken symlinks under current directory
find -L . -type l
Find all broken symlinks under current directory
find -type l -xtype l
Find all broken symlinks under current directory
find -xtype l
Find all broken symlinks under current directory
find . -type l -xtype l
Find all broken symlinks under current directory
find . -xtype l
Find all broken symlinks under current directory
find ./ -type l -exec file {} \; |grep broken
Find all btree*.c files under current directory
find . -type f -name 'btree*.c'
Find all build* directories under /var/www/html/ and print all but first 5 appending with the string 'rf '
find /var/www/html/ -type d -name "build*" | sort | tail -n +5 | xargs -I % echo -rf %
Find all build* directories under /var/www/html/ and reverse sort them
find /var/www/html/ -type d -name "build*" | sort -r
Find all build* directories under current directory and reverse sort them
find . -type d -name "build*" | sort -r
Find all C source code files from the current directory tree that contain "keyword" in their pathnames, ignoring the case
find . -type f \( -iname “*.c” \) |grep -i “keyword”
Find all catalina* files/directories under /path/to/search/in
find /path/to/search/in -name 'catalina*'
Find all catalina* files/directories under current directory
find -name 'catalina*'
find all class files or sh script files in the current folder
find . -type f \( -name "*.class" -o -name "*.sh" \)
find all the configuration files in /etc folder along with the last access & modification time
find /etc -name "*.conf" -printf "%f %a, %t\n"
find all configuration files in a folder
find /home/pat -iname "*.conf"
find all the configuration files in the file system
find / -name "*.conf"
find all the configuration files which have been accessed in the last 30 minutes.
find /etc/sysconfig -amin -30
find all the configuration or text files in current directory
find . -type f \( -name "*.conf" -or -name "*.txt" \) -print
find all the core files in the entire file system and delete them
find / -name core -exec rm -f {} \;
find all the core files in the temp folder and force delete them
find /tmp -name core -type f -print | xargs /bin/rm -f
find all the cpp files in current folder
find -name "*.cpp"
find all the cpp files in the current folder
find . -iname '*.cpp' -print
find all the cpp files in the current folder and move them to another folder
find . -type f -iname '*.cpp' -exec mv {} ./test/ \;
find all the cpp files in the current folder and move them to another folder(plus takes the bulk output of the find command and gives it as input to the move command in exec)
find . -type f -iname '*.cpp' -exec mv -t ./test/ {} \+
find all the cpp(C++ source files), java, header files in the current directory
find . -name *.cpp -o -name *.h -o -name *.java
Find all CSS files
find . -name "*.css"
find all the css files
find -name '*.css'
Find all CSS files that do something with HTML ID #content
find . -name "*.css" -exec grep -l "#content" {} \;
find all CSS files that do something with your HTML ID #content
find . -name "*.css" -exec grep -l "#content" {} \;
find all data files in current folder which have not been changed in the last 60 minutes and display their name without extension
find . -iregex "./[^/]+\.dat" -type f -cmin +60 -exec basename {} \;
find all the database files in the folder /var/named
find /var/named -type f -name *.db
Find all dir* files/directories under parent
find parent -name dir*
Find all directories and for each of them, print an mv command to move it to /new/location
find . -type d -execdir echo /bin/mv {} /new/location \;
Find all directories at level 3 of directory tree $from_dir
find $from_dir -mindepth 3 -maxdepth 3 -type d
Find all directories by the name `httpdocs' on the system
find / -type d -name 'httpdocs'
Find all directories by the name `httpdocs' on the system
find / -type d -name httpdocs
find all the directories in the $LOGDIR folder which have been modified in the last 24 hours and compress them
find $LOGDIR -type d -mtime +0 -exec compress -r {} \;
Find all directories in the /data1/realtime directory tree that were last modified more than 5 minutes ago but less than 60 minutes ago
find /data1/realtime -mmin -60 -mmin +5 -type d
Find all directories in the /data1/realtime directory tree that were modified within the last 60 minutes
find /data1/realtime -mmin -60 -type d
Find all directories in the /path/to/base/dir tree
find /path/to/base/dir -type d
Find all directories in /path/to/dir/ without going into sub-directories
find /path/to/dir/ -mindepth 1 -maxdepth 1 -type d
Find all directories in /path/to/dir/ without going into sub-directories and append a null character at the end of each paths
find /path/to/dir/ -mindepth 1 -maxdepth 1 -type d -print0
Find all directories in /var/www/html/zip/data/*/*/*/*/* that are older than 90 days and print only unique paths
find /var/www/html/zip/data -type d -mtime +90 | uniq
Find all directories in 1 level down the /home directory that have two consecutive vowels in their names and count them
find /home -mindepth 1 -maxdepth 1 -type d -name '*[aeiou][aeiou]*' -printf '*' | wc -c
Find all directories in 1 level down the current directory
find . -mindepth 1 -maxdepth 1 -type d
Find all directories in the current directory tree
find -type d
Find all directories in the current directory tree excluding hidden directories and create them in "../demo_bkp"
find . -not -path \*/.\* -type d -exec mkdir -p -- ../demo_bkp/{} \;
Find all directories in the current directory tree that are not accessible by all
find -type d ! -perm -111
Find all directories in the current directory tree that do not have `execute' permissions for anyone
find . -type d ! -perm -111
Find all directories in the current directory tree that were last modified more than 5 minutes ago but less than 60 minutes ago
find . -mmin -60 -mmin +5
Find all directories in the current directory tree with "music_files" in their names
find . -type d -iname \*music_files\*
find all the directories in the current directory which dont have the execute permission.
find -type d ! -perm -111
find all directories in the current directory which have the name foo and do not have the extension "bar"
find . -name '*foo*' ! -name '*.bar' -type d -print
Find all directories in current directory without going into sub-directories
find . -type d -maxdepth 1
find all directories in the current folder
find -type d
find all the direcories in the current folder
find -type d
find all the directories in the current folder
find -type d
find all the directories in the current folder
find . -type d -print
find all the directories in the current folder and create the same directory structure in a remote machine using ssh
find -type d | ssh server-B 'xargs -I% mkdir -p "/path/to/dir/%"'
find all the directories in current folder and delete them
find . -type d -delete
find all the directories in the current folder excluding search in the sub directories and create these directories in another path
find . -maxdepth 1 -type d | xargs -I X mkdir '/new/directory/X'
find all the directories in the current folder that are empty(size 0 bytes)
find -type d -empty
find all the directories in the current folder which begin with the words "kt" and end with a digit
find . -regex './kt[0-9] '
find all the directories in current folder which start with test
find . -type d -name "test*"
Find all directories in the current one recursively which have the write bit set for "other"
find . -type d -perm -o=w
Find all directories in the current one with "linkin park" in their names and copy them to /Users/tommye/Desktop/LP
find . -maxdepth 1 -type d -iname "*linkin park*" -exec cp -r {} /Users/tommye/Desktop/LP \;
find all the directories in the different folders excluding search in the sub directories and create these folders in the current directory
find /media/New\ Volume/bhajans -maxdepth 1 -type d | xargs -0 mkdir -p
Find all directories in directory tree `httpdocs'
find httpdocs -type d
Find all directories in entire file system which are larger than 50KB
find / -type d -size +50k
find all the directories in the file system which begin with "man"
find / -type d -name 'man*' -print
find all the directories in the file system which have read, write and execute to all the users
find / \( -type d -a -perm -777 \) -print
find all the directories in the folder $LOGDIR which have been modified in the last 5 days and delete them.
find $LOGDIR -type d -mtime +5 -exec rm -f {} \;