![Linux:无法看到“tree”命令的所有选项](https://linux22.com/image/1429224/Linux%EF%BC%9A%E6%97%A0%E6%B3%95%E7%9C%8B%E5%88%B0%E2%80%9Ctree%E2%80%9D%E5%91%BD%E4%BB%A4%E7%9A%84%E6%89%80%E6%9C%89%E9%80%89%E9%A1%B9.png)
我尝试使用命令以递归方式列出目录内容并显示颜色tree -C
。但是,我的 shell 报告错误,而是显示信息条目sed
。该tree
命令本身运行良好,但似乎许多选项(例如tree -a
)对我来说不可用。
我尝试使用 安装新版本,但没有成功。我在和(LXDE/Ubuntu 14.04)sudo apt-get install tree
中都遇到了这种情况。bash
zsh
任何允许我使用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/