LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-16-2007, 05:17 PM   #1
oskar
Senior Member
 
Registered: Feb 2006
Location: Austria
Distribution: Ubuntu 12.10
Posts: 1,142

Rep: Reputation: 49
cp -u bugs me with skip/overwrite y/n questions


I'm backing up my ubuntu home folder from Fedora 7 because I'm in the course of reinstalling -Ubuntu freezes, and I can't figure out why... Started a thread last week: http://www.linuxquestions.org/questi...ck-ups-590324/

I was almost finished copying when I accidently closed the terminal window. I figure cp -rpuv (recursive, preserve owner, update, verbose) should resume it, but it asks me again for every file that already exists.

Of course I'm deleting and copying again... Not worth the trouble, but if anybody has any idea why it doesn't work, or what my alternatives are...

Last edited by oskar; 10-16-2007 at 05:19 PM.
 
Old 10-16-2007, 05:27 PM   #2
The_JinJ
Member
 
Registered: Apr 2004
Location: Scotland
Distribution: Suse, OpenWRT
Posts: 299

Rep: Reputation: 30
Is -i set in your ~/.bash_alias?
 
Old 10-16-2007, 05:36 PM   #3
oskar
Senior Member
 
Registered: Feb 2006
Location: Austria
Distribution: Ubuntu 12.10
Posts: 1,142

Original Poster
Rep: Reputation: 49
come again?

I suppose you mean .bash_profile (I don't have a .bash_alias)

Code:
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
	. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
 
Old 10-16-2007, 07:31 PM   #4
andrews-mark
Member
 
Registered: Feb 2007
Location: London
Distribution: debian
Posts: 108

Rep: Reputation: 15
Hi - it sounds like the -i flag for cp is on by default. I presume that this is what The_JinJ was suggesting. Often there are bash aliases, set in e.g. /etc/bashrc, or ~/bash_aliases, and cp could be set to cp -i.

You can list all current alias with
Code:
alias -p
(at least, I think that will list all aliases)

However, even with the -i flag, the -u flag should lead you to skip over any file already copied, so there should be no over-write issues to query in the first place. In that case, it is a bit puzzling.

-mark
 
Old 10-16-2007, 09:31 PM   #5
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
alternative:

rsync -vax source dest


... be careful with source, /path/ is not the same as /path.

use -n for dry run to see if it's doing it correctly.
 
Old 10-16-2007, 09:59 PM   #6
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
to see if cp is aliased, type:
Code:
alias cp
If you get back something like:
Code:
alias cp='cp -i'
Then it is. If this is the case, you can opt to run the command directly - not using the alias - by prefixing it with a backslash. i.e.
Code:
\cp -rpuv ...
If you don't ever want this -i option, find the entry in your .bash_profile, .bashrc or and file which is sourced from these, and comment out / delete the line with this alias. The change will only affect new sessions.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
how can I make PCLinuxOS skip its setup questions? newbiesforever Linux - Distributions 8 07-08-2007 10:54 PM
how do i skip e2fsck? murrowman789 Slackware 8 07-20-2005 05:25 PM
Skip grub? jago25_98 Linux - Software 1 07-04-2005 05:25 PM
101 tiny bugs and questions... qwijibow Slackware 7 06-28-2004 05:55 PM
Auto-confirm overwrite questions? ifm Linux - Newbie 4 06-10-2002 06:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration