Linux exercise short answer

Keywords: Linux Operation & Maintenance server

Chapter I

Q1 brief introduction to the application field of Linux system

   Linux The server; Embedded Linux System; Software development platform; Desktop applications

Q2 briefly describe the characteristics of Linux system

   Openness, multi-user, multi task, good user interface, equipment independence, rich network functions, reliable system security and good portability

Q3 briefly describes the composition of Linux system

   Kernel shell,File system, application

Q4 brief introduction to mainstream Linux distributions

   Redhat SUSE Oracle CentOS Ubuntu Debian Mandriva Gentoo Slackware Fedora ...

Q5 briefly describes the new features of RHEL7 system

   The network packet technology is cited as the binding backup method of link aggregation KVM Provides a number of improvements and introduces docker,use GRUB2 Boot loader.

Chapter II

Q1 briefly describe the hardware requirements for installing Linux system

   CPU(Mainstream computers and servers), memory (at least 1 GB),Hard disk space (at least 10) GB Above), display and graphics card DVD CD drive

Q2 design a reasonable zoning plan on your computer

   swap Partition: 1 of virtual memory and physical memory~2 times

   /boot Zone: minimum 200 MB

/usr partition: 8GB minimum

/var partition: at least 1GB

/Partition: 1GB minimum

/home partition: for the remaining space

Q3 brief description of partition naming scheme

   Use a combination of letters and numbers to refer to the hard disk partition. The file name format is:/dev/xxyN

   /dev: Directory name of all device files

   xx: The type of equipment where the partition is located, hd yes IDE Hard disk, sd yes SCSI Hard disk

   y: The device where the partition is located, a,b First and second, respectively

   N: Partition, the first four partitions (primary partition or extended partition) use 1~4 Indicates that the logical drive starts at 5

   for example/dev/hda3 Represents the first IDE The third primary or extended partition on the hard disk.

Q4 briefly describes the method of setting computer IP address when installing Linux system

   In the network and host name setting interface, enter Ethernet eno16777736,add to IPv4 Address, save it.

What is the default connection area of Q5 firewall

   public,public Used in public areas, the specified external connection can enter the internal network or host

Chapter III

Q1 what are the ways to enter the character interface

   Through character interface, terminal under graphical interface and virtual console.

Q2 what commands can be used to shut down the computer system

   shutdown -h now   //Shut down the computer system now. Halt / / use the halt command to shut down the system

Q3 briefly introduces the target concept in Linux system

   Previously, the run level was used to represent a specific operation mode, and the number 0~6 Represents 7 levels, and each operation level can start specific services. RHEL7 Replace the run level with the target. The target uses the target unit file description and the file extension is.target. 

How can Q4 get help in Linux system

   use man Manual page, use--help option

What are the redirection methods in Q5

   Output redirection:[command] > [file]  Output append redirection:[command] >> [file]

   Enter redirection:[command] < [file]  Enter additional redirection:[command] << [Separator] >[text] >[Separator]

   Error redirection:[command] 2> [file] Error: append redirection:[command] 2>> [file]

   Achieve both output and error redirection:[command] &> [file]

Q6 briefly describes the working mode of the vi editor

   1)Command mode: press colon to enter last line mode, press i or a Enter insert mode.

          Commands: deleting x and dd,copy yy,paste p,replace r,revoke u,preservation ZZ,sign out ZQ

   2)Insert mode: Press Esc Enter command mode

   3)Last line mode: Press Esc Enter command mode

          Commands: saving:w,Save and exit:wq,sign out:q,forced return:q!,function:!command,

          delete:d,copy:n1,n2 co n3,move:n1,n2 m n3,Jump to:n,Setting environment:set

● restart command: shutdown -r now or reboot

● Shell skills:

1 parameter is provided by the user to determine the target of the command

2 common control combination keys: CTRL+ l: screen clearing c: terminate command z: suspend command d: input end s: block output (q)

3 command line auto completion: Tab key cd /u/sr/k

4 command history: history! $: the last parameter of the previous command

5 command arrangement: "; and & &"

6 command replacement: "$() and"

● virtual console: press alt+Fn in the character interface and ctrl+alt+Fn in the graphical interface to switch the character virtual console.

● display the contents of / var directory in pages by pipeline: ls /var|more

Chapter IV

