Welcome to the first practicum!
Log in and get acquainted with the terminal. Open more
virtual terminals, konsoles, etc. Try pressing the middle button of the mouse to
copy-paste a 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
Read through the web page containing the information that you have to learn after the first lecture, if you have not done it yet. Most of the information should not be new, but some important details may not have been mentioned during the lecture, but have to be learnt. Furthermore, try to understand the examples mentioned on the web page; if you do not understand them, don't hesitate and ask us!
Change your password with the command `passwd' (unless you have already changed your password in the past), and don't forget the new one!
Rule no. 1.: Never tell anybody your password!
If you tell somebody your password, and he or she does something illegal, then you will be liable. Nobody else can have access to your password. The system encrypts the passwords, so that even the system administrator (the superuser) is not able to find out them.
The command echo simply writes its arguments to the screen. Try:
As you remember, shell is the program that runs when you log in or you open a new (virtual) terminal, and it waits for your commands to execute them (or to run them). As shell is also a program, it is a file that has to be found somewhere in the file structure.
However, there are different shells, and maybe the file structure contains several files that can serve as shell. It is important, therefore, to be able to determine which is the file that actually runs as the shell. We will later speak about the variables in Unix. The variable $SHELL contains the path of the current shell running.
Check the shell you are using with:
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 said about the way the shell works (if you do not know, ask us).
Check which directory you are in (use 'pwd'). List the content
of this directory ('ls'). Walk within the directory tree using 'cd'. What
does 'cd ..', 'cd ../..', etc. do? Always look at the prompt (= beginning of the line,
printed by shell to the screen), and check if
it really shows your actual working directory ('pwd'). Always list the actual directory,
look at its content, and walk up and down in the directory tree.
Check also'ls -l' (long list). Does ls on Hagen use colour codes
to distinguish directories from regular files? Remember that the first
character in each line of the long list refers
to the file type: - stands for a regular file, whereas d stands for a directory.
In many systems the command 'll' is just a standard alias for
abbreviating 'ls -l': try it out if it works.
If you are lost after so much walking in the directory tree, go home, i.e.
to your home directory (simply by 'cd' or 'cd ~'), and check if you are
really there (`pwd').
Check also'ls -l' (long list). Does ls on Hagen use colour codes to distinguish directories from regular files? Remember that the first character in each line of the long list refers to the file type: - stands for a regular file, whereas d stands for a directory. In many systems the command 'll' is just a standard alias for abbreviating 'ls -l': try it out if it works.
If you are lost after so much walking in the directory tree, go home, i.e. to your home directory (simply by 'cd' or 'cd ~'), and check if you are really there (`pwd').
Go to the root directory (`cd /'), and try to find your way back to your home directory: list the directory in which you are, and try finding the correct subdirectory in which your home directory might be. If you want, look at the content of other directories.
While walking in the directory structure, try to draw the file tree on a sheet
of paper. What directories are in the root directory? What files and directories
are in these subdirectories? What directories and files do you have in your home
directory? Who is the mother and who are the sisters of your home directory? Obviously,
you don't want to represent everything, but get acquainted at least with the path
from the root to your own home directory and its immediate neighbours.
Now that you are back home, you can start changing the content of your home directory. Make new directories (`mkdir'), check their content (ls) and remove them (rm, rmdir). Create files ('cat > filename') , check them ('ls', 'ls -l', 'cat filename') and remove them (`rm'). Check if you could successfully remove your directories and your files (`ls').
Try to remove a non existent file or a non existent directory. Try to remove a directory with 'rm' (without '-r'). What happens? Try to understand what the error message says exactly.
What is ~/.. ? Try creating a directory and a file in ~/.. ! Why does it not work?
(If you are not able to answer these questions, do not be shy, and ask us. They are not just rhetoric questions, and they may come up in the final exam.)
Note that UNIX doesn't give you any message if the task could be successfully executed, even if the result is not exactly what you had wanted to do! Therefore:
Rule no. 2.: Always check the effect of your commands!
The computer can execute only what you tell it to do, and cannot guess what really you meant. YOU have to be the smarter one, and imagine how the computer would interpret your commands. Using a computer needs a lot of empathy: put yourself in the place of the computer, since the computer is not able to put itself in your place. (For a counter-example, ask Lonneke about her research project :-) ...)
Play around with: cp, mkdir, mv, rm, rmdir, ls.
Use the TAB and the double-TAB to save typing the name of files and directories.
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 | less'. (Within man or less: use cursor-up,
cursor-down and 'q' to quit.)
Assignment to be shown to the instructor (or write the solutions on a sheet of paper and give it to us; or send your solutions in an email). Perform the following tasks, without changing your working directory (remember what you have just read about absolute and relative paths on the web site of the course):
In order to get maximal points, you should be able to present all these steps without help (so don't be lost within your directories, etc.). Obviously, before you finally show us your solution, you can ask for help. 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.
Closing remarks: when you have finished working in the Unix-room, you have to log out (otherwise people can misuse your account). Don't forget it. Nevertheless, never turn off a computer on which Unix is running! You may damage the whole system, and turning off the computer does not save much energy.