-2

I'm wondering how to read the contents of a file, for instance, I have a text file containing the words hello world and I want to read this file without using a text editor. What can I do?

0
3

There are number of commands which you can use to read the file in terminal without using a text editor. My favorites are "less" & "more". You can also use cat as suggested by Scorch.

Uses:

more <file_name>
less <file_name>
cat <file_name>

You can also check man pages for more details.

1

I use the command cat for this.. Ok so here are the contents of hello.txt:

Hello World

Now you open terminal and cd into the directory in which hello.txt is located and type cat hello.txt and the output will (or should) be: Hello World.

Not the answer you're looking for? Browse other questions tagged or ask your own question.