Question 1
Write a bash script which calculates the size of the current working directory by adding the size each file. Assume that the directory contains only files and no subdirectories.
Hint: Use ls -l get the file size information
Write a bash script which calculates the size of the current working directory by adding the size each file. Assume that the directory contains only files and no subdirectories.
Hint: Use ls -l get the file size information
An authlog is copied from the /var/log/ directory to the current working directory. Generate a report from the authlog file which reports the failed logins, successful logins, invalid users and sudo access attempts.
Sample data:
Jul 16 14:13:13 vm212 sshd[444802]: Connection closed by authenticating user 2******* 194.***.***.*** port 59232 [preauth]
Jul 16 14:13:19 vm212 sshd[445097]: Accepted password for 2******* from 194.***.***.*** port 33668 ssh2
Jul 16 14:13:19 vm212 sshd[445097]: pam_unix(sshd:session): session opened for user 2*******(uid=3339) by (uid=0)
Jul 16 14:49:51 vm212 sshd[452702]: Invalid user from 194.***.***.*** port 48804
Jul 16 14:49:54 vm212 sshd[452702]: Connection closed by invalid user 194.***.***.*** port 48804 [preauth]
Jul 16 14:58:00 vm212 sshd[454221]: Invalid user web from 194.***.***.*** port 44484
Jul 16 14:58:00 vm212 sshd[454221]: pam_unix(sshd:auth): check pass; user unknown
Jul 16 14:58:00 vm212 sshd[454221]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=194.***.***.***
Jul 16 14:58:02 vm212 sshd[454221]: Failed password for invalid user web from 194.***.***.*** port 44484 ssh2
Jul 16 14:58:02 vm212 sshd[454221]: Received disconnect from 194.***.***.*** port 44484:11: Bye Bye [preauth]
Jul 19 11:12:52 vm212 sudo: pam_unix(sudo:auth): authentication failure; logname=ubuntu uid=3141 euid=0 tty=/dev/pts/3 ruser=ubuntu rhost= user=ubuntu
The current directory contains multiple files(no directories) with different extensions like .txt, .py, .m, etc.,. Write a bash script to organize the files into folders according to their file extensions. The directory names should be same as the file extensions(case sensitive). Example:file.C will be moved to the directory named C. Do not print anything from your script.
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 1: 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 1 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 1 |
| Negative marking | No negative marking. |
| Updated |