Linux-28-linux Basic Command (L005-10)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.