Question 3.7: Viewing the Contents of a File You want to view the contents......

Viewing the Contents of a File

You want to view the contents of a small file without editing it.

Step-by-Step
The 'Blue Check Mark' means that this solution was answered by an expert.
Learn more on how do we answer questions.

Use the cat or more commands to view the file.

For example:

$ more myfile.txt
This file contains
some text

Discussion

The cat command displays the whole contents of the file, even if it is longer than will fit on the screen.

The more command just displays one screen of text at a time. Press the space bar to display the next screen.

See Also

You can also use cat to concatenate (join together) a number of files (Recipe 3.28).

Another popular command related to more is less. less is like more except it allows you to move backward in the file as well as forward.

Related Answered Questions

Question: 3.34

Verified Answer:

Use the Linux df command: $ df -h Filesystem   ...
Question: 3.33

Verified Answer:

Use the Linux date command. The date and time form...
Question: 3.32

Verified Answer:

Edit the file ~/.bashrc using nano (Recipe 3.6), a...
Question: 3.31

Verified Answer:

Run the program or command in the background using...
Question: 3.30

Verified Answer:

Redirect the output to /dev/null using >. For e...
Question: 3.24

Verified Answer:

Use the Task Manager utility, which you’ll find on...
Question: 3.29

Verified Answer:

Use the pipe command, which is the bar symbol (|) ...
Question: 3.27

Verified Answer:

Use the > command to redirect output that would...
Question: 3.28

Verified Answer:

Use the cat command to concatenate a number of fil...
Question: 3.26

Verified Answer:

Use the lsusb command. This will list all the devi...