Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Getting started with class-2 Linux

2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Catalogue

1. System initial

1.1 broadcast

1.2 shutdown / restart command

1.3 configuration Information

two。 Terminal terminal and interactive interface

2.1 Terminal terminal

2.2 Interactive interface

3. User login

4.bash shell

5. Command prompt

6. Command classification, lookup, aliases, priority

6.1 Command classification

6.2 Command lookup

6.3 command alias

6.4 Command priority

7. Install VMware Tool

8. Command format

9. Simple command date,cal,clock,hwclock

10. Simple commands screen, echo, the color of the file name

10.1 install screen

10.2 screen session commands:

10.3 simple commands echo commands

10.4 define the color of the file name

11. Command line extended, enclosed collection

11.1 Command replacement (command reference)

11.2 bracket extension: {}

12.Tab key

12.1 Command completion

12.2 path completion

13. Get help

13.1 # whatis

13.2 Command help

13.3--help option

13.4 man orders and chapters

13.5 navigating the man man page

13.6 man command

13.7 man search

13.8 info

13.9 navigate info pages

13.10 get help through local documentation

13.11 get help through online documentation

13.12 Red Hat Global Technical support Service

13.13 websites and search

14. Command Line History history

14.1 repeat the previous command

14.2 direction key

14.3 Command history

14.4 Command history-related environment variables

Keyboard shortcuts for 14.5 bash

1. System initial

1.1 broadcast

Echo hello > / dev/pts/1

[root@6] # echo hello > / dev/pts/2 [root@6 ~] # tty/dev/pts/1 [root@6 ~] # hello [root@6 ~] # tty/dev/pts/2

1.2 shutdown / restart command

# halt shuts down without power outage

# poweroff shutdown and Power off

# init

Close the image interface init 3

To restart the system service by opening the image interface init 5, you need to re-enter the user name and password to log in.

# startx opens the image interface to change the current environment to the pattern with the current identity

1.3 configuration Information

Version number

/ etc/redhat-release

/ etc/centos-release

[root@6 ~] # cat / etc/redhat-releaseCentOS release 6.8 (Final) [root@6 ~] # cat / etc/centos-releaseCentOS release 6.8 (Final)

User prompt

/ etc/issue

[root@6 ~] # cat / etc/issueCentOS release 6.8 (Final) Kernel\ r on an\ m

# lsb_release

[root@6 ~] # lsb_releaseLSB Version::base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch

two。 Terminal terminal and interactive interface

2.1 Terminal terminal

Physical terminal: single-user mode of monitor and keyboard equipment directly connected to the local computer

/ dev/console

Virtual terminal: a software virtual implementation attached to a physical terminal.

Terminal, device file path: / dev/tty#

# Ctrl+Alt+F#: [1pc6] Terminal handoff

# chvt n

[root@6 ~] # chvt 2 switch to a user [root@6 ~] #

Graphic terminal: a virtual terminal that is attached to a physical terminal and implemented in a software manner, but provides an additional desktop environment.

Analog terminal: command line opened by graphical interface and remotely opened interface based on ssh protocol or telnet protocol, device file: / dev/pts/# [0, ∞)

View the current end device: tty

[root@6 ~] # tty/dev/pts/1# getent passwd ftp View the related records in the database of the system [root@6 ~] # getent passwd ftpftp:x:14:50:FTP User:/var/ftp:/sbin/nologin

2.2 Interactive interface

Interactive interface: after starting the terminal, attach an interactive application to the terminal device

program

GUI: Graphic User Interface

Desktop:

GNOME (C, graphics library gtk)

KDE (graphics library qt)

CLI: Command Line Interface

3. User login

# id-u UID

Centos 6 normal user 500 (initial value)

Centos 7 normal user 1000 (initial value)

[root@6 ~] # id-u lvasu 500 [root@7 ~] # id-u lvasu 1000

4.bash shell

GNU Bourne-Again Shell (bash) is an important part of GNU project.

Is one of the software, is also the Linux standard shell, compatible with sh.

CentOS defaults to the

Displays the currently used shell::

# echo $SHELL View the user's shell [root@6 ~] # echo $SHELL / bin/bash

Displays all shell::

# cat / etc/shells View system shell [root@6 ~] # echo $SHELL/bin/bash [root@6 ~] # cat / etc/shells/bin/sh/bin/bash/sbin/nologin/bin/dash/bin/tcsh/bin/csh

