In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Experimental objectives:
Through this experiment, we can master the use of head, tail, cat, more, less and other file viewing commands, understand the concept of redirection, and master the use of two redirection methods.
The steps of the experiment:
1. View the file / usr/bin/clean-binary-files through five different commands: head, tail, cat, more and less, and observe the similarities and differences of each tool.
2. Write the first 12 lines of / usr/bin/clean-binary-files to the file headtail.txt
3. Write the last 9 lines of / usr/bin/clean-binary-files to the file headtail.txt, which cannot overwrite the previous content.
Reference commands: 1. Five uses of view commands
Cat, displaying all the contents of the file at once
More/less, paged to display the contents of the file, more can only be turned down, less can be flipped up and down
Head/tail, write the first few lines or the last few lines of the poem file, use tail more, you can view the file update
2. The first 12 lines of / usr/bin/clean-binary-files, write to the file headtail.txt
Head-n 12 / usr/bin/clean-binary-files > / home/student/headtail.txt
Head-n 12, showing the first 12 lines of the file
Input the output of the haed command into the following file, and the > action is also called "redirect".
Note: if you report an error and do not have a directory, you need to create a student directory with mkdir first.
[root@localhost home] # vi / home/student/headtail.txt opens the file to see if 12 lines have been written to the file.
The last line mode of vi (that is, esc then:) enter set nu to view the line number, as shown in the figure
3. Write the last 9 lines of / usr/bin/clean-binary-files to the file headtail.txt, which cannot overwrite the previous content.
Tail-n 9 / usr/bin/clean-binary-files > > / home/student/headtail.txt
Tail-n 9, showing the last 9 lines of the file
The two angle brackets are appended to the following file for the contents of the tail display If you use >, the following file will be overwritten, that is, the previous head input will disappear.
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.