Linux 非常有用的 20 個命令__Linux

來源:互聯網
上載者:User
 Linux 非常有用的 20 個命令
1. 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 14067118.85414

注意:在Linux中,檔案以“.”開頭的就是隱藏檔案,並且每個檔案,檔案夾,裝置或者命令都是以檔案對待。ls -l 命令輸出: d (代表了是目錄). rwxr-xr-x 是檔案或者目錄對所屬使用者,同一組使用者和其它使用者的許可權。 上面例子中第一個ravisaive代表了檔案檔案屬於使用者ravisaive 上面例子中的第二個ravisaive代表了檔案檔案屬於使用者組ravisaive 4096 代表了檔案大小為4096位元組. May 8 01:06 代表了檔案最後一次修改的日期和時間. 最後面的就是檔案/檔案夾的名字

更多"ls"例子請查看 15 linux中ls命令執行個體



2. lsblk命令

"lsblk"就是列出塊裝置。除了RAM外,以標準的樹狀輸出格式,整齊地顯示塊裝置。 ?

1 2 3 4 5 6 7 8 9 10 11 root@tecmint:~ # lsblk NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT sda      8:0    0 232.9G  0 disk ├─sda1   8:1    0  46.6G  0 part / ├─sda2   8:2    0     1K  0 part ├─sda5   8:5    0   190M  0 part  /boot ├─sda6   8:6    0   3.7G  0 part [SWAP] ├─sda7   8:7    0  93.1G  0 part  /data └─sda8   8:8    0  89.2G  0 part  /personal sr0     11:0    1  1024M  0 rom

lsblk -l”命令以列表格式顯示塊裝置(而不是樹狀格式)。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.