S.Y.B.Sc. I.T. Sem - III LAB - MANUAL OPERATING SYSTEM “Special thanks to Nishant Biswal, Satish Prajapati, Akash Gupta, Soham Rane and Prince Chauhan for their co - operation to compile this document.” Compiled by: Asst. Prof. Megha Sharma SYIT SEM - III OPERATING SYSTEM BY: MEGHA SHARMA 2 Practical 1 1.Installation and Configuration of virtual machine Aim: Installation of Virtual machine software and Linux OS on Virtual Machine. Procedure: Step 1: Download the Virtual machine software from the Internet. SYIT SEM - III OPERATING SYSTEM BY: MEGHA SHARMA 3 Step 2: Run VMware installation setup. SYIT SEM - III OPERATING SYSTEM BY: MEGHA SHARMA 4 Step 3: Open virtual machine software installed on your operating system. Step 4: Click on (Open a Virtual Machine) option in VMware software. SYIT SEM - III OPERATING SYSTEM BY: MEGHA SHARMA 5 Step 5: Final step is to click on install and wait for the installation process to be finish. Now our Red Hat Enterprise Linux 6 Operating system is installed. SYIT SEM - III OPERATING SYSTEM BY: MEGHA SHARMA 6 Practical 2 2. Windows (DOS) Commands 2a Date, time, prompt Date: The date command can view or change the current date of the system clock. Syntax: c: \ > date Time : The time command can view or change the current time of the system. Syntax: c: \ > date Prompt : The prompt command allows us to change the MS - DOS prompt to display information. Syntax: PROMPT[Text] Where Text specifies a new command prompt. The prompt can be made up of normal characters and the below special code. $A & Ampersand $H Backspace $B | Pipe $L < less than sign $C (Left parenthesis $N Current drive $D Current Date $P Current drive and path $E Escape code $Q = Equal sign $F ) Right Parenthesis $S space $G > Greater than sign $T Current time $V Window version number $_ Carriage returns and linefeed 2b) md, cd, rd, path, copy, xcopy md: Allows us to create directories in MS - DOS. SYIT SEM - III OPERATING SYSTEM BY: MEGHA SHARMA 7 Syntax: md [drive] path <directory name> Example: C: \ >md abc cd: CD Change directory is a command used to switch directories in MS - DOS and the windows command line. CD \ goes to the root of the drive. CD.. goes back one directory. Syntax: CD[D] [Drive:] [path] Example: C: \ Users \ Omega>cd \ C:> Example: C: \ Users \ Omega>cd.. C: \ Users> r d /rmdir : Removes an empty directory in MS - DOS. Syntax: rd [drive:] path <directory name> Example: C: \ > rd test Path: Path is used to specify the location where MS - DOS looks when using a command. Type path without parameters to display the current path. Syntax: path [drive:]path[;...] Path: used to clear all search path settings and directs windows to search only in current directory. SYIT SEM - III OPERATING SYSTEM BY: MEGHA SHARMA 8 Copy: Allows us to copy one or more files to an alternate location. Syntax: copy [/ D] [ / V] [ /N] [A|B] [+ Source [/A| B] [ destination[/A |/B]] Where: Source Specifies the file or files to be copied /A Indicates an ASCII text file. /B Indicates a binary file. /D Allows the destination file to be created decrypted. destination Specifies the directory or file name for the new file(s). /V Verifies the new files are written correctly. /N Uses short file name, if available when copying a file with a non - 8dot3 name. Example: C: \ abc \ >copy*.txt D: \ Copy all text files from the current directory to the D: \ root directory. Xcopy: xcopy is a powerful version of the copy command with additional features; has the capability of moving files, directories, and even whole drives from one location to another. Example: C: \ abc> xcopy *.* /h test In the above example xcopy commands copy all files in the current directory including any hidden files into the test directory. SYIT SEM - III OPERATING SYSTEM BY: MEGHA SHARMA 9 2c) del, cls, move, echo. d el: del command is used to delete files from the computer. Syntax: del[/P] [/F] [/S] [/Q] [/A] [[: attributes]] names Where Names: Specifies a list of one or more files or directories. Wildcard may be used to delete multiple files. If a directory is specified all files within the directory will be deleted. /P Prompts for confirmation before deleting each file. /F Force deleting a read only files. /S Delete specified files from all subdirectories. /Q Quite mode, do not ask if ok to delete on global wildcard. /A Select files to delete based on attributes. Attributes: R: Read only, S:System files, H:Hidden files SYIT SEM - III OPERATING SYSTEM BY: MEGHA SHARMA 10 Example: C: \ >del test.tmp Delete the test.tmp in the current directory if the file exists. Cls: cls command is used to clear the screen. move: Allows us to move files or directories from one folder to another or from one drive to another. Syntax: move [/Y | - Y] [drive:] [path]filename [,...] destination. Where: [drive:] [path]filename Specifies the location and name of file or files where you want to move. Destination Specifies the new location of the files. /Y: Suppresses prompting to confirm you want to overwrite an existing destination file. Example: move c: \ windows \ temp \ *.*c: \ temp Move the files of c: \ windows \ temp to the temp directory in root . In this example, *.* is wildcard telling the computer every file with every extension. SYIT SEM - III OPERATING SYSTEM BY: MEGHA SHARMA 11 echo: echo is one of the most commonly and widely used built - in commands that is typically used in scripting language and batch files to display a line of text/string on standard output or a file. Syntax: ECHO [ON |OFF] ECHO[message] Type echo without parameters to display the current echo settings. Example: C: \ >echo “hi” Hi C: \ >echo 100 100 SYIT SEM - III OPERATING SYSTEM BY: MEGHA SHARMA 12 2 d ) fc, find, rename, set, type, ver fc: FC or file compare, is used to compare two files against each other. Once completed fc returns lines that differ between the two files. If no line differs, you will receive a message indicating no difference encountered. Syntax: Fc [options] file1 file2 Where options: /A Displays only first and last lines for each set of difference. /B Performs a binary comparison. /C Disregards the case of letters. /L Compares files as ASCII text. /N Display the line numbers on an ASCII comparison /T Does not expand tabs to space /W Compresses white space for comparison. Example: D: \ >fc f1.txt f2.txt SYIT SEM - III OPERATING SYSTEM BY: MEGHA SHARMA 13 find: Allows us to search for text within a file. Syntax: find [SWITCH]” String” [ Pathname/s] Where /V Display all lines not containing the specified string. /C Display only the count of lines containing the string. /N Display line numbers with the displayed lines. /I Ignores the case of characters when searching for the string. “string” Specifies the text string to find. pathname Specifies a file or files to search. Example: D: \ >find “frame” t1.txt rename: Used to rename files and directories from the original name to a new name. Syntax: ren [drive:] [path] [filename1] [filename2] Example: C: \ >ren a.txt b.txt SYIT SEM - III OPERATING SYSTEM BY: MEGHA SHARMA 14 set: Allows you to change one variable or string to another. Syntax: [variable=[string]] Where: variable Specifies the environment variable name. string Specifies a series of characters to assign to the variable. Example: set path=c: \ windows \ command type: Allows the user to see the contents of a file. To edit the files, the user would need to use either edit or copy con. Syntax: Type[drive:] [path] filename Example: C: \ >type t1.txt ver: Displays the version of MS - DOS or if running windows 95 or above the version of windows. Syntax: ver Example: C: \ Users \ abc>ver SYIT SEM - III OPERATING SYSTEM BY: MEGHA SHARMA 15 Microsoft Windows [ Version10.0.22621.1992] SYIT SEM - III OPERATING SYSTEM BY: MEGHA SHARMA 16 Practical 3 3a ) pwd, cd, absolute and relative paths ls mkdir rmdir pwd: This command displays the current working directory. Syntax: $ pwd /home/Admin/Desktop cd: This command is used to change the directory for working. Syntax: cd [Directory] Example: Move to abc folder. $ cd /abc Move up one folder. $ cd.. Going back to home folder $cd Absolute and Relative path. An absolute path is defined as specifying the location of a file or directory from the root directory (/). In other words, we can say absolute path is a complete path from start of actual filesystem from / directory. Relative path is defined as path related to the present working directory. ls: This command is used to list the details about the files. Syntax: ls [Options] ...[Files] mkdir: To create a directory ‘mkdir’ command is used. Syntax: $ mkdir folder name rmdir: Remove directory, this command will only work if the folders are empty. Syntax: rmdir folder name SYIT SEM - III OPERATING SYSTEM BY: MEGHA SHARMA 17 3b file, touch, rm file: The file utility determines the file type. [Admin@vpm documents]$ file abc.jpeg Abc.jpeg: JPEG image data, JFIF standard 1.01. touch: touch is used to create an empty file. [Admin@vpm documents]$ touch text1.txt rm: The rm command is used to remove the file permanently from the machine. [Admin@vpm documents]$ rm text1.txt SYIT SEM - III OPERATING SYSTEM BY: MEGHA SHARMA 18 cp, mv, rename. cp: The cp is a Linux shell command to copy files and directories. Syntax: $ cp [options] source destination cp command options: cp - a archive files cp - f Force copy by removing the destination file if needed. cp - i Interactive – ask before overwriting. cp - l Link files instead of copy cp - l Follow symbolic links cp - n No file overwrites cp - r Recursive copy (including hidden files) cp - u Update - copy when source is newer than destination cp - v Verbose - print informative message Copy single file abc.c to destination directory bak: $ cp abc.c bak mv: The mv command is used to move files and directories. Syntax: mv [options] source dest Options: mv - f Force moves by overwriting destination file without prompt. mv - i Interactive prompt before overwrite. mv - u Update move when source is newer than destination. mv - v Verbose - print source and destination file. man mv Help manul Example: $mv abc.c /home/Admin/Desktop/demo SYIT SEM - III OPERATING SYSTEM BY: MEGHA SHARMA 19 rename: The rename command will rename the specified files by replacing the first occurrence of from in their name with to Syntax: rename from to file... head, tail, cat, more, less, head: This command used for output the first part of files, print the first 10 lines by default of each file. Syntax: head [options]...[file]... SYIT SEM - III OPERATING SYSTEM BY: MEGHA SHARMA 20 Example: $head /etc/passwd tail: This command outputs the last part of files, print the last 10 lines by default of each file. Syntax: tail [options]...[file]... Example: $ tail /etc/passwd cat: The cat command is used to display the content of text files and to combine several files to one file. The cat command does not accept directories. Syntax: cat file1 file2 Example: $ cat l1.txt l2.txt more: This command display output one screen at a time. Syntax : more [options] [file] options Description - c Clear screen before displaying - e Exit immediately after writing the last line of the last file in the argument list - n Specify how many lines are printed in the screen for a given file. +n Starts up the file from the given number. Example: $more - c index.php less: This command is used to display text in the terminal screen. To display the text from the specified line, enter the line number followed by colon(:). Syntax: less[options] filename Options: Option Description - c Clear screen before displaying +n Starts up the file from the given number. :p Examine the previous file in the command list line :d Remove the current file from the list of files. Example: To start printing from the third line of the file. $less +3 index.php