readlink 命令


在Linux中readlink命令的作用是:輸出符號鏈接值或權威文件名(通常使用的是-f參數)

格式:
readlink [選項]... 文件

參數:
-f, --canonicalize                 遞歸跟隨給出文件名的所有符號鏈接以標准化,
                        除最后一個外所有組件必須存在
 -e, --canonicalize-existing         遞歸跟隨給出文件名的所有符號鏈接以標准化,
                            所有組件都必須存在
 -m, --canonicalize-missing         遞歸跟隨給出文件名的所有符號鏈接以標准化,
                          對組件存在性作出要求
 -n, --no-newline                  不輸出尾隨的新行
 -q, --quiet,
 -s, --silent      縮減大多數的錯誤消息
 -v, --verbose     報告所有錯誤消息
     --help        顯示此幫助信息並退出
     --version     顯示版本信息並退出
用法:
[root@JumpServer /]# ll
總用量 20
lrwxrwxrwx.   1 root root    7 10月  3 03:04 bin -> usr/bin   # 鏈接文件
dr-xr-xr-x.   4 root root 4096 10月  3 03:17 boot
drwxr-xr-x.  20 root root 3260 3月   1 16:10 dev
drwxr-xr-x.  83 root root 8192 3月   8 10:36 etc
drwxr-xr-x.   2 root root    6 11月  5 2016 home
lrwxrwxrwx.   1 root root    7 10月  3 03:04 lib -> usr/lib
lrwxrwxrwx.   1 root root    9 10月  3 03:04 lib64 -> usr/lib64
drwxr-xr-x.   2 root root    6 11月  5 2016 media
drwxr-xr-x.   2 root root    6 11月  5 2016 mnt
drwxr-xr-x.   6 root root   78 3月   1 15:58 opt
dr-xr-xr-x. 127 root root    0 3月   1 15:05 proc
dr-xr-x---.   7 root root  258 3月   2 16:46 root
drwxr-xr-x.  27 root root  840 3月   8 11:38 run
lrwxrwxrwx.   1 root root    8 10月  3 03:04 sbin -> usr/sbin
drwxr-xr-x.   2 root root    6 11月  5 2016 srv
dr-xr-xr-x.  13 root root    0 3月   1 15:05 sys
drwxrwxrwt.  14 root root 4096 3月   8 12:02 tmp
drwxr-xr-x.  13 root root  155 10月  3 03:04 usr
drwxr-xr-x.  19 root root  267 3月   1 15:05 var
[root@JumpServer /]# readlink -f /bin/     # 執行readlink方法
/usr/bin                                   # 這個才是真正的可執行文件 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM