linux常用管理命令
安裝了CentOS操作系統,記錄一下相關系統管理操作命令
重啟命令
1、reboot
2、shutdown -r now 立刻重啟(root用戶使用)
3、shutdown -r 10 過10分鐘自動重啟(root用戶使用)
4、shutdown -r 20:35 在時間為20:35時候重啟(root用戶使用)
通過shutdown命令設置重啟,可以用shutdown -c命令取消重啟
關機命令
1、halt 立刻關機
2、poweroff 立刻關機
3、shutdown -h now 立刻關機(root用戶使用)
4、shutdown -h 10 10分鐘后自動關機
通過shutdown命令設置關機,可以用shutdown -c命令取消重啟
查看當前使用的網卡
watch cat /proc/net/dev
看下哪張網卡的流量變化大一般就是哪張網卡是在線使用的
新手必學!Linux重啟+網卡管理+修改IP+防火墻管理
重啟網卡方法
1、全部網卡重啟
重啟網卡使設定生效:sudo /etc/init.d/networking restart
2、單個網卡重啟
關閉網卡 ifdown eth0
開啟網卡 ifup eth0
禁用網卡
vi /etc/sysconfig/network-scripts/ifcfg-eth1
onboot=NO
修改IP
查看網卡信息: ifconfig
Linux重啟+網卡管理+修改IP+防火墻管理
1、動態
設定一個網卡IP:ifconfig eth1 192.168.1.10 netmask 255.255.255.0
重啟網卡使設定生效:sudo /etc/init.d/networking restart
2、靜態
編輯文件 /etc/network/interfaces
sudo vi /etc/network/interfaces
并用下面的行來替換有關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分配方式修改為靜態分配(static)后,為其制定IP、網關、子網掩碼等信息。
將上面的Ubuntu IP地址等信息換成你自己就可以了。
用下面的命令使網絡設置生效:
sudo /etc/init.d/networking restart
操作防火墻(service方式)
查看防火墻狀態: service iptables status
開啟防火墻:service iptables start
關閉防火墻:service iptables stop
轉載于:https://blog.51cto.com/7704223/2397125
總結
以上是生活随笔為你收集整理的linux常用管理命令的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 项目中用到的Linux命令
- 下一篇: 小猿圈web前端简述canvas如何实现