官术网_书友最值得收藏!

  • Bash Cookbook
  • Ron Brash Ganesh Naik
  • 169字
  • 2021-07-23 19:17:41

How to do it...

Open a terminal and run the following commands:

$ cat loremipsum.txt
$ head loremipsum.txt
$ head -n 1 loremipsum.txt
$ tail loremipsum.txt
$ tail -n 1 loremipsum.txt

Interestingly enough, the tail command has a feature that is different than the head command: it can monitor the tail end of a file forever until the command is exited or killed when using the -f or -F flags. Run the following command:

$ tail -F /var/log/kern.log

Keeping the tail command running, try disconnecting your wireless or Ethernet port. What do you see?

Press Ctrl + C to quit tail and run the following command:

$ more loremipsum.txt

Pressing the spacebar or Enter on your keyboard will progress through the file until the end. Pressing q will immediately exit more and return you to the console prompt.

Next, try the following command:

$ less loremipsum.txt 

Try navigating through the file using pg up, pg dn, the up and down arrow keys, and Enter and the spacebar. Notice anything?

主站蜘蛛池模板: 道孚县| 北辰区| 湟源县| 江口县| 宝山区| 沂南县| 沙田区| 克拉玛依市| 苏尼特左旗| 贵溪市| 六安市| 重庆市| 中牟县| 方山县| 宁夏| 赞皇县| 沧源| 曲水县| 金华市| 白朗县| 修武县| 霍州市| 堆龙德庆县| 龙井市| 曲麻莱县| 襄樊市| 宜兴市| 尼玛县| 玉龙| 扶绥县| 东乡族自治县| 北碚区| 怀柔区| 洪江市| 泗水县| 罗江县| 河西区| 北京市| 长岭县| 富裕县| 浮梁县|