Ubuntu

Turning off the trackpad while typing

So that you don't accidentally move the cursor while typing.

If this still doesn't work for you, you could add a new file in /usr/share/X11/xorg.conf.d and name it something like 90-libinput-quirks.conf with the following content

Section "InputClass"
        Identifier "libinput touchpad catchall"
        MatchIsTouchpad "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
        Option "DisableWhileTyping" "True"
EndSection

The file name itself is somewhat important, it needs to start with a higher number than the libinput.conf file bundled with Ubuntu 18.04. Mine was named 40-libinput.conf so I named mine 90-libinput-quirks.conf to make sure it was loaded after, and thus overriding/appending, the original config.

Creating a keyboard shortcut for a new tab in the same terminal

In Ubuntu 18, ctrl+alt+t creates a new terminal window.

To create a new tab, a lot of Q&A sites say that ctrl+shift+t will open a new tab. It does not now, as of gnome-terminal 3.28.2.

The command gnome-terminal --tab will create a new tab in the current terminal window, but if you create a custom keyboard shortcut for it in the OS Settings, it will be executed in a context that is not the current terminal window, so you will still get a new window.

The best I can come up with is:

  • Make a tab.sh file containing gnome-terminal --tab in your home directory.
  • chmod u+x tab.sh.
  • ln -s /home/yourusername/tab.sh /usr/local/bin/t

Then, you can type t in the terminal to get a new tab.

You can switch between tabs with alt+[tab number]. I don't know of a quick way to close a tab. Typing exit is the best I can do.

Updating packages on your servers

  • apt-get update (sudo)
  • apt-get upgrade
  • apt-get dist-upgrade
  • ps aux | grep <pattern for processes you care about>
  • Copy process list somewhere
  • reboot
  • Log back in and make sure old processes are still up.
    • Including nginx

Upgrading to a new major version

To upgrade to a new major version do-release-upgrade. Sometimes this will fail because you have apt PPAs that aren't secure. I got around this by removing those with add-apt-repository --remove ppa:whatever/ppa.

Things to look out for:

  • Upgrading a major version may update the version of PHP. If you do that, and your nginx config refers to a socket like fastcgi_pass unix:/run/php/php7.0-fpm.sock, you're going to have to update that socket reference.

Typing special characters

  • You set up a Compose key in Tweaks. Then, you can hit that key, followed by a sequence to type a special characters.
  • ° is: Compose, o, o
  • emdash — is: Compose, -, -, -

Avoiding 4 GB file in /var/log/journal/

https://askubuntu.com/a/1276078/1192709

Set SystemMaxUse=100M in /etc/systemd/journald.conf.

Copying and pasting from the clipboard

The syntax for copying and pasting in the terminal in Linux is a bit much. (Though sadly, I've typed them for years without addressing it.)

Pasting to a file:

xclip -o -selection clipboard > file.txt

Copying from a file:

cat file.txt | xclip -i -selection clipboard

Instead of being like me, you can add these functions to your .zshrc or .bashrc:

cbout() {
  xclip -o -selection clipboard > "$1"
}

cbin() {
  cat "$1" | xclip -i -selection clipboard
}

Then, you can just type cbout file.txt or cbin file.txt.

#bash #clipboard

Mic registering only silence

Go into alsamixer and pump the volume up all the way. That volume is somehow separate from and more important than the volume in Settings.

If that doesn't work, open the Pulse Audio Volume Control (put pavucontrol into the OS search), go to the Input Devices tab, then select Internal Microphone, then move the sliders for Front Left and Front Right to 0 db.

https://askubuntu.com/questions/6993/internal-microphone-not-working

Then, you should be able to adjust the volume again in system Settings.

Typing accents

Use the Compose key, then ', then the letter you want accented. e.g. Compose-'-e for é.

Saving disk space

  • Run dust on /.
  • To keep journal logs from taking up a lot of space (mine were 4 GB), edit /etc/systemd/journald.conf and add SystemMaxUse=500M (or the size you prefer).
  • Go through /var/lib/snapd/snaps and snap list --all. Use snap [snapname] --revision=[revision] on snapshots you don't need anymore.
  • Check out ~/.cache.

Restarting wifi

nmcli radio wifi off && sleep 5 && nmcli radio wifi on

https://askubuntu.com/questions/811733/how-can-i-restart-my-wi-fi-connection-from-the-command-line