Linux:无法看到“tree”命令的所有选项

Linux:无法看到“tree”命令的所有选项

我尝试使用命令以递归方式列出目录内容并显示颜色tree -C。但是,我的 shell 报告错误,而是显示信息条目sed。该tree命令本身运行良好,但似乎许多选项(例如tree -a)对我来说不可用。

我尝试使用 安装新版本,但没有成功。我在和(LXDE/Ubuntu 14.04)sudo apt-get install tree中都遇到了这种情况。bashzsh

任何允许我使用tree全套选项的建议(列于此处:http://linux.die.net/man/1/tree)?

~ tree -C                                                                 ⏎
sed: invalid option -- 'C'
Usage: sed [OPTION]... {script-only-if-no-other-script} [input-file]...

  -n, --quiet, --silent
                 suppress automatic printing of pattern space
  -e script, --expression=script
                 add the script to the commands to be executed
  -f script-file, --file=script-file
                 add the contents of script-file to the commands to be executed
  --follow-symlinks
                 follow symlinks when processing in place
  -i[SUFFIX], --in-place[=SUFFIX]
                 edit files in place (makes backup if SUFFIX supplied)
  -l N, --line-length=N
                 specify the desired line-wrap length for the `l' command
  --posix
                 disable all GNU extensions.
  -r, --regexp-extended
                 use extended regular expressions in the script.
  -s, --separate
                 consider files as separate rather than as a single continuous
                 long stream.
  -u, --unbuffered
                 load minimal amounts of data from the input files and flush
                 the output buffers more often
  -z, --null-data
                 separate lines by NUL characters
      --help     display this help and exit
      --version  output version information and exit

If no -e, --expression, -f, or --file option is given, then the first
non-option argument is taken as the sed script to interpret.  All
remaining arguments are names of input files; if no input files are
specified, then the standard input is read.

GNU sed home page: <http://www.gnu.org/software/sed/>.
General help using GNU software: <http://www.gnu.org/gethelp/>.

答案1

我没有资格发表评论,因此我只能把这个放在这里。

看起来该tree命令几乎在您的机器上被别名为sed。当我tree -C在我的机器上运行时,我得到了预期的行为。当我sed -C在我的计算机上运行时,我得到了与您运行时完全相同的输出tree -C

您的文件中是否有任何条目~/.bashrc定义这样的别名?

答案2

您可以尝试以下 tree 命令:

tree /boot/
tree -d /boot/
tree -C /boot/

相关内容