Linux系統維護筆記(一)基礎資訊檢視
阿新 • • 發佈:2018-11-09
位數
getconf LONG_BIT
閘道器
cat /etc/sysconfig/network
DNS
cat /etc/resolv.conf
硬碟
df -h
檢視Linux所有版本資訊
lsb_release -a
修改分組所有者和檔案目錄許可權
chown -R www:www filedir
chmod -R 777 filedir
檢視主機名
hostname
修改臨時主機名字
hostname hsxiang.com
永久修改
/etc/hosts
/etc/sysconfig/network
檢視埠
netstat -lnp|grep 80
檢視apache程序
ps -aux | grep apache
檢視系統所有使用者
cat /etc/passwd |cut -f 1 -d :
使用者相關操作
將一個使用者新增到使用者組中,千萬不能直接用: usermod -G groupA 應該用 加上 -a 選項: usermod -a -G groupA user usermod -a -G nginx svn usermod -a -G root svn 從組中刪除使用者 gpasswd -d user GROUP gpasswd -d svn nginx 檢視所有使用者組 cat /etc/group
移動檔案或目錄
移動當前資料夾下的所有檔案到上一級目錄
mv * ../
把當前目錄的一個子目錄裡的檔案移動到另一個子目錄裡
mv test3/*.txt test5
檔案被覆蓋前做簡單備份,前面加引數-b
mv log1.txt -b log2.txt
檔案改名
mv test.log test1.txt
移動檔案
mv test1.txt test3
解壓縮zip
Linux下的壓縮解壓縮命令詳解及例項
例項:壓縮伺服器上當前目錄的內容為xxx.zip檔案
zip -r xxx.zip ./*
解壓zip檔案到當前目錄
unzip filename.zip