首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

linux的man page文档怎么理解

2013-09-06 
linux的man page文档如何理解?比如以下是指令cp的部分描述:CP(1)User CommandsCP(1)NAMEtopcp - copy file

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


本人linux入门中,问题比较多还望大家赐教。
[解决办法]
搜“BNF”
[解决办法]
一般都是参数选项的说明使用,
可以试验下,加与不加对应参数输出结果的变化,就能体会l 
[解决办法]
-是选项的缩写,--是选项的具体,后面是解释。如果英语不是很好,可以找些例子看(就算英语好也不一定能完全理解。。)
[解决办法]
/*1.这里[option]是指选项吗(就是下面DESCRIPTION里的-a,-b -f之类的?)文档中所有被[]的是不是
代表可选择的?省略号代表有多个?*/

是的。

       -a, --archive      //2.这里指输入-a和--archive选项效果一样吧

是的。

       --attributes-only    //3.这里-only是什么,是解释?

--attributes-only是一整个选项,例如
cp --attributes-only foo bar

       --backup[=CONTROL]   //4.[=CONTROL]这种形式的表示什么意思
这个man page应该不完全,用baidu找不到什么好的,可以看看这个
http://os.chinaunix.net/a2007/1110/973/000000973974.shtml
cp --backup=number foo bar
试试

       --preserve[=ATTR_LIST]       //这里有括号[=ATTR_LIST]
              preserve the specified attributes (default:
              mode,ownership,timestamps

), 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

热点排行