Valid XHTML 1.0!

Learn a Little Command Line

Entering the Linux world, you will undoubtedly encounter the command line. That newbie unfriendly text door to controlling your computer. Although most distributions os Linux come with a GUI, access is given to the under lying process through the command line. There is much to be said of the power and convenience of the command line. In fact, most people using Linux use the command line through a GUI. This allows them to open multiple command line windows at once. Most Linux distributions (and other UNIX-like OSes, like OS X)have a program called Terminal that gives users command line access through the GUI.

Xterm

The image above is a terminal window. As you can see, all it says is thart:~ admin$. This is called the prompt. In this case, thart is my user name, admin is my home directory (and the directory I am in), and the $ tells you the command line is ready to take commands. Depending on what command line interface you use you may have # or % instead.

The command line doesn't user the mouse. Instead, the user types commands at the prompt. The computer then runs the appropriate program. There are more commands than you could ever hope or need to know. Below is a short list of some of the most common commands and a short explanation of their use. Remember, this is just the surface, if you really want to you never have to use a GUI again. To use a command, just type it into the command line and hit return. Commands are case sensitive. Oh, and don't type the $, it is just there to represent the prompt.

$ whoami

This simple command tell you who is currently logged in.

$ pwd

At the command line, you don't have a graphical representation of where you are at in the file system. This command will print your working directory, or in other words, where you are in the file system. Note that the word print, in this case, has nothing to do with your printer; it means that the response will be printed to the terminal window.

$ ls

The ls command lists the contents of the working directory. It is the non-graphical equivalent of double-clicking a folder to see what is inside.

$ mkdir

Standing for "make directory," this command does just that. Just like creating a new folder. In a Unix environment a folder is the same thing as a directory and the words are interchangable. You also have to provide the command line with the name of the folder. So mkdir folder would make a folder named "folder" in your current working directory.

$ cd

Now for a command that will finally let you go somewhere in your file system. "cd" stands for change directory. In order to move through the FS, we need to know where to go. Use the ls command to list the contents of the directory you are in. Suppose there is a directory called "music" reported. Typing cd music would change your current working directory to the "music" directory. There are also many other ways to use cd. Typing cd will take you back to your home directory. Typing cd / will take you to the top level of the file system. cd .. will take you to the directory immediately above the current one (a folder behind).

$ rm

This command is how a user removes a file from their computer. Typing rm filename would remove the file (filename). Also, unlike most GUI systems, once a file is gone, its gone for good.

$ cp

Copy file(s). cp somedir somedest would copy somedir (the file to copy) to somedest (the destination).

$ exit

This command closes the command line. If you are loggen on, you will be logged out.


There are many other commands in Linux. There are many resources on the internet to help you learn more.