Skip to content

Is there an easy way to copy last command from terminal to clipboard? #214

Answered by leo-arch
theRoboxx asked this question in Q&A
Discussion options

You must be logged in to vote

If you want to copy the line buffer to the clipboard, to later retrieve it via Ctrl-v or the Paste command in a context menu, you can do it as follows:

NOTE: You need the latest version of clifm, so that you need to clone it and build it as always.

  1. Create a new plugin, say xclip.sh, with the following content and drop it into the plugins directory (~/.config/clifm/plugins):
#!/bin/sh

if [ -z "$CLIFM_LINE" ]; then
    printf "clifm: Empty line buffer\n" 2>&1
    exit 1
fi

printf "%s" "$CLIFM_LINE" | xclip -selection clipboard
printf "clifm: Line buffer copied into the clipboard\n"

NOTE: Replace xclip by your preferred X clipboard application.

  1. Bind this plugin to an action (via the act…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@leo-arch
Comment options

Answer selected by theRoboxx
@leo-arch
Comment options

@theRoboxx
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants