All commands (14,187)

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. 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.

Share Your Commands


Check These Out

Detect illegal access to kernel space, potentially useful for Meltdown detection
Based on capsule8 agent examples, not rigorously tested

full memcache client in under 255 chars (uses dd, sed and nc)
usage: mem memcache-command [arguments] where memcache-command might be: set add get[s] append prepend replace delete incr decr cas stats verbosity version notes: exptime argument is set to 0 (no expire) flags argument is set to 1 (arbitrary)

Dump and bz2compress a mysql db
To also move the db backup to another location you could pass the output to the dd command instead of a file $mysqldump -u user -h host -ppwd -B dbname | bzip2 -zc9 | dd ssh usr@server "dd of=db_dump"

See entire packet payload using tcpdump.

Detect illegal access to kernel space, potentially useful for Meltdown detection
Based on capsule8 agent examples, not rigorously tested

Delete all git branches except master
Delete all your branches except master (useful after archiving branches)

extract email adresses from some file (or any other pattern)
find all email addresses in a file, printing each match. Addresses do not have to be alone on a line etc. For example you can grab them from HTML-formatted emails or CSV files, etc. Use a combination of $...|sort|uniq$ to filter them.

listen to an offensive fortune
or replace "espeak" with "festival --tts" if you like festival better when your buddy leaves his computer unlocked use "crontab" or "at" to play at some time that would be most embarassing (during his next sales presentation) $ echo "fortune -o | espeak" | at now + 30 minutes of course you can exclude the "-o" for non offensive fortunes, or if you don't have offensive fortunes installed

using `!#$' to referance backward-word
expand to: cp /work/host/phone/ui/main.cpp /work/target/phone/ui/main.cpp !# The entire command line typed so far.

rsync instead of scp
The command copies a file from remote SSH host on port 8322 with bandwidth limit 100KB/sec; --progress shows a progress bar --partial turns partial download on; thus, you can resume the process if something goes wrong --bwlimit limits bandwidth by specified KB/sec --ipv4 selects IPv4 as preferred I find it useful to create the following alias: alias myscp='rsync --progress --partial --rsh="ssh -p 8322" --bwlimit=100 --ipv4' in ~/.bash_aliases, ~/.bash_profile, ~/.bash_login or ~/.bashrc where appropriate.


Stay in the loop…

Follow the Tweets.

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.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

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: