1, according to the series listing the distribution of Linux, describing the relationship between the different distributions and differences.
The distribution of Linux is broadly divided into two broad categories, one of which is a distribution version maintained by a commercial company, a distribution version maintained by a community organization, the former is represented by the famous Redhat (RHEL), and the latter is represented by Debian.
Redhat, which should be called the Redhat series, includes Rhel (Redhat Enterprise Linux, the so-called Redhat
Advance Server, paid version), Fedora
Debian, or Debian series, including Debian and Ubuntu. Debian is a model of community Linux and is by far the most GNU compliant
CentOS (Community clone version of Rhel, free)
2, description of the use of the command on the Linux system format, details Ifconfig, Echo, TTY, STARTX, export, pwd, history, shutdown, Poweroff, reboot, Hwclock, the use of the date command , and with the appropriate examples to illustrate
Command format for Linux:
command (commands) [Options ...] Options [Arguments ...] Parameters Some commands may not be followed by options
Options: For starting or turning off a feature, options for short and long options
Short options:-c-d, such as-CD
Long options:--word, e.g.--long
Parameters: The Action object of the command
Providing data to commands
(1) ifconfig command to view the IP address of Linux
Very simple to use the command line interface directly into the ifconfig enter, you can see all the current Linux network card IP address information.
(2) Echo is one of the most commonly used commands for Linux-built bash, typically used in scripting languages and batch files to display a line of text or a string in a standard output or file, and you can use the echo command to display the variable's contents with the variable name.
(3) TTY view the device terminal that is currently logged on, enter the TTY command directly from the command line interface.
(4) Starx is the start of the X Window service, in fact, the STARTX command starts Xinit, and then xinit to start the X window (graphical interface).
(5) Export setting or displaying environment variables
export[options [Parameters]
-F: Represents the function name in [variable name]
-N: Delete the specified variable, the variable is not actually deleted but is not exported to the execution environment of the subsequent instruction
-P: Lists all environment variables that the shell assigns to the program
(6) PWD Displays the path of the file directory where you are currently located, and you can enter PWD directly from the command line interface.
(7) Historical command history, used to record and view the history of commands used in the current system, history records that all commands used in this session will be logged to the command history file at the end of this session. Default in user home directory ~/bash_history
History
-A: Append the newly executed command history to the history command file in this session
-D: Delete the command specified in history
-C: Empty command history
Quick action:
!#: Call History in the section # command directly in the command line interface input! followed by a number to make a history command call
!starx The most recent command that starts with Starx in the history of a call
!! Call the previous command
(8) Shutdown, Poweroff, and reboot are all commands for critical restart of Linux systems
Shutdown: Secure shutdown of operating system
-P off Power off
-F coercion, do not call shutdown
-R Restart
Shutdown directly after the number of minutes after the shutdown, with the specific time to show how much time after the shutdown
Poweroff: Turn off the computer and power off the system, directly using the parameters can be
Reboot reboot system command, direct use not with parameters
(9) Hwclock system clock, the clock in the Linux system is divided into hardware clock and system clock Two, hardware clock has a small battery power in the motherboard, the system clock refers to the clock in the kernel, all Linux related instructions are read the system clock, The Hwclock command can either synchronize the hardware clock to the system or synchronize the system time to the hardware.
Hwclock:
-R Read and print hardware clock
-S synchronizes the hardware clock to the system clock
-W synchronizes the system clock to the hardware clock
Date is used to display and modify the Linux system time. Enter date directly at the command line interface to display the current system time
Date space followed by 12111210 modify the system time-time format to month-day hours
Date
+%d display time 12/11/16
+%f Show Time 2016-12-11
Date +%y-%m-%d16-12-11
3, how to get the Help information of the command on the Linux system, please detailed list, and describe how the chapters of the man document are divided.
Commands on Linux systems are divided into external commands and built-in commands
Internal command:
Help command for information
External command:
Command Help
Using the Help manual Man command
Info Page Info command
Help documents with the program itself
Program official documentation
Official documentation for the release version
Google
The Man Help Handbook is divided into 8
Man1: User Commands
Man2: System call
MAN3:C Library Call
MAN4: Equipment files and special files
MAN5: Configuration file format
Man6: Games
MAN7: Miscellaneous
MAN8: Commands for managing classes
4. What are the file management commands on Linux, their common use methods and their examples are demonstrated.
CP: Copy command to copy or archive files
CP [Source file] [destination path or file name]
-I. Interactive
-r,-r recursively replicate directories and all internal content
-A archive
Mv:move move a file or rename a file, the file to be moved modifies the name, and in the current directory it is equivalent to renaming
MV [source file] [destination file or file name]
-I: Interactive
-F: Mandatory
RM: Deleting files or directories
RM [file or directory]
-I: Interactive
-F: Mandatory
-R: Recursive recursive option to use RM-RF to forcibly delete files or directories when deleting a directory
Touch: Creates or modifies a file timestamp that is created when there is no file with the same name
Touch a.txt in no a.txt is a file that represents the creation of a aa.txt
-T modify file time, file change time cannot be modified touch-t 10101010 a.txt Modified
-A access time synchronization is current system time Touch-a a.txt
-m modify time synchronization to current system time Touch-m a.txt
5. Bash's work features the command execution status and command line expansion involved in the content and its sample demonstration
The execution state of the command in bash is divided into two types, success and failure, or success or failure without a third
Success: 0 indicates successful use of echo $? View Last command execution status
Failure: 1-255 indicates failure
(1) Command completion
External command: Bash searches for a file named after a given command name in each path from left to right, based on the path defined by the PATH environment variable, the command to be executed the first time it is found
Direct completion: Tab user given string with only one unique command, if not unique, tab to list again
(2) Path completion
Takes the user-given string as the beginning of the path and searches for the file name at the beginning of the specified string with the specified parent directory
(3) Command line expansion
~: Expand to User host directory
~username: Expand the home directory for the specified user
{}: Can host a comma-delimited list and expand it to multiple paths
Example:/aa/{a,b}=/aa/a,/aa/b/aa/{a,b}/a=/aa/a/a/aa/b/a
6. Use the command line expansion function to complete the exercise
(1) Create the/tmp directory: A_c,a_d,b_c,b_d
Mkdir-p/tmp/{a_c,a_d,b_c,b_d}
(2) Create/tmp/mylinux directory: mylinux/
├──bin
├──boot
│└──grub
├──dev
├──etc
│├──rc.d
││└──init.d
│└──sysconfig
│└──network-scripts
├──lib
│└──modules
├──lib64
├──proc
├──sbin
├──sys
├──tmp
├──usr
│└──local
│├──bin
│└──sbin
└──var
├──lock
├──log
└──run
Mkdir-p/tmp/{mylinux/{bin,boot/{grub,},dev,etc/{rc.d/{init.d,},},syconfig/{network,},bin/{modules,},lib64,proc , Sbin,sys,tmp,usr/{local/{bin,sbin},},var,lock,log,run,},}
7, what is the metadata information of the file, what does it mean, how to view it? How to modify timestamp information for a file.
Meta-data information for the file:
Access time: touch-t 10101010 a.txt Modify file access time
Modify Time: Modified touch-t 10101010 a.txt Modify File modification time
Change time: Changing times cannot be modified
Use stat to view timestamp information for a file stat a.txt
8. Display all files or directories in the/var directory that start with L, end with a lowercase letter, and have at least one digit (can have other characters) appear in the middle.
ls-d/var/l[[:alnum:]]*[[:lower:]]
9. Displays files or directories that start with any letter in the/etc/directory and end with a non-numeric character.
ls-d/etc/[[0-9]*[[:p ha:]]
10, display in/etc directory, start with a non-letter, followed by a letter and any other length of any character file or directory
Ls-d/etc/[^[alpha]]*[alnum]
11. In the/tmp directory, create a file that starts with Tfile, followed by the current date and time, with the filename line such as: tfile-2016-09-20-09-32-22
touch/tmp/tfile-%$ (Date +%y-%m-%d-%h-%s)
12. Copy all files or directories ending with. D in the/etc directory into the/tmp/mytest2 directory.
Cp-ar/etc/*.d/tmp/mytest2
13. Copy all files in the/etc/directory that begin with L or N and end with. conf to the/TMP/MYTEST3 directory
Cp/etc/[m,n]*.conf/tmp/mytest3
First time job