Commands by jasonwalsh (1)

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

Replace Every occurrence of a word in a file
Replace 'this' with 'that'

Search commandlinefu and view syntax-highlighted results in vim
Here is the full function (got trunctated), which is much better and works for multiple queries. function cmdfu () { local t=~/cmdfu; until [[ -z $1 ]]; do echo -e "\n# $1 {{{1" >> $t; curl -s "commandlinefu.com/commands/matching/$1/`echo -n $1|base64`/plaintext" | sed '1,2d;s/^#.*/& {{{2/g' | tee -a $t > $t.c; sed -i "s/^# $1 {/# $1 - `grep -c '^#' $t.c` {/" $t; shift; done; vim -u /dev/null -c "set ft=sh fdm=marker fdl=1 noswf" -M $t; rm $t $t.c } Searches commandlinefu for single/multiple queries and displays syntax-highlighted, folded, and numbered results in vim.

Running a command at a specific time

Fake system time before running a command
Fake system time before running any command.

list block devices
Shows all block devices in a tree with descruptions of what they are.

automatically ditch old versions in a conflict
This is not exactly a commandline, but a vim macro to automatically ditch the "old" version of a conflict when dealing with the naster

Fix the vi zsh bindings on ubuntu
Use sed to comment out any up/down bindings in zsh

Destroy all ZFS snapshots

Grab just the title of a youtube video
There's another version on here that uses GET but some people don't have lwp-request, so here's an alternative. It's also a little shorter and should work with most youtube URLs since it truncates at the first &

use xxd to create the wake on lan magicpacket and write to pcap file
just set macdst to the mac address of the system you wish to wake up, the macsrc is optional but helps use tcpreplay to broadcast or wireshark to view


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: