1. a) find $HOME -depth -ctime +7 --- 1 ps -axu | grep csh --- 2 more *.c > allsource --- 1 b) You need write permission (and execute permission) on a directory to remove a file. c) ls a/b/c > afile - The output of the ls command is redirected to afile. ls lists the contents of a/b/c grep word afile > bfile 2>&1 - All lines in afile contaning "word" are printed to stdout which is redirected to bfile. stderr is also redirected to bfile. --------------------------------- 2. a) Parent 0 Parent 1 ProgB All Done ProgB b) No. --------------------------------- 3. #!/bin/sh size=$1 for file in * do set `du -b $file` if [ $1 -gt $size ] then echo $file $1 fi done ---------------------------------- 4. #include #include #include #include int main(void) { DIR *dp; struct stat buf; struct dirent *entry; dp = opendir("."); for(entry = readdir(dp); entry != NULL; entry = readdir(dp)) { stat(entry->d_name, &buf); if(S_ISDIR(buf.st_mode)){ continue; } if(buf.st_size > 102400) { printf("%s %d\n", entry->d_name, buf.st_size); } } } ---------------------------------- 5. #!/local/bin/perl -w use strict; my $line; open PHONES, "<$ARGV[0]" || die "Couldn't open $ARGV[0]\n"; while( $line = ) { if($line =~ /([\w\s]+)\s+(\d\d\d-\d\d\d\d)/ ) { print "$1 416-$2\n"; } else { print "$line"; } }