Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/nokia/moler/llms.txt

Use this file to discover all available pages before exploring further.

Moler ships with more than 100 ready-made Unix command parsers. Every command class accepts a connection object, sends the underlying shell command, and returns a structured result dictionary when parsing is complete.
All Unix command classes inherit from GenericUnixCommand (module moler.cmd.unix.genericunix). The base class handles prompt detection and newline splitting; concrete classes implement build_command_string() and on_new_line() parsing.

Full command list

ClassModuleShell command
AdbDevicesmoler.cmd.unix.adb_devicesadb devices
AdbForwardmoler.cmd.unix.adb_forwardadb forward
AdbRootmoler.cmd.unix.adb_rootadb root
Bashmoler.cmd.unix.bashbash
Bzip2moler.cmd.unix.bzip2bzip2
Catmoler.cmd.unix.catcat
Cdmoler.cmd.unix.cdcd
Chgrpmoler.cmd.unix.chgrpchgrp
Chmodmoler.cmd.unix.chmodchmod
Chownmoler.cmd.unix.chownchown
Cpmoler.cmd.unix.cpcp
CtrlCmoler.cmd.unix.ctrl_c^C
CtrlZmoler.cmd.unix.ctrl_z^Z
Cutmoler.cmd.unix.cutcut
Datemoler.cmd.unix.datedate
Devmemmoler.cmd.unix.devmemdevmem
Dfmoler.cmd.unix.dfdf
Dmesgmoler.cmd.unix.dmesgdmesg
Dumoler.cmd.unix.dudu
Echomoler.cmd.unix.echoecho
Entermoler.cmd.unix.enter(newline)
Envmoler.cmd.unix.envenv
Ethtoolmoler.cmd.unix.ethtoolethtool
Exitmoler.cmd.unix.exitexit
ExitTelnetmoler.cmd.unix.exit_telnetexit (telnet)
Exportmoler.cmd.unix.exportexport
Findmoler.cmd.unix.findfind
Grepmoler.cmd.unix.grepgrep
Gunzipmoler.cmd.unix.gunzipgunzip
Gzipmoler.cmd.unix.gzipgzip
Hciconfigmoler.cmd.unix.hciconfighciconfig
Headmoler.cmd.unix.headhead
Hexdumpmoler.cmd.unix.hexdumphexdump
Historymoler.cmd.unix.historyhistory
Hostnamemoler.cmd.unix.hostnamehostname
Hostnamectlmoler.cmd.unix.hostnamectlhostnamectl
Idmoler.cmd.unix.idid
Ifconfigmoler.cmd.unix.ifconfigifconfig
IpAddrmoler.cmd.unix.ip_addrip addr
IpLinkmoler.cmd.unix.ip_linkip link
IpMaddrmoler.cmd.unix.ip_maddrip maddr
IpNeighmoler.cmd.unix.ip_neighip neigh
IpRoutemoler.cmd.unix.ip_routeip route
Iperfmoler.cmd.unix.iperfiperf
Iperf2moler.cmd.unix.iperf2iperf
Iperf3moler.cmd.unix.iperf3iperf3
Ipsecmoler.cmd.unix.ipsecipsec
Iptablesmoler.cmd.unix.iptablesiptables
Killmoler.cmd.unix.killkill
Killallmoler.cmd.unix.killallkillall
Lnmoler.cmd.unix.lnln
Logoutmoler.cmd.unix.logoutlogout
Lsmoler.cmd.unix.lsls
Lsofmoler.cmd.unix.lsoflsof
LxcAttachmoler.cmd.unix.lxc_attachlxc-attach
LxcInfomoler.cmd.unix.lxc_infolxc-info
LxcLsmoler.cmd.unix.lxc_lslxc-ls
Md5summoler.cmd.unix.md5summd5sum
Mkdirmoler.cmd.unix.mkdirmkdir
Mountmoler.cmd.unix.mountmount
Mpstatmoler.cmd.unix.mpstatmpstat
Mvmoler.cmd.unix.mvmv
Netstatmoler.cmd.unix.netstatnetstat
Nftmoler.cmd.unix.nftnft
Nmapmoler.cmd.unix.nmapnmap
Npingmoler.cmd.unix.npingnping
Ntpqmoler.cmd.unix.ntpqntpq
OpensslSClientmoler.cmd.unix.openssl_s_clientopenssl s_client
OpensslX509TextInmoler.cmd.unix.openssl_x509_text_inopenssl x509
Passwdmoler.cmd.unix.passwdpasswd
Pingmoler.cmd.unix.pingping / ping6
Pkillmoler.cmd.unix.pkillpkill
Psmoler.cmd.unix.psps
Pwdmoler.cmd.unix.pwdpwd
Rebootmoler.cmd.unix.rebootreboot
Rmmoler.cmd.unix.rmrm
Routemoler.cmd.unix.routeroute
RunScriptmoler.cmd.unix.run_script(script)
RunSerialProxymoler.cmd.unix.run_serial_proxy(proxy)
Scpmoler.cmd.unix.scpscp
Sedmoler.cmd.unix.sedsed
Servicemoler.cmd.unix.serviceservice
SevenZmoler.cmd.unix.seven_z7z
Sftpmoler.cmd.unix.sftpsftp
Shasummoler.cmd.unix.shasumshasum
Socatmoler.cmd.unix.socatsocat
Ssmoler.cmd.unix.ssss
Sshmoler.cmd.unix.sshssh
Sshkeygenmoler.cmd.unix.sshkeygenssh-keygen
Sumoler.cmd.unix.susu
Sudomoler.cmd.unix.sudosudo
Syncmoler.cmd.unix.syncsync
Sysctlmoler.cmd.unix.sysctlsysctl
Systemctlmoler.cmd.unix.systemctlsystemctl
Tailmoler.cmd.unix.tailtail
TailLatestFilemoler.cmd.unix.tail_latest_filetail (latest)
Tarmoler.cmd.unix.tartar
Tcpdumpmoler.cmd.unix.tcpdumptcpdump
Teemoler.cmd.unix.teetee
Telnetmoler.cmd.unix.telnettelnet
Topmoler.cmd.unix.toptop
Touchmoler.cmd.unix.touchtouch
Traceroutemoler.cmd.unix.traceroutetraceroute
Tsharkmoler.cmd.unix.tsharktshark
Unamemoler.cmd.unix.unameuname
Unrarmoler.cmd.unix.unrarunrar
Unxzmoler.cmd.unix.unxzunxz
Unzipmoler.cmd.unix.unzipunzip
Uptimemoler.cmd.unix.uptimeuptime
Useraddmoler.cmd.unix.useradduseradd
Userdelmoler.cmd.unix.userdeluserdel
Wmoler.cmd.unix.ww
Wgetmoler.cmd.unix.wgetwget
Whichmoler.cmd.unix.whichwhich
Whoamimoler.cmd.unix.whoamiwhoami
Zipmoler.cmd.unix.zipzip

