This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

which command is used ot view file in linux.

 
srikanth sankurthi
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
which command is used ot view file in linux.
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • 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
  • 0
  • 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
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 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
  • 0
  • 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
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • 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: 17620
39
Android Eclipse IDE Linux
  • 0
  • 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
  • 0
  • 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, ...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic