linux commands commonly used symbols

1, symbol:
In linux, & and &&, | and || are described below:
&  Means that the task in the background, such as to run in the background redis-server, there redis-server &
&&  indicates a successful execution, before the implementation of a command before a command, such as echo '1' && echo '2     '
|  A piping, an output command, the next command as a parameter, such as echo 'yes' | wc -l
||  expressed on a post-execution failed before the next command command, such as cat nofile || echo "fail"
cd.      The current directory
cd ..     parent directory
cd ~  user's home directory (root's home directory is the root user's home directory is ordinary home)     
 >    Overwrite a file echo "11111"> hello (with a 11111 document called hello to cover the contents of the file)   
 >>   append to a file echo "11111"> hello (11111 appended to the final surface hello document)  
;     As "successive instructions" function symbol is "semicolon" ( examples:. Cd ~ / backup; mkdir startup; cp ~ /.* startup /
in the middle of a command using the command semicolon (;) to separate, semicolons before executing the command is completed (successfully or not) will be immediately followed by the implementation of subsequent commands)
 
'String' single quote 
Content enclosed with single quotes, and will be treated as a single string. The $ symbol represents the variables in quotation marks, no effect, that is to say, he was generally regarded as a symbol, and preventing any variable substitution.
user@user-virtual-machine:~$ hey=homeeach'$hey'
user@user-virtual-machine:~$ echo $hey
homeeach$hey
"String" double quotes
Double quotation marks are used to enclose the content will be treated as a single string. It prevents wildcard expansion but allow variable expansion. This treatment with different numbers of single primer.
user@user-virtual-machine:~$ hey="long"
user@user-virtual-machine:~$ echo da $hey
da long

* The asterisk (wild card)
is quite commonly used symbols.
1, on the filename extension (Filename expansion), she used to represent any number of characters 0 to infinity.

  1. [root@RHEL6 ~]# ls a*
  2. aaa anaconda-ks.cfg
  3. [root@RHEL6 ~]#

2, the regular expression (Regular Expressions), a * represents a repeated character before a plurality of zero to infinity, such as: grep -n 'ess * file.txt, might match es, ess, esss like. Regular expressions are 0 to an infinite number of characters used is. "*" Indicates.
3, in operation, it represents the "multiplication."
let "fmult = 2 * 3"
In addition to the built-in commands let, as well as instructions on a calculation of expr, the asterisk here also assume the role of "multiplication" of. But be careful in the use, he must be preceded by escape characters.

** power calculation
two asterisks stands for "power" means at the time of operation.
let "sus = 2 ** 3" echo "sus = $ sus" # sus = 8

 

$ And $$ money numbers (dollar sign)

1, using a variable preamble, i.e., before the need to add the value of the variable variable substitution  
variable substitution (Variable Substitution) representative symbol.

[root@RHEL6 ~]# vrs=123
[root@RHEL6 ~]# echo "vrs = $vrs"
vrs = 123

2, in the Regular Expressions are defined as "line" extreme end (end-of-line). This is often used in grep, sed, awk and vim (vi) of them.

[root@RHEL6 ~]# ll | grep "txt$" //列出行末是txt结尾的行
-rw-r--r--. 1 root root 1700 May 21 10:50 1.txt
-rw-r--r--. 1 root root 650 May 31 18:11 123.txt
-rw-r--r--. 1 root root 1700 May 21 10:50 2.txt
-rw-r--r--. 1 root root 923 May 27 09:20 network.txt
-rw-r--r--. 1 root root 96 Jun 1 17:58 printf.txt
-rw-r--r--. 1 root root 673 Jun 1 12:24 regular_express.txt

3, in bash $ itself is also variable. Representatives of the shell is the process code, the so-called PID (Process ID) we want to know the PID of the current shell, it can be

[root@RHEL6 ~]# echo $$
4316

 

 

 

Guess you like

Origin www.cnblogs.com/xiaozhuanfeng/p/10955576.html