Viewing File Content (cat, less, head, tail)
Explore various commands to display and inspect the contents of text files, from full display to specific sections.
Inspecting Files in Linux
Ever wonder what's inside a file without opening a graphical editor? The Linux terminal provides powerful commands to quickly view file content.
This is super handy for checking log files, configuration settings, or just getting a quick peek at a document.
`cat`: Displaying Entire Files
The cat command (short for 'concatenate') is one of the simplest ways to display the entire content of a file directly to your terminal screen.
Let's create a small file and then view it:
echo "Line 1\nLine 2\nLine 3" > my_file.txt
Now, run cat my_file.txt:
cat my_file.txt
Output:Line 1
Line 2
Line 3
All lessons in this course
- Viewing File Content (cat, less, head, tail)
- Understanding File Permissions (chmod, chown)
- Searching for Files (find, grep)
- Creating Links: Hard Links & Symlinks