Shell features, wildcard characters, input and output redirection, command history

Source: Internet
Author: User
Tags aliases

One: Shell introduction

The shell is a command interpreter that provides interaction between the user and the machine, supports specific syntax, and each user can have his or her own specific shell,centos default of bash, and Zsh,ksh.

Two: Command history

History command
environment variable histsize, in/etc/profle, you can set the modified environment variable value, modify the maximum number of saved. You need to change the source a bit.
Time to save the history command:
histtimeformat= "%y/%m/%d%h:%m:%s"
Historical commands Save up to 1000 in the. bash_history file in the home directory, and commands that run in the current shell are saved to the file only if the user exits the current shell normally.
Daily usage:

    1. !! Executes the previous command
    2. !n executing the nth instruction in the command history
    3. ! The string executes the last instruction that begins with the string: command completion and aliases

      tab, tap the Fill command or path, and double-click to display multiple options.
      Alias command:
      Give a long command a good name. Can be dismissed with the Unalias command.
      Syntax: alias aliases = ' Specific commands '
      Each user's custom alias is configured in the. bashrc file in the home directory

      Four: wildcard characters, input and output redirection

      Wildcard characters:
      * Match 0 or more characters
      ? Match one character
      > Output redirection
      >> Chasing heavier orientation
      < input redirection
      2> Error Redirection
      2>> Error Append redirect
      # comment Symbols
      \ de-ideographic characters
      | Pipe character, the result of running the previous command as input to the following command (text is manipulated)
      $ for the identifier preceding the variable
      The delimiter between multiple commands, regardless of whether the former succeeds or not, executes the latter
      && only if the former succeeds, the latter will be executed.
      | | Two commands to execute only one piece of
      ~ User's Home directory
      & put commands in the background to execute
      [] The middle is a character combination that represents either of the intermediate characters
      Command >1.txt 2>&1 correct output to 1.txt, error output to &1, i.e. 1.txt

Shell features, wildcard characters, input and output redirection, command history

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.