← Back to context

Comment by vladvasiliu

3 days ago

> for something like docker commands, there's just no easy way to copy a specific container ID without using the mouse

Some terminals have a mode where you can move the cursor around the history, and allow searching / copying / pasting. Alacritty and tmux come to mind, others may also implement something similar.

It’s still annoying to move. The only way it’s practical is if you can store a regex to match container ids or whatever, and quickly fetch it

  • I do something that, but just parse the output of `docker ps` or whatever. Since each line has the same format it's very straightforward.

  • oh heh I do

        docker ps -a | grep image_name_or_whatever | awk1 | pbcopy (or xclip on linux)
    

    (awk1 is an alias for awk "{print $1}" and I just have awk1-10 or whatever)

    to grab the container id and put it on the clipboard