天天看點

centos學習筆記(一)

centos學習筆記(一)

1、遠端登入伺服器:

ssh [email protected]

2、常用指令(檢視):

檢視CPU資訊:lscpu

檢視硬碟資訊:lsblk

檢視記憶體資訊:ps -aux

檢視系統資訊:uname -a

檢視時間:date

檢視目前使用者:whoami

檢視所有連接配接使用者:w

檢視所有使用者:cat /etc/passwd

檢視已運作服務:systemctl status

檢視開機運作服務:systemctl list-unit-files |grep enabled

檢視定時任務:crontab -l

檢視目錄内容:ls

檢視目錄内容詳細資訊:ll

檢視目前目錄:pwd

檢視檔案内容:cat

實時檢視檔案内容:tail

檢視本機網絡資訊:ifconfig,ip addr

檢視防火牆狀态:systemctl status firewalld

檢視防火牆已開放端口:firewall-cmd --zone=public --list-ports

檢視selinux狀态:getenforce

檢視輸入指令曆史:history

檢視伺服器已開放端口:netstat -ntpl

3、常用指令(建立):

建立檔案:tourch

建立目錄:mkdir

建立軟連接配接:ln -s //file(絕對路徑下源檔案) // (絕對路徑的目标目錄)

建立硬連結:ln //file(絕對路徑下源檔案) // (絕對路徑的目标目錄)

建立使用者:useradd

建立使用者組:groupadd

4、常用指令(編輯):

檔案編輯:vim

複制:cp //file(源檔案) // (目标目錄)

移動(重命名):mv //file(源檔案) // (目标目錄)

重定向:指令 >file

追加重定向:指令 >>file

5、網絡指令:

聯通:ping

遠端通路:telnet x.x.x.x post

路由:route

新網絡工具:vmcli

5、常用指令:

進入目錄:cd

回到上級目錄:cd …

回到家目錄:cd ~

删除:rm

壓縮gz:tar czfv xx .tar.gz /*/xx(源檔案)

解壓gz:tar xzvf xx.tar.gz

殺死程序:kill -9 pid

檔案權限:chmod 421 xxx

删除使用者:userdel xxx

切換使用者:su xxx

更改使用者密碼:passwd

重新開機:reboot

關機:shutdown -h now

繼續閱讀