Switch video output to another monitor from command line

So, you have two video outputs. The first is DisplayPort (eDP). The actual monitor sits on the second video output, which is HDMI. For some reason your Mate desktop sends all the panels and icons to the first output, where you can’t actually see them. The monitor shows you only pristinely clean desktop wallpaper coming from the second video output.

Solution:

  • Find out what displays your system thinks it has:
    xrandr --listmonitors

    The result will be something like this:

    0: +*eDP-1 1920/508x1080/286+0+0 eDP-1
    1: +HDMI-1 1920/480x1080/270+1920+0 HDMI-1
    
  • Then tell it that the second monitor is the primary one, where you want all your user interface widgets to be:
    xrandr --output HDMI-1 --primary

Make Postfix use /etc/hosts

To make Postfix use /etc/hosts file to find IP address of the SMTP server before it contacts any DNS servers, add two lines to the /etc/postfix/main.cf file:

  • lmtp_host_lookup = native
  • smtp_host_lookup = native

See disk usage from command line

From the command line to see which directories are using most of the space on your disk (root / as an example here):

  • du -h / | grep ‘[0-9\,]\+G’

Install Brave Browser from the latest .deb package

Download the latest available .deb package of Brave Browser for Ubuntu or Mint like this:

  • wget -O brave.deb https://laptop-updates.brave.com/latest/dev/ubuntu64

Then just  double click it in the file manager and do package install.

Though this is not the recommended way to install the browser, it is the simplest one, especially in a situation when you are using the latest release of the OS and there is no Brave release built specifically for it yet.

You can see it mentioned at the page Linux install instructions page.


Turn off line wrap in Linux terminal

To switch off line wrap in Linux terminal (GNOME Terminal) run command:

  • setterm -linewrap off

Unable to uninstall MySQL – broken packages

You mess up your MySQL and attempt to remove it completely, but the command

  • apt-get remove mysql-common

fails with the following output:

  • You might want to run ‘apt-get -f install’ to correct these:
    The following packages have unmet dependencies:
    mysql-client-5.7 : Depends: mysql-common (>= 5.5) but it is not going to be installed
    mysql-server : Depends: mysql-server-5.7 but it is not going to be installed

Whatever you do you are stuck and can’t go around this.

If none of the common suggestions works, try this:

  • cd /var/lib
  • mv mysql mysql-old
  • apt install -f

 

[Source] 

 

 


Leave task running after logging out from SSH

Assume you are logged in to a remote server via SSH and are running a task which takes longer to complete than you want to wait.

The straight-forward option would be to terminate the task and re-run it at a later time, but that is not always an acceptable option.

Instead you can send the active task to background and leave it running even after you log out.

  • Press Ctrl-Z to pause the task
  • Type bg to send it to the background and resume running
  • Type disown to disassociate the process with your SSH login, so that it does not terminate when you log out
  • Type exit to log out

Ref.:[1]


Enabling PostgreSQL server at startup

To have PostgreSQL server start automatically at boot do:

  • sudo systemctl enable postgresql

Fast image viewer for Linux

Meet feh – a fast and minimalist image viewer, suitable for quickly scrolling though your collection of resized photos without annoying jerks and delays.

It can be installed from your package repository.

One way to use it is to open the terminal window in the folder where your images are stored and run command:

  • feh -ZF

Here “Z” stands for zoom, and “F” stands for full screen. So it goes full screen and any images smaller than the screen size will be zoomed up. You can also add “r” parameter to recursively scan all subdirectories.

You can also set delay between slides. Read more about it all:

  • man feh

Which deb package owns the file?

To find out which package the file belongs to in a Debian based system (Ubuntu, Mint, BunsenLabs etc.), you may use apt-file.

Normally this utility is not installed by default, so it goes like this.

Install it:

  • sudo apt-get install apt-file

Make it update its database:

  • apt-file update

Use it on any file, for example:

  • apt-file find /usr/bin/blender