5 月 102016
 

 

查看cp命令别名设置

查看别名

[root@localhost ~]# alias cp
alias cp='cp -i'
[root@localhost ~]#

相关参数

-R, -r, --recursive copy directories recursively
-f, --force if an existing destination file cannot be opened, remove it and try again (redundant if the -n option is used)
-i, --interactive prompt before overwrite (overrides a previous -n option)

注释相关别名配置,并重新登录用户。

[root@localhost ~]# cat ~/.bashrc
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
 . /etc/bashrc
fi
[root@localhost ~]#

使用\转义符号处理。

[root@localhost ~]# ls
anaconda-ks.cfg db.txt install.log install.log.syslog
[root@localhost ~]# touch abc.txt
[root@localhost ~]# ls
abc.txt anaconda-ks.cfg db.txt install.log install.log.syslog
[root@localhost ~]# \cp -rf install.log abc.txt
[root@localhost ~]# ll
total 36
-rw-r--r-- 1 root root 8835 May 10 10:12 abc.txt
-rw-------. 1 root root 1107 Nov 9 2015 anaconda-ks.cfg
-rw-r--r-- 1 root root 744 May 7 11:07 db.txt
-rw-r--r--. 1 root root 8835 Nov 9 2015 install.log
-rw-r--r--. 1 root root 3314 Nov 9 2015 install.log.syslog
[root@localhost ~]#

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据