Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ubuntu 如何打开rm命令上的警告?_Ubuntu_Command Line_Terminal_Command_Rm - Fatal编程技术网

Ubuntu 如何打开rm命令上的警告?

Ubuntu 如何打开rm命令上的警告?,ubuntu,command-line,terminal,command,rm,Ubuntu,Command Line,Terminal,Command,Rm,我最近安装了Ubuntu,发现当我使用 rm file 没有警告要求我确认步骤。我没有使用-f标志。它感觉很容易以这种方式被意外删除。 我在网上搜索,没有找到原因。如何打开警告?将别名rm='rm-I'放入shell的~/.bash\u rc或rc文件中。然后 source~/.bash\u rc 它将开始要求确认,无论何时你不想这样做。使用以下选项之一 $\rm file $command rm file \跳过别名,我更喜欢\,因为它的输入更少 本说明假设您正在使用bash。rc文件的名

我最近安装了Ubuntu,发现当我使用

rm file
没有警告要求我确认步骤。我没有使用-f标志。它感觉很容易以这种方式被意外删除。
我在网上搜索,没有找到原因。如何打开警告?

别名rm='rm-I'
放入shell的
~/.bash\u rc
或rc文件中。然后
source~/.bash\u rc

它将开始要求确认,无论何时你不想这样做。使用以下选项之一

$\rm file
$command rm file
\
跳过
别名
,我更喜欢
\
,因为它的输入更少


本说明假设您正在使用
bash
。rc文件的名称可能因您的shell而异,原因是linux假定您知道自己在做什么(顺便说一句:Windows命令提示符中的
del
也不要问您……只要我记得使用计算机,这是一种预期行为)如果您仍然想知道:
-i
开关应该询问您(如果您真的需要),但是在rm的手册页中,它仍然清楚地定义了-f选项。顺便说一句,我以前使用的linux系统将提示一条警告消息。我想这取决于外壳。但既然它们都使用bash,为什么会有区别呢?请注意,这很危险:当您移动到另一台没有别名的机器/用户时,您可能会意外地删除文件。最好为别名使用另一个名称。@Deleisha只是想知道command在$command rm文件中代表什么?哦,
command
是shell内置的,在使用
rm
之前,在提示符处键入
command
,我在哪里可以买到写着“alias rm='rm-I'”的衬衫?