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

The third lesson of my Longco operation and maintenance

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

Share

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

1. Using vim to edit multiple files

Vim file1 file2 file3...

Next views or edits the contents of the latter document

Prev views or edits the contents of the previous document

First views or edits the contents of the first document

Last views or edits the contents of the last document

Vim-o |-O file1 file2 file3.

Display multiple files horizontally or vertically

Ctrl+w switches to another document

# Ctrl+w switches to the specified document

Ctrl+w,s | v horizontal or vertical split screen display

: qa exit

: wa save

R file loads other documents into the current interface to display

:! COMMAND interacts with shell

W file saved to file

M file NW file saves lines m to n to file

The m ~ (th) to m ~ (n) lines are saved to the file by m ~ (th) file

:., $w file

Many kinds of shell are provided in 2.Centos system.

Such as: sh, tcsh, ksh, bash (default), zsh,.

Directly enter the corresponding shell name to switch to a different shell

/ shell is saved in / etc/shells

3. Command alias: alias

Format: alias [alias of command] = [command of system]

Description: for each user, there is a private bash configuration file: ~ / .bashrc

Note: the effect of the alias command is limited to the life of the current shell. If you want to take effect permanently, you need to change the bashrc file and restart it to take effect. In order to ensure the alias to be valid, you usually do both operations.

Revoke the alias: unalias:

Format: unalias NAME

4. Command History:

History [parameters]

Parameter:-c clear the history command in the history buffer

-d offiset deletes a specific historical command entry

Reuse commands in the history buffer

! # repeat the command numbered # in the history command

! STRING finds the most recent command that started with STRING

!? STRING finds the most recently executed command that contains STRING

!-# execute the penultimate command in the history buffer

Ctrl+r performs a search in the history buffer

! $| ^ find the last parameter or the first parameter of the last command

! [SEQUENCE]: NUMBER finds the number argument of the sequence command

History-related bash variables:

HISTSIZE

HISTFILESIZE

HISTTIMEFORMAT

HISTTIMEFORMAT= "F T"

HISTCOMTROL

Ignoredups ignores the history cache of consecutive and the same commands

Ignorespace ignores commands that start with a white space character

Both of the above functions of ignoreboth are enabled

5. Common shortcut keys

Ctrl+l is equivalent to clear. Clear the screen.

Ctrl+a jumps the cursor to the beginning of the command line

Ctrl+e jumps the cursor to the end of the command line

Ctrl+k deletes the command line information from the cursor position to the end of the line

Ctrl+u deletes the command line information from the cursor position to the beginning of the line

Ctrl+c ends the foreground process and cancels the operation of the command

6 Application functions:

': strong reference

"": weak reference

The escape character defined in\ bash can only make the next character lose its special meaning

Metacharacters:

* matches any character of any length, some special position "." Characters cannot be matched

? Match any single character, one and only one character must be matched

[] match a person within a specified range, once a character is matched, only one character must be matched

[a murz]: a, A, B, b, B, C, C, etc. Y _ ray _ Y _ Z does not include Z

[Amurz]: a _ C,. YJH Z Z does not include a.

Character set:

[: lower:] all lowercase letters

[: upper:] all the larger letters

[: alpha:] indicates all alphabetic characters

[: digit:] represents all decimal digits 10

[: alnum:] denotes all uppercase and lowercase letters and decimal numbers

[: space:] represents a white space character

[: punct:] all punctuation marks

^ take inverse matching

7. Output redirection:

>: override output redirection

~] # set-C / / turn on the error prevention overlay switch

After this switch is turned on, you can continue to override the redirection using the "> |" symbol.

~] # set + C / / turn off the error prevention overlay switch

> >: append output redirection

Error redirection:

2 >: overwrite error redirection

2 > >: append error redirection

Merge redirection of standard input and standard output:

1) & >, & >

2) COMMAND > | > > / PATH/TO/SOMEFILE 2 > & 1

Enter redirection:

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

Network Security

Wechat

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

12
Report