Unix Command Clarification

Hello Experts,

I'm getting the following error message when I try and enter the directory command ls or ls -l

Get someone shed some light on the issue.

Command 'ls' is available in '/bin/ls'
The command could not be located because '/bin' is not included in the PATH environment variable.
ls: command not found
carltonp@access-server:~$

or

carltonp@access-server:~$ ls -l
Command 'ls' is available in '/bin/ls'
The command could not be located because '/bin' is not included in the PATH environment variable.
ls: command not found
carltonp@access-server:~$

Cheers

Carlton
cpatte7372Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

omarfaridCommented:
Why don't you include /bin in PATH? try adding it with

PATH=$PATH:/bin ; export PATH
woolmilkporcCommented:
PATH is a variable which contains a string composed of the names of a number of directories.

These directories are searched by the shell for commands when you enter a command without a path specification.

Issue

export PATH=/bin/:/usr/bin

Now ls should work.

To make this setting permanent edit /etc/environment, with

sudo nano /etc/environment
or
sudo vi /etc/environment.

Look for the PATH=... line and correct (or add) it to look like this:

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

or the like.
arnoldCommented:
echo $PATH
PATH=/bin/:$PATH
export PATH

You may have a .login .profile .bashrc, etc. that redefines the PATH omitting the default system settings i.e. not including the $PATH on the end..
Active Protection takes the fight to cryptojacking

While there were several headline-grabbing ransomware attacks during in 2017, another big threat started appearing at the same time that didn’t get the same coverage – illicit cryptomining.

cpatte7372Author Commented:
To be totally straight I'm trying to find what directory a file called startup-config is located. I thought that ls -l would point me in the right direction - I'm a total newbie with unix.

Is there a command that I can use to find files, and their locations?

Cheers
omarfaridCommented:
try this command to find files

find / -name startup-config -exec ls -l {} \;
woolmilkporcCommented:
Try "find"

"man find" will tell you more. Basically it's

find / -type f -name "startup-config"

By the way, this file is most probably in /etc or one of its subdirectories, so try first

find /etc -type f -name "startup-config"

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
omarfaridCommented:
Or simply use below command for location

find / -name startup-config
cpatte7372Author Commented:
When I entered the command:

find /etc -type f -name "startup-config"

I got the following...

carltonp@access-server:~$ find /etc -type f -name "startup-config"
find: `/etc/ppp/peers': Permission denied
find: `/etc/ssl/private': Permission denied
find: `/etc/chatscripts': Permission denied
find: `/etc/skel/.ssh': Permission denied
find: `/etc/skel/.config/gtk-2.0': Permission denied
find: `/etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml': Permission denied
find: `/etc/skel/.config/xfce4/panel': Permission denied
find: `/etc/skel/.config/xfce4/desktop': Permission denied
find: `/etc/skel/.config/xfce4/xfwm4': Permission denied
find: `/etc/skel/.config/Terminal': Permission denied
find: `/etc/skel/.config/Thunar': Permission denied
find: `/etc/skel/.config/squeeze': Permission denied
find: `/etc/skel/.config/xfce4-session': Permission denied
find: `/etc/skel/.config/mousepad': Permission denied
find: `/etc/skel/.config/xfce4-dict': Permission denied
find: `/etc/skel/.config/ristretto': Permission denied
carltonp@access-server:~$  


Not sure where to look for startup-config ???
cpatte7372Author Commented:
After entering the search commands I couldn't find 'startup-config', although I know its up there...
omarfaridCommented:
can you run the command as root user?

Are you sure the file is there?
arnoldCommented:
Based on the responses you received you are likely using debian or ubuntu.
/bin/ls -l is the command you can run until you update the PATH which is what the message/error suggests.
cpatte7372Author Commented:
Unfortunately, I can't run the command as root user.

Yes, very sure the file is there....
woolmilkporcCommented:
sudo find /etc -type f -name "startup-config"
cpatte7372Author Commented:
OK, is there a command I can issue to 'Get' the file 'startup-config' from where-ever its located?
woolmilkporcCommented:
sudo find / -type f -name "startup-config"
cpatte7372Author Commented:
Arnold,

You're correct. See below:

