What is the difference between iptables -S and iptables -L











up vote
0
down vote

favorite












The help information doesn't seem to be very informative:



--list    -L [chain [rulenum]]
List the rules in a chain or all chains
--list-rules -S [chain [rulenum]]
Print the rules in a chain or all chains


The only difference is in the choice of word: "list" vs. "print".



THe manual is a bit more detailed but still doesn't help:



   -L, --list [chain]
List all rules in the selected chain. If no chain is selected, all chains are listed. Like every other iptables command, it applies to the specified table (filter is the default), so NAT
rules get listed by
iptables -t nat -n -L
Please note that it is often used with the -n option, in order to avoid long reverse DNS lookups. It is legal to specify the -Z (zero) option as well, in which case the chain(s) will be atom‐
ically listed and zeroed. The exact output is affected by the other arguments given. The exact rules are suppressed until you use
iptables -L -v

-S, --list-rules [chain]
Print all rules in the selected chain. If no chain is selected, all chains are printed like iptables-save. Like every other iptables command, it applies to the specified table (filter is the
default).


Seems to me that -S is actually more detailed and printed out the exact ports that I allowed with a --dports argument. But why is that the case? I don't think the word "print" automatically suggests a higher level of details than "list"?










share|improve this question


























    up vote
    0
    down vote

    favorite












    The help information doesn't seem to be very informative:



    --list    -L [chain [rulenum]]
    List the rules in a chain or all chains
    --list-rules -S [chain [rulenum]]
    Print the rules in a chain or all chains


    The only difference is in the choice of word: "list" vs. "print".



    THe manual is a bit more detailed but still doesn't help:



       -L, --list [chain]
    List all rules in the selected chain. If no chain is selected, all chains are listed. Like every other iptables command, it applies to the specified table (filter is the default), so NAT
    rules get listed by
    iptables -t nat -n -L
    Please note that it is often used with the -n option, in order to avoid long reverse DNS lookups. It is legal to specify the -Z (zero) option as well, in which case the chain(s) will be atom‐
    ically listed and zeroed. The exact output is affected by the other arguments given. The exact rules are suppressed until you use
    iptables -L -v

    -S, --list-rules [chain]
    Print all rules in the selected chain. If no chain is selected, all chains are printed like iptables-save. Like every other iptables command, it applies to the specified table (filter is the
    default).


    Seems to me that -S is actually more detailed and printed out the exact ports that I allowed with a --dports argument. But why is that the case? I don't think the word "print" automatically suggests a higher level of details than "list"?










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      The help information doesn't seem to be very informative:



      --list    -L [chain [rulenum]]
      List the rules in a chain or all chains
      --list-rules -S [chain [rulenum]]
      Print the rules in a chain or all chains


      The only difference is in the choice of word: "list" vs. "print".



      THe manual is a bit more detailed but still doesn't help:



         -L, --list [chain]
      List all rules in the selected chain. If no chain is selected, all chains are listed. Like every other iptables command, it applies to the specified table (filter is the default), so NAT
      rules get listed by
      iptables -t nat -n -L
      Please note that it is often used with the -n option, in order to avoid long reverse DNS lookups. It is legal to specify the -Z (zero) option as well, in which case the chain(s) will be atom‐
      ically listed and zeroed. The exact output is affected by the other arguments given. The exact rules are suppressed until you use
      iptables -L -v

      -S, --list-rules [chain]
      Print all rules in the selected chain. If no chain is selected, all chains are printed like iptables-save. Like every other iptables command, it applies to the specified table (filter is the
      default).


      Seems to me that -S is actually more detailed and printed out the exact ports that I allowed with a --dports argument. But why is that the case? I don't think the word "print" automatically suggests a higher level of details than "list"?










      share|improve this question













      The help information doesn't seem to be very informative:



      --list    -L [chain [rulenum]]
      List the rules in a chain or all chains
      --list-rules -S [chain [rulenum]]
      Print the rules in a chain or all chains


      The only difference is in the choice of word: "list" vs. "print".



      THe manual is a bit more detailed but still doesn't help:



         -L, --list [chain]
      List all rules in the selected chain. If no chain is selected, all chains are listed. Like every other iptables command, it applies to the specified table (filter is the default), so NAT
      rules get listed by
      iptables -t nat -n -L
      Please note that it is often used with the -n option, in order to avoid long reverse DNS lookups. It is legal to specify the -Z (zero) option as well, in which case the chain(s) will be atom‐
      ically listed and zeroed. The exact output is affected by the other arguments given. The exact rules are suppressed until you use
      iptables -L -v

      -S, --list-rules [chain]
      Print all rules in the selected chain. If no chain is selected, all chains are printed like iptables-save. Like every other iptables command, it applies to the specified table (filter is the
      default).


      Seems to me that -S is actually more detailed and printed out the exact ports that I allowed with a --dports argument. But why is that the case? I don't think the word "print" automatically suggests a higher level of details than "list"?







      networking iptables firewall






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 2 days ago









      xji

      322110




      322110






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          4
          down vote



          accepted










          The difference is the output format. The -S option produces in the the fashion of iptables-save. And this can be reused with iptables-apply,iptables-restore. (Check their man pages entries for details.) So you can think of the difference as:





          • -L is for reference, to get a clue of what's there


          • -S is for reusable output, which is for machine parsing


          If you think the -S option gives more details, then you should learn other iptables parameters that provide more details in combination with -L.






          share|improve this answer





















            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',
            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
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f486932%2fwhat-is-the-difference-between-iptables-s-and-iptables-l%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








            up vote
            4
            down vote



            accepted










            The difference is the output format. The -S option produces in the the fashion of iptables-save. And this can be reused with iptables-apply,iptables-restore. (Check their man pages entries for details.) So you can think of the difference as:





            • -L is for reference, to get a clue of what's there


            • -S is for reusable output, which is for machine parsing


            If you think the -S option gives more details, then you should learn other iptables parameters that provide more details in combination with -L.






            share|improve this answer

























              up vote
              4
              down vote



              accepted










              The difference is the output format. The -S option produces in the the fashion of iptables-save. And this can be reused with iptables-apply,iptables-restore. (Check their man pages entries for details.) So you can think of the difference as:





              • -L is for reference, to get a clue of what's there


              • -S is for reusable output, which is for machine parsing


              If you think the -S option gives more details, then you should learn other iptables parameters that provide more details in combination with -L.






              share|improve this answer























                up vote
                4
                down vote



                accepted







                up vote
                4
                down vote



                accepted






                The difference is the output format. The -S option produces in the the fashion of iptables-save. And this can be reused with iptables-apply,iptables-restore. (Check their man pages entries for details.) So you can think of the difference as:





                • -L is for reference, to get a clue of what's there


                • -S is for reusable output, which is for machine parsing


                If you think the -S option gives more details, then you should learn other iptables parameters that provide more details in combination with -L.






                share|improve this answer












                The difference is the output format. The -S option produces in the the fashion of iptables-save. And this can be reused with iptables-apply,iptables-restore. (Check their man pages entries for details.) So you can think of the difference as:





                • -L is for reference, to get a clue of what's there


                • -S is for reusable output, which is for machine parsing


                If you think the -S option gives more details, then you should learn other iptables parameters that provide more details in combination with -L.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 2 days ago









                Tomasz

                9,13052964




                9,13052964






























                    draft saved

                    draft discarded




















































                    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.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • 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%2f486932%2fwhat-is-the-difference-between-iptables-s-and-iptables-l%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

                    サソリ

                    広島県道265号伴広島線

                    Setup Asymptote in Texstudio