Khi cho một đường dẫn và kiểm tra xem đường dẫn đó có tồn tại hay không, ls có thể trả lời có hoặc không. Nhưng namei mới là giải pháp để tìm ra đường dẫn đứt ở đoạn nào.
Dùng thêm option -l để hiện thông tin chi tiết.
Hết.
$ whatis namei
namei (1) - follow a pathname until a terminal point is found
$ ls /etc/salt/minion.d/extra.conf/hihi/heheKết quả cho biết đường dẫn này không tồn tại từ phần "hihi" chứ ko phải phần "hehe".
ls: cannot access /etc/salt/minion.d/extra.conf/hihi/hehe: Not a directory
$ namei /etc/salt/minion.d/extra.conf/hihi/hehe
f: /etc/salt/minion.d/extra.conf/hihi/hehe
d /
d etc
d salt
d minion.d
- extra.conf
hihi - No such file or directory
Dùng thêm option -l để hiện thông tin chi tiết.
$ namei -l /etc/salt/minion.d/extra.conf/hihi/hehenamei nằm trong package util-linux, package chứa rất nhiều các công cụ quan trọng để bảo trì hệ thống nên có thể nói sẽ tìm thấy namei trên mọi Linux-based OS:
f: /etc/salt/minion.d/extra.conf/hihi/hehe
drwxr-xr-x root root /
drwxr-xr-x root root etc
drwxr-xr-x root root salt
drwxr-x--- root root minion.d
-r--r----- root root extra.conf
hihi - No such file or directory
$ dpkg -S `which namei`Bài viết thực hiện trên:
util-linux: /usr/bin/namei
$ lsb_release -dhvn AT familug DOT org
Description: Ubuntu 14.04.3 LTS
$ dpkg -l util-linux | grep ii
ii util-linux 2.20.1-5.1ubuntu20.7 amd64 Miscellaneous system utilities
Hết.
Comments
Post a Comment