file name" command, this command will write the specified content into the file."/> file name" command, this command will write the specified content into the file.">

Home>Article>Operation and Maintenance> What is the linux file creation command?

What is the linux file creation command?

WBOY
WBOY Original
2022-03-18 11:51:33 83313browse

The file creation commands are: 1. "vi file name" command. The file is created after the command is entered and saved; 2. "touch file name" command. This command is used to change the time of the file or directory. If the file does not exist, it will be created automatically; 3. "echo file content > file name" command, this command will write the specified content into the file.

What is the linux file creation command?

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

What is the Linux file creation command?

1.vi/vim

vi 1.txt # 会直接创建并打开一个文件1.txt

Note: The file will only be saved when you enter: w to save it. is created, exit directly with :q, the file will not be created.

2. touch

Linux touch command is used to modify the time attributes of files or directories, including access time and change time. If the file does not exist, the system will create a new file.

touch 新建文件名

3. echo

echo is an output command. With the redirection symbol, you can create a file.

The function of the echo command is to display a paragraph on the monitor. Text generally serves as a reminder.

The general format of this command is: echo [ -n ] string

The option n means no line breaks after outputting the text; the string can be quoted or not. When using the echo command to output a quoted string, the string is output as it is; when using the echo command to output an unquoted string, each word in the string is output as a string, and each string is separated by a space. .

echo “abcd” > 3.txt # 可以直接创建文件3.txt并将abcd写入。

Related recommendations: "Linux Video Tutorial"

The above is the detailed content of What is the linux file creation command?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn