nl_command
stringlengths 14
387
| bash_code
stringlengths 0
532
|
---|---|
Copy all ".xml" files in the current directory tree to "/new/parent/dir" preserving the directory hierarchy | find . -name \*.xml -print0 | cpio -pamvd0 /new/parent/dir |
Calculate the crc32 of "testring" | echo -n teststring | gzip -1 | tail -c 8 | head -c 4 | hexdump -e '1/4 "%08x" "\n"' |
Recursively finds all '*.pdf' files and folders in a current folder and removes them without prompting. | find . -name "*.pdf" -print0 | xargs -0 rm -rf |
Search all files from the /tmp directory tree for the string "search string" | find /tmp -type f -exec grep 'search string' '{}' /dev/null \+ |
List all regular files from the current directory tree that were modified less than 60 minutes ago | find . -mmin -60 -type f | xargs ls -l |
Find *.jpg screenshots that are bigger than 500k | find ~/Images/Screenshots -size +500k -iname '*.jpg' |
Find files in the current directory and its sub-directories that begin with 'f'. | find . -name f* -print |
Mount "/path/to/device" on "/path/to/mount/location" as a vfat filesystem and a loop back device | mount /path/to/device /path/to/mount/location -o loop -t vfat |
Save in QUEUE_PIDS variable only pid numbers that stored in $NEW_PIDS variable | QUEUE_PIDS=$(comm -23 <(echo "$NEW_PIDS" | sort -u) <(echo "$LIMITED_PIDS" | sort -u) | grep -v '^$') |
Find all symbolic links under '/proc/$pid/fd' directory tree with name pattern '$save_path/sess_\*' and update their timestamps | find "/proc/$pid/fd" -ignore_readdir_race -lname "$save_path/sess_\*" -exec touch -c {} |
find all the jpg files in the directory /ftp/dir which are bigger than 500KB | find /ftp/dir/ -size +500k -iname "*.jpg" |
Find files associated with an inode | find . -inum 968746 -print |
Find all *.php files and *.js files/directories under /home/jul/here excluding /home/jul/here/exclude/* paths | find /home/jul/here -type f -iname "*.php" ! -path "/home/jul/here/exclude/*" -o -iname "*.js" ! -path "/home/jul/here/exclude/*" |
Go to first directory specified in PATH which contains the command 'oracle' | cd $(dirname $(which ls)) |
Print all files/directories with their sizes under $WHATEVER directory tree | find $WHATEVER -printf "%s %p\n" |
Prints total count of lines of all *.php files in a current folder and subfolders. | find . -name '*.php' -type f -exec cat -- {} + | wc -l |
Find all directories in 1 level down the current directory | find . -mindepth 1 -maxdepth 1 -type d |
Print the ping time number only of a single request to "8.8.8.8" | ping -c 1 8.8.8.8 | awk 'FNR == 2 { print $(NF-1) }' | cut -d'=' -f2 |
List the commands in /usr/bin, pausing for user input after each page. | ls /usr/bin | more |
find the file "MyCProgram.c" in the current folder | find -iname "MyCProgram.c" |
find all the file that have not been modified in the last 3 days | find ./ -daystart -mtime +3 |
find *.gif files under the currently directory and sub-directories and list them using the ls command | find . -name *.gif -exec ls {} \; |
Print "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" and append to file "/etc/apt/sources.list" | echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list |
display all the ".c" files in the current folder excluding those that are present in all the sub directories | find . \ -name "*.c" -print |
display all files in the entire file system excluding those that are in the transfer directory | find / -name /transfer -prune -o -print |
take all the files in the current folder and pass them as argument to a program | find . -exec program {} + |
Create all directories in the path specified by variable $javaUsrLib as super user | sudo mkdir -p $javaUsrLib |
Convert *.au files to *.wav files using `sox' | find -type f -name '*.au' | awk '{printf "%s %s\n",$0,$0".wav" }' | xargs sox |
Unzip "file.gz", list the unique first comma separated field prefixed by the number of occurrences, sort from least frequent to most frequent | zcat file.gz | cut -f1 -d, | sort | uniq -c | sort -n |
List all files and directories residing in the current directory and below | find | xargs ls |
display all non empty directories in current folder | find . \! -empty -type d |
Search directory foo for files containing "foo/bar" in their full names | find foo -path foo/bar -print |
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" |
display all the files in the current folder which hare in the sub directory trees of the folders which begin with the word "kt" followed by a digit | find . -path './kt[0-9] ' |
display all the tex files in the current folder | find . -name \*.tex |
find all the directories in the home folder and make create the directory junk. If any errors occur discard them. | find ~ -type d -exec mkdir junk {} \; 2> /dev/null |
Find all .php files starting from the root directory / | find / -name "*.php" |
Changes the group of defined file. | chgrp |
find all files in the folder /path/to/dir which have been modified between two dates | find /path/to/dir -newermt yyyy-mm-dd ! -newermt yyyy-mm-dd -ls |
Find all files/directories under test directory | find test |
Find all *.php (case insensitive) files and *.js files/directories (case insensitive) under /home/jul/here excluding /home/jul/here/exclude/* paths | find /home/jul/here -type f -iname "*.php" ! -path "/home/jul/here/exclude/*" -o -iname "*.js" ! -path "/home/jul/here/exclude/*" |
Find and remove multiple *.txt files | find . -type f -name "*.txt" -exec rm -f {} \; |
Find *.js UTF-8 files with BOM and correct them | find . -iname *.js -type f -exec sed 's/^\xEF\xBB\xBF//' -i.bak {} \; -exec rm {}.bak \; |
Stores system load average number in the 'proc_load_average' variable. | proc_load_average=`w | head -1 | cut -d" " -f13 | cut -d"," -f1-2 | tr ',' '.'` |
split the file data.csv into pieces per 100 mb named as data.tsv.NNN with digital prefixes | split -C 100m -d data.tsv data.tsv. |
Count all the mp3 files in the music user's home and subdirs. | find ~music -type f -iname *.mp3 | wc -l |
Print the most repeated line in "list2.txt" that exists in "list1.txt" prefixed by the number of occurrences | grep -Ff list1.txt list2.txt | sort | uniq -c | sort -n | tail -n1 |
Save the FQDN host name of the system in variable "hnd" | hnd=$(hostname -f) |
Find all files with 644 permission and change the permission to 664 | find . -type f -perm 644 -exec chmod 664 {} \; |
Finds strings with dot-separated sequence of numbers, and prints part of that sequence before the second and third dot. | echo "$f" | grep -Eo '[0-9]+[.]+[0-9]+[.]?[0-9]?' | cut -d. -f3 |
Find all files under current directory | find . -type f |
Find all files/directories greater than 100MB and print their list along with their size in /root/big.txt file | find \( -size +100M -fprintf /root/big.txt '%-10s %p\n' \) |
Move "caniwrite" without clobbering into "/usr/local/bin" | mv -nv caniwrite /usr/local/bin |
display all files in the current folder which are not empty | find . ! -size 0k |
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 |
search for files that are readable for everybody, have at least on write bit set but are not executable for anybody | find . -perm -a+r -perm /a+w ! -perm /a+x |
Find all files/directories under /myfiles that are 2560 bytes in size | find /myfiles -size 5 |
Compare files "A1" and "A2" with 3 lines of unified context and print lines beginning with "+" | diff -u A1 A2 | grep -E "^\+" |
find md5sum of a string stored in $pass | printf '%s' "$pass" | md5 |
Serach in root directory all files which have more than 2 links. | find / -links +2 -print |
Use "composer validate" command on all composer.json files | find . -type f -name "composer.json" -exec composer validate {} \; |
Search for files with "demo" in their names and "sitesearch" in their path names | find . -iname '*demo*' | grep -i sitesearch |
Find files under current directory that are newer than $date_time in regards of modification time | find . -type f -newermt "$date_time" |
Find all files under ${searchpath} that match the regex ${string1}.*${string2}.*${string3} in their contents where ${string1} etc.. will be expanded | find "${searchpath}" -type f -print0 | xargs -0 grep -l -E "${string1}.*${string2}.*${string3}" |
Show all files that have not been accessed in the $HOME directory for 30 days or more | find $HOME -atime +30 |
Split a file ADDRESSS_FILE into pieces per 20 lines named with prefix "temp_file_ and numeric suffixes | split -l20 ADDRESSS_FILE temp_file_ |
Print the list of regular files in the current directory and all subdirectories | find . -type f |
Count the number of files named 'job.history' under '/data/SpoolIn' directory tree that match 'FAIL' in their contents | find /data/SpoolIn -name job.history -exec grep -l FAIL {} \+ | wc -l |
display all the regular/ normal files in a folder | find src/js -type f |
Counts lines in file file1 and shows progress bar while doing. | tail -n 100 file1 | pv | wc -l |
Recursively find the latest modified file in the current directory | find . -type f -print0|xargs -0 ls -drt|tail -n 1 |
Remove all *.sql files in the $backup_path directory that were last modified more than 5 days ago | find $backup_path/*.sql -mtime +5 -exec rm -f {} \; |
Change permissions to 644 for all files in the current directory tree | find . -type f | xargs -I{} chmod -v 644 {} |
Execute "ssh raptor.lan hostname\; uptime" on server "genja.org" | ssh -t genja.org 'ssh raptor.lan hostname\; uptime' |
Find all *.* files under current directory | find . -type f -a -name '*.*' |
find all files in the current directory and sub-directories that were accessed after modifying /etc/hosts | find -anewer /etc/hosts |
Gets MAC address of eth0 network interface. | ifconfig eth0 | grep HWaddr | cut -d ' ' -f 9 |
Print a sorted list of the subdirectories of ~/Music | find ~/Music/ -maxdepth 2 -mindepth 2 -type d | sort |
Find all broken symlinks under /path/to/search directory | find /path/to/search -type l -xtype l |
Find and remove multiple *.mp3 files | find . -type f -name "*.mp3" -exec rm -f {} \; |
Remove all empty directories under the current directory and below | find ./ -type d -size 0c -print | xargs rmdir |
List all the emptry files in thecurrent directory only. | find . -maxdepth 1 -empty |
Search the root directory and its subdirectories for files risiding on NTFS or VFAT filesystems | find / -maxdepth 2 \ 2> /dev/null |
Find all directories under /home/me/target_dir_1 | find /home/me/target_dir_1 -type d |
display all the jpg files in the current folder which belong to the user nobody | find . -name *.jpg -user nobody |
Find all empty directories recursively starting from the current one and delete them | find . -type d -empty -print0 | xargs -0 /bin/rmdir |
find all files in the current folder which start with pro | find . -name pro\* |
Change the owner of "$JBOSS_CONSOLE_LOG" to "$JBOSS_USER" | chown $JBOSS_USER $JBOSS_CONSOLE_LOG |
Reversibly sorts content of the '${TMP}/${SCRIPT_NAME}.name' file | cat ${TMP}/${SCRIPT_NAME}.name|sort -r; |
Find and print detailed information about all regular files in your home directory and below that have only the group permission set | find . -perm g=r -type f -exec ls -l {} \; |
Execute script "your_command_here" passing all regular files from directory tree /target/path as arguments to it | find /target/path -type f -print0 | xargs -0 your_command_here |
Change permissions of all directories in the ~/dir_data directory tree in accordance with mode `a+xr,u+w' | find ~/dir_data -type d -exec chmod a+xr,u+w {} \; |
Extract number from $filename of the form "something_12345_else" and set the variable "number" to this number. | number=$ |
Search for the case insensitive regex expanded by $2 in all files named $1 under current directory | find . -name "$1" -type f -exec grep -i "$2" '{}' \; |
file1.txt and file2.txt both contain a name and a number on each line. For each name whose corresponding number does not match in both files, display the "Age of ... is different" message. | join file{1,2}.txt | awk '$2 != $3 { print "Age of " $1 " is different" }' |
Print second section of line <line> where sections are separated by one or more whitespace. | echo -e "<line>" | sed 's:\s\+:\t:g' | cut -f2 |
Search the path given as the $absolute_dir_path variable for regular files | find "$absolute_dir_path" -type f -print0 |
display the number of lines in all the php files in the current folder | find -name '*php' | xargs cat | wc -l |
Find all files in the /var/tmp directory tree with uid=1000 | find /var/tmp -uid 1000 |
Search the system for directories named "needle" | find / -type d -name "needle" |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.