S
S
Sergey Burduzha2019-09-03 09:31:12
linux
Sergey Burduzha, 2019-09-03 09:31:12

How to copy filename in linux terminal?

Good afternoon.
Sometimes you need to quickly copy the filename.
Suppose, in order to copy the path to the directory where I am, I created such an alias.
alias getp='pwd | xclip -sel clip'
I want to create something similar for copying the name of a file or directory.
You also enter the command and file name, and it is automatically copied to the clipboard.
Thanks in advance for your help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2019-09-03
@serii81

alias pbcopy='xclip -selection clipboard'
ls <filename> | pbcopy

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question