小编use*_*006的帖子

xargs:不匹配的单引号;默认情况下,引号对于 xargs 是特殊的,除非您使用 -0 选项

我想用命令计算主目录上的所有普通文件:

$ find ~ -type f | xargs echo | wc -w
xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option
Run Code Online (Sandbox Code Playgroud)

它提示

xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option
Run Code Online (Sandbox Code Playgroud)

使用上有什么问题?

xargs

9
推荐指数
1
解决办法
6988
查看次数

whereis 返回不同的路径

我使用命令 whereis rm

$ whereis rm
/bin/rm
Run Code Online (Sandbox Code Playgroud)

然后我试试 which rm

$ which rm
/usr/local/opt/coreutils/libexec/gnubin/rm
Run Code Online (Sandbox Code Playgroud)

结果是不同的......所以rm当我运行像这样的命令时会调用哪个rm readme

command-line bash

8
推荐指数
1
解决办法
2369
查看次数

在家庭局域网中使用 SSH 连接两台计算机

我有两台 ubuntu 计算机共享同一个 wifi,并希望从一个终端连接到另一台计算机。

首先在名为“Second”和主机名“Algorithms”的第二台计算机上创建一个用户

然后尝试使用 SSH 从另一个访问它,但得到错误报告为

$ ssh second@Algorithms  
ssh: Could not resolve hostname algorithms: nodename nor servname provided, or not known
Run Code Online (Sandbox Code Playgroud)

我尝试的解决方案是基于网络的 - 从本地到达另一台计算机 - Ask Ubuntu

我的实验有什么问题?

networking

7
推荐指数
1
解决办法
2万
查看次数

使用读取行迭代变量

我有以下文件:

$ ls *.png | egrep -i "am|pm"
output-0 11.42.30 AM.png
output-0 5.10.12 PM.png
....
Run Code Online (Sandbox Code Playgroud)

我想删除它们但收到此错误:

$ ls *.png | egrep -i "am|pm" | while read line; do rm "$line"; done
rm: cannot remove ''$'\033''[0m'$'\033''[01;35moutput-0 11.42.30 AM.png'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[01;35moutput-0 5.10.12 PM.png'$'\033''[0m': No such file or directory
rm: cannot remove ''$'\033''[01;35moutput-1 11.42.30 AM.png'$'\033''[0m': No such file or directory
Run Code Online (Sandbox Code Playgroud)

我的代码有什么问题?

command-line bash ls

3
推荐指数
2
解决办法
320
查看次数

目录有可执行文件模式

我正在学习文件模式权限

666: for non-executable ordinary files 
777: for executable ordinary files 
777: for directories
Run Code Online (Sandbox Code Playgroud)

参考可执行模式,
我可以理解程序文件具有可执行模式,但
不知道为什么目录也具有“可执行模式”。

我发现这没有任何意义。目录条目无法执行,并且无法通过仅设置目录来设置目录中的所有文件“可执行”。

如何理解可执行目录项?

bash

2
推荐指数
1
解决办法
1005
查看次数

标签 统计

bash ×3

command-line ×2

ls ×1

networking ×1

xargs ×1