Pages

Monday, April 11, 2011

Command line basics.

Now that I've talked a bit about not shying away from the command line, I'd like to actually give a basic command line tutorial.

If you have Linux installed, but have never used the command line, or you are trying it out from a live CD, the first thing to do is open a terminal. How you do this depends on which Desktop you are using.

On Gnome, go to the applications menu in the upper left corner scrren and open it up. Go to Accessories, and when that menu opens, move down and click on Terminal.

KDE is similar, but the menu is in the bottom left corner. Open up the menu and go to the System category. Then select Terminal from that menu.

You will get an open window with a text string and blinking cursor in the upper left corner. This is your command line.

To see which directory you are currently in, type pwd and press enter.
The terminal will display the current directory path, which is generally /home/"username", but this may differ if running from a live cd, but in either case, it will tell you which directory you are currently in.

Typing ls and pressing enter will show you the files and sub-directories in the current directory.

To change directories, use the cd command along with the directory you want to change to.
As an example, to change to the root directory, type cd /.

If you enter an ls command here, you will see the basic directory structure of the whole filesystem.

To get back to your home directory. type cd ~.

By now you probably have alot of text in your terminal, so to get rid of it type clear and press enter. All the text will disappear and the prompt will be placed back in the upper left corner.

To exit the terminal, either close the window or enter the word exit and hit enter. In either case, the terminal window will close.

Those are very simple and harmless commands that will get you used to using the command line and getting around a Linux system a little.

There is alot more to the command line, but that should give you a feel for it. Later lessons will likely involve more interaction with the command line.

0 comments:

Post a Comment