Summary of Linux operating system knowledge points (with installation tutorials for VMware, CentOS and finalshell)

1. The components of a computer: input unit, central processing unit (CPU), output unit.

The types of CPUs include: Reduced Instruction Set (RISC) and Complex Instruction Set (CISC).

The five major units of the computer include input unit, output unit, control unit inside the CPU, arithmetic logic unit and memory.

2. Computer classification: supercomputer, mainframe computer, minicomputer, workstation, microcomputer (personal computer).

3. The chipset on the motherboard controls the communication of each component, which is generally divided into North Bridge and South Bridge : ① The North Bridge complexly connects components such as the CPU, memory, and graphics card with a faster speed; ② The South Bridge is responsible for connecting slower peripheral interfaces, including Hard disk, USB, network card, etc. Among them, the bus of the north bridge is called the system bus, and the bus of the south bridge is the so-called input/output bus.

4. The amount of data processed by the CPU each time is called the word size, that is, we often say that the computer is 32-bit or 64-bit.

5. Linux was founded and developed by Mr. Torvalds in 1991. Under the GPL copyright statement, it can run under the x86 architecture and can also be transplanted to other mainframes. It has now become the core system of the server system.

Features of Linux:

① Free and open use and learning environment

② Low equipment requirements

③ The kernel is powerful and stable

④ Independent work

Advantages and disadvantages of Linux:

advantage:

① Stable system

② Free or a small fee

③ Rapid repair of security and vulnerabilities

④ Multi-tasking, multi-user

⑤ Planning of users and user groups

⑥ Relatively does not consume resources

⑦ Suitable for embedded systems that require small core programs

⑧ Well-integrated and diverse graphical user interface

shortcoming:

No specific supported vendor

Insufficient game support

Insufficient support of professional software

6. Application:

① Web server (high stability) 

② Mission-critical applications (financial database, large-scale enterprise network management environment)

③ High-performance computing tasks for academic institutions

7. Installation of the virtual machine (Because the Linux system has the characteristics of free and open source, there are many Linux development versions on the market, among which the most used versions are Ubuntu and CentOS systems . The following mainly introduces the installation and configuration process of the CentOS system):

Before installing the CentOS system, first install the VMware software. The official installation address is:
https://www.vmware.com/cn/products/workstation-pro.html

Follow the software prompts to install step by step. The main thing to note is that after the installation is successful, go to Advanced Network Settings→Network Connection (due to the different locations of win10 and win11, you can also enter "ncpa. "to view) the option of VMnet1 and VMnet8 means the installation is successful, otherwise you need to re-download and install.

After that is the installation of CentOS, the official installation address: (download the DVD.iso in the picture below)

Index of /7.6.1810/isos/x86_64

Note: If the official website shows 404, you can download it through Thunder (very fast). 

CentOS7.6 iso, the following is its download link

http://mirrors.163.com/centos/7.6.1810/isos/x86_64/CentOS-7-x86_64-DVD-1810.iso

Copy the above link - Open Thunder - Click New

When copying the link to Xunlei, click New, and click OK if the following interface appears.

Reference blog post: Free download of CentOS7.6 mirror iso_centos7.6 iso_pxwhfs blog - CSDN blog

  

  

After downloading CentOS, open the VMware software, and then create a virtual machine. I created a typical virtual machine here. After setting the host name and password, you can see the following interface:

 After creating the virtual machine:

 The entire creation process is automatic.

Since the graphical interface of the Linux system is not as stable as the command line, it is generally operated by typing the command line through the terminal. In order to directly connect to the Linux system through your own system, you can download the finalshell software .

Download link: http://www.hostbuf.com/downloads/finalshell_install.exe

 How to connect to your own Linux virtual machine after downloading?

Right-click the last option in the blank space of the virtual machine to open the terminal, enter the ifconfig command, and the output ens33 is the IP address of the virtual machine.

Copy it to finalshell (click on the folder in the upper left corner to open the first option, SSH connection), and you can connect to the virtual machine.

 connection succeeded!

Then you can operate in finalshell, which is convenient for transferring files. 

 8. To save the state of the virtual machine, you can set the "snapshot" function. When there is a problem with the virtual machine, it can be restored to the state at the time of production through the pre-made snapshot for backup.

9. General format of Linux operating system commands:

command [-options] [parameter]

command The command itself.

-options is optional, the behavior details of the command are controlled by options.

parameter is optional and is used to point to the target of the command.

10. ls command (view the contents of the specified folder/directory):

ls [-a -l -h] [Linux path]

The [] after the ls command are all optional parameters.

-a: all, display all files.

-l: list, display the content in the form of a list, and display more information.

-h: Used with -l to display the size unit of the file.

It can also be written together, such as -al, -al, -la and -lah, etc.

