Exercise #4 Using a UNIX text editor of your choice, edit this file and answer the following questions. Use the "man" command to reference any of the named commands. When asked how to do something, write out the command you would use to do it. 1. "ln" command to make _hard_ links to all the files, in the current directory, beginning with "r", followed by 2 hex-digits (0-9, a-f or A-F) and ending with ".mod" into the target directory "foo/bar/": ln r[0-9a-fA-F]{2}.mod foo/bar/ ln r[0-9a-fA-F][0-9a-fA-F].mod foo/bar/ 2. "grep" command to _recursively_ look for files containing the case insensitive string "search" starting from the current directory. The command should print the name of the files that contain the match, one line of context above and below the match as well as the line numbers: grep -r -i -n -A 1 -B 1 -H "search" . grep -r -i -C 1 -n -H search . 3. "grep" command to find all the user-names in /etc/passwd that start with an 'sba' that is further filtered via a pipe with a second grep that filters out anything that contains the strings '/u1/h2' or '/u1/h3': grep "^sba" /etc/passwd | grep -v "/u1/h2" | grep -v "/u1/h3" grep ^sba /etc/passwd | grep -v /u1/h[23] 4. "find" commands to perform find the following: a) A case-insensitive search for files located in /net/web that begin with "my" and end with ".php". Output files in ls format: find /net/web -iname "my*.php" -ls b) All the files in /tmp that have not been modified in more than 30 days (hint: read section TESTS about numeric arguments): find /tmp -mtime +30 -ls c) All files in /tmp that have been modified in the last 24 hours: find /tmp -mtime -1 -ls d) All files in /bin that have their setuid bit set: find /bin -perm /04000 find /bin -perm /?? e) All files in /tmp that are greater than 5MB in size and are NOT owned by root (hint: read the section on OPERATORS): find /tmp -size +5M \! -user root find /tmp \! -user root -size +5M 5. "dd" command to create a file called 'test' that is 1MB in size and contains nothing but null bytes (hint: /dev/zero is full of null bytes): dd bs=1000000 count=1 if=/dev/zero of=test 6. "gzip" commands to: a) compress the test file created above gzip -c test > test.gz gzip test # don't keep multiple copies b) print the uncompressed size and compression ratio of the newly compressed file: gzip -l test.gz;