Copy terminal result from one window to anothercannot insert backslash with bash, python, works fine with...

What is the philosophical significance of speech acts/implicature?

As an international instructor, should I openly talk about my accent?

What are the steps to solving this definite integral?

Is there a way to generate a list of distinct numbers such that no two subsets ever have an equal sum?

Apply MapThread to all but one variable

Does tea made with boiling water cool faster than tea made with boiled (but still hot) water?

How to stop co-workers from teasing me because I know Russian?

Alignment of various blocks in tikz

Was there a Viking Exchange as well as a Columbian one?

What term is being referred to with "reflected-sound-of-underground-spirits"?

Dynamic SOQL query relationship with field visibility for Users

Why does nature favour the Laplacian?

Can we say “you can pay when the order gets ready”?

How much cash can I safely carry into the USA and avoid civil forfeiture?

"The cow" OR "a cow" OR "cows" in this context

Phrase for the opposite of "foolproof"

"Whatever a Russian does, they end up making the Kalashnikov gun"? Are there any similar proverbs in English?

Is there any official lore on the Far Realm?

How can I practically buy stocks?

What happened to Captain America in Endgame?

Was there a shared-world project before "Thieves World"?

Classification of surfaces

How to limit Drive Letters Windows assigns to new removable USB drives

What are the characteristics of a typeless programming language?



Copy terminal result from one window to another


cannot insert backslash with bash, python, works fine with csh, idlebash terminal/console strange overlapping behaviorcopy from one folder to another not working in terminalRecursively copy (and rename) files to their own same directory with another nameWrite command in one terminal, see result on other oneHow to get PID of shell running in a terminal window under mouse?How to prevent copying additional nonvisible textHow to logout the ubuntu while remain vnc session connected?Shell script that open xterm, cd into a folder, run a command, and keeps me thereHow do I efficiently find my terminal window in GNOME Shell?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







6















I often have many terminals open when working (GNOME Terminal 3.4.1.1, Bash). Quite often I need to copy the results of one terminal into another. An common scenario:



terminalA> pwd
/home/hooked/foo

terminalB> cp * /home/hooked/foo


I usually end up copy pasting with the mouse. Is there a keyboard shortcut for what I'm trying to achieve?










