1 Star 0 Fork 4.9K

丛林 / docs

forked from OpenHarmony / docs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
kernel-small-debug-shell-file-rm.md 4.74 KB
一键复制 编辑 原始数据 按行查看 历史
Annie_wang 提交于 2022-05-19 22:02 . update docs

rm

Command Function

This command is used to delete a file or folder.

Syntax

rm [-fv] FILE or rm [-rv] [PATH | filename]...

Parameters

Table 1 Parameter description

Parameter

Description

Value Range

-r

Deletes empty or non-empty directories.

N/A

-f

Deletes a file or directory forcibly without confirmation. No error will be reported when a file that does not exist is to be deleted.

N/A

-v

Displays the deletion process.

N/A

PATH/filename

Specifies the name of the file or directory to delete. The value can be a path.

N/A

Usage

  • The rm command can be used to delete multiple files or folders at a time.
  • You can run rm -r to delete a non-empty directory.
  • If the rm command without -f is used to delete a file that does not exist, an error will be reported.

Example

Run the following commands:

  • rm testfile
  • rm -r testpath/

Output

Example 1: deleting testfile

OHOS:/$ ls
bin  etc  proc    storage  testfile  usr
dev  lib  sdcard  system   userdata  vendor
OHOS:/$ rm testfile
OHOS:/$ ls
bin  etc  proc    storage  userdata  vendor
dev  lib  sdcard  system   usr

Example 2: deleting testpath, a non-empty directory

OHOS:/$ ls
bin  etc  proc    storage  testpath  usr
dev  lib  sdcard  system   userdata  vendor
OHOS:/$ rm -r testpath/
OHOS:/$ ls
bin  etc  proc    storage  userdata  vendor
dev  lib  sdcard  system   usr
1
https://gitee.com/jungle8023/docs.git
git@gitee.com:jungle8023/docs.git
jungle8023
docs
docs
master

搜索帮助