在Linux中具有完整路徑名的ls

如何在Linux終端的命令外殼中列出文件和目錄以顯示完整路徑/絕對路徑名。

 

為了獲得帶有ls的絕對目錄名稱,請在終端的命令外殼中輸入:

$ ls -d $PWD/*

具有絕對目錄名稱的ls:

$ ls -d $PWD/*
/home/user/Desktop   /home/user/Music    /home/user/Templates
/home/user/Documents /home/user/Pictures /home/user/todo.txt
/home/user/Downloads /home/user/Public   /home/user/Videos
$

 

ls具有長列表格式(-l)絕對目錄名稱(-d):

$ ls -ld $PWD/*
total 4
drwxr-xr-x 2 user user  80 2011-08-17 16:52 /home/user/Desktop
drwxr-xr-x 2 user user  40 2011-08-17 16:52 /home/user/Documents
drwxr-xr-x 2 user user  40 2011-08-17 16:52 /home/user/Downloads
drwxr-xr-x 2 user user  40 2011-08-17 16:52 /home/user/Music
drwxr-xr-x 2 user user 120 2011-08-17 18:14 /home/user/Pictures
drwxr-xr-x 2 user user  40 2011-08-17 16:52 /home/user/Public
drwxr-xr-x 2 user user  40 2011-08-17 16:52 /home/user/Templates
-rw-r--r-- 1 user user 131 2011-08-17 18:07 /home/user/todo.txt
drwxr-xr-x 2 user user  40 2011-08-17 16:52 /home/user/Videos
$

 

 


也可以看看

Advertising

LS命令
快速表格