What is the command line equivalent of copying a file to clipboard? What is the command line equivalent to pressing CTRL+C over a file in the file manager so that the file (not the filename) is copied to the clipboard?

A situation where this can be useful and fast, for example, is when you want to copy to the clipboard a file from the directory you are in the terminal to quickly paste the file in the directory you are in the file manager. There are others.

When you press Ctrl-C over a file in the file manager, the file's contents IS NOT copied to the clipboard. A simple test: select a file in file manager, press Ctrl-C, open a text editor, press Ctrl-V. The result is not file's contents but its full path.

In reality the situation is a bit more complicated because you can't do the opposite - copy a list of filenames from a text editor and paste them into file manager.

To copy some data from command line to X11 clipboard you can use xclip command, which can be installed with

sudo apt-get install xclip

to copy contents of a file or output of some command to clipboard use

cat ./myfile.txt|xclip -i

the text can be then pasted somewhere using middle mouse button (this is called "primary selection buffer").

If you want to copy data to the "clipboard" selection, so it can be pasted into an application with Ctrl-V, you can do

cat ./myfile.txt|xclip -i -selection clipboard

To be able to copy files from the command line and paste them in a file manager, you need to specify a correct "target atom" so the file manager recognizes the data in the clipboard, and also provide the data in correct format - luckily, in case of copying files in a file manager it's just a list of absolute filenames, each on a new line, something which is easy to generate using find command:

find ${PWD} -name "*.pdf"| xclip -i -selection clipboard -t text/uri-list

(at least this works for me in KDE). Now you can wrap into a small script which you can call, say, cb:

#!/bin/sh
xclip -i -selection clipboard -t text/uri-list

then you put it in ~/bin, set executable bit on it and use it like this:

find ${PWD} -name "*.txt"| cb

Nice, isn't it?

Mac OS has pbcopy with easier syntax:

pbcopy < ~/.ssh/id_rsa.pub

or

cat ~/.ssh/id_rsa.pub  | pbcopy

To simulate pbcopy on Ubuntu with xclip (installed via sudo apt install xclip):

alias pbcopy='xclip -selection clipboard'
alias pbpaste='xclip -selection clipboard -o'


Install HPLIP-3.17.10 after upgrade to 17.10 After I upgraded from Ubuntu 17.04 to 17.10 I've found it's not possible to install HPLIP-3.17.10

How can I do that?

There are two ways to install hplip:

Download a standalone file like hplip-3.17.10.run and run it in the shell. This method doesn't work for me any more after upgrading to 17.10, so I used the other method which works fine for me
Use the trivial solution sudo apt-get install hplip-gui. This worked fine for me in Artful.

HPLIP should be installed by default. You can try hp-setup -i paste in terminal.


Ubuntu 14.04 installer insists on running in UEFI mode I am trying to dual boot Windows 7 along side Ubuntu 14.04. I have managed to set this up successfully on my old laptop (which only uses Legacy BIOS) using an installation CD and EasyBCD. However when I go to set it up on my newer laptop it insists on running the Ubuntu installer in EUFI mode.

The newer laptop has just had windows 7 installed onto it with the BIOS set to Legacy mode,
when insert the CD and tell the new laptop to boot from that it insists on booting the installer in EUFI mode. (The older laptop was able to run the ubuntu installer fine in Legacy mode.)

If I understand correctly both OS need to be installed in the same mode. My preference would be to use legacy mode as this is the default setting for my laptop and will work with EasyBCD.

I tried installing windows 7 in EUFI mode but the installer couldn't boot properly.

Is it possible to force my laptop to boot the installer using Legacy mode?

How to get your laptop to boot the cd in bios mode is specific to your model of laptop: you will have to read the manual or contact the manufacturer about that.  However, when installing Ubuntu along side an existing bios booting Windows install, it will automatically stick with bios booting even though the installer itself is booted in UEFI mode.


Delete files older than 5 days as well as in all subfolders I need to delete all files older than 5 days in all subfolders, but not the folders themselves. I know the command:

find /path/to/files* -mtime +5 -exec rm {} \;

But how can I tell Ubuntu to check in all subfolders, yet never delete the folders themselves. Will I need a -maxdepth 5 somewhere?

Thanks.

First of all, don't give a glob to find (no files*), just give it the parent directory (/path/to/). It will deal with recursing into it and finding all files. Next, rm will never delete directories, so you don't need to worry about that either. Still, the simplest way is:

find /path/to/ -type f -mtime +5 -delete

Note the -type f which tells find to only look at files and the -delete which, well, deletes them. This is more efficient than calling a separate rm for each result.

You can also use

find /path/to -type f -mtime 5+ -exec rm {} \;


What are some CD Ripping Programs you can use on Ubuntu? What are some CD ripping programs for Ubuntu? Can you list the Pros? What are the Cons? For each program there should be a screenshot, sources to install, and instructions to install and use.

Ubuntu Default CD Ripping Software :

To rip a CD, you will require a suitable CD-ripping application. One is installed by default on Ubuntu, and there are others available through Ubuntu's software channels, as reported in the Ubuntu Documentation.

Sound Juicer

Sound Juicer is Ubuntu's default CD-ripping application, and also has the ability to play your CDs and download track data from the Internet.

To rip a CD using Sound Juicer, simply insert an audio CD; Sound Juicer should start automatically. Alternatively, you can select Sound Juicer from Applications -> Sound & Video -> Audio CD Extractor. By default, the CD will be encoded into the OggVorbis format, a Free Format. If you wish to rip a CD to a non-free format such as MP3 or AAC, you will need to install some additional software.

Kubuntu Default CD Ripping Software :

There are two methods of ripping an Audio CD in a default installation of Kubuntu. One is using Konqueror's audiocd:/ KIO-slave and the other is KaudioCreator (KMenu->Multimedia->KaudioCreator). On inserting the Audio CD, you should be presented with the KDE Audio CD Daemon asking you what you wish to do. To use the KIO-slave method (which is relatively easier), select the 'Open in a new Window' option. Or, if you prefer using KAudioCreator, select the Extract and Encode Audio tracks option.

Using audiocd:/ to rip a CD

In Konqueror's location bar, type audiocd:/ and press enter. You should now see the tracks in the CD along with folders named Ogg Vorbis, FLAC, MP3 etc. Click on the folder which corresponds to the format in which you wish to encode, eg. Ogg Vorbis.

Now, copy the tracks that you need from that folder and paste it in the desired location (/home/kubuntu in the example). The tracks are automagically ripped, encoded and copied to the location you specified!

Note: Copying speeds might not be as fast as those achieved when copying a file directly from the CD as the files are also being ripped and encoded. If you wish to modify some of the settings (like editing the tagging sytax or modifying the encoding settings), you can access it either through System Settings (KMenu->System Settings->Sound and Multimedia->Audio CD) or through KDE Control Center (kcontrol).

Using KAudioCreator

Launch KaudioCreator (Kmenu->Multimedia->KaudioCreator). It should automatically display the tracks in the disc. You can modify the settings to suit your needs (Settings->Configure KaudioCreator), and also choose an encoder. Click on the Rip Selection icon to start the Ripping and encoding process.

Other CD Ripping Software :
In alphabetical order.

ABCDE

Those who want a no-nosense, fast, customizable ripping solution should try ABCDE.

And example conversion from CD to AAC/MP4:

abcde -a cddb,read,encode,tag,move,playlist,clean -d /dev/cdrom -o m4a -V -x

Asunder

Asunder is an easy-to-use, plain CD ripper that converts into MP3, OGG, FLAC, WAV, and the new open codec WavPack. Asunder is in the Ubuntu repository and can be installed with Synaptic or Software Center.

Grip

I have been using Grip until Edgy. It's very easy to use but still very configurable.

Note: Grip is no longer supported by its developers, or by Debian or Ubuntu. It has been removed from the repositories in Ubuntu 9.10.

Ripper X

To install:

sudo apt-get install ripperx

RubyRipper

RubyRipper has been recommended in many forum threads and seems to be one of Linux's best ripping solutions. Also, many feel the closest to EAC in quality of rips.

RubyRipper is not included in the default Ubuntu install and is not included in any of the repositories. Fortunately there is a DEB package available.

To install:

1.Install dependencies by typing in the terminal:

sudo apt-get install cd-discid cdparanoia flac lame mp3gain normalize-audio ruby-gnome2 ruby vorbisgain

2.Download the DEB package from here and follow the instructions.

Alternate install:

Open a terminal window and type:

sudo add-apt-repository ppa:aheck/ppa
sudo apt-get update
sudo apt-get install rubyripper
sudo apt-get install rubyripper-gtk

A good graphical option is xfca, which stands for "X Convert File Audio". The official website is here (in French though).

To install, run:

sudo apt-get install xfca cdparanoia cd-discid

The latter two are needed if one wants to download CD metadata.

The interface is very straightforward, as you can see below:

It also includes a command line option, xcfa_cli, which complete manual can be accessed from man xcfa_cli.

Also, this program integrates with gmusicbrowser, in case you use that music player.


Installing Java on Ubuntu 64 bit I have ubuntu 12.04 LTS version 64 bit . what is the procedure for installing and running Java for development purpose. I am new to Linux and Unix platform. Thanks in advance

On the command line, type:

  $ sudo apt-get install openjdk-7-jre

OR

1) Goto http://www.java.com/en/download/linux_manual.jsp
2) Download the 64-bit package.

Installation:

Change to the directory in which you want to install. Type:

  cd <directory path name>

For example, to install the software in the /usr/java/ directory, Type:

  cd /usr/java/

Note about root access: To install Java in a system-wide location such as /usr/local, you must login as the root user to gain the necessary permissions. If you do not have root access, install Java in your home directory or a subdirectory for which you have write permissions.
Move the .tar.gz archive binary to the current directory.

Unpack the tarball and install Java:

  tar zxvf jre-7u7-linux-x64.tar.gz

The Java files are installed in a directory called jre1.7.0_07 in the current directory. In this example, it is installed in the /usr/java/jre1.7.0_07 directory. When the installation has completed, you will see the word Done.
Delete the .tar.gz file if you want to save disk space.

If you have internet connected then
just do-

sudo apt-get install default-jdk

That will do the work for you...


How to solve my Touchpad problem I use a Asus X550LD laptop. On installing ubuntu or any other linux based ROMs I find that the touchpad doesn't work. The cursor moves towards the left by itself too. I've tried using an external mouse; but that doesn't seem to help.  When I searched about it, I found out that many others also seem to have this problem. Please help.

Try updating drivers.In additional Drivers option.
or download the driver for your touch-pad and install in manually


How to install libqt4-core and libqt4-gui on Ubuntu 16.04 LTS? I upgraded to Ubuntu 16.04 LTS. But the libqt4-core and libqt4-gui packages are missing.

