I use Ollama with continue.dev in code-server, and I wanted a way to hit Cntrl-Shift-Alt-T to get a “top” of sorts that would show CPU, IO, GPU, loaded models, and logs, all in one place quickly.

Set up the below screenrc file and created the shortcut above in Debian. Tab switches between CPU and IO, and Cntrl-a q quits all screens and closes the Gnome shell.

Screenrc:

termcapinfo xterm* ti@:te@
startup_message off
defscrollback 10000

bind q eval "kill" "quit"
caption always "%{= rw}%-w%{= KW}%n %t%{-}%+w"
defbce on

# Start htop and focus
screen -t "HTop" htop
focus

# Split horizontally to put nvtop under htop
split
focus
screen -t "NVTop" nvtop

# Split vertically to put ollama next to nvtop
split -v
focus
screen -t "Ollama PS" watch -n5 'docker exec -ti ai-ollama ollama ps'

# Split horizontally to put logs underneath ps
split
focus
screen -t "Ollama logs" bash -c "docker logs -f --tail 100 ai-ollama | grep -Ev '\"/api/ps\"|\"/\"'"

# Resize PS, then get back to logs
focus up
resize -v 6
focus down

# Get back to htop
focus

The atop script that runs with Cntrl-Alt-Shift-T:

#!/usr/bin/env bash

if [ "${1}" = "new" ]; then
    gnome-terminal --geometry=200x50+0+0 --maximize -- /data/system/bin/atop
else
    screen -c /data/system/setup/common/screenrc-status
fi

Happy to share my htop config as well if anyone wants it.

  • robinm
    link
    fedilink
    arrow-up
    5
    ·
    11 hours ago

    I’ve exensively used screen, tmux and zellij, and all 3 are fantastic workflow enabler. I can’t recommend enough to take the time learn either one, especially if you work over ssh.

      • It should; screen is older, and tmux was a new alternative to try to address screen’s deficiencies. It’s still more correct to say “tmux is like screen.”

        There’s also dvtm, also newer than screen.

        I was a longtime screen user before switching to tmux, which is IMHO categorically better. I tried dvtm for a few months, but you have to pair it with something else to get close to tmux, and I found it fussy and difficult.

        Then there are a bunch of terminals with built in multiplexors, which baffles me: it binds you to a specific terminal, loses all of the benefits of persistent sessions, and can’t be used remotely over ssh. It’s not clear to me why people build or use those.

      • Badabinski@kbin.earth
        link
        fedilink
        arrow-up
        5
        ·
        2 days ago

        I really like screen for simple stuff and for connecting to serial consoles. I just rely on my window manager to handle all the splitting and stuff, so I don’t need the power that tmux has.