歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux教程

linux系統入門學習(71)

ls命令

ls命令是列出目錄內容(List Directory Contents)的意思。運行它就是列出文件夾裡的內容,可能是文件也可能是文件夾。

?

1

2

3

4

5

6

7

root@tecmint:~# ls

 

Android-Games                     Music

Pictures                          Public

Desktop                           Tecmint.com

Documents                         TecMint-Sync

Downloads                         Templates

“ls -l”命令以詳情模式(long listing fashion)列出文件夾的內容。

?

1

2

3

4

5

6

7

8

9

10

11

root@tecmint:~# ls -l

 

total 40588

drwxrwxr-x 2 ravisaive ravisaive     4096 May  8 01:06 Android Games

drwxr-xr-x 2 ravisaive ravisaive     4096 May 15 10:50 Desktop

drwxr-xr-x 2 ravisaive ravisaive     4096 May 16 16:45 Documents

drwxr-xr-x 6 ravisaive ravisaive     4096 May 16 14:34 Downloads

drwxr-xr-x 2 ravisaive ravisaive     4096 Apr 30 20:50 Music

drwxr-xr-x 2 ravisaive ravisaive     4096 May  9 17:54 Pictures

drwxrwxr-x 5 ravisaive ravisaive     4096 May  3 18:44 Tecmint.com

drwxr-xr-x 2 ravisaive ravisaive     4096 Apr 30 20:50 Templates

"ls -a"命令會列出文件夾裡的所有內容,包括以"."開頭的隱藏文件。

?

1

2

3

4

5

6

7

8

9

10

11

12

root@tecmint:~# ls -a

 

.           .gnupg          .dbus           .goutputstream-PI5VVW       .mission-control

.adobe                  deja-dup                .grsync                 .mozilla                    .themes

.gstreamer-0.10         .mtpaint                .thumbnails             .gtk-bookmarks              .thunderbird

.HotShots               .mysql_history          .htaccess       .apport-ignore.xml          .ICEauthority          

.profile                .bash_history           .icons                  .bash_logout                    .fbmessenger

.jedit                  .pulse                  .bashrc                 .liferea_1.8                .pulse-cookie           

.Xauthority     .gconf                  .local                  .Xauthority.HGHVWW      .cache

.gftp                   .macromedia             .remmina                .cinnamon                       .gimp-2.8

.ssh                    .xsession-errors    .compiz                 .gnome                          teamviewer_linux.deb         

.xsession-errors.old    .config                 .gnome2                 .zoncolor

注意:在Linux中,文件以“.”開頭的就是隱藏文件,並且每個文件,文件夾,設備或者命令都是以文件對待。ls -l 命令輸出:

  1. d (代表了是目錄).
  2. rwxr-xr-x 是文件或者目錄對所屬用戶,同一組用戶和其它用戶的權限。
  3. 上面例子中第一個ravisaive 代表了文件文件屬於用戶ravisaive
  4. 上面例子中的第二個ravisaive代表了文件文件屬於用戶組ravisaive
  5. 4096 代表了文件大小為4096字節.
  6. May 8 01:06 代表了文件最後一次修改的日期和時間.
  7. 最後面的就是文件/文件夾的名字
Copyright © Linux教程網 All Rights Reserved