DEV Community

Discussion on: Terminal: Copy Current Path

Collapse
 
brandoncharest profile image
Brandon Charest • Edited

I think a common solution would be to use xclip, but that may have to be installed, I am not positive if that comes along by default, and I do not know what the alternative to clip/pbclip for Ubuntu/Deb if there is one. But the command should still be relatively similar.

pwd | tr -d '\n' | xclip && echo 'pwd copied to clipboard
Enter fullscreen mode Exit fullscreen mode
Collapse
 
moopet profile image
Ben Sinclair

I think it depends whether you're using X, doesn't it :)

So in an SSH session to another device, a virtual terminal, VM, a Docker container, WSL, or any of the other places people use Linux, it won't work.

I suspect most people who use a Windows or MacOS machine as their daily driver doesn't have X installed on any of the things they use Linux on.

Collapse
 
goncalorodrigues profile image
Gonçalo Rodrigues

Yea unfortunately it doesn't come by default, but I do recommend installing it, it's very useful in my day to day