manishawsdevops / aws-devops-learning

This repository consists of training material and examples related for AWS DevOps and python.
Apache License 2.0
0 stars 0 forks source link

Assignment 03 - Basic Linux Commands #16

Closed manishawsdevops closed 1 year ago

manishawsdevops commented 1 year ago

Assignment: Linux Command Line Proficiency

Task 1: File Manipulation

  1. Create a directory called "LinuxAssignment" in your home directory.
  2. Inside "LinuxAssignment," create the following files:
    • file1.txt
    • file2.txt
    • file3.txt
  3. Use the ls command to list the files in the "LinuxAssignment" directory.
  4. Rename file2.txt to newfile.txt.
  5. Move newfile.txt to a subdirectory called "docs" within "LinuxAssignment."
  6. Verify that newfile.txt is now in the "docs" subdirectory.
  7. Create a copy of file1.txt and name it file1_copy.txt in the "LinuxAssignment" directory.
  8. Remove file3.txt from the "LinuxAssignment" directory.

Task 2: Directory Operations

  1. Navigate to your home directory using the cd command.
  2. Create a directory called "Data" inside your home directory.
  3. Inside the "Data" directory, create the following subdirectories:
    • Documents
    • Pictures
    • Music
  4. List the contents of the "Data" directory.
  5. Rename the "Pictures" directory to "Photos."
  6. Move the "Photos" directory to the "Documents" directory.
  7. Verify that the "Photos" directory is now inside the "Documents" directory.
  8. Delete the "Music" directory and its contents.

Task 3: File Viewing and Text Editing

  1. Create a new file called sample.txt inside the "LinuxAssignment" directory.
  2. Use the echo command to add the text "Hello, Linux!" to sample.txt.
  3. Display the contents of sample.txt using the cat command.
  4. Append the text "This is a Linux assignment." to sample.txt without overwriting the existing content.
  5. Display the first 5 lines of sample.txt using the head command.
  6. Display the last 3 lines of sample.txt using the tail command.
  7. Open sample.txt in a text editor (e.g., nano or vim) and make some changes to the text. Save and exit the text editor.
  8. Display the contents of sample.txt again to verify your changes.

Task 4: Permissions and Ownership

  1. Check the permissions of the "LinuxAssignment" directory using the ls -l command.
  2. Change the permissions of sample.txt so that only the owner can read and write to it.
  3. Create a new user named "guest" using the adduser command.
  4. Change the ownership of the "LinuxAssignment" directory and its contents to the "guest" user.
  5. Switch to the "guest" user using the su command.
  6. Attempt to access and modify the contents of sample.txt. Observe the results.

Task 5: Searching and Archiving

  1. Search for all files with the ".txt" extension in the "LinuxAssignment" directory.
  2. Archive the entire "LinuxAssignment" directory into a compressed file named "LinuxAssignment.tar.gz."
  3. Extract the contents of "LinuxAssignment.tar.gz" to a new directory called "LinuxAssignment_backup."
  4. Verify that the "LinuxAssignment_backup" directory contains the same files and subdirectories as the original "LinuxAssignment" directory

Task 6: SSH Communication

  1. Launch 2 linux machies on AWS for this execution.
  2. Setup ssh communication between two servers ( to and fro )
  3. Provide relavant screenprints.
  4. Use scp command to file transfer files between two servers.

Submission Please provide a report that includes the following:

  1. A step-by-step description of the commands you used to complete each task.
  2. Any challenges or issues you encountered and how you resolved them.
  3. Screenshots or terminal output to demonstrate the successful completion of each task.
  4. Any additional observations or insights gained from completing the assignment.