Unix-like DevOps

du 类似快照,更准确,执行耗时。
目录大小:du -sh .
目录大小(列出每个子目录大小):du -h --max-depth=1 .

df 会包括内存中的文件。
文件系统占用:df -h

http://linuxshellaccount.blogspot.com/2008/12/why-du-and-df-display-different-values.html https://www.redhat.com/sysadmin/du-vs-df

完整路径:realpath 404.html

ln: When we create a symbolic link, we are creating a text description of where the target file is relative to the symbolic link. We can use absolute path to create symbolic links too.

# * exec cmd in the directory that contains the symbolic_link
# 在需要生成软链接的目录执行此命令
ln -s target_file symbolic_link

Here Document

Here Document 作用是将两个 delimiter 之间的内容作为输入参数传递给 cmd。
delimiter 可以是任意合法字符;起始的 delimiter 前后的的空格会被省略;结尾 delimiter 要顶格写,后面也不能跟字符。

# format
cmd << delimiter
  Here Document Content
delimiter


# example
cat << EOF
heredoc> LINE 1
heredoc> LINE 2
heredoc> EOF
# LINE 1
# LINE 2

cat << EOF > output
heredoc> line 1
heredoc> line 2
heredoc> EOF
cat output
# line 1
# line 2

# 追加
cat << EOF >> output
heredoc> line 3
heredoc> EOF
➜  kubernetes cat output
line 1
line 2
line 3

# https://my.oschina.net/u/1032146/blog/146941