Skip to main content

3. Basic operations

In this section you will learn how to copy, delete, move and interrogate the properties of files. Follow the links on the left to work your way through this section. Two important things you must read before you start:

1. Wildcards in filenames

You can use commands to refer to a set of files rather than just one file on its own, by using a filename that contains one or more wildcards . A wildcard matches a character or arbitrary sequence of characters. The notation for wildcards is as follows:

* denotes any sequence of zero or more characters
? denotes a single character
[cset] denotes any character defined in cset

The cset construct is written as a sequence of characters and character pairs. A character pair has the form c1-c2, it denotes characters c1 to c2 in the ASCII character set. Useful character pairs are a-z (the lowercase letters), A-Z (the uppercase letters), and 0-9 (numbers). A forward slash ( /) in the actual file name must be always matched by an explicit / in the pattern. A dot ( .) in the actual file name that comes at the start or follows a forward slash must be matched by an explicit dot in the pattern.


Example:

   
Name Refers to Does not refer to
gn*.1 gnu.1 gnostic.1 gn.1 gn/x.1
~/.[a-zA-Z]* ~/.login ~/.bash_profile ~/output
*/averag* input/avergit.f output/averages average
zztop? zztop1 zztops zztop_hits


2. The MAN page

To find out more about any of the commands you meet in this Module, use the man command. For example, to find out about the ls command (used for listing files), type man ls . You will get several pages of information, press the space button to see the next page, and 'b' for back a page. Hit 'q' when you're done reading. "Man" stands for manual pages. All of the commands covered in this Module will have their own man page. Just type
man command
for any given command. Sometimes there are more man pages for a certain command (e.g., for executable commands 1, and for library calls 3). To see the executable command man page, use man 1 command

Putting it into Practice:

What happens if you type
 man man 
Do you get information about the online manual?


System administrators are very big on manuals. If you seek help and advice from others in the linux community, a typical first response is..."have you read the man page?". Even the most experienced linux gurus have to refer to the man pages - so you should get into the habit of referring to the man pages before wasting other people's time.

You can make a start by using man to find out more about some commands you've already met, such as ps, top and tar, just to name a few.