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
- Change your password
passwd
- List all files in your directory including hidden (dot) files
ls -al
- 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
- Copy 'helloMe.txt' and name the new copied file as 'lab1.txt'
cp helloMe.txt lab1.txt
- Move (rename) 'lab1.txt' to 'lab_1.txt'
mv lab1.txt lab_1.txt
cat lab_1.txt
less lab_1.txt
and use q
to exit
- 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.
- Print your present working directory
pwd
- Make a new directory called 'cs2010'
mkdir cs2010
- Move your 'lab_1.txt' to your cs2010 directory
mv lab_1.txt cs2010/.
- Copy your 'helloMe.txt' to your cs2010 directory and rename the copy
cp helloMe.txt cs2010/helloMe_copy.txt
- Remove the original 'helloMe.txt'
rm helloMe.txt
- 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
!
- Change to your cs2010 directory
cd cs2010
- 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.
- 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
- Change directories to the current parent directory
cd ..
You'll notice your are back in your home dir
- Change the permissions of your cs2010 directory to be private
chmod 700 cs2010
ls -al
to confirm that the permissions were changed
- Display your processes with detailed info
ps ux
- Run the cat program in the background
cat &
- Display your processes with detailed info
ps ux
and take notice to the PID for cat
- Attempt to stop the cat process
kill <PID>
and ps ux
again. You'll
notice that the process was not stopped
- Forcibly kill the cat process with '-9' flag
kill -9 <PID>
and ps ux
again
- 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