Study guide for Summer 07 CSCI 330 Hint : Note the esquisite details of the questions. What control character signals end of file or input? What control character suspends the execution of a running foreground program? What control purges the contents of the current command line input buffer? What control character interrupts and terminates a running foreground program? What command allows you to set your password? Name the two programs that allow you to get help on a command. # Don't specify more options than are needed to match the problem. Give the command and option[s] that displays all processes running on the system. Give the command and option[s] that displays all processes belonging to you with a full information listing. Give the command and option[s] that lists all files, even hidden files, in the current directory. Give the command and option[s] that lists files and information about their type, permissions, link count, user and group id, size, last modification date and name. Give the command and option[s] that lists files the same information except it lists the last access time rather than modification date. Give the command and option[s] that lists files the same information except it lists the last status change time rather than modification date. Give the command and option[s] that lists files and their inode id. Give the command and option[s] that set permissions on the file crunch so that it has read, write, and executable permissions for the owner, read by the group, and executable for everyone else. Use octal format. Give the command and option[s] that sets suid bit for the file crunch. Use symbolic option and don't tamper with the other permissions. Give the command and option[s] to create a directory called 330. Give the command and option[s] to delete a directory called temp. The command should also delete any files in the directory at the same time. Assume permissions allow it. Give the command and option[s] rename the file 330 to 330_online. (Filename wildcards, next 4 questions ) Give the command and option[s] to list all files in the current directory that begin with the string data. Give the command and option[s] to list all files in the current directory that are four letter filenames. Give the command and option[s] to list all files in the current directory that begin with the string chap. and have a 1 digit extension of 2, 4, or 7. Give the command and option[s] to list all files in the current directory that begin with the string chap. and have a 1 digit extension in the range of 0 to 9. Use the symbolic range expression. Give the command and option[s] that fetches the last 18 lines of the file msgs. Give the command and option[s] formats the output of another command for printing with a header and page numbers. Send the output of ls to this command and use the option for 3 column format. Give the command and option[s] displays all the local variables and functions defined. Give the command and option[s] cuts the 3rd through the 5th fields from the /etc/passwd file. The file uses : (colon) as a field separator. Create the local changeable variable variable FTMODE and set it to active. Make FTPMODE exportable. Make FTPMODE unchangeable. Create the variable BACKUP as an unchangeable, exportable variable set to $HOME/backup.To all three actions with a single command. What variable configures the command line prompt? What variable designates the paging mechanism for any command that needs an external pager? What variable sets the size of the history list in memory? What variable sets the size of the stored history list when the shell terminates? What variable contains your login id? Assume you have created the file data. It has three time stamps : file access time (fat), file modification time (fmt), and status change time (sct). Use the abbreviations to answer the questions below. If no time change, use none (none). If after a time you cat the file, which timestamps change? If after a time you create a symbolic link to data file, which timestamps change? If after a time you append the output of a command to data, which timestamps change? If after a time you rename the data file, which timestamps change? You have the file data with a single name and a size of 230 bytes. Assume you are in the subdirectory /home/berezin/assn2. The following commands are run. ln -s /home/berezin/Data/data mydata ln /home/berezin/Data/data workdata If we were to list data, mydata, and workdata, What would the size of each be : data mydata workdata What would the link count of each be : data mydata workdata You have a directory called Data with the files data1 and data2 in it. You are in the parent directory of Data. And a file called data exists here. If the directory is set to only be readable and writable, will the following work? ls Data cp Data/data1 . cp newdata Data/newdata mv Data/data2 . cp data Data/data1 If the directory is set to only be writable and executable, will the following work? ls Data cp Data/data1 . cp newdata Data/newdata mv Data/data2 . cp data Data/data1 If the directory is set to only be readable and executable, will the following work? ls Data cp Data/data1 . cp newdata Data/newdata mv Data/data2 . cp data Data/data1 Write a function called lsl that runs ls with the long listing. Write a function that xtest that tests a file to see if it is executable, print the message "runnable". If test fails, no action required. Write a function that dtest that tests a file to see if it is a directory and it is readable, writable, and executable. If file fails any of these, print a message and set return code to 2. If successful, no action required. Write a function called rsort that takes a single argument that will specify a file to sort. It is to sort the file in reverse order and store it back in its original name. Use options. Do not use redirection. Write a function called findit that takes two arguments. The 1st is the directory to start search from and the 2nd is the file to look for. The function will use find to search the directory for the file specified. The output of find should be sent to less and any errors from find redirected to /dev/null