The Linux Command Line For Beginners: Part 1

Ceri Shaw
12/17/15 05:48:27AM

Opening The Terminal For The First Time

⇦ Part 2 Here

Many people coming to Linux for the first time are wary of the command line. It has a fearsome reputation It is supposed to be difficult and hard to grasp. In fact it is a language which you can learn if you choose to, gradually increasing your vocabulary and mastery of the syntax at whatever pace you find comfortable. Of course you do not need to learn it at all in order to use modern user-friendly Linux distributions like Ubuntu but your experience with Linux will be vastly enriched if you take the time to master the basics.

First things first....lets open the terminal. To do this (on Ubuntu) navigate to Applications--> Accessories--> Terminal. The dreaded black box will open and you will be presented with a prompt. The simplest way to start exploring the massive capabilities of your Linux system is to hit the Tab key twice. You should be presented with something similar to the following:-

Display all 2594 possibilities? (y or n) (see graphic at the top of the page)

Your figure will vary according to the number of installed programs you have on your system but nevertheless if you hit the 'y' key you will be presented with a long list of all the available commands on your machine. Just keep hitting the space bar to scroll through it. When you tire of scrolling through a seemingly endless alphabetic list of meaningless names hit 'Ctrl-C' to return to the prompt.

This is all very well but it would be nice to know what these commands do. This is where the famed 'man' command makes its entrance! Almost all the programs on your system have an accompanying man or manual page. Lets suppose you noticed the 'cd' command in the earlier listing and you wanted to know what it does. You would simply type "man cd" at the prompt. The appropriate manual page will be presented in the terminal. Of course the terminal is not the best place to digest large quantities of text but never fear, almost all the Linux man pages are available online too. Just open your browser and, in this case, search for 'man cd'. Much easier to read! In order to close manual pages in the terminal hit the 'q' key.

Some of the programs on your system will open in the graphical interface and others will run in the terminal. In order to see the difference try typing 'firefox' which will open the Firefox browser and 'ls' which will list files and folders in the current directory in your terminal. Of course you can always open programs in the graphical interface by clicking on the appropriate icon in the Applications menu but command line programs will only run after being invoked in the terminal.

As a rule it is not a good idea to run commands in the terminal unless you have researched them and know exactly what they are going to do. Many commands can only be run as the root or administrative user. We will return to this subject later. (see note below)

So...what practical purpose might what we have learned so far possibly serve? Well let us suppose that you have installed a new program with Add/Remove Programs ( or Synaptic or Apt-get ) and no icon was added to the Applications menu ( this happens frequently ). Let us further suppose that you dont remember the full name of the package but do recall that it started with a 'v'. All you need do is open a terminal , type 'v' and press tab twice to be presented with a list of all the packages on your system whose names begin with 'v'. Having spotted a likely candidate in the list press 'Ctrl-C' to escape and then type the appropriate command. Always assuming you've got the right command your program should appear on the screen ( or in the terminal of course ).

NOTE: The superuser or root account on traditional unix/linux systems is god. It alone has the right to administer all particulars of a given system. Ubuntu is not traditional in this respect, allowing regular users to perform administrative tasks if they preface the commands with the sudo command. If you wish to revert to the traditional arrangement you could do worse than consult this article Rootin' For Root.