02 使用命令和获得帮助

Unit 2-Running Command and Getting Help

1.Running commands(指令语法)

1>commands have the fllowing syntax:

command [options] [arguments]
2> options

A> 若options是一个单词,前面要加“--";
B> 若options是单一的字母,前面要加"-"。

例:ls --all  (显示出的文件列表前加"."的,为隐藏文件)

Can be passed as "-a -b -c" or "-abc"

3> Arguments are filenames or other date needed by the command

例; cp a.log /tmp(拷贝) passwd -S user1 (查看用户是否设置密码, -S 与 --status功能同)


2.Some Simple Commands

date - display date and time

Usage: date [option]... +[FORMAT]   (后面要加上显示日期或时间的格式时前要加"+")

例改系统时间:    date -s 22:02

显示时间:date +%T    显示日期及时间; date +%D%T (注意%D与%T中间无空格)


cal - display calendar(日历)

例:cal 12 2009(显示2009年12月日历)

cal 2009 (显示2009年全年日历)

cal 2009 > 2009calendar (日历输出至文件)


3.Getting Help

Linux的建议:Don't try to memorize everything!

求助命令:

1> whatis

2> <command> --help

3> man and info

4> /usr/share/doc

4.The whatis Command(查询命令的简短说明)

例: whatis ls

5.The --help Option, Displays usage summary (使用摘要)and argument list(参数表) .

Used by most , but not all , commands.


6.Reading Usage Summaries (阅读帮忙摘要)

注意:Arguments in "[]",表示可选的,可有可无的。

Arguments in "<>"are variables表示变数。

x|y|z meas "x or y or z" 只能用三个参数中的其中一个

-abc表示可以以任何方式组合使用。


7.The man Command      即linux用户手册

man  [<章节>]  <command>

man pages比较重要的是编号为:1、 5、 8的 章节

1. User command(一般使用者都能用的指令)    5.  File format(命令的档案说明)     8.Administrative commands(仅root帐号可用的指令说明)

按下“Q”键离开man pages.


8.Navigating man pages

1>  使用箭头或pageup pagedown查阅

2>  输入 /<text> 查找关键字;然后使用n/N    向下/向上跳到关键字。

3>   q键退出

4> Searching the Manual 列出带指定关键字的man pages

man -k <keywrod>

9.The i nfo Command(比man更详细的帮助)

info <command>

帮助文档内带星号的,表示可以跳转至其它主题,按Tab键跳到下个星号处。按Enter进入*号所处的主题。


10.Navigating info pages

Navigate wiht arrows,pgup,pgdwon

Tab move the next link

Enter     Follow link the cursor is on

n/p/u       View next / previous / up-one node

s[<text>]  Search for text

q            Quit viewing pages

11.Extended Documentation(额外的说明文件)

/usr/share/doc


12.Red Hat Documentation

http://www.redhat.com/docs/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值