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.

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.

Universal configuration monitoring and system of record for IT.

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:



May 19, 2015 - A Look At The New Commandlinefu
I've put together a short writeup on what kind of newness you can expect from the next iteration of clfu. Check it out here.
March 2, 2015 - New Management
I'm Jon, I'll be maintaining and improving clfu. Thanks to David for building such a great resource!

Top Tags



Psst. Open beta.

Wow, didn't really expect you to read this far down. The latest iteration of the site is in open beta. It's a gentle open beta-- not in prime-time just yet. It's being hosted over at UpGuard (link) and you are more than welcome to give it a shot. Couple things:

  • » The open beta is running a copy of the database that will not carry over to the final version. Don't post anything you don't mind losing.
  • » If you wish to use your user account, you will probably need to reset your password.
Your feedback is appreciated via the form on the beta page. Thanks! -Jon & CLFU Team

Look up a unicode character by name

Terminal - Look up a unicode character by name
egrep -i "^[0-9a-f]{4,} .*$*" $(locate CharName.pm) | while read h d; do /usr/bin/printf "\U$(printf "%08x" 0x$h)\tU+%s\t%s\n" $h "$d"; done
2010-12-31 16:47:59
User: hackerb9
Functions: egrep locate read
Look up a unicode character by name

[Update! Thanks to a tip from ioggstream, I've fixed both of the bugs mentioned below.]

You, yes, 𝙔𝙊𝙐, can be the terror of the Internet! Why use normal, boring bullet points in your text, when you could use a ROTATED HEAVY BLACK HEART BULLET (❥)!? (Which would also be an awesome band name, by the way).

This script makes it easy to find unusual characters from the command line. You can then cut and paste them or, if you're using a GTK application, type Control+Shift+U followed by the code point number (e.g., 2765) and then a SPACE.

USAGE: Put this script in a file (I called mine "ugrep") and make it executable. Run it from the command line like so,

ugrep heart

The output will look like this,












You can, of course, use regular expressions. For example, if you are looking for the "pi" symbol, you could do this:

ugrep '\bpi\b'

REQUIREMENTS: Although this is written in Bash, it assumes you have Perl installed because it greps through the Perl Unicode character name module (/usr/lib/perl5/Unicode/CharName.pm). Note that it would not have made more sense to write this in Perl, since the CharName.pm module doesn't actually include a subroutine for looking up a character based on the description. (Weird.)

BUGS: In order to fit this script in the commandlinefu limits, a couple bugs were added. ① Astral characters beyond the BMP (basic multilingual plane) are not displayed correctly, but see below. ② Perl code from the perl module being grepped is sometimes extraneously matched.

MISFEATURES: Bash's printf cannot, given a Unicode codepoint, print the resulting character to the terminal. GNU's coreutils printf (usually "/usr/bin/printf") can do so, but it is brokenly pedantic about how many hexadecimal digits follow the escape sequence and will actually die with an error if you give the wrong number. This is especially annoying since Unicode code points are usually variable length with implied leading zeros. The CharNames.pm file represents BMP characters as 4 hexits, but astral characters as 5. In the actual version of this script that I use, I've kludged around this misfeature by zero-padding to 8 hexits like so,

/usr/bin/printf "\U$(printf "%08x" 0x$hex)"

TIP 1: The author recommends "xsel" for command line cut-and-paste. For example,

ugrep biohazard | xsel

TIP 2: In Emacs, instead of running this command in a subshell, you can type Unicode code points directly by pressing Control-Q first, but you'll likely want to change the default input from octal to hexadecimal. (setq read-quoted-char-radix 16).

TIP 3: Of course, if you're using X, and you want to type one of the more common unusual characters, it's easiest of all to do it with your Compose (aka Multi) key. For example, hitting [Compose] <3 types ♥.


There are 7 alternatives - vote for the best!

Terminal - Alternatives
grep -i "$*" /usr/lib/perl5/Unicode/CharName.pm | while read a b; do /usr/bin/printf "\u$a\tU+%s\t%s\n" "$b"; done
2011-01-04 11:30:16
User: ioggstream
Functions: grep read

No need for further filedes or substitution for splitting. Simply use read a b

Know a better way?

If you can do better, submit your command here.

What others think

For some reason this module wasn't included with Ubuntu's perl, so I had to install it using

sudo apt-get install libunicode-string-perl

Then I had to run updatedb to let locate know where CharName.pm lives (well, actually it was getting late and I was lazy, so I let the updatedb cron job take care of this for me).

I will suggest making a shell function of this:

ugrep() { exec 5< <(grep -i "$*" $(locate CharName.pm));while read <&5;do h=${REPLY%% *};/usr/bin/printf "\u$h\tU+%s\t%s\n" "$h" "${REPLY##$h }";done; }

The other thing that got me is that in unicode land, an umlaut is called a diaeresis.

Anyway, nicely done.

Comment by bartonski 295 weeks and 1 day ago

Thanks for the compliment, Bartonski, and the suggestion. I don't use shell functions because I don't like all my programs munged together in a single file. It's cleaner and easier to just toss shell fragments like this into a ~/bin directory and chmod 755 them. Also, although infinitesimal, each shell function in a .profile slows down the start up time of every login shell. If this was a command I use all the time and it was important that it not fork, for example "ls", I would use a shell function. But, for the other 99.9% of commands, I use script files so it will only be loaded when needed.

Comment by hackerb9 295 weeks ago

P.S. If you find yourself needing umlauts, you'll definitely be happier once you enable a Compose key. Both Gnome and KDE have an option to do so in their keyboard control panels. If you don't use either of those, you can change it the "old fashioned" way,

xmodmap -e "keysym Menu = Multi_key"

That will let you hit (one at a time) the Menu key, a letter key, and then a double quote to get an umlaut. For example, Multi_key o " → ?. (And to get the right pointing arrow I just typed, I used Multi_key, minus, greater than).

Comment by hackerb9 295 weeks ago

Somehow I have multiple copies of CharName.pm on my system, so I needed to limit the results to one:

locate -l 1 CharName.pm

Otherwise, great command.

Comment by billmakesbooks 291 weeks and 5 days ago

Awesome command! By the way, if you want to have even more Unicode characters available via XCompose, check out this project to add more key bindings:


Comment by hfs 242 weeks and 1 day ago

Your point of view

You must be signed in to comment.