echo
echo命令用于在終端顯示字符串或變量,
格式為:echo [字符串 | 變量]
將echo命令的字符串輸出到終端:
[root@localhost ~]# echo chengwufei
chengwufei
用echo命令查看SHELL變量的值(前面有$符號(hào)):
[root@localhost ~]# echo $SHELL
/bin/bash
查看本機(jī)主機(jī)名:
[root@localhost ~]# echo $HOSTNAME
localhost.localdomain
date
date命令用于顯示/設(shè)置系統(tǒng)的時(shí)間或日期,
格式為:date [選項(xiàng)] [+指定的格式]
強(qiáng)大的date命令能夠按照指定格式顯示系統(tǒng)的時(shí)間或日期,只需鍵入”+”號(hào)開頭的字符串指定其格式.
詳細(xì)格式如下:
eg:
查看當(dāng)前的系統(tǒng)時(shí)間:
[root@localhost%20~]#%20date
Mon%20Sep%2017%2006:00:05%20EDT%202018
按照”年-月-日%20小時(shí):分鐘:秒”的格式:
[root@localhost%20~]#%20date%20"+%Y-%m-%d%20%H:%M:%S"
2018-09-17%2006:01:12
設(shè)置系統(tǒng)時(shí)間為2018年9月17日8點(diǎn)半:
[root@localhost%20~]#%20date%20-s%20"20180917%208:30:00"
Mon%20Sep%2017%2008:30:00%20EDT%202018
查看本地系統(tǒng)時(shí)區(qū):
[root@localhost%20~]#%20date%20"+%Z"
EDT
查看星期幾:
[root@localhost%20~]#%20date%20"+%A"
Monday
輸入當(dāng)前是上午還是下午:
[root@localhost%20~]#%20date%20"+%p"
AM
判斷今天是一年中的第幾天:
[root@localhost%20~]#%20date%20"+%j"
260
reboot
reboot命令用于重啟系統(tǒng)(僅root用戶可以使用)linux常用命令,格式為:”reboot”。
重啟計(jì)算機(jī):
[root@localhost ~]# reboot
wget
wget命令用于使用命令行下載網(wǎng)絡(luò)文件,
格式為:wget [參數(shù)] 下載地址
ifconfig
ifconfig用于獲取網(wǎng)卡配置與網(wǎng)絡(luò)狀態(tài)等信息:格式為ifconfig [網(wǎng)絡(luò)設(shè)備] [參數(shù)]
查看本機(jī)當(dāng)前的網(wǎng)卡配置與網(wǎng)絡(luò)狀態(tài)等信息:
[root@xgj ~]# ifconfig
[root@localhost ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.134.135 netmask 255.255.255.0 broadcast 192.168.134.255
inet6 fe80::563a:c614:1ea8:686a prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:1b:5b:dd txqueuelen 1000 (Ethernet)
RX packets 1081 bytes 88707 (86.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 516 bytes 67896 (66.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
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 1 (Local Loopback)
RX packets 4 bytes 352 (352.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4 bytes 352 (352.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
上一個(gè)教程:Linux+Redis實(shí)戰(zhàn)教程