How to copy command console text?
Solution 1:
if you have a touchpad though, highlight the text and press Ctrl + Shift + C to copy ...
the following resources describe how to copy/paste using keyboard only -- screen/byobu:
How do I integrate Byobu's copy-buffer with the X clipboard?
http://www.samsarin.com/blog/2007/03/11/gnu-screen-working-with-the-scrollback-buffer/
Copy and Paste in Scrollback mode (screen/byobu)
- Enter scrollback mode: Ctrl+A+[ or in byobu also F7
- Move the cursor to the start of the text you want to copy, hit spacebar
- Move the cursor to the end of the text you want to copy and hit enter
- To paste text, hit Ctrl+A+] or Alt+Insert
Solution 2:
Try this:
wpa_passphrase | awk '/psk/ {print $4}' >> wpa.supplicant.conf
Command should take out the "psk=d5e532ecca53ea963e5b3b5521bb3682c53fcf5b6d55f15622027145c795b661" part and copy it to the end of your wpa.supplicant.conf file. Try changing $4
to $3
or $2
if you don't get the right part of the wpa_passphrase command.
Solution 3:
May be not perfect but a workaround. May be you could write the output in a file then go into the file remove unnecessary text and using cat
you could append it to wpa_supplicant.conf
Basically your workflow would be:
command > rough
nano rough
here delete the unnecessary text and keep just the necessary ones i.e psk
sudo sh -c "cat rough >> wpa_supplicant.conf"
Or may be you could use vim to yank the required text choosing it in visual mode.
P.S. Someone with good knowledge of sed would give you a easier solution than this I think.
Solution 4:
Of course the most common way to do this would be to use a mouse or other pointing device (such as a touchpad). Although it's somewhat excentric, it's possible to copy text without a mouse. (You may of course have a valid reason not use a pointing device.) Check out xclip
, as in this answer. Thus you could use:
wpa_passphrase | xclip -sel clip