Home>Article>Operation and Maintenance> What is the linux file creation command?
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.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
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!