1 Star 0 Fork 4.9K

丛林 / docs

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

touch

Command Function

  • This command is used to create an empty file in a specified directory.
  • If this command is executed to create an existing file, the execution will be successful but the timestamp will not be updated.

Syntax

touch [filename]

Parameters

Table 1 Parameter description

Parameter

Description

Value Range

--help

Displays the parameters supported by the touch command.

N/A

filename

Specifies the name of the file to create.

N/A

Usage

  • The touch command creates an empty file that is readable and writeable.

  • You can use the touch command to create multiple files at a time.

    NOTICE: If you run the touch command to create a file in a directory storing important system resources, unexpected results such as a system breakdown may occur. For example, if you run the touch uartdev-0 command in the /dev directory, the system may stop responding.

Example

Run the following commands:

  • touch file.c
  • touch testfile1 testfile2 testfile3

Output

Example 1: creating the file.c file

OHOS:/tmp$ ls
OHOS:/tmp$ touch file.c
OHOS:/tmp$ ls
file.c
OHOS:/tmp$ ll
total 0
-rwxrwxrwx 1 0 0 0 1979-12-31 00:00 file.c*

Example 2: creating three files (testfile1, testfile2, and testfile3)

*OHOS:/tmp$
OHOS:/tmp$ touch testfile1 testfile2 testfile3
OHOS:/tmp$ ll
total 0
-rwxrwxrwx 1 0 0 0 1979-12-31 00:00 testfile1*
-rwxrwxrwx 1 0 0 0 1979-12-31 00:00 testfile2*
-rwxrwxrwx 1 0 0 0 1979-12-31 00:00 testfile3*
OHOS:/tmp$
1
https://gitee.com/jungle8023/docs.git
git@gitee.com:jungle8023/docs.git
jungle8023
docs
docs
master

搜索帮助