1 / 75

Unit 3:Exploring interfaces and filesystems

Unit 3:Exploring interfaces and filesystems. Unit objectives Outline structure of the Linux interface, and roles of the kernel, terminal and shell Enter shell commands, find documentation, use metacharacters, shut down system Learn directory structure, file types, and use wildcards

hua
Télécharger la présentation

Unit 3:Exploring interfaces and filesystems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Unit 3:Exploring interfaces and filesystems Unit objectives • Outline structure of the Linux interface, and roles of the kernel, terminal and shell • Enter shell commands, find documentation, use metacharacters, shut down system • Learn directory structure, file types, and use wildcards • Display contents of text and binary files • Search text files by using grep, identify common text editors, and use the vi editor

  2. Topic A: Linux interfaces

  3. Shells, terminals, and the kernel • Kernel • The core component of the OS • An actual file on the HD • Need an interface to interact with kernel • Terminal • Screen that allows you to log in • Shell • Runs within the terminal • Interface that accepts commands and passes them to the kernel • BASH Shell (Bourne Again Shell): the default shell

  4. Shells, terminals, and the kernel, continued

  5. Shells, terminals, and the kernel • One kernel • Multiple shells and terminal sessions can be going at once • Terminals can be run locally or remote across network • Text only commands • Can run the system • Graphical mode • User friendly

  6. Shell Prompts and Guis • Shell Prompts • As root • {root@localhost root}# • As a regular user • {root@localhost user1}$ • GUI • Loaded based on installation and preferences

  7. GNOME

  8. KDE

  9. Topic B: Basic shell commands

  10. Basic Shell Commands • Commands • Indicate name of the program to execute • Options • Letters starting with a dash “-” that alter way the command works • Arguments • Specify the parameters the command works upon

  11. Some common Linux commands

  12. Command Examples Last login: Tue Feb 13 22:43:26 2007 from 192.168.1.4 [epapates@localhost ~]$ finger Login Name Tty Idle Login Time Office Office Phone epapates Elias Papatestas pts/1 21 Feb 13 20:39 (192.168.1.3) epapates Elias Papatestas pts/2 1 Feb 13 22:46 (:0.0) epapates Elias Papatestas pts/3 Feb 13 22:48 (192.168.1.4) [epapates@localhost ~]$ who epapates pts/1 2007-02-13 20:39 (192.168.1.3) epapates pts/2 2007-02-13 22:46 (:0.0) epapates pts/3 2007-02-13 22:48 (192.168.1.4)

  13. Command Examples [epapates@localhost ~]$ w 22:48:34 up 2:53, 3 users, load average: 0.64, 0.42, 0.44 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT epapates pts/1 192.168.1.3 20:39 21:41 1:01 1.08s sshd: epapates epapates pts/2 :0.0 22:46 1:22 1.07s 5.30s gnome-terminal epapates pts/3 192.168.1.4 22:48 1.00s 0.98s 0.31s w [epapates@localhost ~]$ whoami epapates [epapates@localhost ~]$ id uid=500(epapates) gid=500(epapates) groups=500(epapates) context=user_u:system_r:unconfined_t [epapates@localhost ~]$

  14. Shell metacharacters • Key combinations that have special meaning in the Linux OS • $ character • Tells shell that following text refers to a variable • Variable • Information stored in memory • Many pre-defined

  15. Using variables [epapates@localhost ~]$ echo Hi There! Hi There! [epapates@localhost ~]$ echo My shell is $SHELL My shell is /bin/bash [epapates@localhost ~]$

  16. Common BASH shell metacharacters

  17. Using Metacharacters • If you need to use a metacharacter, place it in quotes • Echo I need ‘$’2.00 • [epapates@localhost ~]$ echo I need $2.00 • I need .00 • [epapates@localhost ~]$ echo I need '$'2.00 • I need $2.00 • [epapates@localhost ~]$

  18. Activity B-1 • Page 3-8, 3-9 • Examples of basic commands • Examples of metacharacters

  19. Getting command help • Manual pages • Commonly referred to as man pages • Documents the command’s function and the syntax it accepts • Usage • man whoami • Multiple levels • Depending on what type of command

  20. Manual page section numbers

  21. Getting command help • Multiple Names • Lowest page appears • Searching Man pages • Man –k command/apropos command • man –k who • apropos who

  22. Getting command help • Info pages • Less “techie” • Usage • info who • Help command • Used for commands that may not have info or man pages • Usage • help echo

  23. System Shutdown • System writes data from memory to HD • If shutdown happens while system is writing, it can corrupt data • Use shutdown commands to shut down gracefully • Tell everyone to please log off • Can cancel with CTRL-c or shutdown -c • Usage • -h halt • -r reboot • 15 time

  24. Topic C: Files and directories

  25. The Linux directory structure

  26. The Linux directory structure • Start at root directory • Directory structure doesn’t usually show partition mount points • Directory • Special file used to organize other files into a logical structure • Absolute pathname • Full pathname to a certain file or directory starting from the root directory

  27. Paths • Route to location of file or directory • Absolute pathname • Full pathname to a certain file or directory starting from the root directory

  28. Mounting Filesystems • Directories can be in same partition or different • Can make a partition part of the directory structure with the mount command • Mount the hda2 to appear as the home directory

  29. Home directory • Home directory • A directory for users to store personal files and information • Each user has a sub-directory • Located at /home/username

  30. Navigating Filesystem • pwd (print working directory) • Used to identify the current directory path • cd (change directory) • Used to move from one directory to another

  31. The ~ metacharacter and relative paths • ~ • Refers to the current user’s home directory • Can specify another user’s home directory by adding the username after ~ • Relative pathname • Pathname of a target directory relative to your current location in the tree

  32. Tab-completion • Tab-completion • Fills in the remaining characters of a unique filename or directory name when you press the Tab key • If more than one match, system will beep

  33. File types • Text files • Binary data files • Executable program files • Directory files • Linked files • Special device files • Named pipes and socket files

  34. Filenames • Filename • User-friendly identifier given to a file • Filename suffixes • Identifiers following a dot (.) at the end of a filename • used to denote the type of the file

  35. The ls command • Used to list the files in a directory • Most common method for displaying files • Displays all the files in the current directory • You can use an argument with ls to list a directory different from current one

  36. Ls –F file type characters • @ Linked file • * Executable file • / Subdirectory • = Socket file • | Named pipe

  37. Ls –l file details • File type • Permission list • Important • Link count • Owner • Group • Size • Modified date • filename

  38. Ls –l file details File type Permissions Links Owner Group Size Modified date filename total 143860 -r--r--r-- 1 epapates epapates 35618816 Nov 13 16:06 linux.iso -r-xr-xr-x 1 epapates epapates 111527809 Feb 14 02:56 VMware-workstation-5.5.3-34685.tar.gz

  39. The file command • File command • Displays detailed information about any file • Works with multiple files • Uses * to include all files in a directory

  40. Hidden files • Hidden files • Files that are not normally displayed with common filesystem commands • represent important configuration files or program directories • View with –a option from ls command

  41. ls command options continued

  42. ls command options, continued

  43. Wildcard metacharacters • Can simplify more than one filename to a command • Interpreted by the shell and can be used with most filesystem commands • Matches certain portions of filenames or an entire filename continued

  44. Wildcard metacharacters, continued

  45. Activity C 2 and 3 Examining files and file types Using wildcard metacharacters

  46. Any Questions?

  47. Topic D: Displaying the contents of files

  48. Displaying content of text files • cat command • Display the entire contents of a text file to the screen • tac command • Displays a file to the screen beginning with the last line of the file and ending with the first line of the file • head command • Displays the first 10 lines (including blank lines) of a text file to the terminal screen • Can also take a numeric option specifying a different number of lines to display continued

  49. Displaying content of text files, continued • tail command • By default, displays the last 10 lines (including blank lines) of a text file to the terminal screen • Can also take a numeric option specifying a different number of lines to display

More Related