Missing the new community theme Yaru after upgrading from Ubuntu 18.04 to 18.10

I just upgraded from 18.04 to 18.10 yesterday, but to my dismay, the new fancy theme, Yaru, was nowhere to be found. Looked around in Gnome Tweaks to no avail. Turns out some of the theme packages were not properly installed, more specifically the yaru-theme-gtk package. 

Enter the command apt search yaru-* to see installation status of every package containing “yaru-*”. If they are installed they will state [Installed] inside the square brackets, like so:

If they’re not installed, you can simply fix the issue by running sudo apt install yaru-*. Once complete, log out and back in, and the theme files will be available in Gnome Tweaks

Voila! Remember to also set CursorIcons and Sound theme to Yaru in Gnome Tweaks if desired.

List a rough overview for automated ssh login attacks

We all love to read log files, and for Linux I tend to simplify that search process if I know what I’m looking for. As you probably know many daemons and programs  logs to /var/log , but usually I don’t care to specify the file (like syslog or mysql.err etc) so I just do cat on all the files in the log dir.

So here’s a quick gem to list automated ssh attacks to your server:

$ sudo cat /var/log/* | grep BREAK-IN

Output:

Clean unused kernels when boot partition is full

My /boot partition keeps getting full so I must regularly clean it.

Quick instructions:

  • Show current linux kernel used
    uname -r
  • Show all installed kernels
    dpkg --list | grep linux-image
  • Remove old kernels which are no longer in use
    sudo apt-get remove linux-image-xxxx
    (replace xxxx) with the unused version numbers
  • For good measure, clean unused packages
    sudo apt-get autoremove
  • Optional: if the GRUB boot list is full of old kernel entries, update it by running
    sudo update-grub

Check out these articles for more info:

Install SMTP client on Ubuntu server

  1. Install the light-weight SMTP client “ssmtp”
    sudo apt-get update && sudo apt-get install ssmtp

  2. Configure ssmtp (sudo nano /etc/ssmtp/ssmtp.conf) [1] and set correct info for the following lines:
    1. root=
    2. mailhub=
    3. AuthUser=
    4. AuthPass=
    5. hostname=
    6. rewriteDomain=

  3. Make aliases for the local user to correct email address [2]
    sudo nano /etc/ssmtp/revaliases

  4. ssmtp uses the local users Full name from the OS as the email sender, so make sure your name is correct. Change by using command
    sudo chfn -f "John Doe" yourUser

  5. Verify ssmtp works by sending a test mail with command [3]
    ssmtp recipient@example.com

 

[1]: Example config

# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=kek@it-db.com

# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=smtp.it-db.com:587

AuthUser=johndoe
AuthPass=123456
UseTLS=YES
UseSTARTTLS=YES

# Where will the mail seem to come from?
#rewriteDomain=

# The full hostname
#hostname=MyMediaServer.home
hostname=it-db.com

# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
FromLineOverride=YES

 

[2]: Example aliases

# sSMTP aliases
#
# Format: local_account:outgoing_address:mailhub
#
# Example: root:your_login@your.domain:mailhub.your.domain[:port]
# where [:port] is an optional port number that defaults to 25.

kek:noreply@it-db.com

 

[3]: Example ssmtp test

ssmtp recipient@example.com
Subject: Testing ssmtp
enter your body text here
via SMTP server.
^d

 

Linux Cheatsheet

Print lines of code (amount) for all .php files in current directory

find . -name '*.php' | xargs wc -l


Create an alias for bash commands and/or custom functions

Add the alias or function to your bash profile config:
nano ~/.bashrc

Example: Add a shorthand command for ls-lah to simply l:

alias l="ls -lah"

Example: Add a custom function for searching for a string in all files in current directory:

grepfor() {
    grep -rnw './' -e "$1"
}

When done, reload your config file by running:
. ~/.bashrc


Search for string in files

grep -rnw '/path/to/dir/' -e 'stringpattern'


List only files with size above 100 MB

find . -type f -size +100M -exec ls -lh {} \;

This command scans the current dir for files above 100 MB and then executes the ls -lh command for those files. You could also say -size -10M to do the same for files below 10 MB in size.


Clean/format USB drives

sudo fdisk -l
sudo mkdosfs /dev/xxx # (i.e sdb1)
sudo mkdir /media/usb
sudo mount /dev/xxx /media/usb


See uptime and average load

uptime


Change timezone

sudo rm /etc/localtime
sudo ln -s /usr/share/zoneinfo/Europe/Oslo /etc/localtime

Replace Europe/Oslo with your preferred timezone


Remove password for local user (make it passwordless)

sudo passwd --delete username


See current users logged on server

users (usernames only)

or

who(includes extra information like logon time and IP address etc)


Show IP addresses for all local network cards (including local loopback)

ifconfig | grep inet | cut -d: -f2 | cut -d" " -f1

or

ifconfig | grep 'inet addr' | cut -d: -f2 | awk '{print $1}'

If you wish to see the IP address for a specific NIC (network interface card), simply append the name after ifconfig, like ifconfig eth0 | ...


Map network share

$ sudo mkdir /mnt/ShareName
$ sudo mount -t cifs -o username=domain\username,password=pw //server/share /mnt/ShareName


List automated ssh attacks to your server from syslog:

$ sudo cat /var/log/* | grep BREAK-IN


This post will be continually updated with useful commands and other notes for Linux environments

Related posts:

MS Cheatsheet

CRON Cheatsheet

Powershell Snippets