nl
stringlengths
13
387
bash
stringlengths
1
532
Delete all directories found in $LOGDIR that are more than a work-week old
find $LOGDIR -type d -mtime +5 -exec rm -rf {} \;
Delete all directories under '.cache/chromium/Default/Cache' directory tree that are at least 1 level deep and are bigger than 100 MB in size
find .cache/chromium/Default/Cache/ -mindepth 1 -type d -size +100M -delete
Delete all directories under '.cache/chromium/Default/Cache/' directory tree that are bigger than 100MB and are at least 1 level deep
find .cache/chromium/Default/Cache/ -mindepth 1 -type d -size +100M -exec rm -rf {} \;
Delete all empty directories and directories that contain only empty directories under current directory
find -type d -empty -exec rmdir -vp --ignore-fail-on-non-empty {} +
Delete all empty directories in the "test" directory tree
find test -depth -type d -empty -delete
Delete all empty directories in the current directory tree
find -type d -empty -exec rmdir -vp --ignore-fail-on-non-empty {} +
delete all the empty directories in the current folder
find . -type d -empty -exec rmdir {} \;
Delete all empty directories in minimum 1 level down the directory 'directory'
find directory -mindepth 1 -type d -empty -delete
Delete all empty directories under root
find root -type -d -empty -delete
Delete all empty files and directories in the "test" directory tree
find test -depth -empty -delete
Delete all empty files/directories under test directory
find test -depth -empty -delete
delete all empty files in the current directory ( empty file = size 0 bytes )
find . -empty -exec rm '{}' \;
delete all the empty files in the current directory
find . -empty -exec rm {}\;
delete all the empty files in the current directory only if they are ok and the user has the permission to delete them
find . -empty -ok rm {}\;
Delete all empty files in the current directory tree
find . -type f -empty -delete
delete all the empty files(files with size 0 bytes) in the current folder
find . -empty -delete -print
delete all the empty in the current folder and all its sub directories
find . -depth -type d -empty -exec rmdir {} \;
delete all the empty in the current folder do not search in sub directories
find . -maxdepth 1 -type d -empty -exec rm {} \;
Delete all empty subdirectories in and below directory/
find directory -mindepth 1 -type d -empty -delete
Delete all files and directories
find -delete
Delete all files/directories in minimum 2 levels down the root directory
find root -mindepth 2 -delete
Delete all files/directories named 'file' under current directory tree
find -name file -delete
Delete all files/directories named 'sample' (case insensitive) under '/home/user/Series/' directory tree as super user
sudo find /home/user/Series/ -iname sample -print0 | sudo xargs -0 rm -r
Delete all files/directories named test under maximum 2 level down the current directory
find . -maxdepth 2 -name "test" -exec rm -rf {} \;
Delete all files/directories older than 48 hours in /path/to/files* paths
find /path/to/files* -mtime +2 -delete
Delete all files/directories under current directory
find -delete
Delete all files/directories under current directory tree excluding '.gitignore' files/directories and files/directories matching the patterns '.git' or '.git/*' in their paths
find . ! -name '.gitignore' ! -path '.git' ! -path '.git/*' -exec rm -rf {} \;
Delete all files/directories under current directory tree with '.$1' extension where $1 expands as the first positional parameter
find . -name "*.$1" -delete;
Delete all files/directories with '.old' extension under current directory tree
find . -name “*.old” -delete
Delete all files/directories with inode number 117672808 under current directory tree
find -inum 117672808 -exec rm {} \;
Delete all files beneath the current directory that begin with the letters 'Foo'.
find . -type f -name "Foo*" -exec rm {} \;
delete all the files ending with "~" in current folder
find -name '*~' -delete
delete all the files ending with "~" in current folder
find -name '*~' -print0 | xargs -0 rm
delete all the files ending with "~" in current folder
find . -name "*~" -print | xargs rm
Delete all the files found in the current directory tree whose names begin with "heapdump"
find . -name heapdump* -exec rm {} \ ;
Delete all the files found in the current directory tree whose names begin with "heapdump"
find . -name heapdump*|xargs rm
Delete all files in the $DIR directory that have not been accessed in 5 or more days.
find "$DIR" -type f -atime +5 -exec rm {} \;
delete all files in $DIR that have not been accessed in at least 5 days
find "$DIR" -type f -atime +5 -exec rm {} \;
Delete all files in the /TBD directory that were modified more than 1 day ago
find /TBD/* -mtime +1 -exec rm -rf {} \;
Delete all files in the /myDir directory tree that were last modfied more than 7 days ago
find /myDir -mindepth 1 -mtime +7 -delete
Delete all files in the current directory.
find . -exec /bin/rm {} \;
Delete all files in the current directory tree whose names end with ~
find . -name "*~" -delete
Delete all files in the current directory tree whose names end with ~
find . -name "*~" -exec rm {} \;
delete all the files in the current folder
find . -delete
delete all the files in the current folder
find . -print0 | xargs -0 rm
delete all the files in the current folder which are bigger than 1KB
find . -size +1024 ?print|xargs -i rm \;
delete all the files in the current folder which have been modified in the last 14*24 hours
find . -mtime -14 -print|xargs -i rm \;
delete all the files in the current folder which end with ".bak" or ".backup" and which have not been accessed in the last 30 days
find . ( -name '*.bak' -o -name *.backup ) -type f -atime +30 -exec rm '{}' ;
delete all the files in the current folder which do not belong to any user
find / -nouser -exec rm {}\;
delete all the files in the current folder which do not belong to any user
find . -nouser | xargs rm
delete all the files in the file system which belong to the user edwarda
find / -user edwarda -exec rm "{}" \;
delete all the files in the file system which belong to the user edwarda after user confirmation
find / -user edwarda -ok rm "{}" \;
delete all files in the home directory which ahve the name core in them
find ~/ -name 'core*' -exec rm {} \;
Delete all files named "filename" in the current directory tree, except the one with path ./path/to/filename
find . -name "filename" -and -not -path "./path/to/filename" -delete
Delete all files named "filename" in the current directory tree, except those with paths ending in "/myfolder/filename"
find . -name "filename" -and -not -path "*/myfolder/filename" -delete
Delete all files named '-F' under current directory tree
find . -name "-F" -exec rm {} \;
Delete all files named 'sample' (case insensitive) under '/home/user/Series' directory tree with superuser privilege
sudo find /home/user/Series/ -iname sample -exec rm {} \;
Delete all files not owned by valid users
find / -nouser | xargs -0 rm
Delete all files that have not been accessed in the last 30 days
find . -type f -atime +30 -exec rm {} \;
Delete all files that were modified more than 60 days ago under '/path-to-directory' tree
find /path-to-directory -mtime +60 -exec rm -f {} \;
Delete all files throughout the entire filesystem that are no longer owned by a valid user.
find / -nouser | xargs -0 rm
Delete all files under $DESTINATION directory tree that were modified more than 7 days ago
find $DESTINATION -mtime +7 -exec rm {} \;
Delete all files under $INTRANETDESTINATION/weekly directory tree that were modified more than 32 days ago
find $INTRANETDESTINATION/weekly -mtime +32 -exec rm {} \;
Delete all files under '/home/backups' directory tree with '.tgz' or '.gz' extension (case insensitive) that were modified more thant 60 days ago
find /home/backups -type f -iregex '.*\.t?gz$' -mtime +60 -exec rm {} \;
Delete all files under /path/to/files that are not newer than dummyfile
find /path/to/files -type f ! -newer dummyfile -delete
Delete all files under /path/to/input/ that match the case insensitive string literal 'spammer@spammy.com' in their contents
find /path/to/input/ -type f -exec grep -qiF spammer@spammy.com \{\} \; -delete
Delete all files under and below the current directory
find -mindepth 1 -delete
Delete all files under current directory tree with '.$1' extension where $1 expands as the first positional parameter
find . -name "*.$1" -exec rm {} \;
Delete all files under root whose status were changed more than 30 minutes ago
find root -type -f -cmin +30 -delete
Delete all files under user's home directory tree that were accessed more than 365 days after their status was changed
find ~ -used +365 -ok rm '{}' ';'
delete all the files which start with "Tes" in the current folder
find . -type f -name "Tes*" -exec rm {} \;
Delete all files with ' .o' extension in the entire filesystem
find project / src / -name "* .o" -exec rm -f {} \;
Delete all files with 128128 inode number under current directory tree
find . -inum 128128 | xargs rm
Delete all files with indoe number $inum under current directory tree
find . -inum $inum -exec rm {} \;
Delete all files with inode number 804180
find -inum 804180 -exec rm {} \
Delete all filename* files under /dir directory
find /dir -name "filename*" -type f -delete
Delete all filename* files under /dir directory
find /dir -name "filename*" -type f -exec rm {} \;
Delete all filename* files under /dir directory
find /dir -name "filename*" -type f -print | xargs rm
Delete all hard links to the physical file with inode number 2655341
find /home -xdev -inum 2655341 | xargs rm
Delete all hidden files/directories under $some_directory including $some_directory
find $some_directory '.*' -delete
Delete all hidden files in the directory tree given as variable $FOLDER
find $FOLDER -name ".*" -delete
Delete all hidden files under $some_directory
find "$some_directory" -type f -name '.*' -delete
Delete all hidden files under $some_directory
find "$some_directory" -type f -name '.*' -exec rm '{}' \;
Delete all hidden files under $some_directory
find "$some_directory" -type f -name '.*' | xargs rm
Delete all HTML files under tree ~/mydir
find ~/mydir -iname '*.htm' -exec rm {} \;
Delete all in the current directory tree
find . -delete
delete all instances of the file "bad" if its size is 0 bytes
find . -name bad -empty -delete
delete all the log files in the current folder
find -name '*.log' -delete
delete all the log files in the current folder
find ./ -name '*.log' -print0 | xargs -0 rm
delete all the log files in the current folder
find ./ -name '*.log' | xargs rm
delete all the log files which have not been modified in the last 5 days after user confirmation
find . — name "*.LOG" — mtime +5 -ok rm {} \;
delete all the mp3 files in the current folder.
find . -type f -name "*.mp3" -exec rm -f {} \;
delete all the mp3 files in the home folder
find /home/ -exec grep -l “mp3” {} \; | xargs rm
Delete all MP3 files under /tmp
find /tmp -iname '*.mp3' -print0 | xargs -0 rm
delete all the mp4 files in the folder /home which are bigger than 10MB
find /home -type f -name *.mp4 -size +10M -exec rm {} \;
Delete all non digits from index "$i" in bash array "depsAlastmodified" and print the hex dump as characters
echo "${depsAlastmodified[$i]}" | tr -cd '[[:digit:]]' | od -c
delete all the normal files in the current directory whcih have the word "gui" in their content.
find / -type f -print0 | xargs -0 grep -liwZ GUI | xargs -0 rm -f
delete all the normal files in the current folder and do not delete those in the subfolders
find . -maxdepth 1 -type f -delete
delete all the php files in the folder /var/www
find /var/www/*.php -type f -exec rm {} \;
delete all normal/regular files in the current folder which are empty
find . -type f -empty -delete