一、linux命令:
ly=ens33
临时生效 命令行的一般都是临时生效,重启就失效了。
[root@localhost opt]# alias ly='cat /opt/456' **//别名赋值**
[root@localhost opt]# ll
总用量 122880
-rw-r--r--. 1 dn dn 0 5月 18 23:07 456
drwxr-xr-x. 2 root root 28 5月 18 23:15 lc102
drwxr-xr-x. 2 root root 28 5月 18 23:28 lc103
drwxr-xr-x. 2 root root 6 5月 18 22:41 test1
-rw-r--r--. 1 root root 115343360 5月 18 23:03 test1.txt
drwxr-xr-x. 2 root root 6 5月 18 22:41 test2
drwxr-xr-x. 2 root root 6 5月 18 22:41 test3
drwxr-xr-x. 7 root root 183 5月 19 12:05 xy102
-rw-r--r--. 1 root root 10485760 5月 18 23:30 xy102.txt
[root@localhost opt]# cat 456
[root@localhost opt]# echo 456 > 456
[root@localhost opt]# cat 456
456
[root@localhost opt]# cd ly
-bash: cd: ly: 没有那个文件或目录
[root@localhost opt]# ly
456
unalias:删除别名
unalias ly:
[root@localhost opt]# alias
alias cp='cp -i'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias ly='cat /opt/456'
alias mv='mv -i'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
[root@localhost opt]# unalias ly
[root@localhost opt]# alias
alias cp='cp -i'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias mv='mv -i'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
[root@localhost opt]#
**1.2、du:当前路径所在目录及文件使用的大小。
**[root@localhost opt]# du
0 ./test1
0 ./test2
0 ./test3
0 ./xy102/opt/test1
0 ./xy102/opt/test2
0 ./xy102/opt/test3
0 ./xy102/opt/xy102
0 ./xy102/opt
0 ./xy102/test1
0 ./xy102/test2
0 ./xy102/test3
0 ./xy102/xy102/opt/test1
0 ./xy102/xy102/opt/test2
0 ./xy102/xy102/opt/test3
0 ./xy102/xy102/opt/xy102
0 ./xy102/xy102/opt
0 ./xy102/xy102/test1
0 ./xy102/xy102/test2
0 ./xy102/xy102/test3
0 ./xy102/xy102
0 ./xy102
0 ./lc102
0 ./lc103
122884 .**
*du -sh:**直观展示当前路径所在目录及文件使用的大小。
[root@localhost opt]# du -sh *
4.0K 456
0 lc102
0 lc103
0 test1
110M test1.txt
0 test2
0 test3
0 xy102
10M xy102.txt
**s:**只统计当前路径下每个目录和文件的总大小,不去计算子目录的大小。
**h:**人性化表示。
*****:**列出所有。
**[root@localhost opt]# du -s
122884 .
[root@localhost opt]# du -h
0 ./test1
0 ./test2
0 ./test3
0 ./xy102/opt/test1
0 ./xy102/opt/test2
0 ./xy102/opt/test3
0 ./xy102/opt/xy102
0 ./xy102/opt
0 ./xy102/test1
0 ./xy102/test2
0 ./xy102/test3
0 ./xy102/xy102/opt/test1
0 ./xy102/xy102/opt/test2
0 ./xy102/xy102/opt/test3
0 ./xy102/xy102/opt/xy102
0 ./xy102/xy102/opt
0 ./xy102/xy102/test1
0 ./xy102/xy102/test2
0 ./xy102/xy102/test3
0 ./xy102/xy102
0 ./xy102
0 ./lc102
0 ./lc103
121M .
[root@localhost opt]# du *
4 456
0 lc102
0 lc103
0 test1
112640 test1.txt
0 test2
0 test3
0 xy102/opt/test1
0 xy102/opt/test2
0 xy102/opt/test3
0 xy102/opt/xy102
0 xy102/opt
0 xy102/test1
0 xy102/test2
0 xy102/test3
0 xy102/xy102/opt/test1
0 xy102/xy102/opt/test2
0 xy102/xy102/opt/test3
0 xy102/xy102/opt/xy102
0 xy102/xy102/opt
0 xy102/xy102/test1
0 xy102/xy102/test2
0 xy102/xy102/test3
0 xy102/xy102
0 xy102
10240 xy102.txt****
**df:**查看整个系统的硬盘使用情况。
df -h:**人性化查看磁盘空间的使用情况。
df -hT:显示挂载点的文件系统。
[root@localhost opt]# df
文件系统 1K-块 已用 可用 已用% 挂载点
/dev/mapper/centos-root 38815216 5503664 33311552 15% /
devtmpfs 1913696 0 1913696 0% /dev
tmpfs 1930752 0 1930752 0% /dev/shm
tmpfs 1930752 12860 1917892 1% /run
tmpfs 1930752 0 1930752 0% /sys/fs/cgroup
/dev/sda1 1038336 182724 855612 18% /boot
/dev/mapper/centos-home 18950144 37500 18912644 1% /home
tmpfs 386152 4 386148 1% /run/user/42
tmpfs 386152 56 386096 1% /run/user/0
/dev/sr0 4480476 4480476 0 100% /run/media/root/CentOS 7 x86_64
[root@localhost opt]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/centos-root 38G 5.3G 32G 15% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 13M 1.9G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/sda1 1014M 179M 836M 18% /boot
/dev/mapper/centos-home 19G 37M 19G 1% /home
tmpfs 378M 4.0K 378M 1% /run/user/42
tmpfs 378M 56K 378M 1% /run/user/0
/dev/sr0 4.3G 4.3G 0 100% /run/media/root/CentOS 7 x86_64
[root@localhost opt]# df -hT
文件系统 类型 容量 已用 可用 已用% 挂载点
/dev/mapper/centos-root xfs 38G 5.3G 32G 15% /
devtmpfs devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs tmpfs 1.9G 13M 1.9G 1% /run
tmpfs tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/sda1 xfs 1014M 179M 836M 18% /boot
/dev/mapper/centos-home xfs 19G 37M 19G 1% /home
tmpfs tmpfs 378M 4.0K 378M 1% /run/user/42
tmpfs tmpfs 378M 56K 378M 1% /run/user/0
/dev/sr0 iso9660 4.3G 4.3G 0 100% /run/media/root/CentOS 7 x86_64
df和du有什么区别?面试题?
1、查看范围:du仅限当前路径;df整个系统。
2、信息的详细度:df整体化信息。包含了整个文件系统的使用情况。du指定目录下的各个文件和目录的大小。
二、find 查找文件
特点:精确查找;
实时遍历,全找,速度比较慢;
支持多种查找条件。
find 查找路径 查找条件 处理动作(默认动作打印结果)
find /opt(不加路径,默认当前所在路径)
查找条件:
2.1、-name:根据文件名进行查找,精确匹配,允许使用通配符查找。*?实现通配符。**
[root@localhost opt]# find /opt/ -name *.txt
/opt/test1.txt
[root@localhost opt]# find /opt/ -name 123
/opt/123
/opt/lc102/123
/opt/lc103/123
[root@localhost opt]#
2.2-size:根据文件大小查找。+表示比查找目标大 -比查找目标小 =(约等于查找目标大小)**
[root@localhost opt]# dd if=/dev/zero of=/opt/test4.txt bs=5M count=8
记录了8+0 的读入
记录了8+0 的写出
41943040字节(42 MB)已复制,0.186239 秒,225 MB/秒
[root@localhost opt]# find /opt/ -size 40M
/opt/test4.txt
[root@localhost opt]# find /opt/ -size +30M
/opt/test1.txt
/opt/test4.txt
[root@localhost opt]#
单位:K M G(大写)
2.3-type:根据文件类型进行查找**
f 普通文件
[root@localhost opt]# find /opt/ -type f /普通文件查找/
/opt/test1.txt
/opt/123
/opt/456
/opt/lc102/123
/opt/lc102/456
/opt/lc103/123
/opt/lc103/456
/opt/test4.txt
[root@localhost opt]#
d 目录
[root@localhost opt]# find /opt/ -type d
/opt/
/opt/test1
/opt/test2
/opt/test3
/opt/xy102
/opt/xy102/opt
/opt/xy102/opt/test1
/opt/xy102/opt/test2
/opt/xy102/opt/test3
/opt/xy102/opt/xy102
/opt/xy102/test1
/opt/xy102/test2
/opt/xy102/test3
/opt/xy102/xy102
/opt/xy102/xy102/opt
/opt/xy102/xy102/opt/test1
/opt/xy102/xy102/opt/test2
/opt/xy102/xy102/opt/test3
/opt/xy102/xy102/opt/xy102
/opt/xy102/xy102/test1
/opt/xy102/xy102/test2
/opt/xy102/xy102/test3
/opt/lc102
/opt/lc103
[root@localhost opt]#
l 链接文件
[root@localhost opt]# find /opt/ -type l
/opt/test1/346
b 块文件
2.4-user:根据文件的所有者进行查找。
1、切换所有者权限
[root@localhost opt]# chown dn.dn 123
[root@localhost opt]# ll
总用量 153600
-rw-r--r--. 1 dn dn 0 5月 18 23:07 123
-rw-r--r--. 1 dn dn 0 5月 18 23:07 456
drwxr-xr-x. 2 root root 28 5月 18 23:15 lc102
drwxr-xr-x. 2 root root 28 5月 18 23:28 lc103
drwxr-xr-x. 2 root root 17 5月 19 14:28 test1
-rw-r--r--. 1 root root 115343360 5月 18 23:03 test1.txt
drwxr-xr-x. 2 root root 6 5月 18 22:41 test2
drwxr-xr-x. 2 root root 6 5月 18 22:41 test3
-rw-r--r--. 1 root root 41943040 5月 19 14:18 test4.txt
drwxr-xr-x. 7 root root 69 5月 18 22:45 xy102
[root@localhost opt]# chown root.dn 123
[root@localhost opt]# ll
总用量 153600
-rw-r--r--. 1 root dn 0 5月 18 23:07 123
-rw-r--r--. 1 dn dn 0 5月 18 23:07 456
drwxr-xr-x. 2 root root 28 5月 18 23:15 lc102
drwxr-xr-x. 2 root root 28 5月 18 23:28 lc103
drwxr-xr-x. 2 root root 17 5月 19 14:28 test1
-rw-r--r--. 1 root root 115343360 5月 18 23:03 test1.txt
drwxr-xr-x. 2 root root 6 5月 18 22:41 test2
drwxr-xr-x. 2 root root 6 5月 18 22:41 test3
-rw-r--r--. 1 root root 41943040 5月 19 14:18 test4.txt
drwxr-xr-x. 7 root root
①根据使用者权限查找
[root@localhost opt]# find /opt/ -user dn
/opt/456
/opt/lc102/456
-inum:根据文件的inode号查找。默认动作
[root@localhost opt]# find /opt/ -inum 33624957
/opt/123
delete删除。
[root@localhost a]# find /opt/ -inum 11496 -delete
[root@localhost a]# ls -ishl
总用量 124M
11503 0 -rw-r--r--. 1 root root 0 5月 17 17:14 123
11504 0 -rw-r--r--. 1 dn root 0 5月 17 17:14 456
11498 24M -rw-r--r--. 1 root root 24M 5月 17 16:51 test2.txt
11497 100M -rw-r--r--. 1 root root 100M 5月 17 16:15 test.txt
非空目录删除。
[root@localhost a]# find /opt/ -inum 11503 -exec rm -rf {} \;
[root@localhost a]# ls -ishl
总用量 124M
11504 0 -rw-r--r--. 1 dn root 0 5月 17 17:14 456
11498 24M -rw-r--r--. 1 root root 24M 5月 17 16:51 test2.txt
11497 100M -rw-r--r--. 1 root root 100M 5月 17 16:15 test.txt
-perm:按照文件权限进行查找。-perm 根据权限(r,w,x对应的数字)进行查找
**-name:**重点
[root@localhost a]# find /opt/ -name 456
/opt/a/456
/opt/456
**-size:**重点
[root@localhost a]# find /opt/ -size +24M
/opt/a/test.txt
[root@localhost a]# find /opt/ -size +23M
/opt/a/test.txt
/opt/a/test2.txt
**-type:**重点f-文件,d-目录,l-链接文件,b-块文件
[root@localhost a]# find /opt/ -type f
/opt/a/test.txt
/opt/a/test2.txt
/opt/a/456
/opt/123
/opt/456
/opt/123.txt
[root@localhost a]# find /opt/ -type d
/opt/
/opt/a
/opt/b
/opt/c
/opt/d
[root@localhost a]# find /opt/ -type l
/opt/b/26
处理动作:-delete 删除,查询的结果直接删除,慎用
-ls 把查询结果,展示详细信息。
[root@localhost opt]# find /opt/ -type f -ls
11497 102400 -rw-r--r-- 1 root root 104857600 5月 17 16:15 /opt/a/test.txt
11498 24576 -rw-r--r-- 1 root root 25165824 5月 17 16:51 /opt/a/test2.txt
11504 0 -rw-r--r-- 1 dn root 0 5月 17 17:14 /opt/a/456
33624945 0 -rw-r--r-- 1 root root 0 5月 17 16:34 /opt/123
33624946 0 -rw-r--r-- 1 root root 0 5月 17 16:34 /opt/456
33624947 0 -rw-r--r-- 1 root root 0 5月 17 16:34 /opt/123.txt
-fls+指定文件名:查找到的信息以长格式的形式保存到指定的文件。
[root@localhost opt]# find /opt/ -name 456 -fls 456.456
[root@localhost opt]# find /opt/ -name 456.456
/opt/456.456
[root@localhost opt]# cd 456.456
bash: cd: 456.456: 不是目录
[root@localhost opt]# ll
总用量 4
-rw-r--r--. 1 root root 0 5月 17 16:34 123
-rw-r--r--. 1 root root 0 5月 17 16:34 123.txt
-rw-r--r--. 1 root root 0 5月 17 16:34 456
-rw-r--r--. 1 root root 158 5月 17 18:04 456.456
drwxr-xr-x. 2 root root 50 5月 17 17:43 a
drwxr-xr-x. 2 root root 16 5月 17 17:05 b
drwxr-xr-x. 2 root root 6 5月 17 15:34 c
drwxr-xr-x. 2 root root 6 5月 17 15:34 d
[root@localhost opt]# find /opt/ -name 456 -fls /opt/a/456.456
[root@localhost opt]# find /opt/ -name 456.456
/opt/a/456.456
/opt/456.456
三、系统命令
-ok:系统命令{};作为结尾
[root@localhost opt]# find -size +24M -ok mv {} c \;
< mv ... ./b/test.txt > ? yes
< mv ... ./c/test.txt > ? no
< mv ... ./test3/test.txt > ? no
[root@localhost opt]# cd b
[root@localhost b]# ll
总用量 0
-rw-r--r--. 1 root root 0 5月 17 18:16 11
-rw-r--r--. 1 root root 0 5月 17 18:16 22
-rw-r--r--. 1 root root 0 5月 17 18:16 33
[root@localhost b]# cd ..
[root@localhost opt]# cd c
[root@localhost c]# ll
总用量 51200
lrwxrwxrwx. 1 root root 8 5月 17 17:05 26 -> /opt/a/1
-rw-r--r--. 1 root root 52428800 5月 17 18:17 test.txt
[root@localhost c]# find /opt/ -size +23M -ok mv {} /opt/b/ \;
< mv ... /opt/c/b > ? y
[root@localhost c]# ll
总用量 0
lrwxrwxrwx. 1 root root 8 5月 17 17:05 26 -> /opt/a/1
[root@localhost c]# cd ..
[root@localhost opt]# cd
[root@localhost ~]# cd b
bash: cd: b: 没有那个文件或目录
[root@localhost ~]# cd /opt/
[root@localhost opt]# cd b
[root@localhost b]# ll
总用量 24576
-rw-r--r--. 1 root root 0 5月 17 18:16 11
-rw-r--r--. 1 root root 0 5月 17 18:16 22
-rw-r--r--. 1 root root 0 5月 17 18:16 33
-rw-r--r--. 1 root root 25165824 5月 17 16:51 b
-exec:系统命令{}\;作为结尾
[root@localhost c]# find /opt/ -size +23M -exec mv {} /opt/d/ \;
mv: "/opt/d/b" 与"/opt/d/b" 为同一文件 //虽为同一文件但是已完成剪切。
[root@localhost c]# ll
总用量 0
lrwxrwxrwx. 1 root root 8 5月 17 17:05 26 -> /opt/a/1
[root@localhost c]# cd ..
[root@localhost opt]# cd d
[root@localhost d]# ll
总用量 24576
-rw-r--r--. 1 root root 25165824 5月 17 16:51 b
[root@localhost d]# find /opt/ -size +23M -exec mv {} /opt/c/ \;
[root@localhost d]# cd ..
[root@localhost opt]# cd c
[root@localhost c]# ll
总用量 24576
lrwxrwxrwx. 1 root root 8 5月 17 17:05 26 -> /opt/a/1
-rw-r--r--. 1 root root 25165824 5月 17 16:51 b
[root@localhost c]#
#查找30天以内,修改过的文件,文件的大小超过10G的文件,直接把他删除。
-mtime 最后修改时间
-ctime 改变时间,改变了权限和所有者和所在组 inode
-atime 访问时间
find /opt -mtime -30 -size +10G -type f -exec rm -rf {} ;
-mtime :最后修改时间
-ctime:改变时间改变了权限和所有者和所在组的inode
-atime:访问时间
find/opt -mtime -30 -size +10G-type f -exec rm -rf {} ;
-mtime -30 30以内
-mtime +30 31以上
-mtime 30 30-31
[root@localhost c]# find /opt/ -mtime -30 -size +23M -type f -exec rm -rf {} \;
[root@localhost c]# cd ..
[root@localhost opt]# ll
总用量 4
-rw-r--r--. 1 root root 0 5月 17 16:34 123
-rw-r--r--. 1 root root 0 5月 17 16:34 123.txt
-rw-r--r--. 1 root root 0 5月 17 16:34 456
-rw-r--r--. 1 root root 158 5月 17 18:04 456.456
drwxr-xr-x. 2 root root 36 5月 17 18:27 b
drwxr-xr-x. 2 root root 16 5月 17 18:35 c
drwxr-xr-x. 2 root root 6 5月 17 18:29 d
drwxr-xr-x. 2 root root 32 5月 17 18:23 test3
[root@localhost opt]# cd c
[root@localhost c]# ll
总用量 0
lrwxrwxrwx. 1 root root 8 5月 17 17:05 26 -> /opt/a/1
find 条件中的逻辑关系;
-o or 或者 满足一个即可;
-a and 且 所有的条件都要满足;
[root@localhost lc102]# touch 123 456
[root@localhost lc102]# ll
总用量 0
-rw-r--r--. 1 root root 0 5月 18 23:15 123
-rw-r--r--. 1 root root 0 5月 18 23:15 456
[root@localhost lc102]# chown dn.dn 456
[root@localhost lc102]# ll
总用量 0
-rw-r--r--. 1 root root 0 5月 18 23:15 123
-rw-r--r--. 1 dn dn 0 5月 18 23:15 456
[root@localhost lc102]# cd ..
[root@localhost opt]# find /opt/lc102/ -user dn -o -user root -type f -exec cp -r {} /opt/lc103/ \;
cp: 无法创建普通文件"/opt/lc103/": 不是目录
[root@localhost opt]# find /opt/lc102/ -user dn -o -user root -type f -exec cp -r {} /opt/lc103 \;
[root@localhost opt]# cd lc103
bash: cd: lc103: 不是目录
[root@localhost opt]# mkdir lc103
mkdir: 无法创建目录"lc103": 文件已存在
[root@localhost opt]# rm -rf lc103
[root@localhost opt]# mkdir lc103
[root@localhost opt]# find /opt/lc102/ -user dn -o -user root -type f -exec cp -r {} /opt/lc103/ \;
[root@localhost opt]# cd lc103
[root@localhost lc103]# ll
总用量 0
-rw-r--r--. 1 root root 0 5月 18 23:17 123
[root@localhost lc103]# find /opt/lc102/ -user dn -o -user root -type f
/opt/lc102/123
/opt/lc102/456
[root@localhost lc103]# find /opt/lc102/ \( -user dn -o -user root \ ) -type f -exec cp -r {} /opt/lc103/ \;
bash: 未预期的符号 `)' 附近有语法错误
[root@localhost lc103]# find /opt/lc102/ \( -user dn -o -user root \) -type f -exec cp -r {} /opt/lc103/ \;
[root@localhost lc103]# ll
总用量 0
-rw-r--r--. 1 root root 0 5月 18 23:28 123
-rw-r--r--. 1 root root 0 5月 18 23:28 456
[root@localhost opt]# find /opt/lc102/ -name xy102.txt -size 10M -type f -ls
[root@localhost opt]# find /opt/ -name xy102.txt -size 10M -type f -ls
33624962 10240 -rw-r--r-- 1 root root 10485760 5月 18 23:30 /opt/xy102.txt
find查看文件或者目录:
whereis:只能搜索系统命令的所在位置,不能查找系统文件和目录。
which也是只能搜索系统命令所在的位置,也不能查找系统文件和目录。区别于whereis,如果该命令有别名,他会把改命令的别名一起展示。不会显示帮助文档所在位置。
root@localhost opt]# which is 123
/usr/bin/which: no is in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
/usr/bin/which: no 123 in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
[root@localhost opt]# which is 456
/usr/bin/which: no is in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
/usr/bin/which: no 456 in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
[root@localhost opt]# whereis 123
123: /etc/123
[root@localhost lc103]# find /opt/lc102/ -user dn -o -user root -a -type f -exec cp -a {} /opt/lc103 \;
[root@localhost lc103]# ll
总用量 0
-rw-r--r--. 1 root root 0 5月 19 15:15 123
[root@localhost lc103]# find /opt/lc102/ \( -user dn -o -user root \) -a -type f -exec cp -a {} /opt/lc103 \;
[root@localhost lc103]# ll
总用量 0
-rw-r--r--. 1 root root 0 5月 19 15:15 123
-rw-r--r--. 1 dn dn 0 5月 19 15:15 456
[root@localhost lc103]#
查看cpu信息:
lscpu:查看
cat /proc/cpuinfo:查看cpu
查看内存:
free -h
清楚缓存
[root@localhost opt]# free -h
total used free shared buff/cache available
Mem: 3.7G 1.0G 843M 955M 1.9G 1.4G
Swap: 3.9G 8.3M 3.9G
[root@localhost opt]# echo 1 > /proc/sys/vm/drop_caches
[root@localhost opt]# free -h
total used free shared buff/cache available
Mem: 3.7G 1.0G 1.2G 955M 1.5G 1.4G
Swap: 3.9G 8.3M 3.9G
[root@localhost opt]#
查看硬盘分区:lsblk
查看机器架构:arch
查看内核版本:uname -r(重点)每个人都要会看
系统时间:
date
date +%T:24小时格式
date +%F:显示日期
date -d ‘-1 day’ +%f:显示前一天日期。
[root@localhost opt]# date -d '-1 day' +%F
2024-05-17
[root@localhost opt]# date +%T
23:51:55
[root@localhost opt]# date +%F
2024-05-18
3.7G 1.0G 1.2G 955M 1.5G 1.4G
Swap: 3.9G 8.3M 3.9G
[root@localhost opt]#
查看硬盘分区:lsblk
查看机器架构:arch
查看内核版本:uname -r(重点)每个人都要会看
系统时间:
date
date +%T:24小时格式
date +%F:显示日期
date -d ‘-1 day’ +%f:显示前一天日期。
[root@localhost opt]# date -d '-1 day' +%F
2024-05-17
[root@localhost opt]# date +%T
23:51:55
[root@localhost opt]# date +%F
2024-05-18
[root@localhost opt]#