How could I install these packages on 16.04?

These libqt4-core and libqt4-gui packages don't exist anymore in Ubuntu 16.04 LTS and newer. They were dummy packages with dependencies to other packages. The following procedure will modify the Vidyo package so it uses working dependencies.

First make sure that all required libqt4 packages not installed by default are installed:

sudo apt install libqt4-designer libqt4-opengl libqt4-svg libqtgui4 libqtwebkit4

Create a script to modify the dependency defined in the package. Use the videbcontrol script provided here.
Run the script videbcontrol VidyoDesktopInstaller-ubuntu64-TAG_VD_3_6_3_017.deb that will open the dependencies in a vi editor
Replace Depends: libxss1,libaudio2,libasound2,libqt4-gui (>= 4.8.1), libqt4-network with Depends: libxss1,libaudio2,libasound2,libqt4-designer,libqt4-opengl,libqt4-svg,libqtgui4,libqtwebkit4,libqt4-network. This creates a file named VidyoDesktopInstaller-ubuntu64-TAG_VD_3_6_3_017.modified.deb containing the new dependency.

If you don't know vi, once you see the package information

move the cursor using the arrows down to the line starting with Depends:
type the letter i to get into insert mode
copy past (right click) the new line and type return
type escape to leave the insert mode
type dd to delete the old Depends line
type ZZ to save and quit the change (two upper case z)

Install the Vidyo package by executing the command:

sudo apt install VidyoDesktopInstaller-ubuntu64-TAG_VD_3_6_3_017.modified.deb

Enjoy

Linked on Ubuntu section of Launchpad:
https://launchpad.net/ubuntu/xenial/+package/libqt4-core
https://launchpad.net/ubuntu/xenial/+package/libqt4-gui
You can install a .deb (Debian binary package) using dpkg: sudo dpkg -i libqt4-core_4.8.6...ubuntu8_amd64.deb


How to block the desktop background from being changed? Possible Duplicate:
  How to restrict users on changing their wallpapers?

I'm trying to lock the desktop background (So, that it cannot be changed by others) but can not find the way, I got it in 10.04 with "gconf-editor", but now I can not do this in 12.04

Besides the list of solutions which can answer your question which can be found to this similar question.

Another way to achieve that is the following:

Open terminal and login as root:

sudo -i

Type:

chmod 744 /usr/bin/ gnome-appearance-properties

To restore:

chmod 755 /usr/bin/gnome-appearance-properties


How can I show workspace names in unity? I have found that the number of workspaces is read from metacitys configuration which also has workspace names. I want to show them.

This is currently not possible with Unity in 11.04.

To show work space names, you will need to switch to classic mode by logging out and choosing Ubuntu Classic (No Effects) and log back in.  After this, you need to make sure that your preferences for the workspace switcher have the "Show workspace names in switcher" option checked.


403 error after upgrading to apache2.4 After upgrading from Ubuntu 13.04 server, the www pages won't display themselves.

  Error 403 Forbidden You don't have permission to access / on this server.

I've changed access control saves from apache2.2 to apache2.4, but that didn't work. What else could I do?

What happened is that the syntax of the configuration files in apache2.4 have changed.

Source: This has happened to me as well after I upgraded to 13.10

conf.d files

All files that were in /etc/apache2/conf.d should be moved to /etc/apache2/conf-available.

They now work the same way sites and mods work. Just put your conf files in the conf-available folder and enable the one you want with a2enconf <config-file-name>.

Example:

I had a file conf.d/httpd.conf which had the ServerName directive.
To make that work, I had to move it to the conf-available directory and enable it manually.

sudo mv /etc/apache2/conf.d/httpd.conf /etc/apache2/conf-available/httpd.conf
sudo a2enconf httpd

sites files

Previously, files in /etc/apache2/sites-available had no extension. For example /etc/apache2/sites-available/default. Now a .conf extension is required.

Example:

If you had /etc/apache2/sites-available/some-site, in 13.04 you can just enable it using sudo a2ensite some-site. Now it will give you an error saying

  ERROR: Site some-site does not exist!

To fix this, append a .conf to all your config files in sites-available.
You can do the same in sites-enabled, or you can delete all the files and re-enable them each manually.
I recommend doing them manually since you probably need to fix each VHost (next step).

sudo find /etc/apache2/sites-available/ ! -iname '*.conf' -type f -exec mv '{}' '{}'.conf \;

if you decided to do them manually:

sudo rm /etc/apache2/sites-enabled/*
sudo a2ensite your-site-name

Virtual Host directives:

allow/deny vs Require

If you had the following:

<Directory /path/to/your/site/>
    order allow,deny
    allow from all
</Directory>

It should become:

<Directory /path/to/your/site/>
    Require all granted
</Directory>

For more info, check on the comments by DaveRandom on an answer on Stack Overflow.

Simply put, if you upgraded to apache2.4 and kept the old httpd.conf of apache2.2, allow directive should keep working fine. If you upgraded your httpd.conf (which I would suggest), you will get 403 errors until you change the Order/Allow/Deny directives to their equivalent Require.

Directory Options

If you had Directory options, note that they all have to be prepended with a + or - or none of them at all. A mix of both is not allowed:

Example:

This is allowed:

<Directory /path/to/your/site/>
    Options +Indexes +FollowSymLinks -MultiViews
</Directory>

So is this (Note that these examples don't both do the same thing, the previous one disables the MultiViews option, the next one doesn't):

<Directory /path/to/your/site/>
    Options Indexes FollowSymLinks MultiViews
</Directory>

This is no longer allowed:

<Directory /path/to/your/site/>
    Options Indexes FollowSymLinks -MultiViews
</Directory>

Last config option will throw the a syntax error saying:

  Either all Options must start with + or -, or no Option may.

Restart apache

Once everything is done, you need to restart your apache server for the changes to take effect:

 sudo apache2ctl restart

You can find a detailed upgrade guide from 2.2 to 2.4 on the official documentation.

I am serving files from a non-standard directory so to make the upgrade work I had to edit /etc/apache2/apache2.conf and add:

    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted

After this, and the recommended changes above, the 403 error went away.


How to jailbreak iphone 4gs in ubuntu? I'm new to Ubuntu, and I didn't realize how to make it fully friendly with my iPhone 4Gs. How I would load it into my phone without iTunes?

Thanks in advance.

Note: I am using Ubuntu 12.04.

You should first downgrade it. Then try again to jailbreak it..
Good luck..

Here you go chief: http://www.ijailbreak.com/jailbreak/download-absinthe-2-0-ios-5-1-1-untethered-jailbreak-mac-windows/


What's a recommended alternative to Quickbooks pro? I've just installed Ubuntu to replace Windows. I can't seem to find a good alternative to Quickbooks pro to run on Ubuntu. Any help would be appreciated.

There are a variety of alternatives to QuickBooks, if you're looking for a web-based option. Or, as Jackson Doak mentioned, there is GnuCash - open source & desktop. It's a pretty robust accounting software and certainly worth exploring, if you prefer a desktop alternative to QuickBooks.

If you're open to web-based options, then have a look at Wave (completely free), Monchilla or Outright (both free/paid options). QuickBooks does have an online version available and there's Xero also.

It will depend on your accounting needs, as much as your chosen platform. I'm a certified advisor and user of QuickBooks, as well as the web-based software options I listed.

Good luck!

For medium to Large size businesses I'd highly recommend Quasar Accounting http://linuxcanada.com/. The Business I work for is running it. We have 6 branches and they are all connected. I also give support for 3 smaller businesses (Less then 5 employees) that use Quasar. The Single user addition is free and the older versions you can even get GPL licensed source code for. To download visit ftp://linuxcanada.com/pub/Quasar/


How do I move window buttons( close,maximise,minimise) to the right in latest Ubuntu? As the title suggest, I want to ask how do I change the alignment of window buttons. I am currently using Ubuntu 17.04 x64. I searched about the topic a bit in Google, what I found is that it was supported in Ubuntu 16.04 via Unity Tweak Tool, but currently  is no longer supported. So, is there any way to do it??

PS- I'm new to Linux in general,so do excuse me for asking silly questions.

From Ubuntu 14.04 onwards, you can't change the position of the minimise, maximise and close buttons in Unity. It has been hardcoded. Please refer to this bug report. Your best bet would be to use a different desktop manager. I would recommend cinnamon


Kernel panic after Ubuntu update. Possible Duplicate:
  Cannot boot because: Kernel panic - not syncing: Attempted to kill init!

I updated Ubuntu and when I rebooted, it won't boot. I get a black screen with the error Kernel panic - not syncing:Attempted to kill init

I use Ubuntu 12.04, my linux-image is 3.2.0-33-generic-pae,recovery mode goes into the same error (Kernel panic - not syncing:Attempted to kill init) and Ubuntu upgraded my previous linux versions as well and they all go into that same error.

Hi you may load Ubuntu by selecting previous version and than selecting the corresponding kernel in that option. The problem generally arises when you have 64-bit kernel and updating causes a generic-pae 32-bit kernel to apear along with the previous one. Thus causing the problem.

Once you are able to boot, you may remove the generic-pae kernel by the following steps:

sudo update-grub. It will show you grub.cfg file and you can see the two kernels present.
sudo rm /boot/*generic-pae
sudo update-grub

Maybe reinstalling OS is the best (no time consuming) choice on this type of messages.
There is another similar problem: Cannot boot because: Kernel panic - not syncing: Attempted to kill init! fixed with reinstall OS.


How to determine which window manager is running Is there any way (such as a command or environmental variable) to determine what window manager is the one actively running in the current session?

If you have wmctrl installed,  the first line of output from command

wmctrl -m

will show you the name of the window manager.   If you don't have wmctrl installed, use the following command to install it:

sudo apt-get install wmctrl

Note, man wmctrl (that is, the man page for wmctrl) says in part:

  -m  Display information about the window manager ...

On my Ubuntu 11.10 / Linux 3.0.0-14-generic #23-Ubuntu x86_64 / metacity 2.34.1 system, the first line of output from wmctrl -m was:  Name: Metacity
while echo $DESKTOP_SESSION showed ubuntu-2d and echo $XDG_CURRENT_DESKTOP showed Unity.

On a fresh Ubuntu 15.10 install of Ubuntu desktop software on an old laptop, the first line of output from wmctrl -m was: Name: Compiz
while the DESKTOP_SESSION and XDG_CURRENT_DESKTOP values were ubuntu and Unity

Script
The following script resulted as the best answer to a similar question I posted over at unix.se. It also works great with Unity and LXDE.
if [ "$XDG_CURRENT_DESKTOP" = '' ]
then
  desktop=$(echo "$XDG_DATA_DIRS" | sed 's/.*\(xfce\|kde\|gnome\).*/\1/')
