0% found this document useful (0 votes)
13 views9 pages

OS Practical

practical notes on operating system

Uploaded by

bidishasarkar979
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)
13 views9 pages

OS Practical

practical notes on operating system

Uploaded by

bidishasarkar979
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/ 9

KALYANI GOVERNMENT ENGINEERING COLLEGE

Department of Computer Science & Engineering

OPERATING SYSTEM (PCC-CS592) LAB ASSIGNMENT - 1

NAME – BIDISHA SARKAR

ROLL NUMBER – 10200222028

YEAR – 3RD

SEMESTER – 5TH

DATE – 15-08-2024
INDEX
SL NO. TOPIC PAGE NO.

1. Show the logged in user. 1

2. Display the information about the user. 1

3. Show current uptime. 1

4. Show CPU information. 1

5. Show Memory information. 2

6. Show kernel information. 2

7. Show the disk usage. 3

8. Show directory space usage. 3

9. Show memory and swap usage. 3

10. Create two directories. 4

11. Enter into a directory. 4

12. Create a file using Cat command, write few lines, and exit. 4

13. Display the file. 4

14. Copy the file and paste it to the other directory. 5

15. Move the file and paste it to the other directory. 5

16. Append few lines in that file using redirection operator. 5

17. Remove the file. 5

18. Remove the empty directory. 6

19. Remove the other directory which contains the file without 6
removing it.

20. Show the difference between ls –l and ls –a. 6

21. Explain and show the significance of ls –l | cat > 7


student.txt.
22. Create tar named file.tar containing file. Extract the files 7
fromfile.tar

23. Logout current session. 7

24. Machine Shutdown. 7


1. Show the logged in user.
COMMAND: whoami
This command displays the username of the current logged-in user.
OUTPUT:

2. Display the information about the user.


COMMAND: id
This command shows user ID (UID), group ID (GID), and the groups the user belongs
to.
OUTPUT:

3. Show current uptime.


COMMAND: uptime -p
This command displays the current time, how long the system has been running,
how many users are logged in, and the load average.
OUTPUT:

4. Show CPU information.


COMMAND: lscpu
This command provides detailed information about the CPU architecture,
includingthe number of CPUs, cores, threads, model name, and speed.

1
OUTPUT:

5. Show Memory information.


COMMAND: top
This command shows the total, used, and available memory (RAM) on the system in
a human-readable format.
OUTPUT:

6. Show kernel information.


COMMAND: uname -r
This command shows the version number of the Linux kernel.

2
OUTPUT:

7. Show the disk usage.


COMMAND: df -P
This command displays the disk space usage of file systems in a human-readable
format.
OUTPUT:

8. Show directory space usage.


COMMAND: du -h
This command shows the disk usage of files and directories within the current
directory in a human-readable format.
OUTPUT:

9. Show memory and swap usage.


COMMAND: free -m
This command is used for showing memory information also displays swap usage.
OUTPUT:

3
10. Create two directories.
COMMAND: mkdir dir_name1 dir_name2
This command creates two directories named dir_name1 and dir_name2.
OUTPUT:

11. Enter into a directory.


COMMAND: cd dir_name
This command changes the current directory to dir_name.
OUTPUT:

12. Create a file using Cat command, write few lines, and exit.
COMMAND: cat > file_name.txt
After running this command, type the lines you want to write in the file and press
Ctrl+D to save and exit.
OUTPUT:

13. Display the file.


COMMAND: cat file_name.txt
This command displays the content of the file_name.txt.
OUTPUT:

14. Copy the file and paste it to the other directory.


COMMAND: cp file_name.txt ../dir_name/
This command copies the file_name.txt from dir_name1 to dir_name2.

4
OUTPUT:

15. Move the file and paste it to the other directory.


COMMAND: mv file_name.txt ../dir_name/
This command moves file_name.txt from dir_name1 to dir_name2.
OUTPUT:

16. Append few lines in that file using redirection operator.


COMMAND: echo "Additional lines" >> ../dir_name/file_name.txt
This command appends "Additional lines" to the file_name.txt in dir_name.
OUTPUT:

17. Remove the file.


COMMAND: rm -r file_name.txt
This command removes file_name.txt from dir_name.
OUTPUT:

18. Remove the empty directory.


COMMAND: rmdir dir_name
This command removes the empty directory dir_name.

5
OUTPUT:

19. Remove the other directory which contains the file


withoutremoving it.
COMMAND: rm -r dir_name
This command removes dir_name and all its contents.
OUTPUT:

20. Show the difference between ls –l and ls –a.


DIFFERENCE:
• ls -l
Lists files in long format, showing file permissions, number of links, owner,
group, size, and timestamp.
• ls -a
Lists all files including hidden files (those starting with .).
OUTPUT:

21. Explain and show the significance of ls –l | cat > student.txt.


EXPLANATION: This command lists files in long format and then redirects the
output to student.txt using a pipe (|) and the redirection operator (>). The
contentof student.txt will now be the result of ls -l.

6
22. Create tar named file.tar containing file. Extract the files
fromfile.tar
COMMANDS:
• tar -cvf file.tar file.txt
This command creates a tar archive named file.tar containing file.txt.
• tar -xvf file.tar
This command extracts the contents of file.tar.
OUTPUT:

23. Logout current session.


COMMAND: logout
This command logs out from the current session.
OUTPUT:

24. Machine Shutdown.


COMMAND: sudo shutdown now
This command shuts down the machine immediately.
OUTPUT:

You might also like