Monday, January 25, 2010

What is all about shell????

Hell NO command line??????

Linux shell is more user firendly than normal text mode OS before. Why the hell I'm telling that? Its because it make the passion inside you to use keyboard than mouse and it can automaticaly complete a long command or filename, retrieve a command recently executed , or edit a command recently used. (Magic isn't it?)

If you are login to linux using command line interface (default login for slackware, which lolipro is using :-) ) the chances are that you are default in shell, but if you are in graphical user interface, go to a program called terminal also known as xterm, Konsole etc. with respective to the OS.



                                            xterm


konsole

Most of KDE desktop systems use Konsole. OS like Ubuntu uses terminal. This is like windows prompt but have more powers built in ;-) It enables you to be contacted with the shell it self. If you cant find it hit for run and type xter or konsole. That should do the trick.

Mostly used internal and external shell commands
No matter you are using bash or anyother shell program most of commands offered are similar. Feel free to use the help menu by using 'man' command. I have mentioned mostly used internal commands below.

1) Changing the working directory :- Whenever you're runnning a shell, you're working inside a specific directory(or shall we say a folder). If you type "cd /home/lolipro" changes your current directory to /(root folder)->home(much like my documents in window)->lolipro (my user account) If my user home directory is /home/lolipro then if I type cd~ takes me to my default home directory without wasting time to type the whole path.

2)Ever wonder how to know in which folder I'm currently working on? If so the command you are looking for is "pwd" which prints the path you are currently working on to the screen.

3) Display the line of text :- typing "echo Lolipro" causes the system to display the string Lolipro in screen. It is very useful when you want to put something happening inside the kernal to the screen. You'll learn more when you study further.

4)Eecute a program :- The exec command runs an external program that you specify. For instance If I type "exec lolipro" it runs the lolipro program. You can also do it by just typing the name of program. For instance if I want to open 'vlc player' I would just type vlc and hit enter. But this exec command have a special feature, when you just runing the program it makes a parallel thread to process alongside with the shell. When you type exec it makes the process inside the shell and when the new process terminates the shell is also terminates.

5) Time and operation :- This is like a stopwatch . For example, typing time cd~ will tells you how much time taken by the system to execute the cd command. The time is displayed after the full command terminates. Three times are printed as : total execution time (real time), user CPU time, and system CPU time. The last two tells how much time CPU has used to process. Its more likely to be less than total execution time.

6) Set option :- In its most basic form, set displays a wide variety of options relating to bash operation. These options are formatted much like environment variables, but they aren't the same things. You can pass various options to set to have it affect a wide range of shell operations.

7) Terminate the shell :- The exit and logout commands both terminates the shell. The exit command terminates any shell, but the logout command termiantes only login shells-that is, those that are launched automatically when you initiate a text-mode login as opposed to those that run in konsole windows or the like.

Note: This is not a complete list but a short introduction. with the help of  LPIC-1 study guide.