Вы находитесь на странице: 1из 33

PRACTICAL NO: 1 AIM : FAMILIARIZE WITH UNIX/ LINUX LOGGING /LOGOUT SIMPLE COMMANDS.

LOGGING IN: If you are working on a large system and have been provided with a terminal, ask the administrator for your user-id and password. If you have the name xyz as your user-id, youll be expected to enter this name when you see a prompt similar to this on the terminal. The login: prompt indicates that the terminal is available for someone to login. This message also indicates that the previous user has logged out .Enter the name in front of login prompt and then presses enter. Login: xyz [enter] The system now requests you to enter the pas word. The secret code that was handed to you by your administrator .This code is known to you only. It is something like personal identification. Type the secret code and them press enter key. Password will not be displayed on the screen. If you enter both the parameters correct then a msg will be displayed showing the last time you logged in. SHELL PROMPT: you will finally see a prompt string with the cursor constantly blinking beside it. The shell is a program that keeps running all the Predetermined list. Following are some common command. the time as long as you are logged in. LOGGING OUT : The technique of doing the log out also depends on the shell you use , so you should try all of them in turn. 1. Ctrl-d :this can be generated by pressing the ctrl key and the character d. The login: message confirms that the session has been terminated for and terminal is available for the next user.If you dont see the login then use the logout command. 2. Logout :This usually happens on accounts hat use % as the prompt. % logout [enter] login: if login command does not work then use exit. 3. Exit : In most cases, this is the command that terminates a session . press enter after writing this command. $ Exit [enter]

SIMPLE COMMANDS : When you key in a word the system interprets it as a command , you are in fact commanding the machine to do something. Not all commands are acknowledged only those that are present in the systems 2. passwd: this command is used to change the password. The one you used to get in press enter after entering password. Firstly it will ask you about old password then it will ask you to enter new password. 3. who: Unix is a system used by multiple users & you might be interested in knowing the people who are currently using the system. Use the who command. 4. who am i: To know who you are , use the same who command , but this time with two additional words am and I . The additional words used with who are know as arguments and most UNIX commands are used with a number of arguments. 5. echo: The string which you will type in front of echo is printed is on the screen. 6. echo & Shell: The echo command when used with the & shell argument displays the name of your shell. Uses enter after writing the command. 7.date:-clock ticking. You can display the current date with the date command, which DATE:- the unix system maintains an internal clock meant to run perpetually. When the system is shut down, a battery back up keeps the shows the date & time to the nearest second. 8.cal:- cal ids handy tool that you can include anytime to see the calendar of any specific month or a complete you have to provide first 3 character as an argument. 9. Bc:- THE CALCULATOR :- UNIX provides two types of calculator one of them is character based bc command. When you invoke bc without arguments, the curser keeps on blinking nothing seem to happen. To quit bc , you have to use [cntrl-d]. You can also ask bc to perform calculations together. 10.MKDIR:- creating a directory:- UNIX organize all its file in separate folders called directories. You can create a directory with a command named mkdir. 11.Is :-listening files and directories:- the ls command 12. pwd: This command will print the current directory. 13. cd: This command is used to change your current directory and place you in another directory. 14. wc: it will count the lines, words & characters for a particular file. 15. ls l : apart from its contents, every file has some attributes associated with it. These attributes are not stored in the file but in a different area of the hard disk. You need to know more about these attributes. The same ls command does this job for us except that it has to be used with l option.

16. rmdir: this command is used to remove or delete the directions. They can also delete more than one directory in one directory in one shot. 17. cp: the cp command copies a file or a group of files. It create an exact image of the file on the disk with a different name. the first is copied to the second. 18. rm:-The rm command deletes files and makes space available a disk. It can delete more than one file with a single shot. 19. mv:-RENAMING FILES:-This Command renames files and directories. It doesnt create a copy of the file but merely renames it. This means no additional space is consumed. 20. cat:-DISPLAYING A FILE:- It is one of the most well know commands of the UNIX system. It is mainly used to display the contents of a small file on the terminal. 21. cat>:- USED TO CREATE A FILE:- Cat is also useful for creating a file. Enter the commands Cat, follow it with>and the filename of the file which you want to create after pressing enter then write the contents of file. At last for termination press [cntrl-d]. 22. chmod:- CHANGING FILE PERMISSION:- This is used to change the access rights of a file for user, owner of group.

PRACTICAL NO: 2 AIM: - Familiarize with vi editor THEORY: - If you want to make changes in your existing file or if you want to create a large file, you must learn to use an editor, and UNIX provides two very versatile ones VI and emacs. VI EDITOR: - It is a full screen editor now available with all UNIX systems, and is widely acknowledged as one of the most powerful editors available in any environment. It was created by a graduate student Bill Joy later to become the co-founder of Sun Microsystems. VI offers cryptic and sometimes mnemonic, internal commands for editing work. The most well VI editor is Vim (VI improved). VI PRELIMINARIES: - A VI session begins by invoking the command VI with a filename. You are presented a full empty screen, each line beginning with a ~ (tilde). This is VIs way of indicating that they are non existent lines. For text editing, VI uses 24 of the 25 lines that are normally available in a terminal. The last line is reserved for some commands that you will enter to act on the text. THE THREE MODES: - 1. When you open a file with VI, the cursor is positioned at the top lefth hand corner of the screen. You are said to be in command mode. This is the mode where you pass commands to act on text. You cant use the command mode to enter or replace text. 1. Input mode: - to enter text, you have to leave the command mode and enter the I/P mode. There are 10 Keys which take you to this mode when pressed and whatever you then enter shows up on screen. To leave this mode, you have to press the [ESC] key. 2. Last line mode or er mode: - You have to save your work, leave vi or switch to editing another file. Sometimes, youll need to make a global substitution in the file. Neither of the 2 modes will do this, you have to use last line mode, where you enter the instruction in the last line of the screen. SAVING AND QUITING: - The last line mode offers two was of saving and quiting 1: x 2: wq The commands return you to the shell after saving your work.

ABORTING EDITING:- It is also possible to abort the editing process and quit the editing mode without saving the buffer. The q command takes you out of the editor:$q [enter] or $q! [enter] ! overrides many safety settings. # Inserting and Replacing Text:- Before you are able to enters text, you have to change from the default command mode to input mode. There are several methods of entering this mode, depending on the type of input you wish to key in, but in every case the mode is terminated by pressing the [esc] key. Some of the input mode command in vi are: Command Function

1. I insert text to left of curser 2. I insert text at beginning of line 3. a append text to right of curser 4. A append text at end of line 5. o opens line below 6. O opens line above 7. rch replaces single character under curser with ch 8. R replace text from curser to right 9. s replace single character under curser with any number of characters 10. S replace entire line

PRACTICAL NO :3

Aim :-Using Bash Shell develop simple shell programs As we know a file can be created using vi editor has 3 modes named as input, command,last line mode. Once a file is created its access rights can be changed using chmod command. Now we will see what shell variables are:SHELL VARIABLES You can define and use variables scripts, these variables are called shell variables. A shell variable is of the string type. All shell variables = value They are assigned with the =operator but evaluated by prefixing the variable name with a $.Here is an example given an LHS. CONTROL STRUCTURE We can also use looping and if, if then else, while loop, switch case, for loop and until loop etc. Now we will develop simple shell programs using Bash shell. 1) Find greatest of two numbers.

2) To calculate Fibonacci series.

3)To make a calculator.

PRACTICAL NO: 4 AIM: WAP TO AUTOMATE COMPILATION OF LARGE PROJECTS SCREENSHOTS: Init.c and Io.c

Compute.h

Myprogram.h Simple Makefile

PRACTICAL NO: 5 AIM: WAP TO AUTOMATE COMPILATION USING SMARTER MAKEFILE SCREENSHOTS: SMARTER MAKEFILE

10

PRACTICAL NO: 6 AIM: WAP TO AUTOMATE COMPILATION USING GENERIC MAKEFILE SCREENSHOTS: GENERIC MAKEFILE

11

PRACTICAL NO: 7 AIM: WAP TO CALCULATIONS AUTOMATE COMPILATION USING DEPENDENCY

SCREENSHOTS: DEPENDENCY MAKEFILE

12

PRACTICAL NO: 8 AIM: WAP TO AUTOMATE COMPILATION OF STATIC LIBRARY SCREENSHOTS: Make file of static library

