Set path in Linux

Source: Internet
Author: User

The path value is a series of directories. When you run a program, Linux searches for these directories and uses the following command to set the path value. Use the Export command directly
Add the/data/test/Hellow. Sh script to the path so that the script can be executed in other directories. [Root @ localhost/] # cd/data/test

[Root @ localhost test] # ll

Total usage 4

-Rwx ------ 1 Root 32 October 25 13:02 Hellow. Sh
[Root @ localhost test] # echo $ path
# Show $ PATH variables

/Usr/Kerberos/sbin:/usr/Kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin: /usr/bin:/usr/x11r6/bin:/root/bin

[Root @ localhost test] # cd/
[Root @ localhost/] # export Path =/data/test: $ path
# Add the script path to $ path

[Root @ localhost/] # export | grep Test
# View $ path

Declare-x oldpwd = "/data/test"

Declare-XPath = "/data/test :/
Usr/Kerberos/sbin:/usr/Kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin: /usr/bin:/usr/x11r6/bin:/root/bin" Modify Profile File
[Root @ localhost/] # vi/etc/profileexport path user LOGNAME mail hostname histsize inputrc
# Join
  Modify the. Bash File
[Root @ localhost/] # vi/root/. bashrc


#. Bashrc

# User specific aliases and functions

Alias Rm = Rm-I

Alias CP = CP-I

Alias mv = MV-I

# Source Global definitions

If [-F/etc/bashrc]; then

./Etc/bashrc

Fi

Export Path = "$ path:/data/test /"


 


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.