Key review notes at the end of the "Linux System and Application"

It's not easy to organize, please like and follow~

Chapter 1 Linux Overview and Installation

1. The characteristics of Linux system: multi-user multi-tasking, open source, security, stability

2. The difference between the Linux kernel version and the distribution version

(1) The kernel version only has the Linux kernel part. After installation, there is no user interface or software

(2) The release version is based on the kernel version, adding user interface and various software, such as Ubuntu, CenterOS, etc.

3. The meaning of the kernel version number 2.6.18-164.el5-x86_64:

"2": major version number

"6": Minor version number, an even number indicates a stable version, and an odd number indicates a version under development

"18": revision number, indicating the number of revisions

4. When installing the Linux system, there must be two partitions: Swap swap partition (swap internal and external villages, storing temporarily unused data in memory) and root partition/

Chapter 2 Linux Graphical Interface and Command Interface

5. Two working interfaces of Linux

(1) Graphical interface: X-Window is a graphical interface protocol for Linux, and GNOME is a desktop environment based on X-Window.

(2) Command line character terminal interface: the preferred method for Linux system configuration and management (Ctrl+Alt+F1~F6 enters the character terminal interface, Ctrl+Alt+F7 exits the character terminal interface)

6.7 operating levels of Linux (init 0 ~ init 6)

init 0: stop running, all processes are terminated, and the system is shut down (cannot be set to initdefault)

init 1: single-user mode, used to maintain the system

init 2: multi-user mode, but the NFS service is not started

init 3: Complete multi-user mode, enter the character terminal interface

init 5: complete multi-user mode, enter the graphical interface

init 6: Reboot the computer (cannot be set to initdefault)

runlevel: Display the current system run level

7. Shut down and restart the system command

shutdown -h now or halt immediately shut down the system

shutdown -h 45 shut down the system after 45 minutes

shutdown -r now or reboot immediately restart

halt -h shut down the computer without powering off

halt -p shut down the computer and power off

8. Help command

man ls displays the man manual for the ls command

mkdir --help If the command name is a letter help followed by a dash, a word help preceded by two dashes

info shutdown Display shutdown command help information

9. Find the location of the command

whereis mkdir Find the location of the mkdir command

10. Usage of the pipeline "|" in the shell (the pipeline can use the output information of a certain command as the input of a certain command)

ls /bin | grep bz Find files with bz in the bin directory

11. Usage of redirection in shell

(1) Output redirection: ls /boot > /root/abc Save the contents of /boot to /root/abc

(2) Input redirection: cat < /root/abc takes the content of /root/abc as the input of the cat command and executes it

(3) Error redirection: cat /root/kk 2> /root/abc Save the error information of the cat command to /root/abc

(4) Append redirection: echo bbb >> /root/abc Append the output of the echo command to /root/abc

(5) Realize output and error redirection: ls /nn &> /root/abc save the output information and error information of the ls command to /root/abc

12. (1) View the Linux kernel version command: uname -a

(2) Display the release number of the operating system: uname -r

13. List all commands entered in history: history

14. Auto-completion: Tab key

15. (1) Standard input device file descriptor: 0 or stdin

(2) Standard output device file descriptor: 1 or stdout

Lecture 3 File Management and Common Commands

16. Five different file types and their symbolic representations in Linux

(Use ls -lh or ll command to view file attributes)

(1) Ordinary files: "-rw-r–r–" the first symbol is "-"

(2) Directory file: the first symbol of "drwxr-xr-x" is "d"

(3) Link file: "lrw-r–r–" the first symbol is "l" (soft link)

(4) Device file: "brw-r–r–" the first symbol is "b" is a block device file, "c" is a character device file

(5) Pipeline file: "prw-r–r–" the first character is "p"

17. What are the two types of link files?

hard link and soft link

18. Path symbols

. represents the current directory

… indicates the upper level directory

/ represents the root directory

19. The purpose of common directories

/bin Stores programs necessary for users and the system

/boot stores the Linux kernel image

/root system administrator's home directory

/mnt Mount subdirectories of other devices

/dev stores all device files

/etc stores most of the system configuration files

/home Default home directory for new users created

20. Common commands for directory and file operations

(1) ls -a displays all files in the directory (including hidden files)

(2) ls -l displays the detailed information of the files in the directory

(3) grep -in 'grub' [fileName] matches characters in the file, -i means case insensitive, -n means the line number of the output line

(4) more [fileName] display text files in pages

(5) head -n [fileName] displays the first n lines of the file

(6) tail -n [fileName] displays the last n lines

(7) find /boot -name grub Find the file named grub in the /boot directory

(8) find /etc -ctime 3 Find files updated in the last 3 days in /etc and its subdirectories

(9) wc -l [fileName] counts the number of lines in the file

