我发现这个命令用于查找重复的文件,但它很长,让我感到困惑。例如,如果我删除 -printf "%s\n",则没有任何结果。那是为什么?此外,他们为什么使用 xargs -I{} -n1?有没有更简单的方法来查找重复的文件?
[4a-o07-d1:root/798]#find -not -empty -type f -printf "%s\n" | sort -rn | uniq -d | xargs -I{} -n1 find -type f -size {}c -print0 | xargs -0 md5sum | sort | uniq -w32 --all-repeated=separate
0bee89b07a248e27c83fc3d5951213c1 ./test1.txt
0bee89b07a248e27c83fc3d5951213c1 ./test2.txt
Run Code Online (Sandbox Code Playgroud) 我想将find命令的输出重定向到cat命令,以便我可以打印给定文件的数据。
因此,例如,如果 find 的输出是/aFile/readme那么 cat 应该被解释为cat ./aFile/readme. 我怎样才能立即做到这一点?
我必须使用管道吗?
我试过这个版本:
cat | find ./inhere -size 1033c 2> /dev/null
Run Code Online (Sandbox Code Playgroud)
但我想这是完全错误的?当然,我确信输出只是一个文件而不是多个文件。
那我该怎么做呢?我在 Google 上搜索过,但找不到解决方案,可能是因为我没有正确搜索:P
在 Linux 中,/etc/hostsDNS如何与 DNS 协同工作以将主机名解析为 IP 地址?
/etc/hosts,那么在/etc/hosts
解析主机名后是否应用 DNS或将解析的 IP 地址
/etc/hosts视为“主机名”以递归解析?在我的浏览器(firefox 和 google chrome)中,当我添加到
/etc/hosts:
127.0.0.1 google.com www.google.com
Run Code Online (Sandbox Code Playgroud)
在浏览器的地址栏中输入 www.google.com 并按 Enter 键将无法连接到该网站。从 中删除该行后/etc/hosts,我可以连接到该网站。这是否意味着/etc/hosts覆盖 DNS 以解析主机名?
将行重新添加到/etc/hosts后,即使刷新网页,我仍然可以连接到该网站。为什么不
/etc/hosts再次申请,导致无法连接网站?
谢谢。
我一直很好奇为什么删除目录中所有内容的命令是rm -rf.
为什么没有标志可以做同样的事情rmdir?
rmdir用于目录操作不是更直观吗?
我想知道 ps 输出中的 SZ、RSS 和 VSZ 输出之间有什么数学联系,例如
ps -p 2363 -o sz,rss,vsz
Run Code Online (Sandbox Code Playgroud) 我试图使用执行新行echo并尝试执行以下两个命令:
第一条命令:
echo $'Hello World\nThis is a new line'
Run Code Online (Sandbox Code Playgroud)
回复:
Hello World
This is a new line
Run Code Online (Sandbox Code Playgroud)第二个命令:
echo $"Hello World\nThis is a new line"
Run Code Online (Sandbox Code Playgroud)
回复:
Hello World\nThis is a new line
Run Code Online (Sandbox Code Playgroud)我的问题是$' '用$" "in包裹的字符串与用bash's包裹的字符串有什么区别echo?
我创建了 env.sh 文件,其内容如下
#!/bin/sh
export M2_HOME=/vagrant/tools/maven
export PATH=$PATH:$M2_HOME/bin
export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_65
export ANT_HOME=/usr/local/apache-ant-1.9.7
export MAVEN_HOME=$M2_HOME
Run Code Online (Sandbox Code Playgroud)
但执行此 sh 文件不会导致导出 env 变量。必须手动执行每一行才能将它们导出。请帮忙
我有一个内核映像和一个空的文件系统,需要用程序填充它,比如桌面、一些基本的实用程序和软件。
我可以apt-get以某种方式安装来为我做到这一点吗?我不确定具体是如何apt-get工作的,所以我没有定义的发行版或其他东西可能会出现一些问题。
如果可能的话,从哪里获得构建它的源代码?
当我启动后台进程然后使用窗口的关闭按钮关闭终端时,后台进程被杀死。但是,如果我使用Ctrl+关闭终端D,后台进程将继续运行:
sam@Sam-Pc:~$ yes > /dev/null &
[1] 10219
// I then close the terminal a reopen a new one
sam@Sam-Pc:~$ ps aux | grep yes
sam 10295 0.0 0.0 15948 2152 pts/8 S+ 00:54 0:00 grep --color=auto yes
Run Code Online (Sandbox Code Playgroud)
现在使用Ctrl+D关闭终端:
sam@Sam-Pc:~$ yes > /dev/null &
[1] 10299
sam@Sam-Pc:~$Ctrl-D
// I then reopen a new terminal
sam@Sam-Pc:~$ ps aux | grep yes
sam 10219 99.4 0.0 11404 812 ? R 00:52 2:01 yes
sam …Run Code Online (Sandbox Code Playgroud) shell terminal signals process-management background-process
我正在将 Raspbian 分区从一张 SD 卡复制到新 SD 卡上的独立 Raspbian 安装。根据其他地方的建议,我跑了:
rsync -av --exclude=/mnt / /mnt
Run Code Online (Sandbox Code Playgroud)
但现在我担心我没有保留硬链接,因为我没有包含 -H 指令,而是 rsync 制作了文件副本而不是保留硬链接。
我该如何纠正这个可能的错误?我可以运行某种形式的 rsync 来解决这个问题吗?如:
rsync -avH --delete-after --exclude=/mnt / /mnt
Run Code Online (Sandbox Code Playgroud)