First Week Work

  1. List the Linux releases in series and describe the connections and differences between the different releases.


    In the general direction, as shown in the following figure, the distribution is divided into several categories: Debian,RedHat,Arch,SUSE, and others
    Based on these categories, there will be many different distribution versions for different areas, each with its own advantages and disadvantages.

    Below is a list of the most popular releases from the last 12 months to the last month
    Here is an overview of the features of the different releases:

    --- redhat    Red Hat Enterprise Linux (RHEL)   The most popular commercial supported Linux distribution. Because of its dedicated support services and updates, it is often used as a server platform by enterprise organizations. Subscription fees required, software installation management using RPM and YUM, acquired by IBM in July 2019
    --- CentOS   CentOS Linux is a derivation of RHEL. It uses all RHEL source code   No additional subscription fees need to be paid for support. To get support, you must rely on the developer community of CentOS, and many other distributions originate from RHEL, such as Scientific Linux and Oracle Linux. Unlike entOS, these distributions are not copies of RHEL. These distributions use RHEL's source code as the underlying platform and build their distributions.
    --- Fedora    The Fedora project is sponsored by RHEL. Red Hat uses Fedora as a test site to test its new capabilities. Many of the features introduced in Fedora typically enter new versions of RHEL. Red Hat does not provide any support for Fedora Linux. To get support, you have to rely on the volunteer community    Since Fedora is a test platform, it should not be used commercially
    ---   SUSE Linux    After Red Hat Enterprise Linux, SUSE is the next stable and popular enterprise Linux for servers and mainframes. SUSE is developed and maintained by SUSE Software Solutions (Germany). You do not have to pay SUSE to install, test, and use SUSE Linux. However, if you need support and updates, you must purchase a paid subscription. SUSE Linux for enterprise-sized networks
    --- Debian   Debian Linux is a free community-based Linux distribution. It is developed, managed, distributed and updated by the largest volunteer community. This project was started in 1993 and the dpkg packaging system is used for software installation and management. Debian Linux is a good choice if you want a completely free Linux. The Debian release is free, open and focused on delivering what users want. Several popular Linux distributions are derived from Debian Linux. Another major reason to choose this release is that it has the largest collection of packages in its pool. It contains over 59000 software packages, and the precompiled software is bundled together in a good format for easy installation on your machine.
    --- Ubuntu    Ubuntu has changed this trend by providing a Windows-like GUI environment and tools. Soon after its release, Ubuntu became the most popular and used Linux distribution. If you're looking for easy-to-use, free Linux, Ubuntu should be your first choice.
    - gentoo linux   It is also a community-based Linux release. The main feature of this distribution is that it allows us to compile the entire Linux from the source code on our computer. We can customize every option and application that fits our hardware platform and meets our requirements. If you are a Linux developer or advanced user and need a Linux that only contains what you want, this is the perfect choice.
    ---   Arch Linux is a lightweight and flexible distribution. This release only contains basic and stable versions of the software. If you have an old system and need a lightweight Linux distribution, this is the perfect choice
    ---   Kali Linux is also based on Debian Linux. This Linux is primarily tailored to test the security of networks and systems. This release comes with many tools for hacking, cracking, and testing network and Web applications.


    Which distribution should you choose?

    There are no predefined rules for selecting a specific distribution. You should choose a distribution that meets your requirements, skills, and budget. However, my broad recommendation is that you choose a Red Hat-derived distribution for enterprise-sized networks or large networks, and a Ubuntu-derived distribution for personal use or for small and medium-sized networks.


  2. Install the Centos7.9 and ubuntu operating systems, create a username with your own name, and log in normally. Take a screenshot of the main steps.

  3.   Configure environment variables so you can see when the command is executed when executing history

      export HISTTIMEFORMAT="%F %T "

  4. Summarize the philosophy of Linux.
      Everything is a file (including hardware)
      Small, single-purpose program
      Link programs to accomplish complex tasks together
      Avoid confusing user interfaces
      Configuration data is stored in text

  5. Summarizes common command formats used on Linux and illustrates them with examples. Commands such as echo, screen, date, ifconfig, export, and so on

        Echo (option) (parameter)

        - n No Line Break Display

[root@localhost ~]# echo -n 123

       \\     backslash

[root@localhost ~]# echo \\test

       \b     backspace

