Linux basic command operations

target content
1. Arrange common words
2. Introduction to Linux Terminal
3. Get to know SHELL
4. Basic command operations
5. System time management
6. Help command usage
7. Shutdown command
8. Actual combat timing boot


1. Common words finishing

Terminal: terminal network-scripts: network script  
passwd: password file nologin: no login   
shutdown: shutdown reboot: restart  
poweroff: shutdown Grep: filter   
localhost: local useradd: add user  
graphic: graphic

2.Linux terminal Introduce
tty: a general term for terminal devices (console terminal)
     The word tty comes from Teletypes, or teletypewriters, which originally referred to teletypewriters, which are things that read and send information through a serial line with a printer keyboard. The keyboard is replaced by the monitor, so it is more appropriate to call it a terminal now.
Terminal is a character device, it has many types, usually use tty to abbreviate various types of terminal device pts virtual terminal       If we remotely telnet to the host or use xterm, don't we also need a terminal interaction? Yes, this is the virtual terminal pty (pseudo-tty), we connect to the server through XSHELL, what is displayed on the server is pts       pts (rpseudo-teminal slave) is the implementation method of pty, and it is implemented in conjunction with ptmx (pseudo-terminal master) Pty console terminal tty1-tty6 switching method: switch from graphical interface to character interface terminal: Ctrl+Alt+F2-6







Switch to the graphical interface Alt+F1-F6

Virtual terminal switching method:
ctrl+shift+t to create a new pseudo terminal
Alt + numeric keys Terminal switching
Alt + F4 to close the terminal


3. Knowing SHELL
      Shell provides an interface for users to interact with the kernel , which receives the command input by the user and sends it to the kernel to execute
      . Shell is actually a command interpreter, which interprets the command input by the user and transmits it to the system kernel for execution. It also has its own programming language, syntax, etc. The difference between the "#" sign and the "$" sign in the

prompt
[root@xuegod72 ~]# --- means that the root user is logged in, and the administrator account is logged in
[miao@xuegod72 ~]$ - --Indicates that a common user logs
in [username@hostname is currently in the directory]root #/ordinary user$

Basic syntax structure
of Bash Shell View all interpreters:
[root@xuegod72 ~]# cat /etc/shells

[root@xuegod72 ~ ]# chsh -l


4. Basic command operation
--ls
ls directory to view the files in the current directory, if no directory is added, view the current directory
Common parameters:
 -l Display detailed information Note: Shortcuts in the system# ll=ls -l
 -a show hidden files
 -d view the directory (do not view the contents inside)

[root@localhost ~]# ll
drwxr-xr-x. 2 root root 6 Nov 4 17:05 Public
d File type
rwxr-xr-x file permission
2 Number of linked files
root file belongs user
root file belongs user group
6 Nov 4 17:05 File last modification time
Public file name

File types are  d :
directory file l
: link file –l and ll are equivalent pwd: print the current directory location of the current user [root@localhost ~]# pwd /root xshell Tips  Increase the font: ctrl+shift + + (+ is not the one on the keypad +) Reduce font size: ctrl + - cd command cd function to switch directories Directory





















5. System time management
     There are two kinds of clocks, such as "hardware clock" and "system clock" in Linux.
The hardware clock refers to the clock device on the motherboard, that is, the clock that can usually be set on the BIOS screen; the
system clock refers to the clock in the kernel;
all Linux-related instructions and functions read
the At startup, the system clock will read the hardware clock settings, and then the system clock will operate independently.

Check
hardware time: [root@localhost ~]# hwclock
Mon 06 Mar 2017 08:30:00 PM CST -0.036942 seconds

Check the system time
[root@localhost ~]# date
Mon Mar 6 20:30:46 CST 2017
[root@localhost ~]#

How to modify time
[root@localhost ~]# date -s 2016-07-08

time synchronization
[root@localhost ~ ]# ntpdate time.windows.com

6. Help command use
whatis <command>: show short function of command
[root@localhost ~]# whatis mkdir
mkdir (1) - make directories
mkdir (1p) - make directories
mkdir (2) - create a directory
mkdir (3p) - make a directory
[root@localhost ~]#

man <command> View man page or command description
[root@localhost ~]# man mkdir
exit :q

Applies to external commands
 <command> --help
 <command> -h
applies to internal commands
 help <command>

distinguish command
type <command>

7. Shutdown commands
commonly used several shutdown commands
 shutdown
 init
 reboot  


--shutdown function of poweroff shutdown command
: shutdown, restart, timed shutdown
Syntax : shutdown [options]
Parameters:
 -r => restart the computer
 -h => shutdown
 -h + time => timed shutdown
[root@xuegod72 ~]# shutdown -h +10 //Shut down after 10 minutes
[root@xuegod72 ~]# shutdown -h 23:30 //Specify a specific time to shutdown
[root@xuegod72 ~]# shutdown -h now //Shutdown immediately
[root@xuegod72 ~]#shutdown -r 22:22 //Restart after 22:22

Shutdown
command --init Command syntax: init 0-6
Linux 7 boot levels:
 0 System shutdown mode, The system default run level cannot be set to 0, otherwise it will not start normally, and the machine will be shut
down
Network support
 3 Complete multi-user text mode, with NFS, enter the console command line mode after logging in
 4 The system is not used, it is generally not used, and it can be used to do some things in some special cases. For example, when the battery of the laptop is exhausted, you can switch to this mode to make
some
settings Normal start. Running init 6 will reboot the machine

Boot
level configuration: RHEL7 no longer uses the /etc/inittab file for the default boot level configuration, instead systemd uses a more liberal target than the sysvinit run level.
 Runlevel 3 replaces multi-user.target
 Runlevel 5 replaces graphical.target
runlevel3.target and runlevel5.target are symbolic links to multi-user.target and graphical.target respectively.

Switch
to runlevel 3
[root@localhost ~]# systemctl isolate multi-user.target
or
[root@localhost ~]# systemctl isolate runlevel3.target

View
runlevel [root@localhost ~]# runlevel
N 3 // The N mark has not been switched temporarily.


Set
default third boot level [root@xuegod60 ~]# systemctl set-default multi-user.target
or you can see this file: /etc/inittab
[root@xuegod60 ~]# systemctl get- default
graphical.target


8. Actual combat timing boot
1. Enter the bios, usually when the motherboard screen appears after booting up, press the Delete key, some brands may press F2 or F1
2. Power Management Setup, enter the power management settings
3. After entering this setting by pressing Enter, select Wake Up Event Setup, press Enter and press Enter
4. Continue to press Enter to select, change Disabied to Enabled, and then press Enter to confirm. Then continue to set the time and date



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326321791&siteId=291194637