1(a) Write a shell command to echo the names of all the files/directories that start with a capital letter in the current directory. 2
1(b) Write shell commands to print (i) names of five biggest files and (ii) names of five files that were most recently modified, in the given directory. You should also consider subdirectories. 3
1(c) Modify /etc/profile to get a special greeting message when you connect to your system as root. (Note that this question involves making changes in a file and not a command to be executed). 2
1(d) Write a single command to play all the songs of a particular singer, say "Kishore" in your music collection using totem, xmms, or mplayer. Assume that you have a music collection with each song file having the format - "<song title>-<singer>.mp3". If you do not have a collection of songs create a small collection of your own for testing the command. Note: Music collection can be a nested hierarchy of directories with each of the subdirectory containing some or no song files. 2
1(e) Write a shell command to declare a variable MYVAR that contains the list of all the text files in the given directory and its subdirectories separated by ":". Assume that the input directory name contains only the alphabets or digits and file names inside it may contain all characters except ":". Enclose file names within double quotes and append a "." in the end. For eg.
Consider the following hierarchy:
The value of variable MYVAR should be -
Note: these kind of commands are useful in setting classpath kind of variables. 3
1(f) Write a single shell command to display the following output on the konsole.
1 1 1
2 4 8
3 9 27
4 16 64
10 100 1000
2. Write a shell script to list all files/directories in a given directory as a tree. The output should be an HTML page which displays the contents of the given directory as a hierarchy. For eg. A typical Hierarchy in the text mode can be shown as
Display directories with blue color, and all .txt files with red color. Use any other color for other files. Note: In HTML you can use HTML tags to create the hierarchy or a tree like structure. 5
3. Write a shell script for a menu driven task scheduler. The task scheduler must provide the following tasks on menu.
1. Add new task entries which should be in the form 'date:job:user:email-id'. You are free to use your own format. The four fields date, job, user, and email-id are mandatory. Job is a text description of the task.
2. Display all tasks scheduled for a particular day (date).
3. Display all tasks scheduled for a user.
4. Delete a particular task.
A mail must be sent to remind the user about the tasks for the day at midnight on that day. For.eg. on 29th July a minute after 23:59 a mail must be sent to the user reminding his tasks for 30th July. After sending the mail, its corresponding entry must be deleted. 10
4(a) Implement the following commands
2. du -a (not for credit)
3. zgrep without using any other z command (command starting with character 'z') .
4(b) You are given a directory hierarchy. For all the .txt files in the directory and its subdirectories, you need to find how many words are there of n characters where n varies from 1 to 10. Give the output as a frequency table in decreasing order of frequency.
This is flab assignment_1
Deadline is 5th august
The output should be a file whose contents are
5. We are providing you an access log of a web server. Use this file to generate the following information. Assume that the format is [ipaddress/domain name] [date] [request] [http status] followed by some other details. Get the acces log from here.
5(a) Write a command/script to find the most frequently visited webpage by a given IP Address. If no page is visited by the given IP Address the result must be 0. Ignore parameters of the request and the protocol information. For. eg. a request "GET /news/index.php?id=2 HTTP 1.0" should be treated as a request to the webpage "/activities/news/index.php". 3
5(b) Write a script/command to find all the IP addresses or the domain names from where the web pages on the site have been accessed. Arrange them in decresing order of the number of pages accessed by them.