13

PRACTICAL NO: 9 AIM: WAP TO STUDY VARIOUS COMMANDS RELATED TO PROCESS SCREENSHOTS: A simple program using fork command

A simple program using fork and sleep command

A simple program printing the id of process using various commands

14

15

PRACTICAL NO: 10 AIM: FAMILIARIZE WITH VARIOUS FILTERS IN UNIX /LINUX 1.grep 2.sort 3.head 4.tail 5. cut

16

Practical no.-11
Aim: To install The Linux Operating System and to set it with some previously installed Operating System.
The development of Linux is one of the most prominent examples of free and open source software collaboration; typically all the underlying source code can be used, freely modified, and redistributed, both commercially and non-commercially, by anyone under licenses such as theGNU General Public Licence. Typically Linux is packaged in a format known as a Linux Distribution for desktop and server use. Some popular mainstream Linux distributions include Debian(and its derivatives such as Ubuntu), Fedora and openSUSE. Linux distributions include the Linux kernel and supporting utilities and libraries to fulfill the distribution's intended use. Fedora is an RPM-based, general purpose collection of software, including an operating system based on the Linux kernel, developed by the community-supported Fedora Project and sponsored by Red Hat. To install fedora 14 and make it dual boot with windows XP i) Delete a partition on the hard disk and make it free or unallocated ii) Install Fedora 14 by following the steps shown below(next page) and reboot, window XP will boot automatically.
iii) Install Grub4dos-0.4.4 in C: drive of XP. iv) From the folder C:\Grub4dos-0.4.4 copy the file grldr and paste it in C:

v) Open the boot.ini file in C:


vi) Add the lines c:\grldr="Grub4dos" at the end of the boot.ini file and save the file

vii) Reboot the system and will get a prompt at system startup with Microsoft Windows XP Professional Grub4dos viii) Choose Grub4dos and Grub will automatically boot the Fedora 14.

17

Steps to install fedora 14 from a CDs/DVD 1) Go to the BIOS menu of the system and give the CD\DVD Rom boot priority over everything else. 2) Insert the bootable DVD or set of CDs and the system will boot from the CD\DVD an start the installation process.
3) The Boot Menu

Figure 1 The boot media displays a graphical boot menu with several options. If no key is hit within 60 seconds,the default boot option runs. Use Enter and arrow keys on keyboard to select different options and Tab key to customize a boot option. The boot menu options are: a) Install a new system or upgrade an existing system This option is the default. Choose this option to install Fedora onto your computer system using the graphical installation program. b) Install system with basic video driver This option allows you to install Fedora in graphical mode even if the installation program is unable to load the correct driver for your video card. c) Rescue installed system Choose this option to repair a problem with your installed Fedora system that prevents you from booting normally. The rescue 18

environment contains utility programs that allow you fix a wide variety of these problems. d) Boot from local drive This option boots the system from the first installed disk. If you booted this disc accidentally, use this option to boot from the hard disk immediately without starting the installer. e) Memory Test This option runs an exhaustive test on the memory on your system. 4) Installation Method

Figure 2

If you booted the installation from minimal boot media or with the askmethod boot option, use the arrow keys on your keyboard to select an installation method (refer to Figure 2). With your selected method highlighted, press the Tab key to move to the OK button and press the Enter key to confirm your choice.

5) Welcome To Fedora

19

Figure 3 The Welcome screen does not prompt you for any input. Click on the Next button to continue.

6) Language Selection

20

Figure 4

Using the mouse, select a language to use for the installation (refer to Figure 4). The language you select here will become the default language for the operating system once it is installed. Once you select the appropriate language, click Next to continue.

7) Keyboard Configuration

21

Figure 5 Using the mouse, select the correct layout type (for example, U.S. English) for the keyboard you would prefer to use for the installation and as the system default (refer to the Figure 5). Once you have made your selection, click Next to continue.

8) Storage Devices

22

Figure 6

You install Fedora on a large variety of storage devices. This screen allows you to select either basic or specialized storage devices.
a) Basic Storage Devices Select Basic Storage Devices to install Fedora on the

following storage devices: Hard drives or solid-state drives connected directly to the local system.
b) Specialized Storage Devices Select Specialized Storage Devices to install

