Linux系统基础命令
1. uname -a 或者 cat /proc/version
2. lsb_release -a
3. hostname
4. date
5. exit
6. powerful 或者 shutdown 或者 init 0 关机
7. reboot
8. uptime
9. free -m
10. who
11. last
12. history
13. echo [字符串 | 变量]
14. ip add show 或者 ifconfig
15. su 或者 su -
[zy@localhost ~]$ uname -a
Linux localhost.localdomain 3.10.0-1160.81.1.el7.x86_64
[zy@localhost ~]$
[zy@localhost ~]$ cat /proc/version
Linux version 3.10.0-1160.81.1.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) )
[zy@localhost ~]$
[zy@localhost ~]$
[zy@localhost ~]$ lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.4.1708 (Core)
Release: 7.4.1708
Codename: Core
[zy@localhost ~]$
[zy@localhost ~]$ date
Sat Jan 28 03:26:33 CST 2023
[zy@localhost ~]$
[root@localhost ~]
logout
[zy@localhost ~]$
[zy@localhost ~]$ uptime
03:27:58 up 4:26, 3 users, load average: 0.00, 0.02, 0.05
[zy@localhost ~]$
[zy@localhost ~]$ free -m
total used free shared buff/cache available
Mem: 1819 698 487 9 633 895
Swap: 2047 0 2047
[zy@localhost ~]$
[zy@localhost ~]$ who
zy :0(GUI) 2023-01-27 23:02 (:0)
zy pts/0(伪终端) 2023-01-27 23:08 (:0)
zy pts/1 2023-01-28 03:11 (192.168.8.1)
[zy@localhost ~]$
[zy@localhost ~]$ last
zy pts/1 192.168.8.1 Sat Jan 28 03:11 still logged in
zy pts/0 :0 Fri Jan 27 23:08 still logged in
zy pts/0 :0 Fri Jan 27 23:02 - 23:02 (00:00)
zy pts/0 :0 Fri Jan 27 23:02 - 23:02 (00:00)
zy :0 :0 Fri Jan 27 23:02 still logged in
reboot system boot 3.10.0-1160.81.1 Fri Jan 27 23:01 - 03:36 (04:34)
root pts/0 :0 Mon Dec 12 23:26 - 23:26 (00:00)
root pts/1 :0 Mon Dec 12 23:20 - 23:26 (00:05)
root pts/0 :0 Mon Dec 12 23:20 - 23:26 (00:05)
root :0 :0 Mon Dec 12 23:19 - down (00:07)
reboot system boot 3.10.0-693.el7.x Mon Dec 12 23:19 - 23:26 (00:07)
wtmp begins Mon Dec 12 23:19:02 2022
[zy@localhost ~]$
zy@localhost ~]$ history
1 ifconfig
2 ping www.qq.com
39 who
40 last
41 history
[zy@localhost ~]$ !history 或者 !41
1 ifconfig
2 ping www.qq.com
39 who
40 last
41 history
[zy@localhost ~]$
[zy@localhost ~]$ echo "xiaozhou"
xiaozhou
[zy@localhost ~]$
[zy@localhost ~]$ ip add show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:50:56:3f:96:8d brd ff:ff:ff:ff:ff:ff
inet 192.168.8.152/24 brd 192.168.8.255 scope global ens33
valid_lft forever preferred_lft forever
inet6 fe80::f3b3:cb7d:dd78:78ca/64 scope link
valid_lft forever preferred_lft forever
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN qlen 1000
link/ether 52:54:00:7e:92:33 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN qlen 1000
link/ether 52:54:00:7e:92:33 brd ff:ff:ff:ff:ff:ff
[zy@localhost ~]$
[zy@localhost ~]$ su - root
Password:
Last login: Sat Jan 28 03:18:42 CST 2023 on pts/1
[root@localhost ~]
[zy@localhost ~]$clear 或者 CTRL + L
[zy@localhost ~]$
[root@localhost ~]
[root@localhost ~]