Scripting class questions 1


1. using wget or curl, and a for loop, download all of the following images:

2. using a loop, backticks (`) and the basename command, rename all of the images, adding “(modified)” to their filenames

3. using a loop, backticks, basename, and the convert command (part of the imagemagick image processing suite), resize all of the images to 50% of their original size

4. using wget or curl,tar, a loop, oggdec and lame, convert the following files into mp3s:

5. (hard) repeat question 4, but retain all ID3 tag information.

6. Use a loop and the “uptime” and “free” commands to record the system load once a minute for the duration of the class. Store the information in CSV format. Use a spreadsheet to draw graphs of this information.

File management

1. Download the following tar.gz, and extract it using the tar command. In the resulting directory, find the newest file that matches name-asdf*.

System commands

1. Write a cron job that will email you the free space on your hard disk once per hour. Its output should be:

Hello, your hard disk has X% of hard drive space remaining!

2. Using the “du” command, find out which of the directories in the root directory of your hard drive is using the most hard disk space. Suggest some files you might delete if you were running out of space.

3. Use the find command to return a list of the files in your home directory that you have modified in the last week. Exclude anything that is not a regular file.

Regular expressions


This entry was posted in questions, scripting. Bookmark the permalink.

Leave a Reply

Your email address will not be published.