How do we view the contents of an individual file in our terminal? We can use cat.

The cat command outputs the contents of a specified file. For example, running the following inside the movies/ directory:

cat genres.txt

will output all the text from genres.txt.

This is a useful command for peeking at files without opening them, and confirming the result of other commands that change the contents of files.

We can also get output using paths to a specified file. To output the contents of batman.txt within the action directory, we can run:

cat action/batman.txt

This will output the contents of batman.txt within the action/ directory.

Try it out below!



Start by moving into the action/ directory. Once there, output the contents of superman.txt.

Make sure to click the Check Work button once you’ve completed each checkpoint.


While inside the action/ directory, output the contents of terminator.txt, which is inside the scifi/ directory.

Sign up to start coding

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?