LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Copy and paste in bash shell??? (https://www.linuxquestions.org/questions/linux-newbie-8/copy-and-paste-in-bash-shell-944323/)

malak33 05-10-2012 09:11 PM

Copy and paste in bash shell???
 
Ok so here is my problem. Let's say I'm in shell 1 and i have open /boot/grub/grub.conf and in shell 2 i have a command ran like this
grub-m5-crypt
then i enter in my password and it spits this out at me
laskdjhfKHFIU98&y8KDJHF6576*&(*&)(*KJHB#Gy22(*#*Yiho0234hj..nih23i4h
(exageration)

Now back in shell 1 i inserted the following line password --md5 (i need super long hashed password here)

How do i go about copying the output from shell 2 and making it so i can paste in shell 1.

I know that if i open up the GUI i can just open up terminal and copy and paste that way. I do not want to use the GUI. I used it at first to get comfortable, i feel like I'm almost there now. Thanks for the help guys. Ohh yea I'm using CentOS 6.2 as well.

TobiSGD 05-10-2012 09:20 PM

Install gpm, when it runs you can mark text with the mouse and paste it everywhere with a middle mouse click.

malak33 05-10-2012 09:21 PM

i do not have a mouse in my shell...

TobiSGD 05-10-2012 09:22 PM

You will when you have installed gpm. gpm is something like a mouse driver for the console.

allend 05-10-2012 09:31 PM

You could also use a temporary file. e.g.
echo "$(grub-md5-crypt)" > temp.txt
and then read in the contents of temp.txt from the editor you are using for the /boot/grub/grub.conf

malak33 05-10-2012 09:55 PM

i don't understand how that would get the super long password into the grub.conf file that i have open in a text editor though? it would copy it to a temp .txt document. How does it get from the temp.txt doc to the grub.conf file that i have open?

allend 05-11-2012 07:14 AM

If you use 'nano' look at Ctrl-R. If you use 'vim' look at :r.

sunnydrake 05-11-2012 08:59 AM

if you use graphic shaell like xterm kterm etc you have clipboard by default(sometimes ctrl+cvx don't work, use shift/crtl+ins/del)
if you use 'bare' shell with no X11 you need a way around like shared file etc.. or package 'console' that have a lot of good stuff buildin (like resume shell session from anywhere,forks,spoons etc..)
my little stuff include things like whattty=$(tty);echo 'All your bases belong to us\n Borg' >> $whattty;


All times are GMT -5. The time now is 02:19 AM.