• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

which command is used ot view file in linux.

 
srikanth sankurthi
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
which command is used ot view file in linux.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are many. Depending on what you mean by 'view'. For example, you can use 'vi'.
 
srikanth sankurthi
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To view the content of the file.
And also let me know the difference between cat and vi commands.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Learn to use the "man" command.
-> man cat
-> man vi

"cat" will outputs the content of the file, while "vi" is an editor which allows you to edit the file. Apparently, "vi" is a bit to early to use.
 
Anayonkar Shivalkar
Bartender
Posts: 1557
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
srikanth sankurthi wrote:which command is used ot view file in linux.

As Christophe mentioned, there are various editors available for Linux (not 'linux') based distros.

It depends on what kind of system you are using.

Are you connecting to a system via terminal? Do you have to work explicitly via command line? In that case vi editor can be useful.

If you are working with some desktop environment, then you can use gedit, kedit, emacs and so on.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15205
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
srikanth sankurthi wrote:And also let me know the difference between cat and vi commands.

cat just prints the content of the file to the terminal window. vi is a text editor.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17989
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, the commonly-used command to view text files is the "more" command, which provides a paged view of the file (cat just dumps the whole thing to the console, where it can roll off the screen).

An improved version of "more" is named "less", and that program can also scroll the display backwards. "more" can only go forwards.

I don't recommend using editors such as "vi" to view files. You might accidentally alter the file.
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
srikanth sankurthi wrote:which command is used ot view file in linux.


Which kind of file? Java-source/textfile, (less, cat, gedit, nano, mcedit, vi, emacs), image (eog, gimp, ...), video (vlc, mplayer, gxine, ...), pdf (xpdf, evince, acroread), zip, mp3, rar, xml, ...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic