Operating System Lab Task-2

 Linux Command Line Tasks

  1. 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.

  2. 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.

  3. Process Management:

    • Display a list of all running processes on the system.

    • Find a process by its name (e.g., bash or sshd).

    • 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.

  4. 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.

  5. 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 to file_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".

  6. 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.

  7. System Administration (Basic):

    • Display the amount of free disk space on your system.

    • Show the total and free memory usage.

Comments

Popular posts from this blog

Shell Scripting Codes - Loops

shell script collection

OS Lab Record