Introduction to Linux: Basic Command-line Control

advertisement
Introduction to Linux: Basic Command-line Control
You need to become familiar with the Linux command-line. Depending on your previous
experience you can either work through or skip the tutorials. All students must complete
the problems at the end.
A. Introduction to the command line: A basic introduction to using the command line is
available at: http://www.tuxfiles.org/linuxhelp/cli.html
A slightly more advanced tutorial can be found here: http://vic.gedris.org/ManualShellIntro/1.2/ShellIntro.pdf .
Other tutorials are available on line. Use the listed tutorials or your favorite search engine
to find one that you like better.
B. Utilities to help you find and understand commands: The important difference
between the command line and GUI interfaces is that the command line expects you to
know and type in the appropriate commands. Therefore a key topic in learning to use the
command line is learning how to find commands, find files and find information on
commands. There are several ways to do this.
Firstly there are lists of commands. Here is one useful list.
http://www.computerhope.com/unix/overview.htm
Secondly there are commands and utilities to help understand the commands and use them
correctly.
The “man” utility: ‘man’ helps you find out the syntax of a command. Type man man in a
terminal window and explore the man utility. The normal way to use man is to type man
<command name>
The ‘info’ utility: Info is similar to man but more sophisticated with search and navigation
capability. Type ‘info’ into a terminal window and then ‘h’ to work through a simple
tutorial.
Problems:
1, Explain briefly what each of the following commands (or utilities) do. If you are not
familiar with these commands you will need to research a few references for each
command to find a good explanation of what they do. Do not simply cut and paste solutions
from some reference, use your own words. If necessary use the information above to help
find the answers.
man
info
whatis
apropos
whoami
grep
2. Set up an alias so that when you type the command ll (two ‘ells’, not two ‘ones’) into the
command line it lists all files, including those that start with a dot (normally hidden) and
shows files in long format (includes ownership information and much more). Test your
alias out and make sure you can see complete directory information. List the complete
syntax of the appropriate command(s) necessary for this.
3. Give the complete command syntax of commands necessary to find two files called
somejunk.txt and somejunk.tmp with a single command. Assume that the two files
are in the same directory and that the files could be in any directory below the root
directory (/).
Solve this with as few commands as possible, ideally one, if possible.
Grading: correct descriptions of the listed commands 3 points each. Subtract points for
confusing or incomplete explanations. Zero points if the answer is pasted from man or
similar utility.
Correct syntax for each command needed 5 points. For question 3, two bonus points for
two commands and three bonus points for a single command. (max 8 points for q3).
Download