linux 从入门到跑路-Shell和部分命令

linux 从入门到跑路

Note2 Shell和部分命令

Shell

(ps:目前流行使用bash)

#查看当前的默认shell

[root@localhost ~]# echo $SHELL
/bin/bash

#查询当前系统一共有哪些shell
[root@localhost ~]# cat /etc/shells 
/bin/sh
/bin/bash
/sbin/nologin
/usr/bin/sh
/usr/bin/bash
/usr/sbin/nologin
/bin/tcsh
/bin/csh

  

 

type命令

用途:判断一个命令的类型

[root@localhost ~]# type cd

cd 是 shell 内嵌

[root@localhost ~]# type ifconfig

ifconfig 是 /usr/sbin/ifconfig

  

enable命令

显示及激活内部命令

[root@localhost ~]# enable

enable .

enable :

#省略中间内容

enable unset

enable wait

  统计已激活命令数

[root@localhost ~]# enable |wc -l

61

  在内部命令中禁用(不出现在内部命令中,优先级可能在外部命令中,如果之前输入过则在Hash中)

[root@localhost ~]# enable -n pwd

[root@localhost ~]# enable -n

enable -n pwd

[root@localhost ~]# enable pwd

[root@localhost ~]# enable -n

  

 

Pwd命令

显示当前路径

Hash命令

将外部命令的路径缓存

[root@localhost ~]# hash

hash: 哈希表为空

[root@localhost ~]# ifconfig

#省略ifconfig 命令结果详见ifconfig命令

[root@localhost ~]# hash

命中 命令

1 /usr/sbin/ifconfig

删除hash中指定命令

[root@localhost ~]# hash -d ifconfig

[root@localhost ~]# hash

hash: 哈希表为空

[root@localhost ~]# ifconfig

#省略ifconfig 命令结果详见ifconfig命令

清空hash表

[root@localhost ~]# hash-r

bash: hash-r: 未找到命令...

[root@localhost ~]# hash -r

[root@localhost ~]# hash

hash: 哈希表为空

  

help命令

内部命令 显示指定内部命令的帮助

Alias命令

定义或显示别名。

alias 别名='命令 选项'

alias ls=ls --color=auto

unalias 取消别名

unalias -a 取消所有别名

 

posted @ 2018-07-12 13:55  Francis_Drake_K  阅读(374)  评论(0编辑  收藏  举报