2018-1-11 Linux Learning Notes

Source: Internet
Author: User

8.6 Pipe symbol and job control

8.6.1 Pipe character
The pipe symbol "|", which is the function of handing the result of the previous command to the following command, such as Cat 1.txt | grep ' Test '
8.6.2 Operation Control

    • Ctrl + z: Pause a task
    • Ctrl + C: Terminate a task
    • Bg[id]: Put the task in the background to run, no ID is the most recent task (ID system to give the task number)
    • FG[ID]: The task is transferred to the foreground to run, no ID is the most recent task (ID system to give the task number)
    • Jobs: Viewing background tasks
    • If you add & at the back of the command to run the task directly in the background, such as entering sleep &, the task runs directly in the background.
8.7/8.8 Shell variables
    • variables, simply by using a simpler string instead of some special-meaning settings and data. Typically, shell-preset variables are capitalized, such as Path,home,pwd,logname.

    • to set the rules for a custom variable :

      1. The format of the variable is "a=b", where a is the variable name, B is the contents of the variable, and no space is allowed on either side of the equal sign.
      2. Variable names can only be made up of English, numeric, and underscores, and cannot begin with a number.
      3. Single quotation marks are required when the contents of a variable have special characters (such as spaces), but double quotation marks are required if the contents of the variable contain a single quotation mark.
      4. Variable content can accumulate the contents of other variables, need double quotation marks, such as A=b, echo $a "HOSTNAME"
    • The role of the global variable is to make this variable effective in the Shell's child shell, but the global variables declared by the child shell in turn do not take effect in the parent shell. That is, the global variable only takes effect in the child shell.
    • To cancel a variable, use the unset variable to cancel it.

Common commands:

    • ENV command: List all variables for system presets
    • Set command: Lists the system preset variables, as well as user-defined variables
    • W command: Displays a list of users who have logged in to the system and displays the instructions that the user is executing
    • Bash command: Enter child shell
    • echo $SSH _tty #查看当前用户的TTY号
8.9 environment variable configuration file [troubleshooting]
    • 8.9.1 system environment variable configuration file
    • /etc/profile
      The file presets several important variables like path, USER, LOGNAME, MAIL, INPUTRC, HOSTNAME, Histsize, Umask and so on.
    • /etc/bashrc
      The file is primarily pre-umask and PS1. This PS1 is the string of characters we have in front of the command, such as [[email protected] ~]#.
    • 8.9.2-person environment variable configuration file
    • ~/.bashrc
      This file contains bash information dedicated to your shell, which is read when you log on and every time you open a new shell. For example, you can write user-defined alias or custom variables to this file.
    • ~/.bash_profile
      Defines the file name of the user's personalization path and environment variable. Each user can use the file to enter shell information that is specific to their own use, which is performed only once when the user logs on.
    • ~/.bash_history
      Record history commands with.
    • ~/.bash_logout
      When you exit the shell, the file is executed. You can put some cleanup work into this file.

2018-1-11 Linux Learning Notes

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.