Personal tools
You are here: Home Docs Help! Tutorials UNIX Tutorial for Beginners UNIX Tutorial Four

UNIX Tutorial Four

2.57142857143
No rating set

The use of pattern matching (wildcards), filename conventions and built in help systems.

A beginners guide to the Unix and Linux operating system by M.Stonebank. (surrey.ac.uk)
Page 4 of 8.

4.1 Wildcards

The * wildcard

The character * is called a wildcard, and will match against none or more character(s) in a file (or directory) name. For example, in your unixstuff directory, type

 % 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

The ? wildcard

The character ? will match exactly one character.
So ?ouse will match files like house and mouse, but not grouse.
Try typing

 % ls ?list

4.2 Filename conventions

We should note here that a directory is merely a special type of file. So the rules and conventions for naming files apply also to directories.

In naming files, characters with special meanings such as / * & % , should be avoided. Also, avoid using spaces within names. The safest way to name a file is to use only alphanumeric characters, that is, letters and numbers, together with _ (underscore) and . (dot).

Good filenames Bad filenames
project.txt project
my_big_program.c my big program.c
fred_dave.doc fred & dave.doc

File names conventionally start with a lower-case letter, and may end with a dot followed by a group of letters indicating the contents of the file. For example, all files consisting of C code may be named with the ending .c, for example, prog1.c . Then in order to list all files containing C code in your home directory, you need only type ls *.c in that directory.

4.3 Getting Help

On-line Manuals

There are on-line manuals which gives information about most commands. The manual pages tell you which options a particular command can take, and how each option modifies the behaviour of the command. Type man command to read the manual page for a particular command.

For example, to find out more about the wc (word count) command, type

 % man wc

Alternatively

 % whatis wc

gives a one-line description of the command, but omits any information about options etc.

Apropos

When you are not sure of the exact name of a command,

 % apropos keyword

will give you the commands with keyword in their manual page header. For example, try typing

 % apropos copy

Summary

Command Meaning
* match any number of characters
? match one character
man command read the online manual page for a command
whatis command brief description of a command
apropos keyword match commands with keyword in their man pages
 
Broadband Deals
Compare the best broadband deals available in the UK from all the leading Internet Service Providers including BT, Sky and Virgin Media.
IT Support Manchester
For IT support, Manchester based MailSure will provide technical support for your IT needs or take control of your IT requirements at any stage in your business development.
IT Support Bristol
IT Services and IT Support provider based in Bristol. Computer maintenance with server support as standard.
Mobile Broadband Deals
Compare the cheapest mobile broadband deals on Mobile Broadband Genie, the independent UK price comparison website.
Project Planning Software
Atlantic Global offers full solutions of project management software, including project planning software, timesheets and more
City Leased Lines
Dedicated 100Mbit fibre optic Internet and Cloud outsourcing in the City of London, call now on 020 7096 9004 or email sales@metro-tek.com
IT Support
For The Best IT Support In London Make Our IT Department Your IT Department. Microsoft Gold Certified Partner.
IT Support London
Efficent IT Support & Hosted Services for SME businesses in and around greater London.
Reliable Web Hosting
Affordable Web Hosting with one click installs for Joomla, Moodle, Wordpress and more!
Data Recovery
Professional data recovery services