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

CC 216 Operating Systems Jan-Apr 2021

Ubuntu Lab Manual 2

Use ubuntu in VirtualBox or Go to: https://linuxcontainers.org/lxd/try-it/

Before you start the following command, make sure you are log in as super user to
have administrator privileges.

1. Adding or Creating New User

In order to add new user account, type adduser <username>.


Type password for new user.
Re-type password for new user.
Type details information of users.
CC 216 Operating Systems Jan-Apr 2021

2. Checking list of users

Type lastlog
Give a list of every single user plus the last time they logged in (or "never
logged in" if that user had not logged in ever).
CC 216 Operating Systems Jan-Apr 2021

Type command last and evaluate the result.

3. Deleting user account

Type deluser
Enter username that you want to delete
Evaluate the result.
CC 216 Operating Systems Jan-Apr 2021

Now, switch back to normal user account in order to avoid deleting or overriding
system files accidently.

4. mkdir (make directory)

To make a subdirectory called linuxstuff in your current working directory type


mkdir linuxstuff
Evaluate the result.

5. Type ls to check all the files or folder under current directory.

6. Go under linuxstuff directory. cd linuxstuff

7. Creating files under linuxstuff directory

Type touch file1


Type ls
Type touch file2
Type ls
Evaluate the result.
CC 216 Operating Systems Jan-Apr 2021

8. Displaying message on screen.

Type echo “This is a test message”;

9. Writing date to a file.

Type echo “This is test message for file1” >file1


Type echo “This is test message for file2” >file2
Evaluate the result.

10. Copying file contents.

Type cp file1 file3


Copies the contents of file1 into file3. If file3 does not exist, it is created;
otherwise, file3 is silently overwritten with the contents of file1.
Evaluate the result.

Type cp –i file1 file2


Evaluate the result

Like above however, since the "-i" (interactive) option is specified, if file3
exists, the user is prompted before it is overwritten with the contents of file1.

Try:
CC 216 Operating Systems Jan-Apr 2021

i. Copy the contents of file1 (into a file named file1) inside of directory
newdir.

ii. Copy the contents of the directory linuxstuff. If directory newdir does
not exist, it is created. Otherwise, it creates a directory named newdir

11. Moving file to different directory.

Type mv <filename> <directoryname>


Type mkdir dir1
Type mv oridirectoryname/file1 newdir/

12. Deleting (removing) files or directories

Type rm <filename>
Type rm file1
Type rm –i file2
Evaluate the answer

You might also like