Linux system executables Add environment variables to make them run across terminals and directories

Source: Internet
Author: User

At the command line terminal input: Echo $PATH Enter to print out the path corresponding to the paths variable

An existing executable file QTFIRSTC, the directory where the file is:/HOME/LOLORS/QTFIRSTC

Now test can only run in this directory, how to run across terminals or directories, like LS, CD and other commands?

Workaround:

1. Cross-directory, not across the terminal, temporary effect: the operation, that is, add temporary environment variables, can only be used under this terminal, only for the current user to take effect.

2. Both cross-directory, and cross-terminal, permanent effect:

1). Modify the directory under the/etc/profile file, add the last line: Export path= $PATH:/HOME/LOLORS/QTFIRSTC, save exit, take effect for all users.

At this time the file is not in effect, in order to take effect can restart the system, after reboot for all the terminal, all users take effect.

2). It is also a permanent method, but this time the modified file is/etc/environment, modified to save. After rebooting, all users are in effect for all terminals.

3) Permanent, the current user takes effect, do not need to restart the system to take effect.

Modify/HOME/LOLORS/.BASHRC file: Add a line at the end of the file: Export path= $PATH:/HOME/LOLORS/QTFIRSTC

Effective method: ① re-open the terminal,

③source/home/lolors/.bashrc

Linux system executables Add environment variables to make them run across terminals and directories

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.