westenfelder commited on
Commit
13012a9
1 Parent(s): 6aba9f5

Upload 6 files

Browse files
Files changed (6) hide show
  1. README.md +12 -0
  2. nl2bash_fs_1.json +242 -0
  3. nl2bash_fs_2.json +214 -0
  4. nl2bash_fs_3.json +242 -0
  5. nl2bash_fs_4.json +110 -0
  6. test_queries.json +99 -0
README.md ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # NL2Bash Dataset Transformation
2
+ * [Link](https://github.com/TellinaTool/nl2bash) to NL2Bash.
3
+
4
+ ## Dataset Description
5
+ This dataset consists of 200 natural language to bash command `[query, gold]` pairs acquired from the NL2Bash dataset.
6
+ To ensure that the `gold` solutions to each query are non-trivial, entities such as folders and files have been renamed in both `query` and `gold` in order to ground the solution in a file system.
7
+
8
+ To this end, we also create four different file systems for a more diverse evaluation setting:
9
+ * [fs_1](nl2bash_fs_1.json) has 60 queries based on the file system defined in [setup_fs_1](../../docker/bash_scripts/setup_nl2b_fs_1.sh)
10
+ * [fs_2](nl2bash_fs_1.json) has 53 queries based on the file system defined in [setup_fs_2](../../docker/bash_scripts/setup_nl2b_fs_2.sh)
11
+ * [fs_3](nl2bash_fs_3.json) has 60 queries based on the file system defined in [setup_fs_3](../../docker/bash_scripts/setup_nl2b_fs_3.sh)
12
+ * [fs_4](nl2bash_fs_4.json) has 27 general bash queries that are not grounded to any specific file system
nl2bash_fs_1.json ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ },
6
+ {
7
+ "query": "Calculate md5 sum of the md5 sum of all the sorted files under /testbed/dir2/subdir2",
8
+ "gold": "find /testbed/dir2/subdir2 -type f -print0 | sort -z | xargs -r0 md5sum | md5sum"
9
+ },
10
+ {
11
+ "query": "Calculate the md5 sum of the contents of the sorted list of files \"$FILES\"",
12
+ "gold": "cat $(echo $FILES | sort) | md5sum"
13
+ },
14
+ {
15
+ "query": "Calculate the md5 sum of the md5 sum of all the files sorted under /testbed/dir2/subdir2",
16
+ "gold": "find testbed/dir2/subdir2 -type f -print0 | sort -z | xargs -r0 md5sum | md5sum"
17
+ },
18
+ {
19
+ "query": "Calculate the md5 sum of the sorted list of md5 sums of all \".py\" files under /testbed/dir1/subdir1",
20
+ "gold": "find /testbed/dir1/subdir1 -type f -name *.py -exec md5sum {} + | awk '{print $1}' | sort | md5sum"
21
+ },
22
+ {
23
+ "query": "Calculate the md5sum of each \".py\" file under /testbed/dir1/subdir1, sort the output, and calculate the md5sum of that",
24
+ "gold": "find /testbed/dir1/subdir1 -type f -name \"*.py\" -exec md5sum {} + | awk '{print $1}' | sort | md5sum"
25
+ },
26
+ {
27
+ "query": "Calculate the total disk usage for each \".txt\" file on the /testbed directory and prepend the system host name to the output",
28
+ "gold": "find /testbed / -iname '*.txt' -exec du -s {} + | sed 's/^/$(hostname): /'"
29
+ },
30
+ {
31
+ "query": "Change directory to the directory containing the executable file of command \"python\"",
32
+ "gold": "cd $(which python | xargs dirname)"
33
+ },
34
+ {
35
+ "query": "Change permissions for all PHP files under the /testbed directory tree to 755 and print the number of files changed",
36
+ "gold": "find /testbed -name \"*.php\" -exec chmod 755 {} \\; -exec /bin/echo {} \\; | wc -l"
37
+ },
38
+ {
39
+ "query": "Check if current shell is running within a 'screen' process.",
40
+ "gold": "pstree --show-parents -p $$ | head -n 1 | sed 's/\\(.*\\)+.*/\\1/' | wc -l"
41
+ },
42
+ {
43
+ "query": "Check if the contents of file /testbed/dir3/subdir1/subsubdir1/textfile3.txt is a subset of file /testbed/dir2/subdir1/textfile2.txt",
44
+ "gold": "comm -23 <(sort /testbed/dir3/subdir1/subsubdir1/textfile3.txt | uniq) <(sort /testbed/dir2/subdir1/textfile2.txt | uniq) | head -1"
45
+ },
46
+ {
47
+ "query": "Compress in parallel regular files in the testbed directory tree that were last modified more than 7 days ago",
48
+ "gold": "find /testbed -type f -mtime +7 | tee compressedP.list | xargs -I{} -P10 compress {} &"
49
+ },
50
+ {
51
+ "query": "Compress regular files in the testbed directory tree that were last modified more than 7 days ago",
52
+ "gold": "find /testbed -type f -mtime +7 | tee compressedP.list | xargs -0 gzip"
53
+ },
54
+ {
55
+ "query": "Compute the mean average of the word count of *.txt files in the /testbed directory",
56
+ "gold": "find /testbed -name '*.txt' -print0 | xargs -0 wc -w | awk 'END { print $1/(NR-1) }'"
57
+ },
58
+ {
59
+ "query": "Compute the mean average of the word count of *.txt files smaller than 2000 words in the /testbed directory",
60
+ "gold": "find /testbed -name '*.txt' -print0 | xargs -0 wc -w | awk '$1 < 2000 {v += $1; c++} END {print v/c}'"
61
+ },
62
+ {
63
+ "query": "Copies all files with \"FooBar\" in the path under the '/testbed/dir1' directory to the '/testbed/dir3/subdir1/subsubdir1/tmp' directory.",
64
+ "gold": "find /testbed -name '*FooBar*' -print0 | xargs -0 -I{} cp -R {} /testbed/dir3/subdir1/subsubdir1/tmp"
65
+ },
66
+ {
67
+ "query": "Construction with additional '-exec true' to be used if both commands need to run regardless of their success or failure.",
68
+ "gold": "find /testbed -name \"*.txt\" \\( -exec echo {} \\; -o -exec true \\; \\) -exec grep banana {} \\;"
69
+ },
70
+ {
71
+ "query": "Convert the first 16 characters in \"/testbed/textfile7.txt\" to a single hexadecimal value",
72
+ "gold": "head /testbed/textfile7.txt -c16 | od -tx1 -w16 | head -n1 | cut -d' ' -f2- | tr -d ' '"
73
+ },
74
+ {
75
+ "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.",
76
+ "gold": "find /testbed -name \"file.txt\"| grep \"FooBar\" | xargs -i cp -p \"{}\" ."
77
+ },
78
+ {
79
+ "query": "Copy all files below the /testbed directory whose names contain \"FooBar\" to directory '/testbed/dir3/subdir1/subsubdir1/tmp'",
80
+ "gold": "find /testbed -name '*FooBar*' -print0 | xargs -0 -I{} cp -R {} /testbed/dir3/subdir1/subsubdir1/tmp"
81
+ },
82
+ {
83
+ "query": "Count all the lines of all '*.c' files in /testbed directory recursively",
84
+ "gold": "find /testbed -name \"*.c\" -print0 | xargs -0 cat | wc -l"
85
+ },
86
+ {
87
+ "query": "Count all the lines of all files with names ending with 'php' in current directory recursively",
88
+ "gold": "find -name '*php' | xargs cat | wc -l"
89
+ },
90
+ {
91
+ "query": "Count all the lines of all php files in the /testbed directory recursively",
92
+ "gold": "find /testbed/ -name '*.php' | xargs cat | wc -l"
93
+ },
94
+ {
95
+ "query": "Count all the lines of code in all php files in the /testbed directory recursively",
96
+ "gold": "find /testbed -name \"*.php\" -type f -exec grep -v -c '^$' {} + | awk '{ cnt += $0 } END { print cnt }'"
97
+ },
98
+ {
99
+ "query": "Count md5sum of all '*.py' files in /testbed folder with subfolders.",
100
+ "gold": "find /testbed -type f -name \"*.py\" -exec md5sum {} + | awk '{print $1}' | sort | md5sum"
101
+ },
102
+ {
103
+ "query": "Count the *.html files residing in the /testbed directory tree and containing string \"foo\"",
104
+ "gold": "find /testbed -name \"*.html\" | xargs grep -l foo | wc -l"
105
+ },
106
+ {
107
+ "query": "Count the number of files named 'job.history' under '/testbed' directory tree that match 'FAIL' in their contents",
108
+ "gold": "find /testbed -name job.history | xargs grep -l FAIL | wc -l"
109
+ },
110
+ {
111
+ "query": "Count the number of files/directories with '.php' extension under /testbed directory tree and change the permissions to 755",
112
+ "gold": "find /testbed -name \"*.php\" -exec chmod 755 {} \\; -exec /bin/echo {} \\; | wc -l"
113
+ },
114
+ {
115
+ "query": "Count the number of lines in all \".php\" files in the /testbed directory tree",
116
+ "gold": "find /testbed -name '*.php' -type f | xargs cat | wc -l"
117
+ },
118
+ {
119
+ "query": "Count the number of lines in all files in the /testbed directory tree that match pattern 'foo??'",
120
+ "gold": "find /testbed/ -name 'foo??' | sort | xargs wc -l"
121
+ },
122
+ {
123
+ "query": "Count the number of regular files in directory tree ${DIRECTORY} that contain a vowel in their names",
124
+ "gold": "find ${DIRECTORY} -type f -print | sed -e 's@^.*/@@' | grep '[aeiouyAEIOUY]' | wc -l"
125
+ },
126
+ {
127
+ "query": "Count the number of unique file extensions in the /testbed directory tree",
128
+ "gold": "find /testbed -type f | sed -e 's/.*\\.//' | sed -e 's/.*\\///' | sort | uniq -c | sort -rn"
129
+ },
130
+ {
131
+ "query": "Count the total number of lines in all \"*.gz\" files in the /testbed directory tree after decompression",
132
+ "gold": "find /testbed -type f -name '*.gz' | xargs zcat | wc -l"
133
+ },
134
+ {
135
+ "query": "Counts all files in the /testbed folder and subfolders.",
136
+ "gold": "find /testbed -type f -exec ls -l {} \\; | wc -l"
137
+ },
138
+ {
139
+ "query": "Count lines in each *.php file sorted by file in /testbed directory.",
140
+ "gold": "find /testbed -name '*.php' -type f | sort | xargs wc -l"
141
+ },
142
+ {
143
+ "query": "Counts lines in each *.php file in /testbed directory, sorted by number of lines, descending.",
144
+ "gold": "find /testbed -name '*.php' -type f | xargs wc -l | sort -nr"
145
+ },
146
+ {
147
+ "query": "Counts lines in each of *.php files in the /testbed folder and subfolders and prints total count.",
148
+ "gold": "find /testbed -name '*.php' | awk '{print $0}' |xargs wc -l"
149
+ },
150
+ {
151
+ "query": "Counts lines in each of *.php files in the /testbed folder with subfolders and prints total count as well.",
152
+ "gold": "find /testbed -name '*.php' | xargs wc -l | sort -r"
153
+ },
154
+ {
155
+ "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.",
156
+ "gold": "cat /etc/networks | sort | uniq -c | sort -nr | awk '{print $2 $1}'"
157
+ },
158
+ {
159
+ "query": "Counts sum of non-empty lines from all .php files in /testbed folder.",
160
+ "gold": "find /testbed -name \"*.php\" -type f -exec grep -v -c '^$' {} + | awk '{ cnt += $0 } END { print cnt }'"
161
+ },
162
+ {
163
+ "query": "Counts total lines in all *.php files in the /testbed directory recursively",
164
+ "gold": "find /testbed -name '*.php' -type f | xargs cat | wc -l"
165
+ },
166
+ {
167
+ "query": "Counts total number of only lines with alphanumeric symbols in all *.php files in the /testbed folder and subfolders.",
168
+ "gold": "find /testbed -name '*.php' | xargs cat | awk '/[a-zA-Z0-9]/ {i++} END{print i}'"
169
+ },
170
+ {
171
+ "query": "Counts total lines in PHP and JS files in /testbed.",
172
+ "gold": "find /testbed -name '*.js' -or -name '*.php' | xargs wc -l | grep 'total' | awk '{print $1}'"
173
+ },
174
+ {
175
+ "query": "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.",
176
+ "gold": "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/"
177
+ },
178
+ {
179
+ "query": "Create an empty file \"abc.txt\" in each directory named \"dir1\" under testbed directory.",
180
+ "gold": "find /testbed -type d -name \"dir1\" -print | sed 's/$/\\/abc.txt/g' | xargs touch"
181
+ },
182
+ {
183
+ "query": "Create archive \"/backup1.tar\" of all subdirectories of the /testbed directory without the prefix \"testbed\"",
184
+ "gold": "find /testbed -mindepth 1 -maxdepth 1 -type d | xargs tar czf /backup1.tar --transform 's,^testbed/,,'"
185
+ },
186
+ {
187
+ "query": "Create logs.tar.gz of all older than one day logs of Ubuntu",
188
+ "gold": "find /var/log/ -mtime +1 | xargs tar -czvPf /testbed/logs.tar.gz"
189
+ },
190
+ {
191
+ "query": "Delete and count files in \"/testbed/dir3/subdir1/subsubdir1/tmp\" that are older than 2 days",
192
+ "gold": "find /testbed/dir3/subdir1/subsubdir1/tmp -type f -mtime +2 -print0 | xargs -0 rm -f"
193
+ },
194
+ {
195
+ "query": "Display the 5 largest files in the /testbed directory and its sub-directories.",
196
+ "gold": "find /testbed -type f -exec ls -s {} \\; | sort -n -r | head -5"
197
+ },
198
+ {
199
+ "query": "Display the 5 smallest files in the /testbed directory and its sub-directories ignoring any empty files.",
200
+ "gold": "find /testbed -not -empty -type f -exec ls -s {} \\; | sort -n | head -5"
201
+ },
202
+ {
203
+ "query": "Display the 5 smallest files in the /testbed directory and its sub-directories.",
204
+ "gold": "find /testbed -type f -exec ls -s {} \\; | sort -n | head -5"
205
+ },
206
+ {
207
+ "query": "Display the biggest file sizes only in the /testbed directory",
208
+ "gold": "find /testbed -type f -exec du -Sh {} + | sort -rh | head -n 5"
209
+ },
210
+ {
211
+ "query": "Find .java files in the testbed directory tree that contain 'Hello', and print their names",
212
+ "gold": "find /testbed -name \"*.java\" -exec grep -Hin Hello {} + | cut -d \":\" -f 1 | xargs -I{} basename {}"
213
+ },
214
+ {
215
+ "query": "Print a list of all duplicate case insensitive filenames in the /testbed directory tree",
216
+ "gold": "find /testbed -type f | awk -F/ '{print $NF}' | sort -f | uniq -i -d"
217
+ },
218
+ {
219
+ "query": "Print all unique file paths under \"testbed/dir1\" compared to \"testbed/dir2\"",
220
+ "gold": "comm -23 <(find /testbed/dir1 | sed 's#/testbed/dir1/##' | sort) <(find /testbed/dir2 | sed 's#/testbed/dir2/##' | sort) | sed 's#^#/testbed/dir1/#'"
221
+ },
222
+ {
223
+ "query": "Recursively finds all files containing text 'Hello' and prints folder where they are placed.",
224
+ "gold": "grep -r Hello * | awk '{split($1, path, \":\"); print path[1]}' | xargs -I{} dirname {}"
225
+ },
226
+ {
227
+ "query": "Prints total number of lines of all *.java files in /testbed folder and subfolders.",
228
+ "gold": "find /testbed -name '*.java' -print0 |xargs -0 wc -l|grep 'total' |awk '{ print $1 }'"
229
+ },
230
+ {
231
+ "query": "Create a symbolc link in the /testbed/dir3/subdir1/subsubdir1/FooBar to root folder",
232
+ "gold": "ln /testbed/dir3/subdir1/subsubdir1/FooBar -s /"
233
+ },
234
+ {
235
+ "query": "search for all the files in the folder /testbed/dir1 which have sticky bit set and have the permissions 553",
236
+ "gold": "find /testbed/dir1 -perm 553"
237
+ },
238
+ {
239
+ "query": "search for php files in /testbed directory and search for \"world\" in all these files",
240
+ "gold": "find /testbed -name '*.php' -exec grep -iq \"world\" {} \\; -print"
241
+ }
242
+ ]
nl2bash_fs_2.json ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ },
6
+ {
7
+ "query": "Recursively finds all files with whole word \"foo\" in the '/system', and precedes found string with its number in file.",
8
+ "gold": "grep -rnw /system -e \"foo\""
9
+ },
10
+ {
11
+ "query": "Recursively list contents of the '/system' directory in a tree-like format",
12
+ "gold": "tree /system"
13
+ },
14
+ {
15
+ "query": "Recursively print all files and directories in the '/system/folder2' directory tree including hidden files",
16
+ "gold": "tree -a /system/folder2"
17
+ },
18
+ {
19
+ "query": "Recursively prints all folders in the '/system' folder that contain files like \"*.out\".",
20
+ "gold": "find /system -name \"*.out\" -print0 | xargs -0 -n1 /system | sort --unique"
21
+ },
22
+ {
23
+ "query": "Recursively remove all \"*.txt\" files in the '/system' folder and answer \"y\" to any prompt",
24
+ "gold": "yes y | rm -r /system/*.txt"
25
+ },
26
+ {
27
+ "query": "Recursively removes all empty folders from the /system/folder3/temp folder.",
28
+ "gold": "find /system/folder3/temp -depth -type d -exec rmdir {} \\;"
29
+ },
30
+ {
31
+ "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.",
32
+ "gold": "find /system/folder3/temp -type d -empty -exec rmdir -vp --ignore-fail-on-non-empty {} +"
33
+ },
34
+ {
35
+ "query": "Recursively removes all files in the /system/folder1 folder but '*txt' files.",
36
+ "gold": "find /system/folder1 -type f -not -name '*txt' | xargs rm"
37
+ },
38
+ {
39
+ "query": "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.",
40
+ "gold": "find /system/folder1 -type f -exec rename 's/special/regular/' '{}' \\;"
41
+ },
42
+ {
43
+ "query": "Recursively search for \"foo\" in the '/system' folder and write the output to the console followed by the number of matched lines",
44
+ "gold": "grep -r \"foo\" /system | tee >(wc -l)"
45
+ },
46
+ {
47
+ "query": "Recursively search for all regular files below directory \"/system/folder3/\", and output the name of each, without any containing directories.",
48
+ "gold": "find /system/folder3/ -type f -exec basename {} \\;"
49
+ },
50
+ {
51
+ "query": "Recursively unzip files to stdout in \"/system/folder2.tar.gz\" and search for \"special\"",
52
+ "gold": "zcat -r /system/folder2.tar.gz | grep \"special\""
53
+ },
54
+ {
55
+ "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",
56
+ "gold": "cat /system/folder3/temp/temp1/text1.txt | sed 's/\\r$//' | od -c"
57
+ },
58
+ {
59
+ "query": "Remove all *.doc files from the /system/folder1 tree",
60
+ "gold": "find /system/folder1 -name '*.doc' -exec rm \"{}\" \\;"
61
+ },
62
+ {
63
+ "query": "Remove all *.log files from the /system/folder1 tree",
64
+ "gold": "find /system/folder1 -name '*.log' -print0 | xargs -0 rm"
65
+ },
66
+ {
67
+ "query": "Remove all *.txt files in '/system' directory but not in it's subdirectories",
68
+ "gold": "find /system -maxdepth 1 -name '*.txt' -maxdepth 1 | xargs rm"
69
+ },
70
+ {
71
+ "query": "Remove all *.sql files in the '/system/folder3/backup_dbg' directory that were last modified more than 25 days ago",
72
+ "gold": "find /system/folder3/backup_dbg/*.sql -mtime +25 -exec rm -f {} \\;"
73
+ },
74
+ {
75
+ "query": "Remove all *.txt files under the /system/folder1 directory modified more than 5 minutes ago",
76
+ "gold": "find /system/folder1 -maxdepth 1 -mmin +5 -type f -name \"*.txt\" -delete"
77
+ },
78
+ {
79
+ "query": "Remove all *.txt files, except \"keep.txt\", under /system/folder1 directory modified more than 5 minutes ago",
80
+ "gold": "find /system/folder1 -maxdepth 1 -mmin +5 -type f -name \"*.txt\" ! -name \"keep.txt\" -delete"
81
+ },
82
+ {
83
+ "query": "Remove all .sh files in the '/system/folder1' tree whose names begin with \"new\"",
84
+ "gold": "find /system/folder1 -name 'new*.sh' -exec rm -f '{}' \\;"
85
+ },
86
+ {
87
+ "query": "Remove all a.out, *.o, and core files under the '/system' directory",
88
+ "gold": "find /system \\( -name a.out -o -name '*.o' -o -name 'core' \\) -exec rm {} \\;"
89
+ },
90
+ {
91
+ "query": "Remove all but 5 last comma-separated fields from each line in '/system/folder1/data.csv'",
92
+ "gold": "cat /system/folder1/data.csv | rev | cut -d, -f-5 | rev"
93
+ },
94
+ {
95
+ "query": "Remove all directories called \"temp\" from the /system directory tree",
96
+ "gold": "find /system -name \"temp\" -type f -delete"
97
+ },
98
+ {
99
+ "query": "Remove all empty files in /system/folder3/temp and below",
100
+ "gold": "find /system/folder3/temp -type f -empty -print | xargs rm -f"
101
+ },
102
+ {
103
+ "query": "Remove all files 'a.out' and *.o in the /system directory tree that were modified more than 7 days ago",
104
+ "gold": "find /system \\( -name a.out -o -name '*.o' \\) -mtime +7 -exec rm {} \\;"
105
+ },
106
+ {
107
+ "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'",
108
+ "gold": "find /system/folder3/temp \\( -name '.DS_Store' -or -name '._.DS_Store' -or -name '._*' -or -name '.TemporaryItems' -or -name '.apdisk' \\) -exec rm -rf {} \\;"
109
+ },
110
+ {
111
+ "query": "Remove empty directories from directory tree /system",
112
+ "gold": "find /system -type d -empty -exec rm -r {} \\;"
113
+ },
114
+ {
115
+ "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",
116
+ "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"
117
+ },
118
+ {
119
+ "query": "Remove files text2, text3, text4 in directory /system/folder1",
120
+ "gold": "find /system/folder1 -name 'text[2-4]' -exec rm {} \\;"
121
+ },
122
+ {
123
+ "query": "Remove files from the /system directory that are owned by nobody",
124
+ "gold": "find /system -nouser -exec rm {} +"
125
+ },
126
+ {
127
+ "query": "Remove files that are greater than 1KB in size under /system directory",
128
+ "gold": "find /system -type f -size +1k -exec rm {} +"
129
+ },
130
+ {
131
+ "query": "Remove junk files modified more than 31 days ago recursively from \"/system\"",
132
+ "gold": "find /system -type f -mtime +31 -exec rm -f {} \\;"
133
+ },
134
+ {
135
+ "query": "Remove newline characters from \"/system/folder3/temp/temp1/text1.txt\"",
136
+ "gold": "paste -sd \"\" /system/folder3/temp/temp1/text1.txt"
137
+ },
138
+ {
139
+ "query": "Remove regular files in the /system directory tree",
140
+ "gold": "find /system -type f -print0 | xargs -0 -n1 echo rm | sh -x"
141
+ },
142
+ {
143
+ "query": "Print summary of new/missing files, and which files differ between /system/folder1 and /system/folder2, sorted alphabetically.",
144
+ "gold": "diff -qr /system/folder1 /system/folder1 | sort"
145
+ },
146
+ {
147
+ "query": "Print amount of space available on the file system containing path to the /system directory in megabytes.",
148
+ "gold": "df /system -B MB | tail -1 | awk {'print $4'} | grep .[0-9]*"
149
+ },
150
+ {
151
+ "query": "Recursively find the latest modified file in the /system directory",
152
+ "gold": "find /system -type f | xargs ls -ltr | tail -n 1"
153
+ },
154
+ {
155
+ "query": "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",
156
+ "gold": "find /system -type d -ls | awk '{print $4 - 2, $NF}' | sort -rn | head"
157
+ },
158
+ {
159
+ "query": "archive all files in /system/folder1 directory modified in the last 60 days to \"/mytarfile.tgz\"",
160
+ "gold": "tar czvf mytarfile.tgz `find /system/folder1 -mtime -60`"
161
+ },
162
+ {
163
+ "query": "Create a symbolc link in the /system/folder1 to root folder",
164
+ "gold": "ln /system/folder1 -s /"
165
+ },
166
+ {
167
+ "query": "Remove files in the /system directory tree modified more than 31 days ago recursively",
168
+ "gold": "find /system -type f -mtime +31 -print0 | xargs -0 -r rm -f"
169
+ },
170
+ {
171
+ "query": "Write the current date and time followed by \" 1\" to the console and append to \"/system/folder3/temp/empty.txt\"",
172
+ "gold": "echo $(date) \"1\" | tee -a /system/folder3/temp/empty.txt"
173
+ },
174
+ {
175
+ "query": "Concatenate all .txt files residing in the /system tree into a single file \"/system/folder3/temp/empty.txt\"",
176
+ "gold": "find /system -name \"*.txt\" -exec cat {} \\; > /system/folder3/temp/empty.txt"
177
+ },
178
+ {
179
+ "query": "compresses all the files in the /system folder with default depth to /backup",
180
+ "gold": "find /system -depth -print | cpio -dump /backup"
181
+ },
182
+ {
183
+ "query": "Copy all files in the /system directory except those containing 'text' to '/system/folder3/backup_dbg/backup'.",
184
+ "gold": "find /system -maxdepth 1 -type f -name '*text*' -exec cp {} /system/folder3/backup_dbg/backup \\;"
185
+ },
186
+ {
187
+ "query": "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",
188
+ "gold": "mv /system/folder3/temp/temp1 /system/folder3/temp/temp1_old -b -S .old"
189
+ },
190
+ {
191
+ "query": "Dump \"/system/text1.txt\" as ASCII characters",
192
+ "gold": "od -t c /system/text1.txt"
193
+ },
194
+ {
195
+ "query": "create a compressed archive of /system/folder1 \"compress_folder1.tar.gz\" with verbose output",
196
+ "gold": "tar -zcvf compress_folder1.tar.gz /system/folder1"
197
+ },
198
+ {
199
+ "query": "download content from \"http://example.com/textfile.txt\" and output to 'textfile.txt' in /system",
200
+ "gold": "curl http://example.com/textfile.txt -o /system/textfile.txt"
201
+ },
202
+ {
203
+ "query": "Search in /system downwards all files whose size is 10 bytes ( Characters ) .",
204
+ "gold": "find /system -size 10c -print"
205
+ },
206
+ {
207
+ "query": "Calculate the md5sum of each \".txt\" file under \"/system\", sort the output, and calculate the md5sum of that",
208
+ "gold": "find /system -type f -name '*.txt' -exec md5sum {} + | awk '{print $1}' | sort | md5sum"
209
+ },
210
+ {
211
+ "query": "Search for the system host name in \"/etc/hosts\" and print the IP address in the first awk field",
212
+ "gold": "more /etc/hosts | grep `hostname` | awk '{print $1}'"
213
+ }
214
+ ]
nl2bash_fs_3.json ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "query": "find files in /workspace directory which are modified 30 days ago",
4
+ "gold": "find /workspace -daystart -type f -mtime -30"
5
+ },
6
+ {
7
+ "query": "find files in the /workspace directory with pattern` *.c that larger than 1 Kilobytes",
8
+ "gold": "find /workspace -name '*.c' -size +1k -print"
9
+ },
10
+ {
11
+ "query": "find files in the /workspace directory and sub-directories, that changed within last hour",
12
+ "gold": "find /workspace -cmin -60"
13
+ },
14
+ {
15
+ "query": "find files in the /workspace directory and sub-directories, that were accessed within last hour",
16
+ "gold": "find /workspace -amin -60"
17
+ },
18
+ {
19
+ "query": "list all the drectories present in the /workspace directory and do not search in the sub directories.",
20
+ "gold": "find /workspace -maxdepth 1 -type d"
21
+ },
22
+ {
23
+ "query": "list all the files in the /workspace directory which are of size 0 bytes.",
24
+ "gold": "find /workspace -empty"
25
+ },
26
+ {
27
+ "query": "list all zero-length files under the /workspace directory",
28
+ "gold": "find /workspace -empty -exec ls {} \\;"
29
+ },
30
+ {
31
+ "query": "locate and remove large files (> 1 KB) in /workspace",
32
+ "gold": "find /workspace -type f -size +1k -delete"
33
+ },
34
+ {
35
+ "query": "long list al the files in the /workspace directory which have only read permission to the group",
36
+ "gold": "find /workspace -perm 400 -type f -exec ls -l {} \\;"
37
+ },
38
+ {
39
+ "query": "long list al the files in the /workspace directory which have all the permissions",
40
+ "gold": "find /workspace -perm 777 -type f -exec ls -l {} \\;"
41
+ },
42
+ {
43
+ "query": "long list the details of all the shell scripts in /workspace directory",
44
+ "gold": "find /workspace -name \"*.sh\" -exec ls -ld {} \\;"
45
+ },
46
+ {
47
+ "query": "move all files in the /workspace folder to / and do not move the files in the sub folder",
48
+ "gold": "find /workspace -maxdepth 1 -type f -exec mv -t / {} +"
49
+ },
50
+ {
51
+ "query": "move files in /workspace accessed more than one day ago to directory /",
52
+ "gold": "find /workspace -atime +1 -type f -exec mv {} / \\;"
53
+ },
54
+ {
55
+ "query": "print all filenames of files under /workspace/dir1 dir containing 'hello', case-insensitive",
56
+ "gold": "find /workspace/dir1 -type f -exec grep -il 'hello' {} \\;"
57
+ },
58
+ {
59
+ "query": "print disk usage of files or folders in /workspace",
60
+ "gold": "du -sh /workspace"
61
+ },
62
+ {
63
+ "query": "print the last word in /workspace/dir1/long.txt",
64
+ "gold": "tac /workspace/dir1/long.txt | awk 'NF{print $NF; exit}'"
65
+ },
66
+ {
67
+ "query": "print top 3 largest files and /workspace",
68
+ "gold": "du -a /workspace | sort -nr | head -3"
69
+ },
70
+ {
71
+ "query": "prints first line of \"/workspace/dir1/long.txt\"",
72
+ "gold": "head -n1 /workspace/dir1/long.txt"
73
+ },
74
+ {
75
+ "query": "prints the last non-empty line of \"/workspace/dir1/a.txt\"",
76
+ "gold": "tac /workspace/dir1/a.txt | grep -m 1 '.'"
77
+ },
78
+ {
79
+ "query": "prune all the files in the /workspace directory",
80
+ "gold": "find /workspace -prune"
81
+ },
82
+ {
83
+ "query": "search for all the files in the /workspace directory which have size greater than 1KB (approx) and less than 32KB(approx).",
84
+ "gold": "find /workspace -size +1000c -size -32000c -print"
85
+ },
86
+ {
87
+ "query": "search for all the files in the /workspace folder and sort them in the order of their depth and display the file names",
88
+ "gold": "find /workspace -type d -printf '%d\\t%P\\n' | sort -r -nk1 | cut -f2-"
89
+ },
90
+ {
91
+ "query": "search for all the files in the /workspace folder which are bigger than 1KB and display them biggest file",
92
+ "gold": "find /workspace -size +1k -exec ls -ls {} \\+ | sort -n | tail -1"
93
+ },
94
+ {
95
+ "query": "search for text files in the /workspace folder which do not have write access to others",
96
+ "gold": "find /workspace -type f \\( -iname \"*.txt\" -not -perm -o=w \\)"
97
+ },
98
+ {
99
+ "query": "search for the directory \"mysql\" in the entire file system",
100
+ "gold": "find /workspace -name mysql -type d"
101
+ },
102
+ {
103
+ "query": "Print a list of all duplicate case insensitive filenames in the /workspace directory tree",
104
+ "gold": "find /workspace -type f | awk -F/ '{print $NF}' | sort -f | uniq -i -d"
105
+ },
106
+ {
107
+ "query": "search for the file foo in the /workspace folder and display a long listing of it in sorted order of modification date",
108
+ "gold": "find /workspace -name foo | xargs ls -tl"
109
+ },
110
+ {
111
+ "query": "search for the word \"hello\" in all the regular/normal files in the /workspace folder and display the matched file name",
112
+ "gold": "find /workspace -type f | xargs grep -l \"hello\""
113
+ },
114
+ {
115
+ "query": "Calculate the md5 sum of all files in the /workspace directory with the filename printed first",
116
+ "gold": "ls -p | grep -v /workspace | xargs md5sum | awk '{print $2,$1}'"
117
+ },
118
+ {
119
+ "query": "Calculate the md5 sum of the contents of all files sorted in directory tree \"/workspace\"",
120
+ "gold": "find /workspace -type f | sort -u | xargs cat | md5sum"
121
+ },
122
+ {
123
+ "query": "Change directory to the alphabetically last path under the /workspace directory",
124
+ "gold": "cd $(find /workspace -type d -print0 | sort -z | tr '\\0' '\\n' | tail -1)"
125
+ },
126
+ {
127
+ "query": "Count the number of unique 3 to 6 character file extensions are in the /workspace directory tree",
128
+ "gold": "find /workspace -type f -name \"*.*\" | grep -o -E \"\\.[^\\.]+$\" | grep -o -E \"[[:alpha:]]{3,6}\" | awk '{print tolower($0)}' | sort | uniq -c | sort -rn"
129
+ },
130
+ {
131
+ "query": "Create a copy of the /workspace directory structure in the /usr directory,",
132
+ "gold": "find /workspace -type d -print|sed 's@^@/usr/@'|xargs mkdir -p"
133
+ },
134
+ {
135
+ "query": "Display a long listing of the oldest file under '/workspace' directory tree",
136
+ "gold": "find /workspace -printf \"%T@ %p\\n\" | sort -n | head -1 | cut -d\" \" -f2- | xargs ls -al"
137
+ },
138
+ {
139
+ "query": "Find the largest 2 directories under /workspace directory",
140
+ "gold": "find /workspace -type d -print0 | xargs -0 du | sort -n | tail -2 | cut -f2 | xargs -I{} du -sh {}"
141
+ },
142
+ {
143
+ "query": "List all files with their paths that have identical content in /workspace directory",
144
+ "gold": "find /workspace -type f | xargs md5sum | sort | uniq -Dw32"
145
+ },
146
+ {
147
+ "query": "Make directories for each unique file path in \"/workspace/files.txt\"",
148
+ "gold": "cat /workspace/files.txt |xargs -I {} dirname \"{}\"| sort -u | xargs -I{} mkdir -p \"{}\""
149
+ },
150
+ {
151
+ "query": "Print the total disk usage in bytes of all files listed in \"/workspace/files.txt\"",
152
+ "gold": "cat /workspace/files.txt | xargs du -c | tail -1 | awk '{print $1}'"
153
+ },
154
+ {
155
+ "query": "Unhide all hidden files in the /workspace directory",
156
+ "gold": "find /workspace -maxdepth 1 -type f -name '.*' -exec sh -c 'mv \"$0\" \"${0%/\\.*}/${0##*/.}\"' {} \\;"
157
+ },
158
+ {
159
+ "query": "Count the number of differing lines in \"/workspace/dir1/long.txt\" and \"/workspace/dir1/terminate.txt\"",
160
+ "gold": "diff /workspace/dir1/long.txt /workspace/dir1/terminate.txt | grep ^[\\>\\<] | wc -l"
161
+ },
162
+ {
163
+ "query": "Count the number of differing lines in \"/workspace/dir1/terminate.txt\" and \"/workspace/dir1/long.txt\" with 0 lines of unified context",
164
+ "gold": "diff -U 0 /workspace/dir1/terminate.txt /workspace/dir1/long.txt | grep -v ^@ | wc -l"
165
+ },
166
+ {
167
+ "query": "Counts lines in file /workspace/dir1/a.txt ignoring empty lines and lines with spaces only.",
168
+ "gold": "awk '!/^[[:space:]]*$/{++x} END{print x}' /workspace/dir1/a.txt"
169
+ },
170
+ {
171
+ "query": "Create a symbolic link in directory \"~/newlinks\" for each file listed in \"/workspace/results.txt\"",
172
+ "gold": "cat /workspace/results.txt | xargs -I{} ln -s {} ~/newlinks"
173
+ },
174
+ {
175
+ "query": "Delete all hidden files under /workspace",
176
+ "gold": "find /workspace -type f -name '.*' -delete"
177
+ },
178
+ {
179
+ "query": "Determine if /workspace/dir2/mysql/ exists on a mounted file system.",
180
+ "gold": "df /workspace/dir2/mysql/"
181
+ },
182
+ {
183
+ "query": "Display a dump of \"/workspace/dir1/long.txt\" as floating point values of double size",
184
+ "gold": "od -t fD /workspace/dir1/long.txt"
185
+ },
186
+ {
187
+ "query": "Display differences between list of files in /workspace/dir1 and /workspace/dir2.",
188
+ "gold": "diff <(ls /workspace/dir1) <(ls /workspace/dir2)"
189
+ },
190
+ {
191
+ "query": "Display the file size of file '/workspace/dir1/sum.c' in bytes",
192
+ "gold": "du -sb /workspace/dir1/sum.c | cut -f1"
193
+ },
194
+ {
195
+ "query": "Display the last slash-separated part of each filename path in /workspace/dir1/file.txt",
196
+ "gold": "rev /workspace/dir1/file.txt | cut -d/ -f1 | rev"
197
+ },
198
+ {
199
+ "query": "Display the sizes and filepaths of all files/directories in /workspace directory sorted in descending order of size",
200
+ "gold": "du /workspace -a -h --max-depth=1 | sort -hr"
201
+ },
202
+ {
203
+ "query": "Print percentage of the space used on the /workspace directory.",
204
+ "gold": "df -k /workspace | tail -1 | awk '{print $5}'"
205
+ },
206
+ {
207
+ "query": "Print the contents of \"/workspace/dir1/long.txt\" in reverse order",
208
+ "gold": "nl /workspace/dir1/long.txt | sort -nr | cut -b8-"
209
+ },
210
+ {
211
+ "query": "Create an empty file \"Icon\" with a carriage return character in the end of its name.",
212
+ "gold": "echo $'Icon\\r' | xargs touch"
213
+ },
214
+ {
215
+ "query": "Create a symbolc link in the /workspace/dir1 to root folder",
216
+ "gold": "ln /workspace/dir1 -s /"
217
+ },
218
+ {
219
+ "query": "Display permissions, user, group, and full path for each file in the /workspace directory tree",
220
+ "gold": "tree /workspace -p -u -g -f"
221
+ },
222
+ {
223
+ "query": "Search for 'hello' case insensitively in all files under /workspace directory tree and show the matched lines with their filenames",
224
+ "gold": "find /workspace -type f -print0 | xargs -0 grep -iH \"hello\""
225
+ },
226
+ {
227
+ "query": "Split the output of \"/workspace/archive.tar.gz\" into files of at most 10 MiB in size and use prefix \"output_prefix\"",
228
+ "gold": "tar -xf /workspace/archive.tar.gz | split -b 10M -d - /output_prefix"
229
+ },
230
+ {
231
+ "query": "Unpack all *.gz archives in the /workspace directory tree",
232
+ "gold": "find /workspace -name '*.gz' -print0 | xargs -0 gunzip"
233
+ },
234
+ {
235
+ "query": "Uncompress \"/workspace/archive.tar.gz\" and extract the archive to \"/backup\"",
236
+ "gold": "gzip -dc /workspace/archive.tar.gz | tar -xf - -C /backup"
237
+ },
238
+ {
239
+ "query": "Create a symbolic link to \"/workspace/dir1/terminate.txt\" named \"/workspace/test\"",
240
+ "gold": "ln /workspace/dir1/terminate.txt /workspace/test"
241
+ }
242
+ ]
nl2bash_fs_4.json ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "query": "Retrieve only build number of current kernel, ie. #104",
4
+ "gold": "uname -v | grep -o '#[0-9]\\+'"
5
+ },
6
+ {
7
+ "query": "Print reverse lookup for adress 127.0.0.1",
8
+ "gold": "dig -x 127.0.0.1"
9
+ },
10
+ {
11
+ "query": "List file information of the full path of command \"c++\"",
12
+ "gold": "ls -ald `which c++`"
13
+ },
14
+ {
15
+ "query": "Extract host name part from \"http://www.google.com\"",
16
+ "gold": "echo \"http://www.google.com\" | cut -d'/' -f3"
17
+ },
18
+ {
19
+ "query": "List environment variables and their values, escaping all semicolons with a backslash.",
20
+ "gold": "env | sed 's/;/\\\\;/g'"
21
+ },
22
+ {
23
+ "query": "Displays a tree of all process alongside their command line arguments.",
24
+ "gold": "pstree -a"
25
+ },
26
+ {
27
+ "query": "Create intermediate directories \"dir\" and \"subdir\" as required and create \"subsubdir\"",
28
+ "gold": "mkdir -p dir/subdir/subsubdir"
29
+ },
30
+ {
31
+ "query": "Change to the directory of the executable \"python\"",
32
+ "gold": "cd `dirname $(which python)`"
33
+ },
34
+ {
35
+ "query": "Print numbers 1 through 10 separated by \":\"",
36
+ "gold": "yes | head -n10 | grep -n . | cut -d: -f1 | paste -sd:"
37
+ },
38
+ {
39
+ "query": "print all readline bindings",
40
+ "gold": "bind -P"
41
+ },
42
+ {
43
+ "query": "list names of bind functions containing \"p\"",
44
+ "gold": "bind -l | grep p"
45
+ },
46
+ {
47
+ "query": "List all files on smbfs mounts",
48
+ "gold": "mount -v | grep smbfs | awk '{print $3}' | xargs ls -ls"
49
+ },
50
+ {
51
+ "query": "Save first IP address of domain 'google.com' in 'address' variable and display it",
52
+ "gold": "address=$(dig +short google.com | grep -E '^[0-9.]+$' | head -n 1) && echo $address"
53
+ },
54
+ {
55
+ "query": "Remove all characters except \";\" and digits from the string \" Hello world;876\t \"",
56
+ "gold": "echo ' Hello world;876\t ' | tr -cd ';0-9'"
57
+ },
58
+ {
59
+ "query": "Remove leading and trailing spaces or tabs from \" Hello world!\t \"",
60
+ "gold": "echo ' Hello world!\t ' | sed -e 's/^[ \\t]*//' | sed -e 's/[ \\t]*$//'"
61
+ },
62
+ {
63
+ "query": "Remove the last 3 characters from \"987654321\"",
64
+ "gold": "echo 987654321 | rev | cut -c 4- | rev"
65
+ },
66
+ {
67
+ "query": "Print source of the file system containing current working directory.",
68
+ "gold": "df . | tail -1 | awk '{print $1}'"
69
+ },
70
+ {
71
+ "query": "List all variables (names only) with names containing \"H\".",
72
+ "gold": "env | awk -F= '{if($1 ~ /H/) print $1}'"
73
+ },
74
+ {
75
+ "query": "Print a list of unique users who are logged in",
76
+ "gold": "who | cut -d' ' -f1 | sort | uniq"
77
+ },
78
+ {
79
+ "query": "Ping hostname, grep for 192.168.11 and print the IP from the output",
80
+ "gold": "ping -c 1 hostname | grep 192.168.11 | grep 'bytes from' | awk '{print $4}' | sed 's/://g'"
81
+ },
82
+ {
83
+ "query": "Print a line of 99 '=' characters",
84
+ "gold": "seq -s= 100|tr -d '[:digit:]'"
85
+ },
86
+ {
87
+ "query": "Counts all business days in a current month.",
88
+ "gold": "cal -h | cut -c 4-17 | tail -n +3 | wc -w"
89
+ },
90
+ {
91
+ "query": "Count number of users logged in",
92
+ "gold": "who | awk -F' ' '{print $1}' | sort -u | wc -l"
93
+ },
94
+ {
95
+ "query": "Displays calendar of a previous, current and next month for December of 2120 year.",
96
+ "gold": "cal -3 12 2120"
97
+ },
98
+ {
99
+ "query": "Extract, sort and print only group names from /etc/group.",
100
+ "gold": "cut -d: -f1 /etc/group | sort"
101
+ },
102
+ {
103
+ "query": "Store system load average number in the 'proc_load_average' variable and print it.",
104
+ "gold": "proc_load_average=$(w | head -n 1 | awk '{print $NF}' | tr ',' '.') && echo $proc_load_average"
105
+ },
106
+ {
107
+ "query": "Calculate the sum of all the numbers from 1 to 10",
108
+ "gold": "seq 10 | jq -s 'add'"
109
+ }
110
+ ]
test_queries.json ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "query": "Count the number of files and directories in the entire testbed directory",
4
+ "gold": "find /testbed | wc -l"
5
+ },
6
+ {
7
+ "query": "Find all text files in the testbed directory and subdirectories and concatenate them into a single file",
8
+ "gold": "find /testbed -type f -name '*.txt' -exec cat {} ; > /testbed/concatenated_text_files.txt"
9
+ },
10
+ {
11
+ "query": "Find all directories in the testbed directory that have at least one Python script and list the number of Python scripts in each directory",
12
+ "gold": "find /testbed -type d -exec sh -c 'echo -n \"{}: \"; ls -1 {}/*.py 2>/dev/null | wc -l' \\;"
13
+ },
14
+ {
15
+ "query": "Sort the lines of textfile1.txt in reverse alphabetical order and save the result to a new file",
16
+ "gold": "sort -r /testbed/dir1/textfile1.txt > /testbed/dir1/textfile1_reverse_sorted.txt"
17
+ },
18
+ {
19
+ "query": "Search for all files containing the word 'error' and sort them by size",
20
+ "gold": "find testbed/ -type f -exec grep -l 'error' {} + | xargs du -b | sort -n"
21
+ },
22
+ {
23
+ "query": "Find all symbolic links in testbed/ that point to files which were modified in the last 7 days",
24
+ "gold": "find testbed/ -type l -lname '*testbed/*' -mtime -7 -ls"
25
+ },
26
+ {
27
+ "query": "Get the total size of all files in testbed/ and save it to a file",
28
+ "gold": "find testbed/ -type f -printf '%s\\n' | awk '{s+=$1} END {print s}' > total_size.txt"
29
+ },
30
+ {
31
+ "query": "Find all PNG files in testbed/ and convert them to JPEG with a quality of 90%",
32
+ "gold": "find testbed/ -name '*.png' -exec convert -quality 90 {} {}.jpg \\;"
33
+ },
34
+ {
35
+ "query": "List all files in the directory /testbed/dir1 and sort them by size in human-readable format",
36
+ "gold": "ls -lhS /testbed/dir1"
37
+ },
38
+ {
39
+ "query": "Count the number of lines in all text files under the directory /testbed/dir2",
40
+ "gold": "grep -rl . /testbed/dir2 | xargs wc -l"
41
+ },
42
+ {
43
+ "query": "Print the name and size of the 3 largest files in the directory /testbed/dir3",
44
+ "gold": "du -a /testbed/dir3 | sort -rn | head -n 3"
45
+ },
46
+ {
47
+ "query": "Find all empty directories in the directory /testbed and delete them",
48
+ "gold": "find /testbed -type d -empty -delete"
49
+ },
50
+ {
51
+ "query": "Rename all files with extension .txt under the directory /testbed to have a .md extension instead",
52
+ "gold": "find /testbed -type f -name '*.txt' -exec rename .txt .md {} +"
53
+ },
54
+ {
55
+ "query": "Find all files modified in the last 2 hours and compress them into a tarball named archive.tar.gz in the directory /testbed",
56
+ "gold": "find /testbed -type f -mmin -120 -print0 | xargs -0 tar -czf /testbed/archive.tar.gz"
57
+ },
58
+ {
59
+ "query": "List all subdirectories of /testbed that are not named subdir1",
60
+ "gold": "ls -d /testbed/*/ | grep -v /subdir1/"
61
+ },
62
+ {
63
+ "query": "Search for all files that contain the string 'text file' in their name or content under the directory /testbed",
64
+ "gold": "grep -r 'text file' /testbed"
65
+ },
66
+ {
67
+ "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",
68
+ "gold": "find /testbed -type f -exec md5sum {} + > /testbed/hashes.txt"
69
+ },
70
+ {
71
+ "query": "Print the last 10 lines of the file /testbed/dir3/subdir1/subsubdir1/textfile3.txt",
72
+ "gold": "tail -n 10 /testbed/dir3/subdir1/subsubdir1/textfile3.txt"
73
+ },
74
+ {
75
+ "query": "Find all symbolic links under the directory /testbed and print their target path",
76
+ "gold": "find /testbed -type l -printf '%p -> %l\n'"
77
+ },
78
+ {
79
+ "query": "Print the line number and contents of all lines containing the string 'value3' in the file /testbed/dir1/subdir1/jsonfile1.json",
80
+ "gold": "grep -n 'value3' /testbed/dir1/subdir1/jsonfile1.json"
81
+ },
82
+ {
83
+ "query": "Find all files in the directory /testbed that have been modified in the last 24 hours and print their path",
84
+ "gold": "find /testbed -type f -mtime -1 -print"
85
+ },
86
+ {
87
+ "query": "Display the contents of jsonfile1.json in a prettified JSON format using a third-party tool 'jq'",
88
+ "gold": "cat /testbed/dir1/subdir1/jsonfile1.json | jq ."
89
+ },
90
+ {
91
+ "query": "Search for all the files in /testbed directory and its subdirectories that contain the word 'Hello' and replace it with 'Hi' in-place.",
92
+ "gold": "grep -rl \"Hello\" /testbed | xargs sed -i 's/Hello/Hi/g'"
93
+ },
94
+ {
95
+ "query": "Display the contents of textfile3.txt and textfile4.txt side by side, with line numbers and a separator between them.",
96
+ "gold": "paste -d \"\t\" - -s < /testbed/dir3/subdir1/subsubdir1/textfile3.txt < /testbed/dir1/subdir1/textfile4.txt"
97
+ }
98
+ ]
99
+