1
$ cp /source/* /destination/ 
cp: overwrite `/destination/file1.conf`

Aim is to copy files from source to destination without getting prompt or using non-alias(/) method.

2 Answers 2

2

Command Without Alias

Any unix command can be prefixed with \ to get the non-alias version.

With Alias

#-(0) :: /dev/shm/test2 > ls
total 0
-rw-------. 1 root 0 Feb 24 16:29 a
-rw-------. 1 root 0 Feb 24 16:29 b
-rw-------. 1 root 0 Feb 24 16:29 c
-rw-------. 1 root 0 Feb 24 16:29 d

Without Alias

#-(0) :: /dev/shm/test2 > \ls
a  b  c  d
0

I don't know what you mean by "using unalias method", but if you read the cp man page, you can learn about

-n, --no-clobber
          do not overwrite an existing file (overrides a previous -i option)

and

-u, --update
          copy only when the SOURCE file is newer than the
          destination file or when the destination file is missing

so you would have two ways to avoid the prompt. You need to decide which method is better suited for your purposes.

1
  • it might be that he uses a shell where cp is already alias to cp -i or something like that (similiar to what Aaron answered) Feb 26, 2017 at 20:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .