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, 755what 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 andPATHvariablemail: 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-pl24per day of week- hints:
last, sort, uniqssh YOUR_NAME@u-pl24.ms.mff.cuni.cz
- Store the results to
counts_daysfile in format:
- hints:
243 Mon
992 Tue
823 Wed
1202 Thu
602 Fri
123 Sat
32 Sun- (1 point) Swap the columns from
counts_days- Keep the numbers aligned to the right side
- Store the results to
days_countsfile in format: - Hints:
cut, pastecharacter positions
Mon 243
Tue 992
Wed 823
Thu 1202
Fri 602
Sat 123
Sun 32Bonus
- (0 points) Write your homework using vim
- Finish
vimtutortutorial 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
Jancan 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-pl24per first name of user- Hints:
joincommand- Do not use
/etc/passwdbutgetent passwdin Rotunda lab
- Send me also the output in
first_names.txtfile
- Hints:
- (2 points) - Draw a histogram for
days_countsfile:- 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.txtfile - See example output for data
Mon 1, Tue 40, Wed 80
Mon 1 =
Tue 40 ====================
Wed 80 =======================================