[root@localhost ~]# echo -e "ab\bc"

       \c     produce no further output

[root@localhost ~]# echo -e "ab\ccdec"

       \e     escape

ab[root@localhost ~]# echo -e "ab\ecdef"

       \f     form feed

[root@localhost ~]# echo -e "12\f345"

       \n     new line

[root@localhost ~]# echo -e "12\n345"

       \r     carriage return

[root@localhost ~]# echo -e "12\r345"

       \t     horizontal tab

[root@localhost ~]# echo -e "12\t345"
12      345

       \v     vertical tab

[root@localhost ~]# echo -e "12\v345"


       screen [ -options ] [ cmd [ args ] ]
       screen -r [[pid.]tty[.host]]
       screen -r sessionowner/[[pid.]tty[.host]]



[root@localhost ~]# date
Mon Oct 25 00:46:17 +08 2021

date -u

[root@localhost ~]# date -u
Sun Oct 24 16:46:48 UTC 2021

date +%"

[root@localhost ~]# date +%d
[root@localhost ~]# date +%a
[root@localhost ~]# date +%A
[root@localhost ~]# date +%h
[root@localhost ~]# date +%b
[root@localhost ~]# date +%B
[root@localhost ~]# date +%m
[root@localhost ~]# date +%y
[root@localhost ~]# date +%Y
[root@localhost ~]# date +%T
[root@localhost ~]# date +%H
[root@localhost ~]# date +%M
[root@localhost ~]# date +%S
[root@localhost ~]#


date --date="past or future"

[root@localhost ~]# date --date="-5year"
Tue Oct 25 00:51:36 +08 2016
[root@localhost ~]# date --date="+1 year"
Tue Oct 25 00:51:45 +08 2022
[root@localhost ~]# date --date="+20 minute"
Mon Oct 25 01:12:09 +08 2021
[root@localhost ~]# date --date="tomorrow"
Tue Oct 26 00:52:23 +08 2021
[root@localhost ~]#

date --set

[root@localhost ~]# date --set "10/27/1988 12:30:00"
Thu Oct 27 12:30:00 +08 1988



-a View all interfaces