else
  desktop=$XDG_CURRENT_DESKTOP
fi

desktop=${desktop,,}  # convert to lower case
echo "$desktop"


android studio question Is this right:
first:

    -sudo apt-get-repository -y ppa:webupd8team/java

    -sudo apt-get update

    -sudo apt-get install -y oracle-java8-installer

than

sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc++6

or

sudo apt-get install lib32stdc++6

For Install Android Studio:

$ sudo add-apt-repository ppa:paolorotolo/android-studio
$ sudo apt-get update
$ sudo apt-get install android-studio

The Github page for that package recommends the following if you can't correctly build a project on Ubuntu amd64:

sudo apt-get install libc6-i386 lib32stdc++6 lib32gcc1 lib32ncurses5 lib32z1 lib32z1-dev


Execute sudo without Password? Inspired by this question....

I am the sole person using my system with 12.04.
Every time I issue a sudo command; the system asks for the user password (which is good in its own way).
However I was thinking; without activating the root account; how can I execute the sudo commands which will not ask for user password to authenticate.

NOTE: I want to execute sudo command without authenticating via password; only when they are executed via terminal.
I don't want to remove this extra layer of security from other functions such a while using 'Ubuntu software center' or executing a bash script by drag-drop something.sh file to the terminal.

You can configure sudo to never ask for your password.

Open a Terminal window and type:

sudo visudo

In the bottom of the file, add the following line:

$USER ALL=(ALL) NOPASSWD: ALL

Where $USER is your username on your system.
Save and close the sudoers file (if you haven't changed your default terminal editor (you'll know if you have), press Ctl + x to exit nano and it'll prompt you to save).

As of Ubuntu 19.04, the file should now look something like

#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults    env_reset
Defaults    mail_badpass
Defaults    secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d

YOUR_USERNAME_HERE ALL=(ALL) NOPASSWD: ALL

After this you can type sudo <whatever you want> in a Terminal window without being prompted for the password.

This only applies, to using the sudo command in the terminal. You'll still be prompted for your password if you (for example) try to install a package from the software center

To never prompt the current user for a password when that user uses sudo run this command:
echo "$USER ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/dont-prompt-$USER-for-sudo-password


cherry st1044 not recognized in ubuntu 12.10 I cannot get Ubuntu 12.10 to recognize my Cherry ST1044 smart terminal reader.  The terminal shows the PCSC software is installed but "no service" is also displayed in the terminal.

The pcscd service is started on demand by systemd. See "pcscd auto start using systemd"
So it is normal if pcscd is NOT started by service pcscd start.

See also "Level 1 smart card support on GNU/Linux" to know how to debug your issue.


Package ‘git’ has no installation candidate? I’m trying to install some dependencies and I get errors. For example, with git, I get “package git has no installation candidate’
With libx11-dev and several other prerequisites, I get “unable to locate package”.

First of all after installation you have to run
sudo apt-get update && sudo dpkg --configure -a

Thi sinitiates your package manager additionaly to keep everything clean
sudo apt-get autoremove && sudo apt-get autoclean

No you are ready to go. start by searching the package you want to install
sudo apt-cache search git

This will bring you the search result and you can do
sudo apt-get install git

If still appears same error then check for content in apt source file probably in /etc/apt/sources.list.d/
However you can always simplify the process by using GUI software called package manager. You can launch that software  by searching in menu.


dsh no tty present and no askpass program specified I'm using the dancers shell to try and run install commands on multiple machines on the network, but whenever I do I get

no tty present and no askpass program specified.

I know that if I use ssh -t for the command, I can avoid this, but is there a way to dsh or ssh to run a command on multiple machines without using the -t command?

Command I'm running:

`dsh -aM -c sudo apt-get install python`

sudo by default will read the password from the attached terminal. Your problem is that there is no terminal attached when it is run from the console.

1 open /etc/sudoers

type sudo vi  /etc/sudoers. This will open your file in edit mode.

2 Add/Modify linux user

Look for the entry for Linux user. Modify as below if found or add a new line.

<USERNAME> ALL=(ALL) NOPASSWD: ALL

3 Save and Exit from edit mode

You can avoid sudo requiring TTY by adding this option Defaults !requiretty in /etc/sudoers file. But if sudo still requires password, than it will not help you, unless you set NOPASSWD to your user. Basically the changes you want can look somehow like this:

Defaults:your_user !requiretty
your_user ALL = NOPASSWD: ALL

Preferred way of editing this file is using visudo, which will check syntax before writing the file back to the disk.


Ubuntu saying No operating system found when installing I have a HP laptop with 500 GB hard disk. When I am trying to install ubuntu in my laptop it is showing that "there is no operating system found in your system do you want to install ?  the whole data will be lost." But I am already using WINDOWS 7. It is not showing the option along with WINDOWS 7. Please give me the solution.

Follow these instructions:

Boot into BIOS
Set the SATA mode to IDE
Set the SATA3 mode to AHCI
Install. You will need to change these settings back when you boot into Windows and vice versa, as Windows cannot boot with these settings.
It is likely the bootloader will not show up, but that can be fixed easily by first typing sudo fdisk -l in a Terminal
Then, run sudo mount /dev/STEP_5_OUTPUT /mnt && sudo grub-install --root-directory=/mnt/ /dev/sda

Now you should be able to boot, but be sure to revert the changes to BIOS to boot Windows and vice versa

Most of the time this happens when you didn't install the bootloader in the correct place during installation or somehow the MBC got corrupted. If you really want to access windows 7 again insert your windows 7 recovery disc. Other than that the only thing you need to do is reinstall ubuntu.


Kubuntu 16.04 lock session Trying to unbind Windows key +L. All my settings within KDE are set to alt+ctl+L to Lock. How do I remove this binding?

Application Menu>System>System Settings>Keyboard & Mouse>Global Keyboard Shortcuts

Source:
https://www.maketecheasier.com/configure-custom-shortcuts-in-kde/

My bad. They actually have removed this capability from KDE.

Please take a look at the following bookmark "kbd-modifying" in the KDE docs:

https://docs.kde.org/stable5/en/applications/fundamentals/kbd.html#kbd-modifying


Restore the Ctrl + Alt + Num Pad 4 and 6 window positioning commands? Using Unity in Ubuntu 12.04, the Ctrl+Alt+Num Pad combination for positioning windows no longer works completely consistently:

Ctrl+Alt+4 (move window to left half of screen) was changed to Ctrl+Super+Left Arrow.
A similar change moved Ctrl+Alt+6 to Ctrl+Super+Right Arrow.

So in 12.04 one moves windows to corners using Ctrl+Alt combos, but Super combos are needed to move to the left or right.

This is more than a convenience problem since the new windows positioning provided by the super key combos seems to give different sizes than the Ctrl+Alt combos they replaced, leading to distracting gaps between windows when you combine the two methods to position three or more windows on one screen.

Is there a way to restore the previous behaviour so that I can use Ctrl+Alt+Num Pad for all window positioning?

Install compizconfig-settings-manager . Search for "compiz" in the Unity Dash, or start with ccsm from the commandline.

Warning
CompizConfig Settings Manager (ccsm) is an advanced tool, and not all of its options are completely compatible with Unity.
As such, CCSM has been known to sometimes break users'
desktops. Please use caution and
know that you are taking a risk by following this answer or any other
answer that recommends the use of CCSM. In the event that following
this advice does break Unity, please see this
question for instructions on how
to reset it.

Find the Grid plugin:

Click on the key binding you want to change, click on Grab key combination, and press the keys you'd like to use.

Have you tried to run a command in the command dash?

Press Alt+F2 and type in following:

unity --reset


What does this mean "You don't have permissions for /dev/ttyACM1 device!"? I have been trying to connect my Nokia E65 phone to my Ubuntu 12.04 via wammu. I tried the option of "Automatically Search The Phone". But I get the error messages like this in the screen:

Wammu is now searching for phone:
You don't have permissions for /dev/ttyS0 device!
You don't have permissions for /dev/ttyS1 device!
You don't have permissions for /dev/ttyS2 device!
You don't have permissions for /dev/ttyS3 device!
You don't have permissions for /dev/ttyS4 device!
You don't have permissions for /dev/ttyS5 device!
You don't have permissions for /dev/ttyS6 device!
You don't have permissions for /dev/ttyS7 device!
You don't have permissions for /dev/ttyS8 device!
You don't have permissions for /dev/ttyS9 device!
You don't have permissions for /dev/ttyS10 device!
You don't have permissions for /dev/ttyS11 device!
You don't have permissions for /dev/ttyS12 device!
You don't have permissions for /dev/ttyS13 device!
You don't have permissions for /dev/ttyS14 device!
You don't have permissions for /dev/ttyS15 device!
You don't have permissions for /dev/ttyS16 device!
You don't have permissions for /dev/ttyS17 device!
You don't have permissions for /dev/ttyS18 device!
You don't have permissions for /dev/ttyS19 device!
You don't have permissions for /dev/ttyACM0 device!
You don't have permissions for /dev/ttyACM1 device!
Discovering Bluetooth devices using PyBluez
Could not access Bluetooth subsystem (error accessing bluetooth device)
All finished, found 0 phones
No phone has been found!

What does this mean? How to overcome this error?

Thanks in advance.

This means that your user don't have permissions to access to /dev (devices).

Try: sudo wammu

to gain permissions to access to devices

Another thing you can do is to put your user in bluetooth group system

Change the device port permission to:

chmod a+rw /dev/ttyXXX


Is there a way to access the WiFi connection through the shell? Is there any way of seeing/manipulating connection represented by the WiFi symbol on the desktop?

For example, programmatically connecting and disconnecting to a router.

Yes, you can do it using nmcli command.

For example, you can turn Wi-Fi off by running

nmcli nm wifi off

You can turn it on by

nmcli nm wifi on

Other options of this command can be seen by running

man nmcli

If you need more advanced options, you can use directly via intefaces. There is great tutorial on Debian Wiki (https://wiki.debian.org/WiFi/HowToUse#Command_Line). Warning: There is a bug, network-manager in gnome-shell (i don't know if it happens in Unity) does not recognize any interface set directly via /etc/interfaces.


old inscape version on 17.04 How can I install the old version of Inkscape (0.91) on a new system (17.04 Zesty Zepus)? The system came with the new version (0.92) which I removed via Synaptic and now I don't know how to add the 0.91 one. Any help greatly appreciated.

Inkscape-0.91: You can get a package with a fake name, inkscape_0.92.1-10ubuntu17_amd64.deb → To prevent any automatic update from installing a new version.

dpkg -s inkscape will report: Version 0.92.1 ... ... Description: Inkscape 0.91

Download link https://drive.google.com/file/d/0B7S255p3kFXNMDVycFMzeGtmLTA/view?usp=sharing The package provides /usr/local/bin/{inkscape, inkview}.

The package was compiled and built with Ubuntu 17.04 .


Wireless mouse not working in 14.04 I have a HP X3500 Wireless mouse. Ubuntu 14.04
My problem is, that the mouse isn't responding.

if I issue lsusb -

Bus 002 Device 010: ID 3938:1031
Bus 002 Device 004: ID 04f2:b1c1 Chicony Electronics Co., Ltd
Bus 002 Device 013: ID 04b3:310b IBM Corp. Red Wheel Mouse
Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0489:e00d Foxconn / Hon Hai Broadcom Bluetooth 2.1 Device
Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

(red wheel mouse is a wired mouse that I am using and when I unplug dongle the Bus 002 Device 010 disappears)
 .
Things I have tried so far:

Trying it in each USB port: no effect
Trying it on an other computer: working
Changing batteries: no effect

Output of modprobe -r usbhid is:

modprobe: ERROR: ../libkmod/libkmod-module.c:769 kmod_module_remove_module() could not remove 'usbhid': Operation not permitted

Here is what I did and not sure how, but it worked:

Restarted the system.
Connected a wired usb (my phone) to port.
lsusb - recognosed it.
unpluged phone and connected the mouse.
Ran lsusb again. mouse recognised and working again.

In order for you to use modprobe, you will need to be either the root user or use sudo.

so..

sudo modprobe -r usbhid


What are some good applications for creating lecture-like videos? I want to make videos like the ones in this YouTube playlist.

Where I can write stuff and talk about stuff at the same time.

My first instinct was to shop around for a pen-tablet I can use to do the writing, but then I realized I didn't know what kind of software I would need to make "pen-tablet videos" and whether such software would be compatible with the specific pen-tablet I would buy.

So those of you who know how this could be done on Ubuntu, what are the (software and compatible hardware) tools I would need to make videos like that?

Vokoscreen: A new screen casting tool for Linux

 sudo add-apt-repository ppa:vokoscreen-dev/vokoscreen
 sudo apt-get update
 sudo apt-get install vokoscreen

For More HELP

Istanbul Desktop Seasson Recorder is a good on of good screen capture

download it from here


How could one really get sensitive information from a swap partition? When I google this question, I only get all sort of information on how to protect sensitive data, how to encrypt swap, and how "dangerous" could be to keep a "normal" swap in a linux system.

But I couldn't find any software, method or "how to" in order to really get (read) any piece of data from a swap partition.

So my question is, being a "normal" citizen living in western Europe, is it really necessary to wipe or encrypt the swap on my computer? And before someone answer "yes", can I have an exemple on how I could test, and leak out my own swap, so that I can actually see what kind of data is unprotected despite my encrypted home?

being a "normal" citizen living in western Europe, is it really
  necessary to wipe or encrypt the swap on my computer?

It is a personal judgement, one that depends on how much you value the privacy of your data, and how much you wish to protect your data from being exposed if it were to fall into the hands of an attacker. Suppose you have a laptop, and one day it gets stolen - how likely is that a thief would try to extract passwords or encryption keys or otherwise private data, and do you care? A lot of people do not care, but some do. Admittedly, most thieves would simply sell the laptop for immediate financial gain, but there are cases where an attacker might be motivated to go further in attempting to access the data itself.

  And before
  someone answer "yes", can I have an exemple on how I could test, and
  leak out my own swap, so that I can actually see what kind of data is
  unprotected despite my encrypted home?

The memory of any process could potentially be swapped out to the swap space. Leaking memory can be dangerous - the obvious example being Heartbleed - see How I used Heartbleed to steal a site’s private crypto key. The memory that is exposed by Heartbleed only belongs to one single process, whereas the memory potentially exposed by your swap space belongs to every process. Imagine a process containing a private key, or password list (eg. web browser) being swapped out - those items will appear, in plaintext, in the swap space. Extracting them is a matter of sifting through the memory for particular patterns of data - it could be plaintext ASCII data visible through strings, or it could be more involved, as in Heartbleed (where the test is that some consecutive bytes are a divisor of the public crypto key). If you have an encrypted /home partition, then the obvious thing to look for is a block of data that forms the encryption key that will unlock the user's data.

A working example:

do bash -c 'echo SECRET=PASSWORD > /dev/null; sleep 1000' to create a bash process with some secret data on its stack
do sysctl vm.swappiness=100 to increase swappiness (not necessary, but may make the example easier)
run top -c, press f, enable the SWAP column, press q to go back to top process view, scroll down until you see the bash -c process
in another terminal, save Chimnay Kanchi's program from Linux: How to put a load on system memory? to usemem.c, compile it gcc -o usemem usemem.c, and run usemem & repeatedly in a terminal. This will use up 512MB blocks of memory at a time. (It does not matter what causes the memory to get swapped out, it could be normal system usage, a run away process, or a deliberate attack, the end result is the same)
watch top, wait for bash -c to get swapped (SWAP column value > 0)
now run strings /dev/sdaX | grep SECRET where X is your swap parititon
Congratulations - you just extracted "secret" data from the swap partition. you will see multiple copies of the SECRET text followed by the "password", the copies that include the full command line leaked from the parent bash process, top process, and the 'bash -c' process. The lines that do not include the full command line have leaked from the 'bash -c' process.
To prove that secrets leak from process memory, and not just the command line, add the line unsigned char secret[] = "SECRET=XXXX"; to usemem.c (just below the unsigned long mem; line). Recompile and run usemem & repeatedly, and strings /dev/sdaX | grep SECRET again. This time you will see the 'XXXX' secret being leaked.

This question leads us to a discussion of issues between software development, such as software keep the sensitive data in memory and data encryption.

So to begin you should read some articles of practical software development and data encryption.

Start to read this article:
http://www.ibm.com/developerworks/library/s-data.html?n-s-311

Hope it helps.


What does 2>/dev/null mean? I would like a brief explanation of the following command line:

grep -i 'abc' content 2>/dev/null

The > operator redirects the output usually to a file but it can be to a device.  You can also use >> to append.
If you don't specify a number then the standard output stream is assumed, but you can also redirect errors:
> file redirects stdout to file
1> file redirects stdout to file
2> file redirects stderr to file
&> file redirects stdout and stderr to file
> file 2>&1 redirects stdout and stderr to file
/dev/null is the null device it takes any input you want and throws it away. It can be used to suppress any output.
Note that > file 2>&1 is an older syntax which still works, &> file is neater, but would not have worked on older systems.

First we need to talk about > operator. It redirect the output of left of symbol to right of symbol.

So it must thought as :

  source_command > target_file

Other things that we must know

0 means stdin
1 means stdout(useful output)
2 means stderr(error message output)

As default, it works as command 1 > target_file

As to /dev/null --> it is a special file that discards channel output redirect to it.

So in your question it means

  Run the command and do not show me the error messages, discard them.


Swap on Ubuntu: No primary partition I am running Ubuntu 13.10 64bit on a system with 4GB RAM, dual booting with Windows

Most people say that it is good to have swap on a system, and results in speed, so I used it with my previous Ubuntu installations.

In my new HDD, I use 3 primary partitions: 1 for Windows OS(ntfs), 1 for Ubuntu(ext4) and 1 for data(ntfs). I did this so that any crashes in an OS would not cause data loss

The windows system also took up one primary partition for system, and I have only 4 MBR slots. Effectively I have no primary partition for SWAP. I do not know it happened earlier, but back then I had a partition for swap as well

My CURRENT disk partitioning looks like this: http://imgur.com/YMTr879

How can I create swap in my current setup?

First, swap space doesn't generally result in significant speed increases. Swap space is used when RAM fills up, so it enables you to run more programs in a limited amount of RAM. Because disk access is slower than RAM access, by the time you need swap for this purpose, your system's speed will start to decline. Swap space is also used by suspend-to-disk operations, and for that purpose, you need at least as much swap space as you've got RAM. (That said, because Linux uses RAM for disk caches, putting little-used data in swap space can result in more disk-cache use, which can increase speed just a little, so there can be some speed benefit to having swap. I don't have any benchmark data handy, but AFAIK this effect is usually pretty small.)

Second, you can convert partitions from primary to logical form with my FixParts program, which is part of the gdisk package in Ubuntu. See the FixParts Web page for more information and documentation. You may need to resize at least one partition using GParted to make this conversion, but you'd need to do this to create new partitions anyhow, so that's probably not too big a hurdle.

Finally, the 4-primary-partition limit applies to the older Master Boot Record (MBR) partitioning system. The newer GUID Partition Table (GPT) system has a limit of 128 partitions by default, and that value can be raised. GPT doesn't use extended or logical partitions. My hunch is that you're using MBR, since if your computer is booting Windows from the disk you show, it would need an EFI System Partition (ESP) to boot from a GPT disk, and your screen shot shows no hint of such a partition. Thus, I don't think that this paragraph really applies to you. I mention it on the off chance that your screen shot is incomplete or misleading, and for the benefit of other readers with a similar question who might be using GPT.

You can check this link: https://askubuntu.com/questions/9092/importance-of-swap-partition

And This:  https://help.ubuntu.com/community/SwapFaq

Best Wishes :)


Geany permission denied I wanted to run a small test program, but if I execute it the terminal says:

./geany_run_script.sh: 5: ./geany_run_script.sh: ./main: Permission denied

------------------
(program exited with code: 126)
Press return to continue

You call in your script another file/script - ./main. Be sure that you have permission to execute that file (in fact this is saying that exit code: 126). To do this, run the following command:

chmod +x /path/to/main

All I need to to solve Geany permission denied error is to specify the extension of the file that I need to execute in my case I want to execute python programming file e.g. *.py then I save it .py and execute the file by press F5 the permission denied gone.


Upgraded To 18.04 -> USB Harddrive doesn’t idle anymore I upgraded my Homeserver from 16.04 LTS to 18.04 LTS and sadly my backup harddrive attached through USB doesn’t get into idle mode anymore.
This harddrive is just used to backup every night so it should idle/suspend the whole day...

hdparm output:

$ sudo hdparm -y /dev/sda
/dev/sda:
 issuing standby command
SG_IO: bad/missing sense data, sb[]:  70 00 01 00 00 00 00 0a 00 00 00 00 00 1d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Any suggestions? On 16.04 it was just working out of the box.

Thanks

looks like autosuspend has not been installed

sudo apt-get install autosuspend


How to print the directory tree in terminal What is the command that can be used to draw the directory tree inside the terminal emulator?

You can use tree to print the directory tree in terminal. Install tree from terminal,

sudo apt-get install tree

To see the directory tree, use

tree /path/to/folder

Or navigate to a directory and just use

tree

