Modern Tools for Enhanced File Exploration
Note: Compared to cat (basic file display), bat offers syntax highlighting and Git integration, making file viewing more intuitive for beginners.
Open your terminal and create a new file called example.txt with some content:
$ echo "Hello World" > example.txt
$ echo "This is a test" >> example.txt
Now, let’s use cat to display the contents of the example.txt file:
$cat example.txt
The output will be:
Hello World
This is a test
Introduction to Bat
Bat is a command to display files with syntax highlighting. It’s a more advanced version of cat.Bat Options
Bat has several options that can be used to modify its behavior. Here are a few examples:
-loption: Display line numbers-poption: Display the contents of the file with syntax highlighting
Let’s use bat with the -p option to display the contents of the example.txt file:
$ bat -p example.txt
The output will be:
1 | Hello World
2 | This is a test
Notice the syntax highlighting and line numbers.
Using Cat and Bat Together
Let’s use cat and bat together to display the contents of multiple files:
$ cat example.txt another_file.txt | bat -p
This will concatenate the contents of example.txt and display them with syntax highlighting.

Practice Exercises
- Create a new file called
hello.shwith the following content:
$ echo "Hello World"
Use cat to display the contents of the hello.sh file.
- Use bat to display the contents of the
hello.shfile with syntax highlighting. - Create a new file called
file1.txtandfile2.txtwith some content. Use cat and bat together to display the contents of both files.
Glossary of Commands and Tools
Reference: For detailed documentation on linux system commands , visit Linux Manpages.
| Command/Tool | Description |
|---|---|
| ls | Lists directory contents. |
| file | Identifies file types. |
| less | Views file contents one screen at a time. |
| cat | Displays or concatenates file contents. |
| bat | Enhanced cat with syntax highlighting. |
| head | Shows the first lines of a file. |
| tail | Shows the last lines of a file. |
| find | Searches for files by criteria. |
| grep | Searches text within files. |
| dust | Colorized disk usage summary. |
| duf | Visual disk usage for mounted filesystems. |
| ncdu | Interactive disk usage analyzer. |
| fd | Faster alternative to find. |
| ripgrep | Speedy alternative to grep. |
Conclusion
You’ve learnt the basics of Linux system commands for file exploration, from ls to ripgrep. Practice these to manage files confidently.
That’s it for Chapter 3, where we learnt Linux System Commands ! In the next chapter, we’ll dive into manipulating files—creating, copying, moving, and deleting them. Until then, practice exploring your system and getting comfortable with these commands.