[ { "nl_command": "Look for any files that were modified 2-5 days ago", "bash_code": "find -mtime +2 -mtime -5" }, { "nl_command": "Creates temporary file in a TMPDIR folder or /tmp folder if TMPDIR doesn`t defined, with file name like current shell name and '-XXXXX'-formatted suffix, and saves created path to the 'tempFile' variable.", "bash_code": "tempFile=\"$(mktemp \"${TMPDIR:-/tmp/}$(basename \"$0\")-XXXXX\")\"" }, { "nl_command": "Find all files with space in their names under current directory", "bash_code": "find . -type f -name '* *'" }, { "nl_command": "find regular which case-insensitive name is foo in current directory", "bash_code": "find . -iname foo -type f" }, { "nl_command": "Find all the files under /etc directory which are larger than 100k", "bash_code": "find /etc -size +100k" }, { "nl_command": "Find all directories under current directory", "bash_code": "find -type d" }, { "nl_command": "search for the regular/normal file \"Dateiname\" in the entire file system", "bash_code": "find / -type f -iname \"Dateiname\"" }, { "nl_command": "Download 10000 web pages \"https://www.example.com/page{}.html\" 100 at a time where \"{}\" ranges from 1 to 10000", "bash_code": "seq 10000 | parallel -j100 wget https://www.example.com/page{}.html" }, { "nl_command": "Go to previous working directory.", "bash_code": "cd -" }, { "nl_command": "Change the group of all directories (except those with a '.') under current directory tree to a group with the same name as the directory name", "bash_code": "find . -type d | sed -e 's/\\.\\///g' | awk '{print $1, $1}' | xargs chgrp" }, { "nl_command": "Remove all files whose names start with spam-", "bash_code": "find . -name 'spam-*' | xargs rm" }, { "nl_command": "Find all *.p[lm] files under /users/tom directory that matches the regex '->get(\\|#hyphenate' in their contents", "bash_code": "find /users/tom -name '*.p[lm]' -exec grep -l -- '->get(\\|#hyphenate' {} +" }, { "nl_command": "Print the date followed by the host name", "bash_code": "echo `date` `hostname`" }, { "nl_command": "display all text files in current folder", "bash_code": "find . -name \".txt\"" }, { "nl_command": "Create tar archive \"dirall.tar\" and copy all files from directory tree /tmp/a1 to it", "bash_code": "find /tmp/a1 -print0 | tar --null -T- -cvf dirall.tar" }, { "nl_command": "Compare files 'file1' and 'file2' and print in three columns strings unique for first file, second file, and common ones", "bash_code": "comm abc def" }, { "nl_command": "Find all files in the /home/ directory tree that are owned by bob", "bash_code": "find /home -user bob" }, { "nl_command": "Find \"file.xml\" under the current directory and change directory to its parent", "bash_code": "cd `find . -name file.xml -exec dirname {} \\;`" }, { "nl_command": "Run 'git pull' and, if successful, 'git status' in every git repository in the current directory", "bash_code": "find . -type d -name .git -exec sh -c \"cd \\\"{}\\\"/../ && pwd && git pull && git status\" \\;" }, { "nl_command": "display all directories in current folder excluding those that are present in .git folder", "bash_code": "find . -iregex '.*/.git/.*' -prune -o -type d -name 'CVS'" }, { "nl_command": "Find the first file/directory under current directory and quit", "bash_code": "find . ... -print -quit" }, { "nl_command": "Find all files with the name \"MyProgram.c\" in the current directory and its sub-directories while ignoring the case of the file name.", "bash_code": "find -iname \"MyCProgram.c\"" }, { "nl_command": "Sum the total content size of the extracted files in \"archive.tar.gz\"", "bash_code": "tar tzvf archive.tar.gz | sed 's/ \\+/ /g' | cut -f3 -d' ' | sed '2,$s/^/+ /' | paste -sd' ' | bc" }, { "nl_command": "Print only printable characters from \"/dev/urandom\"", "bash_code": "cat /dev/urandom | tr -dC '[:graph:]'" }, { "nl_command": "Search /usr/local recursively for directories whose names end with a number 0-9", "bash_code": "find /usr/local -type d -name '*[0-9]'" }, { "nl_command": "Delete all lines matching \"some string here\" in \"yourfile\"", "bash_code": "sed --in-place '/some string here/d' yourfile" }, { "nl_command": "Set permissions to ug=rwx,o= for directories inside the ./default/files tree", "bash_code": "find ./default/files -type d -exec chmod ug=rwx,o= '{}' \\;" }, { "nl_command": "Read a line of standard input with prompt \"Enter the path to the file: \" and suggestion \"/usr/local/etc/\" and save the response to variable \"FILEPATH\"", "bash_code": "read -e -p \"Enter the path to the file: \" -i \"/usr/local/etc/\" FILEPATH" }, { "nl_command": "Write \"127.0.0.1 ad.doubleclick.net\" to the console and append to \"/etc/hosts\" as root", "bash_code": "echo 127.0.0.1 ad.doubleclick.net | sudo tee -a /etc/hosts" }, { "nl_command": "Set permissions of all directories under \"/opt/lampp/htdocs\" to 711", "bash_code": "find /opt/lampp/htdocs -type d -exec chmod 711 {} \\;" }, { "nl_command": "display all the text files from the current folder and skip searching in skipdir1 and skipdir2 folders", "bash_code": "find . \\( -name skipdir1 -prune , -name skipdir2 -prune -o -name \"*.txt\" \\) -print" }, { "nl_command": "Find all files/directories under current directory tree whose names start with 'test' followed by two digits and end with '.txt' extension", "bash_code": "find . -regextype sed -regex \"./test[0-9]\\{2\\}.txt\"" }, { "nl_command": "Find the password file between sub-directory level 2 and 4", "bash_code": "find -mindepth 3 -maxdepth 5 -name passwd" }, { "nl_command": "Search the current working directory tree for files whose names start with \"fileA_\" or \"fileB_\"", "bash_code": "find . -name 'fileA_*' -o -name 'fileB_*'" }, { "nl_command": "display all the html files in the current folder excluding search in the path ./foo", "bash_code": "find . -path \"./foo\" -prune -o -type f -name \"*.html\"" }, { "nl_command": "For each line whose second field is the same in both files, output: first field of second file, second field of first file, and first field of second file.", "bash_code": "$ join -j 2 -o 1.1 1.2 2.1 < <" }, { "nl_command": "Continuously send \"y\" as input to \"cat\" which outputs to \"more\"", "bash_code": "yes | cat | more" }, { "nl_command": "Get the number of regular files in the directory given as the bash script argument $1", "bash_code": "find $1 -type f | wc -l" }, { "nl_command": "find the type & description of all the regular/normal files in the home folder", "bash_code": "find /home -type f -print0 | xargs -0 file" }, { "nl_command": "Move all files and directories in the current directory to \"somewhere/\"", "bash_code": "mv `ls` somewhere/" }, { "nl_command": "display all directories in current folder", "bash_code": "find . -type d -print0" }, { "nl_command": "Filter out current date in current time zone from the GMT+30 and GMT+20 representations of current date and show the last one", "bash_code": "echo -e \"$(TZ=GMT+30 date +%Y-%m-%d)\\n$(TZ=GMT+20 date +%Y-%m-%d)\" | grep -v $(date +%Y-%m-%d) | tail -1" }, { "nl_command": "display a long listing of all the files in the current folder in sorted order, which are bigger than 10KB", "bash_code": "find . -size +10k -exec ls -ls {} \\+ | sort -nr" }, { "nl_command": "Prints list of folders containing '.git', searching recursively from a current folder.", "bash_code": "find . -name '.git' | xargs -n 1 dirname" }, { "nl_command": "find all the files ending with undo in the current folder and calculate the total size of these files", "bash_code": "find . -name \"*.undo\" -ls | awk '{total += $7} END {print total}'" }, { "nl_command": "find the file with inode $inum under the current directory and delete it", "bash_code": "find . -inum $inum -exec rm {} \\;" }, { "nl_command": "Search for the wp-config.php file in /var/www and one level below", "bash_code": "find /var/www/ -name wp-config.php -maxdepth 2" }, { "nl_command": "find all the \".flac\" files in the current folder and convert them to mp3 with 128k bit rate", "bash_code": "find -name \"*.flac\" -exec ffmpeg -i {} -acodec libmp3lame -ab 128k {}.mp3 \\;" }, { "nl_command": "Find all directories under ${1:-.} directory without descending into any sub-directories", "bash_code": "find ${1:-.} -mindepth 1 -maxdepth 1 -type d" }, { "nl_command": "Find all the .mp3 files in the music folder recursively and pass them to the ls command", "bash_code": "find ./music -name \"*.mp3\" -print0 | xargs -0 ls" }, { "nl_command": "Change the permissions of the current directory and all its subdirectories to 755.", "bash_code": "find . -type d -exec chmod 755 {} \\;" }, { "nl_command": "search the file myfile.txt in the current folder", "bash_code": "find . -name myfile.txt -print" }, { "nl_command": "Search the current directory tree for executable regular files", "bash_code": "find . -executable -type f" }, { "nl_command": "Remove the \"^M\" characters from all *.ext files under /home directory", "bash_code": "find /home -type f -name \"*.ext\" -exec sed -i -e \"s/\\r$//g\" {} \\;" }, { "nl_command": "Print the file sizes along with their paths for all *.txt (case insensitive) files/directories under current directory tree", "bash_code": "find . -name \"*.txt\" -print0 |xargs -0 du -ch" }, { "nl_command": "Search the files residing in the current directory tree whose names contain \"bills\" for \"put\"", "bash_code": "find . -name '*bills*' -exec grep -H \"put\" {} \\;" }, { "nl_command": "find all the directories in the different folders excluding search in the sub directories and create these folders in the current directory", "bash_code": "find /media/New\\ Volume/bhajans -maxdepth 1 -type d | xargs -0 mkdir -p" }, { "nl_command": "Print line number \"${linenum}\" in file \"$filename\"", "bash_code": "cat $filename | sed \"${linenum}p;d\";" }, { "nl_command": "Mount \"/path/to/device\" on \"/path/to/mount/location\" as a vfat filesystem and a loop back device", "bash_code": "mount /path/to/device /path/to/mount/location -o loop -t vfat" }, { "nl_command": "Find the total size of *.jpg files within the current directory tree", "bash_code": "find . -type f -iname '*.jpg' -print0 | du -c --files0-from=-" }, { "nl_command": "Find all files/directories under current directory with 'FooBar' in their paths and copy them to ~/foo/bar", "bash_code": "find .|grep \"FooBar\"|yargs -l 203 cp --after ~/foo/bar" }, { "nl_command": "Find all files/directories under '/usr' directory tree that have not been modified in the last 356 days counting days from today", "bash_code": "find /usr -mtime +356 -daystart" }, { "nl_command": "Make directory \"subdirectory\"", "bash_code": "mkdir subdirectory" }, { "nl_command": "Move all files from the `sourceDir' directory tree to the `destDir' directory", "bash_code": "find sourceDir -mindepth 1 -print0 | xargs -0 mv --target-directory=destDir" }, { "nl_command": "Saves listing of a current folder in 'OUTPUT' variable.", "bash_code": "OUTPUT=\"$(ls -1)\"" }, { "nl_command": "List all .gif files in the current directory tree", "bash_code": "find . -name *.gif -exec ls {} \\;" }, { "nl_command": "display ten files in the tmp directory", "bash_code": "find /tmp | head" }, { "nl_command": "Rename all files in current directory with names starting with \"fgh\" so they start with \"jkl\" instead", "bash_code": "rename 's/^fgh/jkl/' fgh*" }, { "nl_command": "find all files without 777 permision", "bash_code": "find / -type f ! perm 777" }, { "nl_command": "Search the /root directory recursively for files named \"FindCommandExamples.txt\"", "bash_code": "find /root -name FindCommandExamples.txt" }, { "nl_command": "Print the first 10 files or directories found in the /tmp directory tree by `find'", "bash_code": "find /tmp | head" }, { "nl_command": "Print yesterday's date as yyy:mm:dd", "bash_code": "date +%Y:%m:%d -d \"1 day ago\"" }, { "nl_command": "Find files that were modified in less than 1 minute ago", "bash_code": "find / -mmin -1" }, { "nl_command": "Search for all files owned by user www-data that are not larger than 100kb", "bash_code": "find -user www-data -not -size +100k" }, { "nl_command": "Find all files/directories case insensitively containing 'xt' in their names under '/etc' directory tree", "bash_code": "find /etc -iregex '.*xt.*'" }, { "nl_command": "Print the list of .txt files under and below the current directory", "bash_code": "find . -name '*.txt' -print0|xargs -0 -n 1 echo" }, { "nl_command": "Extract five digits sequence from a filename with x number of alphanumeric characters followed by the five digit sequence surrounded by a single underscore on either side then another set of x number of alphanumeric characters.", "bash_code": "echo 'someletters_12345_moreleters.ext' | cut -d'_' -f 2" }, { "nl_command": "Save the UTC date represented by time string $sting2 as the seconds since epoch to variable 'FinalDate'", "bash_code": "FinalDate=$(date -u -d \"$string2\" +\"%s\")" }, { "nl_command": "Print the second line of output of \"ls -l\"", "bash_code": "ls -l | tail -n +2 | head -n1" }, { "nl_command": "search the word NEEDLE and substitute it with REPLACEMENT in all the php files of the current folder", "bash_code": "find ./ -type f -exec sed -i '' 's#NEEDLE#REPLACEMENT#' *.php {} \\;" }, { "nl_command": "Show long listing of current directory by deleting all digits from the output", "bash_code": "ls -lt | tr -d 0-9" }, { "nl_command": "Read a single character from standard input and do not allow backslash to escape characters", "bash_code": "read -rn1" }, { "nl_command": "Make directories \"/tmp/A\", \"/tmp/B\", \"/tmp/C\", and \"/tmp/ dir with spaces\"", "bash_code": "mkdir /tmp/A /tmp/B /tmp/C \"/tmp/ dir with spaces\"" }, { "nl_command": "Recursively copy \"original_dir\" to \"copy_dir\" preserving file/dir timestamps, displaying progress, and skipping files which match in size, keeps partially transferred files.", "bash_code": "rsync -Prt --size-only original_dir copy_dir" }, { "nl_command": "print the line containing TERMINATE and everything after in 'file'", "bash_code": "tail -n \"+$\" file" }, { "nl_command": "Immediately terminate all processes whose command or arguments contain 'amarok'.", "bash_code": "ps aux | grep -ie amarok | awk '{print $2}' | xargs kill -9" }, { "nl_command": "display a long listing of all the regular/normal files in the current folder", "bash_code": "find . -type f -ls" }, { "nl_command": "Finds recursively all folders named 'a' within current folder and removes only ones without files and another folders within.", "bash_code": "find . -name \"a\" -type d | xargs rmdir" }, { "nl_command": "Output two lines of \"-tcp\"", "bash_code": "yes -- \"-tcp\" | head -n 2" }, { "nl_command": "List all files in the current directory tree that were last modified yesterday or later", "bash_code": "find -newermt yesterday -ls" }, { "nl_command": "Generates a randomly sorted list of numbers from 1 to 10.", "bash_code": "seq 1 10 | sort -R | tee /tmp/lst |cat < < \\ <" }, { "nl_command": "Remove all files on the system that have been changed within the last minute", "bash_code": "find / -newerct '1 minute ago' -print | xargs rm" }, { "nl_command": "Count the occurrence of 2 in the string '1 1 2 2 2 5'", "bash_code": "echo \"1 1 2 2 2 5\" | tr ' ' $'\\n' | grep -c 2" }, { "nl_command": "Search for regular files of the grooup 'users' in the file system", "bash_code": "find / -type f -group users" }, { "nl_command": "Delete all files with ' .o' extension in the entire filesystem", "bash_code": "find project / src / -name \"* .o\" -exec rm -f {} \\;" }, { "nl_command": "find all text files in user/directory/ which have been modified today and display the last line of these files", "bash_code": "find /user/directory/ -name \"*txt\" -mtime 0 -type f -printf '%p: ' -exec tail -1 {} \\;" }, { "nl_command": "find all the files in the current folder that have been accessed in today", "bash_code": "find -atime 0" }, { "nl_command": "Find all files/directories under current directory with 'FooBar' in their paths and copy them to ~/foo/bar", "bash_code": "find . | grep \"FooBar\" | tr \\\\n \\\\0 | xargs -0 -I{} cp \"{}\" ~/foo/bar" }, { "nl_command": "Find all files/directories under current directory that match the case insensitive glob pattern {EA,FS}_*", "bash_code": "find . -iname \"{EA,FS}_*\"" }, { "nl_command": "search for a word in all the files in the current directory (case insensitive search)", "bash_code": "find . -type f -exec grep 'needle' {} \\;" }, { "nl_command": "Search /usr/bin for regular files that have been modified within the last 10 days", "bash_code": "find /usr/bin -type f -mtime -10" }, { "nl_command": "Compare files in \"/tmp/dir1\" and \"/tmp/dir2\", treating absent files as empty and all files as text", "bash_code": "diff -Nar /tmp/dir1 /tmp/dir2/" }, { "nl_command": "Make directories and parents as needed for each file path in \"a.txt\" excluding the basename for each path", "bash_code": "cat a.txt | grep / | sed 's|/[^/]*$||' | sort -u | xargs -d $'\\n' mkdir -p" }, { "nl_command": "Search the entire file hierarchy for files larger than 100 megabytes and delete them.", "bash_code": "find / -size +100M -exec /bin/rm {} \\;" }, { "nl_command": "Remove all files with names like \"vmware-*.log\" from the current directory tree", "bash_code": "find . -name \"vmware-*.log\" -exec rm '{}' \\;" }, { "nl_command": "Find all thumb.png files in the temps/ directory tree", "bash_code": "find temps/ -name \"thumb.png\"" }, { "nl_command": "List all regular files under current directory", "bash_code": "find . -type f -print | xargs -n 1" }, { "nl_command": "Look for any instance of \"ds1337\" in the modules.alias file matching current kernel release", "bash_code": "grep ds1337 /lib/modules/`uname -r`/modules.alias" }, { "nl_command": "Print each line in \"set1\" and \"set2\" that does not exist in the other", "bash_code": "sort set1 set2 | uniq" }, { "nl_command": "Make directories \"es/LC_MESSAGES\" as needed and do not error if it exists", "bash_code": "mkdir -p es/LC_MESSAGES" }, { "nl_command": "Search for files with \"sitesearch\" in their names and \"demo\" in their path names", "bash_code": "find . -iname '*sitesearch*' | grep demo" }, { "nl_command": "Find all *.jpg files under current directory and print only unique names", "bash_code": "find . -name \\*.jpg -exec basename {} \\; | uniq -u" }, { "nl_command": "show all the files in the current folder which has the word \"ITM\"", "bash_code": "find . -name \u2018*ITM*\u2019" }, { "nl_command": "display the directory name along with the modified time for all the files /var", "bash_code": "find /var -maxdepth 2 -type d -exec stat -c \"%n %y\" {} \\;" }, { "nl_command": "Numerically sort file \"file.dat\" by the second word of each line and output from greatest value to least value", "bash_code": "sort -nk 2,2 file.dat | tac" }, { "nl_command": "Find files in $DIR_TO_CLEAN that are older than $DAYS_TO_SAVE days and print them with null character appended to their paths", "bash_code": "find \"${DIR_TO_CLEAN?}\" -type f -mtime +${DAYS_TO_SAVE?} -print0" }, { "nl_command": "For each .def file under the current directory, create an empty .def.out file with current timestamp.", "bash_code": "find . -name '*.def' | sed 's/\\(.*\\)/\\1.out/' | xargs touch" }, { "nl_command": "Finds PIDs of all running processes, gets executable binary of each process, and prints containing folder of each binary.", "bash_code": "ps -A -o pid | xargs -I pid readlink \"/proc/pid/exe\" | xargs -I file dirname \"file\"" }, { "nl_command": "Find all the regular files under current directory tree that have not been modified in the last 31 days and delete them", "bash_code": "find . -type f -mtime +31 -print0 | xargs -0 -r rm -f" }, { "nl_command": "find all the \".c\" files in the folder /home/david which have been modified in the last 48 hours", "bash_code": "find /home/david -mtime -2 -name '*.c'" }, { "nl_command": "Look for files whose names begin with letters a-j", "bash_code": "find / -name \"[a-j]*\" -print" }, { "nl_command": "Find all files under /path/to/dir and change their permission to 644", "bash_code": "find /path/to/dir -type f -exec chmod 644 {} +" }, { "nl_command": "List all files under and below the directory given as variable $ARCH1", "bash_code": "find $ARCH1 -ls" }, { "nl_command": "Prints process tree of a current process with id numbers and parent processes.", "bash_code": "pstree -sp $$" }, { "nl_command": "Store content of uncompressed file \"$file.fastq\" in variable \"reads\"", "bash_code": "reads=$" }, { "nl_command": "Find all files in the current directory and its sub-directories that have not been assessed in more than 30 days.", "bash_code": "find . -atime +30 -print" }, { "nl_command": "Find all files newer than httpd.conf under and below the current directory", "bash_code": "find . -newer httpd.conf" }, { "nl_command": "Find user daniel's files of type jpeg without `autumn' in the name", "bash_code": "find . -user daniel -type f -name *.jpg ! -name autumn*" }, { "nl_command": "Print the names and sizes of regular files residing in the \"dir\" directory tree", "bash_code": "find dir -type f -printf \"f %s %p\\n\"" }, { "nl_command": "replaces the last occurrence of 'a' with 'c'", "bash_code": "tac infile.txt | sed \"s/a/c/; ta ; b ; :a ; N ; ba\" | tac" }, { "nl_command": "Print each line in parallel in files \"tmp/sample-XXX.tim\" and \"tmp/sample-XXX.log\"", "bash_code": "paste tmp/sample-XXXX.{tim,log}" }, { "nl_command": "Display bash function definition of \"foobar\"", "bash_code": "set | grep -A999 '^foobar ()' | grep -m1 -B999 '^}'" }, { "nl_command": "Search the /etc/apache-perl directory tree for files newer than /etc/apache-perl/httpd.conf", "bash_code": "find /etc/apache-perl -newer /etc/apache-perl/httpd.conf" }, { "nl_command": "Look in /home/dm and below for files with 'uniform' in their names", "bash_code": "find /home/dm -name \"*uniform*\"" }, { "nl_command": "Highlights current day in a month calendar with color.", "bash_code": "cal -h | sed \"s/\\<$\\>/\"$'\\033\\[94m&\\033\\[0m/g'" }, { "nl_command": "Pops the top directory of dirs stack and changes to it.", "bash_code": "popd" }, { "nl_command": "Search the current directory tree for regular files whose names end in \".shtml\" or \".css\"", "bash_code": "find -type f -regex \".*/.*\\.\\(shtml\\|css\\)\"" }, { "nl_command": "Print line, word and byte count for each file recursively and also show the total counts", "bash_code": "wc `find`" }, { "nl_command": "Print symlink resolved script file name", "bash_code": "echo $(basename $)" }, { "nl_command": "find all the files that have been modified in the last 1 day ago", "bash_code": "find -mtime -1" }, { "nl_command": "Prints calendar for a current month, replacing current data with asterisk.", "bash_code": "cal -h|sed -r \"s/\\b$(date|cut -d' ' -f3)\\b/*/\"" }, { "nl_command": "Find all *.m4a files under /home/family/Music directory and convert them to ogg", "bash_code": "find /home/family/Music -name '*.m4a' -print0 | xargs -0 -i ffmpeg -i {} -acodec libvorbis -aq 6 -vn -ac 2 {}.ogg" }, { "nl_command": "Starts new detached tmux session 'vims' with new windows 'vim0' and opens file 'foo' within.", "bash_code": "tmux new-session -s vims -n vim0 -d \"vim foo\"" }, { "nl_command": "Prints information about user $euids currently on machine and its processes, without printing header.", "bash_code": "w -h $euids" }, { "nl_command": "display all the text files in the current folder and discard all the errors.", "bash_code": "find -name \"*.txt\" 2>>/dev/null" }, { "nl_command": "Query about which keys invoke the named function", "bash_code": "bind -q complete" }, { "nl_command": "Print the list of all regular files on the system using \"echo\"", "bash_code": "find / -type f -exec echo {} \\;" }, { "nl_command": "Find files/directories named blah under current directory", "bash_code": "find ./ -iname blah" }, { "nl_command": "find all the text files in the file system and search only in the disk partition of the root.", "bash_code": "find / -mount -name \"*.txt\"" }, { "nl_command": "Print only strings from file 'file2' that not found in 'file1'", "bash_code": "comm -1 -3 file1 file2" }, { "nl_command": "Runs programs and prints formatted summary of system resource usage.", "bash_code": "command time -f \"%E real,%U user,%s sys\" ls -Fs" }, { "nl_command": "Set the exit code to '0'.", "bash_code": "true" }, { "nl_command": "search for the directory \"uploads\" in current folder and change the permission of the folder and all the files to 755", "bash_code": "find . -type d -name 'uploads' -print0 | xargs -0 chmod -R 755" }, { "nl_command": "Display what flags mount points are mounted with", "bash_code": "mount -l" }, { "nl_command": "Find all directories under media/ directory and change their permission to 700", "bash_code": "find media/ -type d -exec chmod 700 {} \\;" }, { "nl_command": "Find files/directories named 'foo.bar' under './dir1' and './dir2' directory tree", "bash_code": "find ./dir1 ./dir2 -name foo.bar -print" }, { "nl_command": "find all executable files in /home directory.", "bash_code": "find /home -type f -perm /a=x" }, { "nl_command": "Add group write permission to all files matching \"*\" or \"...*\"", "bash_code": "chmod g+w * ...*" }, { "nl_command": "Replace all sequence of 'blank' characters in file 'log' with a single occurence of such symbol and print space-separated fields of each string but first two fields", "bash_code": "cat log | tr -s [:blank:] |cut -d' ' -f 3-" }, { "nl_command": "Sort the lines of the file 'inputfile', keep only the uniq lines and change it in-place", "bash_code": "sort inputfile | uniq | sort -o inputfile" }, { "nl_command": "Find command will display top 5 small files from curent directory . most probably you will get ZERO bytes files .", "bash_code": "find . -type f -exec ls -s {} \\; sort -n |head -5" }, { "nl_command": "find all the files in current folder which have been updated in the last 60 minutes", "bash_code": "find . -mmin -60" }, { "nl_command": "Find any files in the current directory and its sub-directories that were last accessed more than 7 days or are larger than 20480 blocks in size.", "bash_code": "find . -atime +7 -o -size +20480 -print" }, { "nl_command": "split content all files file1..40000 into pieces per 1445 lines named as outputprefixNNN as digital prefix", "bash_code": "cat file1 file2 ... file40000 | split -n r/1445 -d - outputprefix" }, { "nl_command": "Remove the regular files from the current directory that were last modified on November, 22", "bash_code": "find -maxdepth 1 -type f -newermt \"Nov 22\" \\! -newermt \"Nov 23\" -delete" }, { "nl_command": "Find all *foo files/directories under current directory", "bash_code": "find . -name '*foo'" }, { "nl_command": "Remove trailing whitespaces in .txt files from the current directory tree", "bash_code": "find . -type f -name '*.txt' -exec sed --in-place 's/[[:space:]]\\+$//' {} \\+" }, { "nl_command": "Print a summary of the command-line usage of find", "bash_code": "find --help" }, { "nl_command": "find all files that do not have read permission to all", "bash_code": "find . -type f ! -perm -444" }, { "nl_command": "Find all SUID files in entire file system", "bash_code": "find / -perm +u=s" }, { "nl_command": "find all the text files in the current folder and display their Permissions and size along with their name", "bash_code": "find . -name \"*.txt\" -printf \"%M %f \\t %s bytes \\t%y\\n\"" }, { "nl_command": "find all normal/regular files in the current directory", "bash_code": "find . -type f -print" }, { "nl_command": "List all environment variables (name and value) whose name starts with GOROOT", "bash_code": "env | grep '^GOROOT'" }, { "nl_command": "Finds string with text \"string to be searched\" in any cased files like \"*.cs\" recursively in a current folder.", "bash_code": "find ./ -type f -iname \"*.cs\" -print0 | xargs -0 grep \"content pattern\"" }, { "nl_command": "Find all the files called FindCommandExamples.txt of owner root", "bash_code": "find / -user root -name FindCommandExamples.txt" }, { "nl_command": "Archive \"user@remoteip:/path/to/files/\" to \"/local/path\" via ssh on port \"$portNumber\" and compressing data during transmission", "bash_code": "rsync -avz -e \"ssh -p $portNumber\" user@remoteip:/path/to/files/ /local/path/" }, { "nl_command": "Find files under /usr that are the same age or older than file `FirstFile'", "bash_code": "find /usr ! -newer /FirstFile -print" }, { "nl_command": "Takes path list from '.exportfiles.text' file, cuts off first two path segments and last one.", "bash_code": "cut -d / -f 4- .exportfiles.text | xargs -n 1 dirname" }, { "nl_command": "Search the /home/sdt5z/tmp directory tree for files named \"accepted_hits.bam\"", "bash_code": "find /home/sdt5z/tmp -name \"accepted_hits.bam\"" }, { "nl_command": "Find all hidden files in the current directory", "bash_code": "find . -type f -name \".*\"" }, { "nl_command": "Archive \"/path/to/sfolder\" to \"name@remote.server:/path/to/remote/dfolder\" preserving hard links and compressing the data during transmission", "bash_code": "rsync -aHvz /path/to/sfolder name@remote.server:/path/to/remote/dfolder" }, { "nl_command": "Find recursively the latest modified file in the current directory", "bash_code": "find . -type f | sed 's/.*/\"&\"/' | xargs ls -E | awk '{ print $6,\" \",$7,\" \",$9 }' | sort | tail -1" }, { "nl_command": "Print comma separated gaps in file \"file\" that contains new line separated ordered numbers", "bash_code": "seq $(tail -1 file)|diff - file|grep -Po '.*(?=d)'" }, { "nl_command": "Copy all \".xml\" files in the current directory tree to \"/new/parent/dir\" preserving the directory hierarchy", "bash_code": "find . -name \\*.xml -print0 | cpio -pamvd0 /new/parent/dir" }, { "nl_command": "Creates temporary file in $appdir variable with name formatted like expression in variable ${template}, and saves path to it in 'launcherfile' variable.", "bash_code": "launcherfile=$" }, { "nl_command": "find all jpg files in current folder", "bash_code": "find . -type f -name \"*.JPG\"" }, { "nl_command": "display all regular/normal files in the current folder ending with the word ummy", "bash_code": "find -type f -name *ummy" }, { "nl_command": "Print first column of every line in every *.txt separated by a space", "bash_code": "paste -d':' *.txt | sed 's/ [^:]*$//;s/ [^:]*:*/ /g;s/://g'" }, { "nl_command": "Read a line from standard input into variable \"ENTERED_PASSWORD\" without echoing the input", "bash_code": "read -s ENTERED_PASSWORD" }, { "nl_command": "display the base name of all the \".NEF\" files in the current folder", "bash_code": "find . -name \"*.NEF\" -exec basename \\{\\} .NEF \\;" }, { "nl_command": "count amount of jobs running", "bash_code": "jobs | wc -l" }, { "nl_command": "Search the current directory recursively for files containing \"needle text\"", "bash_code": "find . -type f -print0 | xargs -0 grep -I \"needle text\"" }, { "nl_command": "Change string \"searc\" to \"replace\" in all files in directory hierarchy", "bash_code": "find . -type f -exec sed -i 's/searc/replace/g' {} \\;" }, { "nl_command": "Creates temporary file and saves path to it in a 'tmpfile' variable.", "bash_code": "tmpfile=$(mktemp)" }, { "nl_command": "find all the files in the current folder that have been modified exactly 24*3 hours ago", "bash_code": "find ./ -mtime 3" }, { "nl_command": "Gets all IP addresses from host network configuration and prints first one.", "bash_code": "ifconfig | grep \"inet addr:\" | grep -v \"127.0.0.1\" | grep -Eo '[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}' | head -1" }, { "nl_command": "Close the current screen session", "bash_code": "screen -X quit" }, { "nl_command": "Search for lines that have zero or more whitespace characters before \"http://\" and number the uniquely sorted output", "bash_code": "grep '^[[:space:]]*http://' | sort -u | nl" }, { "nl_command": "Search the current directory tree for hidden files", "bash_code": "find .*" }, { "nl_command": "display all the regular files in the current folder that are bigger than 10KB", "bash_code": "find . -type f -size +10k" }, { "nl_command": "change the group of all the files in the folder /u/netinst/ to staff", "bash_code": "find /u/netinst -print | xargs chgrp staff" }, { "nl_command": "Find all files called \"INPUT.txt\" in the current directory tree and remove lines starting with # in them, saving backup copies as INPUT.txt.bak", "bash_code": "find . -type f -name INPUT.txt -print0 | xargs -0 -I {} sed -i.bak '/^#/d' {}" }, { "nl_command": "Wrap each line in \"file.txt\" to fit in 76 characters breaking only at spaces and indent the output", "bash_code": "fold -w 76 -s file.txt | pr -T --indent=4" }, { "nl_command": "Remove the .jpg files from the current directory whose names match regular expression \".+-[0-9]+x[0-9]+\\.jpg\"", "bash_code": "find . -type f -regex \".+-[0-9]+x[0-9]+\\.jpg\" -exec rm -rf {} \\;" }, { "nl_command": "Finds recursively all files in '/path/' that contain 'pattern', and prints matched strings with string number and file name.", "bash_code": "grep -rnw '/path/' -e 'pattern'" }, { "nl_command": "set alias \"ff\" for command \"find . -name $1\"", "bash_code": "alias ff=find . -name $1" }, { "nl_command": "Find all file which have more the 2 hard link", "bash_code": "find . -type f -links +2 -exec ls -lrt {} \\;" }, { "nl_command": "Remove trailing whitespaces in TXT files from the current directory tree", "bash_code": "find . -iname '*.txt' -type f -exec sed -i '' 's/[[:space:]]\\{1,\\}$//' {} \\+" }, { "nl_command": "Search for file names with \"bad\" characters in the current directory and delete the files.", "bash_code": "find . -name '*[+{;\"\\\\=?~()<>&*|$ ]*' -maxdepth 0 -exec rm -f '{}' \\;" }, { "nl_command": "Find all files changed on the 29th of September, 2008, starting from the current directory", "bash_code": "find . -type f -newerct 2008-09-29 ! -newerct 2008-09-30" }, { "nl_command": "Print newline, word, and byte counts of each '*.java' file within current directory, and total newline, word, and byte counts", "bash_code": "find . -name \\*.java | tr '\\n' '\\0' | xargs -0 wc" }, { "nl_command": "split file \"${fspec} into pieces named as \"xyzzyNNN\" with numeric prefix from 1 to 6", "bash_code": "split --number=l/6 ${fspec} xyzzy." }, { "nl_command": "search for the word LOG in all the files in the folder ~/jsmith", "bash_code": "find ~jsmith -exec grep LOG '{}' /dev/null \\; -print" }, { "nl_command": "Make a copy of file.txt in all directories in current directory - names may not contain spaces.", "bash_code": "ls -d */ | xargs -iA cp file.txt A" }, { "nl_command": "Search for Subscription.java under current directory, and go to directory containing it.", "bash_code": "cd \"$\"" }, { "nl_command": "Resolve symbolic link of file \"/foo/bar/baz\"", "bash_code": "readlink -e /foo/bar/baz" }, { "nl_command": "Read 10 bytes from $0 and print them by replacing the set '\\000-\\377' with '#'", "bash_code": "head -c 10 \"$0\" | tr '\\000-\\377' '#'" }, { "nl_command": "Exits from login shell.", "bash_code": "logout" }, { "nl_command": "recursively change owner of the directory /usr/local/lib to the current user", "bash_code": "sudo chown -R `whoami` /usr/local/lib" }, { "nl_command": "display the names without extensions of all the data files in current folder which have not been changed in the last 60 mins", "bash_code": "find ./ -name \"*.dat\" -type f -cmin +60 -exec basename {} \\;" }, { "nl_command": "extract archive stored in $1", "bash_code": "tar -zxvf $1" }, { "nl_command": "Remove the .jpg files from the current directory whose names match regular expression \".+-[0-9]+x[0-9]+\\.jpg\"", "bash_code": "find . -type f -regex \".+-[0-9]+x[0-9]+\\.jpg\" | xargs rm" }, { "nl_command": "display all the regular files in the current folder that are exactly 10KB", "bash_code": "find . -type f -size 10k" }, { "nl_command": "Prints long listing of the current directory, sorted from oldest to newest, with appended indicators.", "bash_code": "$ ls -Fltr" }, { "nl_command": "find all read me files in a folder", "bash_code": "find /usr/share/doc -name README" }, { "nl_command": "Extract 8 bytes as an unsigned integer that is \"$o\" offset into \"$rpm\"", "bash_code": "set `od -j $o -N 8 -t u1 $rpm`" }, { "nl_command": "Prints a random number between 1 and 10", "bash_code": "grep -m1 -ao '[0-9]' /dev/urandom | sed s/0/10/ | head -n1" }, { "nl_command": "rename all the png files to jpg files in the current fodler", "bash_code": "find . -name \"*.png\" -print0 | sed 'p;s/\\.png/\\.jpg/' | xargs -0 -n2 mv" }, { "nl_command": "Move all files not matching \"Tux.png\" in \"~/Linux/Old\" to \"~/Linux/New/\" using zsh with \"EXTENDED_GLOB\"", "bash_code": "mv ~/Linux/Old/^Tux.png ~/Linux/New/" }, { "nl_command": "Merge each line in \"file\" into a single comma separated line", "bash_code": "paste -d, -s file" }, { "nl_command": "Format space separated fields in \"filename\" as a table", "bash_code": "column -t -s' ' filename" }, { "nl_command": "search for the word \"slrn\" in all the files in the folder $HOME/html/andrews-corner", "bash_code": "find $HOME/html/andrews-corner -exec grep -q 'slrn' '{}' \\; -print" }, { "nl_command": "Find and show all files in the current directory tree that are smaller than 500 kB", "bash_code": "find . -size -500k" }, { "nl_command": "Create 1000 files each file having a number from 1 to 1000 named \"file000\" to \"file999\"", "bash_code": "seq 1 1000 | split -l 1 -a 3 -d - file" }, { "nl_command": "Convert *.au files to *.wav files using `sox'", "bash_code": "find -type f -name '*.au' | awk '{printf \"sox %s %s\\n\",$0,$0\".wav\" }' | bash" }, { "nl_command": "Prints $m latest modified files within the $d folder, using $f format for printing timestamp.", "bash_code": "find \"$d\" -type f -printf \"%T@ :$f %p\\n\" | sort -nr | cut -d: -f2- | head -n\"$m\"" }, { "nl_command": "count amount of jobs running", "bash_code": "jobs | wc -l" }, { "nl_command": "Find all files under $d directory that are executable by owner and print only their names", "bash_code": "find $d -maxdepth 1 -perm -100 -type f | sed 's#.*/##'" }, { "nl_command": "Print each line that is found only once in \"file1\" and \"file2\" combined", "bash_code": "sort file1 file2 | uniq -u" }, { "nl_command": "Find every JavaScript file in the wordpress directory tree", "bash_code": "find wordpress -name '*js'" }, { "nl_command": "Filnd all files in root directory with 777 permission and change permision 644 with chmod commad .", "bash_code": "find / -type f -perm 777 -print -exec chmod 644 {} \\;" }, { "nl_command": "Search the first 300 commands in history containing \"scp\" and ending in \"important\"", "bash_code": "history 300 | grep scp | grep important$" }, { "nl_command": "delete all the empty directories in the current folder", "bash_code": "find . -type d -empty -exec rmdir {} \\;" }, { "nl_command": "change permissions of all the script files in a directory", "bash_code": "find /home/john/script -name \"*.sh\" -type f -exec chmod 644 {} \\;" }, { "nl_command": "force remove all the directories with the name logs in the folder /var/www", "bash_code": "find /var/www -type d -mtime 0 -name logs -exec sudo rm -fr {} \\;" }, { "nl_command": "Find all files named \"file.ext\" in the current directory tree and print the path names of the directories they are in", "bash_code": "find . -name \"file.ext\" -execdir pwd ';'" }, { "nl_command": "Find one file or directory in the current directory whose name matches the pattern given as a variable $a", "bash_code": "find . -maxdepth 1 -name \"$a\" -print -quit" }, { "nl_command": "find files in current directory that names are game", "bash_code": "find . -name game" }, { "nl_command": "Gets IP address of ${NET_IF} network interface.", "bash_code": "NET_IP=`ifconfig ${NET_IF} | grep -Eo 'inet ?{3}[0-9]*' | grep -Eo '{3}[0-9]*' | grep -v '127.0.0.1'`" }, { "nl_command": "Creates 5-letter random file name and saves it in 'rand_str' variable.", "bash_code": "rand_str=\"$\"" }, { "nl_command": "Rename all *.txt regular files in the current directory tree to *.abc", "bash_code": "find . -type f -iname '*.txt' -print0 | xargs -0 rename .txt .abc" }, { "nl_command": "find the type of all the regular/normal files in the current folder", "bash_code": "find . -type f | xargs file" }, { "nl_command": "find all txt files under the current folder except ./misc folder", "bash_code": "find . -path ./misc -prune -o -name '*.txt' -print" }, { "nl_command": "Find files/directories named under current directory which were accessed less than 5 days ago", "bash_code": "find -name \"\" -atime -5" }, { "nl_command": "Continuously write \"UUUUUUUUUUUUUUUUU\" without newlines to \"/dev/to/overwrite\"", "bash_code": "yes 'UUUUUUUUUUUUUUUUU' | tr -d '\\n' > /dev/to/overwrite" }, { "nl_command": "Find all *.py files/directories under dir directory ignoring .git path", "bash_code": "find dir -not -path '.git' -iname '*.py'" }, { "nl_command": "Find strings with 'Features' in /var/run/dmesg.boot' file", "bash_code": "cat /var/run/dmesg.boot | grep Features" }, { "nl_command": "Make directories to \"$TARGET_PATH\" as needed without causing an error if it exists", "bash_code": "mkdir -p \"$TARGET_PATH\"" }, { "nl_command": "Compress .log files in /var and below on an individual basis", "bash_code": "find /var -iname \\*.log -exec bzip {} \\;" }, { "nl_command": "create a symbolic link named \"test\" to file \".bashrc\"", "bash_code": "ln -s .bashrc test" }, { "nl_command": "Return all of the .conf files in Pat's user folder and subdirectories", "bash_code": "find /home/pat -iname \"*.conf\"" }, { "nl_command": "Print full path of command \"python\"", "bash_code": "which python" }, { "nl_command": "find all CSS files that do something with your HTML ID #content", "bash_code": "find . -name \"*.css\" -exec grep -l \"#content\" {} \\;" }, { "nl_command": "Format file \"list-of-entries.txt\" with no column delimiter", "bash_code": "column -t -s '' list-of-entries.txt" }, { "nl_command": "Print lines containing string TEXT from all log files in the current directory.", "bash_code": "grep -e TEXT *.log | cut -d':' --complement -s -f1" }, { "nl_command": "search for files which are writable by both their owner and their group", "bash_code": "find . -perm -220" }, { "nl_command": "Filters out all comments from the output of the command \"crontab -u $user -l\" ignoring errors", "bash_code": "crontab -u $user -l 2>/dev/null | grep -v '^#'" }, { "nl_command": "display a list of all regular/normal files in the current folder", "bash_code": "find . -type f -ls" }, { "nl_command": "search for the regular/normal file \"myfile\" in the current folder excluding search in the paths of \"work\" and \"home\" sub directories", "bash_code": "find . \\ -prune -o -name myfile -type f -print" }, { "nl_command": "Print your/dir if it's empty", "bash_code": "find your/dir -prune -empty" }, { "nl_command": "Replaces any occurences of '*favicon.ico*' in any subfolder with file '/root/favicon.ico'.", "bash_code": "find . | grep favicon\\.ico | xargs -n 1 cp -f /root/favicon.ico" }, { "nl_command": "display all pdf files in the current folder", "bash_code": "find . -name *.pdf" }, { "nl_command": "Filter contents of 'file' through awk commands written in script.awk, display the result.", "bash_code": "awk -f script.awk file" }, { "nl_command": "Find files that are 100k", "bash_code": "find -size 100k" }, { "nl_command": "Find all empty files in the current directory and delete them", "bash_code": "find . -type f -maxdepth 1 -empty -print0 | xargs -0 /bin/rm" }, { "nl_command": "replace the word foo to bar in the current folder in all the regular/normal files containing the word \"baz\" in their name (does not update the file)", "bash_code": "find . -type f -name \"*baz*\" -exec sed -i 's/foo/bar/g' {} +" }, { "nl_command": "Find all files owned by group `group2'", "bash_code": "find / -group group2" }, { "nl_command": "Prefix all files and folders in the current directory with \"PRE_\"", "bash_code": "ls | xargs -I {} mv {} PRE_{}" }, { "nl_command": "List all files/directories under current directory", "bash_code": "find . -print" }, { "nl_command": "Silently read standard input until the escape key is pressed ignoring backslash escapes and using the prompt $'Press escape to continue...\\n'", "bash_code": "read -rsp $'Press escape to continue...\\n' -d $'\\e'" }, { "nl_command": "display all directories in the folder \"$ORIG_DIR\"", "bash_code": "find \"$ORIG_DIR\" -name \"*\" -type d" }, { "nl_command": "Force create a symbolic link without dereferencing named \"mylink\" to \"dir2\"", "bash_code": "ln -nsf dir2 mylink" }, { "nl_command": "Lists file descriptors of a current process.", "bash_code": "ls -l /proc/self/fd/" }, { "nl_command": "search for a word in all the php files in the current folder and display the count of all matching lines.", "bash_code": "find . -name \\*.php -type f -print0 | xargs -0 -n1 grep -Hn '$test' | wc -l" }, { "nl_command": "Print a count of each unique line from standard input", "bash_code": "sort | uniq -c" }, { "nl_command": "Report total file systems disk usage estimated in terabytes", "bash_code": "df --total -BT | tail -n 1" }, { "nl_command": "Displays status of currently active network interfaces.", "bash_code": "ifconfig" }, { "nl_command": "Search all files in the current directory tree for \"SearchString\", ignoring .html files and skipping .svn directories", "bash_code": "find . \\ | xargs -d '\\n' grep -Hd skip 'SearchString'" }, { "nl_command": "list all regular files which path is not dir1 or dir2", "bash_code": "find ! -path \"dir1\" ! -path \"dir2\" -type f" }, { "nl_command": "Generate UUIDs for the files from the current directory tree", "bash_code": "find . -exec printf '%s\\t' {} \\; -exec uuidgen \\; | awk -F '\\t' '{ sub; print $2, $1 }' | sort -k2" }, { "nl_command": "change the owner of the files which belong to the group 1000 to username and modify only the symbolic link not the originally pointed file", "bash_code": "find -gid 1000 -exec chown -h :username {} \\;" }, { "nl_command": "Find all hidden files under /tmp", "bash_code": "find /tmp -type f -name \".*\"" }, { "nl_command": "Remove all *.tmp files from the /tmp directory tree", "bash_code": "find /tmp -name \"*.tmp\" -print0 | xargs -0 rm" }, { "nl_command": "find all the files in the current folder which have the word cache in them and do not search in the sub directories of the folder.", "bash_code": "find . -name 'cache*' -depth -exec rm {} \\;" }, { "nl_command": "create archive \"backup.tar.gz\" from /path/to/catalog", "bash_code": "tar czfP backup.tar.gz /path/to/catalog" }, { "nl_command": "find all the files in the home folder which have been modified after a file", "bash_code": "find $HOME -newer ~joeuser/lastbatch.txt" }, { "nl_command": "Print common lines in \"file1\" and \"file2\"", "bash_code": "comm -12 file1 file2" }, { "nl_command": "Search the *.pdf files from directory tree PDFs/ for text \"perry sound\", ignoring the case", "bash_code": "find PDFs/ -name '*.pdf' -exec sh -c 'pdftotext \"{}\" - | grep -i --with-filename --label=\"{}\" --color \"perry sound\"' \\;" }, { "nl_command": "Execute \"cat /tmp/iostat.running\" every 10 seconds", "bash_code": "watch -n10 cat /tmp/iostat.running" }, { "nl_command": "Create a symbolic link in the current directory for each file under the directories matching \"../[12][0-9][0-9]\"", "bash_code": "find ../[12][0-9][0-9][0-9] -type f -exec ln -s {} \\;" }, { "nl_command": "Find all files/directories with permission $permissions under $directory directory tree", "bash_code": "find \"$directory\" -perm \"$permissions\"" }, { "nl_command": "Adjust the timestamp of 'filename' by subtracting 2 hours from it.", "bash_code": "touch -d \"$(date -r filename) - 2 hours\" filename" }, { "nl_command": "Search $MYGROUP in /etc/group, take the 4th colon separated field, replace comma with newline and save the result to variable 'MYUSERS'", "bash_code": "MYUSERS=`grep $MYGROUP /etc/group | cut -d \":\" -f4| tr \",\" \"\\n\"`" }, { "nl_command": "Compare files \"A1\" and \"A2\" with 3 lines of unified context and print lines beginning with \"+\"", "bash_code": "diff -u A1 A2 | grep -E \"^\\+\"" }, { "nl_command": "Counts all files in a current folder and subfolders.", "bash_code": "find -type f -printf '\\n' | wc -l" }, { "nl_command": "Search the .java files from the current directory tree for TODO lines", "bash_code": "find . -name \"*.java\" -exec grep -i -n TODO {} \\;" }, { "nl_command": "Recursively finds and compresses all files in a current folder.", "bash_code": "find . -type f -exec bzip2 {} +" }, { "nl_command": "Archive \"foo/bar/baz.c\" to \"remote:/tmp/\" preserving the relative path of \"foo/bar/baz.c\"", "bash_code": "rsync -avR foo/bar/baz.c remote:/tmp/" }, { "nl_command": "SSH into \"$NAME\" as user \"${USERNAME}\" using key file \"${KEYDIR}/${KEY}.pem\", automatically add the host to list of known hosts and execute \"${COMMANDS}\"", "bash_code": "ssh -o \"StrictHostKeyChecking no\" -i ${KEYDIR}/${KEY}.pem ${USERNAME}@$NAME \"${COMMANDS}\"" }, { "nl_command": "List the commands in /usr/bin, pausing for user input after each page.", "bash_code": "more <( ls /usr/bin )" }, { "nl_command": "display all sqlite files in the current directory along with their timestamp", "bash_code": "find ./ -name \"*.sqlite\" -printf '%Tc %p\\n'" }, { "nl_command": "Deletes folder like /tmp/*/* or deeper, older than +7 days if they don`t contain files or other folders.", "bash_code": "find /tmp/*/* -mtime +7 -type d -exec rmdir {} \\;" }, { "nl_command": "change owner and group of the current directory and all files into it to user and group andrew", "bash_code": "chown -R andrewr:andrewr *" }, { "nl_command": "Find all .php files in all directory trees matching pattern `/srv/www/*/htdocs/system/application/' and search those files for string \"debug (\"", "bash_code": "find /srv/www/*/htdocs/system/application/ -name \"*.php\" -exec grep -H \"debug (\" {} +" }, { "nl_command": "Search the entire file hierarchy for files ending in '.old' and delete them.", "bash_code": "find / -name \"*.old\" -exec /bin/rm {} \\" }, { "nl_command": "change the permission of all directories in current folder to 755.", "bash_code": "find . -type d -exec chmod 755 {} \\;" }, { "nl_command": "Move all *.pdf.marker files and their corresponding *.pdf files under ${INPUT_LOCATION} to ${OUTPUT_LOCATION}", "bash_code": "find $INPUT_LOCATION -name '*.pdf.marker' | xargs -i bash -c 'mv ${0%.marker} $0 $1' {} $OUTPUT_LOCATION" }, { "nl_command": "List the files in the /etc directory tree containing text '128.200.34.'", "bash_code": "find /etc -type f -print | xargs grep -il '128\\.200\\.34\\.'" }, { "nl_command": "Print 10 space separated \"x\"s with at most 4 per line", "bash_code": "yes x | head -10 | awk 'BEGIN { RS = \"%%%%%%%\" } { split($0,a,\"\\n\"); for (i=1; i