August 5th class notes

 All IT knowledge is the time to rely on the OSI model (TCP / IP four);

 :( agreement provisions)

 Application layer protocol: http https (B / S) ssh telnet smtp pop3 imap ftp tftp dns dhcp

 Transport Layer: tcp udp - port  

Network layer: routing protocol is a routing protocol (IPv4 IPv6) xxxx

 Data Link Layer: Ethernet protocol MAC ff: ff: ff: ff: ff: ff: ff the world's only  

The physical layer: an electrical signal 01

 Linux directory structure

  Linux disk management fdisk - partition (logical boundary) writing to the file system;

-l disk naming mkfs -t // Specify the file system format;

  mount To mount the device mount point [Storage Device must be mounted on a Linux system]

  to hang in the apparatus umount / mount point  

 df -h / etc / fstab achieve power automatically mount  

 /     /bin  /sbin         /etc         /usr    /usr/local/         /var        /opt        /sys  /proc        /tmp        /lib  /lib64        /home /root        /cdrom  /media  /mnt

 Common file operations on the directory command:

      ls file wildcard globbing * [] ^ $ cd .. ~ -?. absolute path and relative path   

    grep regular expressions

1, the string matching [] [^]. [: Digit:] [: alpha:] ...

2, the number of matching *? \ {M \} \ {m, n \} \ {0, n \} \ {m, \} 

3, the position of the anchor ^ $ \ b <\ \ b /> 

4, packet \ (ab \) * abababab ab * abbbbb * -v -i ^ $ - blank line mkdir -pv also create multi-level sub-directory rm -r rmdir to delete empty directories tree -L -d

File-related commands

1, create, and delete operations

 Touch touch the modification timestamp stat (atime mtime ctime), if the file is not created the file -C MMDDhhmm [CC] YY.ss top

-> View process [CPU: sy ur] -a Rm * find * [range] -file d -name a * [File Properties] -exec command {} \; -ok command {} \; | xargs command;   

 Mkdir -pv  

  2, copy and move files

 Cp -a // carry a copy of all file attributes Mv move 1, 2 move files, modify the file name mv ab mv / tmp / a / root / filename extension {} to create a directory name _ Student ID _00001 mkdir {Zhao Zhao, }} _ {00001,00002 Lei Zhao Zhao _00002 _00001 _00001 Lei Lei _00002

3, view the file contents

 Cat-time view of all file contents cat /etc/init.d/ More // man command /? Q Less in more clear view large files, we use less Tail default view countdown 10 lines -n // tail -n 20 filename simplify: -20 * -f * not exit the file, real-time view file contents head view of the line -n ​​20 filename simplify // head -n: -20

4. Other

 Echo

  -e -n   echo $PATH

  -n   // print("Hello World",end='\t')  print("Hello World")     

   print("Hello World")  

 identifying -e \ t \ n \ r echo -n -e "Hello World \ t" redirect> >> fd file identifier and 0 - Standard Input 1 - Standard Output 2 - error output

  = + Program instruction data tag variable

  Variable inside the data come from? Code execution and data output to where?   

  States: the default standard input - output standard keyboard - is used to change the display redirected input and output;   

  Output redirection> work can not be used to remove this feature set -C redirect the default coverage, while> | can be forced redirection (set + C redirection cover open)

   >> append redirection in the original file, additional data can be added;

 Extension: In Linux, in addition to the default output command output, it also returns the result of a command execution state;

0 is returned for the command is executed successfully, and returns non-0 is a failure;? $ Name on a store execution status results;

  At work, we often do not need the results of the command output, but only command execution state, we will use the redirect will redirect the output to a file empty

(/dev/null)   cat a.txt > /dev/null

  Input redirection  

  <The back of the document, the previous command to be executed;  

  tr command, the foregoing is replaced with the content of the latter  

   tr abc ABC <a.txt << to multiple lines simultaneously input, the command is used in cat cat >> File << EOF> a> EOF

  Error Output Redirection   

 2> need to bring FD (file identifier)    

>> 2 additional error redirect output expansion optimization: cat a.txt> / dev / null cat a.txt 2> / dev / null &> / dev / null command execution, whether correct or not, will be assigned to output content / dev / null & >> [Trivial file] pipe command 1 | comand 2 | command 3 | command 4 | ......... results of the execution of the preceding command output to a later named performed; 

 [Linux Thought: binding of small features, perform complex function] tail -7 / etc / fstab | cut -d '' -f1 cut cut separator specified -d '' -f 1 taken column 3 1-3

Linux Remote

1, view or configure the network card information

Ethernet and IP addresses

 ifconfig Without this command, we need to install the network tools package (net-tools) apt install net-tools

If the card is not up, we need to modify the default network card configuration file; / etc / network / interfaces vim / etc / network / interfaces  

 1, dynamic - dhcp auto eth0 iface eth0 inet dhcp [modify the configuration file, you need to restart the service] /etc/init.d/networking restart  

 2, static - to manually configure the address 192.168.94.10 netmask 255.255.255.0 gateway 192.168.94.1 

2, remote management mechanism Ssh open Ubuntu's ssh port monitoring function;

tcp-22 netstat -tnl // t - tcp Protocol n - is not resolved   

If no: apt install openssh-server -y /etc/init.d/ssh start [Ubuntu default can only use ordinary users to connect remotely]  

Under ssh [email protected] centos, directly from the root user can remotely log; ssh [email protected]

   

                          

Guess you like

Origin www.cnblogs.com/yutianqi0704/p/11305090.html