Go Back   The macosxhints Forums > OS X Help Requests > UNIX - Newcomers



Reply
 
Thread Tools Rate Thread Display Modes
Old 01-23-2002, 12:24 PM   #1
shawnteague
Prospect
 
Join Date: Jan 2002
Location: Oklahoma City
Posts: 6
terminal not behaving as expected

I'v only played w/the terminal a few times but I got a new Mac OS X book and was wanting to work through some of the terminal chapters. The problem is that I can't seem to get anything to work now. Before I could type "top" and it would run the top command but now it thinks I'm spelling it wrong and suggests "stop" instead. If I just hit enter then it says "top: Command not found."

Here's another example of the screwiness...

[localhost:~] shawn% ls
Apps Documents Movies Public
Desktop Extra Stuff Music Sites
Desktop (Mac OS 9) Library Pictures
[localhost:~] shawn% cd /pictures
/pictures: No such file or directory.
[localhost:~] shawn% cd/Pictures
cd/Pictures: Command not found.
[localhost:~] shawn% cd /Pictures
/Pictures: No such file or directory.
[localhost:~] shawn% cd \Pictures
[localhost:~/Pictures] shawn%


This doesn't seem to jive with what the books say. Any suggestions or ideas?
shawnteague is offline   Reply With Quote
Old 01-23-2002, 12:35 PM   #2
Craig R. Arko
Site Admin
 
Join Date: Dec 2001
Location: Minneapolis, MN
Posts: 3,988
About the 'top' command: type 'which top' in you terminal; you should get '/usr/bin/top' back as a response. If you don't, type 'env' and look for the 'PATH=' item in the list. Is '/usr/bin' in there somewhere? If it is, then you may need to reinstall the BSD subsystem from the CD.

As far as the 'cd' goes, if you are in your home directory '~' just type 'cd Pictures', not 'cd /Pictures' or 'cd \Pictures'.
Craig R. Arko is offline   Reply With Quote
Old 01-23-2002, 12:41 PM   #3
robh
Triple-A Player
 
Join Date: Jan 2002
Location: Goolwa, South Australia
Posts: 101
Some answers

1) top - command not found.

This is caused by the shell (which I presume is the default tcsh) having an incomplete PATH environment variable.

Type echo $PATH in the terminal to see a list directories (Folders) that are in your PATH, your PATH being the places where the shell will look for things you try to run.

Next type which top. If your PATH is correct, it'll tell you that top is to be found in /usr/bin/.

I'd guess that at some point you've changed the value of your PATH. The result is that it no longer looks in /usr/bin/.

2) You cannot cd into the Pictures directory because you put / in front of it.

cd /Pictures

means change to the directory named Pictures inside the directory named /

cd Pictures

means change to the directory named Pictures that's in the current directory (i.e. where I am now).

You can see what directory you're in with the command pwd.

Pictures isn't in /, and you can see that it isn't with the command ls /
robh is offline   Reply With Quote
Old 01-23-2002, 01:04 PM   #4
shawnteague
Prospect
 
Join Date: Jan 2002
Location: Oklahoma City
Posts: 6
Well, here is what happens:


[localhost:~] shawn% which top
top: Command not found.
[localhost:~] shawn% env

OK? end? no
env: Command not found.
[localhost:~] shawn% echo $PATH
/Users/shawn/bin/powerpc-apple-darwin:/Users/shawn/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
[localhost:~] shawn%


I'm assuming that the path value has changed (you know how these computers always do things on their own) and that it needs to be changes back. Is this doable?

BTW, thanks for the quick responses!
shawnteague is offline   Reply With Quote
Old 01-23-2002, 01:27 PM   #5
robh
Triple-A Player
 
Join Date: Jan 2002
Location: Goolwa, South Australia
Posts: 101
Quote:
Originally posted by shawnteague


I'm assuming that the path value has changed (you know how these computers always do things on their own) and that it needs to be changes back. Is this doable?

Your PATH looks okay, it includes /usr/bin/

Now, I wonder if you have a /usr/bin, and if so do you have permission to access its contents, and what are the contents.

So, please type:

ls -ld /usr/bin
ls -l /usr/bin
robh is offline   Reply With Quote
Old 01-23-2002, 01:34 PM   #6
shawnteague
Prospect
 