Detailed reference by category

Pingmoler.cmd.unix.ping

Sends ICMP echo requests. Automatically uses ping6 when the destination contains : (IPv6 address).
connection
object
required
Moler connection to the device.
destination
str
required
IPv4 or IPv6 address / hostname to ping.
options
str
Additional CLI options, e.g. "-c 5" or "-w 10".
prompt
str
Regex for the shell prompt. Defaults to generic prompt detection.
newline_chars
list
Characters used to split output lines.
runner
object
Runner used to execute the command.
Result dictionary keys
KeyTypeDescription
packets_transmittedintTotal packets sent
packets_receivedintTotal packets received
packet_lossfloatPacket loss percentage
timeintTotal ping duration (in packets_time_unit)
time_secondsfloatTotal ping duration in seconds
packets_time_unitstrTime unit for total time, e.g. "ms"
time_minfloatMinimum RTT
time_avgfloatAverage RTT
time_maxfloatMaximum RTT
time_mdevfloatRTT standard deviation
time_min_secondsfloatMinimum RTT in seconds
time_avg_secondsfloatAverage RTT in seconds
time_max_secondsfloatMaximum RTT in seconds
time_mdev_secondsfloatRTT standard deviation in seconds
time_unitstrRTT time unit, e.g. "ms"
errorsintError count (only present when errors reported)
duplicatesintDuplicate count (only present when duplicates reported)
from moler.cmd.unix.ping import Ping

cmd = Ping(connection=conn, destination="192.168.1.1", options="-c 5")
result = cmd()
# result = {
#   'packets_transmitted': 5, 'packets_received': 5,
#   'packet_loss': 0, 'time': 4010, 'time_seconds': 4.01,
#   'time_min': 0.5, 'time_avg': 0.6, 'time_max': 0.8,
#   ...
# }

Ifconfigmoler.cmd.unix.ifconfig

Retrieves network interface configuration. Keyed by interface name.
connection
object
required
Moler connection to the device.
options
str
Options passed directly to ifconfig, e.g. "eth0" to restrict to one interface.
Result structure — keys are interface names (e.g. "eth0", "br0"). Each interface dict contains:
KeyTypeDescription
IPV4list[dict]IPv4 addresses with IP, BRD, MASK
IPV6list[dict]IPv6 addresses with IP, MASK, SCOPE
LINKlist[dict]Link layer info with ENCAP, MAC
CONTENTlist[str]Raw content lines
RXdictRX packet/byte counters
TXdictTX packet/byte counters
from moler.cmd.unix.ifconfig import Ifconfig

