OS X - Operating System General OS operation information and support

Terminal Commands Not Working


Post Reply New Thread Subscribe

 
Thread Tools
danj35

 
Member Since: Jan 03, 2012
Posts: 6
danj35 is on a distinguished road

danj35 is offline
Hi,

For some reason some terminal commands which I assume should be working by default are not working, including: netstat and lsof.

I am running on Snow Leopard, 10.6.8. I guess this might have something to with the terminal commands file? Any suggestions would be greatly appreciated.

Thanks,

Dan
QUOTE Thanks
Dysfunction

 
Dysfunction's Avatar
 
Member Since: Mar 17, 2008
Location: Tucson, AZ
Posts: 6,588
Dysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant future
Mac Specs: 2008 and 2011 15" mbps, late 11 iMac, iPhone 4s, and too many ipods and other stuff

Dysfunction is online now
What do you mean by 'not working'?

mike
This machine kills fascists
Got # ? phear the command line!
QUOTE Thanks
danj35

 
Member Since: Jan 03, 2012
Posts: 6
danj35 is on a distinguished road

danj35 is offline
It says 'command not found'.
QUOTE Thanks
Dysfunction

 
Dysfunction's Avatar
 
Member Since: Mar 17, 2008
Location: Tucson, AZ
Posts: 6,588
Dysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant future
Mac Specs: 2008 and 2011 15" mbps, late 11 iMac, iPhone 4s, and too many ipods and other stuff

Dysfunction is online now
is /usr/sbin in your path?

mike
This machine kills fascists
Got # ? phear the command line!
QUOTE Thanks
danj35

 
Member Since: Jan 03, 2012
Posts: 6
danj35 is on a distinguished road

danj35 is offline
Yes it is. I can't see netstat or lsof in there. Quite odd. Is there a way of installing these?

Last edited by danj35; 01-03-2012 at 09:10 AM.
QUOTE Thanks
Dysfunction

 
Dysfunction's Avatar
 
Member Since: Mar 17, 2008
Location: Tucson, AZ
Posts: 6,588
Dysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant future
Mac Specs: 2008 and 2011 15" mbps, late 11 iMac, iPhone 4s, and too many ipods and other stuff

Dysfunction is online now
They SHOULD be installed by default. I'm not aware of any method of installing them manually. I don't believe that either require xCode to be installed.

mike
This machine kills fascists
Got # ? phear the command line!
QUOTE Thanks
danj35

 
Member Since: Jan 03, 2012
Posts: 6
danj35 is on a distinguished road

danj35 is offline
Bah. I can only find a netstat widget online. I have no idea why they're not there to begin with!
QUOTE Thanks
Dysfunction

 
Dysfunction's Avatar
 
Member Since: Mar 17, 2008
Location: Tucson, AZ
Posts: 6,588
Dysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant future
Mac Specs: 2008 and 2011 15" mbps, late 11 iMac, iPhone 4s, and too many ipods and other stuff

Dysfunction is online now
Was this a new install? Used computer? etc?

could try a

sudo find / |grep lsof

and see it it's just in an oddball location I suppose

mike
This machine kills fascists
Got # ? phear the command line!
QUOTE Thanks
danj35

 
Member Since: Jan 03, 2012
Posts: 6
danj35 is on a distinguished road

danj35 is offline
I've inherited it at work and it seems as though you're right. Having now found the folder where there progs are I can only open them and not use them as commands e.g., 'netstat -r' or 'lsof -i -P | grep -i "listen"'. Any ideas how to amend this? Thanks for your help.
QUOTE Thanks
Dysfunction

 
Dysfunction's Avatar
 
Member Since: Mar 17, 2008
Location: Tucson, AZ
Posts: 6,588
Dysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant future
Mac Specs: 2008 and 2011 15" mbps, late 11 iMac, iPhone 4s, and too many ipods and other stuff

Dysfunction is online now
Sure, you can simply add the directory to your path. You'd just need to add something like

export PATH=/path/to/commands:$PATH

to your .profile or .bashrc , etc then restart your terminal login

mike
This machine kills fascists
Got # ? phear the command line!

Last edited by vansmith; 01-03-2012 at 10:02 AM. Reason: Disabled smileys so the command appears properly ;)
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Ottawa
Posts: 15,453
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
I've no idea why this would have happened (why these binaries are in non-standard directories). I wonder how much is in non-standard locations...

Out of curiosity, where did you end up finding these tools?

Important Links: Community Guidelines : Use the reputation system if you've been helped.
M-F Blog :: Write for the blog :: M-F IRC Channel - Chats every Sunday at 8PM EST.
QUOTE Thanks
IvanLasston

 
IvanLasston's Avatar
 
Member Since: Feb 26, 2010
Location: Rocky Mountain High, Colorado
Posts: 2,116
IvanLasston is a splendid one to beholdIvanLasston is a splendid one to beholdIvanLasston is a splendid one to beholdIvanLasston is a splendid one to beholdIvanLasston is a splendid one to beholdIvanLasston is a splendid one to beholdIvanLasston is a splendid one to beholdIvanLasston is a splendid one to behold
Mac Specs: 1.8 GHz i7 MBA 11" OSX 10.8.2

IvanLasston is offline
Are they executable? i.e.
Code:
ls -l netstat 
-r-xr-xr-x  1 root  wheel  218752 Jul 20 16:30 netstat*
The x bits should be set.
So they do have to be in the Path as dysfunction mentions, but they also have to be executable.
Code:
chmod 555 netstat
will change the file to an executable.
QUOTE Thanks
danj35

 
Member Since: Jan 03, 2012
Posts: 6
danj35 is on a distinguished road

danj35 is offline
It was in a folder named /usr/tbin/. Netstat is executable thanks. So to be clear (as a nube) I'm exporting to .profile using the command: '
Code:
export PATH=/usr/tbin:$PATH
'. In which case it didn't work (having restarted terminal). Thanks again for the help.
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Ottawa
Posts: 15,453
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
The export command will only work for the session. You need to add that to your .bash_profile in your home directory such that the path is added every time you open up Terminal.

I don't understand why you have a /usr/tbin directory. Do you have /usr/sbin? If not, it's possible that sbin was moved to tbin (for whatever reason).

Important Links: Community Guidelines : Use the reputation system if you've been helped.
M-F Blog :: Write for the blog :: M-F IRC Channel - Chats every Sunday at 8PM EST.
QUOTE Thanks
Dysfunction

 
Dysfunction's Avatar
 
Member Since: Mar 17, 2008
Location: Tucson, AZ
Posts: 6,588
Dysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant future
Mac Specs: 2008 and 2011 15" mbps, late 11 iMac, iPhone 4s, and too many ipods and other stuff

Dysfunction is online now
Yes, if you have a .bash_profile you need to use that. If you don't, it should pick up .profile. Sounds like you have a .bash_profile.

mike
This machine kills fascists
Got # ? phear the command line!
QUOTE Thanks

Post Reply New Thread Subscribe


« Temporary Internet Files | OS X 10.5.8 Java Issues »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Automatically save log files of terminal sessions Stubaan OS X - Apps and Games 3 04-02-2013 11:24 AM
Terminal Won't Open icefall5 OS X - Operating System 7 08-25-2010 08:26 AM
isight isn't working at all whatsoever! Help? Dejerademy Apple Notebooks 1 07-01-2010 10:48 AM
Automated Terminal Commands sarahsboy18 OS X - Operating System 3 09-09-2005 07:39 PM
useful terminal commands moz Switcher Hangout 4 06-24-2005 11:06 AM

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

Powered by vBulletin
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?