Basic kit survival guide when you have no GUI on Linux
I took bare Xmonad for a spin, quickly I realized I have no graphical apps installed for do most of the things I needed to do, so here is a quick cheat sheet for those moments of despair.
How to get date and time from the command line?
I had no visible clock, so use this to get the time (and date):
$ date
Wed 14 Apr 2021 08:43:54 PM CDT
How to setup WiFi from the command line?
Ok, missed that webinar, too bad, at least my internet is fixed, but wait, it’s a new WiFi π€, need to set it up, let’s see what’s available:
$ nmcli device wifi list
IN-USE BSSID SSID MODE CHAN RATE SIGNAL BARS SECURITY
X4:0B:YC:98:ED:BB GutierFi-D0 Infra 1 270 Mbit/s 100 ββββ WPA1 WPA2
X4:0B:YC:98:ED:BB GutierFi-D0-5G Infra 128 405 Mbit/s 100 ββββ WPA1 WPA2
XC:12:Y5:DD:E3:22 IZZI-FC10 Infra 6 405 Mbit/s 47 ββ__ WPA2
XC:A2:Y6:A6:E7:22 UbeeD79A-2.4G Infra 1 195 Mbit/s 35 ββ__ WPA1 WPA2
X8:47:Y2:60:EA:77 UbeeD79A-5G_2.4GEXT Infra 2 270 Mbit/s 35 ββ__ WPA2
X8:97:YD:87:EF:77 IZZI-2D6E Infra 6 405 Mbit/s 24 β___ WPA2
XC:EB:Y6:FA:EC:BB INFINITUMBFA2_2.4 Infra 9 130 Mbit/s 24 β___ WPA2
X4:98:Y3:50:E6:88 IZZI-5A2F Infra 6 405 Mbit/s 20 β___ WPA2
Great, I think is easy to spot which one is mine, let’s set it up:
$ nmcli device wifi connect GutierFi-D0-5G password T0PS3CRETy0uN3verGues5
Device 'wlp8s11g8' successfully activated with 'a4b6738c-49fa-8df5-c756-a373baca54e9'.
$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=108 time=65.1 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=108 time=75.1 ms
Donzo Alonzo.
How to setup Bluetooth device from the terminal?
Now let me do a call, I just need these Bluetooth speakers set up some how:
$ bluetoothctl
Agent registered
[CHG] Controller 10:AA:FF:BF:99:30 Pairable: yes
We should see a prompt open and if you don’t see Agent registered
then try entering agent on
on it, then start scanning:
> scan on
Discovery started
[CHG] Controller 84:5D:AE:EF:76:11 Discovering: yes
[CHG] Device 10:E8:B8:10:D3:87 RSSI: -76
[CHG] Device 10:E8:B8:10:D3:87 TxPower: 4
Let it marinate for a while, and then turn it off:
> scan off
Discovery stoped
[CHG] Controller 84:5D:AE:EF:76:11 Discovering: yes
[CHG] Device 10:E8:B8:10:D3:87 RSSI: -76
[CHG] Device 10:E8:B8:10:D3:87 TxPower: 4
Nice, my device must be from Tennessee, because that’s the only ten I see, good luck guessing in case you have multiple devices, mine was easy, let’s pair it:
> trust 10:E8:B8:10:D3:87
Changing 10:E8:B8:10:D3:87 trust succeeded
> pair 10:E8:B8:10:D3:87
Attempting to pair with 10:E8:B8:10:D3:87
Failed to pair: org.bluez.Error.AlreadyExists # Previously I've paired it in my case
> connect 10:E8:B8:10:D3:87
Attempting to connect to 10:E8:B8:10:D3:87
[CHG] Device 10:E8:B8:10:D3:87 Connected: yes
Connection successful
[CHG] Device 10:E8:B8:10:D3:87 ServicesResolved: yes
> exit
Nice, the light has stopped blinking.
How to configure audio input/output from the terminal?
Let’s jump into that call, I hook up this USB microphone but how do I switch to it? The answer is pulseaudio
, we can query sources
(devices for audio IN) and sinks
(devices for audio OUT):
$ pactl list short sources
0 alsa_output.pci-0000_00_1f.3.analog-stereo.monitor module-alsa-card.c s16le 2ch 48000Hz SUSPENDED
3 alsa_output.usb-RODE_Microphones_RODE_NT-USB-00.iec958-stereo.monitor module-alsa-card.c s16le 2ch 44100Hz SUSPENDED
4 alsa_input.usb-RODE_Microphones_RODE_NT-USB-00.analog-stereo module-alsa-card.c s16le 2ch 44100Hz SUSPENDED
Why the hell a mic appears as output? let’s not pick that and choose the one with input instead using pacmd
:
$ pacmd set-default-source alsa_input.usb-RODE_Microphones_RODE_NT-USB-00.analog-stereo
$ pactl list short sources
0 alsa_output.pci-0000_00_1f.3.analog-stereo.monitor module-alsa-card.c s16le 2ch 48000Hz IDLE
3 alsa_output.usb-RODE_Microphones_RODE_NT-USB-00.iec958-stereo.monitor module-alsa-card.c s16le 2ch 44100Hz SUSPENDED
4 alsa_input.usb-RODE_Microphones_RODE_NT-USB-00.analog-stereo module-alsa-card.c s16le 2ch 48000Hz RUNNING
If you want to change the output device then look for sinks
:
$ pactl list short sinks
0 alsa_output.pci-0000_00_1f.3.analog-stereo module-alsa-card.c s16le 2ch 48000Hz RUNNING
3 alsa_output.usb-RODE_Microphones_RODE_NT-USB-00.iec958-stereo module-alsa-card.c s16le 2ch 44100Hz SUSPENDED
I will not set my microphone as an output device, but if you have an extra device you can try pacmd set-default-sink <device>
.
How to suspend, shutdown or restart the computer from the command line?
We can use systemctl
for all of that:
$ systemctl suspend # Suspend the system
$ systemctl poweroff # Shutdown the system
$ systemctl reboot # Restart the system
Have fun!