linux cp -rf 时仍然提示是否覆盖

cp -rf /upload/*  /website/oxwall/ 虽然我加上了r和f 参数. f 是force 强制的意思.  但是覆盖文件的时候仍然提示需要确认.

这是为什么呢.

我们输入alias命令看一下.

alias cp=’cp -i’    // 看这里,  系统默认cp 则加入了 -i 参数, -i的意思就是需要用户确认的.
alias l.=’ls -d .* –color=auto’
alias ll=’ls -l –color=auto’
alias ls=’ls –color=auto’
alias mv=’mv -i’
alias rm=’rm -i’
alias which=’alias | /usr/bin/which –tty-only –read-alias –show-dot –show-tilde’

1.  所以我们可以 yes | cp -rf /upload/*  /website/oxwall 可以通过管道的方式来解决.

2. 或者 我们可以直接使用  /bin/cp  -rf /upload/*  /website/oxwall

当然我们把alias 的这行设置去掉也可以了.alias cp=’cp -i’  设置的位置一般在 /etc/.bashrc里.

此篇文章已被阅读2298 次

Tags:

Add a Comment

邮箱地址不会被公开。 必填项已用*标注