Zhang Keke
by Zhang Keke
~1 min read

Categories

Tags

Table of Contents

  1. How to add commands to $PATH in Linux or Mac?
    1. What is PATH?
      1. Option1:Set PATH for your current shell session
      2. Option2:Change your PATH permanently

How to add commands to $PATH in Linux or Mac?


What is PATH?

PATH is a variable in $ \star$nix system which tells the command path

Option1:Set PATH for your current shell session

export PATH=$PATH:/path/to/your/directory
  • Done

Option2:Change your PATH permanently

  • Edit your .bash_profile(if you ues Bash) or .zshrc( if using zsh)
  • add path at the end of the file
export PATH=$PATH:/path/to/your/directory
OR
export PATH=/path/to/your/directory:$PATH
  • Active your changes
source .bash_profile
OR
source .zshrc
  • Done