📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials Linux Command Line Reading Files

Reading Files

4 min read
cat shows full file content. less pages through large files — press Space to scroll and q to quit. head -n 20 shows the first 20 lines and tail -n 20 the last 20. tail -f follows a log file in real time.

Viewing File Content

cat file.txt        # print entire file
less file.txt       # page through (q to quit)
head -20 file.txt   # first 20 lines
tail -20 file.txt   # last 20 lines
tail -f app.log     # follow file in real time
wc -l file.txt      # count lines