Hide

What's this?

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/

Get involved!

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.

Hide

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:

Hide

News

2012-05-20 - test
test
2012-05-20 - test
test
2012-05-20 - test
test
2012-05-20 - Test tweets
YU not working?
Hide

Tags

Hide

Functions

Commands by rodolfoap

Commands by rodolfoap from sorted by
Terminal - Commands by rodolfoap - 8 results
alias Z=base64&&Z=dG91Y2ggUExFQVNFX1NUT1BfQU5OT1lJTkdfQ09NTUFORExJTkVGVV9VU0VSUwo=&&$(echo $Z|Z -d)
2010-12-24 14:29:19
User: rodolfoap
Functions: alias echo
Tags: touch base64
7

Would create a file with a meaningful title. Dedicated to John Cons, who is annoying us users. Merry Christmas!!!

curl -s http://boards.4chan.org/wg/|sed -r 's/.*href="([^"]*).*/\1\n/g'|grep images|xargs wget
2010-12-12 06:32:19
User: rodolfoap
Functions: grep sed xargs
0

Im' not interested in images, but that's how I would do it.

(for FILE in $@; do echo $[100*++x/$#]; command-for-each-parameter; done)|zenity --progress --auto-close
2010-10-05 10:07:04
User: rodolfoap
Functions: echo
0

Shows a zenity progressbar for each file in a script, see the samble output. Works with any number, less, equal or greater than 100.

x is not initially defined. If used twice in the script, set it:

x=0

(for FILE in $@; do echo $[100*++x/$#]; command... "$FILE"; done)|zenity --progress --auto-close

pdftk in.pdf burst
2010-02-10 13:31:36
User: rodolfoap
Tags: pdftk
6

Simple alternative to the previous submitted one

printf "%50s\n"|tr ' ' -
2010-01-07 08:49:46
User: rodolfoap
Functions: printf tr
-2

Better -and faster- using bash printf.

A=1;B=100;X=0;C=0;N=$[$RANDOM%$B+1];until [ $X -eq $N ];do read -p "N between $A and $B. Guess? " X;C=$(($C+1));A=$(($X<$N?$X:$A));B=$(($X>$N?$X:$B));done;echo "Took you $C tries, Einstein";
2009-12-16 13:24:23
User: rodolfoap
Functions: read
Tags: Game
14

Felt like I need to win the lottery, and wrote this command so I train and develop my guessing abilities.

mkdir myicons && find /usr/share/icons/ -type f | xargs cp -t myicons
2009-12-09 17:43:28
User: rodolfoap
Functions: cp find mkdir xargs
Tags: icons
2

Today I needed to choose an icon for an app. My simpler way: put all of /usr/share/icons in myicons folder and brows'em with nautilus. Then rm -r 'ed the entire dir.

find -mindepth 1 -maxdepth 1 -name .\*
2009-11-24 22:18:33
User: rodolfoap
Functions: find
1

find makes it easier, filtering . and ..

maxdepth could be removed, finding entries recursively. Removing mindepth causes . to appear