14,954
edits
| Line 118: | Line 118: | ||
=== List directory or files / list directory contents === | === List directory or files / list directory contents === | ||
* ls ({{Linux}}) | * ls ({{Linux}}) [http://linuxcommand.org/man_pages/ls1.html ls - list directory contents] | ||
** List detailed information of files. e.g. {{kbd | key= ls -lh}}<ref>[http://linux.vbird.org/linux_basic/0210filepermission.php 鳥哥的 Linux 私房菜 -- Linux 的檔案權限與目錄配置]</ref> <ref>[OPTION] | |||
* -l use a long listing format | * -l use a long listing format | ||
* -h, --human-readable; with -l, print sizes in human readable format (e.g., 1K 234M 2G) Quoted from linux {{kbd | key=man ls}}</ref> | * -h, --human-readable; with -l, print sizes in human readable format (e.g., 1K 234M 2G) Quoted from linux {{kbd | key=man ls}}</ref> | ||
** List detailed information of files and sort by modification time. {{kbd | key= ls -lht}} | |||
** List top N files and sort by modification time. {{kbd | key= <nowiki>ls -lht | head -N</nowiki>}} e.g. {{kbd | key= <nowiki>ls -lht | head -10</nowiki>}} First line is the total file size of specified folder. | |||
<ref>[http://www.unix.com/unix-for-dummies-questions-and-answers/44493-how-list-top-10-files.html How to list top 10 files | Unix Linux Forums | UNIX for Dummies Questions & Answers]</ref> | |||
* ll ({{Linux}}) {{kbd | key= ll}} = {{kbd | key= ls -l}} | * ll ({{Linux}}) {{kbd | key= ll}} = {{kbd | key= ls -l}} | ||
* Print the entire path of files and '''level-unlimited''' sub-directories in the current directory. On {{Win}} using {{kbd | key= dir/s/b}}, and on {{Linux}} using {{kbd | key= find /path/to/files/ -print}} <ref>[http://superuser.com/questions/159975/making-ls-output-like-dir-b-s linux - Making ls output like dir /b /s - Super User]</ref>. | * Print the entire path of files and '''level-unlimited''' sub-directories in the current directory. On {{Win}} using {{kbd | key= dir/s/b}}, and on {{Linux}} using {{kbd | key= find /path/to/files/ -print}} <ref>[http://superuser.com/questions/159975/making-ls-output-like-dir-b-s linux - Making ls output like dir /b /s - Super User]</ref>. | ||
| Line 154: | Line 158: | ||
REM -- the returned result will not correct! | REM -- the returned result will not correct! | ||
</pre> | </pre> | ||
=== Print the current directory / where am i === | === Print the current directory / where am i === | ||