Linux 常用小命令

來源:互聯網
上載者:User

1. df 查看硬碟的使用方式
# df
# df -h

2. cd 切換目錄
# cd /var/

3. ls 瀏覽目錄
# ls
# ls -a <查看以.開頭的隱藏檔案>
# ls -l <查看文檔的詳細資料>
# ls -h <以資料單位方式查看 m b g>
# ls -F <查看文件類型>
# ls -al
# ls -aF
# ls -lh

4. mkdir 建立目錄
# mkdir dirName

5. passwd 修改使用者密碼
# passwd <修改目前使用者密碼>
# passwd username <修改其他使用者密碼>

6. su 切換使用者
# su userName

7. pwd 查看當前所在目錄位置
# pwd

8. mount 掛載與卸載光碟機USB
# mount /dev/acd0 <自動掛載到 /cdrom>
# mount <查看掛載狀態>
# mount -t cd9660 /dev/acd0 /mnt <掛在到/mnt目錄>
# umont /mnt <卸載>
# mount -t msdos /dev/da0s1 /mnt/usb <掛載USB>
# umount /dev/da0s1 <卸載USB>

9. netstat 查看網路狀態
# netstat -an

10. exit 退出目前使用者狀態
# exit

11. clear 清除螢幕
# clear

12. date 當前日期時間
# date

13. cal 月曆
# cal
# cal | more

14. who 列出系統上的使用者
# who

15. pkg_delete 移除應用程式
# pkg_delete softName <注意所刪除軟體的版本號碼>

16. reboot 重啟系統
# reboot <第一種重啟方式>
# shutdown -r now <第二種重啟方式>

17. shutdown 關機
# shutdown -p now

18. bc 計算機
# bc
> quit <退出>

19. ps 線程查看命令
# ps
# ps -a <顯示所有進程>
# ps -aux <顯示所有包含其它使用者的進程>
# ps -aux | grep binName/psid <顯示某一應用的進程>

20. pgrep 顯示進程ID
# pgrep nginx

21. traceroute 路由命令
# traceroute ip
# traceroute -I ip <使用ICMP回應取代UDP資料資訊>
# traceroute -n ip <直接使用IP地址而非主機名稱>
# traceroute -v ip <詳細顯示指令的執行過程>
# traceroute -I -n -v ip

22. ntpdate 同步日期
# ntpdate -b -u time.windows.com

23. ln 連結命令
# ln /home/db /usr/local/mysql <永久連結>
# ln -s /home/db /usr/local/mysql <軟體連結,推薦>

24. env 查看環境變數
# env
# setenv

25. find 命令歸集

1. 通過find命令精確尋找
find / -name findname

2. 通過find命令模糊比對右尋找
find / -name "*findname"

3. 通過find命令模糊比對左尋找
find / -name "findname*"

 

其他: ssh ip

         ee(同vim)

         ll(ls -l的縮寫,加上-h可顯示大小)

         more(分頁顯示)

相關文章

聯繫我們

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