The macosxhints Forums

The macosxhints Forums (http://hintsforums.macworld.com/index.php)
-   UNIX - Newcomers (http://hintsforums.macworld.com/forumdisplay.php?f=15)
-   -   Stupidly easy question I can't answer (http://hintsforums.macworld.com/showthread.php?t=24511)

stefanburt 06-06-2004 04:25 PM

Stupidly easy question I can't answer
 
Hello,

as the title of this thread indicated I am having problems with a simple activity.

I want to move around osx with unix and I can't figure out how to access files and directories with spaces in them

E.G

Moving to a directory called "the first"

cd the first

this doesn't work I have tried "cd the_first" this doesn't work what do I use to access folders/directories with spacing in the folder/directory name.

I am sure I am being a complete goff ball...

stefan

stefanburt 06-06-2004 04:42 PM

figured it out....

cd the\ first

thought it was stupidly easy i'm a complete muppet

stefan

griffman 06-06-2004 04:49 PM

Another just as easy solution:

cd "the first"

-rob.

intrntmn 06-06-2004 04:56 PM

or use auto complete ....

cd the[TAB]

:c)

Jack

stefanburt 06-06-2004 06:30 PM

Quote:

Originally Posted by griffman
Another just as easy solution:

cd "the first"

-rob.

thanks for that one!!

Thinking about the method you have adopted is a more intuitive than the \.
This off topic for this thread but how can i remove directories that are file laden?

I am trying to remove a folder/directory that has ended up in a place it shouldn't be and I would like to delete. but using the rmdir then the directory name unix is telling me this

"Directory not empty"

thanks

stefan

stefanburt 06-06-2004 07:14 PM

Quote:

Originally Posted by intrntmn
or use auto complete ....

cd the[TAB]

:c)

Jack

wow auto complete rocks I never knew it existed that speeding things up no end good tip :)

stefan

schwartze 06-06-2004 07:25 PM

Quote:

Originally Posted by stefanburt
thanks for that one!!

Thinking about the method you have adopted is a more intuitive than the \.
This off topic for this thread but how can i remove directories that are file laden?

I am trying to remove a folder/directory that has ended up in a place it shouldn't be and I would like to delete. but using the rmdir then the directory name unix is telling me this

"Directory not empty"

thanks

stefan

(all rm warnings apply)

rm -r directoryname

trevor 06-06-2004 08:52 PM

Quote:

rm -r directoryname
Absolutely correct, but if you want to be safer (and if you are new at this it is a very good idea to follow all extra-safe methods of doing things), then I would advise a very small addition to the above command:

rm -ir directoryname

The "-i" means you have to confirm all deletions with a "y" or an "n", which if there are a lot of items can take some time, but it's a really good idea to do because if you accidentally delete the wrong directory, (like the root directory for example), you can abort the process by typing "n" for individual items or hitting control-c to stop it altogether.

Trevor

stefanburt 06-06-2004 10:18 PM

Quote:

Originally Posted by trevor
it's a really good idea to do because if you accidentally delete the wrong directory, (like the root directory for example), you can abort the process by typing "n" for individual items or hitting control-c to stop it altogether.
Trevor

I have learnt a bit about the root user account I take it the root directory isn't the same thing?

This thread has gone massively off topic but I am learning a lot about UNIX and am quite enjoying it thank for all your input :)

stefan

breen 06-06-2004 10:32 PM

You're right -- root the account and the root directory are different.

The root directory is the top of the directory tree. Look at it by issuing the command
ls /

The root account is the system 'owner' or superuser. Just to confuse things a bit more, that account has a home directory called /root (that is, it's immediately below the root of the filesystem). You should see it in the listing you just did of '/'. [Actually, that directory may not exist on your system if you haven't enabled the root account. If you don't see /root, try searching these forums for 'enable root account' or something like that. And as I think you've probably already seen, the warning is to always be very careful when you're using the root account.]

Breen

stefanburt 06-06-2004 10:55 PM

Quote:

Originally Posted by breen
[Actually, that directory may not exist on your system if you haven't enabled the root account. If you don't see /root, try searching these forums for 'enable root account' or something like that. And as I think you've probably already seen, the warning is to always be very careful when you're using the root account.]
Breen

I believe i have enabled the account but have forgotten the password so might have to do something with that some time soon.

Apart from that maybe you can give some advice about unix in general?
I have been playing about with it for a while now and have only got a basic knowledge of the os thus far. But what I am wondering is what are the cement uses of unix? where does unix rock? as most of the thing I can do so far can easily be done with mouse & gui just a bit slowier.

I am interested in unix as it was something that made me want to run away from the cl as soon as possible because i had no concept of how to use it, so making me want to understand it more :)

