IT 244: Introduction to Linux/Unix
Class 3 Exercise, Tuesday, February 2nd
When finished: Remember to check with instructor to make sure you are recorded as having completed the class exercise!
Open new CLI window for this exercise. (PowerShell, Command Prompt, PuTTY, Mac Terminal, etc.)
Depending on your app, set "screen buffer" size to something generous, such as at least 1000 lines. We can address this in class, as needed. Be prepared to copy CLI window contents, at exercise end.
Log in to pe15
- Run the ssh client
Use the values in the table below to connect to pe15.
In the value for host listed below, the first string, pe15, specifies the
machine, on the Unix network, that you will connect to.
ssh configuration parameter |
value |
protocol | ssh |
ssh version | 2 |
ssh port | 22 |
host | pe15.cs.umb.edu |
user name | your unix username |
Authentication method | password |
- Enter your password
A dialog box will appear on the screen into which you must type the
password for your Unix account.
Create ex and ex03 Directories
- Make sure you are in your home directory
cd
- If your it244 directory was created and it now exists, then go into it. (Otherwise, we'll need to help you set it up.)
cd it244
- Create an ex directory
mkdir ex
- Go to your ex directory
cd ex
- Create an ex03 directory
mkdir ex03
- Go to your ex03 directory
cd ex03
nano
- Run nano creating a text file named today.txt
nano today.txt
- Practice with nano
Write a few sentences about what you did today.
Use as many of the nano commands, which you see at the bottom of the page, as you can.
The ^ character you see before each letter in the
help menu at the bottom of the page tells you to hold down
the Control key as you type the letter of the command.
Some important commands do not appear in the menu.
Control + A will take you to the beginning of the line, Control + E will take you to the end of
the line, and Control + K will delete the current line.
When you use Control + K, the line you deleted is placed in a buffer.
You can get this line back, pasting it in your current position in the file. using Control + U.
- Save the file
Control + O
After typing this command, the file name will appear at the bottom of the screen.
Hit Enter, to indicate that this is the correct file name.
- Quit nano
Control + X
- Look at the contents of the file
cat today.txt
script
Stopping the Execution of a Command
- Run a command that cannot finish
To see how this works, we'll try to run ssh using an account on users that
doesn't exist.
ssh foo@users.cs.umb.edu
If you get a message saying the authenticity of host cannot be established, type "yes".
No password you can enter will allow this command to complete, because you are trying to log
into an account that does not exist.
- Abort the program
Control + C
This is the only way you can get out.
Command Line Editing Practice
- Type something at the command line
foo bar bletch
- Move to the beginning of the command line
Control + A
- Move to the end of the command line
Control + E
- Clear the command line
Control + U
Use the History Feature
- Retrieve the last command
⇑
- Retrieve the command before that
⇑
- Return to the last command
⇓
Look at a man Page
- Run man on ls
man ls
- Scroll down one screen
Space
- Scroll down one line
Enter
- Scroll up one line
⇑
- Scroll down one line
⇓
- Quit man
q
Experiment with apropos
- Run apropos on the word "link"
apropos link
Use info
- Run the info command on the word "link"
info link
- Display the help menu
h
- Close the help menu
x
- Quit info
q
- Run info without an argument
info
You should see the first page of the info system.
- Look at the file permission entry
m
At the bottom of the screen, you should see the following prompt
Menu item:
Enter the "File" then hit the Tab key, then press Enter.
- Go to the previous node
p
You should see the entry for "Numeric operations"
- Return to the File permissions node
n
- Look at the "Mode Structure" Link
Keep hitting the down arrow until you are on the line with an * and the words "Mode Structure"
Hit Enter
You should see the "Mode Structure" page
- Quit info
q
When finished:
- Remember to check with instructor to make sure you are recorded as having completed the class exercise.
- To do this:
- Select/highlight all of the text in your CLI window, from this exercise.
- Copy that text to the clipboard. Note that usual text copying shortcuts may not -- and likely WILL not -- work!
- Make sure you are in your Exercise 3 directory:
cd /home/YOUR_USERNAME/it244/ex/ex03
- Open a new file for editing:
nano ex03_cli.txt
- Paste the copied text into your editing field in nano. Note that usual text pasting shortcuts may not -- and likely WILL not -- work!
- Save file and exit from nano.