(10) cp -r [srcDir] [dstDir] recursively copy all the contents of srcDir and its subdirectories to dstDIr

(11) mv [srcFile/Dir] [dstFile/Dir] is used to rename or move

(12) rm [fileName] delete file

(13) rm -rf [dir] delete non-empty directories

(14) mkdir -p [dir] create directories recursively

(15) touch [fileName] to create an empty file

(16) cd~ or cd to enter the current user home directory

(17) cd- Return to the directory of the last operation

(18) cat -n hello.c View hello.c and display the line number

21. Show calendar command

(1) cal 2022 displays the 2022 calendar

(2) cal 5 2022 displays the calendar for May 2022

(3) cal -jy displays this year's calendar with the number of days from January 1

22. Send information to all logged-in users

wall ‘hello’

23. File or directory permission modification command

(1) Text setting method

chmod a+w /root/abc All users add write permission to the abc file

chmod or /root/abc Other users delete the read permission for the abc file

u: user user, the owner of the file or directory

g: same group user group

o: other users other

r: read permission

w: write permission

x: Execute permissions

(2) Digital setting method

The options need to be filled with three digits, starting from the first one, indicating the permissions of user, group and other users respectively.

0 means no permission, 1 means execute permission, 2 means write permission, 4 means read permission, and two or more will add them

For example, the command chmod 740 hello.c For the hello.c file, the user user has all permissions, the group user only has read permission, and the other user has no permission

24. tar decompression command

tar -zxvf hello.tar.gz -C /home Unzip hello.tar.gz to the home directory

Chapter 4 User and User Group Management

25. Three types of users and functions of Linux system

(1) Root user (root): Linux's built-in user with the highest authority

(2) Ordinary user: Created by the system administrator, able to log in to the system, with limited authority

(3) Virtual users: used to complete specific tasks but do not have the ability to log in to the system

26. User Account Profiles

(1) /etc/passwd: Record all user accounts and related information

(2) /etc/shadow: user shadow file, save user password and related information (such as account validity period)

27. User and user group management commands

(1) useradd -d /home/serein serein Create user serein and set the home directory to /home/serein

(2) userdel -r serein deletes all files in user serein and its home directory

(3) usermod -l wanfeng serein Modify the login name of user serein to wanfeng

(4) usermod -g mygroup serein Modify the group of user serein to mygroup

(5) usermod -Ga mygroup serein will add user serein to the mygroup group

Chapter 5 Disk and File System Management

28. Linux hard disk partition type and partition naming

There are three types of hard disk partitions: primary partition, extended partition and logical partition.

The naming rule is hdXY: hd means IDE hard disk; sd means SCSI hard disk, X is a lowercase letter, Y is a number; devices of the same type are numbered from the character a, a means the first hard disk, b means the second hard disk...

29. A Linux system disk can have up to 4 primary partitions

30. Hard disk partition command

Subcommands under the fdisk interface

(1) l: the partition type supported by the printing system

(2) m: print fdisk help information menu

(3) n: create a new partition

(4) t: Change the type number of the partition

(5) w: save and exit

31. Create file system command

mkfs -c /dev/sda2 Check the device for bad blocks

mkfs -t ext3 /dev/sda2 Create ext3 file system

32. Mount the file system

mount -t ext3 /dev/sda2 /mnt/kk Mount the hard disk partition sda2 to the kk directory

33. The method of setting the automatic mount file system after booting: modify the /etc/fstab file

34. Combining disk and file system management commands, describe the general usage steps of a new disk

(1) The fdisk command partitions the disk

(2) mkfs command to create a file system

(3) The mount command mounts the hard disk partition

Lecture 6 Linux Daily Management and Maintenance

35. View system process information command: ps -aux

36. Terminate a foreground process: Ctrl+C key

37. Terminate a background process: kill -9 PID

38. Let a process run in the background: add "&" after the command

39. (1) The background process is transferred to the foreground: fg

(2) The foreground process is transferred to the background: bg

40. Periodically automated commands: crontab

Chapter 7 and Chapter 8 Shell Programming

41. The content of the first line of the shell script

#!/bin/bash

42. Three ways to execute shell scripts

(1) hello.sh is executed directly (executable permission is required)

(2) sh hello.sh Use the sh command (if the shell of the root user is /bin/bash, use the bash command)

(3) source hello.sh or .hello.sh use source command or point command

43. Shell system variables

(1) $0 The name of the current program

(2) $? The return value of the previous command or function, 0 means success, non-zero means failure

(3) $# The total number of command line parameters, excluding the program name

(4) $n nth parameter

(5) $* saves all parameters in the form of "parameter 1 parameter 2 ...", that is, the value of all command line parameters

44. Branch structure test The judgment of the user's integer value and string, if the expression is true, return 0, and return 1 if false

