0% found this document useful (0 votes)
2 views19 pages

Lab Task 5

This document outlines a series of Linux commands and tasks related to file system navigation, file management, user and permission management, process monitoring, and archiving. It includes step-by-step instructions for creating directories, managing files, changing permissions, and using various commands to interact with the system. The document serves as a practical guide for students in a software engineering course at the International Islamic University, Islamabad.

Uploaded by

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

Lab Task 5

This document outlines a series of Linux commands and tasks related to file system navigation, file management, user and permission management, process monitoring, and archiving. It includes step-by-step instructions for creating directories, managing files, changing permissions, and using various commands to interact with the system. The document serves as a practical guide for students in a software engineering course at the International Islamic University, Islamabad.

Uploaded by

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

International Islamic

University,
Islamabad

Department of software engineering


Linux Commands

Submitted to:
Mrs. Tehmina Mehboob

Submitted by:
Anum Kousar 4503-FOC/BSSE-F22

Course title:
CS-224 Operating System

Date of submission:
05 March, 2025
Step 1: Navigate the File System

1. Open the wsl terminal.


2. Find out the current working directory:
a. Pwd

3. List all files and directories, including hidden files:


a. ls -la

4. Move to the /tmp directory (Webinal may restrict other directories):


a. cd (change directory)

Step 2: Create and Manage Files

1. Create a new directory named Lab1:


a. mkdir Lab1

b. cd Lab1

2. Create an empty file called test.txt:


a. touch test.txt

3. Write some text into test.txt:


a. echo "Hello, Webinal!" > test.txt

4. Display the contents of the file:


a. cat test.txt

5. Copy the file to copy_test.txt:


a. cp test.txt copy_test.txt

6. Rename copy_test.txt to renamed_test.txt


a. mv copy_test.txt renamed_test.txt

7. Delete renamed_test.txt:
a. rm renamed_test.txt

Task 4: User and Permission Management

Step 3: User Information

1. Check the current user


a. Whoami

2. List all logged-in users (Webinal may limit this feature


a. Who

3. View system users:


a. cat /etc/passwd | grep $(whoami)

Step 4: Change File Permissions

1. Check the file permissions of test.txt:


a. ls -l test.txt
2. Change permissions to read-only for everyone:
a. Chmod 444 test.txt

3. Verify the updated permissions:


a. ls -l test.txt

4. Try modifying the file (It should fail due to read-only permission):
a. echo "New text" >> test.txt

5. Restore write permissions for the owner:


a. chmod 644 test.txt

Step 5: Monitor Running Processes

1. Display currently running processes:


a. ps aux

2. Find your terminal’s process ID:


a. echo $$
3. Check system uptime:
a. Uptime

4. Show memory usage:


a. free -h

Task 4: Archiving and Compression

Step 6: Compress and Extract Files

1. Create a compressed archive of test.txt:


a. tar -cvf archive.tar test.txt

2. Extract the archive:


a. tar -xvf archive.tar
After each of the following steps, use ls and cat to verify what has happened.

1. Copy secret-of-the-universe to a new file called answer.txt. Use Tab to avoid typing the
existing file’s name in full.

2. Now copy hello.txt to answer.txt. What’s happened now?

3. Delete the original file, hello.txt.

4. Rename answer.txt to message.


5. Try asking rm to delete a file called missing. What happens?

6. Try copying secret-of-the-universe again, but don’t specify a filename to which to copy.
What happens now?
Input Values

Show system and kernel

Uname -a

head -n1 /etc/issue Show distribution


Mount Show mounted filesystems

Show system date

Date
Show manual for

Command

man command
Search history

CTRL-r

Repeat last command

!!
Run last command starting with

Abc

!abc

!abc:p

Print last command starting with

abc

!$

Last argument of previous

command
!*

All arguments of previous

command
env

Show environment variables

echo $NAME Output value of $NAME

variable
export NAME=value Set $NAME to value

$PATH

Executable search path


$HOME

Home directory

$SHELL

Current shel
cmd < file

Input of cmd from file

cmd > file

Standard output (stdout) of cmd to file


cmd > /dev/null

Discard stdout of cmd

cmd >> file

Append stdout to file


cmd 2> file

Error output (stderr) of cmd to file

You might also like