Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as...
-
Upload
ruth-allen -
Category
Documents
-
view
213 -
download
0
Transcript of Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as...
![Page 1: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/1.jpg)
Day 2
Review of ITSK1601 – Intro Unix.
![Page 2: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/2.jpg)
Break up into Cousin groups• Each cousin group will work as a team.
• Each team will need 5 blank sheets of paper.
• Be sure to write both cousins names at the top of each sheet of paper
• We will see 10 questions per round. Write your teams answers for all 10 questions on one page.– No late submissions of answers.– Only readable answers will be considered for credit.
![Page 3: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/3.jpg)
10 pts extra credit possible.• You are working for 10 points of extra credit on the
first quiz.– If you get 50/50 questions correct, you would have 10 pts
added to your score on the first quiz.– 45/50 would get you 9 points.– 40/50 would get you 8 points– 35/50 would get you 7 points– 30/50 would get you 6 points– ……– 5/50 would get you 1 point.
![Page 4: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/4.jpg)
Rules• While discussing your answer with your cousin, be
quiet so other teams cannot hear your answer.• No partial credit will be given for partially correct
answers. You gotta get it right.• Answer must be readable• You may use any notes/books/computer you want
during the game.• A correct answer may require the options which
would be passed to the command as well as the actual command.
• Judges (I.e. my) decision is final.
![Page 5: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/5.jpg)
Round 1
![Page 6: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/6.jpg)
Question 1• What UNIX command will show you help
information on a command?
![Page 7: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/7.jpg)
Question 2• What UNIX command will show you a list of files
in the current directory?
![Page 8: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/8.jpg)
Question 3• What UNIX command will show allow you to make
a copy of a file?
![Page 9: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/9.jpg)
Question 4• What UNIX command will allow you change what
directory you are currently in?
![Page 10: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/10.jpg)
Question 5• What UNIX command will change your current
directory to be one directory back from where you currently are?– e.g. You are currently in homeworks/hw1/answers. What
command would take you to homeworks/hw1
![Page 11: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/11.jpg)
Question 6• What UNIX command will tell you the current
time?
![Page 12: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/12.jpg)
Question 7• What UNIX command will show you the contents
of a file without stopping at each screen full? – I.e. What command dumps an entire file to the screen.
![Page 13: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/13.jpg)
Question 8• What 2 UNIX commands will show you the
contents of a file but will stop at each screen full?
![Page 14: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/14.jpg)
Question 9• What UNIX command is used to rename a file?
![Page 15: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/15.jpg)
Question 10• What UNIX command is used to see the first 10
lines in a file?
![Page 16: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/16.jpg)
Round 1
Answers
![Page 17: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/17.jpg)
Question 1• What UNIX command will show you help
information on a command?
• man
![Page 18: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/18.jpg)
Question 2• What UNIX command will show you a list of files
in the current directory?
• ls
![Page 19: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/19.jpg)
Question 3• What UNIX command will show allow you to make
a copy of a file?
• cp
![Page 20: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/20.jpg)
Question 4• What UNIX command will allow you change what
directory you are currently in?
• cd
![Page 21: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/21.jpg)
Question 5• What UNIX command will change your current
directory to be one directory back from where you currently are?– e.g. You are currently in homeworks/hw1/answers. What
command would take you to homeworks/hw1
• cd ..
![Page 22: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/22.jpg)
Question 6• What UNIX command will tell you the current
time?
• date
![Page 23: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/23.jpg)
Question 7• What UNIX command will show you the contents
of a file without stopping at each screen full? – I.e. What command dumps an entire file to the screen.
• cat
![Page 24: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/24.jpg)
Question 8• What 2 UNIX commands will show you the
contents of a file but will stop at each screen full?
• more and less
![Page 25: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/25.jpg)
Question 9• What UNIX command is used to rename a file?
• mv
![Page 26: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/26.jpg)
Question 10• What UNIX command is used to see the first 10
lines in a file?
• head
![Page 27: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/27.jpg)
Round 2
![Page 28: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/28.jpg)
Question 1• What UNIX command will allow you to make a
directory called Enda
![Page 29: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/29.jpg)
Question 2• What UNIX command will remove a directory
called Enda. You can assume the directory is in the current directory and is already empty
![Page 30: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/30.jpg)
Question 3• What UNIX command will delete the file called
Bob. You can assume Bob is in the current directory
![Page 31: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/31.jpg)
Question 4• What UNIX command will tell you how many
words are in a file?
![Page 32: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/32.jpg)
Question 5• What UNIX command will allow you to run an
interactive chat session with another user on your system?
![Page 33: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/33.jpg)
Question 6• What UNIX command will show you what the user
enda is currently doing? I.e. what commands they are currently running. Assume you are not enda.
![Page 34: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/34.jpg)
Question 7• What UNIX command will show you the
differences between the file 1.txt and 2.txt.
![Page 35: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/35.jpg)
Question 8• What UNIX command will show you a calendar for
the month of May, 2001?
![Page 36: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/36.jpg)
Question 9• What UNIX command repeats some text to the
screen?
![Page 37: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/37.jpg)
Question 10• What UNIX command is used to view electronic
email?– There is more than 1 correct answer here.
![Page 38: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/38.jpg)
Round 2
Answers
![Page 39: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/39.jpg)
Question 1• What UNIX command will allow you to make a
directory called Enda
• mkdir Enda
![Page 40: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/40.jpg)
Question 2• What UNIX command will remove a directory
called Enda. You can assume the directory is in the current directory and is already empty
• rmdir Enda
![Page 41: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/41.jpg)
Question 3• What UNIX command will delete the file called
Bob. You can assume Bob is in the current directory
• rm Bob
![Page 42: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/42.jpg)
Question 4• What UNIX command will tell you how many
words are in a file?
• wc –w <filename>
• I’ll accept just wc
![Page 43: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/43.jpg)
Question 5• What UNIX command will allow you to run an
interactive chat session with another user on your system?
• talk
![Page 44: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/44.jpg)
Question 6• What UNIX command will show you what the user
enda is currently doing? I.e. what commands they are currently running. Assume you are not enda.
• w enda
![Page 45: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/45.jpg)
Question 7• What UNIX command will show you the
differences between the file 1.txt and 2.txt.
• diff 1.txt 2.txt
![Page 46: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/46.jpg)
Question 8• What UNIX command will show you a calendar for
the month of May, 2001?
• cal 5 2001
![Page 47: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/47.jpg)
Question 9• What UNIX command repeats some text to the
screen?
• echo
![Page 48: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/48.jpg)
Question 10• What UNIX command is used to view electronic
email?– There is more than 1 correct answer here.
• pine
• elm
![Page 49: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/49.jpg)
Round 3
![Page 50: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/50.jpg)
Question 1• What EXACT UNIX command will delete the
directory homeworks and all files/subdirectories contained within.– You can assume homeworks is located in your current
directory
![Page 51: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/51.jpg)
Question 2• What exact UNIX command will move all files in
the current directory who’s name begins with tex to the directory tex-files.– You may assume tex-files already exists, and is located
in the current directory
![Page 52: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/52.jpg)
Question 3• What exact UNIX command would delete any file
which has a x in its file name, in this directory or any sub directory?
![Page 53: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/53.jpg)
Question 4• What UNIX command will take the first 23 lines of
every file in the current directory and put them into a new file called first-lines.
![Page 54: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/54.jpg)
Question 5• What UNIX command will make the file public.txt
readable to everyone on the system?– You may assume the file is in your current directory
![Page 55: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/55.jpg)
Question 6• Assume you have a file (x.txt) which looks like this:
27 chocolate
32 mint
33 orange
99 lemon
100coffee
• What command would return the file showing the items sorted numerically ascending by the number at the front of each line
![Page 56: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/56.jpg)
Question 7• 2 different people need to be able to edit the same
file. The file is currently located in /files/a.txt.
• Each user should see the file in their home directory.
• If either user edits their file, they should be editing the actual file /files/a.txt
• What Unix command would you need to type in each users home directory to make this true?
![Page 57: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/57.jpg)
Question 8• What Unix command would allow you to search for
all occurances of the text Edna and replace it with the Enda in the file mylife.txt
![Page 58: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/58.jpg)
Question 9• What SINGLE Unix command would show you any
messages in the logfile which contain either the words kernel or the IP address 10.1.1.1– The messages file is located in /var/log/message
![Page 59: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/59.jpg)
Question 10• What SINGLE Unix command would find only
lines in /var/log/messages which contain kernel AND 10.1.1.1
![Page 60: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/60.jpg)
Round 3
Answers
![Page 61: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/61.jpg)
Question 1• What EXACT UNIX command will delete the
directory homeworks and all files/subdirectories contained within.– You can assume homeworks is located in your current
directory
• rm –r homeworks
![Page 62: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/62.jpg)
Question 2• What exact UNIX command will move all files in
the current directory who’s name begins with tex to the directory tex-files.– You may assume tex-files already exists, and is located
in the current directory
• mv tex* tex-files
![Page 63: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/63.jpg)
Question 3• What exact UNIX command would delete any file
which has a x in its file name, in this directory or any sub directory?
• rm –r *x*
![Page 64: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/64.jpg)
Question 4• What UNIX command will take the first 23 lines of
every file in the current directory and put them into a new file called first-lines.
• head –23 * > first-lines
![Page 65: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/65.jpg)
Question 5• What UNIX command will make the file public.txt
readable to everyone on the system?– You may assume the file is in your current directory
• chmod a+r public.txt
![Page 66: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/66.jpg)
Question 6• Assume you have a file (x.txt) which looks like this:
27 chocolate
32 mint
33 orange
99 lemon
100coffee
• What command would return the file showing the items sorted numerically ascending by the number at the front of each line
• sort –n x.txt
![Page 67: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/67.jpg)
Question 7• 2 different people need to be able to edit the same
file. The file is currently located in /files/a.txt.
• Each user should see the file in their home directory.
• If either user edits their file, they should be editing the actual file /files/a.txt
• What Unix command would you need to type in each users home directory to make this true?
• ln (-s) /files/a.txt .
![Page 68: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/68.jpg)
Question 8• What Unix command would allow you to search for
all occurances of the text Edna and replace it with the Enda in the file mylife.txt
• sed s/Edna/Enda/g mylife.txt
![Page 69: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/69.jpg)
Question 9• What SINGLE Unix command would show you any
messages in the logfile which contain either the words kernel or the IP address 10.1.1.1– The messages file is located in /var/log/message
• egrep ‘kernel|10.1.1.1’ /var/log/messages
![Page 70: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/70.jpg)
Question 10• What SINGLE Unix command would find only
lines in /var/log/messages which contain kernel AND 10.1.1.1
• grep kernel /var/log/messages | grep 10.1.1.1
![Page 71: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/71.jpg)
Round 4
![Page 72: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/72.jpg)
Question 1• Imagine you have a directory with the following
permissions:
• Can users who are a member of the group managers see a list of all files in that directory?– Why? Why Not?
drwx--x--x 2 enda users 4096 Mar 21 13:06 scripts
![Page 73: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/73.jpg)
Question 2• If you have a file called important.txt and you want
to make sure that you cannot delete it. How can you change its permissions to help prevent this?
![Page 74: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/74.jpg)
Question 3• How could you use the command who to find out a
list of all users who are currently logged on. – Show no additional information other than username– Ensure that each username is only output once even if
they are logged in multiple times
![Page 75: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/75.jpg)
Question 4• What UNIX command will look for any the word
Enda in the file stuff.txt– Be sure you look for enda, Enda, ENDA etc.– Be sure you do not return words like calENDAr.
![Page 76: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/76.jpg)
Question 5• What UNIX command would count how many
times the user enda logged in on May 14.– Use the last command to find this information.– Be sure you only look for enda’s information– Be sure you only look for entries on May 14.
![Page 77: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/77.jpg)
Question 6• What SINGLE Unix command can you use to
make the following directory:– /home/enda/1/2/3/4/5/6/7/8/9– You may assume you are currently in /home/enda– None of the sub directories exist.
• I.e. Right now, in /home/enda there is now directory called 1.
![Page 78: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/78.jpg)
Question 7• You have a file which contains a bunch of words.
– One word per line
• You want to see all words which begin with the letter c, but you need them in REVERSE alphabetical order.– Thus you should get:
• czar• cyclone• cutoff• count• club• cat
![Page 79: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/79.jpg)
Question 8• What Unix command would append a copy of the
file 2.txt to the end of the file 1.txt?
![Page 80: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/80.jpg)
Question 9• Imagine you only have the cat command, and the
ability to redirect
• You start with a file that has 10 lines in it.
• What is the least number of commands you could use to make a file with 1000+ lines in it?
• What command would you be running?
![Page 81: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/81.jpg)
Question 10• Assume you are in vi in escape [command] mode
– How would you do each of the following in a single command:
a. Delete the next 100 lines
b. Add 10 blank lines beneath the current line
c. Find the next occurrence of the word Fido in the document
d. Find the matching close } to this open {.You can assume your cursor is on top of the { for this one.
![Page 82: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/82.jpg)
Round 4
Answers
![Page 83: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/83.jpg)
Question 1• Imagine you have a directory with the following
permissions:
• Can users who are a member of the group managers see a list of all files in that directory?– Why? Why Not?
• Nope, you require read permission ls in a directory, for Others, no read permission exists.
drwxr-x--x 2 enda users 4096 Mar 21 13:06 scripts
![Page 84: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/84.jpg)
Question 2• If you have a file called important.txt and you want
to make sure that you cannot delete it. How can you change its permissions to help prevent this?
• chmod u-w file
![Page 85: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/85.jpg)
Question 3• How could you use the command who to find out a
list of all users who are currently logged on. – Show no additional information other than username– Ensure that each username is only output once even if
they are logged in multiple times
• who | awk ‘{print $1}’ | sort | uniq
![Page 86: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/86.jpg)
Question 4• What UNIX command will look for any the word
Enda in the file stuff.txt– Be sure you look for enda, Enda, ENDA etc.– Be sure you do not return words like calENDAr.
• grep –i ^enda$ stuff.txt
![Page 87: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/87.jpg)
Question 5• What UNIX command would count how many
times the user enda logged in on May 14.– Use the last command to find this information.– Be sure you only look for enda’s information– Be sure you only look for entries on May 14.
• last | grep “May 14” | grep enda | wc -l
![Page 88: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/88.jpg)
Question 6• What SINGLE Unix command can you use to
make the following directory:– /home/enda/1/2/3/4/5/6/7/8/9– You may assume you are currently in /home/enda– None of the sub directories exist.
• I.e. Right now, in /home/enda there is now directory called 1.
• mkdir –p /home/enda/1/2/3/4/5/6/7/8/9
![Page 89: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/89.jpg)
Question 7• You have a file which contains a bunch of words.
– One word per line
• You want to see all words which begin with the letter c, but you need them in REVERSE alphabetical order.– Thus you should get:
• czar
• cyclone
• cutoff
• count
• club
• cat
• grep c file | sort –r
![Page 90: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/90.jpg)
Question 8• What Unix command would append a copy of the
file 2.txt to the end of the file 1.txt?
• cat 2.txt >> 1.txt
![Page 91: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/91.jpg)
Question 9• Imagine you only have the cat command, and the
ability to redirect
• You start with a file that has 10 lines in it.
• What is the least number of commands you could use to make a file with 1000+ lines in it?
• What command would you be running?
• cat file >> file
• Repeat 7 times, to get 1280 lines
![Page 92: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/92.jpg)
Question 10• Assume you are in vi in escape [command] mode
– How would you do each of the following in a single command:
a. Delete the next 100 linesb. Add 10 blank lines beneath the current linec. Find the next occurrence of the word Fido in the documentd. Find the matching close } to this open {.
You can assume your cursor is on top of the { for this one.
• a. 100d• b. 10o• c. /Fido• d. %
![Page 93: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/93.jpg)
Round 5
![Page 94: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/94.jpg)
Question 1• What single command will send 100 messages with
the word “Yo” to the user enda’s screen?
![Page 95: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/95.jpg)
Question 2• Write a simple script which will output “Yes” if
enda is currently logged in and “No” if he is not.
![Page 96: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/96.jpg)
Question 3• What Unix command would give you the answer to
the following math problem:
• (100 * 50) / 5
![Page 97: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/97.jpg)
Question 4• Imagine you have a file called users with a list of
user names in it.– Write a simple script which one at a time will check if
that user is logged on, if they are send them the message “Hey”
![Page 98: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/98.jpg)
Question 5• Write a script which when run, decides what season
it is. And tells you.– For simplicity lets assume the following:– Winter: Dec, Jan, Feb– Spring: Mar, Apr, May– Summer: Jun, Jul, Aug– Fall: Sep, Oct, Nov
![Page 99: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/99.jpg)
Question 6• Write a script which renames the files
– 1.txt, 2.txt, 3.txt
• To the new name:– file1.txt, file2.txt, file3.txt
• The script should do this for all files up to 22.txt
• Be sure the user never sees any errors even if a given file (17.txt) doesn’t exist.
• Use a loop.
![Page 100: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/100.jpg)
Question 7• Write a script which takes one parameter, a file
name.– If the file exists
• Show us the file using more
– Otherwise• Give an error “I could not open you file called xxx”
• Be sure xxx is replaced with the actual file the user typed.
![Page 101: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/101.jpg)
Round 5
Answers
![Page 102: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/102.jpg)
Question 1• What single command will send 100 messages with
the word “Yo” to the user enda’s screen?
let x=0
while [ $x –lt 100 ]
doecho “Yo” | write enda
let x=$x+1
done
![Page 103: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/103.jpg)
Question 2• Write a simple script which will output “Yes” if
enda is currently logged in and “No” if he is not.
if who | grep enda
then
echo “Yes”
else
echo “No”
fi
![Page 104: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/104.jpg)
Question 3• What Unix commands would give you the answer to
the following math problem:
• (100 * 50) / 5
let x=(100*50)/5
echo $x
![Page 105: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/105.jpg)
Question 4• Imagine you have a file called users with a list of user
names in it.– Write a simple script which one at a time will check if that user is
logged on, if they are send them the message “Hey”
for name in `cat users`
do
if who | grep $name
then
echo “hey” | write $name
fi
done
![Page 106: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/106.jpg)
Question 5• Write a script which when run, decides what season it is.
And tells you.– For simplicity lets assume the following:
– Winter: Dec, Jan, Feb
– Spring: Mar, Apr, May
– Summer: Jun, Jul, Aug
– Fall: Sep, Oct, Nov
• if date | grep –i dec –o date | grep –i jan –o date | grep feb• then• echo “Winter”• elif date | grep –i mar –r date | grep –i Apr …
![Page 107: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/107.jpg)
Question 6• Write a script which renames the files
– 1.txt, 2.txt, 3.txt
• To the new name:– file1.txt, file2.txt, file3.txt
• The script should do this for all files up to 22.txt• Be sure the user never sees any errors even if a given file (17.txt) doesn’t exist.• Use a loop.
let x=1while [ $x –lt 22 ]do mv $x.txt file$x.txt 2> /dev/null let x=$x+1done
![Page 108: Day 2 Review of ITSK1601 – Intro Unix.. Break up into Cousin groups Each cousin group will work as a team. Each team will need 5 blank sheets of paper.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e725503460f94b71f4a/html5/thumbnails/108.jpg)
Question 7• Write a script which takes one parameter, a file name.
– If the file exists• Show us the file using more
– Otherwise• Give an error “I could not open your file called xxx”
• Be sure xxx is replaced with the actual file the user typed.
if [ -f $0 ]then more $0else echo “I could not open your file called $0”fi