相关疑难解决方法(0)

如何在终端中输入包含空格或特殊字符的文件或目录名称?

我有文件和目录的用奇怪的名字的集合,它们包含空格和特殊字符\*)(?。当我尝试在命令行或脚本中使用它们时,所有这些都会导致问题,例如:

$ cd space dir
bash: cd: space: No such file or directory

$ cat space file
cat: space: No such file or directory
cat: file: No such file or directory

$ cat (
bash: syntax error near unexpected token `newline'

$ echo content >\
> ^C

$ ls ?
(  )  *  ?  \
Run Code Online (Sandbox Code Playgroud)

如何在终端中输入包含特殊字符的文件或目录名称?

command-line bash scripts files directory

14
推荐指数
0
解决办法
2779
查看次数

使用 grep 和 whoami 列出当前用户不拥有的进程

ps aux --sort=-%cpu | grep -v 'whoami'命令应该输出不是由有效用户启动的进程。但是,它会打印出我用户的进程以及其他用户的进程。请解释什么是错的。

command-line grep ps

4
推荐指数
1
解决办法
2561
查看次数

标签 统计

command-line ×2

bash ×1

directory ×1

files ×1

grep ×1

ps ×1

scripts ×1