text
large_stringlengths
242
1.17k
nl
large_stringlengths
13
387
bash
large_stringlengths
1
715
source
large_stringclasses
3 values
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Print host name followed by ":" and the contents of "/sys/block/sda/size"<|im_end|> <|im_start|>assistant echo "$:$"<|im_end|>
Print host name followed by ":" and the contents of "/sys/block/sda/size"
echo "$:$"
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Find all *.ps files under $STARTDIR and run ps2pdf for each files with the file path as a argument<|im_end|> <|im_start|>assistant find $START...
Find all *.ps files under $STARTDIR and run ps2pdf for each files with the file path as a argument
find $STARTDIR -name '*.ps' -print | sed -e 's/.ps$//' | xargs -l -i ps2pdf \{}.ps
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Search in the current directory and all sub-directories except ./D for the file named hi.dat.<|im_end|> <|im_start|>assistant find . \ -o -nam...
Search in the current directory and all sub-directories except ./D for the file named hi.dat.
find . \ -o -name hi.dat
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Create a symbolic link named "~/bin/subl" to "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"<|im_end|> <|im_start|>assistant ...
Create a symbolic link named "~/bin/subl" to "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Set variable LINE to full process info of process currently taking the most CPU time, squeezing multiple consecutive spaces into one.<|im_end|...
Set variable LINE to full process info of process currently taking the most CPU time, squeezing multiple consecutive spaces into one.
LINE=$
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user display a long list of all the directories which have files ending with ".todo"<|im_end|> <|im_start|>assistant find "$STORAGEFOLDER" -name .t...
display a long list of all the directories which have files ending with ".todo"
find "$STORAGEFOLDER" -name .todo -printf '%h\n' | uniq | xargs ls -l
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Check if a file is executable by the user.<|im_end|> <|im_start|>assistant #!/bin/bash file="/path/to/your/file.txt" if [ -x "$file" ]; then...
Check if a file is executable by the user.
#!/bin/bash file="/path/to/your/file.txt" if [ -x "$file" ]; then echo "$file is executable by the user" else echo "$file is not executable by the user" fi
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Recursively list all files and directories in "coreutils-8.9" with "DIR: " prepending directory names<|im_end|> <|im_start|>assistant tree -F ...
Recursively list all files and directories in "coreutils-8.9" with "DIR: " prepending directory names
tree -F coreutils-8.9 | sed -r 's|── /$|── DIR: \1|'
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Create a script to monitor system processes and send an alert if any processes are consuming excessive CPU or memory.<|im_end|> <|im_start|>as...
Create a script to monitor system processes and send an alert if any processes are consuming excessive CPU or memory.
#!/bin/bash threshold_cpu="80" threshold_mem="80" processes=$(ps aux | sort -nk +4 | tail -n 5) while read -r line; do pid=$(echo "$line" | awk '{print $2}') cpu=$(echo "$line" | awk '{print $3}') mem=$(echo "$line" | awk '{print $4}') if (( $(echo "$cpu > $threshold_cpu" | bc -l) )); then e...
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Replace "-" with "0" in columns 4 and 5 of file "test.in" and format as a table<|im_end|> <|im_start|>assistant awk '{gsub(/-/,"0",$4);gsub(/-...
Replace "-" with "0" in columns 4 and 5 of file "test.in" and format as a table
awk '{gsub(/-/,"0",$4);gsub(/-/,"0",$5)}1' test.in | column -t
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Send SIGTERM signal to entire session of processes containing processes whose command match "rsync".<|im_end|> <|im_start|>assistant kill $(ps...
Send SIGTERM signal to entire session of processes containing processes whose command match "rsync".
kill $(ps -o pid= -s $(ps -o sess --no-heading --pid $))
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Find all *.ps files under $STARTDIR<|im_end|> <|im_start|>assistant find $STARTDIR -name '*.ps' -print<|im_end|>
Find all *.ps files under $STARTDIR
find $STARTDIR -name '*.ps' -print
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user set alias "git-root" for command 'cd $'<|im_end|> <|im_start|>assistant alias git-root='cd $'<|im_end|>
set alias "git-root" for command 'cd $'
alias git-root='cd $'
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Save the full path of command "f" to variable "full_f"<|im_end|> <|im_start|>assistant full_f="$"<|im_end|>
Save the full path of command "f" to variable "full_f"
full_f="$"
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Format the output of "printf ..." to fit in 80 characters per line<|im_end|> <|im_start|>assistant printf ... | fold -w 80<|im_end|>
Format the output of "printf ..." to fit in 80 characters per line
printf ... | fold -w 80
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user check the file type of all the regular/normal files in the current directory and save the output to the file /tmp/filetypes.log<|im_end|> <|im...
check the file type of all the regular/normal files in the current directory and save the output to the file /tmp/filetypes.log
find . -type f -exec file {} \; > /tmp/filetypes.log
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Create a script to find the power of a number using recursion.<|im_end|> <|im_start|>assistant #!/bin/bash power() { num="$1" exp="$2...
Create a script to find the power of a number using recursion.
#!/bin/bash power() { num="$1" exp="$2" if [ "$exp" -eq 0 ]; then echo 1 else echo $((num * $(power "$num" $((exp - 1))))) fi } num=2 exp=5 echo "The result is: $(power $num $exp)"
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Create new crontab set for user 'test' including $job and only jobs from current crontab of 'test' user that don`t contain $command<|im_end|> ...
Create new crontab set for user 'test' including $job and only jobs from current crontab of 'test' user that don`t contain $command
cat <(fgrep -i -v "$command" <) < | crontab -u test -
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user List all aliencoders.[0-9]+ files/directories under /home/jassi/ directory<|im_end|> <|im_start|>assistant find /home/jassi/ -name "aliencoder...
List all aliencoders.[0-9]+ files/directories under /home/jassi/ directory
find /home/jassi/ -name "aliencoders.[0-9]+" | xargs ls -lrt | awk print '$9'
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Renames all *.html files in a 'folder' directory to *.txt files.<|im_end|> <|im_start|>assistant ls folder/*.html | xargs -I {} sh -c 'mv $1 f...
Renames all *.html files in a 'folder' directory to *.txt files.
ls folder/*.html | xargs -I {} sh -c 'mv $1 folder/`basename $1 .html`.txt' - {}
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Split "2011.psv" into chunks of at most 50000000 lines each as input to "./filter.sh"<|im_end|> <|im_start|>assistant split -l 50000000 --filt...
Split "2011.psv" into chunks of at most 50000000 lines each as input to "./filter.sh"
split -l 50000000 --filter=./filter.sh 2011.psv
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Add "new." to the beginning of the name of "original.filename", renaming it to "new.original.filename".<|im_end|> <|im_start|>assistant rename...
Add "new." to the beginning of the name of "original.filename", renaming it to "new.original.filename".
rename 's/$/new.$1/' original.filename
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Print the list of files containing a specific string within a directory.<|im_end|> <|im_start|>assistant #!/bin/bash string="your_string" gr...
Print the list of files containing a specific string within a directory.
#!/bin/bash string="your_string" grep -rnw '/path/to/your/directory/' -e "$string"
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user find all png images in the current folder and convert the to jpg images. print0 is used to handle the files which have new lines in their name...
find all png images in the current folder and convert the to jpg images. print0 is used to handle the files which have new lines in their names
find . -name "*.png" -print0 | xargs -0 mogrify -format jpg -quality 50
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Move all 10*jpg files under /path to 2010*jpg files under the same directory<|im_end|> <|im_start|>assistant find /path -type f -name "10*jpg"...
Move all 10*jpg files under /path to 2010*jpg files under the same directory
find /path -type f -name "10*jpg" | sed 's/.*/mv &/' | sed 's/mv \\/& \120\2/' | sh
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user set alias ".." for command "cd .."<|im_end|> <|im_start|>assistant alias ..='cd ..'<|im_end|>
set alias ".." for command "cd .."
alias ..='cd ..'
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Prints reversed content of a file 'myfile.txt' with string numbers.<|im_end|> <|im_start|>assistant grep -n "" myfile.txt | sort -r -n | gawk ...
Prints reversed content of a file 'myfile.txt' with string numbers.
grep -n "" myfile.txt | sort -r -n | gawk -F : "{ print $2 }"
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user SSH into "111.222.333.444" as user "tunneluser" without interpreting bash variables locally<|im_end|> <|im_start|>assistant ssh tunneluser@111...
SSH into "111.222.333.444" as user "tunneluser" without interpreting bash variables locally
ssh tunneluser@111.222.333.444 <<\EOI
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Create a script to monitor system user password changes and generate reports on password modifications.<|im_end|> <|im_start|>assistant #!/bin...
Create a script to monitor system user password changes and generate reports on password modifications.
#!/bin/bash touch /tmp/password_changes_report.txt while true; do grep 'password changed' /var/log/auth.log >> /tmp/password_changes_report.txt sleep 3600 done
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Check if a specific directory exists and has the correct permissions recursively.<|im_end|> <|im_start|>assistant #!/bin/bash directory="/pat...
Check if a specific directory exists and has the correct permissions recursively.
#!/bin/bash directory="/path/to/directory" permissions="755" if [ -d "$directory" ] && [ $(find "$directory" ! -perm $permissions) ]; then echo "Directory exists with correct permissions" else echo "Directory does not exist or has incorrect permissions" fi
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Search directory $dirname for regular files and save the result to $tempfile<|im_end|> <|im_start|>assistant find $dirname -type f > $tempfil...
Search directory $dirname for regular files and save the result to $tempfile
find $dirname -type f > $tempfile
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Print the time to ping "8.8.8.8" followed by a time stamp if the ping is greater than 50<|im_end|> <|im_start|>assistant ping 8.8.8.8 | awk -F...
Print the time to ping "8.8.8.8" followed by a time stamp if the ping is greater than 50
ping 8.8.8.8 | awk -F"[= ]" '{if($10>50) {cmd="date"; cmd | getline dt; close(cmd) ; print $10, dt}}'
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Save the list of files in the home directory tree whose names begin with "Foto" to `results.txt'<|im_end|> <|im_start|>assistant find ~ -name ...
Save the list of files in the home directory tree whose names begin with "Foto" to `results.txt'
find ~ -name 'Foto*' > results.txt
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Find every JavaScript file in the wordpress directory<|im_end|> <|im_start|>assistant find wordpress -maxdepth 1 -name '*js'<|im_end|>
Find every JavaScript file in the wordpress directory
find wordpress -maxdepth 1 -name '*js'
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Find all sample*_1.txt files/directories under current directory and print 'program sample*-out sample*_1.txt sample*_2.txt' for each of them...
Find all sample*_1.txt files/directories under current directory and print 'program sample*-out sample*_1.txt sample*_2.txt' for each of them
find . -name "sample*_1.txt" | sed -n 's/_1\..*$//;h;s/$/_out/p;g;s/$/_1.txt/p;g;s/$/_2.txt/p' | xargs -L 3 echo program
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user create a tar ball of current directory<|im_end|> <|im_start|>assistant tar cvf - `find . -print` > backup.tar<|im_end|>
create a tar ball of current directory
tar cvf - `find . -print` > backup.tar
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Generate a random number within a range.<|im_end|> <|im_start|>assistant #!/bin/bash min=1 max=100 echo $(( RANDOM % (max - min + 1 ) + min ...
Generate a random number within a range.
#!/bin/bash min=1 max=100 echo $(( RANDOM % (max - min + 1 ) + min ))
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Search all directory from /usr downwards for files whose inode number is 1234 and print them .<|im_end|> <|im_start|>assistant find /usr -inu...
Search all directory from /usr downwards for files whose inode number is 1234 and print them .
find /usr -inum 1234 -print
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Run the specified git command, paging through the output with raw characters written to the terminal, without initializing the terminal capabi...
Run the specified git command, paging through the output with raw characters written to the terminal, without initializing the terminal capabilities, and automatically exiting when the end of the output is reached.
git -c color.status=always status | less -REX
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Find and delete all core files in the user's home directory and below.<|im_end|> <|im_start|>assistant find ~/ -name 'core*' -exec rm {} \<|im...
Find and delete all core files in the user's home directory and below.
find ~/ -name 'core*' -exec rm {} \
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Find the top level directories that contain a 'bin' directory in it or in one of it's sub-directories and print a sorted list to file b<|im_en...
Find the top level directories that contain a 'bin' directory in it or in one of it's sub-directories and print a sorted list to file b
find . -type d -name bin | cut -d/ -f1,2 | sort > b
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Create a script to monitor SSL certificate expiration date and send an alert if it is about to expire.<|im_end|> <|im_start|>assistant #!/bin/...
Create a script to monitor SSL certificate expiration date and send an alert if it is about to expire.
#!/bin/bash cert_expiry=$(openssl x509 -in /etc/ssl/certs/example.crt -noout -dates | grep 'notAfter' | awk -F '=' '{print $2}') expiry_date=$(date -d "$cert_expiry" +%s) current_date=$(date +%s) if [ "$expiry_date" -lt "$((current_date + 2592000))" ]; then echo "SSL certificate is about to expire on $cert_expir...
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Runs 'mpv' command for each *.mpv and *.flv file in a current folder.<|im_end|> <|im_start|>assistant mpv --no-audio \`ls ~/Down/other/*.{mp4,...
Runs 'mpv' command for each *.mpv and *.flv file in a current folder.
mpv --no-audio \`ls ~/Down/other/*.{mp4,flv} --color=never\`
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user get all files in a current directory modified in the last day and a half<|im_end|> <|im_start|>assistant find . -mtime -1.5 | xargs tar --no-r...
get all files in a current directory modified in the last day and a half
find . -mtime -1.5 | xargs tar --no-recursion -czf myfile.tgz
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Check for available updates for installed packages and list them.<|im_end|> <|im_start|>assistant #!/bin/bash apt update apt list --upgradabl...
Check for available updates for installed packages and list them.
#!/bin/bash apt update apt list --upgradable
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Create a script to monitor PostgreSQL server status and send an alert if the server is down.<|im_end|> <|im_start|>assistant #!/bin/bash post...
Create a script to monitor PostgreSQL server status and send an alert if the server is down.
#!/bin/bash postgres_status=$(systemctl is-active --quiet postgresql) if [ "$postgres_status" != "active" ]; then echo "PostgreSQL server is down." # Send alert here fi
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Send email in "mail.tmp" from "noreply@hostname" with subject "Config done!"<|im_end|> <|im_start|>assistant cat mail.tmp | mail -r "noreply@$...
Send email in "mail.tmp" from "noreply@hostname" with subject "Config done!"
cat mail.tmp | mail -r "noreply@$" -s "Config done!" "${MAIL}"
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user resize all the jpg images in the current folder to the size 300x300<|im_end|> <|im_start|>assistant find . -iname '*.jpg' -print0 | xargs -I{}...
resize all the jpg images in the current folder to the size 300x300
find . -iname '*.jpg' -print0 | xargs -I{} -0 -r convert -resize 300x300 {} $outdir/{}
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user set alias "vimrc" for command "$EDITOR ~/.vimrc"<|im_end|> <|im_start|>assistant alias vimrc='$EDITOR ~/.vimrc'<|im_end|>
set alias "vimrc" for command "$EDITOR ~/.vimrc"
alias vimrc='$EDITOR ~/.vimrc'
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Create a script to monitor system network latency and send an alert if it exceeds a certain threshold.<|im_end|> <|im_start|>assistant #!/bin/...
Create a script to monitor system network latency and send an alert if it exceeds a certain threshold.
#!/bin/bash threshold=100 latency=$(ping -c 5 google.com | tail -1 | awk '{print $4}' | cut -d '/' -f 2) if [ "$latency" -gt "$threshold" ]; then echo "System network latency exceeds $threshold ms." # Send alert here fi
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Create a script to monitor system processes and send an alert if the number of processes exceeds a certain threshold.<|im_end|> <|im_start|>as...
Create a script to monitor system processes and send an alert if the number of processes exceeds a certain threshold.
#!/bin/bash threshold=500 process_count=$(ps aux | wc -l) if [ "$process_count" -gt "$threshold" ]; then echo "Number of processes exceeds $threshold." # Send alert here fi
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Create a script to monitor system root user software package updates and send an alert if any updates are available.<|im_end|> <|im_start|>ass...
Create a script to monitor system root user software package updates and send an alert if any updates are available.
#!/bin/bash apt-get update -qq updates_available=$(apt-get -s upgrade | grep -cE '^Inst') if [ "$updates_available" -gt "0" ]; then echo "Updates available for root user: $updates_available" | mail -s "Root Package Update Alert" user@example.com fi
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Create a variable CDATE in the current shell that contains the date in '%Y-%m-%d %H:%M:%S' format , and a variable EPOCH that contains the sec...
Create a variable CDATE in the current shell that contains the date in '%Y-%m-%d %H:%M:%S' format , and a variable EPOCH that contains the seconds since epoch
source <(date +"CDATE='%Y-%m-%d %H:%M:%S' EPOCH='%s'")
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Export variable "JAVA_HOME" as symlink resolved absolute path of the 2nd parent directory name of "java"<|im_end|> <|im_start|>assistant expor...
Export variable "JAVA_HOME" as symlink resolved absolute path of the 2nd parent directory name of "java"
export JAVA_HOME=$(readlink -f $(dirname $(readlink -f $ ))/../)
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Create a script that monitors system web server access logs and logs any unusual activity.<|im_end|> <|im_start|>assistant #!/bin/bash while ...
Create a script that monitors system web server access logs and logs any unusual activity.
#!/bin/bash while true; do grep -E '404|403|500' /var/log/apache/access.log sleep 600 done
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Find regular files modified less than 14 days ago stripping ./ from each file name<|im_end|> <|im_start|>assistant find . -type f -mtime -14 |...
Find regular files modified less than 14 days ago stripping ./ from each file name
find . -type f -mtime -14 | cut -b 3- > deploy.txt
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Print the number of lines in each file in a directory.<|im_end|> <|im_start|>assistant #!/bin/bash directory="/path/to/your/directory" for f...
Print the number of lines in each file in a directory.
#!/bin/bash directory="/path/to/your/directory" for file in "$directory"/*; do echo "$file: $(wc -l < "$file")" done
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Find all .svn directories under current directory and delete them<|im_end|> <|im_start|>assistant find . -type d -name ".svn" -print | paralle...
Find all .svn directories under current directory and delete them
find . -type d -name ".svn" -print | parallel rm -rf
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Create a script to calculate the average of numbers in a file and print only the integer part.<|im_end|> <|im_start|>assistant #!/bin/bash su...
Create a script to calculate the average of numbers in a file and print only the integer part.
#!/bin/bash sum=0 count=0 while read -r num; do sum=$((sum + num)) count=$((count + 1)) done < numbers.txt average=$((sum / count)) echo "The average of numbers in the file is: $average"
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Gets MAC address of p2p0 network interface.<|im_end|> <|im_start|>assistant ifconfig p2p0 | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,...
Gets MAC address of p2p0 network interface.
ifconfig p2p0 | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}'
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Creates temporary folder in a $temp_dir folder with name pattern defined by $template, and stores path to created folder in 'my_temp' variable...
Creates temporary folder in a $temp_dir folder with name pattern defined by $template, and stores path to created folder in 'my_temp' variable.
$ my_temp_dir=$(mktemp -d --tmpdir=$temp_dir -t $template)
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Search the bla directory recursively for *.so files<|im_end|> <|im_start|>assistant find bla -name "*.so"<|im_end|>
Search the bla directory recursively for *.so files
find bla -name "*.so"
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user get all files in a current directory modified in the last day<|im_end|> <|im_start|>assistant find . -mtime -1 | xargs tar --no-recursion -czf...
get all files in a current directory modified in the last day
find . -mtime -1 | xargs tar --no-recursion -czf myfile.tgz
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user beginning at the end of the file, prints lines matching /2012/ and exits after first non-matching line<|im_end|> <|im_start|>assistant tac err...
beginning at the end of the file, prints lines matching /2012/ and exits after first non-matching line
tac error.log | awk '{if(/2012/)print;else exit}'
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Create a script to monitor system root user activities and send an alert if any suspicious activities are detected.<|im_end|> <|im_start|>assi...
Create a script to monitor system root user activities and send an alert if any suspicious activities are detected.
#!/bin/bash suspicious_activities="$(last -n 5 | grep -i root)" if [ -n "$suspicious_activities" ]; then echo "Suspicious root user activities detected: $suspicious_activities" | mail -s "Root User Activity Alert" user@example.com fi
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Find all .c and .C files in the current directory tree that contain "main(" and copy them to directory test1/<|im_end|> <|im_start|>assistant ...
Find all .c and .C files in the current directory tree that contain "main(" and copy them to directory test1/
find -iname “*.c” -exec grep -l ‘main(‘ {} \; -a -exec cp {} test1/ \;
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Search regular files from the /path/to/dir directory tree for lines that contain "_START" and are enclosed in lines "@GROUP" and "@END_GROUP"<...
Search regular files from the /path/to/dir directory tree for lines that contain "_START" and are enclosed in lines "@GROUP" and "@END_GROUP"
find /path/to/dir -type f -exec sed '/@GROUP/,/@END_GROUP/!d' {} \; | grep '_START'
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Print the last white space separated field of every line in "file.txt" as a ", " separated list<|im_end|> <|im_start|>assistant awk '{print $N...
Print the last white space separated field of every line in "file.txt" as a ", " separated list
awk '{print $NF}' file.txt | paste -sd, | sed 's/,/, /g'
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Push the directory containing the first existing command found in all arguments to the directory stack.<|im_end|> <|im_start|>assistant pushd ...
Push the directory containing the first existing command found in all arguments to the directory stack.
pushd $(dirname `which $@`)
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Create a script to monitor system root user systemd target unit status and send an alert if any target units are not active.<|im_end|> <|im_st...
Create a script to monitor system root user systemd target unit status and send an alert if any target units are not active.
#!/bin/bash target_units="multi-user.target graphical.target" for unit in $target_units; do if ! systemctl is-active --quiet $unit; then echo "Target unit $unit is not active (root user)." | mail -s "Root Target Unit Status Alert" user@example.com fi done
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user find all files and directories under the current directory and display the filesize followed by the filename, using the stat command on FreeBS...
find all files and directories under the current directory and display the filesize followed by the filename, using the stat command on FreeBSD/OSX
find . -type f -exec stat -f "%z %N" {} \;
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Unzip "myDB.sql.gz" to standard output as input to "pg_restore ..."<|im_end|> <|im_start|>assistant gzip -cd myDB.sql.gz | pg_restore ...<|im_...
Unzip "myDB.sql.gz" to standard output as input to "pg_restore ..."
gzip -cd myDB.sql.gz | pg_restore ...
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user find all normal/regular files in current folder and display them in sorted order<|im_end|> <|im_start|>assistant find . -type f -ls | awk '{pr...
find all normal/regular files in current folder and display them in sorted order
find . -type f -ls | awk '{print $, $, $, $NF}'
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Send e-mail to "your_email@domain.com" with subject "any subject" containing process statistics output by the GNU version of 'top'.<|im_end|> ...
Send e-mail to "your_email@domain.com" with subject "any subject" containing process statistics output by the GNU version of 'top'.
top -b -n 1 | mail -s "any subject" your_email@domain.com
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user long list all the files in the curent folder starting with "Tes"<|im_end|> <|im_start|>assistant find . -type f -name "Tes*" -exec ls -l {} \;...
long list all the files in the curent folder starting with "Tes"
find . -type f -name "Tes*" -exec ls -l {} \;
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user display all files in the boot directory prepending each filename with STDERR, STDOUT accordingly<|im_end|> <|im_start|>assistant 3>&1 1>&2 2>&...
display all files in the boot directory prepending each filename with STDERR, STDOUT accordingly
3>&1 1>&2 2>&3 | sed 's/^/STDERR:/'
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Read a line from standard input and save each word in the bash array variable "arr"<|im_end|> <|im_start|>assistant read -a arr<|im_end|>
Read a line from standard input and save each word in the bash array variable "arr"
read -a arr
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Installs 'php-mbstring' package, enabling 'remi' repository.<|im_end|> <|im_start|>assistant yum --enablerepo=remi install php-mbstring<|im_en...
Installs 'php-mbstring' package, enabling 'remi' repository.
yum --enablerepo=remi install php-mbstring
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Find all files/directories with '.js' extension under current directory tree without descending into './directory'<|im_end|> <|im_start|>assis...
Find all files/directories with '.js' extension under current directory tree without descending into './directory'
find . -path ./directory -prune -o -name '*.js' -print
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Check if a file exists and is a socket.<|im_end|> <|im_start|>assistant #!/bin/bash file="/path/to/your/file.txt" if [ -S "$file" ]; then ...
Check if a file exists and is a socket.
#!/bin/bash file="/path/to/your/file.txt" if [ -S "$file" ]; then echo "$file exists and is a socket" else echo "$file does not exist or is not a socket" fi
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Unset all environment variables.<|im_end|> <|im_start|>assistant unset `env | awk -F= '/^\w/ {print $1}' | xargs`<|im_end|>
Unset all environment variables.
unset `env | awk -F= '/^\w/ {print $1}' | xargs`
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Bind mount "/original/path" on "/new/path"<|im_end|> <|im_start|>assistant mount --bind /original/path /new/path<|im_end|>
Bind mount "/original/path" on "/new/path"
mount --bind /original/path /new/path
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Prints only unique lines of './script.sh' output.<|im_end|> <|im_start|>assistant ./script.sh | sort -u<|im_end|>
Prints only unique lines of './script.sh' output.
./script.sh | sort -u
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Convert all DOS files under and below the current directory to the Unix format<|im_end|> <|im_start|>assistant find . -type f -print0 | xargs ...
Convert all DOS files under and below the current directory to the Unix format
find . -type f -print0 | xargs -0 -n 1 -P 4 dos2unix
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Create a script to monitor system webcam access attempts and generate reports on camera activations.<|im_end|> <|im_start|>assistant #!/bin/ba...
Create a script to monitor system webcam access attempts and generate reports on camera activations.
#!/bin/bash touch /tmp/webcam_access_report.txt while true; do grep 'camera' /var/log/syslog >> /tmp/webcam_access_report.txt sleep 3600 done
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Calculate the md5 sum of the contents of the sorted list of files "$FILES"<|im_end|> <|im_start|>assistant cat $(echo $FILES | sort) | md5sum<...
Calculate the md5 sum of the contents of the sorted list of files "$FILES"
cat $(echo $FILES | sort) | md5sum
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user List the files matching 'my key phrase' either in their names or contents<|im_end|> <|im_start|>assistant find | xargs -I {} bash -c '( || )'<...
List the files matching 'my key phrase' either in their names or contents
find | xargs -I {} bash -c '( || )'
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Search for the string 'git' in all the files under current directory tree without traversing into '.git' folder and excluding files that have ...
Search for the string 'git' in all the files under current directory tree without traversing into '.git' folder and excluding files that have 'git' in their names
find . -path ./.git -prune -o -not -name '*git*' -print |grep git
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user find all the video files which are bigger than 10 MB which have not been modified in the last 60 days but have been changed in the last 100 da...
find all the video files which are bigger than 10 MB which have not been modified in the last 60 days but have been changed in the last 100 days in /tmp and /var/tmp folder home folders
find /tmp /var/tmp ~ -type f -size +10M -mtime +60 -ctime -100 -exec file -N -i -- {} + | sed -n 's!: video/[^:]*$!!p'
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Gets IP address of 'en0' network interface.<|im_end|> <|im_start|>assistant ifconfig en0 | awk '/inet addr/{print substr($2,6)}'<|im_end|>
Gets IP address of 'en0' network interface.
ifconfig en0 | awk '/inet addr/{print substr($2,6)}'
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user search for a file in a directory and pass it as an input to the script getLine<|im_end|> <|im_start|>assistant find $dir -type f -name $1 -exe...
search for a file in a directory and pass it as an input to the script getLine
find $dir -type f -name $1 -exec getLine {} \;
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Redirects content of extracted file to a pipe<|im_end|> <|im_start|>assistant bunzip2 -c compressedfile.bz2 | yourfilterprogram<|im_end|>
Redirects content of extracted file to a pipe
bunzip2 -c compressedfile.bz2 | yourfilterprogram
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Recursively finds all files in a current folder excluding already compressed files and compresses them with level 9.<|im_end|> <|im_start|>ass...
Recursively finds all files in a current folder excluding already compressed files and compresses them with level 9.
find . -type f | egrep -v '\.bz2' | xargs bzip2 -9 &
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Search for the literal string 'v$process' in all files under current directory<|im_end|> <|im_start|>assistant find . -print|xargs grep v\$pro...
Search for the literal string 'v$process' in all files under current directory
find . -print|xargs grep v\$process
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Create a script to monitor system memory usage and send a notification if it exceeds a certain threshold.<|im_end|> <|im_start|>assistant #!/b...
Create a script to monitor system memory usage and send a notification if it exceeds a certain threshold.
#!/bin/bash threshold="90" memory_usage=$(free | grep Mem | awk '{print $3/$2 * 100.0}') if [ "$memory_usage" -gt "$threshold" ]; then echo "Memory usage is high: $memory_usage%" | mail -s "Memory Alert" user@example.com fi
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user search for all xml files in current folder and display the copy command to copy them to another folder<|im_end|> <|im_start|>assistant find . ...
search for all xml files in current folder and display the copy command to copy them to another folder
find . -name "*.xml" -exec sh -c 'echo "cp $0 someWhereElse/$0"' {} \;
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user List jobs and their process ids and print them by replacing newline with '^'<|im_end|> <|im_start|>assistant joblist=$<|im_end|>
List jobs and their process ids and print them by replacing newline with '^'
joblist=$
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Create a script that monitors system LDAP synchronization status and logs any errors.<|im_end|> <|im_start|>assistant #!/bin/bash while true;...
Create a script that monitors system LDAP synchronization status and logs any errors.
#!/bin/bash while true; do ldapsearch -x -LLL -b '' -s base '(&)' '*' '+' | grep -E '^(structuralObjectClass|numResponses|resultCode):' sleep 600 done
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Print the current date in '%H:%M:%S' format followed by the string ': done waiting. both jobs terminated on their own or via timeout; resuming...
Print the current date in '%H:%M:%S' format followed by the string ': done waiting. both jobs terminated on their own or via timeout; resuming script'
echo "$: done waiting. both jobs terminated on their own or via timeout; resuming script"
AnishJoshi/nl2bash-custom
<|im_start|>system You are an expert shell programmer. Given a natural language request, output ONLY the corresponding shell command. No explanations.<|im_end|> <|im_start|>user Append the current date to variable 'LBUFFER'<|im_end|> <|im_start|>assistant LBUFFER+="$(date)"<|im_end|>
Append the current date to variable 'LBUFFER'
LBUFFER+="$(date)"
AnishJoshi/nl2bash-custom