roncross@cox.net 06-07-2004 12:47 AM

where does unix rock?
 
where does unix rock?

I would suggest that you pick up some books and do a little bit of reading on your own.

Some of the books that I would recommend are as follows:

"Unix for MAC OS X" by Matisse Enzer

or

"Learning unix for MAC OS X Panther" found at

"http://slashdot.org/article.pl?sid=04/02/19/1910207"

or

"Unix for MAC your visual blueprint to maximizing the foundation for Mac OS X"

There are just two many things to point out in Unix where things rock! Some of my favorite unix commands however are

1. ) echo
such as echo $SHELL
2.) cat
such as cat *.txt
3.) redirect command
such as date > list.txt

There are really no GUI equivalent to these above command line.

There are of course many more things that you can do with unix, but these are just a few.

Please do a little bit of reading. Most of the answers to your questions are a bookstore or mouse click away. If you are not able to afford books, then the www has a lot of resources that you can take advantage of to learn more about unix.

Here are some urls to get you started
with unix help. Just put these in your favorite browser, and you will be in the world of unix and see how unix rocks and rolls.

"
http://forums.macosxhints.com/
http://discussions.info.apple.com/
http://www.well.com/index.html
http://developer.apple.com/darwin/
http://www.wsanchez.net/papers/USENIX_2000/
http://www.gnu.org/software/bash/manual/bash.html
http://www.kornshell.com/
http://zsh.sourceforge.net/
http://unix.about.com/library/course...pt-outline.htm
http://steve-parker.org/sh/sh.shtml
http://www.oreilly.com/catalog/bash2/
http://www.openssh.org/history.html
http://www.jmarshall.com/easy/http/
http://www.oreilly.com/catalog/httppr/
http://www.fetchsoftworks.com/
http://www.rbrowser.com/
http://rsync.samba.org/
http://www.oreilly.com/catalog/tcsh/
http://www.openssh.org/
http://www.openssh.org/list.html
http://sunsite.dk/vpnd/
http://www.bresink.de/osx/NFSManager.html
http://www.sudo.ws/
http://www.metaobject.com/
http://homepage.mac.com/WebObjects/F...cty=US&lang=en
http://www.macosxlabs.org/rsyncx/rsyncx.html
http://www.pocketsw.com/PocketSoftware/index.php
http://www.dantz.com/
http://www.orange-carb.org/SkeyCalc/
http://web.mit.edu/kerberos/www/
http://ettercap.sourceforge.net/forum/viewforum.php?f=8
http://ettercap.sourceforge.net/foru...asc&highlight=
http://ettercap.sourceforge.net/forum/memberlist.php
"

thx
RLC

stefanburt 06-07-2004 01:54 AM

Quote:

Originally Posted by roncross@cox.net
where does unix rock?
I would suggest that you pick up some books and do a little bit of reading on your own.
RLC

Possibly a very bad choice of word to discribe something but I guess you understood my point :)

In regard to doing some light reading i guess with respect you would need to do a lot more than just light reading to get to grips with the more advanced features of this command line beastie.

Thanks for all the urls I will have to save this page so I can refer to them as and when they are needed.

stefan

hayne 06-07-2004 11:43 AM

Quote:

Originally Posted by stefanburt
where does unix rock? as most of the thing I can do so far can easily be done with mouse & gui just a bit slowier.

It's somewhat analogous to using power tools in carpentry (GUI = power tool, Unix command-line = hand tool). If a power tool exists for the job you need to do, then it is probably much easier to use the power tool. But if it is a specialized job for which no power tool exists, or if it is too delicate a job for a power tool, or if you are working where there is no electricity, you will want/need to do it by hand.

eravau 06-11-2004 03:44 PM

By the way...to change the password for your root account if you have forgotten it or to set a password for the first time...
  • Log in to another admin account (probably your main account)
  • Open the terminal
  • Type sudo passwd root
  • When it asks Password: enter the password for your admin account (the one you just logged in as)
  • It will then say Changing password for root.
  • Enter and confirm the new password.
That's it.

jhaffner 06-21-2004 01:25 PM

Good Tutorial
 
Hi,

One of the places that helped me learn about the power of UNIX was at OSXFAQ http://www.osxfaq.com/Tutorials/LearningCenter/index.ws.

I found that it took three or four tries (via different methods) to really get my head around the basics of file structure, shell, and commands. I am by no means an expert, but I feel much more comfortable with the CLI than I used to.

A couple of things will help you get the right mindset:

