关键词: 复制
文件覆盖、源文件复制、链接文件复制、
[kingarthur@localhost ~]$ pwd
/home/kingarthur
[kingarthur@localhost ~]$ su root
Password:
[root@localhost kingarthur]
cp: overwrite ‘/tmp/bashrc’? n
[root@localhost kingarthur]
-rw-r--r--. 1 root root 176 2020-03-30 01:12:20.698920937 +0800 /tmp/bashrc
[root@localhost kingarthur]
cp: overwrite ‘/tmp/bashrc’? Y
[root@localhost kingarthur]
-rw-r--r--. 1 root root 176 2020-03-30 01:17:23.255914128 +0800 /tmp/bashrc
[root@localhost tmp]
-rw-r--r--. 1 root root 176 2020-03-30 01:17:23.255914128 +0800 ./bashrc
-rw-r--r--. 1 kingarthur kingarthur 231 2018-10-31 01:07:12.000000000 +0800 /home/kingarthur/.bashrc
[root@localhost tmp]
[root@localhost tmp]
-rw-rw-r--. 1 root utmp 42240 2020-03-30 00:15:15.053998029 +0800 /var/log/wtmp
-rw-r--r--. 1 root root 42240 2020-03-30 01:28:49.632898682 +0800 ./wtmp
[root@localhost tmp]
[root@localhost tmp]
-rw-rw-r--. 1 root utmp 42240 2020-03-30 00:15:15.053998029 +0800 /var/log/wtmp
-rw-r--r--. 1 root root 42240 2020-03-30 01:33:05.401892926 +0800 ./wtmp2
[root@localhost tmp]
[root@localhost tmp]
-rw-rw-r--. 1 root utmp 42240 2020-03-30 00:15:15.053998029 +0800 /var/log/wtmp
-rw-rw-r--. 1 root utmp 42240 2020-03-30 00:15:15.053998029 +0800 ./wtmp3
[root@localhost tmp]
[root@localhost kingarthur]
[root@localhost tmp]
/tmp
[root@localhost tmp]
cp: omitting directory ‘/etc/’
[root@localhost tmp]
[root@localhost tmp]
abrt dhcp hosts man_db.conf popt.d slp.spi
adjtime DIR_COLORS hosts.allow maven portreserve smartmontools
[root@localhost tmp]
./etc
[root@localhost tmp]
./bashrc
[root@localhost tmp]
[root@localhost tmp]
[root@localhost tmp]
-rw-r--r--. 2 root root 176 Mar 30 01:17 bashrc
-rw-r--r--. 2 root root 176 Mar 30 01:17 bashrc_hlink
lrwxrwxrwx. 1 root root 6 Mar 30 16:41 bashrc_slink -> bashrc
[root@localhost tmp]
-rw-r--r--. 2 root root 176 2020-03-30 01:17:23.255914128 +0800 bashrc
-rw-r--r--. 2 root root 176 2020-03-30 01:17:23.255914128 +0800 bashrc_hlink
lrwxrwxrwx. 1 root root 6 2020-03-30 16:41:04.928965131 +0800 bashrc_slink -> bashrc
[root@localhost tmp]
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
[root@localhost tmp]
/tmp
[root@localhost tmp]
cp: overwrite ‘/tmp/bashrc’? N
[root@localhost tmp]
[root@localhost tmp]
-rw-r--r--. 2 root root 176 2020-03-30 01:17:23.255914128 +0800 /tmp/bashrc
[root@localhost tmp]
/tmp
[root@localhost tmp]
[root@localhost tmp]
[root@localhost tmp]
lrwxrwxrwx. 1 root root 6 Mar 30 16:41 bashrc_slink -> bashrc
-rw-r--r--. 1 root root 176 Mar 30 16:54 bashrc_slink_1
lrwxrwxrwx. 1 root root 6 Mar 30 16:55 bashrc_slink_2 -> bashrc
[root@localhost tmp]
-rw-r--r--. 2 root root 176 Mar 30 01:17 bashrc
-rw-r--r--. 2 root root 176 Mar 30 01:17 bashrc_hlink
lrwxrwxrwx. 1 root root 6 Mar 30 16:41 bashrc_slink -> bashrc
-rw-r--r--. 1 root root 176 Mar 30 16:54 bashrc_slink_1
lrwxrwxrwx. 1 root root 6 Mar 30 16:55 bashrc_slink_2 -> bashrc
[root@localhost tmp]
[root@localhost tmp]
bashrc bashrc_hlink bashrc_slink bashrc_slink_1 bashrc_slink_2
[root@localhost tmp]
-rw-r--r--. 2 root root 176 Mar 30 01:17 bashrc
-rw-r--r--. 2 root root 176 Mar 30 01:17 bashrc_hlink
lrwxrwxrwx. 1 root root 6 Mar 30 16:41 bashrc_slink -> bashrc
-rw-r--r--. 1 root root 176 Mar 30 16:54 bashrc_slink_1
lrwxrwxrwx. 1 root root 6 Mar 30 16:55 bashrc_slink_2 -> bashrc
[root@localhost tmp]
-rw-------. 1 root root 2774 Mar 30 16:59 .bash_history
-rw-r--r--. 2 root root 176 Mar 30 01:17 bashrc
-rw-r--r--. 1 root root 176 Mar 30 16:59 .bashrc
-rw-r--r--. 2 root root 176 Mar 30 01:17 bashrc_hlink
lrwxrwxrwx. 1 root root 6 Mar 30 16:41 bashrc_slink -> bashrc
-rw-r--r--. 1 root root 176 Mar 30 16:54 bashrc_slink_1
lrwxrwxrwx. 1 root root 6 Mar 30 16:55 bashrc_slink_2 -> bashrc
[root@localhost tmp]
cp: omitting directory ‘/etc/’
[root@localhost tmp]
[root@localhost tmp]
abrt dhcp hosts man_db.conf popt.d slp.spi
adjtime DIR_COLORS hosts.allow maven portreserve smartmontools
akonadi DIR_COLORS.256color hosts.deny mcelog postfix snmp
aliases DIR_COLORS.lightbgcolor hp mime.types ppp softhsm2.conf
...
[root@localhost tmp]
./etc
[root@localhost tmp]
./bashrc
[root@localhost tmp]
[root@localhost tmp]
[root@localhost tmp]
-rw-r--r--. 2 root root 176 Mar 30 01:17 bashrc
-rw-r--r--. 2 root root 176 Mar 30 01:17 bashrc_hlink
lrwxrwxrwx. 1 root root 6 Mar 30 16:41 bashrc_slink -> bashrc
[root@localhost tmp]
-rw-r--r--. 2 root root 176 2020-03-30 01:17:23.255914128 +0800 bashrc
-rw-r--r--. 2 root root 176 2020-03-30 01:17:23.255914128 +0800 bashrc_hlink
lrwxrwxrwx. 1 root root 6 2020-03-30 16:41:04.928965131 +0800 bashrc_slink -> bashrc
[root@localhost tmp]
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
[root@localhost tmp]
cp: overwrite ‘/tmp/bashrc’? N
[root@localhost tmp]
[root@localhost tmp]
-rw-r--r--. 2 root root 176 2020-03-30 01:17:23.255914128 +0800 /tmp/bashrc
[root@localhost tmp]
[root@localhost tmp]
[root@localhost tmp]
-rw-r--r--. 2 root root 176 Mar 30 01:17 bashrc
-rw-r--r--. 2 root root 176 Mar 30 01:17 bashrc_hlink
lrwxrwxrwx. 1 root root 6 Mar 30 16:41 bashrc_slink -> bashrc
-rw-r--r--. 1 root root 176 Mar 30 16:54 bashrc_slink_1
lrwxrwxrwx. 1 root root 6 Mar 30 16:55 bashrc_slink_2 -> bashrc
[root@localhost tmp]
[root@localhost tmp]
-rw-r--r--. 2 root root 176 Mar 30 01:17 bashrc
-rw-r--r--. 2 root root 176 Mar 30 01:17 bashrc_hlink
lrwxrwxrwx. 1 root root 6 Mar 30 16:41 bashrc_slink -> bashrc
-rw-r--r--. 1 root root 176 Mar 30 16:54 bashrc_slink_1
lrwxrwxrwx. 1 root root 6 Mar 30 16:55 bashrc_slink_2 -> bashrc
[root@localhost tmp]
-rw-------. 1 root root 2774 Mar 30 16:59 .bash_history
-rw-r--r--. 2 root root 176 Mar 30 01:17 bashrc
-rw-r--r--. 1 root root 176 Mar 30 16:59 .bashrc
-rw-r--r--. 2 root root 176 Mar 30 01:17 bashrc_hlink
lrwxrwxrwx. 1 root root 6 Mar 30 16:41 bashrc_slink -> bashrc
-rw-r--r--. 1 root root 176 Mar 30 16:54 bashrc_slink_1
lrwxrwxrwx. 1 root root 6 Mar 30 16:55 bashrc_slink_2 -> bashrc
[root@localhost tmp]
bashrc bashrc_hlink bashrc_slink bashrc_slink_1 bashrc_slink_2
[root@localhost tmp]
rm: remove regular file ‘bashrc’? y
[root@localhost tmp]
rm: remove regular file ‘bashrc_hlink’? y
rm: remove symbolic link ‘bashrc_slink’? y
rm: remove regular file ‘bashrc_slink_1’? y
rm: remove symbolic link ‘bashrc_slink_2’? y
[root@localhost tmp]
ls: cannot access *bashr*: No such file or directory
[root@localhost tmp]
./etc/
[root@localhost tmp]
rm: cannot remove ‘./etc/’: Directory not empty
[root@localhost tmp]
[root@localhost tmp]
rm: descend into directory ‘./etc/’? y
rm: remove regular file ‘./etc/fstab’? y
rm: remove regular empty file ‘./etc/crypttab’? y
rm: remove symbolic link ‘./etc/mtab’? y
rm: remove regular file ‘./etc/resolv.conf’? y
rm: descend into directory ‘./etc/fonts’? y
rm: descend into directory ‘./etc/fonts/conf.d’? y
rm: remove symbolic link ‘./etc/fonts/conf.d/65-0-lohit-kannada.conf’? y
rm: remove symbolic link ‘./etc/fonts/conf.d/59-liberation-sans.conf’? y
rm: remove symbolic link ‘./etc/fonts/conf.d/31-cantarell.conf’? y
rm: remove symbolic link ‘./etc/fonts/conf.d/60-fontawesome.conf’? ^C
[root@localhost tmp]
./etc/
[root@localhost tmp]
rmdir: invalid option -- 'i'
Try 'rmdir --help' for more information.
[root@localhost tmp]
rm: descend into directory ‘./etc’? Y
rm: descend into directory ‘./etc/fonts’? y
rm: descend into directory ‘./etc/fonts/conf.d’? ^C
[root@localhost tmp]
./etc/
[root@localhost tmp]
rm: descend into directory ‘./etc/’? y
rm: descend into directory ‘./etc/fonts’? y
rm: descend into directory ‘./etc/fonts/conf.d’? ^C
[root@localhost tmp]
./etc/
[root@localhost tmp]
[root@localhost tmp]
ls: cannot access ./etc/: No such file or directory
[root@localhost tmp]
[root@localhost tmp]
-rw-r--r--. 1 root root 0 Apr 1 20:18 ./-aaa-
[root@localhost tmp]
rm: invalid option -- 'a'
Try 'rm ./-aaa-' to remove the file ‘-aaa-’.
Try 'rm --help' for more information.
[root@localhost tmp]
rm: remove regular empty file ‘./-aaa-’? n
[root@localhost tmp]
rm: invalid option -- 'a'
Try 'rm ./-aaa-' to remove the file ‘-aaa-’.
Try 'rm --help' for more information.
[root@localhost tmp]
rm: remove regular empty file ‘./-aaa-’? y
[root@localhost tmp]
ls: cannot access ./-aaa-: No such file or directory
[root@localhost tmp]
[root@localhost tmp]
-rw-r--r--. 1 root root 0 Apr 1 20:21 ./-aaa-
[root@localhost tmp]
rm: remove regular empty file ‘-aaa-’? y
[root@localhost tmp]
ls: cannot access ./-aaa-: No such file or directory
[root@localhost tmp]
[root@localhost tmp]
[root@localhost tmp]
[root@localhost tmp]
[root@localhost tmp]
[root@localhost tmp]
[root@localhost tmp]
[root@localhost tmp]
-rw-r--r--. 1 root root 176 Apr 1 20:31 ./bashrc1
-rw-r--r--. 1 root root 176 Apr 1 20:31 ./bashrc2
[root@localhost tmp]
[root@localhost tmp]
total 16
drwxr-xr-x. 2 root root 50 Apr 1 20:32 .
drwxrwxrwt. 25 root root 4096 Apr 1 20:32 ..
-rw-r--r--. 1 root root 176 Apr 1 20:28 bashrc
-rw-r--r--. 1 root root 176 Apr 1 20:31 bashrc1
-rw-r--r--. 1 root root 176 Apr 1 20:31 bashrc2
[root@localhost tmp]
network
[root@localhost tmp]
/etc/sysconfig