In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to use the dd command to create files in the Linux system, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
We all know that you can use the mkdir command to create a new directory, but more often it will be more enjoyable to create a file (a normal file) directly; so you don't have to open a special software to create a text file, and then set the file name to save the path.
We can use the dd command to create a file of a specific size, which is stored in the directory / bin. The dd command copies the given input and then writes the same copy to the output.
Standard input, ordinary files, device files can be used as input; standard output, device files, ordinary files can be used as output.
The format of the dd command is:
Dd if=... Of=... Bs=... Count=...
If represents the input file, of represents the output file, bs specifies the block size in bytes by default (in bytes c, word w, block B, kilobyte m, megabyte m, gigabyte G), and count represents the number of blocks to be copied
For example: create a 1024-byte file with a total content of 0 (empty); / dev/zero is a device file that can provide empty characters (\ 0) that can be used to generate empty files of a specific size.
Teach you how to create files in linux terminals. Teach you how to create files in linux terminals.
If you bs=2048 and count=2, then you will create a file with a size of 4096 bytes.
If you do not specify if, then dd reads the input from standard input and does not specify of, then dd uses standard output stdout as output.
When using dd as root, you should be aware that if you accidentally empty or destroy important files or equipment, it will cause irreparable trouble.
We can also use the touch command to generate a blank file, which is easier to operate and generally exists in the / usr/bin directory:
Touch uses a file name that does not exist as a parameter to create a blank file in the following format:
Touch filename; teaches you how to create files in linux terminals. It teaches you how to create files in linux terminals.
Of course, some friends may say that you can also use the command vi/vim, because I emphasize creating a normal file, while vi/vim, as an editor, emphasizes editing more when we create a file.
You can use the vi editor, vi filenmae, and then enter insert mode for content editing, and finally press: wq to exit the save.
Note that the file name here can be any format of the file name, can be a text file (txt), can also be a cjournal + file, etc., the suffix name of the file depends on the content and function of your file.
The above is all the contents of the article "how to create a file using the dd command in the Linux system". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.