DevOps/Cloud By GK
  • DevOps/Cloud Introduction
  • 🚩AWS
    • Create AWS Account
    • Launch EC2 Instance
  • 🚩Linux
    • User Managment
      • Adding the User to Sudo group
      • visudo
    • Directory / File Management
      • Vi
      • Changing Permissions (chmod)
      • Filtering IO/File
    • Memory Management
    • Process Management
    • Network Management
    • Service Management
    • Environmental Variables
      • $PATH
    • Utilities
    • SHELL PROGRAMMING
      • Hello World
      • Variables
      • Command Line arguments
      • Conditional Statements
      • Array
      • Loops
      • Functions
      • AWK
      • sed
      • Example Useful Scripts
      • Basic -> Advanced
  • 🚩git
    • Introduction
    • Creating GitHub Account
    • Installation
      • Git Bash In Windows
      • Git In VS Code
      • Git In Eclipse
      • Git CLI in Linux
  • Creating Git Remote Repository
  • Git Commands L -> R
  • Git Commands L <- R
  • Git Branch Commands
  • Using SSH (Password Less)
  • 🚩maven
    • Introduction
    • Installation
    • POM.xml
    • Goals
  • 🚩SonarQube
    • Introduction
    • Sonar Cloud
    • Creating Project In SonarCloud
    • Installing Sonar-Scanner
    • Triggering Scan
  • 🚩Nexus
    • Introduction
    • Installation of Nexus
    • Creating Repository
    • Uploading Artifacts to Repository
  • 🚩Jenkins
    • Introduction
    • Installation of Jenkins
    • First Job In Jenkins
    • Git + Jenkins
      • WebHook
    • Maven + Jenkins
    • Sonar-Scanner + Jenkins
    • Nexus + Jenkins
Powered by GitBook
On this page
  1. Linux
  2. Environmental Variables

$PATH

To set the PATH for a specific tool, you can follow these steps:

  1. Identify the tool's directory: Determine the directory where the tool's executable file is located. For example, let's assume the tool is located in /path/to/tool_directory.

  2. Temporarily set the PATH: Open a terminal and use the following command to temporarily set the PATH for the current shell session:

    export PATH="/path/to/tool_directory:$PATH"

    This command adds /path/to/tool_directory to the beginning of the PATH variable, ensuring that the shell looks for the tool's executable file in that directory first. Note that the existing value of PATH ($PATH) is appended after the new directory, separated by a colon (:).

    With this temporary setting, you can use the tool from the command line within the current session.

  3. Permanent PATH setting:

    • For a single user: If you want to set the PATH permanently for a specific user, you can add the export command to the user's shell startup file (~/.bashrc, ~/.bash_profile, or ~/.profile). Open the desired file using a text editor and add a line like this:

      export PATH="/path/to/tool_directory:$PATH"

      Save the file and either open a new shell session or run the source command to apply the changes to the current session:

      source ~/.bashrc

      Replace ~/.bashrc with the appropriate shell startup file for your shell.

    • For all users: If you want to set the PATH system-wide for all users, you can modify the /etc/environment file. Open the file as root using a text editor and modify the line that starts with "PATH=". Make sure to include the /path/to/tool_directory along with the existing PATH directories, separating them with a colon (:). For example:

      PATH="/path/to/tool_directory:$PATH"

      Save the file. The next time the system starts or a new shell session is opened, the modified PATH variable will take effect for all users.

With the PATH set appropriately, you should be able to run the tool from any location in the command line without specifying its full path.

PreviousEnvironmental VariablesNextUtilities

Last updated 2 years ago

🚩