1. Trang chủ
  2. » Công Nghệ Thông Tin

Module Linux essentials - Module 4: Command line skills

19 72 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 19
Dung lượng 86,84 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

This module provide basics of using the Linux command line. After studying this chapter you should be able to: Understanding the basic shell; working with formatting commands and options, learn the effects of variables, globbing and quoting.

Trang 1

Module 4 Command Line Skills

Trang 2

This slide deck is for LPI Academy instructors to use for lectures for LPI Academy courses

©Copyright Network Development Group 2013

Exam Objective 2.1 Basics of using the Linux

command line

Objective Summary

options

quoting

Trang 3

CLI or Basic Shell

Trang 4

This slide deck is for LPI Academy instructors to use for lectures for LPI Academy courses

©Copyright Network Development Group 2013

The Command Line Interface

• Text based interface

• Access via a Terminal

• Commands passed to a shell

• Shell prompt: [sysadmin@localhost ~]

Trang 5

Shell Features

• Command history – ability to re-execute previous commands quickly

• Scripting – create programs by placing shell commands in a file to run

• Alias – create shortcuts to longer

commands

• Variables – store information that can

be used to modify the functionality of

the shell or commands

Trang 6

This slide deck is for LPI Academy instructors to use for lectures for LPI Academy courses

©Copyright Network Development Group 2013

Understanding Command

Structure

Trang 7

Command format

• Basic format:

• Options change the behavior of

command

• Arguments are used to provide

additional information for a command

Trang 8

This slide deck is for LPI Academy instructors to use for lectures for LPI Academy courses

©Copyright Network Development Group 2013

Command options

• Vary based on command

• Older option format: -a

• Newer (GNU) option format: all

Trang 9

Command History

• View previous commands: history

• Bring up previous commands: up

arrow

• Modify previous commands: left

arrow, right arrow, etc.

• Execute a previous command: !<num>

Trang 10

This slide deck is for LPI Academy instructors to use for lectures for LPI Academy courses

©Copyright Network Development Group 2013

Variables

Trang 11

Shell Variables

• Used to store system information

• View with echo command: echo

$HISTSIZE

• Modify: HISTSIZE = 500

• Changes are temporary

• Place commands in ~/.bashrc to make permanent

Trang 12

This slide deck is for LPI Academy instructors to use for lectures for LPI Academy courses

©Copyright Network Development Group 2013

PATH Variable

• Determines where commands are executed from

• May need to be modified for custom software

• Example:

Trang 13

Command Path and Aliases

Trang 14

This slide deck is for LPI Academy instructors to use for lectures for LPI Academy courses

©Copyright Network Development Group 2013

Find command location

• Hard to determine where a command is located

• Instead of searching directories in the PATH variable manually, use the which command:

Trang 15

• Used to make shortcuts for longer

commands

• View aliases: alias

• Create alias: alias name=command

• Change are temporary

• To make permanent, place alias

command in ~/.bashrc file

Trang 16

This slide deck is for LPI Academy instructors to use for lectures for LPI Academy courses

©Copyright Network Development Group 2013

Additional Command

Structure

Trang 17

• Used to match sets of files in a

directory

• * = match zero or more of any

characters

• ? = match exactly one of any character

• [ ] = match exactly one of a set of

characters:

echo [!abc]*.txt

Trang 18

This slide deck is for LPI Academy instructors to use for lectures for LPI Academy courses

©Copyright Network Development Group 2013

Quoting

• Double quotes – used to disable the

meaning of some metacharacters, like glob characters

• Single quotes – used to disable the

meaning of all metacharacters

• Backquotes – used to execute a

command within another command line

Trang 19

Control Statements

• The ; character - Used to separate commands on a command line

• The && characters – Used to execute the second command if the first

command succeeds

• The || characters – Used to execute the second command if the first

command fails

Ngày đăng: 30/01/2020, 05:01

TỪ KHÓA LIÊN QUAN