Welcome to bashoneliners.com, a curated collection of practical and well-explained Bash one-liners, snippets, tips and tricks. We aim to make each published one-liner to be of high quality: useful, easy to read, follows best practices, with clear, detailed, accurate explanation. These one-liners should help you automate tasks, troubleshoot problems, whether it be in system administration, file management, networking or programming.
curl -b "session=$session" 'https://adventofcode.com/2023/day/18/input'
curl -s 'https://api.github.com/orgs/github/repos' | python -m json.tool
curl --data "title=recipe&text=steps123" https://example.com
curl -s 'https://api.github.com/orgs/github/repos' | jq -r '.[] | [.id, .name, .stargazers_count] | @csv'
curl -I amazon.com
unless => "client_remote=\"$(curl localhost:9200/_cluster/settings | python -c \"import json,sys;obj=json.load(sys.stdin);print(obj['persistent']['search']['remote'])\")\"; new_remote=\"$( echo $persistent_json | python -c \"import json,sys;obj=json.load(sys.stdin);print(obj['persistent']['search']['remote'])\")\"; [ \"$client_remote\" = \"$new_remote\" ]",
cat post-list.csv | split -l 30 - --filter='jq -R . | jq --slurp -c .' | xargs -d "\n" -I % sh -c 'curl -H "Content-Type: application/json" -X POST -d '"'"'{"type":1,"entries":%}'"'"' http://127.0.0.1:8080/purge-something && sleep 30'
curl -Lw '%{http_code}' -s -o /dev/null -I SOME_URL
gpg --recv-keys 0xD2C4C74D8FAA96F5 && curl https://hashbang.sh | gpg -o hashbang.sh && less hashbang.sh
i=$(curl -s server/nginx_stats); IFS=$'\n'; i=($i); a=${i[0]/Active connections: } && a=${a/ }; r=${i[2]# [0-9]* [0-9]* }; echo "Active: $a, requests: $r"
curl -L -v -F "value=@myfile" "http://domain.tld/whatever.php"
for i in {1..10}; do time curl http://localhost:8000 >/dev/null; done 2>&1 | grep real