Linux access-server 2.6.32-38-generic-pae #83-Ubuntu SMP Wed Jan 4 12:11:13 UTC 2012 i686 GNU/Linux
Ubuntu 10.04.4 LTS
cpatte7372Author Commented:
After entering sudo find /etc -type f -name "startup-config" I got a message saying that I wasn't in the 'sudoers file'
arnoldCommented:
export PATH=/bin/:$PATH
will eliminate the error you reference.

To avoid doing this piece meal, can you provide details on what it is you want to do as the end result?

http://www.cyberciti.biz/tips/how-to-controlling-access-to-linux-services.html

echo $PATH should tell you the current search path the system will use to locate commands.
i.e. if you run /bin/ls there is no searching,
when you run
ls the system will use the search path ($PATH) to see whether it can locate the command to run.  Ubuntu and debian have a tie in when a command can not be "found" to provide suggestions on how to address and resolve the issue. i.e. if you run a command that is unavailable because the package is not installed, the message will be the command is part of packageX run apt-get install packageX.

etc.
woolmilkporcCommented:
You'll have to be a member of the admin group.

If you can't login as a member of this group you will have to ask your administrator to add you to this group, otherwise you won't be able to accomplish your task.
cpatte7372Author Commented:
Arnold,

I would like to locate the file 'startup-config' and then ftp to my local pc.

Cheers
arnoldCommented:
find / -name "startup-config"
as others pointed out.
the command will go through the filesystem looking for the filename
do you have l2tpns installed? startup-config might be a generic name that is part of multiple packages
http://manpages.ubuntu.com/manpages/dapper/man5/startup-config.5.html

What is the end result that you want to achieve? i.e. you locate the file you make the alterations, what is it you are looking for the alterations to do?
cpatte7372Author Commented:
Hi Arnold,

The unix box being used to simulate cisco routers. The configs are copied into a file called startup-config and I'm trying to copy the file to my desktop.
cpatte7372Author Commented:
This might not be right place to ask this question, but I've mentioned to copy a file into sftp (secure file transfer). When I connect to the unix box with sftp I get all the unix commands that I asked about. However, I still can't locate the file....
arnoldCommented:
Your sftp session might be restricted to a location that does not contain the file.
Once you locate the file, you could use scp to transfer it.
scp file user@remotesyste:/path/to/where/you/want/the/file/
cpatte7372Author Commented:
So guys/gals,

I have these files on the Linux access-server 2.6.32-38-generic-pae #83-Ubuntu SMP Wed Jan 4 12:11:13 UTC 2012 i686 GNU/Linux
Ubuntu 10.04.4 LTS

DLS2#copy unix:?
unix:NETMAP          unix:config.sh       unix:kill.sh
unix:mefile          unix:myfile          unix:netmap.sh
unix:nvram_00191     unix:nvram_00192     unix:nvram_00193
unix:nvram_00194     unix:nvram_00195     unix:nvram_00196
unix:nvram_00197     unix:nvram_00198     unix:pid
unix:sftp            unix:start.sh        unix:startup-config
unix:vlan.dat-00195  unix:vlan.dat-00196  unix:vlan.dat-00197
unix:vlan.dat-00198  unix:wrapper-linux  


Is there anywhere I can transfer them through Get to my pc?

Cheers

Carlton
arnoldCommented:
You can download pscp.exe and transfer the data

On the windows box you would run
pscp.exe -R user@ubuntubox:/path/to/files .

This will copy the contents of the directory to the location where the command is run. Note the user used has to have access to the location where the files are.
D you have samba setup on the Ubuntu system? You could use it to share the folder so that it can be accessed by the windows workstation or alternatively mount a share from a windows platform and copy the files there.

mount -t cifs \\windows\share -o .......
http://ubuntuforums.org/showthread.php?t=288534
cpatte7372Author Commented:
arnold

Wow. That would be exactly what I need but I can't seem to find the path to any of the files I mentioned above....
arnoldCommented:
I am unsure what you mean. What do these files represent?
I am also not in a position to tell you where they might be.

pwd, cwd are commands to let you know where you are.
/bin/ls -l
cpatte7372Author Commented:
Cheers
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.