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]

Advertisements

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

Find and replace text in all files in subdirectories

To search for and replace a text in all files in all subdirectories of the current directory:

  • find ./ -type f -exec sed -i -e 's/old-text/new-text/g' {} \;

PrestaShop 404 Not Found

Running PrestaShop you may experience error “404 Not Found” when attempting to connect to the back office.

If running nginx, add the following to your site’s configuration file in sites_enabled:

location /<YOUR_ADMIN_FOLDER>/ {
   if (!-e $request_filename) {
      rewrite ^/.*$ /<YOUR_ADMIN_FOLDER>/index.php last;
      }
   }

Where <YOUR_ADMIN_FOLDER> is your admin directory in Prestashop’s installation path, looking something like “admin563hdsk25”.

If you already see in the configuration file something like this, check if the <YOUR_ADMIN_FOLDER> parameter matches the actual path, as it may be simple leftover from another case.


Apache ignores .htaccess file

If your Apache2 server straight ignores .htaccess files as if they would not be there at all, see if the particular site configuration file has the “AllowOverride All” statement within it’s “Directory” section.

Add the statement and restart/reload the Apache2 server.