Pipe and job control, shell variables, and environment variable profiles

Source: Internet
Author: User

One, pipe and operation control
1, the pipe symbol "|", is to put the results of the previous command run to the following command.
LS |wc-l; LS |grep test

2, how we are editing a file, want to pause this operation and exit can enter Ctrl Z Pause task

3. Jobs View background tasks

4. Bg[id] Transfer the task to the backstage; Fg[id] Move the mission to the front desk.

5, the command behind & directly dropped to the background, sleep 100 refers to the pause 100 seconds, and then continue to run

Second, shell variables

1. Get system variables using the command env command
PATH, HOME, PWD, logname, etc. are all variables.

Custom variables
Format: Variable name = variable Value
Variable name rule: it can be a letter, a number, an underscore, but the first cannot be a number.
Variable Value rule: you need to enclose the special symbol in single quotation marks. (special symbols include spaces)

Variable value overlay, such as c=a, variable b value, c

Global Variables Export
When we customize a variable on a terminal, it is limited to the shell under the current terminal to take effect, if you open a sub-shell under this terminal, this variable is not synchronized past, this is called non-global variables. If you want all of the child shells to synchronize this custom variable, use the global variable command: Export (only valid from top to bottom, not vice)

If you want to cancel a custom variable, use the command: unset variable name

III. environment variable configuration file
1,/etc/profile: This file presets a few important variables, such as path, USER, LOGNAME, MAIL, INPUTRC, HOSTNAME, histsize, umask, etc.

2,/ETC/BASHRC: This file is mainly preset umask and PS1. This PS1 is the string of characters in front of us when we are knocking at the command:

(\u is the user, \h hostname, \w is the current directory, $ = ' # ', the average user is displayed as ' $ ', the root user is shown as #)
With color setting: ps1= ' [\033[01;32m]\[email protected]\h[\033[00m]:[\033[01;36m]\w[\033[00m]\$ '

Pipe and job control, shell variables, and environment variable profiles

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.