![]() |
Very basic question
I recently installed a second hard drive on my g5. I was able in os x to mount the drive and copy all my files to it as a back up. I am new to unix so I was trying to view the new drive from terminal. I see it in the volumes dir but how do I view it, ls, cd? I try to cd to /volumes/backup 1 which does not work. I tried doing searches on google to find out but no luck. Could someone direct me where to look or explain how it is done. I did pdisk -l I can see the partition listed there, do I do anything with the dev dir to access it?
Thank you, Keith |
You need to escape the space in the volume name.
Won't work: cd /volumes/backup 1 Should work: cd /volumes/backup\ 1 |
Don't forget that <tab> will auto-complete pathnames in Terminal. So if you don't want to bother typing in long names with multiple spaces, just hit <tab> when you've typed enough for it to be uniquely identified.
|
Escaping the space
Thank you so much! I was on another forum which I will not go back to, basically they would not help because it was such a basic question. I did not know that is what you do for the space. I was trying to do cd /volumes/backup 1... Thank you for your help what you suggested worked, I appreciate it.
Keith |
cwtnospam's method of escaping a space is the best one for a couple reasons: it works with the tab complete method, and it's the established "unix" way to deal with spaces. However, there is another alternative way to deal with spaces--use quotations.
So cwtnospam's method is preferred (assuming that the Volume in question is named backup 1): cd /Volumes/backup\ 1 but you can also use cd /Volumes/"backup 1" or single quotes cd /Volumes/'backup 1' or even put the quotations around more of the path, if you prefer, like cd "/Volumes/backup 1" But the REAL hardcore longbeard unixy way to do it is to not even use spaces in directory and file names. :-P Trevor |
quotes
Hello,
I was experimenting with changing directories with spaces as suggested several different ways here. Some of my directory names have " ' " in them ex. file type doc's, when I do cd /documents\ it does not read it properly but if I put the whole name in quotes it does. I take it there really should not be symbols or spaces in the names? Thanks again, Keith |
Quote:
|
Quote:
|
Quote:
|
Unmounting a hard drive
Hello,
One more question, for now that is :) I have a usb hard drive I am trying to unmount in terminal it list as being mounted in the volumes dir. I tried different commands and terminal lists command not found. This is what I thought to be correct, / root# unmount /Volumes/"WD USB 2" is this something I have to do via diskutil in terminal or am I not using the proper command. I also tried unmount /dev/disk2s1 as well , using the device identifier. Thanks again, Keith |
The correct command is "umount" (no 'n').
You can find out what commands relate to a given topic keyword with 'man -k': Code:
% man -k unmountThings in section 2 are system-calls - these are only useful if you are writing a C program. |
Umount
Quote:
Thanks again, Keith |
newbie also
was trying to reformat a Lacie hard drive and erase everything on it and start again but was hit with a popup that said I was unable to "umount" the drive. How do I do that?
|
Quote:
% touch foo\' % ls -l foo* -rw-r--r-- 1 trevor trevor 0 May 13 09:33 foo' % rm foo' > (here, hit Control-C to exit out, it didn't work as planned) % rm foo\' % Quote:
OS X, of course, allows symbols or spaces, and there are always ways to deal with them, such as escaping the characters, or putting names in quotations, or in some cases both at once. Trevor |
Quote:
Quote:
But Unix grew up on filesystems where case matters, and it still insists on proper case in some places. Auto-completion is one of those. It won't auto-complete a filename if the prefix you type has the wrong case. Example: you have a volume named "Backup 1" (and no other similarly-named volume): /V<tab> will auto-expand to /Volumes/ /v<tab> just beeps. So will /volumes<tab> /Volumes/Ba<tab> will auto-expand to /Volumes/Backup\ 1/ /Volumes/ba<tab> just beeps. /volumes/Ba<tab> does work, though. It's probably a good idea to get in the habit of being meticulous about case. You'll thank me when you try to use Unix on another platform. |
Quote:
I have another problem at hand I ran into. I have a usb 250 in fat32 formant. I am able to umount it with no problem but I am having issues mounting it. I have tried mount -t msdos /VOLUMES/"WD USB 2" mount -a -t msdos or vfat /VOLUMES/"WD USB 2" I have also tried diskutil from bash and i did diskutil mountDisk /VOLUMES/"WD USB 2" it stated it mounted. When I type mount I don't see it listed, when I cd to that partition I just see .autodiskmounted not the directories on it. When I reboot the mac the usb drive shows up as mounted and I can access everything on it. I am just trying to learn the ways of mount and Umont. I looked at the man pages I really didnt see anything but mount -t, when I looked on google I found mount -t msdos, and mount -t vfat for linux but neither worked. I am not sure what I am doing wrong at this point. Thanks again , Keith |
Quote:
You haven't told the mount command what you want to mount at the /Volumes/"WD USB 2" mountpoint. You will need to include the entry in /dev for the disk you are trying to mount, like /dev/disk2s9 (or whatever is the right entry). When the disk in question is properly mounted, you can enter the command diskutil -list to see the relevant entry for the disk in /dev. Then, put the /dev/diskwhatever in your mount command before the mountpoint. The example mount command given in the mount manual (type man mount to see it) is: mount -t hfs -o nosuid,-w,-m=755 /dev/disk2s9 /tmp In that case, dev/disk2s9 is the /dev entry, and /tmp is the mountpoint. Trevor |
Suggestions?
Quote:
I was able to get it to work! Thanks for your help, I don't always understand the man pages. I know some things are unique to darwin, is there something on the net I can look at to learn all the commands or things unique to darwin? A good reference point maybe or I was thinking I may need to find a good book, any suggestions. I love to research and read all I can before I bother any one to ask simple questions, sort of a last resort for me. I really appreciate the help here, some other sites are not so kind, I like to really try before I ask. I found this link along the way, http://www.matisse.net/OSX/darwin_commands.html. Thanks again!!! Keith |
I'm biased, because the author is a friend of mine, but I like Mac OS X Unix 101 Byte-Sized Projects by Adrian Mayo.
There are also some very good O'Reilly books about OS X. For just one example, Learning Unix for OS X. (The linked version is for OS X Tiger, but there are also editions for other versions of OS X.) Trevor |
Quote:
|
Quote:
|
By the way, I'm not sure if the correct syntax back in 2008 was indeed
diskutil -list or if I made a mistake back then, but today the correct syntax for that command is diskutil list --note that there is no hyphen before 'list'. Trevor |
| All times are GMT -5. The time now is 10:14 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.