What does (arg: n) in the command prompt mean?












8















On Codecademy's Command Line Course, when trying to use the keyboard shortcut Alt+Shift+# (which is supposed to comment the current line) in the command prompt, it switches the prompt from $ to (arg: 3) instead of adding a dash at the beginning of the line. Alt+Shift+@ will make it display (arg: 2) instead, etc.
See the last line in the screenshot below. Before I hit Alt+Shift+# it was just $.



screenshot



The shortcut works fine on my machine.




  1. What is this (arg: n) thing?

  2. What do keyboard shortcuts depend on to work? Keyboard layout? OS distro? Terminal emulator? Default CLI? What?










share|improve this question









New contributor




user331380 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    8















    On Codecademy's Command Line Course, when trying to use the keyboard shortcut Alt+Shift+# (which is supposed to comment the current line) in the command prompt, it switches the prompt from $ to (arg: 3) instead of adding a dash at the beginning of the line. Alt+Shift+@ will make it display (arg: 2) instead, etc.
    See the last line in the screenshot below. Before I hit Alt+Shift+# it was just $.



    screenshot



    The shortcut works fine on my machine.




    1. What is this (arg: n) thing?

    2. What do keyboard shortcuts depend on to work? Keyboard layout? OS distro? Terminal emulator? Default CLI? What?










    share|improve this question









    New contributor




    user331380 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      8












      8








      8


      1






      On Codecademy's Command Line Course, when trying to use the keyboard shortcut Alt+Shift+# (which is supposed to comment the current line) in the command prompt, it switches the prompt from $ to (arg: 3) instead of adding a dash at the beginning of the line. Alt+Shift+@ will make it display (arg: 2) instead, etc.
      See the last line in the screenshot below. Before I hit Alt+Shift+# it was just $.



      screenshot



      The shortcut works fine on my machine.




      1. What is this (arg: n) thing?

      2. What do keyboard shortcuts depend on to work? Keyboard layout? OS distro? Terminal emulator? Default CLI? What?










      share|improve this question









      New contributor




      user331380 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      On Codecademy's Command Line Course, when trying to use the keyboard shortcut Alt+Shift+# (which is supposed to comment the current line) in the command prompt, it switches the prompt from $ to (arg: 3) instead of adding a dash at the beginning of the line. Alt+Shift+@ will make it display (arg: 2) instead, etc.
      See the last line in the screenshot below. Before I hit Alt+Shift+# it was just $.



      screenshot



      The shortcut works fine on my machine.




      1. What is this (arg: n) thing?

      2. What do keyboard shortcuts depend on to work? Keyboard layout? OS distro? Terminal emulator? Default CLI? What?







      keyboard-shortcuts block-comment






      share|improve this question









      New contributor




      user331380 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      user331380 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 19 hours ago







      user331380













      New contributor




      user331380 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 19 hours ago









      user331380user331380

      434




      434




      New contributor




      user331380 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      user331380 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      user331380 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          1 Answer
          1






          active

          oldest

          votes


















          13














          This is the readline library’s prompt when you’re inputting a numeric argument. By typing AltShift@ on your keyboard, you’re apparently entering Alt2 which maps to M-2, which runs digit-argument in readline by default, and starts entering a numeric argument. If you then press Alt3 (which AltShift# maps to in your case) you’ll see the prompt change to (arg: 23); you can continue with any Alt-digit combination.



          These arguments are used for certain readline functions, for example yank-nth-arg. To see this in action, run



          echo Hello my friend


          then press Alt2 followed by CtrlAltY; you’ll see the (arg: 2) prompt appear, then disappear, and the second argument of the previous command (“my”) will be appended to your current command line.



          See the linked documentation above for details. Bash uses readline to handle its input; other shells won’t show the same behaviour.



          Some terminal emulators use some of these key combinations for their own purposes; for example in GNOME Terminal, Alt-digit switches to the nth tab. You’ll need to disable these combinations to use the readline functions.



          In your case, the Codecademy web-based terminal emulator doesn’t seem to handle AltShift combinations very well. If you don’t need the numeric argument shortcuts, you can repurpose them by running



          bind Meta-3:insert-comment


          In theory you should be able to store this permanently by adding



          Meta-3: insert-comment


          to an ~/.inputrc file, but I couldn’t get that to work on Codecademy.






          share|improve this answer





















          • 1





            Thank you. How do I disable readline or otherwise just use a keyboard shortcut to comment the current command line?

            – user331380
            18 hours ago











          • What terminal emulator are you using?

            – Stephen Kitt
            18 hours ago











          • I want to know how to do it on Codecademy, I don't have a way to right-click and find out. ps -o 'cmd=' -p $(ps -o 'ppid=' -p $$) outputs /usr/local/bin/ein -service-port 4006 -http-port 4007. Does this help?

            – user331380
            17 hours ago






          • 1





            @user331380 Likely you are using bash shell on Codeacademy there. In interactive shell, you could start a new instance with bash --noediting. That will disable readline, but keep in mind that readline library is responsible for a lot of line editing features, which may make interactive use of shell slightly more uncomfortable

            – Sergiy Kolodyazhnyy
            11 hours ago











          • Might be worth mentioning that it also happens on vi-keybindings when you simply type the number in normal-mode to represent the numeric argument to the next normal-mode command you type.

            – JoL
            10 hours ago













          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "106"
          };
          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: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          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
          });


          }
          });






          user331380 is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f494378%2fwhat-does-arg-n-in-the-command-prompt-mean%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          13














          This is the readline library’s prompt when you’re inputting a numeric argument. By typing AltShift@ on your keyboard, you’re apparently entering Alt2 which maps to M-2, which runs digit-argument in readline by default, and starts entering a numeric argument. If you then press Alt3 (which AltShift# maps to in your case) you’ll see the prompt change to (arg: 23); you can continue with any Alt-digit combination.



          These arguments are used for certain readline functions, for example yank-nth-arg. To see this in action, run



          echo Hello my friend


          then press Alt2 followed by CtrlAltY; you’ll see the (arg: 2) prompt appear, then disappear, and the second argument of the previous command (“my”) will be appended to your current command line.



          See the linked documentation above for details. Bash uses readline to handle its input; other shells won’t show the same behaviour.



          Some terminal emulators use some of these key combinations for their own purposes; for example in GNOME Terminal, Alt-digit switches to the nth tab. You’ll need to disable these combinations to use the readline functions.



          In your case, the Codecademy web-based terminal emulator doesn’t seem to handle AltShift combinations very well. If you don’t need the numeric argument shortcuts, you can repurpose them by running



          bind Meta-3:insert-comment


          In theory you should be able to store this permanently by adding



          Meta-3: insert-comment


          to an ~/.inputrc file, but I couldn’t get that to work on Codecademy.






          share|improve this answer





















          • 1





            Thank you. How do I disable readline or otherwise just use a keyboard shortcut to comment the current command line?

            – user331380
            18 hours ago











          • What terminal emulator are you using?

            – Stephen Kitt
            18 hours ago











          • I want to know how to do it on Codecademy, I don't have a way to right-click and find out. ps -o 'cmd=' -p $(ps -o 'ppid=' -p $$) outputs /usr/local/bin/ein -service-port 4006 -http-port 4007. Does this help?

            – user331380
            17 hours ago






          • 1





            @user331380 Likely you are using bash shell on Codeacademy there. In interactive shell, you could start a new instance with bash --noediting. That will disable readline, but keep in mind that readline library is responsible for a lot of line editing features, which may make interactive use of shell slightly more uncomfortable

            – Sergiy Kolodyazhnyy
            11 hours ago











          • Might be worth mentioning that it also happens on vi-keybindings when you simply type the number in normal-mode to represent the numeric argument to the next normal-mode command you type.

            – JoL
            10 hours ago


















          13














          This is the readline library’s prompt when you’re inputting a numeric argument. By typing AltShift@ on your keyboard, you’re apparently entering Alt2 which maps to M-2, which runs digit-argument in readline by default, and starts entering a numeric argument. If you then press Alt3 (which AltShift# maps to in your case) you’ll see the prompt change to (arg: 23); you can continue with any Alt-digit combination.



          These arguments are used for certain readline functions, for example yank-nth-arg. To see this in action, run



          echo Hello my friend


          then press Alt2 followed by CtrlAltY; you’ll see the (arg: 2) prompt appear, then disappear, and the second argument of the previous command (“my”) will be appended to your current command line.



          See the linked documentation above for details. Bash uses readline to handle its input; other shells won’t show the same behaviour.



          Some terminal emulators use some of these key combinations for their own purposes; for example in GNOME Terminal, Alt-digit switches to the nth tab. You’ll need to disable these combinations to use the readline functions.



          In your case, the Codecademy web-based terminal emulator doesn’t seem to handle AltShift combinations very well. If you don’t need the numeric argument shortcuts, you can repurpose them by running



          bind Meta-3:insert-comment


          In theory you should be able to store this permanently by adding



          Meta-3: insert-comment


          to an ~/.inputrc file, but I couldn’t get that to work on Codecademy.






          share|improve this answer





















          • 1





            Thank you. How do I disable readline or otherwise just use a keyboard shortcut to comment the current command line?

            – user331380
            18 hours ago











          • What terminal emulator are you using?

            – Stephen Kitt
            18 hours ago











          • I want to know how to do it on Codecademy, I don't have a way to right-click and find out. ps -o 'cmd=' -p $(ps -o 'ppid=' -p $$) outputs /usr/local/bin/ein -service-port 4006 -http-port 4007. Does this help?

            – user331380
            17 hours ago






          • 1





            @user331380 Likely you are using bash shell on Codeacademy there. In interactive shell, you could start a new instance with bash --noediting. That will disable readline, but keep in mind that readline library is responsible for a lot of line editing features, which may make interactive use of shell slightly more uncomfortable

            – Sergiy Kolodyazhnyy
            11 hours ago











          • Might be worth mentioning that it also happens on vi-keybindings when you simply type the number in normal-mode to represent the numeric argument to the next normal-mode command you type.

            – JoL
            10 hours ago
















          13












          13








          13







          This is the readline library’s prompt when you’re inputting a numeric argument. By typing AltShift@ on your keyboard, you’re apparently entering Alt2 which maps to M-2, which runs digit-argument in readline by default, and starts entering a numeric argument. If you then press Alt3 (which AltShift# maps to in your case) you’ll see the prompt change to (arg: 23); you can continue with any Alt-digit combination.



          These arguments are used for certain readline functions, for example yank-nth-arg. To see this in action, run



          echo Hello my friend


          then press Alt2 followed by CtrlAltY; you’ll see the (arg: 2) prompt appear, then disappear, and the second argument of the previous command (“my”) will be appended to your current command line.



          See the linked documentation above for details. Bash uses readline to handle its input; other shells won’t show the same behaviour.



          Some terminal emulators use some of these key combinations for their own purposes; for example in GNOME Terminal, Alt-digit switches to the nth tab. You’ll need to disable these combinations to use the readline functions.



          In your case, the Codecademy web-based terminal emulator doesn’t seem to handle AltShift combinations very well. If you don’t need the numeric argument shortcuts, you can repurpose them by running



          bind Meta-3:insert-comment


          In theory you should be able to store this permanently by adding



          Meta-3: insert-comment


          to an ~/.inputrc file, but I couldn’t get that to work on Codecademy.






          share|improve this answer















          This is the readline library’s prompt when you’re inputting a numeric argument. By typing AltShift@ on your keyboard, you’re apparently entering Alt2 which maps to M-2, which runs digit-argument in readline by default, and starts entering a numeric argument. If you then press Alt3 (which AltShift# maps to in your case) you’ll see the prompt change to (arg: 23); you can continue with any Alt-digit combination.



          These arguments are used for certain readline functions, for example yank-nth-arg. To see this in action, run



          echo Hello my friend


          then press Alt2 followed by CtrlAltY; you’ll see the (arg: 2) prompt appear, then disappear, and the second argument of the previous command (“my”) will be appended to your current command line.



          See the linked documentation above for details. Bash uses readline to handle its input; other shells won’t show the same behaviour.



          Some terminal emulators use some of these key combinations for their own purposes; for example in GNOME Terminal, Alt-digit switches to the nth tab. You’ll need to disable these combinations to use the readline functions.



          In your case, the Codecademy web-based terminal emulator doesn’t seem to handle AltShift combinations very well. If you don’t need the numeric argument shortcuts, you can repurpose them by running



          bind Meta-3:insert-comment


          In theory you should be able to store this permanently by adding



          Meta-3: insert-comment


          to an ~/.inputrc file, but I couldn’t get that to work on Codecademy.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 17 hours ago

























          answered 18 hours ago









          Stephen KittStephen Kitt

          166k24371451




          166k24371451








          • 1





            Thank you. How do I disable readline or otherwise just use a keyboard shortcut to comment the current command line?

            – user331380
            18 hours ago











          • What terminal emulator are you using?

            – Stephen Kitt
            18 hours ago











          • I want to know how to do it on Codecademy, I don't have a way to right-click and find out. ps -o 'cmd=' -p $(ps -o 'ppid=' -p $$) outputs /usr/local/bin/ein -service-port 4006 -http-port 4007. Does this help?

            – user331380
            17 hours ago






          • 1





            @user331380 Likely you are using bash shell on Codeacademy there. In interactive shell, you could start a new instance with bash --noediting. That will disable readline, but keep in mind that readline library is responsible for a lot of line editing features, which may make interactive use of shell slightly more uncomfortable

            – Sergiy Kolodyazhnyy
            11 hours ago











          • Might be worth mentioning that it also happens on vi-keybindings when you simply type the number in normal-mode to represent the numeric argument to the next normal-mode command you type.

            – JoL
            10 hours ago
















          • 1





            Thank you. How do I disable readline or otherwise just use a keyboard shortcut to comment the current command line?

            – user331380
            18 hours ago











          • What terminal emulator are you using?

            – Stephen Kitt
            18 hours ago











          • I want to know how to do it on Codecademy, I don't have a way to right-click and find out. ps -o 'cmd=' -p $(ps -o 'ppid=' -p $$) outputs /usr/local/bin/ein -service-port 4006 -http-port 4007. Does this help?

            – user331380
            17 hours ago






          • 1





            @user331380 Likely you are using bash shell on Codeacademy there. In interactive shell, you could start a new instance with bash --noediting. That will disable readline, but keep in mind that readline library is responsible for a lot of line editing features, which may make interactive use of shell slightly more uncomfortable

            – Sergiy Kolodyazhnyy
            11 hours ago











          • Might be worth mentioning that it also happens on vi-keybindings when you simply type the number in normal-mode to represent the numeric argument to the next normal-mode command you type.

            – JoL
            10 hours ago










          1




          1





          Thank you. How do I disable readline or otherwise just use a keyboard shortcut to comment the current command line?

          – user331380
          18 hours ago





          Thank you. How do I disable readline or otherwise just use a keyboard shortcut to comment the current command line?

          – user331380
          18 hours ago













          What terminal emulator are you using?

          – Stephen Kitt
          18 hours ago





          What terminal emulator are you using?

          – Stephen Kitt
          18 hours ago













          I want to know how to do it on Codecademy, I don't have a way to right-click and find out. ps -o 'cmd=' -p $(ps -o 'ppid=' -p $$) outputs /usr/local/bin/ein -service-port 4006 -http-port 4007. Does this help?

          – user331380
          17 hours ago





          I want to know how to do it on Codecademy, I don't have a way to right-click and find out. ps -o 'cmd=' -p $(ps -o 'ppid=' -p $$) outputs /usr/local/bin/ein -service-port 4006 -http-port 4007. Does this help?

          – user331380
          17 hours ago




          1




          1





          @user331380 Likely you are using bash shell on Codeacademy there. In interactive shell, you could start a new instance with bash --noediting. That will disable readline, but keep in mind that readline library is responsible for a lot of line editing features, which may make interactive use of shell slightly more uncomfortable

          – Sergiy Kolodyazhnyy
          11 hours ago





          @user331380 Likely you are using bash shell on Codeacademy there. In interactive shell, you could start a new instance with bash --noediting. That will disable readline, but keep in mind that readline library is responsible for a lot of line editing features, which may make interactive use of shell slightly more uncomfortable

          – Sergiy Kolodyazhnyy
          11 hours ago













          Might be worth mentioning that it also happens on vi-keybindings when you simply type the number in normal-mode to represent the numeric argument to the next normal-mode command you type.

          – JoL
          10 hours ago







          Might be worth mentioning that it also happens on vi-keybindings when you simply type the number in normal-mode to represent the numeric argument to the next normal-mode command you type.

          – JoL
          10 hours ago












          user331380 is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          user331380 is a new contributor. Be nice, and check out our Code of Conduct.













          user331380 is a new contributor. Be nice, and check out our Code of Conduct.












          user331380 is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • 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%2funix.stackexchange.com%2fquestions%2f494378%2fwhat-does-arg-n-in-the-command-prompt-mean%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

          Сан-Квентин

          8-я гвардейская общевойсковая армия

          Алькесар