LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-18-2024, 12:33 PM   #1
mahesh.riddles
LQ Newbie
 
Registered: Feb 2024
Posts: 8

Rep: Reputation: 1
bash ng: command not found


My path variable is not updated.
I have installed angular.


Code:
export PATH=$PATH:~/.npm-global/bin
source ~/.bashrc
It did not work after restarting the terminal.
But worked on that session. I was able to use "ng"

Then i tried
Code:
export PATH=$PATH:~/.npm-global/bin
source ~/.bash_profile
Same. It worked on that session.
After restarting terminal, it did not work.

echo $PATH is not showing ".npm-global/bin" after restarting the terminal
It is fedora latest.

Code:
echo $SHELL
/bin/bash
Code:
mahesh@fedora:~$ ls .
./                    .config/              .npmrc
../                   .dotnet/              .pki/
.angular-config.json  .gnome/               .quokka/
.bash_history         .local/               .var/
.bash_logout          .mozilla/             .viminfo
.bash_profile         .mysql/               .vscode/
.bashrc               .npm/                 .wallaby/
.cache/               .npm-global/
 
Old 02-18-2024, 12:55 PM   #2
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,732

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
export only puts the updated PATH in memory for that session only. sourcing .bashrc is not required.
To make the PATH change permanent, put the export statement in .bashrc, then source .bashrc or restart the terminal.
 
1 members found this post helpful.
Old 02-19-2024, 05:40 AM   #3
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,800

Rep: Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201
A nested bash inherits PATH and runs .bashrc, so PATH is expanded again.
The following ensures that PATH is expanded only once.
Code:
_newpath=$HOME/.npm-global/bin; [[ :$PATH: == *":$_newpath:"* ]] || export PATH=$PATH:$_newpath; unset _newpath
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] No package 'x11' found No package 'xext' found No package 'xdamage' found No package 'xfixes' found No package 'x11-xcb' found Jigsaw Linux From Scratch 14 02-23-2021 08:35 PM
"Command not found" on my server? “bash: sudo: command not found”? MilesOfRoses Linux - Server 7 04-01-2016 09:19 AM
Directory not found; -xzvf not found; Makefile not found RealGomer Linux - Software 4 09-20-2010 10:02 AM
bash: rpm: command not found && sudo: alien: command not found Java_Code Ubuntu 7 07-27-2006 11:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration