Linux from scratch learning time in September 2019 9-9.12

Alias Function: configuration file path: / etc / profile ---- configuration variables / environment variables / configuration information alias
      command alias information = 'substitute command information'          
  permanent setting:          
            VI / etc / Input Profile: alias command information = ' Alternatively command information '
        cancel alias:
         a: the configuration file or delete annotations permanently cancel alias ---
         II: --- with the command operation of the unalias alias canceled
         three: the operation command absolute path   
            / usr / bin / rm / oldboy / oldboy01.txt
   four: in front of the alias plus a crowbar \   
  =================================== ================= >>     
    system running file-level
     Linux system run level: / etc / inittab 
             0 run level --- shutdown level poweroff.target
             run a single level --- users run level adaptation to crack the system password rescue.target (rescue mode)
             2 --- multi-user run level to run level no network multi-user.target
             3 run level --- multi-user run level there is a network multi-user.target *** default run level
             4 run level --- reserve / did not use multi-user.target
             run level 5 --- graphical run level graphical.target
             run level --- 6 reboot run level reboot.target
    run level View:
  centos6: runlevel
  centos7: systemctl GET-default
  settings run level information:
  centos6:
  temporary adjustments: init 2 --- configuration to take effect immediately
  permanent adjustments: 
  vi / etc / inittab     
  the above mentioned id: 3: initdefault: --- permanently set to run level must not be set to 0 or 6
  
  centos7:
  systemctl the sET-default TARGET.target
  the SET-default multi-user.target systemctl
========================================= ============ >>
software installation:
    1) yum yum -y install the system --- install tree / download good, it will automatically delete the installation package.
    2) --- binary installation green software after the hard disk installation archive --- decompression can be used directly
 3) rpm to install software --- good software program to download .exe / local premise software packages have been downloaded well
 4) compile and install the software --- flexible installation example download software installation package, any free installation path (custom installation).
===================================== >> ===============
 log file: / var / log
     contains two files in / var / log in: messages: record a program or system operation status information OK / error.
                          : Secure : record user login information.
 brute force password system problems: early detection / address of the specified security policy control to do
 
 the log file to view mode: track ways to view
 tail -f / var / log / secure --- track changes in real-time view file information
 --- displayed before the file header head few lines (the first 10 rows)
 head file information -20    
 tail --- tail / tail lines display file contents (after line 10)
 tail -20 file information
 ===== ================================================ >>
  / proc: collecting server hardware information, hardware information will be recorded to a file
 asset information statistics: hardware information assets
 CPU hardware information:
 CAT / proc / cpuinfo
 Model name: Intel (R) Core (TM) i5-4440 CPU @ 3.10GHz - - displays CPU information
 processor: 0 --- displaying information on the number of CPU cores
    physical id: 0 --- large ones display CPU information (number of stars)
    the CPU MHz: 3092.869 --- display CPU clock speed
 grep -c processor / proc / cpuinfo --- shows the total number of CPU cores server
                                   --- CPU shows the total number of stars server
 lscpu
    Architecture: the x86_64
    CPU-OP MODE (S): 'bit-32, 64' bit-
 CPU (s): 4 --- CPU core number
 core (s) per socket: 2 --- each CPU core
    Socket (s): 2 --- display server has few CPU      
 
 memory hardware information
 CAT / proc / meminfo
    MemTotal : 2028116 kB --- total memory size
    MemFree: 1729172 kB --- free memory capacity
    MemAvailable: 1705828 kB --- available memory capacity *****
    buffers: 2076 kB --- write data buffer capacity use
    cached: 91148 kB --- read data buffer capacity use
   
 [root@oldboyedu ~]# free -h
              total        used        free      shared  buff/cache   available
    Mem:           1.9G        140M        1.6G        9.5M        151M        1.6G
    Swap:          1.5G          0B        1.5G
 Disk hardware information
 cat / proc / mounts --- see the system disk partition mounted case
 / dev / sda1 / boot xfs rw , seclabel, relatime, attr2, inode64, noquota 0 0
 storage device file system mount point type parameter information
 
 [root @oldboyedu ~] # df -h --- partition capacity usage information, and
    the Filesystem Size used Avail the use% Mounted ON
    / dev / 2% sda3 99G 97G 1.6G /
    devtmpfs 980M 0 980M 0% / dev
    tmpfs 991M 0 0 991M % / dev / SHM
    tmpfs 991M 9.6M 981m. 1% / RUN
    tmpfs 991M 0 991M 0% / SYS / FS / a cgroup
    / dev / sda1 197M 105M 93M 54 is% / Boot
    tmpfs 199M 0 199M 0% / RUN / User / 0
 
 system load: the more recognized CPU task, the higher the load
 CAT # / proc / loadavg
    0.00 0.01 0.05 load value <= total number of server core the CPU   
 01 02 03
 01. The average case load per minute
 02. Every five minutes, the average load
 03. average load balanced every 15 minutes
 
 w
 the Load Average: 0.00, 0.01, 0.05
    The averages for System Load The Past. 1,. 5, and 15 minutes.
 
 ================================================== ==== >>
 optimization:
 1) the user
       create a user under a super user: useradd to create a username and password: passwd username
       b modify user password (free interaction): - stdin echo "123456" | passwd --stdin useradd
    b2 set the password by ordinary users:
        requirements: the need for special symbols need case-sensitive digits in length....
       C switch user: --- su - user (user switching is not needed in Supervisor mode switch directly, if contrary to other users or superuser password required)
       d see if the user is successfully created: --- id user name plus
   
