Script to merge Video and subs then delete the existing files (non recursive)

I've decided to gain some experience with Bash and wrote the below script, that has next features:

It can handle all files and folders, placed into the current directory.
If there are more than one subtitle or video file (except sample files), the script will ask for manual interaction.
In all other cases the script will automatically move all files and folders into a backup directory (be careful where you run it!) , that will be moved into the user's trash folder, instead of to be deleted.
It can handle several types of video and subtitle extensions.
It uses mkvmerge to merge video with subtitle files also uses notify-send to show some messages in GUI. Also it uses gvfs-trash to move files in user's trash folder.
It can be used as Nautilus script or as regular shell script but GIU environment is required while notify-send command exists into the script's body.
The name of the output file could be based on the directory name (default) or on the name of the source video file.
Additionally when only two files are selected (one video and one subtitle file), they will be merged and rest of the folder's content will be retained. The output file will be named after the source video file. This option is available only when the script is used as Nautilus script.

The script:

#!/bin/bash -e

# Check if all tools are available
[ -x /usr/bin/notify-send ] || (echo "Please, install 'notify-send'"; exit 1)
[ -x /usr/bin/mkvmerge ] || (echo "Please, install 'mkvmerge'"; exit 1)

# Allowed video and subtitle file extensions
EXT_VIDEO=("mp4 avi mpg mov mkv wmv")
EXT_SUB=("sub str srt vtt")

# Files, which names contains some of next strings will be removed in auto mode
FILTER=("sample Sample SAMPLE")

# Log file
MERGE_LOG="/tmp/merge-video-sub.log"
echo > "$MERGE_LOG"

#
# Functions
#

