Linux Project 1: Exploring Linux Commands, Study Guides, Projects, Research of Computer Science

A series of linux commands and exercises for a project in cs361. Students are required to execute these commands on the linux machines in mak 1135 and answer specific questions related to the output. The exercises cover various topics such as file permissions, creating files, changing directories, and displaying file contents.

Typology: Study Guides, Projects, Research

Pre 2010

Uploaded on 08/19/2009

koofers-user-ors
koofers-user-ors 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS361 -- Project1 (Exploring introductory Linux)
Note: Be precise with your answers! For example would Ls and ls give you the same thing? Your work must be done
on (or telnetting into) our Linux machines in MAK 1135. Either type up your solutions or write very neatly. If you
work with one other person, hand in one copy with both your names on it and make sure you both understand each
problem and your solution. Note: Some questions may require you to look at some other commands in Sobell that we
have not specifically covered.
1. Suppose you have the following:
[eos10:/home/vangorpm/cs361f00/projects/project1]$ ls -l
total 12
drwxr-xr-x 2 vangorpm users 4096 Aug 29 09:51 dir1
drwxr-xr-x 2 vangorpm users 4096 Aug 29 09:53 dir2
drwx------ 2 vangorpm users 4096 Aug 29 11:02 dir3
-rw-r--r-- 1 vangorpm users 0 Aug 29 09:49 file1
-rw-r--r-- 1 vangorpm users 14 Aug 29 09:50 file2
[eos10:/home/vangorpm/cs361f00/projects/project1]$ <command?>
drwxr-xr-x 2 vangorpm users 4096 Aug 29 09:51 dir1
drwxr-xr-x 2 vangorpm users 4096 Aug 29 09:53 dir2
[eos10:/home/vangorpm/cs361f00/projects/project1]$
What <command?> (and any options?) will give you exactly the final listing above (i.e. the stuff in bold)?
2. State specifically how you could create file1 of size 0 bytes above. Your answer may not include an editor and must
be a command.
3. Suppose your current working directory contains file1 and file2. Write a command that would create another file
named file3 in the same directory that has the same i-node # as file1 (see listing below for final result after command).
[eos10:/home/vangorpm/cs361f00/projects/project1]$ ls -il
total 0
2048071 -rw-r--r-- 2 vangorpm users 3 Aug 29 10:05 file1
2048072 -rw-r--r-- 1 vangorpm users 0 Aug 29 10:07 file2
2048071 -rw-r--r-- 2 vangorpm users 3 Aug 29 10:05 file3
[eos10:/home/vangorpm/cs361f00/projects/project1]$
4. Write a one line command that you can use to display all (and only those) files in your current directory that end in
.c (dot c)? FYI: It is ok if the command also displays files in subdirectories that end in .c
5. Write a one line command that you can use to list all files in your current directory that contain a space?
6. Explain why du -b gave the output 12288? It appears that only 112 bytes are being used.
[eos10:/home/vangorpm/cs361f00/projects/project1/dir1]$ ls -l
total 8
-rw-r--r-- 1 vangorpm users 56 Aug 29 09:51 file3
-rw-r--r-- 1 vangorpm users 56 Aug 29 09:51 file4
[eos10:/home/vangorpm/cs361f00/projects/project1/dir1]$ du -b
12288 .
7. What happens when you attempt rmdir on a directory that contains files?
pf2

Partial preview of the text

Download Linux Project 1: Exploring Linux Commands and more Study Guides, Projects, Research Computer Science in PDF only on Docsity!

CS361 -- Project1 (Exploring introductory Linux)

Note: Be precise with your answers! For example would Ls and ls give you the same thing? Your work must be done

on (or telnet ting into) our Linux machines in MAK 1135. Either type up your solutions or write very neatly. If you

work with one other person, hand in one copy with both your names on it and make sure you both understand each

problem and your solution. Note: Some questions may require you to look at some other commands in Sobell that we

have not specifically covered.

  1. Suppose you have the following: [eos10:/home/vangorpm/cs361f00/projects/project1]$ ls -l total 12 drwxr-xr-x 2 vangorpm users 4096 Aug 29 09:51 dir drwxr-xr-x 2 vangorpm users 4096 Aug 29 09:53 dir drwx------ 2 vangorpm users 4096 Aug 29 11:02 dir -rw-r--r-- 1 vangorpm users 0 Aug 29 09:49 file -rw-r--r-- 1 vangorpm users 14 Aug 29 09:50 file [eos10:/home/vangorpm/cs361f00/projects/project1]$ <command?> drwxr-xr-x 2 vangorpm users 4096 Aug 29 09:51 dir drwxr-xr-x 2 vangorpm users 4096 Aug 29 09:53 dir [eos10:/home/vangorpm/cs361f00/projects/project1]$

