nl_command
stringlengths 14
387
| bash_code
stringlengths 0
532
|
---|---|
Find all 0644 permission files/directories under current directory tree and show only the first 10 of them | find . -perm 0644 | head |
Make regular files from debian/fglrx-amdcccle/usr/lib/fglrx/bin/ executable for all | find debian/fglrx-amdcccle/usr/lib/fglrx/bin/ -type f | xargs chmod a+x |
find all the file that have been modified exactly 3 days ago ( considers day starting not 24 hours ) | find ./ -daystart -mtime -3 |
display all the files in the current folder which are present in the path "./src/emacs" | find . -path './src/emacs' -prune -o -print |
Find all files under current directory with their size and paths, reverse sort them numerically, then print the first 4 entries by removing all matches to the regex [0-9]+\s from each line of the output | find -type f -printf "%s %p\n" | sort -nr | head -n 4 | sed -r 's/[0-9]+\s//g' |
record the absolute path of a relative path to a variable | SRC_DIR=$ |
Find all *.txt files/directories under current directory | find -name \*.txt |
Forward all connections to client localhost 3309 via the SSH tunnel to "mysql_access_server" and then connect to host "sqlmaster.example.com" on port 3306 | ssh -f mysql_access_server -L 3309:sqlmaster.example.com:3306 -N |
search for all the directories starting with the word in the current folder and give them as input to the script fixmbox | find . -name 'm?' -type d -exec ./fixmbox {} + |
Remove all files that are not newer than Jul 01 by modification time | find /file/path ! -newermt "Jul 01" -type f -print0 | xargs -0 rm |
Find all Read Only files in entire file system and show a few lines of output from the beginning | find / -perm /u=r | head |
Find all xml files under current directory | find . -name '*.xml' |
Find all files/directories named 'test' under current directory tree | find . -name test |
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 {} \; |
Check if 'nullglob' shell option is enabled, and if so, saves its status in 'is_nullglob' variable. | is_nullglob=$( shopt -s | egrep -i '*nullglob' ) |
Find all directories under 'test' directory tree that match the regex '.*/course[0-9.]*' in their paths | find test -type d -regex '.*/course[0-9.]*' |
List the directory contents of the current working directory | echo $(ls $) |
create a symbolic link with absolute path "/cygdrive/c/Users/Mic/mypics" to file "/cygdrive/c/Users/Mic/Desktop/PENDING - Pics/" | ln -sf '/cygdrive/c/Users/Mic/Desktop/PENDING - Pics/' /cygdrive/c/Users/Mic/mypics |
Rename "old" to "tmp" | mv old tmp |
Remove all .gz files in the current directory tree | find . -name '*.gz' -type f -printf '"%p"\n' | xargs rm -f |
find all files in the home folder that are modified in the last 24 hours | find $HOME -mtime -1 |
Search /usr/src for filenames not ending in "*,v" | find /usr/src ! \ '{}' \; -print |
Print the list of directories that are present in the /mnt/raid directory tree | find /mnt/raid -type d |
search for the directory "config" in the current folder and change directory to the first instance of the search | cd $(find . -name config -type d | sed 1q) |
recursively change user of the direct /home/test/ and all files into it to user test | sudo chown -R test /home/test |
Prints newline, word, and byte count for each *.py in a current folder. | wc *.py |
Find all .txt files in current directory and rename with .html . | find . -type f -name "*.txt" -exec mv {} `basename {} .html` .html \; |
Remove all regular files from the current directory tree that were modified between August 10th and August 17th | find . -type f -newermt "Aug 10" ! -newermt "Aug 17" -exec rm {} \; |
Make directory and parents as needed to "$FINALPATH" | mkdir -p "$FINALPATH" |
Remove files erroneously named `-F' | find . -name "-F" -exec rm {} \; |
Search the /storage/sdcard0/tencent/MicroMsg/ directory tree for JPG files | find /storage/sdcard0/tencent/MicroMsg/ -type f -iname '*.jpg' -print0 |
Execute "1" and write standard output and error to standard output and file "${LOG_FILE}" | exec 1 2>&1 | tee ${LOG_FILE} |
Find all files owned by group `group2' | find / -group group2 |
SSH into server "app1" as the current user | ssh app1 |
Find all files matching "abc*" in the current directory and append "\tok" | find . -name 'abc*' | sed 's/$/\tok/' | column -t |
Recursively changes group ownership of everything in 'files' to 'my_group'. | chgrp -R my_group files |
Find broken symlinks in current directory | find -L -type l |
Find *.c and *.sh files | find . -type f \ |
Examines the path expanded by variable $FILENAME to see if it is a symlink and if so, sets SOURCE_DIR to the location of the link itself. | ls -l $FILENAME | grep -q ^l && SOURCE_DIR=$; |
Replace all ocurrences of '<title>' with 'sblmtitle\n<title>' in all the regular files with '.html' extension under current directory tree | find ./ -type f -name '*.html' | xargs sed -i 's/<title>/sblmtitle\n<title>/g' |
Print all file/directory names without white space safety under the /proc directory | find /proc | xargs |
find all the ".jpg" files in current folder and display their count | find ./ -name '*.jpg' -type f | wc -l |
Change to folder where the oracle binary is. | cd $(dirname $) |
Read a line from an interactive shell's standard input into variable "message" without backslash escapes and prompt $'Please Enter a Message:\n' | read -rep $'Please Enter a Message:\n' message |
find all the files in the entire filesystem which belong to the user root and display the ten files. | find / -user root | head |
Remove all \*~ files under dir | find dir -name \\*~ -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 -execdir /bin/rm {} \+ |
Print file name without the last two extensions assuming the file name doesn't contain any other dots. | echo "$FILE"|rev|cut -d"." -f3-|rev |
Create a symolic link in "/usr/local/bin/" to "/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl" | ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/ |
Find all .gz archives in the current directory tree and check if they are valid | find . -name *.gz -exec gunzip '{}' \; |
Take the last slash-separated section of variable "FILE" and copy it to variable "NAME". | NAME=`basename "$FILE"` |
Print the IP addresses for the current host name | hostname -i |
List recursively all files and directories in /var/www and pass the result to the `more' pager | find /var/www | more |
Search for the system host name in "/etc/hosts" and print the IP address in the first awk field | more /etc/hosts | grep `hostname` | awk '{print $1}' |
Count the number of non localhost users | who | grep -v localhost | wc -l |
Find all regular files that were modified $FTIME days ago under current directory tree | find . -type f -mtime $FTIME |
Grab "variable = value" pairs from a windows style .ini file into the current shell. | source <(grep = file.ini | sed 's/ *= */=/g') |
Save the first two letters of the system host name to variable "DC" | DC=`hostname | cut -b1,2` |
Check if the $somedir directory is empty | find "$somedir" -maxdepth 0 -empty -exec echo {} is empty. \; |
Finds all logged in users. | w | awk '{print $1}' |
search for all the regular/normal mp3 files in the file system and move them to the folder /mnt/mp3 | find / -iname "*.mp3" -type f -exec /bin/mv {} /mnt/mp3 \; |
search for the directory "mysql" in the entire file system | find / -name mysql -type d |
Find all files in the current directory tree whose names begin with '-' | find . -name '[-]*' |
Add execute permission to "ComputeDate", "col", and "printdirections" for all users | chmod a+x ComputeDate col printdirections |
Show all variables whose name or value contains "PATH", sorted in reverse alphabetical order. | env | uniq | sort -r | grep PATH |
Extract protocol and host name from URL. | echo "$url" | cut -d'/' -f1-3 |
Prints long listing of a last modified file in a current folder. | find . -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" " | sed 's/.*/"&"/' | xargs ls -l |
search for the word "foo" in all the regular/normal files in the directory "/path/to/dir" | find /path/to/dir -type f | xargs grep -l "foo" |
find all the files in the file system which have been changed 1 minute ago. | find / -newerct '1 minute ago' -print |
Set environment variables using assignments are listed in '.env' file and run 'rails' command with defined environment | env $ rails |
Prints what year it was 222 days ago | date --date="222 days ago" +"%Y" |
find all the files that have been modified today | find . -type f -daystart -mtime 0 |
List all files and directories residing in the current directory and below | find | xargs ls |
Get only the latest version of the file 'filename' under current directory | find . -name 'filename' | xargs -r ls -tc | head -n1 |
Recursively finds all files in root folder and prints all strings with 'text-to-find-here' from that files, ignoring binary files. | find / -type f -exec grep -l "text-to-find-here" {} \; |
Find all directories with space in their names under current directory and rename them by replacing all spaces with _ | find -name "* *" -type d | rename 's/ /_/g' |
display all the files in the current folder along with their timestamps and sort them and save them in the file1 | find -printf '%p %T@\n' | sort > file1 |
List all environment variables whose name contains 'ipo', showing only the names of the variables and not their values. | env | grep ipo | awk 'BEGIN {FS="="} ; { print $1 } ' |
Overwrite a file 'my-existing-file' with random data to hide its content | shred my-existing-file |
search for all the php files in the folder "/home/mywebsite" which have been changed in the last 30*24 hours | find /home/mywebsite -type f -name "*.php" -ctime -30 |
delete all the empty in the current folder and all its sub directories | find . -depth -type d -empty -exec rmdir {} \; |
find all files in the current folder and search for a word in them. | find . -type f -exec grep "applicationX" {} \; |
Print a list of unique users who are logged in | who | cut -d' ' -f1 | sort | uniq |
display all php,xml and phtml files in current folder | find . -name '*.php' -o -name '*.xml' -o -name '*.phtml' |
Find regular files that have SUID or SGID set | find / -perm +6000 -type f |
Find all files/directories under current directory and set their permission to 775 | find . -type f -exec chmod 775 {} \; |
Search for files/directories named 'fileName.txt' under current directory tree without traversing into './ignored_directory' | find . -path ./ignored_directory -prune -o -name fileName.txt -print |
Make directory "mybuild" | mkdir mybuild |
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]*' |
Find all files/directories that start with 'test' in their names under current directory tree | find . -name 'test*' |
Search for $GROUP at the beginning of each line in /etc/group and print the last colon (':') separated entry with comma replaced with newlines | grep ^$GROUP /etc/group | grep -o '[^:]*$' | tr ',' '\n' |
Find all *.rb (regular) files under current directory and count their line numbers ensuring white space safety on file name/path. | find . -name "*.rb" -type f -print0 | xargs -0 wc -l |
Find all files in $dir directory without going into sub-directories and print only their names preceded by 3 spaces | find "$dir" -maxdepth 1 -type f | sed 's#.*/# #' |
Mathematically sum all lines in "filename" | cat filname | lua -e "sum = 0;for i in io.lines do sum=sum+i end print" |
Decompresses each of "*bz2" files under the current folder, redirecting output to the standard out, and prints only fourth of comma-separated fields. | find . -name "*.bz2" -print0 | xargs -I{} -0 bzip2 -dc {} | cut -f, -d4 |
Uncompress and unarchive "data.tar.gz" | gzip -dc data.tar.gz | tar -xvf - |
Print the mount point of the last mounted drive | mount | tail -1 | sed -e "s/^[^/]*\(.*\) type .*$/\1/g" |
Execute "2" and write output to standard output and file "${LOG_FILE}" | exec 2 | tee ${LOG_FILE} |
Execute "utility" for each file in the current directory tree passing the pathname as a command line argument | find . -exec utility \; |
Print a list of all regular files residing in the current directory | find . -maxdepth 1 -type f -print0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.