Copy paste in bash

Hello

this will be difficult to explain so thanks in advance for you patience…

supposing you type:

cat /etc/passwd | grep nobody

then you type history

in all the linux distros I’ve used so far you can use the left mouse button and, starting with the c in cat, highlight the whole line continuing on past the y in nobody towards the limit of the terminal window. If you now paste this highlighted text into another terminal using the middle mouse button it will run “cat /etc/passwd | grep nobody” and display the result of this command … This is for me normal bash behavior.

I have recently installed DietPi_RPi-ARMv6-Bullseye onto a raspberry pi and this doesn’t work. One has to highlight only the available text (stopping at the y in nobody in the previous example) then paste with the middle mouse button and then hit enter to get the command to run. By pasting a complete line including the blank space after the last character you only get a blank line and the (not functioning) command has to be terminated via ctrl+c.

Is the a config file somewhere that controls copy/paste behavior ???

Thanks

Welcome to our community.

Are you using a Desktop environment or SSH ?

sorry, I should have added that this is a headless dietpi. I am ssh-ing into it from another linux box using roxterm, xterm and xfce-terminal. The result is the same. I also have other raspi’s on my lan running various versions of debian. On those other raspis I don’t see this behaviour.
Thanks

Just mark the text your with mouse / cursor and press ctrl+6, this is default keybinding for copying, I think.

Also I never experienced the behaviour you described in my SSH sessions

edit: I tried like you did with middle mouse button and pasting in the terminal, with the last space character, but it does not get executed by itself nor I have to terminate anything. I would assume this is an issue with your terminal software rather then a problem with dietpi.

But if you connect using SSH, it’s a behaviour of the SSH client and has nothing to do with the underlying OS.

1 Like

Exactly, SSH and bash have no copy&paste features at all, it’s the SSH client and surrounding OS which serve this feature while the server system is not involved at all in this. The SSH client does copy of highlighted text to client OS clipboard and pasting back usually on right mouse click. No idea how other server distros should be able to behave differently (since they do not “behave” at all), so please try to verify this very carefully, at best with two concurrently running systems and identically opened SSH sessions.

1 Like

OK,
I’ve opened 2 instances of xterm and within each I’ve run:

ssh ce@raspian_1
and
ssh ce@dietpi_1

when repeating the aforementioned copy paste operations on the raspian_1 machine the command is run and displays the expected result. On dietpi_1 I get nothing until I either hit the enter key or exit using ctrl+c. I understand what you are saying concerning ssh and client side bash but having done exactly the same thing on two different ssh server sessions and got two different results… I just can’t figure it out.

On my LAN I have several raspberry pis all of the dietpis exhibit this “behavior” while none of the raspians do.

Thanks

Does both systems running same SSH server? By default DietPi is running Dropbear instead of OpenSSH.

1 Like

I’m having the same issue, I’m using vmware workstation in a headless setup. I tried control+6 with no luck. Currently trying to copy from dietpi and paste into windows and for the life of me can’t get it to work.

I was able to get copy and paste working by using ssh with mRemoteNG.

Personally, I’m using Putty without issues

1 Like