Lab1 : Basic Usage of the CS/CEE Department Server

Refer to notes 1 for references to this lab:

The purpose of this lab is to learn how to use the command-line environment used for CMPS 2010 assignments. You will learn how to login, logout, change your password, create a file, view files, and use the email client in this lab. In addition, create and manage directories, view and manipulate file permissions, compile a program, and manage your processes (executables).

What to complete for this lab

  1. Change your password
    passwd
  2. List all files in your directory including hidden (dot) files
    ls -al
  3. Use vi to create a file called helloMe.txt
    vi helloMe.txt
    Type a few lines including your name and 'lab1' then save and exit vi
  4. Copy 'helloMe.txt' and name the new copied file as 'lab1.txt'
    cp helloMe.txt lab1.txt
  5. Move (rename) 'lab1.txt' to 'lab_1.txt'
    mv lab1.txt lab_1.txt
  6. cat lab_1.txt
  7. less lab_1.txt and use q to exit
  8. Open alpine (email client) to write yourself an email attaching both 'helloMe.txt' and 'lab_1.txt' and send yourself the email. Label the subject as 'lab1 cs2010-<section#>'. You should see the email in your inbox if you use the down arrow to refresh the inbox. Alternatively, you can exit and reopen alpine.
  9. Print your present working directory
    pwd
  10. Make a new directory called 'cs2010'
    mkdir cs2010
  11. Move your 'lab_1.txt' to your cs2010 directory
    mv lab_1.txt cs2010/.
  12. Copy your 'helloMe.txt' to your cs2010 directory and rename the copy
    cp helloMe.txt cs2010/helloMe_copy.txt
  13. Remove the original 'helloMe.txt'
    rm helloMe.txt
  14. List all your files in the current directory you are in
    ls or ls -l or ls -al
    You'll notice that 'lab_1.txt' has been relocated from this dir and that 'helloMe.txt' no longer exists, so be careful when using rm!
  15. Change to your cs2010 directory
    cd cs2010
  16. List all your files in the current directory you are in
    ls or ls -l or ls -al
    You'll notice that your terminal has now changed from rowdyrunner@odin:~$ to rowdyrunner@odin:~/cs2010$ which means your 'pwd' is now 'cs2010'. Also, your original 'lab_1.txt' and helloMe_copy.txt' is present.
  17. Make a new dir called 'test' and then remove it
    rmdir test **Note: A directory must be completely empty in order to remove the directory
  18. Change directories to the current parent directory
    cd .. You'll notice your are back in your home dir
  19. Change the permissions of your cs2010 directory to be private
    chmod 700 cs2010
    ls -al to confirm that the permissions were changed
  20. Display your processes with detailed info
    ps ux
  21. Run the cat program in the background
    cat &
  22. Display your processes with detailed info
    ps ux and take notice to the PID for cat
  23. Attempt to stop the cat process
    kill <PID> and ps ux again. You'll notice that the process was not stopped
  24. Forcibly kill the cat process with '-9' flag
    kill -9 <PID> and ps ux again
  25. Congratulations, you've completed this lab. Raise your hand to show me that you've completed the steps. Practice this again at home. If you don't finish during the lab, you may show me tomorrow (Fri)

Top