Join Date: Jan 2002
Location: Oklahoma City
Posts: 6
pretty long...

Here is the result from each command:


[localhost:~] shawn% ls -ld /usr/bin
drwxr-xr-x 125 root wheel 4206 Dec 23 02:32 /usr/bin
[localhost:~] shawn% ls -l /usr/bin
total 10448
-rwxr-xr-x 1 root wheel 108568 Dec 23 02:29 a2p
-r-xr-xr-x 1 root wheel 151 Sep 2 21:09 appletviewer
-r-xr-xr-x 1 root wheel 9900 Dec 23 02:29 arch
-r-xr-xr-x 1 root wheel 130064 Dec 23 02:29 awk

[localhost:~] shawn%

Last edited by shawnteague; 01-23-2002 at 01:48 PM.
shawnteague is offline   Reply With Quote
Old 01-23-2002, 01:40 PM   #7
Craig R. Arko
Site Admin
 
Join Date: Dec 2001
Location: Minneapolis, MN
Posts: 3,988
You're missing a bunch of stuff. Run the Installer from the CD and install the 'BSD' package. You may need to run the various OS updates again after doing so.

And please try to keep things a little more brief next time. In fact it would be nice if you would edit your post and take most of that out. The 'edit' button is near the bottom right of the message.

Thanks!
Craig R. Arko is offline   Reply With Quote
Old 01-23-2002, 01:46 PM   #8
robh
Triple-A Player
 
Join Date: Jan 2002
Location: Goolwa, South Australia
Posts: 101
How on earth did you manage to lose "top" and "env" from /usr/bin ?

Have you been playing with the rm command ?
robh is offline   Reply With Quote
Old 01-23-2002, 01:52 PM   #9
shawnteague
Prospect
 
Join Date: Jan 2002
Location: Oklahoma City
Posts: 6
Sorry about the long post, I had no idea how much of that you needed to see! I'll reinstall and see where that gets me.

As far as rm, I think I only used it once to remove a deleted user folder. I'd like to learn more about using the terminal and obviously being more careful when doing so

Thanks for the help
Shawn
shawnteague is offline   Reply With Quote
Old 01-23-2002, 02:51 PM   #10
griffman
MVP
 
Join Date: Dec 2001
Location: Portland, OR
Posts: 1,472
I didn't see the unedited list, but it's quite possible that he did not originally install the BSD subsystem. You wind up with a functional but not complete UNIX environment when you do that, and "top" may be one of the things not installed.

-rob.
griffman is offline   Reply With Quote
Old 01-23-2002, 03:02 PM   #11
robh
Triple-A Player
 
Join Date: Jan 2002
Location: Goolwa, South Australia
Posts: 101
Quote:
Originally posted by griffman
I didn't see the unedited list, but it's quite possible that he did not originally install the BSD subsystem. You wind up with a functional but not complete UNIX environment when you do that, and "top" may be one of the things not installed.

-rob.

Interesting, however he said that he used to be able to run the "top" command.
robh is offline   Reply With Quote
Old 01-23-2002, 03:09 PM   #12
Craig R. Arko
Site Admin
 
Join Date: Dec 2001
Location: Minneapolis, MN
Posts: 3,988
Perhaps that was in 10.0.4, was the BSD subsystem in the default install then?

I don't think it is in 10.1, you have to check the little box to install it. I'd prefer it was the other way around., but Steve and Avie didn't ask me.
Craig R. Arko is offline   Reply With Quote
Old 01-23-2002, 03:58 PM   #13
griffman
MVP
 
Join Date: Dec 2001
Location: Portland, OR
Posts: 1,472
Quote:
Originally posted by robh


Interesting, however he said that he used to be able to run the "top" command.

Hmm, I missed that part ... yea, not sure if it worked once why it would have vanished after that...

-rob.
griffman is offline   Reply With Quote
Old 01-24-2002, 05:33 AM   #14
sao
Moderator
 
Join Date: Jan 2002
Location: Singapore
Posts: 4,237
terminal freaking...

This happens when the tcsh system binary becomes corrupt. Reinstall MacOS X over the old installation, or just copy the tcsh binary from another machine.


Cheers...
sao is offline   Reply With Quote
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

Forum Jump



All times are GMT -5. The time now is 10:35 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.