Example 8. Known file 1.txt content is:
Test
haha
Lalalalala
The Lalalalala string is not included when printing 1.txt content is required.
Answer: Insert content in text file 1.txt:
View content in 1.txt:
Method One, use grep-v lalalalala 1.txt command
Where- v means that after the Lalalalalala content is excluded,grep is the filtered command, if you want to display only Haha, then grep haha 1.txt command can be used,
Method Two, the head-2 1.txt command is available, where Head-2 is the first two lines displayed,
Example 9. Use a command to complete the creation of the directory/haha/htest, which is to create the/haha directory and/haha/htest directory
Answer: You can use the mkdir command to complete, first of all, the command to create multiple directories, Mkdira b c is a one-time creation of a,b,c three directories,
This topic can be created recursively,mkdir-p/haha/htest/a/b/c command, regardless of the level of the directory hierarchy, a layer of recursion to create down,
Use the Tree command to view the creation results,
Note that there is no such command, stating that the installation of the virtual machine before the Linux server did not install the corresponding package, now installed, Injection command ,
Now use the Tree command to view the directory you just created
garbled, using lang=en to adjust the character set
Then use the Tree command to view the directory you just created.
Linux-28-linux Basic Command (L005-10)