Centos system special symbol description

1. System special symbols

  • Commonly used symbols

    • 1) $ Retrieve variable information and distinguish user types
    • 2) # Indicates that the configuration file is annotated, and that the user information is a super administrator user
    • 3)! But realize the effect of negation and coercion
    • 4) | Realize the pipeline function
    • 5) = Assignment symbol, assign the following value to the previous variable dusays=com
  • Quotation Mark Series

    • 1) "" is basically similar to the single quote function, but it can parse some special symbols $ 命令==$ (command)
    • 2) The content written in '' is what content is output, what you see is what you get
    • 3) `` ($()) Pass the execution result of the command inside the quotation mark to the command outside the quotation mark for use
    • 4) No quotation marks can be directly wildcarded
  • Path symbol

    • 1). Hidden files
    • 2) .. switch to the superior list
    • 3) ~ Switch to home directory
    • 4)-Switch to the last cd path
  • Logical symbol

    • 1) $$ When a command is executed successfully, execute the following command COMMAND1 && COMMAND2
    • 2) || The execution of the previous command failed, and the following command COMMAND1 || COMMAND2 is being executed
    • 3); Commands are executed in sequence, the success of the previous execution has no effect on the latter COMMAND1; COMMAND2
  • Directional symbol

    • 1) 1> Standard output redirection symbol
    • 2) 1>> Add redirection symbol to standard output
    • 3) 2> Error output redirection symbol
    • 4) 2>> Add redirection symbol to error output
    • 5) <standard input redirection symbol
    • 6) << Standard input with redirection symbol added
    • 7) &> Standard output error output redirection symbol
  • The system's unification symbol (wildcard is the main user to find the file, according to the file name)

    • 1) * Match all characters, the number is not limited, for example: rm -f FILE*
    • 2) {} Set a range interval Example: touch FILE{1…10}
  • Regular symbols of the system (the main user searches for the contents of the file)

    • Basic regularity

      • 1) ^ Filter out information starting with what
      • 2) Filter out the information ending with $
      • 3) ^$ Take out the blank line information in the file
      • 4). Means to match any one and only one character
      • 5) * matches 0 or more consecutive occurrences of a character before the asterisk rm -f FILE
      • 6) .* matches all information
      • 7) \ No meaning becomes meaningful and meaningful becomes meaningless, advanced symbols-become ordinary
      • 8) [] matches every character in the brackets, and the matching relationship is an or relationship
        • grep "oldb[oe]y" test.txt to find out the two words oldboy and oldbey in the file
        • grep "[0-9a-zA-Z]" test.tx to find the alphanumeric information in the file
      • 9) [^] Exclude the matched character information in the brackets
        • grep "[^0-9a-zA-Z]" test.txt will exclude all letters and numbers, leaving only symbolic information
      • 10) 1 Use the matching characters in the brackets as the word at the beginning of a line
    • Extended regular

      • 1) + matches one or more consecutive occurrences of the character before the plus sign
      • 2) | or relation symbol
        • egrep "oldboy|oldbey" test.txt matches oldboy or oldbey
      • 3) () Collect multiple character information into a whole
      • 4) {} Specify how many consecutive matches of the first character of the expansion sign
        • {n,m} n means the least number of consecutive matches and m means the most consecutive matches\
        • {n} n means only match n times in a row
        • {n,} n means match at least n times in a row, at most there is no limit
        • {,m} m means at most n consecutive matches, at least 0 times
        • 5)? Means to match the character before the question mark 0 times or 1 time rm -f FILE?

  1. ↩︎

Guess you like

Origin blog.csdn.net/weixin_43357497/article/details/110149656