加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 为什么ls -la不显示当前目录是symlink?

发布时间:2020-12-13 17:00:36 所属栏目:Linux 来源:网络整理
导读:这更像是一种好奇心,但是我注意到/ etc / httpd / logs符号链接到/ var / log / httpd,但是当我在/ etc / httpd / logs里面时,我做了ls -la,我看到: drwx------ 2 root root 4096 Mar 21 14:58 .drwxr-xr-x 9 root root 4096 Mar 17 03:10 .. 为什么不呢.入
这更像是一种好奇心,但是我注意到/ etc / httpd / logs符号链接到/ var / log / httpd,但是当我在/ etc / httpd / logs里面时,我做了ls -la,我看到:
drwx------ 2 root root    4096 Mar 21 14:58 .
drwxr-xr-x 9 root root    4096 Mar 17 03:10 ..

为什么不呢.入门秀lrwx ….?

但是当我去/ etc / httpd并做ls -la时,我看到:

lrwxrwxrwx 1 root root   19 Mar  4 17:12 logs -> ../../var/log/httpd

解决方法

我可以回答一个问题吗?假设你在这里安装RedHat / CentOS ……
ls /etc/httpd/
  # should return something like:
  # conf  conf.d  logs  modules  run
cd /etc/httpd/logs/
  # Why does this next command fail?
ls ../conf
  # ls: cannot access ../conf: No such file or directory
  # But this next command works?
cd ../conf

简短的回答是当你在/ etc / httpd / logs(符号链接)内部时,你实际上在/ var / log / httpd里面,这是一个目录.

cd /etc/httpd/logs/
pwd
  # /etc/httpd/logs
pwd -P
  # /var/log/httpd

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读