我认为我的 du 命令很混乱。
% du -shc DIR ...
...
6123941496 total
% du -shc DIR ...
...
6.1G total
% du -sc --si DIR ...
...
6.6G total
Run Code Online (Sandbox Code Playgroud)
我试过LANG=C
在电子表格中给出并仔细检查结果。看起来 -h 已经使用 1000 (--si) 的幂进行输出,而 --si 给出了错误的答案。我认为正确的答案应该是 -h 的 5.7G 和 --si 的 6.1G。那么这里会发生什么呢?
% du --version
du (GNU coreutils) 8.20
...
% uname -a
Linux XXX 3.9-1-amd64 #1 SMP Debian 3.9.8-1 x86_64 GNU/Linux
Run Code Online (Sandbox Code Playgroud) 例子:
% touch -- safe-name -name-with-dash-prefix "name with space" \
'name-with-double-quote"' "name-with-single-quote'" \
'name-with-backslash\'
Run Code Online (Sandbox Code Playgroud)
xargs
似乎无法处理双引号:
% ls | xargs ls -l
xargs: unmatched double quote; by default quotes are special to xargs unless you use the -0 option
ls: invalid option -- 'e'
Try 'ls --help' for more information.
Run Code Online (Sandbox Code Playgroud)
如果我们使用该-0
选项,它会遇到带有破折号前缀的名称的问题:
% ls -- * | xargs -0 -- ls -l --
ls: invalid option -- 'e'
Try 'ls --help' for more information.
Run Code Online (Sandbox Code Playgroud)
这是在使用其他可能有问题的字符(如换行符、控制字符等)之前。
假设我正在为wget
名为wget-hip
. 我想wget-hip
获得相同的 shell 完成规则,wget
因为它们碰巧具有相同的命令行选项。
所以如果 wget 有这个完成规则:
complete -F _wget wget
Run Code Online (Sandbox Code Playgroud)
或者:
complete -C _wget wget
Run Code Online (Sandbox Code Playgroud)
那么我想要:
complete -F _wget wget-hip
Run Code Online (Sandbox Code Playgroud)
或者:
complete -C _wget wget-hip
Run Code Online (Sandbox Code Playgroud)
有没有合适的方法来做到这一点?
几周前我参加了 RHCSA 测试,这是一项实验室/动手测试。第一步是获得虚拟机的根访问权限。通常(这在我 PC 的 VirtualBox CentOS 7 VM 上工作正常)我通过添加内核参数来实现init=/bin/bash rw
。但是在测试的虚拟机上这并没有真正起作用。在内核将我设置为 root 密码后,即使在我发出reset
. passwd
事实证明使用更改密码是不可能的,因为终端似乎吃掉了我的一些按键。我不得不求助于使用内核参数rd.break
。问题是为什么,尤其是奇怪的终端行为?
autocomplete ×1
centos ×1
disk-usage ×1
init ×1
ls ×1
quoting ×1
rhel ×1
shell ×1
terminal ×1
xargs ×1