Ask your own question, for FREE!
Computer Science 16 Online
OpenStudy (anonymous):

Should I use cat or less for viewing text files in Unix?

OpenStudy (anonymous):

cat [file] prints the file to stdout, whereas less [file] opens it up for viewing, like a manpage

OpenStudy (anonymous):

you said what i wanted to say, so why you asking? lol

OpenStudy (anonymous):

I don't know which is the best option :(

OpenStudy (anonymous):

i never use cat for viewing because it will spam my terminal but maybe you need sometimes to print something to terminal then you can use it

OpenStudy (anonymous):

It depends on the context where you use the file to display.. you can even use VI filename on the terminal to see as well as edit just like edit in windows..

OpenStudy (rsmith6559):

If two commands are equivelant to you, the better one is in the /bin directory (as opposed to /usr/bin or /usr/local/bin), or on the recovery disk for your system. That way, if things go south, you won't be "out of your usual" while trying to repair it.

OpenStudy (anonymous):

Less is better

OpenStudy (farmdawgnation):

Use both! cat filename | less :D

OpenStudy (anonymous):

I agree that it depends on the context. If the file is small, cat it because less requires an extra keystroke to escape. If the file is larger and you need to jump to a specific section, less is better. Now if you just want the end of a file, you can use tail. The various options exist because they each have their use.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Breathless: Spooky witch but cute
5 hours ago 3 Replies 0 Medals
Arriyanalol: help
5 hours ago 10 Replies 2 Medals
Arriyanalol: @tinydinoUwU stop trying to find a argument u blad lil boy
1 day ago 5 Replies 4 Medals
Jaded012023: Please tell me what you all think of this song
8 hours ago 6 Replies 1 Medal
Arriyanalol: bro how
8 hours ago 2 Replies 3 Medals
Arriyanalol: cant wait for the new bluey movie in 2027
1 day ago 12 Replies 2 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!