当前位置: 首页 > article >正文

Linux命令(108)之dirname

linux命令之dirname

1.dirname介绍

linux命令dirname是用来获取文件的指定路径

2.dirname用法

dirname [参数] NAME

dirname参数
参数说明
-z使用NUL而不是换行符分隔输出
--help查看帮助信息
--version查看版本信息

3.实例

3.1.获取文件的指定路径

命令:

dirname ztj.txt

OR

dirname /root/ztj.txt

OR

dirname /a/b/c/d

[root@rhel77 ~]# dirname  ./ztj.txt
.       ---当前目录
[root@rhel77 ~]# dirname /root/ztj.txt
/root
[root@rhel77 ~]# dirname /a/b/c/d
/a/b/c
[root@rhel77 ~]# 

3.2.使用NUL而不是换行符分隔输出

命令:

dirname -z /a/b/c/d

[root@rhel77 ~]# dirname -z /a/b/c/d
/a/b/c[root@rhel77 ~]# 

3.3.查看版本信息

命令:

dirname --version

[root@rhel77 ~]# dirname --version
dirname (GNU coreutils) 8.22
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David MacKenzie and Jim Meyering.
[root@rhel77 ~]# 

3.4.查看帮助信息

命令:

dirname --help

[root@rhel77 ~]# dirname --help
Usage: dirname [OPTION] NAME...
Output each NAME with its last non-slash component and trailing slashes
removed; if NAME contains no /'s, output '.' (meaning the current directory).

  -z, --zero     separate output with NUL rather than newline
      --help     display this help and exit
      --version  output version information and exit

Examples:
  dirname /usr/bin/          -> "/usr"
  dirname dir1/str dir2/str  -> "dir1" followed by "dir2"
  dirname stdio.h            -> "."

GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
For complete documentation, run: info coreutils 'dirname invocation'
You have new mail in /var/spool/mail/root
[root@rhel77 ~]# 

http://www.kler.cn/news/109175.html

相关文章:

  • Mybatis 动态SQL
  • Python mysql 封装备用
  • Go学习第十六章——Gin文件上传与下载
  • Vue路由
  • 基于单片机的温湿度和二氧化碳检测系统设计
  • TensorFlow图像多标签分类实例
  • 【鸿蒙软件开发】ArkTS基础组件之TextTimer(文本显示计时)、TimePicker(时间选择)
  • 校园物业报修小程序开发笔记一
  • C/C++晶晶赴约会 2020年12月电子学会青少年软件编程(C/C++)等级考试一级真题答案解析
  • 基于单片机的超声波探伤仪设计
  • 一句话解释什么是出口IP
  • 0基础学习VR全景平台篇第114篇:全景图优化和输出 - PTGui Pro教程
  • LuaTable转C#的列表List和字典Dictionary
  • Openssl数据安全传输平台015:OCCI的使用方法+在项目中的设计与实现
  • java中spi与api的区别
  • “破解我!“---160个CrackMe练习001-Acid buen.exe
  • 免费活动-11月4日敏捷武林上海站 | Scrum.org CEO 亲临现场
  • 深入理解Linux网络笔记(五):深度理解本机网络IO
  • 【技能树笔记】网络篇——练习题解析(十)
  • STM32-通用定时器
  • SpringBoot 整合 Nacos 实现统一配置中心
  • Azure云工作站上做Machine Learning模型开发 - 全流程演示
  • DVWA-SQL Injection SQL注入
  • 当『后设学习』碰上『工程学思维』
  • iOS iGameGuardian修改器检测方案
  • Python requests之Cookie
  • 大数据Flink(一百零五):SQL性能调优
  • 常见的配置文件格式:yaml,json,xml,ini,csv等
  • 一、灵动mm32单片机_开发环境的搭建(Keil)
  • jvm对象内存划分