nl
stringlengths
13
387
bash
stringlengths
1
532
Remove all Thumbs.db files from the current directory tree
find . -name Thumbs.db -exec rm {} \;
Remove all a.out, *.o, and core files under the current directory
find . \( -name a.out -o -name '*.o' -o -name 'core' \) -exec rm {} \;
Remove all broken symbolic links in /usr/ports/packages
find -L /usr/ports/packages -type l -delete
Remove all broken symlinks from the /usr/ports/packages directory tree
find -L /usr/ports/packages -type l -delete
Remove all but 5 last comma-separated fields from each line in 'data.csv'
cat data.csv | rev | cut -d, -f-5 | rev
Remove all characters except ";" and digits from standard input
tr -cd ";0-9"
Remove all core dump files from user's home directory
find ~/ -name 'core*' -exec rm {} \;
remove all core dump files from user's home directory
find ~/ -name 'core*' -exec rm {} \;
remove all the core files in the current directory
/bin/find -name "core" — exec rm {} \;
remove all the core files in the home folder
find /home -name core -exec rm {} \;
remove all the core files in the temp file after user confirmation
find /tmp -name core -type f -print0 | xargs -0 /bin/rm -i
Remove all CVS directories from the current directory tree
find . -name 'CVS' -type d -exec rm -rf {} \;
Remove all CVS directories in the current directory tree
find . -type d -name CVS -exec rm -r {} \;
Remove all directories called "test" from the /path/to/dir directory tree
find /path/to/dir -name "test" -type d -delete
Remove all directories called "test" from the /path/to/dir directory tree
find /path/to/dir -name "test" -type d -exec rm -rf {} \;
Remove all directories called "test" from the current directory tree
find -name "test" -type d -delete
Remove all directories called "test" from the current directory tree
find -path "*/test" -type d -delete
Remove all directories called "test" from the current directory tree
find -path "*/test/*" -delete
Remove all directories called "test" from the current directory tree
find . -name test -type d -exec rm -r {} +
Remove all directories called "test" from the current directory tree
find . -name test -type d -exec rm -r {} \;
Remove all directories called "test" from the current directory tree
find . -name test -type d -print0|xargs -0 rm -r --
Remove all directories found in directory tree $LOGDIR that were modified more than 5 days ago
find $LOGDIR -type d -mtime +5 -exec rm -f {} \;
Remove all empty directories under the current directory and below
find ./ -type d -size 0c -print | xargs rmdir
Remove all empty files in /tmp/ and below
find /tmp -type f -empty -print | xargs rm -f
Removes all empty folders that ends with any-cased '*.bak' under '/Users/' path.
find /Users -type d -iname '*.bak' -print0 | xargs -0 rmdir
Removes all empty folders under '/path/to/the/folder' path.
find /path/to/the/folder -depth -type d -print0 | xargs -0 rmdir
Removes all empty folders under current folder.
find . -type d -empty -exec rmdir "{}" \;
Removes all empty folders under current folder.
find . -type d -exec rmdir {}\;
Removes all empty folders under current path, aged between 'first' and 'last' timestamps.
find . -newer first -not -newer last -type d -print0 | xargs -0 rmdir
Removes all empty folders under path '/thepath', printing info message on each operation.
find /thepath -type d -empty -print0 | xargs -0 rmdir -v
Removes all empty folders with modification time more that 10 minutes ago from $homeDirData folder.
find $homeDirData -type d -mmin +10 -print0 | xargs -0 rmdir
Removes all empty folders within $DELETEDIR folder.
find "$DELETEDIR" -mindepth 1 -depth -type d -empty -exec rmdir "{}" \;
Remove all empty regular files under the current directory and below
find ./ -type f -empty -print0 | xargs -0 rm
Remove all empty regular files under the current directory and below
find ./ -type f -size 0c -print | xargs rm
Remove all empty sub-directories under current directory
find . -depth -type d -empty -exec rmdir {} \;
Remove all files 'a.out' and *.o in the home directory tree that were accessed more than 7 days ago
find $HOME \( -name a.out -o -name '*.o' \) -atime +7 -exec rm {} \;
Remove all files and directories in the /home directory tree whose names are "Trash"
find /home -name Trash -exec rm {} \;
Remove all files and directories in the current directory by answering with "y" to all prompts
yes | /bin/rm -i *
Remove all files/directories in the current directory without '.git' and '.gitignore'
find -mindepth 1 -depth -print0 | grep -vEzZ '(\.git(/|$)|/\.gitignore$)' | xargs -0 rm -rvf
Remove all files and directories under '/home/foo' directory tree that match with one of the name patterns '.DS_Store', '._.DS_Store' , '._*', '.TemporaryItems' or '.apdisk'
find /home/foo \( -name '.DS_Store' -or -name '._.DS_Store' -or -name '._*' -or -name '.TemporaryItems' -or -name '.apdisk' \) -exec rm -rf {} \;
Removes all files but 5 newest ones from current folder.
ls -tp | grep -v '/$' | tail -n +6 | tr '\n' '\0' | xargs -0 rm --
Removes all files but 5 newest ones from current folder.
ls -tp | grep -v '/$' | tail -n +6 | xargs -I {} rm -- {}
Remove all files except the ones listed in "MANIFEST"
find -type f -printf %P\\n | sort | comm -3 MANIFEST - | xargs rm
Remove all files from the current directory tree whose names contain whitespaces
find . -name "* *" -exec rm -f {} \;
Remove all files from the current directory tree whose names end in "~"
find -iname '*~' | xargs rm
Remove all files from the current directory tree whose names do not end with ".tex" or ".bib"
find . | egrep -v "\.tex|\.bib" | xargs rm
Remove all files from the current directory tree whose names do not match regular expression "excluded files criteria"
find . | grep -v "excluded files criteria" | xargs rm
Removes all files from current folder but 5 newest ones.
ls -tr | head -n -5 | xargs rm
Removes all files from current folder but 5 newest ones, filtering out directories from initial search.
ls -tp | grep -v '/$' | tail -n +6 | xargs -d '\n' rm --
Remove all files from the system whose path names contain "GUI"
find / -type f -print0 | xargs -0 grep -liwZ GUI | xargs -0 rm -f
Remove all files in the $backup_path directory recursively that were last modified more than 30 days ago
find $backup_path/* -mtime +30 -exec rm {} \;
Remove all files in the /myfiles directory tree that were accessed at least 30 days ago
find /myfiles -atime +30 -exec rm {} ;
Remove all files in and below the current directory whose names begin with "not"
find . -name not\* -print0 | xargs -0 rm
Remove all files in and below the current directory whose names begin with "not"
find . -name not\* | tr \\n \\0 | xargs -0 rm
Remove all files in and below the current directory whose names begin with "not"
find . -name not\* | xargs -d '\n' rm
Remove all files in the current directory tree that have the name "abc.xxx"
find . -name abc.xxx -exec rm {} \;
remove all the files in current folder which have the extension "DS_Store"
find . -name ".DS_Store" -exec rm {} \;
remove all the files in the current folder which have not been changed in the last 30*24 hours
find ./ -ctime +30 -type f -exec rm -f {} \;
remove all the files in the current folder which have not been modified in the last 10 days
find . -mtime +10 | xargs rm
remove all the files in the current working directory which have a specifc inode number
find . -inum $inum -exec rm {} \;
remove all the files in the folder "myfiiles" which have not been accessed in the last 30*24 hours
find /myfiles -atime +30 -exec rm {} ;
remove all the files in the present directory which have space in their name.
find . -name "* *" -exec rm -f {} \;
remove all the files in the present directory which have special characters in their name and do not search in the sub directories of the current folder.
find . -name '*[+{;"\\=?~()<>&*|$ ]*' -maxdepth 0 -exec rm -f '{}' \;
Remove all files in the ~/backups/mydatabasename directory recursively that were last modified more than 30 days ago
find ~/backups/mydatabasename/* -mtime +30 -exec rm {} \;
Remove all files last modified more than 10 days ago from the current directory tree
find . -mtime +10 | xargs rm
Removes all files like '*.bak' in a current folder, and prints messages about what is being done.
rm -v *.bak
Removes all files like 'A*.pdf' from current folder without prompting.
rm -f A*.pdf
Remove all files matching the pattern *[+{;"\\=?~()<>&*|$ ]* under current directory
find . -name '*[+{;"\\=?~()<>&*|$ ]*' -exec rm -f '{}' \;
Remove all files named "filename" from the current directory tree, ignoring directory "FOLDER1"
find . -name FOLDER1 -prune -o -name filename -delete
Remove all files named tmp or ending in .xx that have not been accessed for seven or more 24-hour periods
find / \( -name tmp -o -name '*.xx' \) -atime +7 -exec rm {} \;
Remove all files on the system that have been changed within the last minute
find / -newerct '1 minute ago' -print | xargs rm
remove all files that's older than 30 days in '/tmp'
find /tmp -type f -mtime +30 -exec rm -f {} \;
Remove all files that are not newer than Jul 01 by modification time
find /file/path ! -newermt "Jul 01" -type f -print0 | xargs -0 rm
Remove all files that contain the word GUI in entire file system
find / -type f -print0 | xargs -0 grep -liwZ GUI | xargs -0 rm -f
Remove all files under $DIR that were accessed more than 5 days ago
find "$DIR" -type f -atime +5 -exec rm {} \;
Remove all files under /home/user/Maildir/.SPAM/cur
find /home/user/Maildir/.SPAM/cur -type f -exec rm '{}' +
Remove all files under /home/user/Maildir/.SPAM/cur
find /home/user/Maildir/.SPAM/cur -type f -exec rm -f '{}' '+'
Remove all files under /home/user/Maildir/.SPAM/cur
find /home/user/Maildir/.SPAM/cur -type f | xargs rm
Remove all files under /myfiles that were accessed more than 30 days ago
find /myfiles -atime +30 -exec rm {} \;
Remove all files under current directory
find -exec rm '{}' +
Remove all files whose names begin with "no-such-thing" in the /home/peter directory tree
find /home/peter -name no-such-thing* |xargs rm
Remove all files whose names end with "~" in the /home/peter directory tree
find /home/peter -name *~ -print0 |xargs -0 rm
Remove all files whose names end with "~" in the /home/peter directory tree
find /home/peter -name *~ |xargs rm
Remove all files whose names start with spam-
find . -name 'spam-*' | xargs rm
Remove all files with '.js' extension from the 'js' directory tree
find ./js/ -type f -name "*.js" | xargs rm -f
Remove all files with the .c extension in the current directory tree
find . -name "*.c" -print0 | xargs -0 rm -rf
Remove all files with the .c extension in the current directory tree
find . -name "*.c" | xargs rm -rf
Remove all files with a txt extension under current directory
find . -type f -name "*.txt" -exec rm {} \; -print
Remove all files with a txt extension under current directory
find . -type f -name "*.txt" -print|xargs rm
remove all the files with the name "Trash" in the folder /home
find /home -name Trash -exec rm {} \;
Remove all libEGL* files from the current directory tree
find . -name libEGL* | xargs rm -f
Removes all listed folders with content in sudo mode.
sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp /opt/local/bin/node opt/local/include/node /opt/local/lib/node_modules
remove all the pdf files in the current folder and do not delete those in the sub folders
find . -name "*.pdf" -maxdepth 1 -print0 | xargs -0 rm
remove all the permissions for others to all the files in the current folder which have read,write,execute access to users,group and others.
find * -perm 777 -exec chmod 770 {} \;
Remove all regular files found in and below /path
find /path -type f -exec rm '{}' +
Remove all regular files found in and below /path
find /path -type f -exec rm '{}' \;
Remove all regular files found in and below /path
find /path -type f -print | xargs rm
Remove all regular files from the current directory tree except textfile.txt, backup.tar.gz, script.php, database.sql, info.txt
find . -type f ! -regex ".*/\(textfile.txt\|backup.tar.gz\|script.php\|database.sql\|info.txt\)" -delete
Remove all regular files from the current directory tree that were modified between August 10th and August 17th
find . -type f -newermt "Aug 10" ! -newermt "Aug 17" -exec rm {} \;
Remove all regular files from the current directory tree whose names do not end with "ignore1" or "ignore2"
find . -type f -not -name '*ignore1' -not -name '*ignore2' | xargs rm