Useful commands

Created: around 2018

Command Description
du -h --max-depth=1 | sort -hr Calculate how big a folder is on disk [req: sudo]
ifconfig Check configuration of available network cards
ifconfig wlo1 up & ifconfig wlo1 down Restart wlo1 network device
invoke-rc apache2 restart Restart apache [req: sudo]
lspci and lsusb List all available hardware
play -n synth brownnoise synth pinknoise Plays pink and brown noise. Requires sox (sudo apt install sox)
xrandr -q
xrandr --output HDMI1 --rotate left
xrandr --output HDMI1 --rotate normal
List which displays are connected to the computer
Rotate image left
Rotate image normal

Website maintenance

  • I installed https certificates from: certbot.eff.org/instructions?ws=apache&os=ubuntufocal
  • To renew certificates I need to run:
    sudo certbot renew --dry-run
  • To modify password protected areas of the website I change:
    /etc/apache2/sites-available/000-default-le-ssl.conf
    then I need to restart Apache:
    sudo service apache2 reload
  • To archive the website I run: cd /var/www zip -r e1z.ca-2024-02-25.zip ./html

Xubuntu highlight the window title of active window

Xfce uses two separte themes to control window appearances. One is done using Gtk (Settings->Appearance) and one is done using Xfwm (Settings->Window Manager). The "Default" Xfwm theme overides the Gtk theme which prevents the changes made in Gtk taking effect.

I use the Kokodi Xfwm theme (Settings->Window Manager) which highlights the currently active window title in blue while keeping the other windows title gray. For more details see here.

Add Google Drive to file manager

GNOME already has a good integration between the local File Managers and Google Drive through "Gnome Online Accounts". For Xfce (Xubuntu) or other desktop environments install gnome center as follows:

sudo apt install gnome-control-center gnome-online-accounts

To start the "Gnome Online Accounts run:

XDG_CURRENT_DESKTOP=GNOME gnome-control-center

And then select "Online Accounts", click Google and add your account credentials.

Once this is done a "Google Drive" folder will appear in the File Manager you use.

Configure terminal prompt

Set terminal prompt to show date and timestamp so that I can easily tell when a command finished.

Modify ~.bashrc by adding the following to the PS1 variables:

PS1='[\u@\h \W] \D{%F %T}\n\$ '

and the terminal prompt will look like:

[joe@my_rig ~] 2018-04-11 23:12:10
$

Display Logs on TTY9 - TTY10

On Ubuntu distros to display logs on tty9-10 add the following to /etc/rc.local

tail -f /var/log/syslog > /dev/tty9 &
tail -f /var/log/auth.log > /dev/tty10 &
tcpdump >/dev/tty11&
#Open top on tty12 - need to declare TERM here because it is undeclared at the stage in the boot process where rc.local is called.
# NOTE: running top on tty12 is a potential security risk
export TERM=linux
sudo openvt -c 12 top &

Mounting files from Synology

Need to mount it as vers 1.0 otherwise it doesn't work.

sudo mount -t cifs -o vers=1.0,user=USER_NAME //REMOTE/FOLDER /LOCAL/FOLDER

Once mounted all the folders and files are set to read only for non-root user. Run:

sudo chmod * 666

in a folder of interest to make the files read and write available.

Windows Linux Subsystem

mount -t drvfs P: /mnt/p