You are on page 1of 6

Lab #: 2

Submitted By:

Muhammad Jahangir
21-CS-089
Basit Ali
21-CS-104
Muhammad Alrayan
21-CS-107
Talha Malik
21-cs-025
Submitted to:
Mr. Muhammad Husnain
Department of Computer Science,
HITEC University, Taxila
Objective
The objectives of this lab are to familiarize how to perform:

1. File and directory creation


2. File and Directory deletion
3. File and Directory moving from one location to another
4. File and Directory copying from one location to another
5. Displaying data of file

Software Tools
▪ Ubuntu 20.04 LTS

Q1 Difference between terminal and shell.


Terminal

• A program that provides a user interface to interact with a computer system through
textbased input and output.
• Provides a user interface to execute commands and applications on a computer system.
• Users enter commands and receive text-based output as a response.
• GNOME Terminal, macOS Terminal, Windows Terminal Shell

• A command interpreter program that enables users to interact with an operating system,
executing commands and scripts.
• Executes commands and interprets scripts based on user input, providing an interface to
interact with the operating system
• Users enter commands, and the shell interprets and executes them, providing feedback
and results.
• Bash, PowerShell, Zsh, Csh, Ksh, etc.

Q2 Write 10 Basic commands in Linux.

1. pwd – Displays the current working directory.


2. mkdir – Creates a directory.
3. cd – To navigate between different folders.
4. rmdir – Removes empty directories from the directory lists.
5. cp – Moves files from one directory to another.
6. mv – Rename and Replace the files
7. rm – Delete files
8. uname – Command to get basic information about the OS
9. locate– Find a file in the database.
10. touch – Create empty files
Q3 Show Simulation results after performing the following tasks by using suitable
commands in Linux

1. Verify that you are in your home directory

2. Make the directory Jahangir using the command:

3. List the files in the current directory to verify that the directory adir has beenmade correctly

4. Change directories to adir.

5. Verify that you have succeeded in moving to the adir directory.

6. Make file testfile.

7. Verify that the file testfile exists


8. List the contents of the file testfile to the screen.

9. Make a copy of the file testfile under the name secondfile

10.Verify that the files testfile and secondfile both exist.

11.List the contents of both testfile and secondfile to the monitor screen.

12.Delete the file testfile.

13.Verify that testfile has been deleted.

14.Clear the window.

15.Rename the secondfile to thefile


16.Copy thefile to your home directory

17.Remove thefile from the current directory.

18.Verify that thefile has been removed.

19.Copy thefile from your home directory to the current directory.

20.Verify that thefile has been copied from your home directory to the current directory.

21.Change directories to your home directory.

22.Verify that you are in your home directory.

23.Verify that a copy of thefile is in your home directory.


24.Remove thefile from your home directory.

25.Remove thefile from the directory jahangir.

26.Remove the directory adir from your home directory with the command. rmdir adir

27.Verify that thefile and adir are gone from your home directory.

Conclusion

In this Ubuntu simulation exercise, we explored fundamental command-line operations for


managing files and directories in a Linux environment. We began by ensuring our current directory
and proceeded to create directories, generate files, manipulate file and directory names, and
examine file contents. We also learned about navigating directories, listing directory contents, and
clearing the terminal screen.

Key commands employed included mkdir, touch, cp, mv, rm, ls, and clear, which form the core
toolkit for working with files and directories in Linux.A crucial takeaway from this exercise is the
importance of exercising caution, especially with the rm command, as it permanently deletes files
and directories. A thorough understanding of these basic commands lays a strong foundation for
effective Linux system administration and day-to-day tasks on a Linux system.

You might also like