1.查看当前linux系统执行过的命令使用
history
[root@localhost 桌面]# history
……
935 env
936 env
937 tom=test
938 export jack=test
939 env
940 env | grep test
941 set | grep test
942 set
943 history
944 pwd
945 cd ~
946 cat 123.txt
947 ifconfig
948 passwd
949 echo $1
950 echo $933
951 lspci -nn
952 history
953 env
954 sh /opt/data/scripts/mysql/openmysql.sh
如果要快速执行某条命令
直接输入 !+数字
例如执行947条命令
输入!947
[root@localhost 桌面]# !947
ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:b2:a5:8c:60 txqueuelen 0 (Ethernet)
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 0
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.15 netmask 255.255.255.0 broadcast 11.11.11.255
inet6 fe80::7593:782e:4e7e:d54b prefixlen 64 scopeid 0x20<link>
ether 06:3c:18:25:0d:ac txqueuelen 1000 (Ethernet)
RX packets 9289 bytes 12088959 (11.5 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3914 bytes 285677 (278.9 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 1000 (Local Loopback)
RX packets 11956 bytes 1080990 (1.0 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 11956 bytes 1080990 (1.0 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
像954条
sh /opt/data/scripts/mysql/openmysql.sh
这样长的命令,可以用这种方法直接执行
!954
跟运行上面长的命令是一样的