用戶和組
組:
groupadd -g 1100 dba
groupadd -g 1200 oinstall
用戶
useradd -u 1100 -g 1200 -G 1100 -d /home/oracle oracle
查看oracle用戶
id oracle
改組名
groupmod -n osdba #新用戶 dba #老用戶
用戶改組名
usermod -G 1201 1100 oracle
刪除用戶
userdel -r test
groupdel dba
groupdel oinstall
改密碼
passwd oracle
查看 man 5 /etc/passwd
組man 5 /etc/group
切換用戶
su test 不帶環境變量
su - test 帶環境變量
改變目錄的權限
chmod 777 dir
chmod -R 777 test 目錄級聯修改
chown oracle:root
chown -R oracle:root 級聯修改
網絡
ifconfig
ifconfig -a 全部網卡信息
ifconfig eth0 看eth0網卡信息
改IP ifconfig eht0 192.168.133.121 netmask 255.255.255.0
cat /etc/sysconfig/network-scripts/ifcfg-eth0
重啓網卡 service network restart
加第二個IP ifconfig eth0:1 192.168.133.122 netmask 255.255.255.0
啓用一個網卡 ifup eth0
禁用一個網卡 ifdown eth0
顯示主機名
hostname
cat /etc/sysconfig/network
顯示網絡流量
ethtool eth0
網絡連接 netstat -ntuap netstat -nltup
進程
top top->按h->按f排序->n內存降序
ps -ef ps-ef |gerp LOCAL=NO 看oracle遠端連接進程
ps -ef |head -n5只取前5行
kill -9 pid 強制關閉進程號
服務
chkconfig --list 列出所有服務 chkconfig --list |grep iptables
開啓、關閉、狀態
service iptables start\stop\status
cat /etc/inittab
chkconfig iptables off 重啓也關閉
事件
dmesg 內核引導事件
last reboot
uptime
who -a
uname -a
uname -r 內核版本
lsb_release -a 版本信息
關閉linux
init 0
shutdown -h now
重啓linux
init 6
shutdown -r now
reboot