单纯提供一个相对的解答,并不是标准答案!
单纯就是个解答的参考,写完之后再来这边查查看答案跟你想的一样不一样!?
[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 1583243769 [student@station10-101 ~]$ date +%s 1583243786 <==间隔数秒重复运行,会有不同的秒数累积,会持续长大这个数值!
[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
2020-03-03 22:04
[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 三月 2020 日 一 二 三 四 五 六 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 ~]$ cal 2020 2020 一月 二月 三月 日 一 二 三 四 五 六 日 一 二 三 四 五 六 日 一 二 三 四 五 六 1 2 3 4 1 1 2 3 4 5 6 7 5 6 7 8 9 10 11 2 3 4 5 6 7 8 8 9 10 11 12 13 14 12 13 14 15 16 17 18 9 10 11 12 13 14 15 15 16 17 18 19 20 21 19 20 21 22 23 24 25 16 17 18 19 20 21 22 22 23 24 25 26 27 28 26 27 28 29 30 31 23 24 25 26 27 28 29 29 30 31 ...... 十月 十一月 十二月 日 一 二 三 四 五 六 日 一 二 三 四 五 六 日 一 二 三 四 五 六 1 2 3 1 2 3 4 5 6 7 1 2 3 4 5 4 5 6 7 8 9 10 8 9 10 11 12 13 14 6 7 8 9 10 11 12 11 12 13 14 15 16 17 15 16 17 18 19 20 21 13 14 15 16 17 18 19 18 19 20 21 22 23 24 22 23 24 25 26 27 28 20 21 22 23 24 25 26 25 26 27 28 29 30 31 29 30 27 28 29 30 31
[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 二月 2020 三月 2020 四月 2020 日 一 二 三 四 五 六 日 一 二 三 四 五 六 日 一 二 三 四 五 六 1 1 2 3 4 5 6 7 1 2 3 4 2 3 4 5 6 7 8 8 9 10 11 12 13 14 5 6 7 8 9 10 11 9 10 11 12 13 14 15 15 16 17 18 19 20 21 12 13 14 15 16 17 18 16 17 18 19 20 21 22 22 23 24 25 26 27 28 19 20 21 22 23 24 25 23 24 25 26 27 28 29 29 30 31 26 27 28 29 30这样就能显示出前/目前/后一个月的月历了!
# 底下指令中的 [tab] 代表键盘左侧的 Tab 按钮,光标请连着 f 不要有空白键,按下两次 [student@station10-101 ~]$ if[tab][tab] if ifcfg ifconfig ifdown ifenslave ifstat ifup [student@station10-101 ~]$ if # 如上,过程中都没有按下 [enter],屏幕会输出很多以 if 为开头的『指令名称』 [student@station10-101 ~]$ ls[tab][tab] ls lsblk lsgpio lsiio lsipc lslogins lsmd lsmod lsof lsscsi lsusb.py lsattr lscpu lshw lsinitrd lslocks lsmcli lsmem lsns lspci lsusb [student@station10-101 ~]$ ls[tab][tab]
[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月 26 09:03 /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 1583289427 # 将上述总秒数改换成为人类的日期,就是这样: [student@station10-101 ~]$ date --date="@1583289427" 三 3月 4 10:37:07 CST 2020这两者之间的切换这样!这在许多脚本要确认日期时,是很有帮助的功能!
[student@station10-101 ~]$ ll /etc
......
drwxr-xr-x. 3 root root 36 2月 26 09:03 xml
drwxr-xr-x. 2 root root 57 2月 26 09:06 yum
lrwxrwxrwx. 1 root root 12 11月 12 23:35 yum.conf -> dnf/dnf.conf
drwxr-xr-x. 2 root root 4096 2月 26 09:02 yum.repos.d
实在很多数据,得用 [shift]+[pageup] 去查阅。现在通过 more 来翻动看看:
[student@station10-101 ~]$ ll /etc | more 总计 1360 -rw-r--r--. 1 root root 44 3月 4 00:06 adjtime -rw-r--r--. 1 root root 1518 9月 10 2018 aliases drwxr-xr-x. 3 root root 65 2月 26 09:06 alsa drwxr-xr-x. 2 root root 4096 2月 26 09:08 alternatives -rw-r--r--. 1 root root 541 11月 9 00:47 anacrontab -rw-r--r--. 1 root root 55 11月 9 00:21 asound.conf -rw-r--r--. 1 root root 1 5月 11 2019 at.deny drwxr-x---. 4 root root 100 2月 26 09:15 audit drwxr-xr-x. 3 root root 228 2月 26 09:10 authselect drwxr-xr-x. 4 root root 71 2月 26 09:06 avahi drwxr-xr-x. 2 root root 136 2月 26 09:06 bash_completion.d -rw-r--r--. 1 root root 3001 9月 10 2018 bashrc -rw-r--r--. 1 root root 429 11月 9 04:35 bindresvport.blacklist drwxr-xr-x. 2 root root 6 11月 9 07:14 binfmt.d drwxr-xr-x. 2 root root 23 2月 26 09:03 bluetooth -rw-r-----. 1 root brlapi 33 2月 26 09:05 brlapi.key --更多-- # 此时,你可以按下 [enter] 或空白按键,或者是 q 离开,也能按下 / 搜索关键字!more 的功能是一页一页翻动,由于不是文件,因此你无法使用方向键向上查找,只能持续往下找寻数据而已。 最终数据显示完毕后,more 也就运行结束。那如果使用 less 呢?
[student@station10-101 ~]$ ll /etc | less 总计 1360 -rw-r--r--. 1 root root 44 3月 4 00:06 adjtime -rw-r--r--. 1 root root 1518 9月 10 2018 aliases drwxr-xr-x. 3 root root 65 2月 26 09:06 alsa drwxr-xr-x. 2 root root 4096 2月 26 09:08 alternatives -rw-r--r--. 1 root root 541 11月 9 00:47 anacrontab -rw-r--r--. 1 root root 55 11月 9 00:21 asound.conf -rw-r--r--. 1 root root 1 5月 11 2019 at.deny drwxr-x---. 4 root root 100 2月 26 09:15 audit drwxr-xr-x. 3 root root 228 2月 26 09:10 authselect drwxr-xr-x. 4 root root 71 2月 26 09:06 avahi drwxr-xr-x. 2 root root 136 2月 26 09:06 bash_completion.d -rw-r--r--. 1 root root 3001 9月 10 2018 bashrc -rw-r--r--. 1 root root 429 11月 9 04:35 bindresvport.blacklist drwxr-xr-x. 2 root root 6 11月 9 07:14 binfmt.d drwxr-xr-x. 2 root root 23 2月 26 09:03 bluetooth -rw-r-----. 1 root brlapi 33 2月 26 09:05 brlapi.key : <==光标停在这里,几乎与 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 /etc/dnf/vars/infra /etc/dnf/aliases.d /etc/dnf/dnf.conf /etc/dnf/modules.defaults.d /etc/dnf/plugins /etc/dnf/plugins/copr.conf /etc/dnf/plugins/copr.d ...... find: ‘/etc/audit’: 拒绝不符权限的操作 find: ‘/etc/libvirt’: 拒绝不符权限的操作 find: ‘/etc/firewalld’: 拒绝不符权限的操作 find: ‘/etc/sudoers.d’: 拒绝不符权限的操作 :
[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.10.101 netmask 255.255.0.0 broadcast 172.16.255.255 inet6 fe80::5718:f7d5:ab79:9643 prefixlen 64 scopeid 0x20<link> ether 52:54:00:85:b1:54 txqueuelen 1000 (Ethernet) RX packets 9354 bytes 755581 (737.8 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 16824 bytes 4387726 (4.1 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 86 bytes 7046 (6.8 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 86 bytes 7046 (6.8 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 ......
[student@station10-101 ~]$ ifconfig | grep 'inet ' inet 172.16.10.101 netmask 255.255.0.0 broadcast 172.16.255.255 inet 127.0.0.1 netmask 255.0.0.0 inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255这样就仅列出 IP 而已!画面清爽非常多!
[student@station10-101 ~]$ ll / 总计 24 lrwxrwxrwx. 1 root root 7 5月 11 2019 bin -> usr/bin dr-xr-xr-x. 6 root root 4096 2月 26 09:15 boot drwxr-xr-x. 20 root root 3260 3月 3 15:47 dev ......最左侧的第一个字符,就是这个文件名的类型,基本上有三种类型一定要先知道:
[student@station10-101 ~]$ ll -d /sys /proc dr-xr-xr-x. 233 root root 0 3月 3 15:47 /proc dr-xr-xr-x. 13 root root 0 3月 3 15:47 /sys容量竟然是 0 !这是因为这两个目录是从内存里面挂载出来的,所以没有用到实体硬盘容量,而是占用了内存容量喔! 因此硬盘使用量就是 0。
[student@station10-101 ~]$ ll -h /boot/vmlinuz* -rwxr-xr-x. 1 root root 7.8M 2月 26 09:08 /boot/vmlinuz-0-rescue-502dbaaf2a074134909a59ef9ab651c1 -rwxr-xr-x. 1 root root 7.8M 12月 5 05:58 /boot/vmlinuz-4.18.0-147.el8.x86_64ll 加上 -h 可以直接用人类易读的单位来处理,所以可以看到 vmlinuz-4.xxx 为 7.8M,这就是操作系统内核文件,容量相当小! 这个文件就可以驱动整个 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 166448 5月 12 2019 /usr/bin/ls
-rwxr-xr-x. 1 root root 97920 5月 11 2019 /usr/sbin/ifconfig
[student@station10-101 ~]$ df 文件系统 1K-区段 已用 可用 已用% 挂载点 devtmpfs 918108 0 918108 0% /dev tmpfs 936140 0 936140 0% /dev/shm tmpfs 936140 9388 926752 2% /run tmpfs 936140 0 936140 0% /sys/fs/cgroup /dev/mapper/centos-root 10475520 4359596 6115924 42% / /dev/vda2 1998672 149448 1727984 8% /boot /dev/mapper/centos-home 3135488 70240 3065248 3% /home tmpfs 187228 16 187212 1% /run/user/42 tmpfs 187228 4 187224 1% /run/user/0 tmpfs 187228 4 187224 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月 26 09:04 anacron drwx------. 3 root root 31 2月 26 09:06 at drwx------. 2 root root 6 11月 9 00:47 cron drwx--x---. 3 root lp 17 2月 26 09:05 cups drwxr-xr-x. 2 root root 6 5月 11 2019 lpd drwxrwxr-x. 2 root mail 32 2月 26 09:10 mail drwxr-xr-x. 2 root root 6 11月 22 01:36 plymouth drwx------. 2 root root 6 11月 14 12:16 up2date [student@station10-101 mail]$ ll .. 总计 0 drwxr-xr-x. 2 root root 63 2月 26 09:04 anacron drwx------. 3 root root 31 2月 26 09:06 at drwx------. 2 root root 6 11月 9 00:47 cron drwx--x---. 3 root lp 17 2月 26 09:05 cups drwxr-xr-x. 2 root root 6 5月 11 2019 lpd drwxrwxr-x. 2 root mail 32 2月 26 09:10 mail drwxr-xr-x. 2 root root 6 11月 22 01:36 plymouth drwx------. 2 root root 6 11月 14 12:16 up2date # 输出的结果会是一模一样的! [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 总计 2892 drwxr-xr-x. 2 root root 280 2月 26 09:10 anaconda drwx------. 2 root root 23 2月 26 09:15 audit -rw-------. 1 root root 0 3月 3 16:35 boot.log -rw-------. 1 root root 1920 3月 1 16:14 boot.log-20200301 [student@station10-101 anacron]$ ll ../../log | head -n 5 总计 2892 drwxr-xr-x. 2 root root 280 2月 26 09:10 anaconda drwx------. 2 root root 23 2月 26 09:15 audit -rw-------. 1 root root 0 3月 3 16:35 boot.log -rw-------. 1 root root 1920 3月 1 16:14 boot.log-20200301 # 这个案例中,从根目录写起的绝对路径文件名,又比相对路径文件名来的简单好写!
[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 2433 3月 4 13:22 /dev/shm/backup/etc/passwd
-rw-r--r--. 1 student student 2381 3月 4 13:22 /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 3月 4 13:21 /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 "2020/02/09 00:00 GMT" +%s
1581206400
[student@station10-101 ~]$ echo "1581206400/(24*60*60)+1" | bc
18302
[student@station10-101 ~]$ echo "(18310-1)*24*60*60" | bc 1581897600 [student@station10-101 ~]$ date -d "@1581897600" Mon Feb 17 08:00:00 CST 2020
[student@station10-101 ~]$ cal 10 10 2020 October 2020 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 drwxrwxr-x. 3 student student 60 Mar 4 13:21 backup drwxrwxr-x. 2 student student 40 Mar 4 15:23 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 Mar 4 15:24 X11 # 删除目录的方法 [student@station10-101 check]$ ll -d ./X11/xinit drwxr-xr-x. 5 student student 200 Mar 4 15:24 ./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 | grep group 2> /dev/null /etc/security/group.conf /etc/group /etc/group- /etc/iproute2/group [student@station10-101 check]$ cp /etc/security/group.conf /etc/group /etc/group- /etc/iproute2/group . 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 Mar 4 15:24 X11 -rw-r--r--. 1 student student 936 Mar 4 15:25 group -rw-r--r--. 1 student student 920 Mar 4 15:25 group- -rw-r--r--. 1 student student 3635 Mar 4 15:25 group.conf [student@station10-101 check]$ ll -R # 这样才能够看到 X11 底下的子目录!