Registered Member
|
Hi,
from time to time, I think it would be practical to cycle through the output lines of the called commands on the prompt line by some keystrokes. I suppose it is currently not possible in Konsole, if yes, please let me know how. Or let me know, about some creative workarounds :) One of the most common use-cases is that I `cat` some file and it contains file names or server names or similar, which I need to use for next command, ... so I would cycle to the line (which would automatically paste it to the prompt) and then remove the parts of the line I don't need and just prepend the name with `ssh` or `cp` and complete the command. Now, I have to touch my mouse/touchpad, use middle mouse button, which is cumbersome or to type, which is error prone. The closest terminal I know of, which somehow provides this is emac's `shell`. It allows to move the cursor over the output of the previous commands and copy&paste. Although the ergonomics is not ideal -- you have to move the cursor, Kill-ring save (copy) whole line, return the cursor to the prompt, and yank. My idea is to just use some "up" and "down" shortcut keys, which would walk over the lines above the prompt up and down and automatically put the content of the line to the prompt. Then pressing any other key, would return the cursor to the prompt and the copied line could be edited. Another, not so ergonomic, approach is to [pipe the command output to the clipboard](https://stackoverflow.com/questions/513 ... -clipboard), which a) does not allow to finely select the right line, b) does not give the visual feedback if you want to walk over older outputs (you need to walk the clipboard history, which somehow occludes what outputs you already have there).
Last edited by gree on Thu May 14, 2020 10:50 am, edited 1 time in total.
|
Manager
|
My personal workaround: tabs. I have different tabs for the most common use cases (updates, searches, root action) and the history being instance (e.g. tab) specific, a simply cycle through with the arrow up or down keys is good enough not having to wade through to many lines. Tbs are renamed so I know what they are there for. I don't recall ever using the mouse in Konsole ...
Running Kubuntu 22.10 with Plasma 5.26.3, Frameworks 5.100.0, Qt 5.15.6, kernel 5.19.0-23 on Ryzen 5 4600H, AMD Renoir, X11
FWIW: it's always useful to state the exact Plasma version (+ distribution) when asking questions, makes it easier to help ... |
Registered Member
|
There are multiple ways to do that.
One is to use the history command to read the files with the commands. After that you should be able to use arrow up to cycle through that file by arrow up, just like you can do with old commands in ~/.bash_history or similar.
Alternatively you can append it to .bash_history and after that open a new bash prompt. Another way is to use something like tmux and have 2 tmux panes open. On one you open the files with command with something like vim. Now you copy a line using the tmux buffer (<prefix>-[ ....), switch the pane and paste it. Or you can copy it from vim to X11, switch the pane and paste it with ctrl-shift-V. Another way would be to use some shell magic. This works when you do not need to edit the output.
|
Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell