Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 关于「;ls",如何仅显示目录(链接目录和隐藏目录除外)_Linux_Shell_Unix - Fatal编程技术网

Linux 关于「;ls",如何仅显示目录(链接目录和隐藏目录除外)

Linux 关于「;ls",如何仅显示目录(链接目录和隐藏目录除外),linux,shell,unix,Linux,Shell,Unix,我遇到一些关于“ls”这个命令的问题 我只想打印没有隐藏或链接的目录 但我用man ls查找解释,但我没有找到 如果有一个标志,我可以做我想做的 谢谢 下面是我要解决的问题 四,。显示可见的出口 This is two commands: The first command prints "Visible exits: " -> It must not advance the cursor to the next line. The second command displays the

我遇到一些关于“ls”这个命令的问题

我只想打印没有隐藏或链接的目录

但我用man ls查找解释,但我没有找到

如果有一个标志,我可以做我想做的

谢谢

下面是我要解决的问题

四,。显示可见的出口

This is two commands: The first command prints "Visible exits: "
-> It must not advance the cursor to the next line.
The second command displays the visible exits and then a period (.).
-> To prevent the linked directories contents from also displaying, you 
will need a flag.
-> Several wildcard patterns will be needed.
-> The period will be the last of these patterns.
   The period means the current directory. But here it will seem, to
   the user, to be a period at the end of a sentence listing visible
   exits.
-> You will need to use a flag to keep the output from being
   sorted (otherwise the period will not stay at the end).
-> With several patterns to search, some may have no matches. That
   is OK, but we don't want to see warning messages. Redirect these.

使用
ls-d*/
*/
是一个通配符,可扩展到当前目录中的所有目录(目录以
/
结尾)
-d
告诉
ls
列出作为参数而不是其内容给出的目录名。

您应该查看该命令。比如:

stat -c '%F %n' * | sed -n '/^directory /s///p'
还有


Find将向您显示隐藏目录(包括当前目录)

如果OP需要的只是名称,那么
ls
在这里没有任何作用,
echo
也可以。考虑到问题中的措辞,这可能还不够(没有隐藏目录)。话虽如此,问题的
排序
位让我感到困惑,关于末尾的
位和当前目录也是如此。但是使用ls-d*/。像往常一样打印链接目录QQ,我不想打印链接目录你的问题对我来说毫无意义。你需要在你的问题中给我们一个演示。就像我现在有3个目录“a”“ab”“c”,但c是一个链接目录,我想用一个命令来打印一个,ab
find . -maxdepth 1 -type d -print