Pipe and job control, shell variables, environment variable profiles

Source: Internet
Author: User

Pipe character and job control

; indicates that the previous command executes the next command in sequence

[email protected] ~]# cat 1.txt |wc-l; Cat 1.txt |grep ' aaa '

2

AAAAAAAAAA

Aaqweaaaaaaaaa


&&: The previous command is correct to execute the following command; If the previous command is wrong, it will not be executed.

|| : The current command executes successfully, followed by no execution, and, conversely, if the previous command is unsuccessful, the following command is executed

CTRL Z pauses a task

Jobs view the tasks in the background

Bg[id] Move the mission to the background.

Fg[id] Move the mission to the front desk.

The command adds & drops directly to the background; this is usually a script that executes


Shell variables

1. Output Environment variables

[Email protected] ~]# echo "$PATH"

/usr/local/jdk1.8.0_11/bin:/usr/local/jdk1.8.0_11/jre/bin:/usr/local/svn//bin:/usr/local/apache-maven-3.5.0/ Bin:/usr/local/bin/composer:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin


2. Let the environment variable take effect temporarily

Export path= $PATH:/opt/au1200_rm/build_tools/bin

3, the permanent entry into the configuration file

/etc/profile


Env

Also view environment variables, you can search


environment variable configuration file

/etc/profile all user environment variables, interactive, login only execution

/ETC/BASHRC All users do not have to log in, the execution shell is effective

~/.BASHRC the user's home directory, when the user logs on and every time the new shell is opened, the file is read, including the alias

~/.bash_profile Each user can use this file to enter shell information dedicated to their own use, when the user logs on, the file is only executed once! By default, he sets some environment variables to execute the user's. bashrc file.

~/.bash_history records the current user's history

~/.bash_logout execution when exiting login


1.login Shell and Non-login shell concept

(1) Login shell

Obtaining a shell (such as bash) requires a complete login process, called the login shell. For example, with Tty1-tty6 login, enter the user's account and password, the obtained shell is called "Login Shell"

(2) Non-login shell

Get the process that the shell does not require account login. For example, after you log in to Linux on the X window (graphical desktop), right-click the command-line window on the desktop and do not need to log in with your account name and password, the bash environment is called the Non-login shell. In bash, for example, it executes the bash command again, gets the child bash process, and there is no login action, and the child bash process is also the non-login shell.


The difference between a 2.login shell and a non-login shell

The core difference between the login shell and the Non-login shell is that the configuration files are read differently when the shell is acquired.

(1) config file read by login Shell

/etc/profile the file to set the overall environment of the system, usually the configuration of some environment variables.

One of the three ~/.bash_profile or ~/.bash_login or ~/.profile, which is the user's personal settings

(2) Non-login Shell Read configuration file

~/.bashrc

Note, we usually add environment variables that are modified in/eth/profile or ~/.bash_profile. For example, add a new path to the PATH environment variable:

[Plain] View plain copy

#将/home/local/tmux/bin added to the environment variable path

Export Path=/home/local/tmux/bin: $PATH

Or

Path=/home/local/tmux/bin: $PATH

Export PATH



This article is from the "Discover new things" blog, make sure to keep this source http://shenj.blog.51cto.com/5802843/1978734

Pipe and job control, shell variables, 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.