Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The power of combining xargs, cut, tail, grep, seq, amazes me. What resource should I look at for a tutorial on the most useful linux commands for programmers?

I'm interested in just the ones programmers use most frequently, that will make my life easier.

share|improve this question

closed as not constructive by Gilles, Kevin, Michael Mrozek Mar 3 '12 at 20:11

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

Welcome to Stack Exchange. We've found that asking for a list of resources rarely works in our questions and answers format. Please read Real Questions Have Answers. I suggest browsing the site (especially the questions in the tag info for shell, text-processing, sed and so on. – Gilles Mar 2 '12 at 22:37

10 Answers 10

The best thing you can do to learn this is to find problems and solve them. Go through this site, look at all the "How do I do X in awk/sed/grep/etc." and try them for yourself before looking at the answers. Look if you get stuck or to see how others did it once you find a way. If you find yourself doing something repetitive in the terminal, stop and think about how you might use one or more utilities to make it easier. If you can't find a way to do it, post here and we'll guide you.

share|improve this answer
Sidenote: seq, head, and tail (at least the most commonly used parts) are fairly trivial. I suggest you start out looking at grep to get comfortable with the searching half of regular expressions and sed (in parallel but lagging a bit behind grep) to get the replacement half (save the more advanced sed commands for later), then awk because it's quite a powerful tool. Then find, then xargs. – Kevin Mar 2 '12 at 16:45

The Unix Programming Environment by Kernighan and Pike is the classic on the topic. It's ancient but still in print, which should tell you something.

The Art of UNIX Programming by esr is much newer. I found it interesting and helpful, but with a bit more "advocacy" than I felt was necessary. (Euphemism for "frothing partisanship.") Be prepared to take his comparisons to other OSes with a grain of salt, as I recall finding outdated[1] material even when the book was new, and the *ix competitors have almost a decade of progress since that time.

[1] Mostly, I recall jabs at weaknesses in non-*ix OSes that had been eliminated before the book was published. The same sort of thing you find in amateur Windows vs Mac vs Linux arguments all over the net.

share|improve this answer

Follow the one-a-day plan. Start by listing everything in /sbin. Then take one command per day and type man command and find out what it does. The essential core commands are all in /sbin. After that, go to work on /bin and when that is finished, go to work on /usr/sbin and /usr/bin. You can shorten your list of commands by skipping any with more than 5 letters in the command name, and you will not miss many important things.

But the important thing is that you will learn something new every day, and probably before you are half way through, you will understand so much of the basics, that you can easily pick up half a dozen new commands per day.

But you have to use them, each and every one of them, even if it is only tinkering and doing exercises with them.

share|improve this answer
This is good idea. Learn commands one by one. Check what they do and master them. – Kamil Mar 2 '12 at 8:17
I can't agree about starting in /sbin, given the "for programmers" in the question title. On many systems, /sbin and /usr/sbin are in the default PATH only for root. I think you may be right to view them as "core" commands in the sense that they're key parts of the OS, but they aren't tools you use in programming so much as system administration. – Warren Young Mar 2 '12 at 17:27

One of the way is to start reading some blogs which specializes in Unix/Linux ..

This blog thegeekstuff where i write occasionally is one of a good place to start with ... Some important articles which you may be interested in are:

Where there is a series of tutorials about sed and awk Hope it is useful to you...

share|improve this answer
The 50 commands is the perfect answer to this question! Go through it, study examples of each command and if it's interesting, follow the link (usually provided) to further examples. That link's a keeper! – Bill K Mar 2 '12 at 19:04

For Bash I would check out tldp.org/LDP/abs/html/

share|improve this answer
The infamous "Advanced Bash Scripting" guide will teach you to write bugs, not scripts. Whilst the intentions in writing it were noble, the errata and misinformation is too high to recommend it. mywiki.wooledge.org/BashGuide is a far superior guide. – Chris Down Mar 2 '12 at 17:14
Thanks @Chris I thought the intro stuff was a good start. – Iman Mar 2 '12 at 18:57

Programmers have a unique opportunity to master Linux. Every chance you get, instead of writing a program to accomplish a task write a shell script to do it.

I actually have a standing personal challenge to write everything in Bash before I write a program - you'd be amazed and disturbed.

As far as a recommendation for a book, it might seem silly, but the Linux Pocket Guide has a place of honor on my bookshelf. It is compact and has loads of useful Linux programs. Perusing it is easy and its a great reference.

share|improve this answer

Unix Power Tools is very interesting to learn some tricks.

share|improve this answer

I will suggest you to get familiar with these: awk1line.txt and sed1line.txt.

share|improve this answer
info coreutils

gives you a big list of useful commands, grouped by context.

You can take this as a guide and learn one command a day, and of course as a repository to search in.

share|improve this answer

I would add Linux® Command Line and Shell Scripting Bible by Richard Blum. It'easy to understand, practical and full of many useful examples.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.