Dz
Djazair
v1.0.5
🔍

OS Module

Import using: use os

Platform Detection

  • os.name() - OS name string (e.g. 'windows', 'linux', 'darwin').
  • os.type() - More specific OS type identifier.
  • os.version() - OS version string.
  • os.arch() - CPU architecture (e.g. 'x86_64', 'arm64').
  • os.isWindows() - True if running on Windows.
  • os.isLinux() - True if running on Linux.
  • os.isMac() - True if running on macOS.
  • os.endianness() - Byte order: 'LE' or 'BE'.
use os
print(os.name())
print(os.type())
print(os.version())
print(os.arch())
print(str(os.isWindows()))
print(str(os.isLinux()))
print(str(os.isMac()))
print(os.endianness())

System Information

  • os.hostname() - System hostname.
  • os.uptime() - System uptime in seconds.
  • os.loadavg() - Load averages [1min, 5min, 15min].
  • os.totalMemory() - Total physical memory (bytes).
  • os.freeMemory() - Available memory (bytes).
  • os.cpuCount() - Number of logical CPU cores.
use os
print(os.hostname())
print(str(os.uptime()) + " seconds")
let la = os.loadavg()
print(str(la[0]) + ", " + str(la[1]) + ", " + str(la[2]))
print(str(os.totalMemory()) + " bytes total")
print(str(os.freeMemory()) + " bytes free")
print(str(os.cpuCount()) + " CPUs")

User & Temporary Files

  • os.user() - Current user login name.
  • os.uid() - Current user numeric ID (0 on Windows).
  • os.gid() - Current group numeric ID (0 on Windows).
  • os.homeDir() - Home directory path.
  • os.tmpDir() - Temporary directory path.
  • os.mktemp() - Create temp file, returns path.
  • os.mkdtemp() - Create temp directory, returns path.
  • os.which(cmd) - Locate executable in PATH (returns full path or Null).
use os
print(os.user())
print(str(os.uid()))
print(str(os.gid()))
print(os.homeDir())
print(os.tmpDir())
print(os.which("echo"))
© 2026 Harizi Riyadh. Released under the MIT License.
Official Website for Djazair.