A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
-bash/zsh: readlink command not found #Debian apt-get install coreutils #Ubuntu apt-get install coreutils #Alpine apk add coreutils #Arch Linux pacman -S coreutils #Kali Linux apt-get install coreutils #CentOS yum install coreutils #Fedora dnf install coreutils #OS X brew install coreutils #Raspbian apt-get install coreutils #Docker docker run cmd.cat/readlink readlink
readlink 命令是 Linux 系统中一个常用工具,主要用来找出符号链接所指向的位置。
PS:readlink 命令的 -e 选项,几乎等同于 realpath 命令。
readlink [OPTION]... FILE
-f, --canonicalize canonicalize by following every symlink in every component of the given name recursively; all but the last component must exist -e, --canonicalize-existing canonicalize by following every symlink in every component of the given name recursively, all components must exist -m, --canonicalize-missing canonicalize by following every symlink in every component of the given name recursively, without requirements on components existence -n, --no-newline do not output the trailing newline -q, --quiet, -s, --silent suppress most error messages -v, --verbose report error messages --help display this help and exit --version output version information and exit
目标文件
readlink 获取符号链接指向的实际文件:
readlink filename
readlink 获取文件的绝对路径:
readlink -f filename