Question 1
Write a bash script that adds the total size of only PDF files present in a directory. Assume that the directory only contains files and no subdirectories.
Hint: Use ls -l to get the file size information
Write a bash script that adds the total size of only PDF files present in a directory. Assume that the directory only contains files and no subdirectories.
Hint: Use ls -l to get the file size information
A dpkg.log file contains a record of applications installed, removed, upgrade and purge over a period of time. Write a shell script to report the total number of instances when packages are installed, removed, upgraded and purged. A sample of the log file is as follows.
Note: Use Installed, update, remove and purge as the keywords for pattern matching.
2022-05-05 15:55:14 startup packages remove
2022-05-05 15:55:14 status installed linux-virtual:amd64 4.15.0.176.165
2022-05-05 15:55:14 remove linux-virtual:amd64 4.15.0.176.165 <none>
2022-05-05 15:55:14 status half-configured linux-virtual:amd64 4.15.0.176.165
2022-05-05 15:55:14 status half-installed linux-virtual:amd64 4.15.0.176.165
2022-05-05 15:55:14 status config-files linux-virtual:amd64 4.15.0.176.165
2022-05-05 15:55:14 status config-files linux-virtual:amd64 4.15.0.176.165
2022-05-05 15:55:14 status config-files linux-virtual:amd64 4.15.0.176.165
2022-05-05 15:55:14 status not-installed linux-virtual:amd64 <none>
2022-05-05 15:55:14 status installed linux-headers-virtual:amd64 4.15.0.176.165
2022-05-05 15:55:14 remove linux-headers-virtual:amd64 4.15.0.176.165 <none>
2022-05-05 15:55:14 status half-configured linux-headers-virtual:amd64 4.15.0.176.165
2022-05-05 15:55:14 status half-installed linux-headers-virtual:amd64 4.15.0.176.165
2022-05-05 15:55:15 status config-files linux-image-4.15.0-176-generic:amd64 4.15.0-176.185
2022-05-05 15:55:15 status config-files linux-image-4.15.0-176-generic:amd64 4.15.0-176.185
2022-05-05 15:55:15 status installed linux-modules-4.15.0-176-generic:amd64 4.15.0-176.185
2022-05-05 15:55:15 remove linux-modules-4.15.0-176-generic:amd64 4.15.0-176.185 <none>
2022-05-05 15:55:15 status half-configured linux-modules-4.15.0-176-generic:amd64 4.15.0-176.185
2022-05-05 15:55:15 status half-installed linux-modules-4.15.0-176-generic:amd64 4.15.0-176.185
2022-05-05 15:55:15 status config-files linux-modules-4.15.0-176-generic:amd64 4.15.0-176.185
2022-05-05 15:55:15 status config-files linux-modules-4.15.0-176-generic:amd64 4.15.0-176.185
2022-05-05 15:55:15 startup packages configure
2022-05-05 15:55:15 startup packages purge
2022-05-05 15:55:15 purge linux-image-4.15.0-176-generic:amd64 4.15.0-176.185 <none>
2022-05-05 15:55:15 status config-files linux-image-4.15.0-176-generic:amd64 4.15.0-176.185
2022-05-05 15:55:15 status config-files linux-image-4.15.0-176-generic:amd64 4.15.0-176.18
2022-05-05 15:55:17 startup packages remove
2022-05-05 15:55:17 status installed grub-pc:amd64 2.02-2ubuntu8.23
2022-05-05 15:55:17 status installed grub-gfxpayload-lists:amd64 0.7
2022-05-05 15:55:17 status installed grub2-common:amd64 2.02-2ubuntu8.23
2022-05-05 15:55:17 status installed grub-pc-bin:amd64 2.02-2ubuntu8.23
2022-05-05 15:55:17 status installed grub-common:amd64 2.02-2ubuntu8.23
2022-05-05 15:55:17 status installed grub-legacy-ec2:all 1:1
2022-05-05 15:55:17 remove grub-legacy-ec2:all 1:1 <none>
2022-05-05 15:55:17 status half-configured grub-legacy-ec2:all 1:1
Create a file structure as shown below; the commands should not output anything.
/potato_recipes/
├── french_fries
│ ├── ingredients.txt
│ └── procedure.txt
├── frites -> french_fries/
└── potato_wedges
├── ingredients.txt
└── procedure.txt
potato_recipes is a directory present in the root directory /.
french_fries and potato_wedges are the directories present inside the directory potato_recipes.
frites is a symbolic link to the directory french_fries
ingredients.txt inside the directory potato_wedges is a hard link to the file ingredients.txt inside the directory french_fries
procedure.txt are the text file present inside french_fries and potato_wedges
Sign in with Google — it is free — to see every question with its answer and explanation, practise it in learning mode, or take it as a timed mock test.
The IIT Madras BS System Commands (System Commands) OPPE 1 paper sat on May 2023, in the May 2023 term, set 2: 6 questions for 90 marks in 180 minutes. The first 3 questions are below. Sign in with Google — it is free — to see the whole paper with its answers and explanations, in learning mode or as a timed mock test.
| Feature | System Commands OPPE 1 May 2023 Set 2 at a glance |
|---|---|
| Term | May 2023 term |
| Subject | System Commands |
| Course code | BSSE2001 |
| Questions | 6 |
| Marks | 90 |
| Duration | 180 min |
| Programming | 6 |
| Official paper | OPPE 1, May 2023 Set 2 |
| Negative marking | No negative marking. |
| Updated |