It has some advanced options too. You can see owner's username, groupname, date of last modification of a file/folder and so on using tree. It supports directory colors of ls so you can see colourized outputs.

See man tree for more.

There is a program called tree which lists directory content in a tree structure.

I think it's in the repositories (or even installed)

sudo apt install tree

tree -d /path/to/directory

Check this link for more.


What is the "show desktop" keyboard shortcut? I just upgraded to 11.10 from 11.04. Previously the shortcut to show the desktop was Super +D (same as in Windows), But now it is not working. What is the new shortcut?

For 11.10 and 12.10

Control-Alt-D shows the desktop for me

For 12.04 and up

Control-Super-D works for me

What are Unity's keyboard and mouse shortcuts?

In Settings, select keyboard then go to shortcut tab -> navigation -> Hide all normal windows -> click on predefined shortcut and press your preferred combination of keys such as Super and D.


How do I permanently enable mobile broadband on boot? I would like to permanently check "Enable mobile broadband" so I don't have to check it after every boot.

This problem is subject to a bug-report

Thus, until it is resolved upstream, a work around such as enabling mobile broadband on login will probably have to suffice.

Credit for the answer below goes to one of the bug contributors - if you have any additional information, add your details to the bug-report.  Note - the subscribers dont like "me too" answers so dont just add "me too" - just click the subscribe button for updates.

Enable your broadband by clicking "enable broadband" in the network manager indicator.

In a terminal list the configured connections in your Network Manager:

nmcli con list

This show show the following example output:

NAME UUID TYPE TIMESTAMP-REAL
Tele2 Default 1 93c93207-adce-40e4-beb5-d9f9c830d474 gsm Sat 25 Feb 2012 01:27:42 PM CET
Vipnet connection 1 054bdd1f-34e3-4db1-b18b-d38e885276c8 gsm never

In the example look for your mobile broadband - it will have gsm in the line of text.  In the example above, the first item in a row contains the gsm text and at the beginning of the line is the connection name that you will need below i.e. Tele2 Default 1

Now, create a text file (for example using gedit) that starts one of your connections after a delay of e.g. 10 seconds (maybe you'll need a longer delay if your broadband device needs more time to initialize):

#!/bin/sh
sleep 10
nmcli nm wwan on
nmcli con up id "Tele2 Default 1"

i.e. change Tele2 Default 1 for your mobile broadband name

Save the file as start_my_connection in your home folder.

Next move this file to somewhere you and others using your computer can access:

sudo mv ~/start_my_connection /usr/local/bin/start_my_connection

set the file permissions as follows:

sudo chmod 775 /usr/local/bin/start_my_connection

Finally, configure starting the script after login:

in Startup Applications Preferences add an item and enter the script path (/usr/local/bin/start_my_connection) as the program command.


Can I upgrade my ubuntu version and change to be primary OS after originally installing with Wibu? I have recently installed Ubuntu 12.04 using Wubi 12.04 and I now wish to upgrade to a full installation of Ubuntu 14.04, Before attempting to upgrade through the update center I did some research on upgrading from a Wubi installation (alongside windows) to a full installation making Ubuntu primary and only OS and found that it is in fact doable through the update center however it is just highly recommended to perform a full backup before doing so. I have now finished backing up all the data I need to worry about and began the upgrade process through the update center and received the following error:

Your graphics hardware may not be fully supported in Ubuntu 14.04.

Running the 'unity' desktop environment is not fully supported by your graphics hardware. You will maybe end up in a very slow environment after the upgrade. Our advice is to keep the LTS version for now. For more information see https://wiki.ubuntu.com/X/Bugs/UpdateManagerWarningForUnity3D Do you still want to continue with the upgrade?

My questions are as follows: A. Isnt 14.04 a LTS version??? B, What are your recomendations in order to ensure my graphics driver is installed correctly and im not stuck with bad configs/install?

When it comes to the error it is saying that 14.04, although an lts release, does not have unity2d as you are probably using on your current computer with 12.04, and would have to try and run a full unity3d environment with software acceleration instead of hardware. What are your computer's specs? Also to make it a primary installation you can download boot-repair (google it for instructions on doing so) and elect to install it in the mbr of your drive, then update grub. It will most likely have ubuntu as the default boot option and may even have an option to boot windows below it. If you want to just use ubuntu after that, just delete the windows partition (after backing up everything you want to save) then run sudo update-grub /dev/sd<letter of the primary drive, not a subpartition> then resize the ubuntu partition(s) CAREFULLY with gparted to take up the full disk.


How to save GNOME Terminal contents with ANSI escape codes? VT100 terminals have a relatively simple way to save terminal contents with escape codes to a file using Meta-p:

XTerm.VT100.printAttributes: 2
XTerm.VT100.printerCommand: cat - > file
XTerm.VT100.translations: #override Meta <KeyPress> P: print() \n

I've looked around quite a bit, and can't find a solution for this to work in the default GNOME Terminal + XTerm + Bash.

I do not want just an image with the contents of the window.

It looks like GNOME Terminal might eventually get a fix for this, but there's no information about which version it will be included in, and it's been almost three years since the last update...

Unfortunately, l0b0 the answer out of the box is: This is not possible.

There are two ways you can attempt to rectify this, by running script at all times on your terminal and logging all output. Open up gnome-terminal, go to Edit->Profile Preferences, then the tab Title and Command and for your custom command use this:

bash -l -c 'script -q -c bash $HOME/sessionlogs/$BASHPID.sessionlog.$(date +%Y%m%d-%H%M).txt'

Make sure 'sessionlogs' exists under $HOME.

The other way has been removed and added as a second answer on this question.

Hm, this will not copy the escape codes, but just to grab the text, you can go to menu Edit -> Select All, then press CtrlShiftC and either (i) paste the clipboard to an editor or (ii) type cat > filename and press CtrlShiftV.


How to install termite I'm using openbox on UbuntuGnome .. if that helps.

So I reviewed the documentation located here:

https://wiki.archlinux.org/index.php/Termite

and I can't figure out how to install it.
I'm very novice and would just like a simple explanation is possible, or at least a nudge in the right direction.

I also followed the instructions here:
https://github.com/thestinger/termite

Did the following:

git clone --recursive https://github.com/thestinger/termite.git
cd termite && make

then get this:

ask@ubuntu:~/termite$ make
Package gtk+-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk+-3.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk+-3.0' found
Package vte-2.91 was not found in the pkg-config search path.
Perhaps you should add the directory containing `vte-2.91.pc'
to the PKG_CONFIG_PATH environment variable
No package 'vte-2.91' found
Package gtk+-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk+-3.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk+-3.0' found
Package vte-2.91 was not found in the pkg-config search path.
Perhaps you should add the directory containing `vte-2.91.pc'
to the PKG_CONFIG_PATH environment variable
No package 'vte-2.91' found
g++ -std=c++11 -O3 -Wall -Wextra -pedantic -Winit-self -Wshadow -Wformat=2 -Wmissing-declarations -Wstrict-overflow=5 -Wcast-align -Wconversion -Wunused-macros -Wwrite-strings -DNDEBUG -D_POSIX_C_SOURCE=200809L -DTERMITE_VERSION=\"v11\"   -Wno-missing-field-initializers -s -Wl,--as-needed  termite.cc  -o termite
termite.cc:31:21: fatal error: gtk/gtk.h: No such file or directory
compilation terminated.
Makefile:36: recipe for target 'termite' failed
make: *** [termite] Error 1

Over here is an install script, that nicely explains all dependencies and stuff, I'll just copy that for you ;)

Install dependencies

sudo apt install -y g++ libgtk-3-dev gtk-doc-tools gnutls-bin \
    valac intltool libpcre2-dev libglib3.0-cil-dev libgnutls28-dev \
    libgirepository1.0-dev libxml2-utils gperf build-essential

Get and install vte-ng

git clone https://github.com/thestinger/vte-ng.git
echo export LIBRARY_PATH="/usr/include/gtk-3.0:$LIBRARY_PATH"
cd vte-ng && ./autogen.sh && make && sudo make install
cd ..

Get and install termite, and setup

git clone --recursive https://github.com/thestinger/termite.git
cd termite && make && sudo make install
sudo ldconfig
sudo mkdir -p /lib/terminfo/x
sudo ln -s /usr/local/share/terminfo/x/xterm-termite /lib/terminfo/x/xterm-termite

Voila, this should be it ....

An easy viable alternative would be to install terminator which is easily available for all currently supported versions of Ubuntu

This is a very simple 2 step process.

1) Enable the universe repository

2) install terminator either through the Ubuntu software center or via the command line in a terminal with the command sudo apt-get install terminator

This might be a better choice as some say that terminator is superior because it can seperate the terminal window into several areas and you can re-size them as needed. Multiple windows and tabs are also supported.

Sources:

Experience

https://www.slant.co/versus/2444/2462/~terminator_vs_termite


Signing Module on Non-UEFI Boards I am on Ubuntu 16.04 with the 4.4.0-57 kernel and I want to install a self-made module. The BIOS is a non UEFI BIOS (Kontron 986LCD-M/mITX).

I tried to sign the module by following this procedure but the result of step 3 (sudo mokutil --import MOK.der) is EFI variables are not supported on this system.

I tried to follow this recipe but I cannot find the public keys.

How can I sign a module on a non UEFI board?

====================================================

Update 1:
It seems to be a fairy tale that only modules running with a UEFI Bios have to use signed modules under 16.04:

I use as grub option: `GRUB_CMDLINE_LINUX=" acpi_enforce_resources=lax"`.

I get the error `module verification failed: signature and/or required key missing - tainting kernel` in dmesg if I try to load a module via modprobe.

`sudo mokutil --disable-validation` returns the error `EFI variables are not supported on this system`

================ Update 1 ===================================================

I am sorry but this statement is wrong:

  The procedure to which you refer describes disabling Secure Boot
  validation, not signing modules. There's no need to sign kernel
  modules on non-UEFI systems, since Secure Boot is exclusively a UEFI
  feature.

The kernel should work in this way it doesn't. I experiance it because I get always the error message I get the error module verification failed: signature and/or required key missing - tainting kernel in dmesg and the kernel is not loaded.

================ Update 2 ===================================================
How can I install shim on a non uefi motherboard:

