edit PATH linux

  1. Open the terminal.

  2. Use the nano or vim text editor to open the shell configuration file. The file may be one of the following, depending on the shell used:

  3. For Bash: ~/.bashrc or ~/.bash_profile.
  4. For Zsh: ~/.zshrc.
  5. For Fish: ~/.config/fish/config.fish.

  6. Navigate to the end of the file using the arrow keys.

  7. Add the following line to append a directory to the PATH variable, replacing "/your/new/path" with the actual path you want to add: bash export PATH=$PATH:/your/new/path

  8. Save the changes and exit the text editor:

  9. For nano, press Ctrl + X, then press Y,