System

System: processes, services, packages, macOS.

File aliases/system.sh. Disable: export ALIASX_DISABLE="system"

Processes

NameRunsWhat it does
kerneluname -akernel and OS info
loaduptimeuptime and load
memvm_statmemory usagemacOS
psmemps aux | sort -nrk 4 | head -11top 10 by memorymacOS
pscpups aux | sort -nrk 3 | head -11top 10 by CPUmacOS
memfree -hmemory usageLinux
psmemps aux --sort=-%mem | head -11top 10 by memoryLinux
pscpups aux --sort=-%cpu | head -11top 10 by CPULinux
pleaseeval "sudo $(fc -ln -1)"rerun last command with sudo
psgrep PATTERNfind processes by name
example
$ psgrep nginx
root   812  0.0  0.1  nginx: master process
www    813  0.0  0.2  nginx: worker process

Linux hardware

NameRunsWhat it does
diskslsblk -fblock devices and filesystemsLinux
mountsfindmntmounted filesystemsLinux
gpuinfonvidia-smiNVIDIA GPU statusneeds nvidia-smi

systemd and logs

NameRunsWhat it does
scsystemctlsystemctlneeds systemctl
scusystemctl --usersystemctl for userneeds systemctl
scfailedsystemctl --failedfailed unitsneeds systemctl
jcjournalctljournalctlneeds systemctl
jcfjournalctl --followfollow journalneeds systemctl
jcxejournalctl -xerecent journal with explanationsneeds systemctl
jcerrjournalctl -p err..alert -berrors since bootneeds systemctl
svclogs SERVICE [OPTS]journal for one service
example
$ svclogs nginx -n 5
Oct 02 10:31:07 web1 nginx[812]: started
needs systemctl

Firewall (ufw)

NameRunsWhat it does
ufwsasroot ufw status verbosefirewall rulesneeds ufw
ufwaasroot ufw allowallow port or serviceneeds ufw
ufwdasroot ufw denydeny port or serviceneeds ufw

Packages

NameRunsWhat it does
aptupasroot apt update && asroot apt upgradeupdate and upgrade packagesneeds apt
aptiasroot apt installinstall packageneeds apt
aptrasroot apt removeremove packageneeds apt
aptsapt searchsearch packagesneeds apt
aptcleanasroot apt autoremoveremove unused packagesneeds apt
dnfupasroot dnf upgrade --refreshupgrade packagesneeds dnf
dnfiasroot dnf installinstall packageneeds dnf
dnfrasroot dnf removeremove packageneeds dnf
dnfsdnf searchsearch packagesneeds dnf
pacupasroot pacman -Syusync and upgrade packagesneeds pacman
paciasroot pacman -Sinstall packageneeds pacman
pacrasroot pacman -Rnsremove package and depsneeds pacman
pacspacman -Sssearch packagesneeds pacman
apkupasroot apk update && asroot apk upgradeupdate and upgrade packagesneeds apk
apkiasroot apk addinstall packageneeds apk
apkrasroot apk delremove packageneeds apk
brewupbrew update && brew upgradeupdate and upgrade formulaeneeds brew
brewibrew installinstall formulaneeds brew
brewrbrew uninstalluninstall formulaneeds brew
brewsbrew searchsearch formulaeneeds brew
brewcleanbrew cleanupremove old versionsneeds brew

Power (Linux)

NameRunsWhat it does
sys-rebootreboot machine after y/N
example
$ sys-reboot
Reboot web1 now? [y/N] n
Cancelled.
needs systemctl
sys-poweroffpower off machine after y/N
example
$ sys-poweroff
Power off web1 now? [y/N] n
Cancelled.
needs systemctl
sys-suspendsuspend machine after y/N
example
$ sys-suspend
Suspend laptop now? [y/N] y
needs systemctl

macOS

NameRunsWhat it does
flushdnsasroot dscacheutil -flushcache; asroot killall -HUP mDNSResponderflush DNS cachemacOS
showfilesdefaults write com.apple.finder AppleShowAllFiles -bool true; killall Findershow hidden files in FindermacOS
hidefilesdefaults write com.apple.finder AppleShowAllFiles -bool false; killall Finderhide hidden files in FindermacOS
sleepnowput the Mac to sleep after y/N
example
$ sleepnow
Sleep now? [y/N] y
macOS
clipcopystdin to clipboard (pbcopy, wl-copy or xclip)
example
$ cat id_ed25519.pub | clipcopy
(public key copied to clipboard)
clippasteclipboard to stdout
example
$ clippaste > note.txt
(clipboard saved to note.txt)