关于"ls",如何仅显示目录(链接目录和隐藏目录除外) [英] About "ls" , how can I just show directories only (except linked directories and hidden directories)

查看:244
本文介绍了关于"ls",如何仅显示目录(链接目录和隐藏目录除外)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到关于"ls"此命令的一些问题

I meet some problem about "ls" this command

我只想打印目录,而不隐藏或链接

I want to print just only directory without hidden or linked

但是我用man ls来查看说明,但没有找到

but I use man ls to look the explanation , but I didn't found

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

if there is a flag that I can do what I want ...

谢谢

下面是我要解决的问题...

below is the question I am going to solve ...

  4.显示可见的出口

 4. Display the visible exits

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 列出作为参数给出的目录名称,而不列出其内容.

Use ls -d */. The */ is a wildcard that expands to all directories in current directory (directories end in /). -d tells ls to list the names of directories given as arguments and not their content.

这篇关于关于"ls",如何仅显示目录(链接目录和隐藏目录除外)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