nl stringlengths 13 387 | bash stringlengths 1 532 |
|---|---|
Finds name of a current month and saves it in a 'month' variable. | month=$(cal | head -1 | grep -oP "[A-Za-z]+") |
find not case sensitive all directories that names are 'apt' | find / -type d -iname "apt" |
find not case sensitive all directories that names are 'apt' and display details | find / -type d -iname "apt" -ls |
Find not-executable files under /home/www | find /home/www/ ! -executable |
find the oldest normal file in the current directory | find -type f -printf '%T+ %p\n' | sort | head -n 1 |
find the oldest normal file in the current directory | find . -type f -print0 | xargs -0 ls -ltr | head -n 1 |
find the oldest normal file in the current directory and display its contents | find -type f -printf "%T+ %p\0" | sort -z | grep -zom 1 ".*" | cat |
find the oldest normal file in the current directory and display with its timestamp | find ! -type d -printf "%T@ %p\n" | sort -n | head -n1 |
Find one file or directory in the current directory whose name matches the pattern given as a variable $a | find . -maxdepth 1 -name "$a" -print -quit |
Find only directories | find . -type d |
Find only files under /etc with the size of 100k-150k | find /etc -size +100k -size -150k |
Finds only parts of echoed string that match with regex 'run-parts (-{1,2}\S+ )*\S+', and saves them in $match variable, each matched part on a separate line. | match=$(echo "${line}" | egrep -o 'run-parts (-{1,2}\S+ )*\S+') |
Find out all files owned by user vivek | find / -user vivek |
Finds out what groups a current user has. | groups |
Finds out what groups a given user has. | groups user |
find out what group a given user has | groups user |
Find the passwd file in the current directory and one level down | find -maxdepth 2 -name passwd |
Find the passwd file under root and two levels down | find / -maxdepth 3 -name passwd |
Find the passwd file under root and one level down. | find -maxdepth 2 -name passwd |
Find the passwd file under the root directory and two levels down | find / -maxdepth 3 -name passwd |
find the path of a specfic video file in the current directory | find ./ -name "foo.mp4" -printf "%h\n" |
Finds pattern text ignoring letter case in all .js files, prints matched strings and name of file with that strings. | find . -name '*.js' -exec grep -i 'string to search for' {} \; -print |
Find PHP files containing 2 or more classes | find . -type f -name "*.php" -exec grep --with-filename -c "^class " {} \; | grep ":[2-99]" | sort -t ":" -k 2 -n -r |
Finds PIDs of all running processes, gets executable binary of each process, and prints containing folder of each binary. | ps -A -o pid | xargs -I pid readlink "/proc/pid/exe" | xargs -I file dirname "file" |
(GNU specific) Find the process currently taking the most CPU time. | top -b -n1 -c | grep -A 2 '^$' |
Find the process id of mysql | ps -A|grep mysql |
Find recursively all Emacs backup files in the current directory and remove them | find . -name '*~' | xargs rm |
Find recursively all empty directories in the current directory | find -type d -empty |
Find recursively all empty directories in the current directory | find . -type d -empty |
Find recursively all files changed within the last 5 minutes starting from directory b | find b -cmin -5 |
Finds recursively all files having extension .c, .h in '/path/' that contain 'pattern', and prints matched strings with string number and file name. | grep --include=\*.{c,h} -rnw '/path/to/somewhere/' -e "pattern" |
Find recursively all files in the "." directory tree whose names end with ".class" and delete them | find . -type f -name "*.class" -exec rm -vf {} \; |
Finds recursively all files in '/path/' that contain 'pattern', and prints matched strings with string number and file name. | grep -rnw '/path/' -e 'pattern' |
Find recursively all files in /path that end in "txt" and copy them to /tmp/ | find /path -type f -name "*txt" -printf "cp '%p' '/tmp/test_%f'\n" | bash |
Finds recursively all files not having extension .o in '/path/' that contain 'pattern', and prints matched strings with string number and file name. | grep --exclude=*.o -rnw '/path/to/somewhere/' -e "pattern" |
Find recursively all files whose names begin with "foo" | find . -name "foo*" |
Find recursively all files whose names ends with "foo" | find . -name "*foo" |
Finds recursively all folders in current folder which path not contains "NameToExclude" string and removes only ones without files and another folders within. | find . -type 'd' | grep -v "NameToExclude" | xargs rmdir |
Finds recursively all folders named 'a' within current folder and removes only ones without files and another folders within. | find -type d -name a -exec rmdir {} \; |
Finds recursively all folders named 'a' within current folder and removes only ones without files and another folders within. | find . -name "a" -type d | xargs rmdir |
Find recursively all Python files in the current directory and search them for the word ‘import’ | find . -name '*.py' | xargs grep 'import' |
Find recursively all Python files in the current directory tree and count the number of lines in them | find . -name '*.py' | xargs wc -l |
Find recursively all regular .txt files in the current directory tree except README.txt | find . -type f -name "*.txt" ! -name README.txt -print |
Find recursively all regular files changed within the last 5 minutes starting from directory b | find b -type f -cmin -5 |
Find recursively all regular files in the current directory skipping hidden files and directories matching pattern '.?*' | find -name '.?*' -prune -o \( -type f -print0 \) |
Find recursively all regular files in the current directory tree ending in .dll or .exe | find . -type f | grep -P "\.dll$|\.exe$" |
Find recursively all regular files in the current directory tree not ending in .dll or .exe | find . -type f | grep -vP "\.dll$|\.exe$" |
Find recursively all regular files in the current directory whose names contain "." | find . -type f -a -name '*.*' |
Find recursively all regular files in directory tree b that were changed within the last 5 minutes and copy them to directory c | find b -type f -cmin -5 -exec cp '{}' c \; |
Finds recursively and following symlinks from root folder all files that contain "text-to-find-here" and prints files names. | grep -Ril "text-to-find-here" / |
Find recursively the files named "file" in the current directory ignoring the .git subdirectory | find . -path ./.git -prune -o -name file -print |
Find recursively the files named "file" in the current directory ignoring all .git directories | find . -name .git -prune -o -name file -print |
Find recursively the latest modified .zip file in the current directory | find . -name "*zip" -type f | xargs ls -ltr | tail -1 |
Find recursively the latest modified file in the current directory | find . -type f -print0 | xargs -0 ls -ltr | tail -n 1 |
Find recursively the latest modified file in the current directory | find . -type f -print0|xargs -0 ls -drt|tail -n 1 |
Find recursively the latest modified file in the current directory | find . -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" " |
Find recursively the latest modified file in the current directory | find . -type f -printf '%TY-%Tm-%Td %TH:%TM: %Tz %p\n'| sort -n | tail -n1 |
Find recursively the latest modified file in the current directory | find . -type f | xargs ls -ltr | tail -n 1 |
Find recursively regular files in the current directory tree | find -type f -print0 |
Find recursively regular files in the current directory tree | find . -type f -print |
Find recursively regular files in the directory given as the script's command line argument #1, skipping hidden files and directories | find "$1" -path "*/.*" -prune -o \( -type f -print0 \) |
Finds recursion-related options of a 'grep' utility. | grep --help |grep recursive |
find regular files and directories that have been modified in the last seven days | find . -mtime -7 -type f |
Find regular files in the current directory that are writable by their owner | find -maxdepth 1 -type f -perm /200 |
Find regular files in the current directory tree that have all executable bits set | find -L . -type f -perm -a=x |
Find regular files in the current directory tree that have any executable bits set | find -L . -type f \( -perm -u=x -o -perm -g=x -o -perm -o=x \) |
Find regular files in the current directory tree that are called FindCommandExamples.txt and remove them | find . -type f -name "FindCommandExamples.txt" -exec rm -f {} \; |
Find regular files in the current directory tree that have executable bits set for the user and group but not for the other | find -L . -type f -perm -u=x,g=x \! -perm -o=x |
Find regular files in the current directory tree that have the user executable bit set | find . -type f -perm -u=x |
find regular/normal files in the current folder | find -type f |
Find regular files matching pattern "*oraenv*" and excecute the "file" utility for each of them | find . -name "*oraenv*" -type f -exec file {} \; |
Find regular files modified within the last 7 days | find . -mtime -7 -type f |
Find regular files named "expression -and expression" under and below /dir/to/search/ | find /dir/to/search/ -type f -name 'expression -and expression' -print |
Find regular files named "regex" under and below /dir/to/search/ | find /dir/to/search/ -type f -name 'regex' -print |
Find regular files named 'findme.txt' under '/usr' and '/home' directory tree | find /usr /home -name findme.txt -type f -print |
Find regular files named core under /tmp and delete them | find /tmp -name core -type f -print | xargs /bin/rm -f |
find regular file named foo.txt under root / directory. | find / -name foo.txt -type f |
find regular file named foo.txt under root / directory. | find / -name foo.txt -type f -print |
Find regular files readable by the world | find . -perm -g=r -type f -exec ls -l {} \; |
Find regular files that are bigger than 500 MB in size under current directoryt tree | find . -type f -size +500M |
Find regular files that are larger than 2GB | find . -type f -size +2G |
Find regular files that have SUID or SGID set | find / -perm +6000 -type f |
Find regular files under '/somefolder' directory tree satisfying the options/conditions/operations provided in ${ARGS[@]} array with find command | find /somefolder -type f '(' "${ARGS[@]}" ')' |
Find regular files under / that contain "stringtofind" | find / -maxdepth 1 -xdev -type f -exec grep -li stringtofind '{}' \; |
Find regular files under and below /path that match pattern "???-???_[a-zA-Z]*_[0-9]*_*.???" | find /path -type f -name "???-???_[a-zA-Z]*_[0-9]*_*.???" |
find regular files under the current directory and execute an md5sum command on each one | find -type f -exec md5sum {} + |
Find regular files which have 644 permission | find . -perm 644 -type f -exec ls -l {} \; |
find regular files which modification time is 7 days ago | find . -mtime -7 -type f |
Find regular files whose names end in .JPG | find . -type f -name "*.JPG" |
Find regular files with permissions less than 111 | find -perm -111 -type f |
find the regular js files which path does not contains '*/test/*' and name does not contains '*-min-*' or '*console*' | find . ! -path "*/test/*" -type f -name "*.js" ! -name "*-min-*" ! -name "*console*" |
Find regular non-hidden files containing 'some text' in their names | find . -not -path '*/\.*' -type f -name '*some text*' |
Find regular non-hidden files containing `some text' in their names with hidden directories optimization | find . -type d -path '*/\.*' -prune -o -not -name '.*' -type f -name '*some text*' -print |
Find root's files in the current directory tree | find ./ -user root |
Find root's Ruby files accessed in the last two minutes | find /apps/ -user root -type f -amin -2 -name *.rb |
find setuid files and directories writing the details to /root/suid.txt , and find large files writing the details to /root/big.txt, traversing the filesystem just once | find / \( -perm -4000 -fprintf /root/suid.txt '%#m %u %p\n' \) , \ \( -size +100M -fprintf /root/big.txt '%-10s %p\n' \) |
Find SGID files | find / -perm +2000 |
Find SGID files | find / -perm +g=s |
Finds shell options like 'checkjobs' with their state. | shopt -p | grep checkjobs |
Finds shell options with 'login' in name. | shopt | grep login |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.