Command summary
Mkdir-p (Recursive Create directory) command to create a directory Mkdirdirectorys
Ls-l (Long)-D (directory) displays the directory or the file name list (the first file in Linux belongs to the hidden file) use-A to view such files
CD switch directory hierarchy change directory CD ~ represents switch home Directory CD-Switch to the previous location of the directory
PWD View the current directory
echo Print output (printf complex output)
Printf-format and print data
Vi/vim similar to the win Notepad/emeditor Editor, Command mode (: wq:q: q! : wq!) <==> Insert mode (ESC Toggle Command mode)
w write Q quit! Mandatory
: Set Nu Display line number, DD delete the current line, yy copy the current line, p paste, line number GG positioning to the line, G Switch to the end of the file, GG to the head of the file.
Cat view file contents, can append multiple lines of text cat-n display line number
Cat>> a.txt<<eof (>> reverse re-append, input redirection (his feature is multi-line re-append, single-line words with ECHO, usually appended to the end)
[email protected] ~]# cat >> a.txt<<eof
> ASD
> Nihao
> Linux
> EOF
[email protected] ~]# cat A.txt
Asd
Nihao
Linux
TAC Invert content output
CP-APR copy file or directory-P can only copy directories to copy files to add-R
MV Move directory or rename (rename command) move (rename) file
Rm-f Force Delete files,-r recursively delete deleted files or directories-FR delete specified directories and files
Redir Delete Empty directory
Head header shows file header-N rows-number of rows, default header 10 rows
Tail-f (Track changes in a file's log) tail display file trailing-N lines-number of lines, default end 10 lines
One of the grep (filtering) core commands excludes-V "paichu" directly Filters "Xiangyaode"-ei
- e You can filter multiple strings at the same time, - I ignore case
Egrep equivalent to Grep-e
SED takes various content-N cancels the default output P=print D=delete
Alias Display settings Aliases Unalias
Which view the path where the command is located whereis,locate,find
The Find Lookup command-type (f D)-name "ddd" is searched by name-mtime by the modified time.
Tree-l Viewing the directory structure
Xargs is used to give the output of the find/ls to the back processing
Seq-s The specified delimiter, prints the number sequence echo {0..5}
Man view Help for commands and configuration files, etc.
Touch Create file or modify file timestamp
History-c (Clear All)-D line number view history
Diff Compare File content differences (compare files line byline)
Vimdiffedit, three, or fourversions of a file with vim and show difference
Useradd adding users
passwd--stdin Modify the user password, if you do not specify the user, then modify the current user password, ordinary users can only modify their own password.
Whoiam viewing the current command line end user
W View the currently logged on user
SU switches user roles, peasant uprising, overthrow emperor, attention to take on-
sudo allows a normal user to have a command that specifies the user root permission
Yum is an interactive,rpm based,package Namager. Package management tool to resolve RPM package dependencies
RPM-IVH Software Installation command RPM-IVH package name. rpm
Chkconfig View the command to set up automatic software
Netstart View network status Lntup or an
[--tcp|-t] [--udp|-u] [--listening|-1] [--all|-a] [--numeric|-n] [--program|-p]
lsof-i:p Ort view ports, list open files
Chatterchangefile attributes (-i+i)
Lsattrlist file attributes
Uname-a (View All)-R (view kernel)-m (view 32-bit or 64-bit) print System Informationca View the systems version, kernel version, etc.
Halt shut down the machine
Reboot restart
Shutdown-r Now (restart)-H now (shutdown)
Symbol:
; the delimiter for multiple commands.
/ the delimiter for the root or path
> or 1> Standard output redirection ( the data flow flows in the direction of the arrows), overwriting the original file contents
>> or 1>> Chase-weighted orientation (flow of data flow toward arrows), "End" of the original file, "Append" content
< or <0 standard input input redirection: Input redirection is used to change the input of the command, specifying the input, followed by the file name.
<< or <<0 input redirection: followed by a string to indicate "input end" or ctrl+d to end the input
{1 standard input (stdin): code 0, using < or <<. The flow of data flows. From left to right
2 standard Output (STDOUT): Code 1, using > or >>. From left to right
3 standard error Output (STDERR): Code 2, using 2> or 2>>.
Special:
2>&1 is to redirect the standard error to standard output (it can also be used >&) .
[[Email protected] ~] #date >a.txt
[[Email protected] ~] #cat a.txt
. years the Month - Day Tuesday 16:37:49 CST
[[Email protected] ~] #data >a.txt
-bash:data:commandnot found
[[Email protected] ~] #data 2>a.txt
[[Email protected] ~] #cat a.txt
-bash:data:commandnot found
}
.. Top level directory
. current directory
~ User's home directory
- last user's directory
| Pipe character Pass the output of the previous command to the last command with a pipe break to continue processing
{} with echo print sequence number sequence or alpha sequence echo {1 ... 6}
The PATH environment variable is capitalized, and all the paths contained within the environment variable can be directly knocked out to execute.
Global effective /etc/profile. Normal user ~/.bash_profile or ~/.BASHRC
Summary and analysis of common commands in Linux