LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 05-24-2018, 10:18 AM   #1
pawarsachin84
LQ Newbie
 
Registered: May 2018
Posts: 3

Rep: Reputation: Disabled
Unhappy Unable to execute any command in CentOS7 - Using Vagrant Application


Hi All,

I am new to CentOS7 or Linux OS. I am learing vagrant tool and something got mess up I am unable to execute any command.

$ls -ltr
-bash: ls: command not found

[vagrant@localhost ~]$ pwd
/home/vagrant

I am loggin as vagrant user. sudo su - is also not working.
[vagrant@localhost ~]$ sudo su -
-bash: sudo: command not found
[vagrant@localhost ~]$

Please help. Let me know if you need any further details.

Thanks & Regards,
Sachin Pawar
 
Old 05-24-2018, 10:29 AM   #2
Keruskerfuerst
Senior Member
 
Registered: Oct 2005
Location: Horgau, Germany
Distribution: Manjaro KDE, Win 10
Posts: 2,199

Rep: Reputation: 164Reputation: 164
When bash is not working, then you have a problem.
You way want install bash by different ways.
 
Old 05-24-2018, 02:04 PM   #3
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,748

Rep: Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222
It sounds like your $PATH is not set.
What are the contents of ~/.bashrc and ~/.bash_profile ?
 
Old 05-24-2018, 09:05 PM   #4
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,382
Blog Entries: 28

Rep: Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164
Alternatively, what is the output of $PATH:

Code:
$ $PATH
bash: /usr/local/bin:/usr/bin:/bin:/usr/games:/usr/lib64/kde4/libexe
If the application is installed to your home directory, it is likely not in your path. You should be able to run them using the complete /path/to/application.
 
Old 05-25-2018, 08:47 AM   #5
pawarsachin84
LQ Newbie
 
Registered: May 2018
Posts: 3

Original Poster
Rep: Reputation: Disabled
Hi All,

Thanks for your suggestions.

1. Regarding output of 1st (scasey) reply is ....
[vagrant@localhost ~]$ locate bash-completion.sh
-bash: locate: command not found
[vagrant@localhost ~]$
===========================================

2. Regarding output of 2nd (scasey) reply is ...
[vagrant@localhost ~]$ vi ~/.bashrc
-bash: vi: command not found
[vagrant@localhost ~]$
-----------------------------
[vagrant@localhost ~]$ vi ~/.bash_profile
-bash: vi: command not found
[vagrant@localhost ~]$
===========================================

3. Regarding 3rd reply (frankbell) output is ....
[vagrant@localhost ~]$ echo $PATH
/opt/maven/bin:PATH:/home/vagrant/.local/bin:/home/vagrant/bin
[vagrant@localhost ~]$

sorry if I did anything wrong here... Please let me know if you need any further details.

Thanks & Regards,
Sachin Pawar
 
Old 05-25-2018, 02:53 PM   #6
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,748

Rep: Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222
Looks like the system utility directories are missing from your PATH. At a minimum it should include /bin, /usr/bin and /usr/local/bin

On my CentOS installation, PATH includes
Code:
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:
Until that's fixed, you'll need to supply the absolute path to a utility, e.g.
Code:
/bin/vi ~/.bashrc
...or, temporarily,
Code:
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:$PATH
should allow ls and vi to work again.

Is it possible that the PATH got corrupted in this login instance? Have you tried rebooting?
 
Old 05-27-2018, 03:15 AM   #7
pawarsachin84
LQ Newbie
 
Registered: May 2018
Posts: 3

Original Poster
Rep: Reputation: Disabled
Hi All,

Thank for your suggestions. I figured it out. I have added two files under /etc/profile.d/

java.sh & maven.sh and these file got messed up. So my friend helped me in it.

He performed this command - $export PATH=$PATH:/usr/bin/ Then, he moved those files (java.sh & maven.sh) form /etc/profile.d to /var/tmp

Now everything works fine as expected. Once again thanks for your help & support.

Thanks & Regards,
Sachin Pawar
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] error: unable to execute application DiBosco Linux - Software 23 10-12-2019 04:31 AM
sed unable to read/execute second command pump1t Other *NIX 1 09-12-2014 12:39 AM
Vagrant+Ansible playbooks. How to use same playbook on non vagrant provision markotitel Linux - Virtualization and Cloud 1 12-06-2013 09:00 AM
unable to execute qemu command 'cont' DD554 Linux - Virtualization and Cloud 2 11-14-2013 12:55 PM
Unable to execute an application with wine kamlendu Linux - Software 2 06-03-2008 12:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 05:53 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