5. Command prompt

Command prompt: prompt

[root@localhost ~] #

Display the prompt format:

[root@localhost]: echo $PS1

Prompt::

Administrator: #

Ordinary user: $

[root@6 ~] # echo $PS1 [\ u @\ h\ W]\ $[root@6 ~] # PS1= {\ u} Last login: Sat Jul 23 00:37:09 2016 [root@6 ~] # Last login: Wed Jul 20 17:17:28 2016 [lvasu@6 ~] $

6. Command classification, lookup, aliases, priority

6.1 Command classification

There are two types of commands that can be executed in shell:

Internal commands: provided by shell and provided in the form of a command

The enable command enables or disables internal commands

External command: there is a corresponding executable under a file system path of the current system

Line program file

6.2 Command lookup

# which external command path [root@6 ~] # which ls alias ls='ls-- color=auto' [root@6 testdir] # which cd / usr/bin/which: no cd in (/ usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin) / bin/ls The path to the internal command could not be found

Love madness

# path to the whereis file and help documentation [root@6 ~] # whereis ls ls: / bin/ls / usr/share/man/man1p/ls.1p.gz/usr/share/man/man1/ls.1.gz

# type COMMAND depends on the command type (external / internal) [root@6 ~] # type cd cd is a shell builtin [root@6 ~] # type date date is / bin/date

Disable, enable internal commands

# enable-n command disable internal command [root@6 testdir] # enable-n cd [root@6 testdir] # cd /-bash: cd: command not found [root@6 testdir] # enable-n ls-bash: enable: ls: not a shell builtin external command prompt error # enable command startup Use the internal command [root@6 testdir] # enable cd [root@6 testdir] # cd / [root@6 /] #

Hash commands: command cach

The result of the searched external command path is cached to the kv (key-value) store.

Hash display hash cache

[root@6 testdir] # hashhits command 1 / sbin/ifconfig 1 / bin/rm 1 / bin/touch 1 / bin/cp 3 / bin/ls

Hash-d deletes the specified command bar

[root@6 testdir] # hash-d rm [root@6 testdir] # hashhits command 1 / sbin/ifconfig 1 / bin/touch 1 / bin/cp 3 / bin/ls

Hash-r clears the cache

[root@6 testdir] # hash-r [root@6 testdir] # hashhash: hash table empty

6.3 command alias

# alias ls='ls-- color=auto' defines command aliases

[root@6 testdir] # alias lv='cat / etc/passwd' [root@6 testdir] # lvroot:x:0:0:root:/root:/bin/bashbin:x:1:1:bin:/bin:/sbin/nologindaemon:x:2:2:daemon:/sbin:/sbin/nologinadm:x:3:4:adm:/var/adm:/sbin/nologinlp:x:4:7:lp:/var/spool/lpd:/sbin/nologinsync:x:5:0:sync:/ Sbin:/bin/syncshutdown:x:6:0:shutdown:/sbin:/sbin/shutdownhalt:x:7:0:halt:/sbin:/sbin/haltmail:x:8:12:mail:/var/spool/mail:/sbin/nologinuucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin

# unalias cancel command alias

[root@6 testdir] # unalias lv [root@6 testdir] # lv-bash: lv: command not found

Execute the original command

1. Direct path

2.\ command

3. Command'

[root@6 testdir] # which lsalias ls='ls-- color=auto'/bin/ls [root@6 testdir] # / bin/lslost+found VMware Tools [root@6 testdir] #\ lslost+found VMware Tools [root@6 testdir] # 'ls'lost+found VMware Tools

6.4 Command priority

Command priority

Command aliases > internal commands > cache commands > external commands

# echo $PATH Command folder location

[root@6 bin] # echo $PATH/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin [root@7 ~] # echo $PATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin [root@6 ~] # alias ls='cd' Command alias > Internal command [root@6 ~] # ls / [root@6 /] #

[root@7 ~] # enable-n cd Internal Command > external Command [root@7 ~] # cd [root@7 ~] # cd / [root@7 ~] # type cdcd has been hit by Hash (/ usr/bin/cd) [root@7 ~] # hash Command 3 / usr/bin/cd

[root@7 sbin] #! 61 save command > external command echo $PATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin [root@7 sbin] # cp-a / bin/yes / usr/local/sbin [root@7 sbin] # type yesyes has been hashed (/ usr/bin/yes)

