Editing text filesin Linux Red Hat

an article added by: Daniel K. at 11282007


In: Root » Computers and technology » Linux Commands » Editing text filesin Linux Red Hat

French Spanish Portuguese Italian German Japanese Chinese Korean Russian Arabic

Editing Text Files

Editors are by the far the bulkiest of common tools, but they are also the most useful. Without them, making any kind of change to a text file would be a tremendous undertaking. Regardless of your Linux distribution, you will have gotten a few editors. You should take a few moments to get comfortable with them before you’re busy fighting another problem.

NOTE

Although all of the editors listed here come with Red Hat 8, not all of them are installed by default. You may have to specifically install one that you find you like and isn’t one of the defaults.

vi

The vi editor has been part of UNIX-based systems since the 1970s, and its interface shows it. It is arguably one of the last editors to actually use a separate command mode and data entry mode; as a result, most newcomers find it unpleasant to use. But before you give vi the cold shoulder, take a moment to get comfortable with it. In difficult situations, you may not have a pretty graphical editor at your disposal, and vi is ubiquitous across all UNIX systems. The version of vi that ships with Linux distributions is VIM (VI iMproved). It has a lot of what made vi popular in the first place and many features that make it useful in today’s typical environments (including a graphical interface if X is running). To start vi, simply type

    [michael@workbox michael]$ vi

The easiest way to learn more about vi is to start it and enter :help. If you ever find yourself stuck in vi, press the ESC key several times and then type :qu! to force an exit without saving. If you want to save the file, type :wq.

emacs

It has been argued that emacs is an operating system all by itself. It’s big, feature-rich, expandable, programmable, and all-around amazing. If you’re coming from a GUI background, you’ll probably find emacs a pleasant environment to work with at first. On its cover, it works like Notepad in terms of its interface. Yet underneath is a complete interface to the GNU development environment, a mail reader, a news reader, a web browser, and even a psychiatrist (well, not exactly).

To start emacs, simply type

    [michael@workbox michael]$ emacs

Once emacs has started, you can visit the psychiatrist by pressing ALT-X and then typing doctor. To get help using emacs, press CTRL-H. If you want to save a file press CTRL-X and then CTRL-S. To exit emacs, use CTRL-X followed by CTRL-C.

joe

Of the editors listed here, joe most closely resembles a simple text editor. It works much like Notepad and offers on-screen help. Anyone who remembers the original WordStar command set will be pleasantly surprised to see that all those brain cells hanging on to CTRL-K commands can be put back to use with joe. To start joe, simply type

    [michael@workbox michael]$ joe

pico

The pico program is another editor inspired by simplicity. Typically used in conjunction with the pine mail reading system, pico can also be used as a stand-alone editor. Like joe, it can work in a manner similar to Notepad, but pico uses its own set of key combinations. Thankfully, all available key combinations are always shown at the bottom of the screen. To start pico, simply type

    [michael@workbox michael]$ pico

legal disclaimer

Our website is not responsible for the information contained by this article. Web-articles is a free articles resource.
Suggestion: If you need fresh, daily updated content for your website, feel free to use our service. Click here for more information.

related articles

1. Linux is built upon the foundation of file systems
File Systems Linux is built upon the foundation of file systems. They are the mechanisms by which the disk gets organized, providing all of the abstraction layers above sectors and cylinders. In this module, you’ll learn about the composition and management of these abstraction layers supported by the default Linux file system, ext2, and its more robust counterpart, ext3. This module covers the many aspects of managing disks. This includes creating partitions, establishing file systems, automating the process ...

2. Mounting and Unmounting Local Disks
Linux’s strong points include its flexibility and the way it lends itself to seamless management of file locations. Partitions are mounted so that they appear as just another subdirectory. Even a substantial number of file systems look, to the user, like one large directory tree. This characteristic is especially helpful to the administrator, who can relocate partitions to various servers but can have the partitions still mounted to the same location in the directory tree; users of the file system need not know abou...

3. The fsck tool short for File System ChecK
Using fsck The fsck tool, short for File System ChecK, is used to diagnose and repair file systems that may have become damaged in the course of daily operations. Such repairs are usually necessary after a system crash in which the system did not get a chance to fully flush all of its internal buffers to disk. (Although this tool’s name bears a striking resemblance to one of the expressions often uttered after a system crash, that this tool is part of the recovery process is strictly coincidence.) Us...

4. The process of adding a disk under Linux on the Intel
Adding and Partitioning a Disk The process of adding a disk under Linux on the Intel (x86) platform is relatively easy. Assuming you are adding a disk that is of similar type to your existing disks (e.g., adding an IDE disk to a system that already has IDE drives or adding a SCSI disk to a system that already has SCSI drives), the system should automatically detect the new disk at boot time, and all that is left is partitioning it and creating a file system on it. If you are adding a new type of disk (...

5. With the partitions created you need to put file systems on them
Syncing disks. WARNING: If you have created or modified any DOS 6.x partitions, please see the fdisk manual page for additional information. [root@tedford /root]# If you needed to write an /etc/fstab file yourself for this configuration, it would look something like this: /dev/hdb1 / ext3 defaults 1 1 /dev/hdb2 swap swap defaults 0 0 /dev/hdb3 /usr ext3 defaults 1 2 /dev/hdb5 /home ext3 defaults 1 2 /dev/hdb6 /var ext3 defaults 1 2 /dev/hdb...

6. Mounting NFS partitions works much the same way as mounting local partitions
Mounting NFS Partitions Mounting NFS partitions works much the same way as mounting local partitions. The only difference is in how the partition is addressed. On local disks, partitions are addressed by their device name, such as /dev/hda1. In NFS mounts, partitions are referenced by their hostnames and export directories. Thus, if the server named ungerer is allowing your host to mount the directory /export/SL1200/MK2 and you want to mount this to /projects/topsecret1, you would use this command:...

7. Using autofs to mount partitions across the network
Starting the autofs Service Because the way you’re using autofs to mount partitions across the network relies on NFS, before using it you’ll need to be sure you can do normal NFS mounts. Once you have this working, just make a simple change to your startup scripts to deploy the autofs service. The easiest way to do this is to run the redhat-config-services utility to enable the daemon. Simply start the configuration tool and mark the autofs check box as shown. If you need to start autofs by hand...