Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

cleo

macrumors 65816
Original poster
Jan 21, 2002
1,186
0
Tampa Bay Area, FL, USA
In the terminal, how do I navigate to a directory folder that has a name with more than one word? For example, I have a folder in my home directory called "School stuff." How do I get in there from the command line? I tried dragging the window icon into the terminal, because that usually works, but then it tells me that I don't have permission. Help!
 

PCUser

macrumors regular
Mar 1, 2002
123
0
Since I'm not a mac techie, I'm not sure exactly what MacOS X is up to...

But from a UNIX perspective, assuming you're using bash and MacOS X is acting like other UNIX clones, there are two things here.

First, you get into a multiword directory by using quotes. If you have a directory named "School Stuff", it would be:

cd "School Stuff"

Second, file/folder permissions determine what user gets to view, modify, and execute the item (ie, view the contents of a folder, run an app, etc).
 

Taft

macrumors 65816
Jan 31, 2002
1,319
0
Chicago
Space character.

A space character is represented by a '\ ' on the command line. Thats a \ then a space character. Like this:

%ls
Dir1/
Dir2/
Dir Three/
The Bomb/
%cd Dir\ Three/

Also note that you can just type 'cd The' on the command line and then hit the tab key and it will auto complete '\ Bomb' for you. Sweet.

Matthew
 

PCUser

macrumors regular
Mar 1, 2002
123
0
Quotes are a string designator to the console. Anything inside of quotes is one group of characters. A space character works, but since I like the logical breakup of things like

mv "/home/x user/my folder" "/home/x user/old stuff/my folder"

I use quotes.
 

Rower_CPU

Moderator emeritus
Oct 5, 2001
11,219
2
San Diego, CA
Another cool feature is auto-complete.
Since I'm lazy and I don't want to type in "My Folder", I can just type:
cd My and then the "tab" key, and Terminal will fill in the rest for me:
cd My\ Folder/

If you have several directories that start with "My", it will list them and you will then have to provide some more characters for it to choose from. For instance:
%ls
Music Folder
Musty Underpants
cd Mus
Music Folder/ Musty Underpants/
cd Musi "tab"
cd Music\ Folder/
 

PCUser

macrumors regular
Mar 1, 2002
123
0
An easy way to tell who has "permissions" for a file/folder in the console is to type

ls -l

That will list the permissions of each file/folder, which user owns it, and which group the user belongs to.

To see hidden files/folders as well, type "ls -a". Type "ls -a -l" to see all files/folders and their permissions.

That should tell you who owns "School stuff".
 

Rower_CPU

Moderator emeritus
Oct 5, 2001
11,219
2
San Diego, CA
Originally posted by PCUser
An easy way to tell who has "permissions" for a file/folder in the console is to type

ls -l

That will list the permissions of each file/folder, which user owns it, and which group the user belongs to.

To see hidden files/folders as well, type "ls -a". Type "ls -a -l" to see all files/folders, and their permissions.

That should tell you who owns "School stuff".

Wow this is turning into a whole "Intro to the Terminal" thread.

You can actually just type "l" and it will do the same thing as "ls -l".
Or type "tab" at the prompt for the same funtion as "ls".

I'm all about the shortcuts! :D
 

PCUser

macrumors regular
Mar 1, 2002
123
0
Hehe. I've noticed. :)

I'm expecting that the user won't have permissions for the folder, so we'll probably have to send them to root to change that (chmod and chown and all that jazz)...

In MacOS X, can you get into the root by the UNIX command "su"?
 

Rower_CPU

Moderator emeritus
Oct 5, 2001
11,219
2
San Diego, CA
Originally posted by PCUser
Hehe. I've noticed. :)

I'm expecting that the user won't have permissions for the folder, so we'll probably have to send them to root to change that (chmod and chown and all that jazz)...

In MacOS X, can you get into the root by the UNIX command "su"?

Yup, as long as you have already setup the password.

sudo passwd root
 

Choppaface

macrumors 65816
Jan 22, 2002
1,187
0
SFBA
ah finally!! every time I wanted to get into root I kept typing sudo -s cuz it seems root password wasn't set

also I find it kinda odd that it doesnt match password length. my old pass was very long and it works even if i leave off a character a the end or something. the 'max' is like 8 characters right? well you'd think it would at least try to check for extra characters
 

Rower_CPU

Moderator emeritus
Oct 5, 2001
11,219
2
San Diego, CA
Originally posted by Choppaface
ah finally!! every time I wanted to get into root I kept typing sudo -s cuz it seems root password wasn't set

also I find it kinda odd that it doesnt match password length. my old pass was very long and it works even if i leave off a character a the end or something. the 'max' is like 8 characters right? well you'd think it would at least try to check for extra characters

Yeah, I've been kind of surprised by that myself. When you create a new user it only gives you 8 characters for the passwd. Although OS X Server does allow for longer ones.
I guess they figure 8 is enough for client machines that won't be *as* open to the internet. Plus people are less likely to forget if it's shorter. ;)
 

evildead

macrumors 65816
Jun 18, 2001
1,275
0
WestCost, USA
passwords

Think you can use longer passwords by using the passwd command at the termnal. I think you have to be root to run it... or at least an admin. Just type
#passwd username

it will prompt you for the new one.
 

Taft

macrumors 65816
Jan 31, 2002
1,319
0
Chicago
No quotes.

I don't use quotes because its generally one more character I have to type. Most of the time I just have to type part of the first word then tab complete the rest. I figure I need to type the space character once every 5-10 times I hit a file with a space. No need to type more for the rest of the cases.

