整站优化价格,五一自学网免费教程官网,好的域名 org 网站,美团推广平台linux命令之dirname
1.dirname介绍
linux命令dirname是用来获取文件的指定路径
2.dirname用法
dirname [参数] NAME dirname参数 参数说明-z使用NUL而不是换行符分隔输出--help查看帮助信息--version查看版本信息
3.实例
3.1.获取文件的指定路径
命令#xff1a;
dirn…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
[rootrhel77 ~]# dirname ./ztj.txt
. ---当前目录
[rootrhel77 ~]# dirname /root/ztj.txt
/root
[rootrhel77 ~]# dirname /a/b/c/d
/a/b/c
[rootrhel77 ~]# 3.2.使用NUL而不是换行符分隔输出
命令
dirname -z /a/b/c/d
[rootrhel77 ~]# dirname -z /a/b/c/d
/a/b/c[rootrhel77 ~]# 3.3.查看版本信息
命令
dirname --version
[rootrhel77 ~]# 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.
[rootrhel77 ~]# 3.4.查看帮助信息
命令
dirname --help
[rootrhel77 ~]# 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/ - /usrdirname dir1/str dir2/str - dir1 followed by dir2dirname 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
[rootrhel77 ~]#