用户和组

组: 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