nl
stringlengths
13
387
bash
stringlengths
1
532
display a long listing of all files in the entire file system which are bigger than 1MB
find / -size +1000k -exec ls -l {} \; -print
display a long ilsting of all the files in the file system which are bigger than 1KB and which have not been modified in the last 30*24 hours
find / -size +1000 -mtime +30 -exec ls -l {} \;
display a long listing of all the files in the home folder which are bigger than 200MB
find /home -size +200M -exec ls -sh {} \;
display a long list of all the files that are bigger than 10KB in current folder
find . -size +10k -exec ls -l {} \;
display a long listing of all the files that begin with the name "Metallica" in the entire file system
find / -name 'Metallica*' -exec ls -l {} \;
display a long listing of all images with the name "articles" in the current folder
find . -iname "Articles.jpg" -exec ls -l {} \;
display a long listing of all images with the name "articles" in the current folder ( print0 is used to preserve file names with new line in their name )
find . -iname "Articles.jpg" -print0 | xargs -0 ls -l
display a long listing of all the java files in the current folder in sorted order
find . -type f -name '*.java' -ls | sort -k +7 -r
display a long list of all the jpg files in the home folder
find ~ -iname '*.jpg' -exec ls {} \;
display a long list of all the jpg files in the home folder(plus at the end is used to give bulk data as input)
find ~ -iname '*.jpg' -exec ls {} +
display a long listing of all the normal/regular files in the current folder (print0 is used to handle files which have newlines in their names or files with the name only as spaces )
find . -type f -print0 | xargs -0 ls -l
display a long listing of all the regular/normal files in the current folder
find . -type f -ls
display a long listing of all regular files in current folder which have been modified in the last 60 minutes
find . -mmin -60 -type f -exec ls -l {} \;
display a long listing of all regular files in current folder which have been modified in the last 60 minutes
find . -mmin -60 -type f -ls
display a long listing of all regular files in current folder which have been modified in the last 60 minutes
find . -mmin -60 -type f | xargs ls -l
display a long list of all regular/normal files in the file system which belong to the root and with suid bit set
find / -type f -user root -perm -4000 -exec ls -l {} \;
Display a long listing of all the regular files in the file system which belong to user 'root' and which have suid bit set
find / -type f -user root -perm -4000 -exec ls -l {} \;
display a long listing of all the regular/normal files in the file system which have set uid bit or set gid bit enabled.
find / -type f \( -perm -4000 -o -perm -2000 \) -exec ls -l {} \;
Display a long listing of all the regular files owned by the user 'bluher' in the entire filesystem
find / -type f -user bluher -exec ls -ls {} \;
Display a long listing of all regular files that are less than 50 bytes in size under '/usr/bin' directory tree
find /usr/bin -type f -size -50c -exec ls -l '{}' ';'
Display a long listing of all the regular files under current directory tree that are newer than ‘Apr 18 23:59:59 EDT 2013’ and older than ‘Apr 20 00:00:00 EDT 2013’ by modification time
find . -type f -newermt ‘Apr 18 23:59:59 EDT 2013’ ! -newermt ‘Apr 20 00:00:00 EDT 2013’ -exec ls -l ‘{}’ \;
Display a long listing of all regular files with 0777 permission under current directory tree
find . -perm 0777 -type f -exec ls -l {} \;
display a long listing of all the xls or csv files in the entire file system
find / -regex ".*\.\(xls\|csv\)"
display a long listing of all the xls or csv files in the entire file system
find / -type f \( -name "*.xls" -o -name "*.csv" \) -exec ls -l {} \;
display a long listing of the files all non emoty files in current folder which have been modified 60 minutes ago
find . -mmin 60 -print0 | xargs -0r ls -l
Display a long listing of the files/directories with human readable sizes (100M, 10G etc..) under '/var' directory tree which are bigger than 10MB
find /var/ -size +10M -exec ls -lh {} \;
display a long listing of the files in current folder which have been modified in the last 60 minutes
find . -mmin -60 -type f -exec ls -l {} +
display a long listing of the files in current folder which have been modified in the last 60 minutes
find . -mmin -60 |xargs ls -l
display a long list of the files in the current folder which have the word fuddel in all the files in the current folder and then search for the word fiddel in the previously matched files
find -exec grep -q fuddel {} ";" -exec grep -q fiddel {} ";" -ls
Display a long listing of the oldest file under '/hom/backups' directory tree
find /home/backups -printf "%T@ %p\n" | sort -n | head -1 | cut -d" " -f2- | xargs ls -al
Display a named character dump of "test.sh"
od -a test.sh
Display a sorted count of all the characters in "filename"
fold -w1 filename | sort | uniq -c | sort -nr
Displays a tree of all process alongside their command line arguments.
pstree -a
display all the ".c" files in the current directory
find . -name \*.c -print
display all the ".c" files in the current folder excluding those that are present in the .svn sub folder
find . -name .svn -prune -o -name "*.c" -print
display all the ".c" files in the current folder excluding those that are present in all the sub directories
find . \( ! -name . -prune \) -name "*.c" -print
display all the ".c" files in the folder "/home/david" which have been accessed in the last 48 hours
find /home/david -atime -2 -name '*.c'
display all the ".c" files which have been modified in the last 10 minutes
find /home/david -amin -10 -name '*.c'
display all the ".mov" files in the current folder
find . -name "*.mov"
display all the ".mov" video files in the current folder in the format filename and folder path
find . -iname "*.mov" -printf "%p %f\n"
display all the ".sh" files in the current folder
find -name *.sh
display all the "C" files in the current folder
find . -name "*.c"
display all the .sh scripts and perl files in the current folder
find . -type f \( -iname "*.sh" -or -iname "*.pl" \)
display all the .sh scripts and perl files in the current folder
find . -type f \( -name "*.[sS][hH]" -o -name "*.[pP][lL]" \)
display all the C, CPP, Header files in the kat folder
find kat -type f \( -name "*.c" -o -name "*.cpp" -o -name "*.h" \)
display all the c files and the header files in the path /some/dir and do not search in sub directories
find /some/dir -maxdepth 1 \( -name '*.c' -o -name '*.h' \) -print
display all the C files or Python files in the folder "euler"
find euler/ -iname "*.c*" -exec echo {} \; -or -iname "*.py" -exec echo {} \;
display all the configuration files in "/etc" folder along with their last access and modified timestamps
find /etc -name "*.conf" -printf "%f accessed %AF %Ar, modified %TF %Tr\n"
display all the configuration files in the current folder which are in the current tree structure
find . -path '*/*config'
display all the configuration files in the etc folder
find /etc -name '*.conf'
display all the details of empty files in current folder
find . -size 0 -printf '%M %n %u %g %s %Tb\n \b%Td %Tk:%TM %p\n'
display all directories in a folder
find /etc -type d -print
display all directories in current folder
find -type d
display all directories in current folder
find . -type d -print0
display all directories in the current folder
find -type d
display all the directories in the current folder
find . -type d
display all the directories in the current folder
find . -type d -print
display all directories in current folder and do not search in sub directories
find . -maxdepth 1 -mindepth 1 -type d
display all directories in current folder excluding those that are present in .git folder
find . -iregex '.*/.git/.*' -prune -o -type d -name 'CVS'
display all the directories in the current folder excluding those that are present in the .svn directory tree
find -type d -path '.svn' -prune -o -print
display all the directories in the current folder excluding those that are present in the aa directory tree
find . -type d -name aa -prune
display all the directories in the current folder excluding those that are present in the aa directory tree
find . -type d -name aa -prune -o -print
display all the directories in the current folder excluding those that are present in the folder secret
find . -name secret -type d -prune -o -print
display all the directories in the current folder excluding those that have the name "node_modules"
find . ! -name "node_modules" -type d
display all the directories in the current folder for the files which have not been accessed in the last 48 hours
find . -type d -atime +2
display all directories in the entire file system
find / -type d -print
display all directories in the folder "$ORIG_DIR"
find "$ORIG_DIR" -name "*" -type d
display all directories in the folder "/myfiles"
find /myfiles -type d
display all directories in the folder "PROD" and do not search in the sub directories
find /PROD -maxdepth 1 -type d
display all the directories in the folder /path/to/dest except tmp and cache directories
find /path/to/dest -type d \( ! -name tmp \) -o \( ! -name cache \) -print
display all the directories in the folder /path/to/dest except tmp directory
find /path/to/dest -type d \( ! -name tmp \) -print
display all the directories in the folder /usr/share
find /usr/share -type d
display all the directories in the folder master-
find master -type d | sort
display all directories in the folder Symfony
find Symfony -type d
display all directories which have not been accessed in the last 24*3 hours
find -type d -and -atime +3
display all empty files in the current folder
find . -size 0k
display all the empty files in current folder
find . -empty
display all the empty files in the current folder( files of size 0 bytes)
find . -empty
display all the empty files in the entire file system
find / -size 0 -print
display all the empty files in the folder /opt (file size 0 bytes)
find /opt -type f -empty
display all empty files(files with sisze 0 bytes) in home folder
find ~ -empty
dispaly all the empty regular/normal files in the current folder
find . -type f -empty
display all executable files in the folder /home
find /home -perm /a=x
Display all the files/directories under '/home/bozo/projects' directory tree that have been modified within the last day
find /home/bozo/projects -mtime -1
display all the files and directories with the name "CVS" from /usr/src folder that are at least seven levels deep and do not descend onto the folders
find /usr/src -name CVS -prune -o -depth +6 -print
dsisplay all files inthe current folder
find .
display all files ending with ".ext" in current folder and append the file contents of list.txt and sort them based on name and display only uniq items
find . -name \*.ext | cat - list.txt | sort | uniq -u
display all the files ending with ".foo" excluding those that are in the directory ".snapshot"
find . -name .snapshot -prune -o -name '*.foo' -print
display all the files ending with ".foo" including those that are in the directory ".snapshot", this is the wrong way of using prune.
find . \( -name .snapshot -prune -o -name '*.foo' \) -print
display all the files ending with ".user" in /var/adm/logs/morelogs/ and excluding all regular files
find /var/adm/logs/morelogs/* -type f -prune -name "*.user" -print
display all the files ending with ".user" or beginning with "admin" or ending with ".user.gz" in /var/adm/logs/morelogs/ and excluding all regular files
find /var/adm/logs/morelogs/* -type f -prune \( -name "admin.*" -o -name "*.user" -o -name "*.user.gz" \) -print
display all files ending with "ini" in current folder
find . -type f -name '*.ini'
display all the files having spaces in the current folder
find . -name "filename including space"
display all the files having spaces in the current folder
find . -name "filename including space" -print0
display all the files having the word "searched phrasse" in their name in the current folder excluding those from the paths "/tmp/" and "./var/log"
find . -type f -name "*searched phrasse*" ! -path "./tmp/*" ! -path "./var/log/*"
display all the files in the /usr folder which have the permissions 777
find /usr -perm 0777 -print
display all the files in the kat folder
find kat -printf "%f\n"
displays all files in the current directory
find .
display all the files in the current directory and do not search in sub directories
find . -maxdepth 1 -print0
display all the files in the current directory and do not search in the sub directories
find . -maxdepth 0 -print