7. Install VMware Tool

# cp-r / media/VMware\ Tool/ / testdir/

[root@6] # cp-r / media/VMware\ Tool/ / testdir/

# tar xvf VMwareTools-10.0.1-3160059.tar.gz

[root@6 ~] # tar xvf VMwareTools-10.0.1-3160059.tar.gz

#. / vmware-install.pl

[root@6 ~] #. / vmware-install.pl

8. Command format

COMMAND [OPTIONS...] [ARGUMENTS...]

Options: to enable or disable one or some of the features of the command

Short option:-c, for example:-l,-h

Long option:-- word, for example:-- all,-- human-readable

Parameter: the object of the command, such as file name, user name, etc.

Note:

1. Multiple options, and multiple arguments and commands are separated by white space characters.

[root@7] # ls-h-l. / the total amount of etc/.: is 8.0K / r / w / r. 1 root root 1.8K July 21 01:43 anaconda-ks.cfg-rw-. 1 root root 1.9K July 20 17:52 initial-setup-ks.cfgdrwxr-xr-x. 2 root root June 20 17:54 Public drwxr-xr-x. 2 root root June 20 17:54 template drwxr-xr-x. 2 root root June 20 17:54 video drwxr-xr-x. 2 root root June 20 17:54 picture drwxr-xr-x. 2 root root June 20 17:54 document drwxr-xr-x. 2 root root July 20 17:54 download drwxr-xr-x. 2 root root June 20 17:54 Music drwxr-xr-x. 2 root root 18 July 22 15:22 Desktop / etc/: Total usage 1.4Mdrwxr-xr-x. 3 root root 97 July 21 01:29 abrt-rw-r--r--. 1 root root 16 July 21 01:42 adjtime-rw-r--r--. 1 root root 1.5K June 7 2013 aliases-rw-r--r--. 1 root root 12K July 20 17:51 aliases.dbdrwxr-xr-x. 2 root root 49 July 21 01:29 alsadrwxr-xr-x. 2 root root 4.0K July 21 01:38 alternatives-rw-. 1 root root 541 July 27 2015 anacrontab-rw-r--r--. 1 root root 55 March 6 2015 asound.conf-rw-r--r--. 1 root root 1 November 20 2015 at.deny

2. Cancel and end command execution: Ctrl+c, Ctrl+d (exit logout)

Root@7 ~] # yesyyyy ^ C [root@7 ~] #

3. Multiple commands can be used; symbols are separated

[root@7] # date;clock;hwclock2016 July 23 Saturday 15:20:42 CST July 23, 2016 Saturday 23:13:43-0.783823 seconds Saturday July 23, 2016 23:13:44-1.001945 seconds

4. A command can be divided into multiple lines with\

[root@7] # cat anaconda\ >-ks\ > .cfg # version=DEVEL# System authorization informationauth-- enableshadow-- passalgo=sha512# Use CDROM installation mediacdrom# Use graphical install

9. Simple Command date,cal,clock,hwclock,nano Editor

Date-displays the date and time

-u:

Date mmddHHMMYY.SS modifies system time

[root@7] # date2016 23 July 2007 Saturday 15:24:50 CST [root@7] # date-u 23 July 2016 Saturday 07:24:55 UTC [root@7] # date 0801080008.00 Friday 01 August 2008 08:00:00 CST

Two types of clocks for Linux:

System clock: carried out by the Linux kernel through the operating frequency of CPU

Hardware clock: motherboard

Hwclock, clock: display hardware clock

-s,-- hctosys corrects the system clock based on the hardware clock

-w,-- systohc corrects the hardware clock based on the system clock

[root@7 ~] # date 0801080008.00 Friday, 01 August 2008 08:00:00 CST [root@7] # clock-s [root@7] # date2016 23 July 2007 Saturday 23:18:45 CST [root@7] # date 0723152716.25 Saturday 23 July 2016 15:27:25 CST [root@7] # clock-w [root@7 ~] # clock23 Saturday, July 23, 2016 15:27:45-0.600986 seconds

Cal-Show Calendar

# cal 08 2015

# cal 09 1752

