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.

Vinay Kumar D
  • 11
  • 1
  • 4

2 Answers2

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
Aaron
  • 2,859
  • 2
  • 12
  • 30
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.

Sven
  • 98,649
  • 14
  • 180
  • 226
  • 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) – Dennis Nolte Feb 26 '17 at 20:33