Home Man
Search
Today's Posts
Register

If you're not sure where to post a Unix or Linux question, post it here. All unix and Linux beginners welcome in this forum!

Not able to execute standard commands on centos 7 server

Tags
centos 7, commands, server, solved, standards

Login to Reply

 
Thread Tools Search this Thread
# 1  
Old 1 Week Ago
Not able to execute standard commands on centos 7 server

I am not able to run basic commands on my centos 7 server. The PATH variable looks correct I think. I have not seen this before and not sure what to do next. Thank you .


Code:
# cd /usr/bin
# ls
bash: ls: command not found...
Similar command is: 'lz'
nano ~/.bashrc
bash: nano: command not found...
# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/sbin:/root/bin:/root/bin

# 2  
Old 1 Week Ago
Hmmmm.......the first thing to do is to find out whether the 'ls' command executable exists or whether your O/S installation is damaged.

Ask the system for the location of the 'ls' command by either:

Code:
# which ls

or

Code:
# find / -name ls -print

If either of those comes out with a pathname then try to execute:

Code:
# <full pathname of ls command as output>

to see if it works.

If you cannot find where 'ls' is located with the above, then the installation has been damaged resulting in the command 'ls' no longer existing.

The above assumes that you have root access to the system.

Last edited by hicksd8; 1 Week Ago at 04:41 PM..
The Following User Says Thank You to hicksd8 For This Useful Post:
cmccabe (1 Week Ago)
# 3  
Old 1 Week Ago
On many UNIX, Linux, and BSD systems, one would expect the standard commands to be located in /bin or /usr/bin (neither of which are included in the directories in your PATH setting).
The Following User Says Thank You to Don Cragun For This Useful Post:
cmccabe (1 Week Ago)
# 4  
Old 1 Week Ago
Since the commands didn't return anything @hicksd8, the $PATH variable may need to be edited to include /usr/bin where ls and nano reside.

I seem to have issues setting $PATH, so if I do:

Code:
sudo /usr/bino/nano ~/.bashrc

and edit

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/sbin:/root/bin:/root/bin (current PATH)

to include /usr/bin

Code:
/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/usr/sbin:/root/bin:/root/bin

Is that the correct place and why are some lines duplicated? Thank you .

Last edited by cmccabe; 1 Week Ago at 09:42 AM.. Reason: fixed format
# 5  
Old 1 Week Ago
Check /etc/profile and /etc/environment files for the statement that sets the PATH variable. Be sure /bin and /usr/bin are included.

Otherwise, if whatever went wrong may have originated there, it will cause more problems on reboot.
The Following User Says Thank You to jim mcnamara For This Useful Post:
cmccabe (5 Days Ago)
# 6  
Old 1 Week Ago
You have /usr/sbin in your PATH setting twice. Having any directory in PATH more than once will slow down access to any utilities found in any directory after the second occurrence of that directory.

Unless you have some utility that appears in more than one of the directories in PATH, you want the directory that contains the most frequently used utilities first in your PATH and the directory containing the utilities that are the least frequently used last in your PATH. Under usual circumstances, you'll want to put /usr/bin first in PATH (and get rid of one of the /usr/sbin entries and one of the /root/bin entries) like:
Code:
/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/root/bin

Given the naming conventions used on the directories in your PATH, is there also a /root/sbin directory containing utilities that you sometimes want to find? And, as Jim suggested, if your system has /bin and /usr/bin as distinct directories, be sure that both of them are included in PATH.
The Following User Says Thank You to Don Cragun For This Useful Post:
cmccabe (5 Days Ago)
# 7  
Old 5 Days Ago
Thank you all for your help .
Login to Reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Nim server "Unable to execute remote client commands" getrue AIX 2 12-14-2017 12:53 AM
How to execute commands on remote server using expect script? kchinnam Shell Programming and Scripting 1 03-20-2016 10:22 PM
how do i execute a set of commands in telnet?? nikhil jain Shell Programming and Scripting 4 03-22-2012 02:01 AM
How to execute standard output ? Bertieboy7 Shell Programming and Scripting 3 11-07-2010 10:27 AM
how to run non-standard commands in bash script? EinsteinMcfly Shell Programming and Scripting 12 08-05-2010 01:25 AM
ssh - to execute set of commands id100 Shell Programming and Scripting 2 04-28-2010 06:40 AM
Centos commands: Yum Upgrade versus Yum update mojoman UNIX for Dummies Questions & Answers 3 01-28-2010 11:21 AM
Can BASH execute commands on a remote server when the commands are embedded in shell bash_in_my_head Shell Programming and Scripting 1 12-04-2008 12:51 AM
lom don't execute commands pasalagua Solaris 6 01-25-2008 03:22 PM
code that reads commands from the standard i/p and executes the commands Phrozen Smoke Programming 4 01-22-2007 01:06 AM


All times are GMT -4. The time now is 07:55 AM.

Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password