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

Tail a log-file over the network

Terminal - Tail a log-file over the network
tail -f error_log | nc -l 1234
2010-05-07 18:14:04
User: zlemini
Functions: tail
Tail a log-file over the network

Netcat is used to serve a log-file over a network on port 1234.

Point a browser to the specified server/port combo to view log-file updates in real-time.


There are 5 alternatives - vote for the best!

Terminal - Alternatives
socat -u FILE:/var/log/syslog,ignoreeof TCP4-LISTEN:12345,fork,reuseaddr
2013-02-18 13:36:01
User: ichbins
Tags: socat

it also works with the chrome browser. The alternative with tail and nc doesn't

(echo -e "HTTP/1.1 200 Ok\n\r"; tail -f /var/log/syslog) | nc -l 1234
2013-02-09 06:15:42
User: adimania
Functions: echo tail

This one is tried and tested for Ubuntu 12.04. Works great for tailing any file over http.

Know a better way?

If you can do better, submit your command here.

What others think

That doesn't seem to work with my Firefox.

How does netcat handle the http procol ?

Comment by dooblem 337 weeks and 3 days ago

Sorry i should have mentioned i tested this on MacOS.

Here is the Linux (Ubuntu) version:

( echo -e "HTTP/1.0 200 Ok\n\r"; tail -f error_log; ) | nc -lp 1234

Comment by zlemini 337 weeks and 3 days ago

I did as you posted in your comment, but my nc man pages says that l and p cannot be used together, nc won't start; I'm on Ubuntu 10.04, my nc version is: OpenBSD netcat (Debian patchlevel 1.89-3ubuntu2)

Comment by Montecristo 336 weeks and 5 days ago

I've taken the last version from sourceforge but it still doesn't work, when I point my browser to http://localhost:1234 it keeps loading...

Comment by Montecristo 336 weeks and 5 days ago

there are two versions of netcat. One should be started with -l -p and another one without -p. Yeah, welcome to the unix world. This command doesn't work well because browser buffers some amount of data and if nothing is written to the transferred file nothing is shown. Additionally this command doesn't work with chrome browser.

Comment by ichbins 192 weeks ago

Your point of view

You must be signed in to comment.