Pages

The Importance of Running Applications Using Command-Line Interface in GNU/Linux

These days you certainly don't have to rely on the GNU/Linux command-line interface that much even though it's the foundation of the entire operating system. This is because nowadays we have powerful GUI tools written in various toolkits such as GTK+/Qt, etc which makes the life of a someone who's even new to GNU/Linux much more "comfortable" without a doubt.

But quite ironically, many users, beside all those excellent package manager GUIs, etc still prefer to use the command-line when it comes to installing applications because unlike with a GUI where you have to go to the menu and open it then search and click on the "apply" button, etc... with a command-line tool (which is the "engine" these GUIs use anyway) all you gotta do is just copy and paste the command in to your Terminal and hit the "enter" key... the rest will be taken care of :D... especially with Debian based distributions such as Ubuntu for instance.

And the command-line, also known as the "Shell" (which is also known as "Terminal", which is again, another emulation of the original "command line interface" in a GUI environment such as in your Gnome/KDE desktop) is the way how operating systems used to get "orders" from the users since at that time there weren't any graphical user interfaces available thus the shell or the command-line was THE interface it self.

So it is a or "the" most powerful tool, especially in GNU/Linux OS to this day and perhaps always will be as long as the hackers have the authority.  

The "shell emulator" for the Gnome desktop... known as the Gnome Terminal...

Anyway because of its this powerful nature, did you know that you can actually use the command-line also as a way of fixing certain types of application related errors?. Of course not all the errors since some are "caused" by coding errors where there's nothing we as users can do about it but...

This is certainly not something new and is something that anyone like me who's got a decent knowledge of GNU/Linux knows that, concerning software (since the command line is the heart of GNU/Linux and its adaptation is in a much higher scale than I can image...) apart from installing, you can use the command line as a way of fixing certain errors that won't let you run the newly installed programs otherwise!.

For instance (this is just a singe example as I've seen this over and over again) sometime ago in my Ubuntu Laptop (11.04) I installed a software called NTFS-Config. Now I used the "apt-get" command to installed it but after the installation was over I closed the Terminal window and clicked on the icon on the menu to launch it. I waited for few seconds but nothing happened. Then I clicked on the icon again, but still nada, nothing happened.

So I realized the application  have failed to run ("oh Gayan, what an insight that is" :P).

The point is, the application didn't give me any errors or messages of any kind which would help me at lest to understand what was happening. Since I've been using (like many others) command line quite efficiently to getting fixed certain things in apps in the past, I opened the Terminal window and put the command that should launched the "ntfs-config" utility to see what information it can throw at me.

The same thing happened, it failed to launch but, unlike with the above method, this time I was able to see an "output" by the application which was "hidden" while it was running without using the command-line. Below is a portion of the error.
Traceback (most recent call last):
  File "/usr/bin/ntfs-config", line 102, in <module>
    main(args, opts)
  File "/usr/bin/ntfs-config", line 75, in main
    app = NtfsConfig()
  File "/usr/lib/pymodules/python2.7/NtfsConfig/NtfsConfig.py", line 56, in __init__
    os.mkdir(HAL_CONFIG_DIR)
OSError: [Errno 2] No such file or directory: '/etc/hal/fdi/policy' 
Now as you can see, although the whole "text" would get anyone a bit confused and I certainly have no idea what the heck that is all about, yet one line (in bold text) got my attention.

It basically says that "ntfs-config" cannot find a folder in "/etc/hal/fdi/policy" directory path. So I checked and realised that there isn't any folder by that name in that path!. So all I did was manually created the folders it said, "missing".

That's all I did and the next thing I did was reopened it via the standard menu and clicking on the icon and guess what?, this time it worked!.

So all I'm trying to say to all those who are new and learning GNU/Linux from scratch (I'm an average dude... trust me :D) haven't happened to know this yet... whenever an application fails to start after a successful installation, just run it using your command line.

Remember :- this obviously won't be able to fix all the errors since some are only fixable via accessing the original programming codes... in that case there's nothing anyone can do unless the original developers fix it.

But other small issues like the above mentioned one, etc, whenever something like that happens, try running that app in your Terminal because even if you can't figure it out and fix it, still most of the time, command line will at least be able to give some "feedback" to you which should help to finding a way to fix it. Again not all the time but heck, it might save you few "angry faces" :D. Good luck.

2 comments:

routilaje said...

Wooww.. great.

This helped me!

Gayan said...

@routilaje,

You are welcome :)

Post a Comment