Having had this netbook running ubuntu natty for a while, and having experienced the pains of not knowing how to do x, y, or z without fumbling about blindly in a maze alternating command line with google searches for “how to…” or “linux command reference kill,” I am contemplating starting a command-a-day series. My goal would be to learn–not merely to be able to do after having looked up–a good selection of the most important active commands, especially for dealing with wonky programs running on the local machine and for manipulating files/directories both on the server and on the local host, and downloading/installing/running programs from the command line. Also searching: grep confuses the heck out of me! At any rate, I could use your help. What, to your mind, are the most important (and useful, for a beginner) commands to learn? What about the most useful delimiters or modifiers? What should a beginner not mess with until a basic sense of the command structures has been grasped?
8 Replies to “Linux command a day?”
I would say the most important thing to understand about the *nix-Commandline is its philosophy. Very succinctly summarized: This is the Unix philosophy: Write programs that do one thing and do it well. Write programs to work together. Write programs to handle text streams, because that is a universal interface. (Doug McIlroy).
Understanding this and having mastered the concept of input/output streams and the pipe operator (and maybe some very basic shell-scripting), there’s very little you can’t do with a POSIX-compatible shell.
I recommend reading through the material available at the Linux Documentation Project, especially GNU/Linux Command-Line Tools Summary. Before it goes into any detail about commands per se, it discusses the Unix-Philosophy, the concepts of text-streams and where to get help (manpages are your friend!).
As for your confusion with grep, try if you can make more sense of it after you’ve understood the concept behind it, maybe the manpage will make more sense to you then, too 🙂
Oh, and http://superuser.com is a superb resource to get help with problems like these, in case you haven’t already stumbled upon it during your Google searches.
Johannes, thanks so much! These are excellent resources–I’m reading up, and the unix tools philosophy is really helpful. I’m quite sure I’m not at the writing-programs stage, and some of the material you linked actually makes me think I’m not really at the learning-command-line tools stage, either, but I’m definitely eager to learn. SuperUser is great for Q&A, in addition to browsing others’ questions!
I’m not a linux/unix expert, but I’ll be an audience for this kind of thing.
I can say that I’m finding the “find” command very useful; it can be used to recursively apply other commands to, e.g. every file in a large tree of subfolders under some root folder.
I don’t do much beyond the basics, but here’s what I use a lot, along with some modifiers
* ls -a -l
* rm -f -r (yeah, those are dangerous!)
* chmod (especially good for understanding the funny numbers for permissions like 644 or 755)
* chgrp (and other group-related stuff, but there’s usually a good GUI for that in Linux distros)
* more (with modifiers for where to start and how much to display)
* tail -f, and with same modifiers as above
Also very helpful: using | and >
That’s what I have off the top of my head!
Great list! I’ve used some of these before, but I don’t really have a clear grasp on the operators–so that’s definitely going to have to make an appearance. Perhaps that can be a first step. I like the idea of using -v and -i to see more clearly what’s actually being done, though I imagine there’s a way to Q out of the stream. Thanks, Patrick!
Just got a message that reminded me of two other very nifty and helpful, kinda advanced command line tools: wget and curl for grabbing data from elsewhere on the internet.
Come to think of it, and reinforcing Johannes’ thoughts, there’s a fuzzy line to address between “linux command” and “command line app”. Most of what I mentioned previously are standard as part of any linux install. But, there are other tools that might or might not come with a distro’s standard install. Most likely curl and wget are also there by default. But, there are plenty of other tools that might not be part of a default install, but are available via your distro’s package manager.
For example, pdftk (PDF ToolKit) might or might not be there by default. Is a good additional learning experience to go and grab a new app that gives a command-line tool. Also, ImageMagick (‘convert’ on the CL) might fall into that category.
So, as a self-teaching exercise, at some point the step of “Finding and installing new command-line commands” might be another interesting step.
And, what I just mentioned is exactly the path into getting and using git! 🙂