linux常用管理命令
安裝了CentOS操作系統(tǒng),記錄一下相關(guān)系統(tǒng)管理操作命令
重啟命令
1、reboot
2、shutdown -r now 立刻重啟(root用戶使用)
3、shutdown -r 10 過10分鐘自動重啟(root用戶使用)
4、shutdown -r 20:35 在時間為20:35時候重啟(root用戶使用)
通過shutdown命令設(shè)置重啟,可以用shutdown -c命令取消重啟
關(guān)機(jī)命令
1、halt 立刻關(guān)機(jī)
2、poweroff 立刻關(guān)機(jī)
3、shutdown -h now 立刻關(guān)機(jī)(root用戶使用)
4、shutdown -h 10 10分鐘后自動關(guān)機(jī)
通過shutdown命令設(shè)置關(guān)機(jī),可以用shutdown -c命令取消重啟
查看當(dāng)前使用的網(wǎng)卡
watch cat /proc/net/dev
看下哪張網(wǎng)卡的流量變化大一般就是哪張網(wǎng)卡是在線使用的
新手必學(xué)!Linux重啟+網(wǎng)卡管理+修改IP+防火墻管理
重啟網(wǎng)卡方法
1、全部網(wǎng)卡重啟
重啟網(wǎng)卡使設(shè)定生效:sudo /etc/init.d/networking restart
2、單個網(wǎng)卡重啟
關(guān)閉網(wǎng)卡 ifdown eth0
開啟網(wǎng)卡 ifup eth0
禁用網(wǎng)卡
vi /etc/sysconfig/network-scripts/ifcfg-eth1
onboot=NO
修改IP
查看網(wǎng)卡信息: ifconfig
Linux重啟+網(wǎng)卡管理+修改IP+防火墻管理
1、動態(tài)
設(shè)定一個網(wǎng)卡IP:ifconfig eth1 192.168.1.10 netmask 255.255.255.0
重啟網(wǎng)卡使設(shè)定生效:sudo /etc/init.d/networking restart
2、靜態(tài)
編輯文件 /etc/network/interfaces
sudo vi /etc/network/interfaces
并用下面的行來替換有關(guān)eth0的行:
The primary network interface
auto eth0
iface eth0 inet static
address 192.168.2.1
gateway 192.168.2.254
netmask 255.255.255.0
#network 192.168.2.0
#broadcast 192.168.2.255
將eth0的IP分配方式修改為靜態(tài)分配(static)后,為其制定IP、網(wǎng)關(guān)、子網(wǎng)掩碼等信息。
將上面的Ubuntu IP地址等信息換成你自己就可以了。
用下面的命令使網(wǎng)絡(luò)設(shè)置生效:
sudo /etc/init.d/networking restart
操作防火墻(service方式)
查看防火墻狀態(tài): service iptables status
開啟防火墻:service iptables start
關(guān)閉防火墻:service iptables stop
轉(zhuǎn)載于:https://blog.51cto.com/7704223/2397125
總結(jié)
以上是生活随笔為你收集整理的linux常用管理命令的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 项目中用到的Linux命令
- 下一篇: linux中运行.sql文件