nl
stringlengths 13
387
| bash
stringlengths 1
532
|
---|---|
Delete recursively empty files named 'bad'
|
find . -name bad -empty -delete
|
display ten files in the current directory
|
find | head
|
display all files in current folder which have not been modified in the last 60 minutes
|
find -mmin +60
|
display all the files in the home folder that have been modified in the last 24 hours
|
find $HOME -mtime -1
|
display all the regular/normal files in the entire file system
|
find / -type f -exec echo {} \;
|
Display detailed usage help of the 'cp' (copy) command.
|
cp --help
|
Display differences between list of files in /bin and /usr/bin.
|
diff <(ls /bin) <(ls /usr/bin)
|
display the list of all the text files present in the current directory excluding the search in certain paths.
|
find . -type f -name "*.txt" ! -path "./Movies/*" ! -path "./Downloads/*" ! -path "./Music/*" -ls
|
Display system information: kernel name, hostname, kernel release and version, machine architecture, processor type, hardware platform, and operating system type.
|
uname -a
|
display the version of find
|
find --version
|
Execute the 'echo' command on each file from the current directory tree individually
|
find . -exec echo {} \;
|
Extract the second-to-last slash-separated path component, ie. "90_2a5" in this case.
|
echo 'test/90_2a5/Windows' | xargs dirname | xargs basename
|
Find *.html files in the current directory tree that were last modified more than 7 days ago
|
find . -mtime +7 -name "*.html" -print
|
Find the 5 largest regular files in the Downloads folder of tecmint's home directory.
|
find /home/tecmint/Downloads/ -type f -exec du -Sh {} + | sort -rh | head -n 5
|
Find a directory named 'project.images' in the entire filesystem
|
find / -type d -name "project.images"
|
Find all $2 files in $1 path excluding /proc and search for the regex expanded by $3 in those files
|
find $1 -path /proc -prune -o -name "$2" -print -exec grep -Hn "$3" {} \;
|
Find all *.jpg files and copy them to /
|
find / -type f -name *.jpg -exec cp {} . \;
|
Find all *stat files/directories under /usr
|
find /usr -name *stat
|
Find all .c, .h files in the current directory tree and search them for string "expr"
|
find . -name '*.[ch]' | xargs grep -E 'expr'
|
Find all .txt files in the user's home directory and below.
|
find ~/ -name '*.txt'
|
Find all 777 permission files and use chmod command to set permissions to 644
|
find / -type f -perm 0777 -print -exec chmod 644 {} \;
|
Find all directories containing 'linux' in their names under '/root' directory tree
|
find /root -type d -iname "*linux*"
|
find all directories in the current directory
|
find . -type d
|
find all the directories in the current folder which have been modified in 24 hours and move them to the folder /path/to/target-dir
|
find . -depth -type d -mtime 0 -exec mv -t /path/to/target-dir {} +
|
find all the directories in the current folder which have been modified in 24 hours and move them to the folder /path/to/target-dir
|
find . -type d -mtime -0 -exec mv -t /path/to/target-dir {} +
|
find all the directories in the current folder which have been modified in 24 hours and move them to the folder /path/to/target-dir
|
find . -type d -mtime -0 -print0 | xargs -0 mv -t /path/to/target-dir
|
find all the directories in the current folder which have been modified in 24 hours and move them to the folder /path/to/target-dir
|
find . -type d -mtime 0 -exec mv {} /path/to/target-dir \;
|
find all the directories in the entire file system whose size is greater than 50KB
|
find / -type d -size +50k
|
Find all empty files under a certain path
|
find /tmp -type f -empty
|
Find all Executable files in the file system
|
find / -perm /a=x
|
Find all files and directories containing "disc" in their names
|
find . -name *disc*
|
Find all files/directories in entire file system more than 700 Megabytes
|
find / -size +700M
|
Find all files/directories named 'FindCommandExamples.txt' under '/root' directory tree
|
find /root -name FindCommandExamples.txt
|
Find all files/directories named 'file1' under current directory tree
|
find . -name file1 -print
|
Find all files/directories named file1 in maximum 2 levels down the current directory
|
find -maxdepth 2 -name file1
|
Find all files, folders, symlinks, etc matching pattern "*.php" in the current directory recursively
|
find . -name \*.php
|
Finds all files having text "texthere" recursively in a current folder, and precedes found string with string number in file and file name.
|
find -type f -exec grep -Hn "texthere" {} +
|
find all the files in the current folder which which have been modified yesterday and day before yesterday and whose name is of length 1
|
find . -name \? -daystart -mtime +0 -mtime -3
|
Find all the files in entire file system which are accessed 50 days back
|
find / -atime 50
|
Find all the files in file system which are accessed 50 days back
|
find / -atime 50
|
Find all the files in file system which are accessed in last 1 hour
|
find / -amin -60
|
find all files in the file system with the permissions 777 and having the word "filename" in their name.
|
find / -perm 777 -iname "filename"
|
find all the files in the filesystem which do not belong to any group
|
find / -nogroup -print
|
Find all files in the home directory tree that are owned by another user
|
find ~ ! -user ${USER}
|
find all files in the home folder that are modified in the last 24 hours
|
find $HOME -mtime -1
|
Find all files named "something" in the current folder and below and run them through the ls -l command, one by one.
|
find . -name something -exec ls -l {} \;
|
Find all files named "test2" in the current directory tree
|
find -name test2
|
Find all the files named 'vimrc' anywhere on the system
|
find / -name vimrc
|
Find all files that contain the case insensitive regex 'stringtofind' in maximum 1 level down the / directory without descending into other partitions
|
find / -maxdepth 1 -xdev -type f -exec grep -li stringtofind '{}' \;
|
Find all the files that end with the extension “.java” in the current directoy tree
|
find . -name "*.java"
|
Find all files that have the SUID bit set
|
find / -perm -u+s -print
|
find all the files that have the word "fstab" in their name in a folder
|
find /etc -name *fstab*
|
Find all files under current directory
|
find -type f
|
Find all files under current directory
|
find . -type f
|
Find all files under current directory
|
find . -type f -print
|
Find all files under current directory that were modified less than 1 day ago
|
find -mtime -1
|
Find all files under current directory whose status was changed less than 3 days ago and show last 5 lines of output
|
find . -type f -ctime -3 | tail -n 5
|
Find all the files whose name is FindCommandExamples.txt in the current working directory
|
find /root -name FindCommandExamples.txt
|
Find all the files whose permissions are 777
|
find . -type f -perm 0777 -print
|
Find all files with the name "MyProgram.c" in the current directory and its sub-directories while ignoring the case of the file name.
|
find -iname "MyCProgram.c"
|
Find all file.ext files/directories under current directory with "FooBar" in their paths and copy them into the current directory
|
find . -name "file.ext"| grep "FooBar" | xargs -i cp -p "{}" .
|
Find all foo.mp4 files in the current directory tree
|
find ./ -name "foo.mp4" -exec echo {} \;
|
Find all hidden files
|
find /tmp -type f -name ".*"
|
find all the log files in the file system which are present in the current partition
|
find / -xdev -name "*.log"
|
find all the perl files in the current folder and search for a pattern
|
find . -name '*.pl' | xargs grep -L '^use strict'
|
Find all readme.txt files/directories under your home directory
|
find ~ -name readme.txt
|
Find all regular files with '.txt' extension excluding 'README.txt' files under current directory tree
|
find . -type f -name "*.txt" ! -name README.txt -print
|
Find all regular files with 755 permission under current directory tree and change their permission to 644
|
find . -type f -perm 755 -exec chmod 644 {} \;
|
Find all SGID files in entire file system
|
find / -perm +2000
|
Find all SGID files in entire file system
|
find / -perm +g=s
|
Find all symbolic links containg 'vim' in their names under '/usr/bin' directory tree
|
find /usr/bin -name '*vim*' -type l
|
find all the text files in the current folder
|
find . -name "*.txt" -print
|
find all txt files under the current folder except ./misc folder
|
find . -path ./misc -prune -o -name '*.txt' -print
|
find and delete all the empty directories in the current folder and all its sub directories too
|
find . -depth -empty -type d -delete
|
find and delete all the files in the entire file system whose size is greater than 100MB.
|
find / -size +100M -exec rm -rf {} \;
|
Find directories modified in last 7 days
|
find . -mtime -7 -type d
|
Find every vim undo file in the current directory tree
|
find -type f -iname '*.un~'
|
Find file `foo.bar' and delete it
|
find /home -name foo.bar -type f -exec rm -f "{}" ';'
|
Find files/directories greater than 10MB in your home directory
|
find ~ -size +10M
|
Find files and directories in the /tmp/ tree that contain spaces in their names and replace those spaces with underscores
|
find /tmp/ -depth -name "* *" -execdir rename 's/ /_/g' "{}" \;
|
Find files/directories in entire file system with at least 644 permission
|
find / -perm -644
|
Find files/directories named 'aaa.txt' under current directory tree
|
find . -name aaa.txt
|
Find files and directories that are at least seven levels of nesting in the directory /usr/src excluding CVS directory
|
find /usr/src -name CVS -prune -o -depth +6 -print
|
Find files/directories that is under group 'root' or have no group and set their group to 'apache'
|
find /var/www -group root -o -nogroup -print0 | xargs -0 chown :apache
|
Find files/directories that does not have write permssion for group or others
|
find /path ! -perm -022
|
Find files in the /home/user directory tree changed exactly 10 minutes ago
|
find /home/user/ -cmin 10 -print
|
Find files in the current directory recursively that are not readable by all
|
find -type f ! -perm -444
|
Find files in the current directory tree that are named "some_pattern" and move them to directory "target_location"
|
find . -name some_pattern -print0 | xargs -0 -i mv {} target_location
|
Find files in the current directory tree whose status was changed within the last 60 minutes
|
find . -cmin -60
|
Find files modified within the past 24 hours
|
find . -mtime 0
|
Find files named tecmint.txt of owner root in the entire file system
|
find / -user root -name tecmint.txt
|
find the file with inode $inum under the current directory and delete it
|
find . -inum $inum -exec rm {} \;
|
Find out all hard links in the /home directory to file1
|
find /home -xdev -samefile file1
|
find the regular/normal file "myfile" in the folder /root
|
find /root/ -name myfile -type f
|
Find regular files larger than 500MB in the current directory tree
|
find . -type f -size +500M
|
Find regular files modified within the last ten minutes under /etc
|
find /etc -type f -mmin -10
|
find regular which case-insensitive name is foo in current directory
|
find . -iname foo -type f
|
Find writable files in the current directory tree
|
find . -writable
|
Fix files to default permissions 755
|
find . -type d -exec chmod 755 {} \;
|
Give all files in the /path/to/base/dir tree read privileges
|
find /path/to/base/dir -type f -exec chmod 644 {} +
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.