# aptitude search shim
p   grub-splashimages                                   - a collection of great GRUB splashimages
p   grub2-splashimages                                  - a collection of great GRUB2 splashimages
p   libjs-es5-shim                                      - ECMAScript 5 compat. shims for old JavaScript engines (library
p   libjs-es6-shim                                      - ECMAScript 6 compat. shims for legacy JavaScript engines (libr
p   node-es5-shim                                       - ECMAScript 5 compat. shims for old JavaScript engines (Node.js
p   node-es6-shim                                       - ECMAScript 6 compat. shims for legacy JavaScript engines (Node
p   olpc-kbdshim                                        - Dienst zur OLPC-XO-Tastaturunterstützung
v   olpc-kbdshim-common                                 -
v   olpc-kdbshim-hal                                    -
p   ruby-launchy-shim                                   - helper class for launching a web browser
p   shimmer-themes                                      - Gtk+ themes from Shimmer Project
p   shimmer-wallpapers                                  - Wallpapers from Shimmer Project
p   systemd-shim                                        - shim für systemd
p   yoshimi                                             - Software-Synthesizer, basiert auf ZynAddSubFX
p   yoshimi-data                                        - Voreinstellungen für Yoshimi

Is systemd-shim correct? I believe that it will not work because it is a non-uefi MB...

It is a huge bug in Ubuntu. mokutil and MokManager can only sign your own modules if you have MB which support uefi. Older MB under Ubuntu 16.04 which do not support uefi cannot sign modules with mokutil and MokManager. You will get always a responds like EFI variables are not supported on this system or similar.

It is claimed that the signing is just enabled by the kernel for uefi MB. I'm sorry but this is wrong. This is also shown e.g. by these kernel parameter:

CONFIG_MODULE_SIG=y
CONFIG_MODULE_SIG_ALL=y
CONFIG_MODULE_SIG_UEFI=y
CONFIG_MODULE_SIG_SHA512=y
CONFIG_MODULE_SIG_HASH="sha512"
CONFIG_EFI_SECURE_BOOT_SIG_ENFORCE=y
CONFIG_MODULE_SIG_KEY="certs/signing_key.pem"
CONFIG_CHECK_SIGNATURE=y
CONFIG_SIGNATURE=y

As I said this are the kernel parameter for a non uefi MB which don’t make sense, especially CONFIG_MODULE_SIG_UEFI=y.

You have to recompile the kernel and switch off the signing options. They can be found by grep -v ^# /boot/config-$(uname -r) | grep _SIG. Especially CONFIG_MODULE_SIG and CONFIG_MODULE_SIG_ALL should be set to n. However, this has a clear disadvantage because you have to put the kernel update on hold and you’ll have to recompile every new kernel. It’s frustrating.

The procedure to which you refer describes disabling Secure Boot validation, not signing modules. There's no need to sign kernel modules on non-UEFI systems, since Secure Boot is exclusively a UEFI feature.

That said, if you did want to sign kernel modules on a non-UEFI system, you should be able to do so. (I've not tried it, but AFAIK all the tools are Linux userspace tools that do not rely on Secure Boot being available or active.) You might do this if you wanted to build a package with signed modules for installation on other systems. Note that you'll need to install your own keys on the target systems, which can be tedious; see below for pointers. To sign kernel modules:

Create a set of signing keys. This is a complex task. I recommend you read my page on Secure Boot for information on creating signing keys.
Locate the sign-file binary. This binary is not normally installed where Linux binaries are installed; instead, it comes with kernel headers. The command find /usr/src/ -name sign-file should locate it if it's installed on your system. If this command returns nothing, you must install a kernel headers package.
Sign the binary with a command like /path/to/sign-file sha256 /key/path/your.key /key/path/your.cer /path/to/module/module.ko

At this point, the binary module.ko will be signed with your key (your.key and your.cer). To be used, your key must be registered with the target system, presumably in the MOK list. To do this, you must install it with MokManager.efi, as detailed on my Secure Boot page.

I'd like to emphasize again, though, that signing kernel modules is not necessary except on systems that are booting in UEFI mode with Secure Boot active -- and even then, it's necessary only for third-party or locally-compiled kernel modules, such as commercial video drivers or the VirtualBox kernel modules. Most of the kernel modules provided with the Ubuntu kernel are already signed with the same Canonical key that's used to sign GRUB and the main Ubuntu kernel file.


How to move all files in current folder to subfolder? I am at the path:

/myuser/downloads/

And I create a sub folder:

/myuser/downloads/new

Now I want to move all files and folders/sub-folders in the downloads folder to the sub-folder.

how can I do this?

I tried:

mv -R *.* new/

But move doesn't take the -R switch it seems.

The command

mv !(new) new

should do the trick. If it doesn't work, run shopt -s extglob first.

To also move hidden files/directories (that beginning with a dot), run also shopt -s dotglob first.
So, to sum up:

shopt -s extglob dotglob
mv !(new) new
shopt -u dotglob

(it is always better to unset dotglob to avoid bad surprises).

If you want to move all the files from a folder to one of its subfolders you can use the following command:

find /myuser/downloads/ -type d -name 'new' -prune -type f | xargs mv -t /myuser/downloads/new

It will find all the files and then move them to your subfolder.

@waltinator: added -type d -name 'new' -prune to prevent traversal of /myuser/downloads/new.


VNC grey screen and start on boot 12.04 I have 12.04 LTS installed and I am trying to get VNC to work. I want to be able to connect to existing sessions, and have it start on boot. I followed this guide and have left a comment to try and fix my problems but no dice. I have also tried all solutions I have found on google, including the one here, but I could not get it to work (I am missing something easy I am sure).

When I connect to the VNC session I get a grey screen with three checkboxes:

Accept clipboard from viewers
Send clipboard to viewers
Send primary selection to viewers

Here is my xstartup:

#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc
gnome-session -session=gnome-classic &

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &

I have also edited my to include:

/usr/bin/vncserver -geometry 1024x768

It does not start on boot, but when I run the command it starts, but I get the grey screen.

Check for solution on this link

Alternatively you can edit xstartup file located in your home folder by running sudo vi .vnc/xstartup from the terminal.

#!/bin/sh
# Uncomment the following two lines for normal desktop:

unset SESSION_MANAGER
#exec /etc/X11/xinit/xinitrc

gnome-session --session=gnome-classic &
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

xsetroot -solid grey
vncconfig -iconic &

#x-terminal-emulator -geometry 1280x1024+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &

Is there a reason because of the security setting?

I have TightVNC on Ubuntu 14.04 and try to connect from Windows 7 from TightVNC viewer.

I have tried a lot for xstartup files over the internet to get the VNC working, both xwindows and gnome-desktop-fallback. But all I get is a grey blank screen.

I then tried the default ubuntu vnc server: vino. Very easy setup. But I cannot connect through TightVNC viewer because I get "No matching security types".

Following a post that sort of disabling the encryption of vino, I can connect from TightVNC viewer and use my Linux desktop.

See: Getting Remote Access To Work On Ubuntu 14.04 With Vino.

I also tried vino through Windows Remote Desktop, grey blank desktop again.

So I am really, really confused.


Trying to configure two ethernet adapters - Failed to bring up eth1 Gurus of the internet please help. I am trying to configure 2 network adapters, one for local traffic (eth0) and the other for a T1 line to handle incoming requests to apache from the outside world. I am running 12.04 LTS Server.

Here is my /etc/network/interfaces ( I am using x to hide actual addresses )

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface for local traffic

auto eth0
iface eth0 inet static
address 192.168.1.201
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.1

# Second NIC for T1

auto eth1
iface eth1 inet static
address x.x.x.x
netmask x.x.x.x
gateway x.x.x.x
dns-nameservers x.x.x.x x.x.x.x

if i run ifconfig -a i get

eth0      Link encap:Ethernet  HWaddr 00:13:3b:0c:1b:12
          inet addr:192.168.1.201  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::213:3bff:fe0c:1b12/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:13716 errors:0 dropped:146 overruns:0 frame:0
          TX packets:1064 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1077933 (1.0 MB)  TX bytes:147855 (147.8 KB)
          Interrupt:46 Base address:0x2000

eth1      Link encap:Ethernet  HWaddr 00:16:76:c2:81:b9
          inet addr:x.x.x.x  Bcast:x.x.x.x  Mask:x.x.x.x
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:20 Memory:90400000-90420000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:450 errors:0 dropped:0 overruns:0 frame:0
          TX packets:450 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:40004 (40.0 KB)  TX bytes:40004 (40.0 KB)

When I restart the network or reboot I get

ssh start/running, process 2853
RTNETLINK answers: File exists
Failed to bring up eth1.

Please help!

You have a default route on both interfaces. This is probally not what you want. Try to remove the gataway statement from your LAN interface eth0.

If that doesn't work, in a terminal bring down your interfaces with

sudo ifdown eth0 eth1

and bring up only one with

sudo ifup -v eth0

then

sudo ifup -v eth1

The option v gives you a lot of information whats going on and whats going wrong!

so try running the following

sudo ip addr flush dev eth1

this worked for me...

be aware this will clear static routes


What is the difference between Terminal, Console, Shell, and Command Line? What is the difference between Terminal, Console, Shell, and Command Line?

Short answer:

terminal = text input/output environment
console = physical terminal
shell = command line interpreter

Long answer:

Console and terminal are closely related. Originally, they meant a piece of equipment through which you could interact with a computer: in the early days of unix, that meant a teleprinter-style device resembling a typewriter, sometimes called a teletypewriter, or “tty” in shorthand. The name “terminal” came from the electronic point of view, and the name “console” from the furniture point of view. Very early in unix history, electronic keyboards and displays became the norm for terminals.

Terminal

In unix terminology, a terminal is a particular kind of device file which implements a number of additional commands (ioctls) beyond read and write. Some terminals are provided by the kernel on behalf of a hardware device, for example with the input coming from the keyboard and the output going to a text mode screen, or with the input and output transmitted over a serial line. Other terminals, sometimes called pseudo-terminals or pseudo-ttys, are provided (through a thin kernel layer) by programs called terminal emulators. Some types of terminal emulators include:

GUI applications running in the X Window System: Xterm, Gnome Terminal, Konsole, Terminator, etc.
Screen and tmux, which provides a layer of isolation between a program and another terminal
Ssh, which connects a terminal on one machine with programs on another machine
Expect, for scripting terminal interactions

The word terminal can also have a more traditional meaning of a device through which one interacts with a computer, typically with a keyboard and display. For example an X terminal is a kind of thin client, a special-purpose computer whose only purpose is to drive a keyboard, display, mouse and occasionally other human interaction peripherals, with the actual applications running on another, more powerful computer.

Console

A console is generally a terminal in the physical sense that is by some definition the primary terminal directly connected to a machine. The console appears to the operating system as a (kernel-implemented) terminals. On some systems, such as Linux and FreeBSD, the console appears as several terminals (ttys) (special key combinations switch between these terminals); just to confuse matters, the name given to each particular terminal can be “console”, ”virtual console”, ”virtual terminal”, and other variations.

See also Why is a Virtual Terminal “virtual”, and what/why/where is the “real” Terminal?.

Command line [interface]

A command line is an interface where the user types a command (which is expressed as a sequence of characters — typically a command name followed by some parameters) and presses the Return key to execute that command.

Shell

A shell is the primary interface that users see when they log in, whose primary purpose is to start other programs. (I don't know whether the original metaphor is that the shell is the home environment for the user, or that the shell is what other programs are running in.)

In unix circles, shell has specialized to mean a command-line shell, centered around entering the name of the application one wants to start, followed by the names of files or other objects that the application should act on, and pressing the Enter key. Other types of environments (with the notable recent exception of Gnome Shell) usually don't use the word “shell”; for example, window systems involve “window managers” and “desktop environments”, not a “shell”.

There are many different unix shells. Ubuntu's default shell is Bash (like most other Linux distributions). Popular alternatives include zsh (which emphasizes power and customizability) and fish (which emphasizes simplicity).

Command-line shells include flow control constructs to combine commands. In addition to typing commands at an interactive prompt, users can write scripts. The most common shells have a common syntax based on the Bourne_shell. When discussing “shell programming”, the shell is almost always implied to be a Bourne-style shell. Some shells that are often used for scripting but lack advanced interactive features include the Korn shell (ksh) and many ash variants. Pretty much any Unix-like system has a Bourne-style shell installed as /bin/sh, usually ash, ksh or bash. On Ubuntu, /bin/sh is Dash, an ash variant (chosen because it is faster and uses less memory than bash).

In unix system administration, a user's shell is the program that is invoked when they log in. Normal user accounts have a command-line shell, but users with restricted access may have a restricted shell or some other specific command (e.g. for file-transfer-only accounts).

The division of labor between the terminal and the shell is not completely obvious. Here are their main tasks.

Input: the terminal converts keys into control sequences (e.g. Left → \e[D). The shell converts control sequences into commands (e.g. \e[D → backward-char).
Line edition, input history and completion are provided by the shell.

The terminal may provide its own line edition, history and completion instead, and only send a line to the shell when it's ready to be executed. The only common terminal that operates in this way is M-x shell in Emacs.

Output: the shell emits instructions such as “display foo”, “switch the foreground color to green”, “move the cursor to the next line”, etc. The terminal acts on these instructions.
The prompt is purely a shell concept.
The shell never sees the output of the commands it runs (unless redirected). Output history (scrollback) is purely a terminal concept.
Inter-application copy-paste is provided by the terminal (usually with the mouse or key sequences such as Ctrl+Shift+V or Shift+Insert). The shell may have its own internal copy-paste mechanism as well (e.g. Meta+W and Ctrl+Y).
Job control (launching programs in the background and managing them) is mostly performed by the shell. However, it's the terminal that handles key combinations like Ctrl+C to kill the foreground job and Ctrl+Z to suspend it.

 Recycled from Unix & Linux

Most terminals nowadays are strictly speaking terminal emulators.
It is a type of role in the workings of a UNIX-like system and at the same time the basic interface offered by the systems. In fact everything, including the GUI builds on top of it.
Colloquially "terminal" may also refer to end-points in a computer network with a star-topography.

Console refers to the (hardware) interfaces for the terminals. I.e. there are serial consoles and nowadays mostly virtual ones.
The window colloquially referred to as "console"-window is a shell, connected to a terminal of the system, via a virtual console.

Back in the day when computers were expensive a facility might have had one actual computer and several terminals connecting to it, via serial cables ("serial console"). The OS, operations, etc. were carried out on the physical Computer, input and output happened on the console(s).
You can switch between virtual terminals by pressing CTRL+ALT+F1(through to F6): a leftover of those times.
Today the concept of "thin clients" goes back in this direction of centralizing massive amounts of resources and providing just enough hardware to provide a state of the art interface at the actual workplace.

shell is the "engine" that you see in the terminal. It provides interop with the system itself and adds nice features like auto-complete, variables etc..
It translates back and forth between the actual OS / kernel which uses system calls and you. System calls w/o shell are a bit like coding assembler and a shell at least gives you C.

command line refers to the method of exchanging input and output via a text-window. Strictly speaking the line in which you type is the (current) command line. The method in general is more correctly referred to as command line interface or CLI.

kernel
offers terminal
terminal is connected via a console
console runs shell
commands and output are exchanged via command line (interface)


Iptables reload/restart on Ubuntu 18.04 I have problem with iptables on Ubuntu 18.04 before that I used to use with Centos 7 and Red Hat and I can simply restart with

systemctl restart iptables

but on Ubuntu it does not work. I could not find iptable under init.d neither.

Can anybody help me out how can I restart or reload it on Ubuntu 18.04?

If you would like your Ubuntu firewall to function in a similar way to RedHat/Fedora, in Ubuntu 18.04, you probably want these:

sudo apt install iptables-persistent netfilter-persistent

Then edit the rules in /etc/iptables/rules.v[46]

Other commands that might be useful:

netfilter-persistent save
netfilter-persistent start

iptables-save  > /etc/iptables/rules.v4
ip6tables-save > /etc/iptables/rules.v6

systemctl stop    netfilter-persistent
systemctl start   netfilter-persistent
systemctl restart netfilter-persistent

If you ever find that your rules aren't correctly applied at boot, you can run these commands to test that there are not errors in your config files:

iptables-restore  < /etc/iptables/rules.v4
ip6tables-restore < /etc/iptables/rules.v6

The two packages are similar, but provide slightly different functionality. If you only install iptables-persistent, you won't get the service definition file for correct handling in systemd, eg /lib/systemd/system/netfilter-persistent.service

If you only install netfilter-persistent, you will find that rules are not correctly applied at boot, as per the README

netfilter-persistent and its plugins
------------------------------------

netfilter-persistent does no work on its own. You need the accompanying
plugins (for example, iptables-persistent) to load and save filter rules.

However, commands are run from netfilter-persistent. For example, to save
all filter rules:

   netfilter-persistent save

or to load them:

   netfilter-persistent start

For more details, see `man netfilter-persistent`.

The system service will try to load rules at startup if enabled, but by
default it will not flush rules at shutdown. This behaviour can be changed
by editing /etc/default/netfilter-persistent.

Debian / Ubuntu does not have an init script for iptables (unlike any fedora / RHEL / Centos)

You either have e to write a script or see iptables resets when server reboots

Alternately use UFW https://help.ubuntu.com/community/UFW

Or firewalld

How can we replace iptables with firewalld in ubuntu 16.04?


Change the Sort order of Devices in Nautilus I have Three Windows drive,

my nautilus shows devices in following order

I want it to be sorted like windows 7 does

C drive
D drive
E Drive
My Massport
13 GB FS
Future attached removable mediums....
List item

Unfortunately the order of the drives is chosen automatically, usually based on when they are detected/mounted. I don't think you will be able to change their order manually.

Ooopsie

restarted the PC and it is now sorted in the order i desire


Icon theme "Adwaita" not found - Ubuntu 14.04 I have installed Okular using snap in my Ubuntu 14.04. It is functional but there seems to be a problem with some of the icons. They are not being displayed. I have run okular from terminal by:

snap run okular

and it displays these error messages:

Qt: Session management error: None of the authentication protocols specified are supported
Icon theme "Adwaita" not found.

From a little search that I have conducted, these icons are from the Adwaita theme and can be installed from the package adwaita-icon-theme or adwaita-icon-theme-full. However, none of them are available for Trusty (at least on the standard repositories).

Any ideas on how to fix this problem?

I had the same problem on xfce. Okular searches for "adwaita", while /usr/share/icons/ has "Adwaita". Adding a soft link to Adwaita fixed it.

cd /usr/share/icons
sudo ln -s Adwaita/ adwaita


How can I search the ubuntu source code? How can I search through the source code used in Ubuntu?

There is a notification message that I'd like to modify to include more data, but it's not obvious which package it's a part of. But it includes a pretty specific string that would be easy to search on. I know there are a large number of projects included in ubuntu, but I'm hoping there's a good way to find the source when it's not apparent what program is responsible.

If it's that specific, Google should be able to help you -- it has indexed tons of publicly available source code. I'd be very surprised if it didn't find something.

Failing that (or any other sort of web search), strings is a pretty handy little application. It reads all the strings out of a file, even if it's binary. I've been hacking around and you can use this to find a phrase anywhere on your computer. This version is looking for "bad" in /usr/bin

find /usr/bin -exec bash -c 'if [[ $(strings {} | grep -i bad) ]]; then echo "{}"; fi' \;

That's obviously a pretty hardcore way of doing things. But wait, there's more. You can find the package for each result as you go:

find /usr/bin -exec bash -c 'if [[ $(strings {} | grep -i bad) ]]; then dpkg -S "{}"; fi' \;

Now that's what I call awesome. Here's it in action, looking for "No such device"

oli@bert:/var/log$ find /usr/bin -exec bash -c 'if [[ $(strings {} | grep -i "No such device") ]]; then dpkg -S "{}"; fi' \;
handbrake-gtk: /usr/bin/ghb
usbutils: /usr/bin/usbhid-dump

Ubuntu uses the Debian Linux source code. But, you have to know that linux is a kernel (http://www.kernel.org/), and a distribution is the software (http://www.gnu.org/) bundled with it.
You can get the Ubuntu Source repository from archive.ubuntu.com.
You can also refer to https://code.launchpad.net/ubuntu


What is the CVE-2014-6271 bash vulnerability (Shellshock) and how do I fix it? Recently, there have been news going around regarding "CVE-2014-6271" (See USN-2362-1), which is a vulnerability in Bash. How do I know if I am affected by this, how can I fix it, and why should I care?

This is designed as a canonical answer for this vulnerability, due to its scope and severity.

What is Bash?

Bash is the default interactive shell in Ubuntu. When you are interfacing with the terminal (either through the terminal emulator, over a tty, or ssh), you are generally typing commands that bash will read, and execute. Even if you do not use the terminal at all, you still have Bash.

On Ubuntu, /bin/sh is not bash (it is dash). Only bash is affected by this vulnerability.

How does the exploit affect me?

Bash and the OS keep track of a set of environment variables that describe the current logged-on user, where to look for programs on the hard disk, and other such functions. By crafting an environment variable with a specific structure, an attacker might be able to execute code next time Bash starts.

The attacker can set that environment variable multiple ways:

Remotely connect to a service such as SSH with a specific setup such as git over ssh. As Mitre warns, the use of the sshd ForceCommand option is an attack vector. Accounts whose shell isn't bash aren't affected.
Tricking you into setting the environment variable.
Causing another program to set an environment variable to have that crafted value. For example, you might have a webserver and script that needs to set an environment variable with specific user content. Even if that script creates its own, and doesn't touch other environment variables, it's enough. A single environment variable with any name and a crafted value is enough for the exploit to succeed.
Other  ways I have not mentioned here.

Once they set this variable, the next time bash opens for any reason, your attacker's code will be run. This is especially fearsome with sudo -s, as it spawns bash as the super-user (an administrative user rule that has full control over your computer's data and programs). Even if you only start bash as a standard user, that user's files can be deleted.

It is important to note that even if you do not use bash yourself, many programs will spawn bash by themselves as part of their operation. Even in this case, you are vulnerable. However, Ubuntu's /bin/sh is not bash, so only programs that explicitly invoke bash and not the default scripting shell are affected.

According to Mitre:

  vectors involving the ForceCommand feature in OpenSSH sshd, the mod_cgi and mod_cgid modules in the Apache HTTP Server, scripts executed by unspecified DHCP clients, and other situations in which setting the environment occurs across a privilege boundary from Bash execution.

Am I vulnerable?

Use dpkg to check your installed package version:

dpkg -s bash | grep Version

This will look up info on your bash package, and filter the output to only show you the version. The fixed versions are 4.3-7ubuntu1.4, 4.2-2ubuntu2.5, and 4.1-2ubuntu3.4.

For example, I see:

wlan1-loopback% dpkg -s bash | grep Version
Version: 4.3-7ubuntu1.4

and can determine that I am not vulnerable.

How do I update?

The standard update manager will offer you this update. This is a prime example of how security updates are important, no matter what OS you use or how well-maintained it is.

The USN Bulletin states that new versions have been released for Ubuntu 14.04 Trusty Tahr, 12.04 Precise Pangolin, and 10.04 Lucid Lynx. If you are not on one of these LTS versions, but are on a reasonably-recent version, you'll most likely be able to find a patched package.

First, check if you

If you are vulnerable, you should first grab the newest package lists:

sudo apt-get update && sudo apt-get install bash

The first command makes sure that you have the newest package list that includes the fixed version, and the second command installs the newest (fixed) version of bash.

While the bug only appears to come into play when bash is spawned, it's still a good idea to reboot immediately if feasible.

I'm using Natty 11.04, which is EOL (and I have updated /etc/apt/sources.list to use old-releases.ubuntu.com), so I have to build from source. I wanted to build a .deb, so at least the package manage is "aware" the bash version is not the default one. I am not 100% succesful - however, the package is registered as "newer" and the bash binary ends up fixed, so here is what I did:

apt-get source bash
wget https://gist.githubusercontent.com/drj11/e85ca2d7503f28ebfde8/raw/31bd53ed2e47b220d3c728f5440758e0f76769de/gistfile1.c -O bash_CVE-2014-6271.patch
wget https://gist.githubusercontent.com/drj11/239e04c686f0886253fa/raw/046e697da6d4491c3b733b0207811c55ceb9d927/gistfile1.c -O bash_CVE-2014-6271_plus.patch
cd bash-4.2/

Now, in the (sub)directory bash-4.2/, there is: a file bash-4.2.tar.xz, which needs to be unpacked to get to the bash source; and a subdirectory called debian.

I made the following changes to avoid dependencies on texlive: in bash-4.2/debian/control:

Source: bash
...
Build-Depends: autoconf, autotools-dev, patch, bison, libncurses5-dev,
# texinfo, debhelper (>= 5), texi2html, locales, gettext, sharutils, time, xz-ut
ils
 debhelper (>= 5), locales, gettext, sharutils, time, xz-utils
# Build-Depends-Indep: texlive-latex-base, ghostscript
Build-Depends-Indep: ghostscript

... and in bash-4.2/debian/rules:

binary-doc: bash-install #bash-doc-build
        dh_testdir
        dh_testroot
        mkdir -p $(d_doc)/usr/share/doc/$(p)
        dh_installdocs -p$(p_doc)
ifeq ($(with_gfdl),yes)
        #cp -p build-bash/doc/bashref.pdf $(d_doc)/usr/share/doc/$(p)/.
        #dh_link -p$(p_doc) \
        #    /usr/share/doc/$(p)/bashref.pdf /usr/share/doc/$(p_doc)/bashref.pdf
else
        rm -f $(d_doc)/usr/share/doc-base/bashref
endif
        rm -f $(d_doc)/usr/share/info/dir*
        #cp -p build-bash/doc/bash.html build-bash/doc/bash.pdf \
        #    $(d_doc)/usr/share/doc/$(p)/
        #dh_link -p$(p_doc) \
        #    /usr/share/doc/$(p)/bash.html /usr/share/doc/$(p_doc)/bash.html \
        #    /usr/share/doc/$(p)/bash.pdf /usr/share/doc/$(p_doc)/bash.pdf
        dh_installchangelogs -p$(p_doc) bash/CWRU/changelog
        ...

To change the version, in this bash-4.2/ directory, do:

bash-4.2$ dch --local patchCVE

... and fill in the notes in the changelog when asked. This will ensure that the .deb (and related metadata) is called (in my case) bash_4.2-0ubuntu3patchCVE1_i386.deb.

Then you can try building with dpkg-buildpackage -us -uc or debuild command. Note - either of these will re-unpack the source from the zip - thus overriding any patches you may have had! Still, run one of these once so the source is unpacked and built (note debuild may still fail in the end due to texlive, but it should unpack and build the source).

Then, apply the patches; note you should use -p1 here, because currently you're in the bash-4.2/ directory:

bash-4.2$ patch -p1 < ../bash_CVE-2014-6271.patch
bash-4.2$ patch -p1 < ../bash_CVE-2014-6271_plus.patch

Then rebuild patched version by running:

bash-4.2$ fakeroot debian/rules build

This would rebuild the executable; to test it:

bash-4.2$ env VAR='() { :;}; echo Bash is vulnerable!' ./build-bash/bash -c "echo Bash Test"

To build the .deb files, run:

bash-4.2$ fakeroot debian/rules binary

This will save the .deb files in the parent directory; to list their contents:

bash-4.2$ dpkg -c ../bash_4.2-0ubuntu3patchCVE1_i386.deb

To install the .deb:

bash-4.2$ sudo dpkg -i ../bash_4.2-0ubuntu3patchCVE1_i386.deb

However, for some reason, this .deb contains an unpatched binary (?!), so I had to additionally do:

bash-4.2$ sudo cp bash-4.2/build-bash/bash /bin/

... and after that, the test started passing correctly for me:

$ env VAR='() { :;}; echo Bash is!' bash -c "echo Bash Test"
bash: warning: VAR: ignoring function definition attempt
bash: error importing function definition for `VAR'
Bash Test


Problem with cifs-util. Mount: only root can mount i'm trying to use cifs-utils to get files in another machine. In the other machine i've installed samba. Everything works fine if a try in the same machine (the one with samba) using cifs-util, but it doesn't if i try with another in the intranet. Here's what i've done:

i've installed cifs-util
i've added the following line to the /etc/fstab file:

//192.168.0.72/Triple_RDF /media/Triple cifs credentials=/home/ubuntu/.smbcredentials,iocharset=utf8,sec=ntlm 0 0

i've created the .smbcredentials file typing:

gedit ~/.smbcredentials

and adding the lines

username=[username]
password=[password]

Of course i put my real username and password instead of [username] and [password].
then i changed the permits of the previous file typing:

chmod 600 ~/.smbcredentials

Since i'm using Ubuntu 14.04 it apppears an icon on the nautilius bar (the one on the left side), but when i click on it appens nothing. If i try to go inside of the "Triple" which now appears with my network resources the system says:

mount: only root can mount //192.168.0.72/Triple_RDF on /media/Triple.

I thought that may be it could be a problem of permits in the destination folder, /media/Triple. So i changed those. Here my ls -al output of the /media/Triple folder:

drwxrwxr-x 2 user group 4096

where instead of user and group i put the real ones.

Anybody knows which could be the problem ?

Answer: make sure you have installed cifs-utils and you have user in the fstab entry.

Just add users in /etc/fstab like that:

//192.168.0.72/Triple_RDF /media/Triple cifs credentials=/home/ubuntu/.smbcredentials,iocharset=utf8,sec=ntlm,users 0 0

Normally, only the superuser can mount filesystems. However, when fstab contains the user option on a line, anybody can mount the corresponding system.

Or if you want any user to mount/unmount the drives use users instead.

I had the same problem, I put it in /etc/fstab so it mounts automatically on boot.


How to fix missing GPG keys? I have just installed Ubuntu 12.04 and I added some repo, and when I did apt-get update, I got missing gpg key.

Following command seems to doesn't work for me:

apt-get update 2> /tmp/keymissing; for key in $(grep "NO_PUBKEY" /tmp/keymissing |sed "s/.*NO_PUBKEY //"); do echo -e "\nProcessing key: $key"; gpg --keyserver subkeys.pgp.net --recv $key && sudo gpg --export --armor $key | apt-key add -; done

How to fix this problem?

I liked this solution, re-download the missing keys from the Ubuntu key server.

For Ubuntu

UBUNTU: Fixing GPG Keys in UBUNTU

In my case

 Reading package lists... Done
 W: GPG error: http://ppa.launchpad.net precise
 Release: The following signatures couldn't be verified because the public key is not available:
 NO_PUBKEY 2EA8F35793D8809A

Here is the command to add the missing key mentioned in the error message.

sudo apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 2EA8F35793D8809A

So I take the missing key 2EA8F35793D8809A and ask the keyserver.ubuntu.com to added it to the list of keys I have in apt.

For linux mint
Your key server is slightly different keyserver.linuxmint.com

sudo apt-key adv --recv-key --keyserver keyserver.linuxmint.com "missing key"

Alternative key servers to try
keyserver.ubuntu.com

This problem occurred to me when I install 12.04 using German settings. The repository list is then using German mirror repositories by default. If that is the case you can edit the repository list and change all German mirror repositories to the Ubuntu standard repositories.

You can use following method:

sudo nano /etc/apt/sources.list

Search and replace in Nano using Alt-r

Search (to replace): /de.

Replace with: /

Replace All (Press A)

Save file Ctrl-x

Then update your system by entering the following command in the terminal:

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

After this there should be no errors and everything should work fine.


installing .NET framework 4 and tradetigersetup.msi my ubuntu version is 14.04
i want to install a windows software from website http://www.sharekhan.com/tradetigerinstalation/TTSetup.aspx [tradetiger advance]. it requires .NET Framework 4

i installed wine and configured wine to windows 7
then i installed .NET Framework 4
then i installed tradetigersetup.msi
when i run the software system gives error "there is no windows program configured to open this type of file"
please help
thanks in advance

You will not be able to get it to run from WINE: it has a garbage rating.

I would suggest installing Windows from a Virtual Machine and install it from there. That will work.

Wine is compatible to install .msi files as well either in Ubuntu or Mac. You need to configure your wine setup initially which I presume you have already done.

Just type wine start fileName.msi. This will automatically install your desired file.

Here is the supporting link to the Wine FAQ.