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 Assign the alias rm2g to a find command that removes any .tar file larger than 2 gigabytes.<|im_end|> <|im_start|>assistant alias rm2g="find /...
Assign the alias rm2g to a find command that removes any .tar file larger than 2 gigabytes.
alias rm2g="find / -type f -name *.tar -size +2G -exec rm -i {} \;"
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 /Path directory tree for files matching pattern "file_name*" and containing "bar" in their pathnames<|im_end|> <|im_start|>assistan...
Search the /Path directory tree for files matching pattern "file_name*" and containing "bar" in their pathnames
find /Path -name "file_name*" | grep "bar"
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 process information twice, waiting one second between each, filtering out the header line.<|im_end|> <|im_start|>assistant top -b -d2 ...
Display process information twice, waiting one second between each, filtering out the header line.
top -b -d2 -s1 | sed -e '1,/USERNAME/d' | sed -e '1,/^$/d'
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 Output success.txt omitting lines whose first field appears in fail.txt - lines in fail.txt must appear in the same order as they do in succes...
Output success.txt omitting lines whose first field appears in fail.txt - lines in fail.txt must appear in the same order as they do in success.txt.
join -v1 success.txt fail.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 all *.md files in entire file system and convert them to HTML files<|im_end|> <|im_start|>assistant find / -name "*.md" -type f -exec ma...
Find all *.md files in entire file system and convert them to HTML files
find / -name "*.md" -type f -exec markdown -o {}.html {} \;
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 Count total number of lines in all *.txt file in cuuent directory .<|im_end|> <|im_start|>assistant find . -type f -name '*.txt' -exec wc -l...
Count total number of lines in all *.txt file in cuuent directory .
find . -type f -name '*.txt' -exec wc -l {} \; | awk '{total += $1} END{print total}'
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 PostgreSQL database status and vacuum databases when disk space is low.<|im_end|> <|im_start|>assistant #!/b...
Create a script to monitor system PostgreSQL database status and vacuum databases when disk space is low.
#!/bin/bash threshold="10GB" disk_space=$(df -h /var/lib/postgresql | awk 'NR==2 {print $4}') if [ "$disk_space" -lt "$threshold" ]; then sudo -u postgres vacuumdb --all --analyze 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 Prints ten latest modified files within the current directory.<|im_end|> <|im_start|>assistant find . -type f -printf '%T@ %p\n' | sort -n -r ...
Prints ten latest modified files within the current directory.
find . -type f -printf '%T@ %p\n' | sort -n -r | head -${numl} | cut -f2- -d" " | sed -e 's,^\./,,' | xargs ls -U -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 Move *wp-admin/index.php files under /var/www/ to ./index_disabled<|im_end|> <|im_start|>assistant find /var/www/ -path '*wp-admin/index.php'...
Move *wp-admin/index.php files under /var/www/ to ./index_disabled
find /var/www/ -path '*wp-admin/index.php' -exec mv {} $/index_disabled
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 file exists and has been modified in the last 3 days.<|im_end|> <|im_start|>assistant #!/bin/bash file="/path/to/file" i...
Check if a specific file exists and has been modified in the last 3 days.
#!/bin/bash file="/path/to/file" if [ -e "$file" ] && [ $(find "$file" -mtime -3 | wc -l) -gt 0 ]; then echo "$file has been modified in the last 3 days" else echo "$file does not exist or has not been modified in the last 3 days" 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 full path symbolic link "$newlink" from a relative path symbolic link "$origlink"<|im_end|> <|im_start|>assistant ln -s $ $newlink<|i...
Create a full path symbolic link "$newlink" from a relative path symbolic link "$origlink"
ln -s $ $newlink
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 an infinite number of lines consisting of "y", until the user presses the Q key.<|im_end|> <|im_start|>assistant yes | more<|im_end|>
Display an infinite number of lines consisting of "y", until the user presses the Q key.
yes | more
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 directory is empty.<|im_end|> <|im_start|>assistant #!/bin/bash directory="/path/to/your/directory" if [ -z "$(ls -A "$directory"...
Check if a directory is empty.
#!/bin/bash directory="/path/to/your/directory" if [ -z "$(ls -A "$directory")" ]; then echo "$directory is empty" else echo "$directory is not empty" 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 Force create a symbolc link named "softlink_name" to "source_file_or_directory_name" without dereferencing "softlink_name"<|im_end|> <|im_star...
Force create a symbolc link named "softlink_name" to "source_file_or_directory_name" without dereferencing "softlink_name"
ln -sfn source_file_or_directory_name softlink_name
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 service status and send an alert if any services are not running.<|im_end|> <|im_start|>as...
Create a script to monitor system root user systemd service status and send an alert if any services are not running.
#!/bin/bash services="sshd apache2 mysql" for service in $services; do if ! systemctl is-active --quiet $service; then echo "Service $service is not running (root user)." | mail -s "Root Service 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 Delete the commands 1006 through 1008 from history<|im_end|> <|im_start|>assistant for h in $; do history -d $h; done<|im_end|>
Delete the commands 1006 through 1008 from history
for h in $; do history -d $h; 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 Monitor system disk usage every 10 seconds for 1 minute and display the results.<|im_end|> <|im_start|>assistant #!/bin/bash for ((i=0; i<6; ...
Monitor system disk usage every 10 seconds for 1 minute and display the results.
#!/bin/bash for ((i=0; i<6; i++)); do df -h >> disk_usage.log sleep 10 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 Create a script to monitor system root user systemd socket unit status and send an alert if any socket units are not active.<|im_end|> <|im_st...
Create a script to monitor system root user systemd socket unit status and send an alert if any socket units are not active.
#!/bin/bash socket_units="sshd.socket apache2.socket mysql.socket" for unit in $socket_units; do if ! systemctl is-active --quiet $unit; then echo "Socket unit $unit is not active (root user)." | mail -s "Root Socket 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 remote copy all text files from one location to another<|im_end|> <|im_start|>assistant find . -name '*.txt' -exec rsync -R {} path/to/dext \...
remote copy all text files from one location to another
find . -name '*.txt' -exec rsync -R {} path/to/dext \;
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 current directory tree for files whose names end in "rb" or "js"<|im_end|> <|im_start|>assistant find . -regextype posix-egrep -reg...
Search the current directory tree for files whose names end in "rb" or "js"
find . -regextype posix-egrep -regex ".*$"
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 php files<|im_end|> <|im_start|>assistant find -name '*.php'<|im_end|>
find all the php files
find -name '*.php'
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 sorted list of unique users logged in followed by a total count<|im_end|> <|im_start|>assistant who | awk '{ print $1; }' | sort -u | aw...
Print sorted list of unique users logged in followed by a total count
who | awk '{ print $1; }' | sort -u | awk '{print $1; u++} END{ print "users: " 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 Find List of directory with non-zero file count<|im_end|> <|im_start|>assistant find -maxdepth 1 -type d | sort | while read -r dir; do n=$; ...
Find List of directory with non-zero file count
find -maxdepth 1 -type d | sort | while read -r dir; do n=$; if [ $n -gt 0 ]; then printf "%4d : %s\n" $n "$dir"; 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 Send each byte in "/home/cscape/Desktop/file" to awk script "x.awk"<|im_end|> <|im_start|>assistant fold -1 /home/cscape/Desktop/file | awk -...
Send each byte in "/home/cscape/Desktop/file" to awk script "x.awk"
fold -1 /home/cscape/Desktop/file | awk -f x.awk
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 Force pseudo-terminal allocation to run "sudo <cmd>" on "remotehost"<|im_end|> <|im_start|>assistant ssh -t remotehost "sudo <cmd>"<|im_end|>
Force pseudo-terminal allocation to run "sudo <cmd>" on "remotehost"
ssh -t remotehost "sudo <cmd>"
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 square root of a number.<|im_end|> <|im_start|>assistant #!/bin/bash num=25 sqrt=$(echo "sqrt($num)" | bc) echo "...
Create a script to find the square root of a number.
#!/bin/bash num=25 sqrt=$(echo "sqrt($num)" | bc) echo "The square root of $num is: $sqrt"
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 Compress regular files in the current directory tree that were last modified more than 7 days ago<|im_end|> <|im_start|>assistant find . -type...
Compress regular files in the current directory tree that were last modified more than 7 days ago
find . -type f -mtime +7 | tee compressedP.list | xargs compress
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 names of the directories from the paths expanded by the glob pattern /path/to/directory/*<|im_end|> <|im_start|>assistant find /path...
Print the names of the directories from the paths expanded by the glob pattern /path/to/directory/*
find /path/to/directory/* -maxdepth 0 -type d -exec basename -a {} +
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 Delete and count files in $DIR_TO_CLEAN that are older than $DAYS_TO_SAVE days<|im_end|> <|im_start|>assistant find "$DIR_TO_CLEAN" -type -f -...
Delete and count files in $DIR_TO_CLEAN that are older than $DAYS_TO_SAVE days
find "$DIR_TO_CLEAN" -type -f -mtime "+$DAYS_TO_SAVE" -exec rm {} \; -exec printf '.' \; | wc -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 Execute "./my_script.sh" every 3 seconds and highlight the differences in successive runs<|im_end|> <|im_start|>assistant watch -n 3 -d ./my_s...
Execute "./my_script.sh" every 3 seconds and highlight the differences in successive runs
watch -n 3 -d ./my_script.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 Move all *foo* directories under current directory to new paths obtained by replacing all occurrences of 'foo' with 'Bar' in their paths<|im...
Move all *foo* directories under current directory to new paths obtained by replacing all occurrences of 'foo' with 'Bar' in their paths
find . -type d -iname '*foo*' -exec bash -O nocasematch -c '[[ $1 =~ ]] && mv "$1" "${1//${BASH_REMATCH[1]}/Bar}"' -- {} \;
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 From another terminal, detach process $PID from its terminal and run it in the background.<|im_end|> <|im_start|>assistant kill -20 $PID; kill...
From another terminal, detach process $PID from its terminal and run it in the background.
kill -20 $PID; kill -18 $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 Print the list of all processes running as a specific user.<|im_end|> <|im_start|>assistant #!/bin/bash username="username" ps -U $username<...
Print the list of all processes running as a specific user.
#!/bin/bash username="username" ps -U $username
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 commands in /usr/bin, pausing for user input after each page.<|im_end|> <|im_start|>assistant more <<|im_end|>
List the commands in /usr/bin, pausing for user input after each page.
more <
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 "hostname" as user "buck"<|im_end|> <|im_start|>assistant ssh -l buck hostname<|im_end|>
ssh into "hostname" as user "buck"
ssh -l buck hostname
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 process CPU usage and send an alert if any process exceeds a certain CPU usage.<|im_end|> <|im_start|>assist...
Create a script to monitor system process CPU usage and send an alert if any process exceeds a certain CPU usage.
#!/bin/bash threshold="50" processes=$(ps aux --sort=-%cpu | awk 'NR<=5{print $11}') while read -r process; do cpu_usage=$(ps -C "$process" --no-headers -o %cpu | awk '{print $1}') if (( $(echo "$cpu_usage > $threshold" | bc -l) )); then echo "Process $process is consuming high CPU: $cpu_usage%" | ma...
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 Write list of files present only in dir1 to file "difference1.txt".<|im_end|> <|im_start|>assistant diff -r dir1 dir2 | grep 'Only in' | grep ...
Write list of files present only in dir1 to file "difference1.txt".
diff -r dir1 dir2 | grep 'Only in' | grep dir1 | awk '{print $4}' > difference1.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 Search the current directory tree for all image files<|im_end|> <|im_start|>assistant find . -type f -regex ".*\.\"<|im_end|>
Search the current directory tree for all image files
find . -type f -regex ".*\.\"
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 "y" for each line in "file2.txt" found in "file1.txt" and a blank newline otherwise<|im_end|> <|im_start|>assistant comm -2 file1.txt fi...
Print "y" for each line in "file2.txt" found in "file1.txt" and a blank newline otherwise
comm -2 file1.txt file2.txt | awk -F'\t' '{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 Convert the string "$myArray" into a bash array using ";" delimiters<|im_end|> <|im_start|>assistant IFS=';' read -a myArray <<< "$myArray"<|i...
Convert the string "$myArray" into a bash array using ";" delimiters
IFS=';' read -a myArray <<< "$myArray"
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 Remove files that are greater than 1MB in size under <directory><|im_end|> <|im_start|>assistant find <directory> -type f -size +1M -delete<|i...
Remove files that are greater than 1MB in size under <directory>
find <directory> -type f -size +1M -delete
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 file exists and is a socket.<|im_end|> <|im_start|>assistant #!/bin/bash file="/path/to/file" if [ -S "$file" ]; then ...
Check if a specific file exists and is a socket.
#!/bin/bash file="/path/to/file" 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 Saves hostname that matches ${ip_address} in 'host' variable, without trailing dot.<|im_end|> <|im_start|>assistant host=$(dig +short -x "${ip...
Saves hostname that matches ${ip_address} in 'host' variable, without trailing dot.
host=$(dig +short -x "${ip_address}" | 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 display all regular/normal files in the current folder that were accessed exactly 7*24 hours back<|im_end|> <|im_start|>assistant find . -type...
display all regular/normal files in the current folder that were accessed exactly 7*24 hours back
find . -type f -atime 7
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 Immediately kill all child processes of parent process whose ID is specified by the variable PPID.<|im_end|> <|im_start|>assistant ps -o pid= ...
Immediately kill all child processes of parent process whose ID is specified by the variable PPID.
ps -o pid= --ppid $PPID | xargs kill -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 Copy all files in "/path/to/local/storage" to "/path/to/copy" on host "remote.host" authenticating as user "user"<|im_end|> <|im_start|>assis...
Copy all files in "/path/to/local/storage" to "/path/to/copy" on host "remote.host" authenticating as user "user"
rsync /path/to/local/storage user@remote.host:/path/to/copy
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 files under $dir directory except path $dir/prune_me directory<|im_end|> <|im_start|>assistant find "$dir" -not -path "$dir/prune_me*...
list all files under $dir directory except path $dir/prune_me directory
find "$dir" -not -path "$dir/prune_me*" -exec bash -c 'echo "$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 find all the xml files in the current folder which are present in the pattern text file<|im_end|> <|im_start|>assistant find . -name "*.xml" -...
find all the xml files in the current folder which are present in the pattern text file
find . -name "*.xml" -exec grep -HFf < {} \;
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 for each *.txt file from the $DIR directory tree<|im_end|> <|im_start|>assistant find $DIR -name "*.txt" -exec wc -l...
Print the number of lines for each *.txt file from the $DIR directory tree
find $DIR -name "*.txt" -exec wc -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 change the permissions of all the directories in the folder "/path/to/someDirectory" to 755<|im_end|> <|im_start|>assistant sudo find /path/to...
change the permissions of all the directories in the folder "/path/to/someDirectory" to 755
sudo find /path/to/someDirectory -type d -print0 | xargs -0 sudo chmod 755
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 in '%d%m%Y-%H-%M' format, '_' and the current username, then save it in 'name' variable<|im_end|> <|im_start|>assistan...
Append the current date in '%d%m%Y-%H-%M' format, '_' and the current username, then save it in 'name' variable
name="$_$"
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 by process and send an alert if any process consumes excessive memory.<|im_end|> <|im_start|>as...
Create a script to monitor system memory usage by process and send an alert if any process consumes excessive memory.
#!/bin/bash threshold="500000" processes="$(ps -eo pid,%mem,cmd | grep -vE 'PID|%MEM' | sort -nr -k2 | head -n 5)" while read -r line; do pid=$(echo "$line" | awk '{print $1}') mem=$(echo "$line" | awk '{print $2}') if [ "$mem" -gt "$threshold" ]; then echo "Process $pid is consuming high memory...
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 nth Fibonacci number using recursion.<|im_end|> <|im_start|>assistant #!/bin/bash fibonacci() { n="$1" if...
Create a script to find the nth Fibonacci number using recursion.
#!/bin/bash fibonacci() { n="$1" if [ "$n" -le 1 ]; then echo "$n" else echo $(( $(fibonacci $(($n - 1))) + $(fibonacci $(($n - 2))) )) fi } result=$(fibonacci 10) echo "The 10th Fibonacci number is: $result"
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 Insert the current host name on line 15 of "test.html"<|im_end|> <|im_start|>assistant sed -i "15i `hostname`" test.html<|im_end|>
Insert the current host name on line 15 of "test.html"
sed -i "15i `hostname`" test.html
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 current directory tree for all .java files newer than the file build.xml<|im_end|> <|im_start|>assistant find . -name '*.java' -new...
Search the current directory tree for all .java files newer than the file build.xml
find . -name '*.java' -newer build.xml -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 Create a script to monitor system cron jobs and send an alert if any jobs fail to execute.<|im_end|> <|im_start|>assistant #!/bin/bash cron_l...
Create a script to monitor system cron jobs and send an alert if any jobs fail to execute.
#!/bin/bash cron_logs="/var/log/cron.log" failed_jobs=$(grep -i 'error' $cron_logs | awk '{print $5}') if [ -n "$failed_jobs" ]; then echo "Some cron jobs failed to execute: $failed_jobs" | mail -s "Cron Job Failure 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 Read a single character from standard input with prompt "Are you sure? "<|im_end|> <|im_start|>assistant read -p "Are you sure? " -n 1<|im_e...
Read a single character from standard input with prompt "Are you sure? "
read -p "Are you sure? " -n 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 that monitors system CPU temperature every 10 seconds for 1 minute and alerts if it exceeds a certain threshold.<|im_end|> <|i...
Create a script that monitors system CPU temperature every 10 seconds for 1 minute and alerts if it exceeds a certain threshold.
#!/bin/bash threshold=70 for ((i=0; i<6; i++)); do cpu_temp=$(sensors | grep 'Tdie' | awk '{print $2}') if (( $(echo "$cpu_temp > $threshold" | bc -l) )); then echo "High CPU temperature: $cpu_temp°C" fi sleep 10 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 Create a script to monitor MySQL database performance and send an alert if it exceeds a certain threshold.<|im_end|> <|im_start|>assistant #!/...
Create a script to monitor MySQL database performance and send an alert if it exceeds a certain threshold.
#!/bin/bash threshold="90" mysql_cpu_usage=$(ps -C mysql --no-headers -o %cpu | awk '{print $1}') if [ "$mysql_cpu_usage" -gt "$threshold" ]; then echo "MySQL CPU usage is too high: $mysql_cpu_usage%" | mail -s "High MySQL CPU Usage 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 the regular files of the current directory tree for string "foo"<|im_end|> <|im_start|>assistant find . -type f -exec grep "foo" '{}' \...
Search the regular files of the current directory tree for string "foo"
find . -type f -exec grep "foo" '{}' \;
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 all occurrences of 'previousword' with 'newword' in all regular files with '.cpp' extension under '/home/www' directory tree and modif...
Replace all occurrences of 'previousword' with 'newword' in all regular files with '.cpp' extension under '/home/www' directory tree and modify them in-place
find /home/www -type f -name '*.cpp' -exec sed -i 's/previousword/newword/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 Find all Name* files under ../../$name-module and rename them by replacing 'Name' with $Name in their names<|im_end|> <|im_start|>assistant f...
Find all Name* files under ../../$name-module and rename them by replacing 'Name' with $Name in their names
find ../../$name-module -name 'Name*' -type f -exec bash -c "mv \"\$1\" \"\${1/Name/$Name}\"" -- {} \;
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 Perform case-insensitive search for file `TeSt123.txt' on the system<|im_end|> <|im_start|>assistant find / -iname TeSt123.txt<|im_end|>
Perform case-insensitive search for file `TeSt123.txt' on the system
find / -iname TeSt123.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 Change permissions to 644 for all directories under and below /path/to/someDirectory/<|im_end|> <|im_start|>assistant find /path/to/someDirect...
Change permissions to 644 for all directories under and below /path/to/someDirectory/
find /path/to/someDirectory -type d -print0 | xargs -0 sudo chmod 755
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 Delete in the background all files in /var/tmp/stuff1 and below that have not been modified in over 90 days<|im_end|> <|im_start|>assistant fi...
Delete in the background all files in /var/tmp/stuff1 and below that have not been modified in over 90 days
find /var/tmp/stuff1 -mtime +90 -delete &
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 files in current folder which have spaces and save the long listing of these files to log file before deleting them<|im_end|> <|i...
find all the files in current folder which have spaces and save the long listing of these files to log file before deleting them
find . -name "filename including space" -print0 | xargs -0 -I '{}' sh -c 'ls -aldF {} >> log.txt; rm -rdf {}'
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 user name in upper case of the current user in variable "v"<|im_end|> <|im_start|>assistant v=$<|im_end|>
Save the user name in upper case of the current user in variable "v"
v=$
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 "Shared Memory" if shared memory mounted at /tmp or print "Not Shared Memory" otherwise.<|im_end|> <|im_start|>assistant df /tmp | grep ...
Print "Shared Memory" if shared memory mounted at /tmp or print "Not Shared Memory" otherwise.
df /tmp | grep -q tmpfs && echo "Shared Memory" || echo "Not Shared Memory"
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 "s" for command 'it=$($)'<|im_end|> <|im_start|>assistant alias s='it=$($)'<|im_end|>
set alias "s" for command 'it=$($)'
alias s='it=$($)'
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 the files in the folder /data/images which have been modified after /tmp/start and before /tmp/end and save the output list to ...
search for all the files in the folder /data/images which have been modified after /tmp/start and before /tmp/end and save the output list to output.txt
find /data/images -type f -newer /tmp/start -not -newer /tmp/end > output.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 Format the output of "..." as a tab separated table<|im_end|> <|im_start|>assistant ... | column -s$'\t' -t<|im_end|>
Format the output of "..." as a tab separated table
... | column -s$'\t' -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 Constantly write "y" to backingfile as a background process<|im_end|> <|im_start|>assistant yes > backingfile &<|im_end|>
Constantly write "y" to backingfile as a background process
yes > backingfile &
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 git branch currently checked out in a working directory.<|im_end|> <|im_start|>assistant git symbolic-ref HEAD 2>/dev/null | cut -d"/" -...
Print git branch currently checked out in a working directory.
git symbolic-ref HEAD 2>/dev/null | cut -d"/" -f 3
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 Answer "y" to all "Are you sure?" prompts from command "cp * /tmp"<|im_end|> <|im_start|>assistant yes | cp * /tmp<|im_end|>
Answer "y" to all "Are you sure?" prompts from command "cp * /tmp"
yes | cp * /tmp
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 Archive directory specified by variable "myFolder" to current directory.<|im_end|> <|im_start|>assistant rsync -av $myFolder .<|im_end|>
Archive directory specified by variable "myFolder" to current directory.
rsync -av $myFolder .
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 users who have logged in this month.<|im_end|> <|im_start|>assistant #!/bin/bash last | grep "$(date '+%b')" | awk '{print ...
Print the list of users who have logged in this month.
#!/bin/bash last | grep "$(date '+%b')" | awk '{print $1}' | 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 Check if a specific directory exists and has sticky bit set.<|im_end|> <|im_start|>assistant #!/bin/bash directory="/path/to/directory" if [...
Check if a specific directory exists and has sticky bit set.
#!/bin/bash directory="/path/to/directory" if [ -d "$directory" ] && [ $(stat -c %a "$directory" | grep '^1') ]; then echo "Directory exists and has sticky bit set" else echo "Directory either does not exist or does not have sticky bit set" 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 Copies ${FILE} to COLLECT folder with unique name formatted like 'job_XXXXXXXXX'.<|im_end|> <|im_start|>assistant cp "${FILE}" "COLLECT/$"<|im...
Copies ${FILE} to COLLECT folder with unique name formatted like 'job_XXXXXXXXX'.
cp "${FILE}" "COLLECT/$"
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 modified time of a file.<|im_end|> <|im_start|>assistant #!/bin/bash file_path="/path/to/your/file.txt" stat -c %y "$file_pat...
Print the last modified time of a file.
#!/bin/bash file_path="/path/to/your/file.txt" stat -c %y "$file_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 Check if current shell is running within a 'screen' process.<|im_end|> <|im_start|>assistant pstree --show-parents -p $$ | head -n 1 | sed 's/...
Check if current shell is running within a 'screen' process.
pstree --show-parents -p $$ | head -n 1 | sed 's/\+.*/\1/' | wc -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 Find all files named "file.ext" in the current directory tree and print the path names of the directories they are in<|im_end|> <|im_start|>as...
Find all files named "file.ext" in the current directory tree and print the path names of the directories they are in
find $PWD -name "file.ext" -exec sh -c '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 Create a script that monitors system kernel messages for errors and alerts if any errors are found.<|im_end|> <|im_start|>assistant #!/bin/bas...
Create a script that monitors system kernel messages for errors and alerts if any errors are found.
#!/bin/bash while true; do dmesg | grep -i 'error' 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 all files/directories under current directory that match the case insensitive regex ./\.* and show several lines of output from the begin...
Find all files/directories under current directory that match the case insensitive regex ./\.* and show several lines of output from the beginning
find . -iregex './\.*' | head
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 change to a directory and search for a file in that directory<|im_end|> <|im_start|>assistant cd /nfs//office/ && find . -name '.user.log'<|im...
change to a directory and search for a file in that directory
cd /nfs//office/ && find . -name '.user.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 Print unique lines in "file1" compared to "file2" in the order they appear<|im_end|> <|im_start|>assistant comm -23 < <|grep -f - file1<|im_en...
Print unique lines in "file1" compared to "file2" in the order they appear
comm -23 < <|grep -f - file1
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 files in current folder using name patterns<|im_end|> <|im_start|>assistant find . -name "S1A*1S*SAFE"<|im_end|>
search for files in current folder using name patterns
find . -name "S1A*1S*SAFE"
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 git branch currently checked out in a working directory.<|im_end|> <|im_start|>assistant git branch | grep "*" | cut -d ' ' -f 2<|im_end...
Print git branch currently checked out in a working directory.
git branch | grep "*" | cut -d ' ' -f 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 download contents of a website "http://example.com/"<|im_end|> <|im_start|>assistant curl http://example.com/<|im_end|>
download contents of a website "http://example.com/"
curl http://example.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 change the owner of all the files in the file system which belong to the user with the uid 999<|im_end|> <|im_start|>assistant find / -user 99...
change the owner of all the files in the file system which belong to the user with the uid 999
find / -user 999 -exec chown NEWUSER {} \;
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 first 3 lines output by 'yes' to 'file', and log the rest through 'more' which simply waits for user interaction at each page.<|im_en...
Save the first 3 lines output by 'yes' to 'file', and log the rest through 'more' which simply waits for user interaction at each page.
yes | awk 'FNR<4 {print >>"file"; close} 1' | more
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 Remove trailing white spaces from all files under dir directory and keep backups of the originals<|im_end|> <|im_start|>assistant find dir -ty...
Remove trailing white spaces from all files under dir directory and keep backups of the originals
find dir -type f -print0 | xargs -0 sed -i .bak -E "s/[[:space:]]*$//"
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 Remove all *.bak and *.backup files that were accessed last time more than 30 days ago<|im_end|> <|im_start|>assistant find . \ -type f -atime...
Remove all *.bak and *.backup files that were accessed last time more than 30 days ago
find . \ -type f -atime +30 -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 Rename "file.txt" in directories "v_1", "v_2", and "v_3" each to "v_1.txt", "v_2.txt", and "v_3.txt" respectively and print the conversion<|im...
Rename "file.txt" in directories "v_1", "v_2", and "v_3" each to "v_1.txt", "v_2.txt", and "v_3.txt" respectively and print the conversion
rename -v 's#/file##' v_{1,2,3}/file.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 Page through the contents of 'file', but excess from lines that don't fit within the screen/window width is cut.<|im_end|> <|im_start|>assista...
Page through the contents of 'file', but excess from lines that don't fit within the screen/window width is cut.
less -S file
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 in current directory excluding hidden files, archive them and put the output into variable full_backup_dir<|im_end|> <|im_star...
Find all files in current directory excluding hidden files, archive them and put the output into variable full_backup_dir
full_backup_dir="$(find . -depth \ -prune -o -print | cpio -oav)"
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 files with pattern "*[!0-9][1-9].txt" and execute chmod and ls command with AND condition then sort the output<|im_end|> <|im_start|>ass...
Find files with pattern "*[!0-9][1-9].txt" and execute chmod and ls command with AND condition then sort the output
sudo find -name "*[!0-9][1-9].txt" -exec chmod 744 '*' {} \; -a -exec ls -l {} \; | sort | parallel 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 the .sh scripts in the folder /usr<|im_end|> <|im_start|>assistant find /usr -name \*.sh<|im_end|>
display all the .sh scripts in the folder /usr
find /usr -name \*.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 Create a script to monitor system Docker container status and send alerts if containers are stopped.<|im_end|> <|im_start|>assistant #!/bin/ba...
Create a script to monitor system Docker container status and send alerts if containers are stopped.
#!/bin/bash stopped_containers=$(docker ps -a -q -f 'status=exited' | wc -l) if [ "$stopped_containers" -gt "0" ]; then echo "Some Docker containers are stopped." | mail -s "Docker Container 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 List all files/directories under current directory matching the posix-egrep type regex ".+\.$" in their names excluding the files that contain...
List all files/directories under current directory matching the posix-egrep type regex ".+\.$" in their names excluding the files that contain 'generated' or 'deploy' in their paths
find . -regextype posix-egrep -regex '.+\.$' -print0 | grep -vzZ generated | grep -vzZ deploy | xargs -0 ls -1Ld
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 files under current directory matching the regex '.*\.\'<|im_end|> <|im_start|>assistant find . -type f -regex '.*\.\' -exec ls {} \;...
List all files under current directory matching the regex '.*\.\'
find . -type f -regex '.*\.\' -exec ls {} \;
AnishJoshi/nl2bash-custom