Welcome to bashoneliners.com, a growing collection of practical and well-explained Bash one-liners, snippets, tips and tricks. We review and improve every contributed one-liner to make sure it is 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.
vi +'bufdo %s/pattern/replacement/g | update' +q $(grep -rl pattern /path/to/dir)
file /proc/*/fd/* 2>/dev/null | grep Flash | cut -f1 -d:
wget -–header='Accept-Language: en-us' http://www.timeanddate.com/calendar/index.html?year=2008&country=26 -O calendar.html
growisofs -dvd-compat -Z /dev/scd0 -R -J -pad /path/to/dir
for i in *.flac; do flac -c -d "$i" | lame -m j -b 192 -s 44.1 - "${i%.flac}.mp3"; done
echo o > /proc/sysrq-trigger
tar c paths_to_files_and_dirs | gzip -c | openssl des3 > encrypted.tar.gz
find /private/ 2>/dev/null | grep /Flash
paste <(ls) <(ls | tr A-Z a-z) | while read OLD NEW; do echo mv -v $OLD $NEW; done
bzr co https://repo1/proj1/trunk proj1 && cd proj1 && bzr push https://repo2/vendor/proj1/trunk
sudo mlabel -i /dev/sdd1 ::NewLabel
for i in $(grep :boss /etc/group | cut -f1 -d:); do adduser wife $i; done