[root@7] # cal July 2016 1 23 4 5 7 8 910 11 12 13 14 1617 18 20 21 22 2324 25 26 27 28 29 3031 [root@7] # cal 08 August 2015 1 2 3 4 5 6 7 89 10 11 12 13 14 1516 17 18 19 20 21 2223 24 25 26 27 28 2930 31 [root@7] # cal 09 1752 September 1752 one, two, three, four, five, six, one, two, 14, 15, 1617, 18, 19, 20, 21, 22, 2324, 25, 27, 28, 2930

10. Simple commands screen, echo, the color of the file name

10.1 install screen

[root@7 Packages] # cd / run/media/root/CentOS\ 7\ x86_64/Packages/ [root @ 7 Packages] # rpm-I screen-4.1.0-0.21.20120314git3c2946.el7.x86_64.rpm

10.2 screen session command: connect to the same account and the same session

Open a new screen:

# screen

Open a new screen:

# screen-S [SESSION]

[root@7] # screen-S 100

Join the club:

# screen-x [SESSION]

[root@7 ~] # screen-x 100

Exit and close screen:

# exit

[screen is terminating]

To split the current screen:

Ctrl+a,d ctrl+d shuts down the terminal

[detached from 6907.20]

Show all screen that have been opened:

# screen-ls

Restore a screen

# screen-r [SESSION]

10.3 simple commands echo commands

Function: display characters

Syntax: echo [- neE] [string]

Description: echo sends the input string to standard output.

The output strings are separated by blank characters and added at the end

Feed the line number.

Echo "$VAR_NAME": variables are replaced, double quotes are weakly referenced

Echo'$VAR_NAME': variables will not be replaced, strongly referenced

$echo-e "Enter the file name:\ c"

Echo command options:

-n is not in the last automatic line wrapping of the character

-e if the following characters appear in the string, they are specially processed, and

It will not be output as normal text: (weak reference)

\ a sound of warning

[root@7 ~] # echo-e "\ a"

\ b Backspace key

[root@7 ~] # echo-e "abc\ bd" abd

\ C finally, no newline symbol is added; and the following content is deleted, compress enter and feed the newline.

[root@7 ~] # echo-e "\ cabcd" [root@7 ~] # echo-e "abcd\ c" abcd [root@7 ~] # echo-e "abc\ cd" abc [root@7] # echo-e "ab\ ccd" ab [root@7 ~] #

\ nWrap and the cursor moves to the beginning of the line

A [root@7 ~] # echo-e "ab\ ncd" abcd [root@7 ~] # echo-e "a\ nbcd" abcd

\ r move the cursor to the beginning of the line, but do not wrap it; move the cursor to the beginning of the line and replace the previous

[root@7 ~] # echo-e "a\ rbcd" bcd [root@7 ~] # echo-e "ab\ rcd" cd

\ t insert tab

[root@7 ~] # echo-e "ab\ tcd" ab cd

\ insert\ character

Ab [root@7 ~] # echo-e "abcd\\" abcd\

\ 0nnn inserts ASCII characters represented by nnn (octal)

[root@7] # echo-e'\ 0141yoga

Echo-e "\ 033 [43 × 31mred color\ 033 [0m"

\ xHH inserts ASCII characters represented by HH (hexadecimal)

[root@7 ~] # echo-e "\ xad"

10.4 define the color of the file name

Cat / etc/DIR_COLORS

Cat

11. Command line extended, enclosed collection

11.1 Command replacement (command reference)

`command` applies to command references

$(command)

[root@7 ~] # echo "echo $USER" weak reference echo root [root@7 ~] # echo 'echo $USER' strong reference echo $USER [root@7 ~] # echo `echo $USER`

Command line extension: $() or ``

Print the output of one command to the parameters of another command

$echo "This system's name is $(hostname)"

This system's name is server1.example.com

$echo "I am `whoami `"

I am root

11.2 bracket extension: {}

Print a simplified form of a duplicate string

$echo file {1JI 3JI 5}

File1 file3 file5

$rm-f file {1pm 3pm 5}

12.Tab key

12.1 Command completion

Internal commands:

External command: the path defined by bash based on the PATH environment variable, from left to

Right search each path for a file named with a given command name, the command found for the first time

That is, the command to be executed

The string given by the user has only one unique corresponding command, which can be completed directly.

Otherwise, Tab will give you a list again

12.2 path completion

Take the string given by the user as the beginning of the path and specify the parent directory in it

Search for a file name that begins with the specified string

If it is unique, then make it up directly.

Otherwise: Tab gives the list again

13. Get help

The ability to get help determines the ability of technology!

