Linux Beginners - Tutorial On Editors In Linux.

free web hosting
Free Web Hosting > Computers & Tech > How-To's and Tutorials > OS > Linux

Linux Beginners - Tutorial On Editors In Linux.

kanade
This is a simple tutorial on the editors in Linux.

I use these 3 editors for programming on linux:
1. vi -- available in all Linux and unix box, used to edit
2. vim -- not in all Linux flavors and it has got default coloring of key words feature, used to edit
3. view --Its used only to view, recommended to use for viewing of system config files, as it should not get edited without your notice.

Following are the basic commands comes handy with these editors

#Open a file for edit
$ vi test -- creates a file if file is not exist in the current directory
$ vim test.cpp -- key words will be in different colors

#Start editing the file
To edit the file press ‘i’ key , then you write your program

#To save the file and exit
After you finished editing the file press “ Esc ctrl+z ” to save file and exit.
Press “Esc ctrl+q!” to exit the file without saving the file.

# To search the word inside a file using Vi or vim
Once you’re inside the file using this command
$vi test
If you want to search word say “sample” inside your file, use this command
Press “Esc /sample” Note: sample is the word to search
To go to next word press “n” to go from top-to-bottom search
To go to next word press “shift n” or “N” to go from bottom-to-top search

# To search and replace the word inside a file using Vi or vim
I am going to give you only the useful commands to do this.
Command is to search word “sample” from top to bottom and replace with “hello” based on your confirmation[y/n].
Press “Esc” then type “ :g/sample/s//hello/gc ”

The command you typed just now will display bottom left of your screen.

This will keep on replacing “sample” with “hello” based on your
Confirmation[y/n].

# To delet the line inside a file using vi or vim
Press “Esc dd” to delete the current line (cursor pointing to).
Press “Esc 2dd” to delete 2 lines from the current line (cursor pointing to).

# To cut the line and paste it in some other place inside a file using vi or vim
Press “Esc dd” to cut the current line (cursor pointing to) and move your cursor to the point where you want to paste then press “p” to paste the line.

# To copy the line and paste it in some other place inside a file using vi or vim
Press “Esc yy” to copy the line (cursor pointing to) and move your cursor to the point where you want to paste then press “p” to paste the line.
Press “Esc 2yy” to copy two line (cursor pointing to) and move your cursor to the point where you want to paste then press “p” to paste the line.

These are the basic some of the commands mainly used to work with vi or vim.

For today this is sufficient, I will add some more based on your feedback.

 

 

 


Reply

yordan
Nice tuto, thanks. All these vi commands are of course quite obvious for most of us, the other people simply type "man vi" in a console window, but you are right, we should think about our beginners.
I would just like to add a little comment. Here you are writing a tutorial, which is supposed to be read by a lot of people. Just for politeness and for sake of this tutorial forum section, you should pay special attention to grammar and claritiness.
For instance you write "$ vi test -- creates a file if file is not exist in the current directory"
I guess that you meant "creates a file if a file with this name does not exist".
Moreover, "in the current directory is false" because we often issue "vi /etc/hosts", i.e. we edit files with absolute path, so the words "in the same directory" is false, should be "a file with the same full path name" or simple remove the "in the current directory" words.
Regards
Yordan

Reply

Floux
Interesting! It's a good tuto to remenber the use of these text editors. Thanks to wrote it!

Reply

docduke
Many people don't like vi (or vim) because it isn't "like" more modern screen-oriented editors. However, if you are going to make much use of Linux, vi is the one editor that is always there! For example, the Avira rescue CD is a Live-CD linux distribution with a built-in virus checker, in less than 60 MB. For a Linux distribution, that is very small, but it includes vi!

The essential things to remember about vi are (1) a few commands will do most basic editing. They are well covered at the start of this thread. (2) It is a keyboard-oriented editor. While many enhanced versions of vi use a mouse, it was designed, and long in development before mice became widely available. If the Linux disrtro you are using can't find your mouse, you can still use vi! (3) Even though its input emphasis is on the keyboard, not the mouse, its output is screen oriented. In fact that is the reason for its name: vi = VIsual editor. It was one of the first Linux (and Unix) editors that could do screen-oriented (visual) editing instead of line-oriented (text) editing. Actually, it can do both, though very few people now make much use of just its text commands.

