nl
stringlengths
13
387
bash
stringlengths
1
532
display all the normal/regular files in the current folder which are empty
find . -type f -empty
display all the regular/normal files in the current folder which are modified after a file
find . -type f -newer "$FILE"
display all regular/normal files in the current folder which are not accessed in the last 7*24 hours
find . -type f -atime +7
display all the regular/normal files in current folder which have been modified exactly 60 minutes before
find . -mmin 60 -type f
display all the regular files in the current folder which dont not have the permission 777
find . -type f ! -perm 777
display all normal/regular files in current folder which have readable permission
find . -type f -readable
display all regular/normal files in the current folder with the name dummy
find -type f -name dummy
display all the normal/regular files in the directory FOLDER1
find FOLDER1 -type f -print0
display all normal/regular files in the folder "$ORIG_DIR"
find "$ORIG_DIR" -name "*" -type f
display all regular/normal files in the folder "dir" and display the filename along with file size
find dir -type f -printf "f %s %p\n"
display all normal/regular files in the folder "pathfolder"
find pathfolder -type f
display all regular/normal files in the folder /Users/david/Desktop/
find /Users/david/Desktop/-type f
display all the regular/normal files in the folder /path/ which have not been modified today ( from day start ie, 00:00 )
find /path/ -type f -daystart -mtime +0
display all regular/normal files in the folder Symfony
find Symfony -type f
display all normal/regular files or directories in the folder "$ORIG_DIR"
find "$ORIG_DIR" -name "*" -type d -o -name "*" -type f
display all regular/normal files which have been modified in the last 30 minutes
find -type f -and -mmin -30
display all the regular/ normal files in a folder
find src/js -type f
display all scala files in the directory "src/main"
find . -path "*src/main*" -type f -iname "*\.scala*"
display all scala files in the directory "src/main"
find . -type f -path "*src/main/*\.scala"
display all scala files in the directory "src/main"
find . -type f -regex ".*src/main.*\.scala$"
display all the soft links in a folder which are not broken
find -L /target ! -type l
display all soft links in current folder
find . -type l
display all sqlite files in the current directory along with their timestamp
find ./ -name "*.sqlite" -printf '%Tc %p\n'
display all symbolic links in the folder "myfiles"
find /myfiles -type l
display all symbolic links in the folder "myfiles" and follow them
find -L /myfiles
Display all symlinks and their targets in the current directory
find -P . -maxdepth 1 -type l -exec echo -n "{} -> " \; -exec readlink {} \;
Display all symlinks and their targets in the current directory tree
find -P . -type l -exec echo -n "{} -> " \; -exec readlink {} \;
display all the tex files in the current folder
find . -name "*.tex"
display all the tex files in the current folder
find . -name \*.tex
display all the text and pdf files in the current folder
find . -regex ".*\(\.txt\|\.pdf\)$"
display all the text files and pdf files in the current folder
find . \( -name "*.txt" -o -name "*.pdf" \)
display all the text files from the current folder and skip searching in skipdir1 and skipdir2 folders
find . \( -name skipdir1 -prune , -name skipdir2 -prune -o -name "*.txt" \) -print
display all text files in current folder
find . -name "*.txt"
display all text files in current folder
find . -name ".txt"
display all text files in the current folder
find . -type f -name "*.txt"
display all the text files in the current folder
find . -name "*.txt" -print
display all the text files in current folder
find . -name "*.txt"
display all the text files in current folder
find . -name "*.txt" -printf "%f\n"
display all the text files in the current folder
find -name “*.txt”
display all the text files in the current folder and do not search in the bin directory
find . -name bin -prune -o -name "*.txt" -print
display all the text files in the current folder except readme files
find . -type f -name "*.txt" ! -name README.txt -print
display all the text files in the current folder which have been modified in the last half minute ( 30 seconds )
find . -mmin 0.5
display all text files in the folder /home/you which have been modified in the last 60*24 hours(case insensitive search)
find /home/you -iname "*.txt" -mtime -60 -print
display all text files in the folder /tmp/1 excluding those which do not have spaces in their names
find /tmp/1 -iname '*.txt' -not -iname '[0-9A-Za-z]*.txt'
display all text files in the folder /user/directory which have been modified in today
find /user/directory/* -name "*txt" -mtime 0 -type f
display all the text files in the home folder
find /home -name "*.txt"
display all the text files in the home folder ( case insensitive search )
find /home -iname "*.txt"
display all the text files in the temp folder
find /tmp -name *.txt
display all text, mpg, jpg files in the folder /Users/david/Desktop
find /Users/david/Desktop -type f \( -name '*.txt' -o -name '*.mpg' -o -name '*.jpg' \)
display all the trace files (".trc") from the folder $DBA/$ORACLE_SID/bdump/ which have not been accessed in the last 7*24 hours
find $DBA/$ORACLE_SID/bdump/*.trc -mtime +7
display all the users in the current folder that belong to the group "sunk"
find . -type f -group sunk
display all the users in the current folder which do not belong to the user root
find . ! -user root
Display an amount of processes running with a certain name
ab=`ps -ef | grep -v grep | grep -wc processname`
display the base name(name without extension) of all the ".flac" files in the current folder
find . -name "*.flac" -exec basename \{\} .flac \;
Display the biggest file sizes only
find -type f -exec du -Sh {} + | sort -rh | head -n 5
Displays calendar for a previous, current and next month.
cal -3
Displays calendar of a previous, current and next month for December of 2120 year.
cal -3 12 2120
display the change owner command for all the regular files in the current folder.
find . -type f -exec echo chown username {} \;
display the commands to force delete all jpg files in current directory which are less than 50KB and do not search in the sub directories
find . -maxdepth 1 -name "*.jpg" -size -50k | xargs echo rm -f
Display the contents of "file" formatted into a table, removing duplicate lines where the first 12 characters are duplicates, and display the number of occurrences at the beginning of each line.
column -t file | uniq -w12 -c
Display the contents of "myfile" located in the current directory.
cat myfile
Display the contents of "text"
cat text
display the contents of all the files in the current folder which start with test ( case insensitive search )
find . -iname '*test*' -exec cat {} \;
display the contents of all the files in the current folder which start with test (case insensitive search)
find . -iname '*test*' -exec cat {} \;
display the contents of all the text files in the current directory
find . -name '*.txt' -exec cat {} \;
Display the content of file "f" in home directory if it exists and is executable
cat `which ~/f`
display the count of all the directories in the current folder
find . -type d –print | wc -l
display the count of all the directories present in a folder
find /mount/point -type d | wc -l
display the count of all the files in the current folder
find . -print | wc -l
display the count of all normal/regular files in current directory
find . -type f | wc -l
display the count of number html files in the current folder
find . -name "*.html" -print | xargs -l -i wc {}
display the count of number of files in the current folder
find | wc -l
Displays the count of of each unique line read from standard input
sort | uniq -c
Display the count of regular files for which the owner has read and execute permission under 'home/magie/d2' directory tree
find home/magie/d2 -type f -perm -u+rx | wc -l
display the count of regular/normal files in the current folder do not search in sub directories
find . -maxdepth 1 -type f |wc -l
Display the count of regular files under 'home/magie/d2' directory tree which have execute permission to all the users
find home/magie/d2 -type f -perm +111 | wc -l
display the count of total number of empty files in the current folder
find . -type f -empty | wc -l
display the count of total number of non empty files in the current folder
find . -type f -not -empty | wc -l
display the count of total number of text files in the folder /home/you which have been modified in the last 60*24 hours
find /home/you -iname "*.txt" -mtime -60 | wc -l
Display the current directory tree except files or directories starting with "3rd"
tree -I '3rd*'
(Linux specific) Display current running kernel's compile-time config file.
cat /boot/config-`uname -r`
Display current system's kernel name, kernel release and version, and machine architecture
uname -srvm
Display differences between /destination/dir/1 and /destination/dir/2 excluding files that match any pattern in file "exclude.pats".
diff /destination/dir/1 /destination/dir/2 -r -X exclude.pats
Display differences between /destination/dir/1 and /destination/dir/2 excluding files with names ending with extensions '.foo', '.bar' and '.baz'
diff -x '*.foo' -x '*.bar' -x '*.baz' /destination/dir/1 /destination/dir/2
Display differences between /destination/dir/1 and /destination/dir/2 excluding XML files.
diff /destination/dir/1 /destination/dir/2 -r -x *.xml
Display differences between /tmp/test1 and /tmp/test2.
diff /tmp/test1 /tmp/test2
Display differences between /tmp/test1 and /tmp/test2 side-by-side.
diff -y /tmp/test1 /tmp/test2
Display differences between a and b side-by-side
diff -y a b
Display differences between directories dir1 and dir2.
diff -r dir1 dir2
Display differences between directories dir1 and dir2.
diff -r dir1/ dir2/
Display differences between directories dir1 and dir2, treating absent files as empty.
diff -Naur dir1/ dir2/
Display differences between directories repos1 and repos2, ignoring changes due to tab expansion, white spaces and treating absent files as empty.
diff -ENwbur repos1/ repos2/
Display differences between files "a.txt" and "b.txt" side-by-side and do not output common lines.
diff -a --suppress-common-lines -y a.txt b.txt
Display differences between files dir1.txt and dir2.txt.
diff dir1.txt dir2.txt
Display difference between one.txt and two.txt side-by-side.
diff -y one.txt two.txt
Display differences in "/tmp/ksh-9725.log" when compared to "/tmp/ksh-9781.log"
diff /tmp/ksh-{9725,9781}.log | grep ^\<
display the directory name along with the modified time for all the files /var
find /var -maxdepth 2 -type d -printf "%p %TY-%Tm-%Td %TH:%TM:%TS %Tz\n"
Display the entire file system in a tree-like format
tree /
display the files along with the size of all the files in the current which are bigger than 100MB
find . -size +100M -exec ls -s {} \;
Display the files/directories under current directory tree matching the regex '/$prefix$ypatt' where $prefix and $ypatt expands in the current shell
find . -print | grep "/${prefix}${ypatt}"