I recently got a Raspberry Pi 4B (8 GB). I played a bit with it and decided to have two boot devices for it: a SD card that carries Raspbian OS - the officially supported OS by the makers of the awesome device and the other one is Ubuntu Linux (Jammy Jellyfish or 22.04 release to be precise).
I did a little bit of tinkering with the GPIO pins but during a day when I am mostly engrossed with office work, I wasn’t finding much time to work on anything related to hardware. So I was ending up using Ubuntu most of the time (which booted off a SSD connected to the Pi via USB).
After some fun usages, I decided to hook it up to the router as a local file server. Once I did that, I realised that I could actually switch off the GUI and WiFi. The Pi was having two IP addresses, one for ethernet and another for WiFi and I did not want the two interfaces working together to cause transfer problems.
Disable GUI
To disable the GUI, we can run:
sudo systemctl set-default multi-user
and reboot. If you want to enable it back:
sudo systemctl set-default graphical
and reboot.
Disable WiFi
To disable the WiFi though, I got a few suggestions and most did not work. An answer on stackoverflow for Ubuntu 16.04 worked. The command to disable WiFi is:
sudo nmcli radio wifi off
And to switch it back on:
sudo nmcli radio wifi on
These commands work on non-raspberry-pi versions of Ubuntu (ARM as well as AMD64 architecture) as well. As you can guess, it would also work for Ubuntu releases between 16.04 and 22.04 as well!