Main > Notes > Quick switching from CLI between LAN and WiFi

Quick switching from CLI between LAN and WiFi

02.03.2024 0 comments » Views: 4

Usually, I work on my LAN connection, but to use a printer I need to jump to a Wi-Fi connection. This is needed because the printer is connected to the other network and I can't reach this network from my LAN. I prepared two simple bash scripts and saved it in the directory that included in the environment PATH variable, so I could call these two scripts from anywhere. This post is intended for saving these scripts.

The same actions can be called from the Network Manager, but it requires more steps, like find wifi connection, turning it on, finding a LAN connection, turn it off.

Anyway here are the scripts

Create 2wifi file

with the next content

Create 2lan file

with the next content

If you are on wifi, just execute 2lan, eg

and vice versa - if you are on lan connection just execute 2wifi


If something doesn't make sure that the interface is parsed correctly from your ifconfig output and align the next command accordingly

Author: | Rating: 4/5 | Tags: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

Allowed HTML-tags: <a>, <code>, <i>, <em>, <strong>, <b>, <u>, <strike>