opennomad/ShellLife
7B • Updated • 29
conversations listlengths 2 2 |
|---|
[
{
"from": "human",
"value": "Write a Bash script to list all files in a directory."
},
{
"from": "gpt",
"value": "#!/bin/bash\nls -la"
}
] |
[
{
"from": "human",
"value": "Find all .log files modified in the last 24 hours."
},
{
"from": "gpt",
"value": "find /var/log -name '*.log' -mtime -1"
}
] |
[
{
"from": "human",
"value": "Create a Bash script that monitors CPU usage every 5 seconds."
},
{
"from": "gpt",
"value": "#!/bin/bash\nwhile true; do top -b -n1 | grep 'Cpu'; sleep 5; done"
}
] |
[
{
"from": "human",
"value": "Write a one-liner to find and delete all .tmp files in /home."
},
{
"from": "gpt",
"value": "find /home -type f -name '*.tmp' -delete"
}
] |
[
{
"from": "human",
"value": "Create a Bash script that backs up a directory to a tar.gz file."
},
{
"from": "gpt",
"value": "#!/bin/bash\ntar -czvf backup.tar.gz /path/to/directory"
}
] |
[
{
"from": "human",
"value": "Extract all .tar.gz files in the current directory."
},
{
"from": "gpt",
"value": "for file in *.tar.gz; do tar -xzvf \"$file\"; done"
}
] |
[
{
"from": "human",
"value": "Check if a file exists and print a message if it does."
},
{
"from": "gpt",
"value": "#!/bin/bash\nif [ -f /path/to/file ]; then echo 'File exists'; fi"
}
] |
[
{
"from": "human",
"value": "Find the largest 5 files in a directory."
},
{
"from": "gpt",
"value": "du -ah /path/to/directory | sort -rh | head -5"
}
] |
[
{
"from": "human",
"value": "Create a cron job to run a script every day at midnight."
},
{
"from": "gpt",
"value": "echo '0 0 * * * /path/to/script.sh' | crontab -"
}
] |
[
{
"from": "human",
"value": "Convert all .jpg images in a folder to .png using a loop."
},
{
"from": "gpt",
"value": "for img in *.jpg; do convert \"$img\" \"${img%.jpg}.png\"; done"
}
] |
[
{
"from": "human",
"value": "Display the 10 most common IPs from an access.log file."
},
{
"from": "gpt",
"value": "awk '{print $1}' access.log | sort | uniq -c | sort -nr | head -10"
}
] |
[
{
"from": "human",
"value": "Check if a command exists before running it."
},
{
"from": "gpt",
"value": "#!/bin/bash\nif command -v mycommand &>/dev/null; then mycommand; else echo 'Command not found'; fi"
}
] |
[
{
"from": "human",
"value": "Generate a strong random password in Bash."
},
{
"from": "gpt",
"value": "openssl rand -base64 12"
}
] |
[
{
"from": "human",
"value": "Create a function in Bash that checks if a number is even or odd."
},
{
"from": "gpt",
"value": "#!/bin/bash\nis_even() { (( $1 % 2 == 0 )) && echo 'Even' || echo 'Odd'; }\nis_even $1"
}
] |
[
{
"from": "human",
"value": "Write a script that pings a list of servers and reports if they are up."
},
{
"from": "gpt",
"value": "#!/bin/bash\nfor server in google.com example.com; do ping -c 1 $server &>/dev/null && echo \"$server is up\" || echo \"$server is down\"; done"
}
] |
[
{
"from": "human",
"value": "How can I replace 'foo' with 'bar' in all text files in a directory?"
},
{
"from": "gpt",
"value": "sed -i 's/foo/bar/g' *.txt"
}
] |
[
{
"from": "human",
"value": "List open network ports on a Linux system."
},
{
"from": "gpt",
"value": "netstat -tulnp"
}
] |
[
{
"from": "human",
"value": "Count the number of files in the current directory."
},
{
"from": "gpt",
"value": "ls -1 | wc -l"
}
] |
[
{
"from": "human",
"value": "Write a Bash script to log system uptime every hour."
},
{
"from": "gpt",
"value": "#!/bin/bash\nwhile true; do echo \"$(date): $(uptime -p)\" >> uptime.log; sleep 3600; done"
}
] |
[
{
"from": "human",
"value": "Loop through a list of files and process them."
},
{
"from": "gpt",
"value": "#!/bin/bash\nfor file in *.txt; do echo \"Processing $file\"; done"
}
] |
[
{
"from": "human",
"value": "Find and kill a process by name."
},
{
"from": "gpt",
"value": "pkill -f process_name"
}
] |
[
{
"from": "human",
"value": "Write a Bash script to create a simple HTTP server using Python."
},
{
"from": "gpt",
"value": "#!/bin/bash\npython3 -m http.server 8080"
}
] |
[
{
"from": "human",
"value": "Check disk usage and send an alert if usage exceeds 90%."
},
{
"from": "gpt",
"value": "#!/bin/bash\nusage=$(df / | awk 'NR==2 {print $5}' | sed 's/%//')\nif [ $usage -gt 90 ]; then echo 'Disk space critically low!'; fi"
}
] |
[
{
"from": "human",
"value": "Create a Bash script that archives old log files (older than 7 days)."
},
{
"from": "gpt",
"value": "#!/bin/bash\nfind /var/log -name '*.log' -mtime +7 -exec gzip {} \\;"
}
] |
[
{
"from": "human",
"value": "Bash script to sync two directories using rsync."
},
{
"from": "gpt",
"value": "#!/bin/bash\nrsync -avh /source/dir/ /destination/dir/"
}
] |
[
{
"from": "human",
"value": "Monitor memory usage and log high usage events."
},
{
"from": "gpt",
"value": "#!/bin/bash\nwhile true; do free -m | awk '/Mem/ { if ($3/$2 * 100.0 > 80.0) print strftime(), $0; }' >> memlog.txt; sleep 60; done"
}
] |
[
{
"from": "human",
"value": "Get public IP address using a Bash command."
},
{
"from": "gpt",
"value": "curl -s ifconfig.me"
}
] |
[
{
"from": "human",
"value": "Download a file with wget and verify checksum."
},
{
"from": "gpt",
"value": "#!/bin/bash\nurl=\"https://example.com/file.zip\"\nwget $url -O file.zip\nsha256sum file.zip"
}
] |
[
{
"from": "human",
"value": "Batch rename files in a directory."
},
{
"from": "gpt",
"value": "for f in *.txt; do mv \"$f\" \"new_$f\"; done"
}
] |
[
{
"from": "human",
"value": "Prompt user input and use it in a script."
},
{
"from": "gpt",
"value": "#!/bin/bash\necho \"Enter your name:\"\nread name\necho \"Hello, $name!\""
}
] |
[
{
"from": "human",
"value": "Create and activate a virtual environment in Python from Bash."
},
{
"from": "gpt",
"value": "#!/bin/bash\npython3 -m venv venv\nsource venv/bin/activate"
}
] |
[
{
"from": "human",
"value": "Script to find duplicate files based on checksum."
},
{
"from": "gpt",
"value": "#!/bin/bash\nfind . -type f -exec md5sum {} + | sort | uniq -w32 -dD"
}
] |
[
{
"from": "human",
"value": "Compress all subdirectories separately."
},
{
"from": "gpt",
"value": "for dir in */; do tar -czf \"${dir%/}.tar.gz\" \"$dir\"; done"
}
] |
[
{
"from": "human",
"value": "Schedule a script to run every 5 minutes with cron."
},
{
"from": "gpt",
"value": "echo '*/5 * * * * /path/to/script.sh' | crontab -"
}
] |
[
{
"from": "human",
"value": "Display the current date in YYYY-MM-DD format."
},
{
"from": "gpt",
"value": "date +%F"
}
] |
[
{
"from": "human",
"value": "Bash script to check if a website is up."
},
{
"from": "gpt",
"value": "#!/bin/bash\nsite=\"https://example.com\"\ncurl -s --head $site | head -n 1 | grep \"200 OK\" > /dev/null && echo \"Website is up\" || echo \"Website is down\""
}
] |
[
{
"from": "human",
"value": "Script to extract domain names from a list of URLs."
},
{
"from": "gpt",
"value": "awk -F/ '{print $3}' urls.txt | sort -u"
}
] |
[
{
"from": "human",
"value": "Check if a user exists on the system."
},
{
"from": "gpt",
"value": "#!/bin/bash\nuser_to_check=\"john\"\nid \"$user_to_check\" &>/dev/null && echo \"User exists\" || echo \"User does not exist\""
}
] |
[
{
"from": "human",
"value": "Create a timestamped backup file."
},
{
"from": "gpt",
"value": "cp myfile.txt \"myfile_$(date +%Y%m%d_%H%M%S).txt\""
}
] |
[
{
"from": "human",
"value": "Bash script to rotate logs weekly."
},
{
"from": "gpt",
"value": "#!/bin/bash\nlog_file=\"/var/log/myapp.log\"\nbackup=\"/var/log/myapp_$(date +%F).log\"\nmv $log_file $backup\ntouch $log_file"
}
] |
[
{
"from": "human",
"value": "Remove lines containing a keyword from a file."
},
{
"from": "gpt",
"value": "grep -v 'keyword' input.txt > output.txt"
}
] |
[
{
"from": "human",
"value": "Make a script executable from the command line."
},
{
"from": "gpt",
"value": "chmod +x script.sh"
}
] |
[
{
"from": "human",
"value": "Show file contents up to the match."
},
{
"from": "gpt",
"value": "sed '/PATTERN/q' FILE"
}
] |
[
{
"from": "human",
"value": "Determine if directory is under git control."
},
{
"from": "gpt",
"value": "git rev-parse --is-inside-work-tree"
}
] |
[
{
"from": "human",
"value": "How I find what my public IP address is from the CLI."
},
{
"from": "gpt",
"value": "dig +short myip.opendns.com @resolver1.opendns.com"
}
] |
[
{
"from": "human",
"value": "Sum a column of numbers."
},
{
"from": "gpt",
"value": "awk 'BEGIN {FS = \"|\"} ; {sum+=$3} END {print sum}' filename.txt"
}
] |
[
{
"from": "human",
"value": "Generate a self-signed SSL certificate using OpenSSL."
},
{
"from": "gpt",
"value": "openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 365"
}
] |
[
{
"from": "human",
"value": "List files with their absolute path."
},
{
"from": "gpt",
"value": "readlink -f filename"
}
] |
[
{
"from": "human",
"value": "Install a package"
},
{
"from": "gpt",
"value": "pkcon install package"
}
] |
[
{
"from": "human",
"value": "Remove a package"
},
{
"from": "gpt",
"value": "pkcon remove package"
}
] |
[
{
"from": "human",
"value": "Refresh the package cache"
},
{
"from": "gpt",
"value": "pkcon refresh"
}
] |
[
{
"from": "human",
"value": "Update packages"
},
{
"from": "gpt",
"value": "pkcon update"
}
] |
[
{
"from": "human",
"value": "Search for a specific package"
},
{
"from": "gpt",
"value": "pkcon search package"
}
] |
[
{
"from": "human",
"value": "List all available packages"
},
{
"from": "gpt",
"value": "pkcon get-packages"
}
] |
[
{
"from": "human",
"value": "Uncompress specific files"
},
{
"from": "gpt",
"value": "uncompress path/to/file1.Z path/to/file2.Z ..."
}
] |
[
{
"from": "human",
"value": "Uncompress specific files while ignoring non-existent ones"
},
{
"from": "gpt",
"value": "uncompress -f path/to/file1.Z path/to/file2.Z ..."
}
] |
[
{
"from": "human",
"value": "Write to `stdout` (no files are changed and no `.Z` files are created)"
},
{
"from": "gpt",
"value": "uncompress -c path/to/file1.Z path/to/file2.Z ..."
}
] |
[
{
"from": "human",
"value": "Verbose mode (write to `stderr` about percentage reduction or expansion)"
},
{
"from": "gpt",
"value": "uncompress -v path/to/file1.Z path/to/file2.Z ..."
}
] |
[
{
"from": "human",
"value": "List all active inhibition locks and the reasons for their creation"
},
{
"from": "gpt",
"value": "systemd-inhibit --list"
}
] |
[
{
"from": "human",
"value": "Block system shutdown for a specified number of seconds with the `sleep` command"
},
{
"from": "gpt",
"value": "systemd-inhibit --what shutdown sleep 5"
}
] |
[
{
"from": "human",
"value": "Keep the system from sleeping or idling until the download is complete"
},
{
"from": "gpt",
"value": "systemd-inhibit --what sleep:idle wget https://example.com/file"
}
] |
[
{
"from": "human",
"value": "Ignore lid close switch until the script exits"
},
{
"from": "gpt",
"value": "systemd-inhibit --what sleep:handle-lid-switch path/to/script"
}
] |
[
{
"from": "human",
"value": "Ignore power button press while command is running"
},
{
"from": "gpt",
"value": "systemd-inhibit --what handle-power-key command"
}
] |
[
{
"from": "human",
"value": "Describe who and why created the inhibitor (default: the command and its arguments for `--who` and `Unknown reason` for `--why`)"
},
{
"from": "gpt",
"value": "systemd-inhibit --who $USER --why reason --what operation command"
}
] |
[
{
"from": "human",
"value": "View documentation for the original command"
},
{
"from": "gpt",
"value": "tldr apport-bug"
}
] |
[
{
"from": "human",
"value": "Discard all sectors on a device, removing all data"
},
{
"from": "gpt",
"value": "blkdiscard /dev/device"
}
] |
[
{
"from": "human",
"value": "Securely discard all blocks on a device, removing all data"
},
{
"from": "gpt",
"value": "blkdiscard [-s|--secure] /dev/device"
}
] |
[
{
"from": "human",
"value": "Discard the first 100 MB of a device"
},
{
"from": "gpt",
"value": "blkdiscard [-l|--length] 100MB /dev/device"
}
] |
[
{
"from": "human",
"value": "Generate a mirrorlist using the default settings"
},
{
"from": "gpt",
"value": "sudo pacman-mirrors --fasttrack"
}
] |
[
{
"from": "human",
"value": "Get the status of the current mirrors"
},
{
"from": "gpt",
"value": "pacman-mirrors --status"
}
] |
[
{
"from": "human",
"value": "Display the current branch"
},
{
"from": "gpt",
"value": "pacman-mirrors --get-branch"
}
] |
[
{
"from": "human",
"value": "Switch to a different branch"
},
{
"from": "gpt",
"value": "sudo pacman-mirrors --api --set-branch stable|unstable|testing"
}
] |
[
{
"from": "human",
"value": "Generate a mirrorlist, only using mirrors in your country"
},
{
"from": "gpt",
"value": "sudo pacman-mirrors --geoip"
}
] |
[
{
"from": "human",
"value": "Show all recognized EXIF information in an image"
},
{
"from": "gpt",
"value": "exif path/to/image.jpg"
}
] |
[
{
"from": "human",
"value": "Show a table listing known EXIF tags and whether each one exists in an image"
},
{
"from": "gpt",
"value": "exif --list-tags --no-fixup image.jpg"
}
] |
[
{
"from": "human",
"value": "Extract the image thumbnail into the file `thumbnail.jpg`"
},
{
"from": "gpt",
"value": "exif --extract-thumbnail --output=thumbnail.jpg image.jpg"
}
] |
[
{
"from": "human",
"value": "Show the raw contents of the \"Model\" tag in the given image"
},
{
"from": "gpt",
"value": "exif --ifd=0 --tag=Model --machine-readable image.jpg"
}
] |
[
{
"from": "human",
"value": "Change the value of the \"Artist\" tag to John Smith and save to `new.jpg`"
},
{
"from": "gpt",
"value": "exif --output=new.jpg --ifd=0 --tag=\"Artist\" --set-value=\"John Smith\" --no-fixup image.jpg"
}
] |
[
{
"from": "human",
"value": "Add a new attachment to an existing PDF file"
},
{
"from": "gpt",
"value": "pdfattach path/to/input.pdf path/to/file_to_attach path/to/output.pdf"
}
] |
[
{
"from": "human",
"value": "Replace attachment with same name if it exists"
},
{
"from": "gpt",
"value": "pdfattach -replace path/to/input.pdf path/to/file_to_attach path/to/output.pdf"
}
] |
[
{
"from": "human",
"value": "Display help"
},
{
"from": "gpt",
"value": "pdfattach -h"
}
] |
[
{
"from": "human",
"value": "Display version"
},
{
"from": "gpt",
"value": "pdfattach -v"
}
] |
[
{
"from": "human",
"value": "Create an EROFS filesystem based on the root directory"
},
{
"from": "gpt",
"value": "mkfs.erofs image.erofs root/"
}
] |
[
{
"from": "human",
"value": "Create an EROFS image with a specific UUID"
},
{
"from": "gpt",
"value": "mkfs.erofs -U UUID image.erofs root/"
}
] |
[
{
"from": "human",
"value": "Create a compressed EROFS image"
},
{
"from": "gpt",
"value": "mkfs.erofs -zlz4hc image.erofs root/"
}
] |
[
{
"from": "human",
"value": "Create an EROFS image where all files are owned by root"
},
{
"from": "gpt",
"value": "mkfs.erofs --all-root image.erofs root/"
}
] |
[
{
"from": "human",
"value": "Display A (default) record from DNS for hostname(s)"
},
{
"from": "gpt",
"value": "adig example.com"
}
] |
[
{
"from": "human",
"value": "Display extra [d]ebugging output"
},
{
"from": "gpt",
"value": "adig -d example.com"
}
] |
[
{
"from": "human",
"value": "Connect to a specific DNS [s]erver"
},
{
"from": "gpt",
"value": "adig -s 1.2.3.4 example.com"
}
] |
[
{
"from": "human",
"value": "Use a specific TCP port to connect to a DNS server"
},
{
"from": "gpt",
"value": "adig -T port example.com"
}
] |
[
{
"from": "human",
"value": "Use a specific UDP port to connect to a DNS server"
},
{
"from": "gpt",
"value": "adig -U port example.com"
}
] |
[
{
"from": "human",
"value": "Display the status of the most recent cloud-init run"
},
{
"from": "gpt",
"value": "cloud-init status"
}
] |
[
{
"from": "human",
"value": "Wait for cloud-init to finish running and then report status"
},
{
"from": "gpt",
"value": "cloud-init status --wait"
}
] |
[
{
"from": "human",
"value": "List available top-level metadata keys to query"
},
{
"from": "gpt",
"value": "cloud-init query --list-keys"
}
] |
[
{
"from": "human",
"value": "Query cached instance metadata for data"
},
{
"from": "gpt",
"value": "cloud-init query dot_delimited_variable_path"
}
] |
[
{
"from": "human",
"value": "Clean logs and artifacts to allow cloud-init to rerun"
},
{
"from": "gpt",
"value": "cloud-init clean"
}
] |
[
{
"from": "human",
"value": "Generate a cloudinit file for a specific configuration type"
},
{
"from": "gpt",
"value": "qm cloudinit dump virtual_machine_id meta|network|user"
}
] |
[
{
"from": "human",
"value": "Plot the values `1`, `2` and `3` (`cat` prevents ttyplot to exit)"
},
{
"from": "gpt",
"value": "{ echo 1 2 3; cat } | ttyplot"
}
] |
[
{
"from": "human",
"value": "Set a specific title and unit"
},
{
"from": "gpt",
"value": "{ echo 1 2 3; cat } | ttyplot -t title -u unit"
}
] |
[
{
"from": "human",
"value": "Use a while loop to continuously plot random values"
},
{
"from": "gpt",
"value": "{ while true; do echo $RANDOM; sleep 1; done } | ttyplot"
}
] |
No dataset card yet