nl_command
stringlengths 14
387
| bash_code
stringlengths 0
532
|
---|---|
find all teh script files in a directory | find /home/john -name "*.sh" -type f -print |
Print the contents of "order.txt" | cat order.txt |
find for lighttpd in /var | find /var -name lighttpd |
find all .pm, .pl files in /users/tom and search for multiple pattern in same files and display the matched file names | find /users/tom -name '*.p[lm]' -exec grep -l -- '->get(' {} + | xargs grep -l '#hyphenate' |
Find all directories under $d directory and set read-write-execute permission for owner and group and no permission for other for those directories | find $d -type d -exec chmod ug=rwx,o= '{}' \; |
Creae a tarball 'files.tar.gz' containing all regular files under current directory tree that are newer than 2013-12-04 and older than 2013-12-05 | find . -type f -name "*" -newermt 2013-12-04 ! -newermt 2013-12-05 | xargs -I {} tar -czvf files.tar.gz {} |
change html files to mode 644 | find /usr/local -name "*.html" -type f -exec chmod 644 {} \; |
Print the list of all subdirectories of the current directory | find . -maxdepth 1 -mindepth 1 -type d |
find all files in the entire file system whose size is more than 100MB | find / -size +100M |
Locate symbolic links in /usr and below | find /usr -type l |
List files cart1, cart2, ..., cart6 in directory ~/junk | find ~/junk -name 'cart[1-6]' -exec ls -l {} \; 2> /dev/null |
Show the list of files modified less than a minute ago | find / -mmin -1 -print |
Find all regular files under test directory | find test -type f |
find all the files starting with "config" in the folder Symfony | find Symfony -name '*config*'; |
search in the home folder for all the files with the name "monfichier" | find /home/ -name monfichier |
Print the first line of "seq 1 10000" | seq 1 10000 | head -1 |
Send SIGTERM signal to first process sent to background by the current shell. | kill %1 |
take all files in the directory " /path/to/files" and provide them as input to the script file truncate.sh | find /path/to/files -exec truncate.sh {} \; |
Pushes current folder to the directory stack. | pushd . |
Search the /root directory recursively for the regular file named "myfile" ignoring "work" directories | find /root/ -name 'work' -prune -o -name myfile -type f -print |
display all symbolic links in the folder "myfiles" | find /myfiles -type l |
Find all the SGID bit files whose permissions set to 644 | find / -perm 2644 |
Find all files/directories under current directory and count the number of lines for the output | find |wc -l |
List all php files below current directory whose full pathname name does not include "libs", "tmp", "tests", or "vendor", sorted by number of lines, letting the user page interactively through the output. | find . -name '*.php' -print0 | xargs -0 wc -l | sort -nr | egrep -v "libs|tmp|tests|vendor" | less |
Find all files/directories under current directory and print their paths | find . -exec echo {} + |
show all the mp3 files in the folder /home | find /home -type f -name '*.mp3' |
Remove files that are less than 1MB in size under <directory> | find <directory> -type f -size -1M -print0 | xargs -0 rm |
display the version of find command | find --version |
Archive "foo/bar/baz.c" to "remote:/tmp/" preserving the relative path of "foo/bar/baz.c" | rsync -avR foo/bar/baz.c remote:/tmp/ |
Find files starting with the word "file" in the current directory tree, ignoring the case | find . -iname "file*" |
Find all empty directories under current directory | find . -type d -empty |
generates a list of all files beneath the current directory whose filename DOES NOT end in .html, so it matches files like *.txt, *.jpg, and so on. | find . -type f -not -name "*.html" |
Show all files in user's home directory that have read, write and execute permissions set for user, group and others. | find ~ -perm 777 |
Unzip "daily_backup.sql.gz" and search for lines matching "'x'|/x/" | zcat daily_backup.sql.gz| grep -E "'x'|/x/" |
Find all files in the /home/myuser directory recursively that are older than 7 days | find /home/myuser -mtime +7 -print |
Creates temporary folder, and saves current folder path joined with created temporary folder path in 'tdir' variable. | tdir="$(pwd)/$(mktemp -d)" |
print list of all alias commands | alias -p | cut -d= -f1 | cut -d' ' -f2 |
Remove files named "core" from the /work directory tree and write their names to /dev/stderr (the standard error | find /work \( -fprint /dev/stderr \) , \( -name 'core' -exec rm {} \; \) |
List the drive of each "/dev/" disk mount point | mount | grep '^/dev/' | sed -E 's/([^ ]*) on ([^ ]*) .*/"\2" is located on "\1"/' |
Read a line from standard input into variable "password" without echoing the input and using the prompt "Password: " | read -s -p "Password: " password |
Count the number of regular files in directory tree ${DIRECTORY} that contain a vowel in their names | find ${DIRECTORY} -type f -print | sed -e 's@^.*/@@' | grep '[aeiouyAEIOUY]' | wc -l |
create a symbolic link with absolute path "/cygdrive/c/Program Files" to file "/cygdrive/c/ProgramFiles" | ln -s "/cygdrive/c/Program Files" /cygdrive/c/ProgramFiles |
Rename all directories under current directory by replacing all occurrences of 'Foo' with 'Bar' in their names | find . -type d -iname '*foo*' -depth -exec rename 's@Foo@Bar@gi' {} + |
find all the files in the current folder which have been modified after the file disk.log | find . -newer disk.log -print |
Calculate md5sum of the contents of the archives '/tmp/tst.gz', '/tmp/tst.bz2', '/tmp/tst.lzma' and '/tmp/tst.xz'. | md5sum < < < < |
Find all file.ext files/directories under present working directory and print . for each of them | find `pwd` -name "file.ext" -exec echo $(dirname {}) \; |
Find all files/directories under $something directory | find $something |
Enables shell option 'histappend'. | shopt -s histappend |
Remove all libGLE* files from the current directory tree | find . -name libGLE* | xargs rm -f |
Report file systems disk usage, elide all entries insignificant to available space, and produce a grand total. | df --total |
Search the /path directory tree for files matching pattern '*.foo' | find /path -name '*.foo' |
Remove empty directories from directory tree /srv/${x} | find /srv/${x} -type d -empty -exec rmdir {} \; |
Find all *.mov files under current directory and execute /path/to/myffmpeg.sh with each file path as its argument | find . -iname "*.mov" -exec /path/to/myffmpeg.sh {} \; |
Unhide all hidden files in the current directory | find . -maxdepth 1 -type f -name '\.*' | sed -e 's,^\./\.,,' | sort | xargs -iname mv .name name |
display all the html files in the current folder | find . -name \*.html |
search for the word echo all the bash files in the current folder | find . -name "*.bash" |xargs grep "echo" |
create a gzip of all the files in the current folder excluding the already gzipped files | gzip `find . \! -name '*.gz' -print` |
In the current shell, interpret 'incl.sh' which is in the directory pointed by variable DIR | source "$DIR/incl.sh" |
display all the empty files in the folder /opt (file size 0 bytes) | find /opt -type f -empty |
find all regular/normal files in the current folder that have been modified in the last 120 hours | find -mtime -5 -type f -print |
Display the file type description of /bin/bash, ie. symbolic link, ELF executable, etc. | $ file /bin/bash |
Count the number of regular files in the current directory that contain a vowel in their names | find . -maxdepth 1 -type f -iname '*[aeiouy]*' -printf ".\n" | wc -l |
Split "file.txt" excluding the first line into files with at most 20 lines each and a prefix "split_" | tail -n +2 file.txt | split -l 20 - split_ |
Lists all top-level files in a '/home/dreftymac/' folder. | ls /home/dreftymac/ |
display all the java script files in a folder | find src/js -name '*.js' |
Look for files with wide open permissions | find . -type f -perm 777 -exec ls -l {} \; |
Find all the files in file system which are modified more than 50 days back and less than 100 days | find / -mtime +50 –mtime -100 |
Merge the first "$lc" lines of "current.txt" and the last "$lc" lines of "current.txt" and display the result as a comma separated table | paste < < | column -t -o, |
Find all *.rb files under current directory and count their line numbers | find . -name "*.rb" -type f | xargs wc -l |
Replace ",," with ", ," twice in "data.csv" and display the "," delimited result as a table | sed 's/,,/, ,/g;s/,,/, ,/g' data.csv | column -s, -t |
Prints calendar for a current month without first day of a week. | cal | sed -e 's/^.\{3\}//' -e 's/^\(.\{15\}\).\{3\}$/\1/' |
Print all unique file paths under "dir1" compared to "dir2" | comm -23 <(find dir1 | sed 's/dir1/\//'| sort) <(find dir2 | sed 's/dir2/\//'| sort) | sed 's/^\//dir1/' |
Calculate md5 checksum of $KEY, take the 1st to 10th character, append them with the string '/tmp/command_cache.' and save the rsultant string to variable FILE | FILE="/tmp/command_cache.`echo -n "$KEY" | md5sum | cut -c -10`" |
Raise an error if there is a reference to a non-existent environment variable and exit the shell immediately if there is any error | set -eu |
Write 10 lines of "y" to file "10lines.txt" | yes | head -n10 > 10lines.txt |
Print last 10 commands in history | history 10 |
Search the /path directory tree for files lacking the group writable bit | find /path ! -perm /020 |
Recursively find the latest modified file in the current directory | find . -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" " |
Recursively change the group ownership to "laravel" in "./storage" | sudo chown -R :laravel ./storage |
show all .cpp, .c, .h, .hpp files in the folder ~/src | find ~/src -type f \( -iname '*.cpp' -or -iname '*.h' -or -iname '*.c' -or -iname '*.hpp' \) -exec echo {} \; |
display all the files in the current folder excluding those that are present in the sub directory aa and display those files that start with the word "file" | find . \( -type d -name aa -prune \) -o \( -type f -name 'file*' -print \) |
Find all files under /home/username/public_html/sites/all/themes and set their permission to 640 | find /home/username/public_html/sites/all/themes -type f -exec chmod 640 {} + |
Prints long recursive listing of all content of a root folder, saving output to 'output.file'. | ls -lR / | tee output.file |
Find all regular files under current directory non-recursively that have execute permission set for all (user, group and other) | find . -maxdepth 1 -type f -perm -uga=x |
change the group of all directories in the current folder | find . -type d -exec chgrp usergroup {} \; |
Get from file 'File1.txt' strings starting with 'Q', extract only part of them following after '=' sign, and print which ones are not found in 'File2.txt' | grep ^Q File1.txt | cut -d= -f2- | sort | comm -23 - < |
Connect as ssh user specified by variable USER to host whose IP address or host name is specified by HOST, and copy remote file specified by variable SRC to location on local host specified by variable DEST, disabling progress info but enabling debug info. | scp -qv $USER@$HOST:$SRC $DEST |
display all the header files and cpp files in the current folder | find . -name \*.h -print -o -name \*.cpp -print |
Find all files under /home that belong to user tecmint | find /home -user tecmint |
search for the regular/normal file "foo.bar" and force delete it | find /home -name foo.bar -type f -exec rm -f "{}" ';' |
list regular files under the current directory ending in .mbox putting a null between each file found | find . -type f -wholename \*.mbox -print0 |
Find files in the current directory and below that are 2000 kB in size | find . -size 2000k -print |
Save the system host name in variable "HOSTNAME" | HOSTNAME="`hostname`" |
Change the owner and group of "it" to "root" | chown root:root it |
Print the last command in history | history | tail -1 | awk '{print $1}' |
Gets IP address of 'en1' network interface. | ifconfig en1 | sed -n '/inet addr/s/.*addr.\ .*/\1/p' |
find all the file which name end with c or h and content contain 'thing' | find . -name '*.[ch]' -print0 | xargs -r -0 grep -l thing |
Print a colon-separated list of all directories from the ~/code directory tree, except hidden ones and those below them | find ~/code -type d | sed '/\/\\./d' | tr '\n' ':' | sed 's/:$//' |
Unpack all *.gz archives in the current directory tree | find . -name '*.gz' -print0 | xargs -0 gunzip |
Copy all files (not directories) in "/path/to/local/storage" to "/path/to/copy" on host "remote.host" authenticating as user "user" | rsync /path/to/local/storage [email protected]:/path/to/copy |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.