linux命令之which,whatis,whereis,tty

which

1.说明:shows the full path of (shell) commands;Which takes one or more arguments意思是该命令用于显示命令所在包括shell命令的绝对路径,并且该命令至少需要一个参数

默认在/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin这些路径搜索即$PATH,可以通过设置该环境变量改变搜索路径

2.使用

3.NOTE:使用简单,选项不做介绍,可以man which自行学习

whatis

1.说明:display manual page descriptions;Each  manual  page  has a short description available within it意思是该命令用于查找与相应name匹配的操作手册说明书的位置所在方便获得所需要的明确帮助

2.使用:whatis name

  name may contain wildcards (-w) or be a regular expression (-r)该name可以使用glob通配符或正则表达式但要通过-w和-r选项指定

3.使用简单,便于操作,其他选项不做说明,详细请man whatis

whereis

1.说明:locate the binary, source, and manual page files for a command;意思是该命令用于定位二进制,源码和操作手册页文件所在的

2.使用:whereis name

简单使用

 

To find all files in /usr/bin which are not documented in /usr/man/man1 or have no source in /usr/src:

查找/usr/bin中的所有命令且在/usr/man/man1中没有文件的在/usr/src没有源码的命令位置

$ cd /usr/bin
$ whereis -u -ms -M /usr/man/man1 -S /usr/src -f *

3.选项说明

  -u  Only  show  the command names that have unusual entries

  -m  Search only for manuals

  -s  Search only for sources

  -M  list  Limit the places where whereis searches for manuals, by a whitespace-separated list of directories.

  -S  list  Limit the places where whereis searches for sources, by a whitespace-separated list of directories.

  -f   Terminates the directory list and signals the start of filenames. It must be used when any of the -B, -M, or -S options is used.

tty

1.说明:print the file name of the terminal connected to standard input以文件名的方式标准输出已连接的终端,通过该命令可以清楚知道系统连接了哪些终端

终端有物理终端,虚拟终端和远程终端三种

  物理终端指直接接入本机的显示器和键盘设备 -->/dev/console

  虚拟终端指以软件方式虚拟实现的终端,centOS的默认启动6个虚拟终端-->文件名为/dev/tty1,一直到/dev/tty6

  远程终端指图形界面下的命令行接口基于ssh协议或telnet协议等远程打开的界面-->/dev/pts/0一直到/dev/pts/无穷

2.使用

 3.NOTE:踢出指定终端用户:pkill -kill -t ttyn

 

转载于:https://www.cnblogs.com/holdononedream/p/10852281.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值