nl_command
stringlengths 14
387
| bash_code
stringlengths 0
532
|
---|---|
Look for any files that were modified 2-5 days ago | find -mtime +2 -mtime -5 |
Creates temporary file in a TMPDIR folder or /tmp folder if TMPDIR doesn`t defined, with file name like current shell name and '-XXXXX'-formatted suffix, and saves created path to the 'tempFile' variable. | tempFile="$(mktemp "${TMPDIR:-/tmp/}$(basename "$0")-XXXXX")" |
Find all files with space in their names under current directory | find . -type f -name '* *' |
find regular which case-insensitive name is foo in current directory | find . -iname foo -type f |
Find all the files under /etc directory which are larger than 100k | find /etc -size +100k |
Find all directories under current directory | find -type d |
search for the regular/normal file "Dateiname" in the entire file system | find / -type f -iname "Dateiname" |
Download 10000 web pages "https://www.example.com/page{}.html" 100 at a time where "{}" ranges from 1 to 10000 | seq 10000 | parallel -j100 wget https://www.example.com/page{}.html |
Go to previous working directory. | cd - |
Change the group of all directories (except those with a '.') under current directory tree to a group with the same name as the directory name | find . -type d | sed -e 's/\.\///g' | awk '{print $1, $1}' | xargs chgrp |
Remove all files whose names start with spam- | find . -name 'spam-*' | xargs rm |
Find all *.p[lm] files under /users/tom directory that matches the regex '->get(\|#hyphenate' in their contents | find /users/tom -name '*.p[lm]' -exec grep -l -- '->get(\|#hyphenate' {} + |
Print the date followed by the host name | echo `date` `hostname` |
display all text files in current folder | find . -name ".txt" |
Create tar archive "dirall.tar" and copy all files from directory tree /tmp/a1 to it | find /tmp/a1 -print0 | tar --null -T- -cvf dirall.tar |
Compare files 'file1' and 'file2' and print in three columns strings unique for first file, second file, and common ones | comm abc def |
Find all files in the /home/ directory tree that are owned by bob | find /home -user bob |
Find "file.xml" under the current directory and change directory to its parent | cd `find . -name file.xml -exec dirname {} \;` |
Run 'git pull' and, if successful, 'git status' in every git repository in the current directory | find . -type d -name .git -exec sh -c "cd \"{}\"/../ && pwd && git pull && git status" \; |
display all directories in current folder excluding those that are present in .git folder | find . -iregex '.*/.git/.*' -prune -o -type d -name 'CVS' |
Find the first file/directory under current directory and quit | find . ... -print -quit |
Find all files with the name "MyProgram.c" in the current directory and its sub-directories while ignoring the case of the file name. | find -iname "MyCProgram.c" |
Sum the total content size of the extracted files in "archive.tar.gz" | tar tzvf archive.tar.gz | sed 's/ \+/ /g' | cut -f3 -d' ' | sed '2,$s/^/+ /' | paste -sd' ' | bc |
Print only printable characters from "/dev/urandom" | cat /dev/urandom | tr -dC '[:graph:]' |
Search /usr/local recursively for directories whose names end with a number 0-9 | find /usr/local -type d -name '*[0-9]' |
Delete all lines matching "some string here" in "yourfile" | sed --in-place '/some string here/d' yourfile |
Set permissions to ug=rwx,o= for directories inside the ./default/files tree | find ./default/files -type d -exec chmod ug=rwx,o= '{}' \; |
Read a line of standard input with prompt "Enter the path to the file: " and suggestion "/usr/local/etc/" and save the response to variable "FILEPATH" | read -e -p "Enter the path to the file: " -i "/usr/local/etc/" FILEPATH |
Write "127.0.0.1 ad.doubleclick.net" to the console and append to "/etc/hosts" as root | echo 127.0.0.1 ad.doubleclick.net | sudo tee -a /etc/hosts |
Set permissions of all directories under "/opt/lampp/htdocs" to 711 | find /opt/lampp/htdocs -type d -exec chmod 711 {} \; |
display all the text files from the current folder and skip searching in skipdir1 and skipdir2 folders | find . \( -name skipdir1 -prune , -name skipdir2 -prune -o -name "*.txt" \) -print |
Find all files/directories under current directory tree whose names start with 'test' followed by two digits and end with '.txt' extension | find . -regextype sed -regex "./test[0-9]\{2\}.txt" |
Find the password file between sub-directory level 2 and 4 | find -mindepth 3 -maxdepth 5 -name passwd |
Search the current working directory tree for files whose names start with "fileA_" or "fileB_" | find . -name 'fileA_*' -o -name 'fileB_*' |
display all the html files in the current folder excluding search in the path ./foo | find . -path "./foo" -prune -o -type f -name "*.html" |
For each line whose second field is the same in both files, output: first field of second file, second field of first file, and first field of second file. | $ join -j 2 -o 1.1 1.2 2.1 < < |
Continuously send "y" as input to "cat" which outputs to "more" | yes | cat | more |
Get the number of regular files in the directory given as the bash script argument $1 | find $1 -type f | wc -l |
find the type & description of all the regular/normal files in the home folder | find /home -type f -print0 | xargs -0 file |
Move all files and directories in the current directory to "somewhere/" | mv `ls` somewhere/ |
display all directories in current folder | find . -type d -print0 |
Filter out current date in current time zone from the GMT+30 and GMT+20 representations of current date and show the last one | echo -e "$(TZ=GMT+30 date +%Y-%m-%d)\n$(TZ=GMT+20 date +%Y-%m-%d)" | grep -v $(date +%Y-%m-%d) | tail -1 |
display a long listing of all the files in the current folder in sorted order, which are bigger than 10KB | find . -size +10k -exec ls -ls {} \+ | sort -nr |
Prints list of folders containing '.git', searching recursively from a current folder. | find . -name '.git' | xargs -n 1 dirname |
find all the files ending with undo in the current folder and calculate the total size of these files | find . -name "*.undo" -ls | awk '{total += $7} END {print total}' |
find the file with inode $inum under the current directory and delete it | find . -inum $inum -exec rm {} \; |
Search for the wp-config.php file in /var/www and one level below | find /var/www/ -name wp-config.php -maxdepth 2 |
find all the ".flac" files in the current folder and convert them to mp3 with 128k bit rate | find -name "*.flac" -exec ffmpeg -i {} -acodec libmp3lame -ab 128k {}.mp3 \; |
Find all directories under ${1:-.} directory without descending into any sub-directories | find ${1:-.} -mindepth 1 -maxdepth 1 -type d |
Find all the .mp3 files in the music folder recursively and pass them to the ls command | find ./music -name "*.mp3" -print0 | xargs -0 ls |
Change the permissions of the current directory and all its subdirectories to 755. | find . -type d -exec chmod 755 {} \; |
search the file myfile.txt in the current folder | find . -name myfile.txt -print |
Search the current directory tree for executable regular files | find . -executable -type f |
Remove the "^M" characters from all *.ext files under /home directory | find /home -type f -name "*.ext" -exec sed -i -e "s/\r$//g" {} \; |
Print the file sizes along with their paths for all *.txt (case insensitive) files/directories under current directory tree | find . -name "*.txt" -print0 |xargs -0 du -ch |
Search the files residing in the current directory tree whose names contain "bills" for "put" | find . -name '*bills*' -exec grep -H "put" {} \; |
find all the directories in the different folders excluding search in the sub directories and create these folders in the current directory | find /media/New\ Volume/bhajans -maxdepth 1 -type d | xargs -0 mkdir -p |
Print line number "${linenum}" in file "$filename" | cat $filename | sed "${linenum}p;d"; |
Mount "/path/to/device" on "/path/to/mount/location" as a vfat filesystem and a loop back device | mount /path/to/device /path/to/mount/location -o loop -t vfat |
Find the total size of *.jpg files within the current directory tree | find . -type f -iname '*.jpg' -print0 | du -c --files0-from=- |
Find all files/directories under current directory with 'FooBar' in their paths and copy them to ~/foo/bar | find .|grep "FooBar"|yargs -l 203 cp --after ~/foo/bar |
Find all files/directories under '/usr' directory tree that have not been modified in the last 356 days counting days from today | find /usr -mtime +356 -daystart |
Make directory "subdirectory" | mkdir subdirectory |
Move all files from the `sourceDir' directory tree to the `destDir' directory | find sourceDir -mindepth 1 -print0 | xargs -0 mv --target-directory=destDir |
Saves listing of a current folder in 'OUTPUT' variable. | OUTPUT="$(ls -1)" |
List all .gif files in the current directory tree | find . -name *.gif -exec ls {} \; |
display ten files in the tmp directory | find /tmp | head |
Rename all files in current directory with names starting with "fgh" so they start with "jkl" instead | rename 's/^fgh/jkl/' fgh* |
find all files without 777 permision | find / -type f ! perm 777 |
Search the /root directory recursively for files named "FindCommandExamples.txt" | find /root -name FindCommandExamples.txt |
Print the first 10 files or directories found in the /tmp directory tree by `find' | find /tmp | head |
Print yesterday's date as yyy:mm:dd | date +%Y:%m:%d -d "1 day ago" |
Find files that were modified in less than 1 minute ago | find / -mmin -1 |
Search for all files owned by user www-data that are not larger than 100kb | find -user www-data -not -size +100k |
Find all files/directories case insensitively containing 'xt' in their names under '/etc' directory tree | find /etc -iregex '.*xt.*' |
Print the list of .txt files under and below the current directory | find . -name '*.txt' -print0|xargs -0 -n 1 echo |
Extract five digits sequence from a filename with x number of alphanumeric characters followed by the five digit sequence surrounded by a single underscore on either side then another set of x number of alphanumeric characters. | echo 'someletters_12345_moreleters.ext' | cut -d'_' -f 2 |
Save the UTC date represented by time string $sting2 as the seconds since epoch to variable 'FinalDate' | FinalDate=$(date -u -d "$string2" +"%s") |
Print the second line of output of "ls -l" | ls -l | tail -n +2 | head -n1 |
search the word NEEDLE and substitute it with REPLACEMENT in all the php files of the current folder | find ./ -type f -exec sed -i '' 's#NEEDLE#REPLACEMENT#' *.php {} \; |
Show long listing of current directory by deleting all digits from the output | ls -lt | tr -d 0-9 |
Read a single character from standard input and do not allow backslash to escape characters | read -rn1 |
Make directories "/tmp/A", "/tmp/B", "/tmp/C", and "/tmp/ dir with spaces" | mkdir /tmp/A /tmp/B /tmp/C "/tmp/ dir with spaces" |
Recursively copy "original_dir" to "copy_dir" preserving file/dir timestamps, displaying progress, and skipping files which match in size, keeps partially transferred files. | rsync -Prt --size-only original_dir copy_dir |
print the line containing TERMINATE and everything after in 'file' | tail -n "+$" file |
Immediately terminate all processes whose command or arguments contain 'amarok'. | ps aux | grep -ie amarok | awk '{print $2}' | xargs kill -9 |
display a long listing of all the regular/normal files in the current folder | find . -type f -ls |
Finds recursively all folders named 'a' within current folder and removes only ones without files and another folders within. | find . -name "a" -type d | xargs rmdir |
Output two lines of "-tcp" | yes -- "-tcp" | head -n 2 |
List all files in the current directory tree that were last modified yesterday or later | find -newermt yesterday -ls |
Generates a randomly sorted list of numbers from 1 to 10. | seq 1 10 | sort -R | tee /tmp/lst |cat < < \ < |
Remove all files on the system that have been changed within the last minute | find / -newerct '1 minute ago' -print | xargs rm |
Count the occurrence of 2 in the string '1 1 2 2 2 5' | echo "1 1 2 2 2 5" | tr ' ' $'\n' | grep -c 2 |
Search for regular files of the grooup 'users' in the file system | find / -type f -group users |
Delete all files with ' .o' extension in the entire filesystem | find project / src / -name "* .o" -exec rm -f {} \; |
find all text files in user/directory/ which have been modified today and display the last line of these files | find /user/directory/ -name "*txt" -mtime 0 -type f -printf '%p: ' -exec tail -1 {} \; |
find all the files in the current folder that have been accessed in today | find -atime 0 |
Find all files/directories under current directory with 'FooBar' in their paths and copy them to ~/foo/bar | find . | grep "FooBar" | tr \\n \\0 | xargs -0 -I{} cp "{}" ~/foo/bar |
Find all files/directories under current directory that match the case insensitive glob pattern {EA,FS}_* | find . -iname "{EA,FS}_*" |
search for a word in all the files in the current directory (case insensitive search) | find . -type f -exec grep 'needle' {} \; |
nl2bash-custom
nl2bash-custom is a custom dataset used to fine-tune Large Language Models for Bash Code Generation. Fine tune the Code-Llamma family of LLMs (7b, 13b, 70b) for best results.
The dataset is created by reformatting and reshiffling of 2 original datasets
Dataset Structure
train.json
: Training split.dev.json
: Development split.test.json
: Test split.
Usage
from datasets import load_dataset
dataset = load_dataset("AnishJoshi/nl2bash-custom")
Features
- 'srno': Serial number of the input-output pair
- 'nl_command': The natural language input/command
- 'bash_code': Corresponding bash code
References
@inproceedings{LinWZE2018:NL2Bash, author = {Xi Victoria Lin and Chenglong Wang and Luke Zettlemoyer and Michael D. Ernst}, title = {NL2Bash: A Corpus and Semantic Parser for Natural Language Interface to the Linux Operating System}, booktitle = {Proceedings of the Eleventh International Conference on Language Resources and Evaluation {LREC} 2018, Miyazaki (Japan), 7-12 May, 2018.}, year = {2018} }
@article{Fu2021ATransform, title={A Transformer-based Approach for Translating Natural Language to Bash Commands}, author={Quchen Fu and Zhongwei Teng and Jules White and Douglas C. Schmidt}, journal={2021 20th IEEE International Conference on Machine Learning and Applications (ICMLA)}, year={2021}, pages={1241-1244} }
@article{fu2023nl2cmd, title={NL2CMD: An Updated Workflow for Natural Language to Bash Commands Translation}, author={Fu, Quchen and Teng, Zhongwei and Georgaklis, Marco and White, Jules and Schmidt, Douglas C}, journal={Journal of Machine Learning Theory, Applications and Practice}, pages={45--82}, year={2023} }
- Downloads last month
- 42