Week 4, Intro to Unix lab 2016
Content
- Homework discussions - rights
- limit number of arguments. Try
ls /*/*/*/*
- limit number of arguments. Try
- Recapitulation
- numeric representation
- permissions
000, 600, 700, 644, 755
what is the behaviour? - Show the names and login times of the currently logged in users
- Quick recap test - show prikazy.txt
env
, standard variables, calling script from anywhere andPATH
variablemail
: mail me (email on white board) and yourself in carbon copy (cc) your login and your machine name so I can see where you are sitting- use one liner
- write a pomodoro script which email to stretch every 20 minutes
last
,sort
,join
,uniq
,/ect/passwd # or getent passwd
- if time, prepare for future:
find
- look at the syntax till next time- print is not like printing - 1200 pages cost money
- recap
less
,more
,pg
sync
Homework
Send me both your scripts but also the files counts_days
and days_counts
- (2 points) Count number of logins to machine
u-pl24
per day of week- hints:
last, sort, uniq
ssh YOUR_NAME@u-pl24.ms.mff.cuni.cz
- Store the results to
counts_days
file in format:
- hints:
- (1 point) Swap the columns from
counts_days
- Keep the numbers aligned to the right side
- Store the results to
days_counts
file in format: - Hints:
cut, paste
character positions
Bonus
- (0 points) Write your homework using vim
- Finish
vimtutor
tutorial before starting
- Finish
- (1 point) Change homework from third week so you backup dotfiles and dotdirectories and change the directories permissions recursively and files recursively so you cannot change/delete them.
- (1 point) How many users with first name
Jan
can login to Rotunda lab?- Submit the code and write me a number into the email
- (1 point) Similarly to homework count number of logins to
u-pl24
per first name of user- Hints:
join
command- Do not use
/etc/passwd
butgetent passwd
in Rotunda lab
- Send me also the output in
first_names.txt
file
- Hints:
- (2 points) - Draw a histogram for
days_counts
file:- Suppose that the first two columns do not exceed 18 characters
- Distribute 60 ‘=’ characters proportionally according counts
- See example of desired output for only three days.
- Send me also the output in
histogram.txt
file - See example output for data
Mon 1, Tue 40, Wed 80