NEP -OS lAB B.Sc

PROGRAM 1 PROGRAM 2 PROGRAM 3 PROGRAM 4 PROGRAM 5 PROGRAM 6

PART B

PROGRAM B1 PROGRAM B2 PROGRAM B3 PROGRAM B4 PROGRAM B5 PROGRAM B6 . . .
DOWNLOAD PDF FILE OS LAB MANUAL

 
   
 
 
 1.Write a python program to Get information about the operating system.

import os

# Get current working directory
current_directory = os.getcwd()
print("Current working directory:", current_directory)
 
print("\nFiles and directories in current directory:")
for item in os.listdir(current_directory):
    print(item)
# Create a new directory
new_directory = "test_directory"
os.mkdir(new_directory)
print("\nCreated directory:", new_directory)

# Rename the directory
new_directory_name = "renamed_directory"
os.rename(new_directory, new_directory_name)
print("Renamed directory to:", new_directory_name)

# Remove the directory
os.rmdir(new_directory_name)
print("Removed directory:", new_directory_name)

# Get information about the operating system
print("\nOperating system information:")
print("Name:", os.name)
print("PID:", os.getpid())
print("Parent PID:", os.getppid())
print("User ID:", os.getuid())
print("Group ID:", os.getgid())
print("Effective User ID:", os.geteuid())
print("Effective Group ID:", os.getegid())







Output 1:
Files and directories in current directory:
F5.py
 A1.py

Created directory: test_directory
Renamed directory to: renamed_directory
Removed directory: renamed_directory

Operating system information:
Name: posix
PID: 3831
Parent PID: 3818
User ID: 1000
Group ID: 1000
Effective User ID: 1000
Effective Group ID: 1000