jco*_*lum 74 windows-7 bash git git-bash
我在 Windows 7 上使用 git-bash。我想查看当前目录的树。然而:
jcollum@DEVELOPER01 ~/Dev/express_coffee
$ tree .
sh.exe": tree: command not found
Run Code Online (Sandbox Code Playgroud)
好的,所以我没有 tree 命令。我该如何安装?我找到了一篇文章,但它是针对 Mac 的。
Vik*_*ren 55
您也"cmd //c tree"可以使用 Windows'tree
解释:
/C 执行字符串指定的命令,然后终止
(用于转义的额外斜线)
/a 用于使用 ascii 字符运行,以防它显示不正确。
在这里更详细地回答:https : //stackoverflow.com/q/515309/1261166
小智 45
我已经按照建议从http://gnuwin32.sourceforge.net/packages/tree.htm下载了 zip 文件中的 tree.exe 。
然后我将 tree.exe 文件解压缩到C:\Program Files\Git\usr\bin(我已将此文件夹添加到 Windows 路径以使其与常规 CMD 一起使用,但它也与 GITBash 一起使用)。

我希望这能以某种方式帮助你!
小智 21
Windows 中已经有一个 tree 命令——唯一的问题是它是tree.comgit bash 不会自动添加扩展.com并执行它。
但是,如果您tab在键入tree或tre后按它会找到它
要查看您必须使用的文件//f- 您必须使用//或 bash 会认为它是文件夹名称
我也曾经//a显示 ascii 行,但您不必使用它
例子:
dean@dean:~/java$ tree
bash: tree: command not found
dean@dean:~/java$ tree.com //a
Folder PATH listing for volume c
Volume serial number is 4E70-B37A
C:.
+---atom
+---sublime
\---vscode
dean@dean:~/java$ tree.com //a //f
Folder PATH listing for volume c
Volume serial number is 4E70-B37A
C:.
+---atom
| test1
|
+---sublime
| test2
|
\---vscode
test3
dean@dean:~/java$
Run Code Online (Sandbox Code Playgroud)
GnuWin32 构建的树位于http://gnuwin32.sourceforge.net/packages/tree.htm - 如果您尚未使用 GnuWin32,则需要手动将其添加到您的路径中。
如果您想在 Windows 控制台上使用它,您还需要将 tree.exe 重命名或复制到其他内容,例如 lstree.exe,否则 Windows tree 命令将优先。GnuWin 版本的优点是它有很多选项——例如tree -L 2将递归深度限制为 2。
> tree --help
usage: tree [-adfghilnpqrstuvxACDFNS] [-H baseHREF] [-T title ] [-L level [-R]]
[-P pattern] [-I pattern] [-o filename] [--version] [--help] [--inodes]
[--device] [--noreport] [--nolinks] [--dirsfirst] [--charset charset]
[--filelimit #] [<directory list>]
-a All files are listed.
-d List directories only.
-l Follow symbolic links like directories.
-f Print the full path prefix for each file.
-i Don't print indentation lines.
-q Print non-printable characters as '?'.
-N Print non-printable characters as is.
-p Print the protections for each file.
-u Displays file owner or UID number.
-g Displays file group owner or GID number.
-s Print the size in bytes of each file.
-h Print the size in a more human readable way.
-D Print the date of last modification.
-F Appends '/', '=', '*', or '|' as per ls -F.
-v Sort files alphanumerically by version.
-r Sort files in reverse alphanumeric order.
-t Sort files by last modification time.
-x Stay on current filesystem only.
-L level Descend only level directories deep.
-A Print ANSI lines graphic indentation lines.
-S Print with ASCII graphics indentation lines.
-n Turn colorization off always (-C overrides).
-C Turn colorization on always.
-P pattern List only those files that match the pattern given.
-I pattern Do not list files that match the given pattern.
-H baseHREF Prints out HTML format with baseHREF as top directory.
-T string Replace the default HTML title and H1 header with string.
-R Rerun tree when max dir level reached.
-o file Output to file instead of stdout.
--inodes Print inode number of each file.
--device Print device ID number to which each file belongs.
--noreport Turn off file/directory count at end of tree listing.
--nolinks Turn off hyperlinks in HTML output.
--dirsfirst List directories before files.
--charset X Use charset X for HTML and indentation line output.
--filelimit # Do not descend dirs with more than # files in them.
Run Code Online (Sandbox Code Playgroud)
与 Windows 树相比:
> tree /?
Graphically displays the folder structure of a drive or path.
TREE [drive:][path] [/F] [/A]
/F Display the names of the files in each folder.
/A Use ASCII instead of extended characters.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
80904 次 |
| 最近记录: |