A Practical Guide to File and Directory Management

230
  1. Working with wildcards:
    • Create five .txt files named file1.txt, file2.txt, file3.txt, fileA.txt, fileB.txt. Use a wildcard to list only the files that end with a number.
    • Try to list all the files that start with ‘file’ and end with ‘A’ or ‘1’.
  2. Managing and working with directories:
    • Create a directory named test_directory.
    • Navigate into test_directory.
    • Try to delete test_directory (This should fail because you are inside the directory).
    • Navigate out of test_directory and then delete it.
  3. Working with absolute and relative pathnames:
    • Navigate to the /home directory using an absolute path.
    • If there is a user directory inside /home, navigate into it using a relative path.
  4. Listing files and directories:
    • Navigate to a directory of your choice and list all the files and directories in it.
    • Use the -l option to display additional information about the files and directories.
  5. Copying files and directories:
    • Create a file named source_file.txt and a directory named destination_directory.
    • Copy source_file.txt into destination_directory.
    • Verify the copy was successful by listing the contents of destination_directory.
  6. Moving files and directories:
    • Create a file named file_to_move.txt and a directory named target_directory.
    • Move file_to_move.txt into target_directory.
    • Verify the move was successful by listing the contents of target_directory.
  7. Deleting files and directories:
    • Create a file named file_to_delete.txt and a directory named directory_to_delete.
    • Delete file_to_delete.txt.
    • Delete directory_to_delete.

Please remember to replace the paths and file/directory names as needed according to your Ubuntu setup. Also, ensure to create backup copies or use non-essential data when practising delete, copy, and move operations to prevent any accidental data loss.