In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "how to read files in Fedora in different ways", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to read files in Fedora in different ways" this article.
A feast with everything.
The cat command is well known to users of command line terminals. When you cat a file, you can easily display the contents of the entire file on your screen. What really happens at the bottom is that the file reads one line at a time and then writes it to the screen one line at a time.
Suppose you have a file called myfile, which has only one word per line. For simplicity, the word of each line is the line number of that line, like this:
Onetwothreefourfive
So if you cat this file, you will see the following output:
$cat myfileonetwothreefourfive
It's not much of a surprise, is it? But there is an interesting twist, as long as you use the tac command, you can cat the file from back to front. Please note that Fedora takes no responsibility for this controversial humor! )
$tac myfilefivefourthreetwoone
The cat command allows you to decorate the output in different ways, for example, you can output the line number:
$cat-n myfile 1 one 2 two 3 three 4 four 5 five
There are other options for displaying special characters and other features. To learn more, run the man cat command, and then press Q to exit and return to shell.
Choose your food.
Often, the file is too long to display all on the screen, and you may want to be able to view it like a document. In this case, try the less command:
$less myfile
You can use the arrow keys, or you can use PgUp/PgDn to view the file, press Q to return to shell.
In fact, there is also a more command, which is based on the old UNIX system command. If you still want to see the contents of the file after returning the shell, you may need to use it. The less command allows you to go back to what you were before you left shell and erase all the contents of the files you see on the screen.
A little pizza or dessert.
Sometimes the output you need is just the beginning of the file. For example, there is a very long file that displays all the contents of the file when you use the cat command, and the first few lines are easy to scroll through so that you can't see it. The head command will help you get the first few lines of the file:
$head-n 2 myfileonetwo
Similarly, you will use the tail command to look at the last few lines of the file:
$tail-n 3 myfilethreefourfive
Of course, these are just a few simple commands in this field.
These are all the contents of this article entitled "how to read Files in Fedora". 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.