[root@andy ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/cl-root 17G 2.0G 16G 12% /
devtmpfs 902M 0 902M 0% /dev
tmpfs 912M 0 912M 0% /dev/shm
tmpfs 912M 8.7M 904M 1% /run
tmpfs 912M 0 912M 0% /sys/fs/cgroup
/dev/sda1 1014M 139M 876M 14% /boot
tmpfs 183M 0 183M 0% /run/user/0
[root@andy ~]# free -m
total used free shared buff/cache available
Mem: 1823 118 1509 8 195 1529
Swap: 2047 0 2047
[root@andy ~]# free -h
total used free shared buff/cache available
Mem: 1.8G 118M 1.5G 9.0M 195M 1.5G
Swap: 2.0G 0B 2.0G
[root@andy ~]# free -h -s 3
total used free shared buff/cache available
Mem: 1.8G 118M 1.5G 9.0M 195M 1.5G
Swap: 2.0G 0B 2.0G
total used free shared buff/cache available
Mem: 1.8G 118M 1.5G 9.0M 195M 1.5G
Swap: 2.0G 0B 2.0G
^C
[root@andy ~]# date
2019年 10月 30日 星期三 18:43:04 CST
[root@andy ~]# date -s "2019-10-12 16:45"
2019年 10月 12日 星期六 16:45:00 CST
[root@andy ~]# date
2019年 10月 12日 星期六 16:45:03 CST
[root@andy ~]# date "+%F %T"
2019-10-12 16:47:19
%F年 %m月 %d日 %H时 %M分 %S秒
[root@andy ~]# date "+%Y"
2019
[root@andy ~]# date "+%m"
10
[root@andy ~]# date "+%d"
12
[root@andy ~]# date "+%H"
17
[root@andy ~]# date "+%M"
04
[root@andy ~]# date "+%S"
14
[root@andy ~]# date "+%Y-%m-%d %H:%M:%S"
2019-10-12 17:05:13
[root@andy ~]# date
2019年 10月 12日 星期六 17:05:27 CST
[root@andy ~]#
[root@andy ~]# date
2019年 10月 12日 星期六 17:05:27 CST
[root@andy ~]# clock
2019年10月30日 星期三 19时04分47秒 -0.813873 秒
[root@andy ~]# date
2019年 10月 12日 星期六 17:06:56 CST
[root@andy ~]# clock -w
[root@andy ~]# date
2019年 10月 12日 星期六 17:07:14 CST
[root@andy ~]# clock
2019年10月12日 星期六 17时07分18秒 -0.894695 秒
[root@andy ~]#
[root@andy ~]# cat test
hello
hello
hello
hello
[root@andy ~]# echo "Hi">test
[root@andy ~]# cat test
Hi
[root@andy ~]# cat test
Hi
[root@andy ~]# echo "hello">>test
[root@andy ~]# cat test
Hi
hello
[root@andy ~]#
[root@andy ~]# cdg 2>test
[root@andy ~]# cat test
-bash: cdg: 未找到命令
[root@andy ~]#
[root@andy ~]# dfgs 2>>test
[root@andy ~]# cat test
-bash: cdg: 未找到命令
-bash: dfgs: 未找到命令
[root@andy ~]#
[root@andy ~]# cat test
-bash: cdg: 未找到命令
-bash: dfgs: 未找到命令
[root@andy ~]# echo "hello" &>test
[root@andy ~]# cat test
hello
[root@andy ~]#
[root@andy ~]# cat test
-bash: sdfg: 未找到命令
[root@andy ~]# sdfg &>>test
[root@andy ~]# cat test
-bash: sdfg: 未找到命令
-bash: sdfg: 未找到命令
[root@andy ~]#
[root@andy ~]# cat /etc/passwd | grep "root"|wc -l
2
[root@andy ~]#
[root@andy ~]# ls /dev/sd*
/dev/sda /dev/sda1 /dev/sda2
[root@andy ~]#
[root@andy ~]# ls /dev/sd?
/dev/sda
[root@andy ~]# ls /dev/sd??
/dev/sda1 /dev/sda2
[root@andy ~]# ls /dev/sda[0-9]
/dev/sda1 /dev/sda2
[root@andy ~]#
[root@andy ~]# ls /dev/sd[a-z]
/dev/sda
[root@andy text]# ln -s /root/andy andy2
[root@andy text]# ls -l
总用量 0
-rw-r--r-- 2 root root 0 10月 12 20:26 andy1
lrwxrwxrwx 1 root root 10 10月 12 20:28 andy2 -> /root/andy
硬链接相当于复制黏贴,但是修改源文件中的内容,硬链接中的内容也会跟着改变,修改硬连接内容,源文件也会跟着改变
root@andy text]# ln /root/andy andy1
[root@andy text]# ls
andy1
[root@andy text]# ls -l
总用量 0
-rw-r--r-- 2 root root 0 10月 12 20:26 andy1
创建完成后,源文件,软硬链接均可以查看到文件内容。编辑源文件,软硬链接跟着动。
删除源文件,软链接失效,硬链接无影响,在创建一个与源文件同名的文件,软连接就直接链接到新的文件,而硬链接不改变。因为软连接是按照名称进行链接的
原文:https://www.cnblogs.com/yzandy/p/11768434.html