this post was submitted on 31 Jan 2025
81 points (94.5% liked)

Linux

5915 readers
464 users here now

A community for everything relating to the GNU/Linux operating system

Also check out:

Original icon base courtesy of [email protected] and The GIMP

founded 2 years ago
MODERATORS
 

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.

you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 2 points 17 hours ago (1 children)

Fair enough! For what it's worth, parallel provides a lot of really nice control mechanisms to fine tune how your jobs are scheduled (e.g., only start a new job when there's X amount of memory available), saving stdout and stderr to log files, running jobs on remote hosts, even saving results to a SQL database.

[โ€“] [email protected] 1 points 11 hours ago

Very cool. Love finding new CLI commands to use. I've been in terminals since the days of Solaris, so it's rare I find something unique to use these days. Usually it's just something slightly better than the old ways so it's switching for the sake of that. Though for some reason tmux never stuck for me.