-
You will put the results of this lab in a file in your home directory or a subdirectory
called lab2.txt. Open a terminal window and create this file with emacs.
-
Open a second terminal window and cd to /home/mathcs/courses/cs246/discworld.
-
For each of the following collections of files, list the files using ls with a
SINGLE glob expression. In the file lab2.txt, record the comand you used and the
results. Copy and paste each part from the second terminal window to the first.
Your output should look like this (including blank line between the parts, for readability.
(3a) ls a*
agnes albert angua atuin auditors
(3b) ...
- Files whose names begin with a.
- Files whose names end with s.
- Files whose names begin with a and end with s.
- Files whose names begin with a vowel.
- Files whose names end with a character other than a vowel.
- Files whose names begin with a vowel and end with a character other than a vowel.
- Files whose names contain a character other than a letter.
- Files whose names contain two o's.
- Files whose names contain two consecutive o's.
- Files whose names contain an a and an s in that order (not necessarily consecutively)..
- Files whose names contain exactly 3 characters.
- Files whose names contain at least 3 characters..
- Files whose names begin with one of the letters a through m.
- Files whose names begin with one of the letters a through m and have exactly 4 characters .
-
In your second terminal window, cd back to your own directory or a subdirectory and create
a file called foo. The easiest way to do this is with the command touch foo.
-
Use ls -l foo to list the file with its permissions.
-
The chmod command will change the permissions. Try chmod 777 foo and then list
the permissions again.
-
For each of the following sets of permissions, use chmod with permissions in octal to
set those permissions on foo and use ls -l foo to check whether the permissions
are correct. In the file lab2.txt, for each part list the command that you
used and the result of the ls command. Your output should look like this:
(7a) chmod 722 foo
ls -l foo
-rwx-w--w- 1 sullivan staff 0 Jan 28 21:24 foo
(7b) ...
- r---w---x
- rw-r-x-wx
- r--------
- -w-rw--wx
- rwxrwx---
- rwxrw-r--
- -w-r-x--x
- --xrwxr-x
-
In your second terminal window, cd to your home directory (or a subdirectory). Think of a
umask that will result in
permissions rw-r----- for ordinary files and rwxr-x--x for directories. Change your umask
to that umask using the umask commands. Create a file called foobar with touch and a
directory called xyzzy with mkdir. Use ls -ld to list the two files to make sure that you
had the correct umask. Add the output to lab2.txt. If should look like this:
(8)
umask ????
touch foobar
mkdir xyzzy
ls -ld foobar xyzzy
-rw-r----- 1 sullivan sullivan 0 Jan 29 11:06 foobar
drwxr-x--x 2 sullivan sullivan 4096 Jan 29 11:06 xyzzy
-
Repeat the previous instructions with r---w-rw- for ordinary files and
r-x-w-rwx for directories. Yes these are very weird permissions.
-
Turn in the file lab2.txt with turnin.
-
If you are finished and there is time left, work more on the emacs tutorial.