View Full Version : Terminal command Guru needed!
meta-ghost
May 25, 2004, 07:58 PM
Serious problem here, any help and i'd be grateful. been backing up multiple users onto dvd's from my (the admin account). i just installed panther and wiped my hard drive clean. trouble is, the other user documents may have not had the proper permissions setup for this and while they copied onto the dvd (and i can open each document from the disk) i can't copy them back to the hard drive.
i tried everything. disk utility, toast, holding the option key down, and more. the "get info" window only has "read only" option. my last thought is some sort of terminal commands. anybody?
dragula53
May 25, 2004, 08:28 PM
umm....
from the terminal window, do like this:
df (to make sure that the volume is as I say)
it should say something like: /dev/disk1 <disk name> (whatever you named your dvd)
cd /Volumes/<diskname>
(note that if the name is Audio CD, for example, you can type Au*, and it will go to it, unix R smart)
or even easier..
sudo cp * ~/Desktop
enter admin password
that should force it to copy everything on the DVD to your desktop
or you can be more specific, and do other paths, or copy specific stuff, etc.
sudo cp -R * ~/Desktop will do all directories recursively
or
sudo cp -R * /Users
if you are just gonna cram it all into the users directory...
meta-ghost
May 25, 2004, 11:50 PM
thanks dragula. i'm a bit of a terminal newbie. used it once or twice in the past. i tried your commands but no action happened (see below). ideally i'd like to take just one of the top most folders off the disk.
dsl081-070-009:~ eskiba$ sudo cp*~/desktop
sudo: cp*~/desktop: command not found
dsl081-070-009:~ eskiba$ sudo cp* ~/Desktop
sudo: cp*: command not found
dsl081-070-009:~ eskiba$ sudo cp -R ~/Desktop
usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src target
cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src1 ... srcN directory
dsl081-070-009:~ eskiba$ sudo cp -R /Users
usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src target
cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src1 ... srcN directory
dsl081-070-009:~ eskiba$
Westside guy
May 26, 2004, 12:34 AM
It's all about spacing. You need to hit the spacebar on occasion. :D
sudo[space]cp[space]*[space]~/desktop
meta-ghost
May 26, 2004, 01:11 AM
It's all about spacing. You need to hit the spacebar on occasion. :D
sudo[space]cp[space]*[space]~/desktop
ok, what am i missing? it asked for and took my password but still no action...
Last login: Tue May 25 22:06:02 on ttyp2
Welcome to Darwin!
dsl081-070-009:~ eskiba$ sudo cp * ~/desktop
Password:
dsl081-070-009:~ eskiba$
cait-sith
May 26, 2004, 01:30 AM
~/desktop and ~/Desktop are different things.
type in the commands EXACTLY as they are shown to you.
Nermal
May 26, 2004, 03:18 AM
And you still need to do the "cd /Volumes/DVDName".
dragula53
May 26, 2004, 06:15 AM
is case sensitive
so everything needs to be exact.
cd /Volumes/<disk name>
cp -R * ~/Desktop (upper case R, upper case D, etc)
you also didn't "df" to find out what your disk name was.
so it should go more like this, sorry for being not specific enough the first time..
open terminal
type:
df
look for the /dev/disk1 line. there should be a name after it (My DVD maybe?)
cd /Volumes/<disk name>
(remember upper case V, and you can type My* to get to "My DVD")
sudo cp -R * ~/Desktop
(upper case R, spaces, upper case D)
meta-ghost
May 26, 2004, 10:29 AM
sorry guys but i'm not there yet... was trying to copy all to desktop. to icons appeared "Desktop DF" and "Desktop DB" which are "unix executable files" but are too small to represent all of the data. here is the terminal action:
Welcome to Darwin!
dsl081-070-009:~ eskiba$ df
Filesystem 512-blocks Used Avail Capacity Mounted on
/dev/disk0s9 78157200 28318448 49326752 36% /
devfs 200 200 0 100% /dev
fdesc 2 2 0 100% /dev
<volfs> 1024 1024 0 100% /.vol
/dev/disk1s9 240098256 140156456 99941800 58% /Volumes/Films
automount -nsl [303] 0 0 0 100% /Network
automount -fstab [315] 0 0 0 100% /automount/Servers
automount -static [315] 0 0 0 100% /automount/static
/dev/disk2 8467180 8467180 0 100% /Volumes/GeneralDocBackup
dsl081-070-009:~ eskiba$ cd /Volumes/GeneralDocBackup
dsl081-070-009:/Volumes/GeneralDocBackup eskiba$ sudo cp * ~/Desktop
Password:
dsl081-070-009:/Volumes/GeneralDocBackup eskiba$
Westside guy
May 26, 2004, 11:00 AM
~/desktop and ~/Desktop are different things.
type in the commands EXACTLY as they are shown to you.
Actually on OS X this is incorrect - OS X is case-preserving but case-insensitive. If you don't believe me give it a try.
Tabbed autocomplete won't work if you don't capitalize correctly, but you can still traverse directories.
meta-ghost
May 26, 2004, 11:12 AM
say westside, if i do "sudo cp -R * ~/Desktop" will it put into and override any data in directories such as my library?
wrldwzrd89
May 26, 2004, 11:17 AM
say westside, if i do "sudo cp -R * ~/Desktop" will it put into and override any data in directories such as my library?
It will overwrite anything with the same name on your desktop, but NOT in your library or other directories. I'd recommend creating a directory inside your desktop to hold the copy: "mkdir ~/Desktop/dvdcopy" then copying the contents of the DVD to it: "sudo cp -R * ~/Desktop/dvdcopy". That way, nothing gets overwritten.
meta-ghost
May 26, 2004, 11:34 AM
It will overwrite anything with the same name on your desktop, but NOT in your library or other directories. I'd recommend creating a directory inside your desktop to hold the copy: "mkdir ~/Desktop/dvdcopy" then copying the contents of the DVD to it: "sudo cp -R * ~/Desktop/dvdcopy". That way, nothing gets overwritten.
sorry mate, but nothing seems to be happening... i assume by "dvdcopy" you mean the name of the dvd (in my case GeneralDocBackup). i made the folder with the name "mkdir ~/Desktop/GeneralDocBackup". here is what was done in the terminal:
Welcome to Darwin!
dsl081-070-009:~ eskiba$ df
Filesystem 512-blocks Used Avail Capacity Mounted on
/dev/disk0s9 78157200 28753520 48891680 37% /
devfs 200 200 0 100% /dev
fdesc 2 2 0 100% /dev
<volfs> 1024 1024 0 100% /.vol
/dev/disk1s9 240098256 140156552 99941704 58% /Volumes/Films
automount -nsl [303] 0 0 0 100% /Network
automount -fstab [315] 0 0 0 100% /automount/Servers
automount -static [315] 0 0 0 100% /automount/static
/dev/disk2 8467180 8467180 0 100% /Volumes/GeneralDocBackup
dsl081-070-009:~ eskiba$ cd /Volumes/GeneralDocBackup
dsl081-070-009:/Volumes/GeneralDocBackup eskiba$ sudo cp -R * ~/Desktop/GeneralDocBackup
Password:
usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src target
cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src1 ... srcN directory
dsl081-070-009:/Volumes/GeneralDocBackup eskiba$
GiantsFan
May 26, 2004, 11:35 AM
uh, does anyone know how to change the default of " ls " ? when i type in " alias ls " it shows that is " ls -f ". i dont want the " -f ", just " ls ".
wrldwzrd89
May 26, 2004, 11:43 AM
sorry mate, but nothing seems to be happening... i assume by "dvdcopy" you mean the name of the dvd (in my case GeneralDocBackup). i made the folder with the name "mkdir ~/Desktop/GeneralDocBackup". here is what was done in the terminal:
Welcome to Darwin!
dsl081-070-009:~ eskiba$ df
Filesystem 512-blocks Used Avail Capacity Mounted on
/dev/disk0s9 78157200 28753520 48891680 37% /
devfs 200 200 0 100% /dev
fdesc 2 2 0 100% /dev
<volfs> 1024 1024 0 100% /.vol
/dev/disk1s9 240098256 140156552 99941704 58% /Volumes/Films
automount -nsl [303] 0 0 0 100% /Network
automount -fstab [315] 0 0 0 100% /automount/Servers
automount -static [315] 0 0 0 100% /automount/static
/dev/disk2 8467180 8467180 0 100% /Volumes/GeneralDocBackup
dsl081-070-009:~ eskiba$ cd /Volumes/GeneralDocBackup
dsl081-070-009:/Volumes/GeneralDocBackup eskiba$ sudo cp -R * ~/Desktop/GeneralDocBackup
Password:
usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src target
cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src1 ... srcN directory
dsl081-070-009:/Volumes/GeneralDocBackup eskiba$
OK - I think I've figured out what's going on. The cp command is complaining that you're using invalid syntax. Here's what you wanted: "sudo cp -R /Volumes/GeneralDocBackup ~/Desktop/GeneralDocBackup" (without the quotes, of course).
ThomasW
May 26, 2004, 11:52 AM
You shouldn't use the cp command at all!!
All files with resource forks will be damaged after they're copied with cp. You should really use CpMac, which is included with the developer tools.
meta-ghost
May 26, 2004, 12:10 PM
You shouldn't use the cp command at all!!
All files with resource forks will be damaged after they're copied with cp. You should really use CpMac, which is included with the developer tools.
i looks like your correct. as i write this message the documents are being copied with an error message and landing on my machine with 0 (zero)kb file size. i have "Developer Tools" version 10.1. is it difficult to use the CpMac?
terminal commands are as follows:
Last login: Wed May 26 08:13:09 on ttyp2
Welcome to Darwin!
dsl081-070-009:~ eskiba$ df
Filesystem 512-blocks Used Avail Capacity Mounted on
/dev/disk0s9 78157200 28753520 48891680 37% /
devfs 200 200 0 100% /dev
fdesc 2 2 0 100% /dev
<volfs> 1024 1024 0 100% /.vol
/dev/disk1s9 240098256 140156552 99941704 58% /Volumes/Films
automount -nsl [303] 0 0 0 100% /Network
automount -fstab [315] 0 0 0 100% /automount/Servers
automount -static [315] 0 0 0 100% /automount/static
/dev/disk2 8467180 8467180 0 100% /Volumes/GeneralDocBackup
dsl081-070-009:~ eskiba$ cd /Volumes/GeneralDocBackup
dsl081-070-009:/Volumes/GeneralDocBackup eskiba$ sudo cp -R * ~/Desktop/GeneralDocBackup
Password:
usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src target
cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src1 ... srcN directory
dsl081-070-009:/Volumes/GeneralDocBackup eskiba$ sudo cp -R * ~/Desktop
Password:
cp: Quicken Essentials/Backup Folder/6Quicken Data: Input/output error
cp: Quicken Essentials/Backup Folder/1Quicken Data: Input/output error
cp: Quicken Essentials/Backup Folder/21Quicken Data: Input/output error
cp: Quicken Essentials/Backup Folder/2Quicken Data: Input/output error
cp: Quicken Essentials/Backup Folder/31Quicken Data: Input/output error
wrldwzrd89
May 26, 2004, 12:11 PM
You shouldn't use the cp command at all!!
All files with resource forks will be damaged after they're copied with cp. You should really use CpMac, which is included with the developer tools.
No, use the ditto command instead with the -rsrcFork switch. That doesn't require the developer tools and will do the same thing.
MrBubbles
May 26, 2004, 12:14 PM
uh, does anyone know how to change the default of " ls " ? when i type in " alias ls " it shows that is " ls -f ". i dont want the " -f ", just " ls ".
The short answer is to type "unalias ls". To make the change more permanent you have to edit a shell startup script. First figure out which shell you're using (bash or csh) by typing "echo $SHELL". Then, edit the appropriate files in either your home directory or in /etc (assuming you have administrator privileges). Bash uses [.]bashrc and [.bash_]profile, while csh uses [csh].cshrc and csh.login.
For more (just as confusing) information on bash, csh, or ls, consult the man pages (e.g., "man bash").
meta-ghost
May 26, 2004, 12:15 PM
btw, anybody know how to stop this copying (which is a bit slow) happening through the terminal as i write this. end, quit, stop and logout haven't worked. (i know, i know i shouldn't be using the terminal...)
meta-ghost
May 26, 2004, 12:21 PM
No, use the ditto command instead with the -rsrcFork switch. That doesn't require the developer tools and will do the same thing.
sorry for my ignorance, but what exactly do you mean? are the files being copied still usable?
wrldwzrd89
May 26, 2004, 12:21 PM
btw, anybody know how to stop this copying (which is a bit slow) happening through the terminal as i write this. end, quit, stop and logout haven't worked. (i know, i know i shouldn't be using the terminal...)
open a new terminal window and type "killall cp". Alternatively, you can open a new terminal window, type "top", make a note of the PID of the active "cp" process (the one using CPU time), quit top by pressing q, then type "kill -9 [PID]" where [PID] is the PID you noted earlier. That should stop it.
wrldwzrd89
May 26, 2004, 12:23 PM
sorry for my ignorance, but what exactly do you mean? are the files being copied still usable?
ditto is like cp, but it has the ability to preserve resource forks with the -rsrcFork switch. It can be used even if the developer tools aren't installed; it's the command line utility Carbon Copy Cloner uses to duplicate disks. As far as usability goes, all your files will remain intact when copied with ditto, even if they had resource forks.
JFreak
May 26, 2004, 12:44 PM
btw, anybody know how to stop this copying (which is a bit slow) happening through the terminal as i write this. end, quit, stop and logout haven't worked. (i know, i know i shouldn't be using the terminal...)
usually control-c cancels whatever you have executed in the terminal.
Anticipat3
May 26, 2004, 02:18 PM
OK... I'm a little surprised at all this feedback and no good answers.
If you have read access to everything, this isn't a hard problem to fix.
First, make sure the disc is mounted.
Next, make a "Junk" folder on your desktop.
now open a terminal. type these commands:
sudo bash (will log you in as root)
cp -R /Volumes/DVDName/* ~/Desktop/Junk
now it's time to fix the permissions. type these:
chown -R [yourusername] ~/Desktop/Junk/* (makes you the owner)
chmod -R +rw ~/Desktop/Junk/* (gives you read and write permission).
There you go.
wrldwzrd89
May 26, 2004, 02:49 PM
OK... I'm a little surprised at all this feedback and no good answers.
If you have read access to everything, this isn't a hard problem to fix.
First, make sure the disc is mounted.
Next, make a "Junk" folder on your desktop.
now open a terminal. type these commands:
sudo bash (will log you in as root)
cp -R /Volumes/DVDName/* ~/Desktop/Junk
now it's time to fix the permissions. type these:
chown -R [yourusername] ~/Desktop/Junk/* (makes you the owner)
chmod -R +rw ~/Desktop/Junk/* (gives you read and write permission).
There you go.
You don't understand - cp DOES NOT preserve resource forks. To do that, you have to use the ditto command: "ditto -rsrcFork /Volumes/DVDName ~/Desktop/Junk" (without the quotes - substitute the name of the DVD for DVDName, and substitute whatever you want the destination directory to be called for Junk).
meta-ghost
May 26, 2004, 05:12 PM
OK... I'm a little surprised at all this feedback and no good answers.
If you have read access to everything, this isn't a hard problem to fix.
First, make sure the disc is mounted.
Next, make a "Junk" folder on your desktop.
now open a terminal. type these commands:
sudo bash (will log you in as root)
cp -R /Volumes/DVDName/* ~/Desktop/Junk
now it's time to fix the permissions. type these:
chown -R [yourusername] ~/Desktop/Junk/* (makes you the owner)
chmod -R +rw ~/Desktop/Junk/* (gives you read and write permission).
There you go.
almost... i still get the below error messages and the actual documents are coming over at 0(zero)kb.
Last login: Wed May 26 14:51:25 on ttyp2
Welcome to Darwin!
dsl081-070-009:~ eskiba$ sudo bash
Password:
dsl081-070-009:~ root# cp -R /Volumes/GeneralDocBackup/* ~/Desktop/Junk
cp: /Volumes/GeneralDocBackup/Quicken Essentials/Backup Folder/6Quicken Data: Input/output error
cp: /Volumes/GeneralDocBackup/Quicken Essentials/Backup Folder/1Quicken Data: Input/output error
cp: /Volumes/GeneralDocBackup/Quicken Essentials/Backup Folder/21Quicken Data: Input/output error
cp: /Volumes/GeneralDocBackup/Quicken Essentials/Backup Folder/2Quicken Data: Input/output error
cp: /Volumes/GeneralDocBackup/Quicken Essentials/Backup Folder/31Quicken Data: Input/output error
^Cexit
dsl081-070-009:~ root# exit
exit
dsl081-070-009:~ eskiba$ exit
logout
[Process completed]
meta-ghost
May 27, 2004, 06:09 PM
anybody else with an idea?
wrldwzrd89
May 27, 2004, 07:18 PM
anybody else with an idea?
Are you ignoring me or what? I suggested using the ditto command - why haven't you tried it?
meta-ghost
May 27, 2004, 10:00 PM
Are you ignoring me or what? I suggested using the ditto command - why haven't you tried it?
no, not at all (believe me) but when i posted in message #21 "sorry for my ignorance, but what exactly do you mean?" i meant - what in the world is the ditto command?
wrldwzrd89
May 28, 2004, 09:07 AM
no, not at all (believe me) but when i posted in message #21 "sorry for my ignorance, but what exactly do you mean?" i meant - what in the world is the ditto command?
The ditto command is a relative of the cp command, except that it copies recursively by default and can preserve resource forks with the -rsrcFork switch. It is best used for "cloning" a volume, such as your troublesome DVD.
meta-ghost
May 28, 2004, 10:22 AM
The ditto command is a relative of the cp command, except that it copies recursively by default and can preserve resource forks with the -rsrcFork switch. It is best used for "cloning" a volume, such as your troublesome DVD.
ok, what exactly do i type?
wrldwzrd89
May 28, 2004, 10:35 AM
ok, what exactly do i type?
Look at my post (#26) for guidance on use of the ditto command.
meta-ghost
May 28, 2004, 03:29 PM
Look at my post (#26) for guidance on use of the ditto command.
hey thanks, i missed that. i've had some success but not quite there yet. the dvd in question has the home folders for both wife and i. using the ditto command on the dvd resulted in the copying that of files to the junk folder that began good (no errors) but began to get errors (and zero kb files) as the process went on (4 hours...) to the point where all files were errors. since it started with my files (which are not needed) my wife's never made it.
i then used the ditto command with an older (1 year old data) cd that contained her directory. it worked!
since i still want to get the most recent stuff, is it possible to specify the first sub-folder (ie: DVDname/subfolder name) in the ditto command?
thanks again for your time...
wrldwzrd89
May 29, 2004, 06:52 AM
hey thanks, i missed that. i've had some success but not quite there yet. the dvd in question has the home folders for both wife and i. using the ditto command on the dvd resulted in the copying that of files to the junk folder that began good (no errors) but began to get errors (and zero kb files) as the process went on (4 hours...) to the point where all files were errors. since it started with my files (which are not needed) my wife's never made it.
i then used the ditto command with an older (1 year old data) cd that contained her directory. it worked!
since i still want to get the most recent stuff, is it possible to specify the first sub-folder (ie: DVDname/subfolder name) in the ditto command?
thanks again for your time...
Yep! Just specify that directory (/Volumes/DVDName/SubDir1 instead of /Volumes/DVDName) as the source (where DVDName is the name of the DVD and SubDir1 is the name of the sub-directory you want copied).
meta-ghost
May 29, 2004, 10:43 AM
Yep! Just specify that directory (/Volumes/DVDName/SubDir1 instead of /Volumes/DVDName) as the source (where DVDName is the name of the DVD and SubDir1 is the name of the sub-directory you want copied).
i must be doing something wrong. the files are still getting an "input/output error" and are not being copied. here is the terminal info:
dsl081-070-009:~ root# ditto -rsrcFork /Volumes/GeneralDocBackup/natalie/Documents ~/Desktop/Junk
ditto: /Volumes/GeneralDocBackup/natalie/Documents/%pdf: Input/output error
ditto: /Volumes/GeneralDocBackup/natalie/Documents/.DS_Store: Input/output error
ditto: /Volumes/GeneralDocBackup/natalie/Documents/.FBCIndex: Input/output error
ditto: /Volumes/GeneralDocBackup/natalie/Documents/.FBCLockFolder/.FBCSemaphoreFile: Input/output error
crenz
May 29, 2004, 11:04 AM
"Input/Output error" usually relates to a problem with the medium. It might be that your DVD can't be read in some problems, which is a very common problem with DVD-Rs. Do you have another backup?
realityisterror
May 29, 2004, 02:33 PM
what if he made a dmg of the cd and then copied it with the finder?
i'm not saying to actually do that... i want to know if others think that wouldn't mess up the resource forks and permissions....
reality
meta-ghost
May 29, 2004, 05:05 PM
"Input/Output error" usually relates to a problem with the medium. It might be that your DVD can't be read in some problems, which is a very common problem with DVD-Rs. Do you have another backup?
worse than a dvd-r, it's a dvd-rw... i'm beginning to think it might be damaged. no other backup...
anybody know an inexpensive place i can send it to for retrieval?
wrldwzrd89
May 29, 2004, 05:21 PM
worse than a dvd-r, it's a dvd-rw... i'm beginning to think it might be damaged. no other backup...
I've heard that Mac OS X Panther's support for DVD-RW is flaky at best - this flakiness could be what you are experiencing (some things DVD-RW related work; others don't; still others work inconsistently).
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.