Linux command ppt


Published on

Linux command ppt

Published in: Education
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • “ ls ” stands for list. Ls –l gives the discription about which is directory and which is file. Directory is indicated by letter d and file is indicated by hypan(-). Pwd stands for present working directory $ pwd $ cd dir-name $ cd dir1 dir2 $ find storing directory parameter action(it searches a file or dir) Storing directory- where tobe search Parameter –on what criteria tobe search Action- what action tobe performed $ grep word file name(it searches word in a given file) “ su ” means switch user. When you have several user account on one machine.
  • Linux command ppt

    1. 1. Linux Operating System CA 102/CS 104 Kalyani Neve.
    2. 2. A Brief History of Linux1991 August• Linux is introduced by Linus Torvalds, a student university of “Helsinki” in Finland.• While the linux you know today was developed with assistance of programmer.• Linus Torvalds still remain control of the evolving core of Linux O.S. :The Kernel. Linus Benedict Torvalds
    3. 3. A Brief History of Linux1992,March• In March 1992 Version 1.0 of Kernel came into market ,the first official release of Linux.• At this point Linux RAM most of the common Unix tool from compiler to networking software to “X-Windows”. Linus Benedict Torvalds
    4. 4. A Brief History of Linux1991 September Version 0.01 of Torvalds project is made available via Ari Lemmke, the systems administrator, gives the directory the name Linux. Linus had originally intended to call the new kernel "Freax". According to Wikipedia, the name Linux was actually invented by Ari Lemmke who maintained the FTP server from which the kernel was originally distributed. Ari Lemmke
    5. 5. A Brief History of LinuxOctober 1991 Richard Stallman expresses interest in having the Free Software Foundation distribute a GNU system with the Linux kernel.December 1991 Robert Blum posts the first Linux FAQJanuary 1992 Minix creator Andrew Tannenbaum claims "Linux is obsolete" in a posting to comp.os.minix and starts a public discussion on the merits of Linux in which Linus Torvalds participates.
    6. 6. A Brief History of Linux• First Linux "distribution", called MCC Interim Linux is released by the University of Manchester, England. (February 1992)• Version 0.95 of the Linux kernel released. First version to be able to support X-Window. (March 1992)• A Linux distribution called Softlanding Linux System (SLS) is released. (September 1992)• Software und System Entwicklung GmbH (SuSE) founded in Nuremberg, Germany. Distributes a German version of SLS with corresponding manuals. (November 1992)
    7. 7. A Brief History of Linux1993:• Version 1.0 of Slackware released by Patrick Volkerding. It is based on the SLS distribution.• Ian Murdock creates the Debian distribution.1994:• Linux kernel version 1.0 released.• First issue of Linux Journal published Marc Ewing• Linux distributor Caldera founded by Ray Noorda of Novell & Ransom Love. Marc Ewing• Marc Ewing releases the first version of Red Hat Linux.
    8. 8. A Brief History of Linux1995:• Bob Young partners with Marc Ewing and forms Red Hat Software.• Apache web server project started as a series of patches to the NCSA HTTPd server (A Patchy server).1996:• Linux kernel version 2.0 released.
    9. 9. A Brief History of Linux• Linus Torvalds suggests that a "slightly overweight penguin" would be the best mascot for Linux. He recommends Larry Ewings "Tux" penguin images. A Tuxedo Tux
    10. 10. A Brief History of Linux• The following filed a suit against William R. Della Croce, Jr. (September 1996) – Linus Torvalds – Linux Journal, – Yggdrasil Computing, Inc., – Linux International – Work Group Solutions (Digital Equipment Corporation & Red Hat Software contributed to the cost of the legal process) to re-assign the Linux trademark to Linus Torvalds. The firm of Davis & Schroeder handled the case on an almost pro-bono basis. (Freeor reduced charge for public good)• Kool Desktop Environment (KDE) project announced.
    11. 11. A Brief History of Linux1997:• The Linux trademark dispute between William Della Croce and Linus Torvalds is settled, with Della Croce re-assigning the trademark to Torvalds.• Miguel de Icaza starts the GNOME project.1998:• Version 1.0 of the K Desktop Environment (KDE) released.
    12. 12. A Brief History of Linux1999:• Linux kernel version 2.2 released.• GNOME 1.0 desktop released.2000:• Microsoft CEO Steve Ballmer calls Linux "a cancer that attaches itself in an intellectual property sense to everything it touches." in an interview with the Chicago Sun-Times.
    13. 13. A Brief History of Linux2001:• Linux kernel version 2.4 released.2003:• Linux kernel version 2.6 is released.• Novell acquires German Linux distributor SuSE.• Red Hat announces that they will no longer sell boxed sets of their Linux distribution for retail customers. Instead, they will distribute Linux to end users via a development distribution called Fedora Core.
    14. 14.  Multi-user: • Each user’s shells, applications and commands are separate processes • Number of simultaneous users limited only by: – CPU speed and available memory – Min. response times required by users/apps Multi-tasking: • Many jobs can be under way at the same time • Jobs truly simultaneous on multi-cpu  Time-sharing: • A single cpu is shared by all processes • Processes exec briefly, passing cpu to others • Process switches occur in miliseconds or less • Kernel gives process a sense of total control
    15. 15. Applications of LinuxAS the Linux is the OS, it provides lot ofapplications. Some of them given below:1)Text And Word Processing Applications Star Office is Text and word applicationinstead of WordPad and notepad.2) Programming Language There is a wide verity of Programming andscripting languages and tools available for Linux.3)X-windows X-windows is a highly flexible andconfigurable GUI environment that run on Linux aswell as almost UNIX System.
    16. 16. Applications of Linux4) Internet tool It supports Netscape as well as Mosaic It provides wide and full range of software neededto create internet server. It also provide the complete network support toconnect the internet.5) Data bases Today Oracle, Sybase and Informix all offerrelational data base provides for Linux.6) Dos and Windows Capability Software Linux can be made to run DOS software with highdegree of stability and compatibility.
    17. 17. Acquiring and using Linux There are quite a few ways to obtain a Linux distribution.1. One way is to go to the distributors website and download the linux distribution of our choice. For example, If you want to download a. Mandrake, the go to b. SUSE Linux Enterprise Server 9, go to
    18. 18. Acquiring and using Linux2. Other way is to obtain pre-burned copies of the Linux distribution we need from the distributor’s website or from sites like – The price is of such distributions starts from less than Rs. 100/- – Some new computers have Linux as preinstalled
    19. 19. Examining Linux Distributions• A Linux distribution is a collection of software that incorporates a version of the Linux kernel, versions of the assorted GNU tools, and various other bits and pieces like XFree86, the Open Source version of the X-windows system.• Many vendors of distributions offer this collection as a basic version, and charge (extra) money for versions that incorporate or include various non-free programs.
    20. 20. Survey of Major Distributions• The major distributions of Linux include: – Caldera – Debian – Mandrake – Red Hat – Slackware – SuSE – Turbolinux
    21. 21. Linux distributions. Website/LogoRed Hat Linux: SuSE Linux: Mandrake Linux: Caldera Linux: Debian GNU/Linux: Slackware Linux:
    22. 22. X-WINDOWS• X-Windows is GUI for UNIX Which sets up the graphics display• X-Windows is a highly configurable environment that (resolution , refresh rate, color depth),displays the windows and provides a broad range of flexibletrack mouse movements , key operation for both strokes the user and application developers.• On X-Windows system two application must run to provide the complete GUI 1) X-serverIt provides menu, windows border, 2) window managermechanism for moving ,switching,minimizing or maximizing windows.
    23. 23. Components of the X Window System• X server• X client• Window manager• Graphical libraries• Graphical application – Provides a comprehensive user interface
    24. 24. Components of theX Window System (continued)
    25. 25. Starting X• $ startx – Standard command to start X window system H.W Similarities and differences between X-windows and Microsoft windows
    26. 26. Desktop Interfaces• Graphical environment – Provides collection of functions and utilities – Makes using computer easier for those who do not have many commands memorized• KDE interface – Most widely used desktop environment on Linux systems – Installed by default for most distributions, except Red Hat
    27. 27. Desktop Interfaces (continued)• KDE interface includes suite of applications – Internet access – System maintenance – Personal productivity – Other basic tasks• Panel – Set of icons at bottom of screen
    28. 28. Desktop Interfaces (continued)• GNOME desktop – Stands for GNU object model environment – Very similar to KDE – Includes panel with integrated taskbar – Applications included similar to those with KDE – Installed by default for Red Hat
    29. 29. Working with Graphical Windows (continued)
    30. 30. Configuring GNOME and KDE• GNOME and KDE – Both highly configurable
    31. 31. Questions !!!
    32. 32. Unit -2System AccessLogging In and using the Linux systemLinux CommandsLogging In and using Remote Linuxsystem
    33. 33. 2.1 Logging in and Using Linux System Because the system can be used by many users some has to be given charge of administration of the systemcalled ‘system administrator’ who will grant you the authorityto use the system .login: kumarPassword:*******This will start up a desktop. The default desktop in RedHat Linux 9 isGNOME desktop. If you want to turn off your computer, you must first shut downLinux. You can shut down your system in three ways:1)By using halt command. Main Menu2)By using shutdown command. Logout menu
    34. 34. #haltThis command will log you out and shut downthe system.•$ halt# shutdownshutdown 16:00 shut down at 16:00shutdown -r now shutdown immediately and rebootshutdown -h now shutdown immediately and halt Linux also allow alt+ctrl+del
    35. 35. Saving Your Configuration Between Logins• On logout – GNOME can note which application windows were open – Same applications are opened automatically at next login• Can also save configuration between logins
    36. 36. Configuring the Graphical Login Screen• Before you are permitted to configure most parts of graphical login screen – Must be logged in as root or enter root password• Select system settings, then Login Screen on GNOME main menu – Or runrun gdmsetup command• Configure login options
    37. 37. Basic CommandsHow to run commands• Finder => Application => Utilitaires => Terminal• When you log on Unix machine, you will see,[someone]$• One command consists of three parts, i.e. command name, options, arguments.Example)[someone~]$ command-name optionA optionB argument1 argument2
    38. 38. Basic CommandsHow to run commands• Between command name, options and arguments, space is necessary.• Options always start with “-”• Example: cd .. ls –l .bashrc mv fileA fileB
    39. 39. Some more Linux commands Everything in the square bracket isName Syntax optional• Cal • Cal [ [ month ] year ] • E.g. $ cal Current date Current date Wed augcal 3 1985 • $ 31 Wed aug31 16:22:40 IST 16:22:40 IST 2005 2005 Month no Month no• Date • $ date 08 08 Month name Month name Month no with • $ date +%m Aug name with Month no Aug name • $ date +%h 08 Aug 08 Aug • $ date +”%m %h”
    40. 40. To display the a: bell To display the message on the backspace message onb:the• $ echo • $ printf screen c:current line screen• Syntax: echo Linux n :•new line printf Linux Syntax: t tab $ echo [-ne] [string] -e: enables the interpretation of back slash special character in string. -n: disable o/p of trailing new line Who: The o/p of this command is linux gives us a details of the user who have logged the linux system currently e.g. $ who o/p: student tty10 july 30 7:14 Terminal name
    41. 41. clear : Clears the terminal screen and resets the prompt and cursorlocation to the first line of the screen.$ clear.Free: Displays a report of free and used memory.Free [-b|-k|-m][-s delay][-t]-b: Displays amount of memory in bytes.-k: Displays amount of memory in kilobytes(this is default).[$ free]-m: Displays amount of memory in megabytes.-s delay : Displays continue reports separated by specified delaying seconds[^zto escape it]-t: Displays an extra line containing totals.
    42. 42. kill: You can terminate process with kill command. The command usesone or more PID’s as its argument.$ kill 122 129 115sleep: This command will suspend the execution of shell.The maximum limit of sleep is 18000 second.Unfortunately keep the terminal idle.$ sleep [seconds]ps: This command will displayed the process status .submmission time,required CPU time, Process name.$ ps [option]-a: Print all terminal process.-e: Print all current process.-t: Print all processes of listed terminal.-u: Displays processes of listed user.
    43. 43. Basic Commands1.Jumping directly to the line. Commands2. Jumping directly beginning and ending ofthe file.3. Move backward through the file. • ls show files in current position4. Search backward through the file. • pwd show current position • cd change directory • less, more display file contents • man xman display online manual(help pages) • find ,grep For searching for a file.GREP.docx • su switch user • cat For i/p and o/p on the screen • wc count word char and no.of line in a given file Basic command1 Basic Command2
    44. 44. Basic CommandsCommands This command we will see in next unit.• passwd change password• useradd create new user account• userdel delete user account• mount mount file system• umount unmount file system• df show disk space usage• cp copy file or directory• mv move file or directory• rm remove file or directory• mkdir create directory• rmdir remove directory
    45. 45. Relative & Absolute Path• Path means a position in the directory tree.• To express a path, you can use relative path or absolute path.• In relative path expression, the path is not defined uniquely, depends on your current path.• In absolute path expression, the path is defined uniquely, does not depend on your current path.
    46. 46. Relative & Absolute Path• Relative Path Ablsoute Path pwd cd cd . mkdir mydir pwd pwd cd .. pwd cd /Users/invite cd .. pwd pwd cd /Users cd pwd cd / pwd cd /Users/invite cd ~/mydir
    47. 47. User Accounts Creating additional user accounts This creates the Useradd- $ useradd user1 user with all default setting1) Creating a entry of user in /etc/passwd file with password2) Assigning a user ID to user .it is greater than all other user ID.3) Adding user to appropriate group.4) Creating a home directory for the user.$ useradd –u 500 user1 $ useradd –g group-name user1 1) If you want to use particular user ID. 2) If you want to assign a particular group to user. 3) If you want to specify an alternative home directory for a user. $ useradd –d directory-name user1
    48. 48. usermod: Modifying the user usermod is used for , modifying some of the parameters set with useradd. e.g. usermod –s /bin/bash oracle*We can combine all the option in this way. The useradd command adds new user to the system. $ useradd –u 210 –g dba –d /home/oracle –s /bin/ksh oracle
    49. 49. Managing user accountsChange Password o/p: old passwd:$ passwd New passwd: New passwd: Deletes the Removing user user Deletes the user $ userdel user1 and its file $ userdel –r user1
    50. 50. Creating GroupCreating Group$ groupadd [option] group-name1) -F : If the group is already available then it should displayresult.2) –g : Group ID is suppiled by this action.3) –o : giving ID which is not unique.4) –r : Add to system account..Deleting Group$ groupdel group-name
    51. 51. Adding user to Group • There is no standard program available to add the user to a group • In order to do this we can directly edit the file /etc/group. Group-name :: password : group-id : user-listName of Encrypted password to Unique Group ID in CommaGroup the group numeric form seperated user list who want to add this group
    52. 52. Modifying Group If you want to change a group name youcan use the groupmod command.e.g change the group’s name from test1 totest2 # groupmod –n test2 test1
    53. 53. Managing Users: For the creation and maintenanace of user accounts, Linux provides 3 commands :useradd,usermod,userdel useradd : Adding user The useradd command adds new user to the system. $ useradd –u 210 –g dba –d /home/oracle –s /bin/ksh oraclejhThis quietly creates the user oracle with a UID of 210 and name dba.Thehome directory is /home/oracle, and user will use the Korn shell. The –option ensures that the home directory is created if it doesnt already existand copies a sample .profile and .kshrc to the user’s home directory.
    54. 54. • usermod: Modifying the user usermod is used for , modifying some of the parameters of already existing users. e.g. usermod –s /bin/bash oracle• userdel : Removing user Users are removed from the system with userdel. userdel oracle
    55. 55. Unit -3 Introduction to File System And Linux PermissionManaging File.Managing Directory.Understanding permission.Evaluating System Security.
    56. 56. File contains 3 types of information User data System data Executable fileFile Name1)File name is upto 256 character.2)This character can be a lower case ,upper case,numbersand other character like hypen(-), under scroll(_) andperiod(.)3)Don’t include Meta character because they have specialmeaning(*,?,&,/ etc)
    57. 57. Standard directory structure◮ / - the topmost◮ /dev - all the devices are accessible as files◮ /var - “variable” data such as mails, log files,databases◮ /usr - almost all the packages installed◮ /etc - configuration files◮ /home - home directories for all the users◮ /root - home directory of the privileged user root◮ /mnt - used to mount other directories/partitions
    58. 58. File Navigation1) Navigating using GUI2) Navigating using terminalNavigating using GUI Main menu Home folder Nautilus file managerYou can give any address to this locationbar and nautilus will displayed the contents atthat locationIn this way you can navigate up to rootdirectory
    59. 59. Navigate using terminal • Open terminal • Type the command1) pwd: It gives present working directory $ pwd2) ls: It displays the list of file and directory $ ls [option]3) cd: Change directory $ cd dir-name4) For searching file.Locate command Find command$ locate file-name $ find start-dir parameter action
    60. 60. Managing File system• Creating a file• Deleting a File• Copy a File• Move a file• Archiving a File• File Compression Creation of a File: cat is used for creation of file. Enter command cat followed by the > character and file name. $ cat $ cat > fileName1 $ cat fileName1 $ cat >> fileName1 $ cat > fileName2 $ cat fileName1 fileName2 $ cat fileName1 fileName2 > fileName3
    61. 61. Copying A File :• The cp command copies a file or a group of files.• It creates an exact image of a files on disk with different name.• The syntax requires at least 2 files names to be specified in the command line.• When both are ordinary files the first is copied to other.• If the destination file (unit1) doesn’t exist it will first be crated before copying takes place.• If already exist it will simply overwritten without any warning from the system.e.g $ cp file1 file2 $ cp file1 /temp Copy multiple file $ cp file1 /temp/file2 Copies all directories and sub $ cp file1 file2 file3 /tem/file4 directories. $ cp *.txt *.doc *.bak /tem/file
    62. 62.  Deleting file: The rm command deletes one or more files.$ rm file1$ rm file1 file2 file3$ rm *.txt
    63. 63. . Renaming Files: The mv command renames (moves) file .It has 2 distinct functions. 1) It renames a file (or dir). 2) It moves a group of file or different directory. mv doesn’t create a copy of the file only renames it. No additional space isconsumed on disk during renaming.$ mv file1 /tmp$ mv file1 /tmp/file2$ mv *.txt , *.doc,*.bak /tmp
    64. 64. Locating the File System Using GUI Using command lineMain Menu 1) Use locate command All files wit the givenFile Option $ locate FileName extension 2) There are various option like-Specify Name of file whichyou want to search(In i) $ locate *.extensionDialogue Box) ii) $locate –i fileNameClick on file (we get locationof the file in the box)
    65. 65. Making Directory To create a new directory use the mkdir command ,the syntax is: $ mkdir DirNameDeleting Directory To delete whole directory use –r flag with rm command . e.g. $ rm –r DirName
    66. 66. File Ownership and permission In Linux each file is owned by that user who created it. The owner of the file has the right to read the file, run it, delete it. Each file and directory in Linux contains set of permission that determine who access them and how. Other user can do only those things for which the owner has given the permission. A file also belongs to a group. Each user on the system is a memberof one or more group. Date of Name of Access To see the file ownership details creation use file$ ls –l PermissionTotal 866-rw –r – 1 root root 2045 oct 23 1997 Dir-colors File Owner File Group Size of file
    67. 67.  To change owner of file$ chown user-name filename$ chown u1 f1 To change a group of file$ chgrp group-name filename$ chgrp g1 f1
    68. 68. Access permission for a file is divided into three: 1)File owner(denoted by u) 2)Members of a file group(g) 3)Others(o) Others Permission e.g. rwx rwx rwx (o)Owner user (u) Group 1) r: Indicate the read permission. permission 2) w: Indicate the write permission (g) 3) x: Indicate execute permission 4) -: Indicate that particular permission is denied.
    69. 69. To change the access permission of a file/directory.$ chmod <mode> file-name + - In this mode we can change all To permission at one time using 3 sets of grant/revok 3 binary digits. e the e.g.$ chmod 755 mydata permission This command allows the user to read write and execute while it allows the group and others to read and execute only.Symbolic Mode Absolute Mode (u):User Owner (g):for group (o): for other user
    70. 70. • Chmod u+r file-name: gives owner to read the permission• Chmod g-x file-name: takes away to execute the permission from group• Chmode o+rx-w file-name: allow others to read and execute but not to write permission
    71. 71. Unit -4 Creating And Viewing the File And Archiving the File.Using Vi editor and other editor.Examine file content,redirection.Archiving the file with tar and cpio.Zipping file .
    72. 72. There are various editors as follows:1) Vi editor2) Vim editor  Link 13) Emac editor  Link 24) Ed editor  Link 35) Joe editor6) Red editor GO
    73. 73. Vi editor It is a full screen text editor that enables you to view ,to create and edit a file several lines at a time . Most Unix system ,including Linux come with Vi. Vi works with buffer as Vi edits the file ,read a file into buffer and enables you to change the text in buffer . Before you start a full screen text editor such as Vi you must set the TERM environment use the terminal type of lookup the terminal characteristic in the etctermcap file and then control the terminal in the full screen mode. Vim editor This is a enhance version of Vi editor . It includes various enhancement over the Vi editor such as syntax highlighting, command line editing and online help . The Vim editor can be used to edit as ASCII text, it is specially useful for editing the programs. Back
    74. 74. emac editor “the edit macro ” or emac editors is the next widely used editors. It provides the larger set of commands than Vi editors. The editors is used to format source code for programming languages such as C and C++. It allows to work with multiple file at a time . Emac editor offer ispell utility to check the spelling in the document. It also offers the online help.ed editor  To use the line editor or ed to creates display , modify, save text files.  When you start ed editor with file name as an argument, a copy of a file is created in the editor buffer. You can make changes only to the copy of a file and not directly to the file.  To save the changes to the file you use w command. Back
    75. 75. Joe editor You can invoke the Joe editor by typing at the command prompt. The Joe editor is a full screen editor that lets you edit both programs and text. red editor You can use the restricted editor or red editor To edit the file in the current directory you can not execute shell commands by using the red editor. Back
    76. 76.  Archiving Files:Tar Specifies that you are creating an archive as used to create archive known as tar archive. This command isopposed to viewing an This command create new archive with new file name. existing archive Tar file has .tar extension.Copy a file into archive the file into archive so there is no danger that This process copies original file will be deleted in process.Syntax:$ tar cvf tar file-name file_list Means you are archiving in a file as opposed to temp drive f represents the file. Indicate that each command should be verbose mode. which means that each file name will be displayed as it is copied into archive.
    77. 77. e.g.1) $ tar cvf text.tar *.txt It copies all .txt file and create archive filewith the name text.tar 2) $ tar cvf vnc.tar vnc It copies all contents of vnc directory. To view the contents of archive file replace c by t. e.g. $tar tvf vnc.tar To extract contents of an archive into current directory replace c by x e.g. $ tar xvf vnc.tar
    78. 78. Other Option of the tar command•-r : To append the file to an archive . That means archive can containseveral file with same name.•-u : It also add the file to an archive but only if the file is not alreadythere or if file is there then overwrites it.•-w : It permits interactive coping and restoration. It prints the filename and prompts for the action to be taken (Y /N)
    79. 79. Create CompressionA compressed archive is a single file that containsone or more file in a compressed form.Every Linux system comes with all or some of thefollowing compression and decompression utilities.• gzip and gunzip (.gz)• bzip2 and bunzip2(.bz2)• Zip and unzip (.zip)
    80. 80. Gzip• While tar is useful for archiving the file, it doesn’t perform any compression.• It is done with the gzip command• It adds .gz extension to the end of the file.• It compressed individual file but not create archive.• It saves the memory.E.G. $ gzip text.pdfo/p: It creates the compressed file with the name text.pdf.gz $ gzip *o/p: It compressed all files in the current directory but not in sub directory. $ gzip –r *o/p: It compressed all files in the current directory and also in sub directory.
    81. 81. To uncompressed the file $ gzip –d text.pdf.gz Alternative to –d option(gunzip) $ gunzip text.pdf.gzTo view the compressed text file, no need to decompressed$ gzcat text.pdf.gz or$ gzmore text.pdf.gzCombining gzip and tar alternative$ tar cvf text.tar *.txt$ gzip text.tarIt creates single compressed archive of all .txt file with the nametext.tar.gz
    82. 82. Bzip2 and bunzip2•Its working and functionality is same as gzip and gunzip resp.•If you know gzip and gunzip then you also know the bzip2 andbunzip2.•Bzip2 is slower than gzip and creates .bz2 files.
    83. 83. Zip and unzip•Compressing and archiving together.•Zip requires first argument to be compressed file name, the renamingarguments are interpreted as files and directories are to becompressed. It compressed the t1.html and•The unusual features of this command is thatthe doesn’t overwrite an t2.txt and make it singleexisting compressed file. If it isarchive with the name be updated already exists ,file eitheror appended to the archive . It compressed all files in current directory but not in sub directory and make the singlee.g. $ zip t1.html t2.txt archive with the name It compressed all files in current $ zip * directory and also in sub $ zip –r * directory and make the single archive with the name text.zipTo Unzip the file It decompressed all files and $ unzip come all the files in the original form
    84. 84. Archiving File with cpio (copy input output)•The cpio command copies the file to and from a backupdevices.•It uses standard input to take the list of file names.•It then copies them with their contents and headers to thestandard output which can be redirected to the file and device.•This means that cpio can be used with redirection and piping•Cpio uses two key optioni)–o (output)ii)-I (input) Either of which but not the both must be there incommand line.
    85. 85. Backup files (-o)•Since cpio uses only standard input you can use ls to generatelist of file name to serve as its input.•The –o key option creates the archive on the standard output,which you need to redirect to a device file.•This is how you copy the file in the current directory to a 1.44mbfloppy.•$ ls | cpio –ov > /dev/rdsk/f0q18dt or•$ ls | cpio –o > /dev/rdsk/f0q18dt•$ find / -name “f*” –print | cpio –o > / dev/rdsk/f0q18dt
    86. 86. Restoring Files (-i)•A complete archive or selected files can be restored with the –(i) key option .•To restore the files use the redirection to take input from thedevice.•$ cpio –iv < /dev/rdsk/foq18•Cpio also accepts a quoted wild cards pattern so multiple filesfitting the pattern can be restored.•$ cpio –I “*.sh” < /dev/rdsk/f0q18
    87. 87. Displaying the archive (-it) •The –t option displays the content of the device without restoring the files. •These option must be combine with the (-i) key option •$ cpio –itv < /dev/rdsk/foq18Other Option•-r : It renames the file before starting the coping process . Thesystem presents each file name and waits for a response .If you enterthe file name coping is done with that file.•A null response leaves the file uncopied.•-f : This option followed by the expression causes cpio to select allfiles except those in the expression $ cpio –ivf “*.c” < /dev/rdsk/foq18•It restores all files except C program.
    88. 88. Dump and restore utility•You can use the dump utility to back up the file from file system•Typically it is used for back up the data not for archiving•The restore utility performs the inverse function of the dump utilitye.g.1) $ dump <back up level> [option] file system 2) $ Restore <operation> [option] files
    89. 89. What is shell?The shell is a program used to interface between you and the linux. User Linux Shell Program Linux Kernel
    90. 90. How the shell get’s started?Generally the ‘bash’ is the most popular and default shell.In X-windows you can start a shell by running terminal window (such as x-term) The most Common Shell • Sh (Bourne shell) • C shell • Ksh (Korn shell) • Bash (Bourne Again Shell)
    91. 91. Features Of Bash $ cd t<tab><enter>1)Command Line Completion2)Wild cards There are 3 types of wild cards3)Command history1)* : Matches any character and any no of character4)Aliases 2)? : Matches any single character 3)[…] : Matches any single character content within the braces. • HISTSIZE • .bash_history $ cd /user /x11/Lib/x11/FVWM/sample-config $ alias gosample=‘cd /user /x11/Lib/x11/FVWM/sample-config’ $ cd gosample $ unalias gosample
    92. 92. Redirection Symbol •Input Redirection(<) •Output Redirection(>) •Output Redirection with append mode(>>)PipelineOutput from first command in the pipeline is used as theinput to the second command in the pipelinee.g.$ cat sample.txt | grep “high” | wc -l
    93. 93. Prompts•First level ($)•Second level (>)Ps1=“Please enter the command”Ps2=“I need more information”
    94. 94. Surprise Test 1
    95. 95. UNIT VWorking in X Windows
    96. 96. X Windows (X11)• History of X – Developed at MIT in 1984 – Derived from Stanford project called W – X is now freely distributable, and available for UNIX, Windows, and Mac.
    97. 97. • The X Windows system is the standard graphical interface for UNIX – Distinguishing features: – Allows multiple virtual terminals to be opened at once – Highly Customizable and extensible – Highly Portable – Works over networks
    98. 98. X Windows Architecture• Separation of display and programs• Connected by TCP/IP• Your display is the X server• Programs that run are clients• Confusing because backwards from what we are used to.
    99. 99. • It is important to note that X is a network-oriented graphics system.• That is, X clients can run either locally (on the same system that the server is running) or remotely (on a system somewhere on a TCP/IP network).• The X server listens to both local and remote network sockets for requests from clients. This feature is obviously quite powerful. If you have a connection to a TCP/IP network, you can log in to another system over the network and run an X application there, directing it to display on your local X server.
    100. 100. • From the beginning it incorporated many of the windowing capabilities that we now take for granted.• These capabilities include network transparency, graphical capability, the use of a mouse, and the ability to link together a heterogeneous network of workstations from different vendors .
    101. 101. • One of the most significant features of X is that it was specifically designed to work across a network.• The client and the server communicate via the X Protocol, a network protocol that can run locally or across a network. Regardless of whether a client program is local or remote, it communicates with the server through the X Protocol.
    102. 102. Managing Files and File systemsTypes Of DescriptionFile SystemExt Earlier version of Linux File System ,no longer in useExt2 Older standard Linux file systemExt3 standard Linux file systemMsdos File system for MSDOSNtfs File system for Windows NT ,Windows XP ,windows 2000Iso9660 File system for mounting the CDROMFd0 Mounting the file system to the floppy drive.
    103. 103. Managing Files and File systems• Under Linux, filesystem types include the Second Extended filesystem, or ext2fs, which you probably use to store Linux files.• when you access any file system under Linux, the system presents the data as files arranged into a hierarchy of directories, along with owner and group IDs, permissions bits, and the other characteristics youre familiar with.
    104. 104. • Information on file ownership, permissions, and so forth is provided only by file system types that are meant to be used for storing Linux files.• As the system administrator, you need to know how to create file systems should you want to store Linux files on a floppy or add additional file systems to your hard drives.
    105. 105. • Mounting Filesystems: In order to access any filesystem under Linux, you must mount it on a certain directory. This makes the files on the filesystem appear as though they reside in the given directory, allowing you to access them. The mount command is used to do this and usually must be executed as root. Syntax:mount -t type device mount-point
    106. 106. • where type is the type name of the filesystem• device is the physical device where the filesystem resides (the device file in /dev)• mount-point is the directory on which to mount the filesystem.• For example, if you have a Second Extended filesystem on the partition /dev/hda2, and wish to mount it on the directory /mnt, use the command: mount -t ext2 /dev/hda2 /mnt
    107. 107. • To mount a floppy that was created on a Windows system and therefore is in DOS format, you use the command: mount -t msdos /dev/fd0 /mnt• This makes the files available on an MS-DOS format floppy under /mnt.• The inverse of mounting a file system is, naturally, unmounting it.• Unmounting a file system has two effects: it synchronizes the systems buffers with the actual contents of the file system on disk, and it makes the file system no longer available from its mount point. You are then free to mount another file system on that mount point.
    108. 108. • Unmounting is done with the umount command (note that the first "n" is missing from the word "unmount"), as in: umount /dev/fd0 to unmount the filesystem on /dev/fd0.• Similarly, to unmount whatever filesystem is currently mounted on a particular directory, use a command such as: umount /mnt
    109. 109. Creating File systems• A filesystem can be created using the mkfs command. Creating a filesystem is analogous to "formatting" a partition or floppy, allowing it to store files.• Syntax: mkfs -t type device blocks where type is the type of filesystem to create, device is the device on which to create the filesystem (such as /dev/fd0 for a floppy), blocks is the size of the filesystem,
    110. 110. • For example, to create an ext2 filesystem on a floppy, you use this command: mkfs -t ext2 /dev/fd0 1440• Here, blocks is 1440, which specifies a 1.44- MB, high-density 3.5-inch floppy. You could create an MS-DOS floppy using -t msdos instead.
    111. 111. Checking and Repairing File systems• It is sometimes necessary to check your Linux file systems for consistency and repair them if there are any errors or lost data. Such errors commonly result from a system crash or loss of power.• The program fsck is used to check file systems and correct any problems. Like mkfs, fsck is a front end for a file system-type-specific fsck.type, such as fsck.ext2 for Second Extended file systems.
    112. 112. • Syntax:• fsck -t type device• For example, to check an ext2 filesystem on /dev/hda2, you use:• fsck -t ext2 /dev/hda2
    113. 113. Customizing X EnvironmentXinit – You run X with the startx command. – This is a front end for xinit, the program responsible for starting the X server and running various X clients that you specify. – xinit (via startx) executes the shell script .xinitrc in your home directory. – This script simply contains commands that you wish to run when starting X, such as xterm, xclock, and so on. – If you dont have a .xinitrc file, the system default /usr/lib/X11/xinit/xinitrc is used instead of that.
    114. 114. Running startx with this particular .xinitrc in place gives you somethingthat looks like
    115. 115. Configuring X-Windows• Configuration of X11 is a multi-step process. – # Xorg –configure – This will generate an X11 configuration skeleton file in the /root directory called The X11 program will attempt to search the graphics hardware on the system and write a configuration file to load the proper drivers for the detected hardware on the target system.
    116. 116. • # Xorg -config – Test the existing configuration to verify that Xorg can work with the graphics hardware on the target system.• # Xorg -config -retro – this test produces a black screen which may make it difficult to diagnose whether X11 is working properly. The older behavior is still available by using the retro option.• If a black and grey grid and an X mouse cursor appear, the configuration was successful. To exit the test, switch to the virtual console used to start it by pressing Ctrl+Alt+Fn (F1 for the first virtual console) and press Ctrl+C.
    117. 117. GNOME• The GNU Network Object Model Environment also known as GNOME.• It consist of Panel, desktop, set of GUI tool• GNOME is provided a flexible platform for the development of powerful application• GNOME is strongly supported by several distribution and is the primary interface for red hat and mandrake.
    118. 118. Advantages Of GNOME• It is open source software , it is available free of cost.• GNOME supports the drag and drop feature.• GNOME documentation is extensive and you can view the document by using the GNOME help browser or any web browser such as Netscape Navigator.• GNOME support many national languages and you can add new language without making any additional changes to the s/w.
    119. 119. Choosing And Changing Window Manager And Desktop• GNOME works with any window manager.• However desktop functionality such as drag and drop capabilities and the GNOME pager only work with window manager that are GNOME compliant.• The current release of GNOME uses the sawfish window manager.• If you have several window manager installed on your system you can change from one to other using the window manager caplet.• Caplet is the term used for a control panel , a module used to configure your desktop.• select the window manager entry in main menu to start a setting menu or select its icon in the desktop.
    120. 120. Continued….•Windows opened from perform preferences in the start herewindow. A Panel is displayed listing your window managers.•To add others to the list click on Add button on the right side ofthe panel.•This open the window that prompts you to enter an identifyingname for the window managers the command that starts thewindow managers and any configuration tool it may used.•If the window manager is GNOME compliant you can click thebutton window manager Is session Managed.•Once you finished making your entries and click OK the newwindow manager appears in the list on the window managerpanel select it and click.•Try to run that window manager. To run window managerconfiguration tool, click run configuration tool button.
    121. 121. Remote X window accessWhile running X on the system the X servers run on thecomputer and controls the monitor keyboard and mouse.The server responds to command that X client sends thatopen window and draw in those window.The X client may run locally or on the remote system. Theargument is called as client server model. A server provides the source that the client request.Client communicate with server through network.X display server offered graphics display server to clientthat send X-protocol request to the server .File servers and database servers request are usuallyprocess executing on remote machine..
    122. 122. Continued…The X client may run on locally or remote system with thename of script file as a parameter first.This should work but it would be much better if we couldsimply revoke the script by typing its name giving it therespectability of the linux command.We do this by changing the file , make a file executable forall user using the mode cmd $ chmod +x first .Chmod to make a file executable use man and chmod tofind out more about octal arguments and other option