Linux命令基礎(一)

來源:互聯網
上載者:User

  1.建立一個檔案:touch filename
  
  2.檔案許可權前面那一位代表的是檔案類型
       d  目錄
       l  符號連結(指向另外一個檔案)
       s  通訊端檔案
       b  塊裝置檔案
       c  字元裝置檔案
       p  具名管道檔案
       -  普通檔案
 
 3.chmod [who] operator [permission] filename
      who的含義:
          u  檔案屬主許可權
          g  同組使用者權限
          o  其他使用者權限
          a  所有使用者
     operator含義:
          +  增加許可權
           -  取消許可權
          =  設定許可權
     permission含義:
          r  讀許可權
          w  寫入權限
          x  執行許可權
          s  檔案屬主和組set-ID
          t  粘性位*

          l  給檔案加鎖

 for example: myfile檔案許可權rwxrwxrwx
 chmod a-x myfile rw-rw-rw
 chmod og-w myfile rw-r--r--
 絕對模式:
 chmod 755 myfile
 
 4.目錄許可權位含義:
 讀:可以列出其中的內容
 寫:可以在該目錄中建立檔案
 執行:可以搜尋和訪問該目錄
 
 5.chown:改變屬主
    chgrp:改變所屬組
 
 6.umask:設定建立檔案或目錄的預設許可權,也就是從許可權中“拿走”相應的許可權位
 For example:umask值為002
 檔案最大許可權    777
 umask值         002
 目錄許可權        775
 檔案許可權        664
 
 7.建立軟連結命名的一般形式:
 ln [-s] source_path target_path
 For example:有一個網路監視器,它將日誌寫在/usr/opt/monitor/regstar目錄下,但是其他所有的日誌都儲存在/var/adm/logs下,用下面的命令可以在一個地方看所有的日誌了:
 ln -s /usr/opt/monitor/regstar/reg.log /var/adm/logs/monitor.log
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.