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 - Linux Tutorial
From the course: Linux: System Information and Directory Structure Tools
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
-
-
-
-
-
-
(Locked)
What is a file?5m 3s
-
(Locked)
Getting information about files4m 45s
-
(Locked)
About extended attributes3m 38s
-
(Locked)
Getting extended attributes3m 55s
-
(Locked)
Reading files5m 24s
-
(Locked)
Searching in files with grep7m 25s
-
(Locked)
Archiving files with tar and cpio9m 10s
-
(Locked)
Compressing files3m 21s
-
(Locked)
-
-