我已经阅读了 /tmp 和 /var/tmp 之间的区别,因此请注意,这不是这个问题的内容。当我在 /tmp 中创建文件时,它会显示在 /var/tmp 中;但是,两个目录都显示为另一个的符号链接:
[root@l12662 /]# pwd; ll
/
total 32
lrwxrwxrwx. 1 root root 7 Aug 25 2017 bin -> usr/bin
dr-xr-xr-x. 4 root root 4096 Aug 25 2017 boot
drwxr-xr-x 21 root root 3560 Nov 18 23:32 dev
...
drwxrwxrwt. 27 root root 4096 Nov 24 08:18 tmp
...
[root@l12662 /]# cd /var
[root@l12662 var]# ll
total 12
drwxr-xr-x. 2 root root 19 Mar 28 2017 account
drwxr-xr-x. 2 root root 6 Mar 10 2016 adm
drwxr-xr-x. 10 root root 122 Aug 25 2017 cache
...
drwxrwxrwt. 27 root root 4096 Nov 24 08:18 tmp
...
它们是如何关联的:
[root@l12662 tmp]# pwd; ls | grep test
/tmp
[root@l12662 tmp]# ls /var/tmp/ | grep test
[root@l12662 tmp]# pwd; touch test.me
/tmp
[root@l12662 tmp]# pwd; ls | grep test
/tmp
test.me
[root@l12662 tmp]# ls /var/tmp/ | grep test
test.me
[root@l12662 tmp]#
这是 RHEL 7,顺便说一句:
[root@l12662 tmp]# cat /etc/*release
NAME="Red Hat Enterprise Linux Server"
VERSION="7.4 (Maipo)"
ID="rhel"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="7.4"
PRETTY_NAME="Red Hat Enterprise Linux Server 7.4 (Maipo)"