centos 7 手工安装tree过程
先到tree官网下载源代码,按下方最新版本为1.8.0
http://mama.indstate.edu/users/ice/tree/

下载保存到本地

上传到centos系统中,使用ftp传送
ftp:/write> put C:\Users\xuc\Downloads\tree-1.8.0.tgz tree-1.8.0.tgz
先解压:
[root@localhost write]# tar --zxvf tree-1.8.0.tgz
安装过程在INSTALL中描述,通过make,make install进行安装
Installation instructions:
1. Edit the Makefile for your OS. Comment out the Linux options and un-comment
the options for your OS.
2. Type: make
3. Type: make install
4. Enjoy colorful directory trees.
I cannot test on non-Linux machines, so please feel free to contribute
porting information, bug reports, compile options, patches, etc for porting to
other OS's to ice@mama.indstate.edu.
I would also welcome any localization efforts, particularly translating the
man page to other languages. And of course feel free to suggest options and
improvements you would like to see in tree.
make生成通常没有编译错误:
[root@localhost tree-1.8.0]# make
gcc -ggdb -pedantic -Wall -DLINUX -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -c -o tree.o tree.c
tree.c: In function ‘main’:
tree.c:585:86: warning: ISO C90 does not support ‘long long’ [-Wlong-long]
if (duflag) fprintf(outfile,"%s<size>%lld</size>%s", noindent?"":" ", (long long int)size, _nl);
^
tree.c:585:7: warning: ISO C90 does not support the ‘ll’ gnu_printf length modifier [-Wformat=]
if (duflag) fprintf(outfile,"%s<size>%lld</size>%s", noindent?"":" ", (long long int)size, _nl);
^
tree.c:591:59: warning: ISO C90 does not support ‘long long’ [-Wlong-long]
if (duflag) fprintf(outfile,",\"size\":%lld", (long long int)size);
^
tree.c:591:7: warning: ISO C90 does not support the ‘ll’ gnu_printf length modifier [-Wformat=]
if (duflag) fprintf(outfile,",\"size\":%lld", (long long int)size);
^
tree.c: In function ‘usage’:
tree.c:695:2: warning: string length ‘3106’ is greater than the length ‘509’ ISO C90 compilers are required to support [-Woverlength-strings]
" -- Options processing terminator.\n");
^
tree.c: In function ‘read_dir’:
tree.c:747:1: warning: C++ style comments are not allowed in ISO C90 [enabled by default]
// if (pattern && ((lst.st_mode & S_IFMT) == S_IFLNK) && !lflag) continue;
^
tree.c:747:1: warning: (this will be reported only once per input file) [enabled by default]
tree.c: In function ‘do_date’:
tree.c:1211:7: warning: ISO C90 does not support the ‘%e’ gnu_strftime format [-Wformat=]
strftime(buf,255,"%b %e %Y",tm);
^
tree.c:1213:7: warning: ISO C90 does not support the ‘%e’ gnu_strftime format [-Wformat=]
strftime(buf,255,"%b %e %R", tm);
^
tree.c:1213:7: warning: ISO C90 does not support the ‘%R’ gnu_strftime format [-Wformat=]
tree.c: In function ‘printit’:
tree.c:1236:2: warning: ISO C90 does not support the ‘%lc’ gnu_printf format [-Wformat=]
if (iswprint(*tp)) fprintf(outfile,"%lc",(wint_t)*tp);
^
tree.c: In function ‘psize’:
tree.c:1283:59: warning: ISO C90 does not support ‘long long’ [-Wlong-long]
} else return sprintf(buf, sizeof(off_t) == sizeof(long long)? " %11lld" : " %9lld", (long long int)size);
^
tree.c:1283:94: warning: ISO C90 does not support ‘long long’ [-Wlong-long]
} else return sprintf(buf, sizeof(off_t) == sizeof(long long)? " %11lld" : " %9lld", (long long int)size);
^
tree.c:1283:3: warning: ISO C90 does not support the ‘ll’ gnu_printf length modifier [-Wformat=]
} else return sprintf(buf, sizeof(off_t) == sizeof(long long)? " %11lld" : " %9lld", (long long int)size);
^
tree.c: In function ‘fillinfo’:
tree.c:1305:50: warning: ISO C90 does not support ‘long long’ [-Wlong-long]
if (inodeflag) n += sprintf(buf," %7lld",(long long)ent->linode);
^
tree.c:1305:3: warning: ISO C90 does not support the ‘ll’ gnu_printf length modifier [-Wformat=]
if (inodeflag) n += sprintf(buf," %7lld",(long long)ent->linode);
^
gcc -ggdb -pedantic -Wall -DLINUX -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -c -o unix.o unix.c
gcc -ggdb -pedantic -Wall -DLINUX -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -c -o html.o html.c
html.c:24:1: warning: C++ style comments are not allowed in ISO C90 [enabled by default]
//extern char *title,
^
html.c:24:1: warning: (this will be reported only once per input file) [enabled by default]
html.c: In function ‘emit_html_header’:
html.c:69:2: warning: string length ‘1689’ is greater than the length ‘509’ ISO C90 compilers are required to support [-Woverlength-strings]
"\t<h1>%s</h1><p>\n\t",charset ? charset : "iso-8859-1", version, title, title);
^
gcc -ggdb -pedantic -Wall -DLINUX -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -c -o xml.o xml.c
xml.c: In function ‘xml_fillinfo’:
xml.c:290:58: warning: ISO C90 does not support ‘long long’ [-Wlong-long]
if (inodeflag) fprintf(outfile," inode=\"%lld\"",(long long)ent->inode);
^
xml.c:290:3: warning: ISO C90 does not support the ‘ll’ gnu_printf length modifier [-Wformat=]
if (inodeflag) fprintf(outfile," inode=\"%lld\"",(long long)ent->inode);
^
xml.c:302:55: warning: ISO C90 does not support ‘long long’ [-Wlong-long]
if (sflag) fprintf(outfile, " size=\"%lld\"", (long long int)(ent->size));
^
xml.c:302:3: warning: ISO C90 does not support the ‘ll’ gnu_printf length modifier [-Wformat=]
if (sflag) fprintf(outfile, " size=\"%lld\"", (long long int)(ent->size));
^
gcc -ggdb -pedantic -Wall -DLINUX -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -c -o json.o json.c
json.c: In function ‘json_fillinfo’:
json.c:295:58: warning: ISO C90 does not support ‘long long’ [-Wlong-long]
if (inodeflag) fprintf(outfile,",\"inode\":%lld",(long long)ent->inode);
^
json.c:295:3: warning: ISO C90 does not support the ‘ll’ gnu_printf length modifier [-Wformat=]
if (inodeflag) fprintf(outfile,",\"inode\":%lld",(long long)ent->inode);
^
json.c:312:40: warning: C++ style comments are not allowed in ISO C90 [enabled by default]
for(i=0; isspace(nbuf[i]); i++); // trim() hack
^
json.c:312:40: warning: (this will be reported only once per input file) [enabled by default]
json.c:315:48: warning: ISO C90 does not support ‘long long’ [-Wlong-long]
fprintf(outfile, ",\"size\":%lld", (long long int)ent->size);
^
json.c:315:7: warning: ISO C90 does not support the ‘ll’ gnu_printf length modifier [-Wformat=]
fprintf(outfile, ",\"size\":%lld", (long long int)ent->size);
^
gcc -ggdb -pedantic -Wall -DLINUX -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -c -o hash.o hash.c
gcc -ggdb -pedantic -Wall -DLINUX -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -c -o color.o color.c
color.c: In function ‘parse_dir_colors’:
color.c:92:3: warning: string length ‘946’ is greater than the length ‘509’ ISO C90 compilers are required to support [-Woverlength-strings]
if ((s == NULL || strlen(s) == 0) && (force_color || cc != NULL)) s = ":no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.bat=01;32:*.BAT=01;32:*.btm=01;32:*.BTM=01;32:*.cmd=01;32:*.CMD=01;32:*.com=01;32:*.COM=01;32:*.dll=01;32:*.DLL=01;32:*.exe=01;32:*.EXE=01;32:*.arj=01;31:*.bz2=01;31:*.deb=01;31:*.gz=01;31:*.lzh=01;31:*.rpm=01;31:*.tar=01;31:*.taz=01;31:*.tb2=01;31:*.tbz2=01;31:*.tbz=01;31:*.tgz=01;31:*.tz2=01;31:*.z=01;31:*.Z=01;31:*.zip=01;31:*.ZIP=01;31:*.zoo=01;31:*.asf=01;35:*.ASF=01;35:*.avi=01;35:*.AVI=01;35:*.bmp=01;35:*.BMP=01;35:*.flac=01;35:*.FLAC=01;35:*.gif=01;35:*.GIF=01;35:*.jpg=01;35:*.JPG=01;35:*.jpeg=01;35:*.JPEG=01;35:*.m2a=01;35:*.M2a=01;35:*.m2v=01;35:*.M2V=01;35:*.mov=01;35:*.MOV=01;35:*.mp3=01;35:*.MP3=01;35:*.mpeg=01;35:*.MPEG=01;35:*.mpg=01;35:*.MPG=01;35:*.ogg=01;35:*.OGG=01;35:*.ppm=01;35:*.rm=01;35:*.RM=01;35:*.tga=01;35:*.TGA=01;35:*.tif=01;35:*.TIF=01;35:*.wav=01;35:*.WAV=01;35:*.wmv=01;35:*.WMV=01;35:*.xbm=01;35:*.xpm=01;35:";
^
gcc -ggdb -pedantic -Wall -DLINUX -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -c -o file.o file.c
file.c: In function ‘nextpc’:
file.c:42:19: warning: C++ style comments are not allowed in ISO C90 [enabled by default]
*tok = T_EOP; // Shouldn't happen.
^
file.c:42:19: warning: (this will be reported only once per input file) [enabled by default]
gcc -o tree tree.o unix.o html.o xml.o json.o hash.o color.o file.o
make install完成安装过程:
[root@localhost tree-1.8.0]# make install
install -d /usr/bin
install -d /usr/man/man1
if [ -e tree ]; then \
install tree /usr/bin/tree; \
fi
install doc/tree.1 /usr/man/man1/tree.1
执行tree命令
[root@localhost tree-1.8.0]# tree
.
├── CHANGES
├── color.c
├── color.o
├── doc
│ ├── tree.1
│ ├── tree.1.fr
│ └── xml.dtd
├── file.c
├── file.o
├── hash.c
├── hash.o
├── html.c
├── html.o
├── INSTALL
├── json.c
├── json.o
├── LICENSE
├── Makefile
├── README
├── strverscmp.c
├── TODO
├── tree
├── tree.c
├── tree.h
├── tree.o
├── unix.c
├── unix.o
├── xml.c
└── xml.o
1 directory, 28 files
tree命令的使用说明如下:
[root@localhost tree-1.8.0]# tree --help
usage: tree [-acdfghilnpqrstuvxACDFJQNSUX] [-H baseHREF] [-T title ]
[-L level [-R]] [-P pattern] [-I pattern] [-o filename] [--version]
[--help] [--inodes] [--device] [--noreport] [--nolinks] [--dirsfirst]
[--charset charset] [--filelimit[=]#] [--si] [--timefmt[=]<f>]
[--sort[=]<name>] [--matchdirs] [--ignore-case] [--fromfile] [--]
[<directory list>]
------- Listing options -------
-a All files are listed.
-d List directories only.
-l Follow symbolic links like directories.
-f Print the full path prefix for each file.
-x Stay on current filesystem only.
-L level Descend only level directories deep.
-R Rerun tree when max dir level reached.
-P pattern List only those files that match the pattern given.
-I pattern Do not list files that match the given pattern.
--ignore-case Ignore case when pattern matching.
--matchdirs Include directory names in -P pattern matching.
--noreport Turn off file/directory count at end of tree listing.
--charset X Use charset X for terminal/HTML and indentation line output.
--filelimit # Do not descend dirs with more than # files in them.
--timefmt <f> Print and format time according to the format <f>.
-o filename Output to file instead of stdout.
------- File options -------
-q Print non-printable characters as '?'.
-N Print non-printable characters as is.
-Q Quote filenames with double quotes.
-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.
--si Like -h, but use in SI units (powers of 1000).
-D Print the date of last modification or (-c) status change.
-F Appends '/', '=', '*', '@', '|' or '>' as per ls -F.
--inodes Print inode number of each file.
--device Print device ID number to which each file belongs.
------- Sorting options -------
-v Sort files alphanumerically by version.
-t Sort files by last modification time.
-c Sort files by last status change time.
-U Leave files unsorted.
-r Reverse the order of the sort.
--dirsfirst List directories before files (-U disables).
--sort X Select sort: name,version,size,mtime,ctime.
------- Graphics options -------
-i Don't print indentation lines.
-A Print ANSI lines graphic indentation lines.
-S Print with CP437 (console) graphics indentation lines.
-n Turn colorization off always (-C overrides).
-C Turn colorization on always.
------- XML/HTML/JSON options -------
-X Prints out an XML representation of the tree.
-J Prints out an JSON representation of the tree.
-H baseHREF Prints out HTML format with baseHREF as top directory.
-T string Replace the default HTML title and H1 header with string.
--nolinks Turn off hyperlinks in HTML output.
------- Input options -------
--fromfile Reads paths from files (.=stdin)
------- Miscellaneous options -------
--version Print version and exit.
--help Print usage and this help message and exit.
-- Options processing terminator.
浙公网安备 33010602011771号