How to display file contents?

0115

To display the contents of a file in Linux, you can use the cat command followed by the filename. Here’s the syntax:

cat filename.txt

Replace filename.txt with the name of the file you want to display. This command will output the entire contents of the file to the terminal.

If you want to see only the first few lines of a file, you can use the head command:

head filename.txt

To see the last few lines, use the tail command:

tail filename.txt

These commands are useful for quickly inspecting files without opening them in a text editor.

0 Comments

no data
Be the first to share your comment!