In this part, we will learn how to read files in Linux. Linux systems store everything as text — logs, configs, scripts. Knowing how to view files is a core Linux skill.
cat prints the entire file content at once.
Best for small files.
cat file.txt
Combine files:
cat file1.txt file2.txt
Do not use cat on large files.
It will flood your terminal.
less opens files in a scrollable viewer.
This is the most used file viewer in Linux.
less largefile.log
/word → searchq → quit
more is similar to less but limited.
Less is preferred in modern systems.
more file.txt
Shows the first 10 lines of a file by default.
head file.txt
Custom number of lines:
head -n 5 file.txt
Shows the last 10 lines. Very useful for logs.
tail file.txt
Live log monitoring:
tail -f /var/log/syslog
Runs a command repeatedly every 2 seconds.
watch tail file.txt
Server admins use:
tail -f /var/log/nginx/access.log
This allows real-time monitoring.
Linux is about observing systems. Logs tell the truth before dashboards do.
In the next part, we will learn how to search text inside files using powerful Linux tools.
Next: Searching Text with grep →sudo only when necessary.