Why is it that whenever I visit almost any high profile site it asks me to install something?

These are Unity Webapps:

  Ubuntu webapps are web-hosted sites or apps that are displayed inside an Ubuntu app container. They are true apps that users install, see, launch and use. But their content is provided through URLs.

Webapps create Launcher icons and provide other features to some websites. They used to be simple launchers for Firefox, with some custom options (like "Compose" for GMail). However, they apparently use the Ubuntu Browser (called Oxide) from 14.04 onwards, according to this OMG! Ubuntu article and this Ubuntu Discourse discussion, but do provide more features.


Just look into the qemu-doc.html in /usr/share/doc... and follow the example: -net user,hostfwd=tcp::8834-:8834, . This suppose you are using the most simple network definition: -net nic, ... -net user, .... Even if you do not configure any application in the guest system, in the host system you can immediately see the listen port with e.g. netstat.


Pass value of variabe to the another command

If you stored sink_index as environment variable you could use $ENV{} instead:

export sink_index=$(pactl list short sinks | awk -v index_number=$usb_soundcard_sink '$2==index_number {print $1}')

volume=$(pactl list sinks | perl -000ne 'if(/#$ENV{sink_index}/){/(Volume:.*)/; print "$1\n"}' | sed 's/.*\ \(.*\)%.*/\1/g')


How do I best clone an existing dual boot hhd to a new, larger hhd?

If sda is the old disk and sdb is the new one, then you can use this command

sudo dd if=/dev/sda of=/dev/sdb

That will make sdb a clone of sda, complete with all partitions, boot, and everything. Sdb must be at least as big as sda, otherwise you will loose information. Since you're cloning the disk, that means the partitions will also be identical. You will then use something like gparted to resize the partition and then resize the filesystems. For ext2,3,4 filesystems, you can use resize2fs for that.


How do I add a submenu for all “Advanced Options for ...” in GRUB menu?

you can use grub-customizer GUI tool to create submenus.
With grub customizer opened right-click in one of "Advanced boot option" and select "Create submenu". To move the others to that submenu, right-click in other submenus and select "Move Up".
To get grub-customizer in Ubuntu (19.10 or later) you must do:
sudo apt install grub-customizer

If you are 19.04 or older you must add PPA first.


show limited git diff status in ls, only in git directories

First, in order to create a custom ls, the easiest way is to proceed as follows:

Create a directory $HOME/bin
Add $HOME/bin to your PATH. To do this, open the file ~/.bashrc in your favorite text editor, and add the following line to the end:

export PATH=$HOME/bin:$PATH

Note that it is important that you prepend $HOME/bin to your PATH, so that executables in there will take precedence over other executables with the same name along your PATH (such as, in your case, the ls command)
Create a file $HOME/bin/ls with the contents that I'll post below.
Make it executable: chmod 755 $HOME/bin/ls.
You will probably need to restart your terminal.

Second, your new $HOME/bin/ls should behave like so: It checks if the current directory is a git repository, and

if no, it simply delegates to the normal /bin/ls executable.
if yes, it creates that output you asked for, depending on whether the current folder is the root of the git repository or if it is deeper.

I quickly hacked such a script together for you. It's by no means perfect, but it should be pretty close to what you want, and you can easily work your way from there. :-)

#!/bin/bash

# determine if we're in a git repo, what the root dir is, and assign it to GIT_ROOT, all in one swoop
GIT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)

# if not in git repo, relay to normal ls
if (( $? )); then
  /bin/ls "$@"

# if in git repo, are we in root dir?
elif [ "x$GIT_ROOT" = "x$PWD" ]; then
  # first, normal ls with 1 file per line, also pass along other parameters
  /bin/ls -1 "$@"
  echo
  # a few git stats
  GIT_DIFF=$(git diff --stat | tail -1)
  # any insertions?
  echo $GIT_DIFF | grep insertion >/dev/null
  if (( ! $? )); then
    # bonus points: color in green
    echo -e "\e[0;32m+ $(echo $GIT_DIFF | sed 's/.*, \([[:digit:]]\+\) insertion.*/\1/;') lines\e[0m"
  fi
  # any deletions?
  echo $GIT_DIFF | grep deletion >/dev/null
  if (( ! $? )); then
    # bonus points: color in red
    echo -e "\e[0;31m- $(echo $GIT_DIFF | sed 's/.*, \([[:digit:]]\+\) deletion.*/\1/;') lines\e[0m"
  fi
  # Finally, display last commit message and date
  git log -1 --pretty='Last commit: "%s" (%ad)'

# otherwise, we're depper in a git repo
else
  echo -e "\e[1;34m${PWD##*/}\e[0m"
  IFS=$'\n'
  for file in $(tree -C | tail -n +2 | head -n -2); do
    filename=$(echo $file | cut -d" " -f 2-)
    echo -n $file
    # a few git stats
    GIT_DIFF=$(git diff --stat "$(echo $filename | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g")")
    # any insertions?
    echo $GIT_DIFF | grep insertion >/dev/null
    if (( ! $? )); then
      # bonus points: color in green
      echo -ne " \e[0;32m(+ $(echo $GIT_DIFF | sed 's/.*, \([[:digit:]]\+\) insertion.*/\1/;') lines since last commit)\e[0m"
    fi
    # any deletions?
    echo $GIT_DIFF | grep deletion >/dev/null
    if (( ! $? )); then
      # bonus points: color in red
      echo -ne " \e[0;31m(- $(echo $GIT_DIFF | sed 's/.*, \([[:digit:]]\+\) deletion.*/\1/;') lines since last commit)\e[0m"
    fi
    echo
  done

fi

Demo

Note: output is nicely colored, though clearly this won't show here.

$ ls
app
README.md
run.py
test
test.py

+ 11 lines
- 3 lines
Last commit: "add a new test for deployment" (Fri Nov 21 04:20:37 2014 +0100)
$ cd test/
$ ls
test
├── bla
├── __init__.py
├── test_add_user.py (+ 3 lines since last commit)
└── test_deploy.py


Custom Keyboard Shortcuts Lost After 12.04 to 14.04 Upgrade

I got the same problem today. I wrote a small script to convert the old  keybindings to the new interface.

#!/bin/bash

# Delete old new-style keybindings
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "[]"

gconftool-2 -R /desktop/gnome/keybindings | while read LINE; do
    read BINDINGLINE
    read ACTIONLINE
    read NAMELINE
    NUM="`echo "$LINE" | sed -e 's@^/desktop/gnome/keybindings/custom@@g' -e 's/:$//g'`"
    BINDING="`echo "$BINDINGLINE" | sed 's/^binding = //g'`"
    ACTION="`echo "$ACTIONLINE" | sed 's/^action = //g'`"
    NAME="`echo "$NAMELINE" | sed 's/^name = //g'`"

    gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom$NUM/ name "'$NAME'"
    gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom$NUM/ command "'$ACTION'"
    gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom$NUM/ binding "'$BINDING'"
    CURRENTLIST="`gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings`"
    CURRENTLIST="${CURRENTLIST%]}, '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom$NUM/']"
    gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "${CURRENTLIST/[, /[}"
done


How to associate RDP extension to open remote desktop client on 12.04?

Install Ubuntu Tweak tool

sudo add-apt-repository ppa:tualatrix/ppa
sudo apt-get update
sudo apt-get install ubuntu-tweak

and go to file type manager and add rdp.
I suggest you will use remmina as .rdp's default application

But this solution may not fit your question, because .rdp files taken from Windows are different than what remmina uses. So it may be irrelevant to associate remmina with .rdp.

So you may rename files saved by remmina to .rdp so that you can benefit from associating remmina with .rdp files.
Another solution may force tsclient to work on ubuntu 12.04:

Download the tsclient package and the relevant dependencies from packages.ubuntu.com.

For a typical 64-bit architecture, the following command would install tsclient for you:

sudo dpkg --force-all -i tsclient_0.150-4ubuntu2_amd64.deb

For 32-bit system:

