Linux CLI Terminal: Free Memory & Free Disk Space

How to Check Free Memory Space on Linux


How to Check Free Memory Space on Linux [Terminal]


Method 1: Using meminfo

cat /proc/meminfo

grep MemTotal /proc/meminfo


Method 2: Using free, top and Other Commands
Typing free in your command terminal provides the following result:
Provides general information about processes, memory, paging, block IO, traps, and CPU activity.


How to Check Free Disk Space on Linux


How to Check Free Disk Space on Linux [Terminal]


Method 1: Using df 
The df command stands for disk-free and quite obviously, it shows you the free and available disk space on Linux systems.
With -h option, it shows the disk space in human-readable format (MB and GB).
df -h
View the disk usage with more details like filesystem type and blocks, you can use the command:
df -T
Shows the file system's complete disk usage even if the Available field is 0
df -a 


Method 2: Using du, ls, and Other Commands
While df command is quite popular and should be enough for the use case, there are other alternatives that you can try including:

du -h → Shows disk usage in human-readable format for all directories and subdirectories.
du -a →Shows disk usage for all files.
du -s Provides the total disk space used by a particular file or directory.
ls -al →Lists the entire contents, along with their size, of a particular directory.
stat <file/directory> →Displays the size and other stats of a file/directory or a file system.
fdisk -l →Shows disk size along with disk partitioning information (may require sudo privileges).
dust  → An interesting alternative to the du command written in Rust, available for Arch Linux in the repositories. For other Linux distros, you can refer to its GitHub releases section.


Docker[Containers] vs Hypervisor[Virtual Machines]

Virtualization Technologies

Docker vs Hypervisor — Containers vs Virtual Machines

Wednesday, April 21, 2021

Category \ TechnologyDocker [Containers]Hypervisor [Virtual Machines]
Docker vs. Virtual Machines  
OS Support and ArchitectureNo Guest OS, Docker containers hosted on a single physical server with a host OS, which shares among them. Sharing the host OS between containers makes them light and increases the boot time. Docker containers are considered suitable to run multiple applications over a single OS kernel.Host OS and the Guest OS inside each VM. Guest OS can be any OS, like Linux or Windows, irrespective of host OS.
SecurityProviding root access to applications and running them with administrative premises is not recommended in the case of Docker containers because containers share the host kernel. The container technology has access to the kernel subsystems; as a result, a single infected application can hack the entire host system.Virtual machines are stand-alone with their kernel and security features. Applications needing more privileges and security run on virtual machines. 
PortabilityDocker containers packages are self-contained and can run applications in any environment, and since they do not need a guest OS, they can be easily ported across different platforms. Also, containers being lightweight [MBs] can be started and stopped in very less time compared to virtual machinesVMs are huge in size [GBs] because each include standalone OS. Not easy moved to a different platform without incurring compatibility issues.
Category \ TechnologyDocker [Containers]Hypervisor [Virtual Machines]
Docker vs. Virtual Machines  
PerformanceThe lightweight architecture of Docker containers is less resource-intensive than virtual machines. Most times one application per Container.VMs are more resource-intensive than Docker containers as the virtual machines need to load the entire OS to start. One OS in each VM, and usually many apps running in this OS.
Boot-TimeBoots in a few seconds.It takes a few minutes for VMs to boot.
Runs onDockers make use of the execution engine.VMs make use of the hypervisor.
Memory EfficiencyNo space is needed to virtualize, hence less memory.Requires entire OS to be loaded before starting the surface, so less efficient, more memory.
IsolationProne to adversities as no provisions for isolation systems.Interference possibility is minimum because of the efficient isolation mechanism.
DeploymentDeploying is easy as only a single image, containerized can be used across all platforms.Deployment is comparatively lengthy as separate instances are responsible for execution
UsageDocker has a complex usage mechanism consisting of both third party and docker managed tools.Tools are easy to use and simpler to work with.
Reuse of Resources and LibrariesDocker Containers can reuse Resources and Libraries from other Containers, taking less disk space.No reuse between VMs, Redundant copies exist, demanding more disk space.

Usually, Organizations are making use of the hybrid approach mostly as the choice between virtual machines and Docker containers depends upon the kind of workload offered.

Hypervisor-2 vs Docker

Hypervisor-1 vs Docker


Hypervisor-2 vs Hypervisor-1

Note: Hypervisor 1 [Servers mainly] vs Hypervisor 2 [Desktop mainly]

VM Hypervisor-2 vs Docker [Linux] vs Docker [VM Linux]