uTools-Manuals/docs/linux/userdel.html
2019-04-21 11:50:48 +08:00

19 lines
1.6 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<h1 id="userdel">userdel</h1>
<p>用于删除给定的用户以及与用户相关的文件</p>
<h2 id="补充说明">补充说明</h2>
<p><strong>userdel命令</strong> 用于删除给定的用户,以及与用户相关的文件。若不加选项,则仅删除用户帐号,而不删除相关文件。</p>
<h3 id="语法">语法</h3>
<pre><code class="language-bash">userdel(选项)(参数)</code></pre>
<h3 id="选项">选项</h3>
<pre><code class="language-bash">-f强制删除用户即使用户当前已登录
-r删除用户的同时删除与用户相关的所有文件。</code></pre>
<h3 id="参数">参数</h3>
<p>用户名:要删除的用户名。</p>
<h3 id="实例">实例</h3>
<p>userdel命令很简单比如我们现在有个用户linuxde其家目录位于<code>/var</code>目录中,现在我们来删除这个用户:</p>
<pre><code class="language-bash">userdel linuxde //删除用户linuxde但不删除其家目录及文件
userdel -r linuxde //删除用户linuxde其家目录及文件一并删除</code></pre>
<p>请不要轻易用<code>-r</code>选项;他会删除用户的同时删除用户所有的文件和目录,切记如果用户目录下有重要的文件,在删除前请备份。</p>
<p>其实也有最简单的办法,但这种办法有点不安全,也就是直接在<code>/etc/passwd</code>中删除您想要删除用户的记录;但最好不要这样做,<code>/etc/passwd</code>是极为重要的文件,可能您一不小心会操作失误。</p>
<!-- Linux命令行搜索引擎https://jaywcjlove.github.io/linux-command/ -->