Download presentation
Presentation is loading. Please wait.
Published byKerry Watson Modified over 9 years ago
1
Guide to Linux Installation and Administration, 2e1 Chapter 6 Using the Shell and Text Files
2
Guide to Linux Installation and Administration, 2e2 Objectives In this chapter, you will: Describe how a Linux shell operates Customize your shell environment Use common text editors to create or modify text files Describe popular text-processing methods and tools used on Linux
3
Guide to Linux Installation and Administration, 2e3 Understanding the Shell Command interpreter: program that accepts input from the keyboard and launches commands or otherwise controls the computer system Linux command interpreter is called the shell The shell is only loaded when a user logs in at a text mode login prompt Different types of shells are available for Linux Valued Gateway Client:
4
Guide to Linux Installation and Administration, 2e4 The Shell Prompt Shell prompt: set of words or characters indicating that the shell is ready for commands The default shell prompt includes four components: –The user account name –The hostname –The last part of the full directory path –A prompt character Valued Gateway Client:
5
Guide to Linux Installation and Administration, 2e5 A Standard Shell Prompt
6
Guide to Linux Installation and Administration, 2e6 The Functions of a Shell A shell’s primary purpose is to launch programs A Linux shell gives users the ability to write scripts that the shell can execute The shell has many built-in features to work with files and commands on a Linux system Valued Gateway Client:
7
Guide to Linux Installation and Administration, 2e7 Different Types of Shells
8
Guide to Linux Installation and Administration, 2e8 Different Types of Shells
9
Guide to Linux Installation and Administration, 2e9 Entering Commands Modern shells include features designed to simplify the process of entering commands and command parameters: –Tab completion –History feature Valued Gateway Client:
10
Guide to Linux Installation and Administration, 2e10 Using Tab Completion Tab completion is a shell feature that lets you enter part of a file or directory name, press the Tab key, and have the shell fill in the remainder of the name Using tab completion makes it easier to enter long or complex directory paths and filenames Valued Gateway Client:
11
Guide to Linux Installation and Administration, 2e11 Using the History Feature Command history: records each command that you enter at the shell prompt History list: recently entered commands To locate a previously executed command –Use the history number –Use the beginning of a command –Search the history list Valued Gateway Client:
12
Guide to Linux Installation and Administration, 2e12 The Shell Start-up Process The profile scripts are executed when a user logs into a Linux system Additional scripts are executed when a user starts a shell The /etc/profile script contains configuration information that applies to every user on the system Valued Gateway Client:
13
Guide to Linux Installation and Administration, 2e13 A Typical Start-up Script
14
Guide to Linux Installation and Administration, 2e14 Customizing the Shell You can customize the Linux environment with the following methods: –Use aliases –Use symbolic links –Use environment variables Valued Gateway Client:
15
Guide to Linux Installation and Administration, 2e15 Using Aliases Alias: string of characters that is substituted for another string of characters at the shell prompt The alias command lets you define an alias for text you enter at a shell prompt General format of the alias command: alias = Valued Gateway Client:
16
Guide to Linux Installation and Administration, 2e16 Symbolic Links Symbolic link –File that refers to another file or directory, rather than containing data itself –Used when the same data must be accessed from two locations in the directory structure, or by two different names –Commonly used in directories such as /lib and /usr/lib To create a symbolic link, use the ln command with the -s option Valued Gateway Client:
17
Guide to Linux Installation and Administration, 2e17 A Symbolic Link
18
Guide to Linux Installation and Administration, 2e18 Viewing a Symbolic Link
19
Guide to Linux Installation and Administration, 2e19 Environment Variables Environment variables are settings, or values, available to any program launched by a user Each environment variable is assigned a value Set command: displays a list of all environment variables defined in your current environment To see the value of an environment variable, execute echo followed by the environment variable name preceded by a dollar sign The export command makes an environment variable available to other programs launched from that environment Valued Gateway Client:
20
Guide to Linux Installation and Administration, 2e20 Using Text Editors Linux supports numerous text editors Linux system administrator can modify configuration files using any text editor Files that use a markup language can be created in any text editor You can filter text files within some text editors Valued Gateway Client:
21
Guide to Linux Installation and Administration, 2e21 The Variety of Linux Text Editors Graphical text editors are included on modern Linux desktops, such as –gedit in Gnome –kedit and kate in KDE Widely used text-mode editors: –vi –emacs –pico –joe Valued Gateway Client:
22
Guide to Linux Installation and Administration, 2e22 The pico Text Editor
23
Guide to Linux Installation and Administration, 2e23 Using the vi Editor vi is a modal editor – keystrokes are interpreted differently depending on the mode you are working in vi has several modes: –Command mode –Insert mode –Replace mode Valued Gateway Client:
24
Guide to Linux Installation and Administration, 2e24 Using the vi Editor
25
Guide to Linux Installation and Administration, 2e25 vi Commands to Enter Insert or Replace Mode
26
Guide to Linux Installation and Administration, 2e26 Additional vi Commands
27
Guide to Linux Installation and Administration, 2e27 Text Processing There are two methods to create formatted documents: –Graphical, or WYSIWYG (what-you-see-is-what- you-get) –Rely on markup languages to define special codes that format documents Valued Gateway Client:
28
Guide to Linux Installation and Administration, 2e28 Markup Languages Widely used markup languages in the Unix and Linux world: –HTML (hypertext markup language) –TeX – a document-processing system with two popular versions: LaTeX and TeTeX –roff codes for online documents Valued Gateway Client:
29
Guide to Linux Installation and Administration, 2e29 An HTML Document in vi
30
Guide to Linux Installation and Administration, 2e30 Controlling Fonts The X Window System is installed with many different fonts xfontsel graphical program is used to review and select fonts Both Gnome and KDE provide a standard font selection dialog box Fonts are managed in X using the xfs font server New fonts can be added to the Linux system any time Valued Gateway Client:
31
Guide to Linux Installation and Administration, 2e31 The xfontsel Program
32
Guide to Linux Installation and Administration, 2e32 The Font Selector Dialog Box in Gnome
33
Guide to Linux Installation and Administration, 2e33 Manipulating Text Files Filtering is the process of adding, removing, or altering data in the text file based on complex rules or patterns sort command: sorts all of the lines in a text file, writing them out in alphabetical order sed command: processes each line in a text file according to a series of command-line options awk and perl programming languages can be used to create scripts for filtering text files Valued Gateway Client:
34
Guide to Linux Installation and Administration, 2e34 Linux Text-filtering Commands
35
Guide to Linux Installation and Administration, 2e35 Summary Linux shell: program that launches other programs and works with files in Linux Modern shells include features designed to simplify the process of entering commands - tab completion and history Aliases within a shell cause the shell to replace text on a command-line entry with different text before trying to execute the command Environment variables store values that any program can access
36
Guide to Linux Installation and Administration, 2e36 Summary Linux supports text editors, such as vi Linux programs format text using a WYSIWYG display or markup languages such as LaTeX and roff use codes Fonts are managed in X Windows System using a font server Gnome and KDE provide a dialog box to select the font for graphical programs Filtering text files can be done within some text editors or using different command-line utilities
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.