QuestionQuestion

1. Locate the command that will Display statistics on free disk space. What command will do this?
Create a command string that contains the above command and will display the disk space statistics in kilobytes. What command string will do this?

2. You want to save from line #10 to line #30 from file1 to a new file called file2. Use head and tail to do this with one command string (no 's).

3. Execute the finger command as the following:
          finger smcgowan
The output will contain the following line of text:

To put my C programming courses into Cyber-Ed format.

From where is the finger command getting that line of text?

4. Create a SINGLE command string that will locate all of the lines that do NOT contain the string /usr but must contain the string ksh within the file called /etc/passwd. Direct this output to a file called pout.
A.) What command string will do this?
B.) How many characters are in the file pout?

5. In your home directory, create a directory called MID.
cd to this directory.

Create the following files:
notes1a notes2 notes labnotes Notes1 Notes2 labs

Execute the following commands in the exact order specified:
rm Notes2
ls -ld labnotes notes2 notes
cat labs notes labnotes

Using ONLY history references and word identifiers, from these three commands, construct a command string that will remove the files called notes2 and labs.
A.) What command string will do this?

Construct a command string that will remove the files Notes1 and notes1a. This string MUST make use of the [ ]. (Please note that this question does NOT involve using history references)
B.) What command string will do this?

6. Create an alias called whopw that will do the following:
grep the password file for your username to return your password file entry. Assume the following: once the alias works, you will be letting all of your friends copy and use it. In other words, the alias must locate their password entry when it is run by them without them having to make ANY changes to the alias.
HINT: One way to solve this problem can be found by searching the man pages for the string 'who'
What alias will do this?

7. Normally, when you execute the man command, the output is displayed one page at a time.
If you did not want the output of the man command to be displayed by pages, (i.e. you want all the output at once, as if you were cat'ing a file) what man command option would you use to prevent the paging?

8. I have created an alias called class within my .mailrc file. The alias includes the addresses of all the students in the class as well as my address. Normally, when sending mail to an alias, the sender will not receive a copy of the message even if the senders address is included in the alias.
What mail internal variable do I need to set to insure that I receive a copy of the mail message too?
(Note: we are talking about the "Mail" or "mailx" command, not "mail")
9. Consider the following command string.
cat > aa < mfile1
A) What is the effect of the redirection characters? Be specific and mention each redirect in your answer.
B) Write another UNIX command that will accomplish the same thing. (Do not use cat or either redirect or a pipe)

10. cd to ~smcgowan/Cyber/Unix. This directory contains a number of files.
What combination of option flags, when used with the ls command, will generate the output in the following format?
Please note that this output is old, so you can IGNORE any date/time field differences or disregard the fact that there may be a missing or extra file or two. The point is to get the correct type and format of the output.

total 100
-rw-r--r--   1 10013    200         1124 Feb 14 19:17 welcome.txt
-rw-r--r--   3 10013    200       28744 Feb 14 19:17 vitutor
drwxr-xr-x   3 10013    200          512 Feb 14 19:17 TarDir/
lrwxrwxrwx   1 10013    200          38 Sep 2 2005 Scripts -> /users/faculty/smcgowan/Spring/Scripts/
drwxr-xr-x   2 10013    200          512 Feb 14 19:17 Practice/
-rw-r--r--   1 10013    200          21 Feb 14 19:17 numdata
drwxr-xr-x   2 10013    200          512 Feb 14 19:17 Links/
drwx------   2 10013    200          512 Mar 4 18:55 Junk/
-rwxr-xr-x   1 10013    200          536 Feb 14 19:17 greeting*
-rw-r--r--   1 10013    200         1141 Mar 4 13:34 grades.dat
lrwxrwxrwx   1 10013    200            7 Sep 2 2005 for-midterm -> numdata
drwxr-xr-x   4 10013    200          512 Feb 14 19:17 Final/
drwxr-xr-x   3 10013    200         1024 Feb 14 19:17 FAQ/
drwxr-xr-x   5 10013    200          512 Feb 14 19:17 Extra/
drwxr-xr-x   2 10013    200          512 Feb 14 19:17 Data/
-rwxr-xr-x   1 10013    200          47 Feb 14 19:17 csh.cshrc*
-rw-r--r--   1 10013    200          273 Feb 14 19:17 compute-midterm-grades
-rw-r--r--   1 10013    200          191 Feb 14 19:17 autos
drwxr-xr-x   6 10013    200          512 Jan 26 13:00 ../
drwxr-xr-x 10 10013    200          512 Mar 4 13:34 ./

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

Question 5
A)      Answer: assuming that the 1st command has number 686 in history, the 2nd command has the number 687 in history and the last command has number 688 in history, the required command string will be:
$!686:0 !687:3 !688:1

B) $rm *otes1*
There are more ways to accomplish this task – if it is needed to be used [], this means by searching patterns in the filename. The *otes1* means the same thing. It is confusing for a bit because from the formulation it can be understood in more than one way.

Question 6) alias whopw='ypcat passwd | grep `whoami`'...
$30.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Linux Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats