You are on page 1of 12

PRACTICAL FILE

LINUX

By: Abhijeet Rai 00320602009 BCA V Sem 1st Shift

INDEX
1 ARCHITECTURE OF LINUX 1.1 BRIEF ARCHITECTURE 1.2 KNOWING YOUR MACHINE 1.3 LOGIN WITH USER NAME AND PASSWORD 1.4 SHELL CONCEPT 2 UNDERSTANDING LINUX COMMAND 2.1 LOCATING COMMANDS 2.2 INTERNAL AND EXTERNAL COMMAND 3. COMMAND, ARGUMENT AND OPTIONS 3.1 COMMAND STRUCTURE 3.2 OPTIONS 3.3 FILE NAME ARGUMENTS 4 FLEXIBILITY OF COMMAND USAGE 4.1 COMBINING COMMANDS 4.2 A COMMAND LINE CAN OVERFLOW OR BE SPLIT INTO MULTIPLE LINES GENERAL PURPOSE UTILITIES

5.

(SIGNATURE)

1. ARCHITECTURE OF LINUX
1.1 BRIEF ARCHITECTURE

IN THE ARCITECTURE OF LINUX THE DIVISION OF LABOUR IS DIVIDED INTO 2 ENTITES: KERNEL

The Linux kernel is an operating system kernel used by the Linux family of Unix-like operating systems.[6] It is one of the most prominent examples of free and open source software.[7] The Linux kernel is released under the GNU General Public License version 2 (GPLv2)[4] (plus some firmware images with various non-free licenses), and is developed by contributors worldwide. Day-to-day development discussions take place on the Linux kernel mailing list. The Linux kernel was initially conceived and created by Finnish computer science student[8] Linus Torvalds in 1991. Linux rapidly accumulated developers and users who adapted code from other free software projects for use with the new operating system.[9] The Linux kernel has received contributions from thousands of programmers.[10] Many Linux distributions have been released based upon the Linux kernel SHELL

The Linux/Unix shell refers to a special program that allows you to interact with it by entering certain commands from the keyboard; the shell will execute the commands and display its output on the monitor. The environment of interaction is text-based (unlike the GUI-based interaction we have been using in the previous

chapters) and since it is command-oriented this type of interface is termed Command Line interface or CLI. Before the advent of GUI-based computing environments, the CLI was the only way that one can interact and access a computer system.

1.2 KNOWING YOUR MACHINE Linux can be used by several users concurrently. In other words copy of the operating system installed on the disk can serve the needs of hundred of users. If you have access such a multiuser system, then you will be sitting with just a terminal or monitor and like you there will be others working on similar type of terminal. The rest of the equipments will be probably with restricted access.

KEYBOARD:Each alphabet, number or signal is known as characters which represent the smallest piece of information. All these characters have unique values assigned knows as ASSCII values. For e.g.:- the letter A has ASCII values of 65. The enter key at the right if the keyboard is used to terminate the line. When you look at the blank screen you will see a blinking object called a cursor. When you key in a character it shows at the location of the cursor while moving the cursor towards the right. Directly above the enter key is the backspace key which is used to erase one or more character that you would have entered using a feature known as backspacing. Another important key is (clt) which you would find in duplicate on the lower side of the keyboard. This key is never used singly but always used in combination with other

key. At the top left corner you will see the esc key. Which we will be required to use when performing the file editing which the text editor such as VI.

1.3 LOGIN WITH USER NAME AND PASSWORD UNIX/LINUX are security conscious, and can be used only by those persons who maintain separately in the computer. Because the system can be used by many users, someone has to be given charge of administrator system. This person is known as system administrator, he is the person who will grant you the authority to the system. He opens an account with a name for your use and gives you a secret code that you have to enter that a system prompts you for it. The string you entered on the first prompt (login) is known as login name or login id or user name. The secret code that you enter at the next prompt is known as password. If you enter either of them, the system flashes a message incorrectly. After the successful login to the system, the system now shows the dollar prompt, with the cursor constantly blinking beside it. This is a typical UNIX prompt and many systems user a $ as a user prompt string. As you log into the system a program called shell starts to run at your terminal and keeps running until you to terminate the session. The shell is your command interpreter, it displays the prompt and accept and accept all the input from the keyboard.

1.4 SHELL CONCEPT A Unix shell is a command-line interpreter or shell that provides a traditional user interface for the Unix operating system and for Unix-like systems. Users direct the operation of the computer by entering commands as text for a command line interpreter to execute or by creating text scripts of one or more such commands Linux usually offer a variety of shell types:

sh or Bourne Shell: the original shell still used on UNIX systems and in UNIX-related environments. This is the basic shell, a small program with few features. While this is not the standard shell, it is still available on every Linux system for compatibility with UNIX programs. bash or Bourne Again shell: the standard GNU shell, intuitive and flexible. Probably most advisable for beginning users while being at the same time a powerful tool for the advanced and professional user. On Linux, bash is the standard shell for common users. This shell is a socalled superset of the Bourne shell, a set of add-ons and plug-ins. This means that the Bourne Again shell is compatible with the Bourne shell: commands that work in sh, also work in bash. However, the reverse is not always the case. All examples and exercises in this book use bash. csh or C shell: the syntax of this shell resembles that of the C programming language. Sometimes asked for by programmers. tcsh or TENEX C shell: a superset of the common C shell, enhancing user-friendliness and speed. That is why some also call it the Turbo C shell. ksh or the Korn shell: sometimes appreciated by people with a UNIX background. A superset of the Bourne shell; with standard configuration a nightmare for beginning users

2. UNDERSTANDING LINUX COMMAND


2.1. LOCATING COMMANDS The Unix system is the command based i.e. thing happened because of command you key in. Unix commands are seldom more than four character long. All Unix command are single word like ls, cat, who, date etc. these names are all in lower case and if we type them in upper case then Unix will generate the error. Commands are essentially files containing programmes mainly written in C. Files are stored in directories. For ex:-ls is a file or programme which will be found in bin/ls. The easiest way of locating or knowing the location of a command is to use command. $type ls THE PATH The sequence of directories that the shell searches to look for a command is specified its own PATH variable used echo to evaluate this variable and you will see a directory list separated. For eg:- $echo $PATH

Output:-

2.2. INTERNAL AND EXTERNAL COMMAND Since ls is the program or file having independent existence in/bin directory(or/usr/bin). It is branded as an external command. Most commands are external in nature but there are some which are not really found anywhere, and some which are normally not executed even if they are in one of the directory specified by PATH variable for a number. For ex:- $type echo Output:-

Echo is not an external command in the sense that when we type echo the shell would not look in its PATH to locate rather it will execute it from its own setup built-in command that are not stored at separate file. These built-in commands are known as internal commands. If a command exist both as an internal command of shell as well as external one. The shell will give top priority to its own internal command of the same name.So the internal echo commands take the precedence our external.

3. COMMAND, ARGUMENT AND OPTIONS


3.1 COMMAND STRUCTURE In the command the first word is actually the command name, the additional words are called as arguments.For example $echo priya, $cat f1 f2 f3. The commands and arguments have to separated by spaces and tabs to enable the system to interrupt them as words. You can use any number of them to separate the words that form a command.unix arguments range from simple to complex.They consist of options,expressions,instruction,filenames etc.

3.2 OPTIONS There is a special type of argument i.e. mostly used with a - sign. For eg:ls -1 f1 is a special argument to ls command. It is a special argument known as option. An option is normally preceeded by a - sign to distinguish it from file name. There must not be any ehite spaces between - and l.Options are also argument but givena special name because their list is predetermined. There is always space between the command and argument. Options can be combined with only one - sign i.e. instead of using $ ls -l-a-t. We might write it as $ ls lat 3.3 FILE NAME ARGUMENTS Many Unix command uses a file name as a argument so the command can take input from a file. For eg:- cp f1 f2. The command with its arguments and options is known as command line. This line can be considered complete only after the user has hit enter key. The complete line is then fed to a shell as its input for interpretion and execution.

4. FLEXIBILITY OF COMMAND USAGE


4.1 COMBINING COMMANDS So far we have been executing the command separately each command was first preceeded and executed before the next can be executed. Unix allows you to specify more than one command in the command line.Each command has to be separated by ; $wc f1;cal 2 2011>f2 The combined output of both the command is now send to the file f2.When a command line contains a ; ,the shell understands the command on each side of the ; is needed to be executed seperatly.the ; here is knoen as meta character.

4.2 A COMMAND LINE CAN OVERFLOW OR BE SPLIT INTO MULTIPLE LINES Sometimes you will find It necessary or desirable to split a long command line into multiple lines. In that case the shell issue a secondary prompt usually > to indicate you that the command line is not complete. This is easily shown with the echo command. For eg:$echo this is >a three line >text message

Output:-

You might also like