1. 程式人生 > >Linux Centos 命令

Linux Centos 命令

  1. 檢視安裝的軟體的包 package: rpm -q package_string
    rpm -q httpd
    httpd-x.x.x-xx.xxx.centos.x.xxx_xx
    rpm -q apache
    package apache is not installed
    rpm -q python
    python-2.xx-xx.xxx.xxxxxx
    rpm -q test2
    package test2 is not installed

  2. 用 sudo檢視另一個使用者執行的操作
    sudo grep curl /home/username/.bash_history

// 類別 –> 運維,監控
1. mpstat 1


非常好用的一個工具,可以動態監控,比如CPU的執行狀況,可以按照每隔一秒鐘輸出一個狀態,動態更新
08:35:23 AM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle
08:35:24 AM all 0.xx 0.xx 0.xx 0.xx 0.xx 0.xx 0.xx 0.xx 0.xx xx.xx
2. 檢視 lastname.firstname的可以執行sudo的授權的所有命令
[email protected]
:~$ sudo -llU lastname.firstname
Matching Defaults entries for lastname.firstname on xx001:
!authenticate
User lastname.firstname may run the following commands on xx001:
SSSD Role: test_xxx_web_sudo
RunAsUsers: lastname.firstname
Options: !authenticate
Commands:
/abc/bcd/systemctl stop httpd
/abc/bcd/systemctl start httpd
/abc/bcd/systemctl restart httpd
/abc/bcd/systemctl reload httpd
/abc/bcd/journalctl -eu httpd

  1. 檢視目錄下各個檔案包括資料夾分別佔用的磁碟空間
    du -h –max-depth 1 /home
    du -h –max-depth 1 ./

    1. nmap localhost

5, lsblk (列出塊裝置)
(列出塊裝置)命令用於列出所有可用塊裝置的資訊,但是,它不會列出RAM盤的資訊。塊裝置有硬碟,快閃記憶體盤,CD-ROM等等
// 使用Linux的lsblk命令列出塊裝置資訊
https://linux.cn/article-3340-1.html