...
Design a wildcard that will match the files haiku.txt and mobydick.txt but not jabberwocky.txt in your Home directory.
Expand | |||||
---|---|---|---|---|---|
| |||||
There are always multiple ways of doing things in Unix. Here are two possible answers:
|
File attributes
Let's revisit a listing of our Home directory contents. Before we created any files, an ls -l listing looked something like this:
Ignoring that "total 779" line, there are 9 whitespace-separatedcolumns in this long listing:
- file permissions - a 10-character field
- number of sub-directories or symbolic links associated with a directory - rarely important
- account name of the file owner
- Unix group associated with the file
- file size
- last modification month
- last modification day
- last modification year, or last modification hour/minute if within the last year
- file name
Notice I call everything a file, even directories. That's because directories are just a special kind of file – one that contains information about the directory's contents.
Owner and Group
A file's owner is the Unix account that created the file (here student01, me). That account belongs to one or more Unix groups, and the group associated with a file is listed in field 4.
The owner will always be a member of the group associated with a file, and other accounts may also be members of the same group. The Unix group for our class is CCBB_Workshops_1. (To see the Unix groups you belong to, just type the groups command.)
Permissions
File permissions (and some information about the file type) are encoded in that 1st 10-character field. Permissions govern who can access a file, and what actions they are allowed.
- character 1 describes the file type (d for directory, - for regular file, l for symbolic link)
- the remaining 9 characters are 3 sets of 3-character designations
- characters 2-4: what the owning user account can do
- characters 5-7: what other members of the associated Unix group can do
- characters 8-19: what other non-group members can do
Each of the 3-character sets describes if read ( r ) write ( w ) and execute ( x ) actions are allowed, or not allowed ( - ).