The Power of Linux Console

0 views
Skip to first unread message

Nirmal Pathak

unread,
Mar 24, 2007, 3:16:07 AM3/24/07
to VG...@googlegroups.com, linuxc...@googlegroups.com

The Power of Linux Console

A console (terminal, terminal emulation) and a shell are equivalent to what is commonly known in Windows as the 'command line'. For many it's just a mysterious and unnecessary system tool, reserved only for the '1337′. For people like professional system administrators it's indispensable. The Linux console, in contrast with the Windows command shell, is an extremely powerful user tool, which allows to perform virtually any operation on the system.

Author: Borys Musielak

The combined power of the console and the shell (i.e. Bash) enables us to perform thousands of tasks; here are a few examples:


apt-get install mp3blaster

http://polishlinux.org/reviews/Windows/apt-get_thumb.png

Pic 1. Software installation requires
no more then just one command.




Alsamixer - system sound mixer

http://polishlinux.org/reviews/Windows/alsamixer.png

Pic 2. Alsamixer - useful for
system sound settings changes.

  • detailed and extensive system-wide configuration and administration,
  • software installation, updates, and removal,
  • file and folder administration and manipulation (using i.e. Midnight Commander),
  • sharing, accessing, and transferring data between machines using SSH, NFS, or Samba,
  • managing personal email (mutt, pine), web browsing (lynx, elinks), reading discussion groups (slrn),
  • listening to music (mpd/mpc, mp3blaster, xmms-shell),
  • burning CD's (cdrecord, cdrdao) and DVD's (growiofs),
  • chatting via IRC or via many popular instant messaging networks like Jabber, ICQ, etc!
  • extensive system monitoring and troubleshooting (top, netstat, io, iptraf),

What differentiates a Linux console from a Windows command line?

Simply said: its architecture and abilities.
Let's dig a little deeper… First of all, in Linux the shell is a completely system independent entity, it is not an integral part of the operating system. Thanks to this simple architecture we can use several shells for all kinds of different purposes. Note especially that we can launch a large number of consoles for different tasks, using different shells if it's necessary. It's the shell that controls the functionality of such events as command history and command line completion, but also any kind of conditional statements, loops, and all other programming concepts used in shell scripting. The most popular shells include: bash, zsh, and ksh.

The terminal emulator on the other hand is a program (usually with graphical user interface, including menus, etc) which helps us to effectively use the console. The most commonly used emulators are: gnome-terminal, konsole, xterm, aterm, Eterm and multi-gnome-terminal. Most of them are simply called "console' or 'terminal' in the system menu. The terminal emulator is responsible for extra stuff like transparency, having multiple terminals in tabs, key shortcuts, etc.

The real terminal and the emulator

In many Linux distribution (especially those dedicated for servers) the default user interface is pure terminal. The graphical interface (X Window System) is optional and can be run independently. In such cases, we have the access to terminal just after logging in so we don't have to use an emulator run from the GUI. In most cases however (all desktop-oriented Linux systems), the default setting is to use the graphical user interface. In these systems we can also switch to the real terminal using a key shortcut CTRL+ALT+F1 to F6).

This architecture, which does not require a graphical interface to work with the system, is a great advantage of GNU/Linux and other UNIX-like systems. Few remember that a similar division was in place in old versions of Microsoft systems as well. MS Windows, up to version 3.11 could not be run independently and required DOS ("a terminal") to normally function. In Windows 95 this method was abandoned. The graphical interface is always running, eating up valuable resources for server systems. Being condemned to using graphical interface is also an important restriction in case of system crashes. For instance, in case of problems with a graphics card driver, when Windows does not want to run, we have almost no way to easily correct the error (e.g. by removing the driver and replacing it with a working one). If the plug & play magic fails, we have no option but to call tech support or reinstall the system.

Why use the console if there is GUI?

Indeed… Why the heck should you use the console (except for sorting out system crashes)? Isn't it way easier and faster to click through things? Linux was supposed to be as easy as Windows you said! And now you come up with this geeky stuff…

Take it easy. Nobody says you have to use the console. You can configure your system and perform all the standard operations in the GUI mode. But.. I'm not sure you really want to. Using the GUI is easy but remember two things: the console is faster and it is more efficient.

Don't believe me? I've got examples:

  • Let's delete a file. For instance, the file test.txt located in our home folder
    • In a terminal: rm ~/test.txt (the file name is auto-completed when you enter TAB)
    • In GUI: Double-click the "Home" icon on the Desktop. Then find the proper file, select it and use the right mouse button to choose 'Delete'.
  • Let's do some configuration now. For instance, let's configure the Internet access via DHCP
    • In a terminal: sudo dhclient eth0 (and enter your password)
    • In a GUI: Click on the icon representing the Network on the desktop toolbar. A network configuration applet shows up. Choose a network card represented by eth0, and click Activate. If it does not work, then enter the specific configuration for this card, enter the root password, set the DHCP option (probably static IP has been set before), click OK, and again click Activate on the network card. Finally, we can leave the applet.
  • Let's do some admin stuff now and start the Apache2 web server!
    • In terminal: sudo /etc/init.d/apache2 start (and enter your password)
    • In GUI: Choose System-%lt;Administration-%lt;Services from the GNOME menu. Then look for Apache2 server and select it. Click 'Apply' and close the applet.
  • OK, the last example is the least geeky one. Let's watch a movie in MPlayer!
    • In terminal: mplayer /home/movies/Aviator/AviatorCD1.avi (of course using the TAB completion option for file names!)
    • In GUI: In GNOME menu choose Applications-<Sound & Video-<MPlayer Movie Player . When the program shows up, choose 'Open' and navigate to folder /home/movies/Aviator. Then click the first part (AviatorCD1.avi). Alternatively, navigate in your file manager (like Nautilus) to the right folder and then double click the movie file (or, if MPlayer is not your default movie player, select 'Open With' and select MPlayer from the list).

konsola w akcji

http://polishlinux.org/reviews/Windows/konsola_w_akcji.png

Pic 3. Console tools in action: mp3blaster, Midnight
Commander, gcc, FvwmConsole and top

These are only four examples. In each one, performing the exact same task was a couple times faster in terminal than in GUI. Of course it's not always the case. Burning a DVD in console is for hardcore hackers only, since the growisofs program requires many parameters and typing them all manually is harder than choosing 'Burn as DVD' in a program like K3B or GnomeBaker. In general however, if we care for efficiency in our work, it is a very good idea to make friends with the terminal. It will take time to get to know the basics, but for a Windows power user like you, the learning curve should not be long and the benefits are faster and more efficient work.

What is worth mentioning, after many years of ignorance, the Microsoft guys finally realized that an efficient console is good for them as well. They have been working for couple years on the new Windows shell called MONAD or msh, designed to make the system's administration work easier.
The new shell, now called Windows PowerShell was supposed to be available in Vista, but the schedule has changed and it is not part of this release. So, basically if you are a Windows user you are still left with Cygwin, a UNIX shell emulator for Windows, with all the drawbacks of this solution.


--
Nirmal D Pathak.
+91-9898173175.
Reply all
Reply to author
Forward
0 new messages