Operating System Lab Task-2
Linux Command Line Tasks
System Information:
Find out the name and version of the operating system you are running.
Display the current date and time.
Show your username and user ID.
Find out which users are currently logged in.
File and Directory Permissions:
Create a new, empty file named
test_script.sh
.Change the permissions of
test_script.sh
so that it is executable only by the owner.Change the permissions of
test_script.sh
so that it is readable and writable by the owner, but has no permissions for the group or others.Recursively change the permissions of a directory and all its contents so that the owner has full read, write, and execute permissions, while the group and others have read and execute permissions only.
Process Management:
Display a list of all running processes on the system.
Find a process by its name (e.g.,
bash
orsshd
).Simulate a long-running process (e.g., a simple
sleep
command) in the background.Stop a process by its Process ID (PID).
Forcefully terminate a process by its name.
Networking:
Display the network interface information and your IP address.
Check if a website (e.g.,
www.google.com
) is reachable from your machine.Show all active network connections.
Input/Output Redirection and Pipes:
List all files in your home directory and redirect the output to a new file called
file_list.txt
.List all files in the root directory (
/
) and append the output tofile_list.txt
.Use a pipe to count the number of lines in
file_list.txt
.Use a pipe to display all running processes and then filter the output to show only lines containing the word "root".
Advanced File Viewing:
Display the last 10 lines of a log file named
server.log
.Continuously display the content of
server.log
as new lines are added.View a large file page by page, allowing you to scroll both up and down.
System Administration (Basic):
Display the amount of free disk space on your system.
Show the total and free memory usage.
Comments
Post a Comment