LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 11-12-2019, 06:04 PM   #1
jag1
LQ Newbie
 
Registered: Nov 2019
Posts: 3

Rep: Reputation: Disabled
no console commands works from nowhere


I wanted to install react native + android studio so i followed this guide on how to do that.
https://shift.infinite.red/painless-...x-39e2e4d58d89

Then from nowhere all these commands stopped working

npm list -g | head -n 1

bash: head: command not found
bash: npm: command not found

bash: apt-get: command not found
bash: sudo: command not found

bash: ls: command not found



how do i fix this?

Last edited by jag1; 11-12-2019 at 06:42 PM.
 
Old 11-12-2019, 08:20 PM   #2
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
pro tip blogs are usually poor quality

but seriously, your problems appear to be related to PATH


what do you get from
Code:
echo $PATH
does it contain /usr/bin:/bin ?

my guess is no
something must have gone wrong with the ~/.bash_profile and/or ~/.bashrc edits

first lets fix the PATH
Code:
PATH="/usr/bin:/bin:$PATH"
that "guide" seems to be a bit broken

Pro Tip: a keyboard typically contains three or more locks

one part

Code:
export JAVA_HOME="$HOME/jdk1.8.0_181" // Or your version of the jdk
export PATH=$PATH: "$JAVA_HOME/bin"
export ANDROID_HOME=$HOME/Android/Sdk export
PATH=$PATH:$ANDROID_HOME/tools export
PATH=$PATH:$ANDROID_HOME/tools/bin export
PATH=$PATH:$ANDROID_HOME/platform-tools export
PATH=$PATH:$ANDROID_HOME/emulator


#
the exports at the end of the lines *should* be at the start of the next line
( like the first 3 lines )

Pro Tip: water is wet

also , I don't like the look of

Code:
export PATH=$PATH: "$JAVA_HOME/bin"
there should be no space between : and "
Code:
export PATH=$PATH:"$JAVA_HOME/bin"
but I don't see how any of those would break the PATH, so I guess some typo crept it
maybe a missing $PATH or just a $
will know more once I see the output of that echo


EDIT:
it also asks you to edit /.bash_profile
I suspect that should be ~/.bash_profile
~ is shorthand for $HOME

Last edited by Firerat; 11-12-2019 at 08:29 PM.
 
3 members found this post helpful.
Old 11-13-2019, 01:58 AM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by Firerat View Post
but I don't see how any of those would break the PATH
I can see how that last one could break PATH.
 
Old 11-13-2019, 02:19 AM   #4
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
Quote:
Originally Posted by ondoho View Post
I can see how that last one could break PATH.
I don't see how it would break PATH
it would be a bit screwy
tagging : on the end effectively adds the Working Directory to PATH
some people do that on purpose ( too lazy to type ./ )
 
Old 11-14-2019, 12:56 AM   #5
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by Firerat View Post
tagging : on the end effectively adds the Working Directory to PATH
some people do that on purpose ( too lazy to type ./ )
Not on my system (bash 5.0.11):
Code:
$ export PATH=$PATH: "$JAVA_HOME/bin"
bash: export: `/bin': not a valid identifier
$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:
and I was not in /usr/lib/jvm/default/bin when I did this.

Yes, that random blog post seems to contain many outright errors.
 
Old 11-14-2019, 01:33 AM   #6
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
Quote:
Originally Posted by ondoho View Post
Not on my system (bash 5.0.11):
Code:
$ export PATH=$PATH: "$JAVA_HOME/bin"
bash: export: `/bin': not a valid identifier
$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:
and I was not in /usr/lib/jvm/default/bin when I did this.

Yes, that random blog post seems to contain many outright errors.
: got tagged on the end

now make some script, make exec. and see if you can run it without ./
 
Old 11-16-2019, 07:59 AM   #7
jag1
LQ Newbie
 
Registered: Nov 2019
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thanks for the reply guys.

echo $PATH gives me usr/local/lib

it probably broke when i was editing .bashrc i think but now I can not even find it in the UI. All i find is
bash.bashrc - etc
dot.bashrc - usr/share/base-files
bash.bashrc - usr/share/doc/adduser/examples ... ...
dot.bashrc - usr/share/docadduser/examples ... ...

I am so very new with linux so I have no idea what I am doing
 
1 members found this post helpful.
Old 11-16-2019, 08:13 AM   #8
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
bash is in the root of your home dir
~/.bashrc

files that begin with a . are "hidden"

if you are using gui you may need to configure the file manager to show hidden files
( I would have to research it, I don't use GUI file managers )


on the command line

Code:
nano ~/.bashrc
nano is a basic text editor

I won't expose you to vim just yet

you can launch a GUI text editor from the command line
I don't know what distro/DE you are using, so I can only guess.

gedit might be available ( I don't use GUI text editors either )
 
1 members found this post helpful.
Old 11-17-2019, 01:56 AM   #9
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by jag1 View Post
echo $PATH gives me usr/local/lib
You have to show us the full output.
And use CODE tags for output (see my signature).
 
  


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] LibreOffice printing dialog works in KDE, but nowhere else gargamel Slackware 7 10-14-2015 07:41 PM
Password don't works in graphical start login but works in console wowy Linux - General 4 05-26-2015 06:42 AM
Grub2/console-setup commands for console mode 132 x 43 without framebuffer LQ123 Debian 0 10-22-2013 09:44 AM
Sound works in browser but nowhere else Joe Soap Linux - Newbie 3 03-20-2007 11:18 AM
Script works in work dir but nowhere else Drutten Programming 7 10-01-2006 10:22 AM

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

All times are GMT -5. The time now is 11:27 AM.

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