Detailed explanation of Linux command file overwrite and file append

Detailed explanation of Linux command file overwrite and file append

1. The difference between the command > and >>

Command>: If the file exists, overwrite the original file's contents; if the original file does not exist, create the file and then add the information.
Command >>: will not overwrite the original file content, but append the content to the end of the file.

2. Basic grammar (just understand the difference between > and >>)

Basic syntax Functional Description
ls -l >filename Write the list contents to file
ls -l >filename Append the contents of the list to the end of the file
cat file1 > file2 Overwrite the contents of file 1 to file 2
echo "content" > filename Write the contents to the file

3. Example:

ls -l > filename:

ls -l >>filename:

Other commands are similar. I won’t go into details, you can verify it yourself.

The above is the detailed explanation and integration of Linux command file overwriting and file appending introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • Summary of useful commands such as clearing files in Linux
  • How to use cp command to implement forced overwrite function in Linux system
  • Linux background running node service command method
  • Summary of Linux daily commonly used commands and applications
  • Summary of common Linux commands under Ubuntu
  • Detailed explanation of info command in Linux
  • A brief discussion on whoami and who commands in Linux
  • Detailed explanation of the Crontab command in Unix/Linux
  • In-depth explanation of Linux grep command (practical)

<<:  What scenarios are not suitable for JS arrow functions?

>>:  mysql5.6.8 source code installation process

Recommend

Specific method of viewing user authorization information in mysql

Specific method: 1. Open Command Prompt 2. Enter ...

element-ui Mark the coordinate points after uploading the picture

What is element-ui element-ui is a desktop compon...

The implementation of Youda's new petite-vue

Table of contents Preface Introduction Live Easy ...

MySQL 5.6 compressed package installation method

There are two installation methods for MySQL: msi...

Introduction and use of Javascript generator

What is a generator? A generator is some code tha...

Vue achieves the top effect through v-show

html <div class="totop" v-show="...

On good design

<br />For every ten thousand people who answ...

JavaScript to achieve a simple countdown effect

This article example shares the specific code of ...

Understand all aspects of HTTP Headers with pictures and text

What are HTTP Headers HTTP is an abbreviation of ...

VMware Workstation Pro 16 License Key with Usage Tutorial

VMware Workstation is a powerful desktop virtual ...

Teach you how to quickly enable self-monitoring of Apache SkyWalking

1. Enable Prometheus telemetry data By default, t...