and the system will respond with:
Changing password for .
(current) Linux password:
Enter your current password. As before, it will not appear on the screen. If you typed it correctly you will be prompted for your new password:
New Linux password:
Re-type new Linux password:
Type your new password. Once again, it will not appear on the screen. If the system does not consider it to be a good password, it will let you know. Once you type your password, the system will ask you to type it again. This is so the system can make sure that you typed it right the first time. When the Linux prompt shows up again, you have successfully completed changing your password. Remember what you typed in because the system will ask for it every time you log on!
Email
There are a variety of different email programs used with Linux. I find alpine to be the easiest to use for simple things. When someone has sent you mail, the system will prompt:
You have new mail.
when you log on. To see your mail or to compose new mail simply type:
alpine
Followed by hitting return. From the pine main menu, you can view your mail by going into “Folder List” and hitting return on “INBOX”. To compose new mail, simply hit a capital C from the main menu. To exit, hit Q.
Let’s look at some of the commands available to you through Linux.
The first of these is list. To get a listing of your files on the screen, type
ls
Then hit the return key. Now, create a directory named Lab1 and change into it by typing mkdir Lab1. Now, change into it by typing cd Lab1.
Copying: You can make a copy of a file using the command cp. After the cp, you need to give the source and the destination of the copy.
From time to time I will put files in a public area so everyone can access them. This public area for this class is called /pub/digh/IST126 . To see what’s in the public area, use the command ls followed by the subdirectory you want to list:
ls /pub/digh/IST126/Lab1
There is a file there you will need for this lab, lab1.file. Now, let’s copy this file to your account using this command:
cp /pub/digh/IST126/Lab1/lab1.file lab1.file
Renaming: You can change the name of a file with the mv (short for move) command. After the mv, you have the old name, then the new name, so rename the file lab1.file to sample1, use the command:
mv lab1.file sample1
Viewing: You can view the contents of a file with the command cat (short for concatenate):
cat sample1
will display the contents of the file sample1. If a file is too large for the screen, it will scroll off quickly. To view the file one screenful at a time, use the command more :
more sample1
The computer will pause after each screen. Type to continue.
Removing files: Use the command rm (short for remove) to delete files:
rm sample1
will remove the file of sample1. Be very careful. It takes very little effort to delete all of the files in a subdirectory!
Editing Files
We will use the vim (short for visual) editor in this class.
The vim editor has two modes (ways of interacting with you): insert mode and command mode. In the insert mode, the characters you type appear on the screen as part of the file. They are inserted into the file. In command mode, the characters you type cause various things to happen to the file. Make sure you have the handout “Linux_vim Handout”. The last page is very helpful.
When you enter vim, you are automatically in command mode. Once you get into insert mode, you can return to the command mode at any time by pressing the escape key. The letter i is one of several letters that allow you to enter the insert mode.
Enter vim to edit the file horton by typing:
vim horton
Now, let's type the following outline into our first file exactly as it appears below:
I meant what I said
and I said what I meant
An elephant's faithful
one hundred percent
Add a line with your name at the top of the file. When you're done typing, hit the escape key and type the command :wq to exit and save your information. (The ‘:’ moves the cursor to the bottom of the screen to receive a command, the ‘w’ writes the file, and the ‘q’ quits.)
Do an ls when you return to your cobra prompt to verify that your work has been saved.
Check yourself. Using vim, open the file horton and verify that your text is all okay. Then exit.
Getting Help
There are on-line manual pages for almost every Linux command. To see the page for the ls command, use the command: man ls
Directory Maintenance & Practice with rsync & tar
There are a number of ways to move around in subdirectories. The command pwd is used to print the name of the directory you're currently in (it stands for "Print Working Directory"). Now, try each of the following :
cd .. To move up one level
cd ~/ To move to your home directory (Just cd will also do this)
cd Lab1 To move to a specified directory in your home directory from your home directory
cd ~/Lab1 To move to a specified directory in your home directory from any other directory
chmod ugo+rw horton To give read & write permission to all with file horton
cp –rR /pub/digh/Concord . To copy a directory & all its subdirectories to your current area (don’t forget the space, dot, and then return at the end)
rsync –azv /pub/digh/Concord ~/backup To remote sync everything from /pub/digh/Concord to a backup directory in your top level
tar –cf concord.tar Concord To mount all the contents of directory Concord to file concord.tar
rm –rf Concord To delete the directory Concord
tar –xf concord.tar To “un-tar” concord.tar & recreate the directory Concord
Short Answers on Linux – Type up the answers to each of the following in a file named lab1.answers in your Lab1 directory of your cobra account. Use your handouts.
1. Next lab, what Linux command will you use to change into your Lab2 subdirectory? ________
2. Next lab, what Linux command will you type to make a directory named Lab2 within the Labs subdirectory? (You will create a new subdirectory for each lab.) ___________________________
3. What Linux command will move you up one level from your current directory? _____________
4. What Linux command would you to use mount multiple folders into a single file? _________
5. What Linux command would let you see who else is logged in? ______________
6. What Linux command could be used to rename the file mydata as input1? _____________
7. What is one vim command that puts you into insert mode? ____________________________
8. What is the only way in vim to leave insert mode and go into command mode? ____________
9. What single letter vim command deletes a character? _________________________________
10. What vim command is best for replacing a letter? ___________________________________
11. What vim command deletes a word? ______________________________________________
12. What vim command deletes a line? _______________________________________________
13. What vim command allows you to save changes to a file without exiting vim? _____________
14. What vim command allows you to exit vim without saving any of your changes? __________
15. What vim command moves you to the end of a file? _________________________________
Now, let's exit your account and return to your personal computer by typing exit. Don't ever leave your account without first exiting it.