Commit
·
e547783
1
Parent(s):
c1d76bc
init
Browse files- README.md +13 -0
- corrections.csv +227 -0
- final.csv +194 -0
- nl2bash_fs_1.json +232 -0
- nl2bash_fs_2.json +247 -0
- nl2bash_fs_3.json +287 -0
- nl2bash_fs_4.json +117 -0
- nl2bash_fs_5.json +92 -0
README.md
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
task_categories:
|
4 |
+
- translation
|
5 |
+
language:
|
6 |
+
- en
|
7 |
+
size_categories:
|
8 |
+
- n<1K
|
9 |
+
---
|
10 |
+
# Dataset Card for InterCode-Corrections
|
11 |
+
|
12 |
+
<!-- Provide a quick summary of the dataset. -->
|
13 |
+
This is a manually corrected version of the InterCode-Bash dataset, providing natural language prompts and Bash commands for the task of machine translation.
|
corrections.csv
ADDED
@@ -0,0 +1,227 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Original Prompt,Original Command,Valid (T/F),Duplicate (T/F),Valid Prompt (T/F),Valid Environment (T/F),Valid Command (T/F),Corrected Prompt,Corrected Environment,Corrected Command,Functionally Equivalent Command,Notes,Remove (T/F)
|
2 |
+
"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,T,F,T,T,T,NA,NA,NA,"find /testbed -type f -name ""*.java"" -exec md5sum {} + | sort | uniq -w32 -d -c | sort -nr",NA,F
|
3 |
+
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,F,F,F,T,F,Calculate the md5 sum of the md5 sum of all the files under /testbed/dir2/subdir2 sorted by filename,NA,find /testbed/dir2/subdir2 -type f -print0 | sort -z | xargs -0 md5sum | awk '{print $1}' | md5sum,ls -1 /testbed/dir2/subdir2/* | sort | xargs md5sum | awk '{print $1}' | md5sum,"Prompt is ambiguous if you sort by file path or md5sum value, and ambiguous if you include path in the final md5sum. Task is sensitive to newlines and null terminators.",F
|
4 |
+
"Calculate the md5 sum of the contents of the sorted list of files ""$FILES""",cat $(echo $FILES | sort) | md5sum,F,F,T,F,F,NA,"ENV FILES=""/testbed/hello.c /testbed/FooBar.html""",cat $(echo $FILES | tr ' ' '\n' | sort) | md5sum,"echo ""$FILES"" | tr ' ' '\n' | sort | xargs cat | md5sum",The FILES environment variable is not set.,F
|
5 |
+
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,F,T,F,T,F,NA,NA,NA,NA,Duplicate of 1.,T
|
6 |
+
"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,T,F,T,T,T,NA,NA,NA,find /testbed/dir1/subdir1 -type f -name '*.py' -print0 | xargs -0 md5sum | awk '{print $1}' | sort | md5sum,Prompt ambiguous if you include path in the final md5sum. Task is sensitive to newlines and null terminators.,F
|
7 |
+
"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",F,T,T,T,T,NA,NA,NA,NA,Duplicate of 4.,T
|
8 |
+
"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): /',F,F,T,T,F,NA,NA,"find /testbed -name ""*.txt"" -exec du {} + | awk -v hostname=""$(hostname)"" '{print hostname, $0}'","find /testbed -name ""*.txt"" -exec du -h {} + | awk -v hostname=""$(hostname)"" '{print hostname, $0}'",Command incorrectly searches the root directory and does not prepend the hostname.,F
|
9 |
+
"Change directory to the directory containing the executable file of command ""python""",cd $(which python | xargs dirname),F,F,F,F,F,NA,NA,NA,NA,Python is not installed on the system. InterCode does not correctly handle cd commands. Only 3 commands in the dataset use cd.,T
|
10 |
+
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",T,F,T,T,T,NA,NA,NA,"find /testbed -type f -name ""*.php"" -exec chmod 755 {} \; -print | wc -l",NA,F
|
11 |
+
Check if current shell is running within a 'screen' process.,pstree --show-parents -p $$ | head -n 1 | sed 's/\(.*\)+.*/\1/' | wc -l,F,F,F,T,F,"Check if the current shell is running within a 'screen' process and print ""True"" or ""False""",NA,"pstree -s $$ | grep -q ""screen"" && echo ""True"" || echo ""False""","ps -o comm= $(pstree -sp $$ | awk -F '[^0-9]*' '{print $2}') | grep -q 'screen' && echo ""True"" || echo ""False""",Command does not check for screen process. Prompt does not specify what output to return to user.,F
|
12 |
+
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,F,F,F,T,F,"Print ""True"" if the contents of file /testbed/dir3/subdir1/subsubdir1/textfile3.txt is a subset of file /testbed/dir2/subdir1/textfile2.txt, otherwise print ""False""",NA,"comm -23 <(sort /testbed/dir3/subdir1/subsubdir1/textfile3.txt | uniq) <(sort /testbed/dir2/subdir1/textfile2.txt | uniq) | head -1 | grep -q '.' && echo ""False"" || echo ""True""","comm -23 <(sort /testbed/dir3/subdir1/subsubdir1/textfile3.txt | uniq) <(sort /testbed/dir2/subdir1/textfile2.txt | uniq) | grep -q '.' && echo ""False"" || echo ""True""",Prompt does not specify what output to return to user.,F
|
13 |
+
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 {} &,F,F,F,T,F,Compress regular files in the testbed directory tree that were last modified more than 7 days ago in parallel using gzip,NA,find /testbed -type f -mtime +7 -print0 | xargs -0 -P 4 gzip,find /testbed -type f -mtime +7 -print0 | xargs -0 -P 0 gzip,Prompt does not specify how to compress files. Command does not execute.,T
|
14 |
+
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,F,T,F,T,F,NA,NA,NA,NA,Duplicate of 11.,T
|
15 |
+
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) }',T,F,T,T,T,NA,NA,NA,"find /testbed -type f -name ""*.txt"" -exec wc -w {} + | awk '{total = $1} END {print total/(NR-1)}'",NA,F
|
16 |
+
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}',F,F,F,F,F,Compute the mean average of the word count of *.txt files smaller than 6 words in the /testbed directory,NA,find /testbed -name '*.txt' -print0 | xargs -0 wc -w | awk '$1 < 6 {v += $1; c++} END {print v/c}',"find /testbed -name '*.txt' -print0 | xargs -0 wc -w | awk '$1 < 6 {v += $1; c++} END {print v/c, ""words""}'",The environment does not have any text files greater than 2000 words.,F
|
17 |
+
"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,F,F,F,T,F,"Copy all files with ""FooBar"" in the path under the '/testbed' directory to the '/testbed/dir3/subdir1/subsubdir1/tmp' directory.",NA,find /testbed -path '*FooBar*' -print0 | xargs -0 -I{} cp -r {} /testbed/dir3/subdir1/subsubdir1/tmp,find /testbed -path '*FooBar*' -print0 | xargs -0 -I{} cp -R {} /testbed/dir3/subdir1/subsubdir1/tmp,Command uses testbed/ instead of testbed/dir1/ and -name instead of -path.,F
|
18 |
+
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 {} \;",F,F,F,F,F,"search for all .txt files in the /testbed directory, prints their paths, and then search within each file for the word ""another""",NA,"find /testbed -name ""*.txt"" \( -exec echo {} \; -o -exec true \; \) -exec grep another {} \;","find /testbed -type f -name ""*.txt"" -print -exec grep -H ""another"" {} \;","Prompt does not describe a task. Environment does not contain any files with the word ""banana""",F
|
19 |
+
"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 ' ',T,F,T,T,T,NA,NA,NA,head -c 16 /testbed/textfile7.txt | od -An -tx1 | tr -d ' \n',NA,F
|
20 |
+
"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 ""{}"" .",F,F,T,T,F,NA,NA,"find /testbed -type f -path '*FooBar*' | xargs -i cp -p ""{}"" .","find /testbed -type f -path '*FooBar*' -exec cp --preserve=mode,ownership,timestamps {} ./ \;",Command incorrectly uses -name instead of -path.,F
|
21 |
+
"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,F,F,F,T,T,"Copy all files and folders below the /testbed directory whose names contain ""FooBar"" to directory '/testbed/dir3/subdir1/subsubdir1/tmp'",NA,NA,"find /testbed -name ""*FooBar*"" -exec cp -r {} /testbed/dir3/subdir1/subsubdir1/tmp \;",Command copies folders but prompt only specifies files.,F
|
22 |
+
Count all the lines of all '*.c' files in /testbed directory recursively,"find /testbed -name ""*.c"" -print0 | xargs -0 cat | wc -l",T,F,T,T,T,NA,NA,NA,"find /testbed -name ""*.c"" -exec wc -l {} + | awk '{s+=$1} END {print s}'",NA,F
|
23 |
+
Count all the lines of all files with names ending with 'php' in current directory recursively,find -name '*php' | xargs cat | wc -l,F,F,F,T,F,Count all the lines of all files with names ending with 'php' in current directory and subdirectories recursively,NA,find . -type f -name '*php' | xargs cat | wc -l,find . -type f -name '*.php' -exec wc -l {} + | awk '{s=$1} END {print s}',Command does not explicitly search for files. Prompt does not specify if subdirectories are included.,F
|
24 |
+
Count all the lines of all php files in the /testbed directory recursively,find /testbed/ -name '*.php' | xargs cat | wc -l,T,F,T,T,T,NA,NA,NA,find /testbed/ -type f -name '*.php' | xargs cat | wc -l,NA,F
|
25 |
+
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 }'",F,T,T,T,T,NA,NA,NA,NA,Duplicate of 22.,T
|
26 |
+
Count md5sum of all '*.py' files in /testbed folder with subfolders.,"find /testbed -type f -name ""*.py"" -exec md5sum {} + | awk '{print $1}' | sort | md5sum",F,F,F,T,F,Calculate the md5sum of all '*.py' files in /testbed folder and sub folders.,NA,"find /testbed -type f -name ""*.py"" -exec md5sum {} +","find /testbed -type f -name ""*.py"" -print0 | xargs -0 md5sum","Prompt asks for a count of md5sums, ambiguous.",F
|
27 |
+
"Count the *.html files residing in the /testbed directory tree and containing string ""foo""","find /testbed -name ""*.html"" | xargs grep -l foo | wc -l",F,F,T,F,T,NA,"echo '<html><head><title>Test</title></head><body><h1>Hello, foo!</h1></body></html>' > /testbed/index.html",NA,"find /testbed -name ""*.html"" -exec grep -l foo {} + | wc -l",The testbed directory does not contain any .html files.,F
|
28 |
+
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,F,T,T,F,T,NA,NA,NA,NA,Duplicate of 25.,T
|
29 |
+
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",T,F,T,T,T,NA,NA,NA,find /testbed -type f -name '*.php' -exec chmod 755 {} \; -print | wc -l,NA,F
|
30 |
+
"Count the number of lines in all "".php"" files in the /testbed directory tree",find /testbed -name '*.php' -type f | xargs cat | wc -l,F,T,T,T,T,NA,NA,NA,NA,Duplicate of 22.,T
|
31 |
+
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,F,F,F,F,F,Count the number of lines in all files in the /testbed directory tree that match pattern '*file*',NA,find /testbed/ -name '*file*' | sort | xargs wc -l,find /testbed -type f -name '*file*' -exec wc -l {} +,"No files in the testbed directory match the pattern ""foo??""",F
|
32 |
+
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,T,F,T,T,T,NA,NA,NA,"find ""${DIRECTORY}"" -type f -print | awk -F/ '{print $NF}' | grep -i '[aeiouy]' | wc -l",NA,F
|
33 |
+
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,F,F,F,T,T,Count the number of files for each unique file extensions in the /testbed directory tree.,NA,NA,find /testbed -type f | awk -F. '{if (NF>1) print $NF}' | sort | uniq -c | sort -nr,Prompt does not specify if the total number of unique file types of the count of files for each unique type should be printed.,F
|
34 |
+
"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,F,F,T,F,T,NA,gzip -c /testbed/index.html > /testbed/index.html.gz,NA,"find /testbed -type f -name ""*.gz"" -exec sh -c 'gunzip -c ""$0"" | wc -l' {} \; | awk '{s+=$1} END {print s}'",Environment does not contain any .gz files.,F
|
35 |
+
Counts all files in the /testbed folder and subfolders.,find /testbed -type f -exec ls -l {} \; | wc -l,T,F,T,T,T,NA,NA,NA,find /testbed -type f | wc -l,NA,F
|
36 |
+
Count lines in each *.php file sorted by file in /testbed directory.,find /testbed -name '*.php' -type f | sort | xargs wc -l,T,F,T,T,T,NA,NA,NA,"find /testbed -type f -name ""*.php"" -exec wc -l {} + | sort",NA,F
|
37 |
+
"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,T,F,T,T,T,NA,NA,NA,"find /testbed -type f -name ""*.php"" -exec wc -l {} + | sort -rn",NA,F
|
38 |
+
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,F,T,T,T,T,NA,NA,NA,NA,Duplicate of 22.,T
|
39 |
+
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,F,T,T,T,T,NA,NA,NA,NA,Duplicate of 22.,T
|
40 |
+
"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}',F,F,T,T,F,NA,NA,"grep -oE '([0-9]{1,3}\.){3}[0-9]{1,3}' /etc/networks | sort | uniq -c | sort -nr","awk '{for (i=1; i<=NF; i++) if ($i ~ /([0-9]{1,3}\.){3}[0-9]{1,3}/) print $i}' /etc/networks | sort | uniq -c | sort -nr","Command prints symbolic name, not the address.",F
|
41 |
+
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 }'",F,T,T,T,T,NA,NA,NA,NA,Duplicate of 22.,T
|
42 |
+
Counts total lines in all *.php files in the /testbed directory recursively,find /testbed -name '*.php' -type f | xargs cat | wc -l,F,T,T,T,T,NA,NA,NA,NA,Duplicate of 22.,T
|
43 |
+
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}',F,F,T,F,T,NA,"echo -e '<?php echo ""Hello, world!""; ?>\n<>' > /testbed/hello1.php",NA,find /testbed -type f -name '*.php' -exec grep -H '.*[[:alnum:]].*' {} + | wc -l,Environment does not include any php files that have non alphanumeric lines.,F
|
44 |
+
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}',F,F,T,F,T,NA,"echo -e 'console.log(""Hello, world!"");\n<>' > /testbed/hello1.js",NA,find /testbed -type f \( -name '*.php' -o -name '*.js' \) -exec wc -l {} + | awk '{s=$1} END {print s}',Environment does not have any .js files.,F
|
45 |
+
"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/,F,F,F,T,T,NA,NA,NA,NA,Ambiguous prompt.,T
|
46 |
+
"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",T,F,T,T,T,NA,NA,NA,"find testbed -type d -name ""dir1"" -exec touch {}/abc.txt \;",NA,F
|
47 |
+
"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/,,'",F,F,T,F,T,NA,Add .gitkeep files to setup.sh,NA,"find /testbed -mindepth 1 -maxdepth 1 -type d | xargs tar -czf /backup1.tar --transform 's,^testbed/,,'",Environment git reset script results in different docker containers due to empty folders. This results in different tar files.,T
|
48 |
+
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,T,F,T,T,T,NA,NA,NA,find /var/log -type f -mtime +1 -exec tar -czvPf /testbed/logs.tar.gz {} +,NA,F
|
49 |
+
"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,F,F,F,T,T,"Delete files in ""/testbed/dir3/subdir1/subsubdir1/tmp"" that are older than 2 days",NA,NA,find /testbed/dir3/subdir1/subsubdir1/tmp -type f -mtime +2 -delete,Command does not count the number of files deleted.,F
|
50 |
+
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,F,F,T,T,F,NA,NA,find /testbed -type f -exec du -b {} + | sort -rh | head -n 5,find /testbed -type f -print0 | xargs -0 du -b | sort -rn | head -n 5,Command uses ls which shows the allocated disk space not than the actual file size.,F
|
51 |
+
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,F,F,T,T,F,NA,NA,find /testbed -type f -size +0c -exec du -b {} + | sort -n | head -n 5,find /testbed -type f -size +0c -exec du -b {} + | sort -rh | tail -n 5,Command uses ls which shows the allocated disk space not than the actual file size.,F
|
52 |
+
Display the 5 smallest files in the /testbed directory and its sub-directories.,find /testbed -type f -exec ls -s {} \; | sort -n | head -5,T,F,T,T,T,NA,NA,NA,find /testbed -type f -exec du -b {} + | sort -n | head -n 5,NA,F
|
53 |
+
Display the biggest file sizes only in the /testbed directory,find /testbed -type f -exec du -Sh {} + | sort -rh | head -n 5,F,F,F,T,F,Display the five biggest file sizes only in the /testbed directory,NA,find /testbed -type f -maxdepth 1 -exec du -b {} + | sort -rh | head -n 5,ls -lS /testbed | grep '^-' | head -n 5,Prompt does not specify the number of files to display. Command incorrectly uses du -h.,F
|
54 |
+
"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 {}",T,F,T,T,T,NA,NA,NA,"find testbed -type f -name ""*.java"" -exec grep -l 'Hello' {} +",NA,F
|
55 |
+
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,T,F,T,T,T,NA,NA,NA,find /testbed -type f | awk -F/ '{print tolower($NF)}' | sort | uniq -d,NA,F
|
56 |
+
"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/#',T,F,T,T,T,NA,NA,NA,comm -23 <(find testbed/dir1 -type f | sed 's|testbed/dir1/||' | sort) <(find testbed/dir2 -type f | sed 's|testbed/dir2/||' | sort) | sed 's|^|testbed/dir1/|',NA,F
|
57 |
+
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 {}",F,F,F,T,F,Recursively finds all files containing text 'Hello' in /testbed and prints folder where they are placed.,NA,grep -rl 'Hello' /testbed | xargs -I {} dirname {} | sort | uniq,find /testbed -type f -exec grep -l 'Hello' {} + | xargs -I {} dirname {} | sort | uniq,Prompt does not specify a directory. Command incorrectly uses awk.,F
|
58 |
+
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 }',T,F,T,T,T,NA,NA,NA,"find /testbed -name ""*.java"" -exec wc -l {} + | awk '{s=$1} END {print s}'",NA,F
|
59 |
+
Create a symbolc link in the /testbed/dir3/subdir1/subsubdir1/FooBar to root folder,ln /testbed/dir3/subdir1/subsubdir1/FooBar -s /,T,F,T,T,T,NA,NA,NA,ln -s /testbed/dir3/subdir1/subsubdir1/FooBar /,NA,F
|
60 |
+
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,F,F,T,F,F,NA,echo 'File with perms' > /testbed/dir1/perms.txt; chmod 1553 /testbed/dir1/perms.txt,find /testbed/dir1 -perm 1553,find /testbed/dir1 -type f -perm 1553,Environment does not include a file with the correct permissions. Command does not check for sticky bit.,F
|
61 |
+
"search for php files in /testbed directory and search for ""world"" in all these files","find /testbed -name '*.php' -exec grep -iq ""world"" {} \; -print",T,F,T,T,T,NA,NA,NA,"find /testbed -name ""*.php"" -exec grep -H ""world"" {} \;",NA,F
|
62 |
+
"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",T,F,T,T,T,NA,NA,NA,find /system/folder1 -type f -exec grep -inH 'hello' {} \;,NA,F
|
63 |
+
"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""",T,F,T,T,T,NA,NA,NA,grep -ronw '/system' -e 'foo',NA,F
|
64 |
+
Recursively list contents of the '/system' directory in a tree-like format,tree /system,T,F,T,T,T,NA,NA,NA,find /system -print | sed -e 's;[^/]*/;|___;g;s;___|; |;g',NA,F
|
65 |
+
Recursively print all files and directories in the '/system/folder2' directory tree including hidden files,tree -a /system/folder2,T,F,T,T,T,NA,NA,NA,find /system/folder2 -print | sed -e 's;[^/]*/;|___;g;s;___|; |;g',NA,F
|
66 |
+
"Recursively prints all folders in the '/system' folder that contain files like ""*.out"".","find /system -name ""*.out"" -print0 | xargs -0 -n1 /system | sort --unique",F,F,T,T,F,NA,NA,"find /system -type f -name ""*.out"" -print0 | xargs -0 -n1 dirname | sort -u","find /system -type f -name ""*.out"" -printf '%h\n' | sort -u","Original command uses xargs incorrectly, without the dirname utility.",F
|
67 |
+
"Recursively remove all ""*.txt"" files in the '/system' folder and answer ""y"" to any prompt",yes y | rm -r /system/*.txt,F,F,F,T,T,"Remove all ""*.txt"" files in the '/system' folder and answer ""y"" to any prompt",NA,NA,"find /system -maxdepth 1 -type f -name ""*.txt"" -exec rm -f {} \;",Gold command does not recurse into sub directories. Prompt changed to match gold command.,F
|
68 |
+
Recursively removes all empty folders from the /system/folder3/temp folder.,find /system/folder3/temp -depth -type d -exec rmdir {} \;,T,F,T,T,T,NA,NA,NA,find /system/folder3/temp -type d -empty -delete,NA,F
|
69 |
+
"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 {} +,T,F,T,T,T,NA,NA,NA,find /system/folder3/temp -type d -empty -print -delete 2>/dev/null,NA,F
|
70 |
+
Recursively removes all files in the /system/folder1 folder but '*txt' files.,find /system/folder1 -type f -not -name '*txt' | xargs rm,T,F,T,T,T,NA,NA,NA,find /system/folder1 -type f ! -name '*.txt' -print -delete,NA,F
|
71 |
+
"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/' '{}' \;,F,F,F,F,F,Recursively rename all files under /system/folder2 replacing special with regular.,NA,"find /system/folder2 -type f -name '*special*' ! -path '*/special/*' -execdir bash -c 'mv ""$0"" ""${0/special/regular}""' {} \;","find /system/folder1 -type f -name '*special*' -exec bash -c 'for f; do mv -- ""$f"" ""${f%/*}/${f##*/special/regular}""; done' _ {} +",Folder1 does not contain any files with a name including 'special'. The rename utility is not installed on the system.,F
|
72 |
+
"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)",T,F,T,T,T,NA,NA,NA,"grep -r ""foo"" /system | awk '{print} END {print NR}'",NA,F
|
73 |
+
"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 {} \;,T,F,T,T,T,NA,NA,NA,find /system/folder3/ -type f | xargs -n 1 basename,NA,F
|
74 |
+
"Recursively unzip files to stdout in ""/system/folder2.tar.gz"" and search for ""special""","zcat -r /system/folder2.tar.gz | grep ""special""",T,F,T,T,T,NA,NA,NA,"tar -xzvf /system/folder2.tar.gz -O | grep ""special""",NA,F
|
75 |
+
"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,T,F,T,T,T,NA,NA,NA,cat system/folder3/temp/temp1/text1.txt | sed 's/\r$//' | od -c -An,NA,F
|
76 |
+
Remove all *.doc files from the /system/folder1 tree,"find /system/folder1 -name '*.doc' -exec rm ""{}"" \;",T,F,T,T,T,NA,NA,NA,find /system/folder1 -type f -name '*.doc' -delete,NA,F
|
77 |
+
Remove all *.log files from the /system/folder1 tree,find /system/folder1 -name '*.log' -print0 | xargs -0 rm,T,F,T,T,T,NA,NA,NA,find /system/folder1 -type f -name '*.log' -delete,NA,F
|
78 |
+
Remove all *.txt files in '/system' directory but not in it's subdirectories,find /system -maxdepth 1 -name '*.txt' -maxdepth 1 | xargs rm,F,F,T,T,F,NA,NA,find /system -name '*.txt' -maxdepth 1 | xargs rm,find /system -name '*.txt' -maxdepth 1 -delete,Gold command contained two maxdepth flags.,F
|
79 |
+
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 {} \;,T,F,T,T,T,NA,NA,NA,find /system/folder3/backup_dbg -name '*.sql' -print -mtime +25 -delete,NA,F
|
80 |
+
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",F,F,T,T,F,NA,NA,"find /system/folder1 -mmin +5 -type f -name ""*.txt"" -delete","find /system/folder1 -mmin +5 -type f -name ""*.txt"" | xargs rm -f",Gold command does not search subdirectories.,F
|
81 |
+
"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",F,F,F,T,T,"Remove all *.txt files, except ""keep.txt"", under /system/folder1 directory modified more than 5 minutes ago. Do not include subdirectories.",NA,NA,"find /system/folder1 -maxdepth 1 -mmin +5 -type f -name ""*.txt"" ! -name ""keep.txt"" | xargs rm -f",Prompt did not specify that subdirectories should not be included.,F
|
82 |
+
"Remove all .sh files in the '/system/folder1' tree whose names begin with ""new""",find /system/folder1 -name 'new*.sh' -exec rm -f '{}' \;,T,F,T,T,T,NA,NA,NA,find /system/folder1 -name 'new*.sh' -delete,NA,F
|
83 |
+
"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 {} \;,T,F,T,T,T,NA,NA,NA,"find /system -type f \( -name ""a.out"" -o -name ""*.o"" -o -name ""core"" \) -delete",NA,F
|
84 |
+
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",F,F,F,T,T,Print the last five lines of /system/folder1/data.csv,NA,NA,"tail -n 1 /system/folder1/data.csv | rev | cut -d',' -f1-5 | rev","Command does not update the csv file, modified the prompt to match.",F
|
85 |
+
"Remove all directories called ""temp"" from the /system directory tree","find /system -name ""temp"" -type f -delete",F,F,T,T,F,NA,NA,"find /system -name ""temp"" -type d -delete","find /system -type d -name ""temp"" -exec rm -rf {} +",Command removes files while the prompt specifies directories.,F
|
86 |
+
Remove all empty files in /system/folder3/temp and below,find /system/folder3/temp -type f -empty -print | xargs rm -f,T,F,T,T,T,NA,NA,NA,find /system/folder3/temp -type f -empty -print -delete,NA,F
|
87 |
+
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 {} \;,F,F,F,F,F,Remove all files a.out and *.o in the /system directory tree that were modified less than 7 days ago,NA,find /system \( -name a.out -o -name '*.o' \) -mtime -7 -exec rm {} \;,"find /system -type f \( -name ""a.out"" -o -name ""*.o"" \) -mtime -7 -delete",The environment does not contain files modified more than 7 days ago.,F
|
88 |
+
"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 {} \;,F,F,T,F,T,NA,touch /system/folder3/temp/.DS_Store,NA,find /system/folder3/temp \( -name '.DS_Store' -or -name '._.DS_Store' -or -name '._*' -or -name '.TemporaryItems' -or -name '.apdisk' \) -delete,Added .DS_Store file to /system/folder3/temp.,F
|
89 |
+
Remove empty directories from directory tree /system,find /system -type d -empty -exec rm -r {} \;,F,F,T,F,T,NA,NA,NA,NA,The environment does not contain empty directories due to the .gitkeep bug.,T
|
90 |
+
"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,T,F,T,T,T,NA,NA,NA,echo '1/2 [3] (27/03/2012 19:32:54) word word word word 4/5' | sed 's/([^)]*)//g' | tr -c '0-9' ' ' | column -t,NA,F
|
91 |
+
"Remove files text2, text3, text4 in directory /system/folder1",find /system/folder1 -name 'text[2-4]' -exec rm {} \;,F,F,T,T,F,NA,NA,find /system/folder1 -name 'text[2-4]*' -exec rm {} \;,find /system/folder1 -name 'text[2-4]*' -delete,Gold command was missing * and did not find files with .txt extension.,F
|
92 |
+
Remove files from the /system directory that are owned by nobody,find /system -nouser -exec rm {} +,F,F,T,F,T,NA,NA,NA,NA,Files owned by nobody do not exist in the environment and cannot be created.,T
|
93 |
+
Remove files that are greater than 1KB in size under /system directory,find /system -type f -size +1k -exec rm {} +,F,F,F,F,F,Remove files that are less than 1KB in size under /system directory,NA,find /system -type f -size -1k -exec rm {} +,find /system -type f -size -1k -delete,"No files are greater than 1KB, changed the prompt to less than 1KB.",F
|
94 |
+
"Remove junk files modified more than 31 days ago recursively from ""/system""",find /system -type f -mtime +31 -exec rm -f {} \;,F,F,F,T,T,"Remove files modified more than 31 days ago recursively from ""/system""",NA,NA,find /system -type f -mtime +31 -delete,"The term Junk Files is ambiguous, removed from prompt.",F
|
95 |
+
"Remove newline characters from ""/system/folder3/temp/temp1/text1.txt""","paste -sd """" /system/folder3/temp/temp1/text1.txt",F,F,F,T,T,"Print ""/system/folder3/temp/temp1/text1.txt"" without newline characters.",NA,NA,tr -d '\n' < /system/folder3/temp/temp1/text1.txt,"Command does not modify the file, updated prompt to print file contents.",F
|
96 |
+
Remove regular files in the /system directory tree,find /system -type f -print0 | xargs -0 -n1 echo rm | sh -x,F,F,T,T,F,NA,NA,find /system -type f -exec rm {} +,find /system -type f -delete,Gold command did not remove the specified files.,F
|
97 |
+
"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,F,F,F,T,F,Print which files differ between /system/folder1 and /system/folder2.,NA,diff -qr /system/folder1 /system/folder2 | sort,diff -qr /system/folder1 /system/folder2,Simplified prompt and corrected gold command that compared the same directories.,F
|
98 |
+
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]*,F,F,T,T,F,NA,NA,df -m /system,df -m /system | grep / | tr -s ' ' | cut -d ' ' -f 4,Gold command displayed output in bytes.,F
|
99 |
+
Recursively find the latest modified file in the /system directory,find /system -type f | xargs ls -ltr | tail -n 1,F,F,T,F,T,NA,NA,NA,NA,All files are modified at the same time due to docker init.,T
|
100 |
+
"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",F,F,F,T,F,Display the number of sub-directories under /system,NA,find /system -type d | wc -l,tree -d /system | tail -n 1,Simplified over complicated prompt and updated gold command.,F
|
101 |
+
"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`,F,F,F,T,F,"Archive all files in /system/folder1 directory modified in the last 60 days to ""/mytarfile.tgz"" with a time of 2023-01-01, owner of 0, and group of 0.",NA,tar --mtime='2023-01-01' --owner=0 --group=0 -czf mytarfile.tgz `find /system/folder1 -mtime -60`,tar --mtime='2023-01-01' --owner=0 --group=0 -czvf mytarfile.tgz `find /system/folder1 -mtime -60`,Metadata of the tar command must be fixed to result in equivalent backups. Corrected the prompt and gold command.,F
|
102 |
+
Create a symbolc link in the /system/folder1 to root folder,ln /system/folder1 -s /,T,F,T,T,T,NA,NA,NA,ln -s /system/folder1 /,NA,F
|
103 |
+
Remove files in the /system directory tree modified more than 31 days ago recursively,find /system -type f -mtime +31 -print0 | xargs -0 -r rm -f,F,T,T,T,T,NA,NA,NA,NA,Duplicate of 92.,T
|
104 |
+
"Write the current date and time followed by "" 1"" to the console and append to ""/system/folder3/temp/empty.txt""","echo $(date) ""1"" | tee -a /system/folder3/temp/empty.txt",T,F,T,T,T,NA,NA,NA,"echo $(date +""%Y-%m-%d~%H:%M:%S"") ""1"" | tee -a /system/folder3/temp/empty.txt",This case shows agent and eval containers are not run at the same time.,F
|
105 |
+
"Concatenate all .txt files residing in the /system tree into a single file ""/system/folder3/temp/empty.txt""","find /system -name ""*.txt"" -exec cat {} \; > /system/folder3/temp/empty.txt",F,F,F,T,F,"Concatenate all .txt files residing in the /system tree into a single file ""/system/folder3/temp/concat.txt""",NA,"find /system -name ""*.txt"" -not -name ""concat.txt"" -print -exec cat {} \; > /system/folder3/temp/concat.txt","find /system -type f -name ""*.txt"" -not -name ""concat.txt"" -print -exec cat {} \; > /system/folder3/temp/concat.txt",Gold command included the output file in the input causing it to fail.,F
|
106 |
+
compresses all the files in the /system folder with default depth to /backup,find /system -depth -print | cpio -dump /backup,F,F,F,T,T,Compresses all the files in the /system folder with default depth to /backup using cpio.,NA,NA,find /system -print | cpio -dump /backup,"Ambiguous prompt, changed to specify using cpio.",F
|
107 |
+
Copy all files in the /system directory except those containing 'text' to '/system/folder3/backup_dbg/backup'.,find /system -maxdepth 1 -type f -name '*text*' -exec cp {} /system/folder3/backup_dbg/backup \;,F,F,F,T,F,Copy all files in the /system directory except those containing 'text' to '/system/folder3/backup_dbg/backup'. Do not include subdirectories.,NA,find /system -maxdepth 1 -type f ! -name '*text*' -exec cp {} /system/folder3/backup_dbg/backup \;,find /system -maxdepth 1 -print -type f ! -name '*text*' -exec cp {} /system/folder3/backup_dbg/backup \;,Command searches for files containing text and ignores subdirectories. Updated prompt to match.,F
|
108 |
+
"Rename ""/system/folder3/temp/temp1"" to ""/system/folder3/temp/temp1_old"" and backup to ""/system/folder3/temp/temp1_old.old"" if ""/system/folder3/temp/temp1_old"" exists",mv /system/folder3/temp/temp1 /system/folder3/temp/temp1_old -b -S .old,F,F,F,T,F,"Rename ""/system/folder3/temp/temp1"" to ""/system/folder3/temp/temp1_old""",NA,mv /system/folder3/temp/temp1 /system/folder3/temp/temp1_old,cp -r /system/folder3/temp/temp1 /system/folder3/temp/temp1_old && rm -r /system/folder3/temp/temp1,Simplified overly complex prompt.,F
|
109 |
+
"Dump ""/system/text1.txt"" as ASCII characters",od -t c /system/text1.txt,T,F,T,T,T,NA,NA,NA,hexdump -C /system/text1.txt,NA,F
|
110 |
+
"create a compressed archive of /system/folder1 ""compress_folder1.tar.gz"" with verbose output",tar -zcvf compress_folder1.tar.gz /system/folder1,F,F,F,T,F,"Create a compressed archive of /system/folder1 ""compress_folder1.tar.gz"" with a time of 2023-01-01, owner of 0, and group of 0.",NA,tar --mtime='2023-01-01' --owner=0 --group=0 -zcf compress_folder1.tar.gz /system/folder1,tar --mtime='2023-01-01' --owner=0 --group=0 -zcvf compress_folder1.tar.gz /system/folder1,Metadata of the tar command must be fixed to result in equivalent backups. Corrected the prompt and gold command.,F
|
111 |
+
"download content from ""http://example.com/textfile.txt"" and output to 'textfile.txt' in /system",curl http://example.com/textfile.txt -o /system/textfile.txt,T,F,T,T,T,NA,NA,NA,curl -vo /system/textfile.txt http://example.com/textfile.txt,NA,F
|
112 |
+
Search in /system downwards all files whose size is 10 bytes ( Characters ) .,find /system -size 10c -print,F,F,F,T,F,Search in /system downwards all files whose size is greater than 10 bytes.,NA,find /system -size +10c -print,find /system -type f -size +10c,No files in the environment have a size of 10 bytes. Corrected prompt and command to be greater than 10 bytes.,F
|
113 |
+
"Calculate the md5sum of each "".txt"" file under ""/system"", sort the output, and calculate the md5sum of that",find /system -type f -name '*.txt' -exec md5sum {} + | awk '{print $1}' | sort | md5sum,F,F,F,T,F,"Calculate the md5sum of each "".txt"" file under ""/system"" and sort the output.",NA,find /system -type f -name '*.txt' -exec md5sum {} + | awk '{print $1}' | sort,"find /system -type f -name ""*.txt"" -exec md5sum {} + | sort",Simplified ambiguous prompt and corrected gold command.,F
|
114 |
+
"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}',T,F,T,T,T,NA,NA,NA,"grep ""$(hostname)"" /etc/hosts | awk '{print $1}'",NA,F
|
115 |
+
find files in /workspace directory which are modified 30 days ago,find /workspace -daystart -type f -mtime -30,F,F,F,T,T,Find files in /workspace directory modified within 30 days.,NA,NA,find /workspace -type f -mtime -30,Prompt does not specify exactly 30 days or less than or equal to 30 days.,F
|
116 |
+
find files in the /workspace directory with pattern` *.c that larger than 1 Kilobytes,find /workspace -name '*.c' -size +1k -print,T,F,T,T,T,NA,NA,NA,find /workspace -name '*.c' -size +1k,NA,F
|
117 |
+
"find files in the /workspace directory and sub-directories, that changed within last hour",find /workspace -cmin -60,F,F,F,F,F,"Find files in the /workspace directory and sub-directories, that changed over an hour ago.",NA,find /workspace -type f -cmin +60,find /workspace -type f -cmin +60 -print,"No files changed within the last hour, updated to files changed more than an hour ago. Gold command also searched for directories.",F
|
118 |
+
"find files in the /workspace directory and sub-directories, that were accessed within last hour",find /workspace -amin -60,F,F,F,F,F,"Find files in the /workspace directory and sub-directories, that were accessed over an hour ago.",NA,find /workspace -type f -amin +60,find /workspace -type f -amin +60 -print,"No files accessed within the last hour, updated to files accessed more than an hour ago. Gold command also searched for directories.",F
|
119 |
+
list all the drectories present in the /workspace directory and do not search in the sub directories.,find /workspace -maxdepth 1 -type d,T,F,T,T,T,NA,NA,NA,find /workspace -maxdepth 1 -type d,NA,F
|
120 |
+
list all the files in the /workspace directory which are of size 0 bytes.,find /workspace -empty,T,F,T,T,T,NA,NA,NA,find /workspace -empty -print,NA,F
|
121 |
+
list all zero-length files under the /workspace directory,find /workspace -empty -exec ls {} \;,T,F,T,T,T,NA,NA,NA,find /workspace -type f -size 0,NA,F
|
122 |
+
locate and remove large files (> 1 KB) in /workspace,find /workspace -type f -size +1k -delete,T,F,T,T,T,NA,NA,NA,find /workspace -type f -size +1k -exec rm {} \;,NA,F
|
123 |
+
long list al the files in the /workspace directory which have only read permission to the group,find /workspace -perm 400 -type f -exec ls -l {} \;,F,F,F,T,T,List all the files in the /workspace directory which have only read permission to the group.,NA,NA,find /workspace -perm 400 -ls,Corrected ambiguous prompt.,F
|
124 |
+
long list al the files in the /workspace directory which have all the permissions,find /workspace -perm 777 -type f -exec ls -l {} \;,F,F,F,T,T,List all the files in the /workspace directory which have permissions 777.,NA,NA,find /workspace -perm 777 -ls,Corrected ambiguous prompt.,F
|
125 |
+
long list the details of all the shell scripts in /workspace directory,"find /workspace -name ""*.sh"" -exec ls -ld {} \;",F,F,F,T,F,List the details of all the text files in /workspace directory.,NA,"find /workspace -name ""*.txt"" -exec ls -ld {} \;","find /workspace -name ""*.txt"" | xargs ls -ld","Environment does not display .sh files, replaced with .txt",F
|
126 |
+
move all files in the /workspace folder to / and do not move the files in the sub folder,find /workspace -maxdepth 1 -type f -exec mv -t / {} +,T,F,T,T,T,NA,NA,NA,find /workspace -maxdepth 1 -type f -exec mv {} / \;,NA,F
|
127 |
+
move files in /workspace accessed more than one day ago to directory /,find /workspace -atime +1 -type f -exec mv {} / \;,F,F,F,F,F,Move files in /workspace accessed less than one day ago to directory /.,NA,find /workspace -atime -1 -type f -exec mv {} / \;,find /workspace -type f -atime -1 -print0 | xargs -0 -I {} mv {} /,Environment does not contain files accessed more than one day ago. Changed to less than one day ago.,F
|
128 |
+
"print all filenames of files under /workspace/dir1 dir containing 'hello', case-insensitive",find /workspace/dir1 -type f -exec grep -il 'hello' {} \;,T,F,T,T,T,NA,NA,NA,grep -ril 'hello' /workspace/dir1,NA,F
|
129 |
+
print disk usage of files or folders in /workspace,du -sh /workspace,T,F,T,T,T,NA,NA,NA,du -h /workspace,NA,F
|
130 |
+
print the last word in /workspace/dir1/long.txt,tac /workspace/dir1/long.txt | awk 'NF{print $NF; exit}',T,F,T,T,T,NA,NA,NA,awk '{ for (i=1; i<=NF; i++) last=$i } END { print last }' /workspace/dir1/long.txt,NA,F
|
131 |
+
print top 3 largest files and /workspace,du -a /workspace | sort -nr | head -3,F,F,F,T,F,Print the 3 largest directories in /workspace.,NA,du -a /workspace | sort -nr | head -n 3,find /workspace -exec du -h {} + | sort -rh | head -n 3,"Command printed directory sizes, updated prompt to match.",F
|
132 |
+
"prints first line of ""/workspace/dir1/long.txt""",head -n1 /workspace/dir1/long.txt,T,F,T,T,T,NA,NA,NA,sed -n '1p' /workspace/dir1/long.txt,NA,F
|
133 |
+
"prints the last non-empty line of ""/workspace/dir1/a.txt""",tac /workspace/dir1/a.txt | grep -m 1 '.',T,F,T,T,T,NA,NA,NA,awk 'NF' /workspace/dir1/a.txt | tail -n 1,NA,F
|
134 |
+
prune all the files in the /workspace directory,find /workspace -prune,F,F,T,T,F,NA,NA,find /workspace -type f -delete,find /workspace -type f -exec rm -f {} +,Gold command with -prune option does not remove any files.,F
|
135 |
+
search for all the files in the /workspace directory which have size greater than 1KB (approx) and less than 32KB(approx).,find /workspace -size +1000c -size -32000c -print,F,F,T,T,F,NA,NA,find /workspace -type f -size +1k -size -32k,find /workspace -type f -size +1k -size -32k -print,Gold command searched for directories and did not include the correct size limits.,F
|
136 |
+
search for all the files in the /workspace folder and sort them in the order of their depth and display the file names,find /workspace -type d -printf '%d\t%P\n' | sort -r -nk1 | cut -f2-,F,F,T,T,F,NA,NA,"find /workspace -type f | awk -F/ '{print NF, $0}' | sort -n","find /workspace -type f | awk -F/ '{print NF, $0}' | sort -n | cut -d' ' -f2-","Gold command displayed directories, not files.",F
|
137 |
+
search for all the files in the /workspace folder which are bigger than 1KB and display them biggest file,find /workspace -size +1k -exec ls -ls {} \+ | sort -n | tail -1,F,F,F,T,F,Search for all the files in the /workspace folder which are bigger than 1KB and display the biggest file.,NA,find /workspace -type f -size +1k -exec ls -ls {} + | sort -n | tail -1,find /workspace -type f -size +1k -exec ls -lh {} + | sort -k 5 -rh | head -n 1,Gold command searched for directories and files. Fixed typo in prompt.,F
|
138 |
+
search for text files in the /workspace folder which do not have write access to others,"find /workspace -type f \( -iname ""*.txt"" -not -perm -o=w \)",T,F,T,T,T,NA,NA,NA,"find /workspace -type f -name ""*.txt"" ! -perm -o=w",NA,F
|
139 |
+
"search for the directory ""mysql"" in the entire file system",find /workspace -name mysql -type d,F,F,F,T,T,"Search for the directory ""mysql"" in the workspace directory.",NA,NA,"find workspace -type d -name ""mysql""","Prompt specified whole file system, but command searched workspace directory. Corrected prompt to match.",F
|
140 |
+
Print a list of all duplicate case insensitive filenames in the /workspace directory tree,find /workspace -type f | awk -F/ '{print $NF}' | sort -f | uniq -i -d,T,F,T,T,T,NA,NA,NA,find /workspace -type f | awk -F/ '{print tolower($NF)}' | sort | uniq -d,NA,F
|
141 |
+
search for the file foo in the /workspace folder and display a long listing of it in sorted order of modification date,find /workspace -name foo | xargs ls -tl,F,F,F,T,F,Search for the file old2.txt in the /workspace folder and list its permissions and creation time.,NA,find /workspace -name old2.txt | xargs ls -tl,find /workspace -name old2.txt -print0 | xargs -0 ls -tl,"Environment does not contain a file ""foo"" without extension. Original command just listed the root directory.",F
|
142 |
+
"search for the word ""hello"" in all the regular/normal files in the /workspace folder and display the matched file name","find /workspace -type f | xargs grep -l ""hello""",T,F,T,T,T,NA,NA,NA,grep -rnw '/workspace' -e 'hello',NA,F
|
143 |
+
Calculate the md5 sum of all files in the /workspace directory with the filename printed first,"ls -p | grep -v /workspace | xargs md5sum | awk '{print $2,$1}'",F,F,T,T,F,NA,NA,"find /workspace -type f -exec md5sum {} + | awk '{print $2 "" "" $1}'","find /workspace -type f -print0 | xargs -0 md5sum | awk '{print $2 "" "" $1}'","Gold command searched within the root directory, not the workspace directory.",F
|
144 |
+
"Calculate the md5 sum of the contents of all files sorted in directory tree ""/workspace""",find /workspace -type f | sort -u | xargs cat | md5sum,F,F,F,T,F,"Calculate the md5 sum of all files in directory tree ""/workspace""",NA,find /workspace -type f -exec md5sum {} + | sort,find /workspace -type f -exec md5sum {} +,Corrected ambiguous prompt.,F
|
145 |
+
Change directory to the alphabetically last path under the /workspace directory,cd $(find /workspace -type d -print0 | sort -z | tr '\0' '\n' | tail -1),F,F,T,T,T,NA,NA,NA,NA,Environment does not support cd commands.,T
|
146 |
+
Count the number of unique 3 to 6 character file extensions are in the /workspace directory tree,"find /workspace -type f -name ""*.*"" | grep -o -E ""\.[^\.]+$"" | grep -o -E ""[[:alpha:]]{3,6}"" | awk '{print tolower($0)}' | sort | uniq -c | sort -rn",F,F,T,T,F,NA,NA,find /workspace -type f -name '*.*' | awk -F. 'NF>1 {ext=tolower($NF); if (length(ext) >= 3 && length(ext) <= 6) print ext}' | sort | uniq -c | wc -l,"find /workspace -type f -name '*.*' | sed -n 's/.*\.//p' | awk '{print tolower($0)}' | grep -E '^[a-z]{3,6}$' | sort -u | wc -l",Invalid gold command did not accomplish task.,F
|
147 |
+
"Create a copy of the /workspace directory structure in the /usr directory,",find /workspace -type d -print|sed 's@^@/usr/@'|xargs mkdir -p,T,F,T,T,T,NA,NA,NA,find /workspace -type d | cpio -pdm /usr,NA,F
|
148 |
+
Display a long listing of the oldest file under '/workspace' directory tree,"find /workspace -printf ""%T@ %p\n"" | sort -n | head -1 | cut -d"" "" -f2- | xargs ls -al",F,F,T,T,F,NA,NA,find /workspace -type f -printf '%T+ %p\n' | sort | head -n 1 | awk '{print $2}' | xargs ls -l,find /workspace -type f -exec stat --format '%Y %n' {} \; | sort -n | head -n 1 | cut -d' ' -f2- | xargs ls -l,Invalid gold command did not accomplish task.,F
|
149 |
+
Find the largest 2 directories under /workspace directory,find /workspace -type d -print0 | xargs -0 du | sort -n | tail -2 | cut -f2 | xargs -I{} du -sh {},T,F,T,T,T,NA,NA,NA,find /workspace -type d -print0 | xargs -0 du | sort -n | tail -2,NA,F
|
150 |
+
List all files with their paths that have identical content in /workspace directory,find /workspace -type f | xargs md5sum | sort | uniq -Dw32,T,F,T,T,T,NA,NA,NA,find /workspace -type f -print0 | xargs -0 md5sum | sort | uniq -w32 -D,NA,F
|
151 |
+
"Make directories for each unique file path in ""/workspace/files.txt""","cat /workspace/files.txt |xargs -I {} dirname ""{}""| sort -u | xargs -I{} mkdir -p ""{}""",F,F,T,F,T,NA,"echo -e ""/workspace/dir2/foo.txt
|
152 |
+
/workspace/dir9/foo.txt"" > /workspace/files.txt",NA,"cat /workspace/files.txt | xargs -I {} dirname {}| sort -u | xargs -I{} mkdir -p ""{}""",Files.txt contained one file path that already existed. Added a new file path.,F
|
153 |
+
"Print the total disk usage in bytes of all files listed in ""/workspace/files.txt""",cat /workspace/files.txt | xargs du -c | tail -1 | awk '{print $1}',F,F,T,T,F,NA,NA,cat /workspace/files.txt | xargs du -b | tail -1 | awk '{print $1}',awk '{print $0}' /workspace/files.txt | xargs du -b | awk '{sum += $1} END {print sum}',Gold command did not print the size in bytes.,F
|
154 |
+
Unhide all hidden files in the /workspace directory,"find /workspace -maxdepth 1 -type f -name '.*' -exec sh -c 'mv ""$0"" ""${0%/\.*}/${0##*/.}""' {} \;",F,F,F,T,T,Unhide all hidden files in the /workspace directory. Do not include subdirectories.,NA,NA,"find /workspace -maxdepth 1 -type f -name '.*' -exec sh -c 'mv ""$1"" ""${1%/\.*}/${1##*/.}""' _ {} \;",Prompt did not specify sub directories.,F
|
155 |
+
"Count the number of differing lines in ""/workspace/dir1/long.txt"" and ""/workspace/dir1/terminate.txt""",diff /workspace/dir1/long.txt /workspace/dir1/terminate.txt | grep ^[\>\<] | wc -l,T,F,T,T,T,NA,NA,NA,diff /workspace/dir1/long.txt /workspace/dir1/terminate.txt | grep '^>' | wc -l,NA,F
|
156 |
+
"Count the number of differing lines in ""/workspace/dir1/terminate.txt"" and ""/workspace/dir1/long.txt"" with 0 lines of unified context",diff -U 0 /workspace/dir1/terminate.txt /workspace/dir1/long.txt | grep -v ^@ | wc -l,T,F,T,T,T,NA,NA,NA,diff -U 0 /workspace/dir1/terminate.txt /workspace/dir1/long.txt | grep -v '^@' | wc -l,NA,F
|
157 |
+
Counts lines in file /workspace/dir1/a.txt ignoring empty lines and lines with spaces only.,awk '!/^[[:space:]]*$/{++x} END{print x}' /workspace/dir1/a.txt,T,F,T,T,T,NA,NA,NA,grep -v '^[[:space:]]*$' /workspace/dir1/a.txt | wc -l,NA,F
|
158 |
+
"Create a symbolic link in directory ""~/newlinks"" for each file listed in ""/workspace/results.txt""",cat /workspace/results.txt | xargs -I{} ln -s {} ~/newlinks,T,F,T,T,T,NA,NA,NA,cat /workspace/results.txt | xargs -I {} ln -s {} ~/newlinks,NA,F
|
159 |
+
Delete all hidden files under /workspace,find /workspace -type f -name '.*' -delete,T,F,T,T,T,NA,NA,NA,find /workspace -type f -name '.*' -exec rm -f {} \;,NA,F
|
160 |
+
Determine if /workspace/dir2/mysql/ exists on a mounted file system.,df /workspace/dir2/mysql/,T,F,T,T,T,NA,NA,NA,mountpoint /workspace/dir2/mysql/,NA,T
|
161 |
+
"Display a dump of ""/workspace/dir1/long.txt"" as floating point values of double size",od -t fD /workspace/dir1/long.txt,T,F,T,T,T,NA,NA,NA,od -An -t fD /workspace/dir1/long.txt,NA,F
|
162 |
+
Display differences between list of files in /workspace/dir1 and /workspace/dir2.,diff <(ls /workspace/dir1) <(ls /workspace/dir2),T,F,T,T,T,NA,NA,NA,diff -qr /workspace/dir1 /workspace/dir2,NA,F
|
163 |
+
Display the file size of file '/workspace/dir1/sum.c' in bytes,du -sb /workspace/dir1/sum.c | cut -f1,T,F,T,T,T,NA,NA,NA,stat -c %s /workspace/dir1/sum.c,NA,F
|
164 |
+
Display the last slash-separated part of each filename path in /workspace/dir1/file.txt,rev /workspace/dir1/file.txt | cut -d/ -f1 | rev,T,F,T,T,T,NA,NA,NA,awk -F/ '{print $NF}' /workspace/dir1/file.txt,NA,F
|
165 |
+
Display the sizes and filepaths of all files/directories in /workspace directory sorted in descending order of size,du /workspace -a -h --max-depth=1 | sort -hr,F,F,T,T,F,NA,NA,du /workspace -a -h | sort -hr,du -ah /workspace | sort -rh,Gold command did not include sub directories.,F
|
166 |
+
Print percentage of the space used on the /workspace directory.,df -k /workspace | tail -1 | awk '{print $5}',T,F,T,T,T,NA,NA,NA,df -h /workspace | awk 'NR==2 {print $5}',NA,F
|
167 |
+
"Print the contents of ""/workspace/dir1/long.txt"" in reverse order",nl /workspace/dir1/long.txt | sort -nr | cut -b8-,T,F,T,T,T,NA,NA,NA,tac /workspace/dir1/long.txt,NA,F
|
168 |
+
"Create an empty file ""Icon"" with a carriage return character in the end of its name.",echo $'Icon\r' | xargs touch,F,F,F,T,F,"Create an empty file ""Icon"" in workspace/ with a carriage return character in the end of its name.",NA,echo $'workspace/Icon\r' | xargs touch,"touch ""workspace/Icon""$'\r'",Creating the file outside the workspace directory does not allow the environment to measure changes. Updated to create the file in the workspace directory.,F
|
169 |
+
Create a symbolc link in the /workspace/dir1 to root folder,ln /workspace/dir1 -s /,T,F,T,T,T,NA,NA,NA,ln -s /workspace/dir1 /,NA,F
|
170 |
+
"Display permissions, user, group, and full path for each file in the /workspace directory tree",tree /workspace -p -u -g -f,T,F,T,T,T,NA,NA,NA,find /workspace -type f -exec stat --format '%A %U %G %N' {} \;,NA,F
|
171 |
+
Search for 'hello' case insensitively in all files under /workspace directory tree and show the matched lines with their filenames,"find /workspace -type f -print0 | xargs -0 grep -iH ""hello""",T,F,T,T,T,NA,NA,NA,grep -ri 'hello' /workspace,NA,F
|
172 |
+
"Split the output of ""/workspace/archive.tar.gz"" into files of at most 10 MiB in size and use prefix ""output_prefix""",tar -xf /workspace/archive.tar.gz | split -b 10M -d - /output_prefix,F,F,T,F,F,NA,NA,NA,NA,Unzipping tar file overwrites workspace directory. Removing.,T
|
173 |
+
Unpack all *.gz archives in the /workspace directory tree,find /workspace -name '*.gz' -print0 | xargs -0 gunzip,T,F,T,T,T,NA,NA,NA,find /workspace -type f -name '*.gz' -exec gunzip {} +,NA,F
|
174 |
+
"Uncompress ""/workspace/archive.tar.gz"" and extract the archive to ""/backup""",gzip -dc /workspace/archive.tar.gz | tar -xf - -C /backup,T,F,T,T,T,NA,NA,NA,tar -xzvf /workspace/archive.tar.gz -C /backup,NA,F
|
175 |
+
"Create a symbolic link to ""/workspace/dir1/terminate.txt"" named ""/workspace/test""",ln /workspace/dir1/terminate.txt /workspace/test,T,F,T,T,T,NA,NA,NA,ln -s /workspace/dir1/terminate.txt /workspace/test,NA,F
|
176 |
+
"Retrieve only build number of current kernel, ie. #104",uname -v | grep -o '#[0-9]\+',T,F,T,T,T,NA,NA,NA,uname -r | awk -F'-' '{print $2}',NA,F
|
177 |
+
Print reverse lookup for adress 127.0.0.1,dig -x 127.0.0.1,T,F,T,T,T,NA,NA,NA,nslookup 127.0.0.1,NA,F
|
178 |
+
"List file information of the full path of command ""c++""",ls -ald `which c++`,F,F,F,F,F,"List file information of the full path of command ""grep""",NA,ls -ald `which grep`,stat $(which grep),"Environment does not contain c++ command, changed to grep.",F
|
179 |
+
"Extract host name part from ""http://www.google.com""","echo ""http://www.google.com"" | cut -d'/' -f3",T,F,T,T,T,NA,NA,NA,"echo ""http://www.google.com"" | sed -E 's|https?://([^/]+).*|\1|'",NA,F
|
180 |
+
"List environment variables and their values, escaping all semicolons with a backslash.",env | sed 's/;/\\;/g',T,F,T,T,T,NA,NA,NA,"while IFS= read -r line; do echo ""${line//;/\\;}""; done < <(env)",HOSTNAME will differ between containers.,F
|
181 |
+
Displays a tree of all process alongside their command line arguments.,pstree -a,T,F,T,T,T,NA,NA,NA,"ps -eo pid,ppid,cmd --forest",NA,F
|
182 |
+
"Create intermediate directories ""dir"" and ""subdir"" as required and create ""subsubdir""",mkdir -p dir/subdir/subsubdir,T,F,T,T,T,NA,NA,NA,mkdir -p dir/subdir/subsubdir,NA,F
|
183 |
+
"Change to the directory of the executable ""python""",cd `dirname $(which python)`,F,F,T,F,T,NA,NA,NA,NA,cd commands not supported by environment.,T
|
184 |
+
"Print numbers 1 through 10 separated by "":""",yes | head -n10 | grep -n . | cut -d: -f1 | paste -sd:,T,F,T,T,T,NA,NA,NA,"echo $(seq -s "":"" 1 10)",NA,F
|
185 |
+
print all readline bindings,bind -P,T,F,T,T,T,NA,NA,NA,bind -P,NA,F
|
186 |
+
"list names of bind functions containing ""p""",bind -l | grep p,T,F,T,T,T,NA,NA,NA,bind -l | egrep 'p',NA,F
|
187 |
+
List all files on smbfs mounts,mount -v | grep smbfs | awk '{print $3}' | xargs ls -ls,F,F,T,F,T,NA,NA,NA,NA,Mounts do not exist in the environment.,T
|
188 |
+
Save first IP address of domain 'google.com' in 'address' variable and display it,address=$(dig +short google.com | grep -E '^[0-9.]+$' | head -n 1) && echo $address,T,F,T,T,T,NA,NA,NA,address=$(dig +short google.com | grep -m 1 '^[0-9]' | head -n 1) && echo $address,NA,F
|
189 |
+
"Remove all characters except "";"" and digits from the string "" Hello world;876 """,echo ' Hello world;876 ' | tr -cd ';0-9',T,F,T,T,T,NA,NA,NA,"echo "" Hello world;876 "" | sed 's/[^0-9;]//g'",NA,F
|
190 |
+
"Remove leading and trailing spaces or tabs from "" Hello world! """,echo ' Hello world! ' | sed -e 's/^[ \t]*//' | sed -e 's/[ \t]*$//',T,F,T,T,T,NA,NA,NA,"echo -n "" Hello world! "" | sed 's/^[ \t]*//;s/[ \t]*$//'",NA,F
|
191 |
+
"Remove the last 3 characters from ""987654321""",echo 987654321 | rev | cut -c 4- | rev,T,F,T,T,T,NA,NA,NA,"echo ""987654321"" | sed 's/...$//'",NA,F
|
192 |
+
Print source of the file system containing current working directory.,df . | tail -1 | awk '{print $1}',T,F,T,T,T,NA,NA,NA,df -P . | awk 'NR==2 {print $1}',NA,F
|
193 |
+
"List all variables (names only) with names containing ""H"".",env | awk -F= '{if($1 ~ /H/) print $1}',T,F,T,T,T,NA,NA,NA,env | grep '^[^=]*H[^=]*=' | awk -F= '{print $1}',NA,F
|
194 |
+
Print a list of unique users who are logged in,who | cut -d' ' -f1 | sort | uniq,T,F,T,T,T,NA,NA,NA,who | awk '{print $1}' | sort | uniq,NA,F
|
195 |
+
"Ping hostname, grep for 192.168.11 and print the IP from the output",ping -c 1 hostname | grep 192.168.11 | grep 'bytes from' | awk '{print $4}' | sed 's/://g',F,F,F,T,F,ping 192.168.1.1,NA,ping -w 1 192.168.1.1,ping -w 1 192.168.1.1,Simplified over complicated command with incorrect ip address.,F
|
196 |
+
Print a line of 99 '=' characters,seq -s= 100|tr -d '[:digit:]',T,F,T,T,T,NA,NA,NA,printf '=%.0s' {1..99},NA,F
|
197 |
+
Counts all business days in a current month.,cal -h | cut -c 4-17 | tail -n +3 | wc -w,F,F,T,T,F,NA,NA,NA,NA,Invalid use of cal command.,T
|
198 |
+
Count number of users logged in,who | awk -F' ' '{print $1}' | sort -u | wc -l,T,F,T,T,T,NA,NA,NA,who | wc -l,"Docker environemnt will show zero users, but this is still a valid task.",F
|
199 |
+
"Displays calendar of a previous, current and next month for December of 2120 year.",cal -3 12 2120,T,F,T,T,T,NA,NA,NA,cal -3 12 2120,NA,F
|
200 |
+
"Extract, sort and print only group names from /etc/group.",cut -d: -f1 /etc/group | sort,T,F,T,T,T,NA,NA,NA,cut -d: -f1 /etc/group | sort | uniq,NA,F
|
201 |
+
Store system load average number in the 'proc_load_average' variable and print it.,"proc_load_average=$(w | head -n 1 | awk '{print $NF}' | tr ',' '.') && echo $proc_load_average",F,F,T,F,T,NA,NA,NA,proc_load_average=$(cut -d -f 1 /proc/loadavg) && echo $proc_load_average,This will differ between containers.,T
|
202 |
+
Calculate the sum of all the numbers from 1 to 10,seq 10 | jq -s 'add',T,F,T,T,T,NA,NA,NA,echo $(( (10 * (10 + 1)) / 2 )),NA,F
|
203 |
+
Count the number of files and directories in the entire testbed directory,find /testbed | wc -l,T,F,T,T,T,NA,NA,NA,find /testbed -print | wc -l,NA,F
|
204 |
+
Find all text files in the testbed directory and subdirectories and concatenate them into a single file,find /testbed -type f -name '*.txt' -exec cat {} ; > /testbed/concatenated_text_files.txt,F,F,T,T,F,NA,NA,NA,NA,Command times out.,T
|
205 |
+
Find all directories in the testbed directory that have at least one Python script and list the number of Python scripts in each directory,"find /testbed -type d -exec sh -c 'echo -n ""{}: ""; ls -1 {}/*.py 2>/dev/null | wc -l' \;",F,F,F,T,F,Print the number of python files in the testbed directory.,NA,"find testbed -type f -name ""*.py"" | wc -l","find testbed -type f -name ""*.py"" -print | wc -l",Simplified overly complex prompt.,F
|
206 |
+
Sort the lines of textfile1.txt in reverse alphabetical order and save the result to a new file,sort -r /testbed/dir1/textfile1.txt > /testbed/dir1/textfile1_reverse_sorted.txt,T,F,T,T,T,NA,NA,NA,sort -r /testbed/dir1/textfile1.txt > /testbed/dir1/textfile1_reverse_sorted.txt,NA,F
|
207 |
+
Search for all files containing the word 'error' and sort them by size,find testbed/ -type f -exec grep -l 'error' {} + | xargs du -b | sort -n,F,F,F,T,F,Search for all files containing the word 'Shell' in testbed.,NA,find /testbed -type f -exec grep -l 'Shell' {} +,grep -r 'Shell' /testbed,Gold command incorrectly lists system files. Simplified prompt and commands.,F
|
208 |
+
Find all symbolic links in testbed/ that point to files which were modified in the last 7 days,find testbed/ -type l -lname '*testbed/*' -mtime -7 -ls,F,F,F,T,F,Find all symbolic links in the testbed directory.,NA,find /testbed -type l,find /testbed -type l -print,Simplified prompt based on environment's find command limitations.,F
|
209 |
+
Get the total size of all files in testbed/ and save it to a file,find testbed/ -type f -printf '%s\n' | awk '{s+=$1} END {print s}' > total_size.txt,F,F,F,T,F,Get the total size of all files in testbed/ and save it to total_size.txt,NA,du -sh testbed/ | awk '{print $1}' > total_size.txt,du -s testbed/ | awk '{print $1}' > total_size.txt,Corrected ambiguous prompt and invalid find command.,F
|
210 |
+
Find all PNG files in testbed/ and convert them to JPEG with a quality of 90%,find testbed/ -name '*.png' -exec convert -quality 90 {} {}.jpg \;,F,F,T,F,T,NA,NA,NA,NA,The environment does not contain any image files.,T
|
211 |
+
List all files in the directory /testbed/dir1 and sort them by size in human-readable format,ls -lhS /testbed/dir1,T,F,T,T,T,NA,NA,NA,ls -lhS /testbed/dir1,NA,F
|
212 |
+
Count the number of lines in all text files under the directory /testbed/dir2,grep -rl . /testbed/dir2 | xargs wc -l,F,F,F,T,T,Count the number of lines in files under the directory /testbed/dir2.,NA,NA,find /testbed/dir2 -type f -exec wc -l {} +,"Gold command did not only count .txt files, updated prompt to match.",F
|
213 |
+
Print the name and size of the 3 largest files in the directory /testbed/dir3,du -a /testbed/dir3 | sort -rn | head -n 3,F,F,T,T,F,NA,NA,find /testbed/dir3 -type f -exec ls -lhS {} + | sort -rh -k5 | head -n 3,find /testbed/dir3 -type f -exec ls -lhS {} + 2>/dev/null | sort -rh -k5 | head -n 3,Gold command listed directories not files.,F
|
214 |
+
Find all empty directories in the directory /testbed and delete them,find /testbed -type d -empty -delete,F,F,T,F,T,NA,NA,NA,NA,Environment does not contain empty directories.,T
|
215 |
+
Rename all files with extension .txt under the directory /testbed to have a .md extension instead,find /testbed -type f -name '*.txt' -exec rename .txt .md {} +,F,F,T,F,T,NA,NA,NA,NA,Environment does not contain the rename utility.,T
|
216 |
+
Find all files modified in the last 2 hours and compress them into a tarball named archive.tar.gz in the directory /testbed,find /testbed -type f -mmin -120 -print0 | xargs -0 tar -czf /testbed/archive.tar.gz,T,F,T,T,T,NA,NA,NA,find /testbed -type f -mmin -120 -print0 | xargs -0 tar -czf /testbed/archive.tar.gz,Results in empty archive.,F
|
217 |
+
List all subdirectories of /testbed that are not named subdir1,ls -d /testbed/*/ | grep -v /subdir1/,T,F,T,T,T,NA,NA,NA,"find /testbed -mindepth 1 -maxdepth 1 -type d ! -name ""subdir1""",NA,F
|
218 |
+
Search for all files that contain the string 'text file' in their name or content under the directory /testbed,grep -r 'text file' /testbed,F,F,F,T,T,Search for all files that contain the string 'text file' under the directory /testbed,NA,NA,grep -rl 'text file' /testbed,"Command only searched file contents, not names. Updated prompt to match.",F
|
219 |
+
Compute the MD5 hash of all files under the directory /testbed and store them in a file named hashes.txt in the same directory,find /testbed -type f -exec md5sum {} + > /testbed/hashes.txt,T,F,T,T,T,NA,NA,NA,find /testbed -type f -exec md5sum {} + > /testbed/hashes.txt,NA,F
|
220 |
+
Print the last 10 lines of the file /testbed/dir3/subdir1/subsubdir1/textfile3.txt,tail -n 10 /testbed/dir3/subdir1/subsubdir1/textfile3.txt,T,F,T,T,T,NA,NA,NA,tail -n 10 /testbed/dir3/subdir1/subsubdir1/textfile3.txt,NA,F
|
221 |
+
Find all symbolic links under the directory /testbed and print their target path,"find /testbed -type l -printf '%p -> %l
|
222 |
+
'",F,F,T,F,T,NA,NA,NA,NA,There are no links in the testbed environment.,T
|
223 |
+
Print the line number and contents of all lines containing the string 'value3' in the file /testbed/dir1/subdir1/jsonfile1.json,grep -n 'value3' /testbed/dir1/subdir1/jsonfile1.json,T,F,T,T,T,NA,NA,NA,grep -n 'value3' /testbed/dir1/subdir1/jsonfile1.json,NA,F
|
224 |
+
Find all files in the directory /testbed that have been modified in the last 24 hours and print their path,find /testbed -type f -mtime -1 -print,T,F,T,T,T,NA,NA,NA,find /testbed -type f -mtime -1,NA,F
|
225 |
+
Display the contents of jsonfile1.json in a prettified JSON format using a third-party tool 'jq',cat /testbed/dir1/subdir1/jsonfile1.json | jq .,F,F,T,F,T,NA,NA,NA,NA,jq utility is not installed on the system.,T
|
226 |
+
Search for all the files in /testbed directory and its subdirectories that contain the word 'Hello' and replace it with 'Hi' in-place.,"grep -rl ""Hello"" /testbed | xargs sed -i 's/Hello/Hi/g'",T,F,T,T,T,NA,NA,NA,grep -rl 'Hello' /testbed | xargs sed -i 's/Hello/Hi/g',NA,F
|
227 |
+
"Display the contents of textfile3.txt and textfile4.txt side by side, with line numbers and a separator between them.","paste -d "" "" - -s < /testbed/dir3/subdir1/subsubdir1/textfile3.txt < /testbed/dir1/subdir1/textfile4.txt",T,F,T,T,F,NA,NA,paste <(nl /testbed/dir3/subdir1/subsubdir1/textfile3.txt) <(nl /testbed/dir1/subdir1/textfile4.txt),paste <(nl /testbed/dir3/subdir1/subsubdir1/textfile3.txt) <(nl /testbed/dir1/subdir1/textfile4.txt),Malformed gold command.,F
|
final.csv
ADDED
@@ -0,0 +1,194 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Prompt,Ground Truth Command,Functionally Equivalent Command
|
2 |
+
"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,"find /testbed -type f -name ""*.java"" -exec md5sum {} + | sort | uniq -w32 -d -c | sort -nr"
|
3 |
+
Calculate the md5 sum of the md5 sum of all the files under /testbed/dir2/subdir2 sorted by filename,find /testbed/dir2/subdir2 -type f -print0 | sort -z | xargs -0 md5sum | awk '{print $1}' | md5sum,ls -1 /testbed/dir2/subdir2/* | sort | xargs md5sum | awk '{print $1}' | md5sum
|
4 |
+
"Calculate the md5 sum of the contents of the sorted list of files ""$FILES""",cat $(echo $FILES | tr ' ' '\n' | sort) | md5sum,"echo ""$FILES"" | tr ' ' '\n' | sort | xargs cat | md5sum"
|
5 |
+
"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,find /testbed/dir1/subdir1 -type f -name '*.py' -print0 | xargs -0 md5sum | awk '{print $1}' | sort | md5sum
|
6 |
+
"Calculate the total disk usage for each "".txt"" file on the /testbed directory and prepend the system host name to the output","find /testbed -name ""*.txt"" -exec du {} + | awk -v hostname=""$(hostname)"" '{print hostname, $0}'","find /testbed -name ""*.txt"" -exec du -h {} + | awk -v hostname=""$(hostname)"" '{print hostname, $0}'"
|
7 |
+
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","find /testbed -type f -name ""*.php"" -exec chmod 755 {} \; -print | wc -l"
|
8 |
+
"Check if the current shell is running within a 'screen' process and print ""True"" or ""False""","pstree -s $$ | grep -q ""screen"" && echo ""True"" || echo ""False""","ps -o comm= $(pstree -sp $$ | awk -F '[^0-9]*' '{print $2}') | grep -q 'screen' && echo ""True"" || echo ""False"""
|
9 |
+
"Print ""True"" if the contents of file /testbed/dir3/subdir1/subsubdir1/textfile3.txt is a subset of file /testbed/dir2/subdir1/textfile2.txt, otherwise print ""False""","comm -23 <(sort /testbed/dir3/subdir1/subsubdir1/textfile3.txt | uniq) <(sort /testbed/dir2/subdir1/textfile2.txt | uniq) | head -1 | grep -q '.' && echo ""False"" || echo ""True""","comm -23 <(sort /testbed/dir3/subdir1/subsubdir1/textfile3.txt | uniq) <(sort /testbed/dir2/subdir1/textfile2.txt | uniq) | grep -q '.' && echo ""False"" || echo ""True"""
|
10 |
+
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) }',"find /testbed -type f -name ""*.txt"" -exec wc -w {} + | awk '{total = $1} END {print total/(NR-1)}'"
|
11 |
+
Compute the mean average of the word count of *.txt files smaller than 6 words in the /testbed directory,find /testbed -name '*.txt' -print0 | xargs -0 wc -w | awk '$1 < 6 {v += $1; c++} END {print v/c}',"find /testbed -name '*.txt' -print0 | xargs -0 wc -w | awk '$1 < 6 {v += $1; c++} END {print v/c, ""words""}'"
|
12 |
+
"Copy all files with ""FooBar"" in the path under the '/testbed' directory to the '/testbed/dir3/subdir1/subsubdir1/tmp' directory.",find /testbed -path '*FooBar*' -print0 | xargs -0 -I{} cp -r {} /testbed/dir3/subdir1/subsubdir1/tmp,find /testbed -path '*FooBar*' -print0 | xargs -0 -I{} cp -R {} /testbed/dir3/subdir1/subsubdir1/tmp
|
13 |
+
"search for all .txt files in the /testbed directory, prints their paths, and then search within each file for the word ""another""","find /testbed -name ""*.txt"" \( -exec echo {} \; -o -exec true \; \) -exec grep another {} \;","find /testbed -type f -name ""*.txt"" -print -exec grep -H ""another"" {} \;"
|
14 |
+
"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 ' ',head -c 16 /testbed/textfile7.txt | od -An -tx1 | tr -d ' \n'
|
15 |
+
"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 -type f -path '*FooBar*' | xargs -i cp -p ""{}"" .","find /testbed -type f -path '*FooBar*' -exec cp --preserve=mode,ownership,timestamps {} ./ \;"
|
16 |
+
"Copy all files and folders 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,"find /testbed -name ""*FooBar*"" -exec cp -r {} /testbed/dir3/subdir1/subsubdir1/tmp \;"
|
17 |
+
Count all the lines of all '*.c' files in /testbed directory recursively,"find /testbed -name ""*.c"" -print0 | xargs -0 cat | wc -l","find /testbed -name ""*.c"" -exec wc -l {} + | awk '{s+=$1} END {print s}'"
|
18 |
+
Count all the lines of all files with names ending with 'php' in current directory and subdirectories recursively,find . -type f -name '*php' | xargs cat | wc -l,find . -type f -name '*.php' -exec wc -l {} + | awk '{s=$1} END {print s}'
|
19 |
+
Count all the lines of all php files in the /testbed directory recursively,find /testbed/ -name '*.php' | xargs cat | wc -l,find /testbed/ -type f -name '*.php' | xargs cat | wc -l
|
20 |
+
Calculate the md5sum of all '*.py' files in /testbed folder and sub folders.,"find /testbed -type f -name ""*.py"" -exec md5sum {} +","find /testbed -type f -name ""*.py"" -print0 | xargs -0 md5sum"
|
21 |
+
"Count the *.html files residing in the /testbed directory tree and containing string ""foo""","find /testbed -name ""*.html"" | xargs grep -l foo | wc -l","find /testbed -name ""*.html"" -exec grep -l foo {} + | wc -l"
|
22 |
+
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",find /testbed -type f -name '*.php' -exec chmod 755 {} \; -print | wc -l
|
23 |
+
Count the number of lines in all files in the /testbed directory tree that match pattern '*file*',find /testbed/ -name '*file*' | sort | xargs wc -l,find /testbed -type f -name '*file*' -exec wc -l {} +
|
24 |
+
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,"find ""${DIRECTORY}"" -type f -print | awk -F/ '{print $NF}' | grep -i '[aeiouy]' | wc -l"
|
25 |
+
Count the number of files for each unique file extensions in the /testbed directory tree.,find /testbed -type f | sed -e 's/.*\.//' | sed -e 's/.*\///' | sort | uniq -c | sort -rn,find /testbed -type f | awk -F. '{if (NF>1) print $NF}' | sort | uniq -c | sort -nr
|
26 |
+
"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,"find /testbed -type f -name ""*.gz"" -exec sh -c 'gunzip -c ""$0"" | wc -l' {} \; | awk '{s+=$1} END {print s}'"
|
27 |
+
Counts all files in the /testbed folder and subfolders.,find /testbed -type f -exec ls -l {} \; | wc -l,find /testbed -type f | wc -l
|
28 |
+
Count lines in each *.php file sorted by file in /testbed directory.,find /testbed -name '*.php' -type f | sort | xargs wc -l,"find /testbed -type f -name ""*.php"" -exec wc -l {} + | sort"
|
29 |
+
"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,"find /testbed -type f -name ""*.php"" -exec wc -l {} + | sort -rn"
|
30 |
+
"Counts number of occurences of all ip addresses in '/etc/networks' file, and prints all addresses with number of occurences in a descending order.","grep -oE '([0-9]{1,3}\.){3}[0-9]{1,3}' /etc/networks | sort | uniq -c | sort -nr","awk '{for (i=1; i<=NF; i++) if ($i ~ /([0-9]{1,3}\.){3}[0-9]{1,3}/) print $i}' /etc/networks | sort | uniq -c | sort -nr"
|
31 |
+
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}',find /testbed -type f -name '*.php' -exec grep -H '.*[[:alnum:]].*' {} + | wc -l
|
32 |
+
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}',find /testbed -type f \( -name '*.php' -o -name '*.js' \) -exec wc -l {} + | awk '{s=$1} END {print s}'
|
33 |
+
"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","find testbed -type d -name ""dir1"" -exec touch {}/abc.txt \;"
|
34 |
+
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,find /var/log -type f -mtime +1 -exec tar -czvPf /testbed/logs.tar.gz {} +
|
35 |
+
"Delete 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,find /testbed/dir3/subdir1/subsubdir1/tmp -type f -mtime +2 -delete
|
36 |
+
Display the 5 largest files in the /testbed directory and its sub-directories.,find /testbed -type f -exec du -b {} + | sort -rh | head -n 5,find /testbed -type f -print0 | xargs -0 du -b | sort -rn | head -n 5
|
37 |
+
Display the 5 smallest files in the /testbed directory and its sub-directories ignoring any empty files.,find /testbed -type f -size +0c -exec du -b {} + | sort -n | head -n 5,find /testbed -type f -size +0c -exec du -b {} + | sort -rh | tail -n 5
|
38 |
+
Display the 5 smallest files in the /testbed directory and its sub-directories.,find /testbed -type f -exec ls -s {} \; | sort -n | head -5,find /testbed -type f -exec du -b {} + | sort -n | head -n 5
|
39 |
+
Display the five biggest file sizes only in the /testbed directory,find /testbed -type f -maxdepth 1 -exec du -b {} + | sort -rh | head -n 5,ls -lS /testbed | grep '^-' | head -n 5
|
40 |
+
"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 {}","find testbed -type f -name ""*.java"" -exec grep -l 'Hello' {} +"
|
41 |
+
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,find /testbed -type f | awk -F/ '{print tolower($NF)}' | sort | uniq -d
|
42 |
+
"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/#',comm -23 <(find testbed/dir1 -type f | sed 's|testbed/dir1/||' | sort) <(find testbed/dir2 -type f | sed 's|testbed/dir2/||' | sort) | sed 's|^|testbed/dir1/|'
|
43 |
+
Recursively finds all files containing text 'Hello' in /testbed and prints folder where they are placed.,grep -rl 'Hello' /testbed | xargs -I {} dirname {} | sort | uniq,find /testbed -type f -exec grep -l 'Hello' {} + | xargs -I {} dirname {} | sort | uniq
|
44 |
+
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 }',"find /testbed -name ""*.java"" -exec wc -l {} + | awk '{s=$1} END {print s}'"
|
45 |
+
Create a symbolc link in the /testbed/dir3/subdir1/subsubdir1/FooBar to root folder,ln /testbed/dir3/subdir1/subsubdir1/FooBar -s /,ln -s /testbed/dir3/subdir1/subsubdir1/FooBar /
|
46 |
+
search for all the files in the folder /testbed/dir1 which have sticky bit set and have the permissions 553,find /testbed/dir1 -perm 1553,find /testbed/dir1 -type f -perm 1553
|
47 |
+
"search for php files in /testbed directory and search for ""world"" in all these files","find /testbed -name '*.php' -exec grep -iq ""world"" {} \; -print","find /testbed -name ""*.php"" -exec grep -H ""world"" {} \;"
|
48 |
+
"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",find /system/folder1 -type f -exec grep -inH 'hello' {} \;
|
49 |
+
"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""",grep -ronw '/system' -e 'foo'
|
50 |
+
Recursively list contents of the '/system' directory in a tree-like format,tree /system,find /system -print | sed -e 's;[^/]*/;|___;g;s;___|; |;g'
|
51 |
+
Recursively print all files and directories in the '/system/folder2' directory tree including hidden files,tree -a /system/folder2,find /system/folder2 -print | sed -e 's;[^/]*/;|___;g;s;___|; |;g'
|
52 |
+
"Recursively prints all folders in the '/system' folder that contain files like ""*.out"".","find /system -type f -name ""*.out"" -print0 | xargs -0 -n1 dirname | sort -u","find /system -type f -name ""*.out"" -printf '%h\n' | sort -u"
|
53 |
+
"Remove all ""*.txt"" files in the '/system' folder and answer ""y"" to any prompt",yes y | rm -r /system/*.txt,"find /system -maxdepth 1 -type f -name ""*.txt"" -exec rm -f {} \;"
|
54 |
+
Recursively removes all empty folders from the /system/folder3/temp folder.,find /system/folder3/temp -depth -type d -exec rmdir {} \;,find /system/folder3/temp -type d -empty -delete
|
55 |
+
"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 {} +,find /system/folder3/temp -type d -empty -print -delete 2>/dev/null
|
56 |
+
Recursively removes all files in the /system/folder1 folder but '*txt' files.,find /system/folder1 -type f -not -name '*txt' | xargs rm,find /system/folder1 -type f ! -name '*.txt' -print -delete
|
57 |
+
Recursively rename all files under /system/folder2 replacing special with regular.,"find /system/folder2 -type f -name '*special*' ! -path '*/special/*' -execdir bash -c 'mv ""$0"" ""${0/special/regular}""' {} \;","find /system/folder1 -type f -name '*special*' -exec bash -c 'for f; do mv -- ""$f"" ""${f%/*}/${f##*/special/regular}""; done' _ {} +"
|
58 |
+
"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)","grep -r ""foo"" /system | awk '{print} END {print NR}'"
|
59 |
+
"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 {} \;,find /system/folder3/ -type f | xargs -n 1 basename
|
60 |
+
"Recursively unzip files to stdout in ""/system/folder2.tar.gz"" and search for ""special""","zcat -r /system/folder2.tar.gz | grep ""special""","tar -xzvf /system/folder2.tar.gz -O | grep ""special"""
|
61 |
+
"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,cat system/folder3/temp/temp1/text1.txt | sed 's/\r$//' | od -c -An
|
62 |
+
Remove all *.doc files from the /system/folder1 tree,"find /system/folder1 -name '*.doc' -exec rm ""{}"" \;",find /system/folder1 -type f -name '*.doc' -delete
|
63 |
+
Remove all *.log files from the /system/folder1 tree,find /system/folder1 -name '*.log' -print0 | xargs -0 rm,find /system/folder1 -type f -name '*.log' -delete
|
64 |
+
Remove all *.txt files in '/system' directory but not in it's subdirectories,find /system -name '*.txt' -maxdepth 1 | xargs rm,find /system -name '*.txt' -maxdepth 1 -delete
|
65 |
+
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 {} \;,find /system/folder3/backup_dbg -name '*.sql' -print -mtime +25 -delete
|
66 |
+
Remove all *.txt files under the /system/folder1 directory modified more than 5 minutes ago,"find /system/folder1 -mmin +5 -type f -name ""*.txt"" -delete","find /system/folder1 -mmin +5 -type f -name ""*.txt"" | xargs rm -f"
|
67 |
+
"Remove all *.txt files, except ""keep.txt"", under /system/folder1 directory modified more than 5 minutes ago. Do not include subdirectories.","find /system/folder1 -maxdepth 1 -mmin +5 -type f -name ""*.txt"" ! -name ""keep.txt"" -delete","find /system/folder1 -maxdepth 1 -mmin +5 -type f -name ""*.txt"" ! -name ""keep.txt"" | xargs rm -f"
|
68 |
+
"Remove all .sh files in the '/system/folder1' tree whose names begin with ""new""",find /system/folder1 -name 'new*.sh' -exec rm -f '{}' \;,find /system/folder1 -name 'new*.sh' -delete
|
69 |
+
"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 {} \;,"find /system -type f \( -name ""a.out"" -o -name ""*.o"" -o -name ""core"" \) -delete"
|
70 |
+
Print the last five lines of /system/folder1/data.csv,"cat /system/folder1/data.csv | rev | cut -d, -f-5 | rev","tail -n 1 /system/folder1/data.csv | rev | cut -d',' -f1-5 | rev"
|
71 |
+
"Remove all directories called ""temp"" from the /system directory tree","find /system -name ""temp"" -type d -delete","find /system -type d -name ""temp"" -exec rm -rf {} +"
|
72 |
+
Remove all empty files in /system/folder3/temp and below,find /system/folder3/temp -type f -empty -print | xargs rm -f,find /system/folder3/temp -type f -empty -print -delete
|
73 |
+
Remove all files a.out and *.o in the /system directory tree that were modified less than 7 days ago,find /system \( -name a.out -o -name '*.o' \) -mtime -7 -exec rm {} \;,"find /system -type f \( -name ""a.out"" -o -name ""*.o"" \) -mtime -7 -delete"
|
74 |
+
"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 {} \;,find /system/folder3/temp \( -name '.DS_Store' -or -name '._.DS_Store' -or -name '._*' -or -name '.TemporaryItems' -or -name '.apdisk' \) -delete
|
75 |
+
"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,echo '1/2 [3] (27/03/2012 19:32:54) word word word word 4/5' | sed 's/([^)]*)//g' | tr -c '0-9' ' ' | column -t
|
76 |
+
"Remove files text2, text3, text4 in directory /system/folder1",find /system/folder1 -name 'text[2-4]*' -exec rm {} \;,find /system/folder1 -name 'text[2-4]*' -delete
|
77 |
+
Remove files that are less than 1KB in size under /system directory,find /system -type f -size -1k -exec rm {} +,find /system -type f -size -1k -delete
|
78 |
+
"Remove files modified more than 31 days ago recursively from ""/system""",find /system -type f -mtime +31 -exec rm -f {} \;,find /system -type f -mtime +31 -delete
|
79 |
+
"Print ""/system/folder3/temp/temp1/text1.txt"" without newline characters.","paste -sd """" /system/folder3/temp/temp1/text1.txt",tr -d '\n' < /system/folder3/temp/temp1/text1.txt
|
80 |
+
Remove regular files in the /system directory tree,find /system -type f -exec rm {} +,find /system -type f -delete
|
81 |
+
Print which files differ between /system/folder1 and /system/folder2.,diff -qr /system/folder1 /system/folder2 | sort,diff -qr /system/folder1 /system/folder2
|
82 |
+
Print amount of space available on the file system containing path to the /system directory in megabytes.,df -m /system,df -m /system | grep / | tr -s ' ' | cut -d ' ' -f 4
|
83 |
+
Display the number of sub-directories under /system,find /system -type d | wc -l,tree -d /system | tail -n 1
|
84 |
+
"Archive all files in /system/folder1 directory modified in the last 60 days to ""/mytarfile.tgz"" with a time of 2023-01-01, owner of 0, and group of 0.",tar --mtime='2023-01-01' --owner=0 --group=0 -czf mytarfile.tgz `find /system/folder1 -mtime -60`,tar --mtime='2023-01-01' --owner=0 --group=0 -czvf mytarfile.tgz `find /system/folder1 -mtime -60`
|
85 |
+
Create a symbolc link in the /system/folder1 to root folder,ln /system/folder1 -s /,ln -s /system/folder1 /
|
86 |
+
"Write the current date and time followed by "" 1"" to the console and append to ""/system/folder3/temp/empty.txt""","echo $(date) ""1"" | tee -a /system/folder3/temp/empty.txt","echo $(date +""%Y-%m-%d~%H:%M:%S"") ""1"" | tee -a /system/folder3/temp/empty.txt"
|
87 |
+
"Concatenate all .txt files residing in the /system tree into a single file ""/system/folder3/temp/concat.txt""","find /system -name ""*.txt"" -not -name ""concat.txt"" -print -exec cat {} \; > /system/folder3/temp/concat.txt","find /system -type f -name ""*.txt"" -not -name ""concat.txt"" -print -exec cat {} \; > /system/folder3/temp/concat.txt"
|
88 |
+
Compresses all the files in the /system folder with default depth to /backup using cpio.,find /system -depth -print | cpio -dump /backup,find /system -print | cpio -dump /backup
|
89 |
+
Copy all files in the /system directory except those containing 'text' to '/system/folder3/backup_dbg/backup'. Do not include subdirectories.,find /system -maxdepth 1 -type f ! -name '*text*' -exec cp {} /system/folder3/backup_dbg/backup \;,find /system -maxdepth 1 -print -type f ! -name '*text*' -exec cp {} /system/folder3/backup_dbg/backup \;
|
90 |
+
"Rename ""/system/folder3/temp/temp1"" to ""/system/folder3/temp/temp1_old""",mv /system/folder3/temp/temp1 /system/folder3/temp/temp1_old,cp -r /system/folder3/temp/temp1 /system/folder3/temp/temp1_old && rm -r /system/folder3/temp/temp1
|
91 |
+
"Dump ""/system/text1.txt"" as ASCII characters",od -t c /system/text1.txt,hexdump -C /system/text1.txt
|
92 |
+
"Create a compressed archive of /system/folder1 ""compress_folder1.tar.gz"" with a time of 2023-01-01, owner of 0, and group of 0.",tar --mtime='2023-01-01' --owner=0 --group=0 -zcf compress_folder1.tar.gz /system/folder1,tar --mtime='2023-01-01' --owner=0 --group=0 -zcvf compress_folder1.tar.gz /system/folder1
|
93 |
+
"download content from ""http://example.com/textfile.txt"" and output to 'textfile.txt' in /system",curl http://example.com/textfile.txt -o /system/textfile.txt,curl -vo /system/textfile.txt http://example.com/textfile.txt
|
94 |
+
Search in /system downwards all files whose size is greater than 10 bytes.,find /system -size +10c -print,find /system -type f -size +10c
|
95 |
+
"Calculate the md5sum of each "".txt"" file under ""/system"" and sort the output.",find /system -type f -name '*.txt' -exec md5sum {} + | awk '{print $1}' | sort,"find /system -type f -name ""*.txt"" -exec md5sum {} + | sort"
|
96 |
+
"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}',"grep ""$(hostname)"" /etc/hosts | awk '{print $1}'"
|
97 |
+
Find files in /workspace directory modified within 30 days.,find /workspace -daystart -type f -mtime -30,find /workspace -type f -mtime -30
|
98 |
+
find files in the /workspace directory with pattern` *.c that larger than 1 Kilobytes,find /workspace -name '*.c' -size +1k -print,find /workspace -name '*.c' -size +1k
|
99 |
+
"Find files in the /workspace directory and sub-directories, that changed over an hour ago.",find /workspace -type f -cmin +60,find /workspace -type f -cmin +60 -print
|
100 |
+
"Find files in the /workspace directory and sub-directories, that were accessed over an hour ago.",find /workspace -type f -amin +60,find /workspace -type f -amin +60 -print
|
101 |
+
list all the drectories present in the /workspace directory and do not search in the sub directories.,find /workspace -maxdepth 1 -type d,find /workspace -maxdepth 1 -type d
|
102 |
+
list all the files in the /workspace directory which are of size 0 bytes.,find /workspace -empty,find /workspace -empty -print
|
103 |
+
list all zero-length files under the /workspace directory,find /workspace -empty -exec ls {} \;,find /workspace -type f -size 0
|
104 |
+
locate and remove large files (> 1 KB) in /workspace,find /workspace -type f -size +1k -delete,find /workspace -type f -size +1k -exec rm {} \;
|
105 |
+
List all the files in the /workspace directory which have only read permission to the group.,find /workspace -perm 400 -type f -exec ls -l {} \;,find /workspace -perm 400 -ls
|
106 |
+
List all the files in the /workspace directory which have permissions 777.,find /workspace -perm 777 -type f -exec ls -l {} \;,find /workspace -perm 777 -ls
|
107 |
+
List the details of all the text files in /workspace directory.,"find /workspace -name ""*.txt"" -exec ls -ld {} \;","find /workspace -name ""*.txt"" | xargs ls -ld"
|
108 |
+
move all files in the /workspace folder to / and do not move the files in the sub folder,find /workspace -maxdepth 1 -type f -exec mv -t / {} +,find /workspace -maxdepth 1 -type f -exec mv {} / \;
|
109 |
+
Move files in /workspace accessed less than one day ago to directory /.,find /workspace -atime -1 -type f -exec mv {} / \;,find /workspace -type f -atime -1 -print0 | xargs -0 -I {} mv {} /
|
110 |
+
"print all filenames of files under /workspace/dir1 dir containing 'hello', case-insensitive",find /workspace/dir1 -type f -exec grep -il 'hello' {} \;,grep -ril 'hello' /workspace/dir1
|
111 |
+
print disk usage of files or folders in /workspace,du -sh /workspace,du -h /workspace
|
112 |
+
print the last word in /workspace/dir1/long.txt,tac /workspace/dir1/long.txt | awk 'NF{print $NF; exit}',awk '{ for (i=1; i<=NF; i++) last=$i } END { print last }' /workspace/dir1/long.txt
|
113 |
+
Print the 3 largest directories in /workspace.,du -a /workspace | sort -nr | head -n 3,find /workspace -exec du -h {} + | sort -rh | head -n 3
|
114 |
+
"prints first line of ""/workspace/dir1/long.txt""",head -n1 /workspace/dir1/long.txt,sed -n '1p' /workspace/dir1/long.txt
|
115 |
+
"prints the last non-empty line of ""/workspace/dir1/a.txt""",tac /workspace/dir1/a.txt | grep -m 1 '.',awk 'NF' /workspace/dir1/a.txt | tail -n 1
|
116 |
+
prune all the files in the /workspace directory,find /workspace -type f -delete,find /workspace -type f -exec rm -f {} +
|
117 |
+
search for all the files in the /workspace directory which have size greater than 1KB (approx) and less than 32KB(approx).,find /workspace -type f -size +1k -size -32k,find /workspace -type f -size +1k -size -32k -print
|
118 |
+
search for all the files in the /workspace folder and sort them in the order of their depth and display the file names,"find /workspace -type f | awk -F/ '{print NF, $0}' | sort -n","find /workspace -type f | awk -F/ '{print NF, $0}' | sort -n | cut -d' ' -f2-"
|
119 |
+
Search for all the files in the /workspace folder which are bigger than 1KB and display the biggest file.,find /workspace -type f -size +1k -exec ls -ls {} + | sort -n | tail -1,find /workspace -type f -size +1k -exec ls -lh {} + | sort -k 5 -rh | head -n 1
|
120 |
+
search for text files in the /workspace folder which do not have write access to others,"find /workspace -type f \( -iname ""*.txt"" -not -perm -o=w \)","find /workspace -type f -name ""*.txt"" ! -perm -o=w"
|
121 |
+
"Search for the directory ""mysql"" in the workspace directory.",find /workspace -name mysql -type d,"find workspace -type d -name ""mysql"""
|
122 |
+
Print a list of all duplicate case insensitive filenames in the /workspace directory tree,find /workspace -type f | awk -F/ '{print $NF}' | sort -f | uniq -i -d,find /workspace -type f | awk -F/ '{print tolower($NF)}' | sort | uniq -d
|
123 |
+
Search for the file old2.txt in the /workspace folder and list its permissions and creation time.,find /workspace -name old2.txt | xargs ls -tl,find /workspace -name old2.txt -print0 | xargs -0 ls -tl
|
124 |
+
"search for the word ""hello"" in all the regular/normal files in the /workspace folder and display the matched file name","find /workspace -type f | xargs grep -l ""hello""",grep -rnw '/workspace' -e 'hello'
|
125 |
+
Calculate the md5 sum of all files in the /workspace directory with the filename printed first,"find /workspace -type f -exec md5sum {} + | awk '{print $2 "" "" $1}'","find /workspace -type f -print0 | xargs -0 md5sum | awk '{print $2 "" "" $1}'"
|
126 |
+
"Calculate the md5 sum of all files in directory tree ""/workspace""",find /workspace -type f -exec md5sum {} + | sort,find /workspace -type f -exec md5sum {} +
|
127 |
+
Count the number of unique 3 to 6 character file extensions are in the /workspace directory tree,find /workspace -type f -name '*.*' | awk -F. 'NF>1 {ext=tolower($NF); if (length(ext) >= 3 && length(ext) <= 6) print ext}' | sort | uniq -c | wc -l,"find /workspace -type f -name '*.*' | sed -n 's/.*\.//p' | awk '{print tolower($0)}' | grep -E '^[a-z]{3,6}$' | sort -u | wc -l"
|
128 |
+
"Create a copy of the /workspace directory structure in the /usr directory,",find /workspace -type d -print|sed 's@^@/usr/@'|xargs mkdir -p,find /workspace -type d | cpio -pdm /usr
|
129 |
+
Display a long listing of the oldest file under '/workspace' directory tree,find /workspace -type f -printf '%T+ %p\n' | sort | head -n 1 | awk '{print $2}' | xargs ls -l,find /workspace -type f -exec stat --format '%Y %n' {} \; | sort -n | head -n 1 | cut -d' ' -f2- | xargs ls -l
|
130 |
+
Find the largest 2 directories under /workspace directory,find /workspace -type d -print0 | xargs -0 du | sort -n | tail -2 | cut -f2 | xargs -I{} du -sh {},find /workspace -type d -print0 | xargs -0 du | sort -n | tail -2
|
131 |
+
List all files with their paths that have identical content in /workspace directory,find /workspace -type f | xargs md5sum | sort | uniq -Dw32,find /workspace -type f -print0 | xargs -0 md5sum | sort | uniq -w32 -D
|
132 |
+
"Make directories for each unique file path in ""/workspace/files.txt""","cat /workspace/files.txt |xargs -I {} dirname ""{}""| sort -u | xargs -I{} mkdir -p ""{}""","cat /workspace/files.txt | xargs -I {} dirname {}| sort -u | xargs -I{} mkdir -p ""{}"""
|
133 |
+
"Print the total disk usage in bytes of all files listed in ""/workspace/files.txt""",cat /workspace/files.txt | xargs du -b | tail -1 | awk '{print $1}',awk '{print $0}' /workspace/files.txt | xargs du -b | awk '{sum += $1} END {print sum}'
|
134 |
+
Unhide all hidden files in the /workspace directory. Do not include subdirectories.,"find /workspace -maxdepth 1 -type f -name '.*' -exec sh -c 'mv ""$0"" ""${0%/\.*}/${0##*/.}""' {} \;","find /workspace -maxdepth 1 -type f -name '.*' -exec sh -c 'mv ""$1"" ""${1%/\.*}/${1##*/.}""' _ {} \;"
|
135 |
+
"Count the number of differing lines in ""/workspace/dir1/long.txt"" and ""/workspace/dir1/terminate.txt""",diff /workspace/dir1/long.txt /workspace/dir1/terminate.txt | grep ^[\>\<] | wc -l,diff /workspace/dir1/long.txt /workspace/dir1/terminate.txt | grep '^>' | wc -l
|
136 |
+
"Count the number of differing lines in ""/workspace/dir1/terminate.txt"" and ""/workspace/dir1/long.txt"" with 0 lines of unified context",diff -U 0 /workspace/dir1/terminate.txt /workspace/dir1/long.txt | grep -v ^@ | wc -l,diff -U 0 /workspace/dir1/terminate.txt /workspace/dir1/long.txt | grep -v '^@' | wc -l
|
137 |
+
Counts lines in file /workspace/dir1/a.txt ignoring empty lines and lines with spaces only.,awk '!/^[[:space:]]*$/{++x} END{print x}' /workspace/dir1/a.txt,grep -v '^[[:space:]]*$' /workspace/dir1/a.txt | wc -l
|
138 |
+
"Create a symbolic link in directory ""~/newlinks"" for each file listed in ""/workspace/results.txt""",cat /workspace/results.txt | xargs -I{} ln -s {} ~/newlinks,cat /workspace/results.txt | xargs -I {} ln -s {} ~/newlinks
|
139 |
+
Delete all hidden files under /workspace,find /workspace -type f -name '.*' -delete,find /workspace -type f -name '.*' -exec rm -f {} \;
|
140 |
+
"Display a dump of ""/workspace/dir1/long.txt"" as floating point values of double size",od -t fD /workspace/dir1/long.txt,od -An -t fD /workspace/dir1/long.txt
|
141 |
+
Display differences between list of files in /workspace/dir1 and /workspace/dir2.,diff <(ls /workspace/dir1) <(ls /workspace/dir2),diff -qr /workspace/dir1 /workspace/dir2
|
142 |
+
Display the file size of file '/workspace/dir1/sum.c' in bytes,du -sb /workspace/dir1/sum.c | cut -f1,stat -c %s /workspace/dir1/sum.c
|
143 |
+
Display the last slash-separated part of each filename path in /workspace/dir1/file.txt,rev /workspace/dir1/file.txt | cut -d/ -f1 | rev,awk -F/ '{print $NF}' /workspace/dir1/file.txt
|
144 |
+
Display the sizes and filepaths of all files/directories in /workspace directory sorted in descending order of size,du /workspace -a -h | sort -hr,du -ah /workspace | sort -rh
|
145 |
+
Print percentage of the space used on the /workspace directory.,df -k /workspace | tail -1 | awk '{print $5}',df -h /workspace | awk 'NR==2 {print $5}'
|
146 |
+
"Print the contents of ""/workspace/dir1/long.txt"" in reverse order",nl /workspace/dir1/long.txt | sort -nr | cut -b8-,tac /workspace/dir1/long.txt
|
147 |
+
"Create an empty file ""Icon"" in workspace/ with a carriage return character in the end of its name.",echo $'workspace/Icon\r' | xargs touch,"touch ""workspace/Icon""$'\r'"
|
148 |
+
Create a symbolc link in the /workspace/dir1 to root folder,ln /workspace/dir1 -s /,ln -s /workspace/dir1 /
|
149 |
+
"Display permissions, user, group, and full path for each file in the /workspace directory tree",tree /workspace -p -u -g -f,find /workspace -type f -exec stat --format '%A %U %G %N' {} \;
|
150 |
+
Search for 'hello' case insensitively in all files under /workspace directory tree and show the matched lines with their filenames,"find /workspace -type f -print0 | xargs -0 grep -iH ""hello""",grep -ri 'hello' /workspace
|
151 |
+
Unpack all *.gz archives in the /workspace directory tree,find /workspace -name '*.gz' -print0 | xargs -0 gunzip,find /workspace -type f -name '*.gz' -exec gunzip {} +
|
152 |
+
"Uncompress ""/workspace/archive.tar.gz"" and extract the archive to ""/backup""",gzip -dc /workspace/archive.tar.gz | tar -xf - -C /backup,tar -xzvf /workspace/archive.tar.gz -C /backup
|
153 |
+
"Create a symbolic link to ""/workspace/dir1/terminate.txt"" named ""/workspace/test""",ln /workspace/dir1/terminate.txt /workspace/test,ln -s /workspace/dir1/terminate.txt /workspace/test
|
154 |
+
"Retrieve only build number of current kernel, ie. #104",uname -v | grep -o '#[0-9]\+',uname -r | awk -F'-' '{print $2}'
|
155 |
+
Print reverse lookup for adress 127.0.0.1,dig -x 127.0.0.1,nslookup 127.0.0.1
|
156 |
+
"List file information of the full path of command ""grep""",ls -ald `which grep`,stat $(which grep)
|
157 |
+
"Extract host name part from ""http://www.google.com""","echo ""http://www.google.com"" | cut -d'/' -f3","echo ""http://www.google.com"" | sed -E 's|https?://([^/]+).*|\1|'"
|
158 |
+
"List environment variables and their values, escaping all semicolons with a backslash.",env | sed 's/;/\\;/g',"while IFS= read -r line; do echo ""${line//;/\\;}""; done < <(env)"
|
159 |
+
Displays a tree of all process alongside their command line arguments.,pstree -a,"ps -eo pid,ppid,cmd --forest"
|
160 |
+
"Create intermediate directories ""dir"" and ""subdir"" as required and create ""subsubdir""",mkdir -p dir/subdir/subsubdir,mkdir -p dir/subdir/subsubdir
|
161 |
+
"Print numbers 1 through 10 separated by "":""",yes | head -n10 | grep -n . | cut -d: -f1 | paste -sd:,"echo $(seq -s "":"" 1 10)"
|
162 |
+
print all readline bindings,bind -P,bind -P
|
163 |
+
"list names of bind functions containing ""p""",bind -l | grep p,bind -l | egrep 'p'
|
164 |
+
Save first IP address of domain 'google.com' in 'address' variable and display it,address=$(dig +short google.com | grep -E '^[0-9.]+$' | head -n 1) && echo $address,address=$(dig +short google.com | grep -m 1 '^[0-9]' | head -n 1) && echo $address
|
165 |
+
"Remove all characters except "";"" and digits from the string "" Hello world;876 """,echo ' Hello world;876 ' | tr -cd ';0-9',"echo "" Hello world;876 "" | sed 's/[^0-9;]//g'"
|
166 |
+
"Remove leading and trailing spaces or tabs from "" Hello world! """,echo ' Hello world! ' | sed -e 's/^[ \t]*//' | sed -e 's/[ \t]*$//',"echo -n "" Hello world! "" | sed 's/^[ \t]*//;s/[ \t]*$//'"
|
167 |
+
"Remove the last 3 characters from ""987654321""",echo 987654321 | rev | cut -c 4- | rev,"echo ""987654321"" | sed 's/...$//'"
|
168 |
+
Print source of the file system containing current working directory.,df . | tail -1 | awk '{print $1}',df -P . | awk 'NR==2 {print $1}'
|
169 |
+
"List all variables (names only) with names containing ""H"".",env | awk -F= '{if($1 ~ /H/) print $1}',env | grep '^[^=]*H[^=]*=' | awk -F= '{print $1}'
|
170 |
+
Print a list of unique users who are logged in,who | cut -d' ' -f1 | sort | uniq,who | awk '{print $1}' | sort | uniq
|
171 |
+
ping 192.168.1.1,ping -w 1 192.168.1.1,ping -w 1 192.168.1.1
|
172 |
+
Print a line of 99 '=' characters,seq -s= 100|tr -d '[:digit:]',printf '=%.0s' {1..99}
|
173 |
+
Count number of users logged in,who | awk -F' ' '{print $1}' | sort -u | wc -l,who | wc -l
|
174 |
+
"Displays calendar of a previous, current and next month for December of 2120 year.",cal -3 12 2120,cal -3 12 2120
|
175 |
+
"Extract, sort and print only group names from /etc/group.",cut -d: -f1 /etc/group | sort,cut -d: -f1 /etc/group | sort | uniq
|
176 |
+
Calculate the sum of all the numbers from 1 to 10,seq 10 | jq -s 'add',echo $(( (10 * (10 + 1)) / 2 ))
|
177 |
+
Count the number of files and directories in the entire testbed directory,find /testbed | wc -l,find /testbed -print | wc -l
|
178 |
+
Print the number of python files in the testbed directory.,"find testbed -type f -name ""*.py"" | wc -l","find testbed -type f -name ""*.py"" -print | wc -l"
|
179 |
+
Sort the lines of textfile1.txt in reverse alphabetical order and save the result to a new file,sort -r /testbed/dir1/textfile1.txt > /testbed/dir1/textfile1_reverse_sorted.txt,sort -r /testbed/dir1/textfile1.txt > /testbed/dir1/textfile1_reverse_sorted.txt
|
180 |
+
Search for all files containing the word 'Shell' in testbed.,find /testbed -type f -exec grep -l 'Shell' {} +,grep -r 'Shell' /testbed
|
181 |
+
Find all symbolic links in the testbed directory.,find /testbed -type l,find /testbed -type l -print
|
182 |
+
Get the total size of all files in testbed/ and save it to total_size.txt,du -sh testbed/ | awk '{print $1}' > total_size.txt,du -s testbed/ | awk '{print $1}' > total_size.txt
|
183 |
+
List all files in the directory /testbed/dir1 and sort them by size in human-readable format,ls -lhS /testbed/dir1,ls -lhS /testbed/dir1
|
184 |
+
Count the number of lines in files under the directory /testbed/dir2.,grep -rl . /testbed/dir2 | xargs wc -l,find /testbed/dir2 -type f -exec wc -l {} +
|
185 |
+
Print the name and size of the 3 largest files in the directory /testbed/dir3,find /testbed/dir3 -type f -exec ls -lhS {} + | sort -rh -k5 | head -n 3,find /testbed/dir3 -type f -exec ls -lhS {} + 2>/dev/null | sort -rh -k5 | head -n 3
|
186 |
+
Find all files modified in the last 2 hours and compress them into a tarball named archive.tar.gz in the directory /testbed,find /testbed -type f -mmin -120 -print0 | xargs -0 tar -czf /testbed/archive.tar.gz,find /testbed -type f -mmin -120 -print0 | xargs -0 tar -czf /testbed/archive.tar.gz
|
187 |
+
List all subdirectories of /testbed that are not named subdir1,ls -d /testbed/*/ | grep -v /subdir1/,"find /testbed -mindepth 1 -maxdepth 1 -type d ! -name ""subdir1"""
|
188 |
+
Search for all files that contain the string 'text file' under the directory /testbed,grep -r 'text file' /testbed,grep -rl 'text file' /testbed
|
189 |
+
Compute the MD5 hash of all files under the directory /testbed and store them in a file named hashes.txt in the same directory,find /testbed -type f -exec md5sum {} + > /testbed/hashes.txt,find /testbed -type f -exec md5sum {} + > /testbed/hashes.txt
|
190 |
+
Print the last 10 lines of the file /testbed/dir3/subdir1/subsubdir1/textfile3.txt,tail -n 10 /testbed/dir3/subdir1/subsubdir1/textfile3.txt,tail -n 10 /testbed/dir3/subdir1/subsubdir1/textfile3.txt
|
191 |
+
Print the line number and contents of all lines containing the string 'value3' in the file /testbed/dir1/subdir1/jsonfile1.json,grep -n 'value3' /testbed/dir1/subdir1/jsonfile1.json,grep -n 'value3' /testbed/dir1/subdir1/jsonfile1.json
|
192 |
+
Find all files in the directory /testbed that have been modified in the last 24 hours and print their path,find /testbed -type f -mtime -1 -print,find /testbed -type f -mtime -1
|
193 |
+
Search for all the files in /testbed directory and its subdirectories that contain the word 'Hello' and replace it with 'Hi' in-place.,"grep -rl ""Hello"" /testbed | xargs sed -i 's/Hello/Hi/g'",grep -rl 'Hello' /testbed | xargs sed -i 's/Hello/Hi/g'
|
194 |
+
"Display the contents of textfile3.txt and textfile4.txt side by side, with line numbers and a separator between them.",paste <(nl /testbed/dir3/subdir1/subsubdir1/textfile3.txt) <(nl /testbed/dir1/subdir1/textfile4.txt),paste <(nl /testbed/dir3/subdir1/subsubdir1/textfile3.txt) <(nl /testbed/dir1/subdir1/textfile4.txt)
|
nl2bash_fs_1.json
ADDED
@@ -0,0 +1,232 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[
|
2 |
+
{
|
3 |
+
"query": "Calculate a list of duplicate md5 sum hashes for all the \".java\" files in the /testbed directory",
|
4 |
+
"gold": "md5sum /testbed/*.java | awk '{print $1}' | sort | uniq -d",
|
5 |
+
"gold2": "find /testbed -type f -name \"*.java\" -exec md5sum {} + | sort | uniq -w32 -d -c | sort -nr"
|
6 |
+
},
|
7 |
+
{
|
8 |
+
"query": "Calculate the md5 sum of the md5 sum of all the files under /testbed/dir2/subdir2 sorted by filename",
|
9 |
+
"gold": "find /testbed/dir2/subdir2 -type f -print0 | sort -z | xargs -0 md5sum | awk '{print $1}' | md5sum",
|
10 |
+
"gold2": "ls -1 /testbed/dir2/subdir2/* | sort | xargs md5sum | awk '{print $1}' | md5sum"
|
11 |
+
},
|
12 |
+
{
|
13 |
+
"query": "Calculate the md5 sum of the contents of the sorted list of files \"$FILES\"",
|
14 |
+
"gold": "cat $(echo $FILES | tr ' ' '\\n' | sort) | md5sum",
|
15 |
+
"gold2": "echo \"$FILES\" | tr ' ' '\\n' | sort | xargs cat | md5sum"
|
16 |
+
},
|
17 |
+
{
|
18 |
+
"query": "Calculate the md5 sum of the sorted list of md5 sums of all \".py\" files under /testbed/dir1/subdir1",
|
19 |
+
"gold": "find /testbed/dir1/subdir1 -type f -name *.py -exec md5sum {} + | awk '{print $1}' | sort | md5sum",
|
20 |
+
"gold2": "find /testbed/dir1/subdir1 -type f -name '*.py' -print0 | xargs -0 md5sum | awk '{print $1}' | sort | md5sum"
|
21 |
+
},
|
22 |
+
{
|
23 |
+
"query": "Calculate the total disk usage for each \".txt\" file on the /testbed directory and prepend the system host name to the output",
|
24 |
+
"gold": "find /testbed -name \"*.txt\" -exec du {} + | awk -v hostname=\"$(hostname)\" '{print hostname, $0}'",
|
25 |
+
"gold2": "find /testbed -name \"*.txt\" -exec du -h {} + | awk -v hostname=\"$(hostname)\" '{print hostname, $0}'"
|
26 |
+
},
|
27 |
+
{
|
28 |
+
"query": "Change permissions for all PHP files under the /testbed directory tree to 755 and print the number of files changed",
|
29 |
+
"gold": "find /testbed -name \"*.php\" -exec chmod 755 {} \\; -exec /bin/echo {} \\; | wc -l",
|
30 |
+
"gold2": "find /testbed -type f -name \"*.php\" -exec chmod 755 {} \\; -print | wc -l"
|
31 |
+
},
|
32 |
+
{
|
33 |
+
"query": "Check if the current shell is running within a 'screen' process and print \"True\" or \"False\"",
|
34 |
+
"gold": "pstree -s $$ | grep -q \"screen\" && echo \"True\" || echo \"False\"",
|
35 |
+
"gold2": "ps -o comm= $(pstree -sp $$ | awk -F '[^0-9]*' '{print $2}') | grep -q 'screen' && echo \"True\" || echo \"False\""
|
36 |
+
},
|
37 |
+
{
|
38 |
+
"query": "Print \"True\" if the contents of file /testbed/dir3/subdir1/subsubdir1/textfile3.txt is a subset of file /testbed/dir2/subdir1/textfile2.txt, otherwise print \"False\"",
|
39 |
+
"gold": "comm -23 <(sort /testbed/dir3/subdir1/subsubdir1/textfile3.txt | uniq) <(sort /testbed/dir2/subdir1/textfile2.txt | uniq) | head -1 | grep -q '.' && echo \"False\" || echo \"True\"",
|
40 |
+
"gold2": "comm -23 <(sort /testbed/dir3/subdir1/subsubdir1/textfile3.txt | uniq) <(sort /testbed/dir2/subdir1/textfile2.txt | uniq) | grep -q '.' && echo \"False\" || echo \"True\""
|
41 |
+
},
|
42 |
+
{
|
43 |
+
"query": "Compute the mean average of the word count of *.txt files in the /testbed directory",
|
44 |
+
"gold": "find /testbed -name '*.txt' -print0 | xargs -0 wc -w | awk 'END { print $1/(NR-1) }'",
|
45 |
+
"gold2": "find /testbed -type f -name \"*.txt\" -exec wc -w {} + | awk '{total = $1} END {print total/(NR-1)}'"
|
46 |
+
},
|
47 |
+
{
|
48 |
+
"query": "Compute the mean average of the word count of *.txt files smaller than 6 words in the /testbed directory",
|
49 |
+
"gold": "find /testbed -name '*.txt' -print0 | xargs -0 wc -w | awk '$1 < 6 {v += $1; c++} END {print v/c}'",
|
50 |
+
"gold2": "find /testbed -name '*.txt' -print0 | xargs -0 wc -w | awk '$1 < 6 {v += $1; c++} END {print v/c, \"words\"}'"
|
51 |
+
},
|
52 |
+
{
|
53 |
+
"query": "Copy all files with \"FooBar\" in the path under the '/testbed' directory to the '/testbed/dir3/subdir1/subsubdir1/tmp' directory.",
|
54 |
+
"gold": "find /testbed -path '*FooBar*' -print0 | xargs -0 -I{} cp -r {} /testbed/dir3/subdir1/subsubdir1/tmp",
|
55 |
+
"gold2": "find /testbed -path '*FooBar*' -print0 | xargs -0 -I{} cp -R {} /testbed/dir3/subdir1/subsubdir1/tmp"
|
56 |
+
},
|
57 |
+
{
|
58 |
+
"query": "search for all .txt files in the /testbed directory, prints their paths, and then search within each file for the word \"another\"",
|
59 |
+
"gold": "find /testbed -name \"*.txt\" \\( -exec echo {} \\; -o -exec true \\; \\) -exec grep another {} \\;",
|
60 |
+
"gold2": "find /testbed -type f -name \"*.txt\" -print -exec grep -H \"another\" {} \\;"
|
61 |
+
},
|
62 |
+
{
|
63 |
+
"query": "Convert the first 16 characters in \"/testbed/textfile7.txt\" to a single hexadecimal value",
|
64 |
+
"gold": "head /testbed/textfile7.txt -c16 | od -tx1 -w16 | head -n1 | cut -d' ' -f2- | tr -d ' '",
|
65 |
+
"gold2": "head -c 16 /testbed/textfile7.txt | od -An -tx1 | tr -d ' \\n'"
|
66 |
+
},
|
67 |
+
{
|
68 |
+
"query": "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.",
|
69 |
+
"gold": "find /testbed -type f -path '*FooBar*' | xargs -i cp -p \"{}\" .",
|
70 |
+
"gold2": "find /testbed -type f -path '*FooBar*' -exec cp --preserve=mode,ownership,timestamps {} ./ \\;"
|
71 |
+
},
|
72 |
+
{
|
73 |
+
"query": "Copy all files and folders below the /testbed directory whose names contain \"FooBar\" to directory '/testbed/dir3/subdir1/subsubdir1/tmp'",
|
74 |
+
"gold": "find /testbed -name '*FooBar*' -print0 | xargs -0 -I{} cp -R {} /testbed/dir3/subdir1/subsubdir1/tmp",
|
75 |
+
"gold2": "find /testbed -name \"*FooBar*\" -exec cp -r {} /testbed/dir3/subdir1/subsubdir1/tmp \\;"
|
76 |
+
},
|
77 |
+
{
|
78 |
+
"query": "Count all the lines of all '*.c' files in /testbed directory recursively",
|
79 |
+
"gold": "find /testbed -name \"*.c\" -print0 | xargs -0 cat | wc -l",
|
80 |
+
"gold2": "find /testbed -name \"*.c\" -exec wc -l {} + | awk '{s+=$1} END {print s}'"
|
81 |
+
},
|
82 |
+
{
|
83 |
+
"query": "Count all the lines of all files with names ending with 'php' in current directory and subdirectories recursively",
|
84 |
+
"gold": "find . -type f -name '*php' | xargs cat | wc -l",
|
85 |
+
"gold2": "find . -type f -name '*.php' -exec wc -l {} + | awk '{s=$1} END {print s}'"
|
86 |
+
},
|
87 |
+
{
|
88 |
+
"query": "Count all the lines of all php files in the /testbed directory recursively",
|
89 |
+
"gold": "find /testbed/ -name '*.php' | xargs cat | wc -l",
|
90 |
+
"gold2": "find /testbed/ -type f -name '*.php' | xargs cat | wc -l"
|
91 |
+
},
|
92 |
+
{
|
93 |
+
"query": "Calculate the md5sum of all '*.py' files in /testbed folder and sub folders.",
|
94 |
+
"gold": "find /testbed -type f -name \"*.py\" -exec md5sum {} +",
|
95 |
+
"gold2": "find /testbed -type f -name \"*.py\" -print0 | xargs -0 md5sum"
|
96 |
+
},
|
97 |
+
{
|
98 |
+
"query": "Count the *.html files residing in the /testbed directory tree and containing string \"foo\"",
|
99 |
+
"gold": "find /testbed -name \"*.html\" | xargs grep -l foo | wc -l",
|
100 |
+
"gold2": "find /testbed -name \"*.html\" -exec grep -l foo {} + | wc -l"
|
101 |
+
},
|
102 |
+
{
|
103 |
+
"query": "Count the number of files/directories with '.php' extension under /testbed directory tree and change the permissions to 755",
|
104 |
+
"gold": "find /testbed -name \"*.php\" -exec chmod 755 {} \\; -exec /bin/echo {} \\; | wc -l",
|
105 |
+
"gold2": "find /testbed -type f -name '*.php' -exec chmod 755 {} \\; -print | wc -l"
|
106 |
+
},
|
107 |
+
{
|
108 |
+
"query": "Count the number of lines in all files in the /testbed directory tree that match pattern '*file*'",
|
109 |
+
"gold": "find /testbed/ -name '*file*' | sort | xargs wc -l",
|
110 |
+
"gold2": "find /testbed -type f -name '*file*' -exec wc -l {} +"
|
111 |
+
},
|
112 |
+
{
|
113 |
+
"query": "Count the number of regular files in directory tree ${DIRECTORY} that contain a vowel in their names",
|
114 |
+
"gold": "find ${DIRECTORY} -type f -print | sed -e 's@^.*/@@' | grep '[aeiouyAEIOUY]' | wc -l",
|
115 |
+
"gold2": "find \"${DIRECTORY}\" -type f -print | awk -F/ '{print $NF}' | grep -i '[aeiouy]' | wc -l"
|
116 |
+
},
|
117 |
+
{
|
118 |
+
"query": "Count the number of files for each unique file extensions in the /testbed directory tree.",
|
119 |
+
"gold": "find /testbed -type f | sed -e 's/.*\\.//' | sed -e 's/.*\\///' | sort | uniq -c | sort -rn",
|
120 |
+
"gold2": "find /testbed -type f | awk -F. '{if (NF>1) print $NF}' | sort | uniq -c | sort -nr"
|
121 |
+
},
|
122 |
+
{
|
123 |
+
"query": "Count the total number of lines in all \"*.gz\" files in the /testbed directory tree after decompression",
|
124 |
+
"gold": "find /testbed -type f -name '*.gz' | xargs zcat | wc -l",
|
125 |
+
"gold2": "find /testbed -type f -name \"*.gz\" -exec sh -c 'gunzip -c \"$0\" | wc -l' {} \\; | awk '{s+=$1} END {print s}'"
|
126 |
+
},
|
127 |
+
{
|
128 |
+
"query": "Counts all files in the /testbed folder and subfolders.",
|
129 |
+
"gold": "find /testbed -type f -exec ls -l {} \\; | wc -l",
|
130 |
+
"gold2": "find /testbed -type f | wc -l"
|
131 |
+
},
|
132 |
+
{
|
133 |
+
"query": "Count lines in each *.php file sorted by file in /testbed directory.",
|
134 |
+
"gold": "find /testbed -name '*.php' -type f | sort | xargs wc -l",
|
135 |
+
"gold2": "find /testbed -type f -name \"*.php\" -exec wc -l {} + | sort"
|
136 |
+
},
|
137 |
+
{
|
138 |
+
"query": "Counts lines in each *.php file in /testbed directory, sorted by number of lines, descending.",
|
139 |
+
"gold": "find /testbed -name '*.php' -type f | xargs wc -l | sort -nr",
|
140 |
+
"gold2": "find /testbed -type f -name \"*.php\" -exec wc -l {} + | sort -rn"
|
141 |
+
},
|
142 |
+
{
|
143 |
+
"query": "Counts number of occurences of all ip addresses in '/etc/networks' file, and prints all addresses with number of occurences in a descending order.",
|
144 |
+
"gold": "grep -oE '([0-9]{1,3}\\.){3}[0-9]{1,3}' /etc/networks | sort | uniq -c | sort -nr",
|
145 |
+
"gold2": "awk '{for (i=1; i<=NF; i++) if ($i ~ /([0-9]{1,3}\\.){3}[0-9]{1,3}/) print $i}' /etc/networks | sort | uniq -c | sort -nr"
|
146 |
+
},
|
147 |
+
{
|
148 |
+
"query": "Counts total number of only lines with alphanumeric symbols in all *.php files in the /testbed folder and subfolders.",
|
149 |
+
"gold": "find /testbed -name '*.php' | xargs cat | awk '/[a-zA-Z0-9]/ {i++} END{print i}'",
|
150 |
+
"gold2": "find /testbed -type f -name '*.php' -exec grep -H '.*[[:alnum:]].*' {} + | wc -l"
|
151 |
+
},
|
152 |
+
{
|
153 |
+
"query": "Counts total lines in PHP and JS files in /testbed.",
|
154 |
+
"gold": "find /testbed -name '*.js' -or -name '*.php' | xargs wc -l | grep 'total' | awk '{print $1}'",
|
155 |
+
"gold2": "find /testbed -type f \\( -name '*.php' -o -name '*.js' \\) -exec wc -l {} + | awk '{s=$1} END {print s}'"
|
156 |
+
},
|
157 |
+
{
|
158 |
+
"query": "Create an empty file \"abc.txt\" in each directory named \"dir1\" under testbed directory.",
|
159 |
+
"gold": "find /testbed -type d -name \"dir1\" -print | sed 's/$/\\/abc.txt/g' | xargs touch",
|
160 |
+
"gold2": "find testbed -type d -name \"dir1\" -exec touch {}/abc.txt \\;"
|
161 |
+
},
|
162 |
+
{
|
163 |
+
"query": "Create logs.tar.gz of all older than one day logs of Ubuntu",
|
164 |
+
"gold": "find /var/log/ -mtime +1 | xargs tar -czvPf /testbed/logs.tar.gz",
|
165 |
+
"gold2": "find /var/log -type f -mtime +1 -exec tar -czvPf /testbed/logs.tar.gz {} +"
|
166 |
+
},
|
167 |
+
{
|
168 |
+
"query": "Delete files in \"/testbed/dir3/subdir1/subsubdir1/tmp\" that are older than 2 days",
|
169 |
+
"gold": "find /testbed/dir3/subdir1/subsubdir1/tmp -type f -mtime +2 -print0 | xargs -0 rm -f",
|
170 |
+
"gold2": "find /testbed/dir3/subdir1/subsubdir1/tmp -type f -mtime +2 -delete"
|
171 |
+
},
|
172 |
+
{
|
173 |
+
"query": "Display the 5 largest files in the /testbed directory and its sub-directories.",
|
174 |
+
"gold": "find /testbed -type f -exec du -b {} + | sort -rh | head -n 5",
|
175 |
+
"gold2": "find /testbed -type f -print0 | xargs -0 du -b | sort -rn | head -n 5"
|
176 |
+
},
|
177 |
+
{
|
178 |
+
"query": "Display the 5 smallest files in the /testbed directory and its sub-directories ignoring any empty files.",
|
179 |
+
"gold": "find /testbed -type f -size +0c -exec du -b {} + | sort -n | head -n 5",
|
180 |
+
"gold2": "find /testbed -type f -size +0c -exec du -b {} + | sort -rh | tail -n 5"
|
181 |
+
},
|
182 |
+
{
|
183 |
+
"query": "Display the 5 smallest files in the /testbed directory and its sub-directories.",
|
184 |
+
"gold": "find /testbed -type f -exec ls -s {} \\; | sort -n | head -5",
|
185 |
+
"gold2": "find /testbed -type f -exec du -b {} + | sort -n | head -n 5"
|
186 |
+
},
|
187 |
+
{
|
188 |
+
"query": "Display the five biggest file sizes only in the /testbed directory",
|
189 |
+
"gold": "find /testbed -type f -maxdepth 1 -exec du -b {} + | sort -rh | head -n 5",
|
190 |
+
"gold2": "ls -lS /testbed | grep '^-' | head -n 5"
|
191 |
+
},
|
192 |
+
{
|
193 |
+
"query": "Find .java files in the testbed directory tree that contain 'Hello', and print their names",
|
194 |
+
"gold": "find /testbed -name \"*.java\" -exec grep -Hin Hello {} + | cut -d \":\" -f 1 | xargs -I{} basename {}",
|
195 |
+
"gold2": "find testbed -type f -name \"*.java\" -exec grep -l 'Hello' {} +"
|
196 |
+
},
|
197 |
+
{
|
198 |
+
"query": "Print a list of all duplicate case insensitive filenames in the /testbed directory tree",
|
199 |
+
"gold": "find /testbed -type f | awk -F/ '{print $NF}' | sort -f | uniq -i -d",
|
200 |
+
"gold2": "find /testbed -type f | awk -F/ '{print tolower($NF)}' | sort | uniq -d"
|
201 |
+
},
|
202 |
+
{
|
203 |
+
"query": "Print all unique file paths under \"testbed/dir1\" compared to \"testbed/dir2\"",
|
204 |
+
"gold": "comm -23 <(find /testbed/dir1 | sed 's#/testbed/dir1/##' | sort) <(find /testbed/dir2 | sed 's#/testbed/dir2/##' | sort) | sed 's#^#/testbed/dir1/#'",
|
205 |
+
"gold2": "comm -23 <(find testbed/dir1 -type f | sed 's|testbed/dir1/||' | sort) <(find testbed/dir2 -type f | sed 's|testbed/dir2/||' | sort) | sed 's|^|testbed/dir1/|'"
|
206 |
+
},
|
207 |
+
{
|
208 |
+
"query": "Recursively finds all files containing text 'Hello' in /testbed and prints folder where they are placed.",
|
209 |
+
"gold": "grep -rl 'Hello' /testbed | xargs -I {} dirname {} | sort | uniq",
|
210 |
+
"gold2": "find /testbed -type f -exec grep -l 'Hello' {} + | xargs -I {} dirname {} | sort | uniq"
|
211 |
+
},
|
212 |
+
{
|
213 |
+
"query": "Prints total number of lines of all *.java files in /testbed folder and subfolders.",
|
214 |
+
"gold": "find /testbed -name '*.java' -print0 |xargs -0 wc -l|grep 'total' |awk '{ print $1 }'",
|
215 |
+
"gold2": "find /testbed -name \"*.java\" -exec wc -l {} + | awk '{s=$1} END {print s}'"
|
216 |
+
},
|
217 |
+
{
|
218 |
+
"query": "Create a symbolc link in the /testbed/dir3/subdir1/subsubdir1/FooBar to root folder",
|
219 |
+
"gold": "ln /testbed/dir3/subdir1/subsubdir1/FooBar -s /",
|
220 |
+
"gold2": "ln -s /testbed/dir3/subdir1/subsubdir1/FooBar /"
|
221 |
+
},
|
222 |
+
{
|
223 |
+
"query": "search for all the files in the folder /testbed/dir1 which have sticky bit set and have the permissions 553",
|
224 |
+
"gold": "find /testbed/dir1 -perm 1553",
|
225 |
+
"gold2": "find /testbed/dir1 -type f -perm 1553"
|
226 |
+
},
|
227 |
+
{
|
228 |
+
"query": "search for php files in /testbed directory and search for \"world\" in all these files",
|
229 |
+
"gold": "find /testbed -name '*.php' -exec grep -iq \"world\" {} \\; -print",
|
230 |
+
"gold2": "find /testbed -name \"*.php\" -exec grep -H \"world\" {} \\;"
|
231 |
+
}
|
232 |
+
]
|
nl2bash_fs_2.json
ADDED
@@ -0,0 +1,247 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[
|
2 |
+
{
|
3 |
+
"query": "Recursively finds all files with any cased text \"Hello\" in the '/system/folder1' folder, and precedes found string with its number in file.",
|
4 |
+
"gold": "grep -inr \"Hello\" /system/folder1",
|
5 |
+
"gold2": "find /system/folder1 -type f -exec grep -inH 'hello' {} \\;"
|
6 |
+
},
|
7 |
+
{
|
8 |
+
"query": "Recursively finds all files with whole word \"foo\" in the '/system', and precedes found string with its number in file.",
|
9 |
+
"gold": "grep -rnw /system -e \"foo\"",
|
10 |
+
"gold2": "grep -ronw '/system' -e 'foo'"
|
11 |
+
},
|
12 |
+
{
|
13 |
+
"query": "Recursively list contents of the '/system' directory in a tree-like format",
|
14 |
+
"gold": "tree /system",
|
15 |
+
"gold2": "find /system -print | sed -e 's;[^/]*/;|___;g;s;___|; |;g'"
|
16 |
+
},
|
17 |
+
{
|
18 |
+
"query": "Recursively print all files and directories in the '/system/folder2' directory tree including hidden files",
|
19 |
+
"gold": "tree -a /system/folder2",
|
20 |
+
"gold2": "find /system/folder2 -print | sed -e 's;[^/]*/;|___;g;s;___|; |;g'"
|
21 |
+
},
|
22 |
+
{
|
23 |
+
"query": "Recursively prints all folders in the '/system' folder that contain files like \"*.out\".",
|
24 |
+
"gold": "find /system -type f -name \"*.out\" -print0 | xargs -0 -n1 dirname | sort -u",
|
25 |
+
"gold2": "find /system -type f -name \"*.out\" -printf '%h\\n' | sort -u"
|
26 |
+
},
|
27 |
+
{
|
28 |
+
"query": "Remove all \"*.txt\" files in the '/system' folder and answer \"y\" to any prompt",
|
29 |
+
"gold": "yes y | rm -r /system/*.txt",
|
30 |
+
"gold2": "find /system -maxdepth 1 -type f -name \"*.txt\" -exec rm -f {} \\;"
|
31 |
+
},
|
32 |
+
{
|
33 |
+
"query": "Recursively removes all empty folders from the /system/folder3/temp folder.",
|
34 |
+
"gold": "find /system/folder3/temp -depth -type d -exec rmdir {} \\;",
|
35 |
+
"gold2": "find /system/folder3/temp -type d -empty -delete"
|
36 |
+
},
|
37 |
+
{
|
38 |
+
"query": "Recursively removes all empty folders under /system/folder3/temp, printing info message on each operation, and suppressing error messages if folder is not empty.",
|
39 |
+
"gold": "find /system/folder3/temp -type d -empty -exec rmdir -vp --ignore-fail-on-non-empty {} +",
|
40 |
+
"gold2": "find /system/folder3/temp -type d -empty -print -delete 2>/dev/null"
|
41 |
+
},
|
42 |
+
{
|
43 |
+
"query": "Recursively removes all files in the /system/folder1 folder but '*txt' files.",
|
44 |
+
"gold": "find /system/folder1 -type f -not -name '*txt' | xargs rm",
|
45 |
+
"gold2": "find /system/folder1 -type f ! -name '*.txt' -print -delete"
|
46 |
+
},
|
47 |
+
{
|
48 |
+
"query": "Recursively rename all files under /system/folder2 replacing special with regular.",
|
49 |
+
"gold": "find /system/folder2 -type f -name '*special*' ! -path '*/special/*' -execdir bash -c 'mv \"$0\" \"${0/special/regular}\"' {} \\;",
|
50 |
+
"gold2": "find /system/folder1 -type f -name '*special*' -exec bash -c 'for f; do mv -- \"$f\" \"${f%/*}/${f##*/special/regular}\"; done' _ {} +"
|
51 |
+
},
|
52 |
+
{
|
53 |
+
"query": "Recursively search for \"foo\" in the '/system' folder and write the output to the console followed by the number of matched lines",
|
54 |
+
"gold": "grep -r \"foo\" /system | tee >(wc -l)",
|
55 |
+
"gold2": "grep -r \"foo\" /system | awk '{print} END {print NR}'"
|
56 |
+
},
|
57 |
+
{
|
58 |
+
"query": "Recursively search for all regular files below directory \"/system/folder3/\", and output the name of each, without any containing directories.",
|
59 |
+
"gold": "find /system/folder3/ -type f -exec basename {} \\;",
|
60 |
+
"gold2": "find /system/folder3/ -type f | xargs -n 1 basename"
|
61 |
+
},
|
62 |
+
{
|
63 |
+
"query": "Recursively unzip files to stdout in \"/system/folder2.tar.gz\" and search for \"special\"",
|
64 |
+
"gold": "zcat -r /system/folder2.tar.gz | grep \"special\"",
|
65 |
+
"gold2": "tar -xzvf /system/folder2.tar.gz -O | grep \"special\""
|
66 |
+
},
|
67 |
+
{
|
68 |
+
"query": "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",
|
69 |
+
"gold": "cat /system/folder3/temp/temp1/text1.txt | sed 's/\\r$//' | od -c",
|
70 |
+
"gold2": "cat system/folder3/temp/temp1/text1.txt | sed 's/\\r$//' | od -c -An"
|
71 |
+
},
|
72 |
+
{
|
73 |
+
"query": "Remove all *.doc files from the /system/folder1 tree",
|
74 |
+
"gold": "find /system/folder1 -name '*.doc' -exec rm \"{}\" \\;",
|
75 |
+
"gold2": "find /system/folder1 -type f -name '*.doc' -delete"
|
76 |
+
},
|
77 |
+
{
|
78 |
+
"query": "Remove all *.log files from the /system/folder1 tree",
|
79 |
+
"gold": "find /system/folder1 -name '*.log' -print0 | xargs -0 rm",
|
80 |
+
"gold2": "find /system/folder1 -type f -name '*.log' -delete"
|
81 |
+
},
|
82 |
+
{
|
83 |
+
"query": "Remove all *.txt files in '/system' directory but not in it's subdirectories",
|
84 |
+
"gold": "find /system -name '*.txt' -maxdepth 1 | xargs rm",
|
85 |
+
"gold2": "find /system -name '*.txt' -maxdepth 1 -delete"
|
86 |
+
},
|
87 |
+
{
|
88 |
+
"query": "Remove all *.sql files in the '/system/folder3/backup_dbg' directory that were last modified more than 25 days ago",
|
89 |
+
"gold": "find /system/folder3/backup_dbg/*.sql -mtime +25 -exec rm -f {} \\;",
|
90 |
+
"gold2": "find /system/folder3/backup_dbg -name '*.sql' -print -mtime +25 -delete"
|
91 |
+
},
|
92 |
+
{
|
93 |
+
"query": "Remove all *.txt files under the /system/folder1 directory modified more than 5 minutes ago",
|
94 |
+
"gold": "find /system/folder1 -mmin +5 -type f -name \"*.txt\" -delete",
|
95 |
+
"gold2": "find /system/folder1 -mmin +5 -type f -name \"*.txt\" | xargs rm -f"
|
96 |
+
},
|
97 |
+
{
|
98 |
+
"query": "Remove all *.txt files, except \"keep.txt\", under /system/folder1 directory modified more than 5 minutes ago. Do not include subdirectories.",
|
99 |
+
"gold": "find /system/folder1 -maxdepth 1 -mmin +5 -type f -name \"*.txt\" ! -name \"keep.txt\" -delete",
|
100 |
+
"gold2": "find /system/folder1 -maxdepth 1 -mmin +5 -type f -name \"*.txt\" ! -name \"keep.txt\" | xargs rm -f"
|
101 |
+
},
|
102 |
+
{
|
103 |
+
"query": "Remove all .sh files in the '/system/folder1' tree whose names begin with \"new\"",
|
104 |
+
"gold": "find /system/folder1 -name 'new*.sh' -exec rm -f '{}' \\;",
|
105 |
+
"gold2": "find /system/folder1 -name 'new*.sh' -delete"
|
106 |
+
},
|
107 |
+
{
|
108 |
+
"query": "Remove all a.out, *.o, and core files under the '/system' directory",
|
109 |
+
"gold": "find /system \\( -name a.out -o -name '*.o' -o -name 'core' \\) -exec rm {} \\;",
|
110 |
+
"gold2": "find /system -type f \\( -name \"a.out\" -o -name \"*.o\" -o -name \"core\" \\) -delete"
|
111 |
+
},
|
112 |
+
{
|
113 |
+
"query": "Print the last five lines of /system/folder1/data.csv",
|
114 |
+
"gold": "cat /system/folder1/data.csv | rev | cut -d, -f-5 | rev",
|
115 |
+
"gold2": "tail -n 1 /system/folder1/data.csv | rev | cut -d',' -f1-5 | rev"
|
116 |
+
},
|
117 |
+
{
|
118 |
+
"query": "Remove all directories called \"temp\" from the /system directory tree",
|
119 |
+
"gold": "find /system -name \"temp\" -type d -delete",
|
120 |
+
"gold2": "find /system -type d -name \"temp\" -exec rm -rf {} +"
|
121 |
+
},
|
122 |
+
{
|
123 |
+
"query": "Remove all empty files in /system/folder3/temp and below",
|
124 |
+
"gold": "find /system/folder3/temp -type f -empty -print | xargs rm -f",
|
125 |
+
"gold2": "find /system/folder3/temp -type f -empty -print -delete"
|
126 |
+
},
|
127 |
+
{
|
128 |
+
"query": "Remove all files a.out and *.o in the /system directory tree that were modified less than 7 days ago",
|
129 |
+
"gold": "find /system \\( -name a.out -o -name '*.o' \\) -mtime -7 -exec rm {} \\;",
|
130 |
+
"gold2": "find /system -type f \\( -name \"a.out\" -o -name \"*.o\" \\) -mtime -7 -delete"
|
131 |
+
},
|
132 |
+
{
|
133 |
+
"query": "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'",
|
134 |
+
"gold": "find /system/folder3/temp \\( -name '.DS_Store' -or -name '._.DS_Store' -or -name '._*' -or -name '.TemporaryItems' -or -name '.apdisk' \\) -exec rm -rf {} \\;",
|
135 |
+
"gold2": "find /system/folder3/temp \\( -name '.DS_Store' -or -name '._.DS_Store' -or -name '._*' -or -name '.TemporaryItems' -or -name '.apdisk' \\) -delete"
|
136 |
+
},
|
137 |
+
{
|
138 |
+
"query": "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",
|
139 |
+
"gold": "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",
|
140 |
+
"gold2": "echo '1/2 [3] (27/03/2012 19:32:54) word word word word 4/5' | sed 's/([^)]*)//g' | tr -c '0-9' ' ' | column -t"
|
141 |
+
},
|
142 |
+
{
|
143 |
+
"query": "Remove files text2, text3, text4 in directory /system/folder1",
|
144 |
+
"gold": "find /system/folder1 -name 'text[2-4]*' -exec rm {} \\;",
|
145 |
+
"gold2": "find /system/folder1 -name 'text[2-4]*' -delete"
|
146 |
+
},
|
147 |
+
{
|
148 |
+
"query": "Remove files that are less than 1KB in size under /system directory",
|
149 |
+
"gold": "find /system -type f -size -1k -exec rm {} +",
|
150 |
+
"gold2": "find /system -type f -size -1k -delete"
|
151 |
+
},
|
152 |
+
{
|
153 |
+
"query": "Remove files modified more than 31 days ago recursively from \"/system\"",
|
154 |
+
"gold": "find /system -type f -mtime +31 -exec rm -f {} \\;",
|
155 |
+
"gold2": "find /system -type f -mtime +31 -delete"
|
156 |
+
},
|
157 |
+
{
|
158 |
+
"query": "Print \"/system/folder3/temp/temp1/text1.txt\" without newline characters.",
|
159 |
+
"gold": "paste -sd \"\" /system/folder3/temp/temp1/text1.txt",
|
160 |
+
"gold2": "tr -d '\\n' < /system/folder3/temp/temp1/text1.txt"
|
161 |
+
},
|
162 |
+
{
|
163 |
+
"query": "Remove regular files in the /system directory tree",
|
164 |
+
"gold": "find /system -type f -exec rm {} +",
|
165 |
+
"gold2": "find /system -type f -delete"
|
166 |
+
},
|
167 |
+
{
|
168 |
+
"query": "Print which files differ between /system/folder1 and /system/folder2.",
|
169 |
+
"gold": "diff -qr /system/folder1 /system/folder2 | sort",
|
170 |
+
"gold2": "diff -qr /system/folder1 /system/folder2"
|
171 |
+
},
|
172 |
+
{
|
173 |
+
"query": "Print amount of space available on the file system containing path to the /system directory in megabytes.",
|
174 |
+
"gold": "df -m /system",
|
175 |
+
"gold2": "df -m /system | grep / | tr -s ' ' | cut -d ' ' -f 4"
|
176 |
+
},
|
177 |
+
{
|
178 |
+
"query": "Display the number of sub-directories under /system",
|
179 |
+
"gold": "find /system -type d | wc -l",
|
180 |
+
"gold2": "tree -d /system | tail -n 1"
|
181 |
+
},
|
182 |
+
{
|
183 |
+
"query": "Archive all files in /system/folder1 directory modified in the last 60 days to \"/mytarfile.tgz\" with a time of 2023-01-01, owner of 0, and group of 0.",
|
184 |
+
"gold": "tar --mtime='2023-01-01' --owner=0 --group=0 -czf mytarfile.tgz `find /system/folder1 -mtime -60`",
|
185 |
+
"gold2": "tar --mtime='2023-01-01' --owner=0 --group=0 -czvf mytarfile.tgz `find /system/folder1 -mtime -60`"
|
186 |
+
},
|
187 |
+
{
|
188 |
+
"query": "Create a symbolc link in the /system/folder1 to root folder",
|
189 |
+
"gold": "ln /system/folder1 -s /",
|
190 |
+
"gold2": "ln -s /system/folder1 /"
|
191 |
+
},
|
192 |
+
{
|
193 |
+
"query": "Write the current date and time followed by \" 1\" to the console and append to \"/system/folder3/temp/empty.txt\"",
|
194 |
+
"gold": "echo $(date) \"1\" | tee -a /system/folder3/temp/empty.txt",
|
195 |
+
"gold2": "echo $(date +\"%Y-%m-%d~%H:%M:%S\") \"1\" | tee -a /system/folder3/temp/empty.txt"
|
196 |
+
},
|
197 |
+
{
|
198 |
+
"query": "Concatenate all .txt files residing in the /system tree into a single file \"/system/folder3/temp/concat.txt\"",
|
199 |
+
"gold": "find /system -name \"*.txt\" -not -name \"concat.txt\" -print -exec cat {} \\; > /system/folder3/temp/concat.txt",
|
200 |
+
"gold2": "find /system -type f -name \"*.txt\" -not -name \"concat.txt\" -print -exec cat {} \\; > /system/folder3/temp/concat.txt"
|
201 |
+
},
|
202 |
+
{
|
203 |
+
"query": "Compresses all the files in the /system folder with default depth to /backup using cpio.",
|
204 |
+
"gold": "find /system -depth -print | cpio -dump /backup",
|
205 |
+
"gold2": "find /system -print | cpio -dump /backup"
|
206 |
+
},
|
207 |
+
{
|
208 |
+
"query": "Copy all files in the /system directory except those containing 'text' to '/system/folder3/backup_dbg/backup'. Do not include subdirectories.",
|
209 |
+
"gold": "find /system -maxdepth 1 -type f ! -name '*text*' -exec cp {} /system/folder3/backup_dbg/backup \\;",
|
210 |
+
"gold2": "find /system -maxdepth 1 -print -type f ! -name '*text*' -exec cp {} /system/folder3/backup_dbg/backup \\;"
|
211 |
+
},
|
212 |
+
{
|
213 |
+
"query": "Rename \"/system/folder3/temp/temp1\" to \"/system/folder3/temp/temp1_old\"",
|
214 |
+
"gold": "mv /system/folder3/temp/temp1 /system/folder3/temp/temp1_old",
|
215 |
+
"gold2": "cp -r /system/folder3/temp/temp1 /system/folder3/temp/temp1_old && rm -r /system/folder3/temp/temp1"
|
216 |
+
},
|
217 |
+
{
|
218 |
+
"query": "Dump \"/system/text1.txt\" as ASCII characters",
|
219 |
+
"gold": "od -t c /system/text1.txt",
|
220 |
+
"gold2": "hexdump -C /system/text1.txt"
|
221 |
+
},
|
222 |
+
{
|
223 |
+
"query": "Create a compressed archive of /system/folder1 \"compress_folder1.tar.gz\" with a time of 2023-01-01, owner of 0, and group of 0.",
|
224 |
+
"gold": "tar --mtime='2023-01-01' --owner=0 --group=0 -zcf compress_folder1.tar.gz /system/folder1",
|
225 |
+
"gold2": "tar --mtime='2023-01-01' --owner=0 --group=0 -zcvf compress_folder1.tar.gz /system/folder1"
|
226 |
+
},
|
227 |
+
{
|
228 |
+
"query": "download content from \"http://example.com/textfile.txt\" and output to 'textfile.txt' in /system",
|
229 |
+
"gold": "curl http://example.com/textfile.txt -o /system/textfile.txt",
|
230 |
+
"gold2": "curl -vo /system/textfile.txt http://example.com/textfile.txt"
|
231 |
+
},
|
232 |
+
{
|
233 |
+
"query": "Search in /system downwards all files whose size is greater than 10 bytes.",
|
234 |
+
"gold": "find /system -size +10c -print",
|
235 |
+
"gold2": "find /system -type f -size +10c"
|
236 |
+
},
|
237 |
+
{
|
238 |
+
"query": "Calculate the md5sum of each \".txt\" file under \"/system\" and sort the output.",
|
239 |
+
"gold": "find /system -type f -name '*.txt' -exec md5sum {} + | awk '{print $1}' | sort",
|
240 |
+
"gold2": "find /system -type f -name \"*.txt\" -exec md5sum {} + | sort"
|
241 |
+
},
|
242 |
+
{
|
243 |
+
"query": "Search for the system host name in \"/etc/hosts\" and print the IP address in the first awk field",
|
244 |
+
"gold": "more /etc/hosts | grep `hostname` | awk '{print $1}'",
|
245 |
+
"gold2": "grep \"$(hostname)\" /etc/hosts | awk '{print $1}'"
|
246 |
+
}
|
247 |
+
]
|
nl2bash_fs_3.json
ADDED
@@ -0,0 +1,287 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[
|
2 |
+
{
|
3 |
+
"query": "Find files in /workspace directory modified within 30 days.",
|
4 |
+
"gold": "find /workspace -daystart -type f -mtime -30",
|
5 |
+
"gold2": "find /workspace -type f -mtime -30"
|
6 |
+
},
|
7 |
+
{
|
8 |
+
"query": "find files in the /workspace directory with pattern` *.c that larger than 1 Kilobytes",
|
9 |
+
"gold": "find /workspace -name '*.c' -size +1k -print",
|
10 |
+
"gold2": "find /workspace -name '*.c' -size +1k"
|
11 |
+
},
|
12 |
+
{
|
13 |
+
"query": "Find files in the /workspace directory and sub-directories, that changed over an hour ago.",
|
14 |
+
"gold": "find /workspace -type f -cmin +60",
|
15 |
+
"gold2": "find /workspace -type f -cmin +60 -print"
|
16 |
+
},
|
17 |
+
{
|
18 |
+
"query": "Find files in the /workspace directory and sub-directories, that were accessed over an hour ago.",
|
19 |
+
"gold": "find /workspace -type f -amin +60",
|
20 |
+
"gold2": "find /workspace -type f -amin +60 -print"
|
21 |
+
},
|
22 |
+
{
|
23 |
+
"query": "list all the drectories present in the /workspace directory and do not search in the sub directories.",
|
24 |
+
"gold": "find /workspace -maxdepth 1 -type d",
|
25 |
+
"gold2": "find /workspace -maxdepth 1 -type d"
|
26 |
+
},
|
27 |
+
{
|
28 |
+
"query": "list all the files in the /workspace directory which are of size 0 bytes.",
|
29 |
+
"gold": "find /workspace -empty",
|
30 |
+
"gold2": "find /workspace -empty -print"
|
31 |
+
},
|
32 |
+
{
|
33 |
+
"query": "list all zero-length files under the /workspace directory",
|
34 |
+
"gold": "find /workspace -empty -exec ls {} \\;",
|
35 |
+
"gold2": "find /workspace -type f -size 0"
|
36 |
+
},
|
37 |
+
{
|
38 |
+
"query": "locate and remove large files (> 1 KB) in /workspace",
|
39 |
+
"gold": "find /workspace -type f -size +1k -delete",
|
40 |
+
"gold2": "find /workspace -type f -size +1k -exec rm {} \\;"
|
41 |
+
},
|
42 |
+
{
|
43 |
+
"query": "List all the files in the /workspace directory which have only read permission to the group.",
|
44 |
+
"gold": "find /workspace -perm 400 -type f -exec ls -l {} \\;",
|
45 |
+
"gold2": "find /workspace -perm 400 -ls"
|
46 |
+
},
|
47 |
+
{
|
48 |
+
"query": "List all the files in the /workspace directory which have permissions 777.",
|
49 |
+
"gold": "find /workspace -perm 777 -type f -exec ls -l {} \\;",
|
50 |
+
"gold2": "find /workspace -perm 777 -ls"
|
51 |
+
},
|
52 |
+
{
|
53 |
+
"query": "List the details of all the text files in /workspace directory.",
|
54 |
+
"gold": "find /workspace -name \"*.txt\" -exec ls -ld {} \\;",
|
55 |
+
"gold2": "find /workspace -name \"*.txt\" | xargs ls -ld"
|
56 |
+
},
|
57 |
+
{
|
58 |
+
"query": "move all files in the /workspace folder to / and do not move the files in the sub folder",
|
59 |
+
"gold": "find /workspace -maxdepth 1 -type f -exec mv -t / {} +",
|
60 |
+
"gold2": "find /workspace -maxdepth 1 -type f -exec mv {} / \\;"
|
61 |
+
},
|
62 |
+
{
|
63 |
+
"query": "Move files in /workspace accessed less than one day ago to directory /.",
|
64 |
+
"gold": "find /workspace -atime -1 -type f -exec mv {} / \\;",
|
65 |
+
"gold2": "find /workspace -type f -atime -1 -print0 | xargs -0 -I {} mv {} /"
|
66 |
+
},
|
67 |
+
{
|
68 |
+
"query": "print all filenames of files under /workspace/dir1 dir containing 'hello', case-insensitive",
|
69 |
+
"gold": "find /workspace/dir1 -type f -exec grep -il 'hello' {} \\;",
|
70 |
+
"gold2": "grep -ril 'hello' /workspace/dir1"
|
71 |
+
},
|
72 |
+
{
|
73 |
+
"query": "print disk usage of files or folders in /workspace",
|
74 |
+
"gold": "du -sh /workspace",
|
75 |
+
"gold2": "du -h /workspace"
|
76 |
+
},
|
77 |
+
{
|
78 |
+
"query": "print the last word in /workspace/dir1/long.txt",
|
79 |
+
"gold": "tac /workspace/dir1/long.txt | awk 'NF{print $NF; exit}'",
|
80 |
+
"gold2": "awk '{ for (i=1; i<=NF; i++) last=$i } END { print last }' /workspace/dir1/long.txt"
|
81 |
+
},
|
82 |
+
{
|
83 |
+
"query": "Print the 3 largest directories in /workspace.",
|
84 |
+
"gold": "du -a /workspace | sort -nr | head -n 3",
|
85 |
+
"gold2": "find /workspace -exec du -h {} + | sort -rh | head -n 3"
|
86 |
+
},
|
87 |
+
{
|
88 |
+
"query": "prints first line of \"/workspace/dir1/long.txt\"",
|
89 |
+
"gold": "head -n1 /workspace/dir1/long.txt",
|
90 |
+
"gold2": "sed -n '1p' /workspace/dir1/long.txt"
|
91 |
+
},
|
92 |
+
{
|
93 |
+
"query": "prints the last non-empty line of \"/workspace/dir1/a.txt\"",
|
94 |
+
"gold": "tac /workspace/dir1/a.txt | grep -m 1 '.'",
|
95 |
+
"gold2": "awk 'NF' /workspace/dir1/a.txt | tail -n 1"
|
96 |
+
},
|
97 |
+
{
|
98 |
+
"query": "prune all the files in the /workspace directory",
|
99 |
+
"gold": "find /workspace -type f -delete",
|
100 |
+
"gold2": "find /workspace -type f -exec rm -f {} +"
|
101 |
+
},
|
102 |
+
{
|
103 |
+
"query": "search for all the files in the /workspace directory which have size greater than 1KB (approx) and less than 32KB(approx).",
|
104 |
+
"gold": "find /workspace -type f -size +1k -size -32k",
|
105 |
+
"gold2": "find /workspace -type f -size +1k -size -32k -print"
|
106 |
+
},
|
107 |
+
{
|
108 |
+
"query": "search for all the files in the /workspace folder and sort them in the order of their depth and display the file names",
|
109 |
+
"gold": "find /workspace -type f | awk -F/ '{print NF, $0}' | sort -n",
|
110 |
+
"gold2": "find /workspace -type f | awk -F/ '{print NF, $0}' | sort -n | cut -d' ' -f2-"
|
111 |
+
},
|
112 |
+
{
|
113 |
+
"query": "Search for all the files in the /workspace folder which are bigger than 1KB and display the biggest file.",
|
114 |
+
"gold": "find /workspace -type f -size +1k -exec ls -ls {} + | sort -n | tail -1",
|
115 |
+
"gold2": "find /workspace -type f -size +1k -exec ls -lh {} + | sort -k 5 -rh | head -n 1"
|
116 |
+
},
|
117 |
+
{
|
118 |
+
"query": "search for text files in the /workspace folder which do not have write access to others",
|
119 |
+
"gold": "find /workspace -type f \\( -iname \"*.txt\" -not -perm -o=w \\)",
|
120 |
+
"gold2": "find /workspace -type f -name \"*.txt\" ! -perm -o=w"
|
121 |
+
},
|
122 |
+
{
|
123 |
+
"query": "Search for the directory \"mysql\" in the workspace directory.",
|
124 |
+
"gold": "find /workspace -name mysql -type d",
|
125 |
+
"gold2": "find workspace -type d -name \"mysql\""
|
126 |
+
},
|
127 |
+
{
|
128 |
+
"query": "Print a list of all duplicate case insensitive filenames in the /workspace directory tree",
|
129 |
+
"gold": "find /workspace -type f | awk -F/ '{print $NF}' | sort -f | uniq -i -d",
|
130 |
+
"gold2": "find /workspace -type f | awk -F/ '{print tolower($NF)}' | sort | uniq -d"
|
131 |
+
},
|
132 |
+
{
|
133 |
+
"query": "Search for the file old2.txt in the /workspace folder and list its permissions and creation time.",
|
134 |
+
"gold": "find /workspace -name old2.txt | xargs ls -tl",
|
135 |
+
"gold2": "find /workspace -name old2.txt -print0 | xargs -0 ls -tl"
|
136 |
+
},
|
137 |
+
{
|
138 |
+
"query": "search for the word \"hello\" in all the regular/normal files in the /workspace folder and display the matched file name",
|
139 |
+
"gold": "find /workspace -type f | xargs grep -l \"hello\"",
|
140 |
+
"gold2": "grep -rnw '/workspace' -e 'hello'"
|
141 |
+
},
|
142 |
+
{
|
143 |
+
"query": "Calculate the md5 sum of all files in the /workspace directory with the filename printed first",
|
144 |
+
"gold": "find /workspace -type f -exec md5sum {} + | awk '{print $2 \" \" $1}'",
|
145 |
+
"gold2": "find /workspace -type f -print0 | xargs -0 md5sum | awk '{print $2 \" \" $1}'"
|
146 |
+
},
|
147 |
+
{
|
148 |
+
"query": "Calculate the md5 sum of all files in directory tree \"/workspace\"",
|
149 |
+
"gold": "find /workspace -type f -exec md5sum {} + | sort",
|
150 |
+
"gold2": "find /workspace -type f -exec md5sum {} +"
|
151 |
+
},
|
152 |
+
{
|
153 |
+
"query": "Count the number of unique 3 to 6 character file extensions are in the /workspace directory tree",
|
154 |
+
"gold": "find /workspace -type f -name '*.*' | awk -F. 'NF>1 {ext=tolower($NF); if (length(ext) >= 3 && length(ext) <= 6) print ext}' | sort | uniq -c | wc -l",
|
155 |
+
"gold2": "find /workspace -type f -name '*.*' | sed -n 's/.*\\.//p' | awk '{print tolower($0)}' | grep -E '^[a-z]{3,6}$' | sort -u | wc -l"
|
156 |
+
},
|
157 |
+
{
|
158 |
+
"query": "Create a copy of the /workspace directory structure in the /usr directory,",
|
159 |
+
"gold": "find /workspace -type d -print|sed 's@^@/usr/@'|xargs mkdir -p",
|
160 |
+
"gold2": "find /workspace -type d | cpio -pdm /usr"
|
161 |
+
},
|
162 |
+
{
|
163 |
+
"query": "Display a long listing of the oldest file under '/workspace' directory tree",
|
164 |
+
"gold": "find /workspace -type f -printf '%T+ %p\\n' | sort | head -n 1 | awk '{print $2}' | xargs ls -l",
|
165 |
+
"gold2": "find /workspace -type f -exec stat --format '%Y %n' {} \\; | sort -n | head -n 1 | cut -d' ' -f2- | xargs ls -l"
|
166 |
+
},
|
167 |
+
{
|
168 |
+
"query": "Find the largest 2 directories under /workspace directory",
|
169 |
+
"gold": "find /workspace -type d -print0 | xargs -0 du | sort -n | tail -2 | cut -f2 | xargs -I{} du -sh {}",
|
170 |
+
"gold2": "find /workspace -type d -print0 | xargs -0 du | sort -n | tail -2"
|
171 |
+
},
|
172 |
+
{
|
173 |
+
"query": "List all files with their paths that have identical content in /workspace directory",
|
174 |
+
"gold": "find /workspace -type f | xargs md5sum | sort | uniq -Dw32",
|
175 |
+
"gold2": "find /workspace -type f -print0 | xargs -0 md5sum | sort | uniq -w32 -D"
|
176 |
+
},
|
177 |
+
{
|
178 |
+
"query": "Make directories for each unique file path in \"/workspace/files.txt\"",
|
179 |
+
"gold": "cat /workspace/files.txt |xargs -I {} dirname \"{}\"| sort -u | xargs -I{} mkdir -p \"{}\"",
|
180 |
+
"gold2": "cat /workspace/files.txt | xargs -I {} dirname {}| sort -u | xargs -I{} mkdir -p \"{}\""
|
181 |
+
},
|
182 |
+
{
|
183 |
+
"query": "Print the total disk usage in bytes of all files listed in \"/workspace/files.txt\"",
|
184 |
+
"gold": "cat /workspace/files.txt | xargs du -b | tail -1 | awk '{print $1}'",
|
185 |
+
"gold2": "awk '{print $0}' /workspace/files.txt | xargs du -b | awk '{sum += $1} END {print sum}'"
|
186 |
+
},
|
187 |
+
{
|
188 |
+
"query": "Unhide all hidden files in the /workspace directory. Do not include subdirectories.",
|
189 |
+
"gold": "find /workspace -maxdepth 1 -type f -name '.*' -exec sh -c 'mv \"$0\" \"${0%/\\.*}/${0##*/.}\"' {} \\;",
|
190 |
+
"gold2": "find /workspace -maxdepth 1 -type f -name '.*' -exec sh -c 'mv \"$1\" \"${1%/\\.*}/${1##*/.}\"' _ {} \\;"
|
191 |
+
},
|
192 |
+
{
|
193 |
+
"query": "Count the number of differing lines in \"/workspace/dir1/long.txt\" and \"/workspace/dir1/terminate.txt\"",
|
194 |
+
"gold": "diff /workspace/dir1/long.txt /workspace/dir1/terminate.txt | grep ^[\\>\\<] | wc -l",
|
195 |
+
"gold2": "diff /workspace/dir1/long.txt /workspace/dir1/terminate.txt | grep '^>' | wc -l"
|
196 |
+
},
|
197 |
+
{
|
198 |
+
"query": "Count the number of differing lines in \"/workspace/dir1/terminate.txt\" and \"/workspace/dir1/long.txt\" with 0 lines of unified context",
|
199 |
+
"gold": "diff -U 0 /workspace/dir1/terminate.txt /workspace/dir1/long.txt | grep -v ^@ | wc -l",
|
200 |
+
"gold2": "diff -U 0 /workspace/dir1/terminate.txt /workspace/dir1/long.txt | grep -v '^@' | wc -l"
|
201 |
+
},
|
202 |
+
{
|
203 |
+
"query": "Counts lines in file /workspace/dir1/a.txt ignoring empty lines and lines with spaces only.",
|
204 |
+
"gold": "awk '!/^[[:space:]]*$/{++x} END{print x}' /workspace/dir1/a.txt",
|
205 |
+
"gold2": "grep -v '^[[:space:]]*$' /workspace/dir1/a.txt | wc -l"
|
206 |
+
},
|
207 |
+
{
|
208 |
+
"query": "Create a symbolic link in directory \"~/newlinks\" for each file listed in \"/workspace/results.txt\"",
|
209 |
+
"gold": "cat /workspace/results.txt | xargs -I{} ln -s {} ~/newlinks",
|
210 |
+
"gold2": "cat /workspace/results.txt | xargs -I {} ln -s {} ~/newlinks"
|
211 |
+
},
|
212 |
+
{
|
213 |
+
"query": "Delete all hidden files under /workspace",
|
214 |
+
"gold": "find /workspace -type f -name '.*' -delete",
|
215 |
+
"gold2": "find /workspace -type f -name '.*' -exec rm -f {} \\;"
|
216 |
+
},
|
217 |
+
{
|
218 |
+
"query": "Display a dump of \"/workspace/dir1/long.txt\" as floating point values of double size",
|
219 |
+
"gold": "od -t fD /workspace/dir1/long.txt",
|
220 |
+
"gold2": "od -An -t fD /workspace/dir1/long.txt"
|
221 |
+
},
|
222 |
+
{
|
223 |
+
"query": "Display differences between list of files in /workspace/dir1 and /workspace/dir2.",
|
224 |
+
"gold": "diff <(ls /workspace/dir1) <(ls /workspace/dir2)",
|
225 |
+
"gold2": "diff -qr /workspace/dir1 /workspace/dir2"
|
226 |
+
},
|
227 |
+
{
|
228 |
+
"query": "Display the file size of file '/workspace/dir1/sum.c' in bytes",
|
229 |
+
"gold": "du -sb /workspace/dir1/sum.c | cut -f1",
|
230 |
+
"gold2": "stat -c %s /workspace/dir1/sum.c"
|
231 |
+
},
|
232 |
+
{
|
233 |
+
"query": "Display the last slash-separated part of each filename path in /workspace/dir1/file.txt",
|
234 |
+
"gold": "rev /workspace/dir1/file.txt | cut -d/ -f1 | rev",
|
235 |
+
"gold2": "awk -F/ '{print $NF}' /workspace/dir1/file.txt"
|
236 |
+
},
|
237 |
+
{
|
238 |
+
"query": "Display the sizes and filepaths of all files/directories in /workspace directory sorted in descending order of size",
|
239 |
+
"gold": "du /workspace -a -h | sort -hr",
|
240 |
+
"gold2": "du -ah /workspace | sort -rh"
|
241 |
+
},
|
242 |
+
{
|
243 |
+
"query": "Print percentage of the space used on the /workspace directory.",
|
244 |
+
"gold": "df -k /workspace | tail -1 | awk '{print $5}'",
|
245 |
+
"gold2": "df -h /workspace | awk 'NR==2 {print $5}'"
|
246 |
+
},
|
247 |
+
{
|
248 |
+
"query": "Print the contents of \"/workspace/dir1/long.txt\" in reverse order",
|
249 |
+
"gold": "nl /workspace/dir1/long.txt | sort -nr | cut -b8-",
|
250 |
+
"gold2": "tac /workspace/dir1/long.txt"
|
251 |
+
},
|
252 |
+
{
|
253 |
+
"query": "Create an empty file \"Icon\" in workspace/ with a carriage return character in the end of its name.",
|
254 |
+
"gold": "echo $'workspace/Icon\\r' | xargs touch",
|
255 |
+
"gold2": "touch \"workspace/Icon\"$'\\r'"
|
256 |
+
},
|
257 |
+
{
|
258 |
+
"query": "Create a symbolc link in the /workspace/dir1 to root folder",
|
259 |
+
"gold": "ln /workspace/dir1 -s /",
|
260 |
+
"gold2": "ln -s /workspace/dir1 /"
|
261 |
+
},
|
262 |
+
{
|
263 |
+
"query": "Display permissions, user, group, and full path for each file in the /workspace directory tree",
|
264 |
+
"gold": "tree /workspace -p -u -g -f",
|
265 |
+
"gold2": "find /workspace -type f -exec stat --format '%A %U %G %N' {} \\;"
|
266 |
+
},
|
267 |
+
{
|
268 |
+
"query": "Search for 'hello' case insensitively in all files under /workspace directory tree and show the matched lines with their filenames",
|
269 |
+
"gold": "find /workspace -type f -print0 | xargs -0 grep -iH \"hello\"",
|
270 |
+
"gold2": "grep -ri 'hello' /workspace"
|
271 |
+
},
|
272 |
+
{
|
273 |
+
"query": "Unpack all *.gz archives in the /workspace directory tree",
|
274 |
+
"gold": "find /workspace -name '*.gz' -print0 | xargs -0 gunzip",
|
275 |
+
"gold2": "find /workspace -type f -name '*.gz' -exec gunzip {} +"
|
276 |
+
},
|
277 |
+
{
|
278 |
+
"query": "Uncompress \"/workspace/archive.tar.gz\" and extract the archive to \"/backup\"",
|
279 |
+
"gold": "gzip -dc /workspace/archive.tar.gz | tar -xf - -C /backup",
|
280 |
+
"gold2": "tar -xzvf /workspace/archive.tar.gz -C /backup"
|
281 |
+
},
|
282 |
+
{
|
283 |
+
"query": "Create a symbolic link to \"/workspace/dir1/terminate.txt\" named \"/workspace/test\"",
|
284 |
+
"gold": "ln /workspace/dir1/terminate.txt /workspace/test",
|
285 |
+
"gold2": "ln -s /workspace/dir1/terminate.txt /workspace/test"
|
286 |
+
}
|
287 |
+
]
|
nl2bash_fs_4.json
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[
|
2 |
+
{
|
3 |
+
"query": "Retrieve only build number of current kernel, ie. #104",
|
4 |
+
"gold": "uname -v | grep -o '#[0-9]\\+'",
|
5 |
+
"gold2": "uname -r | awk -F'-' '{print $2}'"
|
6 |
+
},
|
7 |
+
{
|
8 |
+
"query": "Print reverse lookup for adress 127.0.0.1",
|
9 |
+
"gold": "dig -x 127.0.0.1",
|
10 |
+
"gold2": "nslookup 127.0.0.1"
|
11 |
+
},
|
12 |
+
{
|
13 |
+
"query": "List file information of the full path of command \"grep\"",
|
14 |
+
"gold": "ls -ald `which grep`",
|
15 |
+
"gold2": "stat $(which grep)"
|
16 |
+
},
|
17 |
+
{
|
18 |
+
"query": "Extract host name part from \"http://www.google.com\"",
|
19 |
+
"gold": "echo \"http://www.google.com\" | cut -d'/' -f3",
|
20 |
+
"gold2": "echo \"http://www.google.com\" | sed -E 's|https?://([^/]+).*|\\1|'"
|
21 |
+
},
|
22 |
+
{
|
23 |
+
"query": "List environment variables and their values, escaping all semicolons with a backslash.",
|
24 |
+
"gold": "env | sed 's/;/\\\\;/g'",
|
25 |
+
"gold2": "while IFS= read -r line; do echo \"${line//;/\\\\;}\"; done < <(env)"
|
26 |
+
},
|
27 |
+
{
|
28 |
+
"query": "Displays a tree of all process alongside their command line arguments.",
|
29 |
+
"gold": "pstree -a",
|
30 |
+
"gold2": "ps -eo pid,ppid,cmd --forest"
|
31 |
+
},
|
32 |
+
{
|
33 |
+
"query": "Create intermediate directories \"dir\" and \"subdir\" as required and create \"subsubdir\"",
|
34 |
+
"gold": "mkdir -p dir/subdir/subsubdir",
|
35 |
+
"gold2": "mkdir -p dir/subdir/subsubdir"
|
36 |
+
},
|
37 |
+
{
|
38 |
+
"query": "Print numbers 1 through 10 separated by \":\"",
|
39 |
+
"gold": "yes | head -n10 | grep -n . | cut -d: -f1 | paste -sd:",
|
40 |
+
"gold2": "echo $(seq -s \":\" 1 10)"
|
41 |
+
},
|
42 |
+
{
|
43 |
+
"query": "print all readline bindings",
|
44 |
+
"gold": "bind -P",
|
45 |
+
"gold2": "bind -P"
|
46 |
+
},
|
47 |
+
{
|
48 |
+
"query": "list names of bind functions containing \"p\"",
|
49 |
+
"gold": "bind -l | grep p",
|
50 |
+
"gold2": "bind -l | egrep 'p'"
|
51 |
+
},
|
52 |
+
{
|
53 |
+
"query": "Save first IP address of domain 'google.com' in 'address' variable and display it",
|
54 |
+
"gold": "address=$(dig +short google.com | grep -E '^[0-9.]+$' | head -n 1) && echo $address",
|
55 |
+
"gold2": "address=$(dig +short google.com | grep -m 1 '^[0-9]' | head -n 1) && echo $address"
|
56 |
+
},
|
57 |
+
{
|
58 |
+
"query": "Remove all characters except \";\" and digits from the string \" Hello world;876\t \"",
|
59 |
+
"gold": "echo ' Hello world;876\t ' | tr -cd ';0-9'",
|
60 |
+
"gold2": "echo \" Hello world;876 \" | sed 's/[^0-9;]//g'"
|
61 |
+
},
|
62 |
+
{
|
63 |
+
"query": "Remove leading and trailing spaces or tabs from \" Hello world!\t \"",
|
64 |
+
"gold": "echo ' Hello world!\t ' | sed -e 's/^[ \\t]*//' | sed -e 's/[ \\t]*$//'",
|
65 |
+
"gold2": "echo -n \" Hello world! \" | sed 's/^[ \\t]*//;s/[ \\t]*$//'"
|
66 |
+
},
|
67 |
+
{
|
68 |
+
"query": "Remove the last 3 characters from \"987654321\"",
|
69 |
+
"gold": "echo 987654321 | rev | cut -c 4- | rev",
|
70 |
+
"gold2": "echo \"987654321\" | sed 's/...$//'"
|
71 |
+
},
|
72 |
+
{
|
73 |
+
"query": "Print source of the file system containing current working directory.",
|
74 |
+
"gold": "df . | tail -1 | awk '{print $1}'",
|
75 |
+
"gold2": "df -P . | awk 'NR==2 {print $1}'"
|
76 |
+
},
|
77 |
+
{
|
78 |
+
"query": "List all variables (names only) with names containing \"H\".",
|
79 |
+
"gold": "env | awk -F= '{if($1 ~ /H/) print $1}'",
|
80 |
+
"gold2": "env | grep '^[^=]*H[^=]*=' | awk -F= '{print $1}'"
|
81 |
+
},
|
82 |
+
{
|
83 |
+
"query": "Print a list of unique users who are logged in",
|
84 |
+
"gold": "who | cut -d' ' -f1 | sort | uniq",
|
85 |
+
"gold2": "who | awk '{print $1}' | sort | uniq"
|
86 |
+
},
|
87 |
+
{
|
88 |
+
"query": "ping 192.168.1.1",
|
89 |
+
"gold": "ping -w 1 192.168.1.1",
|
90 |
+
"gold2": "ping -w 1 192.168.1.1"
|
91 |
+
},
|
92 |
+
{
|
93 |
+
"query": "Print a line of 99 '=' characters",
|
94 |
+
"gold": "seq -s= 100|tr -d '[:digit:]'",
|
95 |
+
"gold2": "printf '=%.0s' {1..99}"
|
96 |
+
},
|
97 |
+
{
|
98 |
+
"query": "Count number of users logged in",
|
99 |
+
"gold": "who | awk -F' ' '{print $1}' | sort -u | wc -l",
|
100 |
+
"gold2": "who | wc -l"
|
101 |
+
},
|
102 |
+
{
|
103 |
+
"query": "Displays calendar of a previous, current and next month for December of 2120 year.",
|
104 |
+
"gold": "cal -3 12 2120",
|
105 |
+
"gold2": "cal -3 12 2120"
|
106 |
+
},
|
107 |
+
{
|
108 |
+
"query": "Extract, sort and print only group names from /etc/group.",
|
109 |
+
"gold": "cut -d: -f1 /etc/group | sort",
|
110 |
+
"gold2": "cut -d: -f1 /etc/group | sort | uniq"
|
111 |
+
},
|
112 |
+
{
|
113 |
+
"query": "Calculate the sum of all the numbers from 1 to 10",
|
114 |
+
"gold": "seq 10 | jq -s 'add'",
|
115 |
+
"gold2": "echo $(( (10 * (10 + 1)) / 2 ))"
|
116 |
+
}
|
117 |
+
]
|
nl2bash_fs_5.json
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[
|
2 |
+
{
|
3 |
+
"query": "Count the number of files and directories in the entire testbed directory",
|
4 |
+
"gold": "find /testbed | wc -l",
|
5 |
+
"gold2": "find /testbed -print | wc -l"
|
6 |
+
},
|
7 |
+
{
|
8 |
+
"query": "Print the number of python files in the testbed directory.",
|
9 |
+
"gold": "find testbed -type f -name \"*.py\" | wc -l",
|
10 |
+
"gold2": "find testbed -type f -name \"*.py\" -print | wc -l"
|
11 |
+
},
|
12 |
+
{
|
13 |
+
"query": "Sort the lines of textfile1.txt in reverse alphabetical order and save the result to a new file",
|
14 |
+
"gold": "sort -r /testbed/dir1/textfile1.txt > /testbed/dir1/textfile1_reverse_sorted.txt",
|
15 |
+
"gold2": "sort -r /testbed/dir1/textfile1.txt > /testbed/dir1/textfile1_reverse_sorted.txt"
|
16 |
+
},
|
17 |
+
{
|
18 |
+
"query": "Search for all files containing the word 'Shell' in testbed.",
|
19 |
+
"gold": "find /testbed -type f -exec grep -l 'Shell' {} +",
|
20 |
+
"gold2": "grep -r 'Shell' /testbed"
|
21 |
+
},
|
22 |
+
{
|
23 |
+
"query": "Find all symbolic links in the testbed directory.",
|
24 |
+
"gold": "find /testbed -type l",
|
25 |
+
"gold2": "find /testbed -type l -print"
|
26 |
+
},
|
27 |
+
{
|
28 |
+
"query": "Get the total size of all files in testbed/ and save it to total_size.txt",
|
29 |
+
"gold": "du -sh testbed/ | awk '{print $1}' > total_size.txt",
|
30 |
+
"gold2": "du -s testbed/ | awk '{print $1}' > total_size.txt"
|
31 |
+
},
|
32 |
+
{
|
33 |
+
"query": "List all files in the directory /testbed/dir1 and sort them by size in human-readable format",
|
34 |
+
"gold": "ls -lhS /testbed/dir1",
|
35 |
+
"gold2": "ls -lhS /testbed/dir1"
|
36 |
+
},
|
37 |
+
{
|
38 |
+
"query": "Count the number of lines in files under the directory /testbed/dir2.",
|
39 |
+
"gold": "grep -rl . /testbed/dir2 | xargs wc -l",
|
40 |
+
"gold2": "find /testbed/dir2 -type f -exec wc -l {} +"
|
41 |
+
},
|
42 |
+
{
|
43 |
+
"query": "Print the name and size of the 3 largest files in the directory /testbed/dir3",
|
44 |
+
"gold": "find /testbed/dir3 -type f -exec ls -lhS {} + | sort -rh -k5 | head -n 3",
|
45 |
+
"gold2": "find /testbed/dir3 -type f -exec ls -lhS {} + 2>/dev/null | sort -rh -k5 | head -n 3"
|
46 |
+
},
|
47 |
+
{
|
48 |
+
"query": "Find all files modified in the last 2 hours and compress them into a tarball named archive.tar.gz in the directory /testbed",
|
49 |
+
"gold": "find /testbed -type f -mmin -120 -print0 | xargs -0 tar -czf /testbed/archive.tar.gz",
|
50 |
+
"gold2": "find /testbed -type f -mmin -120 -print0 | xargs -0 tar -czf /testbed/archive.tar.gz"
|
51 |
+
},
|
52 |
+
{
|
53 |
+
"query": "List all subdirectories of /testbed that are not named subdir1",
|
54 |
+
"gold": "ls -d /testbed/*/ | grep -v /subdir1/",
|
55 |
+
"gold2": "find /testbed -mindepth 1 -maxdepth 1 -type d ! -name \"subdir1\""
|
56 |
+
},
|
57 |
+
{
|
58 |
+
"query": "Search for all files that contain the string 'text file' under the directory /testbed",
|
59 |
+
"gold": "grep -r 'text file' /testbed",
|
60 |
+
"gold2": "grep -rl 'text file' /testbed"
|
61 |
+
},
|
62 |
+
{
|
63 |
+
"query": "Compute the MD5 hash of all files under the directory /testbed and store them in a file named hashes.txt in the same directory",
|
64 |
+
"gold": "find /testbed -type f -exec md5sum {} + > /testbed/hashes.txt",
|
65 |
+
"gold2": "find /testbed -type f -exec md5sum {} + > /testbed/hashes.txt"
|
66 |
+
},
|
67 |
+
{
|
68 |
+
"query": "Print the last 10 lines of the file /testbed/dir3/subdir1/subsubdir1/textfile3.txt",
|
69 |
+
"gold": "tail -n 10 /testbed/dir3/subdir1/subsubdir1/textfile3.txt",
|
70 |
+
"gold2": "tail -n 10 /testbed/dir3/subdir1/subsubdir1/textfile3.txt"
|
71 |
+
},
|
72 |
+
{
|
73 |
+
"query": "Print the line number and contents of all lines containing the string 'value3' in the file /testbed/dir1/subdir1/jsonfile1.json",
|
74 |
+
"gold": "grep -n 'value3' /testbed/dir1/subdir1/jsonfile1.json",
|
75 |
+
"gold2": "grep -n 'value3' /testbed/dir1/subdir1/jsonfile1.json"
|
76 |
+
},
|
77 |
+
{
|
78 |
+
"query": "Find all files in the directory /testbed that have been modified in the last 24 hours and print their path",
|
79 |
+
"gold": "find /testbed -type f -mtime -1 -print",
|
80 |
+
"gold2": "find /testbed -type f -mtime -1"
|
81 |
+
},
|
82 |
+
{
|
83 |
+
"query": "Search for all the files in /testbed directory and its subdirectories that contain the word 'Hello' and replace it with 'Hi' in-place.",
|
84 |
+
"gold": "grep -rl \"Hello\" /testbed | xargs sed -i 's/Hello/Hi/g'",
|
85 |
+
"gold2": "grep -rl 'Hello' /testbed | xargs sed -i 's/Hello/Hi/g'"
|
86 |
+
},
|
87 |
+
{
|
88 |
+
"query": "Display the contents of textfile3.txt and textfile4.txt side by side, with line numbers and a separator between them.",
|
89 |
+
"gold": "paste <(nl /testbed/dir3/subdir1/subsubdir1/textfile3.txt) <(nl /testbed/dir1/subdir1/textfile4.txt)",
|
90 |
+
"gold2": "paste <(nl /testbed/dir3/subdir1/subsubdir1/textfile3.txt) <(nl /testbed/dir1/subdir1/textfile4.txt)"
|
91 |
+
}
|
92 |
+
]
|