Turn Airplane Mode on/off via terminal












6














What is the terminal command to turn Airplane Mode on/off in Ubuntu?



Is it simply sudo rfkill block all and sudo rfkill unblock all? I know that this will disable all wireless modules in the computer, but will this be noticed by the system, so that Airplane Mode is toggled off/on in network settings?










share|improve this question
























  • Try sudo rfkill unblock wifi
    – Mitch
    Sep 21 '13 at 9:57










  • @Mitch Do we really need root privileges to climb in an airplane?
    – Radu Rădeanu
    Sep 21 '13 at 10:54










  • @RaduRădeanu With all the security issues at airports sure :) lol
    – Mitch
    Sep 21 '13 at 11:18
















6














What is the terminal command to turn Airplane Mode on/off in Ubuntu?



Is it simply sudo rfkill block all and sudo rfkill unblock all? I know that this will disable all wireless modules in the computer, but will this be noticed by the system, so that Airplane Mode is toggled off/on in network settings?










share|improve this question
























  • Try sudo rfkill unblock wifi
    – Mitch
    Sep 21 '13 at 9:57










  • @Mitch Do we really need root privileges to climb in an airplane?
    – Radu Rădeanu
    Sep 21 '13 at 10:54










  • @RaduRădeanu With all the security issues at airports sure :) lol
    – Mitch
    Sep 21 '13 at 11:18














6












6








6


1





What is the terminal command to turn Airplane Mode on/off in Ubuntu?



Is it simply sudo rfkill block all and sudo rfkill unblock all? I know that this will disable all wireless modules in the computer, but will this be noticed by the system, so that Airplane Mode is toggled off/on in network settings?










share|improve this question















What is the terminal command to turn Airplane Mode on/off in Ubuntu?



Is it simply sudo rfkill block all and sudo rfkill unblock all? I know that this will disable all wireless modules in the computer, but will this be noticed by the system, so that Airplane Mode is toggled off/on in network settings?







wireless bluetooth






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 1 '13 at 19:47

























asked Sep 21 '13 at 9:42









lindhe

3353722




3353722












  • Try sudo rfkill unblock wifi
    – Mitch
    Sep 21 '13 at 9:57










  • @Mitch Do we really need root privileges to climb in an airplane?
    – Radu Rădeanu
    Sep 21 '13 at 10:54










  • @RaduRădeanu With all the security issues at airports sure :) lol
    – Mitch
    Sep 21 '13 at 11:18


















  • Try sudo rfkill unblock wifi
    – Mitch
    Sep 21 '13 at 9:57










  • @Mitch Do we really need root privileges to climb in an airplane?
    – Radu Rădeanu
    Sep 21 '13 at 10:54










  • @RaduRădeanu With all the security issues at airports sure :) lol
    – Mitch
    Sep 21 '13 at 11:18
















Try sudo rfkill unblock wifi
– Mitch
Sep 21 '13 at 9:57




Try sudo rfkill unblock wifi
– Mitch
Sep 21 '13 at 9:57












@Mitch Do we really need root privileges to climb in an airplane?
– Radu Rădeanu
Sep 21 '13 at 10:54




@Mitch Do we really need root privileges to climb in an airplane?
– Radu Rădeanu
Sep 21 '13 at 10:54












@RaduRădeanu With all the security issues at airports sure :) lol
– Mitch
Sep 21 '13 at 11:18




@RaduRădeanu With all the security issues at airports sure :) lol
– Mitch
Sep 21 '13 at 11:18










2 Answers
2






active

oldest

votes


















6














Running the following command in terminal:



gnome-control-center network


will open a window for network management which should be similar with:



Airplane mode on



You can observe that at this moment the "Airplane Mode" is off and the wireless is on.



Now, without to close this window, run the following command in terminal:



nmcli nm wifi off


The above window will be changed automatically to:



Airplane mode on



As you can see, now "Airplane Mode" is on and the wireless is off.



Running, again in terminal, the following command:



nmcli nm wifi off


will turn "Airplane Mode" off and wireless on again.



So, you don't need rfkill (which need also root privileges) to toggle "Airplane Mode" via terminal.



nmcli (see also man nmcli) it's enough and can be executed by any usual user... You don't need root privileges to climb in an airplane :)).






share|improve this answer





















  • nmcli nm wifi off does not turn off airplane mode unless bluetooth is off.
    – kzh
    Dec 28 '14 at 17:27






  • 1




    For 15.04 it would be: nmcli r all off and nmcli r all on. Or to include bluetooth: rfkill block bluetooth & rfkill block wlan and rfkill unblock bluetooth & rfkill unblock wlan .
    – VRR
    Jul 26 '15 at 12:42










  • For 15.04 (with updates) I found this to work best: alias wifitoggle='nmcli r wifi off ; sleep 1 ; nmcli r wifi on'
    – Alan Thompson
    Oct 20 '15 at 23:51



















