If I were to choose one of the main reason why people use PCs, I would definitely say for writing. With a computer and a word processing program, cross outs, white out and crumpled up paper has disappeared forever. Linux is just as well suited for word processing as any other operating system. There are several excellent word processing programs for Linux like AbiWord, KWord, part of the KOffice suite and the OpenOffice.org suite's word processor. We'll talk about these kinds of programs in a later lesson. First, we should talk about the terminal mode text editors that are available for Linux.
Why use a text editor? A text editor is just like a word processor without a lot of features. All operating systems come with a basic text editor. Linux comes with several. The main use of a text editor is for writing something in plain text with no formatting so that another program can read it. Based on the information it gets from that file, the program will run one way or another.
The text editor "vi" The most popular text editor for Linux is called 'vi'. This is a program that comes from UNIX. There is a more recent version called 'vim' which means 'vi improved'. The problem with 'vi' or 'vim' is that a lot of people don't like it. You have to remember a lot of key combinations to do stuff that other text editors will do for you more easily. We should go through some basic 'vi' commands, because I have found that 'vi' is good if I want to get into a text file quickly and change something or I want to write a short note to myself. I generally do not use "vi" for anything that requires more than about 30 seconds of work, but there are people who swear by 'vi' and do all kinds of things with it like designing entire websites.
Working with 'vi' Let's make a text file. Type:
You'll see a line of tildes down the left side and the name 'tryvi' at the bottom and [new file].
To write something, you have to press ESC and the 'i' key (i for insert). Even if you don't press 'ESC-i' it usually gets the idea that you want to type something and lets you do it after a few keystrokes. You should get used to the 'ESC-i' keys so you don't end up writing 'ar John' instead of 'Dear John'. Press ESC + 'i' then type: hello vi
If you wrote jello vi or jello bi or something I don't want to know about, you can always erase your mistakes with the backspace key.
To save this file, you would press ESC then the colon key ':' then 'w' (write)
To save the file and quit vi, you would press ESC, ESC the colon key ':' then wq (write, quit)
To quit without saving, press ESC, ':' then 'q'. Vi may protest if you've written something and you don't want to save it. If you press ESC ':' 'q!' with an exclamation point, vi will accept it and not save your changes.
That's vi in a nutshell, or more like a sesame seed. There are a lot of commands in vi - and you may explore those on your own at a later date, on your own terms and in the privacy of your own home.
Using 'joe' 'joe'- sounds like a comic strip. Actually, they are two other text editors that I like and I think are a little easier to manage. They're like 'vi' in that you use them to create and edit non-formatted text, but they're a little more user-friendly. Using 'joe' 'joe' was created by Joseph Allen, so that's why it's called Joe. I suppose if his name had been Hrothgar Allen, it would have been called 'hroth'.
To use 'joe', you could type:
You won't see the tildes like vi. It looks a little friendlier. The majority of joe's commands are based on the CTRL-K keys and a third key. The most important of these is CTRL-K-H which gets you 'help'. Help shows you the key combinations to use with 'joe'.
The most important thing about 'joe' is the logical concept that you can just start writing if you want. Try writing anything you want.
To save it, press CTRL-K-D. To save and quit, CTRL-K-X.
To quit without saving, CTRL-C, (without the K).
If you want to see the other features of 'joe', press CTRL-K-H, as I mentioned before.
My favorite little added feature of 'joe' is that if you edit a file again, it will save the previous file with a tilde on the end, like 'tryjoe~' That little tilde file has saved my life a couple of times. (well, maybe not my life) But it has saved me a lot of work. I've made some changes to a file and then found out that wasn't a good idea. I could always fall back on the tilde file, which is a copy of your previous edit.
'joe' is a very good option for writing those short text files that you'll need.
'pico' is another friendly text editor. If you type:
You'll see the commands you need in 'pico' specified at the bottom. You can just start writing anything you want.
To save the file, press CTRL-o. To save and quit or to just quit, press CTRL-x
Pico will always ask you if you want to do what you're doing. That's good. Questions like that will keep you from sending a file into non-existence without wanting to. All the other commands you'll need are at the bottom of the page.
Well, this is our little overview of the main text editors available for Linux. In our next lesson, we're going to need to use one in order to make our work in Linux a little bit safer and easier.