Fedora on the following storage devices: Storage area networks (SANs) Direct access storage devices (DASDs) Firmware RAID devices

23

Multipath devices

Select Basic Storage Devices and click Next to continue.

9) Assign Storage Devices

Figure 7

The screen is split into two panes. The left pane contains a list of devices to be used for data storage only. The right pane contains a list of devices that are to be available for installation of the operating system. When you have finished identifying devices to be used for installation, click Next to continue.

10) Setting The Hostname 24

Figure 8 Give an appropriate hostname which will identify your computer on a network and click Next to continue.

11) Time Zone Configuration

25

Figure 9

Set time zone by selecting the city closest to your computer's physical location. Click on the map to zoom in to a particular geographical region of the world. Click Next to proceed.

12) Set The Root Password

Figure 10 Setting a root account and password is one of the most important steps during your installation. The root account is used to install packages, upgrade RPMs, and perform most system maintenance. Logging in as root gives you complete control over your system. Use the root account only for system administration. Create a non-root account for your generaluse and use the su command to change to root only when you need to perform tasks that require superuser authorization. These basic rules minimize the changes of a typo or an incorrect command doing damage to your system. Click Next to continue.

26

13)

Disk Partitioning Setup

Figure 11

Partitioning you to divide your hard drive into isolated sections, where each section behaves as its own hard drive. Partitioning is particularly useful if you run multiple operating systems. Your Options are: Use all Space -Select this option to remove all partitions on your hard drives (this includes partitions created by other operating systems such as Windows VFAT or NTFS partitions). b) Replace Existing Linux System(s) - Select this option to remove only partitions created by a previous Linux installation. This does not remove other partitions you may have on your hard drives (such as VFAT or FAT32 partitions). c) Shrink Current System - Select this option to resize your current data and partitions manually and install a default Fedora layout in the space that is freed. d) Use Free Space - Select this option to retain your current data and partitions and install Fedora in the unused space available on the storage drives. Ensure that there is sufficient space available on the storage drives before you select this option. e) Create Custom Layout -Select this option to partition storage devices manually and create customized layouts. Select Create Custom Layout and click Next to continue.
a)

27

14)

Creating Custom Layout or Modifying The Default Layout

Figure 12 The partitioning screen contains two panes. The top pane contains a graphical representation of the hard drive, logical volume, or RAID device selected in the lower pane. The lower pane contains a list of all drives, logical volumes, and RAID devices to be used during installation, as specified earlier in the installation process Beneath the lower pane are four buttons: Create, Edit, Delete, and Reset. Create - create a new partition, logical volume, or software RAID. Edit - change an existing new partition, logical volume, or software RAID. Delete - remove a partition, logical volume, or software RAID. Reset - undo all changes made in this screen. Highlight the free space you created earlier for fedora and click the Create button. a) The create storage window will open (Figure 13). Select Standard Partition and click Create button. b) The add partition window will open(Figure 14) i) Mount Point : / ii) File System Type : ext4 iii) Size(MB) : enter all available space iv) Additional Size Options : Fixed

28

Click OK button.

Figure 13

Figure 14 Click Next when ready or click back to recreate partitions in the Creating Custom Layout window (Figure 12). 15) Write Changes to Disk

29

Figure 15 The installer prompts you to confirm the partitioning options that you selected. Click Write changes to disk to allow the installer to partition your hard drive and install Fedora. 16) Boot Loader Configuration

Figure 16 The above screen (Figure 16) is vital to ensure correct location for Grub. a) Check Install boot loader on /dev/sda and click on change device button, the boot loader device window(Figure 17) will open.

30

Figure 17 b) Select First Partition of boot partition and click ok c) In boot loader configuration window(Figure 16) under boot loader operating system list Fedora should be ticked and delete all other entries. d) Click Next.

17)

Package Group Selection

Figure 18 The Package Installation Defaults screen appears and details the default package set for your Fedora installation. This screen varies depending on the version of Fedora you are installing. Select The packages according to your choice and then click on Next. 31

18)

Installation Starting

Figure 19 The Installation process starts and takes about 30-40 minutes depending on the system. 19) Installing

32

Figure 20 20) All Done

Figure 21 Click on reboot to restart your system.

33

Вам также может понравиться