nl_command
stringlengths 14
387
| bash_code
stringlengths 0
532
|
---|---|
Print the full real path of "/dev/disk/by-uuid/$1" followed by "is not mounted" | echo $(readlink -f /dev/disk/by-uuid/$1) is not mounted |
change the permissions of all the files ending with "fits" in the folder "/store/01" | find /store/01 -name "*.fits" -exec chmod -x+r {} \; \ |
display all the files in the current folder along with the hidden files with the depth | find . — name "*" — print -о -name ".*" — print -depth |
Print "#include" statements found in "file2" that are not in "file1" | comm -13 < < |
change the ownership of all regular/normal files in the current directory | find . -type f | xargs chown username |
Find all directories under ~/code excluding hidden directories and replace all newlines with : in the output then remove the last : | find ~/code -type d -name '[^\.]*' | tr '\n' ':' | sed 's/:$//' |
Get domain names from file '1.txt' and request TXT DNS record for each one | cat 1.txt | xargs dig TXT |
recursively finds all files newer than a date | find . -type f -newermt "$" |
find all the files that have been modified in exactly 7*24 hours ago | find . -mtime 7 |
display all normal/regular files in current folder | find . -type f -print0 |
Find all regular files in the /path/to/base/dir tree | find /path/to/base/dir -type f |
Unpack all *.gz archives in the current directory tree | find . -name '*.gz' -print0 | xargs -0 gunzip |
List all files in the /var directory tree whose size is greater than 10 megabytes | find /var/ -size +10M -exec ls -lh {} \; |
display all the files in the home folder which belong to the suer "bruno" and end with ".sxw" and have been accessed in the last 3*24 hours | find /home -type f -name *.sxw -atime -3 -user bruno |
Gets IP address of first listed active network interface in system. | ifconfig | grep 'inet addr:' | grep -v '127.0.0.1' | awk -F: '{print $2}' | awk '{print $1}' | head -1 |
use regex with find command | find . -regextype posix-egrep -regex '\./[a-f0-9\-]{36}\.jpg' |
Save standard input to variable 'stdin' until the first character encoded as '\004' is read | read -d "$" stdin |
Find all files/directories under current directory and print them with newline as the delimiter | find -print | xargs -d'\n' |
Delete all .svn files/directories under current directory | find . -name .svn -exec rm -rf {} + |
Find all '*~' files under current directory | find ./ -name '*~' |
change the group of all the files which belong to the user edwarda to pubs | find / -user edwarda -exec chgrp pubs "{}" \; |
find all the cpp files in current folder | find -name "*.cpp" |
Search for "YOURSTRING" in all files under current directory | grep YOURSTRING `find .` |
Search for empty files | find . -size 0k |
Gets MAC address of en0 network interface. | ifconfig en0 | grep -Eo ..\{5} |
Print the text file paths that match 'needle text' in their contents under 'my_folder' recursively | grep -rl "needle text" my_folder | tr '\n' '\0' | xargs -r -0 file | grep -e ':[^:]*text[^:]*$' | grep -v -e 'executable' |
Search for the regex '[0-9][0-9]*[.][0-9][0-9]*[.][0-9][0-9]*[.][0-9][0-9]*' in all files under /etc | find /etc -exec grep '[0-9][0-9]*[.][0-9][0-9]*[.][0-9][0-9]*[.][0-9][0-9]*' {} \; |
show all the regular/normal files in the folder /home/user/demo | find /home/user/demo -type f -print |
Move all directories from the `sourceDir' directory tree to the `destDir' directory | find sourceDir -mindepth 1 -type d -print0 | xargs -0 mv --target-directory=destDir |
Run the find command with all shell positional arguments | `which find` "$@" -print0; |
Find all *.rb files/directories under current directory | find . -name "*.rb" |
Enables 'nullglob' shell option. | shopt -s nullglob |
Rename all files in the current directory to the md5 sum followed by the extension and print the conversions | md5sum * | sed -e 's/\ \(.*\\)$/mv -v \2 \1\3/e' |
search for a shell script in the current folder and display the current folder path but search from the sub directories | find . -name onlyme.sh -execdir pwd \; |
Print every found file like '*.cfg' under '/path/to/files/' directory followed by its content, and wait 2 seconds after each printed file | find /path/to/files -type f -name \*.cfg -print -exec cat {} \; -exec sleep 2 \; |
Filters only directories including hidden ones from long file listing of a current directory, and prints their names. | ls -Al | grep "^d" | awk -F" " '{print $9}' |
find all headers file *.h in /nas/projects directory | find /nas/projects -name "*.h" |
Find all files/directories under current directory tree excluding files/directories with name 'query_to_avoid' | find \! -name "query_to_avoid" |
Print source of the file system containing $path. | df -P $path | tail -1 | cut -d' ' -f 1 |
Find all files in $dir directory and count them | find "$dir" -maxdepth 1 -type f | wc -l |
Print a null delimited list of all *.emlx files/directories under /path/to/folders/ to filelist | find /path/to/folders/ -name \*.emlx -print0 > filelist |
Calculate the md5sum of the executable file of command "cc" | md5sum $(which cc) |
Search the /usr/bin directory tree for regular files modified or created less than 10 days ago | find /usr/bin -type f -mtime -10 |
List all regular files in the current directory tree | find . -type f -print0 | xargs -0 ls -l |
Recursively removes all empty folders under current folder. | find . -depth -type d -empty -exec rmdir {} \; |
Add a date time stamp to every line of output in "ping host" | ping host | perl -nle 'print scalar, " ", $_' |
Count the number of files/directories named file1 under current directory | find -name file1 | wc -l |
recursively change owner of the directory ~/.npm to the current user | sudo chown -R $ ~/.npm |
Find files in the current directory tree that were accessed within the last 60 minutes | find . -amin -60 |
Receive pattern to search for on the standard input and print only matching part of lines from file 'f.html' | cat f.html | grep -o \ |
Find a directory named 'project.images' case insensitively in the entire filesystem and show it in long listing format | find / -type d -iname "project.images" -ls |
Find all empty files in the current directory and delete them | find . -type f -maxdepth 1 -empty -print0 | xargs -0 /bin/rm |
Find all files under $1 directory excluding hidden files and append a null character at the end of each of their paths | find "$1" -path "*/.*" -prune -o \( -type f -print0 \) |
Print and delete all directories named 'work' under '/usr/ports/' directory tree | find /usr/ports/ -name work -type d -print -exec rm -rf {} \; |
Find all directories starting from / that have permissions 777 | find / -type d -perm 0777 |
Send SIGKILL signal to process ID 16085, killing it instantly. | kill -9 16085 |
Print all files containing "word1" and "word2" in the current directory tree | comm -12 <(grep -rl word1 . | sort) <(grep -rl word2 . | sort) |
Look for *.jpg files | find . -name “*.jpg” |
Print a count of case insensitive duplicate filenames in the current directory | ls -1 | tr '[A-Z]' '[a-z]' | sort | uniq -c | grep -v " 1 " |
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 |
Find SGID files | find / -perm +g=s |
Filter /path/to/logfile for any lines containing the specified date, paging interactively through the output. | grep 'Nov 12 2012' /path/to/logfile | less |
extract /path/to/my_archive.tar.xz to /path/to/extract and preserve permissions. | tar xpvf /path/to/my_archive.tar.xz -C /path/to/extract |
Search the current directory tree for files whose names do not end in ".exe" and ".dll" | find . -not -name "*.exe" -not -name "*.dll" -not -type d |
Search for 'js' in all files under current directory that match 'some string' in their names | find . | grep 'some string' | grep js |
Opens gcc info manual and selects "option index" menu entry. | info gcc "option index" |
find all directories that names are 'project.images' | find / -type d -name "project.images" |
Search the directory tree given as variable $root_dir for regular files | find $root_dir -type f |
Find all *.jpg files under maximum 2 levels down the temp/medium/* paths and run `mogrify -resize 428x270">" -quality 80 -compress JPEG -monitor -strip` with the file paths as arguments | find temp/medium/* -maxdepth 2 -iname "*.jpg" -print0 | xargs -0 mogrify -resize 428x270">" -quality 80 -compress JPEG -monitor -strip |
Write standard input to standard output and to "foobar.txt" | tee foobar.txt |
find all files and directories under the current directory and display the inode of each one, using printf | find . -printf "%i \n" |
remove all core files in the file system | find / -name "*.core" -print -exec rm {} \; |
Search the current directory recursively for regular files last changed more than 2 days ago | find . type -f -ctime +2 |
List all *.txt files/directories under current directory | find . -name "*.txt" -print |
Unsets all environment variables. | unset `env | awk -F= '/^\w/ {print $1}' | xargs` |
kill group leader | kill `jobs -lp` |
Find all directories in the current directory tree excluding hidden directories and create them in "../demo_bkp" | find . -not -path \*/.\* -type d -exec mkdir -p -- ../demo_bkp/{} \; |
display a long listing of all the normal/regular files in the current folder and do not search in the sub folders | find . -maxdepth 1 -type f -exec ls -l {} \; | less |
Save a nginx link to "/path/to/file" with the current user and system FQDN host name in variable "path" | path="http://$.$/path/to/file" |
Find all .core files on the system starting from / and delete them | find / -name "*.core" -print -exec rm {} \; |
Add executable permission to "pretty-print" | chmod +x pretty-print |
Change the ownership of "/home/bob" to "root" | sudo chown root /home/bob |
Compress all *.img files using bzip2 | find ./ -name "*.img" -exec bzip2 -v {} \; |
Invoke a trusted X11 forwarding SSH connection with the server $ssh_server as user $ssh_user | ssh -Y $ssh_user@$ssh_server |
Find all files under current directory matching either of the patterns 'error.[0-9]*', 'access.[0-9]*', 'error_log.[0-9]*', 'access_log.[0-9]*', 'mod_jk.log.[0-9]*' in their names | find -type f -name 'error.[0-9]*' -o -name 'access.[0-9]*' -o -name 'error_log.[0-9]*' -o -name 'access_log.[0-9]*' -o -name 'mod_jk.log.[0-9]*' |
Search the current directory tree for filenames matching the pattern '[mM][yY][fF][iI][lL][eE]*' | find . -name '[mM][yY][fF][iI][lL][eE]*' |
Set variable value to current kernel release name. | value=$ |
Find all *.axvw files/directories under current directory | find . -name '*.axvw' |
Search the home directory tree for files owned by sam | find /home -user sam |
Rename files from the current directory tree to the ASCII standard | find . -type f -exec bash -c 'for f do d=${f%/*} b=${f##*/} nb=${b//[^A-Za-z0-9._-]/_}; [[ $b = "$nb" ]] || echo mv "$f" "$d/$nb"; done' _ {} + |
Find all files that have the SUID bit set | find / -perm -u+s -print |
Display the host's ECDSA fingerprint using the sha256 hasing algorithm. | ssh-keygen -l -f /etc/ssh/ssh_host_ecdsa_key.pub |
Find all files under /path and below writable by `group' and `other' | find /path -perm -go+w |
Find files/directories that have not been modified in the last one day in directories or files taken from the glob pattern '/tmp/test/*' | find /tmp/test/* -daystart -mtime +1 |
Display all symlinks and their targets in the current directory | find -P . -maxdepth 1 -type l -exec echo -n "{} -> " \; -exec readlink {} \; |
Search the current directory tree for regular files changed less than 1 day ago | find . -type f -ctime -1 |
Search for 'string-to-find' in all HTML files under current directory tree and show the matched lines with their filenames | find . -name \*.html -exec grep -H string-to-find {} \; |
find all files in current folder having the name pattern "some_pattern" and move them to folder target_location (GNU VERSION) | find . -name some_pattern -print0 | xargs -0 -I % mv % target_location |
Create a symbolic link named "~/bin/subl" to "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" | ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl |
Find all files name passwd in the root directory and all its sub-directories. | find / -name passwd |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.