Readers

Thursday, February 10, 2011

Pre-Defined Environment Variable


There are some standard variables that many HP-UX commands use. These are called predefined because their names are standard. Here are some of these variables and their use by different commands.


PATH: is the most commonly used environment variable. It contains the command search path or name of    directories where your shell searches for a command when you issue it.Usually it is set up through the system startup file (/etc/profile) and can be modified by a user to add personal directories through the user startup file (.profile). Each directory in the PATH variable is separated by a colon.


HOME:  is automatically set when a user logs into HP-UX. It contains the path of the user's home directory. To refer to the .profile file in your home directory, you can use $HOME/.profile as the complete path to the file. Please note that there is another way to refer to your home directory in HP-UX, and that is the ~/ combination.


PWD: shows the current directory. It is also set automatically whenever you use the cd command. It always has the value of the current directory.


SHELL:  shows the absolute path of your login shell. It is automatically set at the login time.


TERM:  contains the name or type of your terminal. It is usually set through the /etc/profile shell startup file using the test or tty type command.


PS1: contains the primary command prompt string. This string is displayed in your shell prompt. If $ is displayed as your command prompt, the value of PS1 is a $ symbol.

PS2:  contains the secondary command prompt string. That is, if you issue a command that is incomplete, you will see a prompt by the shell with a value of PS2.


MANPATH: contains the list of directories where the man command looks for manual pages. A colon separates each directory in the list.


TZ: contains the local time zone that was set at the time of HP-UX installation. Commands such as date read this variable.


EDITOR: contains the name of the editor you want to use for command line editing or for typing mail messages. You can set this variable in your shell startup file with your favorite editor.


HISTFILE: contains the name of the history file where your command history is kept. All of the commands you use go to the history file.


HISTSIZE: variable shows how many commands are kept in the history file.

Tuesday, February 8, 2011

What is Kernel & Shell in HP-UX?

Kernel :


Kernel is a core part of the UNIX OS. Well here Core mean heart. You can give a thought that it is a software which is responsible to communicate between Hardware and user softwares. It is the Kernel that decides how to communicate with peripheral devices (like HDD, USB etc...), how to share time among users of the system, hot to allocate memory for different programs running, and how to utilize the processor and other resources. The Kernel keep record of all the programs running on the system usually we call it process and share time among this process according to the well defined policy. 


Shell :


As we have seen in above topic that what is Kernel? Now, the question comes here that how can we interact with Kernel? Can we directly tell Kernel to do few things or not? Well in that case no we can not directly interact with Kernel. Then how can we do that?


The very simple answer is SHELL. Now again what is shell?


Well shell is a user interface which is responsible to send the command to Kernel. So we can define shell in this way User can not interact with kernel directly. Instead, user will work with program called shell. We can consider shell as interpreter. 


What is the function of Shell?


1) It take command from user.
2) Interpret command.
3) Do necessary action on that command.
4) Produce the output.


The most common shell are as follows :


Bourne shell : 


Available on all UNIX platforms. It is the oldest and most widely used shell.


C shell : 


It uses a C language-like syntax for shell programming.


Korn shell : 


It has more complex and advanced features than the Bourne or C
shell and takes more time to master.


POSIX shell : 


IEEE POSIX (Portable Operating System Interface) compliant shell.
It is the default and primary shell for all users on HP-UX.


Each of these shells has its own capabilities and limitations. The default shell used on HP-UX systems is the POSIX shell, although the user is free to choose any of the available shells.