2019.8.5

review

     All IT knowledge is the time to rely on the OSI model (TCP / IP four);
     protocol :( provisions)
     application layer protocols: http https (B / S) ssh smtp pop3 imap ftp tftp dns dhcp telnet
     transport layer: tcp udp - port
     network layer: routing protocol is a routing protocol (IPv4 IPv6) xxxx
     data link layer: Ethernet protocol ff the MAC: ff: ff: ff: ff: ff: ff globally unique
     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 in Linux ] must be mounted on the system
     umount device to be hung in / mount point
     DF -H
     / etc / fstab achieve power automatic loading

     / / bin / sbin
     / etc
     / usr / usr / local /
     / var
     / opt
     / SYS / proc
     / tmp
     / lib / lib64
     / Home / root
     / cdrom / Media / mnt

   Common command on the directory file operations:
                                       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, grouping \ (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 modification timestamp stat (atime mtime ctime), if the file is not created the file
            -C
            format of time: MMDDhhmm [CC] YY.ss
            Top -> see the process [CPU: sy ur ]
           -a
            Rm of
           * * [range] Find -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). move files

                             (2) Modify the file name
           mv ab
           mv / tmp / A / root /
           filename extension
           {}
           to create a directory name _ Student ID Zhao _00001
            mkdir {Zhao, Shi Lei} _ {00001,00002}
            Zhao _00001
            Zhao _00002
            Benji _00001
            Benji _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 // 20 -n filename simplify tail: -20
        * -f * not exit the file, real-time view file contents
         head view of the line
         -n 20 filename simplify // head -n: -20

   4、其他
        Echo -e -n
        echo $PATH
        -n // print("Hello World",end='\t') print("Hello World")
        print("Hello World")
        -e 识别 \t \n \r
        echo -n -e "Hello World \t"


  Redirect> and >>

          fd file identifier

          0 - standard input

          1 - Standard Output

          2 - error output

              Program instructions = data +

                         Code variables

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

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


   Output redirection:

                 > Work can not be used to remove this feature set -C redirect the default cover,

                            At the same time> | can be forced to redirect (set + C to open cover redirection)

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

   Extended :
            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 stored execution state

            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 (/ dev / null) empty file

             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

                   << The multi-line input simultaneously with the cat command

                   cat >> file << EOF

                   >a

                  >EOF

 

  Error output redirection:

                      2> need to bring FD (file identifier)

                      >> 2 additional error output redirection

        Extended Optimization:

                      cat a.txt > /dev/null

                      2 a.txt CAT> / dev / null
        &> / dev / null command executed whether correct or not, will be assigned to the content output / dev / null

        & >> [Trivial File] 

   pipeline:

          command 1 | comand 2 | command 3 | command 4 | .........

          Preceding command execution result, and outputs to later perform a name;

                  [Linux idea: combine a small function, perform complex functions]  

          tail -7 /etc/fstab | cut -d' ' -f1

          cut cut

         -d specified delimiter '

          1,3 -f 1 taken column 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

           Ruoguo, 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

                  address 192.168.94.10

                  netmask 255.255.255.0

                  gateway 192.168.94.1


       2, remote management mechanism

                Ssh ssh port open Ubuntu's monitoring function; tcp-22

                netstat -tnl // t - tcp protocol n - not parse

               If no: apt install openssh-server -y

         /etc/init.d/ssh start

             [Ubuntu default can only use ordinary users to connect remotely]

               ssh [email protected]

               Under centos, directly from the root user can log on remotely;

               ssh [email protected]

              No remote login password

                 

 


        

Guess you like

Origin www.cnblogs.com/liyuanyuan97/p/11305237.html