query
stringlengths 27
253
| gold
stringlengths 7
172
|
---|---|
Calculate a list of duplicate md5 sum hashes for all the ".java" files in the /testbed directory | md5sum /testbed/*.java | awk '{print $1}' | sort | uniq -d |
Calculate md5 sum of the md5 sum of all the sorted files under /testbed/dir2/subdir2 | find /testbed/dir2/subdir2 -type f -print0 | sort -z | xargs -r0 md5sum | md5sum |
Calculate the md5 sum of the contents of the sorted list of files "$FILES" | cat $(echo $FILES | sort) | md5sum |
Calculate the md5 sum of the md5 sum of all the files sorted under /testbed/dir2/subdir2 | find testbed/dir2/subdir2 -type f -print0 | sort -z | xargs -r0 md5sum | md5sum |
Calculate the md5 sum of the sorted list of md5 sums of all ".py" files under /testbed/dir1/subdir1 | find /testbed/dir1/subdir1 -type f -name *.py -exec md5sum {} + | awk '{print $1}' | sort | md5sum |
Calculate the md5sum of each ".py" file under /testbed/dir1/subdir1, sort the output, and calculate the md5sum of that | find /testbed/dir1/subdir1 -type f -name "*.py" -exec md5sum {} + | awk '{print $1}' | sort | md5sum |
Calculate the total disk usage for each ".txt" file on the /testbed directory and prepend the system host name to the output | find /testbed / -iname '*.txt' -exec du -s {} + | sed 's/^/$(hostname): /' |
Change directory to the directory containing the executable file of command "python" | cd $(which python | xargs dirname) |
Change permissions for all PHP files under the /testbed directory tree to 755 and print the number of files changed | find /testbed -name "*.php" -exec chmod 755 {} \; -exec /bin/echo {} \; | wc -l |
Check if current shell is running within a 'screen' process. | pstree --show-parents -p $$ | head -n 1 | sed 's/\(.*\)+.*/\1/' | wc -l |
Check if the contents of file /testbed/dir3/subdir1/subsubdir1/textfile3.txt is a subset of file /testbed/dir2/subdir1/textfile2.txt | comm -23 <(sort /testbed/dir3/subdir1/subsubdir1/textfile3.txt | uniq) <(sort /testbed/dir2/subdir1/textfile2.txt | uniq) | head -1 |
Compress in parallel regular files in the testbed directory tree that were last modified more than 7 days ago | find /testbed -type f -mtime +7 | tee compressedP.list | xargs -I{} -P10 compress {} & |
Compress regular files in the testbed directory tree that were last modified more than 7 days ago | find /testbed -type f -mtime +7 | tee compressedP.list | xargs -0 gzip |
Compute the mean average of the word count of *.txt files in the /testbed directory | find /testbed -name '*.txt' -print0 | xargs -0 wc -w | awk 'END { print $1/(NR-1) }' |
Compute the mean average of the word count of *.txt files smaller than 2000 words in the /testbed directory | find /testbed -name '*.txt' -print0 | xargs -0 wc -w | awk '$1 < 2000 {v += $1; c++} END {print v/c}' |
Copies all files with "FooBar" in the path under the '/testbed/dir1' directory to the '/testbed/dir3/subdir1/subsubdir1/tmp' directory. | find /testbed -name '*FooBar*' -print0 | xargs -0 -I{} cp -R {} /testbed/dir3/subdir1/subsubdir1/tmp |
Construction with additional '-exec true' to be used if both commands need to run regardless of their success or failure. | find /testbed -name "*.txt" \( -exec echo {} \; -o -exec true \; \) -exec grep banana {} \; |
Convert the first 16 characters in "/testbed/textfile7.txt" to a single hexadecimal value | head /testbed/textfile7.txt -c16 | od -tx1 -w16 | head -n1 | cut -d' ' -f2- | tr -d ' ' |
Copies all files under the /testbed folder like "file.txt" with "FooBar" in the path to the root of the current folder, preserving mode, ownership and timestamp attributes. | find /testbed -name "file.txt"| grep "FooBar" | xargs -i cp -p "{}" . |
Copy all files below the /testbed directory whose names contain "FooBar" to directory '/testbed/dir3/subdir1/subsubdir1/tmp' | find /testbed -name '*FooBar*' -print0 | xargs -0 -I{} cp -R {} /testbed/dir3/subdir1/subsubdir1/tmp |
Count all the lines of all '*.c' files in /testbed directory recursively | find /testbed -name "*.c" -print0 | xargs -0 cat | wc -l |
Count all the lines of all files with names ending with 'php' in current directory recursively | find -name '*php' | xargs cat | wc -l |
Count all the lines of all php files in the /testbed directory recursively | find /testbed/ -name '*.php' | xargs cat | wc -l |
Count all the lines of code in all php files in the /testbed directory recursively | find /testbed -name "*.php" -type f -exec grep -v -c '^$' {} + | awk '{ cnt += $0 } END { print cnt }' |
Count md5sum of all '*.py' files in /testbed folder with subfolders. | find /testbed -type f -name "*.py" -exec md5sum {} + | awk '{print $1}' | sort | md5sum |
Count the *.html files residing in the /testbed directory tree and containing string "foo" | find /testbed -name "*.html" | xargs grep -l foo | wc -l |
Count the number of files named 'job.history' under '/testbed' directory tree that match 'FAIL' in their contents | find /testbed -name job.history | xargs grep -l FAIL | wc -l |
Count the number of files/directories with '.php' extension under /testbed directory tree and change the permissions to 755 | find /testbed -name "*.php" -exec chmod 755 {} \; -exec /bin/echo {} \; | wc -l |
Count the number of lines in all ".php" files in the /testbed directory tree | find /testbed -name '*.php' -type f | xargs cat | wc -l |
Count the number of lines in all files in the /testbed directory tree that match pattern 'foo??' | find /testbed/ -name 'foo??' | sort | xargs wc -l |
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 |
Count the number of unique file extensions in the /testbed directory tree | find /testbed -type f | sed -e 's/.*\.//' | sed -e 's/.*\///' | sort | uniq -c | sort -rn |
Count the total number of lines in all "*.gz" files in the /testbed directory tree after decompression | find /testbed -type f -name '*.gz' | xargs zcat | wc -l |
Counts all files in the /testbed folder and subfolders. | find /testbed -type f -exec ls -l {} \; | wc -l |
Count lines in each *.php file sorted by file in /testbed directory. | find /testbed -name '*.php' -type f | sort | xargs wc -l |
Counts lines in each *.php file in /testbed directory, sorted by number of lines, descending. | find /testbed -name '*.php' -type f | xargs wc -l | sort -nr |
Counts lines in each of *.php files in the /testbed folder and subfolders and prints total count. | find /testbed -name '*.php' | awk '{print $0}' |xargs wc -l |
Counts lines in each of *.php files in the /testbed folder with subfolders and prints total count as well. | find /testbed -name '*.php' | xargs wc -l | sort -r |
Counts number of occurences of all ip addresses in '/etc/networks' file, and prints all addresses with number of occurences in a descending order. | cat /etc/networks | sort | uniq -c | sort -nr | awk '{print $2 $1}' |
Counts sum of non-empty lines from all .php files in /testbed folder. | find /testbed -name "*.php" -type f -exec grep -v -c '^$' {} + | awk '{ cnt += $0 } END { print cnt }' |
Counts total lines in all *.php files in the /testbed directory recursively | find /testbed -name '*.php' -type f | xargs cat | wc -l |
Counts total number of only lines with alphanumeric symbols in all *.php files in the /testbed folder and subfolders. | find /testbed -name '*.php' | xargs cat | awk '/[a-zA-Z0-9]/ {i++} END{print i}' |
Counts total lines in PHP and JS files in /testbed. | find /testbed -name '*.js' -or -name '*.php' | xargs wc -l | grep 'total' | awk '{print $1}' |
Create a table containing all information from /testbed/dir1/subdir1/textfile4.txt and /testbed/dir2/subdir2/textfile5.txt, merging lines where the first field of both files matches, and keeping the line that starts with "Gene" at the start of the file. | join -a1 -a2 <(sed s/^Gene/00ne/ /testbed/dir1/subdir1/textfile4.txt | sort) <(sed s/^Gene/00ne/ /testbed/dir2/subdir2/textfile5.txt | sort) | column -t | sed s/^00ne/Gene/ |
Create an empty file "abc.txt" in each directory named "dir1" under testbed directory. | find /testbed -type d -name "dir1" -print | sed 's/$/\/abc.txt/g' | xargs touch |
Create archive "/backup1.tar" of all subdirectories of the /testbed directory without the prefix "testbed" | find /testbed -mindepth 1 -maxdepth 1 -type d | xargs tar czf /backup1.tar --transform 's,^testbed/,,' |
Create logs.tar.gz of all older than one day logs of Ubuntu | find /var/log/ -mtime +1 | xargs tar -czvPf /testbed/logs.tar.gz |
Delete and count files in "/testbed/dir3/subdir1/subsubdir1/tmp" that are older than 2 days | find /testbed/dir3/subdir1/subsubdir1/tmp -type f -mtime +2 -print0 | xargs -0 rm -f |
Display the 5 largest files in the /testbed directory and its sub-directories. | find /testbed -type f -exec ls -s {} \; | sort -n -r | head -5 |
Display the 5 smallest files in the /testbed directory and its sub-directories ignoring any empty files. | find /testbed -not -empty -type f -exec ls -s {} \; | sort -n | head -5 |
Display the 5 smallest files in the /testbed directory and its sub-directories. | find /testbed -type f -exec ls -s {} \; | sort -n | head -5 |
Display the biggest file sizes only in the /testbed directory | find /testbed -type f -exec du -Sh {} + | sort -rh | head -n 5 |
Find .java files in the testbed directory tree that contain 'Hello', and print their names | find /testbed -name "*.java" -exec grep -Hin Hello {} + | cut -d ":" -f 1 | xargs -I{} basename {} |
Print a list of all duplicate case insensitive filenames in the /testbed directory tree | find /testbed -type f | awk -F/ '{print $NF}' | sort -f | uniq -i -d |
Print all unique file paths under "testbed/dir1" compared to "testbed/dir2" | comm -23 <(find /testbed/dir1 | sed 's#/testbed/dir1/##' | sort) <(find /testbed/dir2 | sed 's#/testbed/dir2/##' | sort) | sed 's#^#/testbed/dir1/#' |
Recursively finds all files containing text 'Hello' and prints folder where they are placed. | grep -r Hello * | awk '{split($1, path, ":"); print path[1]}' | xargs -I{} dirname {} |
Prints total number of lines of all *.java files in /testbed folder and subfolders. | find /testbed -name '*.java' -print0 |xargs -0 wc -l|grep 'total' |awk '{ print $1 }' |
Create a symbolc link in the /testbed/dir3/subdir1/subsubdir1/FooBar to root folder | ln /testbed/dir3/subdir1/subsubdir1/FooBar -s / |
search for all the files in the folder /testbed/dir1 which have sticky bit set and have the permissions 553 | find /testbed/dir1 -perm 553 |
search for php files in /testbed directory and search for "world" in all these files | find /testbed -name '*.php' -exec grep -iq "world" {} \; -print |
Recursively finds all files with any cased text "Hello" in the '/system/folder1' folder, and precedes found string with its number in file. | grep -inr "Hello" /system/folder1 |
Recursively finds all files with whole word "foo" in the '/system', and precedes found string with its number in file. | grep -rnw /system -e "foo" |
Recursively list contents of the '/system' directory in a tree-like format | tree /system |
Recursively print all files and directories in the '/system/folder2' directory tree including hidden files | tree -a /system/folder2 |
Recursively prints all folders in the '/system' folder that contain files like "*.out". | find /system -name "*.out" -print0 | xargs -0 -n1 /system | sort --unique |
Recursively remove all "*.txt" files in the '/system' folder and answer "y" to any prompt | yes y | rm -r /system/*.txt |
Recursively removes all empty folders from the /system/folder3/temp folder. | find /system/folder3/temp -depth -type d -exec rmdir {} \; |
Recursively removes all empty folders under /system/folder3/temp, printing info message on each operation, and suppressing error messages if folder is not empty. | find /system/folder3/temp -type d -empty -exec rmdir -vp --ignore-fail-on-non-empty {} + |
Recursively removes all files in the /system/folder1 folder but '*txt' files. | find /system/folder1 -type f -not -name '*txt' | xargs rm |
Recursively rename all files under /system/folder1 replacing 'special' with 'regular' - all file/diretory names may not include spaces, and directory names containing such files may not contain the word 'special' in their name. | find /system/folder1 -type f -exec rename 's/special/regular/' '{}' \; |
Recursively search for "foo" in the '/system' folder and write the output to the console followed by the number of matched lines | grep -r "foo" /system | tee >(wc -l) |
Recursively search for all regular files below directory "/system/folder3/", and output the name of each, without any containing directories. | find /system/folder3/ -type f -exec basename {} \; |
Recursively unzip files to stdout in "/system/folder2.tar.gz" and search for "special" | zcat -r /system/folder2.tar.gz | grep "special" |
Remove "\r" at the end of each line in "system/folder3/temp/temp1/text1.txt" and display the result as printable characters or backslash escapes | cat /system/folder3/temp/temp1/text1.txt | sed 's/\r$//' | od -c |
Remove all *.doc files from the /system/folder1 tree | find /system/folder1 -name '*.doc' -exec rm "{}" \; |
Remove all *.log files from the /system/folder1 tree | find /system/folder1 -name '*.log' -print0 | xargs -0 rm |
Remove all *.txt files in '/system' directory but not in it's subdirectories | find /system -maxdepth 1 -name '*.txt' -maxdepth 1 | xargs rm |
Remove all *.sql files in the '/system/folder3/backup_dbg' directory that were last modified more than 25 days ago | find /system/folder3/backup_dbg/*.sql -mtime +25 -exec rm -f {} \; |
Remove all *.txt files under the /system/folder1 directory modified more than 5 minutes ago | find /system/folder1 -maxdepth 1 -mmin +5 -type f -name "*.txt" -delete |
Remove all *.txt files, except "keep.txt", under /system/folder1 directory modified more than 5 minutes ago | find /system/folder1 -maxdepth 1 -mmin +5 -type f -name "*.txt" ! -name "keep.txt" -delete |
Remove all .sh files in the '/system/folder1' tree whose names begin with "new" | find /system/folder1 -name 'new*.sh' -exec rm -f '{}' \; |
Remove all a.out, *.o, and core files under the '/system' directory | find /system \( -name a.out -o -name '*.o' -o -name 'core' \) -exec rm {} \; |
Remove all but 5 last comma-separated fields from each line in '/system/folder1/data.csv' | cat /system/folder1/data.csv | rev | cut -d, -f-5 | rev |
Remove all directories called "temp" from the /system directory tree | find /system -name "temp" -type f -delete |
Remove all empty files in /system/folder3/temp and below | find /system/folder3/temp -type f -empty -print | xargs rm -f |
Remove all files 'a.out' and *.o in the /system directory tree that were modified more than 7 days ago | find /system \( -name a.out -o -name '*.o' \) -mtime +7 -exec rm {} \; |
Remove all files and directories under '/system/folder3/temp' directory tree that match with one of the name patterns '.DS_Store', '._.DS_Store' , '._*', '.TemporaryItems' or '.apdisk' | find /system/folder3/temp \( -name '.DS_Store' -or -name '._.DS_Store' -or -name '._*' -or -name '.TemporaryItems' -or -name '.apdisk' \) -exec rm -rf {} \; |
Remove empty directories from directory tree /system | find /system -type d -empty -exec rm -r {} \; |
Remove everything within parentheses and substitute all non digit characters with a space from "1/2 [3] (27/03/2012 19:32:54) word word word word 4/5" and format the output as a table | echo '1/2 [3] (27/03/2012 19:32:54) word word word word 4/5' | sed -e 's/(.*)//' -e 's/[^0-9]/ /g' | column -t |
Remove files text2, text3, text4 in directory /system/folder1 | find /system/folder1 -name 'text[2-4]' -exec rm {} \; |
Remove files from the /system directory that are owned by nobody | find /system -nouser -exec rm {} + |
Remove files that are greater than 1KB in size under /system directory | find /system -type f -size +1k -exec rm {} + |
Remove junk files modified more than 31 days ago recursively from "/system" | find /system -type f -mtime +31 -exec rm -f {} \; |
Remove newline characters from "/system/folder3/temp/temp1/text1.txt" | paste -sd "" /system/folder3/temp/temp1/text1.txt |
Remove regular files in the /system directory tree | find /system -type f -print0 | xargs -0 -n1 echo rm | sh -x |
Print summary of new/missing files, and which files differ between /system/folder1 and /system/folder2, sorted alphabetically. | diff -qr /system/folder1 /system/folder1 | sort |
Print amount of space available on the file system containing path to the /system directory in megabytes. | df /system -B MB | tail -1 | awk {'print $4'} | grep .[0-9]* |
Recursively find the latest modified file in the /system directory | find /system -type f | xargs ls -ltr | tail -n 1 |
Display the number of sub-directories for all directories under /system directory tree, sort them according to the decreasing order of the number and show only the first 10 of them | find /system -type d -ls | awk '{print $4 - 2, $NF}' | sort -rn | head |
archive all files in /system/folder1 directory modified in the last 60 days to "/mytarfile.tgz" | tar czvf mytarfile.tgz `find /system/folder1 -mtime -60` |