I've been looking to compile a list of most useful one-liner commands recently. Personally, I think it would be helpful for a lot of people if they could simply browse through the answers and discover other clever one-liners from other users.

Answers would have to be strictly one line commands (piping is of course permitted) and nothing too lengthy (simply putting a small script into one line would not be an answer). Some examples:

Finding information about a running process:

ps -ef | grep <process-name>

List mounted filesystems in a nice way:

mount | column -t

Of course, there are more but I'll save the good ones for the question if it isn't off topic :)

  • 1
    not so much "offtopic" as not useful subjective, imo Aug 19, 2011 at 23:52
  • @xenoterracide, I think there could be some very useful commands, plus answers could provide some insight on the different commands and flags along with what they do. As a bonus, it would generate some good traffic to this site.
    – n0pe
    Aug 20, 2011 at 0:19
  • "Strictly one line" doesn't mean much when you can write about ten commands on a single line and break a single simple command across multiple lines at will. Lots of the best command line magic involves invoking special magic scoped inside a subshell or process substitution or multiple-IO redirection or other such multiple-process wizardry. Other than your favorite arguments to ps or some wizardry with find there really isn't much magic in the way a single command is written, it's all about how they are combined whether written in one line or five.
    – Caleb
    Aug 20, 2011 at 13:31

3 Answers 3


Short answer:


Longer answer:

Rarely, and only under exceptional conditions.

We spend a lot of time railing against exactly these sorts of "infinite list of X" non-questions. However, flavors of them are tolerated on the network, in very limited amounts, provided they prove their worth. One example of that is the "hidden features" series on Stack Overflow:


(There are other flavors of this type of question in the SE network, if you know where to dig.. it's like hunting for truffles.)

However, note that in the Stack Overflow example, those questions at least scope to a specific tool whereas your request for "one-liners" could mean ... anything and everything.

That said, if in your question, you DEMAND that answers provide a full explanation of the one-liner they are posting -- and I mean really full, like super detailed wikipedia type full, with a comprehensive list of pros and cons and why you would ever want to use this command and every single little character in it is explained and examined -- then, maybe.

And this would need to be strictly enforced not just in the question body, but for all subsequent answers, even weeks later.

So. Like I said -- probably no.

  • Fair enough, I guess this is something for better suited for me to add to my website. Thanks for your input Jeff.
    – n0pe
    Aug 20, 2011 at 0:48
  • @MaxMackie If you want to keep a list of your own favorite one-liners your own site sounds like the right place to do it, but if you want to learn about others and share those magic snippets around you might check out Command Line Fu.
    – Caleb
    Aug 20, 2011 at 13:20

Jeff's answer covers the general theory really well.

In this particular case I think the SE QnA format is ill-suited to that question even if it was an 'on-topic' topic. There are other resources out there that are specifically tailored to the kind of thing you are looking for. In fact there is one awesome site devoted entirely to that one question. See Command Line Fu.

  • Yeah I recently found Command Line Fu. Neat stuff, exactly what I wanted to do here.
    – n0pe
    Aug 20, 2011 at 13:33

There is already a question like that on the site.

Now have a look at that question and consider how useful the answers are.

If you use the default sort order (by votes), the first answer begins with

This expands somewhat on the !! trick mentioned in [this answer](link)

That's hardly a well-presented set of answers. (Plus this is by far not the most useful answer in the lot.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .