Discussion
Loading...

Post

Log in
  • About
  • Code of conduct
  • Privacy
  • About Bonfire
Alexander Dyas
Alexander Dyas
@alexanderdyas@mindly.social  ·  activity timestamp 4 days ago

Small shell function to copy last line in shell history to clipboard:

# Copy last command from shell history into clipboard
function cl() {
fc -ln | tail -1 | tr --delete "\n" | xclip -selection clipboard
}

Mega useful when you have multiple terminals open, or you want to paste it into documentation.

https://www.alexdyas.com/technical/Last-command-copy/

#unix #bash #zsh #shell

alexdyas

Copy last command in shell history to clipboard

More command line clipboard functionality. This shell function copies the last line in your shell history to the clipboard. # Copy last command from shell history into clipboard function cl() { fc -ln | tail -1 | tr --delete "\n" | xclip -selection clipboard }
  • Copy link
  • Flag this post
  • Block

BT Free Social

BT Free is a non-profit organization founded by @ozoned@btfree.social . It's goal is for digital privacy rights, advocacy and consulting. This goal will be attained by hosting open platforms to allow others to seamlessly join the Fediverse on moderated instances or by helping others join the Fediverse.

BT Free Social: About · Code of conduct · Privacy ·
Bonfire social · 1.0.1-beta.22 no JS en
Automatic federation enabled
Log in
  • Explore
  • About
  • Code of Conduct