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
1
Typing free in your command terminal provides the following result:
free
2
Use:
top
htop
3
Provides general information about processes, memory, paging, block IO, traps, and CPU activity.
vmstat

=================

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.
1
With -h option, it shows the disk space in human-readable format (MB and GB).
df -h
2
View the disk usage with more details like filesystem type and blocks, you can use the command:
df -T
3
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.

=================

Check the Python version from the command line and in the Python script

import os


def print_hi(name):
    # Use a breakpoint in the code line below to debug your script.
    print(f'Hi, {name}')  # Press ⌘F8 to toggle the breakpoint.


def ver_Py3():
    #checking using cmd
    #python --version
    #using python script to get version
    os.system("python --version")
    os.system("python -V")
    os.system("python -VV")

/Users/leonidassavvides/PycharmProjects/pythonProject2/venv/bin/python /Users/leonidassavvides/PycharmProjects/pythonProject2/main.py
Hi, PyCharm
Python 3.10.4
Python 3.10.4
Python 3.10.4 (v3.10.4:9d38120e33, Mar 23 2022, 17:29:05) [Clang 13.0.0 (clang-1300.0.29.30)]

Process finished with exit code 0

The default interactive shell is now zsh.
To update your account to use zsh, please run chsh -s /bin/zsh.
For more details, please visit https://support.apple.com/kb/HT208050.
(venv) leonidass-mbp:pythonProject2 leonidassavvides$ python --version
Python 3.10.4
(venv) leonidass-mbp:pythonProject2 leonidassavvides$ python -V
Python 3.10.4
(venv) leonidass-mbp:pythonProject2 leonidassavvides$ python -VV
Python 3.10.4 (v3.10.4:9d38120e33, Mar 23 2022, 17:29:05) [Clang 13.0.0 (clang-1300.0.29.30)]

iPad-1 — 11 years of Service without any Defects

iPad-1 — 11 years of Service without any Defects

09 June 2010 — 09 June 2021 (today) = 11-years

My iPad-1 [2010-June-09], 11-years of Service [2011-June-09]

https://lse-blogs.s3-eu-west-1.amazonaws.com/wp/2018-03-19_20-31-00+-+Sony+Pafos+-+iPad+1+.png

iPad-1 — 11 Years of Service without any Defects