#100DaysOfCloudDevOps Challenge — Day 04 — Streamlining Linux: Package Management, File System Insights, Optimizing Storage
Welcome to Day 04 of my #100DaysOfCloudDevOps challenge!
In this article, I delve into essential aspects of Linux management, covering streamlined package handling, comprehensive file system insights, and effective storage optimization techniques.
Managing Linux System (Ubuntu VM & Software)
Managing Ubuntu VM & software simply refers to the tasks involved in controlling and organizing the software installed on a computer running the Ubuntu operating system.
This includes activities such as installing software, keeping the installed software up-to-date with the latest versions and security patches, uninstalling or removing software that is no longer needed or wanted on your system.
This helps free up disk space and keeps your system clutter-free, and ensuring that all required libraries and components needed by a software package are installed on your system.
Package Management: Ubuntu primarily uses the Advanced Package Tool (APT) for managing software packages. You can use commands like apt-get
, apt
, or aptitude
to install, update, and remove software packages.
sudo apt-get update
: Updates the package lists.
sudo apt-get install package_name
: Installs a package.
sudo apt-get upgrade
: Upgrades all installed packages.
sudo apt-get remove package_name
: Removes a package.
Example:
sudo apt-get update
Now we have an updated Ubuntu VM with the latest OS updates installed. We now want to get some software installed here.
Let's choose figlet
which is a program that generates text banners.
If we type figlet
in our terminal you are going to see that we do not have it installed on our system.
Let's try sudo apt install figlet
We can now use our figlet
app as you can see below.
If we want to remove that or any of our software installations we can also do that via the apt
package manager.
sudo apt remove figlet
File System Explained
In Linux, a file system is like a structured way of organizing and storing your files and data on your computer's storage devices, such as hard drives or solid-state drives (SSDs).
Think of it as a filing cabinet in an office. Each drawer in the filing cabinet represents a different storage device (like a hard drive). Inside each drawer, you have folders (directories) to help you organize your files. And within those folders, you have individual files where you store your data.
Similarly, in Linux, the file system provides a structure for organizing your data. It includes directories (also called folders) that can contain other directories and files. Each file system has its own rules and methods for storing and accessing data efficiently.
Understanding the file system in Linux is important because it allows you to manage your files and data effectively, ensuring they are stored securely and can be accessed efficiently when needed.
On Windows, you have C: drive and that is what we consider the root. On Linux we have /
this is where we are going to find the important folders on our Linux system.
/
- The "/" root directory is the top-level directory in the Linux file system hierarchy. All other directories and files are subdirectories or files of the root directory.
/bin
- Short for binary, the bin folder is where our binaries that your system needs, executables and tools will mostly be found here. These directories contain essential system binaries (commands) used for system administration and maintenance.
/sbin
- sudo bin, similar to the bin folder but these tools are intended for elevated superuser privileges on the system.
/etc
- Configuration files for the system and installed applications are stored here. Likely the most important folder on your Linux system.
/boot
- All the files your system needs to boot up. How to boot up, and what drive to boot from.
/dev
- You can find device information here, this is where you will find pointers to your disk drives sda
will be your main OS disk. In other words, device files, representing hardware devices, are stored here.
/home
- this is where you will find your user folders and files. We have our vagrant user folder. And if you standardized your VM, this is where you will find your Documents
and Desktop
folders.
/lib
- We mentioned that /bin
is where our binaries and executables live, and /lib
is where you will find the shared libraries.
/media
- This is where we will find removable devices.
/mnt
- This is a temporary mount point.
/opt
- Optional software packages.
/proc
- Kernel & process information, similar to /dev
./proc
and /sys
are directories that provide interfaces to kernel data structures and system information.
Here you can find out CPU details and spec:
/sys
- This directory and /proc
provide interfaces to kernel data structures and system information.
/root
- To gain access you will need to sudo into this folder. The home folder for root.
/run
- Placeholder for application states.
/tmp
- Temporary files are stored here. These files are typically deleted upon system reboot.
/usr
- User-related programs and data are stored here. If we as a standard user have installed software packages it would generally be installed in the /usr/bin
location. This directory often contains a separate subdirectory for each application.
/var
- Our applications get installed in a bin
folder. We need somewhere to store all of the log files this is /var
. Variable data files such as logs, mail, and printer spools are stored here.
Storage
When we come to a Linux system or any system we might want to know the available disks and how much free space we have on those disks. The next few commands will help us identify and use and manage storage.
lsblk
- means List Block devices. And this is a command in Linux that helps you list all the block devices connected to your system.
Now, what are block devices? Block devices are storage devices like hard drives (HDDs), solid-state drives (SSDs), USB drives, and so on. They're called "block" devices because data is stored and retrieved in fixed-size blocks or chunks.
So, when we run lsblk
, it shows us a structured list of these block devices along with their details like their names, sizes, and the type of storage technology they use (e.g., SATA, NVMe). It helps us quickly see what storage devices are available and how they are organized in our system.
df
- gives us a little more detail about those partitions, total, used and available. You can parse other flags here I generally use df -h
to give us a human output of the data.
df -h
- Adding the -h
flag, when used with various Linux commands like lsblk
, df
, and du
, stands for "human-readable."
With this, effectively managing Ubuntu entails navigating package systems, understanding file structures, and optimizing storage. By grasping these basics, users can ensure a smoother and more organized computing experience on their Ubuntu systems.
Find the GitHub repo here.
I trust we all learned something from this blog. If you found it helpful too, give back and show your support by clicking heart or like, share this article as a conversation starter and join my newsletter so that we can continue learning together and you won’t miss any future posts.
Thanks for reading until the end! If you have any questions or feedback, feel free to leave a comment.