显示行号
|
选择喜欢的代码风格
默认
GitHub
Dune
LakeSide
Plateau
Vibrant
Blue
Eighties
Tranquil
realpath 命令显示文件或目录的解析绝对路径。
realpath 命令安装:
-bash/zsh: realpath command not found
#Debian
apt-get install realpath
#Ubuntu
apt-get install realpath
#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 realpath
#Raspbian
apt-get install coreutils
#Docker
docker run cmd.cat/realpath realpath
realpath 命令补充说明:
realpath 命令将每个文件名参数转换为绝对路径名,该绝对路径名不包含符号链接或 special 组成部分 . 或 .. 目录条目。
PS:readlink 命令的 -e 选项提供了几乎相同的功能。
realpath 命令语法:
realpath [OPTION]... FILE...
realpath [-s|--strip] [-z|--zero] filename ...
realpath --h|--help
realpath --v|--version
realpath 命令选项:
-s, --strip
Only strip . and .., components, but do not resolve symbolic links.
-z, --zero
Separate output filenames with the null character instead of newline, so it can be used with the '-0' option of xargs(1).
-h, --help
打印简短用法信息。
-v, --version
显示realpath的版本号
realpath 命令参数:
目标文件
realpath 命令实例:
realpath 显示文件或目录的绝对路径:
realpath path/to/file_or_directory
realpath 要求所有路径组件都存在:
realpath --canonicalize-existing path/to/file_or_directory
realpath 在符号链接之前解析 .. 组件:
realpath --logical path/to/file_or_directory
realpath 禁用符号链接扩展:
realpath --no-symlinks path/to/file_or_directory
realpath 禁止显示错误消息:
realpath --quiet path/to/file_or_directory
realpath 命令扩展阅读:
realpath 命令评论