单纯提供一个相对的解答,并不是标准答案!
单纯就是个解答的参考,写完之后再来这边查查看答案跟你想的一样不一样!?
[student@station10-101 ~]$ date --help Usage: date [OPTION]... [+FORMAT] or: date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]] Display the current time in the given FORMAT, or set the system date. ...... FORMAT controls the output. Interpreted sequences are: ...... %H hour (00..23) <==应该是指 24 小时制 %I hour (01..12) <==应该是指 12 小时制 %j day of year (001..366) %k hour, space padded ( 0..23); same as %_H %l hour, space padded ( 1..12); same as %_I ...... %M minute (00..59) <==分钟的设置 ...... %s seconds since 1970-01-01 00:00:00 UTC %S second (00..60) ...... [student@station10-101 ~]$ date +%H:%M 21:52要注意的是,我们要输出的信息有『小时』与『分钟』,所以需要 %H 与 %M,但是两者中间还有冒号,因此,就得要在两者间加上冒号链接。 否则会出错。
[student@station10-101 ~]$ date +%s 1676795948 [student@station10-101 ~]$ date +%s 1676795966 <==间隔数秒重复运行,会有不同的秒数累积,会持续长大这个数值!
[student@station10-101 ~]$ date 二 3月 3 21:59:17 CST 2020 <==先显示今天 [student@station10-101 ~]$ date -d "2 days ago" +%Y/%m/%d 2020/03/01 <==果然是两天前! [student@station10-101 ~]$ date --date="2 days ago" +%Y/%m/%d 2020/03/01使用最后一个长选项的指令 (--date="xxx") 也是可以的!
[student@station10-101 ~]$ date +%H %M
date: 出现多余的参数 ‘%M’
Try 'date --help' for more information.
所以,我们得要将『西元年-日-月 小时:分钟』中间的空格去除。如何去除?其实是『让空白字符变一般字符』即可,可以这样:
『西元年-日-月' '小时:分钟』,用单引号将两边黏在一起。因为『 '空白' 』也是『一串字符』,因此就可以将两者连一起。
[student@station10-101 ~]$ date +%Y-%d-%m' '%H:%M 2023-19-02 16:40 [student@station10-101 ~]$ date +"%Y-%d-%m %H:%M"上面两种作法都可以!空白键也是个特殊字符,所以需要以纯文本呈现时,就得要通过各种方法,将空白变成文本!
[student@station10-101 ~]$ cal --help Usage: cal [options] [[[day] month] year] cal [options] <timestamp|monthname> Display a calendar, or some part of it. Without any arguments, display the current month. ......意思是说,显示月历 (calendar),若不加参数,则会显示目前这个月的月历。
[student@station10-101 ~]$ cal February 2023 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28你会发现到,目前的日期还会反白!
[student@station10-101 ~]$ cal 2023 2023 January February March Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 1 2 3 4 1 2 3 4 8 9 10 11 12 13 14 5 6 7 8 9 10 11 5 6 7 8 9 10 11 15 16 17 18 19 20 21 12 13 14 15 16 17 18 12 13 14 15 16 17 18 22 23 24 25 26 27 28 19 20 21 22 23 24 25 19 20 21 22 23 24 25 29 30 31 26 27 28 26 27 28 29 30 31 ... October November December Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 1 2 3 4 1 2 8 9 10 11 12 13 14 5 6 7 8 9 10 11 3 4 5 6 7 8 9 15 16 17 18 19 20 21 12 13 14 15 16 17 18 10 11 12 13 14 15 16 22 23 24 25 26 27 28 19 20 21 22 23 24 25 17 18 19 20 21 22 23 29 30 31 26 27 28 29 30 24 25 26 27 28 29 30
[student@station10-101 ~]$ cal --help ...... 选项: -1, --one show only a single month (default) -3, --three show three months spanning the date ...... [student@station10-101 ~]$ cal -3 January 2023 February 2023 March 2023 Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 1 2 3 4 1 2 3 4 8 9 10 11 12 13 14 5 6 7 8 9 10 11 5 6 7 8 9 10 11 15 16 17 18 19 20 21 12 13 14 15 16 17 18 12 13 14 15 16 17 18 22 23 24 25 26 27 28 19 20 21 22 23 24 25 19 20 21 22 23 24 25 29 30 31 26 27 28 26 27 28 29 30 31这样就能显示出前/目前/后一个月的月历了!
# 底下指令中的 [tab] 代表键盘左侧的 Tab 按钮,光标请连着 f 不要有空白键,按下两次 [student@station10-101 ~]$ if[tab][tab] if ifconfig ifenslave ifstat [student@station10-101 ~]$ if # 如上,过程中都没有按下 [enter],屏幕会输出很多以 if 为开头的『指令名称』 [student@station10-101 ~]$ ls[tab][tab] iscsiadm iscsi-iname iscsiuio iso-info isosize iscsid iscsistart isdv4-serial-inputattach iso-read [student@station10-101 ~]$ ls
[student@station10-101 ~]$ ifco[tab] [student@station10-101 ~]$ ifconfig上面的动作都没有按下 [enter] 按键,第一行按下 [tab] 之后,会立刻变成第二行的型态!这就是命令补齐
[student@station10-101 ~]$ find / ......(很乱很乱,一直输出文件名) /proc/2434/net/^C [student@station10-101 ~]$ ^C # [ctrl]+c 的代表符号就是『^C』,我按了两次,所以有一次就会出现在指令列上面!
[student@station10-101 ~]$ ls ' / > /home > /var > ^C <==最后按下 [ctrl]+c 就中断这次的输入!
[student@station10-101 ~]$ ll -d /etc/se[tab][tab] security/ selinux/ services sestatus.conf setroubleshoot/ # 你会发现到, /etc 底下以 se 开头的有上述几个文件名。 # 现在假设我需要 security 这个文件名,所以多加一个 c 再 [tab] [student@station10-101 ~]$ ll -d /etc/sec[tab] <==多加一个 c 再 [tab],就会补齐成底下这样 [student@station10-101 ~]$ ll -d /etc/security/ drwxr-xr-x. 7 root root 4096 2月 16 11:44 /etc/security/
[student@station10-101 ~]$ echo ${H[tab][tab]
${HISTCMD} ${HISTCONTROL} ${HISTFILE} ${HISTFILESIZE}
${HISTSIZE} ${HOME} ${HOSTNAME} ${HOSTTYPE}
上述过程中都没有按下 [enter] 喔!所以 H 开头的变量有上面这 8 个呢!再也不会打错字了![student@station10-101 ~]$ bc bc 1.07.1 Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006, 2008, 2012-2017 Free Software Foundation, Inc. This is free software with ABSOLUTELY NO WARRANTY. For details type `warranty'. 1/3 0 scale=4 1/3 .3333 quite这样就取得了 4 位数小数点的输出了。
[student@station10-101 ~]$ man bc EXAMPLES In /bin/sh, the following will assign the value of "pi" to the shell variable pi. pi=$(echo "scale=10; 4*a(1)" | bc -l) The following is the definition of the exponential function used in the math library. This function is written in POSIX bc. scale = 20 ...... /pi= <==直接按下斜线 / 之后,光标就会主动跑到最左下角了!你可以找到上面这行奇怪的东西,其中那个 scale 缺省使用了 10 位数,我们需要的是 50 位数,所以运行方法改成这样:
[student@station10-101 ~]$ echo "scale=50; 4*a(1)" | bc -l
3.14159265358979323846264338327950288419716939937508
[student@station10-101 ~]$
上面就可以算出圆周率 pi 啰!因为我们要直接运算,不需要设置变量,所以直接处理成上面这样啰![student@station10-101 ~]$ man bc ...... expr % expr The result of the expression is the "remainder" and it is computed in the following way. To compute a%b, first a/b is computed to scale digits. That result is used to compute a-(a/b)*b to the scale of the maximum of scale+scale(b) and scale(a). If scale is set to zero and both expres‐ sions are integers this expression is the integer remainder function. expr ^ expr The result of the expression is the value of the first raised to the sec‐ ond. The second expression must be an integer. (If the second expression ...... /remainder <==输入 / 找寻,找到之后按下方向键↑几次,就会发现如上模样我们可以发现到,要算余数,就用百分比,也就是题目中的,用 1000 % 17 来算!
[student@station10-101 ~]$ bc bc 1.07.1 Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006, 2008, 2012-2017 Free Software Foundation, Inc. This is free software with ABSOLUTELY NO WARRANTY. For details type `warranty'. 1000 / 17 58 1000 % 17 14 58*17+14 1000 quit得到商数为 58,得到余数为 14,亦即答案应该是:『 1000 = 58*17 + 14 』啰!
[student@station10-101 ~]$ man date ...... EXAMPLES Convert seconds since the epoch (1970-01-01 UTC) to a date $ date --date='@2147483647' ...... /examples意思是,由 +%s 得到的总秒数,将他转回日期的方法!例如底下的实验:
# 先找出目前的总秒数 [student@station10-101 ~]$ date +%s 1676812193 # 将上述总秒数改换成为人类的日期,就是这样: [student@station10-101 ~]$ date --date="@1676812193" 西元2023年02月19日 (周日) 21时09分53秒 CST这两者之间的切换这样!这在许多脚本要确认日期时,是很有帮助的功能!
[student@station10-101 ~]$ ll /etc
......
drwxr-xr-x. 3 root root 36 2月 16 11:44 xml
drwxr-xr-x. 2 root root 57 2月 16 11:46 yum
lrwxrwxrwx. 1 root root 12 11月 15 17:28 yum.conf -> dnf/dnf.conf
drwxr-xr-x. 2 root root 98 10月 20 23:51 yum.repos.d
实在很多数据,得用 [shift]+[pageup] 去查阅。现在通过 more 来翻动看看:
[student@station10-101 ~]$ ll /etc | more 总用量 1308 drwxr-xr-x. 3 root root 28 2月 16 11:44 accountsservice -rw-r--r--. 1 root root 44 2月 19 16:50 adjtime -rw-r--r--. 1 root root 1529 6月 23 2020 aliases drwxr-xr-x. 3 root root 65 2月 16 11:46 alsa drwxr-xr-x. 2 root root 4096 2月 16 11:46 alternatives -rw-r--r--. 1 root root 541 11月 1 03:55 anacrontab -rw-r--r--. 1 root root 769 8月 29 2021 appstream.conf -rw-r--r--. 1 root root 55 11月 1 03:44 asound.conf -rw-r--r--. 1 root root 1 10月 26 10:53 at.deny drwxr-x---. 4 root root 100 2月 16 11:45 audit ... --更多-- # 此时,你可以按下 [enter] 或空白按键,或者是 q 离开,也能按下 / 搜索关键字!more 的功能是一页一页翻动,由于不是文件,因此你无法使用方向键向上查找,只能持续往下找寻数据而已。 最终数据显示完毕后,more 也就运行结束。那如果使用 less 呢?
[student@station10-101 ~]$ ll /etc | less 总用量 1308 drwxr-xr-x. 3 root root 28 2月 16 11:44 accountsservice -rw-r--r--. 1 root root 44 2月 19 16:50 adjtime -rw-r--r--. 1 root root 1529 6月 23 2020 aliases drwxr-xr-x. 3 root root 65 2月 16 11:46 alsa drwxr-xr-x. 2 root root 4096 2月 16 11:46 alternatives -rw-r--r--. 1 root root 541 11月 1 03:55 anacrontab -rw-r--r--. 1 root root 769 8月 29 2021 appstream.conf -rw-r--r--. 1 root root 55 11月 1 03:44 asound.conf -rw-r--r--. 1 root root 1 10月 26 10:53 at.deny drwxr-x---. 4 root root 100 2月 16 11:45 audit .... : <==光标停在这里,几乎与 man page 相同!事实上, man page 的环境,就是调用 less 来达成的!所以,你也可以在 less 底下使用 man page 相同的指令来翻动与查找关键字!
[student@station10-101 ~]$ ll /etc | less -rw-r--r--. 1 root root 2433 2月 26 09:10 passwd -rw-r--r--. 1 root root 2381 2月 26 09:06 passwd- -rw-r--r--. 1 root root 1362 5月 14 2019 pbm2ppa.conf -rw-r--r--. 1 root root 2872 5月 14 2019 pinforc drwxr-xr-x. 2 root root 27 2月 26 09:05 pipewire drwxr-xr-x. 3 root root 21 2月 26 09:02 pkcs11 drwxr-xr-x. 10 root root 123 2月 26 09:06 pki drwxr-xr-x. 2 root root 28 2月 26 09:05 plymouth ...... /passwd
[student@station10-101 ~]$ find /etc | less find: /etc/lvm/profile /etc/lvm/profile/cache-mq.profile /etc/lvm/profile/cache-smq.profile /etc/lvm/profile/command_profile_template.profile ..... :find: ‘/etc/pki/rsyslog’: 拒绝不符权限的操作 find: ‘/etc/sssd’: 拒绝不符权限的操作 find: ‘/etc/sos/cleaner’: 拒绝不符权限的操作 find: ‘/etc/grub.d’: 拒绝不符权限的操作 find: ‘/etc/polkit-1/rules.d’: 拒绝不符权限的操作 find: ‘/etc/polkit-1/localauthority’: 拒绝不符权限的操作 .... :
[student@station10-101 ~]$ echo "365*24*60*60" | bc
31536000
一年共有 31,536,000 秒喔![student@station10-101 ~]$ ifconfig ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.16.2.253 netmask 255.255.0.0 broadcast 172.16.255.255 inet6 fe80::5054:ff:feba:bfc prefixlen 64 scopeid 0x20 ether 52:54:00:ba:0b:fc txqueuelen 1000 (Ethernet) RX packets 24210 bytes 14169623 (13.5 MiB) RX errors 0 dropped 8729 overruns 0 frame 0 TX packets 14688 bytes 1974174 (1.8 MiB) 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 0x10loop txqueuelen 1000 (Local Loopback) RX packets 18 bytes 2112 (2.0 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 18 bytes 2112 (2.0 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[student@station10-101 ~]$ ifconfig | grep 'inet ' inet 172.16.2.253 netmask 255.255.0.0 broadcast 172.16.255.255 inet 127.0.0.1 netmask 255.0.0.0这样就仅列出 IP 而已!画面清爽非常多!
[student@station10-101 ~]$ ll / 总用量 24 dr-xr-xr-x. 2 root root 6 5月 16 2022 afs lrwxrwxrwx. 1 root root 7 5月 16 2022 bin -> usr/bin dr-xr-xr-x. 6 root root 4096 2月 17 10:30 boot ......最左侧的第一个字符,就是这个文件名的类型,基本上有三种类型一定要先知道:
[student@station10-101 ~]$ ll -d /sys /proc dr-xr-xr-x. 251 root root 0 2月 20 2023 /proc dr-xr-xr-x. 13 root root 0 2月 20 2023 /sys容量竟然是 0 !这是因为这两个目录是从内存里面挂载出来的,所以没有用到实体硬盘容量,而是占用了内存容量喔! 因此硬盘使用量就是 0。
[student@station10-101 ~]$ ll -h /boot/vmlinuz* -rwxr-xr-x. 1 root root 12M 2月 16 11:48 /boot/vmlinuz-0-rescue-d587a2c04fbb458e8015aef30df28fec -rwxr-xr-x. 1 root root 12M 11月 18 10:18 /boot/vmlinuz-5.14.0-162.6.1.el9_1.x86_64ll 加上 -h 可以直接用人类易读的单位来处理,所以可以看到 vmlinuz-5.xxx 为 12M,这就是操作系统内核文件,容量相当小! 这个文件就可以驱动整个 x86 的硬件设备喔!
[student@station10-101 ~]$ man ls LS(1) User Commands LS(1) NAME ls - list directory contents ...... [student@station10-101 ~]$ man ifconfig IFCONFIG(8) Linux System Administrator's Manual IFCONFIG(8) NAME ifconfig - configure a network interface ......一个是 ls(1),一个是 ifconfig(8),所以,我们猜文件名应该就是 /usr/bin/ls 以及 /usr/sbin/ifconfig,来检查看看:
[student@station10-101 ~]$ ll /usr/bin/ls /usr/sbin/ifconfig
-rwxr-xr-x. 1 root root 142168 10月 31 10:42 /usr/bin/ls
-rwxr-xr-x. 1 root root 81384 5月 16 2022 /usr/sbin/ifconfig
[student@station10-101 ~]$ df 文件系统 1K-区块 已用 可用 已用% 挂载点 devtmpfs 4096 0 4096 0% /dev tmpfs 906728 0 906728 0% /dev/shm tmpfs 362692 10144 352548 3% /run /dev/mapper/rocky-root 10475520 4585348 5890172 44% / /dev/mapper/rocky-home 3135488 71632 3063856 3% /home /dev/vda2 1992552 250700 1620612 14% /boot tmpfs 181344 100 181244 1% /run/user/1000 [student@station10-101 ~]$ ll /dev/shm 总计 0
[student@station10-101 ~]$ cd /var/spool/mail [student@station10-101 mail]$ pwd /var/spool/mail # 工作目录确实是切换到我们需要的目录了!
[student@station10-101 mail]$ ll /var/spool/ 总用量 0 drwxr-xr-x. 2 root root 63 2月 16 11:44 anacron drwx------. 3 root root 31 2月 16 11:46 at drwx------. 2 root root 6 11月 1 03:55 cron drwx--x---. 3 root lp 17 2月 16 11:45 cups drwxr-xr-x. 2 root root 6 5月 16 2022 lpd drwxrwxr-x. 2 root mail 21 2月 16 11:51 mail drwxr-xr-x. 2 root root 6 5月 26 2022 plymouth [student@station10-101 mail]$ ll .. 总用量 0 drwxr-xr-x. 2 root root 63 2月 16 11:44 anacron drwx------. 3 root root 31 2月 16 11:46 at drwx------. 2 root root 6 11月 1 03:55 cron drwx--x---. 3 root lp 17 2月 16 11:45 cups drwxr-xr-x. 2 root root 6 5月 16 2022 lpd drwxrwxr-x. 2 root mail 21 2月 16 11:51 mail drwxr-xr-x. 2 root root 6 5月 26 2022 plymouth # 输出的结果会是一模一样的! [student@station10-101 mail]$ ll -d ../ana[tab] [student@station10-101 mail]$ ll -d ../anacron/ drwxr-xr-x. 2 root root 63 2月 26 09:04 ../anacron/ # 当然使用相对路径要打字的情况会减少,同时再以 [tab] 去补齐文件名的结果!!
[student@station10-101 mail]$ cd ../anacron/ [student@station10-101 anacron]$ pwd /var/spool/anacron
[student@station10-101 anacron]$ ll /var/log | head -n 5 总用量 3852 drwxr-xr-x. 2 root root 4096 2月 16 11:51 anaconda drwx------. 2 root root 23 2月 17 10:30 audit -rw-------. 1 root root 2484 2月 20 2023 boot.log -rw-------. 1 root root 85955 2月 20 2023 boot.log-20230220 [student@station10-101 anacron]$ ll ../../log | head -n 5 总用量 3852 drwxr-xr-x. 2 root root 4096 2月 16 11:51 anaconda drwx------. 2 root root 23 2月 17 10:30 audit -rw-------. 1 root root 2484 2月 20 2023 boot.log -rw-------. 1 root root 85955 2月 20 2023 boot.log-20230220 # 这个案例中,从根目录写起的绝对路径文件名,又比相对路径文件名来的简单好写!
[student@station10-101 anacron]$ cd [student@station10-101 ~]$ pwd /home/student [student@station10-101 ~]$ cd ~
# 使用缺省的方式来运行正规指令: [student@station10-101 ~]$ ifconfig ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.16.10.101 netmask 255.255.0.0 broadcast 172.16.255.255 ...... # 使用绝对路径的方式来运行指令: [student@station10-101 ~]$ /usr/sbin/ifconfig ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.16.10.101 netmask 255.255.0.0 broadcast 172.16.255.255 # 由于我们在 /home/student 底下,所以,直接使用相对路径就成为: [student@station10-101 ~]$ ../../usr/sbin/ifconfig ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.16.10.101 netmask 255.255.0.0 broadcast 172.16.255.255 # 切换工作目录到 /usr/sbin 底下去,就变这样: [student@station10-101 ~]$ cd /usr/sbin [student@station10-101 sbin]$ pwd /usr/sbin [student@station10-101 sbin]$ ./ifconfig最后一个工作目录底下运行该指令的方法,未来在你出外工作后,会是很常看到的运行非正规指令的方法喔!
[student@station10-101 backup]$ ll /dev/shm/backup/etc/passwd*
-rw-r--r--. 1 student student 2098 2月 19 22:18 /dev/shm/backup/etc/passwd
-rw-r--r--. 1 student student 2046 2月 19 22:18 /dev/shm/backup/etc/passwd-
确实有存在两个 passwd 为开头的文件名![student@station10-101 backup]$ rm --help 用法:rm [选项]... [文件]... Remove (unlink) the FILE(s). [student@station10-101 backup]$ rm /dev/shm/backup/etc/passwd* # 有点可怕的是,一般身份用户删除文件时,系统不会提醒你!直接就删除了! [student@station10-101 backup]$ ll /dev/shm/backup/etc/passwd* ls: 无法访问 '/dev/shm/backup/etc/passwd*': 没有此一文件或目录
[student@station10-101 backup]$ ll -d /dev/shm/backup/etc/X11 drwxr-xr-x. 7 student student 180 2月 19 22:17 /dev/shm/backup/etc/X11/ # 最左边是 d ,所以是个目录文件
[student@station10-101 backup]$ rm /dev/shm/backup/etc/X11 rm: 无法删除 '/dev/shm/backup/etc/X11': 是个目录 [student@station10-101 backup]$ man rm ...... -r, -R, --recursive remove directories and their contents recursively ...... [student@station10-101 backup]$ rm -r /dev/shm/backup/etc/X11 [student@station10-101 backup]$ ll -d /dev/shm/backup/etc/X11 ls: 无法访问 '/dev/shm/backup/etc/X11': 没有此一文件或目录
[student@station10-101 backup]$ man rm
-i prompt before every removal
-I prompt once before removing more than three files, or when removing
recursively; less intrusive than -i, while still giving protection
against most mistakes
--interactive[=WHEN]
prompt according to WHEN: never, once (-I), or always (-i); without WHEN,
prompt always
由上面可以知道:
[student@station10-101 backup]$ rm -ri /dev/shm/backup/etc/xdg/ rm: descend into directory '/dev/shm/backup/etc/xdg/'? y rm: descend into directory '/dev/shm/backup/etc/xdg/menus'? y rm:是否移除普通文件'/dev/shm/backup/etc/xdg/menus/gnome-applications.menu'? y ^C <==每次都要回答 y,很烦~所以直接 [ctrl]+c 中断 [student@station10-101 backup]$ rm -rI /dev/shm/backup/etc/xdg/ rm: remove 1 argument recursively? y # 只问第一次,确定就全部都删除了!
[student@station10-101 ~]$ locale LANG=zh_TW.utf8 <==是这一个 LC_CTYPE="zh_TW.utf8" LC_NUMERIC="zh_TW.utf8" LC_TIME="zh_TW.utf8" LC_COLLATE="zh_TW.utf8" LC_MONETARY="zh_TW.utf8" LC_MESSAGES="zh_TW.utf8" LC_PAPER="zh_TW.utf8" LC_NAME="zh_TW.utf8" LC_ADDRESS="zh_TW.utf8" LC_TELEPHONE="zh_TW.utf8" LC_MEASUREMENT="zh_TW.utf8" LC_IDENTIFICATION="zh_TW.utf8" LC_ALL= [student@station10-101 ~]$ LANG=C [student@station10-101 ~]$ locale LANG=C <==变成这个 LC_CTYPE="C" LC_NUMERIC="C" LC_TIME="C" ......
[student@station10-101 ~]$ date -d "2022/11/26 00:00 GMT" +%s
1669420800
[student@station10-101 ~]$ echo "1669420800/(24*60*60)+1" | bc
19323
[student@station10-101 ~]$ echo "(19295-1)*24*60*60" | bc 1667001600 [student@station10-101 ~]$ date -d "@1667001600" Sat Oct 29 08:00:00 CST 2022
[student@station10-101 ~]$ cal 10 10 2023 October 2023 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
[student@station10-101 ~]$ echo ${HIST[tab][tab] ${HISTCMD} ${HISTCONTROL} ${HISTFILESIZE} ${HISTFILE} ${HISTSIZE} [student@station10-101 ~]$ echo ${HISTSIZE} 1000所以得到可以记忆 1000 笔纪录的设置值
# 变换工作目录 [student@station10-101 ~]$ cd /dev/shm [student@station10-101 shm]$ pwd /dev/shm # 创建目录 [student@station10-101 shm]$ mkdir check [student@station10-101 shm]$ ll total 0 drwxr-xr-x. 3 student student 60 Feb 19 22:17 backup drwxr-xr-x. 2 student student 40 Feb 19 22:33 check # 切换工作目录 [student@station10-101 shm]$ cd check # 拷贝目录的方法 [student@station10-101 check]$ cp /etc/X11 . cp: -r not specified; omitting directory '/etc/X11' [student@station10-101 check]$ cp -r /etc/X11 . [student@station10-101 check]$ ll total 0 drwxr-xr-x. 7 student student 180 Feb 19 22:34 X11 # 删除目录的方法 [student@station10-101 check]$ ll -d ./X11/xinit drwxr-xr-x. 5 student student 200 Feb 19 22:34 ./X11/xinit/ [student@station10-101 check]$ rm ./X11/xinit rm: cannot remove './X11/xinit': Is a directory [student@station10-101 check]$ rm -r ./X11/xinit # 配合管线,抓到关键字文件名,然后进一步拷贝 [student@station10-101 check]$ find /etc 2> /dev/null | grep group /etc/sos/groups.d /etc/group /etc/group- /etc/iproute2/group /etc/security/group.conf [student@station10-101 check]$ cp /etc/sos/groups.d /etc/group /etc/group- /etc/iproute2/group /etc/security/group.conf . cp: -r not specified; omitting directory '/etc/sos/groups.d' cp: will not overwrite just-created './group' with '/etc/iproute2/group' [student@station10-101 check]$ ll total 12 drwxr-xr-x. 6 student student 160 Feb 19 22:35 X11 -rw-r--r--. 1 student student 814 Feb 19 22:37 group -rw-r--r--. 1 student student 798 Feb 19 22:37 group- -rw-r--r--. 1 student student 3635 Feb 19 22:37 group.conf [student@station2-253 check]$ [student@station10-101 check]$ ll -R # 这样才能够看到 X11 底下的子目录!