(1) Integer judgment: -lt (less than), -le (less than or equal to), -gt (greater than), -ge (greater than or equal to)

-eq (equal), -ne (not equal)

For example: test 3 -lt 4 to determine whether 3 is less than 4

(2) String judgment: = (equal), != (not equal), -z str (return true if the length of str is 0), -n str (return true if the length of str is not 0)

(3) Logical judgment: -a (logic and), -o (logic or), ! (logic not)

(4) File judgment: -f file (if the file exists and is an ordinary file)

For example: test $a -eq 0 -a $b -eq 0 to determine whether variable a and variable b are both equal to 0

45. The rule for using square brackets to express test conditions is that there must be spaces on both sides of the square brackets

[ $a -eq 0 -a $b -eq 0 ]

46. ​​The role of single quotes, double quotes, back quotes, and backslashes

(1)': The content enclosed by single quotation marks appears as ordinary characters

(2)": Characters enclosed by double quotes, $, back quotes and backslashes retain special functions, and the rest of the characters are not treated as ordinary characters

(3)`: Backticks are used for command substitution, and the enclosed string is interpreted as a command and converted to its standard output

The results

(4) \: escape character

example:

echo “My current directory is pwd and logname is $LOGNAME”

输出My current directory is /root and logname is root

echo “My current directory is pwd and logname is $LOGNAME”

输出My current directory is /root and logname is $LOGNAME

echo ‘My current directory is pwd and logname is $LOGNAME’

输出My current directory is pwd and logname is $LOGNAME

47.if statement structure

if judgment condition 1

then …

elif judgment condition 2

then …

else …

fi

48. for statement

for loop variable name in variable list

do

​ …

done

49. The echo command prompts the user

echo -ne -e interprets \ escape characters, -n suppresses newlines

50. Variable definition, assignment, calculation

(1) String variable definition (assignment is definition): season=Winter There can be no spaces on both sides of the equal sign

(2) Integer variable definition: declare -ia=5

(3) Integer variable operation: declare -ic= a + a+a + b orc = c=c=[ a + a+ a+b]

(4) Array variable definition: declare -a arr=(abc)

51. Print the ninety-nine multiplication table shell program

\#!/bin/bash

for i in `seq 1 9`

do  

	for j in `seq 1 9`  

	do    

		echo $i x $j = $[$i*$j]    

	done

done

Add executable permissions for script programs: chmod a+x jiujiu.sh or chmod 111 jiujiu.sh

Run the script: ./jiujiu.sh or source jiujiu.sh

Chapter 9 Basic Network Configuration and Network Security

52. Network configuration file

(1) /etc/network/interfaces: network card configuration file

(2) /etc/resolv.conf: DNS configuration file (specify DNS domain name resolver)

53. Network configuration command ifconfig

(1) ifconfig eth0 192.168.1.1 netmask 255.255.255.0 up Configure the IP address and subnet mask of the network card eth0, and activate the device at the same time

54. Routing configuration command route

route add -net 192.168.20.0/24 gw 192.168.10.1 dev eth0 Add a route to the eth0 network card

55. Firewall configuration commands

(1) ufw enable to open the firewall

(2) ufw disable turn off the firewall

(3) ufw allow/deny port open/close port port

56. Service restart command

service vsftpd restart or /etc/init.d/vsftpd restart

Chapter Ten and Eleven Server Configuration

57. OpenSSH server for remote connections

58. NFS server is a network file system for file sharing

Chapter 12 C++ Integrated Development Environment

59. Working steps of make command

(1) Look for files named GNUmakefile, makefile, Makefile in the current directory, and explain this file if found

(2) Read the files contained in the makefile in the working directory using "include" in sequence

(3) Rebuild the rules of all Makefiles that have been read

(4) Initialize variable values ​​in the Makefile

(5) overthrow the implicit rules

(6) Establish a dependency list according to the dependencies of the ultimate goal and other goals

(7) Rules for executing all goals except the ultimate goal

(8) Rules for implementing the ultimate goal

60. If @ is added before the command in the makefile, the command itself will not be displayed, only the result will be displayed

Chapter 13 Linux Kernel Boot Loading

61. Linux kernel bootloading and initialization process

(1) Load the BIOS

(2) Read MBR

(3) Load the second part of Grub and boot/grub/grub.cfg

(4) Load the kernel and decompress and mount the initrd file system

(5) Set the operation level according to the rc-sysinit.conf file

(6) The init process executes /etc/init.d/rc

(7) Start the kernel module

(8) Execute script programs rc0.d~rc6.d of different operation levels

(9) Execute custom script /etc/rc.local

(10) Execute the /bin/login program to enter the login state

Guess you like

Origin blog.csdn.net/Dae_Lzh/article/details/125320747