Multi-level help

Whatis

Command-help

Man and info

/ usr/share/doc/

Red Hat documentation

Other websites and searches

13.1 # whatis

1. Displays a short description of the command

two。 Use one database update every night

3. Cannot be used immediately after installation

# makewhatis (centos6)

# mandb (centos7) making database

[root@7 ~] # mandb is deleting old database entries in / usr/share/man. Bash: makewhatis: command not found. [root@6 ~] # makewhatis

Whatis cal or man-f cal

[root@6] # whatis calcal (1)-displays a calendarcal (1p)-print a calendar

13.2 Command help

Internal command: # help COMMAND

# man bash

External command: (1) # COMMAND-- help

# COMMAND-h

(2) user manual (manual)

# man COMMAND

(3) Information page

# info COMMAND

(4) help documentation of the program itself

README

INSTALL

ChangeLog

(5) official documentation of the program

Official site: Documentation

(6) official documents of the distribution version

(7) Google

13.3--help option

Display usage summary and parameter list

Most of them, but not all of them

$date-help

Usage: date [OPTION]... [+ FORMAT] or: date [-

U |-- utc |-- universal] [MMDDhhmm [[CC] YY] [.ss]]

1. [] is optional

2. CAPS or variable

3.... Represents a list

4. X | y | z "means" x or y or z "

5.-abc means-a-b-c

13.4 man orders and chapters

1. A file that provides command help

two。 Man pages are stored at / usr/share/man

3. Almost every command has a man "page"

4.man pages are grouped into different "chapters"

5. Collectively known as the Linux manual

6.man [chapter] command

7.man command configuration file: / etc/man.config | man_db.conf

8.MANPATH / PATH/TO/SOMEWHERE: indicates where to search for new manual files

9.# man-M / PATH/TO/SOMEWHERE COMMAND: search under the specified location

Request the man page of the COMMAND command and display

Man chapter

1: user command

2: system call

3: C library call

4: equipment files and special documents

5: configuration file format

6: games

7: miscellaneous

8: commands for managing classes

9: Linux kernel API

[root@6 ~] # whatis passwdpasswd (1)-update user's authentication tokenspasswd (5)-password filepasswd [sslpasswd] (1ssl)-compute password hashes [root@6 ~] # man 5 passwdPASSWD (5) Linux Programmer's Manual PASSWD (5) NAME passwd-password file

13.5 navigating the man man page

1. View the man man page

2.SYNOPSIS Summary: []: optional content

: required

A | b: choose one of the two

...: the same content can appear multiple times.

3.man-a keyword lists all the help

4. Search the man manual

Man-k keyword lists all matching pages

Using the whatis database

13.6 man command

The operation method of the man command: use the less command to implement

Space, ^ V, ^ f, ^ F: flip the screen to the end of the file

B, ^ B: flip the screen to the head of the file

D, ^ D: flip half the screen to the end of the file

U, ^ U: turn half the screen to the head of the file

RETURN, ^ N, e, ^ E or j or ^ J: turn a line to the end of the file

Y or ^ Y or ^ P or k or ^ K: turn one line to the beginning of the file

Q: exit

#: jump to line #

1G: go back to the header of the file

G: turn to the end of the file

13.7 man search

/ KEYWORD:

From the current location to the file with the string specified by KEYWORD as the keyword

Trailing search; character case insensitive

N: next

N: previous

? KEYWORD:

From the current location to the file with the string specified by KEYWORD as the keyword

First search; insensitive to character case

N: in the same direction as the search command, next

N: in the opposite direction of the search command, last

13.8 info

The 1.man test is often used for command reference, and the GNU tool info is suitable for general documentation reference.

two。 No parameters, list all pages

The structure of a 3.info page is like a website

4. Each page is divided into "nodes"

5. Before the front link node *

6.info [command]

13.9 navigate info pages

1. Direction key, PgUp, PgDn navigation

2.Tab key move to the next link

3.d display theme catalog

4.Home display theme header

5.Enter enter to the selected link

6.n/p/u/l goes to the next / front / upper / last link

7.s word text search

8.Q exit info

13.10 get help through local documentation

1. Click "system"-> "document":

Official user guide and release notes provided

2. / usr/share/doc directory

Subdirectories of most installed software packages, including those related to these software

Theory of principle

Location of documents that are not suitable for other places

Sample configuration file

Documents in HTML/PDF/PS format

