A Practical Guide to File and Directory Management
July 1, 2023Enabling SSH on Ubuntu
July 1, 2023Working with Links, Archives, and Compression
- Links
- Create a file named
file1.txt
and write some text in it. - Create a hard link to
file1.txt
namedhardlink1
. Usels -i
to confirm they share the same inode number. - Modify
hardlink1
and observe the changes infile1.txt
. - Create a symbolic link to
file1.txt
namedsymlink1
. - Delete
file1.txt
and try to accesshardlink1
andsymlink1
. What’s the difference?
- Create a file named
- Absolute and Relative Filenames
- Navigate to your home directory. Using relative paths, navigate to
/etc
directory. - Navigate back to your home directory using an absolute path.
- Navigate to your home directory. Using relative paths, navigate to
- Inodes
- Create a new file, check its inode number using
ls -i
. - Create a hard link to this file and verify they share the same inode number.
- Create a new file, check its inode number using
- Archives and Compression
- Create a new directory, add a few text files to it.
- Create a
tar
archive of this directory. - Extract the
tar
archive in a different directory. - Compress one of the text files using
gzip
. - Decompress the
gzip
file. - Compress the same text file using
bzip2
. - Decompress the
bzip2
file.
- Archiving and Compression Together
- Create a compressed
tar
archive of the directory created earlier usinggzip
compression. - Extract the files from this compressed
tar
archive. - Repeat the steps using
bzip2
compression.
- Create a compressed
Remember to replace the placeholder names with your own files and directories. Also, ensure you’re running these commands in a terminal.