Computer Science Atlas

Ubuntu: Show the Contents of a Text-Based File in a Terminal

May 5, 2021
Table of Contents

Step 1. Open a Terminal Session

If you're using an Ubuntu laptop or desktop, you can press Ctrl + Alt + T on your keyboard to open a new terminal window. If you're using a remote Ubuntu server, you can connect using SSH to open a new terminal session.

Step 2. Use cat

The cat program, which comes pre-installed on Ubuntu, allows you to display the contents of a text-based file (such as .html, .py, and .js files but not binary files like .jpg, .png, .pdf, etc.) in your current terminal window.

For example, if we have a Python source code file, we can display its contents in the terminal window by running:

$ cat