sudo dpkg --force-all -i tsclient_0.150-4ubuntu2_i386.deb`


Automatically add/scan existing cover art in Banshee?

This has been a bug which is now resolved.


gEdit 3

The version of gEdit in Oneiric & above is v3 built using gtk+3 libraries.  The plugin folder locations are slightly different than from gEdit v2.

Every plugin needs at least two files.

One file (pluginname.plugin) is to tell gedit:

where the plugin can be found,
what it's called,
a short description,
who is the author, etc.

This file is in the .desktop format.

The second file is the actual code.

Both of these files need to be placed in either:

the system-wide plugins directory /usr/lib/gedit/plugins/, or
in the user plugins directory, which may have to be manually created - ~/.local/share/gedit/plugins/.

Installing Plugins

First create the plugin folder:

mkdir -p ~/.local/share/gedit/plugins

Now create a .plugin file using gedit N.B. these files have the format:

[Plugin]
Loader=python
Module=examplepy
IAge=3
Name=Example py
Description=A Python plugin example
Authors=Jesse van den Kieboom <jesse@icecrew.nl>
Copyright=Copyright © 2006 Jesse van den Kieboom <jesse@icecrew.nl>
Website=http://www.gedit.org

source

For your v2 plugin you already have a file called project-manager.gedit-plugin so you can rename it:

mv project-manager.gedit-plugin project-manager.plugin

Then edit the plugin file and change the section header to "[Plugin]"

You will now see this in your gedit plugin list.

However for me it threw errors about "import gedit, gtk, gtk.glade".

You need to change the source code to import the gtk+3 variants - called python introspection.

An excellent tutorial for converting from gtk+2 to gtk+3 see

http://python-gtk-3-tutorial.readthedocs.org/en/latest/index.html


Errors information logged by the kernel, troubleshoot a custom-built kernel by /var/log/kern.log

The gvfsd-metadata is provided by package gvfs which is the GNOME Virtual Filesystem.

It should have nothing to do with your kernel, it appears on your logs because it segfaults
and a quick google search shows some (old) bugs.

You can check if the segfault is related to your custom kernel by (temporarily) installing a stock kernel and rebooting your system into it,
then check if the segfaults go away.


Tomcat heap space settings seems not applied

what we are using commonly is put the JAVA_OPTS and CATALINA_OPTS into the /etc/bash.bashrc file at the end. Then every user has access to the OPTS also the tomcat user.

To monitor if your changes are applied you could use the 'ps -AfH | grep tomcat' command, which will display all tomcat processes including their start params.


that's a bit weird because this should be enabled by default..
are you using oracle-jdk or open-jdk on your linux machine?

if pmoffscreen is enabled then your 2d engine uses X11 pixmaps for storing or caching certain types of offscreen images.. This usually speeds up your performance for 'basic' image processing..

however, if you would do stuff like antialiasing, alpha compositing or whatsoever than you should disable pmoffscreen because such things are handled way more efficient by the build in software renderer.

best,
chris


how to list opened nautilus tabs with qdbus?

From this answer, I got to this

gdbus introspect -r --session -o / --only-properties -d org.gnome.Nautilus |grep "OpenLocations ="

easier one

qdbus org.gnome.Nautilus /org/freedesktop/FileManager1 org.freedesktop.FileManager1.OpenLocations

Tho to open tabs in nautilus thru command line, to the date, seem impossible.


Ubuntu 14.04 videos and games running slow

Sounds like an issue with your GPU drivers. Search for 'Additional Drivers' in Unity, and see what comes up. The propiatary drivers, while not GNU, would run a lot better.


Why does my web site have to specify the .php extension in the URI

The difference between 12.04 and 14.04 is in the /etc/mime.types file. In 12.04 the related area is this:

application/x-httpd-php                         phtml pht php
application/x-httpd-php-source                  phps
application/x-httpd-php3                        php3
application/x-httpd-php3-preprocessed           php3p
application/x-httpd-php4                        php4
application/x-httpd-php5                        php5

In 14.04 the related area is this:

#application/x-httpd-php                        phtml pht php
#application/x-httpd-php-source                 phps
#application/x-httpd-php3                       php3
#application/x-httpd-php3-preprocessed          php3p
#application/x-httpd-php4                       php4
#application/x-httpd-php5                       php5

Notice the relevant lines are commented out in the 14.04 case.
Once I uncommented those lines I was able to have .php files load without specifying the .php file extension (after restarting apache, of course).

sudo service apache2 restart


How to get Shutter Edit feature to open images in GIMP?

There are 2 options. Of course, both require shutter and gimp to be installed:
A - How to open every screenshot automatically with GIMP:
Simply open the Shutter window and click in the menu line on Edit --> Preferences (or press Alt+P) or if the Shutter icon already shows up in the panel, click on it and select Preferences from the drop-down menu.
Choose the tab Actions on the left side and you will see a window like in the screenshot below. Here you may switch the application with which you want to perform edits by selecting another one from the list labelled Open with:.

B - How to disable automatic editor opening and open a single screenshot manually with GIMP:

Disable automatic editor launching:
Open Shutter and go to Preferences --> Actions as described in detail in part A of this answer. There, disable the checkbox Open with:. What program is selected in the list is irrelevant, as it will be ignored.

Open a single screenshot with GIMP:
After normally making the screenshot with Shutter, the main window appears (no editor, as we unchecked this in step 1 before). In the menu Screenshot, you navigate to the submenu Open with, where you may chose any recognized image editing application to launch and open the current screenshot.


How can I encrypt the entire disk on alternate installation?

Go to releases.ubuntu.com/11.04 and download the alternate install CD for your architecture.
Burn the .iso to a blank CD.
Reboot with the CD in the drive, and allow the computer to boot from the CD.
On the Ubuntu alternate CD's menu, select "Install":

Follow the installer's instructions until you get to the step entitled "Partition Disks".
Choose "Guided - use entire disk and set up encrypted LVM" from the menu.
Finish the installation by following the instructions on the screen.


Answer to the question

German Truck Simulator works under Wine with a platinum rating. So does Euro Trucks Simulator,  18 Wheels of Steel: Across America, 18 Wheels of Steel: American Long Haul, 18 Wheels of Steel: Convoy, 18 Wheels of Steel: Extreme Trucker and 18 Wheels of Steel: Pedal to the Metal. So you should be able to get these working.

2 of the games do work native under Linux using Steam: Scania Truck Driving Simulator, Euro Truck Simulator 2.

  Extra about Wine

Since all of the games are platinum you do need to fix this problem inside Wine. But it depends alot on the game specific what to do. For instance driconf is used for 3d acceleration.
I would suggest to start with Play on Linux and install it from there; those installation scripts tend to fix alot of problems out of the box.

UPDATE:

Euro Truck Simulator 2 beta for Linux has been in closed beta testing for a few days and today it's available as a non free public beta for all Linux users, exclusively through Steam. More information on webupd8 and SCS software blog.