[ { "query": "Find files in /workspace directory modified within 30 days.", "gold": "find /workspace -daystart -type f -mtime -30", "gold2": "find /workspace -type f -mtime -30" }, { "query": "find files in the /workspace directory with pattern` *.c that larger than 1 Kilobytes", "gold": "find /workspace -name '*.c' -size +1k -print", "gold2": "find /workspace -name '*.c' -size +1k" }, { "query": "Find files in the /workspace directory and sub-directories, that changed over an hour ago.", "gold": "find /workspace -type f -cmin +60", "gold2": "find /workspace -type f -cmin +60 -print" }, { "query": "Find files in the /workspace directory and sub-directories, that were accessed over an hour ago.", "gold": "find /workspace -type f -amin +60", "gold2": "find /workspace -type f -amin +60 -print" }, { "query": "list all the drectories present in the /workspace directory and do not search in the sub directories.", "gold": "find /workspace -maxdepth 1 -type d", "gold2": "find /workspace -maxdepth 1 -type d" }, { "query": "list all the files in the /workspace directory which are of size 0 bytes.", "gold": "find /workspace -empty", "gold2": "find /workspace -empty -print" }, { "query": "list all zero-length files under the /workspace directory", "gold": "find /workspace -empty -exec ls {} \\;", "gold2": "find /workspace -type f -size 0" }, { "query": "locate and remove large files (> 1 KB) in /workspace", "gold": "find /workspace -type f -size +1k -delete", "gold2": "find /workspace -type f -size +1k -exec rm {} \\;" }, { "query": "List all the files in the /workspace directory which have only read permission to the group.", "gold": "find /workspace -perm 400 -type f -exec ls -l {} \\;", "gold2": "find /workspace -perm 400 -ls" }, { "query": "List all the files in the /workspace directory which have permissions 777.", "gold": "find /workspace -perm 777 -type f -exec ls -l {} \\;", "gold2": "find /workspace -perm 777 -ls" }, { "query": "List the details of all the text files in /workspace directory.", "gold": "find /workspace -name \"*.txt\" -exec ls -ld {} \\;", "gold2": "find /workspace -name \"*.txt\" | xargs ls -ld" }, { "query": "move all files in the /workspace folder to / and do not move the files in the sub folder", "gold": "find /workspace -maxdepth 1 -type f -exec mv -t / {} +", "gold2": "find /workspace -maxdepth 1 -type f -exec mv {} / \\;" }, { "query": "Move files in /workspace accessed less than one day ago to directory /.", "gold": "find /workspace -atime -1 -type f -exec mv {} / \\;", "gold2": "find /workspace -type f -atime -1 -print0 | xargs -0 -I {} mv {} /" }, { "query": "print all filenames of files under /workspace/dir1 dir containing 'hello', case-insensitive", "gold": "find /workspace/dir1 -type f -exec grep -il 'hello' {} \\;", "gold2": "grep -ril 'hello' /workspace/dir1" }, { "query": "print disk usage of files or folders in /workspace", "gold": "du -sh /workspace", "gold2": "du -h /workspace" }, { "query": "print the last word in /workspace/dir1/long.txt", "gold": "tac /workspace/dir1/long.txt | awk 'NF{print $NF; exit}'", "gold2": "awk '{ for (i=1; i<=NF; i++) last=$i } END { print last }' /workspace/dir1/long.txt" }, { "query": "Print the 3 largest directories in /workspace.", "gold": "du -a /workspace | sort -nr | head -n 3", "gold2": "find /workspace -exec du -h {} + | sort -rh | head -n 3" }, { "query": "prints first line of \"/workspace/dir1/long.txt\"", "gold": "head -n1 /workspace/dir1/long.txt", "gold2": "sed -n '1p' /workspace/dir1/long.txt" }, { "query": "prints the last non-empty line of \"/workspace/dir1/a.txt\"", "gold": "tac /workspace/dir1/a.txt | grep -m 1 '.'", "gold2": "awk 'NF' /workspace/dir1/a.txt | tail -n 1" }, { "query": "prune all the files in the /workspace directory", "gold": "find /workspace -type f -delete", "gold2": "find /workspace -type f -exec rm -f {} +" }, { "query": "search for all the files in the /workspace directory which have size greater than 1KB (approx) and less than 32KB(approx).", "gold": "find /workspace -type f -size +1k -size -32k", "gold2": "find /workspace -type f -size +1k -size -32k -print" }, { "query": "search for all the files in the /workspace folder and sort them in the order of their depth and display the file names", "gold": "find /workspace -type f | awk -F/ '{print NF, $0}' | sort -n", "gold2": "find /workspace -type f | awk -F/ '{print NF, $0}' | sort -n | cut -d' ' -f2-" }, { "query": "Search for all the files in the /workspace folder which are bigger than 1KB and display the biggest file.", "gold": "find /workspace -type f -size +1k -exec ls -ls {} + | sort -n | tail -1", "gold2": "find /workspace -type f -size +1k -exec ls -lh {} + | sort -k 5 -rh | head -n 1" }, { "query": "search for text files in the /workspace folder which do not have write access to others", "gold": "find /workspace -type f \\( -iname \"*.txt\" -not -perm -o=w \\)", "gold2": "find /workspace -type f -name \"*.txt\" ! -perm -o=w" }, { "query": "Search for the directory \"mysql\" in the workspace directory.", "gold": "find /workspace -name mysql -type d", "gold2": "find workspace -type d -name \"mysql\"" }, { "query": "Print a list of all duplicate case insensitive filenames in the /workspace directory tree", "gold": "find /workspace -type f | awk -F/ '{print $NF}' | sort -f | uniq -i -d", "gold2": "find /workspace -type f | awk -F/ '{print tolower($NF)}' | sort | uniq -d" }, { "query": "Search for the file old2.txt in the /workspace folder and list its permissions and creation time.", "gold": "find /workspace -name old2.txt | xargs ls -tl", "gold2": "find /workspace -name old2.txt -print0 | xargs -0 ls -tl" }, { "query": "search for the word \"hello\" in all the regular/normal files in the /workspace folder and display the matched file name", "gold": "find /workspace -type f | xargs grep -l \"hello\"", "gold2": "grep -rnw '/workspace' -e 'hello'" }, { "query": "Calculate the md5 sum of all files in the /workspace directory with the filename printed first", "gold": "find /workspace -type f -exec md5sum {} + | awk '{print $2 \" \" $1}'", "gold2": "find /workspace -type f -print0 | xargs -0 md5sum | awk '{print $2 \" \" $1}'" }, { "query": "Calculate the md5 sum of all files in directory tree \"/workspace\"", "gold": "find /workspace -type f -exec md5sum {} + | sort", "gold2": "find /workspace -type f -exec md5sum {} +" }, { "query": "Count the number of unique 3 to 6 character file extensions are in the /workspace directory tree", "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", "gold2": "find /workspace -type f -name '*.*' | sed -n 's/.*\\.//p' | awk '{print tolower($0)}' | grep -E '^[a-z]{3,6}$' | sort -u | wc -l" }, { "query": "Create a copy of the /workspace directory structure in the /usr directory,", "gold": "find /workspace -type d -print|sed 's@^@/usr/@'|xargs mkdir -p", "gold2": "find /workspace -type d | cpio -pdm /usr" }, { "query": "Display a long listing of the oldest file under '/workspace' directory tree", "gold": "find /workspace -type f -printf '%T+ %p\\n' | sort | head -n 1 | awk '{print $2}' | xargs ls -l", "gold2": "find /workspace -type f -exec stat --format '%Y %n' {} \\; | sort -n | head -n 1 | cut -d' ' -f2- | xargs ls -l" }, { "query": "Find the largest 2 directories under /workspace directory", "gold": "find /workspace -type d -print0 | xargs -0 du | sort -n | tail -2 | cut -f2 | xargs -I{} du -sh {}", "gold2": "find /workspace -type d -print0 | xargs -0 du | sort -n | tail -2" }, { "query": "List all files with their paths that have identical content in /workspace directory", "gold": "find /workspace -type f | xargs md5sum | sort | uniq -Dw32", "gold2": "find /workspace -type f -print0 | xargs -0 md5sum | sort | uniq -w32 -D" }, { "query": "Make directories for each unique file path in \"/workspace/files.txt\"", "gold": "cat /workspace/files.txt |xargs -I {} dirname \"{}\"| sort -u | xargs -I{} mkdir -p \"{}\"", "gold2": "cat /workspace/files.txt | xargs -I {} dirname {}| sort -u | xargs -I{} mkdir -p \"{}\"" }, { "query": "Print the total disk usage in bytes of all files listed in \"/workspace/files.txt\"", "gold": "cat /workspace/files.txt | xargs du -b | tail -1 | awk '{print $1}'", "gold2": "awk '{print $0}' /workspace/files.txt | xargs du -b | awk '{sum += $1} END {print sum}'" }, { "query": "Unhide all hidden files in the /workspace directory. Do not include subdirectories.", "gold": "find /workspace -maxdepth 1 -type f -name '.*' -exec sh -c 'mv \"$0\" \"${0%/\\.*}/${0##*/.}\"' {} \\;", "gold2": "find /workspace -maxdepth 1 -type f -name '.*' -exec sh -c 'mv \"$1\" \"${1%/\\.*}/${1##*/.}\"' _ {} \\;" }, { "query": "Count the number of differing lines in \"/workspace/dir1/long.txt\" and \"/workspace/dir1/terminate.txt\"", "gold": "diff /workspace/dir1/long.txt /workspace/dir1/terminate.txt | grep ^[\\>\\<] | wc -l", "gold2": "diff /workspace/dir1/long.txt /workspace/dir1/terminate.txt | grep '^>' | wc -l" }, { "query": "Count the number of differing lines in \"/workspace/dir1/terminate.txt\" and \"/workspace/dir1/long.txt\" with 0 lines of unified context", "gold": "diff -U 0 /workspace/dir1/terminate.txt /workspace/dir1/long.txt | grep -v ^@ | wc -l", "gold2": "diff -U 0 /workspace/dir1/terminate.txt /workspace/dir1/long.txt | grep -v '^@' | wc -l" }, { "query": "Counts lines in file /workspace/dir1/a.txt ignoring empty lines and lines with spaces only.", "gold": "awk '!/^[[:space:]]*$/{++x} END{print x}' /workspace/dir1/a.txt", "gold2": "grep -v '^[[:space:]]*$' /workspace/dir1/a.txt | wc -l" }, { "query": "Create a symbolic link in directory \"~/newlinks\" for each file listed in \"/workspace/results.txt\"", "gold": "cat /workspace/results.txt | xargs -I{} ln -s {} ~/newlinks", "gold2": "cat /workspace/results.txt | xargs -I {} ln -s {} ~/newlinks" }, { "query": "Delete all hidden files under /workspace", "gold": "find /workspace -type f -name '.*' -delete", "gold2": "find /workspace -type f -name '.*' -exec rm -f {} \\;" }, { "query": "Display a dump of \"/workspace/dir1/long.txt\" as floating point values of double size", "gold": "od -t fD /workspace/dir1/long.txt", "gold2": "od -An -t fD /workspace/dir1/long.txt" }, { "query": "Display differences between list of files in /workspace/dir1 and /workspace/dir2.", "gold": "diff <(ls /workspace/dir1) <(ls /workspace/dir2)", "gold2": "diff -qr /workspace/dir1 /workspace/dir2" }, { "query": "Display the file size of file '/workspace/dir1/sum.c' in bytes", "gold": "du -sb /workspace/dir1/sum.c | cut -f1", "gold2": "stat -c %s /workspace/dir1/sum.c" }, { "query": "Display the last slash-separated part of each filename path in /workspace/dir1/file.txt", "gold": "rev /workspace/dir1/file.txt | cut -d/ -f1 | rev", "gold2": "awk -F/ '{print $NF}' /workspace/dir1/file.txt" }, { "query": "Display the sizes and filepaths of all files/directories in /workspace directory sorted in descending order of size", "gold": "du /workspace -a -h | sort -hr", "gold2": "du -ah /workspace | sort -rh" }, { "query": "Print percentage of the space used on the /workspace directory.", "gold": "df -k /workspace | tail -1 | awk '{print $5}'", "gold2": "df -h /workspace | awk 'NR==2 {print $5}'" }, { "query": "Print the contents of \"/workspace/dir1/long.txt\" in reverse order", "gold": "nl /workspace/dir1/long.txt | sort -nr | cut -b8-", "gold2": "tac /workspace/dir1/long.txt" }, { "query": "Create an empty file \"Icon\" in workspace/ with a carriage return character in the end of its name.", "gold": "echo $'workspace/Icon\\r' | xargs touch", "gold2": "touch \"workspace/Icon\"$'\\r'" }, { "query": "Create a symbolc link in the /workspace/dir1 to root folder", "gold": "ln /workspace/dir1 -s /", "gold2": "ln -s /workspace/dir1 /" }, { "query": "Display permissions, user, group, and full path for each file in the /workspace directory tree", "gold": "tree /workspace -p -u -g -f", "gold2": "find /workspace -type f -exec stat --format '%A %U %G %N' {} \\;" }, { "query": "Search for 'hello' case insensitively in all files under /workspace directory tree and show the matched lines with their filenames", "gold": "find /workspace -type f -print0 | xargs -0 grep -iH \"hello\"", "gold2": "grep -ri 'hello' /workspace" }, { "query": "Unpack all *.gz archives in the /workspace directory tree", "gold": "find /workspace -name '*.gz' -print0 | xargs -0 gunzip", "gold2": "find /workspace -type f -name '*.gz' -exec gunzip {} +" }, { "query": "Uncompress \"/workspace/archive.tar.gz\" and extract the archive to \"/backup\"", "gold": "gzip -dc /workspace/archive.tar.gz | tar -xf - -C /backup", "gold2": "tar -xzvf /workspace/archive.tar.gz -C /backup" }, { "query": "Create a symbolic link to \"/workspace/dir1/terminate.txt\" named \"/workspace/test\"", "gold": "ln /workspace/dir1/terminate.txt /workspace/test", "gold2": "ln -s /workspace/dir1/terminate.txt /workspace/test" } ]