How does Linux create a file
This article mainly introduces "how to create files in Linux". In daily operation, I believe many people have doubts about how to create files in Linux. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts about "how to create files in Linux". Next, please follow the editor to study!
First of all, touch creates one file touch yyTest.ini simultaneously creates two files touch test1.txt test2.txt batch creation files (such as creating 2000 files) touch test {0001... 2000} .txt change the file yyTest.ini time to the current time (yyTest.ini already exists) touch yyTest.inivi and vim here do not expand the explanation vi and vim, the blog posts will be supplemented later
Vi test.txt vim touch.txt uses > to overwrite the original file directly without any prompt.
> > append to the end of the original file and will not overwrite the contents of the original file
Create a file directly with > create empty file > test.inils (write result to file) ls > test.inils > > test.inigrep create file (write result to file) ps-ef | grep java > test.ini ps-ef | grep java > > test.iniecho create file (write result to file) echo $PATH > test.iniecho $PATH > > test.ini creates a file using cp to create a file as long as the target file is a new file For detailed command interpretation of cp, please see this blog post: https://www.cnblogs.com/poloyy/p/12514389.html
Using cat to create files is easy to use >, > cat > test.inicat > > test.ini is also useful > and > >, but there is one difference: after typing the above command, you will enter the editing mode of test.ini. You can enter the content you want to write directly, and finally press ctrl+z to exit the editing mode to save automatically.
Cat combined with eofcat > > test.ini eof can be used as a delimiter, stop input when you encounter the next delimiter; case-same oh cat combined with exit and eof synonymous cat > > test.ini so far, the study on "how to create a file for Linux" is over, hoping to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!