Add System Path in linux

Source: Internet
Author: User

The linux system path has been added for nearly half a year since it was switched to linux, and there is still a long way to go from skilled use. The reason for slow growth is not that many problems have not been encountered, however, I encountered problems but failed to record them in time and review them in time. Of course, I was not able to give a thorough explanation. I often think that the problem is very simple and it is not worth recording. In fact, linux is not very complicated, and its depth lies in its flexibility. It has a lot of knowledge points like English; once you have mastered a lot of small knowledge points, it's easy to get familiar with it. As a newbie, www.2cto.com often suffers from the headache of hitting the path of a large segment to execute commands after installing a new program. For example, after I install redis, if I want to enter the client, I have to input/opt/redis/src/redis-cli every time, which is very troublesome. The solution to this problem is to add the path of the command to the system path. Enter/etc at www.2cto.com and edit the profile (remember to back up to avoid failure ). [Cpp] #/etc/profile: system-wide. profile file for the Bourne shell (sh (1) # and Bourne compatible shells (bash (1), ksh (1), ash (1 ),...). if ["$ PS1"]; then if ["$ BASH"] & ["$ BASH "! = "/Bin/sh"]; then # The file bash. bashrc already sets the default PS1. # PS1 = '\ h: \ w \ $' if [-f/etc/bash. bashrc]; then. /etc/bash. bashrc fi else if ["'id-U'"-eq 0]; then PS1 = '# 'else PS1 =' $ 'fi fi # The default umask is now handled by pam_umask. # See pam_umask (8) and/etc/login. defs. if [-d/etc/profile. d]; then for I in/etc/profile. d /*. sh; do if [-r $ I]; then. $ I fi done unset I fi <em> <strong> <span style = "color: #000000;"> REDIS_HOME = "/opt/redis-2.6.10/src" PATH = "$ PATH: $ REDIS_HOME "export PATH </span> </strong> </em> follow the bold slash to add it. After the machine is restarted, you can see that it has taken effect. Echo "$ PATH", you can see that REDIS_HOME has been added. However, the export PATH = "new path" method in the command line will expire after restart (the cause is unknown ).

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.