[root@localhost ~]# ifconfig -a
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet  netmask  broadcast
        inet6 fe80::88fa:3ca9:8d8a:21b  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:75:7e:aa  txqueuelen 1000  (Ethernet)
        RX packets 17806  bytes 21070483 (20.0 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3731  bytes 360797 (352.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet  netmask
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

up enabled

[root@localhost ~]#ifconfig ens33 up

down Disabled

[root@localhost ~]#ifconfig ens33 down

"ip address" set ip address broadcast set gateway netmask set subnet mask

[root@localhost ~]#ifconfig ens33 netmask broadcast

Export (option) (parameter)

-f: stands for the name of the function in [variable name];
-n: Deletes the specified variable. The variable is not actually deleted, but is not exported to the execution environment of subsequent instructions;
-p: Lists all environment variables that the shell assigns to the program.
[root@localhost /]# export -p
declare -x HISTCONTROL="ignoredups"
declare -x HISTSIZE="1000"
declare -x HOME="/root"
declare -x HOSTNAME="localhost.localdomain"
declare -x LANG="en_CA.UTF-8"
declare -x LESSOPEN="||/usr/bin/ %s"
declare -x LOGNAME="root"
declare -x LS_COLORS="rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36:"
declare -x MAIL="/var/spool/mail/root"
declare -x OLDPWD="/root"
declare -x PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin"
declare -x PWD="/"
declare -x SHELL="/bin/bash"
declare -x SHLVL="1"
declare -x SSH_CLIENT=" 3116 22"
declare -x SSH_CONNECTION=" 3116 22"
declare -x SSH_TTY="/dev/pts/0"
declare -x TERM="xterm"
declare -x USER="root"
declare -x XDG_RUNTIME_DIR="/run/user/0"
declare -x XDG_SESSION_ID="3"

6. Describe the system catalog naming rules for Linux distribution and their uses.

[root@localhost /]# tree -d -L 1
├── bin -> usr/bin
├── boot
├── data
├── dev
├── etc
├── home
├── lib -> usr/lib
├── lib64 -> usr/lib64
├── media
├── mnt
├── opt
├── proc
├── root
├── run
├── sbin -> usr/sbin
├── srv
├── sys
├── tmp
├── usr
└── var

  • /bin:
    Binary is an abbreviation for Binaries, which stores the most frequently used commands.

  • /boot:
    Here are some of the core files used to start Linux, including some connection files and mirror files.

  • /dev :
    dev is an abbreviation for Device, which stores external devices on Linux in the same way that devices are accessed and files are accessed on Linux.

  • /etc:
    etc is an abbreviation for Etcetera (and so on), which is used to store all the configuration files and subdirectories needed for system administration.

  • /home:
    The user's home directory. On Linux, each user has his or her own directory, which is usually named after the user's account, such as alice, bob, and eve in the figure above.

  • /lib:
    lib is the abbreviation of Library. This directory contains the most basic dynamic connection shared libraries of the system, which act like DLL files in Windows. These shared libraries are required by almost all applications.

  • /lost+found:
    This directory is normally empty, and when the system is illegally shut down, some files are stored there.

  • /media:
    The Linux system automatically recognizes some devices, such as U disk, CD-ROM, etc. When it recognizes them, Linux will mount the recognized devices into this directory.

  • /mnt:
    This directory is provided to allow users to temporarily mount other file systems. We can mount the CD-ROM on/mnt/and then enter the directory to view the contents of the CD-ROM.

  • /opt:
    Opti is the abbreviation opt ional, which is the directory where additional software is installed for the host. For example, if you install an ORACLE database, you can place it in this directory. The default is empty.

  • /proc:
    Proc is the abbreviation of Processes, /proc is a pseudo file system (also called virtual file system), which stores a series of special files in the current state of the kernel. This directory is a virtual directory, which is a map of the system memory, and we can get system information by accessing it directly.
    The contents of this directory are not on the hard disk but in memory. We can also modify some files directly inside, for example, by blocking the ping command of the host computer with the following commands, so that no one else can ping your machine:

    echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all
  • /root:
    This directory is the system administrator, also known as the user home directory of the super privileger.

  • /sbin:
    s is the abbreviation for Superuser Binaries, which stores the hypervisor used by the system administrator.

  • /selinux:
      This directory is unique to Redhat/CentOS. Selinux is a security mechanism, similar to the firewall of windows, but it is a more complex mechanism, which stores selinux-related files.

  • /srv:
      This directory holds some data that needs to be extracted after the service starts.

  • /sys:

    This is a big change in the Linux 2.6 kernel. A new file system in the 2.6 kernel is installed in this directory   sysfs  .

    The sysfs file system integrates information from three file systems: the proc file system for process information, the devfs file system for devices, and the devpts file system for pseudo-terminals.

    This file system is an intuitive reflection of the kernel device tree.

    When a kernel object is created, corresponding files and directories are also created in the kernel object subsystem.

  • /tmp:
    tmp is short for temporary. This directory is used to store temporary files.

  • /usr:
      usr is the abbreviation of UNIX shared resources, which is a very important directory in which many applications and files of users are placed, similar to the program files directory under windows.

  • /usr/bin:
    Applications used by system users.

  • /usr/sbin:
    Super users use more advanced managers and system daemons.

  • /usr/src:
    The default drop directory for kernel source code.

  • /var:
    var is the abbreviation of variable. This directory contains things that are expanding. We are used to keeping directories that are frequently modified in this directory. Includes various log files.

  • /run:
    Is a temporary file system that stores information since the system was started. When the system restarts, files in this directory should be deleted or cleared. If you have a / var/run directory on your system, you should make it point to run.

In Linux systems, it is important to have several directories. In general, you need to be careful not to delete or change internal files by mistake.

/etc:   As mentioned above, this is a configuration file in the system. If you change a file in this directory, the system may not start.

/bin, /sbin, /usr/bin, /usr/sbin:   This is the system's default directory for executing files, such as   LS   It is at / bin/ls   Under the directory.

It is worth mentioning, /bin, /usr/bin   Is a command for system users (except root), and/sbin, /usr/sbin   Is the instruction for root.

/var:   This is a very important directory, there are many programs running on the system, so each program will have its own log generated, and these logs are recorded in this directory, specifically in / var/log   In the directory, the default placement of mail s is also here.

Tags: Linux

Posted on Sun, 24 Oct 2021 12:37:43 -0400 by mattwal