cmd = Ifconfig(connection=conn)
result = cmd()
print(result['eth0']['IPV4'][0]['IP'])  # e.g. '10.0.0.1'
print(result['eth0']['LINK'][0]['MAC'])  # e.g. '60:a8:fe:74:f8:a9'

IpRoutemoler.cmd.unix.ip_route

Runs ip route (or ip -6 route) and parses the routing table.
connection
object
required
Moler connection to the device.
is_ipv6
bool
Set True to run ip -6 route. Default False.
addr_get
str
Address for ip route get <addr>.
addr_from
str
Source address filter with from keyword.
Result dictionary keys
KeyTypeDescription
VIAdictDefault gateway information
ALLlistAll route entries
ADDRESSdictPer-prefix route details

Sshmoler.cmd.unix.ssh

Establishes an SSH connection. Handles host-key prompts, password prompts, known-hosts failures, and terminal resize sequences automatically.
connection
object
required
Moler connection to the device.
host
str
required
Remote hostname or IP address.
login
str
SSH username (passed via -l).
password
str | list
Password or list of passwords for multi-step authentication.
port
int
Remote port. Default 0 (SSH default port 22).
expected_prompt
str
Regex for the prompt on the remote host. Default ">".
known_hosts_on_failure
str
How to handle unknown host: "keygen" (run ssh-keygen -R) or "rm". Default "keygen".
options
str
Extra SSH options injected before the hostname. Default -o ServerAliveInterval=7 -o ServerAliveCountMax=2.
encrypt_password
bool
Replace password characters with * in logs. Default True.
from moler.cmd.unix.ssh import Ssh

cmd = Ssh(
    connection=conn,
    host="192.168.1.10",
    login="admin",
    password="secret",
    expected_prompt=r'admin@host:~\$',
)
cmd()

Netstatmoler.cmd.unix.netstat

Runs netstat and parses socket/connection listings.

Traceroutemoler.cmd.unix.traceroute

Runs traceroute and parses hop-by-hop routing output.

Nmapmoler.cmd.unix.nmap

Runs nmap network scanner and parses open port results.

Wgetmoler.cmd.unix.wget

Downloads URLs via wget. Reports download completion records and optionally logs progress.
connection
object
required
Moler connection to the device.
options
str
required
Options passed to wget, typically including the URL.
log_progress_bar
bool
Set True to collect progress bar lines into PROGRESS_LOG. Default False.
Result dictionary keys
KeyTypeDescription
RESULTlist[str]Completion lines: "YYYY-MM-DD HH:MM:SS (X.X MB/s) - 'file' saved"
PROGRESS_LOGlist[str]Progress bar lines (only when log_progress_bar=True)
from moler.cmd.unix.wget import Wget

cmd = Wget(connection=conn, options="http://example.com/file.tar.gz")
result = cmd()
print(result['RESULT'])  # ['2023-01-01 10:00:00 (1.5 MB/s) - file.tar.gz saved [446966]']

Lsmoler.cmd.unix.ls

Runs ls and parses file/directory listings. Supports plain, long (-l), and human-readable (-lh) formats.
connection
object
required
Moler connection to the device.
options
str
Options passed to ls, e.g. "-l", "-lh", "-la".
path
str
Path to list. Omit to list the current directory.
Result dictionary keys
KeyTypeDescription
filesdictMapping from filename to file-info dict
totaldict{"raw": "8", "bytes": 8} — only present with -l flag
Each entry in files (long listing) contains:
KeyTypeDescription
namestrFilename
permissionsstrPermission string, e.g. "-rwxr-xr-x"
hard_links_countintNumber of hard links
ownerstrFile owner
groupstrFile group
size_rawstrRaw size string
size_bytesintSize in bytes (human suffixes expanded)
datestrModification date string
linkstrLink target (only for symlinks)
The get_dirs(), get_files(), and get_links() helper methods filter results by type.
from moler.cmd.unix.ls import Ls

cmd = Ls(connection=conn, options="-l", path="/var/log")
result = cmd()
for name, info in result['files'].items():
    print(name, info['permissions'], info['size_bytes'])

Findmoler.cmd.unix.find

Runs find and parses path results.
connection
object
required
Moler connection to the device.
options
str
Full options string for find, e.g. "/var/log -name '*.log' -mtime +7".

Catmoler.cmd.unix.cat

Runs cat and returns file contents as a list of lines.Result: {"LINES": ["line1", "line2", ...]}

Tailmoler.cmd.unix.tail

Runs tail on a file. Inherits from Cat.
connection
object
required
Moler connection to the device.
path
str
required
Path to the file to tail.
options
str
Options, e.g. "-n 20" or "-f" (follow mode).
Result: {"LINES": ["last line 1", "last line 2", ...]}
from moler.cmd.unix.tail import Tail

