Bash中的可执行命令
来源:互联网 发布:crossover linux 破解 编辑:程序博客网 时间:2024/06/05 16:43
I、可执行命令
Bash下的可执行命令分为四类:
1. Aliases
these are nicknames for a command with some options. They are defined in the shell’s initialization file (~/.bashrc for bash).
$ alias #查看所有定义的别名$ alias -p #查看定义别名的格式
2. Functions
they are snippets of shell code given a name. Like aliases, they are defined in the shell’s initialization file.
$ declare -f #查看所有定义的函数
3. Builtins
bash内置命令,不需要另外启动子进程来执行,所以所有的操作都会影响当前bash
$ help #查看所有的内置命令及其启用情况
4. External commands
they are independent of the shell,shell executes external programs by looking them up in the executable search path。
II、执行顺序
man bash #COMMAND EXECUTION
III、常用相关命令
# type (buildin)# Display information about command type, 查看一个命令属于哪一类$ type -t cmd# compgen (buildin) # Display possible completions depending on the options$ compgen -c # will list all the commands you could run.$ compgen -a # will list all the aliases you could run.$ compgen -b # will list all the built-ins you could run.$ compgen -k # will list all the keywords you could run.$ compgen -A function # will list all the functions you could run.$ compgen -A function -abck # will list all the above in one go.# 查看所有的外部命令case "$PATH" in (*[!:]:) PATH="$PATH:" ;;esacset -f; IFS=:for dir in $PATH; do set +f [ -z "$dir" ] && dir="." for file in "$dir"/*; do if [ -x "$file" ] && ! [ -d "$file" ]; then printf '%s = %s\n' "${file##*/}" "$file" fi donedone
参考文档
- http://unix.stackexchange.com/questions/94775/list-all-commands-that-a-shell-knows
- https://linux.die.net/man/1/bash
0 0
- Bash中的可执行命令
- bash中的历史命令
- bash赋值中的命令替换
- 关于Bash中的source命令
- Bash Shell 中的History命令
- 去除文本中的空行的bash命令
- bash中的export命令的使用
- linux中的source、sh、bash、./命令
- Linux中的ldd命令(显示可执行模块的dependency)
- Bash 命令
- Bash 命令
- bash命令
- bash命令
- 命令或可执行程序
- APAB中的可执行程序
- bash中的>& <&
- Linux命令之for - Bash中的For循环
- Linux命令之while - Bash中的While循环
- onActivityResult回调的用法
- 写一个复数类Complex,(复数形如3.2+5.6i,2.9-1.3i,其中i*i=-1)。要求支持+-*/,++、--,到bool类型和string类型的转换,支持>>、<<运算符。
- Spring Batch Partitioning example
- 车(唯一分解定理+高精度乘以单精度)
- 7. Scaling and Parallel Processing
- Bash中的可执行命令
- namespace 命名空间
- 信用风险评估评分卡 之 极端值
- Jsp简介
- file change只触发一次 解决方案
- 理解面向对象
- Can’t connect to local MySQL server through socket 解决办法
- js设计模式-原型模型
- hbase非正常删除表之后,以原来表名删除和创建时报错问题