Linux operating system

Posted Jun 16, 20202 min read

One. \_Linux_\Common commands(__Centos7__):


_1.__ Directory structure:_/System root directory, ~ System home directory

2.__Switch directory:

cd directory-absolute path, relative path(../to return to the previous level) directly enter cd will return to the home directory

Command:cd/cd ~ cd directory

3.__Show all files(except hidden files)

Command:ll

4.__Clear screen:

Command:clear or rtrl+l

5.__Show current absolute path:

Command:pwd

6.__View the contents of the current directory:

Command:ls:-a -i -l

7.__Folder operation:

Command:mkdir software create directory software

Command:Mkdir p ~/temp/software/123 Create temp, software, 123 directories at the same time

Command:rmdir software delete directory software

8.__Rename or path:

Command:mv original path new path mv a.txt b.txt change a name to b

9.__File operation:

increase:

Command:touch file path to create a file

delete:

Command:rm file path

The necessary skills for deleting the library and running:

Command:rm -rfc

change:

Command:mv original path new path

_copy_:

Command:cp file or path target file or path

View from head__n__line

Command:head -n file name

View from the tail:

Command:tail -n file name

Dynamic view file:

Command:tail -f file name

more command:load documents at once

less command:show how much load

_ __. vi_\editor

View mode, edit mode, last line mode

  1. _Enter file editing(view mode)_:

Command:vi file name

2.__From view mode to edit mode:

(1) a is inserted after the cursor A is inserted at the end of the line where the cursor is located

(2) I insert at the cursor position I insert at the beginning of the line where the cursor is

(3) o Create a new line under the cursor and insert it O Create a new line above and insert

3.__Introduce editing mode_\:_

Esc built

4.__Enter the last row mode from viewing mode:

Enter:

(1) w save, q exit, q! Force quit

5.__Quickly switch lines in view mode:

(1) G goes directly to the last line, gg goes to the first line, and ngg jumps directly to the nth line

(__2_\)__n__Enter:Find from the current line down__n__ _

6.__Copy and paste(in view mode)

(1) Single line copy:yy, paste:p

7.__Delete:

(1) Single line deletion:dd

(2) Delete multiple lines:ndd

_ __._\user management

  1. Add(create user):useradd username

ps:modify the original password:passwd

Switch user su username

  1. Delete:userdel

  2. Change:usermod

  3. Check:vi /etc/passwd to view all users

Five\_._\solution__/__pressure command

1. tar command unpacking:tar -zxvf xxx.tar.gz

2. Tar command package:tar -zcvf xxx xxx.tar.gz