1) UNIX was written by programmers for programmers.
2) It's cryptic and powerful.
3) It treats you like an adult and assumes that you know what you're doing.
4) From its foundations UNIX is a multi-user system.

There's a lot more, but hopefully this will help get you started.

Best Regards,

John Haffner

stefanburt 06-22-2004 07:32 AM

Quote:

Originally Posted by jhaffner
Hi,

One of the places that helped me learn about the power of UNIX was at OSXFAQ http://www.osxfaq.com/Tutorials/LearningCenter/index.ws.

I found that it took three or four tries (via different methods) to really get my head around the basics of file structure, shell, and commands. I am by no means an expert, but I feel much more comfortable with the CLI than I used to.

A couple of things will help you get the right mindset:

1) UNIX was written by programmers for programmers.
2) It's cryptic and powerful.
3) It treats you like an adult and assumes that you know what you're doing.
4) From its foundations UNIX is a multi-user system.

There's a lot more, but hopefully this will help get you started.

Best Regards,

John Haffner


Hey John :)

thanks for the link its rather a good one I have visited it before and was very helpful haven't completed the bulk of them and your post have reminded me my work isn't quite done with this yet!!

I am starting to get more use to the command line its something that I don't really have to use on a day to day basis but if I am going to continue with the web development at the rate I am its only a matter of time before I am going to need it.

I ended up buying a copy of mac os x panther unleashed by sams which has lots of good stuff, I need to reset my unix under belly to get MySQL working which the book details I have tried this before and this is why my mac is a bit of a mess unix wise, need a clean sheet.

thanks again.

stefan

tonyboy 06-24-2004 10:39 AM

Quote:

Originally Posted by stefanburt
I believe i have enabled the account but have forgotten the password so might have to do something with that some time soon.

Remember that you can reset the root password without knowing it as long as you have administrator privileges. On the command line, use the following:
Code:

sudo passwd root
You will be prompted for your current user password first (if you haven't authenticated in the last 5 minutes). After that, you'll be given a chance to enter a new root password and then confirm it.

You can also do this by booting from your Mac OS X install/upgrade disks.

osxpounder 06-24-2004 12:29 PM

Using TAB to auto-complete -- that's my favorite solution
 
Quote:

Originally Posted by intrntmn
or use auto complete ....

cd the[TAB]

:c)

Jack

I like this one best because I tend to make typing mistakes that would otherwise force me to retry the whole command again, so ... for me, it's better to let the computer fill in the name.

I also tend to prefer copying and pasting over typing, regardless of the situation -- Like, if I need a file's name to be typed elsewhere, I often go to the file, pretend I'm going to rename it, and copy the name. That way, I can paste the name and it will be precisely correct -- I eliminate a source of error [namely, me].

mrchaotica 06-25-2004 10:11 PM

Quote:

Originally Posted by osxpounder
I like this one best because I tend to make typing mistakes that would otherwise force me to retry the whole command again, so ... for me, it's better to let the computer fill in the name.

I also tend to prefer copying and pasting over typing, regardless of the situation -- Like, if I need a file's name to be typed elsewhere, I often go to the file, pretend I'm going to rename it, and copy the name. That way, I can paste the name and it will be precisely correct -- I eliminate a source of error [namely, me].

First of all, if you make a mistake typing a command in the Terminal (or Bash shell in general), just hit the up arrow and it will retype the last command. (You can also learn how to use the history to get other previous commands, but I don't know how to do that yet!)

Second, if you want to get the filename, you can drag the file's icon into the Terminal window -- it will type it on the command line.

And on an unrelated note (so I don't have to post twice):


Quote:

Originally Posted by hayne
It's somewhat analogous to using power tools in carpentry (GUI = power tool, Unix command-line = hand tool). If a power tool exists for the job you need to do, then it is probably much easier to use the power tool. But if it is a specialized job for which no power tool exists, or if it is too delicate a job for a power tool, or if you are working where there is no electricity, you will want/need to do it by hand.

In my opinion, your analogy is sorta backwards. The command line is more like a machine shop, where you can use the provided tools to automate tasks and build new tools from them.

osxpounder 06-29-2004 11:32 AM

I realized I all those things you pointed out about shell usage -- my point is that copying and pasting "eliminates" a source of error, not that I can't correct errors in Terminal. I'm well acquainted with history, too. If I copy a filename, I know I won't misspell it, and I won't need to use backspace or arrow keys. That tip is useful for all computer usage, not just for command-line and Terminal action.

Thanks, though -- and it never hurts to mention such things, since other readers will not have realized that you can, for example, drag a folder or file into Terminal to see its proper, complete path typed out for you.


All times are GMT -5. The time now is 10:36 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.