1














For Ubuntu 18.04:



nmcli r wifi on turns airplane mode off, and the converse is true.



A simple bash script to toggle airplane mode on or off is below; save it to file and set its execute bit in properties.



#!/bin/bash



wifi="$(nmcli r wifi | awk 'FNR = 2 {print $1}')



if [ "$wifi" == "enabled" ]



then



nmcli r wifi off



else



nmcli r wifi on



fi






share|improve this answer





















    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%2f348262%2fturn-airplane-mode-on-off-via-terminal%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    6














    Running the following command in terminal:



    gnome-control-center network


    will open a window for network management which should be similar with:



    Airplane mode on



    You can observe that at this moment the "Airplane Mode" is off and the wireless is on.



    Now, without to close this window, run the following command in terminal:



    nmcli nm wifi off


    The above window will be changed automatically to:



    Airplane mode on



    As you can see, now "Airplane Mode" is on and the wireless is off.



    Running, again in terminal, the following command:



    nmcli nm wifi off


    will turn "Airplane Mode" off and wireless on again.



    So, you don't need rfkill (which need also root privileges) to toggle "Airplane Mode" via terminal.



    nmcli (see also man nmcli) it's enough and can be executed by any usual user... You don't need root privileges to climb in an airplane :)).






    share|improve this answer





















    • nmcli nm wifi off does not turn off airplane mode unless bluetooth is off.
      – kzh
      Dec 28 '14 at 17:27






    • 1




      For 15.04 it would be: nmcli r all off and nmcli r all on. Or to include bluetooth: rfkill block bluetooth & rfkill block wlan and rfkill unblock bluetooth & rfkill unblock wlan .
      – VRR
      Jul 26 '15 at 12:42










    • For 15.04 (with updates) I found this to work best: alias wifitoggle='nmcli r wifi off ; sleep 1 ; nmcli r wifi on'
      – Alan Thompson
      Oct 20 '15 at 23:51
















    6














    Running the following command in terminal:



    gnome-control-center network


    will open a window for network management which should be similar with:



    Airplane mode on



    You can observe that at this moment the "Airplane Mode" is off and the wireless is on.



    Now, without to close this window, run the following command in terminal:



    nmcli nm wifi off


    The above window will be changed automatically to:



    Airplane mode on



    As you can see, now "Airplane Mode" is on and the wireless is off.



    Running, again in terminal, the following command:



    nmcli nm wifi off


    will turn "Airplane Mode" off and wireless on again.



    So, you don't need rfkill (which need also root privileges) to toggle "Airplane Mode" via terminal.



    nmcli (see also man nmcli) it's enough and can be executed by any usual user... You don't need root privileges to climb in an airplane :)).






    share|improve this answer





















    • nmcli nm wifi off does not turn off airplane mode unless bluetooth is off.
      – kzh
      Dec 28 '14 at 17:27






    • 1




      For 15.04 it would be: nmcli r all off and nmcli r all on. Or to include bluetooth: rfkill block bluetooth & rfkill block wlan and rfkill unblock bluetooth & rfkill unblock wlan .
      – VRR
      Jul 26 '15 at 12:42










    • For 15.04 (with updates) I found this to work best: alias wifitoggle='nmcli r wifi off ; sleep 1 ; nmcli r wifi on'
      – Alan Thompson
      Oct 20 '15 at 23:51














    6












    6








    6






    Running the following command in terminal:



    gnome-control-center network


    will open a window for network management which should be similar with:



    Airplane mode on



    You can observe that at this moment the "Airplane Mode" is off and the wireless is on.



    Now, without to close this window, run the following command in terminal:



    nmcli nm wifi off


    The above window will be changed automatically to:



    Airplane mode on



    As you can see, now "Airplane Mode" is on and the wireless is off.



    Running, again in terminal, the following command:



    nmcli nm wifi off


    will turn "Airplane Mode" off and wireless on again.



    So, you don't need rfkill (which need also root privileges) to toggle "Airplane Mode" via terminal.



    nmcli (see also man nmcli) it's enough and can be executed by any usual user... You don't need root privileges to climb in an airplane :)).






    share|improve this answer












    Running the following command in terminal:



    gnome-control-center network


    will open a window for network management which should be similar with:



    Airplane mode on



    You can observe that at this moment the "Airplane Mode" is off and the wireless is on.



    Now, without to close this window, run the following command in terminal:



    nmcli nm wifi off


    The above window will be changed automatically to:



    Airplane mode on



    As you can see, now "Airplane Mode" is on and the wireless is off.



    Running, again in terminal, the following command:



    nmcli nm wifi off


    will turn "Airplane Mode" off and wireless on again.



    So, you don't need rfkill (which need also root privileges) to toggle "Airplane Mode" via terminal.



    nmcli (see also man nmcli) it's enough and can be executed by any usual user... You don't need root privileges to climb in an airplane :)).







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Sep 21 '13 at 10:51









    Radu Rădeanu

    116k34246322




    116k34246322












    • nmcli nm wifi off does not turn off airplane mode unless bluetooth is off.
      – kzh
      Dec 28 '14 at 17:27






    • 1




      For 15.04 it would be: nmcli r all off and nmcli r all on. Or to include bluetooth: rfkill block bluetooth & rfkill block wlan and rfkill unblock bluetooth & rfkill unblock wlan .
      – VRR
      Jul 26 '15 at 12:42










    • For 15.04 (with updates) I found this to work best: alias wifitoggle='nmcli r wifi off ; sleep 1 ; nmcli r wifi on'
      – Alan Thompson
      Oct 20 '15 at 23:51


















    • nmcli nm wifi off does not turn off airplane mode unless bluetooth is off.
      – kzh
      Dec 28 '14 at 17:27






    • 1




      For 15.04 it would be: nmcli r all off and nmcli r all on. Or to include bluetooth: rfkill block bluetooth & rfkill block wlan and rfkill unblock bluetooth & rfkill unblock wlan .
      – VRR
      Jul 26 '15 at 12:42










    • For 15.04 (with updates) I found this to work best: alias wifitoggle='nmcli r wifi off ; sleep 1 ; nmcli r wifi on'
      – Alan Thompson
      Oct 20 '15 at 23:51
















    nmcli nm wifi off does not turn off airplane mode unless bluetooth is off.
    – kzh
    Dec 28 '14 at 17:27




    nmcli nm wifi off does not turn off airplane mode unless bluetooth is off.
    – kzh
    Dec 28 '14 at 17:27




    1




    1




    For 15.04 it would be: nmcli r all off and nmcli r all on. Or to include bluetooth: rfkill block bluetooth & rfkill block wlan and rfkill unblock bluetooth & rfkill unblock wlan .
    – VRR
    Jul 26 '15 at 12:42




    For 15.04 it would be: nmcli r all off and nmcli r all on. Or to include bluetooth: rfkill block bluetooth & rfkill block wlan and rfkill unblock bluetooth & rfkill unblock wlan .
    – VRR
    Jul 26 '15 at 12:42












    For 15.04 (with updates) I found this to work best: alias wifitoggle='nmcli r wifi off ; sleep 1 ; nmcli r wifi on'
    – Alan Thompson
    Oct 20 '15 at 23:51




    For 15.04 (with updates) I found this to work best: alias wifitoggle='nmcli r wifi off ; sleep 1 ; nmcli r wifi on'
    – Alan Thompson
    Oct 20 '15 at 23:51













    1














    For Ubuntu 18.04:



    nmcli r wifi on turns airplane mode off, and the converse is true.



    A simple bash script to toggle airplane mode on or off is below; save it to file and set its execute bit in properties.



    #!/bin/bash



    wifi="$(nmcli r wifi | awk 'FNR = 2 {print $1}')



    if [ "$wifi" == "enabled" ]



    then



    nmcli r wifi off



    else



    nmcli r wifi on



    fi






    share|improve this answer


























      1














      For Ubuntu 18.04:



      nmcli r wifi on turns airplane mode off, and the converse is true.



      A simple bash script to toggle airplane mode on or off is below; save it to file and set its execute bit in properties.



      #!/bin/bash



      wifi="$(nmcli r wifi | awk 'FNR = 2 {print $1}')



      if [ "$wifi" == "enabled" ]



      then



      nmcli r wifi off



      else



      nmcli r wifi on



      fi






      share|improve this answer
























        1












        1








        1






        For Ubuntu 18.04:



        nmcli r wifi on turns airplane mode off, and the converse is true.



        A simple bash script to toggle airplane mode on or off is below; save it to file and set its execute bit in properties.



        #!/bin/bash



        wifi="$(nmcli r wifi | awk 'FNR = 2 {print $1}')



        if [ "$wifi" == "enabled" ]



        then



        nmcli r wifi off



        else



        nmcli r wifi on



        fi






        share|improve this answer












        For Ubuntu 18.04:



        nmcli r wifi on turns airplane mode off, and the converse is true.



        A simple bash script to toggle airplane mode on or off is below; save it to file and set its execute bit in properties.



        #!/bin/bash



        wifi="$(nmcli r wifi | awk 'FNR = 2 {print $1}')



        if [ "$wifi" == "enabled" ]



        then



        nmcli r wifi off



        else



        nmcli r wifi on



        fi







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 27 '18 at 7:09









        DrMoishe Pippik

        1185




        1185






























            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.





            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%2faskubuntu.com%2fquestions%2f348262%2fturn-airplane-mode-on-off-via-terminal%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

            數位音樂下載

            When can things happen in Etherscan, such as the picture below?

            格利澤436b