0% found this document useful (0 votes)
20 views

Operating Systems Lab 1 Manual

Uploaded by

Mazhar Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Operating Systems Lab 1 Manual

Uploaded by

Mazhar Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Operating Systems Lab 1 Manual

Objectives:
Introduction to Operating Systems (OS):

- What is an OS?

- Role and importance in managing hardware and software resources.

- Types of OS (Windows, Linux, MacOS) with a focus on Linux-based systems (Ubuntu).

Why Ubuntu for OS Lab:

- Open-source, stable, widely used in academic and professional environments.

- Provides a robust platform for understanding OS concepts through a command-line interface


(CLI).

CLI Commands to Practice:

This lab will introduce you to basic commands used in the terminal. Follow the steps below and
practice each command to understand its function.

Command: `pwd` (Print Working Directory)

Description: Displays the current directory path.

pwd
Command: `ls` (List Directory Contents)

Description: Lists files and folders in the current directory.

ls
Task: Run this command to see all the files and folders in the current directory. Try `ls -l` for more
details.

Command: `cd` (Change Directory)

Description: Used to navigate between directories.

cd <directory-name>

Task 1: Navigate to an existing folder inside the current directory.

- Example: If there is a folder called `Documents`, type:

cd Desktop
Task 2: Use the `pwd` command again to check your new location.
Command: `cd ..` (Move to Parent Directory)

Description: Moves one directory level up (to the parent folder).

cd ..
Task: Navigate back to the previous directory (parent folder).

Copy Folder to Another Folder

Command: `cp`

Description: Copies files or directories to another location.

cp -r <source-folder> <destination-folder>
Task: Copy a folder from the current directory to another directory.

Example: Copy the folder `test` into a folder called `backup`:

cp -r test backup or
cp -r ~//Desktop/Folder1 ~//Desktop/Folder2
Move Folder to Another Folder

Command: `mv`

- **Description:** Moves files or folders from one location to another.

mv <source-folder> <destination-folder> or
mv ~//Desktop/Folder1 ~//Desktop/Folder2
Task: Move a folder from one location to another.

Example: Move the folder `test` to `backup`:

mv test test2

Command: `touch` (Create New Empty File)

Description: Creates an empty file in the current directory.

touch <file-name>
Task: Create a new empty file.

Example: Create a file named `example.txt`:

touch example.txt
Command: `nano` (Text Editor)

Description: Opens a text editor in the terminal.


nano <file-name>
Open a text file using the `nano` editor.

Example: Edit the file `example.txt`:

nano example.txt
Note: After editing, press `CTRL+X`, then `Y` to save changes, and `Enter` to confirm.

Lab Tasks:
1. Open a terminal and check your current directory using `pwd`.

2. List the contents of your directory using `ls`.

3. Navigate to another directory using `cd` and confirm using `pwd`.

4. Use `cd ..` to go back to the previous directory.

5. Create two folders (`test` and `backup`) in your current directory using `mkdir <folder-name>`.

6. Copy the `test` folder into the `backup` folder.

7. Move the `test` folder to the `backup` folder.

8. Create a new text file using `touch example.txt`.

9. Edit `example.txt` using `nano` and add some text to it.

You might also like