cmd = Tail(connection=conn, path="/proc/meminfo")
result = cmd()
for line in result['LINES']:
    print(line)

Grepmoler.cmd.unix.grep

Runs grep and parses matched lines, optionally with file paths, line numbers, and byte offsets.
connection
object
required
Moler connection to the device.
options
str
required
Full grep options including pattern and filename, e.g. "-n 'error' /var/log/syslog".
Result: {"LINES": [...]}Each item in LINES is a dict with a subset of:
KeyDescription
LINEThe matched line content
PATHFile path (when grepping multiple files)
NUMBERLine number (with -n)
BYTESByte offset (with -b)
from moler.cmd.unix.grep import Grep

cmd = Grep(connection=conn, options="-n 'ERROR' /var/log/app.log")
result = cmd()
for match in result['LINES']:
    print(match['NUMBER'], match['LINE'])

Cp / Mv / Rm / Mkdir / Touch

Standard filesystem manipulation commands. All accept connection, options, and runner.

Tar / Gzip / Gunzip / Bzip2 / Zip / Unzip / Unrar / Unxz / SevenZ

Archive and compression commands.

Mountmoler.cmd.unix.mount

Runs mount and parses mount point information.

Dfmoler.cmd.unix.df

Runs df and parses disk usage per filesystem.

Dumoler.cmd.unix.du

Runs du and parses disk usage per directory.

Psmoler.cmd.unix.ps

Runs ps and parses the process list. Returns a list of dicts (one per process row). Column names are derived dynamically from the header line, so the result adapts to the options used.
connection
object
Moler connection to the device.
options
str
Options string, e.g. "-ef" or "-o user,pid,vsz,cmd -e". Default "".
Result: List of dicts. Keys match the column header names from ps output. Numeric fields are converted to int or float automatically.
# ps -ef produces dicts with: UID, PID, PPID, C, STIME, TTY, TIME, CMD
# ps -aux produces dicts with: USER, PID, %CPU, %MEM, VSZ, RSS, TTY, STAT, START, TIME, COMMAND
from moler.cmd.unix.ps import Ps

cmd = Ps(connection=conn, options="-ef")
result = cmd()
for proc in result:
    print(proc['PID'], proc['CMD'])
When there are no running processes matching the filter, result is an empty list [].

Kill / Killall / Pkill — signal sending

Send signals to processes by PID or name.
from moler.cmd.unix.kill import Kill
cmd = Kill(connection=conn, options="-9 1234")
cmd()

Topmoler.cmd.unix.top

Runs top (typically in batch mode) and parses live process stats.

Unamemoler.cmd.unix.uname

Runs uname and returns kernel/OS information.

Hostname / Hostnamectlmoler.cmd.unix.hostname

Retrieves the system hostname.

Uptimemoler.cmd.unix.uptime

Parses uptime output into load averages and system up-time duration.

Datemoler.cmd.unix.date

Parses current system date and time.

Dmesgmoler.cmd.unix.dmesg

Captures kernel ring buffer messages.

Sysctlmoler.cmd.unix.sysctl

Reads or writes kernel parameters.

Systemctlmoler.cmd.unix.systemctl

Manages systemd services.

Servicemoler.cmd.unix.service

Controls SysV init services.

Rebootmoler.cmd.unix.reboot

Sends the reboot command.

Env / Exportmoler.cmd.unix.env

Reads and sets environment variables.

Syncmoler.cmd.unix.sync

Flushes filesystem buffers.

Sumoler.cmd.unix.su

Switches user identity, handles password prompts.

Sudomoler.cmd.unix.sudo

Runs a command with elevated privileges.

Passwdmoler.cmd.unix.passwd

Changes a user’s password interactively.

Useradd / Userdelmoler.cmd.unix.useradd

Adds and removes user accounts.

Idmoler.cmd.unix.id

Prints the current user and group IDs.

Whoamimoler.cmd.unix.whoami

Prints the effective username.

Chmod / Chown / Chgrp

File permission and ownership management.

Sshkeygenmoler.cmd.unix.sshkeygen

Runs ssh-keygen to manage SSH keys.

Iptables / Nftmoler.cmd.unix.iptables

Network packet filtering rule management.

Scpmoler.cmd.unix.scp

Secure file copy over SSH. Handles password prompts and host-key verification.

Sftpmoler.cmd.unix.sftp

Interactive SFTP session.

Telnetmoler.cmd.unix.telnet

Establishes a Telnet connection, handling login/password prompts.

Wgetmoler.cmd.unix.wget

See the Network section above.

Socatmoler.cmd.unix.socat

Multipurpose relay — connects two data streams.

Tcpdump / Tshark — packet capture

Capture and parse network traffic.

Build docs developers (and LLMs) love