Q1 what are the file types in Linux system

   Ordinary file-,Catalog file d,Equipment file b.c,Pipeline file p,Symbolic link file l

Q2 briefly describe the difference between soft link file and hard link file

   Hard links record the of the target inode,Soft links record the target path. Soft links are like shortcuts and hard links are like backups. Soft links can be used as cross partition links, and hard links can only be used as links in this partition.

Q3 briefly describes the directory structure in Linux system

   Linux The directory structure of the system is a hierarchical tree structure, which is mounted on the root file system“/"Down.

Q4 briefly describes the details displayed using the "ls -l" command

   The first column: the first is the file type, followed by access rights: user owner, group owner and other users

   Column 2: number of links to the file

   Column 3: user owner of the file

   Column 4: group owner of the file

   Column 5: file length

   sixth-Eight columns: change time or last access time of the file

   Column 9: document name

Q5 what command can I use to delete a directory with subdirectories

   rm -rf /root/ab

● Linux directory structure:

/Home home directory of each user; / home directory of root user; / bin command file; / dev device file;

/mnt mount directory; / boot kernel and boot file; / etc configuration file; / usr programs and data used by users

● common commands:

pwd working directory path; cd changing working directory path; ls listing directory file information; touch creating an empty file;

mkdir creates a directory; rmdir deletes an empty directory; cp copies a file directory; mv renames and moves the path; rm deletes a file directory; wc counts the number of file lines, words, numbers, and section numbers

● display the detailed information of all file directories under / root directory, including hidden files.

ls -al /root

● create an empty file / root/ab and change the time record to 8:08 on August 8.

touch /root/ab

touch -c -t 08080808 /root/ab

● create hard link file / root/b and soft link file / root/c of / root/a.

ln /root/a /root/b

ln -s /root/a /root/c

Chapter V

