Practicum - week 9


Welcome to the first practicum!

1.

Log in and get acquainted with the terminal. Open more virtual terminals, etc. Try pressing the middle button of the mouse to copy the highlighted text. Try deleting with ^h. Close a virtual terminal with 'exit', as well as with ^d. (Remark: from now on ^ will refer to the CTRL button.)
 

2.

Change your password (passwd), and don't forget the new one!

Rule no. 1.: Never tell anybody your password!




3.

The command echo simply writes its arguments to the screen. Try:

echo Hello, what a nice day!

We will latter speak about the variables in Unix. For instance $SHELL contains the path of the current shell.

Check the shell you are using with:

echo $SHELL.
You should get something like '/usr/local/gnu/bin/bash'.

Try out typing the same, but changing the case, like 'ECHO', '$shell', etc. Use the upper cursor to save typing. Notice the different error messages.

What is the reason that if you type both an incorrect command (like 'Echo') with an incorrect variable name (like '$sheLL') you are told about the command, and not about the variable? Remember what we have told about the way the shell works...
 

4.

Check which directory you are in ('pwd'). List the content of this directory ('ls'). Walk within the directory tree using 'cd'. What does 'cd ..', 'cd ../..', etc.? Always look at your prompt, and check if it really shows your actual working directory ('pwd'). Always list the actual directory, see at its content, and walk up and down. Check also 'ls -l'. In many systems the command 'll' is just a standard alias for abbreviating 'ls -l': try it out. If you are lost, go home (simply 'cd' or 'cd ~'), and check if you are really there.
 

5.

Now that you are back home, you can start changing the content of your home directory.  Make new directories, check their content and remove them. Create files ('cat > filename') , check them ('ls', 'ls -l', 'cat filename') and remove them. Check if you could successfully remove your directories and your files.

Try to remove a non existent file or a non existent directory. Try to remove a directory with 'rm' (without '-r'). What happens?

What is ~/.. ? Try creating a directory and a file in ~/.. !

Note that UNIX doesn't give you any message if the task could be successfully executed! Therefore:

Rule no. 2.: Always check the effect of your commands!




Play around with: cp, mkdir, mv, rm, rmdir, ls.
Use the TAB and the double-TAB to save typing.

Try 'who', 'who am i', 'w', 'date' and 'cal'. (Don't forget 'cal 09 1752'!) Read the man-pages of the most important commands.

Get information on these commands using 'man <command_name>' and '<command_name> --help | more'. (Within man or less: use cursor-up, cursor-down and 'q' to quit; while 'space' and 'enter' within more.)
 

6.

Assignement to be shown to the instructor:

  1. Open a new terminal.
  2. Start changing your password. (You don't need to...)
  3. List the content of the root directory.
  4. Create a directory called `My_Directory' in your home directory. Then create a directory called `My_child_directory' within `My_Directory'.
  5. Locate the file containing the shell (cf. 3), and copy it to `My_child_directory'.
  6. Create a file in `My_directory' and move it to your home directory.
  7. Rename `My_directory' to `new_name'.
  8. List recurively what you have in your home directory.
  9. Remove the directory `My_child_directory'.
  10. You want to overwrite a file with another one, but you are worried that perhaps the source is older than the destination. So you want to copy the file only if the source is newer than the destination. How would you check if the command which copies a file has an option to solve this problem?

In order to get maximal points, you should be able to do all these without help (so don't be lost within your directories, etc.). Try to make use of all tricks, such as copying a text with the middle button of the mouse, and by using ALT and the cursor-up buttons to save typing.

(10 points)