§linux 0 Basic 1-3 RHEL7 command operation and startup level settings
"Content of this section"
*linux Terminal Introduction
*shell prompt
*bash Shell Basic Syntax
* Use of BASIC commands: LS, pwd, CD
* View System BIOS settings
*linux How to get help
*linux shutdown command: Shutdown, init 0, etc.
*Linux 7 boot level
* Set up the server automatically after the call
"Introduction to Linux Terminal"
TTY Console Terminal
PTS represents a virtual terminal
Tty1-tty6
> Just entered the graphical interface (desktop) for tty1
> Graphical interface Toggle character Interface Ctrl + (SHIFT) +alt + F2~F6
> Open Virtual Terminal Ctrl + ALT + T
! Ps-aux | grep pts #新建虚拟终端
> Switching between terminals ALT + [n]
> Close terminal ALT + F4
> Clear Screen Ctrl + L
"Shell Prompt"
[[Email protected] Desktop]#
[User name @ host name current directory name] Prompt
# root/Admin $ normal User
"Bash Shell basic Syntax"
Example: Useradd-u 1022-s/bin/nologin-g This user isn't allow to login Tom
Summary of command rules
Value of the value parameter for the command name [options] ([parameter]) option
"Basic Command"
*ls Command #查看当前目录的文件
Syntax: LS [directory name] #查看某目录下的文件, no parameter defaults to the current directory
Parameters:-L #显示文件详细信息
-A #显示隐藏文件
-D #查看目录, do not view content inside
-H #增强可读性
"File types in Linux"
Different colors represent different file types
catalogue / etc
Black Files / ETC/PASSWD
Light blue links / Etc/grub2.cfg
Red BOOT.TAR.GZ 
Green executable file /etc/init.d/network
Black Bottom yellow    device files /dev/sda
*PWD Command #查看当前目录
[Email protected] ~]# cd/etc/sysconfig/network-scripts/
[Email protected]]# pwd
/etc/sysconfig/network-scripts
*CD #切换目录
role: Switch directories
syntax: CD directory name
Example:
#cd back to the user's own home directory
#cd ~ go back to the user's own home directory
#cd-Go back to the previous directory
"Viewing system and BIOS hardware Time"
[[Email protected]~]#Hwclock
Thu 05:34:24 AMCST-0.943039 seconds
"View System Time"
[Email protected]~]#Date
Wed Jan 21:34:42 CST
"Modified Time"
[Email protected] ~]# date-s 2017-1-1
Sun Jan 1 00:00:00 CST 2017
[Email protected] ~]# date-s 21:38
Sun Jan 1 21:38:00 CST 2017
"About the display of time commonly used format"
[Email protected] ~]# date+%f
2017-01-01
[Email protected] ~]# date+%y-%m-%d
2017-01-01
[[email protected] ~]# Date ' +%y-%m-%d%h:%m'
2017-01-01 21:41
"How Linux gets Help"
Method 1: Add parameter-H or-help
[Email protected]~]# date--help
[Email protected] ~]#fdisk–h
[Email protected] ~]# manfind
Help View Internal command assistance information
--help viewing external command Help information
Task: Baidu the difference between internal commands and external commands
"Shutdown Command"
Shutdown, init, reboot Poweroff
"Shutdown"
Function: Shutdown, restart, timer shutdown
Syntax: Shutdown [options]
-R = Restart the computer
-H = power off
-H + time = Timer off
-C +-Cancel the pre-timer shutdown or CTRL + C
[Email protected] ~]# shutdown-h+10 #10分钟之后关机
[Email protected] ~]#shutdown-h 23:30 #指定具体的时间点进行关机
[Email protected] ~]#shutdown-h now #立即关机
shutdown -r now # Restart Now
shutdown -r +10 #10 Restart
shutdown -r 22:22 after minutes # 22:22 restart
later
"Init command"
Function: Switching system operation level
Syntax: Init 0-6
Linux 7 Boot levels:
0 System shutdown mode, the system default operation level cannot be set to 0, otherwise it will not start normally, the machine shuts down.
1 single-user mode, root privilege, for system maintenance, prohibit remote login, like Safe mode login under Windows.
2 Multi-user mode, no NFS network support.
3 full multi-user text mode with NFS, login to console command line mode.
4 The system is unused, reserved for general use, and in some special cases it can be used to do something. For example, you can switch to this mode to do some setup when your laptop's battery is running out.
5 graphical mode, after landing into the graphical GUI mode, X window System.
6 Restart mode, the default run level cannot be set to 6, otherwise it will not start normally. Running the INIT6 machine will restart.
"Boot level Configuration"
RHEL7 no longer uses the/etc/inittab file for the default boot level configuration
The SYSTEMD uses a more free target substitution than the sysvinit run level. The 3rd run level is replaced with Multi-user.target. The 5th run level is replaced with Graphical.target. Runlevel3.target and Runlevel5.target are symbolic links that point to Multi-user.target and Graphical.target, respectively.
Switch to the 3rd run level
[Email protected]~]# systemctl isolate Multi-user.target
Or
[Email protected]~]# systemctl isolate Runlevel3.target
Switch to the 5th run level
[Email protected]~]# systemctl isolate Graphical.target
Or
[Email protected]~]# systemctl isolate Runlevel5.target
"Set default run-level"
Set the default third boot level
[Email protected] ~]#systemctl set-default multi-user.target
Removed Symlink/etc/systemd/system/default.target.
Created symlink from/etc/systemd/system/default.target To/usr/lib/systemd/system/multi-user.target.
Set the default fifth boot level
[Email protected] ~]#systemctl set-default graphical.target
Removed Symlink/etc/systemd/system/default.target.
Created symlink from/etc/systemd/system/default.target To/usr/lib/systemd/system/graphical.target.
"View the current default startup level"
[Email protected] ~]#systemctl get-default
Graphical.target
This article from the "Non-security" blog, reproduced please contact the author!
Linux 0 Basics 1-3 RHEL7 Basic command operation and startup level settings