Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

LAB ACTIVITY 2: SYSTEM HIERARCHY AND BASIC COMMANDS

SYSTEM HIERARCHY

1 | Page

LOGGING IN, LOGGING OUT AND SWITCH USER


Logging In
User: Login using your user name and password you set earlier.
Root: login using root password you set earlier
Switch User
Switch user to normal user: using command

su

Switch user to root user: using command

su

Note: Dont enter


<username> in your
command. You have
to enter your own
username without the
<username>
< >
-

Logging out
Apply command exit or logout or Ctrl + D (close the terminal)
NOTE: you may refer to the manual in the system by enter
man exit

man

login or

FINDING YOURSELF
To find out the name of the current directory, enter pwd
To find out the name of current directory and its contents, enter
To find who are you, enter

ls

pwd

whoami

NOTE: you may refer to the manual in the system by enter

man whoami

LISTING DIRECTORIES AND FILES WITH ls


To list the files and directories of the directory you are in, enter
To list the files and directories of a specified directory, enter

ls
Note: directory name
is changeable
ls /bin

CHANGING DIRECTORIES WITH cd


To change directories, enter

cd

Note: directory name


is changeable
/Home

To move up one level in the directory tree , enter


To move to a specific directory , cd projects

Exercise:
2 | Page

cd

..

Note: directory name


is changeable

Task: Change Directories and List Directory Contents


1. Log in with your username and password. (ex:Username = wserver1
password=password1)
2. Start your terminal.
3. Change to /tmp directory by entering cd
/tmp
4. Display the name of the active directory by entering pwd and see the result.
5. Change to the home directory by entering cd ~
6. Display the name of the active directory by entering pwd
7. Change to the /usr/share/doc directory by entering cd /usr/share/docs and enter
ls to view the content of this file.
8. Display the name of the active directory by entering pwd
9. Change back to the last directory (home) by entering cd ~
10. Display the name of the active directory by entering pwd
11. Display the content of the current directory by entering ls
12. Display the content of the current directory, including the hidden files, by entering ls
-a
13. View the permission and the file size of all the files in the current directory by
entering ls -la
14. Close the terminal window by entering exit

NOTE: you may enter more than one terminal and login with more than
one user by click Open New Tab.

3 | Page

You might also like