A Beginner's Guide to the Linux Command Line


Posts: 3,836   +1,189
I'm sorry... I might be a bit too old for this but it feels like welcome to dos 101 :p

I still use the command line even in windows 8, it's a powerfull tool.


Nice article. Here are a some other things that may be worth knowing:
Linux is case sensitive, so /home/Name is different from /home/name
ls -l show long listing format - displays permissions, owners, size, date
ls -R recursively list files in subdirectories
nano is a simple easy to use word processor, good for changing basic files
vi is a powerful word processor, though a bit tricky to learn (need to remember various commands)
mkdir dirname creates a directory called dirname


Posts: 859   +206
Good article. Some nice additions would be wildcarding and redirection. Linux command line is a big pain as it's hard to learn initially. It's super convenient once you get the hang of it though.


It's great to have an article like this, but it needs a bit of work. Some examples,
  1. The home directory doesn't have to be the same name as the user name. That's just the default.
  2. The home directory is covered but it isn't mentioned that ~ refers to the home directory, and that's why the command prompt is as it is.
  3. ls doesn't do colour by default.
  4. Creating a new file with touch is pretty pointless. It implies you need to create a file before you can edit it. The purpose of touch is to update the modification/access time of a file.
  5. rmdir is the command to remove a directory. rm -r is a recursive delete that shouldn't be recommended unless necessary.
  6. The find example is broken, as above.


Posts: 4,046   +4,710
Helpfull article, altough I don't use Linux, I used to and I rarely had to use the command line. As I remember cd command is also used in Command Prompt in Windows and MS-DOS.
There is a reason we don't use dos anymore.

And that reason is that most users have no interest in learning how to get the most from a computer, only ever master an extremely small computing skill set, and are generally more concerned with ease of use than speed, flexibility or automation. It's absolutely true that general users don't need a command line, and are apt to be more effective with an ***** proof GUI than a tool that takes time to learn to use well. If you want to keep improving your ability to use a computer, however, then a GUI only takes you so far, and you need to learn to use and love a CLI.


The CLI was swapped in favor of the GUI. With a GUI though your limited to what is presented to you. With a CLI it's much more dynamic allowing for some powerful commands. Microsoft have even jumped on this with their addition of PowerShell. Obviously a CLI is not as user friendly so naturally guides like this exist. This guide is very well written.


Glad to see autocomplete and searching have been included - makes navigation so much faster. Every computing enthusiast should get an understanding of the commands presented (as they're now applicable to all OSs, including Windows).

You may be wondering 'why not use the mouse'? Because there will be times when you have to automate tasks, and CLI is the best way.


Posts: 1,018   +167
Good starting article. I did note that you mention piping cat to less which is fine to use as a simple example of how to use the pipe command. However, you don't need to pipe cat to less, you can just read the file using the less command I.e.. less myfile.sh Then you can traverse the file using the cursors or you can use the spacebar to move forward a page at a time, or the B key to move back a page at a time.


As a developer, you use the CLI frequently. Linux installs using things like RPM, but at the bottom of the GUI is config & make CLI processors. Linux also favors tar, gzip & gunzip
You can learn a lot of the CLI with the documentation package man and/or info
use man man for an overview
the terse synopsis is also seen using man -h (-h is the ms equiv of /?)
I'll also mention some directory navigation tricks of the shell (that thing that reads the CLI inputs you type)
given a login and a prompt like
pwd gives the current working directory
moving to the webserver
#pushd /apache/apache2.2.22/​
-- do some work and then need to see a file in the home directory
#pushd ~
cat some.log​
-- go back to the webserver (without retyping the whole bloody thing again)
-- get to access server config
#cd config
-- work on the server config
#vi httpd.conf​
--- show you where we are
/apache/Apache2.2.22/conf /users/jeff
--- and move back to my home in one fell swoop

SO; pushd & popd operate like a stack;
pushd moves to the new dir and places it on top
popd forgets the top entry on the stack and makes the next one the current dir
pushd x; pushd y; creates y, x
pushd without an argument toggles the top two dirs
Curious to see in point 5, cat file.txt is piped to the less command. Although it is a neat touch point to gently explain piping and how piping a long output from *any* command to less makes its navigable, it is far easier to contemplate `less file.txt`. As written it gives the impression that the only way you can read a long text file is with both cat and less. Same goes for point 6, I can `vi newfile.txt` instead of `touch newfile.txt; vi newfile.txt`
Like where you are going with that introducing concepts silently thing, just think people will go I can't open and page a file all in one command, this is crap!


You do not have to use pipes regarding cat [filename] | less.
Just use less [filemane] or more [filename]