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.

UpGuard checks and validates configurations for every major OS, network device, and cloud provider.

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



Save current layout of top

Terminal - Save current layout of top
<Shift + W>
2009-09-23 13:51:22
User: hfs
Save current layout of top

'top' has fancy layout modes where you can have several windows with different things displayed. You can configure a layout and then save it with 'W'. It will then be restored every time you run top.

E.g. to have two colored windows, one sorted by CPU usage, the other by memory usage, run top


then press the keys

<A> <z> <a> <-> <a> <z> <a> <-> <a>

and then as you don?t want to repeat this the next time:



There is 1 alternative - vote for the best!

Terminal - Alternatives

Know a better way?

If you can do better, submit your command here.

What others think

v. nice tip!

Comment by Escher 420 weeks and 5 days ago

Good tip! Bad top(1).

That is, this tip is useful, but exemplifies why the user interface of top needs to be revamped. "" is not a command line, it's a keystroke for an interactive program, necessary to mention on commandlinefu.com because 'top' is actually very command line unfriendly.

Qualification: In the following rant, I'm speaking of top from procps version 3.2.8.

It's been bothering me for a long time that one of the first introductions people have to UNIX is with a program that doesn't follow the UNIX philosophy. Tools should be small and precise, not duplicating function; they should use each other's strengths and work together harmoniously in ways the original designer hadn't imagined. Top, as a command line tool, does not play well with others.

For example, it irks me that I can't use $EDITOR to write the .toprc. Yes, I know it's ASCII, but what's the syntax? The manpage for top doesn't say, except to tell one to use 'W' in the interactive interface as if it was a binary file.

Another problem with 'top' is that it allows only one configuration file per user. I want it to show fewer columns of information when I log in from a serial console with a 40x16 screen. I figured it'd be simple, a single line in .bashrc specifying some command line options. I was wrong. Top has no way to configure it from the command line and it only allows one configuration file, which *must* be called ".toprc" and *must* be in the user's home directory.

I had to kludge around top's deficiencies by creating a fake $HOME directory containing a specially crafted ".toprc" in it. (Gross!)

if [ "$TERM" = "td200" ]; then alias top='HOME=/root/.td200 top' fi

Wait, did I say top has "no" way to configure it from the command line? I meant to say, top has a completely f'brain-damaged way of configuring it from the command line. The options are not absolute, but relative "toggles" which reverse the settings in the .toprc. So, instead of having one option to disable showing idle processes and another option to enable showing them, there is only "-i" which does both, and one can't know which without knowing the contents of the .toprc.

Hmmm... this seems to be something that bothers me more than I thought. I've spent quite a bit of time cutting examples of problems in top to keep this rant short and it's still too long. Sorry about that.

Comment by hackerb9 412 weeks and 6 days ago

Erratum: The emptiness in quotes in my second sentence was supposed to be "〈Shift+W〉" in angle brackets.

I wish commandlinefu had a preview button...

Comment by hackerb9 412 weeks and 6 days ago

Your point of view

You must be signed in to comment.