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