8.1 Linux Advanced Text Processing Tools
/usr/games/banner -w79 "Happy Birthday, Marie" > marie.txt
Create an ascii "banner" with the width of 79 characters. The output is sent to file marie.txt. Funny, old-fashioned tool. Another utilty for asci text art is figlet. E.g. figlet "Funny!" produces this on in my terminal (I always use a fixed-size font to display ascii art):
_____ _
| ___| _ _ __ _ __ _ _| |
| |_ | | | | '_ \| '_ \| | | | |
| _|| |_| | | | | | | | |_| |_|
|_| \__,_|_| |_|_| |_|\__, (_)
|___/
script
Start logging my current session in the text terminal into a text file typescript (this is the default filename). The logging finishes when I type exit or press <Ctrl>d. Then, I can raname, email (or whatever I want to do with it) the file typescript.
emacs&
(in X-terminal) The emacs text editor. Advanced and sophisticated text editor. Seems for gurus only: "emacs is not just an editor, it is a way of living". Emacs surely seems rich or bloated, depending on your point of view. There are likely 3 versions of emacs installed on your system: (1) text-only: type emacs in a text (not X-windows) terminal (I avoid this like fire) ; (2) graphical-mode: type emacs in an X-windows terminal (fairly usable even for a newbie if you take some time to learn it) ; and (3) X-windows mode: type "xemacs" in an X-windows terminal.
vi
The famous (notorious?) "vi" text editor (definitely not recommended for newbies). To exit "vi" (no changes saved) use these five characters: <ESC>:q!<Enter> I use the "kate&" (under X) or "pico" (command line) or "nano" (command line) text editors and don't ever need vi (well, unless I have to unmount the /usr subsystem and modify/edit some configuration files, then vi is the only editor avialable). To be fair, modern Linux distributions use vim (="vi improved") in place of vi, and vim is somewhat better than the original vi. The GUI version of vi is also available (type gvim in an X terminal). Here is one response I have seen to the criticism of vi interface being not "intuitive": "The only intuitive interface is the nipple. The rest must be learned." (Well, so much for MS Windows being an "intuitive" interface.)
Experts do like vi, but vi is definitely difficult unless you use it very often. Here is a non-newbie opinion on vi (http://linuxtoday.com/stories/16620.html):
"I was first introduced to vi in 1988 and I hated it. I was a freshman in college... VI seemed archaic, complicated and unforgiving... It is now 12 years later and I love vi, in fact it is almost the only editor I use. Why the change? I actually learned to use vi... Now I see vi for what it really is, a powerful, full featured, and flexible editor..."
For your entertainment, you might want to try the even more ancient-looking line-editor ed (just type ed on the command line). Tools like these, however "inconvenient" in interactive use, can be very useful for automation of manipulation of files from within another program.
Brief Introduction to vim (="visual editor improved") which is a modern Linux version of vi. The main reason why a newbie like myself ever needs vi is for rescue--sometimes it is the only editor available. The most important thing to understand about vi is a "modal" editor, i.e., it has a few modes of operation between which user must switch. The quick reference is below, the 4 essential commands are in bold.
The commands to switch modes:
The key Enters the mode Remarks
<ESC> command mode (get back to the command mode from any editing mode)
i "insert" editing mode (start inserting before the current position of the cursor)
DO NOT PRESS ANY OTHER KEYES IN THE COMMAND MODE. THERE ARE MORE COMMANDS AND MODES IN THE COMMAND MODE!
Copying, cutting and pasting (in the command mode):
v start highlighting text. Then, move the cursor to highlight text
y copy highlighted text
x cut highlighted text
p paste text that has been
* License

