nl
stringlengths
13
387
bash
stringlengths
1
532
delete all the regular files in the temp folder which have not been changed in the last 15*24 hours
find /tmp/ -ctime +15 -type f -exec rm {} \;
delete all the regular files in the temp folder which have not been modified in the last 24 hours
find /tmp/ -type f -mtime +1 -delete
delete all the regular files in the temp folder which have not been modified in the last 24 hours
find /tmp/ -type f -mtime +1 -exec rm {} \;
delete all the regular files in the temp folder which have not been modified in the last 24 hours
find /tmp/ -type f -mtime +1 -print0 | xargs -0 -n1 rm
Delete all regular files named 'FILE-TO-FIND' under current directory tree
find . -type f -name "FILE-TO-FIND" -exec rm -f {} \;
Delete all regular files named 'FindCommandExamples.txt' under current directory tree
find . -type f -name "FindCommandExamples.txt" -exec rm -f {} \;
Delete all regular files named 'IMAG1806.jpg' under current directory tree
find . -type f -name "IMAG1806.jpg" -exec rm -f {} \;
Delete all regular files named 'IMAGE1806.jpg' under current directory tree
find . -type f -name 'IMAGE1806.jpg' -delete
Delete all regular files that have not been modified in the last 31 days under '/path/to/junk/files' directory tree
find /path/to/junk/files -type f -mtime +31 -exec rm -f {} \;
Delete all regular files that have not been modified in the last 60 weeks under $DIR directory tree
find $DIR -type f -mtime +60w -exec rm {} \;
Delete all regular files that reside in directory $OUTPUTDIR and below, and were last modified more than 7 days ago
find $OUTPUTDIR -type f -mtime +7 -delete
Delete all regular files that start with 'sess_' in their names, are at least 1 level deep and were modified more than $gc_maxlifetime minutes ago under $save_path directory tree
find -O3 "$save_path" -depth -mindepth 1 -name 'sess_*' -ignore_readdir_race -type f -cmin "+$gc_maxlifetime" -delete
Delete all regular files under $DIR directory tree that have been modified before file $a
find "$DIR" -type f \! -newer "$a" -exec rm {} +
Delete all regular files with '.cache' extension that were accessed more than 30 days ago under $HOME/Library/Safari/Icons directory tree
find $HOME/Library/Safari/Icons -type f -atime +30 -name "*.cache" -print -delete
Delete all regular files with inode number 314167125 under current directory tree
find . -type f -inum 314167125 -delete
delete all the text files from the current folder after user confirmation
find . -name "*.txt" -ok rm {} \;
delete all the text files in the current folder
find . -type f -name "*.txt" -delete
delete all the text files in the current folder.
find . -type f -name "*.txt" -exec rm -f {} \;
delete all text files in the entire file system
find / -type f -name "*.txt" -print | xargs rm
delete all text files in the home folder after user confirmation
find $HOME/. -name "*.txt" -ok rm {} \;
delete all the tmp files ( files with the extension tmp ) in the /tmp folder
find /tmp -name "*.tmp" | xargs rm
delete 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 -exec rm {} \;
delete all the trace files (".trc") which have not been been accessed in the last 30*24 hours
find /dirpath \( -name \*.trc -a -mtime +30 \) -exec rm {} \;
Delete and count files in $DIR_TO_CLEAN that are older than $DAYS_TO_SAVE days
find "$DIR_TO_CLEAN" -type -f -mtime "+$DAYS_TO_SAVE" -exec rm {} \; -printf '.' | wc -c
Delete characters in columns 36 through 40 from the output of "finger"
finger | cut --complement -c36-40
Delete empty files and print their names
find . -empty -delete -print
Deletes empty folder 'nonsense_dir'.
rmdir nonsense_dir
Delete empty regular files
find . -type f -empty -delete
Delete everything in the current directory
find -mindepth 1 -maxdepth 1 -print0 | xargs -0 rm -rf
Delete files "*doc copoy" in directory tree /mnt/zip
find /mnt/zip -name "*doc copy" -execdir rm "{}" \;
Delete files containing whitespaces
find . -name "* *" -exec rm -f {} \;
Delete files containing whitespaces without recursion
find . -name '*[+{;"\\=?~()<>&*|$ ]*' -maxdepth 0 -exec rm -f '{}' \;
Delete files in $DIR_TO_CLEAN older than $DAYS_TO_SAVE days
find "$DIR_TO_CLEAN" -mtime +$DAYS_TO_SAVE -exec rm {} \;
Delete files in /var/tmp/stuff and below that have not been modified in over 90 days
find /var/tmp/stuff -mtime +90 -delete
Delete files in /var/tmp/stuff and below that have not been modified in over 90 days
find /var/tmp/stuff -mtime +90 -exec /bin/rm {} \+
Delete files in /var/tmp/stuff and below that have not been modified in over 90 days
find /var/tmp/stuff -mtime +90 -exec /bin/rm {} \;
Delete files in /var/tmp/stuff and below that have not been modified in over 90 days
find /var/tmp/stuff -mtime +90 -execdir /bin/rm {} \+
Delete files in /var/tmp/stuff and below that have not been modified in over 90 days
find /var/tmp/stuff -mtime +90 -print | xargs /bin/rm
Delete files in /var/tmp/stuff and below that have not been modified in over 90 days
find /var/tmp/stuff -mtime +90 -print0 | xargs -0 /bin/rm
Delete files in the DIR directory tree whose names begin with "2015" and contain "album" or "picture"
find DIR \( -name 2015\* -a \( -name \*album\* -o -name \*picture\* \) \) -delete
Delete files older than 31 days
find ./ -mtime +31 -delete
Delete files under $LOCATION that match $REQUIRED_FILES in their names and were modified more than 360 minutes ago
find $LOCATION -name $REQUIRED_FILES -type f -mmin +360 -delete
Delete the files under the current working directory with inode numbers specified on standard input
xargs -n 1 -I '{}' find "$(pwd)" -type f -inum '{}' -delete
Delete files with inode number specified by [inode-number] under current directory
find . -inum [inode-number] -exec rm -i {} \;
Deletes folder like /tmp/*/* or deeper, older than +7 days if they don`t contain files or other folders.
find /tmp/*/* -mtime +7 -type d -exec rmdir {} \;
Delete history entry at offset, defined in first argument of executed script
history -d "$1"
Delete interactively all the files/directories with inode number 782263 under current directory tree
find . -inum 782263 -exec rm -i {} \;
Delete line 2 in numbered file "file" and renumber
grep -v '^2 ' file | cut -d' ' -f2- | nl -w1 -s' '
Delete the oldest file with '.tgz' or '.gz' extension under '/home/backups' directory tree
ls -tr $(find /home/backups -name '*.gz' -o -name '*.tgz')|head -1|xargs rm -f
delete recursively, without prompting, any files or directories under the current directory that case insensitively match the filename ".svn"
find . -iname .svn -exec rm -rf {} \;
delete recursively, without prompting, any files or directories under the current directory that case insensitively match the filename ".svn"
find . -iname .svn -print | xargs rm -rf
delete recursively, without prompting, any files or directories under the current directory that case insensitively match the filename ".svn"
find . -iname .svn -print0 | xargs -0 rm -rf
delete what was typed in the command line and run "pwd" when button "\e[24~"
bind '"\e[24~":"\C-k \C-upwd\n"'
Delimit standard input with ":" and display as a table
column -s: -t
To descend at most one levels of directories below the command line arguments pass the -maxdepth 1 option. This will avoid deleting nested directories:
find . -maxdepth 1 -type d -iname ".[^.]*" -print0 | xargs -I {} -0 rm -rvf "{}"
Descend into every directory under /etc and print the file/directory names with relative paths
find /etc -execdir echo "{}" ';'
Determine if /full/path exists on a mounted file system.
df /full/path | grep -q /full/path
Determine the user associated with stdin
who -m
Disables shell option 'compat31'.
shopt -u compat31
Disables shell option 'dotglob'.
shopt -u dotglob
Disables shell option 'nocasematch'.
shopt -u nocasematch
Disables shell option 'nullglob'.
shopt -u nullglob
Discard the first letter from every line in $line and calculate the md5 sum of the remaining
echo $line | cut -c2- | md5sum
Display "/tmp/file" as a table of width 30 with columns filled before rows
column -x -c 30 /tmp/file
Display "infile" as printable characters or backslash escapes
cat infile | od -c
display ten files in the tmp directory
find /tmp | head
Display 12345 backwards
echo 12345 | rev
Display the 5 largest files in the current directory and its sub-directories.
find . -type f -exec ls -s {} \; | sort -n -r | head -5
Display the 5 smallest files in the current directory and its sub-directories ignoring any empty files.
find . -not -empty -type f -exec ls -s {} \; | sort -n | head -5
Display 798 backwards
echo 798|rev
Display a character dump of "oldfile"
od -c oldfile
Display a count of regular files in each directory at the current level.
find -P . -type f | rev | cut -d/ -f2- | rev | cut -d/ -f1-2 | cut -d/ -f2- | sort | uniq -c
Display a dump of "file" as floating point values of double size
od -t fD file
Display a dump of standard input as floating point values of double size
od -t fD
display a list of all the files in the file system which do not belong to any group and search only in jfs and jfs2 file systems
find / -nogroup \( -fstype jfs -o -fstype jfs2 \) -ls
display a list of all the files in the file system which do not belong to any user and search only in jfs and jfs2 file systems
find / -nouser \( -fstype jfs -o -fstype jfs2 \) -ls
display a list of all files in the folder passed as argument to a script
find $@ -ls
display a list of all the files in the home folder which have been modified today
find ~ -type f -mtime 0 -ls
display a list of all java or jsp files in the current folders
find . \( -name '*jsp' -o -name '*java' \) -type f -ls
display a list of all regular/normal files in the current folder
find . -type f -ls
display a list of all the normal/regular files in the file system ,excluding the folder proc which have the suid or sgid bit set
find / -path /proc -prune -o -type f -perm +6000 -ls
Display a list of files with sizes in decreasing order of size of all the regular files under '/your/dir' directory tree that are bigger than 5 MB in size
find /your/dir -type f -size +5M -print0 | xargs -0 ls -1Ssh
display a long listing of all the "Trash" files in the folder /home
find /home -name Trash -exec ls -al {} \;
Display a long listing of all 0777 permission directories under current directory tree
find . -perm 0777 -type d -exec ls -l {} \;
display a long listing of all the directories in current directory
find . -type d -ls
display a long listing of all the directories in the current folder
find . -type d -exec ls -algd {} \;
display a long listing of all the directories in the entire file system
find / -print0 -type d | xargs -0 ls -al
Display a long listing of all directories under '/nas' directory tree
find /nas -type d -ls
display a long listing of all the empty files in the entire file system which are empty
find / -type f -size 0 -exec ls -l {} \;
Display a long listing of all files/directories named 'file' under current directory tree
find -name file -ls
Display a long listing of all files/directories that are bigger than 10MB under '/var/' directory tree
find /var/ -size +10M -ls
Display a long listing of all the files/directories under current directory tree that are newer than the file 'Nov' by modification time
find . -newer Nov -ls
display a long listing of all the files in the /var folder which are bigger than 10MB. print0 is used to handle the files which have new lines in their names
find /var -size +10000k -print0 | xargs -0 ls -lSh
display a long listing of all the files in the current folder
find . — type f -exec ls -1 {} \;
display a long listing of all the files in the current folder in sorted order, which are bigger than 10KB
find . -size +10k -exec ls -ls {} \+ | sort -nr
display a long listing of all the files in the current folder that have been accessed in today from the start of the day
find -daystart -atime 0 -ls
display a long listing of all the files in the current folder which are bigger than 10KB
find . -size +10k -exec ls -lh {} \+
dispaly a long listing of all the files in the current folder which have been modified in the last 14 days
find . -mtime -14 -ls
display a long listing of all fles in current folder which have been modified in the last 60 minutes
find . -mmin -60 -ls
display a long list of all the files in the directory "/mydir" which have not been modified in the last 20*24 hours or which have not been accessed in the last 40*24 hours
find /mydir \(-mtime +20 -o -atime +40\) -exec ls -l {} \;