Shell Introduction
[Email protected] ~]#
two components, #为命令行提示符; #为超级用户, $ for other users;
Before the first part, the user's identity
After @ for the second part, your host name
~ The location shows the directory where the current user is located
Shell command three parts shell command, options, parameters;
The general options are in the front plus –
The general parameters are in the front Plus/
Each part is separated by a space.
Which command, used to see where things need to be found;
Key combinations
Ctrl+l Clear Screen
Ctrl+d work ends, such as switching between two users. Example: The switch between the root user and the use user;
CTRL + C terminate command terminates the command being executed
CTRL + Z Hang command
CTRL + A cursor quickly moves to the beginning of the line
Ctrl+e cursor quickly moves to end of line
Wildcard characters
* represents any character
? Represents any single character
[] a relationship in square brackets, regardless of what is added within square brackets
[ ! ] Add! is to take the opposite, except ... other than the other;
<tab> keys, automatic completion of commands
<tab> key to command, file path, variable automatic completion, press 1 times <tab> if not, the description has multiple, need to press again and select;
Historical command
The simplest is to flip the arrow back to find it.
$HISTFILE can view the. bash_history which. is the hidden files directory
$HISTSIZE can see 1000 commands stored in $histfile
$HISTFILESIZE can also see the number of commands stored in the $histfile set
Command arrangement
; No logical relationship, the first command finishes executing the second command automatically, whether it succeeds or not
&& A logical relationship, the first command executes successfully before executing the command behind it.
Du command to see the size of the file footprint
Du-hs/root View root directory All file footprint and show as Total
Command aliases
View System Presets alias command: Alias
Create alias: Alias La= ' Ls-a '
Alias: Unalias LA
Note: It is generally not recommended to create additional command aliases, and too many command aliases will increase the difficulty of remembering commands.
redirect
What the Read command does: reads the value of the keyboard input
The function of the Echo command: To display the input information in the terminal
The role of the Process command:
Output redirection
Subscript 0, which indicates keyboard input, keyboard input on general input, redirection can be entered from the specified file
Subscript 1, indicates the correct output, the general output is on the screen, redirection can be output to the specified file
Subscript 3, indicating the error output, the general output is on the screen, redirection can be output to the specified file
Correct output:
The LS 1>/root/test.log to the subscript is 1 redirect output to the specified location/root/test.log
Cat/root/test.log the content directed to a text file
ls | Tee Test.log is saved on the screen, and the result is saved in the specified location, tee is equivalent to the tee of the water pipe
The > in the command will overwrite the previous content, but if you use the >> two greater than sign, it means the added meaning.
Standard error Output:
LS SFAFSFSF 1>/root/test.log 2>/root/error.log
Output correct results redirected to/root/test.log if the output is wrong redirect to/root/error.log if you want to save the results together, change the directory to match. Can also be written in simple
LS SFAFSFSF 1>/root/test.log 2>&1
LS SFAFSFSF &>/root/test.log
A single command is typically two selected, so there is no overwrite. But generally normal use or >> two greater than the number of
Cat >/root/test.log
Input redirect
Cat </ETC/PASSWD display text messages to the screen
The cat >/root/test.log <<eof EOF is the Terminator, and the Terminator can be casual, as long as it is not repeated with the contents of the body.
Sqlplus/as SYSDBA <<eof
Select Count (*) from scott.emp;
Eof
Pipe character
Who shows the terminals currently connected to the system
WC Word Count
Wc-l only look at the number of rows
More pagination Display
grep looks for the line that matches the keyword and displays it.
PS-EF viewing system background process information
Rpm-qa to query all installed packages
Sort sorts
W.H.O. | Wc-l
ls/etc | More
Ps-ef | grep ' Ora_ '
Pipe symbol | Used to concatenate multiple small commands.
SSH protocol Server side
Port number of the SSH protocol 22
OpenSSH SSH Protocol specific implementation
SSH status command:
Service sshd Status
Service sshd Start
Service sshd Stop
Service View Commands
NETSTAT-TINP | grep 22
Netstat viewing host network status
-T only see TCP/IP protocol
L Monitor Status
Display port number in the form of n numbers
P Port
grep 22 matches every line of information that has 22
Client
Creation of remote connections
Protocol VNC for Remote graphical interface
TigerVNC Redhat Oracle uses this
RealVNC
UltraVNC
Rpm-qa | grep VNC
Check VNC, please.
TIGERVNC Installation
Vncserver command
Vncserver-list
Vncserver-kill: Excess Value
Find Tigervnc from the graphical interface application
Enter IP and the service number to connect to: 1
Enter the password set at installation password
Vi/etc/selinux/config the SELinux
Linux file system
LS-LH viewing the properties of a file
Composed of 10 bits, the first bit when the file type. Behind nine-bit delegate permissions
-Representing ordinary documents
D Stands for Directory
b device files are generally stored in/dev comma separated, a primary device number is a secondary device number, the main device number is used to indicate what this device, the second device number indicates this is the first few. The letter B represents the block type device, and C represents the character type device.
The device is converted into a device file to simplify user scheduling of the device.
TTY Direct-attached virtual device number
/dev/pts Directory
Communication between the terminals
Echo Hello >/dev/pts/1
P is a pipe file Mkfifo mypipe the command to create a pipeline file
Link file
A soft connection file is also called a symbolic link file, which is equivalent to a shortcut to a Windows system. L represents a symbolic link file
Linux Foundation Course the next day