linux外部命令帮助,内部命令和外部命令帮助,内部命令和外部命令

内部命令和外部命令帮助,内部命令和外部命令

查看内部命令和外部命令帮助

一、内部命令

可以用type来判断该命令是内部命令还是外部命令,type后加要查看的命令.

示例写法:type enable

[10:52:18 root@centos ~]#type enable

enable is a shell builtin

有的命令既有内部命令也有外部命令但是系统会优先使用内部命令。

例如:type echo ,查看到的是内部命令,但是加上 -a系统会显示出他的外部命令路径。

[11:32:59 root@centos ~]#type echo

echo is a shell builtin

[11:33:18 root@centos ~]#type -a echo

echo is a shell builtin

echo is /usr/bin/echo

用help查看全部内部命令的简单说明

[09:47:49 root@centos ~]#help

GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu)

These shell commands are defined internally. Type `help' to see this list.

Type `help name' to find out more about the function `name'.

Use `info bash' to find out more about the shell in general.

Use `man -k' or `info' to find out more about commands not in this list.

A star (*) next to a name means that the command is disabled.

job_spec [&] history [-c] [-d offset] [n] or history>

(( expression )) if COMMANDS; then COMMANDS; [ elif COMM>

. filename [arguments] jobs [-lnprs] [jobspec ...] or jobs -x >

: kill [-s sigspec | -n signum | -sigspec>

[ arg... ] let arg [arg ...]

[[ expression ]] local [option] name[=value] ...

alias [-p] [name[=value] ... ] logout [n]

bg [job_spec ...] mapfile [-n count] [-O origin] [-s coun>

bind [-lpvsPVS] [-m keymap] [-f filename> popd [-n] [+N | -N]

break [n] printf [-v var] format [arguments]

builtin [shell-builtin [arg ...]] pushd [-n] [+N | -N | dir]

caller [expr] pwd [-LP]

case WORD in [PATTERN [| PATTERN]...) CO> read [-ers] [-a array] [-d delim] [-i t>

cd [-L|[-P [-e]]] [dir] readarray [-n count] [-O origin] [-s co>

command [-pVv] command [arg ...] readonly [-aAf] [name[=value] ...] or r>

compgen [-abcdefgjksuv] [-o option] [-A> return [n]

complete [-abcdefgjksuv] [-pr] [-DE] [-o> select NAME [in WORDS ... ;] do COMMAND>

compopt [-o|+o option] [-DE] [name ...] set [-abefhkmnptuvxBCHP] [-o option-nam>

continue [n] shift [n]

coproc [NAME] command [redirections] shopt [-pqsu] [-o] [optname ...]

declare [-aAfFgilrtux] [-p] [name[=value> source filename [arguments]

dirs [-clpv] [+N] [-N] suspend [-f]

disown [-h] [-ar] [jobspec ...] test [expr]

echo [-neE] [arg ...] time [-p] pipeline

enable [-a] [-dnps] [-f filename] [name > times

eval [arg ...] trap [-lp] [[arg] signal_spec ...]

exec [-cl] [-a name] [command [arguments> true

exit [n] type [-afptP] name [name ...]

export [-fn] [name[=value] ...] or expor> typeset [-aAfFgilrtux] [-p] name[=value>

false ulimit [-SHacdefilmnpqrstuvx] [limit]

fc [-e ename] [-lnr] [first] [last] or f> umask [-p] [-S] [mode]

fg [job_spec] unalias [-a] name [name ...]

for NAME [in WORDS ... ] ; do COMMANDS; > unset [-f] [-v] [name ...]

for (( exp1; exp2; exp3 )); do COMMANDS;> until COMMANDS; do COMMANDS; done

function name { COMMANDS ; } or name () > variables - Names and meanings of some >

getopts optstring name [arg] wait [id]

hash [-lr] [-p pathname] [-dt] [name ...> while COMMANDS; do COMMANDS; done

help [-dms] [pattern ...] { COMMANDS ; }

查看某一个内部命令详细说明:

示例写法:help enable

help后面加上要查看的命令。

[10:45:50 root@centos ~]#help enable

enable: enable [-a] [-dnps] [-f filename] [name ...]

Enable and disable shell builtins.

Enables and disables builtin shell commands. Disabling allows you to

execute a disk command which has the same name as a shell builtin

without using a full pathname.

Options:

-a print a list of builtins showing whether or not each is enabled

-n disable each NAME or display a list of disabled builtins

-p print the list of builtins in a reusable format

-s print only the names of Posix `special' builtins

Options controlling dynamic loading:

-f Load builtin NAME from shared object FILENAME

-d Remove a builtin loaded with -f

Without options, each NAME is enabled.

To use the `test' found in $PATH instead of the shell builtin

version, type `enable -n test'.

Exit Status:

Returns success unless NAME is not a shell builtin or an error occurs.

echo用法及原理

echo可以将你输入的内容进行显示,可以加参数,显示参数标准输出显示。并且自动换新行。

-n: 加上-n就是不换行

-e:启用反斜杠转义解释 示例:echo -e '\a' 警报声 '\a' 加引号。

用法示例:sleep 10;echo -e '\a' 休眠10秒,结束后警报声提醒

-E:禁用反斜杠转义解释

范例:echo的help使用方法

echo内部命令帮助查看:

示例写法:help echo

[11:33:21 root@centos ~]#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

`echo' interprets the following backslash-escaped characters:

\a alert (bell) 警报声提醒

\b backspace

\c suppress further output 压缩之后的输出 压缩掉echo的换行

\e escape character

\f form feed

\n new line 换新行 本身echo就带有换行,再加\n表示换两行。

\r carriage return

\t horizontal tab

\v vertical tab

\\ backslash

\0nnn the character whose ASCII code is NNN (octal). NNN can be

0 to 3 octal digits

\xHH the eight-bit character whose value is HH (hexadecimal). HH

can be one or two hex digits

Exit Status:

Returns success unless a write error occurs.

二、外部命令

带有路径的都是外部命令。

示例:passwd --help

[13:55:39 root@centos ~]#type passwd

passwd is hashed (/usr/bin/passwd)

[13:01:45 root@centos ~]#passwd --help

Usage: passwd [OPTION...]

-k, --keep-tokens keep non-expired authentication tokens

-d, --delete delete the password for the named account (root only)

-l, --lock lock the password for the named account (root only)

-u, --unlock unlock the password for the named account (root only)

-e, --expire expire the password for the named account (root only)

-f, --force force operation

-x, --maximum=DAYS maximum password lifetime (root only)

-n, --minimum=DAYS minimum password lifetime (root only)

-w, --warning=DAYS number of days warning users receives before password

expiration (root only)

-i, --inactive=DAYS number of days after password expiration when an account

becomes disabled (root only)

-S, --status report password status on the named account (root only)

--stdin read new tokens from stdin (root only)

Help options:

-?, --help Show this help message

--usage Display brief usage message

echo外部命令查看帮助:

示例写法:/bin/echo --help

[12:25:14 root@centos ~]#/bin/echo --help

Usage: /bin/echo [SHORT-OPTION]... [STRING]...

or: /bin/echo LONG-OPTION

Echo the STRING(s) to standard output.

-n do not output the trailing newline

-e enable interpretation of backslash escapes

-E disable interpretation of backslash escapes (default)

--help display this help and exit

--version output version information and exit

If -e is in effect, the following sequences are recognized:

\\ backslash

\a alert (BEL)

\b backspace

\c produce no further output

\e escape

\f form feed

\n new line

\r carriage return

\t horizontal tab

\v vertical tab

\0NNN byte with octal value NNN (1 to 3 digits)

\xHH byte with hexadecimal value HH (1 to 2 digits)

NOTE: your shell may have its own version of echo, which usually supersedes

the version described here. Please refer to your shell's documentation

for details about the options it supports.

GNU coreutils online help:

For complete documentation, run: info coreutils 'echo invocation'

(echo以上的写法查看到的帮助用法是相同的,但是帮助内容不一样,仅供参考。)

1Z5305918-0.png

可能写的有点乱,第三次写还有点不适应。

http://www.dengb.com/Linuxjc/1370376.htmlwww.dengb.comtruehttp://www.dengb.com/Linuxjc/1370376.htmlTechArticle内部命令和外部命令帮助,内部命令和外部命令     查看内部命令和外部命令帮助 一、内部命令   可以用type来判断该命令是内部命...

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值