Day 1 - morning
Basic UNIX exercises
1. Go into the subdirectory called "unix". Verify all exercises by doing "ls"
- Copy the file "foo.txt" into "foo.txt.copy".
- Rename the file "foo.txt.copy" to "foo2".
- Move the file "foo2" into the "data" subdirectory.
- Create a new subdirectory called "new" in the unix directory.
- Move the file "foo2" in the "data" directory into the "new" directory.
- Move the file "foo2" in the "new" directory back into the "unix" directory and change the name to "foo.old".
- Delete the file "foo.old".
- Remove the "new" subdirectory.
[Answers]
2.
- Display the file "verylong.seq" on the screen using "cat" command.
- Same as 2a but use the "more" program instead.
- Test to walk upwards and downwards in the file using the "more" program.
- Search for the word "Length" using the "more" and the "less" program, compare the results.
- Access the online help in the "more" program, then exit from the program.
3.
- Change the protection of your own file "foo.txt" so that anyone may read it.
4.
- Make a copy of the file "edit.me" and edit it using the "pico" editor.
- Make another copy of "edit.me" and call it "edit.txt"
- Access your account using your browser, and view the file "edit.txt"
5.
- Change the password to your account.
6. Use the man pages to find answers to the following:
- What is the option to "ls" to list all files?
Try it in your home directory.
Which files do you see now that you don't see with "ls" alone?
- What is the option to "ls" to list all files in all subdirectories. Try it.
- What is the command to count lines, words and characters in a file?
- How do you make this command display only the number of lines?
7.
- Use the "ls" command and list all files that contains "seq" in the filename.
- Copy all files in the "unix" directory into the "text" subdirectory.
- Make a list of your files into a file.
- Copy the content of all files that contain "seq" in their filename, into a file called "tot.txt".
- Write a single command that shows how many files you have in your current working directory.
8.
- Display the first 5 lines of the file "verylong.seq" on the screen.
- Do a case insensitive search for the string "length" in all files.
- Compare the files "1.txt", "2.txt" and "3.txt". Which one is different from the others?
- Put the first 7 and last 7 lines of the file "verylong.seq" into a file called "first-and-last".
9.
- List the names of all files in your whole account that end with "seq" in their filename.
- List all files created or changed during the last 24 hours.
10.
- Find out who is logged on using "w", "who" and "finger".
- Find out which processes that are running using "top".
- Get more information about one account using "finger accountname" where accountname is the name of the account. What does "No plan" mean?
11.
- Look at the file "test.ps" using the "more" command. What does it look like?
- Locate the same file using your browser, and click on its name. What does it look like now?