Details of power of attorney

13.11 get help through online documentation

1. Official documentation of third-party programs

two。 Available on the official CD-ROM of the distribution or on the website

Installation Guid

Deployment Guid

Virtualization Guid

Red Hat knowledge Base and official online documentation

Http://kbase.redhat.com

Http://www.redhat.com/docs

Http://access.redhat.com

13.12 Red Hat Global Technical support Service

1. Rhn.redhat.com or local satellite server / proxy server

Machines based on network management

RHN proxy server provides caching for RHN traffic

RHN satellite server provides independent RHN

2. RHN account

For its registered and web-based RHN users

System ID for automatic system verification

3. Sosreport

A tool that collects log information on all systems and automatically packages it into compressed packages

It is convenient for technical support staff and Red Hat global support to provide the basis for analyzing problems.

13.13 websites and search

1. Http://tldp.org

2. Http://www.slideshare.net

3. Http://www.google.com

Openstack filetype:pdf

Rhca site:redhat.com/docs

14. Command line history

When you log in to shell, the commands recorded in the command history file are read

~ / .bash_history

Newly executed commands after logging in to shell are only recorded in the cache; these lives

"append" to the command history file when the user exits

14.1 repeat the previous command

There are four ways:

Repeat the previous command using the up key and press enter to execute.

Press it! And enter to execute.

Enter!-1 and enter to execute.

Press Ctrl+p and press enter to execute.

! String: repeat the previous command that starts with "string"

! num: repeat the corresponding command according to the sequence number in the output of the history command

!? String: repeat the previous command containing abc

!-n: repeat the command before n commands

14.2 direction key

Use the up (up) and down (down) keys to browse the previous input up and down

The order of

Type ctrl-r to search for commands in the command history

((reverse-i-search) `'::

To recall the last argument in the previous command:

! $means

Esc,. Click the Esc button and release, and then click. Key)

Alt+. Press and hold the Alt key and click. Key)

Call history parameter

# cmd! ^: use the first parameter of the previous command to do the parameter of cmd

# cmd! $: use the last parameter of the previous command to do the parameter of cmd

# cmd! *: use all parameters of the previous command to do the parameters of cmd

# cmd!: n: use the nth argument of the previous command to do the parameter of cmd

! n: ^ invokes the first argument of the n command

! NVR $invokes the last argument of the article n command

! Maren invokes the nth parameter of the article m command of the article m command

! NRV * invokes all parameters of the Article n command

Call history parameter

! string: ^ to search the command history for commands that start with string and get the

Its first parameter

! string:$ searches the command history for a command that begins with string and gets it

The last parameter of

! string:n searches the command history for commands that start with string and gets the

Its nth parameter

! string:* searches the command history for commands that start with string and gets the

All its parameters

Call history parameter

14.3 Command history

History [- c] [- d offset] [n]

History-anrw [filename]

History-ps arg [arg...]

-c: clear command history

-d: delete the command specified in the history

#: show the most recent # history

-a: append the history list of newly executed commands in this session to the history file

-n: read the unread lines in the history file to the history list

-r: read the history file and attach it to the history list

-w: save the history list to the specified history file

-p: expand the history parameter into multiple lines, but it does not exist in the history list

-s: expand the history parameter into a line and append it to the history list

14.4 Command history-related environment variables

HISTSIZE: number of command history entries

HISTFILE: specify a history file. Default is ~ / .bash_history;

HISTFILESIZE: the number of entries recorded in the command history file

HISTTIMEFORMAT= "F% T" display time

HISTIGNORE= "str1:str2: …" ignores string1,string2 history

Controls how command history is recorded:

Environment variable: HISTCONTROL

Ignoredups: ignore duplicate commands; consecutive and identical is "repetitive"

Ignorespace: ignore all commands that start with whitespace

Ignoreboth: ignoredups, ignorespace

Erasedups: delete duplicate command

Export variable name = "value"

Stored in / etc/profile or ~ / .bash_profile

Keyboard shortcuts for 14.5 bash

Ctrl+l clear screen, which is equivalent to clear command

Ctrl+c cancels the execution of the command

Ctrl-a moves to the front of the command line

Ctrl-e moves to the end of the command line

Ctrl-u will be deleted to the beginning of the line

Ctrl-k will be deleted to the end of the line

Arrow ctrl-b ctrl-f moves one character to the left or right

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report