Wednesday, February 15, 2006

Viewing and Editing Files in Linux

You can use both GUI based and command line based editior.

Some GUI based popular editors are :
1) Kate : Heavy but ithas a lot of features.I prefer to use this one for any long code.
2) Kwrite :Light (uses less reqources than Kate)
3) Kedit : Very light Editor which is good from small programs only.Less feautred than Kate.

There are varous command line editior.Some of the most popular one are :
1) VIM editior
2) PICO editor
3) Emacs editor

I prefer to use VIM over these editors though all are equally good editors.

Please go through the documentation of each editor if you want to know more:
$man vim
$man pico
$man emacs

Commands for viewing and editing:
cat filename Dump a file to the screen in ascii.
more filename Progressively dump a file to the screen: ENTER = one line down
SPACEBAR page down q=quit
less filename Like more, but you can use Page-Up too. Not on all systems.
vim filename Edit a file using the vi editor. All UNIX systems will have vi in some form.
emacs filename Edit a file using the emacs editor. Not all systems will have emacs.
head filename Show the first few lines of a file.
head -n filename Show the first n lines of a file.
tail filename Show the last few lines of a file.
tail -n filename Show the last n lines of a file.

Something about vim editor:
1) Opening the file ==> vim
2) Writting in file ==> press " I "
3) Removing whole line ==> ESC then Press " DD " (double d)
4) Saving the file ==> ESC then " :wq "
5) Saving without changing ==> ESC then " :q! "
6) Closing a file ==> ESC then " :q "
7) Searching in a file ==> ESC then "/word"

You can mail me personally at sansor@iitk.ac.in and can visit website which is daily updated by me http://www.geeksclass.tk or www.linux4u.co.nr

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home