What Is the tail Command? See a File’s End Fast
You open a long file, but you only care about the most recent part — what happened last. Scrolling all the way down sounds painful, right? There’s a faster way.
The tail command shows you only the end of a file, so you can see the newest lines without endless scrolling. Once you’ve learned how to peek at the top of a file, peeking at the end is the natural next step.
The tail command shows the last few lines of any file straight away. You type tail filename in your terminal, press Enter, and only the bottom lines appear — perfect when the newest information sits at the very end.
What does the tail command do?
The tail command prints the final lines of a file. The name says it all — it shows you the “tail end” of something.
Most files add new information at the bottom. Log files, for example, write the latest event last. So instead of opening the whole file, one command takes you straight to what just happened.
Think of a busy group chat on WhatsApp. You don’t read every old message from the morning. You jump to the latest one to see what just came in. The tail command does the same thing for a file — straight to the bottom.
How do I use the tail command?
The structure is simple. You write the command, then the file you want to check:
tail log.txt
Let’s break that apart:
tailis the command — it means “show the end”.log.txtis the file — the one you’re checking.
Put them together with a space in between: tail, space, log.txt. Press Enter, and only the last lines appear. No scrolling required.
Why is the tail command useful?
Because the newest stuff is usually what you want. When something just happened — an error, a new entry, the latest update — it lives at the bottom of the file.
The tail command takes you there instantly. You skip everything you’ve already seen and land exactly where the action is. For anyone working in the terminal, this saves real time every single day.
How can I try it right now?
Open a terminal and type this:
tail log.txt
Watch only the last lines show up. That’s the end of your file, shown in one quick step. If you’d like to walk through every terminal skill from scratch, follow along with the free Zero to AI Hero course — we build these foundations one small lesson at a time.
Key takeaways
- The tail command shows the last few lines of a file instantly.
- Syntax is simple:
tail filename, liketail log.txt. - It’s perfect for files where the newest information sits at the bottom, such as logs.
- It saves you from scrolling all the way down — straight to what just happened.
- Next up: making the computer print text on screen.
🚀 Take the full free course: Zero to AI Hero — learn to build with AI from scratch. New lessons daily, in Hindi & English.
Want to actually learn this?
151 free 2-minute lessons — from "what's a file?" to building with AI.
▶ Start the free course