ff1cdc02b9
Initial nushell dotfiles: config, modules (git, k8s, sys, hypr, pkg, dev), apex theme files, and a chezmoi-templated prompt that shows dir and git branch/dirty using apex-neon/aeon colors with vi mode indicators.
23 lines
646 B
Nu
23 lines
646 B
Nu
# Processes sorted by CPU, optionally filtered by name
|
|
def psk [query?: string] {
|
|
ps | sort-by cpu -r
|
|
| if $query != null { where name =~ $query } else { $in }
|
|
}
|
|
|
|
# Listening TCP ports with process info
|
|
def ports [] {
|
|
^ss -tlnp
|
|
| detect columns
|
|
| rename state recv-q send-q local peer process
|
|
| each {|r| $r | upsert port (try { $r.local | split row ":" | last | into int } catch { null })}
|
|
| select state local port process
|
|
| sort-by port
|
|
}
|
|
|
|
# Environment variables as a filterable sorted table
|
|
def envs [query?: string] {
|
|
$env | transpose key value
|
|
| if $query != null { where key =~ $query } else { $in }
|
|
| sort-by key
|
|
}
|