Kyurious Minds Computer Academy Blog Linux Activity Sheet -1

Linux Activity Sheet -1

  1. Navigating the File System:
    • Task: Navigate to the root directory (/), then to your home directory (~), and finally to the /etc directory.
    • Task: Navigate to a directory called “Documents” within your home directory.
  2. Creating and Removing Files and Directories:
    • Task: Create a directory called “Projects” within your home directory.
    • Task: Inside “Projects”, create subdirectories named “Project1” and “Project2”.
    • Task: Remove the “Project2” directory.
  3. Copying, Moving, and Renaming Files:
    • Task: Create a text file named “file1.txt” in the “Project1” directory.
    • Task: Copy “file1.txt” to the “Project2” directory.
    • Task: Move “file1.txt” from “Project2” to the parent directory of “Projects”.
    • Task: Rename “file1.txt” to “newfile.txt”.
  4. Viewing File Contents:
    • Task: Create a text file named “example.txt” and add some text to it.
    • Task: View the contents of “example.txt” using cat.
    • Task: View the contents of “example.txt” using less or more.
  5. Searching for Files and Text Within Files:
    • Task: Search for all files with the “.txt” extension in the “Projects” directory.
    • Task: Search for the word “Linux” within all text files in the “Projects” directory.
  6. File Permissions:
    • Task: Create a file named “secret.txt” with read, write, and execute permissions only for the owner.
    • Task: Change the permissions of “secret.txt” to allow read access for all users.
    • Task: Remove write permissions for the owner of “secret.txt”.
  7. Piping and Redirection:
    • Task: Create a file named “numbers.txt” containing numbers from 1 to 10.
    • Task: Use grep to find lines containing the number “5” in “numbers.txt”.
    • Task: Redirect the output of ls to a file named “directory_contents.txt”.
  8. Archiving and Compressing Files:
    • Task: Archive the “Projects” directory into a file named “projects.tar”.
    • Task: Compress “projects.tar” using gzip to create “projects.tar.gz”.
    • Task: Extract “projects.tar.gz” into a directory named “restored_projects”.
  9. Using Wildcards:
    • Task: Create three text files named “file1.txt”, “file2.txt”, and “file3.txt”.
    • Task: Rename all files with the “.txt” extension to have a “.bak” extension.
  10. Scripting:
    • Task: Write a bash script that creates a directory structure for a project, including subdirectories for “source”, “documentation”, and “tests”.
    • Task: Write a bash script that takes a filename as an argument and displays whether it exists and if it’s a file or directory.