nl
stringlengths
13
387
bash
stringlengths
1
532
Filters only directories from long file listing of the current directory
ls -l --color=always "$@" | egrep --color=never '^d|^[[:digit:]]+ d'
Filters only directories from long file listing of the current directory
ls -l --color=always "$@" | grep --color=never '^d'
Filters only directories from long file listing of the current directory.
ls -l | grep "^d"
Filters out strings, using the extended regexp pattern '^#|^$|no crontab for|cannot use this program' from "$USERTAB"
echo "$USERTAB"| grep -vE '^#|^$|no crontab for|cannot use this program'
Filters unique lines by matching against the first column of a .csv file
tac a.csv | sort -u -t, -r -k1,1 |tac
Find the "*.foo" files in the current directory tree that are not under ".snapshot" directories
find . -name .snapshot -prune -o -name '*.foo' -print
Find "*prefs copy" files in the /mnt/zip directory tree and remove them with prompting
find /mnt/zip -name "*prefs copy" -print0 | xargs -p rm
Find ".c" and ".h" files in the current directory tree and print lines containing "#include"
tree -if | grep \\.[ch]\\b | xargs -n 1 grep -H "#include"
Find ".c" and ".h" files in the current directory tree and print line numbers and lines containing "#include"
tree -if | grep \\.[ch]\\b | xargs -n 1 grep -nH "#include"
find ".flac" files in current folder using regular expressions
find ./ -regex "./cmn-.\.flac"
find the "MyCProgram.c" file (case insensitive find) under the current directory
find -iname "MyCProgram.c"
Find the "param1" string in regular files under and below /var
find /var -type f -exec grep "param1" {} \; -print
Find the "param1" string in regular files under and below /var
find /var -type f | xargs grep "param1"
Find & replace broken symbolic links
find -L . -type l -delete -exec ln -s new_target {} \;
Find '*prefs copy' files under /mnt/zip and delete them with confirmation prompt ensuring white space safety
find /mnt/zip -name "*prefs copy" -print0 | xargs -0 -p /bin/rm
Find '.git' directories in directory tree /home/madhu/release/workspace
find /home/madhu/release/workspace -type d -name '.git'
Find '.git' directories in directory tree /path/to/files and print the pathnames of their parents
find /path/to/files -type d -name '.git' -exec dirname {} +
Find '.java' files with checksum 0bee89b07a248e27c83fc3d5951213c1 in the current directory
md5sum *.java | grep 0bee89b07a248e27c83fc3d5951213c1
Find `string' in all *.java files ignoring the case of that string
find . -type f -name "*.java" -exec grep -il string {} \;
Find *.avi and *.flv files in /path/to/your/directory and below and copy them to /path/to/specific/folder
find /path/to/your/directory -regex '.*\.\(avi\|flv\)' -exec cp {} /path/to/specific/folder \;
Find *.c and *.sh files
find . -type f \( -name "*.c" -o -name "*.sh" \)
Find *.conf files/directories only upto 1 level down under /etc directory and show a few lines of output from the end
find /etc -maxdepth 1 -name "*.conf" | tail
Find *.conf files/directories only upto 2 levels down under /etc directory and show a few lines of output from the end
find /etc -maxdepth 2 -name "*.conf" | tail
find *.gif files under the currently directory and sub-directories and list them using the ls command
find . -name *.gif -exec ls {} \;
Find *.html files in the /usr/src/linux directory tree
find /usr/src/linux -name "*.html"
Find *.html files in the current directory tree that were modified 7 days ago
find . -mtime 7 -name "*.html" -print
Find *.html files in the current directory tree that were modified less than 7 days ago
find . -mtime -7 -name "*.html" -print
Find *.o files with permissions 664 in the current directory tree
find . -name *.o -perm 664 -print
Find *.pl files/directories under /users/tom
find /users/tom -name "*.pl"
Find *.scm files recursively in the current directory
find . -name '*.scm'
Find *.tex files in the current directory tree that contain text "documentclass"
find . -type f -name *.tex -print0 | xargs -0 grep -l 'documentclass'
Find *.txt files in the current directory tree, ignoring paths ./Movies/*, ./Downloads/*, and ./Music/*
find . -type f -name "*.txt" ! -path "./Movies/*" ! -path "./Downloads/*" ! -path "./Music/*"
Find *2011* files and grep for the string 'From: Ralph' in those files
find . -name '*2011*' -print | xargs -n2 grep 'From: Ralph'
Find *log files/directories within a maximum of 3 levels of directories
find / -maxdepth 3 -name "*log"
find -name '*.js' -not -path './node_modules/*' -not -path './vendor/*'
find -name '*.js' -not \( -path './node_modules/*' -o -path './vendor/*' \)
find .bmp or .txt files
find /home/user/Desktop -name '*.bmp' -o -name '*.txt'
find .gif files in /var/www and below that were last changed between 90 and 180 days ago
find /var/www -name *.gif -ctime +90 -ctime -180
Find the .groovy files outside the "./target" directory path
find . -name "*.groovy" -not -path "./target/*" -print
Find .java files in the current directory tree that contain 'TODO', and print their names
find . -name "*.java" -exec grep -Hin TODO {} + | basename `cut -d ":" -f 1`
Find .jpg files owned by user daniel in the current directory and its sub-directories.
find . -user daniel -type f -name *.jpg
Find .jpg files owned by user daniel in the current directory and its sub-directories but ignore any file beginning with "autumn".
find . -user daniel -type f -name *.jpg ! -name autumn*
Find .rmv files in the ./root directory recursively and copy them to directory /copy/to/here
find root -name '*.rmv' -type f -exec cp --parents "{}" /copy/to/here \;
Find .rmv files in the ./root directory recursively and copy them to directory /copy/to/here
find root -name '*.rmv' -type f -exec cp {} /copy/to/here \;
Find .rmv files in the current directory recursively
find . -name *.rmv
Find .txt files on the system whose size is greater than 12000 bytes
find / -name "*.txt" -size +12000c
find the ten biggest files
find /home -type f -exec du -s {} \; | sort -r -k1,1n | head
Find 10 largest files in the current directory and its subdirectories
du -hsx * | sort -rh | head -10
Find 10 most recently changed files in the current directory tree
find . -type f -printf "%C@ %p\n" | sort -rn | head -n 10
Find the 5 largest regular files in the current directory and below.
find -type f -exec du -Sh {} + | sort -rh | head -n 5
Find <fileName> files/directories under current directory
find -name "<fileName>"
find the MyCProgram.c (case insensitive find) under the current directory and run the md5sum command against it
find -iname "MyCProgram.c" -exec md5sum {} \;
find a 'fool.scala' named regular file under /opt /usr /var those directories.
find /opt /usr /var -name foo.scala -type f
Find a 400 permission file under /data directory
find /data -type f -perm 400 -print -quit
find a difference between website content of "http://tldp.org/LDP/abs/html/" and "http://www.redhat.com/mirrors/LDP/LDP/abs/html/"
diff <(curl -s http://tldp.org/LDP/abs/html/) <(curl -s http://www.redhat.com/mirrors/LDP/LDP/abs/html/)
Find a directory named 'project.images' in the entire filesystem and show it in long listing format
find / -type d -name "project.images" -ls
Find a hostname that resolves to IP '173.194.33.71'
dig +short -x 173.194.33.71
Find a more recent version of httpd.conf file than /etc/apache-perl/httpd.conf in entire file system
find / -name httpd.conf -newer /etc/apache-perl/httpd.conf
Find a single file called tecmint.txt and remove it
find . -type f -name "tecmint.txt" -exec rm -f {} \;
find a specfic video file in the current directory
find ./ -name "foo.mp4" -exec echo {} \;
Find a used disk space of a target directory and files inside of it
du -h your_directory
find a.out, *.o and core files under the current directory and sub-directories and delete them.
find . \( -name a.out -o -name '*.o' -o -name 'core' \) -exec rm {} \;
Find a.out and object files in the current directory tree
find . ( -name a.out -o -name *.o ) -print
Find absolute path of command with PID "$pid"
readlink -f `ls --dereference /proc/$pid/exe`
find al the files that are modified exactly 2 days ago
find -daystart -mtime 2
find al the tmp directories in the current directory and create a dump of it
find . -type d -name tmp -prune -o -print | cpio -dump /backup
find all the ".JPG" files in current folder and display their count
find ./ -name '*.JPG' -type f | wc -l
find all the ".c" files in the folder "/home/you" which have been accessed in the last 30*24 hours
find /home/you -iname "*.c" -atime -30 -type -f
find all the ".c" files in the folder /home/david which have been modified in the last 48 hours
find /home/david -mtime -2 -name '*.c'
find all ".flac" files in current folder starting with "cmn-"
find . -name 'cmn-*.flac'
find all ".flac" files starting with "cmn-" and search for files having CJK characters using unicodes
find . -name 'cmn-*.flac' -print | grep -P '[\x4e00-\x9fa5]'
find all ".flac" files starting with "cmn-" and search for files having CJK characters using unicodes
find . -name 'cmn-*\.flac' -print | grep -P './cmn-[\x4e00-\x9fa5]\.flac'
find all the ".sh" files in the current folder ( case insensitive search)
find -iname *.SH
find all the ".wma" files in the folder "$current_directory"
find "${current_directory}" -type f -iname "*.wma"
Find all "G*.html" files modified more than 7 days ago in the current directory tree
find . -mtime +7 -name "G*.html"
Find all "YourProgramName" regular files in the current directory tree and print the full paths to the directories containing them
find . -type f -name YourProgramName -execdir pwd \;
find all the "error_log" files in the folder "/home" which are bigger than 5MB and force delete them
find /home -size +5000000b -name "error_log" -exec rm -rf {} \;
find all the "jpg" file in a folder.
find /win/C -iname *JPG
find all the "passwd" files in the entire file system
find / -iname passwd
Find all $1 files/directories under current directory and enter into the parent directory of the first one found
cd $(find . -name $1 | xargs dirname)
Find all $2 files in $1 path and search for the regex expanded by $3 in those files
find $1 -name "$2" -exec grep -Hn "$3" {} \;
Find all $2 files in $1 path and search for the regex expanded by $3 in those files excluding the files with /proc in their paths
find $1 -name "$2" | grep -v '/proc' | xargs grep -Hn "$3" {} \;
find all '*.c' files under $HOME directory which context contains sprintf
find $HOME -name '*.c' -print | xargs grep -l sprintf
Find all '*~' files under current directory
find ./ -name '*~'
Find all 'custlist*' files under current directory
find . -name custlist\*
Find all `doc.txt' files in the current directory tree printing "found" for each of them
find ./ -name doc.txt -printf "found\n"
find all 'js' suffix files exclue the path *exclude/this/dir*' under current dirctory
find . -name '*.js' -not -path '*exclude/this/dir*'
Find all 'test' directories in the current directory tree
find -type d -a -name test
Find all 'test' directories in the current directory tree and remove them
find -type d -a -name test|xargs rm -r
Find all 'test' directories in the current directory tree and remove them
find . -name test -type d -print0|xargs -0 rm -r --
Find all 'test' directories in the current directory tree and remove them
find . -type d -name 'test' -exec rm -rf {} \;
Find all * * regular files under current directory
find . -type f -name "* *"
Find all *$VERSION* files/directories under current directory where $VERSION is a variable
find . -name "*$VERSION*"
Find all *-* files under current directory
find . -type f -name '*-*'
Find all *.$input_file_type files/directories under $source_dir with the null character as the delimiter
find "$source_dir" -name "*.$input_file_type" -print0
Find all *.* directories under /home/feeds/data directory
find /home/feeds/data -type d \( -name 'def/incoming' -o -name '456/incoming' -o -name arkona \) -prune -o -name '*.*' -print
Find all *.* files not within .git directory and run $SED_CMD -i "s/$1/$2/g" on each of them
find . -type f -name "*.*" -not -path "*/.git/*" -print0 | xargs -0 $SED_CMD -i "s/$1/$2/g"
Find all *.* files under current directory
find . -type f -a -name '*.*'
Find all *.[ch] files under current directory
find . -name '*.[ch]'
Find all *.axvw files/directories under current directory
find . -name '*.axvw'
Find all the *.c files at any level of directory Programming under any 'src' directory
find ~/Programming -path '*/src/*.c'