加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux常用管理命令

发布时间:2020-12-14 01:09:10 所属栏目:Linux 来源:网络整理
导读:CentOS操作系统,记录一下相关系统管理操作命令 重启命令 1、reboot 2、shutdown -r now 立刻重启(root用户使用) 3、shutdown -r 10 过10分钟自动重启(root用户使用) 4、shutdown -r 20:35 在时间为20:35时候重启(root用户使用) 通过shutdown命令设置重启,
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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读