the unix power tools

源代码在线查看: ch17_13.htm

软件大小: 3657 K
上传用户: akk79600872
关键词: power tools unix the
下载地址: 免注册下载 普通下载 VIP

相关代码

								>				>				>[Chapter 17] 17.13 Searching for Files by Type 				>				NAME="DC.title"				CONTENT="UNIX Power Tools">				NAME="DC.creator"				CONTENT="Jerry Peek, Tim O'Reilly & Mike Loukides">				NAME="DC.publisher"				CONTENT="O'Reilly & Associates, Inc.">				NAME="DC.date"				CONTENT="1998-08-04T21:38:28Z">				NAME="DC.type"				CONTENT="Text.Monograph">				NAME="DC.format"				CONTENT="text/html"				SCHEME="MIME">				NAME="DC.source"				CONTENT="1-56592-260-3"				SCHEME="ISBN">				NAME="DC.language"				CONTENT="en-US">				NAME="generator"				CONTENT="Jade 1.1/O'Reilly DocBook 3.0 to HTML 4.0">				REV="made"				HREF="mailto:online-books@oreilly.com"				TITLE="Online Books Comments">				REL="up"				HREF="ch17_01.htm"				TITLE="17. Finding Files with find">				REL="prev"				HREF="ch17_12.htm"				TITLE="17.12 Finding Many Things with One Command ">				REL="next"				HREF="ch17_14.htm"				TITLE="17.14 Searching for Files by Size ">				>				BGCOLOR="#FFFFFF"				TEXT="#000000"				>				CLASS="htmlnav"				>				>				SRC="gifs/smbanner.gif"				ALT="UNIX Power Tools"				USEMAP="#srchmap"				BORDER="0">				>				NAME="srchmap"				>				SHAPE="RECT"				COORDS="0,0,466,58"				HREF="index.htm"				ALT="UNIX Power Tools">				SHAPE="RECT"				COORDS="467,0,514,18"				HREF="jobjects/fsearch.htm"				ALT="Search this book">				>				WIDTH="515"				BORDER="0"				CELLSPACING="0"				CELLPADDING="0"				>				>				ALIGN="LEFT"				VALIGN="TOP"				WIDTH="172"				>				CLASS="SECT1"				HREF="ch17_12.htm"				TITLE="17.12 Finding Many Things with One Command "				>				SRC="gifs/txtpreva.gif"				SRC="gifs/txtpreva.gif"				ALT="Previous: 17.12 Finding Many Things with One Command "				BORDER="0">				>				>				ALIGN="CENTER"				VALIGN="TOP"				WIDTH="171"				>				>				FACE="ARIEL,HELVETICA,HELV,SANSERIF"				SIZE="-1"				>Chapter 17Finding Files with find				>				>				>				ALIGN="RIGHT"				VALIGN="TOP"				WIDTH="172"				>				CLASS="SECT1"				HREF="ch17_14.htm"				TITLE="17.14 Searching for Files by Size "				>				SRC="gifs/txtnexta.gif"				SRC="gifs/txtnexta.gif"				ALT="Next: 17.14 Searching for Files by Size "				BORDER="0">				>				>				>				> 				ALIGN="LEFT"				WIDTH="515"				TITLE="footer">				>				CLASS="SECT1"				>				CLASS="sect1"				>				CLASS="title"				NAME="UPT-ART-7936"				>17.13 Searching for Files by Type 				>				>				CLASS="para"				>				CLASS="indexterm"				NAME="AUTOID-19089"				>				>				CLASS="indexterm"				NAME="AUTOID-19092"				>				>If you are only interested in files of a certain type,				use the								CLASS="emphasis"				>-type				>				argument, followed by one of the characters in								CLASS="xref"				HREF="ch17_13.htm#UPT-ART-7936-TAB-0"				TITLE="find -type Characters"				>Table 17.1				>				[some versions of 				CLASS="emphasis"				>find				> don't have all of these 				CLASS="emphasis"				>-JP				> ].				>				CLASS="table"				>				CLASS="table"				>				CLASS="title"				NAME="UPT-ART-7936-TAB-0"				>Table 17.1: find -type Characters				>				>				CLASS="thead"				>				CLASS="row"				VALIGN="TOP"				>				CLASS="entry"				ALIGN="LEFT"				ROWSPAN="1"				COLSPAN="1"				>				CLASS="replaceable"				>				>Character				>				>				>				CLASS="entry"				ALIGN="LEFT"				ROWSPAN="1"				COLSPAN="1"				>				CLASS="replaceable"				>				>Meaning				>				>				>				>				>				CLASS="tbody"				>				CLASS="row"				VALIGN="TOP"				>				CLASS="entry"				ROWSPAN="1"				COLSPAN="1"				>b				>				CLASS="entry"				ROWSPAN="1"				COLSPAN="1"				>Block special file ("device file")				>				>				CLASS="row"				VALIGN="TOP"				>				CLASS="entry"				ROWSPAN="1"				COLSPAN="1"				>c				>				CLASS="entry"				ROWSPAN="1"				COLSPAN="1"				>Character special file ("device file")				>				>				CLASS="row"				VALIGN="TOP"				>				CLASS="entry"				ROWSPAN="1"				COLSPAN="1"				>d				>				CLASS="entry"				ROWSPAN="1"				COLSPAN="1"				>Directory				>				>				CLASS="row"				VALIGN="TOP"				>				CLASS="entry"				ROWSPAN="1"				COLSPAN="1"				>f				>				CLASS="entry"				ROWSPAN="1"				COLSPAN="1"				>Plain file				>				>				CLASS="row"				VALIGN="TOP"				>				CLASS="entry"				ROWSPAN="1"				COLSPAN="1"				>l				>				CLASS="entry"				ROWSPAN="1"				COLSPAN="1"				>Symbolic link				>				>				CLASS="row"				VALIGN="TOP"				>				CLASS="entry"				ROWSPAN="1"				COLSPAN="1"				>p				>				CLASS="entry"				ROWSPAN="1"				COLSPAN="1"				>Named pipe file				>				>				CLASS="row"				VALIGN="TOP"				>				CLASS="entry"				ROWSPAN="1"				COLSPAN="1"				>s				>				CLASS="entry"				ROWSPAN="1"				COLSPAN="1"				>Socket				>				>				>				>				CLASS="para"				>Unless you are a system administrator, the important types are				directories, plain files, or symbolic links (i.e., types								CLASS="literal"				>d				>,								CLASS="literal"				>f				>,				or								CLASS="literal"				>l				>).				>				CLASS="para"				>Using the								CLASS="emphasis"				>-type				>				operator, another way to list files recursively is:				>				CLASS="para"				>				CLASS="screen.co"				BORDER="1"				>				>				VALIGN="TOP"				>				CLASS="calloutlist"				>								CLASS="co"				HREF="ch09_21.htm"				TITLE="9.21 Handle Too-Long Command Lines with xargs "				>xargs				> 				>				>				VALIGN="TOP"				>				CLASS="screen"				>				 % 				CLASS="userinput"				>				>find . -type f -print | xargs ls -l				>				>				>				>				>				>				>				CLASS="para"				>				CLASS="indexterm"				NAME="AUTOID-19141"				>				>It can be difficult to keep track of all the symbolic links				in a directory. The next command will find all the symbolic				links in your home directory and print the files that				your symbolic links point to.				[				CLASS="literal"				>$NF				> gives the last field				of each line, which holds the name a symlink points to. 				CLASS="emphasis"				>-JP				>]				If your 				CLASS="emphasis"				>find				> doesn't have a 				CLASS="emphasis"				>-ls				> operator, pipe to								CLASS="emphasis"				>xargs ls -l				> as above.				>				CLASS="para"				>				CLASS="screen"				>				CLASS="screen"				>% 				CLASS="userinput"				>				>find $HOME -type l -ls | awk '{print $NF}'				>				>				>				>				>				CLASS="sect1info"				>				CLASS="SECT1INFO"				>- 				CLASS="authorinitials"				>BB				>				>				>				>				CLASS="htmlnav"				>				>				>				ALIGN="LEFT"				WIDTH="515"				TITLE="footer">				WIDTH="515"				BORDER="0"				CELLSPACING="0"				CELLPADDING="0"				>				>				ALIGN="LEFT"				VALIGN="TOP"				WIDTH="172"				>				CLASS="SECT1"				HREF="ch17_12.htm"				TITLE="17.12 Finding Many Things with One Command "				>				SRC="gifs/txtpreva.gif"				SRC="gifs/txtpreva.gif"				ALT="Previous: 17.12 Finding Many Things with One Command "				BORDER="0">				>				>				ALIGN="CENTER"				VALIGN="TOP"				WIDTH="171"				>				CLASS="book"				HREF="index.htm"				TITLE="UNIX Power Tools"				>				SRC="gifs/txthome.gif"				SRC="gifs/txthome.gif"				ALT="UNIX Power Tools"				BORDER="0">				>				>				ALIGN="RIGHT"				VALIGN="TOP"				WIDTH="172"				>				CLASS="SECT1"				HREF="ch17_14.htm"				TITLE="17.14 Searching for Files by Size "				>				SRC="gifs/txtnexta.gif"				SRC="gifs/txtnexta.gif"				ALT="Next: 17.14 Searching for Files by Size "				BORDER="0">				>				>				>				>				ALIGN="LEFT"				VALIGN="TOP"				WIDTH="172"				>17.12 Finding Many Things with One Command 				>				ALIGN="CENTER"				VALIGN="TOP"				WIDTH="171"				>				CLASS="index"				HREF="index/idx_0.htm"				TITLE="Book Index"				>				SRC="gifs/index.gif"				SRC="gifs/index.gif"				ALT="Book Index"				BORDER="0">				>				>				ALIGN="RIGHT"				VALIGN="TOP"				WIDTH="172"				>17.14 Searching for Files by Size 				>				>				>				ALIGN="LEFT"				WIDTH="515"				TITLE="footer">				SRC="gifs/smnavbar.gif"				SRC="gifs/smnavbar.gif"				USEMAP="#map"				BORDER="0"				ALT="The UNIX CD Bookshelf Navigation">				NAME="map"				>				SHAPE="RECT"				COORDS="0,0,73,21"				HREF="../index.htm"				ALT="The UNIX CD Bookshelf">				SHAPE="RECT"				COORDS="74,0,163,21"				HREF="index.htm"				ALT="UNIX Power Tools">				SHAPE="RECT"				COORDS="164,0,257,21"				HREF="../unixnut/index.htm"				ALT="UNIX in a Nutshell">				SHAPE="RECT"				COORDS="258,0,321,21"				HREF="../vi/index.htm"				ALT="Learning the vi Editor">				SHAPE="RECT"				COORDS="322,0,378,21"				HREF="../sedawk/index.htm"				ALT="sed & awk">				SHAPE="RECT"				COORDS="379,0,438,21"				HREF="../ksh/index.htm"				ALT="Learning the Korn Shell">				SHAPE="RECT"				COORDS="439,0,514,21"				HREF="../lrnunix/index.htm"				ALT="Learning the UNIX Operating System">				>				>				>				>							

相关资源