nl
stringlengths
13
387
bash
stringlengths
1
532
List each subdirectory name composing the current working directory
pwd | cut -b2- | tr '/' '\n'
List each subdirectory name composing the current working directory
pwd | cut -f 1- -d\/ --output-delimiter=$'\n'
List each unique case insensitive character in "file" prefixed by number of occurrences
grep -o . file | sort -f | uniq -ic
List each unique case insensitive character in "file" prefixed by number of occurrences and sorted from most frequent to least frequent
grep -o . filename | tr '[:upper:]' '[:lower:]' | sort | uniq -c | sort -nr
List each unique character in "file" prefixed by number of occurrences
grep -o . file | sort | uniq -c
List each unique character in "file" prefixed by number of occurrences and sorted from most frequent to least frequent
grep -o . filename | sort | uniq -c | sort -nr
List empty directories in the current directory tree
find . -depth -empty -type d
List the entire cron job list of user "apache".
crontab -u apache -l
List every symbolic link in every home directory's subdirectory owned by group `staff'
find `pwd` -group staff -exec find {} -type l -print ;
List files/directories at least three levels down the directory tree
find / -mindepth 3 -name "*log"
List file contents of compressed file 'compressed.tar.gz'
gzip -l compressed.tar.gz
Lists file descriptors of a current process.
ls -l /proc/self/fd/
List files ending in .html and residing in the current directory tree
find . -name "*.html"
list files found under the current directory ending in "txt" or ending in "html"
find . -name '*.txt' -o -name '*.html'
List the files from the current directory tree that contain lines matching regular expression '^From:.*unique sender', ignoring ~/src and ~/bin
find . -name bin -prune -o -name src -prune -o -type f -print | xargs egrep -il '^From:.*unique sender'
List the files from the current directory tree that contain lines matching regular expression '^Subject:.*unique subject'
find . -type f -print | xargs grep -il '^Subject:.*unique subject'
List the files from the current directory tree that contain lines matching regular expression '^Subject:.*unique subject'
find . -type f -print0 | xargs -0 grep -il '^Subject:.*unique subject'
List the files in "archive.tar.gz"
gzip -l archive.tar.gz
List the files in the /etc directory tree containing text "old1.old2.co.com"
find /etc -type f -print | xargs grep -il old1\.old2\.co\.com
List the files in the /etc directory tree containing text '128.200.34.'
find /etc -type f -print | xargs grep -il '128\.200\.34\.'
list files in /usr modified after February 1 of the current year
find /usr -newermt "Feb 1"
list files in /usr modified after the time which /tmp/stamp$$ modified
find /usr -newer /tmp/stamp$$
List files in the current directory
find . \( ! -name . -prune \)
List files in the current directory
find . \( -path './*' -prune \)
List files in the current directory and below
find -ls
List files in the current directory and below except for GIT files
find . -not -iwholename '*/.git/*'
List files in the current directory and below that are exactly 1234 bytes in size
find . -size 1234c
List files in the current directory tree using echo
find . -exec echo {} ;
List files in the current directory tree which have permissions rwx for user and rw for group and others
find . -perm 766 -exec ls -l {} \;
List files in directory "one" and "two" that do not exist in the other
sort <(ls one) <(ls two) | uniq -u
List files in directory "one" that exist in directory "two"
sort <(ls one) <(ls two) | uniq -d
List file information of the full path of command "c++"
ls -ald `which c++`
List files larger than 10MB in the /var directory recursively
find /var/ -size +10M -exec ls -lh {} \;
List files larger than 10MB in the /var directory recursively
find /var/ -size +10M -ls
List files larger than 10MB under /var/log
find /var/log -size +10M -ls
List files larger than 10MB under /var/log /tmp that haven't changed in a month
find /tmp /var/tmp -size +30M -mtime 31 -ls
List files larger than 10MB under /var/log /tmp that haven't changed in a month
find /tmp /var/tmp -size +30M -mtime 31 -print0 | xargs -0 ls -l
List files named "accepted_hits.bam" in the current directory tree prefixing their names with "somecommand"
find `pwd` -name "accepted_hits.bam" | xargs -i echo somecommand {}
List files smaller than 9kB residing in the current directory and below
find . -size -9k
list files that the user does not have permissions to read, do not try to descend into directories that cannot be read.
find . ! -perm -g+r,u+r,o+r -prune
list files that the user does not have permissions to read, do not try to descend into directories that cannot be read.
find . ! -readable -prune
List files under $CURR_DIR which were modified, accessed or whose status were changed $FTIME ago replacing the $CURR_DIR path string to './'
find ${CURR_DIR} -type f \( -ctime ${FTIME} -o -atime ${FTIME} -o -mtime ${FTIME} \) -printf "./%P\n"
List files under current directory according to their size in descending order
find . -type f -exec ls -s {} \; | sort -n -r
List (in long list format with inode number) the file under the current directory that has the oldest modification time
find . -type f -ls | sort +7 | head -1
list the files with a name ending with '.mp3' or '.jpg' and beginning with 'foo'
find . \( -name '*.mp3' -o -name '*.jpg' \) -name 'foo*' -print
List files with C-style escape sequences for non-alphanumeric characters
ls -b
List first 20 files under current directory
find . -type f |xargs ls -lS |head -20
List first 5 files named 'something' that are found under current directory
find . -name something -print | head -n 5
List the full path of each directory under the current working directory
tree -dfi "$(pwd)"
List in detail all *.txt files in the current directory tree, omitting paths ./Movies/*, ./Downloads/*, and ./Music/*
find . -type f -name "*.txt" ! -path "./Movies/*" ! -path "./Downloads/*" ! -path "./Music/*" -ls
list in long format all files from / whose filename ends in "jbd", not descending into directories that are not readable while searching, and not descending into directories on other filesystems
find / -mount \! -readable -prune -o -path /dev -prune -o -name '*.jbd' -ls
List jobs and their process ids and print them by replacing newline with '^'
joblist=$(jobs -l | tr "\n" "^")
list jobs including its PIDs
jobs -l
List the largest file in long list format of all the files under the current directory
find . -type f -ls | sort -nrk7 | head -1 #unformatted
List the last entry of the numerically sorted list of all files and folders under "/foldername"
find /foldername | sort -n | tail -1
List the last modified file under "$DIR"
find $DIR -type f -printf "%T@ %p\n" | sort -n | cut -d' ' -f 2 | tail -n 1
List level 2 subdirectories of the current directory
find . -mindepth 2 -maxdepth 2 -type d -ls
List level 2 subdirectories of the current directory
find . -mindepth 2 -maxdepth 2 -type d -printf '%M %u %g %p\n'
Lists long format information about file '/bin/echo'.
ls -l /bin/echo
List the MD5 digest of all files under "teste1" and "teste2" sorted alphabetically
find teste1 teste2 -type f -exec md5 -r {} \; | sort
List the names of all file.ext files/directories under present working directory
find `pwd` -name "file.ext" -printf "%f\n"
List the names of the directories in current directory without going into sub-directories
find . -maxdepth 1 -mindepth 1 -type d -printf '%f\n'
List the names of the directories in current directory without going into sub-directories
find . -mindepth 1 -maxdepth 1 -type d -printf "%P\n"
List non-hidden regular files in the current directory tree that were last modified more than 500 days ago
find . -type f -not -name '.*' -mtime +500 -exec ls {} \;
List the number of occurrences of each unique character in "The quick brown fox jumps over the lazy dog" sorted from most frequent to least frequent
echo "The quick brown fox jumps over the lazy dog" | grep -o . | sort | uniq -c | sort -nr
List only the non-hidden empty files only in the current directory.
find . -maxdepth 1 -empty -not -name ".*"
List path/filename of all PHP files under current directory whose file type description or path/name contains "CRLF"
find . -type f -iname "*.php" -exec file "{}" + | grep CRLF
list PID of a group leader
jobs -lp
List recursively all files and directories in /var/www
find /var/www
list regular files under the current directory
find . -type f
list regular files under the current directory ending in .mbox putting a null between each file found
find . -type f -wholename \*.mbox -print0
list regular files under the user's home directory that are over 100KB and have not been accessed in over 30 days.
find $HOME -type f -atime +30 -size 100k
list regular file which file name is NOT end with '.html' in current directory in current directory
find . -type f -not -name "*.html"
List root's regular files with permissions 4000
find / -type f -user root -perm -4000 -exec ls -l {} \;
List subdirectories in the current directory
find . -maxdepth 1 -type d -exec ls -ld "{}" \;
List subdirectories in the current directory
find . -maxdepth 1 -type d -print0 | xargs -0 ls -d
list symbolic links under the directory "$directory"
find $directory -type l
list txt files older than 5 days or html files of any age, null separated
find . \( -name '*.txt' -mtime +5 -o -name '*.html' \) -print0
lists txt or html files older than 5 days, null separated
find . \( -name '*.txt' -o -name '*.html' \) -mtime +5 -print0
List the unique file extensions of all files under the current directory
find . -type f | grep -o -E '\.[^\.]+$' | sort -u
List unique MD5 digests of all files in the current directory ending in .txt
md5sum *.txt | cut -d ' ' -f 1 | sort -u
List the unique parent directories of all .class files found in the entire filesystem
find / -name *.class -printf '%h\n' | sort --unique
List the unique parent directories of all .class files found under "/root_path"
find /root_path -type f -iname "*.class" -printf "%h\n" | sort -u
List the unique second "/" delimited field of every line from standard input prefixed by the number of occurrences
cut -d/ -f1-2 | cut -d/ -f2- | sort | uniq -c
List unique series of 3 characters in file "$1" prefixed by the number of occurrences and sorted from most frequent to least frequent
fold -w3 "$1" | sort | uniq -c | sort -k1,1nr -k2
List the unique tab delimited field number "$FIELD" in all files, prefix with the number of occurrences, sort from most frequent to least frequent
cut -f $FIELD * | sort| uniq -c |sort -nr
List the z* links in the /usr/bin directory and the file to which it points to
find /usr/bin -type l -name "z*" -exec ls -l {} \;
List the z* links in the /usr/bin directory with inode information and the file to which it points to
find /usr/bin -type l -name "z*" -ls
Load keybindings from a file ~/.inputrc
bind -f ~/.inputrc
Locates 'gcc' executable file, strips last two parts of the full path, adds '/lib' to the end and saves result in 'libdir' variable.
libdir=$(dirname $(dirname $(which gcc)))/lib
Locate all `readme.txt' files under the home directory
find ~ -name readme.txt
Locate all *.csv files under the current directory tree
find . -name "*.csv"
Locate all *.csv files under the current directory tree
find . -name "*.csv" -print
Locate all *.csv files under the current directory tree separating the file names with zeroes
find . -name "*.csv" -print0
Locate all *.csv regular files under the current directory tree
find . -type f -name "*.csv"
Locate all *.txt files in the current directory tree
find . -name "*.txt"
Locate all .txt files in and below the current directory
find . -name "*.txt"
Locate all files "needle.txt"
find . -name "needle.txt"
Locate all files in the current directory and below that have "testfile" in their names regardless of the case
find -iname "*TESTFILE*"
Locate all files in the current directory and below that do not have "testfileasdf" in their names
find -not -name "*testfileasdf*"