Linux Assignments on Ubuntu


  1. Basic Commands
  • Task 1: Write commands to navigate to your home directory and list all files and directories.
    • Expected Output:
    Contents of Home Directory: Desktop Documents Downloads Music Pictures Videos
  • Task 2: Write commands to create a directory named Assignment1 in your home directory and navigate into it.
    • Expected Output:
    Directory 'Assignment1' created. Current directory: /home/user/Assignment1
  • Task 3: Write commands to create a file named file1.txt and write “Hello, Linux!” into it.
    • Expected Output:
    File 'file1.txt' created with content: Hello, Linux!
  • Task 4: Write commands to rename file1.txt to newfile.txt.
    • Expected Output:
    File 'file1.txt' renamed to 'newfile.txt'.
  • Task 5: Write commands to delete the file newfile.txt.
    • Expected Output:
      File 'newfile.txt' deleted.
  1. File Permissions and Ownership
  • Task 6: Write commands to display the permissions of a file example.txt and change its permissions to read-only for all users.
    • Expected Output:
    Current permissions of 'example.txt': -rw-r--r-- Permissions changed to read-only for all users.
  • Task 7: Write commands to change the ownership of a file example.txt to user john and group users.
    • Expected Output:
      Ownership of 'example.txt' changed to user: john, group: users.
  1. Processes and Jobs
  • Task 8: Write commands to display all running processes.
    • Expected Output: (Sample output with process details)
  • Task 9: Write commands to find and kill a process named firefox.
    • Expected Output:
    Process 'firefox' killed.
  • Task 10: Write commands to run a command ls -l in the background and list all background jobs.
    • Expected Output:
      Command 'ls -l' running in background. Background jobs: [1]+ Running ls -l &
  1. File System Navigation and Manipulation
  • Task 11: Write commands to navigate to the root directory and list all files and directories.
    • Expected Output:
    Contents of Root Directory: bin boot dev etc home lib media mnt opt proc root run sbin srv sys tmp usr var
  • Task 12: Write commands to create a symbolic link named link1 pointing to a file file2.txt.
    • Expected Output:
    Symbolic link 'link1' created pointing to 'file2.txt'.
  • Task 13: Write commands to compress a directory Folder1 into a Folder1.tar.gz archive.
    • Expected Output:
    Directory 'Folder1' compressed into 'Folder1.tar.gz'.
  • Task 14: Write commands to extract contents from Folder1.tar.gz into a directory named Extracted.
    • Expected Output:
      Contents extracted from 'Folder1.tar.gz' into 'Extracted' directory.
  1. Networking
  • Task 15: Write commands to display network interfaces and their IP addresses.
    • Expected Output: (Sample output with interface details)
  • Task 16: Write commands to ping google.com and display the result.
    • Expected Output: (Sample output showing ping statistics)
  • Task 17: Write commands to display the contents of /etc/hosts file.
    • Expected Output: (Contents of /etc/hosts file)
  1. Shell Scripting
  • Task 18: Write a shell script to accept a number as input and display its factorial.
    • Expected Output: (Sample output showing factorial calculation)
  • Task 19: Write a shell script to accept a filename as input and check if it exists in the current directory.
    • Expected Output: (Sample output indicating file existence)
  • Task 20: Write a shell script to list all .txt files in the current directory and count them.
    • Expected Output: (Sample output showing list of .txt files and count)

Mahesh Wabale

Leave a Comment