Basic information
- Teacher: Petr Kučera <>, room S304
- Schedule: Thursday 12:20 -- 14:50 SU2
Useful links
- Lecture web pages
- Local copy of the last UNIX specification
- The UNIX Specification
- Exercise assignments in book “Shell v příkladech” by Libor Forst, translated to English.
- Shell script checker
Credit requirements
At the end of each practical homeworks shall be assigned, I will expect to receive their solution by e-mail before the beginning of the next practical. If by the end of the semester you have at least 2/3 of possible number of points, you get a credit. If you have at least 1/3 of possible number of points (but less than 2/3), you will have to finish additional homeworks to achieve the credit (number and complexity of these additional homeworks will be in proportional to missing number of points). Each set of homeworks assigned after a practical will be worth 3 points, at the beginning of the semester that could mean three exercises while at the end it can be just one more difficult. Whoever is not able to achieve at least 1/3 will not get a credit from me.
If not stated otherwise, you are allowed to use only the commands, tools and structures we have used on practicals before the homework was assigned (including the one to which homework was assigned). In some cases the tools might be even more restricted. If I come across a solution which is just a copy of another one I will assign no points for this solution. If this case repeats there will be no possibility to obtain a credit from me.
Please, send me your solutions via an e-mail and do so before the beginning of the next practical. The homework assignments are appended below a list of exercises we have done at the corresponding practical (i.e. the current homework exercises are always at the bottom of this web page).
There have been 13 homeworks assigned and thus the number of points required to get the credit is 26. The homeworks assigned to 14th practical are considered as additional and do not count into the limit.
Some peculiarities of the Malá Strana UNIX lab
I think it is worth to know and bear in mind some specifics of the Malá Strana UNIX lab. To Czech students I recommend to check the web pages of the UNIX lab, but as far as I know there is no English version (yet) of these web pages. So I will warn you of the lab properties as we come across them. In this section I would to mention at least the most apparent of them:
- Users home directories are placed in a remote AFS filesystem, where
standard UNIX permissions do not apply and the standard UNIX commands
for file permissions manipulations (mainly
chmod
) cannot be used or they can be used only in a very restricted way (there is a web page about the ACL which is the system in use, but it is only in Czech to the best of my knowledge). - This means that when you try the chmod command or anything which
has some connection to the standard UNIX permission system, you should
do so in local directories (such as
/tmp
in which you are allowed more or less anything). There the standard UNIX permissions apply. - As user accounts are stored remotely, local file
/etc/passwd
does not contain information about your account or accounts of other lab users. If you want to get your and other users account info in the format of/etc/passwd
you can achieve that using agetent
command as follows:
getent passwd
for other parameters and general help on this command usegetent --help
. - The same applies to
/etc/group
andgetent group
. - The
find
command (still most probably) is not in the best of terms with AFS filesystem — when used on network AFS drives in the lab such as your home dir you can get unexpected results. You can usefind
to search on local directories such as/tmp, /etc, /usr
etc. The exercises usually suggest it.
Content of the practicals
1st practical (26th February, 2016)
Basic commands, shell command line edit.
More detailed:
- Command line edit: Ctrl-a, Ctrl-e, Ctrl-h, Ctrl-r, arrows (left, right, up and down), Ctrl-d, Ctrl-k (deletes text from the cursor position to the end of line).
-
Commands:
man, ls, cd, pwd, cat, more, less, head, tail, wc, mkdir, rmdir, cp, mv, rm, echo.
- Redirecting and pipes: <, >,
>>, 2>, 2>>, |,
/dev/null
. - Shell expansion: *, ?, [list], [!list], apostrophes and quotation marks, filenames starting with a dot.
Exercises:
- In your home directory create a directory named DIR
- Copy all files whose filenames satisfy the following conditions to ~/DIR. The files are in /usr/include directory, their names start with m, end with .h and contain a number.
- Create a subdirectory called SUBDIR in your DIR directory.
- The first five lines of each file you have copied from /usr/include copy to file ~/DIR/SUBDIR/firstfive.
- The last lines of files in ~/DIR copy to file ~/DIR/SUBDIR/last.
- Concatenate the two files in ~/DIR/SUBDIR into one file ~/DIR/SUBDIR/firstandlast
- Delete the files in ~/DIR/SUBDIR except firstandlast.
- Store the number of files and directories in ~/DIR into a file ~/DIR/SUBDIR/count
- Output the long information on ~/DIR/SUBDIR directory. (Not its content, but information on it).
- Delete the contents of ~/DIR/SUBDIR/firstandlast file without removing the file itself.
- Add a line containing just a star sign (i.e. *) to file ~/DIR/SUBDIR/firstandlast.
- Delete ~/DIR together with all the files it contains.
-
(Show solutions to
preceding exercises)
Fatal error: Uncaught Error: Call to undefined function create_function() in /home/kucerap/public_html/include/geshi.php:4698 Stack trace: #0 /home/kucerap/public_html/include/geshi.php(4621): GeSHi->_optimize_regexp_list_tokens_to_string() #1 /home/kucerap/public_html/include/geshi.php(1655): GeSHi->optimize_regexp_list() #2 /home/kucerap/public_html/include/geshi.php(2029): GeSHi->optimize_keyword_group() #3 /home/kucerap/public_html/include/geshi.php(2168): GeSHi->build_parse_cache() #4 /home/kucerap/public_html/include/geshi.php(4728): GeSHi->parse_code() #5 /home/kucerap/public_html/unix/index-en-16.php(275): geshi_highlight() #6 {main} thrown in /home/kucerap/public_html/include/geshi.php on line 4698