Linux命令使用格式

Linux命令基本格式

命令基本格式为:
命令 [选项] [参数]
其中[]代表可选项,即有些命令无选项和参数也可执行。不同的命令格式不完全一致。
shell内部命令可使用help查看帮助信息,如“echo”,可以查看命令的格式和实现的功能。

[root@centos7 ~]#help echo
echo: echo [-neE] [arg ...]
    Write arguments to the standard output.
    
    Display the ARGs on the standard output followed by a newline.
    
    Options:
      -n	do not append a newline
      -e	enable interpretation of the following backslash escapes
      -E	explicitly suppress interpretation of backslash escapes

非shell内部一般可通过“–help”查看帮助信息,如“date”。具体不同命令之间格式上会有一些差异。

[root@centos7 ~]#date --help
Usage: date [OPTION]... [+FORMAT]
  or:  date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
Display the current time in the given FORMAT, or set the system date.

选项作用

选项可以调整命令,实现更丰富的功能,不加选项只能实现最基本的功能。选项有短格式(-a)和长格式(–all)之分,实现功能形同。

[root@centos7 ~]#ls
anaconda-ks.cfg  initial-setup-ks.cfg
[root@centos7 ~]#ls -a
.   anaconda-ks.cfg  .bash_logout   .bashrc  .config  .dbus                 .tcshrc
..  .bash_history    .bash_profile  .cache   .cshrc   initial-setup-ks.cfg  .viminfo
[root@centos7 ~]#ls --all
.   anaconda-ks.cfg  .bash_logout   .bashrc  .config  .dbus                 .tcshrc
..  .bash_history    .bash_profile  .cache   .cshrc   initial-setup-ks.cfg  .viminfo

参数作用

参数一般用于指定命令操作的对象。实现更加具体的操作。

[root@centos7 ~]#ls 
anaconda-ks.cfg  initial-setup-ks.cfg
[root@centos7 ~]#ls -l initial-setup-ks.cfg 
-rw-r--r--. 1 root root 1878 Apr 18 19:01 initial-setup-ks.cfg
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值