readlink -f <file>

readlink -m <file>

会把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

参考:http://stackoverflow.com/questions/3915040/bash-fish-command-to-print-absolute-path-to-a-file

shell -- 获取绝对路径的更多相关文章

  1. shell脚本获取绝对路径

    当前脚本全路径 echo $(readlink -f "$0") 获取绝对路径(不带文件名) echo $(dirname $(readlink -f "$0" ...

  2. 【转载】路径双反斜杠!!!Python IDLE或Python shell中切换路径 切换目录os.chdir("C:\\python37\\2019pythonshel37\\diedai")

    Python IDLE或shell中切换路径在Python自带的编辑器IDLE中或者python shell中不能使用cd命令,那么跳到目标路径呢.方法是使用os包下的相关函数实现路径切换功能. im ...

  3. Bash Shell 获取进程 PID

    转载地址:http://weyo.me/pages/techs/linux-get-pid/ 导读 Linux 的交互式 Shell 与 Shell 脚本存在一定的差异,主要是由于后者存在一个独立的运 ...

  4. C# 获取文件路径

    1.C# 获取文件路径:http://www.cnblogs.com/bq-blog/archive/2012/09/01/2666394.html

  5. JAVA获取服务器路径的方法

    1.在JSF环境中获取到ServletContext: 1 2 ServletContext sc = (ServletContext)FacesContext.         getCurrent ...

  6. java代码中获取classpath路径

    Javaweb工程中,有时候需要自己手动的去读取classpath下面的配置文件,这里总结一点读取classpath路径的方法,分享一下. 方法一: String path = Test.class. ...

  7. 用C++和shell获取本机CPU、网卡IO、内存、磁盘等的基本信息

    用C++和shell获取本机CPU.网卡.内存.磁盘等的基本信息: 由于对C++相关的函数没多少了解,但是觉得用shell反而相对简单一些: 一.shell脚本,用来辅助C++获取主机的资源使用信息 ...

  8. linux中用shell获取昨天、明天或多天前的日期

    linux中用shell获取昨天.明天或多天前的日期 时间 -- :: BlogJava-专家区 原文 http://www.blogjava.net/xzclog/archive/2015/12/0 ...

  9. 通过PID获取进程路径的几种方法

    通过PID获取进程路径的几种方法 想获得进程可执行文件的路径最常用的方法是通过GetModuleFileNameEx函数获得可执行文件的模块路径这个函数从Windows NT 4.0开始到现在的Vis ...

随机推荐

  1. js 操作cookie cookie路径问题

    这里主要不是讲这个方法,js写cookie这种代码网上一抓一把,在使用的时候遇到一点问题,就是写的cookie 是有路径问题的,在user目录下可以使用跳转到另外一个目录下cookie,经过比较coo ...

  2. PMBOK项目管理认知概要

    2015年6月,通过努力取得PMP证书,很是欣喜,也是对努力付出的一种奖励吧! 通过学习PMP相关的项目管理的知识,对国外的项目管理技术有更加系统的认知.理解.掌握,熟悉全项目生命周期的管理. 其实对 ...

  3. linux命令之系统管理命令(上)

    1.lsof:查看进程打开的文件 该命令可以列举系统中已经被打开的文件,可以根据文件找到对应的进程信息,同时也可以根据进程信息找到进程打开的文件. 参数 说明 -c 进程名 显示指定的进程名打开的文件 ...

  4. dict字典;dict的操作

    一.字典: 1. 字典 dict 用{}来表示 键值对数据 {key:value} 唯一性 键   都必须是可哈希的 不可变的数据类型就可以当做字典中的键 值   没有任何限制 1.1  字典的创建: ...

  5. Windows下Jmeter安装出现Not able to find Java executable or version问题解决方案

    安装好java1.8.jmeter4.0,并java -version正常,jmeter也能正常使用.某一次使用突然出现Not able to find Java executable or vers ...

  6. animal与@keyframe

    .test1 { width: 90px; height: 60px; -webkit-animation-name: skyset; -webkit-animation-duration: 2000 ...

  7. 2016级算法第四次上机-D.AlvinZH的1021实验plus

    978 AlvinZH的1021实验plus 思路 贪心,中等题. 使用miss变量表示未覆盖的最小数字,初始值为1. 初始覆盖区间为[1,miss),目标是覆盖[1,m],即miss需要大于m. 需 ...

  8. Centos 7.6 安装selenium+firefox+google chrome(支持xshell运行)

    1. 查看Linux 版本 [root@penguin selenium]# cat /etc/redhat-release CentOS Linux release 7.6.1810 (Core) ...

  9. six

    团队序号:6组 团队名称:拯救地球小分队 团队项目的码云地址:https://gitee.com/lwj5950/seflash 此次博客撰写人姓名:刘威骏 学号:2017*****7168 团队中的 ...

  10. git常用安装包,指令

    babel-polufill  -es6  API转义 npm install --save @babel/polyfill babel-runtime -es语法转义 npm install --s ...