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 Execute "tail file | grep pattern" every 2 seconds<|im_end|> <|im_start|>assistant watch "tail file | grep pattern"<|im_end|>
Execute "tail file | grep pattern" every 2 seconds
watch "tail file | grep pattern"
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 process is running and terminate it if it is.<|im_end|> <|im_start|>assistant #!/bin/bash process_name="process_name" if...
Check if a specific process is running and terminate it if it is.
#!/bin/bash process_name="process_name" if pgrep -x $process_name >/dev/null; then pkill -x $process_name 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 that monitors system software package updates and logs any available updates.<|im_end|> <|im_start|>assistant #!/bin/bash whi...
Create a script that monitors system software package updates and logs any available updates.
#!/bin/bash while true; do apt-get update > /dev/null apt-get --just-print upgrade | grep 'Inst ' sleep 86400 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 that monitors system backup failures and alerts if any failures are found.<|im_end|> <|im_start|>assistant #!/bin/bash while ...
Create a script that monitors system backup failures and alerts if any failures are found.
#!/bin/bash while true; do grep -i 'backup' /var/log/syslog | grep -i 'error' 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 file exists and is a directory.<|im_end|> <|im_start|>assistant #!/bin/bash file="/path/to/file" if [ -d "$file" ]; then...
Check if a specific file exists and is a directory.
#!/bin/bash file="/path/to/file" if [ -d "$file" ]; then echo "$file exists and is a directory" else echo "$file does not exist or is not a directory" 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 directories under /directory-path and change their permission to 2755<|im_end|> <|im_start|>assistant find /directory-path -type d -...
Find all directories under /directory-path and change their permission to 2755
find /directory-path -type d -exec sudo chmod 2775 {} +
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 regular files in and below the current directory<|im_end|> <|im_start|>assistant find . -type f -print | sed...
Change permissions to 644 for all regular files in and below the current directory
find . -type f -print | sed -e 's/^/"/' -e 's/$/"/' | xargs chmod 644
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 all man entries beginning with std and sends them to vi.<|im_end|> <|im_start|>assistant apropos -r '^std' | vi -<|im_end|>
Gets all man entries beginning with std and sends them to vi.
apropos -r '^std' | vi -
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 all files beginning with .env or .bash in current directory to user's home directory on host "app1", preserving timestamps and skippin...
Archive all files beginning with .env or .bash in current directory to user's home directory on host "app1", preserving timestamps and skipping files that are newer on "app1"
rsync -vaut ~/.env* ~/.bash* app1:
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 all empty directories in the /some/parrent/dir directory tree<|im_end|> <|im_start|>assistant find /some/parrent/dir -type d | while re...
Delete all empty directories in the /some/parrent/dir directory tree
find /some/parrent/dir -type d | while read d ; do ls "$d"/* &>/dev/null || rm -r "$d"; 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 Add the .abc suffix to the names of all *.txt regular files in the current directory tree<|im_end|> <|im_start|>assistant find . -type f -inam...
Add the .abc suffix to the names of all *.txt regular files in the current directory tree
find . -type f -iname '*.txt' -print0 | xargs -0 mv {} {}.abc
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 current host's IPv6 address.<|im_end|> <|im_start|>assistant host $ | grep "IPv6 address" | head -n 1 | awk '{print $5}'<|im_end|>
Get current host's IPv6 address.
host $ | grep "IPv6 address" | head -n 1 | awk '{print $5}'
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 "*Checking Partition Permission* Hostname=$ LastChecked=" followed by the current date<|im_end|> <|im_start|>assistant echo -n *Checking...
Print "*Checking Partition Permission* Hostname=$ LastChecked=" followed by the current date
echo -n *Checking Partition Permission* Hostname=$ LastChecked=$
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 in the current directory for each hidden file or directory in "git-stuff/home/" excluding "." and ".."<|im_end|> <|im_s...
Create a symbolic link in the current directory for each hidden file or directory in "git-stuff/home/" excluding "." and ".."
ln -s git-stuff/home/.[!.]* .
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 network interface status and send an alert if it's down.<|im_end|> <|im_start|>assistant #!/bin/bash interface="et...
Create a script to monitor network interface status and send an alert if it's down.
#!/bin/bash interface="eth0" status=$(ip link show $interface | grep "state" | awk '{print $9}') if [ "$status" != "UP" ]; then echo "$interface 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 Print the total number of lines in all text files within a directory.<|im_end|> <|im_start|>assistant #!/bin/bash cat /path/to/your/directory...
Print the total number of lines in all text files within a directory.
#!/bin/bash cat /path/to/your/directory/*.txt | 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 Search the current directory tree for regular files whose names end with "keep.${SUFFIX}", where $SUFFIX is a shell variable<|im_end|> <|im_st...
Search the current directory tree for regular files whose names end with "keep.${SUFFIX}", where $SUFFIX is a shell variable
find . -type f -name "*keep.${SUFFIX}"
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 all files in "/your/dir" including content and filenames<|im_end|> <|im_start|>assistant grep -ar -e . /your/dir | md...
Calculate the md5 sum of all files in "/your/dir" including content and filenames
grep -ar -e . /your/dir | md5sum | cut -c-32
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 top 10 most frequent commands executed by users.<|im_end|> <|im_start|>assistant #!/bin/bash history | awk '{print $2}' | s...
Print the list of top 10 most frequent commands executed by users.
#!/bin/bash history | awk '{print $2}' | sort | uniq -c | sort -nr | head -n 10
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 first file/directory under current directory named 'modules' and exit with empty result<|im_end|> <|im_start|>assistant find . -name ...
Find the first file/directory under current directory named 'modules' and exit with empty result
find . -name modules -exec sh -c 'exit 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 *gz files under asia and emea directory and print their names and line counts to file_count.txt<|im_end|> <|im_start|>assistant find ...
Find all *gz files under asia and emea directory and print their names and line counts to file_count.txt
find asia emea -type f -name "*gz" | while IFS= read -r fname; do printf "%s %s\n" "$fname" $ >> file_count.txt; 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 Kafka Streams application status and restart applications when processing latency exceeds a certain threshol...
Create a script to monitor system Kafka Streams application status and restart applications when processing latency exceeds a certain threshold.
#!/bin/bash app_name="<app_name>" latency=$(kafka-streams-monitoring-tool get-latency $app_name) threshold="500" if [ "$latency" -gt "$threshold" ]; then kafka-streams-application-restart $app_name 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 Print the IP addresses for the current host name<|im_end|> <|im_start|>assistant host `hostname` | awk '{print $4}'<|im_end|>
Print the IP addresses for the current host name
host `hostname` | awk '{print $4}'
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 under current directory excluding hidden directories<|im_end|> <|im_start|>assistant find -name '.?*' -prune -o \<|im_end|>
Find all files under current directory excluding hidden directories
find -name '.?*' -prune -o \
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 Thumbs.db files under temp/images directory<|im_end|> <|im_start|>assistant find temp/images/ -type f -iname Thumbs.db | while re...
Remove all Thumbs.db files under temp/images directory
find temp/images/ -type f -iname Thumbs.db | while read FILE ; do rm "${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 Save absolute path of the script filename in variable "SCRIPT"<|im_end|> <|im_start|>assistant SCRIPT=$( readlink -m $)<|im_end|>
Save absolute path of the script filename in variable "SCRIPT"
SCRIPT=$( readlink -m $)
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 all the svg.png files to png files in the current fodler<|im_end|> <|im_start|>assistant find . -name "*.svg.png" -print0 | sed 's/.svg...
rename all the svg.png files to png files in the current fodler
find . -name "*.svg.png" -print0 | sed 's/.svg.png//g' | xargs -0 -I namePrefix mv namePrefix.svg.png namePrefix.png
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 NTP synchronization status and send an alert if the system clock is not synchronized.<|im_end|> <|im_start|>...
Create a script to monitor system NTP synchronization status and send an alert if the system clock is not synchronized.
#!/bin/bash ntp_status=$(ntpq -p | grep '^*' | awk '{print $6}') if [ "$ntp_status" != "0.000" ]; then echo "System clock is not synchronized." | mail -s "NTP Sync 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 Show the number of lines for each .php and .phtml file in the current directory tree<|im_end|> <|im_start|>assistant find . -type f \ -exec wc...
Show the number of lines for each .php and .phtml file in the current directory tree
find . -type f \ -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 search for all the regular/normal mp3 files in the file system and create a directory int /mt/mp3/ with the basename of the mp3 file<|im_end|>...
search for all the regular/normal mp3 files in the file system and create a directory int /mt/mp3/ with the basename of the mp3 file
find / -iname “*.mp3″ -type f -print0 | xargs -0 -I ‘{}’ mkdir -p /mnt/mp3/`basename {}`
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 user and group information for each logged in system user.<|im_end|> <|im_start|>assistant w | awk '{print $1}' | xargs -I '{}' id '{}'...
Prints user and group information for each logged in system user.
w | awk '{print $1}' | xargs -I '{}' id '{}'
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 Merge file1 and file2 by outputting all lines where the first comma-separated field of both files matches, followed by extra fields in file1 a...
Merge file1 and file2 by outputting all lines where the first comma-separated field of both files matches, followed by extra fields in file1 and those in file2
join -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 Remove regular files whose names match Perl regular expression '\w+-\d+x\d+\.\w+$' from the current directory tree<|im_end|> <|im_start|>assis...
Remove regular files whose names match Perl regular expression '\w+-\d+x\d+\.\w+$' from the current directory tree
find -type f | grep -P '\w+-\d+x\d+\.\w+$' | sed -re 's//\\\1/g' | xargs 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 Create a table containing all information from S43.txt and S44.txt, merging lines where the first field of both files matches, and keeping the...
Create a table containing all information from S43.txt and S44.txt, merging lines where the first field of both files matches, and keeping the line that starts with "Gene" at the start of the file.
join -a1 -a2 <(sed s/^Gene/00ne/ S43.txt | sort) <(sed s/^Gene/00ne/ S44.txt | sort) | column -t | sed s/^00ne/Gene/
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 Email an alert message containing the IP address of the SSH connection with attachment "tmpfile" to "user@example.com"<|im_end|> <|im_start|>a...
Email an alert message containing the IP address of the SSH connection with attachment "tmpfile" to "user@example.com"
mail -s "Alert: SSH Access from `who | cut -d'' -f1`" -a tmpfile user@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 Test if "file.tar.gz" is corrupt<|im_end|> <|im_start|>assistant gunzip -t file.tar.gz<|im_end|>
Test if "file.tar.gz" is corrupt
gunzip -t file.tar.gz
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 644 permission to all regular files under /home/my/special/folder directory<|im_end|> <|im_start|>assistant chmod 644 `find /home/my/speci...
Set 644 permission to all regular files under /home/my/special/folder directory
chmod 644 `find /home/my/special/folder -type 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 Remove all .sh files in the current directory tree whose names begin with "new"<|im_end|> <|im_start|>assistant find . -name "new*.sh" -exec r...
Remove all .sh files in the current directory tree whose names begin with "new"
find . -name "new*.sh" -exec rm -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 Find all .js files in the current directory tree that do not contain a whitespace<|im_end|> <|im_start|>assistant find . -type f -name '*.js' ...
Find all .js files in the current directory tree that do not contain a whitespace
find . -type f -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 Write standard output and error of "./a.out" to standard output and to file "output"<|im_end|> <|im_start|>assistant ./a.out 2>&1 | tee output...
Write standard output and error of "./a.out" to standard output and to file "output"
./a.out 2>&1 | tee output
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 whose names match the pattern given by the 2nd argument $2 of the Bash script and replace string $3 with $4 in them<|im_end|> <|im_...
Find files whose names match the pattern given by the 2nd argument $2 of the Bash script and replace string $3 with $4 in them
find ./ -type f -name "$2" -exec sed -i "s/$3/$4/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 Print $1 if $1 is an empty directory<|im_end|> <|im_start|>assistant find "$1" -name "?*" | dd bs=$() count=1 2>/dev/null<|im_end|>
Print $1 if $1 is an empty directory
find "$1" -name "?*" | dd bs=$() count=1 2>/dev/null
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 Show the mv commands that would rename the *.so files in the current directory tree prepending their names with "lib"<|im_end|> <|im_start|>as...
Show the mv commands that would rename the *.so files in the current directory tree prepending their names with "lib"
find . -name "*.so" -printf "mv '%h/%f' '%h/lib%f'\n" | less -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 Find all files under $1, calculate their md5sum and redirect the result to checksums.md5<|im_end|> <|im_start|>assistant find "$1" -type f -pr...
Find all files under $1, calculate their md5sum and redirect the result to checksums.md5
find "$1" -type f -print0 | parallel -0 -X md5 > checksums.md5
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 check if a given number is a perfect number or not.<|im_end|> <|im_start|>assistant #!/bin/bash is_perfect_number() { ...
Create a script to check if a given number is a perfect number or not.
#!/bin/bash is_perfect_number() { num="$1" sum=0 for ((i=1; i<num; i++)); do if [ $((num % i)) -eq 0 ]; then sum=$((sum + i)) fi done if [ "$sum" -eq "$num" ]; then echo "$num is a perfect number" else echo "$num is not a perfect number" fi } is_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 Saves 'ls' output together with time report to a file 'time.txt'.<|im_end|> <|im_start|>assistant { time ls; } 2>&1 | cat > time.txt<|im_end|...
Saves 'ls' output together with time report to a file 'time.txt'.
{ time ls; } 2>&1 | cat > time.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 & Write Changes to a File and Print the Changes Using sed s//gpw<|im_end|> <|im_start|>assistant find . -type f -name "*.txt" -exec sed -...
Find & Write Changes to a File and Print the Changes Using sed s//gpw
find . -type f -name "*.txt" -exec sed -n 's/Linux/Linux-Unix/gpw output' thegeekstuff.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 Write output of "command" to standard output and to "/path/to/logfile"<|im_end|> <|im_start|>assistant command | tee /path/to/logfile<|im_end|...
Write output of "command" to standard output and to "/path/to/logfile"
command | tee /path/to/logfile
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 deb packages in the current directory recursively and list them with `dpkg'<|im_end|> <|im_start|>assistant find . -type f -and -iname "*...
Find deb packages in the current directory recursively and list them with `dpkg'
find . -type f -and -iname "*.deb" | xargs -n 1 dpkg -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 Create a script to monitor system PostgreSQL database performance and send alerts if replication lag exceeds a certain threshold.<|im_end|> <|...
Create a script to monitor system PostgreSQL database performance and send alerts if replication lag exceeds a certain threshold.
#!/bin/bash threshold="60" replication_lag=$(psql -c "SELECT EXTRACT(EPOCH FROM now() - pg_last_xact_replay_timestamp())/60" | tail -3 | head -1 | cut -d ' ' -f 3) if [ "$replication_lag" -gt "$threshold" ]; then echo "PostgreSQL replication lag is high: $replication_lag minutes" | mail -s "PostgreSQL Replication ...
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 history with the first field removed<|im_end|> <|im_start|>assistant history | awk '{sub($1, ""); sub(/^[ \t]+/, ""); print}'<|im_end|>
Print history with the first field removed
history | awk '{sub($1, ""); sub(/^[ \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 Recursively change ownership of "~/.npm" to the current user<|im_end|> <|im_start|>assistant sudo chown -R $ ~/.npm<|im_end|>
Recursively change ownership of "~/.npm" to the current user
sudo chown -R $ ~/.npm
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 *.txt files/directories in entire file system<|im_end|> <|im_start|>assistant find / -name "*.txt"<|im_end|>
Find all *.txt files/directories in entire file system
find / -name "*.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 files in current directory and grep text and html files - but not index.html and report things that contain the word 'elevator' in four o...
FInd files in current directory and grep text and html files - but not index.html and report things that contain the word 'elevator' in four or more lines
find . -type f -print0 | egrep -iazZ '$' | grep -vazZ 'index.html' | xargs -n 1 -0 grep -c -Hi elevator | egrep -v ':[0123]$'
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 trace prompt to print seconds, nnoseconds, script name, and line number<|im_end|> <|im_start|>assistant PS4='+$ %N:%i> '<|im_end|>
Set trace prompt to print seconds, nnoseconds, script name, and line number
PS4='+$ %N:%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 Prints path to folder that contains target of the symbolic link ../../../../etc/passwd.<|im_end|> <|im_start|>assistant $(dirname $(readlink -...
Prints path to folder that contains target of the symbolic link ../../../../etc/passwd.
$(dirname $(readlink -e ../../../../etc/passwd))
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 /path/to/file exists and has a size greater than 25600KB<|im_end|> <|im_start|>assistant [[ $ ]] && echo true || echo false<|im_end|>
Check if /path/to/file exists and has a size greater than 25600KB
[[ $ ]] && echo true || echo false
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 first 10 lines of a file.<|im_end|> <|im_start|>assistant #!/bin/bash file_path="/path/to/your/file.txt" head "$file_path"<|im_end...
Print the first 10 lines of a file.
#!/bin/bash file_path="/path/to/your/file.txt" head "$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 Find all files under current directory and set read-write permission for owner, read permission for group and other for those directories<|im_...
Find all files under current directory and set read-write permission for owner, read permission for group and other for those directories
find . -type f -exec chmod u=rw,g=r,o=r {} \; - that's 644
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 disk I/O activity and logs any disks experiencing high read/write operations.<|im_end|> <|im_start|>assis...
Create a script that monitors system disk I/O activity and logs any disks experiencing high read/write operations.
#!/bin/bash threshold=1000 while true; do iostat -d | awk -v threshold=$threshold '{if ($4 > threshold || $5 > threshold) print "Disk " $1 " is experiencing high I/O activity: read " $4 " ops/s, write " $5 " ops/s"}' sleep 300 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 Extract all zip files in a directory to their respective directories.<|im_end|> <|im_start|>assistant #!/bin/bash for file in /path/to/your/d...
Extract all zip files in a directory to their respective directories.
#!/bin/bash for file in /path/to/your/directory/*.zip; do unzip -d "${file%.zip}" "$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 If first command fails, exits from script with exit code of failed command.<|im_end|> <|im_start|>assistant echo $[4/0] || exit $?<|im_end|>
If first command fails, exits from script with exit code of failed command.
echo $[4/0] || 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 find all regular/normal files in the current folder and display them in the a format.<|im_end|> <|im_start|>assistant find -type f -exec perl ...
find all regular/normal files in the current folder and display them in the a format.
find -type f -exec perl -e 'printf qq[%s => %s\n], scalar @ARGV, length join q[ ], @ARGV' {} +
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 regular files under current directory tree without descending into './dir1' and './dir2' directories<|im_end|> <|im_start|>assistant...
Find all regular files under current directory tree without descending into './dir1' and './dir2' directories
find . \ -prune -or -type f -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 Append the parent directory name with a space in all 'text.txt' files in all sub directories of current directory<|im_end|> <|im_start|>assist...
Append the parent directory name with a space in all 'text.txt' files in all sub directories of current directory
find . -name text.txt | sed 's|.*/\/.*|sed -i "s@^@\1 @" & |' | 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 search for files cart1 or cart2 or cart3 or ...cart6 in the folder junk which is in home folder and display all its details. Discard all the e...
search for files cart1 or cart2 or cart3 or ...cart6 in the folder junk which is in home folder and display all its details. Discard all the errors and do not display them.
find ~/junk -name 'cart[1-6]' -exec ls -l {} \; 2> /dev/null
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 show all directories in the current folder excluding those that are present in the sub directories of media, images and backups<|im_end|> <|im...
show all directories in the current folder excluding those that are present in the sub directories of media, images and backups
find . -type d \ -prune -o -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 Find all of the distinct file extensions in current directory<|im_end|> <|im_start|>assistant find . -type f | perl -ne 'print $1 if m/\.$/' |...
Find all of the distinct file extensions in current directory
find . -type f | perl -ne 'print $1 if m/\.$/' | 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 Create a script to monitor system user logins and send an alert if any unusual login patterns are detected.<|im_end|> <|im_start|>assistant #!...
Create a script to monitor system user logins and send an alert if any unusual login patterns are detected.
#!/bin/bash login_count=$(last | grep -v 'still logged in' | wc -l) if [ "$login_count" -gt "50" ]; then echo "Unusual number of user logins detected: $login_count" | mail -s "Unusual User Logins 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 Print git branch currently checked out in a working directory.<|im_end|> <|im_start|>assistant git status --branch --porcelain | grep '##' | c...
Print git branch currently checked out in a working directory.
git status --branch --porcelain | grep '##' | cut -c 4- | cut -d'.' -f1
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 Kill screen session 23536<|im_end|> <|im_start|>assistant screen -S 23536 -X quit<|im_end|>
Kill screen session 23536
screen -S 23536 -X quit
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 thumbnails from the first page of each PDF files under /path/to/dir<|im_end|> <|im_start|>assistant find /path/to/dir -name '*.pdf' -ex...
Create thumbnails from the first page of each PDF files under /path/to/dir
find /path/to/dir -name '*.pdf' -exec convert -thumbnail x80 {}[0] {}-thumb.png \;
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 out all .pdf files from the current directory tree as plain text on the standard output<|im_end|> <|im_start|>assistant find . -name '*....
Print out all .pdf files from the current directory tree as plain text on the standard output
find . -name '*.pdf' -print0 | xargs -0 -n1 -I '{}' pdftotext '{}' -
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 process UDP network connections and send an alert if any unauthorized connections are detected.<|i...
Create a script to monitor system root user process UDP network connections and send an alert if any unauthorized connections are detected.
#!/bin/bash unauthorized_connections="$(netstat -nup | grep -vE '^Active|^Proto' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr | head -n 5)" if [ -n "$unauthorized_connections" ]; then echo "Unauthorized UDP connections found for root user: $unauthorized_connections" | mail -s "Root UDP Connection ...
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 spaces from all files under current directory<|im_end|> <|im_start|>assistant find . -type f -print0 | xargs -0 perl -pi -e 's...
Remove trailing spaces from all files under current directory
find . -type f -print0 | xargs -0 perl -pi -e '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 Find and delete files older than 30 days within a directory.<|im_end|> <|im_start|>assistant #!/bin/bash find /path/to/directory -type f -mti...
Find and delete files older than 30 days within a directory.
#!/bin/bash find /path/to/directory -type f -mtime +30 -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 Create a script that monitors system firewall logs and alerts if any suspicious activity is detected.<|im_end|> <|im_start|>assistant #!/bin/b...
Create a script that monitors system firewall logs and alerts if any suspicious activity is detected.
#!/bin/bash while true; do grep -i 'blocked' /var/log/iptables.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 all php files in current directory and delete text matching the regex '<?php /\*\*/ eval(base64_decode("aWY.*?>' in those files<|im_end|>...
Find all php files in current directory and delete text matching the regex '<?php /\*\*/ eval(base64_decode("aWY.*?>' in those files
find ./ -name "*.php" -type f | xargs sed -i 's#<?php /\*\*/ eval(base64_decode("aWY.*?>##g' 2>&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 Print appended data in "file" and search for "my_pattern" without buffering<|im_end|> <|im_start|>assistant tail -f file | stdbuf -o0 grep my_...
Print appended data in "file" and search for "my_pattern" without buffering
tail -f file | stdbuf -o0 grep my_pattern
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 Silently read $char number of symbols from file descriptor 4, without backslash escaping, and store received input in 'line' variable<|im_end|...
Silently read $char number of symbols from file descriptor 4, without backslash escaping, and store received input in 'line' variable
read -u 4 -N $char -r -s 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 Shows strings that NOT match regex '^'<|im_end|> <|im_start|>assistant echo "${line}" | egrep --invert-match '^'<|im_end|>
Shows strings that NOT match regex '^'
echo "${line}" | egrep --invert-match '^'
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 modified within a fortnight ago to `deploy.txt' stripping the file names of any leading directories<|im_end|> <|im_star...
Save the list of files modified within a fortnight ago to `deploy.txt' stripping the file names of any leading directories
find . -type f -mtime -14 -printf '%f\n' > 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 Move all *.log files under $sourcePath that were modified more than 10 days ago to a zip archive $zipFile<|im_end|> <|im_start|>assistant find...
Move all *.log files under $sourcePath that were modified more than 10 days ago to a zip archive $zipFile
find $sourcePath -type f -mtime +10 -name "*.log" | xargs zip -mT $zipFile -@
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 disk I/O and send an alert if it exceeds a certain threshold.<|im_end|> <|im_start|>assistant #!/bin/bash t...
Create a script to monitor system disk I/O and send an alert if it exceeds a certain threshold.
#!/bin/bash threshold=1000 disk_io=$(iostat -d | awk '/sda/ {print $2}') if [ "$disk_io" -gt "$threshold" ]; then echo "System disk I/O 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 File 'mydatafile' has a number on each line, display the sum of these numbers rounded to lowest integer.<|im_end|> <|im_start|>assistant awk '...
File 'mydatafile' has a number on each line, display the sum of these numbers rounded to lowest integer.
awk '{s+=$1} END {printf "%.0f", s}' mydatafile
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 addresses of all active network interfaces on host.<|im_end|> <|im_start|>assistant ifconfig | awk -F':' '/inet addr/&&!/127.0.0.1/{sp...
Gets IP addresses of all active network interfaces on host.
ifconfig | awk -F':' '/inet addr/&&!/127.0.0.1/{split($2,_," ");print _[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 Delete all files/directories with node number $inum under current directory tree<|im_end|> <|im_start|>assistant find . -inum $inum -exec rm {...
Delete all files/directories with node number $inum under current directory tree
find . -inum $inum -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 Create a script that monitors system file system usage and logs any file systems nearing full capacity.<|im_end|> <|im_start|>assistant #!/bin...
Create a script that monitors system file system usage and logs any file systems nearing full capacity.
#!/bin/bash threshold=90 while true; do df -h | awk -v threshold=$threshold '{if ($5 > threshold) print "File system " $1 " is nearing full capacity: " $5 " used"}' sleep 300 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 Get a list of all hidden files from the current directory tree<|im_end|> <|im_start|>assistant find . -type f -name '.*' -print0 | while IFS= ...
Get a list of all hidden files from the current directory tree
find . -type f -name '.*' -print0 | while IFS= read -r -d '' f; do basename "$f"; 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 run command './bin/elasticsearch -d --default.path.conf=/etc/elasticsearch' as user elasticsearch<|im_end|> <|im_start|>assistant sudo su elas...
run command './bin/elasticsearch -d --default.path.conf=/etc/elasticsearch' as user elasticsearch
sudo su elasticsearch -c './bin/elasticsearch -d --default.path.conf=/etc/elasticsearch'
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 the filename and size of all the files in the file system which are bigger than 20MB<|im_end|> <|im_start|>assistant find / -type f -s...
display the filename and size of all the files in the file system which are bigger than 20MB
find / -type f -size +20000k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }'
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 ignoring hidden files under current directory and replace every occurrences of 'subdomainA.example.com' with 'subdomainB.exampl...
Find all files ignoring hidden files under current directory and replace every occurrences of 'subdomainA.example.com' with 'subdomainB.example.com' in those files
find . -not -path '*/\.*' -type f -print0 | xargs -0 sed -i 's/subdomainA\.example\.com/subdomainB.example.com/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 dispaly a long listig of all the files in the current folder which are bigger than 100KB<|im_end|> <|im_start|>assistant find . -size +100000 ...
dispaly a long listig of all the files in the current folder which are bigger than 100KB
find . -size +100000 -ls
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 under /somefolder matching the extended regex '\./$' in their paths<|im_end|> <|im_start|>assistant find -E /somefolder -type f...
Find all files under /somefolder matching the extended regex '\./$' in their paths
find -E /somefolder -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 Check if a string contains only digits.<|im_end|> <|im_start|>assistant #!/bin/bash string="12345" if [[ "$string" =~ ^[0-9]+$ ]]; then ...
Check if a string contains only digits.
#!/bin/bash string="12345" if [[ "$string" =~ ^[0-9]+$ ]]; then echo "$string contains only digits" else echo "$string does not contain only digits" 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 Gets domain name from dig reverse lookup and save in variable 'go'.<|im_end|> <|im_start|>assistant go=$(dig -x 8.8.8.8| awk '/PTR[[:space:]]/...
Gets domain name from dig reverse lookup and save in variable 'go'.
go=$(dig -x 8.8.8.8| awk '/PTR[[:space:]]/{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 Print "new.txt" with line numbers prepended and lines 3 and 4 deleted<|im_end|> <|im_start|>assistant cat new.txt | nl |sed "3d;4d"<|im_end...
Print "new.txt" with line numbers prepended and lines 3 and 4 deleted
cat new.txt | nl |sed "3d;4d"
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 text files in current folder and change the extension of these files and move them to another folder<|im_end|> <|im_start|>assist...
find all the text files in current folder and change the extension of these files and move them to another folder
find ./ -name \*.txt | perl -p -e 's/^(.*\/\.txt)$/mv $1 .\/foo\/$2.bar.txt/' | bash
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 current directory<|im_end|> <|im_start|>assistant find . -type f -size +1M -exec rm {} +<...
Remove files that are greater than 1MB in size under current directory
find . -type f -size +1M -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 Check if a specific process is running and kill it if it is.<|im_end|> <|im_start|>assistant #!/bin/bash process_name="process_name" if pgre...
Check if a specific process is running and kill it if it is.
#!/bin/bash process_name="process_name" if pgrep "$process_name" >/dev/null; then pkill "$process_name" fi
AnishJoshi/nl2bash-custom