From the course: Linux: System Information and Directory Structure Tools

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Reading files

Reading files

- [Instructor] Any command output that goes through the screen can be saved as a file using a redirect as well as sent to other commands using a pipe. For this demonstration, I'll use the journalctl command that shows system messages. Type into a terminal journalctl and hit enter. This output's a lot of useful information that you might want to save somewhere. To redirect a screen output to a file, just append the line with a greater than symbol and a file name, press control C, and then bring your line back and add > space journal.txt and hit enter. To view this file, you can use several commands, the simplest being cat. Type in cat journal.txt, and hit enter. This was the output on the screen exactly like the journalctl command did. If you want to view this file in reverse order, you can use the tac command instead of cat. tac is cat backwards. Very clever. Type in tac journal.txt and hit enter. If you want…

Contents