Command tips:
Tips for command exercise:
Ctrl + A cursor jumps to the top
Ctrl + e cursor jumps to the end of a career
CTRL + u delete the cursor to the beginning of the content
Ctrl + k Delete cursor to end of line content
Ctrl + L for clear screen
Command history Usage Tips:
!n executing the nth line command in the command history
!-n execution of the penultimate line command in the history command
!! Executes the previous command
! CHARACTER the last command in the history command that starts with CHARACTER
!$ references the last parameter of the previous command
ESC Release Press. Reference the last parameter of the previous command
Command aliases:
#alias cmdalias=comand Command Rename
Aliases defined in the shell are valid only in the current shell life cycle, the valid range of aliases the current shell process
#unalias Cancel Command Rename, #unalias COMAND
TAB key function:
Command completion: Searches for executable files at the beginning of each path specified by the PATH environment variable with the string we give
Path completion: Search for each file name under the starting path that we gave me, and try to complement the whole
The quotes and functions that bash supports:
' reverse quotation mark (tab above key), command substitution, replace a command with a command to execute the result of the process, format $ (command), anti-quote: ' command '
"" "double quotes, weak references, you can complete the variable substitution, the contents of the double quotation marks out, if there are commands, variables, etc., the variables, commands will be parsed out the results, and then output the final content.
' Single quotes, strong references, non-complete variable substitution; What you see is what you get: the contents of a single quotation mark are output as-is, or what you see in single quotes will output.
without quotes, does not consider the string containing the space as a whole output, if the content has commands, variables, etc., will first parse the variables, commands, and then in the output of the final content, if the string with a space and other special characters, it will not be complete output, need to add double quotation marks, general continuous string, number, Paths, etc. can be used.
Example 1:
[[email protected] etc]# echo ' Date ' #反引号的作用为命令替换. Fri Sep 8 18:08:29 CST 2017[[email protected] etc]# echo ' Date ' #单引号, WYSIWYG, the contents of the single quotation mark are output directly. ' Date ' [[email protected] etc]# echo "' Date '" #先做命令替换, in the output. Fri Sep 8 18:08:44 CST 2017
Example 2:
[Email protected] etc]# a=who #设置变量A =who[[email protected] etc]# echo ' $A ' $A [[email protected] etc]# echo "$A" Who[[em AIL protected] etc]# echo ' $A ' #反引号, variable substitution, execute $ A =who first, then execute the WHO command, equivalent to echo ' who ', and finally output the results of the WHO command root tty1 2017-09-07 18:26 root pts/0 2017-09-07 18:27 (172.16.10.200) [[email protected] etc]# echo $A #先做变量替换, then output who
Environment variables:
Path command paths
histsize Command History size
Example: # echo $HISTSIZE, showing the size of the cache command
#echo $shell to display the user shell environment
File name wildcard
* matches any character of any length, including an empty #ls *
? Match any single character, #ls? y*
[] matches any single character within the specified range, such as [a-za-z][0-9] [0-9a-za-z]
[[: Space:]] all whitespace characters
[[:p UNCT:]] all punctuation
[[: Lower:]] all lowercase characters
[[: Upper:]] all uppercase characters
[[: Alpha:]] all uppercase and lowercase letters
[[:d Igit:]] All numbers
[[: Alnum:]] numbers and uppercase and lowercase
[^] matches any character outside the specified range
Cases:
1. A file that starts with a letter and ends with a letter and contains a space in the middle #ls-l [[: Alpha:]]*[[:space:]]*[[:alpha:]] 2, displays all start with M/Var and ends with a lowercase letter. and a file or directory with at least one digit (which can have other characters) appear in the middle. # ls-1d/var/m*[[:d igit:]]*[[:lower:]]3, displays a file or directory that starts with any number in the/etc directory and ends in a non-numeric number. # ls-ld/etc/[[:d igit:]]*[^[:d igit:]]4, Show/etc directory, start with a non-letter, followed by a letter and any other arbitrary length of any character file or directory. #ls-ld/etc/[^[:alpha:]][[:alpha:]]*5, displays all files or directories in the/etc directory that begin with a non-numeric end of M. #ls-ld/etc/m*[^[:d igit:]]6, Show/etc directory, all files or directories ending in. d #ls-ld/etc/*.d7, display the/etc directory, all. conf End with M,n,o,p file or directory #ls-ld /etc/[m,n,o,p]*.conf
This article is from the "Wish_" blog, be sure to keep this source http://itwish.blog.51cto.com/11439802/1963750
Command tips for Linux learning notes, bash-supported quotes and file wildcard characters