Linux 命令的基本格式:
[root@localhost ~]# 命令[选项][参数]
命令格式中的 [] 表明可选项,也就是有些命令能够不写选项或参数,也能执行。
一、echo
Shell 的 echo 用于字符串的输出。命令格式:
echo string
不加选项:
还能够加上选项 -n 表示不换行输出
echo -e 能在字符串中输出彩色的字符
二、screen
screen命令用于多重视窗管理程序
参数说明:shell
-A 将全部的视窗都调整为目前终端机的大小。
-d<做业名称> 将指定的screen做业离线。
-h<行数> 指定视窗的缓冲区行数。
-m 即便目前已在做业中的screen做业,仍强制创建新的screen做业。
-r<做业名称> 恢复离线的screen做业。
-R 先试图恢复离线的做业。若找不到离线的做业,即创建新的screen做业。
-s<shell> 指定创建新视窗时,所要执行的shell。
-S<做业名称> 指定screen做业的名称。
-v 显示版本信息。
-x 恢复以前离线的screen做业。
-ls或--list 显示目前全部的screen做业。
-wipe 检查目前全部的screen做业,并删除已经没法使用的screen做业。网络
三、date
date不加选项,不加参数
[root@CentOS7 ~]# date
Sat Jun 13 22:52:57 CST 2020
也能够加上参数,指定输出格式
[root@CentOS7 ~]# date "+%F %T"
2020-06-13 22:54:11
date 加上选项,加上参数
-d 显示字符串的时间
[root@CentOS7 ~]# date -d "yesterday"
Fri Jun 12 23:23:18 CST 2020
四、ifconfig
ifconfig 命令用于显示或设置网络设备。
不加选项和参数,显示网络设备信息
[root@CentOS7 ~]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.87.130 netmask 255.255.255.0 broadcast 192.168.87.255
inet6 fe80::f686:21f:4b09:798d prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:0e:90:4f txqueuelen 1000 (Ethernet)
RX packets 3246 bytes 265593 (259.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 869 bytes 362483 (353.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0ide
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.87.131 netmask 255.255.255.0 broadcast 192.168.87.255
inet6 fe80::66b2:651d:4ec0:dccf prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:0e:90:59 txqueuelen 1000 (Ethernet)
RX packets 2143 bytes 140827 (137.5 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 27 bytes 3896 (3.8 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0oop
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 03d
ifconfig eth1 down 关闭eth1网卡
[root@CentOS7 ~]# ifconfig eth1 down
[root@CentOS7 ~]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.87.130 netmask 255.255.255.0 broadcast 192.168.87.255
inet6 fe80::f686:21f:4b09:798d prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:0e:90:4f txqueuelen 1000 (Ethernet)
RX packets 3423 bytes 279579 (273.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 904 bytes 370423 (361.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0blog
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0ip
修改eth1的IP地址
[root@CentOS7 ~]# ifconfig eth1 192.168.87.132 netmask 255.255.255.0
[root@CentOS7 ~]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.87.130 netmask 255.255.255.0 broadcast 192.168.87.255
inet6 fe80::f686:21f:4b09:798d prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:0e:90:4f txqueuelen 1000 (Ethernet)
RX packets 3739 bytes 309753 (302.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1028 bytes 396475 (387.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0字符串
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.87.132 netmask 255.255.255.0 broadcast 192.168.87.255
inet6 fe80::66b2:651d:4ec0:dccf prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:0e:90:59 txqueuelen 1000 (Ethernet)
RX packets 2314 bytes 152497 (148.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 40 bytes 5452 (5.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0string
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0it