Q1 what are the common text content display commands? What are the differences?

   cat,more(Paging) less(Rewind) head(First few lines) tail((end)

Q2 what are the common text processing commands? What are the differences?

   sort(Sort) uniq(Weight removal) cut(Selected fields) comm(Line by line comparison) diff(Line by line comparison (different)

What command can Q3 use to display the kernel version of the current computer?

   uname -r

Q4 what command can you use to clear the computer screen information?

   clear

Q5 what commands can be used to sort file contents in reverse order?

   sort -r textfile1

● find the file fstab in the / etc directory and find / etc - name fstab

● display the file type of the / etc/fstab file

● display the disk occupancy of / root directory du -s root

Chapter VII

Q1 what are the classifications of user accounts in Linux system?

   root User, system user, ordinary user

Q2 what are the profiles for managing user accounts? And describe the meaning of each field in these documents.

   /etc/passwd File: 7 fields, user name:password:UID:GID:full name:home directory:Sign in shell

   /etc/shadow File: 9 fields, user name:Encryption password:6 Date related fields:Reserved fields

What are the profiles for managing group accounts in Q3? And describe the meaning of each field in these documents

   /etc/group File: 4 fields, group name:Group password:GID:Group members

   /etc/shadow File: 4 fields, group name:Group password:Group manager:Group members

Q4 by default, what is the UID of the first newly created user account?

   1000

Q5 briefly describe the difference between setting password and not setting password for user account

   stay/etc/shadow In the file, the second field of the user who sets the password displays the encrypted password and can log in to Linux On the system, the second field of a user who does not set a password displays“!!",Unable to log in to Linux On the system.

● create the user account zhangsan, set its password to 111111, and set the full name of the user name to Zhang San.

useradd zhangsan

passwd zhangsan

usermod -c Zhang San

● delete the user account zhangsan and its home directory at the same time

userdel -r zhangsan

● create group group1 and set its GID to 1800

groupadd -g 1800 group1

● switch to other user accounts for login: su [options] [user]

Switch to root by default without any options, and do not change the shell environment.

su – it / / switch to user it to log in, and even switch to the shell environment

su it / / switch to user it to log in. The shell environment does not need to switch to it

● switch to super user mode to execute super user authority: sudo [command]

Chapter VIII

Q1 briefly describe the meaning of disk partition

   It is not only conducive to file management, but also different partitions can establish different file systems, so that different operating systems can be installed on different partitions.

Q2 briefly describe the meaning of formatting

   Formatting refers to the initialization of a disk partition, which usually causes all the data in the existing partition to be cleared. It is to establish tracks and sectors in the disk, and then the computer can use the disk to store data.

What are the subcommands of the Q3 fdisk command? What are their meanings?

   m Show all subcommands p Display disk partition information a Set disk boot partition n Create a new partition e create extended p create primary partition

d delete disk partition q exit without saving settings l list known partition types w save settings and exit fdisk v verify partition table t change the system ID of the partition

What are the file systems commonly used in Q4 Linux system?

   xfs,ext4,ext3,JFS,vfat,msdos,ext2...

● to store data on a disk, partition the disk, create a file system, and finally mount it to a directory.

● / etc/fstab file composition: device mount directory file system type mount option dump option check option

● modify the / etc/fstab file so that the / dev/sda5 partition is automatically mounted in the / mnt/kk directory when it is powered on.

/dev/sd5 /mnt/kk xfs defaults 1 2

● mount the partition / dev/sda5 to the / mnt/kk directory.

mount /dev/sda5 /mnt/kk

● mount the / dev/sda5 partition to the / mnt/kk directory in a read-only manner.

mount -o ro /dev/sda5 /mnt/kk

Chapter IX

Q1 what is the purpose of using RPM package management?

   It can be installed, deleted, upgraded, refreshed and managed RPM Software package.

   Can know RPM The ownership of software packages and files.

   Query information in the system RPM Whether the software package is installed and query its installation version.

   Developers can package and publish their own programs as RPM Software package.

   Dependency check to see if there are RPM The software package disturbs the system due to incompatibility.

   Package signature GPG and MD5 Import, validation, and signature publishing of.

Q2 briefly describe the difference between upgrading RPM package and refreshing RPM package

   Upgrade is a combination of deletion and installation. The upgrade option will install the package regardless of whether the previous version of the package has been installed. Refresh will compare the versions. If it is newer than the installed version, it will be upgraded to the newer version. If it has not been installed before, the package will not be installed.

Q3 briefly describe the steps to create a local software warehouse on a local disk

   Installing packages: installing deltarpm,python-deltarpm and createrepo software package

Copy package: copy the package from the Linux system installation CD

Create software warehouse profile

Create a software warehouse: use the createrepo command to create a software warehouse

What compressors can the Q4 tar command call

   gzip,bzip2,xz...

● use the rpm command to install the bind chroot package. After installation, view the description of the package.

rpm -ivh bind-9.9.4-29.el7.x86_64.rpm

● delete the bind package using the yum command.

yum remove bind-chroot

● use the tar command to call the gzip compressor to compress the / root/abc directory into a / root/abc.tar.gz file.

tar zcvf /root/abc.tar.gz /root/abc

● rpm installation, deletion and query

● yum install and uninstall query

● tar packaging and unpacking compression program

Chapter X

What permissions do Q1 files have? What are their meanings?

   User owner permissions: access to their own files

   Group owner permission: the permission of the user group to access one of the users' files

   Other user permissions: the permissions of all other users to access a user's files

Q2 what methods can be used to set file permissions?

   Text setting method, number setting method

● use the text setting method to set permissions for the / root/ab file. The owner is read, write and execute permissions, and the users in the same group are read and write permissions, while other users do not have any permissions.

chmod u+rwx,g+rw /root/ab

● set permissions on the / root/ab file by digital setting method, and the owner only has read and write permissions.

chmod 600 /root/ab

● change the owner of the / root/ab file to user zhangsan.

chown zhangsan /root/ab

● special authority: SUID(chmod u+s) SGID(chmod g+s) Sticky(chmod o+t)

Chapter XI

Q1 briefly describe the process classification of Linux system?

   Interactive process: shell Start and control processes

Batch process: a series of processes scheduled to complete at a specified time

Daemon: starts when the system boots to perform immediate operating system tasks

Q2 briefly describe the startup process of Linux system

   BIOS Self test and startup GRUB2,Load kernel, execute systemd Process, initialize system environment, execute/bin/login

● ps process view command

● top displays the running process

● kill kill process kill -9 1659

● create, modify, view and delete crontab entries

● modify / etc/crontab file to realize automation. Time sharing day month week user commands / scripts

0 11 * * 1 root cp /boot /root/abc / / copy the files in the / boot directory to / root/abc at 11:00 every Monday

Chapter XII

Q1 describe the contents of the network card configuration file?

   /etc/sysconfig/network-scripts/ifcfg-eno16777736 File. Circuit IP Address information.

Q2 what commands can be used to test network connectivity?

   ping,netstat

What port number does the Q3 DNS service use?

   53

●systemctl

Start: systemctl start named.service

Status: systemctl status named.service

Stop: systemctl stop named.service

Restart: systemctl restart named.service

Startup and self startup: systemctl enable named.service

Query self startup: systemctl is enabled named.service

Stop self start: systemctl disable named.service

● display the connection of port number 22

netstat -antu |grep 22

● save location of network card configuration files for CentOS and Ubuntu

● IP and mask attributes in the network card configuration file

Chapter XIII

Q1 describe the main reasons why OpenSSH replaces telnet?

   OpenSSH It is a secure and encrypted network connection tool, telnet It is not safe to use plaintext to transmit passwords and data.

Q2 briefly describe the components of VFC software

   Server side VNC server,Client VNC viewer

● start sshd service: systemctl start sshd.service (enable self start)

● log in to the remote SSH computer with IP address 192.168.0.100 as user zhangsan.

ssh -l zhangsan 192.168.0.100

● connect the remote host 192.168.0.100 with the root account and execute the ls /boot command.

ssh root@192.168.0.100 ls /boot

● use the root account to transfer the local file / root/a to / root under 192.168.0.100 remote host and change its name to b.

scp /root/a root@192.168.0.100:/root/b

● use the root account to transfer all files in the local / ab directory to the / root directory of 192.168.0.100 remote host.

scp /ab/* root@192.168.0.100:/root

● use root to transfer the file / root/abc on the remote host 192.168.0.100 to the local / root directory and change its name to a.

scp root@192.168.0.100:/root/abc /root/a

● start VNC server: vncserver; Create or change VNC login password: vncpasswd

Chapter 14

Q1 what does NFS mean?

   network file system Network file system

Q2 briefly describe the format of the contents of the / etc/exports file

   This document controls NFS The shared directory and access control to be exported by the server.

   Format: shared directory client (export option)

● modify the / etc/exports file to allow users from the host 192.168.0.100 to mount the / it directory with read-write permissions.

/it 192.168.0.100(rw,sync)

Mount NFS directory / it of remote host 192.168.0.100 to local host / mnt/it

●mount 192.168.0.100:/it /mnt/it

supplement

Q1 what is LVM?

   Logical volume management, yes Linux A mechanism for managing disk partitions in an environment.

Q2 what are PV, VG, LV?

   PV It's a physical volume, VG Is a volume group, LV Is a logical volume.

Q3 what is the relationship between PV, VG and LV?

   Several physical volumes(PV)Combined into a volume group(VG),A space partitioned from a volume group is a logical volume(LV). 

Can Q4 logical volumes be expanded or reduced online?

   The capacity can be expanded online, but not reduced online.

Can the Q5 file system be expanded or reduced online?

   The capacity can be expanded online, but not reduced online.

Q6 what should I pay attention to when shrinking a logical volume or file system?

When you shrink a file system, you must unmount the logical volume and determine the data usage.
Q7 how to create a logical volume?

New empty partition

Initialize partition (create PV): pvcreate device name

Create volume group: vgcreate -s block size volume group name physical volume device name

Create logical volume: lvcreate -n logical volume name - L logical volume size volume group name already exists

Format logical volume: mkfs -t file system type logical volume device name

What is the PE default size of Q8 volume group?

   4MB

Q9 what is SELinux? What are the advantages?

   SELinux Is a set of security rules that determine which process can access files, directories, ports, etc.

The advantage is to protect user data from the threat of compromised system services.

What are the two states of Q10 SELinux?

   Forced mode( enforcing),License mode( permissive),Disable mode( disabled)

Q11 how to modify SELinux mode?

   1)modify/etc/sysconfig/selinux File.

   2)Command: setenforce

Q12 what is the role of SELinux security context?

   1)Restrict file access. The file must have a matching security context to recognize access.

   2)Set switches for services and limiting service functions that are considered unsafe

Q13 what is the format of SELinux security context?

   User: role: type identifier

Q14 how to modify SELinux context?

   chcon -t Context type file name

Q15 SELinux Boolean concept?

   change SELinux Switch for policy behavior.

Q16 how does SELinux modify Boolean values?

   setsebool -P type on|off

Posted by hykc on Wed, 01 Dec 2021 13:06:09 -0800