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

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 exitExamples: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.lryc.cn/news/211207.html

相关文章:

  • SDL事件处理以及线程使用(2)
  • DAY38 动态规划 + 509. 斐波那契数 + 70. 爬楼梯 + 746. 使用最小花费爬楼梯
  • Redis快速上手篇七(集群-一台虚拟机六个节点)
  • 社恐了怎么办?如何改变社交恐惧症?
  • HiQPdf Library for .NET - HTML to PDF Crack
  • ES6中Set集合
  • 论坛介绍 | COSCon'23 开源文化(GL)
  • 【httpd】 Apache http服务器目录显示不全解决
  • 笔记本电脑搜索不到wifi6 无线路由器信号
  • js获取input?
  • STM32 CAN使用
  • 安全和便捷:如何将运营商二要素API应用于实名制管理中
  • leetcode-二叉树
  • 【鸿蒙软件开发】ArkTS基础组件之TextTimer(文本显示计时)、TimePicker(时间选择)
  • pytorch 笔记:KLDivLoss
  • 父子项目打包发布至私仓库
  • 汽车网络安全--ECU的安全更新
  • NLP之搭建RNN神经网络
  • Android问题笔记四十三:JNI 开发如何快速定位崩溃问题
  • 机器学习 | 决策树算法
  • javascript中各种风骚的代码
  • el-tree横向纵向滚动条
  • STM32G030F6P6 芯片实验 (一)
  • Wpf 使用 Prism 实战开发Day01
  • 6G关键新兴技术- 智能超表面(RIS)技术演进
  • 【redhat9.2】搭建Discuz-X3.5网站
  • 算法篇 : 并查集
  • AM@微积分基本定理@微积分第二基本定理
  • goland常用快捷键
  • CSDN写文章时常见问题及技巧