2) system command prompt
       a: environment variables: PS1 = [\ U @ \ H \ W] \ $
               [\ U @ \ H \ W] \ $
               [root @ oldboyedu ~] #
            \ U --- login information system user name
            \ h --- display system host name information (abbreviated display)
            \ H --- display system host name information ( full display)
            \ W --- shows the current location path information (abbreviated display)
            \ w --- shows the current path location information (full display)
            \ $ --- display command prompt information
             # root user login
  b: color
            \ [\ e [32; 1m \] start to add color specifying information
            \ [\ e [0m \] colored working end
               export PS1 = '\ [\ e [30; 1m \] [\ u @ \ h \ W] \\ $ \ [\ e [0m \ ] ' gray
                export PS1 =' \ [\ e [31; 1m \] [\ u @ \ h \ W] \\ $ \ [\ e [0m \] ' gray
               export PS1 = '\ [\ e [32; 1m \] [\ u @ \ h \ W] \\ $ \ [\ e [0m \]' forgive green color
               export PS1 = '\ [\ e [33; 1m \] [ \ u @ \ h \ W] \\ $ \ [\ e [0m \] ' yellow
               export PS1 =' \ [\ e [34; 1m \] [\ u @ \ h \ W] \\ $ \ [\ e [0m \] 'blue
               export PS1 =' \ [\ e [35; 0m 1m \] [\ u @ \ h \ W] \\ $ \ [\ e [\] ' purple
               export PS1 = '\ [\ e [36; 1m \] [\ u @ \ h \ W] \\ $ \ [\ e [0m \]' blue
               export PS1 = '\ [\ e [37; 1m \] [\ u @ \ h \ W] \\ $ \ [\ e [0m \] ' white  
   
   
3) yum source:
       a plurality of access aliyun image optimization is started warehouse base (Linux based system) of two optimization EPEL
    b obtain yum command in the source file has the help in
       base: linux system infrastructure software
            curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos -7.repo
          epel: Extra Packages for Enterprise Linux Enterprise linux package extra
            curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
    c centos7 popular software download package
       yum install -y vim wget nET-tools SL cowsay the Telnet bash-Completion Tree lrzsz
     vim - an upgraded version of vi commands, edit the file information
    wget - download files or software to download information tools for
    net-tools - network-related Kit
    telnet - test network service port is normal
    bash-completion --- let systemctl behind parameter information with a complete feature
    lrzsz - the windows linux host data can be uploaded to the system rz -y
                    the linux host data can be downloaded to the windows system -y sz
       
    SL - funny
    cowsay "content" - funny
4) Firewall:
    Role: Configuring Security Policy
    service status: enabled by default
    optimization: Shut down the server
    operation:
     first check whether the service is turned on:
         centos6
            /etc/init.d/iptables Status
            centos7
            systemctl Status firewalld.service
    temporarily closed: systemctl stop firewalld. service
        open: systemctl start firewalld.service
    permanently closed: systemctl disable firewalld.service
        open: systemctl enable firewalld.service  
    SELinux security program optimization:
        role: to limit the root user the ability to
        check the service status: getenforce
         Enforcing --- open state   
    temporarily closed: root @ oldboyedu scripts] # setenforce
             Usage: setenforce [Enforcing | Permissive | 1 | 0]
             [root @ oldboyedu scripts] # setenforce 0
    permanently closed:
     Method One: vim edits    
           vim / etc / SELinux / config
        SELINUX = Disabled
        Method Two: sed command to edit the file
     sed -i 'S = enforcing the SELINUX # # # Disabled the SELINUX = G' / etc / SELinux / config 
. 5) system character: What character: UTF-8 is supported both Chinese GBK Showing
    role Description: Chinese information may be displayed to avoid distortion
    modified character:
        centos6:
         temporary modified:
         Export LANG = en_US.GBK
         permanent modification: 
         vim / etc / sysconfig / i18n
         LANG = "en_US.GBK"
        
         centos7:
         temporary modifications: the environment variable LANG
         export LANG = en_US.GBK
         permanent changes:
         Method a:
         Vim / etc / Profile
         export LANG = en_US.GBK
         Method two:
         CAT /etc/locale.conf
            the LANG = "en_US.GBK"
        
         a command to change the character encoding:
         localectl the locale-SET = the LANG ". 8-the en_US.UTF" 
. 6) system time:
   View time: date                  
   modification method:
        automatically synchronize the time information:
     the time zone information provided 
       timedatectl set-timezone Asia / Shanghai
     open network time synchronization
       timedatectl set-ntp 1
     enable time synchronization service
       systemctl status chronyd.service
     
     manually synchronize the system time:
       yum the install the ntpdate -Y
       ntpdate ntp1.aliyun.com  

Guess you like

Origin www.cnblogs.com/3237sd/p/11517616.html