mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-08 15:04:05 +08:00
50 lines
1.8 KiB
HTML
50 lines
1.8 KiB
HTML
<h1 id="type">type</h1>
|
||
<p>显示指定命令的类型</p>
|
||
<h2 id="补充说明">补充说明</h2>
|
||
<p><strong>type命令</strong> 用来显示指定命令的类型,判断给出的指令是内部指令还是外部指令。</p>
|
||
<p>命令类型:</p>
|
||
<ul>
|
||
<li>alias:别名。</li>
|
||
<li>keyword:关键字,Shell保留字。</li>
|
||
<li>function:函数,Shell函数。</li>
|
||
<li>builtin:内建命令,Shell内建命令。</li>
|
||
<li>file:文件,磁盘文件,外部命令。</li>
|
||
<li>unfound:没有找到。</li>
|
||
</ul>
|
||
<h3 id="语法">语法</h3>
|
||
<pre><code class="language-bash">type(选项)(参数)</code></pre>
|
||
<h3 id="选项">选项</h3>
|
||
<pre><code class="language-bash">-t:输出“file”、“alias”或者“builtin”,分别表示给定的指令为“外部指令”、“命令别名”或者“内部指令”;
|
||
-p:如果给出的指令为外部指令,则显示其绝对路径;
|
||
-a:在环境变量“PATH”指定的路径中,显示给定指令的信息,包括命令别名。</code></pre>
|
||
<h3 id="参数">参数</h3>
|
||
<p>指令:要显示类型的指令。</p>
|
||
<h3 id="实例">实例</h3>
|
||
<pre><code class="language-bash">[root@localhost ~]# type ls
|
||
ls is aliased to `ls --color=tty'
|
||
|
||
[root@localhost ~]# type cd
|
||
cd is a shell builtin
|
||
|
||
[root@localhost ~]# type date
|
||
date is /bin/date
|
||
|
||
[root@localhost ~]# type mysql
|
||
mysql is /usr/bin/mysql
|
||
|
||
[root@localhost ~]# type nginx
|
||
-bash: type: nginx: not found
|
||
|
||
[root@localhost ~]# type if
|
||
if is a shell keyword
|
||
|
||
[root@localhost ~]# type which
|
||
which is aliased to `alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
|
||
|
||
[root@localhost ~]# type -a cd
|
||
cd is a shell builtin
|
||
|
||
[root@localhost ~]# type -a grep
|
||
grep is /bin/grep</code></pre>
|
||
<!-- Linux命令行搜索引擎:https://jaywcjlove.github.io/linux-command/ -->
|