Plus if I have several folders with a common start to the name, like:

Folder A 1
Folder A 2
Folder A 3

The shell will fill in all of the name it can. So I type:

%cd Fol

then hit the tab key and it fills:

Folder A 1/
Folder A 2/
Folder A 3/
%cd Folder\ A\

Then I just have to type the number of the folder I want.

Its simple key economics.

Screw organization. If I need to do anything complicated, I use a shell script and then worry about good code. The command line is for getting stuff done fast.

Matthew
 

Rower_CPU

Moderator emeritus
Oct 5, 2001
11,219
2
San Diego, CA
Re: No quotes.

Originally posted by mrtrumbe
I don't use quotes because its generally one more character I have to type. Most of the time I just have to type part of the first word then tab complete the rest. I figure I need to type the space character once every 5-10 times I hit a file with a space. No need to type more for the rest of the cases.

Plus if I have several folders with a common start to the name, like:

Folder A 1
Folder A 2
Folder A 3

The shell will fill in all of the name it can. So I type:

%cd Fol

then hit the tab key and it fills:

Folder A 1/
Folder A 2/
Folder A 3/
%cd Folder\ A\

Then I just have to type the number of the folder I want.

Its simple key economics.

Screw organization. If I need to do anything complicated, I use a shell script and then worry about good code. The command line is for getting stuff done fast.

Matthew

Yes, I'm all for shortcuts too. See my similar post above...:D
 

cleo

macrumors 65816
Original poster
Jan 21, 2002
1,186
0
Tampa Bay Area, FL, USA
Wow, thanks for all of the help! Since all of you seem to know so much, can anyone point me in the direction of a good (easy for newbies) book to learn this stuff? I'm finding myself wanting to do things in OS X that require using the terminal (such as "compiling" - whatever the heck that is - for programs like, for example, MacGIMP), but I just don't know how. I catch on really quick, but I need step-by-step instructions the first time, you know?

Oh, and about the original problem... the issue, minor though it may seem, was that damned k.d. lang song's genre being "unclassifiable" in iTunes. So I actually found a thing that told me how to login as root (which I had never done before) and I got it sorted out really fast. I think I like root a lot :)

So yeah, if anyone knows of any "How to use Terminal if you're smart but just un-initiated in Unix"-type books/sites/whatever, please let me know. Or if someone wants to walk me through setting up MacGIMP... :D
 

Choppaface

macrumors 65816
Jan 22, 2002
1,187
0
SFBA
to compile you will first need the developers' kit from apple. to get their dev kit you have to become an ADC member (which is easy and free, see connect.apple.com) and download it (which may take a long time-> usually its over 100 megs or so)...not to mention it take a long time to install. before devkit my drive had 120,000 items. after it had 189,000 he he :D

compiling is taking written code (like C/C++, somethig you can read and write if you learn it) and then transforming it into code that your machine can understand (binary code, all those 1's and 0's). for this you need the compilers in the mac dev kit. also a helper book (which i've been looking for too actually) will help you do basic terminal things, but it seems install instructions change every time a new OS version comes out....well at least it does for PHP and Apache. I'm still looking for OS 10.1.3 install instructions for apache, PHP and mysql because the ones for 10.1 don't work.....well I've been able to get PHP in but had *many* errors during the installation
 

Rower_CPU

Moderator emeritus
Oct 5, 2001
11,219
2
San Diego, CA
Originally posted by Choppaface
to compile you will first need the developers' kit from apple. to get their dev kit you have to become an ADC member (which is easy and free, see connect.apple.com) and download it (which may take a long time-> usually its over 100 megs or so)...not to mention it take a long time to install. before devkit my drive had 120,000 items. after it had 189,000 he he :D

compiling is taking written code (like C/C++, somethig you can read and write if you learn it) and then transforming it into code that your machine can understand (binary code, all those 1's and 0's). for this you need the compilers in the mac dev kit. also a helper book (which i've been looking for too actually) will help you do basic terminal things, but it seems install instructions change every time a new OS version comes out....well at least it does for PHP and Apache. I'm still looking for OS 10.1.3 install instructions for apache, PHP and mysql because the ones for 10.1 don't work.....well I've been able to get PHP in but had *many* errors during the installation

Are you trying to update to newer versions of Apache and PHP? They're already included in OS X, and they work great!
 

cleo

macrumors 65816
Original poster
Jan 21, 2002
1,186
0
Tampa Bay Area, FL, USA
Am I blind, or is the only way to get the developer tools to buy a cd for $20? I don't see a download anywhere in the ADC area. Bleh, $20 for tools I don't know how to use to compile free software... no thanks.

That Star Wars thing was cool!
 

jaykk

macrumors 6502a
Jan 5, 2002
854
5
CA
Developer tools option

Here is the menu options for ADC to select Developer Tools
 

Attachments

  • adc.jpg
    adc.jpg
    9.1 KB · Views: 210

cleo

macrumors 65816
Original poster
Jan 21, 2002
1,186
0
Tampa Bay Area, FL, USA
Re: Developer tools option

Originally posted by jaykk
Here is the menu options for ADC to select Developer Tools

Doh! I didn't realize I could scroll down.

Thanks for helping me through that brainfart :)

I'll let you all know if/how MacGimp does :)
 

Beej

macrumors 68020
Jan 6, 2002
2,139
0
Hey, someone should probably point out that if you hit 'tab' the file name will be completed automatically. ;)

Some people need to read the thread before repeating things for the third time...
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.