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 Linux-03- command uses the

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

I. Common orders

1. Common operations

Mkdir-p. / a/b/c / / Recursively create a multi-tier directory

Mkdir. / abc/ {, XJ YJ Z} dir / / create a xdir,ydir,cdir folder under abc

Cd ~ syraer / / enter the user directory under user name syraer

Cd-/ / returns the previous directory

Rm-f / / Force deletion

Rm-rf / / Recursive forced deletion

Hash-r / / clear command cache

Mv 1 2 / / move files-> directory

Cp-r / a / / copy file directory

Ln 1 2 / / hard link (point to the same address unit, count increase or decrease, delete files, count decrease)

Ln-s 1 2 / / soft connection (points to the same file, the count only increases, not decreases. Delete file, link error)

Stat. / etc / / metadata (modify permissions and other metadata information, change time will change. Modify file, metadata change, access time change, file change, all three times will change)

Touch / / is mainly used to modify metadata for three times or to create an empty file.

[root@node01 /] # stat / etc

File: `/ etc'

Size: 4096 Blocks: 8 IO Block: 4096 directory

Device: 803h/2051d Inode: 917505 Links: 61

Access: (0755/drwxr-xr-x) Uid: (0 / root) Gid: (0 / root)

Access: 2020-01-12 22 purl 18 purl 34.983663970 + 0800

Modify: 46.470668281 + 0800

Change: 46.470668281 + 0800

2. View the file

Cat / / View files

More// View Files

Less// view file, Q exit, j line, b fallback, space block by block

Head-4max / View the first four lines of the file

Tail-4 / / the last four lines of viewing the file

Grep PATTERN profile / / find PATTERN in profile

Grep-v PATTERN profile / / find objects that do not contain PATTERN in the profile

'|' pipeline format: command 1 | Command 2 (command 1 is output to pipeline, command 2 is followed by pipeline operation) learn carefully later

Echo "/" | xargs ls-l / / character'/'is ordered to be executed by xargs, taking the acquired character'/'as an argument to the ls command and executing ls

3. Vi / vim command (commonly used red, must be able to use it)

Open a file

Vim / path/to/somefile

Vim + #: open the file and navigate to line

Vim +: open the file and navigate to the last line

Vim + / PATTERN: open the file and navigate to the beginning of the line that was first matched by PATTERN

Full screen editor

Mode:

-Edit mode: the button has the function of editing text: open by default and enter edit mode

-input mode: the meaning of the button itself

-Last line mode: accept user command input

Edit mode

Edit-- > enter:

-I: switch to input mode before the character where the current cursor is located

-a: switch to input mode after the character in which the current cursor is located

-

-o: create a new line below the line of the current cursor and switch to input mode

-O: create a new line above the line of the current cursor and switch to input mode

-I: convert to input mode at the beginning of the line where the current cursor is located

-A: convert to input mode at the end of the line where the current cursor is located

-enter-- > Edit:

ESC

Edit-- > Last line:

-:

Last line-- > Edit:

-ESC, ESC

Move the cursor

-character

H: left; j: bottom; k: top; l: right

-words

W: move to the beginning of the next word

E: skip to the end of the current or next word

B: skip to the beginning of the current or previous word

-in-line

0: absolute beginning of line

^: the first non-white space character at the beginning of the line

$: absolute end of line

-between lines

G: at the end of the article

3G: line 3

Gg: the beginning of the article

-flip the screen

Ctrl:f,b

Delete & replace a single character

-x: delete cursor position characters

-3x: delete the first 3 characters of the cursor

-r: replace the cursor position character

Delete command: d

-dw,dd,3dw (three words)

Copy and paste & cut

-yw,yy

-p

-P

Undo & redo

-u undo

-ctrl+r redo undo operation

-. Repeat the previous step

Last row mode

Close the file

Last line mode: shift+:

Q quit without touching the file

: wq saved and exited and moved, no regrets

: q! I didn't save and quit. I moved it. I regretted it.

W save

: w! Forced preservation

: wq->: X

Shift+ZZ: save and exit without colons, edit mode

Set: settin

-set nu number

-set nonu nonumber

-set readonly

-

-

/: find

-/ after

-NBI N

-? Look up

-1. Delete one line to the last line and combine commands

! Execute the command

-:! ls-l /

S find and replace

-s/str1/str2/gi

/: the first character of the adjacent s command is the boundary character: /, @, #

G: replace all in one line

I: ignore case

-ran

N: line number

.: current cursor line

+ n: offset n Lin

$: last line, $- 3

%: full text

-

Copyright notice: this article is the original article of CSDN blogger "AYXYJ", in accordance with the CC 4.0BY-SA copyright Agreement. Please attach the original source link and this statement for reprint.

Original link: https://blog.csdn.net/weixin_39531549/article/details/103945941

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

Servers

Wechat

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

12
Report