4. Input and output redirection, pipe character, Vim editor

Redirection-Operator between command and file

  • Output redirection (write output information to a file)
    standard output-">"
    error output-"2>"
    all output-"&>"
    if additional writing, add a ">" at the end, such as: "> >", "2>>", "&>>"
  • Input redirection (the opposite of the above)-"<"

    Pipe symbol-operator between command and command (any gate)

  • Separate the two commands with a vertical line, and hand over the previous command to the next command for processing
  • Such as: ls|wc-l ie: use the wc command to count the number of lines of file information listed by the ls command

    Wildcard

    "* "-0 or more
    "?"-at least one
    "[ ]"-matches a single character (similar to regular expressions, such as "or" is separated by ",")
    "{ }"-matches A string

character meaning
* Match 0 or more characters
Match any character
[list] Match any single character in the list
[!list] Match characters except any single character in list
[c1-c2] Match any single character in c1-c2, such as: [0-9] [az]
{string1,string2,...} Match one of sring1 or string2 (or more)
{c2..c2} Match all characters in c1-c2 such as {1..10} to generate sequence

Escapes

  • "\" refers to the escape character of the programming language
  • Special characters in double quotes should be escaped with "\"
  • All special characters in single quotes will be directly escaped, including the "$" operator for reading variables
  • The commands written in the backticks will be executed (can be used for script file writing)

    Vim editor

    Command mode, input mode (edit mode), last line mode

Input mode and last line mode can not be converted directly

Common commands in command line mode:

  • dd: delete (cut) the entire line where the cursor is

  • Number dd: delete (cut) the number line where the cursor is located

  • yy: copy the entire line where the cursor is

  • Number yy: copy the number line where the cursor is

  • u: undo the operation of the previous step

Common commands in the last line mode:

  • : Set nu: display line number

  • : Set nonu: do not display the line number

  • : Integer: Jump to change line

  • ?String: Search the string from bottom to top in the text

  • /String: Search the string from top to bottom in the text
    4. Input and output redirection, pipe character, Vim editor4. Input and output redirection, pipe character, Vim editor

Guess you like

Origin blog.51cto.com/14846455/2596934