Information Technology Reference
In-Depth Information
# cpio -ivt -I archive
-rw-r--r-- 1 root other 27 Apr 6 03:04 2001, file1
-rw-r--r-- 1 root other 389 Apr 6 03:04 2001, file2
-rw-r----- 1 root other 34341 Apr 6 03:04 2001, file3
-rw-r--r-- 1 root other 103306 Apr 6 03:04 2001, file4
272 blocks
# cpio -ivum -I archive
file1
file2
file3
file4
272 blocks
#
The find Command
The
find(1)
command can be used to generate a list of files (their names) under
a particular directory or a list of filenames that meet specified criteria. The
find
command is especially useful when combined with the
cpio
command.
At a minimum, one command-line argument is required. That is the name of
the directory. By default, the directory and all files and directories under it are
also listed. The
find
command provides a variety of command-line arguments.
Table 8.6 lists some of the more useful
find
command-line arguments.
Table 8.6
Selected find Command-Line Arguments
Argument
Description
-atime
n
List only files accessed
-
n
(fewer than
n
days ago) or
+n
(more
than
n
days ago).
-ctime
n
Lists only files for which statuses changed
-
n
(fewer than
n
days
ago) or
+n
(more than
n
days ago).
-exec
cmd
Executes
cmd
for each listed file.
-group
grp
Lists only files that belong to the group name of GID
grp
.
-mtime
n
Lists only files modified
-
n
(fewer than
n
days ago) or
+n
(more
than
n
days ago).
-name
pattern
Lists only files whose name matches
pattern
.
-newer
file
Lists only files that are newer than
file
.
-print
Prints the selected files (always true even if not specified).
-type
c
Lists only the specified type of file (
block
,
character
,
directory
,
Door
,
fifo
,
link
,
plain
, or
s
ocket
).
-user
usr
Lists only files owned by username or UID
usr
.