Essential UNIX commands:
passwd-- to change your password
ls-- list the contents of a directory
cp file1 file2-- to copy file1 to file2
mv file1 file2-- move (or rename) file1 to file2
rm file-- to remove (delete) a file
more file-- to print contents of file a page at a time
pwd-- to print the working directory name
cd dir_name-- to change working directory
mkdir dir_name-- to create a directory
rmdir dir_name-- to remove a directory
chmod-- change file mode (access permissions)
who-- who is on the system
man command-- manual information about command
joe-- edit files
history-- list the last commands used
-- type !num to redo command num
exit-- log out (you can also use logout)
Remember Unix is case-sensitive (most commands are in lower case).
Don't forget to log out!
- Log on to sun3.cs.plu.edu using Telnet.
- Type in your user id and password at the prompts.
- (If you have not already done so, use passwd to change your password.)
- To find out the name of your account directory type: pwd
- To get a list of the files in your directory type: ls -al
- Create a subdirectory called csce270 by typing: mkdir csce270
- Do another ls -al, notice the directory csce270 is now also listed.
- Change to the csce270 directory by typing: cd csce270
- Do another pwd to confirm you are in the csce270 subdirectory.
Do another ls -al, you will see that csce270 is empty.
- Now we will edit a file using the joe editor. Type: joe test.txt
- You will see a summary of special commands, if you press ctrl+K followed
by typing H. (for help)
- You may simply start typing text in your file. You may move around the file using
the arrow keys or the special control keys.
Please enter the following in your file, substituting your information for the
Log out by typing exit or logout
- Name: your name
Major: your major
Musical Artist: your favorite
Sport: your favorite
Actor/Actress: your favorite
Then, use ^K followed by D to save.
- To EXIT: ^K followed by X.
- Do an ls -al to confirm that csce270 contains the file test.txt
- Make a copy of the test.txt file using the cp command: cp
- Do an ls -al to confirm that a copy has been made.
- View the contents of file test2.txt using the more command: more test2.txt
- Rename test.txt using the mv command: mv test.txt test1.txt
- Do an ls to confirm.
- Delete a file using the rm command: rm test2.txt
- Do an ls to confirm.
- Move up one level in the directory tree using the cd command: cd ..
- Do a pwd to confirm.
- Use the man command to display information about the chmod command: man chmod
- Use chmod to change the access permissions for the files in the csce270 directory
so that the owner may read,
- write and execute, the group may read and write, and others may read.
- Then change the permissions so that only the owner may access the file.
- See who else is on the system, type: who
- Find out how many users are on the system by piping output from who to wc using
the command:who | wc -l
- Use output redirection to send a command's standard output to a file using the
command: who > whofile
- Verify that whofile contains the output from who using the more command.
- Use input redirection to get a commands input from a file rather than standard
input: ls -l < whofile
- Remove whofile.
- See who you are (in case you have forgotten), type: whoami