nl
stringlengths
13
387
bash
stringlengths
1
532
Recursively removes all files and folders like 'FILE-TO-FIND' from current folder.
find . -name "FILE-TO-FIND" -exec rm -rf {} +
Recursively removes all files and folders like 'FILE-TO-FIND' from current folder.
find . -name "FILE-TO-FIND" -exec rm -rf {} \;
Recursively removes all files and folders named '.svn' in a current folder.
find . -name .svn -exec rm -rf {} +
Recursively removes all files and folders named '.svn' in a current folder.
find . -name .svn -exec rm -rf {} \;
Recursively removes all files and folders named '.svn' in a current folder.
find . -name .svn | xargs rm -fr
Recursively removes all files and folders named '.svn' in a current folder.
find . -name .svn |xargs rm -rf
Recursively removes all files and folders named '.svn' in a current folder, handling content of removed folder before folder inself.
find . -depth -name .svn -exec rm -fr {} \;
Recursively removes all files and folders that match pattern '/usr/local/{lib/node{,/.npm,_modules},bin,share/man}/npm*'
rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/npm*
Recursively removes all files in a 'path' folder but 'EXPR' files.
find [path] -type f -not -name 'EXPR' | xargs rm
Recursively removes all files like "(__pycache__|\.pyc|\.pyo$)" in a current folder.
find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
Recursively removes all files like '*.pyc' in a current folder, printing info message about each action.
find . -name "*.pyc" | xargs -I {} rm -v "{}"
Recursively removes all files like '*.pyc' of '*.pyo' in a current folder without prompting.
find . -type f -name "*.py[c|o]" -exec rm -f {} +
Recursively removes all files like '*.r*' in current folder and removes folders with such files if they become empty.
find ./ -type f -name '*.r*' -delete -printf "%h\0" | xargs -0 rmdir
Recursively removes all files like '*.xyz' in a current folder.
find . -name \*.xyz -exec rm {} \;
Recursively removes all files like '.DS_Store' from current folder.
rm `find ./ -name '.DS_Store'` -rf
Recursively removes all files like '._*' from current folder.
find . -name "._*" -print0 | xargs -0 rm -rf
Recursively removes all files like '4' under folder './a' and removes folders with such files if they become empty.
find a -type f -name '4' -delete -printf "%h\0" | xargs -0 -r rmdir
Recursively removes all files like '_*' and '.DS_Store' from /var/www/html/ folder.
rm /var/www/html/**/_* /var/www/html/**/.DS_Store
Recursively removes all files with name like "*.war" in /home/ubuntu/wars folder.
find /home/ubuntu/wars -type f -name "*.war" -exec rm {} \\;
Recursively removes all folders named '.svn' in a current folder.
find . -type d -name .svn -print0|xargs -0 rm -rf
Recursively rename all files under /your/target/path replacing 'special' with 'regular' - all file/diretory names may not include spaces, and directory names containing such files may not contain the word 'special' in their name.
find /your/target/path/ -type f -exec rename 's/special/regular/' '{}' \;
Recursively search for "string here" and write the output to the console followed by the number of matched lines
grep -r "string here" * | tee >(wc -l)
Recursively search for all directories containing "foo" (case insensitive) under the current directory, renaming them to replace "foo" (case insensitive) with "Bar"
find . -type d -iname '*foo*' -depth -exec rename 's@Foo@Bar@gi' {} +
Recursively search for all files not ending in ".xml" under the current directory, append ".xml" to the end of each file name
find . -type f \! -name '*.xml' -print0 | xargs -0 rename 's/$/.xml/'
Recursively search for all files with names ending with "_test.rb", renaming them to end with "_spec.rb".
find . -name "*_test.rb" | xargs rename s/_test/_spec/
Recursively search for all files with names ending with "_test.rb", renaming them to end with "_spec.rb", using at most 1000000 characters per command.
find . -name "*_test.rb" | xargs -s 1000000 rename s/_test/_spec/
Recursively search for all files with names ending with "_test.rb", renaming them to end with "_spec.rb", using at most 4 concurrent processes.
find . -name "*_test.rb" | xargs -P 4 rename s/_test/_spec/
Recursively search for all regular files below directory "dir1" in currentd directory, and output the name of each, without any containing directories.
find ./dir1 -type f -exec basename {} \;
Recursively search through directory "test" in home directory, displaying names of all directories without full paths, ie. only the name part following the last slash of each directory.
find ~/test -type d -exec basename {} \;
Recursively set all permissions under "/folder" to 755
chmod 755 /folder -R
Recursively set all permissions under "/opt/lampp/htdocs" to 755
sudo chmod 755 -R /opt/lampp/htdocs
Recursively unzip files to stdout in "/some/dir/here" and search for "blah"
zcat -r /some/dir/here | grep "blah"
Remount "/" with read and write permission
mount / -o remount,rw
Remount "/" without writing in "/etc/mtab"
mount -n -o remount /
Remount "/dev/block/mtdblock3" on "/system" with read and write permission
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
Remount "/dev/block/mtdblock3" on "/system" with read only permission
mount -o remount,ro -t yaffs2 /dev/block/mtdblock3 /system
Remount "/dev/stl12" on "/system" as read and write
mount -o rw,remount /dev/stl12 /system
Remount "/dev/stl12" on "/system" as read only
mount -o ro,remount /dev/stl12 /system
Remount "/home/evgeny" with the "suid" flag set
sudo mount -i -o remount,suid /home/evgeny
Remount "/media/Working/" with a umask of 000
mount /media/Working/ -oremount,umask=000
Remount "/mnt/mountpoint" as read only
mount /mnt/mountpoint -oremount,ro
Remount "/mnt/mountpoint" with read and write permission
mount /mnt/mountpoint -oremount,rw
Remount "/path/to/chroot/jail/usr/bin" as read only
mount -o remount,ro /path/to/chroot/jail/usr/bin
Remount "/system" as read only
mount -o remount,ro /system
Remount "/system" with read only permission
mount -o remount,ro /system
Remount "extX" filesystem "/dev/hdaX" on "/" without writing in "/etc/mtab"
mount -n -o remount -t extX /dev/hdaX /
Remount "rfs" filesystem "/dev/stl12" on "/system" with read and write permission
mount -o rw,remount -t rfs /dev/stl12 /system
Remount "yaffs2" filesystem "/dev/block/mtdblk4" to "/system" as read only
mount -o ro,remount -t yaffs2 /dev/block/mtdblk4 /system
Remount the root file system with read and write permission
mount -o rw,remount -t rootfs /
Remount root filesystem "/"
mount -oremount /
Remount subtree "/outside" to "/inside" as a bind
mount /outside /inside -o bind
Remove the "123_" prefix from all filenames of .txt files in current directory.
find -name "123*.txt" -exec rename 's/^123_//' {} ";"
Remove the "123_" prefix from all filenames of .txt files in current directory.
rename 's/^123_//' *.txt
Remove "\n" from "test1\ntest2\ntest3" and search for "test1.*test3"
echo -e "test1\ntest2\ntest3" |tr -d '\n' |grep "test1.*test3"
Remove "_dbg" from all file or directory names under the current directory
rename _dbg.txt .txt **/*dbg*
Removes 'folderName', and removes all content within if 'folderName' is folder.
rm -rf folderName
Removes 'latest' folder if empty.
rmdir latest
Removes 5 oldest files in the current folder.
ls -t *.log | tail -$tailCount | xargs rm -f
Remove adjascent duplicate lines from file 'input' comparing all but last space-separated fields
rev input | uniq -f1 | rev
remove all the ".core" files in the file system
find / -name "*.core" -print -exec rm {} \;
remove all the ".core" files in the file system
find / -name "*.core" | xargs rm
Remove all "CVS" directories from the current directory tree, ignoring the case
find . -iname CVS -type d | xargs rm -rf
remove all the "core" files in the current folder which have not been changed in the last 4 days.
find . -name core -ctime +4 -exec /bin/rm -f {} \;
Remove all "core" files that were last changed more than 4 days ago from the current directory tree
find . -name core -ctime +4 -exec /bin/rm -f {} \;
Remove all "core" regular files in the /tmp/ directory tree
find /tmp -name core -type f -print | xargs /bin/rm -f
Remove all "work" directories residing in /usr/ports and below
find /usr/ports/ -name work -type d -print -exec rm -rf {} \;
Remove all 'a.out', '*.o', and 'core' files in the current directory tree
find . \( -name a.out -o -name '*.o' -o -name 'core' \) -exec rm {} \;
Remove all *.bak and *.backup files that were accessed last time more than 30 days ago
find . \( -name '*.bak' -o -name *.backup \) -type f -atime +30 -exec rm '{}' ';'
Remove all *.bak files under current directory
find . -type f -name \*.bak -print0 | xargs -0 rm -v
Remove all *.mp3 files in tmp directory but not in it's subdirectories
find tmp -maxdepth 1 -name '*.mp3' -maxdepth 1 | xargs -n1 rm
Remove all *.mp3 files in tmp directory but not in it's subdirectories
find tmp -maxdepth 1 -name '*.mp3' -maxdepth 1 | xargs rm
Remove all *.mp3 files in tmp directory but not in it's subdirectories
find tmp -maxdepth 1 -name *.mp3 -print0 | xargs -0 rm
Remove all *.mp3 files in tmp directory but not in it's subdirectories
rm `find tmp -maxdepth 1 -name '*.mp3'`
Remove all *.sql files in the $backup_path directory that were last modified more than 5 days ago
find $backup_path/*.sql -mtime +5 -exec rm -f {} \;
Remove all *.sql files in the $backup_path directory tree that were last modified more than 30 days ago
find $backup_path/* -name *.sql -mtime +30 -exec rm {} \;
Remove all *.swp files/directories under current directory
find . -name "*.swp"-exec rm -rf {} \;
Remove all *.swp files under current directory
find . -name "*.swp"|xargs rm
Remove all *.tmp files from the /tmp directory tree
find /tmp -name "*.tmp" -print0 | xargs -0 rm
Remove all *.tmp files from the /tmp directory tree
find /tmp -name "*.tmp" | xargs rm
Remove all *.txt files, except robots.txt, under the given directory modified more than 5 minutes ago
find /home/u20806/public_html -maxdepth 1 -mmin +5 -type f -name "*.txt" ! -name "robots.txt" -delete
Remove all *.txt files, except robots.txt, under the given directory modified more than 5 minutes ago
find /home/u20806/public_html -name "robots.txt" -o -maxdepth 1 -mmin +5 -type f -name "*.txt" -delete
Remove all *.txt files under the given directory modified more than 5 minutes ago
find /home/u20806/public_html -maxdepth 1 -mmin +5 -type f -name "*.txt" -delete
Remove all *bak files under current directory with confirmation prompt
find . -name '*bak' -exec rm -i {} \;
Remove all *~ files under current directory with confirmation prompt
find . -name '*~' -ok rm {} \;
Remove all .gz files in the current directory tree
find . -name '*.gz' -type f -printf '"%p"\n' | xargs rm -f
Remove all .mpg files in the /home/luser directory tree
find /home/luser -type f -name '*.mpg' -exec rm -f {} \;
Remove all .mpg files in the /home/luser directory tree
find /home/luser -type f -name '*.mpg' -print0 | xargs -0 rm -f
Remove all .mpg files in the /home/luser directory tree
find /home/luser -type f -name '*.mpg' | tr "\n" "\000" | xargs -0 rm -f
Remove all .mpg files in the /home/luser directory tree
find /home/luser -type f -name '*.mpg' | xargs rm -f
Remove all .php files in the /var/www/ directory
find /var/www/*.php -type f -exec rm {} \;
Remove all .sh files in the current directory tree whose names begin with "t"
find . -name "t*.sh" -exec rm -vf '{}' \;
Remove all .tmp files in and below /tmp
find /tmp -name "*.tmp" -print0 | xargs -0 rm
Remove all .tmp files in and below /tmp
find /tmp -name "*.tmp" | xargs rm
Remove all .txt files in and below the current directory
find . -name "*.txt" -delete
Remove all .txt files in and below the current directory
find . -name "*.txt" -exec rm {} +
Remove all .txt files in and below the current directory
find . -name "*.txt" -exec rm {} \;
Remove all .txt files in and below the current directory
find . -name "*.txt" -print0 | xargs -0 rm
Remove all .txt files in and below the current directory
find . -name "*.txt" | xargs rm
Remove all .txt files with spaces in names in and below the current directory
find -name "*\ *.txt" | xargs rm
remove all the DS_Store files in the current directory
find . -name .DS_Store -exec rm {} \;