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.
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.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
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:
This command uses the top voted "Get your external IP" command from commandlinefu.com to get your external IP address.
Use this and you will always be using the communities favourite command.
This is a tongue-in-cheek entry and not recommended for actual usage.
There's been so many ways submitted to get your external IP address that I decided we all need a command that will just go pick a random one from the list and run it. This gets a list of "Get your external IP" commands from commanlinefu.com and selects a random one to run. It will run the command and print out which command it used.
This is not a serious entry, but it was a learning exercise for me writing it. My personal favourite is "curl icanhazip.com". I really don't think we need any other ways to do this, but if more come you can make use of them with this command ;o).
Here's a more useful command that always gets the top voted "External IP" command, but it's not so much fun:
eval $(curl -s http://www.commandlinefu.com/commands/matching/external/ZXh0ZXJuYWw=/sort-by-votes/plaintext|sed -n '/^# Get your external IP address$/{n;p;q}')
Not my script. Belongs to mathewbauer. Used without his permission.
This script gives a single line as shown in the sample output.
NOTE: I have blanked out the IP address for obvious security reasons. But you will get whatever is your IP if you run the script.
Tested working in bash.
Sometimes, you don't really care about all the other information that ifconfig spits at you (however useful it may otherwise be). You just want an IP. This strips out all the crap and gives you exactly what you want.
Removes ANSI color and end of line codes to the [{attr1};...;{attrn}m format.
Add a [fluxbox] binding in your key file then this
command provides a dmenu selector for the next track to play
Useful when you need to write e.g. an INSERT for a table with a large number of columns. This command will retrieve the column names and comma-separate them ready for INSERT INTO(...), removing the last comma.
You'll run into trouble if you have files w/ missing newlines at the end. I tried to use
PAGER='sed \$q' git blame
and even
PAGER='sed \$q' git -p blame
to force a newline at the end, but as soon as the output is redirected, git seems to ignore the pager.
If you wanted to do all in one command, you could go w/ sed instead
Can easily be scripted in order to show permission "tree" from any folder. Can also be formated with
column -t
{ pushd .> /dev/null; cd /; for d in `echo $OLDPWD | sed -e 's/\// /g'`; do cd $d; echo -n "$d "; ls -ld .; done; popd >/dev/null ; } | column -t
from http://www.commandlinefu.com/commands/view/3731/using-column-to-format-a-directory-listing
Use the hold space to preserve lines until data is needed.
I use it for embedding images in CSS for Stylish, the Firefox addon.
Thought it might be useful to others.
I often need to extract a function from a bash script and this command will do it.
This will record the Alexa Traffic Stats to a file and run every 5 hours.
-- www.fir3net.com --
For all of the jpgs in a directory, determine their size and if below a threshold remove them forcefully.
This command generates a sequential login list. Good to be used as a source of new logins.
You can get one specific line during any procedure. Very interesting to be used when you know what line you want.