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.

Enable SSL for Apache

If you are configuring SSL site with your Apache2 server and everything seems fine, but the server is  stubbornly refusing HTTPS connections, you may have overlooked enabling the SSL module.

Enable SSL with Apache2:

  • sudo a2enmod ssl

Find disk usage at command line

To find out disk usage by directories, use:

  • ncdu

Add PDF pseudo-printer on Ubuntu

Sure, there already exists an option to print to a file, but sometimes you wish that there was a dedicated virtual printer for producing PDF output.

Try this:

  • apt-get install cups-pdf