What <command?> (and any options?) will give you exactly the final listing above (i.e. the stuff in bold)?

2. State specifically how you could create file1 of size 0 bytes above. Your answer may not include an editor and must

be a command.

3. Suppose your current working directory contains file1 and file2. Write a command that would create another file

named file3 in the same directory that has the same i-node # as file1 (see listing below for final result after command).

[eos10:/home/vangorpm/cs361f00/projects/project1]$ ls -il total 0 2048071 -rw-r--r-- 2 vangorpm users 3 Aug 29 10:05 file 2048072 -rw-r--r-- 1 vangorpm users 0 Aug 29 10:07 file 2048071 -rw-r--r-- 2 vangorpm users 3 Aug 29 10:05 file [eos10:/home/vangorpm/cs361f00/projects/project1]$

4. Write a one line command that you can use to display all (and only those) files in your current directory that end in

.c (dot c)? FYI: It is ok if the command also displays files in subdirectories that end in .c

5. Write a one line command that you can use to list all files in your current directory that contain a space?

6. Explain why du -b gave the output 12288? It appears that only 112 bytes are being used.

[eos10:/home/vangorpm/cs361f00/projects/project1/dir1]$ ls -l total 8 -rw-r--r-- 1 vangorpm users 56 Aug 29 09:51 file -rw-r--r-- 1 vangorpm users 56 Aug 29 09:51 file [eos10:/home/vangorpm/cs361f00/projects/project1/dir1]$ du -b

7. What happens when you attempt rmdir on a directory that contains files?

8. List a command or commands that will allow me to change to dir4.

[eos10:/home/vangorpm/cs361f00/projects/project1]$ ls -l drw-rw-rw- 2 vangorpm users 4096 Aug 29 11:04 dir

  1. Suppose you are given: [eos10:/home/vangorpm/cs361f00/projects/project1]$ ls -l total 24 drwxr-xr-x 2 vangorpm users 4096 Aug 29 09:51 dir drwxr-xr-x 2 vangorpm users 4096 Aug 29 09:53 dir drwx------ 2 vangorpm users 4096 Aug 29 11:02 dir drw-rw-rw- 2 vangorpm users 4096 Aug 29 11:04 dir [eos10:/home/vangorpm/cs361f00/projects/project1]$ ls -l dir1 dir dir1: total 8 -rw-r--r-- 1 vangorpm users 56 Aug 29 09:51 file -rw-r--r-- 1 vangorpm users 56 Aug 29 09:51 file dir2: total 8 -rw-r--r-- 1 vangorpm users 84 Aug 29 09:53 file -rw-r--r-- 1 vangorpm users 70 Aug 29 09:53 file [eos10:/home/vangorpm/cs361f00/projects/project1]$ <command?>

Write a one line <command?> that will put file3 from dir1 into dir2 and rename it as file3.bak

10. When you as a user on the EOS machines create a new directory, this directory immediately contains the number

2 in the links column. Why do you think this is?

11. Describe specifically what happens when this sequence of commands is given on one command line.

cal 5 2001; cal 6 2001; cal 7 2001 > summer.

12. List 4 different editors available on the EOS Linux machines (MAK 1135). Write a command that would help

give you this information.

13. Write a command that will allow you to look at only the first 7 lines of a file named cs361.c

14. Write a command that will allow you to look at only the last 10 characters of a file named cs361.c

15. Is each of the following an absolute pathname, a relative pathname, or a simple filename?

a. /home/vangorpm

b. cs361/unix/chapter

c. chapter

d. /home/vangorpm/public_html

e. ..

16. Create an ASCII text file with two or more lines on an EOS machine. Then FTP this file in ASCII mode to a DOS/

Windows9X system. Why did the file increase in size? You may answer this by stating what was added to the file.

Other Sobell Exercises:

P. 39, 40: 2, 3 (give 2 reasons), 7, 8, 11

P. 65: 5, 6, 10 (use an editor to create the file, also be very careful in how you answer this one)

P. 89, 90: 5, 12, 13, 14

P. 111-112: 2, 3, 9, 12a, 15