11. The cd command switches the working directory, and the pwd command (print work directory) displays the current working directory. 

cd [Linux path]

When no path is added, it means returning to the user's home directory.

Special path characters:

① . Indicates the current path, such as cd ./Desktop.

② .. means to return to the previous directory, such as cd ..

③ ~ indicates the home directory, such as cd ~.

The pwd command has no options, no parameters, and can be used directly to output the current working directory.

12. Relative paths and absolute paths.

Relative path: starting from the current directory, does not need to start with /.

Absolute path: Starting from the root directory, it needs to start with /. 

13.  The mkdir (Make Directory) command is used to create a new directory.

mkdir [-p] Linux path

The required parameter indicates the Linux path, that is, the path of the folder to be created, relative path/absolute path/special path character.

-p is optional, which means to automatically create a parent directory that does not exist, and is suitable for creating continuous multi-level directories (you must add -p when the created folder directory does not exist ).

14. The touch command creates the file. 

touch Linux path

No option, the parameter is required, indicating the path of the file to be created, relative path/absolute path/special path character.

15. The cat command to view the contents of the file.

cat Linux path

Display the entire content of the file directly.

No option, the parameter is required, indicating the file path to be viewed, relative path/absolute path/special path character.

16 more command to view the contents of the file. 

 more Linux paths

Support page turning, if the content of the file is too much, it can be displayed page by page. Use the space bar to turn the page, and the "q" key to exit.

No option, the parameter is required, indicating the file path to be viewed, relative path/absolute path/special path character.

For example, check the system built-in file /etc/services.

 17. cp, mv, rm commands

cp [-r] parameter 1 parameter 2

Used to copy files/folders to a specified location.

-r is used for copying folders , optional.

Parameter 1 and parameter 2 indicate the file/folder to be copied and the file path to copy to, respectively.

mv parameter 1 parameter 2

Used to move files/folders.

File renaming effect can be achieved.

Parameter 1 and parameter 2 indicate the file/folder to be moved and the file path to move to, respectively.

rm [-r -f] parameter 1 parameter 2 ... parameter n

Used to delete files/folders.

-r deletes the folder, -f forces deletion.

The rm command supports the wildcard *, which matches any content. For example, *test matches all content ending with test, test* matches all content beginning with test, and *test* matches all content containing test.

Parameter 1, parameter 2...parameter n respectively represent the path of the deleted file/folder, separated by spaces.

You can use su - root, switch to the root user experience after entering the password, and return to the normal user by entering the exit command.

Never type the rm -rf / or rm -rf /* command under the root administrator user! It is equivalent to formatting the C drive under win.

18. The which command is used to view the program file storage location of a series of commands used.

which command to find

19. The find command is used to search for the specified file.

find start path-name "Find file name" 

You can execute the find command by switching to administrator privileges through the su - root command.

find start path -size +/- n [kMG] "Find file name": Find files according to file size, +/- means greater than and less than, n means size number, kMG means size unit, k means kb, M Means MB, G means GB.

For example, find / -size -10k means to find files smaller than 10kB, and find / -size +100M means to find files larger than 100MB.

20. The grep command filters file lines by keywords. 

grep [-n] keyword file path

-n Optional, used to display the line number of the matching line.

Keywords are suggested to be wrapped in quotation marks.

21. The wc command is used to count the number of lines and words in a file.

wc [-c -l -m -w] file path

-c counts the number of bytes, -l counts the number of lines, -m counts the number of characters, and -w counts the number of words.

22. Pipe symbol |

 Use the result of the command on the left as input to the command on the right.

like,

enter:

[zhouzhou@localhost ~]$ cat test.txt
hello world!
I love Linux.
I love Python.
[zhouzhou@localhost ~]$ cat test.txt | grep "love"    Here, the result on the left side of the pipe symbol is used as the input of the command on the right side , equivalent to grep "love" (cat test.txt)
I love Linux.
I love Python.
[zhouzhou@localhost ~]$ cat test.txt | wc -l
3
[zhouzhou@localhost ~]$ 

Another example,

[zhouzhou@localhost ~]$ ls | grep test
test
test1
test2
test3
test.txt

Pipe characters support nested use.

like,

[zhouzhou@localhost ~]$ cat test.txt | grep love | grep Linux
I love Linux.
Use the first two parts together as the input of the last grep Linux command.

 23. The echo command outputs the specified content in the command line, which has the same meaning as "print".

The output of echo

For complex content, it is best to wrap it in double quotes, which means it is a whole.

Backticks ` (also known as floating signs) are used to execute the enclosed content as a command. For example, echo `pwd` returns the current location.

like,

[zhouzhou@localhost ~]$ echo `pwd`
/home/zhouzhou

24. Redirector

> Overwrites the result of the command on the left to the file specified on the right of the symbol.

>> Appends the results of the command on the left to the file specified on the right of the symbol.

 

25. The tail command is used to view the tail content of the file and track the latest content of the file. 

 tail [-f -num] Linux path

-f means continuous tracking, you can exit the continuous running state through the shortcut key of Ctrl+C .

-num View the number of lines at the end, the default is 10 lines.

Note: The -num here can be directly written as a number , such as tail -5 to display the last 5 lines.

 26. The vi/vim editor is the most classic (command line) text editor in Linux. Among them, vim is an enhanced version of vi, compatible with all commands of vi.

Three working modes:

command mode, input mode, bottom line command mode.

vi/vim file path

Used to edit a new file (when the file does not exist) / edit an existing file (if the file exists).

Commonly used commands: 

 27. Command mode shortcut key:

Reference to the picture above: Chapter 2-13-vi Editor_哔哩哔哩_bilibili 

 28. su - root switch to super administrator.

You can return to the previous user through the exit command.

29. The sudo command temporarily executes commands as root.

sudo other commands

Let ordinary commands have root privileges.

Configure sudo authentication for normal users:

 Switch to the root user, and then enter the following file through the visudo command , and no password command is required for the settings.

 Return to the normal user, and the authenticated user can use the sudo command to create a folder at this time.

 30. Interpretation of ls -l command permissions

-r means read permission (view)

-w means write permission (modify)

-x means execute permission

 31. User group management (Linux can support multiple users, multiple user groups, and users joining multiple groups. The unit of Linux authority control is the user level and user group level.)

The following commands need to be executed under the root user:

① Create a user group

groupadd user group name

② Delete user group

groupdel user group name

 ③ Create a user

useradd [-g -d] username

Among them, -g specifies the user's group. If not specified, a group with the same name will be created and automatically joined; -d specifies the user's home path. If not specified, the home directory defaults to /home/username.

④ Delete user

userdel [-r] username

Among them, -r deletes the user's home directory, and when -r is not used, the home directory remains.

⑤ View the group to which the user belongs

id [username]

View itself when no username is provided.

⑥ Modify the group to which the user belongs

usermod -aG user group username

Add the specified user to the specified user group.

32. The getent command checks which users are in the current system. 

getent passwd

View all user information in the system

getent group

View all group information in the system

The information printed by the system includes 7 parts, namely:

Username: password (X): user ID group ID description information (useless): HOME directory: execution terminal (default bash)

33. The chmod command modifies the permission information of files and folders.

chmod [-R] permission file/folder

-R means to perform the same operation on all files in the folder.

For example, chmod u=rwx, g=rx, o=x hello.txt, where u means user, g means group, and o means other.

The digital serial number of the authority (commonly used 751, which means rwx rx --x, r is recorded as 4, w is recorded as 2, and x is recorded as 1):

 34. The chown command can modify the users and user groups to which files and folders belong. ( This command is only applicable to root user execution )

chown [-R] [user][:][group] file/folder

-R Same as chmod, apply the same rules to all contents of the folder.

: Used to separate users and user groups.

35. Commonly used shortcut keys 

① Ctrl+C Forced stop

② Ctrl+d to log out

③ history View historical commands

④! Command prefix ( without spaces, follow the command directly ), automatically match the previous command

⑤ Ctrl+r Search history commands

⑥ Ctrl+a|e cursor moves to the start/end of the command

⑦ Ctrl+←|→ Jump words left and right

⑧ Ctrl+l or clear to clear the screen

36. CentOS uses the yum manager, and Ubuntu uses the apt manager. 

yum syntax:

yum [-y] [install | remove | search] software name

apt syntax:

apt [-y] [install | remove | search] software name

-y means auto confirm.

install: install.

remove: Uninstall.

search: search.

The yum command requires root privileges, you can switch to root with su, or use sudo privileges.

如,yum -y install wget。

37. The systemctl command controls the startup of built-in/third-party software in the Linux system, and stops the startup from booting. 

systemctl start | stop | status | enable | disable service name

System built-in services such as NetworkManager (main network), network (secondary network), firewalld (firewall), sshd, ssh.

start to start, stop to close, status to view the status, enable to open the boot automatically, disable to turn off the boot automatically.

yum install -y ntp installs ntp software, which can be controlled through the ntpd service name and systemctl.

yum install -y httpd installs the apache server software, which can be controlled through the httpd service name and systemctl.

38. The ln command creates soft links (similar to hyperlinks). 

ln -s parameter 1 parameter 2

-s create a soft link

Parameter 1 The file or folder to be linked

Parameter 2 The location to link to

Guess you like

Origin blog.csdn.net/baidu_41774120/article/details/131641895
Recommended