Home > System Tutorial > LINUX > body text

What are the commands for creating new files in Linux?

下次还敢
Release: 2024-04-12 13:27:12
Original
544 people have browsed it

Linux新建文件命令:touch:新建空文件echo >:标准输出重定向到新文件cat >:将标准输入或指定文件内容写入新文件mkdir -p:创建目录并同时新建文件

What are the commands for creating new files in Linux?

Linux 新建文件的命令

在 Linux 系统中,可以使用以下命令新建文件:

touch

此命令用于新建一个空文件。

<code>touch 文件名</code>
Copy after login

>

此命令将标准输出重定向到一个新文件。

<code>echo 内容 > 文件名</code>
Copy after login

cat

此命令可将标准输入或指定文件的内容写入新文件。

<code>cat > 文件名</code>
Copy after login

创建目录的新建文件

以上命令还可用于在不存在时同时创建目录和文件。

<code>mkdir -p 目录/文件名</code>
Copy after login

详细信息

  • touch:这是一个简单的命令,仅用于新建文件。
  • >:此命令允许您将内容直接写入文件。
  • cat:此命令可将内容粘贴到文件中,包括来自标准输入的内容。
  • mkdir -p:此命令用于创建目录并同时新建文件。

The above is the detailed content of What are the commands for creating new files in Linux?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!