commandlinefu.com is the place to record those command-line gems that you return to again and again.
Delete that bloated snippets file you've been using and share your personal repository with the world. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/
You can sign-in using OpenID credentials, or register a traditional username and password.
First-time OpenID users will be automatically assigned a username which can be changed after signing in.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for:
I had to compress it a bit to meet the 255 limit. See sample for full command (274)
Supports 3 arguments (optional)
ffgif filename seek_time time_duration scale
ffgif 10 5 320 will seek 10 seconds in, convert for 5 seconds at a 320 scale.
Default will convert whole video to gif at 320 scale.
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
Will stop all running containers, then remove all containers
**This isn't for selectively handling containers, it removes everything**
Streams youtube-dl video to mplayer.
syt 'youtube.com/link' 'anotherlinkto.video'
Uses mplayer controls
Cleans apt-get and gpg cache and keys
Sometimes you just want to operate on files that were created after specific date. This command consists of 3 commands:
- Create a dummy file with the custom date
- Find all files with "creation time" further than our custom date by using `-newer` find option. Add your crazy stuff here, like moving, deleting, printing, etc.
- Remove the dummy file
this command can be added to crontab so as to execute a nightly backup of directories and store only the 10 last backup files.
Applies 'docker rm' to all container IDs that appear in 'docker ps -a' but not in 'docker ps' - i.e. the ones that are not running.
Improved google text-to-speech function. Allows to specify language, plays sound in terminal. Automatically removes downloaded file after successfully processing.
say LANGUAGE TEXT
say en "This is a test."
say pl "To jest test"
Sometimes I get FLAC files that RhythmBox can't play but VLC can. So I re-encode them using GStreamer at highest compression.
Just pulls a quote for each day and displays it in a notification bubble...
or you can change it a bit and just have it run in the terminal
wget -q -O "quote" https://www.goodreads.com/quotes_of_the_day;echo "Quote of the Day";cat quote | grep '“\|/author/show' | sed -e 's/<[a-zA-Z\/][^>]*>//g' | sed 's/“//g' | sed 's/”//g'; rm -f quote
Generate a truly random password using noise from your microphone to seed the RNG. This will spit out 12 password with 12 characters each, but you can save this into a bash script and replace 'pwgen -ys 12 12' with 'pwgen $@' so you can pass any paramters to pwgen as you would normally do.
Written on OSX after `brew install unrar coreutils`; presumably works on other unices with minimal modifications.
Didn't test rars that actually have paths in them, just "flat" files. Won't include files in the rar starting with a dot.
You'll probably want to pass in the -rf options if you have to delete a directory or something.
Finds all nfo files without the filename movie.nfo and deletes them.
- recompresses all gz files to bz2 files from this point and below in the directory tree
- output shows the size of the original file, and the size of the new file. Useful.
- conceptually easier to understand than playing tricks with awk and sed.
- don't like output? Use the following line:
for gz in `find . -type f -name '*.gz' -print`; do f=`basename $gz .gz` && d=`dirname $gz` && gunzip -c $gz | bzip2 - -c > $d/$f.bz2 && rm -f $gz ; done
do it, disown it and exit without time for a mess
sudo when you mean it
ps aux | grep $USER
sudo when you mean it
ps aux | grep $USER
The glob pattern * expands to all files, no need for the 'ls' command.
The quotes around "$i" make sure filenames with spaces in them are handled correctly.
mplayer determines if it is a media file and plays it, or gives errors and the loop asks if this file has to be removed.
Old drive with lots of music or unsorted drive? This command will play all mp3 files in a folder and after playing one song or pressing q, it will ask you if you want to delete the file.
when bad day comes...