Quick Links

The Linux console may not be as user friendly as the GUI but it is faster and saves you a lot of time when you are doing simple repetitive tasks.This is may be a little bit subjective, but once you know how to do some tasks faster from the console you will not go back to the GUI to do them.

Installing Software from Optional Repositories

There are thousands of Linux programs stored as software archives that are commonly referred to as 'Repositories'. Ubuntu comes with four predefined repositories:

  • Main - Officially supported software.
  • Restricted - Supported software that is not available under a completely free license.
  • Universe - Community maintained software, i.e. not officially supported software.
  • Multiverse - Software that is not free.

Ubuntu's software repository is fully configurable and we can add new repositories in order to install software from other repositories outside the above predefined repositories.

GUI-based repository management is normally accomplished via "Software Sources" that involves adding the repository from either the 'Main Menu' > 'Administration' > 'Software Sources' and then installing the software from the 'Main Menu' > 'Ubuntu Software Centre'.

Installing software through the console involve less mouse clicking and can be done by executing the following commands through the console. These commands will install CLICompanion and add its repository to your Ubuntu so that you will receive updates on the software.

Note: Press the 'Enter' key after each command

        sudo add-apt-repository ppa:clicompanion-devs/clicompanion-nightlies
    
        sudo apt-get update
    
        sudo apt-get install clicompanion
    

Kill any Program

You will find that the console is a useful tool to kill an application that is acting up and causing your problem. Type 'killall' followed by the name of the program you're trying to kill. If let just just say, your Firefox is eating up your computer resources, type

        killall firefox
    

and Linux will kill any Firefox instance running in your machine.

Resizing Images

Unless we're editing our images with air brushing or colour adjustment, we can simply resize images through the console instead of a full blown image editing software such as GIMP using a simple command:

        convert -resize 100 original_image.JPG smaller_img.jpg
    

Finding Text

The console provides a simple yet powerful tool to search for text in text file called 'grep'. The basic grep command is as follow:

        grep "string" file_name
    

where "string" is the particular text that we are looking for and file_name can be either an existing file name or a file name pattern. A more useful example that we can do with 'grep' is to find a particular text in a file

        grep -C 1 "line" ./*.txt 
    

The above command looks for any occurrences of the word "line" in every '*.txt' files.

'grep' is a very flexible command that we can combine to filter output from other command such as the 'ps' command that displays active processes. Let just say you want to look for every Firefox process running in your Linux, just run the following command

        ps -ef | grep 'firefox'
    

The pipe character means that we are feeding the list of active processes to the 'grep' command that will look only for any processes linked to Firefox.

Adding A Companion to Your Console

CLICompanion help beginners to get comfortable with command lines by giving a dictionary of commonly used commands. We can also customize CLICompanion's dictionary by adding our own frequently used commands making it easier for us to refer back to those commands.

Selecting the 'Add menu' will open a simple command editing form to add command into CLICompanion dictionary.

CLICompanion makes it easier for us to run commands by selecting one of the command in the dictionary and clicking the apply button to run the command.

The tabs allow us to open multiple console and run them simultaneously.

The Console Manual Page

The console comes with a manual page, or man for short, that gives us detail instructions on the available commands in your console. If we want to know what 'mv' does then type

        man -mv
    

to read the 'mv' command's manual.

If you're not sure about what commands that you need to use to do a particular task, you can use

         man -k "task name"
    

where task name is brief description of the task that you are looking for.

Let just say you want to search for a command to ping a network address, run the following command and Linux will search command that mention the word 'ping':

        man -k ping
    

If you happen to have Konqueror installed in your Linux, you can browse the man page in a nicely formatted web pages making it way easier to browse the details of the commands.

Conclusion

Most of the task that we can do in the console can also be done in the GUI and it will be easier to use the GUI wizards to do the unnecessary dirty works of typing commands through the console. Nobody says that we should use the console, but we can definitely execute simple repetitive tasks faster through the console.