UNIX Tutorial Four: 4.1 Wildcards
UNIX Tutorial Four: 4.1 Wildcards
UNIX Tutorial Four: 4.1 Wildcards
4.1 Wildcards
% ls list*
This will list all files in the current directory starting with list....
Try typing
% ls *list
This will list all files in the current directory ending with ....list
% ls ?list
On-line Manuals
% man wc
Alternatively
% whatis wc
Apropos
% apropos keyword
will give you the commands with keyword in their manual page
header. For example, try typing
% apropos copy
Summary
You will see that you now get lots of details about the contents
of your directory, similar to the example below.
• The first three (rwx) gives the file permissions for the user that
owns the file (or directory) (ee51ab in the above example);
• The next three (rw-) gives the permissions for the group of people
to whom the file (or directory) belongs (eebeng95 in the above
example);
• The last three (r--) gives the permissions for all others.
• r (or -), indicates read permission (or otherwise), that is, the
presence or absence of permission to read and copy the file
• w (or -), indicates write permission (or otherwise), that is,
the permission (or otherwise) to change a file
• x (or -), indicates execution permission (or otherwise), that is,
the permission to execute a file, where appropriate
Some examples
-rwxrwxrwx a file that everyone can read, write and execute (and delete).
a file that only the owner can read and write - no-one else
-rw------- can read or write and no-one has execution rights (e.g. your
mailbox file).
5.2 Changing access rights
Symbol Meaning
u user
g group
o other
a all
r read
w write (and delete)
x execute (and access directory)
+ add permission
- take away permission
Exercise 5a
% sleep 10
% sleep 10 &
[1] 6259
The & runs the job in the background and returns the prompt
straight away, allowing you do run other programs while waiting
for that one to finish.
The first line in the above example is typed in by the user; the
next line, indicating job number and PID, is returned by the
machine. The user is be notified of a job number (numbered
from 1) enclosed in square brackets, together with a PID and is
notified when a background process is finished. Backgrounding
is useful for jobs which will take a long time to complete.
Backgrounding a current foreground process
% sleep 100
% bg
% jobs
% fg %jobnumber
% fg %1
% sleep 100
^C
% kill %jobnumber
% kill %4
To check whether this has worked, examine the job list again to
see if the process has been removed.
ps (process status)
% kill 20077
and then type ps again to see if it has been removed from the
list.
Summary