Understanding the File System Hierarchy and Mounting Devices in Ubuntu
July 1, 2023Working with Links, Archives, and Compression
July 1, 2023A Practical Guide to File and Directory Management
- 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’.
- Create five .txt files named
- 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.
- Create a directory named
- 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.
- Navigate to the
- 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.
- Copying files and directories:
- Create a file named
source_file.txt
and a directory nameddestination_directory
. - Copy
source_file.txt
intodestination_directory
. - Verify the copy was successful by listing the contents of
destination_directory
.
- Create a file named
- Moving files and directories:
- Create a file named
file_to_move.txt
and a directory namedtarget_directory
. - Move
file_to_move.txt
intotarget_directory
. - Verify the move was successful by listing the contents of
target_directory
.
- Create a file named
- Deleting files and directories:
- Create a file named
file_to_delete.txt
and a directory nameddirectory_to_delete
. - Delete
file_to_delete.txt
. - Delete
directory_to_delete
.
- Create a file named
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.