I decided that the best way to illustrate some common Linux utilities was to describe a session that used them in a natural fashion. One of my hobbies is to compose music, and I often use the Linux system to write lyrics for my songs. The next few sections are a running commentary on the Linux utilities that I used to create a final version of one of my song's lyrics, called "Heart To Heart." Figure 3-6 shows the approximate series of events that took place, together with the utility that I used at each stage.
Figure 3-6. Script of upcoming examples.
Action | Utility |
---|
I displayed my current working directory. | pwd |
I wrote the first draft and stored it in a file called "heart." | cat |
I listed the directory contents to see the size of the file. | ls |
I displayed the "heart" file using several utilities. | cat, more, page, head, tail |
I renamed the first draft "heart.ver1." | mv |
I made a directory called "lyrics" to store the first draft. | mkdir |
I moved "heart.ver1" into the "lyrics" directory. | mv |
I made a copy of "heart.ver1" called "heart.ver2." | cp |
I edited the "heart.ver2" file. | vi |
I moved back to my home directory. | cd |
I made a directory called "lyrics.final." | mkdir |
I renamed the "lyrics" directory to "lyrics.draft." | mv |
I copied the "heart.ver5" file from "lyrics.draft" to "lyrics.final," renaming it "heart.final." | cp |
I removed all the files from the "lyrics.draft" directory. | rm |
I removed the "lyrics.draft" directory. | rmdir |
I moved into the "lyrics.final" directory. | cd |
I printed the "heart.final" file. | lpr |
I counted the words in "heart.final." | wc |
I listed the file attributes of "heart.final." | ls |
I looked at the file type of "heart.final." | file |
I obtained a list of my groups. | groups |
I changed the group of "heart.final." | chgrp |
I changed the permissions of "heart.final." | chmod |