If you're serious about Linux, take a little time, and learn the essential vi commands. You never know when you'll really need them! cool.gif

 

 

 


Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Recent Queries:-
  1. hp-ux tutorial- avi - 162.13 hr back. (1)
Similar Topics

Keywords : linux, beginners, tutorial, editors, linux,

  1. Adding Ttf Fonts To Your Linux
    so you can really get into gimping :) (0)
  2. Installing Photoshop 7 On Linux (fedora)
    Needs windows installation (10)
    Hi, well I've tried coping with The GIMP but could never get it to make smaller compressed file
    sizes, so I had to cheat and use Adobe Photoshop 7, however, I use to switch over to Windows to do
    this, and it was only for compressing the file, so I thought, how about getting Adobe Photoshop 7
    working with Linux (no, I am not kidding!), well here's my steps on how to do this. (tested
    and verified that it works, not completely tested though). Also working off by memory so I do
    apologise if some things aren't correct, but I know it's near enough that you....
  3. Demystifying "chmod" - Part 1
    & why viruses get so retarded on Linux (7)
    Hi, Today we are going to learn a bit about *NIX command chmod or "change mode" - which could be
    referred to as the *NIX counterpart of the MS-DOS/Windows attrib command. Our objective here is to
    understand the way File Permissions work on *NIX systems and be able to srt/change file permissions
    according to our needs. Recently there have been a lot of questions flyig around about viruses on
    *NIX systems - so along with this I'll briefly try to explain HOW the *NIX file permissions make
    it so hard for viruses to operate successfully in such an environment. We....
  4. Howto: Setup Your Own DHCP Server On Linux
    And have it to allot IPs dynamically (0)
    Howto: Setup a DHCP Server on Linux in Few Simple Steps Hi all, I'm back again with a new
    turorial - this time we're going to deal with another aspect of Linux/Windows networking - the
    DHCP Server . I'm sure all of you must have come across the term DHCP - anyone who connects to
    the internet has to come across it every now and then. You see the term even on the small setup
    instructions leaflets that accompany the dial-up internet packages from most of the ISPs. DHCP is
    what allots you a unique IP address everytime you dial out to your ISP. Here's ....
  5. Linux Tutorials List
    Lets all chip in... (0)
    Hi all /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /> Lets all chip
    in an maintain the most complete list of Linux Tutorials here. I believe there's a similar post
    somewhere in one of the OS Forums - admins, it would do good if you could move it in here. Thanks.
    Here's one for a starter - for user's migrating from Windows to Linux, the IBM
    Windows-to-Linux Roadmap Series: http://www-106.ibm.com/developerworks/linu.../l-roadmap.html ....
  6. Howto: Setup Windows NT/2K Domain Using SAMBA
    and make Windows 2000 Logon to Linux (9)
    Howto: Setup and emulate a Windows NT Domain on Linux and make Windows 2000/XP log on
    =========================================================================== HI all, I'm
    back with another Tutorial in the Linux series. This time we're going to with an issue that is
    very common in everyday networking and is implemented almost everywhere in some form or the other.
    The primary issue here is to make two DIFFERENT Operating Systems talk to each other over the
    network and synchonize and share files without letting off any hint about the complex protocols i....
  7. Howto: Domain Name Server On Linux
    DNS for your Intranet (or Internet) Serv (7)
    HOWTO: Setup a Local Domain Name Server (DNS) for your Intranet
    ==================================================================== Experimentation Platform:
    ------------------------- Intel P4 3.0Ghz (Intel MB) 1 GB RAM 2 x 80 GB HDD on RAID 1 (Disk
    Mirroring) - alloted entirely to Linux OS: ------------------------- Linux - Redhat Enterprise AS
    Server v3 Note: a. I was trying to setup the system so that later on when my server goes
    online, I don't have to modify much to make my nameservers work with the internet - so I used my
    registered domain "mi....
  8. Hotkeys / Keyboard Quick Launch Keys In Linux
    (5)
    I first submitted this tutorial a couple of months ago over at http://linuxiso.org/forums as user
    adpsimpson. Having spent ages wishing the hotkeys on my laptop would work, I spent most of an
    afternoon looking into it. Since no site I found explained it satisfactorily, here's my
    method... The first step is to find out which of the keys are registered by the kernel, and what
    their keycodes are (the unique event number that they cause). To do this you need a program called
    xev, (in Mandrake this is part of X11R6-contrib, is installed by default in Slack, and should....
  9. Using Ntloader To Boot Linux
    Win2K or XP, should work with most Linux (3)
    Basically what we're going to do with NTLoader is use NTLoader to boot into Linux's
    bootloader which then boots Linux, why someone would do that when Grub works perfectly fine booting
    Windows on NTFS? Who knows what reason other than it could destroy their MBR and make both OS
    inaccessible or at least render Linux useless till it's recovered, NTLoader is not specifically
    designed to boot other Operating Systems other than Windows. We will be using 2 Hard Drives, this
    is not necessary, we could use 2 partitions on a hard drive, but we should have the Operati....
  10. Networking Linux and Windows
    (4)
    For the life of me I can not figure out how to go about mounting my Windows share on my Linux box.
    I read somewhere that I needed to use Samba so I got that and I have no clue what to do. I am not
    very experienced with Linux and am using RedHat so if you could dumb it down and go through it step
    by step it would be great. Thanks alot.....
  11. Linux - which distributiuon?
    (18)
    I'm wondering what distributions of Linux do you like most. Please make some comments on
    distribution you like so everybody will know its adventagies.....
  12. Linux/Gnu
    (3)
    hmmm I am a friend of Gnu/Linux itself. I like the concept of Gnu/Linux, but as I have used Linux
    for a long time I have noticed that the hardware support is not the best. You can read which
    hardware is supported, but this is not the best way because if your printer e.g is claimed to be
    supported by cups on their website, it's not ensured that this printer is really supported. I
    had so many printers, which should run with cups (only an example) and at the end these printers
    then print pure crap . Another example are graphic adapters...I have 3 different cards and e....
  13. Some one know how to install my scanner
    Hp psc 1210 in linux suse (2)
    I have problen whit my Scanner the system detect this of hp scanjet all-in-one but this don't
    are scanjet this are PSC 1210, and I don't know how he does that. I browsing in google.com/linux
    for the driver and to in Hp.com but don't exist this drivers. You know where I download this
    drivers. /tongue.gif' border='0' style='vertical-align:middle' alt='tongue.gif' />
    /tongue.gif' border='0' style='vertical-align:middle' alt='tongue.gif' /> /tongue.gif'
    border='0' style='vertical-align:middle' alt='tongue.gif' /> /biggrin.gif' border='0'
    style='vert....
  14. looks himself linux
    Don't fear him. (1)
    Is enough seemed to windows pruevalo.....
  15. Linux is well supported.
    Belive it or not (2)
    Believe it or not, it may be a lot easier to get patches and updates for Linux than for any
    proprietary operating system! The answer to a problem often comes back within a few hours after
    sending a message to some newsgroup or mailing list. Moreover, drivers for Linux are usually
    available a few weeks after new hardware products have been introduced on the market. By contrast,
    hardware manufacturers release device drivers for only a few commercial operating systems, usually
    the Microsoft ones. Therefore, all commercial Unix variants run on a restricted subset of hard....
  16. Linux is highly compatible
    with many common operating systems. (0)
    It lets you directly mount filesystems for all versions of MS-DOS and MS Windows, SVR4, OS/2, Mac
    OS, Solaris, SunOS, NeXTSTEP, many BSD variants, and so on. Linux is also able to operate with many
    network layers like Ethernet, Fiber Distributed Data Interface (FDDI), High Performance Parallel
    Interface (HIPPI), IBM's Token Ring, AT&T WaveLAN, DEC RoamAbout DS, and so forth. By using
    suitable libraries, Linux systems are even able to directly run programs written for other operating
    systems. For example, Linux is able to execute applications written for MSDOS, MS Win....
  17. Linux is fully customizable in all its components.
    but is don't ease (0)
    Thanks to the General Public License (GPL), you are allowed to freely read and modify the source
    code of the kernel and of all system programs. Several commercial companies have started to support
    their products under Linux, most of which aren't distributed under a GNU Public License.
    Therefore, you may not be allowed to read or modify their source code.....
  18. Linux offers the following advantages over its com
    Linux is free. (0)
    8 You can install a complete Unix system at no expense other than the hardware (of course).....
  19. Linux Versus Other Unix-Like Kernels
    This is a Littler History (0)
    6 The various Unix-like systems on the market, some of which have a long history and may show signs
    of archaic practices, differ in many important respects. All commercial variants were derived from
    either SVR4 or 4.4BSD; all of them tend to agree on some common standards like IEEE's POSIX
    (Portable Operating Systems based on Unix) and X/Open's CAE (Common Applications Environment).
    Understanding the Linux Kernel 7 The current standards specify only an application programming
    interface (API) that is, a well-defined environment in which user programs should run. T....
  20. You Can Learn Linux: This Is A Little History
    (0)
    Linux is a member of the large family of Unix-like operating systems. A relative newcomer
    experiencing sudden spectacular popularity starting in the late 1990s, Linux joins such well-known
    commercial Unix operating systems as System V Release 4 (SVR4) developed by AT&T, which is now owned
    by Novell; the 4.4 BSD release from the University of California at Berkeley (4.4BSD), Digital Unix
    from Digital Equipment Corporation (now Compaq); AIX from IBM; HP-UX from Hewlett-Packard; and
    Solaris from Sun Microsystems. Linux was initially developed by Linus Torvalds in 1991 as an....
  21. "Demo" of Linux
    Knoppix (7)
    I found something interesting out here. For all us Windows-users who want to try Linux but
    can't, let me introduce Knoppix . I haven't tried it myself, and I'm a Windows user,
    but I certainly will try at some point.....
  22. Mplayer in Linux
    Best of Windows Media Player (4)
    Yes the program Mplayer is best of windows media player. You can download that every codec pack and
    skins. These program open your movies faster, and it does't matter that type be: DVD, VCD, AVI,
    ASF, MPG, DivX and XviD. These player is faster and ease for use. Ty it I assure you that pleased
    you. But it's only under Linux Use. this the screenshut:
    http://www.radikalsoft.com/img/Mplayer.jpg And you dont need to modific your region of DVD because
    mplayer have regionfree.....
  23. How to make your life in Linux most ease
    My life in Linux is now ease (18)
    The you can do is chage your linux to SuSE 9.1, These linux meke all for you. He install your modem,
    printer well your every hareware. The it brings software as mplayer to see movies (these are similar
    to Media Player), Xmms to play musicb (these are similar to Winamp), Kopete for every messengers,
    K3B for write yoour cd's and dvd's (these are similar to Nero), Mozilla (these are similar
    to Nestcape). And the best is that you do not have to pay for the lisence its free. And SuSE heve
    good games that Unreal tournamend, Quake 3, Medal of Honor and Wolfenstein Enemi....
  24. Running Linux on slow computers
    (7)
    I'm wondering if Mandrake 9.2 with X can be used on slow machine like: Pentium 350, 64mb ram,
    2mb graphic card. I don't want to install any servers (ssh maybe).....
  25. To all Linux users
    Linux counter for all Linux users (5)
    All Linux users, Linux community has a Linux counter which keeps track for Linux usuage all over
    the world. This counter is counting for since years and is still counting. All of you Linux users,
    should register that at http://counter.li.org/ It's run by a nonprofit membership
    organization called the Linux Counter Project. And BTW, I'm not affiliated with them. I just
    happen to be a Linux user for over 6 years.....
  26. FreeBSD? Linux?
    (2)
    Hi all. I've been working on Mandrake, RedHat. Now I use FreeBSD. Seem to be very robust and
    stable. Everything you can get from one point - it's ports collection on www.freebsd.org. One
    problem - there is no ALSA driver for it. What do you think about FreeBSD and Linux?....
  27. Linux
    (9)
    Linux is one of my favorite OS out there. It seems to have none of the problemes that windows have.
    Liux is free and I really like that free always equals good. But sometimes when I coldboot I takes
    forever to finally run .....

    1. Looking for linux, beginners, tutorial, editors, linux,

Searching Video's for linux, beginners, tutorial, editors, linux,
advertisement




Linux Beginners - Tutorial On Editors In Linux.



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE