A couple of Unix exercises
Electronic mail or email is an important part of a student's daily life since a a great
deal of information is distributed this way. Here follows a small exercise.
- Start pine
- Compose a new mail
- Send an e-mail to yourself with the subject: I can email!
- Quit pine
- Start pine again
- Choose Folder Index
- Read the mail that you did just send
- Remove the mail
- If you like to, do all of the above with mutt
When you are going to start using Unix in the future you will probably use
kind of editor. An editor is a program used to edit text, like notepad in
windows but much more powerful.
Here are some examples of editors, with all of them having their specific
pros and cons. You will probably hear people telling you that editor X is
better than editor Y all the time in the following weeks. However, pay these
people no attention, but try to learn each editor before making up your mind
on which editor to use.
Feel free to try all these editors; how to start, open/save files and quit.
- Start pico, exit by pressing Ctrl+x.
- Start emacs, through the menu (if you're in X). If you are not
in X it's exited by pressing Ctrl+X and then Ctrl+c
- Start xemacs (can only be started in X), exit through the menu
- Start nedit, (can only be started in X), exit through the menu
- Start vim and exit by pressing ESC and then write :q
and then press ENTER
The file system
By now you should know enough about the filesystem to be able to do something creative.
Your future laborations and reports should be saved in a directory named edu in
your home directory.
Create a new directory in edu named ci (computerintro). What permissions
does the newly created directory have? Is this good?
All answers to the following questions are to be written in a file called
ci_exercise in the ci directory. After the exercise you are to hand in a printed copy of this
document to the TA (teacher assistent). Now is a good time to use man. Inside
suggested commands that you could use. These exercises should be done in X.
- Start a terminal windows
- In what directory are you? (Tip: pwd)
- Change directory to /
- How many records are there in this directory?
- Go to your home directory.
- Go to the ci directory
- Create an empty file with an editor (or use touch)
- Create a new directory (mkdir) in ci and move the file (mv) to that directory
- Remove the directory, why can't this be done with rmdir?
- What permissions does ci have?
- What permissions should you assign to it?
- Remember to write answers in the file ci_exercise
- Run less on ci_exercise, what happens?
- Copy text from another terminal window to ci_exercise.
X - The graphical user interface
In X there are some nice features that will make a lot of things easier.
To copy and paste in Unix, select the text you wish to copy and then simply
place the pointer to where you wish the text to go and press the middle mouse
button. The selected text is now pasted. Some programs, however, have the
Windows-style (ctrl+c, ctrl+v) style copy-pasting most of you are used to.
Feel free to try to copy and paste between the terminal windows in X.
Be aware that the default X setting here at CS uses "Focus follows
mouse", this means that the window under the mouse cursor is the active