• Что бы вступить в ряды "Принятый кодер" Вам нужно:
    Написать 10 полезных сообщений или тем и Получить 10 симпатий.
    Для того кто не хочет терять время,может пожертвовать средства для поддержки сервеса, и вступить в ряды VIP на месяц, дополнительная информация в лс.

  • Пользаватели которые будут спамить, уходят в бан без предупреждения. Спам сообщения определяется администрацией и модератором.

  • Гость, Что бы Вы хотели увидеть на нашем Форуме? Изложить свои идеи и пожелания по улучшению форума Вы можете поделиться с нами здесь. ----> Перейдите сюда
  • Все пользователи не прошедшие проверку электронной почты будут заблокированы. Все вопросы с разблокировкой обращайтесь по адресу электронной почте : info@guardianelinks.com . Не пришло сообщение о проверке или о сбросе также сообщите нам.

Day 19/ 30 Days of Linux Mastery: File Viewing Commands (cat, less, more, head, tail)

Lomanu4 Оффлайн

Lomanu4

Команда форума
Администратор
Регистрация
1 Мар 2015
Сообщения
1,481
Баллы
155
Table of Contents

  • Introduction
  • What Are These Commands?
  • Real-World Scenario: Using File Viewing Commands
  • Conclusion
  • Let's Connect


Introduction


Welcome back to day 19!.Today’s focus is on file-viewing commands:

cat, less, more, head, and tail.

When working with files in Linux, being able to view logs, outputs, and configuration files quickly is critical. You don’t always need to open a full editor like vim, sometimes a simple peek is all you need.

Let’s get into it!


What Are These Commands?

CommandPurpose
catConcatenate and display file contents
lessView file one page at a time, scrollable
moreSimilar to less, but can only scroll forward
headShow the first few lines of a file
tailShow the last few lines of a file (often logs)


Real-World Scenario: Using File Viewing Commands


You work as a Junior Linux Admin. Your team gives you a log file and says:

  • Let's view the file using cat


man man > manualpage.txt - # we created a file called manual page by opening the man command and copying the contents into manualpage.txt


cat manualpage.txt # this views the file showing what we created.


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



  • Let's check the man page, and use more to view the content page by page. Note, you can only scroll forward. ( The up and arrow keys works, but forward and backward here means using the right and left arrow keys.)

more manualpage.txt


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



  • Let's view a large file or logs using less. This helps you view large files page by page, and you can scroll forward and backward unlike the more command.

less manualpage.txt


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



  • We use head to view the top lines of the files. You can include the number of lines you also intend to view.

head manualpage.txt

or

head -n 5 manualpage.txt to view the first 5 lines.


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



  • You can also view the last lines using tail command.

tail manualpage.txt

or

tail -5 manualpage.txt to view the last 5 lines.
m5 description




Conclusion



These file viewing commands are very essential, and by mastering these commands, even a beginner can:


  • Quickly read and understand system logs


  • Debug issues like failed logins or service restarts


  • Monitor live updates without extra tools

If this is helpful to you, feel free to bookmark, comment, like and follow me for Day 20!


Let's Connect!


If you want to connect or share your journey, feel free to reach out on

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

.
I am always happy to learn and build with others in the tech space.

#30DaysLinuxChallenge #Redhat#RHCSA #RHCE #CloudWhistler #Linux #Rhel #Ansible #Vim #CloudComputing #DevOps #LinuxAutomation #IaC #SysAdmin#CloudEngineer


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

 
Вверх Снизу