Linux中dir和dirname命令

 

001、dir列出指定目录下的所有文件

[root@localhost test]# ls
1.txt  3.txt  5.txt  8.txt  a.txt  result.txt
[root@localhost test]# dir                        ## 列出当前目录下的所有文件
1.txt  3.txt  5.txt  8.txt  a.txt  result.txt
[root@localhost test]# dir /home                  ## 列出指定目录下的所有文件
liujiaxin01  pileupCaller-Linux  test

 。

 

002、dirname会返回指定目录的上一级目录

[root@localhost test]# ls
1.txt  3.txt  5.txt  8.txt  a.txt  result.txt
[root@localhost test]# pwd
/home/test
[root@localhost test]# dirname /home/test/
/home
[root@localhost test]# dirname /home/
/
[root@localhost test]# dirname /home/test/xxx/yyy
/home/test/xxx

 。

 

posted @ 2024-12-09 23:22  小鲨鱼2018  阅读(115)  评论(0)    收藏  举报