Getting Started : Exercises
Exercise 1 : Connecting to linux.ox.ac.uk
- Launch a terminal session program (TELNET).
- Type
linux.ox.ac.uk then press the <Return> key.
- You will be asked for your username at the
login: prompt.
- If you have logged in successfully, you should see the
linux.ox.ac.uk%
prompt.
Exercise 2 : Simple Commands
- Find out the current date and time with the
date and
time commands. Date gives the current date and time
while time gives the command execution time.
- Examine the current quota for your course username by typing
quota
Exercise 3 : Accessing Help
- On linux.ox.ac.uk, there are two help systems, the
man pages as
described above and Help on using linux.ox.ac.uk which is an OUCS system.
To access the Help on using linux.ox.ac.uk information, type
help and press <Return>.
- Read the instructions at the bottom of the screen to see how to use
the information system.
- Move around the options on the screen using the arrow keys. Various
words will be highlighted as you move. Pressing <Return> when the
item you want is highlighted will take you to the page of information on
that topic.
- Browse through the headings available under
General Help on Unix.
Exercise 4 : Changing your Password
- The password rules on linux.ox.ac.uk can be quite complicated. Details about
them and how to change your password can be found by typing
help
(as above), then selecting Getting Started on linux.ox.ac.uk and
Passwords. If you are already in Help, type M
for the Main Menu and confirm that is where you want to go then
select Getting Started on linux.ox.ac.uk.
- Read through the information given.
- When you have read it, quit from the help system by typing
q
and confirming that you wish to quit.
- To actually change your password type
passwd and follow
the instructions to change your password to one of your choice, remembering
the rules and guidelines given in the help system. But only do this if
you wish to change your password.
Exercise 5 : Using the Man Pages
- Look up the man page on the
ls command. What does the
ls option -x do?
- Find out what sub-commands are available while browsing the man pages
by typing
h
- When you have finished reading the information, type
q to
return to the linux.ox.ac.uk% prompt. Alternatively, browse to the
end of the information, press any key and the linux.ox.ac.uk% prompt
will reappear.
- Look up the page for
mv then use man -k rename to
list all the pages on the topic of renaming files and directories. Is
mv one of the pages listed?
- Type
man quota to find out about the quota command.
Search for the next page containing the word group by typing
/group then pressing <Return>.
Exercise 6 : Manipulating Files
- List all the files in your current (home) directory with
ls.
- Try typing
ls -l to see the difference. This will give
more information on the files. How many directories do you have?
- List the files using
ls -a to see the hidden files and
finally with ls -la to see all information on all the files.
- List full details for everything beginning with
v using
the ls -l v* command.
Exercise 7 : Creating a File
- Create a file called
intro using the pico editor
by typing pico intro and type the following text into it:
Two files in your main (home) directory are executed automatically
on login. One, .cshrc, contains C-shell setup material, that is set commands
to define various shell variables and alias commands to provide alternative
names for commands. In fact, this file is executed whenever you begin a
(new) C-shell, including at the start of a batch job.
- Save the file and leave pico with <Ctrl/x>. Confirm you want
to save the file and press <Return> to accept the filename.
Exercise 8 : Displaying and Printing Files
- Display this file on the screen with the
cat intro command.
- Use
cat to display a file on the screen.
- Display the file again but this time use
more to see it
a page at a time.
- Print
the file on the userarea lineprinter.
Exercise 9 : Copying, Renaming and Deleting Files
- Use
cp afile text to copy the file called afile
to text.
- Copy
afile2 to text. text already
exists and you do not want to overwrite it so type n, when
asked to confirm your actions, to cancel the copy.
- Rename
text as txt with the mv command.
- Now copy
afile2 to text again. This time
there is no file called text to be overwritten.
- Type
rm t* to delete all files starting with t.
Only confirm deletion of text.
- Rename
txt as afileand delete text.
You should now have all the same files as when you started! Check with
ls.
Exercise 10 : Redirecting Input and Output
- List your home directory to the file
dirlist with the
ls > dirlist command. Use pico to check the contents
of dirlist.
- The
finger command can be used to obtain brief details
about people who have usernames on a particular machine. Type finger
chris | more to list the people called Chris a page
at a time.
Exercise 11 : Working with Directories
- Create a subdirectory called
coursestuff under your home
directory with the mkdir command.
- Change directory to
coursestuff and list its contents.
- Copy the some files to this directory. As they are in your home directory
and you are currently in the
coursestuff directory, you will
need to use cp ~/***** .(full stop). The full stop means 'here'.
That is, copy this file to the current directory and keep its name.
- Create another new directory under
coursestuff called
newfiles
- Change directory to
newfiles and check the path with the
pwd command.
- Type
cd then pwd to move back to your home
directory and check its path.
- From your home directory, move the a file from the
coursestuff
directory to the newfiles directory and rename it as
first. The command will be:
mv ~/coursestuff/***** ~/coursestuff/newfiles/first
- Type
ls ~/coursestuff/newfiles to check.
Now, change directory to coursestuff and copy another file to
newfiles, renaming it as second. Type cp ******* newfiles/second. When
moving or copying files the pathnames can often be simplified depending
on which directory you start from.
- From the
coursestuff directory, type rmdir newfiles
to delete the directory. As it is not empty, you will not be able
to.
- Change directory to
newfiles, check its contents, which
should be first and second, and delete them with
rm *
- Use
cd .. to go back down the directory structure to
coursestuff and delete the newfiles directory. This
time it will succeed.