linux的man page文档如何理解?
比如以下是指令cp的部分描述:
CP(1) User Commands CP(1)
NAME top
cp - copy files and directories
SYNOPSIS top
cp [OPTION]... [-T] SOURCE DEST
cp [OPTION]... SOURCE... DIRECTORY
cp [OPTION]... -t DIRECTORY SOURCE...
/*1.这里[option]是指选项吗(就是下面DESCRIPTION里的-a,-b -f之类的?)文档中所有被[]的是不是
代表可选择的?省略号代表有多个?*/
DESCRIPTION top
Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.
Mandatory arguments to long options are mandatory for short options
too.
-a, --archive //2.这里指输入-a和--archive选项效果一样吧
same as -dR --preserve=all
--attributes-only //3.这里-only是什么,是解释?
don't copy the file data, just the attributes
--backup[=CONTROL] //4.[=CONTROL]这种形式的表示什么意思
make a backup of each existing destination file
-b like --backup but does not accept an argument
--copy-contents
copy contents of special files when recursive
-d same as --no-dereference --preserve=links
-f, --force
if an existing destination file cannot be opened, remove it
and try again (this option is ignored when the -n option is
also used)
-i, --interactive
prompt before overwrite (overrides a previous -n option)
-H follow command-line symbolic links in SOURCE
-l, --link
hard link files instead of copying
-L, --dereference
always follow symbolic links in SOURCE
-n, --no-clobber
do not overwrite an existing file (overrides a previous -i
option)
-P, --no-dereference
never follow symbolic links in SOURCE
-p same as --preserve=mode,ownership,timestamps
--preserve[=ATTR_LIST] //这里有括号[=ATTR_LIST]
preserve the specified attributes (default:
mode,ownership,timestamps), if possible additional attributes:
context, links, xattr, all
--no-preserve=ATTR_LIST //这里没有ATTR_LIST 。。
don't preserve the specified attributes
--strip-trailing-slashes
remove any trailing slashes from each SOURCE argument
-s, --symbolic-link
make symbolic links instead of copying
-S, --suffix=SUFFIX
override the usual backup suffix
-t, --target-directory=DIRECTORY
copy all SOURCE arguments into DIRECTORY
-T, --no-target-directory
treat DEST as a normal file
), if possible additional attributes:
context, links, xattr, all
[]表示可选,如果没有,即
cp --preserve foo bar
那表示
cp --preserve=mode,ownership,timestamps foo bar
--no-preserve=ATTR_LIST //这里没有ATTR_LIST 。。
ATTR_LIST必需要有,就是上面那些attr