function get-video-and-sub-file-names {
    # Get the names of the video and subtitle files and move the rest of the files into the Backup directory
    for ((i=0; i<${#FILE_LIST[@]}; i++)); do
        FILE_NAME="${FILE_LIST[$i]%.*}"
        FILE_EXT="${FILE_LIST[$i]##*.}"

        if   [[ "${EXT_SUB[@]}" == *"$FILE_EXT"* ]]; then
            SUB_FULL_FILE_NAME="${FILE_LIST[$i]}"
            SUB_FILE_NAME="${FILE_NAME}"
            SUB_FILE_EXT="${FILE_EXT}"
        elif [[ "${EXT_VIDEO[@]}" == *"$FILE_EXT"* ]]; then
            VIDEO_FULL_FILE_NAME="${FILE_LIST[$i]}"
            VIDEO_FILE_NAME="${FILE_NAME}"
            VIDEO_FILE_EXT="${FILE_EXT}"
        else
            # We need 'find' to manipulate only with files, because "$BACKUP_DIR" is in the queue
            find ./* -maxdepth 0 -type f -name "${FILE_LIST[$i]}" -exec mv "{}" "$BACKUP_DIR" \; -exec echo -e "The file {} was REMOVED.\n" >> "$MERGE_LOG" \;
        fi
    done
}

function get-the-content-of-the-current-directory {
    # Get the content of the current directory
    shopt -s nullglob
    FILE_LIST=(*)
    shopt -u nullglob
}

function mkvmerge-video-and-sub-files {
    # Create merged file
    mkvmerge -o "$OUTPUT_FILE" "$VIDEO_FULL_FILE_NAME" "$SUB_FULL_FILE_NAME"
    sleep 3
}

#
# Scenario 1: If exactly two files are selected in Nautilus! Then check if they are 1 video and 1 subtitle files, if yes - merge and remove them
# Scenario 2: Else run the standard procedure
#

# Get the files, selected in Nautilus as file list. Use next command to check the result: notify-send "MESSAGE" "`echo -e "${#FILE_LIST[@]}"; printf '%s\n' "${FILE_LIST[@]}"`"
IFS_BAK=$IFS
IFS=$'\t\n'
FILE_LIST=($NAUTILUS_SCRIPT_SELECTED_FILE_PATHS)
IFS=$IFS_BAK

if [ "${#FILE_LIST[@]}" -eq "2" ]
then # Scenario 1

    # Get the names of the video and subtitle files
    get-video-and-sub-file-names

    if   [[ "${EXT_SUB[@]}" == *" $SUB_FILE_EXT "* ]] && [[ "${EXT_VIDEO[@]}" == *" $VIDEO_FILE_EXT "* ]]
    then
        notify-send "OK" "`echo -e "The following files will be MERGED and MOVED to trash:"; printf '\t-\ %s\n' "${FILE_LIST[@]##*/}"`"

        # Construct the name of the merged file.
        OUTPUT_FILE="${VIDEO_FILE_NAME}.sub.mkv"

        # Merge the files
        mkvmerge-video-and-sub-files

        # Move video and subtitle files into user's trash directory and create trash infofile
        if [ -f "$OUTPUT_FILE" ]
        then
            gvfs-trash "$VIDEO_FULL_FILE_NAME"
            gvfs-trash "$SUB_FULL_FILE_NAME"
            notify-send "OK" "`echo -e "THE NAME OF THE NEW MERGED FILE IS:\n${OUTPUT_FILE##*/}"`"
        else
            notify-send "ERROR 1" "`echo "Something went wrong!"`"
        fi
    else
        notify-send "ERROR" "`echo -e "\n\t\nTo use this function, please select exactly:\n\t- 1 video file and\n\t- 1 subtitle file!\n\t\nYou are selected these files:"; printf '\t-\ %s\n' "${FILE_LIST[@]##*/}"`"
    fi

else # Scenario 2

    # Get the current directory name
    DIR_NAME="${PWD##*/}"

    # Create Backup sub-directory
    BACKUP_DIR="${DIR_NAME}.backup"
    [ -d "${BACKUP_DIR}" ] || mkdir "$BACKUP_DIR" && echo "The directory $BACKUP_DIR was CREATED.\n" > "$MERGE_LOG"

    # Move all sub-directories into the Backup directory
    shopt -s dotglob
    find ./* -maxdepth 0 -type d ! -name "*$BACKUP_DIR*" -prune -exec mv "{}" "$BACKUP_DIR" \; -exec echo "The directory {} was REMOVED.\n" >> "$MERGE_LOG" \;
    shopt -u dotglob

    # Move all files and folders, whose names contains a string, that exists in $FILTER[@]
    for f in $FILTER; do
        shopt -s dotglob
        find ./* -maxdepth 0 ! -name "*$BACKUP_DIR*" -type f -name "*$f*" -exec mv "{}" "$BACKUP_DIR" \; -exec echo "The file {} was REMOVED.\n" >> "$MERGE_LOG" \;
        shopt -u dotglob
    done

    # Get the entire content of the current directory
    get-the-content-of-the-current-directory

    # Get the names of the video and subtitle files and move the rest of the files into the Backup directory
    get-video-and-sub-file-names

    # Construct the name of the merged file. It could be based on the parent directory or on the video file name Make your choice and comment/uncomment next lines
    #OUTPUT_FILE="${VIDEO_FILE_NAME}.sub.mkv"
    OUTPUT_FILE="${DIR_NAME}.sub.mkv"

    # Get the entire content of the current directory after the filtering
    get-the-content-of-the-current-directory

    echo -e "$(cat $MERGE_LOG)" && notify-send "OK" "`echo -e "$(cat $MERGE_LOG)"`" && echo > "$MERGE_LOG"

    # Check the current structure of the directory
    if [ "${#FILE_LIST[@]}" -ne "3" ]; then
        echo "The content structure must consists of next 3 items:" > "$MERGE_LOG"
        echo "\t- 1 movie file,\n\t- 1 subtitle file and\n\t- 1 backup directory." >> "$MERGE_LOG"
        echo "\n\t\nThe current number of contained items is ${#FILE_LIST[@]}." >> "$MERGE_LOG" && echo >> "$MERGE_LOG"
        echo "\n\t\nPLEASE RESOLVE THIS MANUALLY!" >> "$MERGE_LOG"
        echo -e "$(cat $MERGE_LOG)" && notify-send "ERROR" "`echo -e "$(cat $MERGE_LOG)"`"
    else
        echo "The directory structure looks good, is contains ${#FILE_LIST[@]} items." > "$MERGE_LOG"
        echo " - The source VIDEO file is: ${VIDEO_FULL_FILE_NAME::21}... .${VIDEO_FULL_FILE_NAME##*.}" >> "$MERGE_LOG"
        echo " - The source SUB file is: ${SUB_FULL_FILE_NAME::25}... .${SUB_FULL_FILE_NAME##*.}" >> "$MERGE_LOG"
        echo "They has been merged and removed!" | tr /a-z/ /A-Z/ >> "$MERGE_LOG"

        # Merge the files
        mkvmerge-video-and-sub-files

        # Move video and subtitle files into the Backup directory
        mv "$VIDEO_FULL_FILE_NAME" "$BACKUP_DIR"
        mv "$SUB_FULL_FILE_NAME" "$BACKUP_DIR"

        # Move the Backup directory to trash and create trash infofile
        if [ -f "$OUTPUT_FILE" ]; then
            gvfs-trash "$BACKUP_DIR"

            echo "\n\t\nThe Backup directory has been MOVED to Trash!\n\t\n" >> "$MERGE_LOG"
            echo "The name of the new merged file is:"  | tr /a-z/ /A-Z/ >> "$MERGE_LOG"
            echo "${OUTPUT_FILE##*/}" >> "$MERGE_LOG"
            echo -e "$(cat $MERGE_LOG)" && notify-send "OK" "`echo -e "$(cat $MERGE_LOG)"`"
        else
            echo "Something went wrong!" && notify-send "ERROR 2" "`echo "Something went wrong!"`"
        fi

    fi
fi

rm "$MERGE_LOG"
exit 1

Setup:

Create executable file and paste the above content inside. Let's call this file merge-video-sub:

touch merge-video-sub
chmod +x merge-video-sub
nano merge-video-sub

Copy (or ln -s) this file into the folder ~/.local/share/nautilus/scripts to make it available as Nautilus script for the current user.
At the moment I can't find a way how to make it available system wide as Nautilus script.
Copy the file into ~/bin (and add export PATH=$PATH:~/bin to the bottom of ~/.bashrc if is needed) to make it available as shell command  for the current user.
Copy the file into /usr/local/bin to make it available as shell command system wide.
The short way is to curl the script from my PasteBin directly into nautilus/scripts folder:

curl https://pastebin.com/raw/HrLTibuR | sed -e 's/\r$//' > $HOME/.local/share/nautilus/scripts/merge-video-sub
chmod +x $HOME/.local/share/nautilus/scripts/merge-video-sub

Demo:

The previous demo

Additional references:

Encode forced subtitles using mkvmerge
How to merge srt, idx or sub subtitles with MKV in seconds
ToolSlick: SUB to SRT Converter and SubtitleTools: Convert Sub/Idx to Srt


The XFCE-Menu you are talking about is called xfce4-whiskermenu-plugin. It is a plugin that lives in a xfce4 panel. So make sure you have xfce4 and the whiskermenu installed.

Check if Whisker Menu is installed

Ubuntu Software Center way

Go into the ubuntu software center and check if whisker menu is installed searching for it and see if there is a green check mark. If not install it.

Terminal way

Check if whiskermenu is installed

dpkg -s xfce4-whiskermenu-plugin

If not installed install it

sudo apt-get install xfce4-whiskermenu-plugin

Add Whisker Menu to your XFCE4 Panel

If you have installed the package properly you should be able to add it to an xfce4 panel.

Right click the bar you have in your screenshot
Click Panel
Click Add New Items..
Search for whisker in your items and add it

Whiskermenu should appear now in your panel.

Edit Whisker Menu

If you want to edit the whiskermenu you need the package menulibre which is also available in the software center.

Installing it works like above

sudo apt-get install menulibre

or via the Ubuntu Software Center


Replicating Windows' Super + Arrow shortcuts for resizing windows

I think, out of the box, Ubuntu  15.10 can do something very similar, except the key combo is Ctrl + Super + arrows.


A simple solution is to install easyTAG , which is in the Software Center.

You can search the information from CDDB. And later put the music in your Music folder and import it in Rhythmbox.


Ubuntu Weird Internet Issue [USB/WiFi Tether]

Open software properties

  sudo software-properties-gtk

Change download from to another

Update repository

  sudo apt-get update


GRUB Timeout Set to 0, Can't Access GRUB Menu Anymore

Hold down the 'shift' key as the machine boots. The grub menu should show.


Fixing Ubuntu Installation after aborted Installation attempt

As per our conversation, reinstall Ubuntu using a boot CD or USB.

When partitioning, choose "Something else".

Choose to install root (/) on the same partition you had before.  If you had any other folders such as /home on other partitions, make sure you select those as well.  Ensure that the format checkbox is UNCHECKED.

Ensure you create your user with the same name and password as before.

This will install Ubuntu in the same places as before, overwriting anything that was there before, but it will not delete any files.

You may have to reinstall some packages for them to work correctly, but any data/files you had before will still be there.  You may have to change any preference settings back to what you had before, such as backgrounds, color themes, font sizes etc.


Gtk: Webkit WebView C++ (can't load url + awkward terminal output)

Oh, sorry - it was simple yet I was not able to find out what is causing it.
The answer is not to forget to show the webview widget.

gtk_widget_show(GTK_WIDGET(webview));

But I still have the awkward terminal output that I would like to get rid of.


Would 12.04 work well on my VAIO with single core 1.86GHz Centrino and 1GB RAM?

I will not recommend this. Actually I had such setup before and in case I reach top memory the usability went down. Try to add maximum memory you can. Then it could go somehow, depending on what you need to run. Otherwise I will recommend to use 12.04 Xubuntu or Lubuntu, which does not use Unity and therefore are less demanding to system resources. But you will loose some comfort Unity has.


Need to replace string with * except first and last 3 characters

This script uses sed to replace the characters with asterisks. It also uses bc to calculate the number of asterisks that should be used and seq to define the range in the printf command.

#!/bin/bash
STRING="fgdsfssa"
echo "$STRING"
STRING_LENGTH=${#STRING}

if [[ "$STRING_LENGTH" -lt 7 ]]; then
    echo "$STRING"
else
    ASTERISKS_LENGTH=$(echo $STRING_LENGTH - 6 | bc)
    ASTERISKS=$(printf "*%.0s" $(seq $ASTERISKS_LENGTH))
    FINAL_STRING="$(echo "$STRING" | sed -r "s/(.{3})(.*)(.{3})/\1$ASTERISKS\3/")"
    echo "$FINAL_STRING"
fi


Automount remote filesystem on reboot without password with sshfs

As per Revision #4 of the question:

  Adding the line export SSH_AUTH_SOCK=/run/user/1000/keyring/ssh to the sh script solved the issue with cron.


Ubuntu 12.04 LTS Got freezing while preparing to install

I had this problem myself! Luckily, I found a useful answer: No hard drive formatting, or mucking around with partitions required! Its a bit complex, and you need to use the terminal.

Open up Ubuntu like you normally would, from your flash drive.

Click "Try Ubuntu".

Press Ctrl+Alt+T.

A terminal, or a cute purple box, will appear!

Leave it open for the time being and start the installer, untick all the boxes, and click"Next". Ouch! It hung.

Here comes the tricky part...
Type

ps -ef | egrep "dosfsck|ntfs"

something like this will show:

waterlubber@UbuntuAcer:~$ ps -ef | egrep "dosfsck|ntfs"
ubuntu    4458  4401  0 18:02 pts/0    00:00:00 egrep --color=auto dosfsck|ntfs
root      4313 4242  stuff stuff stuff ............................ntfs

Note the "4313" next to "root". This is important

Now, type

sudo kill 4313

Replace 4313 with whatever number is next to"root" on the list. You may find some other stuff, try to figure out which number is the Process ID. (Thats that 4313 we saw earlier)

Don't bother killing ubuntu, if you do, nothing will happen other then a not found message

Repeat the process of typing

ps -ef | egrep "dosfsck|ntfs"

and killing the process until 'ubuntu' is the lone survivor. Take a look at the installer...is it working? If not, try it again! If worst comes to worst, make sure you don't have too many partitions with 'gparted' (Its in applications)

Hope this helped!


Got this fixed by chmod as non sudo user due to particular permissions setting in this enterprise machine.

> chmod 0664 shiny-server-1.5.3.838-amd64.deb
> ls -al
total 83140
drwxr-x---  3 tom users     4096 Mar 16 07:23 .
drwxrwx--x  5 tom users     4096 Mar 16 08:26 ..
-rw-rw-r--  1 tom users 70643942 Feb 25 03:23 shiny-server-1.5.3.838-amd64.deb
>

> sudo gdebi shiny-server-1.5.3.838-amd64.deb
Enter password for tom (INTRANETPASS):
Reading package lists... Done
Building dependency tree
Reading state information... Done
Building data structures... Done
Building data structures... Done

Shiny Server
 Shiny Server is a server program from RStudio, Inc. that makes Shiny applications available over the web. Shiny is a web application framework for the R statistical computation language.
Do you want to install the software package? [y/N]:y
Selecting previously unselected package shiny-server.
(Reading database ... 81902 files and directories currently installed.)
Preparing to unpack shiny-server-1.5.3.838-amd64.deb ...
Unpacking shiny-server (1.5.3.838) ...
Setting up shiny-server (1.5.3.838) ...
Creating user shiny
Adding LANG to /etc/init/shiny-server.conf, setting to en_US.UTF-8
shiny-server start/running, process 8854
>

credits - cues from @steeldriver, @bistoco


Recover accidentally removed files on NTFS partition

The Ubuntu Wiki has a lenghty topic on data recovery and, luckily for you, also has a segment on recovering files deleted from a NTFS partition. From that part of the link:

Ntfsprogs

ntfsprogs  can recover deleted files from an NTFS file-system. The Windows and LiveCd versions have a very nice intuitive gui but the linux one is probably stronger and does not have a front-end gui at the moment.

Briefly, it has 3 modes

Scan. searches for deleted files and find info about them
Undelete. See below.
Copy.

When undeleting chose which files to undelete and where to undelete them too. By default this appears to be the desktop of the OS you are booted into, whether that is a LiveCd or on a different partition or drive. For a LiveCd or LiveUsb you will need to move them onto Usb-stick or safe partition before rebooting as the desktop gets forgotten on LiveCds unless you are using a Persistent image.

To search

ntfsundelete /dev/sda2

To undelete

ntfsundelete /dev/sda2 -u -i 3689 -o work.doc -d ~/output

This will write all recovered files (in this case word.doc) from/dev/sda2 (be sure to find out the device name of your NTFS partition) in a directory output inside your home directory.

For better information on using ntfsundelete please see the separate page NtfsUndelete, particularly the External Links there.

Besides the part of the wiki it also contains this external link explaining NtfsUndelete with images.


Adjusting Bright makes Ubuntu not to respond

Install xbacklight:

sudo apt-get install xbacklight

You can set brightness to X% as (no sudo required):

xbacklight -set X

To make the setting permanent, go to Startup Applications and add a new startup program, with the following command (where X% is your desired brightness):

xbacklight -set X

example : xbacklight -set 65

Next time, you log in to your computer, Brightness will automatically set to 65. You can change this value any time.


NO pubkey in xubuntu 11.10 when i use apt-get update

converted comment to answer

The error you see is due to you having added a OpenSuse repository.

Search in Dash for software sources and untick the OpenSuse repositories you see in the Other Software tab.

Close and the refresh Update Manager

Alternatively - from a terminal run

sudo apt-get update && sudo apt-get upgrade


sound-How to customize the volume indication sound in ubuntu 16.0.4

System sounds are usually in:

/usr/share/sounds

The pop to indicate the current volume should be this one:

/usr/share/sounds/freedesktop/stereo/audio-volume-change.oga


How do I enable horizontal scroll on lubuntu desktop

The setting should be:

synclient HorizTwoFingerScroll=1

if you have a Synaptics touchpad. To make the changes permanent, see this answer.


/etc/network/interfaces configuration messed up

You have three options that I can think of.

Remove the auto eth0 and replace it with auto br0.  Configure the bridge with your public IP configuration.  If you need an internal address range add it as an extra address using ip or as br0:1.  I believe you can have only one bridge if you add an inter face to it.

Configure the bridge separate from the eth0 interface.  This is the configuration I use modified with your addresses.  You do not want to add a gateway to this interface.  You will need to configure iptables to do SNAT (masq) and forward packets.

iface br0 inet static
    address 192.168.40.1
    netmask 255.255.255.0
    pre-up    brctl addbr br0
    post-down brctl delbr br0

Configure the network in KVM and configure it to autostart.  KVM will then configure the bridge for you.


Grub will not install with boot-repair or by any other means

Explanation:

Ubiquity (the Ubuntu installer) installed Ubuntu in the wrong mode. You were affected by this bug: https://bugs.launchpad.net/ubuntu/+source/ubiquity/+bug/1050940
It also removed the boot flag by mistake.

Solution:

Via Gparted, set a boot flag on your sda1 partition.
Use Boot-Repair --> Recommended Repair


Can I install Intel Smart Response Technology?

No.  If you want SSD cache-ing you can use bcache as noted in some other questions on site.  Intel SRT is a Windows only technology, but bcache is in software not hardware and supposedly provides similar performance gains.


It seems like you can't right now. There's an open issue which you can follow to get updates about when this will be implemented.


How To Replace Unity with Gnome Shell via Ubuntu Software Center?

Log out.

Then, in the lightdm greeter click on the gear symbol and click on "Gnome". This will load the gnome-shell desktop.

To set gnome-shell as default, open a terminal and type

sudo /usr/lib/lightdm/lightdm-set-defaults -s gnome-shell


If unzip would have adhered to the pipes and filters architectural style characteristic of Unix, then one would expect to be able to do this by piping the output of wget into the input of unzip:

wget -O - http://www.test.com/test.zip | (cd destination-folder && unzip -)

Where the the dash after -O means standard output, the dash after unzip means standard input and the parenthesised right hand side starts a subshell in the correct directory.

However the ZIP format stores its contents index at the end of the file, and unzip needs to read this before it can start decompressing. So, contrary to gzip et al, it cannot decompress a stream in one pass.

As a workaround you need a temporary file:

wget -O /tmp/z.$$ http://www.test.com/test.zip &&
   (cd destination-folder && unzip /tmp/z.$$)

Where the $$ are just used to generate a non-colliding number.

Instead of running the subshell, you could use the -d option of unzip. And for added hygiene, clean up your temporary file:

wget -O /tmp/z.$$ http://www.test.com/test.zip &&
   unzip -d destination-folder /tmp/z.$$ &&
   rm /tmp/z.$$


How do I find out which process is preventing a umount?

open a terminal:

fuser -c /media/KINGSTON

It will output something like this:

/media/KINGSTON/: 3106c 11086

This will give you the pid of the processes using this volume. The extra character at the end of pid will give some extra info. ( c in  3106c)

c - the process is using the file as its current working directory
m - the file is mapped with mmap
o - the process is using it as an open file
r - the file is the root directory of the process
t - the process is accessing the file as a text file
y - this file is the controlling terminal for the process

So to unmount just kill that pids and re-try the unmount

sudo kill -9 3106 11086
sudo umount /media/KINGSTON

Note: To find the exact application name of these pids you may use this command

cat /proc/<pid>/cmdline

For example :  cat /proc/11086/cmdline

this will output something like below.

    evince^@/media/KINGSTON/Ubuntu-guide.pdf^@

Hope this will help


The manufacturer used wrong product id (re-used from another product) and it messes up the USB flip mode (USB devices can go through 2 modes). The usb-modeswitch package takes care of this in Ubuntu.
There is a temporary fix. Edit your /etc/usb_modeswitch.conf file and disable the switching mode:

DisableSwitching=1

Then when you insert the device it should work. It works fine for me, I could re-format the partitions and use the device. I'm using the USB-C port though. Not sure it matters.

Package maintainers are looking at a way to distinguish this device using other properties. I've open a bug there:
https://bugs.launchpad.net/ubuntu/+source/usb-modeswitch/+bug/1878921


USB-creator: Error erasing device: Unknown or unsupported erase type

SB must be formatted to FAT32. then it'll work again. I was creating the live USB stick fo rubuntu 14.04. when I encountered it and  now its working fine


"Dual boot" help with external SSD and no change to internal Windows SSD boot manager

I recommend you to follow these steps:
Extract your internal hard disk from your work latop.
Insert the pendrive with Ubuntu installer and boot with Ubuntu live.
Insert your external HD where you want to install Ubuntu.
Install Ubuntu on your external HD from the pendrive.
Install boot repair wich contains utils to use UEFI with Ubuntu.
shut down the laptop.
Boot from the external HD
install boot re-pair and execute it, you will find in internet that will help you configure UEFi in Ubuntu.
sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install boot-repair

Now you can shutdown.
Connect the internal harddisk and the external harddisk.
Boot with F12 to configure uefi to use Windows 10 uefi and efi from the Ubutnu external hardisk too.
Reboot.
Boot from Ubuntu external hard disk.
Now beging the magic to use Windows 10 internal installation from Ubuntu using Virtual Box in my case.
What you need to do is what is called "create a raw disk" file that points to the existing harddisk. Later, you create a new Virtual Box virtual machine using that file and you will boot Windows 10 from Ubuntu using an existing installation. Do not forget to click UEFI options on the Virtual Box virtual machine configuration.
Here is an example to create a raw file virtual harddisk from an existing one that Ubuntu maps to /dev/nvme0n1 :
VBoxManage internalcommands createrawvmdk -filename /home/luis/virtualmachines/Windows10/windows10.vmdk -rawdisk /dev/nvme0n1  -relative

These is just a litlle help. You may find that perhaps you need to use Virtual Box using sudo, but with some lectures and some hours you may find the way to make it work with your normal user.


Frozen desktop after upgrading to 14.04 from 12.10

Your GUI is not active, try startx command.
If this dosn't work try to download the new Live-ISO file and Burn it to a CD or Usb-stick.
Start from that and do a reinstall, don't reformat anything - at vleast at first.
Otherwise you have a broken system - and need to get rid of the dodgy configurations, so you have to do the format.....  --
Do backup - if you don't allready have one, make one to a Usb-disk from your live Iso.
Happy Ubuntuing and newyear.


Updating gfortran compiler from 4.8 to 4.9

You have two gfortran packages installed: gfortran plain (version 4.8.4) and gfortran-4.9 (version 4.9).

When you run gfortran in a regular terminal, you're actually running version 4.8.4, as you've noticed. In order to force your system to use the 4.9 version, try running gfortran-4.9 from the terminal.

Now, in theory, you could force gfortran-4.9 to be called from gfortran, but this is not recommended. If you want to ignore this warning, do this:

Back up and remove the existing gfortran binary.

sudo mv /usr/bin/gfortran /usr/bin/gfortran.bak
sudo rm /usr/bin/gfortran

Link gfortran-4.9 to the old one:

ln -s /usr/bin/gfortran-4.9 /usr/bin/gfortran

Note that you will lose this if you actually update the regular gfortran package, so keep this in mind.

For a slightly more permanent alteration that runs no risk of breaking your system (with the downside that it only works in a terminal), you could also assign gfortran to be an alias of gfortran-4.9 by running this:

echo "alias gfortran=gfortran-4.9" >> ~/.bashrc

Restart any Bash sessions, and gfortran should run version 4.9


append line command not working in terminal

The issue is the unescaped / in your replacement text :/opt

You must either escape it

ex -sc 's/$/:\/opt/|w|q' file

or use an alternate separator for the s command

ex -sc 's@$@:/opt@|w|q' file


How to suppress tar error messages in when piping

Here are couple of alternatives that involve redirecting STDERR of both tar and grep :

Use bash command grouping {}:

{ tar -xvf file.tar.bz2 | grep "something" ;} 2>/dev/null

Using a subshell () :

( tar -xvf file.tar.bz2 | grep "something" ) 2>/dev/null

Note that if you want to redirect STDERR of a single process its better to use Oli's answer instead.

On a different note, if you want to grep something over both the STDOUT and STDERR of tar use :

tar -xvf file.tar.bz2 |& grep "something"

This will also cause the STDERR of tar to be exhausted.

This is actually a shorthand for :

tar -xvf file.tar.bz2 2>&1 | grep "something"


Gnu sed, will the p command append a newline when printing?

There is an error in the diagram. Adds back newline to pattern space only happens when sed is run without the -n option. So the correct diagram should be:

Below is an excerpt from sed's documentation at How sed Works

When the end of the script is reached, unless the -n option is in use, the contents of pattern space are printed out to the output stream, adding back the trailing newline if it was removed. Then the next cycle starts for the next input line.

So if we run sed with -n, there will be no Adds newline back step.
sed's documentation states that the p command simply prints the pattern space. See Often-Used Commands for details.

p
Print out the pattern space (to the standard output). This command is usually only used in conjunction with the -n command-line option.

But it seems that p will always append a newline at the end of the pattern space (please correct me if you think this is wrong).
Based on the above-mentioned facts, let take a look the examples.
# seq 3 | sed -rn 'p'
1
2
3

The process for this example is:

Read text 1<newline>, strip <newline> and put 1 in pattern space.
p prints 1 and then prints a <newline>
Read text 2<newline>, strip <newline> and put 2 in pattern space.
p prints 2 and then prints a <newline>
Read text 3<newline>, strip <newline> and put 3 in pattern space.
p prints 3 and then prints a <newline>

For the second example:
# seq 3 | sed -rn 'x;p;x;p'

1

2

3

The process is:

Read text 1<newline>, strip <newline> and put 1 in pattern space.
Put 1 in hold space and put empty string in the pattern space.
Print empty string and then print a <newline>.
Put 1 back to the pattern space and put empty string in hold space.
Print 1 and then print a <newline>
Repeat step 1~5 for other input lines

So there is no inconsistency in these examples.
BTW, I'm still learning sed and this answer is based on my understanding. Please correct me if you find anything wrong. Thanks.


As long as you have 16.04 (and then 16.10, 17.04, etc when they come out), you don't need to install anything for Intel. The drivers are either open source or Intel allows Ubuntu to include them in the installation. Most of the time, Intel works OOTB.

As for performance, well that's a little more complicated. 4600 should be enough for GNOME (and even KDE), normal web browsing, videos and a few low-power games. It won't be nearly as great as the 980 in terms of performance, but if you aren't a serious gamer, you'll get along fine with Intel.

If you do game, do not sell the card. Intel graphics are great for work, but not so much for play. Minecraft will be fine on Intel (not great, but OK), but something like Deus Ex might not be so nice.

Maybe you do something in between: some low-power games and work. In that case, buy a lower performance NVIDIA card (DO NOT get AMD) and sell the 980.


Has anyone tried to write an itunes alternative for linux?

You may want to take a look at libimobiledevice they have brought a lot of Apple device services to Linux. If you take a scroll down their page you will see the current status of all services. The one you are looking for is:

  Music/Video Synchronization   DBVersion <= 4  4.3.5

  Rhythmbox, gtkpod and
  Amarok sync with latest libgpod >= 0.7.90. The iPhone 4/4S, iPod Touch
  4, iPad 1/2/3rd Gen and Apple TV do NOT work.
      Any device with DBVersion > 4 does NOT work. To check your DBVersion run "ideviceinfo -q com.apple.mobile.iTunes -k DBVersion".
  WIP.

They don't go into too much detail why music sync is so far behind however there is this report on there page:

  14.10.2011: iOS 5 music sync has a lot of changes. Linux users who want to sponsor the required implementations feel free to donate.

Maybe you can ask the guy's there if you can help.


The answered to the problem was changing out the dumb 5 port switch I was using.

Do not use this:

Cisco SF100D-05 if you are using a Linux machine with Realtek networking chipset.

https://supportforums.cisco.com/discussion/11874911/unstable-link-sf100d-05


unreliable touchpad after installation of 18.04 on Lenovo Flex 11 laptop

I had the same problem and updating the kernal fixed my problem. Use [$ uname -sr] to check your version. I had 4.15 and 5.01 is the current release. The new kernals can be found at https://kernel.ubuntu.com/~kernel-ppa/mainline/ A simple tutorial is found at https://www.tecmint.com/upgrade-kernel-in-ubuntu/


Your Ubuntu system rotates logs to prevent them from growing to enormous size with ancient data.
Logfiles get rotated by the logrotate service. Default is weekly, and that is configurable in /etc/logrotate/ . Older logs are compressed, then eventually deleted.

See man logrotate and man logrotate.conf

Here's an example of what rotated logs look like:
$ ls -lh /var/log | grep auth
-rw-r-----  1 syslog    adm      46K Jul  3 07:30 auth.log
-rw-r-----  1 syslog    adm     108K Jun 30 09:32 auth.log.1
-rw-r-----  1 syslog    adm     5.5K Jun 21 15:01 auth.log.2.gz
-rw-r-----  1 syslog    adm     6.3K Jun 14 07:27 auth.log.3.gz
-rw-r-----  1 syslog    adm     7.6K Jun  7 08:58 auth.log.4.gz


OpenOffice Presentation change slide by clicking slides

I'm pretty sure that one way to do this is to show the same image in both monitors - if that would work for you.  I have recently switched from Open Office to Libre Office on my machine that has a second monitor attached.  The version of Impress in Libre Office certainly works this way.

However, another interesting option offered by Libre Office is the add-on "presenter console".  This let you show the main presentation on the second screen (or LCD projector) and, on the main screen, shows the current slide, a mini-view of the next slide, some timing information (clock, presentation run time), previous/next buttons, a button to access any speaker's notes, etc.  All this - but - you can't change the slide by clicking on the image; you have to use the next button.  And, I don't think that you can use the mouse to point to something on the presentation screen in this mode.


Not able to ajust Screen Brightness in ubuntu 18.04 in Desktop

This is a problem common with Nvidia cards. If you do have an Nvidia video card, you are going to need to load the driver.
First of all do a uname -a, it will show something like 4.15.0-142-generic, not exactly that, but something like that in the output.
After that do sudo apt install linux-headers-4.15.0-142 linux-headers-4.15.0-142-generic. It's not going to be that exact version, but the numbers have to match whatever uname -a gave you.
Then you are going to add the graphics driver repository: sudo add-apt-repository ppa:graphics-drivers/ppa
Now you can check what driver is available: sudo ubuntu-drivers devices
It should display a list and some entry is going to say "recommended" next to it. So you can go ahead and install it. sudo ubuntu-drivers autoinstall
Make sure to reboot and you should be all set. All that said, I really do hope that somebody fixes the issue that linux-headers packages are never part of any dependencies even though you can't load the video drivers correctly without them. 16.04 had a huge problem where it lost its mind every time the kernel updated. Every time there was a kernel update, before rebooting had to remember to go in and manually install the correct header set. Otherwise pain was inevitable.


How to connect to homepage after creating it with a python webframework (hyde) from an other machine in the same network?

You need to give hyde the external ip of the server, not localhost which is limited to the machine itself.

To get the external ip, run ifconfig | grep "inet addr"

egil@mutter:~$ ifconfig | grep "inet addr"
          inet addr:192.168.10.10  Bcast:192.168.10.255  Mask:255.255.255.0
          inet addr:127.0.0.1  Mask:255.0.0.0

The inet addr on the same line as with Bcast and Mask is the one you need to start hyde with.


How to update ClamAV definitions database?

To update the ClamAV database do sudo freshclam.

NAME
       freshclam - update virus databases

SYNOPSIS
       freshclam [options]

DESCRIPTION
       freshclam is a virus database update tool for ClamAV.

For offline update, you can also directly download virus definition from database: main, daily and then put them into /var/lib/clamav (remove old files).


How to skip boot-time fsck check preferably by editing grub menu-entry?

Editing /etc/fstab file to bypass fsck check at boot:
You can change the value of <pass>, the 6th field of file system description line in /etc/fstab to 0 (zero) to avoid filesystem check at the boot. (For your swap it's already 0, so you'll have to change your / and /home partitions' values from 1 and 2 respectively to 0 each.)
# <file system>                  <mount point>  <type> <options>      <dump>   <pass>

UUID=0a0fda6a-a0af-461f-936e-fe6feff3adba /      ext2  errors=remount-ro 0       1

UUID=b9ed5358-a68a-48ef-8c51-7241f0462913 /home  ext4  defaults          0       2

UUID=301dcfce-1bb3-415d-a71a-df64add29443 none   swap    sw              0       0

..so that the entries look like:
# <file system>                  <mount point>  <type> <options>      <dump>   <pass>

UUID=0a0fda6a-a0af-461f-936e-fe6feff3adba /      ext2  errors=remount-ro 0       0

UUID=b9ed5358-a68a-48ef-8c51-7241f0462913 /home  ext4  defaults          0       0

UUID=301dcfce-1bb3-415d-a71a-df64add29443 none   swap    sw              0       0

The documented description of the fs_passno i.e. <pass> field in /etc/fstab file:

The sixth field (`fs_passno`):

This  field  is used by the fsck program to determine the order in which filesystem checks are done at reboot time. The root filesystem should be specified with a fs_passno of 1, and other filesystems should have a fs_passno of 2.  Filesystems within  a drive  will be checked sequentially, but filesystems on different drives will be checked at the same time to utilize parallelism available in the hardware.  If the sixth field is not present or zero, a value of zero is returned and fsck will assume that the filesystem does not need to be checked.


Can't get upstart service to honor capabilities(7)

I'm now thinking this is a bug, and related to the way upstart starts services with "expect daemon" (i.e. services that fork twice upon startup). I notice that if I use strace on a process that is using capabilities(7) the capabilities are also ignored. I suspect that upstart, in order to determine the PID to wait on, traces a service specified with "expect daemon" long enough to obtain the PID, and that's causing the kernel capabilities mechanism to fail. So the bug is in the way that capabilities interact with process tracing, and the fact that upstart uses process tracing when starting a service with "expect daemon" (this is supposition).

As a simple test:

Write a small C PROGRAM to bind to port 443 (you cannot use an interpreted language such as python with capabilities(7)).
Run it as non-root, and see that it fails to bind due to lack of privilege.
Set the CAP_NET_BIND_SERVICE capability for your PROGRAM (as root run setcap 'cap_net_bind_service+epi' PROGRAM)
Run it as non-root, and see that it now succeeds.
Now run it with strace, and see that it now fails.

(note that in step 3 strictly speaking the Inherited capability set (i flag) does not need to be modified for this test, but it does for a process that forks() such as my daemon).

This behavior is necessary to avoid privilege exploits but makes Upstart behavior incompatible with Capabilities.


error: hd0, 1 read error, VM can't boot up

boot a Live CD and reinstall grub2 by chroot'ing to the 'broken' system.

Boot into Live CD
Open Terminal (CTRL+ALT+T)
Enter the following commands:

sudo fdisk -l

And find your Ubuntu partition (should be /dev/sda1 if it is the first partition)

sudo mount /dev/sda1 /mnt

sudo mount --bind /sys /mnt/sys

sudo mount --bind /proc /mnt/proc

sudo mount --bind /dev /mnt/dev

sudo chroot /mnt

Now reinstall Grub2

sudo apt-get install --reinstall grub2


Put the iso on a cd/usb (There should be a utility for putting it on a cd on windows) and boot from it (Don't forget to change your bios so you can do that first!), when you have gotten into ubuntu run the setup and when it asks you select where to
install ubuntu, select install ubuntu alogside windows! Then just install ubuntu like any other os.
Downside? It's a little harder to remove ubuntu but it's still possible.


How to specify to install libraries to /usr/local/

You can use:

./configure --prefix=/usr/local

or in your case

./configure --prefix=/usr/local --enable-asio-lib

It will install in the /usr/local directory tree i.e. in /usr/local/bin/, /usr/local/lib, etc ...


wifi connections not showing up for ubuntu 16.04

I had the same problem yesterday and i used this command :

sudo iwlist scan

And the list appear again


You might be the victim of this bug

A short excerpt of the bug summary:

I use ubuntu 11.04.
The version of evolution is : 2.32.2-0ubuntu7
The version of rss-evolution is : 0.2.2-0ubuntu1

When I open evolution without option, It freezes after 2 seconds, but when I open evolution with the command "evolution --disable-eplugin", It works.
So I think plugin evolution-rss is the problem.


Packaging a Java web application: Reuse tomcat6 or separate process?

That should be the choice of the sysadmin. Just package the app in order to just run out-of-the box. If the sysadmin wants increased security that is his work :)


Why tilda take long time to appear on my laptop?

It was a driver problem.

I solved installing the latest version of ATI drivers, adding two repositories:

deb http://ppa.launchpad.net/ubuntu-x-swat/x-updates/ubuntu lucid main
deb-src http://ppa.launchpad.net/ubuntu-x-swat/x-updates/ubuntu lucid main
key: http://keyserver.ubuntu.com:11371/pks/lookup?op=get&search=0x3B22AB97AF1CDFA9

and then sudo apt-get update


Monitoring Ryzen 2700X CPU Temperatures in Ubuntu 18.04 (Kernel 5.0.11)

Replying to old question but as it seems issue still not resolved:

Check:

https://github.com/electrified/asus-wmi-sensors

Resolved my case with same chip and ROG Crosshair VII Hero, but also works with other MBs


You downloaded wrong package. You downloaded generic version of linux-image and linux-headers but lowlatency version of linux-modules . generic and lowlatency aren't compatible and is entirely different. You downloaded linux-modules-5.5.0-050500-lowlatency which isn't correct package. You must download linux-modules-5.5.0-050500-generic and install that.


About to dual boot Ubuntu with currently installed Windows 7 need expert advice!

I have L502, so all are from my personal experience.

You can install any version of ubuntu (preferable >= 12.04) with any kernel.
For Optimus setup, use bumblebee. Follow instruction here to install
About dual moniter - Follow instruction here

For your information, the HDMI port is connected to nvidia chip. So as per bumblebee wiki

  When the port is wired into the nvidia chip, you can currently not
  expand the screen over monitors. The monitor may still be used as
  extra screen (with no desktop running on it) or to run the full
  desktop on it (with no output on the Intel LVDS output, a.k.a. "the
  laptop display").

That means, you can't use both display at same time.


how can I shutdown from the command line using lightdm?

I looked through the manpages and couldn't find anything in lightdm that would allow you to shtudown the computer. You could use dbus.

import dbus
bus = dbus.SystemBus()
bus_object = bus.get_object("org.freedesktop.Hal", "/org/freedesktop/Hal/devices/computer")
bus_object.Shutdown(dbus_interface="org.freedesktop.Hal.Device.SystemPowerManagement")

Which is explained here


Why does pressing Alt + Tab cause a freeze?

It is more likely to be a bug with Xorg/Xorg driver, if you can reproduce the freeze please open a bug report and if you have the skills try to debug it as described at https://wiki.ubuntu.com/DebuggingXorg .


Put together this from various responses:

Move to Home folder

VMware-Workstation-Full-8.0.2-591240.x86_64.bundle
PATCH: patch-modules_3.2.0.sh
PATCH: vmware3.2.0.patch

  Patch download link (xtact contents to Home folder):

  http://weltall.heliohost.org/wordpress/2012/01/26/vmware-workstation-8-0-2-player-4-0-2-fix-for-linux-kernel-3-2-and-3-3/

Install VMware

sudo sh VMware-Workstation-Full-8.0.2-591240.x86_64.bundle

Install Patch

sudo ./patch-modules_3.2.0.sh

NB: Make sure patch has an executable permission


Problem with k3b in 18.04 releases " cdrecord has no permission to open the device"

Try attempting the following commands:

sudo chmod 4711 /usr/bin/wodim; sudo chmod 4711 /usr/bin/cdrdao

This will set the UID bit on the necessary binaries.  It is illustrated in Settings -> Configure k3b -> programs -> Permissions "tab".


My Lenovo Ideapad u165 wireless doesn't work

I'd rather comment but can't sorry!

which version of Ubuntu are you using? I encountered the same problem when I upgraded to Natty on my Lenovo Ideapad, also Broadcom 4313.
You could try the solutions here: http://ubuntuforums.org/showthread.php?t=1700897

Ultimately I downgraded because nothing worked for me & everything is fine now. I'll wait for the next LTS. Hopefully you'll find a solution! I shifted my home to a separate partition so that I can do fresh installs without erasing my documents.


Strange Issue! Red light coming out from Headset jack

It is ok. It's for the optical audio output for HD quality.
Possible Solution: https://askubuntu.com/questions/37971/optical-audio-jack-always-on-macbook-pro-5-2-natty


What tools can I use to download videos from Youtube and Vimeo on Ubuntu 12.04?

youtube-dl

youtube-dl is a small command-line program to download videos from YouTube, Vimeo and a few more sites. It is included in the Ubuntu repositories, so you may install it by typing:

sudo apt-get install youtube-dl

vimeo-dl

vimeo-dl is a stand-alone command-line program to download videos from Vimeo. It is not included in the Ubuntu repositories, therefore you must download and save the script somewhere and make it executable by typing:

chmod 775 <script>


Installing Ubuntu on native ZFS root with encryption

Grub 1.99 (shipped with Ubuntu) doesn't support encrypted zfs, which is why update-grub is failing.

So your options are:

Install grub 2.00 (which does support encrypted zfs).
Write your grub.cfg manually rather than using update-grub.

Both of these options deviate significantly from Ubuntu defaults, but still much less so than using encrypted ZFS for your root FS in the first place :)

For #1 you'll need to compile grub 2.00 from source, as I'm not aware of any grub 2.00 packages for Ubuntu.

For #2 you'll need to dpkg-divert update-grub and replace it with a symlink to /bin/true then write your grub.cfg by hand (updating it whenever you get a kernel upgrade).

If you need to more specifics on how to do either option I'd be glad to expand on that.


Try reinstalling the graphic driver,if it doesnt work try reinstalling ubuntu, if it still doesnt work.....well consider checking your HDD,good luck


broadcom B4318 driver installation - cannot unload wl driver in 14.04

Please do:

sudo apt-get purge bcmwl-kernel-source

Reboot and enjoy your wireless.


How to upgrade/install newest version of nodejs on Ubuntu 14.04

Below are the steps to install Node.js from source (OSX/linux)

NOTE - this installs Node.js which gives you both node as well as npm, they come together per release.

to start fresh remove prior node and npm installs as well as these :

sudo mv ~/.npmrc ~/.npmrc_ignore
sudo mv ~/.npm   ~/.npm_ignore
sudo mv ~/tmp    ~/tmp_ignore
sudo mv ~/.npm-init.js ~/.npm-init.js_ignore

download source from : http://nodejs.org/download/

cd node-v5.0.0   #  <-- or whatever download expands to

You may/should issue all following cmds as yourself NOT root (sudo)

Pick one of these NODE_PARENT locations to define where node gets installed into :

# export NODE_PARENT=/some/desired/install/path_goes_here
# export NODE_PARENT=/usr/local/bin/nodejs  # use this ONLY if you MUST install as root (sudo)
export NODE_PARENT=${HOME}/node-v5.0.0      # Recommended - owned by you NOT root

export PATH=${NODE_PARENT}/bin:${PATH} # jack up PATH for executables
export NODE_PATH=${NODE_PARENT}/lib/node_modules # so node itself can find its modules dir

./configure --prefix=${NODE_PARENT}

make
make install

which puts it into dir defined by above --prefix

when you use syntax : npm install -g some_cool_module the -g for global installs it into dir $NODE_PATH and not your $PWD

IMPORTANT - put above three export xxx=yyy commands into your ~/.bashrc or some such to persist these environment variable changes

On subsequent updates to Nodejs, just update your ~/.bashrc with new release name in your NODE_PARENT env var , then source this ~/.bashrc and simply issue the configure/make/install as above

If you had a prior install of node you may want to copy over previously installed modules into new location :

~/node-v5.0.0/lib/node_modules/

or do fresh module installs using npm install -g xxxx


Ubuntu 16.04 running on a Dell 1950 server 16GB RAM 140GB HDD CPU @ 2% Mem @9% runs slow

The issue you are implying is you don't have a GPU and so graphical things like the Ubuntu desktop environment aren't rendered by the GPU but instead on the CPU and the CPU doesn't handle things like that unless it has a built-in GPU like the Intel HD 4000 series.


See here  for basic networking steps on Ubuntu.

sudo lshw -class network

will list all network interfaces on your server.

Detailed official documentation from ubuntu.com for servers goes here.


Here's a test of /dev/zero's throughput on my system:

$ dd if=/dev/zero of=/dev/null bs=1M count=1000000
1000000+0 records in
1000000+0 records out
1048576000000 bytes (1,0 TB) copied, 65,2162 s, 16,1 GB/s

There's no other bottleneck than the CPU's cache speed here. That means that in my system /dev/zero can generate up to 16,1 GB/s of zeros, so it definetly should be fast enough for your purpose.


How to write commands with default variables for terminal or default app (Browser, Terminal) so it would work on any Ubuntu or Debian?

If you need to run the same command on multiple platforms / distributions there is a workaround which involves writing customized copies of the same command and separating them with the || operator which will try to execute the next command if the first command fails.
Example
Command for mate-terminal:
mate-terminal -- bash -c 'sleep 2; echo "hi"; sleep 5; firefox'

Command for gnome-terminal:
gnome-terminal -- bash -c 'sleep 2; echo "hi"; sleep 5; firefox'

Command that will run on either terminal:
mate-terminal -- bash -c 'sleep 2; echo "hi"; sleep 5; firefox' || gnome-terminal -- bash -c 'sleep 2; echo "hi"; sleep 5; firefox'

Command that will run on either terminal and launch either firefox, google-chrome or chromium:
mate-terminal -- bash -c 'sleep 2; echo "hi"; sleep 5; firefox || google-chrome || chromium' || gnome-terminal -- bash -c 'sleep 2; echo "hi"; sleep 5; firefox || google-chrome || chromium'

This will however require looking into target platforms to find out how to correctly run the command.
Best of luck


To make zfs compatible again with spl, as root:

apt-get install ubuntu-zfs zfs-dkms
zpool import -a
zfs mount -a

(This summarizes the comments with gertvdijk, who deserves the credit for this answer but may have lost interest as almost a week has passed.)


Totem movie player has some nice visualisations that can be enabled via edit > preferences > display (see the second screenshot below). You can start the visualisations by playing a music track (when that option is is set in the preferences) and pause them by pausing the music track. There are many different visualisations to choose from and different effects can be combined.

I don't think that they respond to the beat of the music (i.e. get more frenzied as the tempo increases), but perhaps something like audiosurf might become available if Steam makes good its promise and comes to Ubuntu.

Unfortunately, if the sound file contains an album cover picture, (for example say like one has with files downloaded from Jamendo), then Totem displays the album art and not the visualizations.


Navigate to

software sources -> Additional Drivers

and see what driver your nvidia card is using.
I have the same setup and found that using the nvidia-experimental-304 driver worked best for me.

Scroll all the way to the right to see the names of the drivers, and see this post for more information on which drivers allow you to shutdown properly.

Refer to this guide for more information on fully utilizing your macbook pro 7,1 with ubuntu 12.10.


This error sometimes exists if you update via GUI.
Try to update from command line.

sudo apt-get update ; sudo apt-get upgrade

If this does not help try to free space. Uninstalling old linux kernels helps me.

sudo dpkg -l | grep linux

Then uninstall the old kernels. If you have only one, do not uninstall it!


The command is given below for use with macOS.

shasum -a 256 <iso.file>

For example,

shasum -a 256 ubuntu-18.04.2-desktop-amd64.iso

produces the following output.

22580b9f3b186cc66818e60f44c46f795d708a1ad86b9225c458413b638459c4  ubuntu-18.04.2-desktop-amd64.iso

According to this Ubuntu website, this is the correct value.


How to use "quickly run" and pass command-line arguments?

From the help:

  $ quickly run help

  Runs your application. This is the best way to try test it out
  while you are developing it. It starts up the main project window.

  $ quickly run -- values -
  to pass '-whatever' and 'values' to the executed program. Without that
  if you use for instance --help, it would be Quickly help and not your
  program one.

So for instance, I have a program, that I import sys and add the following to the finish_initializing function:

print sys.argv

I then run from the command line:

quickly run -- param1=value1 param2=value2

Which then outputs:

  ['bin/ui-test', 'param1=value1', 'param2=value2']


Actually the launcher is misplaced in Ubuntu 18+, Ubuntu made a mistake, all the other distributions based on ubuntu including linux mint inherited the bug, nobody cared to fix

Run the below command in terminal

sudo ln -s /usr/share/doc/wine-stable/examples/wine.desktop /usr/share/applications/

Now right click the windows app and click open with , you can now see open with "wine windows program loader" in the applications list.


Ubuntu 14.04 mouse and window focus issues

So I kept looking around and the problem seems to have been the type of mouse I have. I found a thread on the Ubuntu forums by a user with a similar mouse having a problem that sounded like mine. In the thread it was suggested to (create and) edit the /etc/X11/xorg.conf files with the following:

Section "InputClass"
    Identifier "Mouse Remap"
    MatchProduct "Saitek Cyborg R.A.T.5 Mouse"
    MatchDevicePath "/dev/input/event*"
    Option "ButtonMapping" "1 2 3 4 5 6 7 2 9 10 11 12 0 0 0"
EndSection

And then I restarted my computer.

I have RAT5 gaming mouse and the use from the thread has the RAT7 gaming mouse.
It has been a day since I implemented the fix and there have been no problems. Didn't bother looking into why it was buggy but I know the above configuration fixed it.

Thread: http://ubuntuforums.org/showthread.php?t=2152976


To solve this issue you will have to boot into recovery mode (root shell) and set the appropriate permissions on that file.

To boot into recovery mode hold the Shift while booting.
Select the first entry ending with (recovery mode).
In the recovery menu list select the root option.
Run following command.

chmod 0440 /etc/sudoers
Enter reboot when you are done.

That should work.


I don't know the passphrase to ubuntu. Is there a way to uninstall ubuntu?

If the objective is to remove Ubuntu anyway and not keeping any data, you can use the same installation medium you used when installing the current version and then format the hard drive. Then you can choose to install again or go for installing whatever else you like. This is an irreversible action so try it only as a last resort.


Not having write access for my FTP User for my Wordpress / nginx / ubuntu with SSH

What you need is alternative permissions to make this work..    Which as long as your on a fully functional filesystem such as ext4 you can use Linux Access Control Lists (ACLs).
The following link will get you started..
https://www.redhat.com/sysadmin/linux-access-control-lists
In effect you can control the default UID and GID settings for newly created files anywhere under the file tree you've configured which is perfect for what you describe.


Trouble installing Ubuntu 12.04 on Mac PowerPC G5

did you try to install it as a main Operating system on the specific computer?

download ubuntu 14.04 and try again to install it!
what device did you use to install ubuntu?


Yes, Ubuntu needs that EFI partition. UEFI is a (relatively) new method of booting for operating systems, and is much more featured than legacy/BIOS boot. Look it up for some more details.

If you don't copy it over, you aren't going to be able to boot, as it stores the bootloader files for OSes that support EFI. There may be Windows stuff left over, but there's also almost definitely GRUB files in there as well.


How can I increase volume beyond max in xubuntu?

sudo apt-get install pavucontrol
and adjust to suit


How to run a .pyc (compiled python) file?

Since your python file is byte compiled you need to run it through the python interpreter
python yourfile.pyc

The reason you can run your .py files directly is because you have the line
#!/usr/bin/python

or
#!/usr/bin/env python

or something similar on the first line in the .py files.
This tells your shell to execute the file with the Python interpreter.


How to retain the wireless settings using ndiswrapper

I have run into similar problems in the past trying to get a Linksys WUSB54G to work with ubuntu. I found this tutorial really helpful: https://help.ubuntu.com/community/WifiDocs/Driver/Ndiswrapper
It talks about your exact problem in section 3.6.


MacbookAir 3,1 (late 2010) suspension under Kubuntu 16.04.3 LTS

OK, so I couldn't find an answer for this. pm-suspend works but the computer doesn't wake up after suspension. I've tested pm-hibernate which works. from there I'm searched for solutions as why xfce4-power-manger settings are ignored, in short - in /etc/systemd/logind.conf - I've removed the # from HandleLidSwitch and changed "suspend" to "hibernate" Now the setting Laptop Lid = Suspend actually Hibernates now.


Failed to download repository information 14.04

You have some lines in /etc/apt/sources.list that refer to saucy release that is not supported any more.

Just remove them. If you have Ubuntu 14.04, you need only trusty repositories.


It seems steam's repo has not been updated to support 12.04.2 yet. as you can see in this screenshot steam tries to downgrade a crapload of important packages: http://i.imgur.com/xOhaU09.png


Using native connection while still connected to a vpn

I believe you're talking about split-tunneling. Depending on the application/VPN in question, this could be an option in the server configuration.

With OpenVPN, I'm not sure if this is the default.  If you aren't sure what routing is being pushed to the client, it would be easiest just to run a route command on the client to see where it think the default is.  You'll really only want the vpn gateway set as a route for the development server(s).  Everything else should default to whatever the normal gateway for the client is.


There is no way you can change the min. window size in regards to resizing. That is up to the app to do & in the case of sublime it doesn't. Altering this is done in source & as sublime is closed source your best bet is to file a bug with them.

From xwininfo -

Normal window size hints:
      Program supplied location: 0, 0
      Program supplied minimum size: 0 by 0


when setting up a webserver on linux , is it a good practice to make a new user and install everything under that user?

When using Linux you should not run things as root unless it's essential. This means that most installations will actually be done as root, normally by using the sudo command (or the GUI equivalent) as this ensures that all the files can be put in the right locations, with most files being below the /usr directory.

The Apache developers are well aware of security concerns and, by default, will install the webserver to run as a specially created user; on my system, most of the apache2 instances are running under the user www-data which I believe is the default (it's a long time since I installed it).

I think you can override the default locations for the actual web files during installation, but normal practice is to use the default (/var/www as I recall) and then link subfolders to there.

In summary, taking the defaults of the installation (run as root or using sudo) will give you a reasonably safe setup and you don't need to take any special action.


remotely log out of (graphical) gnome session

After logging in with ssh, run:

env DISPLAY=:0.0 gnome-session-quit --logout

This will force a logout on the remote machine just as if you had logged out from the menu (but without prompting).  You may need to run gnome-session-quit with --force-logout if there's an application with, for example, unsaved work, that would otherwise prevent a clean logout.

If you use a very old version (<2011) of GNOME, then you need to

env DISPLAY=:0.0 gnome-session-save --logout

... because gnome-session-save was renamed to gnome-session-quit in 2011.

Source


Regular expressions VS Filename globbing

Regular expressions and file name globbing are two very different things.

Regular expressions are used in commands / functions for pattern matching in text. For example in the pattern parameter of grep, or in programming languages.

File name globbing is used by shells for matching file and directory names using wildcards. The capabilities of globbing depend on the shell. Bash, for example, supports wildcards like:

* match 0 or more characters
? match 1 character
[...] match a character in the specified set

These wildcards may look similar to regular expressions, indeed [...] has the same meaning in globbing and regex. But * and ? mean different things in globbing and regex.

In a comment you wrote:

  but how the interpreter difference * whether it's a joker or regex ? for example : grep a*b a*.txt ?

Easy. Sort of.

First of all, the shell tries to interpret the wildcards, by matching them against filenames. If there are files starting with "a" and ending with "b", the shell will replace a*b with the matching filenames. Same goes for a*.txt. If there are no matching filenames, the shell will pass the arguments to grep as they were, literally.

However, the first parameter of grep should be a pattern.
In 99.999% of practical use cases you don't want the first parameter to be interpreted by the shell. So most probably the intention was this:

grep "a*b" a*.txt

Thanks to quoting a*b, the shell will not interpret it using globbing, and instead pass it directly to grep. In turn, grep will interpret that
as a regular expression (by design).

To sum it up, the shell interprets the command line following its own globbing language, which is using wildcards. Commands, programs interpret their parameters in whatever way they were designed by their authors.


How to see the intermediate code on compilation of a C program?

If this is gcc* you also need -save-temps after -S

 gcc -S -save-temps file.cpp would make file.i

* By default, gcc is installed and linked to cc. If you install another C Compiler, cc will link to that.


Can I create an internet whitelist using only the packages availible on a clean Ubuntu install? (maybe /etc/hosts.allow?)

To block all sites with hosts.deny you should put ALL: ALL in your /etc/hosts.deny file.
But there are some better ways to do this, for example:

Using a firewall like iptables, with firewall you can block all HTTP, HTTPS, whatever traffic you want and allow it for some spacial IP, domain, etc.
Read this: https://unix.stackexchange.com/questions/212233/iptables-to-block-all-websites

Using something like dnsmasq:
Read this: https://www.linuxquestions.org/questions/linux-networking-3/how-to-block-all-websites-except-2-a-667350/


If you have ever had the subtitles hidden or used a custom subtitle settings

Try pressing v If it didn't show

Un-check the custom subtitle in the right click menu.


Home folder synced to HD: results differ!

Use rsync utility to clone a directory. Run:

sudo rsync -xrlptgoEvv --progress /home/user/source/ /home/user/dest/

To keep destination directory in fresh state, you can add --delete option - this will remove from destination directory files and directories which have been deleted in source directory since previous syncing, i.e.

sudo rsync -xrlptgoEvv --progress --delete /home/user/source/ /home/user/dest/

Another solution is tar with or without compression. Tar itself is just a multiple files "container". To create uncompressed tar-archive (archive file is larger, but creation process is faster) of a directory, issue the command:

tar pcvf archive.tar sourcedir/

Gzip compressed tar-archive (archive file is smaller, but creation process is slower) can be created with

tar pczvf archive.tar.gz sourcedir/

To extract such archives, use commands:

tar xvf archive.tar
tar xzvf archive.tar.gz

Remark. Use sudo before tar command if your directory contains files with restricted access for current user.


Computer goes on deep sleep whereas being accessed through LAN

Presumably you have this set up as a laptop computer rather than as a server. If you want to disable the automatic sleep, then go into the power screen of the configuration and settings.


Permissions for Apache2 on fresh Ubuntu installation

sudo chmod 0774 -R /var/www

You should make this 2 commands. 1 for files. 1 for directories. It is more secure to use 0 for others: generally you only want the user and the group to be able to do anything with files. The least permissive permissions would be set like this:

find . -type f -exec chmod 640 {} \
find . -type d -exec chmod 750 {} \

Not saying you have to do it like this! 644, 755 or your 774 is a little more permissive but works too. Lower than 640/750 is possible too: 600 and 700 is you so not need a group but that hardly ever is the case. I tend to use those 2 commands and if something does not work (ie. forbidden notice from webserver) I would "up" the permissions and try again. If I end up with a working website where I needed to "up" others I know there is a file that has bad owner or permissions.

  alias craft="sudo -u www-data php ./craft"

That works but is that needed? You said you used 774 as permissions so your group should be able to execute it. Check from the user with

groups

you are indeed in group www-data.


Is there a quick way to kill hundreds of alert dialogs?

Try this command: kill $( xprop | grep _NET_WM_PID | grep -o [0-9]*$ )
(it will kill the next clicked windows' process)


Unfortunately, the notification timeout cannot be changed. It is actually not a fixed timeout. "if you move the mouse up towards the notification, the timeout is prolonged, and notifications do not hide when hovered."

However, it is possible to disable Notification popups. This way, it won't disrupt you, but it still remains available in the notification area you see when clicking the date or by pressing Super+m.

To disable notification popups, head to "Settings" - "Notification".


The TCP reassembly time in the Linux kernel is indeed 30 seconds by default.
You can check the setting on your system by looking at:
cat /proc/sys/net/ipv4/ipfrag_time

You can change the timeout as well:
echo 60 | sudo tee /proc/sys/net/ipv4/ipfrag_time

To make the change permanent, add to your /etc/sysctl.conf (or a new file in /etc/sysctl.d directory) (sudo required to edit these files):
net.ipv4.ipfrag_time = 60

and run sudo sysctl -p to apply the change immediately.


Which download manager is capable of 'throttle' and 'pause & resume' a running instance of download from a script

I'm using JDownloader. However, AFAIK running instance cannot be controlled by command line.

On the other hand, there are add-ons like:
- JD Scheduler or
- JD RemoteControl

which can do a great job.

See:
http://jdownloader.org/home/features
http://jdownloader.org/home/addons

(I guess that there will be more tools, maybe someone else will add another suggestion...)


Kubuntu 16.04 LTS and Phpstorm 2016.3 - Clipboard Issue - cannot paste

I had the same issue while KeePass2 running in mono.

This did trick for me:

sudo apt-get install xsel:i386


Unable to load page using Express from local machine

I am abandoning this issue. All steps followed here.


What User Space tools support Btrfs functionality (e.g. clone instead of copy)

There is timeshift-launcher and snapper-GUI to help you boot into snapshots after a crash. some more tips can be found in the Howto of https://linuxreviews.org/Btrfs


14.04 server, upstart, network interfaces, and frustrated

You could try to start your service daemon adding a script in the folder

/etc/network/if-up.d/

It will run after the network interfaces are up.

Until you solve the problem, if you want to avoid waiting for 60 seconds every time the network interfaces fail, you can edit the sleep lines in the file

/etc/init/failsafe.conf


Ubuntu Installation: Attempt to mount a filesystem with type ext4 in SCSI7 (0,0,0). partition #1 at / failed.

EDIT: MikeD, can you share which version of the kernel worked?
EDIT2: Seems kernel 3.13 works. It would be nice to understand if any newer versions will work.

I don't have a solution yet, but don't have the reputation to comment (so apologies for this being an "answer"). I've fought the same issue on 2 different HP ZBook 14 G2 laptops - each with a Liteon CX1-JB512-HP PCIe SSD. What's even more interesting is that, when trying to format ext4 partitions, gparted somehow screws with the existing Windows/NTFS partitions. There's gotta be something related to this hardware. Fresh installs of Windows 7 work without any issue.


Can't access files on ubuntu from hard drive

Plug the hard drive into a machine that either knows or uses the EXT4 file system.
Pretty sure macOS and other linux ditros can do this.


I came looking for answers because I experienced the same issue. However, following the recommendation by @Terrance to install without sudo fixed the problem. The installation was successful without the usual errors. One more thing happened though. Launching the application from the software center ( or application center ) wasn't successful as the application just didn't start so I resorted to the commandline which gave the following result:

:~$ notepad-plus-plus
You need to connect this snap to the wine-platform snap.

snap disconnect notepad-plus-plus:wine-platform-plug
snap install wine-platform
snap connect notepad-plus-plus:wine-platform-plug wine-platform:wine-base-stable

Remove deprecated wine-platform-i386 snap.

snap remove wine-platform-i386

After these steps were carried out, notepad is now running.

Note: I'm running Ubuntu 18.04


Does Microsoft Office 2010 still have incompatibility issues with LibreOffice

With my personal experience, I say that NO they are not.

A .doc file created in LibreOffice suffers from some changes when it is reopened in MS Office 2010. You will also feel that your header and footer settings are disturbed.

Same in the case of .ppt files.

I prepared a seminar of robotics in LibreOffice and saved it as a .ppt file. But, at the time of presentation my college offered me a Windows computer with MS Office 2010. When I opened the .ppt on Windows, I have to make several changes before presentation such as  page width, table size, heading size and images (specially charts and bars).


Why does WICD work and Network-Manager does not? And why no bluetooth?

WICD is great for WiFi management.  If you chose to stay with WICD, you could use bluez to manage your bluetooth.

sudo apt-get install bluez

You can learn about how to manage connections on the CLI, using bluetoothctl or try out blueman for an easier, GUI experience.

There is a community Bluetooth Doc for other ideas and more details.


Setting the owner of the file created by start-stop-daemon output redirection

Redirections are not part of command line arguments. They are handled separately by the shell, which in your case is run as root. But even if the permissions were correct, this command wouldn't cause the output of the daemon to be appended to the log file.

For illustration, this is what actually happens:

The shell executes start-stop-daemon and redirects its output to solr.log. The file is going to be empty, because this command doesn't output anything (just try running it manually, without redirection).
The start-stop-daemon command processes its arguments and ends up calling /usr/bin/java -jar start.jar. Notice that there is no output redirection there, but the process is forked in the background, so the output ends up in /dev/null.

In other words, the daemon should either accept a log file argument, or you need to create a wrapper script that will handle the redirection. It might look as follows

#/bin/sh
cd /home/phuihock/src/proj/solr
exec /usr/bin/java -jar start.jar >> logs/solr.log


This is very much depending on your hardware, but most probably for notebooks/netbooks: no.

However, it is common to be able to share the physical input jack for both line-in and microphone input modes. Both modes are related to input, usually. On some desktops I've seen the ability to change the output configuration mode from stereo to 6-channel output to configure the three jacks as output.

To see the options for your sound card I know of the following two options:

Install PulseAudio Volume Control  and see what your port options are at the Input Devices tab:

Use the alsamixer from the terminal and select the Mic Jack Mode:

Again, this is very much hardware dependent and based on the information in your question there's no way to tell your hardware has this capability or the one you ask for. Just try to see what your options are.


How to use a regular expression with apt-cache search to find all Wine versuons?

That's not how character classes work, the regex does not differentiate between 26 and 2 followed by 6, so your character class is being interpreted as 1-2 or 5. Also, the . means "match any character", not a literal ., I don't think the apt regex engine allows escaping, so you'd have to use a character class to match it ([.]). Finally, you need to have multiple occurrences of each number, so you need something like:

apt-cache search --names-only wine[0-9]+[.]*[0-9]*

The --names-only ensures that your regex is only matched agaist package names, not descriptions.


if [ ! -d "$DIR/$YESTERDAY" ]; then

This one fails to execute. You are testing if there is NOT a directory.

It should be

if [ -d "$DIR/$YESTERDAY" ]; then


How do I remove all metadata from a quicktime movie file?

Well, I have a command-line answer:

Note: This only works with the ffmpeg included in Ubuntu by default: it will have a version similar to 0.8.1-4:0.8.1-0ubuntu1; it WILL NOT work with any ffmpeg binaries you have installed from a third-party PPA or compiled yourself. Your mileage may vary.

Install these: sudo apt-get install ffmpeg libimage-exiftool-perl
Then navigate to where your source .mov file is, we'll call it test.mov
And run:

ffmpeg -i test.mov -map_metadata -1 -vcodec copy -acodec copy test-nometadata.mov

You can then use exiftool to check that it worked; exiftool test.mov and exiftool test-nometadata.mov should show you the difference.
Here are my sample outputs from an old Nikon .mov with tons of metadata (pastebin'd):

before - 80 metadata lines
after - 52 metadata lines (even the create, modify etc.times have been nulled)

(note that the order in ffmpeg above is essential -- the input and output files must be specified at the very end)


does xfce4 support automatic proxy configuration?

You can set up auto_proxy/AUTO_PROXY variables in /etc/environment like:

auto_proxy="https://someurl.to/your.pac"
AUTO_PROXY="https://someurl.to/your.pac"

and logout/login after that.


How to access MySQL after deleting all MySQL users?

How to restore the root user

Stop MySQL and edit /etc/my.cnf to contain skip_grant_tables:

[mysqld]
skip_grant_tables

Then restart MySQL with /etc/init.d/mysqld restart.

Start the MySQL CLI:

[root@test ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.0.77 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

Then enter the following query (replace NEW_PASSWORD_HERE):

INSERT INTO `mysql`.`user`(`Host`, `User`, `Password`, `Select_priv`, `Insert_priv`, `Update_priv`, `Delete_priv`, `Create_priv`, `Drop_priv`, `Reload_priv`, `Shutdown_priv`, `Process_priv`, `File_priv`, `Grant_priv`, `References_priv`, `Index_priv`, `Alter_priv`, `Show_db_priv`, `Super_priv`, `Create_tmp_table_priv`, `Lock_tables_priv`, `Execute_priv`, `Repl_slave_priv`, `Repl_client_priv`, `Create_view_priv`, `Show_view_priv`, `Create_routine_priv`, `Alter_routine_priv`, `Create_user_priv`, `ssl_type`, `ssl_cipher`, `x509_issuer`, `x509_subject`, `max_questions`, `max_updates`, `max_connections`, `max_user_connections`) VALUES ('%', 'root', PASSWORD('NEW_PASSWORD_HERE'), 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', '', '', '', '', '0', '0', '0', '0');

You now have a working root user.

Restore

Now that you have access to your database, please restore from a backup
(you do have backups, do you?)


awk: pipe output of (conditional) print to gzip

You can pipe to commands in GNU awk's print. From the GNU awk manual:

print items | command

  It is possible to send output to another program through a pipe
  instead of into a file. This redirection opens a pipe to command, and
  writes the values of items through this pipe to another process
  created to execute command.

  The redirection argument command is actually an awk expression. Its
  value is converted to a string whose contents give the shell command
  to be run. For example, the following produces two files, one unsorted
  list of peoples’ names, and one list sorted in reverse alphabetical
  order:

awk '{ print $1 > "names.unsorted"
       command = "sort -r > names.sorted"
       print $1 | command }' mail-list

So:

awk -v varn="$var2" -F, 'FNR == 1 {header = $0;next}
  !seen[$1]++ { print header | "gzip > "output/"varn"_"$1".gz" }
  {print | "gzip > output/"varn"_"$1".gz";}'

For example:

% echo 1 2 | awk '{print $2 | "gzip > "$1".gz"}'
% zcat 1.gz
2


Preparing to replace install-info 4.13a.dfsg.1-10ubuntu4 (using .../install-info_5.1.dfsg.1-3_i386.deb)

Run sudo apt-get install dpkg before running anything else. It seems that the package in question depends on a newer version of dpkg, but doesn't list that dependency.

See http://lists.debian.org/debian-tex-maint/2013/05/msg00373.html for more info.


Get Kingston DataTraveler Locker+ working under Ubuntu 11.10

The Kingston Locker+ G3 can be accessed through linux. Here are two (non-officialy supported by Kingston) methods:

Using a windows virtual machine to un-lock the drive, and then releasing it to the host OS. It works for me with VMware Workstation.
Using the binaries shipped with another Kingston key, namely the "DataTraveler Vault Privacy 3.0". (Works under both x86 and x64 linux system.) Obviously, you would need to carry the binaries on another drive (unless you are able to edit the read-only zone of the stick).


Ubuntu machine connects to an unknown wireless network

Open Network Manager and choose Wireless and select Particular connections and select edit  and uncheck Connect Automatically button and save.

Use this image for reference

Edit:

We have one more solution , Block that SSID

#!/bin/sh

SSID=`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I\
 | grep ' SSID:' | cut -d ':' -f 2 | tr -d ' '`

if [[ $SSID = "RLSPOT001" || "RLAVID001" || "RLSHEE001" || "RLGUES001" || "RLBGAS001" || "BTFON" ]]; then
/usr/sbin/networksetup -setairportpower en1 off
fi

Where RLSPOT001,RLAVID001 are SSID's that you want to block. Is there any way you can figure what SSID you are connecting ?

then above script can  help  if you run at startup.


How can I change the Lock Screen (not Wallpapewaar) background?

Ubuntu 18.04 with Gnome Desktop

please note: this is copied straight from Ubuntu documentation, it's worth a look :)

You can change the image used for your backgrounds or set it to be a solid color.

Open the Activities overview and start typing Background.
Click on Background to open the panel.
Select the Background or Lock Screen.
There are three choices displayed on top:

  Select Wallpapers to use one of the many professional background
  images that ship with GNOME. Some wallpapers change throughout the
  day. These wallpapers have a small clock icon in the bottom-right
  corner.

  Select Pictures to use one of your own photos from your Pictures
  folder. Most photo management applications store photos there. If you
  would like to use an image that is not in your Pictures folder, either
  use Files by right-clicking on the image file and selecting Set as
  Wallpaper, or Image Viewer by opening the image file, clicking the
  menu button in the titlebar and selecting Set as Wallpaper.

Select Colors to just use a flat color.
The settings are applied immediately.

When done, switch to an empty workspace to view your entire desktop.


First I purge the java installer PPA using following commands:

sudo rm oracle-java7-installer*
sudo apt-get purge oracle-java7-installer

Than I signed in to technet.oracle.com using my account ID (registration is free to oracle.com)

I then added the PPA, and this time, it was a success.

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

I was able to successfully download from oracle.com. I guess sign-in worked.

Are PPA's safe to add to my system and what are some "red flags" to watch out for?


Try change release-upgrades file on /etc/update-manager directory, in that file you can use the option to upgrade either to LTS or normal release upgrade:

sudo nano /etc/update-manager/release-upgrades

Change the value of prompt from lts to normal:

# Default behavior for the release upgrader.

[DEFAULT]
# Default prompting behavior, valid options:
#
#  never  - Never check for a new release.
#  normal - Check to see if a new release is available.  If more than one new
#           release is found, the release upgrader will attempt to upgrade to
#           the release that immediately succeeds the currently-running
#           release.
#  lts    - Check to see if a new LTS release is available.  The upgrader
#           will attempt to upgrade to the first LTS release available after
#           the currently-running one.  Note that this option should not be
#           used if the currently-running release is not itself an LTS
#           release, since in that case the upgrader won't be able to
#           determine if a newer release is available.
Prompt=normal

Save the file, then exit.


Is there any comparable (source-based) package management system like ABS on Arch Linux for Ubuntu?

ABS follows many practices pioneered by Debian over 20 years ago.
See https://www.debian.org/doc/manuals/maint-guide/build.en.html for the source build process in Debian-based systems (including Ubuntu).

Folks who enjoy building-from-source can benefit of the whole community. Consider volunteering to be a Debian Package Maintainer. That means you adopt a package (or a dozen) and rebuild it as new source versions and patches appear upstream. Debian (and Ubuntu) are based upon the efforts of these vital volunteers. Start your journey at http://mentors.debian.net.


No microphone in Ubuntu 18.04 on HP elitebook

I have installed dconf-editor and dconf
after start of the gui the search-function is active and you could use the keyboard.
The keyword "volume" drives to a button named "use-mediakeys" on or off?


Let me Google that for you
$ gzip -d this_is_the_file.tar.gz
$ tar -xvf this_is_the_file.tar

These can be combined, but it's probably better to start out with the two commands independently. Put the sudo wherever you need it.

gzip -d ⇢ Decompress
tar -xvf ⇢ Extract, Verbose, File

This should do what you need.


Why can't I log in after upgrading to 13.04?

Try selecting a different window manager from the drop down. If it does not work or you do not have an alternative window manager option try to login on a text base console press ctrl-alt-F1 to get to one, see if that lets you in. If you got in there, sudo su - to root, /etc/init.d/lightdm stop; exit
as the user again try mv .xinitrc .xinitrc.bak; echo xterm >.xinitrc; X
if X starts type in your window manager command eg. metacity see if any hint comes up from command outputs / error messages.

There can be many reasons behind this problem, can be permission issue on files, no valid shell or just some broken X session environment.


For starters you cannot add an event for a team unless you are a member of that team.

The procedure for registering an event is as follows:

Go to http://loco.ubuntu.com/events/
Click on Add Team Event - Login through the LP SSO if you are not already logged in
Submit the details for the new event

You will then have a publishable link to the event detail. You will also find a direct link to the RSVP page in the detail page of the event.


Keep in mind that the forward slash "/" and not the back slash "\" is the character for specifying a directory in Linux.  The backslash is a special character that will give special attributes to the next character that following it.

As far as using the 180G area, you can find a directory that has content that you might want to consider adding a symbolic link to space on the /home partition.

You can check what is using a lot of your space in your /usr partition with this command (or a variation there off):

$ cd /usr
$ du -sh $(ls)

Some of the directories will require elevated access to scan.  You can add sudo to check the size of those folders.

$ sudo du -sh $(ls)

If you have folders that have spaces you can check those folders by temporarily modifying the field separator with this variation of the command.

$ STOREIFS=$IFS && IFS=$(echo -en "\n\b") && sudo du -sh $(ls);IFS=$STOREIFS

Now once you see the folder that is taking up all your space you can move the files to a directory on your /home folder and make a symbolic link to it as such (for instance if /games is the oversize folder).

$ sudo mkdir /home/games
$ sudo cp -pvau /usr/games /home/
$ sudo mv /usr/games /usr/games.old
$ sudo ln -s /home/games /usr/games

Now after you have verified that the new physical location of your /usr/games folder works you can delete the /usr/games.old folder.

I used /usr/games as an example.  You could do that with any folder from the /usr directory.


As I found the answer I realized this question is a duplicate.

To be short: nginx do not require a specific extension for its configuration files, but apache do.

I forgot to suffix the conf file with the *.conf extension, causing the file to not be recognized by apache.

Thanks Henning Kockerbeck, who put me in the right direction.


Installing Ubuntu on Lenovo Ideapad 710S-13ISK

Windows has drivers for AHCI mode disks. The problem is when you enable AHCI, windows doesn't have the driver installed because it was installed in IDE mode, thus can't mount the disk and boot.
You could ask on Superuser about booting windows into safe mode and getting it to install the driver for AHCI, or reinstall Windows in AHCI mode.
You wouldn't be locked out as the new BIOS should allow you to select between IDE and AHCI. But of course it is advisable to backup important data before doing anything to a system.


How to read an output file in one command line?

You should output lshw to a file, and open that file with firefox, as follows:

lshw -html >/tmp/specs.html && firefox /tmp/specs.html

Or

sudo lshw -html >/tmp/specs.html && firefox /tmp/specs.html

Update: Following not uses temp files, but need bcat
Install bcat package:

sudo apt install ruby-bcat

Then the command you want is simple

lshw -html|bcat -b firefox

bcat help output:

  Pipe to browser utility. Read standard input, possibly one or more
  s, and write concatenated / formatted output to browser.


Low Signal Strength of Bluetooth in Ubuntu 18.04

Bluetooth and wifi sometimes have a problem getting along together, as they both use similar frequencies.

A solution is to tell the wifi driver to be bluetooth aware. We do that this way...

In terminal...

sudo -H gedit /etc/modprobe.d/iwlwifi-opt.conf # edit the configuration file

Change this:

options iwlwifi bt_coex_active=N

to this:

options iwlwifi bt_coex_active=Y

Save the file and quit gedit.

Reboot the computer. Retest bluetooth and wifi.


How do I recover a BTRFS partition that will not mount?

Easiest way
btrfs-zero-log /dev/sda5

Your getting that issue because a transaction(write or delete) is stuck in the journal log and the disk doesnt match it.
How it works:
So when data is written 1st its written to journal then to disk (or at same time, but journal just saves metadata about the upcoming write - not sure... need more research on that part)...
Anyhow if you turn off the system in the middle of this write/delete or do something that hickups the system (dismount the USB that holds your btrfs mount point), then when it returns that mount will not work it will fail (dmesg and btrfsck will show you the errors in more detail)...
Looking at dmesg you will see those same transid messages.
You will see something like this:
parent transid verify failed on 109973766144 wanted 1823 found 1821

It means that btrfs wanted transid 1823 (That was on the journal) but on the disk it saw 1821. So the disk was 2 transactions away from being in sync with journal. I personally would risk a brtfs-zero-log here just because its only 2 transactions. But to be 100% safe if this is your only data (by the way if you have critical data you should NEVER EVER have only 1 copy of it, always have a copy/backup in a safe other location - blaming the creators of btrfs wouldnt justify against the persons own lack of responsibility of not having a backup - btrfs is not backup solution, its a filesystem - nothing is a true backup solution besides having a copy of it else where - not even parity or mirrored drives, a true backup is sitting somewhere underground in the Alps while its active copy is in your office in Texas)
parent transid verify failed on 31302336512 wanted 62455 found 62456

Here the journal is wanting 62455 but the disk is one ahead at 62456, so in your case i would just clear the journal. Journal didnt update this time. Again I told you bout being safe thing, if its your only data and its mega critical (shame on you), and I would do the below operations first to be safe.
Running a btrfsck /dev/sda5 (which by the way just does a readonly check so its completely safe, its only btrfsck options that you have to worry about) will also show you those messages.
But beware if that data is critical, i would first do (As the other gents said)
mount -t btrfs -o rootflags=recovery,nospace_cache /dev/sda3 /mnt/sda3

mount -t btrfs -o rootflags=recovery,nospace_cache,clear_cache /dev/sda3 /mnt/sda3

mount -t btrfs -o recovery,nospace_cache,clear_cache /dev/sda3 /mnt/sda3

Then cp or rsync all of your files over to safe location, then when safe do the btrfs-zero-log, if its a successful operation you just wasted alot of time backing up your system (but if its not successful, you just saved your arse)
Then if the mounts failed do a btrfs restore (dump of the system, as I understand its a resumeable operation, however it keeps asking for Y or y every now and again so watch the output)
btrfs restore /dev/sda5 /USB

Then when safe (when btrfs restore is done) do the btrfs-zero-log, if its a successful operation you just wasted alot of time backing up your system (but if its not successful, you just saved your arse)
You can run screen first
screen /bin/bash

btrfs restore /dev/sda5 /USB

SCREEN SIDE NOTE
To detach (command will still run): CONTROL-a then type ":detach" without the quotes then press ENTER
Another way to detach: Then close out of putty or your terminal and it will detach (the command / restore will still run).
To check up on it, just screen back to it:
screen -x

screen -x will attach to sessions, even if detached, and unlike -h says, it will attach even if its already attached as well)
If you have several screens, screen -x will tell you need to be more specific to attach to the session:
screen -ls

ls for list all sessions, easy to remember that.
to see the PID you can also do this:
ps aux | grep screen

Once you find out your PID, then run screen like this:
screen -x PID

That will attach to a specific session. You can have several sessions/puttys attached to the same screen (they will output the same text, you can type commands in one, and they will be mirrored on the other putty)


How can I print sheetnames of a spreadsheet using Linux command-line?

in2csv from the csvkit package provides the --names or -n option for that: [Source]

 -n, --names     Display sheet names from the input Excel file.

In your example the command would be:

in2csv -n file1.xls

This feature was added in csvkit 1.0.2, which is not available from the official package sources for releases older than Bionic. If you’re running Xenial you need to either

compile the program from source or
install it via pip with

sudo pip install csvkit

to get the latest version.


Something is setting an rtc wakealarm. How do I stop it?

My first idea (but unfortunately that does not work):

sudo auditctl -w /sys/class/rtc/rtc0/wakealaram -p w -k rtc_access
sudo auditctl -w /proc/driver/rtc -p w -k rtc_access

The following isn't a specific solution, but a strategy:

The command to set the alarm time, looks like this.

/usr/sbin/rtcwake

To find executable scripts that use this command:

sudo find -L <your_script_folder> -executable -type f | xargs grep rtcwake

But even in these directories it is worth a look:

sudo find -L /usr/bin -executable -type f | xargs grep rtcwake
sudo find -L /usr/local/bin -executable -type f | xargs grep rtcwake
sudo find -L /opt -executable -type f | xargs grep rtcwake

You should also check your startup programs in:

/etc/xdg/autostart
~/.config/autostart

Another place is in crontab

sudo crontab -e
crontab -e

and in

/etc/cron.*


Is it possible to send keys to inactive window via any c/c++ library?

I dig into it a little bit and found about that I can use either "xdotool" command line tool or libxdo (for c++ intergration) for it.


How to confine WINE apps using a chroot jail?

From this answer on Unix.SE

  "chroot jail" is a misnomer [...]

and

  chroot is not intended to force a program to stay in that simulated filesystem; a program that knows it's in a chroot "jail" can fairly easily escape, so you shouldn't use chroot as a security measure to prevent a program from modifying files outside your simulated filesystem

Indeed, it is just a normal chroot with the hope that what you are doing does not get out of it.

If you are still motivated to use it, you can follow the official Ubuntu Documentation on chroot to start understanding and setting it.

And you can then obviously come back to AskUbuntu if you have specific questions. :)


It's ok! is in:

/usr/lib/python2.7/dist-packages/kivy


Unable to access location: Not authorized to perform operation

In my case it was related to chrome remote desktop app. I was logged in as another user. Once i logged out from remote app, i was able to acces the drives


how can i upgrade only jre from 7 to jre 8 on ubuntu 1404

OpenJDK 8 for Trusty isn't available  in the official Ubuntu repositories.
As a workaround, you can install OpenJDK 8 from a PPA.
Open a terminal and execute:

sudo apt-add-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jdk

Or if you only need the JRE

sudo apt-get install openjdk-8-jre

It is usual that several major versions are installed in parallel.

To switch between Java 7 and Java 8 use this command:

sudo update-alternatives --config java