如果我在目录中有以下内容:
empty_dir: 空目录。empty_file: 空的文件。one_char: 由一个字符组成的文件。several_blocks:由几个块组成的文件(但不是“太大”或“稀疏”)。然后,ls将显示以下†:
$ ls -Gghs
total 152K
8,0K drwxr-xr-x 2 4,0K dec 21 23:34 empty_dir
4,0K -rw-r--r-- 1 0 dec 21 23:21 empty_file
8,0K -rw-r--r-- 1 1 dec 21 23:22 one_char
132K -rw-r--r-- 1 127K dec 22 00:14 several_blocks
Run Code Online (Sandbox Code Playgroud)
其次,stat显示以下内容:
$ stat empty_dir/
File: empty_dir/
Size: 4096 Blocks: 16 IO Block: 4096 directory
...
$ stat empty_file
File: empty_file
Size: 0 Blocks: 8 IO Block: …Run Code Online (Sandbox Code Playgroud) 假设我不知道我的 Django 源代码存储在哪里,但我知道它以这种方式包含这些目录:django/contrib/admin.
如何使用该find命令或任何更合适的 coreutils 命令来查找此部分目录路径(结构)可用的位置?
示例输出:
/home/me/python/extracted/django/contrib/admin/
/home/me/env/django/contrib/admin/
Run Code Online (Sandbox Code Playgroud) 有没有办法只构建和安装几个 GNU coreutils?
coreutils-8.19.tar.xz 中的 README 列出了 100 多个,但 INSTALL 没有说明如何安装只有几个,并且 Makefile(对我来说)是不透明的。
我在运行 OS X 10.8.4 的 Mac 上通过 MacPorts 安装了 coreutils。我已ls设置为在可用时使用ls[ (GNU coreutils) 8.21]的 coreutils 版本:
if [ -e /opt/local/libexec/gnubin ]; then
alias ls='/opt/local/libexec/gnubin/ls --color=auto'
else
alias ls='/bin/ls -G'
fi
Run Code Online (Sandbox Code Playgroud)
当我ls -l在包含已知具有扩展属性 (xattrs) 的文件的目录中运行时,我希望@在这些列表中的权限之后看到一个符号。但是,我看不到任何@迹象。如果我跑/bin/ls -l,我会得到@标志。
文件列表来自/bin/ls -l:
-rw-r--r--@ 1 zev.eisenberg staff 132887 Jul 19 16:24 flowchart.graffle
Run Code Online (Sandbox Code Playgroud)
文件列表来自ls -l(使用 coreutils):
-rw-r--r-- 1 zev.eisenberg staff 132887 Jul 19 16:24 flowchart.graffle
Run Code Online (Sandbox Code Playgroud)
当 xattrs 存在时,如何让 coreutils …
该cp命令的info页面提供--preserve=了以下选项:
links
在目标文件中保留相应源文件之间的任何链接。请注意,使用-L' or-H',此选项可以将符号链接转换为硬链接。
接下来是一个我不明白的例子[现在];无论如何:
问题:如何将软链接变成硬链接cp?有没有办法返回[将硬链接转换为软链接]?
次要问题:上面引用中的哪些地方可以发挥作用?我了解-Land的目的-H,我能够复制功能齐全的软链接等,但到目前为止我还没有设法将软链接变成硬链接。
随着du -bh我觉得我得到人类可读格式的外观尺寸:
# du -bh
295K ./test
Run Code Online (Sandbox Code Playgroud)
但是,我希望从du -hb,但我得到其他东西:
# du -hb
301926 ./test
Run Code Online (Sandbox Code Playgroud)
我相信这与刚刚du -b给我的输出相同。
# du --version
du (GNU coreutils) 7.4
Run Code Online (Sandbox Code Playgroud) 如何确定上次打开文件的时间?
我已经查看过man ls(使用 GNU coreutils 8.22),但没有看到有关此时间戳的任何信息。
是否有像env、nice、nohup等这样的命令运行程序可以运行带有修改信号的程序?就我而言,我需要将某些内容重置SIGINT为SIG_DFL.
为什么我需要这个?由于非交互式bash套SIG_IGN的SIGINT后台进程,你可以不带内置的外壳复位trap:https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=573780
upd:在 bash 4.3 后台子shell 中不忽略 SIGINT,其他后台程序仍然这样做
http://tiswww.case.edu/php/chet/bash/CHANGES
H。修复了导致 SIGINT 和 SIGQUIT 在异步子 shell 命令中无法捕获的错误。
昨天在 中更新了以下软件包后debian wheezy,tr命令停止工作。
Start-Date: 2016-02-16 23:10:06
Commandline: apt-get dist-upgrade
Upgrade: libkrb5-3:amd64 (1.10.1+dfsg-5+deb7u6, 1.10.1+dfsg-5+deb7u7),
libk5crypto3:amd64 (1.10.1+dfsg-5+deb7u6, 1.10.1+dfsg-5+deb7u7),
libgraphite2-2.0.0:amd64 (1.1.3-1, 1.3.5-1~deb7u1),
libc-bin:amd64 (2.13-38+deb7u8, 2.13-38+deb7u10),
libc6-i386:amd64 (2.13-38+deb7u8, 2.13-38+deb7u10),
libgssrpc4:amd64 (1.10.1+dfsg-5+deb7u6, 1.10.1+dfsg-5+deb7u7),
iceweasel-l10n-de:amd64 (38.6.0esr-1~deb7u1, 38.6.1esr-1~deb7u1),
locales:amd64 (2.13-38+deb7u8, 2.13-38+deb7u10),
iceweasel:amd64 (38.6.0esr-1~deb7u1, 38.6.1esr-1~deb7u1),
libkrb5support0:amd64 (1.10.1+dfsg-5+deb7u6, 1.10.1+dfsg-5+deb7u7),
multiarch-support:amd64 (2.13-38+deb7u8, 2.13-38+deb7u10),
libgcrypt11:amd64 (1.5.0-5+deb7u3, 1.5.0-5+deb7u4),
libkadm5clnt-mit8:amd64 (1.10.1+dfsg-5+deb7u6, 1.10.1+dfsg-5+deb7u7),
libkadm5srv-mit8:amd64 (1.10.1+dfsg-5+deb7u6, 1.10.1+dfsg-5+deb7u7),
libc6-dev:amd64 (2.13-38+deb7u8, 2.13-38+deb7u10),
krb5-locales:amd64 (1.10.1+dfsg-5+deb7u6, 1.10.1+dfsg-5+deb7u7),
libkdb5-6:amd64 (1.10.1+dfsg-5+deb7u6, 1.10.1+dfsg-5+deb7u7),
libgssapi-krb5-2:amd64 (1.10.1+dfsg-5+deb7u6, 1.10.1+dfsg-5+deb7u7),
libc-dev-bin:amd64 (2.13-38+deb7u8, 2.13-38+deb7u10),
libc6:amd64 (2.13-38+deb7u8, 2.13-38+deb7u10),
libc6-dev-i386:amd64 (2.13-38+deb7u8, 2.13-38+deb7u10)
End-Date: 2016-02-16 23:10:28 …Run Code Online (Sandbox Code Playgroud) 我正在编写一个 shell 脚本,它应该可以在各种不同的发行版上运行,其中一些正在使用busybox,有些没有。
此脚本使用timeout命令来确定它执行的命令是否运行时间更长<time>。在使用coreutils timeoutthis的发行版的情况下,这没有问题,因为当timeout不得不终止一个命令时,它总是返回124,所以这很简单。
我的问题是,当我在Alpine Linux(使用 busybox )上运行相同的程序时,退出状态是0超时后必须终止命令,但是当我在 Ubuntu 中使用包中的timeout命令时,busybox它以143.
为什么timeout这两个来自 的命令busybox给了我不同的返回值?
是否有任何一致性或规则可以用来确定命令是否超时?
coreutils ×10
command-line ×2
disk-usage ×2
linux ×2
ls ×2
shell ×2
alpine-linux ×1
bash ×1
busybox ×1
compiling ×1
cp ×1
debian ×1
filesystems ×1
find ×1
glibc ×1
gnu ×1
options ×1
osx ×1
posix ×1
signals ×1
stat ×1
timeout ×1
timestamps ×1
tr ×1
xattr ×1