1 / 67

Exploring interfaces and filesystems

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

camille
Download Presentation

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. 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 • Topic A: Linux interfaces • Topic B: Basic shell commands • Topic C: Files and directories • Topic D: Displaying the contents of files • Topic E: Searching and editing text files

  3. Shells, terminals, and the kernel • Kernel • The core component of the OS • 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 continued

  4. Shells, terminals, and the kernel, continued

  5. A GNOME terminal

  6. A KDE terminal

  7. Exercise A-1 Discussing terminals and shells

  8. Topic B • Topic A: Linux interfaces • Topic B: Basic shell commands • Topic C: Files and directories • Topic D: Displaying the contents of files • Topic E: Searching and editing text files

  9. 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

  10. Some common Linux commands

  11. Shell metacharacters • Key combinations that have special meaning in the Linux OS • One of the most commonly used metacharacters is the $ character

  12. Common BASH shell metacharacters

  13. Activity B-1 Using shell commands and metacharacters

  14. Getting command help • Manual pages • Commonly referred to as man pages • Documents the command’s function and the syntax it accepts

  15. Manual page section numbers

  16. Activity B-2 Getting help

  17. Activity B-3 Shutting down the system

  18. Topic C • Topic A: Linux interfaces • Topic B: Basic shell commands • Topic C: Files and directories • Topic D: Displaying the contents of files • Topic E: Searching and editing text files

  19. The Linux directory structure

  20. The Linux directory structure • 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

  21. Home directory • Home directory • A directory for users to store personal files and information • Each user has a sub-directory

  22. Changing directories • pwd (print working directory) • Used to identify the current directory path • cd (change directory) • Used to move from one directory to another

  23. 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

  24. Tab-completion • Tab-completion • Fills in the remaining characters of a unique filename or directory name when you press the Tab key

  25. Activity C-1 Logging on and navigating the file structure

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

  27. 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

  28. Filename extensions

  29. 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

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

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

  32. Hidden files • Hidden files • Files that are not normally displayed with common filesystem commands • represent important configuration files or program directories

  33. ls command options continued

  34. ls command options, continued

  35. Activity C-2 Examining files and file types

  36. 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

  37. Wildcard metacharacters, continued

  38. Activity A-3 Using wildcard metacharacters

  39. Topic D • Topic A: Linux interfaces • Topic B: Basic shell commands • Topic C: Files and directories • Topic D: Displaying the contents of files • Topic E: Searching and editing text files

  40. 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

  41. 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

  42. Other text file viewing commands • more command • Displays a text file page-by-page and line-by-line • Gets its name from the pg command once used on UNIX system • less command • Displays a text file page-by-page • Use the cursor keys to navigate the file

  43. Activity D-1 Displaying text file contents

  44. Displaying the contents of binary files • strings commands • Linux command used to search for and display text characters in a binary file • od command • Linux command that is used to display the contents of a file in octal format (numeric base 8 format) • Safe to use on binary files and text files

  45. Activity D-2 Displaying binary data

  46. Topic E • Topic A: Linux interfaces • Topic B: Basic shell commands • Topic C: Files and directories • Topic D: Displaying the contents of files • Topic E: Searching and editing text files

  47. Searching for text within files • Regular expressions (regexp) • Special metacharacters used to match patterns of text within text files • Commonly used by many text tool commands such as grep

  48. Regular expressions and wildcards • Regular expressions are interpreted by a text tool program, wildcard metacharacters are interpreted by the shell, • Regular expressions match characters within text files, wildcard metacharacters match characters in filenames or directory names continued

  49. Regular expressions and wildcards, continued • Wildcard metacharacters regular expressions usually have different definitions than wildcard metacharacters • More metacharacters are available for regular expressions • Regular expressions are divided into two different categories: • Common • extended continued

  50. Regular expressions

More Related