share|improve this question





























    6















    I often have many terminals open when working (GNOME Terminal 3.4.1.1, Bash). Quite often I need to copy the results of one terminal into another. An common scenario:



    terminalA> pwd
    /home/hooked/foo

    terminalB> cp * /home/hooked/foo


    I usually end up copy pasting with the mouse. Is there a keyboard shortcut for what I'm trying to achieve?










    share|improve this question

























      6












      6








      6


      1






      I often have many terminals open when working (GNOME Terminal 3.4.1.1, Bash). Quite often I need to copy the results of one terminal into another. An common scenario:



      terminalA> pwd
      /home/hooked/foo

      terminalB> cp * /home/hooked/foo


      I usually end up copy pasting with the mouse. Is there a keyboard shortcut for what I'm trying to achieve?










      share|improve this question














      I often have many terminals open when working (GNOME Terminal 3.4.1.1, Bash). Quite often I need to copy the results of one terminal into another. An common scenario:



      terminalA> pwd
      /home/hooked/foo

      terminalB> cp * /home/hooked/foo


      I usually end up copy pasting with the mouse. Is there a keyboard shortcut for what I'm trying to achieve?







      command-line gnome-terminal clipboard






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Sep 19 '12 at 14:25









      HookedHooked

      1,08331529




      1,08331529






















          5 Answers
          5






          active

          oldest

          votes


















          6














          Ctrl + Shift + c --> Copy



          Ctrl + Shift + v --> paste



          In terminal...
          Go to Edit > Keyboard Shortcuts... and this window opens...
          For further info...






          share|improve this answer


























          • I had no idea that the copy commands took in the buffer! I feel so stupid - thanks!

            – Hooked
            Sep 19 '12 at 14:31











          • absolutely, though the site prevents me from doing so until some prerequisite time has elapsed.

            – Hooked
            Sep 19 '12 at 14:41











          • Hey check the updates...

            – Sam
            Sep 19 '12 at 14:46



















          4














          you highlight the text (or double left click it) you want to copy with the mouse and Ctrl+Shift+C to copy and Ctrl+Shift+V to paste. Also you can highlight text with the mouse and use the middle mouse key/scroll wheel to paste.






          share|improve this answer































            4














            Another solution: you do not need to use keyboard shortcuts at all!



            Just mark what you want with the left mouse button (for example, double clicking a word), and paste it by clicking the middle mouse button in the other terminal. This is the "old style" X clipboard.






            share|improve this answer


























            • I have always selected the text with 1st mouse button and pasted it with middle mouse button

              – user1156544
              yesterday











            • you are absolutely right.

              – January
              16 hours ago



















            1














            There are many situations where copying and pasting from the terminal is useful. However, in the situation you cited, I believe there's a better way.



            Your situation involves operating on some path which was printed in another terminal window. You can copy and paste, but what if there are spaces in the name? Also, copying and pasting involves you moving your hand from the keyboard to the mouse to select the text, which is inefficient.



            In your example, you wanted to work with /home/hooked/foo. I'm assumming that /home/hooked is your home directory, which is the value of the environment variable $HOME. So, you could refer to $HOME/foo instead. But, in bash and a number of other places, ~ is a shortcut for $HOME. Thus, you could refer instead to ~/foo.



            Then, there's tab completion. Suppose you had the following directory structure:



            /
            |-> home
            |-> hooked
            |-> foo
            |-> bar
            |-> buzz


            When you want to refer to ~/foo, you can type this: ~/fTAB. The tab key does autocompletion. Play with it to learn how it works, and you'll stop typing things in full now. Thanks to tab completion, I freely use long filenames with spaces and other special characters--sometimes even characters not present on my keyboard--without any inconvenience, because I never have to actually type them or waste time copying and pasting.



            If you learn to use these tools (along with relative diretory paths if you don't already know about them), I predict you'll no longer find a need to copy and paste for filesystem operations.






            share|improve this answer































              0














              A completely different approach would be to use a temporary file, like



              terminalA> pwd > /tmp/somepwd

              terminalB> cp * `cat /tmp/somepwd`





              share|improve this answer



















              • 1





                This approach won't work if the directory name contains spaces or other characters that have a special meaning to the shell.

                – Scott Severance
                Sep 19 '12 at 23:15






              • 1





                Yes; however that's easily fixed with adding extra double quotes (cp * "`cat /tmp/somepwd`").

                – leftaroundabout
                Sep 20 '12 at 9:22













              • And, of course, such directory names are a very bad thing to have in the first place anyway, (though in fact Canonical choose to name that infamoous folder Ubuntu One...). At least, they're a problem in the OP's original example, too.

                – leftaroundabout
                Sep 20 '12 at 9:35













              • Having spaces in filenames is hardly a bad idea. In fact, in many cases it's the best way in terms of readability and overall usability. Spaces in filenames never cause problems in sane code, and thanks to features such as tab completion they don't make filenames more difficult to type, either. My personal practice is to use any appropriate character (including spaces, exotic characters that I pull from the character map, etc.) when I expect to use the file/directory in a GUI at least on occasion. If I'm programming, I avoid spaces to comply with conventions.

                – Scott Severance
                Sep 21 '12 at 8:30













              • I like using exotic characters, too – those should never be a problem, everything should be UTF-8 compliant. And you're right: sane code should handle spaces as well. But IMO, the file system should be fine with "insane" code as well, namely quick command-line Bash hacks; those typically are quite a bit more cumbersome to write if you want to be space-safe. — What I'd propose is to use the no-break-space-character (U+a0 " "): that looks fine in a GUI, prevents wrapping at inappropriate places (which makes it easier to copy paths from a GUI text field into a terminal), and is Bash-hack-safe.

                – leftaroundabout
                Sep 21 '12 at 8:41














              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "89"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f190575%2fcopy-terminal-result-from-one-window-to-another%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              5 Answers
              5






              active

              oldest

              votes








              5 Answers
              5






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              6














              Ctrl + Shift + c --> Copy



              Ctrl + Shift + v --> paste



              In terminal...
              Go to Edit > Keyboard Shortcuts... and this window opens...
              For further info...






              share|improve this answer


























              • I had no idea that the copy commands took in the buffer! I feel so stupid - thanks!

                – Hooked
                Sep 19 '12 at 14:31











              • absolutely, though the site prevents me from doing so until some prerequisite time has elapsed.

                – Hooked
                Sep 19 '12 at 14:41











              • Hey check the updates...

                – Sam
                Sep 19 '12 at 14:46
















              6














              Ctrl + Shift + c --> Copy



              Ctrl + Shift + v --> paste



              In terminal...
              Go to Edit > Keyboard Shortcuts... and this window opens...
              For further info...






              share|improve this answer


























              • I had no idea that the copy commands took in the buffer! I feel so stupid - thanks!

                – Hooked
                Sep 19 '12 at 14:31











              • absolutely, though the site prevents me from doing so until some prerequisite time has elapsed.

                – Hooked
                Sep 19 '12 at 14:41











              • Hey check the updates...

                – Sam
                Sep 19 '12 at 14:46














              6












              6








              6







              Ctrl + Shift + c --> Copy



              Ctrl + Shift + v --> paste



              In terminal...
              Go to Edit > Keyboard Shortcuts... and this window opens...
              For further info...






              share|improve this answer















              Ctrl + Shift + c --> Copy



              Ctrl + Shift + v --> paste



              In terminal...
              Go to Edit > Keyboard Shortcuts... and this window opens...
              For further info...







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Sep 19 '12 at 14:46

























              answered Sep 19 '12 at 14:30









              SamSam

              62631021




              62631021













              • I had no idea that the copy commands took in the buffer! I feel so stupid - thanks!

                – Hooked
                Sep 19 '12 at 14:31











              • absolutely, though the site prevents me from doing so until some prerequisite time has elapsed.

                – Hooked
                Sep 19 '12 at 14:41











              • Hey check the updates...

                – Sam
                Sep 19 '12 at 14:46



















              • I had no idea that the copy commands took in the buffer! I feel so stupid - thanks!

                – Hooked
                Sep 19 '12 at 14:31











              • absolutely, though the site prevents me from doing so until some prerequisite time has elapsed.

                – Hooked
                Sep 19 '12 at 14:41











              • Hey check the updates...

                – Sam
                Sep 19 '12 at 14:46

















              I had no idea that the copy commands took in the buffer! I feel so stupid - thanks!

              – Hooked
              Sep 19 '12 at 14:31





              I had no idea that the copy commands took in the buffer! I feel so stupid - thanks!

              – Hooked
              Sep 19 '12 at 14:31













              absolutely, though the site prevents me from doing so until some prerequisite time has elapsed.

              – Hooked
              Sep 19 '12 at 14:41





              absolutely, though the site prevents me from doing so until some prerequisite time has elapsed.

              – Hooked
              Sep 19 '12 at 14:41













              Hey check the updates...

              – Sam
              Sep 19 '12 at 14:46





              Hey check the updates...

              – Sam
              Sep 19 '12 at 14:46













              4














              you highlight the text (or double left click it) you want to copy with the mouse and Ctrl+Shift+C to copy and Ctrl+Shift+V to paste. Also you can highlight text with the mouse and use the middle mouse key/scroll wheel to paste.






              share|improve this answer




























                4














                you highlight the text (or double left click it) you want to copy with the mouse and Ctrl+Shift+C to copy and Ctrl+Shift+V to paste. Also you can highlight text with the mouse and use the middle mouse key/scroll wheel to paste.






                share|improve this answer


























                  4












                  4








                  4







                  you highlight the text (or double left click it) you want to copy with the mouse and Ctrl+Shift+C to copy and Ctrl+Shift+V to paste. Also you can highlight text with the mouse and use the middle mouse key/scroll wheel to paste.






                  share|improve this answer













                  you highlight the text (or double left click it) you want to copy with the mouse and Ctrl+Shift+C to copy and Ctrl+Shift+V to paste. Also you can highlight text with the mouse and use the middle mouse key/scroll wheel to paste.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Sep 19 '12 at 14:29









                  NateNate

                  52425




                  52425























                      4














                      Another solution: you do not need to use keyboard shortcuts at all!



                      Just mark what you want with the left mouse button (for example, double clicking a word), and paste it by clicking the middle mouse button in the other terminal. This is the "old style" X clipboard.






                      share|improve this answer


























                      • I have always selected the text with 1st mouse button and pasted it with middle mouse button

                        – user1156544
                        yesterday











                      • you are absolutely right.

                        – January
                        16 hours ago
















                      4














                      Another solution: you do not need to use keyboard shortcuts at all!



                      Just mark what you want with the left mouse button (for example, double clicking a word), and paste it by clicking the middle mouse button in the other terminal. This is the "old style" X clipboard.






                      share|improve this answer


























                      • I have always selected the text with 1st mouse button and pasted it with middle mouse button

                        – user1156544
                        yesterday











                      • you are absolutely right.

                        – January
                        16 hours ago














                      4












                      4








                      4







                      Another solution: you do not need to use keyboard shortcuts at all!



                      Just mark what you want with the left mouse button (for example, double clicking a word), and paste it by clicking the middle mouse button in the other terminal. This is the "old style" X clipboard.






                      share|improve this answer















                      Another solution: you do not need to use keyboard shortcuts at all!



                      Just mark what you want with the left mouse button (for example, double clicking a word), and paste it by clicking the middle mouse button in the other terminal. This is the "old style" X clipboard.







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited 16 hours ago

























                      answered Sep 19 '12 at 14:58









                      JanuaryJanuary

                      26.1k116789




                      26.1k116789













                      • I have always selected the text with 1st mouse button and pasted it with middle mouse button

                        – user1156544
                        yesterday











                      • you are absolutely right.

                        – January
                        16 hours ago



















                      • I have always selected the text with 1st mouse button and pasted it with middle mouse button

                        – user1156544
                        yesterday











                      • you are absolutely right.

                        – January
                        16 hours ago

















                      I have always selected the text with 1st mouse button and pasted it with middle mouse button

                      – user1156544
                      yesterday





                      I have always selected the text with 1st mouse button and pasted it with middle mouse button

                      – user1156544
                      yesterday













                      you are absolutely right.

                      – January
                      16 hours ago





                      you are absolutely right.

                      – January
                      16 hours ago











                      1














                      There are many situations where copying and pasting from the terminal is useful. However, in the situation you cited, I believe there's a better way.



                      Your situation involves operating on some path which was printed in another terminal window. You can copy and paste, but what if there are spaces in the name? Also, copying and pasting involves you moving your hand from the keyboard to the mouse to select the text, which is inefficient.



                      In your example, you wanted to work with /home/hooked/foo. I'm assumming that /home/hooked is your home directory, which is the value of the environment variable $HOME. So, you could refer to $HOME/foo instead. But, in bash and a number of other places, ~ is a shortcut for $HOME. Thus, you could refer instead to ~/foo.



                      Then, there's tab completion. Suppose you had the following directory structure:



                      /
                      |-> home
                      |-> hooked
                      |-> foo
                      |-> bar
                      |-> buzz


                      When you want to refer to ~/foo, you can type this: ~/fTAB. The tab key does autocompletion. Play with it to learn how it works, and you'll stop typing things in full now. Thanks to tab completion, I freely use long filenames with spaces and other special characters--sometimes even characters not present on my keyboard--without any inconvenience, because I never have to actually type them or waste time copying and pasting.



                      If you learn to use these tools (along with relative diretory paths if you don't already know about them), I predict you'll no longer find a need to copy and paste for filesystem operations.






                      share|improve this answer




























                        1














                        There are many situations where copying and pasting from the terminal is useful. However, in the situation you cited, I believe there's a better way.



                        Your situation involves operating on some path which was printed in another terminal window. You can copy and paste, but what if there are spaces in the name? Also, copying and pasting involves you moving your hand from the keyboard to the mouse to select the text, which is inefficient.



                        In your example, you wanted to work with /home/hooked/foo. I'm assumming that /home/hooked is your home directory, which is the value of the environment variable $HOME. So, you could refer to $HOME/foo instead. But, in bash and a number of other places, ~ is a shortcut for $HOME. Thus, you could refer instead to ~/foo.



                        Then, there's tab completion. Suppose you had the following directory structure:



                        /
                        |-> home
                        |-> hooked
                        |-> foo
                        |-> bar
                        |-> buzz


                        When you want to refer to ~/foo, you can type this: ~/fTAB. The tab key does autocompletion. Play with it to learn how it works, and you'll stop typing things in full now. Thanks to tab completion, I freely use long filenames with spaces and other special characters--sometimes even characters not present on my keyboard--without any inconvenience, because I never have to actually type them or waste time copying and pasting.



                        If you learn to use these tools (along with relative diretory paths if you don't already know about them), I predict you'll no longer find a need to copy and paste for filesystem operations.






                        share|improve this answer


























                          1












                          1








                          1







                          There are many situations where copying and pasting from the terminal is useful. However, in the situation you cited, I believe there's a better way.



                          Your situation involves operating on some path which was printed in another terminal window. You can copy and paste, but what if there are spaces in the name? Also, copying and pasting involves you moving your hand from the keyboard to the mouse to select the text, which is inefficient.



                          In your example, you wanted to work with /home/hooked/foo. I'm assumming that /home/hooked is your home directory, which is the value of the environment variable $HOME. So, you could refer to $HOME/foo instead. But, in bash and a number of other places, ~ is a shortcut for $HOME. Thus, you could refer instead to ~/foo.



                          Then, there's tab completion. Suppose you had the following directory structure:



                          /
                          |-> home
                          |-> hooked
                          |-> foo
                          |-> bar
                          |-> buzz


                          When you want to refer to ~/foo, you can type this: ~/fTAB. The tab key does autocompletion. Play with it to learn how it works, and you'll stop typing things in full now. Thanks to tab completion, I freely use long filenames with spaces and other special characters--sometimes even characters not present on my keyboard--without any inconvenience, because I never have to actually type them or waste time copying and pasting.



                          If you learn to use these tools (along with relative diretory paths if you don't already know about them), I predict you'll no longer find a need to copy and paste for filesystem operations.






                          share|improve this answer













                          There are many situations where copying and pasting from the terminal is useful. However, in the situation you cited, I believe there's a better way.



                          Your situation involves operating on some path which was printed in another terminal window. You can copy and paste, but what if there are spaces in the name? Also, copying and pasting involves you moving your hand from the keyboard to the mouse to select the text, which is inefficient.



                          In your example, you wanted to work with /home/hooked/foo. I'm assumming that /home/hooked is your home directory, which is the value of the environment variable $HOME. So, you could refer to $HOME/foo instead. But, in bash and a number of other places, ~ is a shortcut for $HOME. Thus, you could refer instead to ~/foo.



                          Then, there's tab completion. Suppose you had the following directory structure:



                          /
                          |-> home
                          |-> hooked
                          |-> foo
                          |-> bar
                          |-> buzz


                          When you want to refer to ~/foo, you can type this: ~/fTAB. The tab key does autocompletion. Play with it to learn how it works, and you'll stop typing things in full now. Thanks to tab completion, I freely use long filenames with spaces and other special characters--sometimes even characters not present on my keyboard--without any inconvenience, because I never have to actually type them or waste time copying and pasting.



                          If you learn to use these tools (along with relative diretory paths if you don't already know about them), I predict you'll no longer find a need to copy and paste for filesystem operations.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Sep 19 '12 at 23:29









                          Scott SeveranceScott Severance

                          10.5k73670




                          10.5k73670























                              0














                              A completely different approach would be to use a temporary file, like



                              terminalA> pwd > /tmp/somepwd

                              terminalB> cp * `cat /tmp/somepwd`





                              share|improve this answer



















                              • 1





                                This approach won't work if the directory name contains spaces or other characters that have a special meaning to the shell.

                                – Scott Severance
                                Sep 19 '12 at 23:15






                              • 1





                                Yes; however that's easily fixed with adding extra double quotes (cp * "`cat /tmp/somepwd`").

                                – leftaroundabout
                                Sep 20 '12 at 9:22













                              • And, of course, such directory names are a very bad thing to have in the first place anyway, (though in fact Canonical choose to name that infamoous folder Ubuntu One...). At least, they're a problem in the OP's original example, too.

                                – leftaroundabout
                                Sep 20 '12 at 9:35













                              • Having spaces in filenames is hardly a bad idea. In fact, in many cases it's the best way in terms of readability and overall usability. Spaces in filenames never cause problems in sane code, and thanks to features such as tab completion they don't make filenames more difficult to type, either. My personal practice is to use any appropriate character (including spaces, exotic characters that I pull from the character map, etc.) when I expect to use the file/directory in a GUI at least on occasion. If I'm programming, I avoid spaces to comply with conventions.

                                – Scott Severance
                                Sep 21 '12 at 8:30













                              • I like using exotic characters, too – those should never be a problem, everything should be UTF-8 compliant. And you're right: sane code should handle spaces as well. But IMO, the file system should be fine with "insane" code as well, namely quick command-line Bash hacks; those typically are quite a bit more cumbersome to write if you want to be space-safe. — What I'd propose is to use the no-break-space-character (U+a0 " "): that looks fine in a GUI, prevents wrapping at inappropriate places (which makes it easier to copy paths from a GUI text field into a terminal), and is Bash-hack-safe.

                                – leftaroundabout
                                Sep 21 '12 at 8:41


















                              0














                              A completely different approach would be to use a temporary file, like



                              terminalA> pwd > /tmp/somepwd

                              terminalB> cp * `cat /tmp/somepwd`





                              share|improve this answer



















                              • 1





                                This approach won't work if the directory name contains spaces or other characters that have a special meaning to the shell.

                                – Scott Severance
                                Sep 19 '12 at 23:15






                              • 1





                                Yes; however that's easily fixed with adding extra double quotes (cp * "`cat /tmp/somepwd`").

                                – leftaroundabout
                                Sep 20 '12 at 9:22













                              • And, of course, such directory names are a very bad thing to have in the first place anyway, (though in fact Canonical choose to name that infamoous folder Ubuntu One...). At least, they're a problem in the OP's original example, too.

                                – leftaroundabout
                                Sep 20 '12 at 9:35













                              • Having spaces in filenames is hardly a bad idea. In fact, in many cases it's the best way in terms of readability and overall usability. Spaces in filenames never cause problems in sane code, and thanks to features such as tab completion they don't make filenames more difficult to type, either. My personal practice is to use any appropriate character (including spaces, exotic characters that I pull from the character map, etc.) when I expect to use the file/directory in a GUI at least on occasion. If I'm programming, I avoid spaces to comply with conventions.

                                – Scott Severance
                                Sep 21 '12 at 8:30













                              • I like using exotic characters, too – those should never be a problem, everything should be UTF-8 compliant. And you're right: sane code should handle spaces as well. But IMO, the file system should be fine with "insane" code as well, namely quick command-line Bash hacks; those typically are quite a bit more cumbersome to write if you want to be space-safe. — What I'd propose is to use the no-break-space-character (U+a0 " "): that looks fine in a GUI, prevents wrapping at inappropriate places (which makes it easier to copy paths from a GUI text field into a terminal), and is Bash-hack-safe.

                                – leftaroundabout
                                Sep 21 '12 at 8:41
















                              0












                              0








                              0







                              A completely different approach would be to use a temporary file, like



                              terminalA> pwd > /tmp/somepwd

                              terminalB> cp * `cat /tmp/somepwd`





                              share|improve this answer













                              A completely different approach would be to use a temporary file, like



                              terminalA> pwd > /tmp/somepwd

                              terminalB> cp * `cat /tmp/somepwd`






                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Sep 19 '12 at 21:09









                              leftaroundaboutleftaroundabout

                              589313




                              589313








                              • 1





                                This approach won't work if the directory name contains spaces or other characters that have a special meaning to the shell.

                                – Scott Severance
                                Sep 19 '12 at 23:15






                              • 1





                                Yes; however that's easily fixed with adding extra double quotes (cp * "`cat /tmp/somepwd`").

                                – leftaroundabout
                                Sep 20 '12 at 9:22













                              • And, of course, such directory names are a very bad thing to have in the first place anyway, (though in fact Canonical choose to name that infamoous folder Ubuntu One...). At least, they're a problem in the OP's original example, too.

                                – leftaroundabout
                                Sep 20 '12 at 9:35













                              • Having spaces in filenames is hardly a bad idea. In fact, in many cases it's the best way in terms of readability and overall usability. Spaces in filenames never cause problems in sane code, and thanks to features such as tab completion they don't make filenames more difficult to type, either. My personal practice is to use any appropriate character (including spaces, exotic characters that I pull from the character map, etc.) when I expect to use the file/directory in a GUI at least on occasion. If I'm programming, I avoid spaces to comply with conventions.

                                – Scott Severance
                                Sep 21 '12 at 8:30













                              • I like using exotic characters, too – those should never be a problem, everything should be UTF-8 compliant. And you're right: sane code should handle spaces as well. But IMO, the file system should be fine with "insane" code as well, namely quick command-line Bash hacks; those typically are quite a bit more cumbersome to write if you want to be space-safe. — What I'd propose is to use the no-break-space-character (U+a0 " "): that looks fine in a GUI, prevents wrapping at inappropriate places (which makes it easier to copy paths from a GUI text field into a terminal), and is Bash-hack-safe.

                                – leftaroundabout
                                Sep 21 '12 at 8:41
















                              • 1





                                This approach won't work if the directory name contains spaces or other characters that have a special meaning to the shell.

                                – Scott Severance
                                Sep 19 '12 at 23:15






                              • 1





                                Yes; however that's easily fixed with adding extra double quotes (cp * "`cat /tmp/somepwd`").

                                – leftaroundabout
                                Sep 20 '12 at 9:22













                              • And, of course, such directory names are a very bad thing to have in the first place anyway, (though in fact Canonical choose to name that infamoous folder Ubuntu One...). At least, they're a problem in the OP's original example, too.

                                – leftaroundabout
                                Sep 20 '12 at 9:35













                              • Having spaces in filenames is hardly a bad idea. In fact, in many cases it's the best way in terms of readability and overall usability. Spaces in filenames never cause problems in sane code, and thanks to features such as tab completion they don't make filenames more difficult to type, either. My personal practice is to use any appropriate character (including spaces, exotic characters that I pull from the character map, etc.) when I expect to use the file/directory in a GUI at least on occasion. If I'm programming, I avoid spaces to comply with conventions.

                                – Scott Severance
                                Sep 21 '12 at 8:30













                              • I like using exotic characters, too – those should never be a problem, everything should be UTF-8 compliant. And you're right: sane code should handle spaces as well. But IMO, the file system should be fine with "insane" code as well, namely quick command-line Bash hacks; those typically are quite a bit more cumbersome to write if you want to be space-safe. — What I'd propose is to use the no-break-space-character (U+a0 " "): that looks fine in a GUI, prevents wrapping at inappropriate places (which makes it easier to copy paths from a GUI text field into a terminal), and is Bash-hack-safe.

                                – leftaroundabout
                                Sep 21 '12 at 8:41










                              1




                              1





                              This approach won't work if the directory name contains spaces or other characters that have a special meaning to the shell.

                              – Scott Severance
                              Sep 19 '12 at 23:15





                              This approach won't work if the directory name contains spaces or other characters that have a special meaning to the shell.

                              – Scott Severance
                              Sep 19 '12 at 23:15




                              1




                              1





                              Yes; however that's easily fixed with adding extra double quotes (cp * "`cat /tmp/somepwd`").

                              – leftaroundabout
                              Sep 20 '12 at 9:22







                              Yes; however that's easily fixed with adding extra double quotes (cp * "`cat /tmp/somepwd`").

                              – leftaroundabout
                              Sep 20 '12 at 9:22















                              And, of course, such directory names are a very bad thing to have in the first place anyway, (though in fact Canonical choose to name that infamoous folder Ubuntu One...). At least, they're a problem in the OP's original example, too.

                              – leftaroundabout
                              Sep 20 '12 at 9:35







                              And, of course, such directory names are a very bad thing to have in the first place anyway, (though in fact Canonical choose to name that infamoous folder Ubuntu One...). At least, they're a problem in the OP's original example, too.

                              – leftaroundabout
                              Sep 20 '12 at 9:35















                              Having spaces in filenames is hardly a bad idea. In fact, in many cases it's the best way in terms of readability and overall usability. Spaces in filenames never cause problems in sane code, and thanks to features such as tab completion they don't make filenames more difficult to type, either. My personal practice is to use any appropriate character (including spaces, exotic characters that I pull from the character map, etc.) when I expect to use the file/directory in a GUI at least on occasion. If I'm programming, I avoid spaces to comply with conventions.

                              – Scott Severance
                              Sep 21 '12 at 8:30







                              Having spaces in filenames is hardly a bad idea. In fact, in many cases it's the best way in terms of readability and overall usability. Spaces in filenames never cause problems in sane code, and thanks to features such as tab completion they don't make filenames more difficult to type, either. My personal practice is to use any appropriate character (including spaces, exotic characters that I pull from the character map, etc.) when I expect to use the file/directory in a GUI at least on occasion. If I'm programming, I avoid spaces to comply with conventions.

                              – Scott Severance
                              Sep 21 '12 at 8:30















                              I like using exotic characters, too – those should never be a problem, everything should be UTF-8 compliant. And you're right: sane code should handle spaces as well. But IMO, the file system should be fine with "insane" code as well, namely quick command-line Bash hacks; those typically are quite a bit more cumbersome to write if you want to be space-safe. — What I'd propose is to use the no-break-space-character (U+a0 " "): that looks fine in a GUI, prevents wrapping at inappropriate places (which makes it easier to copy paths from a GUI text field into a terminal), and is Bash-hack-safe.

                              – leftaroundabout
                              Sep 21 '12 at 8:41







                              I like using exotic characters, too – those should never be a problem, everything should be UTF-8 compliant. And you're right: sane code should handle spaces as well. But IMO, the file system should be fine with "insane" code as well, namely quick command-line Bash hacks; those typically are quite a bit more cumbersome to write if you want to be space-safe. — What I'd propose is to use the no-break-space-character (U+a0 " "): that looks fine in a GUI, prevents wrapping at inappropriate places (which makes it easier to copy paths from a GUI text field into a terminal), and is Bash-hack-safe.

                              – leftaroundabout
                              Sep 21 '12 at 8:41




















                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Ask Ubuntu!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f190575%2fcopy-terminal-result-from-one-window-to-another%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Why do type traits not work with types in namespace scope?What are POD types in C++?Why can templates only be...

                              Will tsunami waves travel forever if there was no land?Why do tsunami waves begin with the water flowing away...

                              Should I use Docker or LXD?How to cache (more) data on SSD/RAM to avoid spin up?Unable to get Windows File...