Concealing long paths in variables in Bash I have to move files from one folder to another but they reside in totally different paths. The destination path is so long and complicated that I am not able to remember it. Is there any way to go first to destination directory then store the path in some variable lets suppose X and then go to source directory and write a command like that:

 mv * $X

Try:

cd /your/long/path
X=$(pwd)

The command pwd prints the current directory; with the command X=$(pwd) you are storing the output of the command in the variable(1) X (no spaces around the =!)

cd /the/other/dir/
mv * "$X"

Now you are using the value of the variable X, using $X (read $ as "the value of"). The " that are around the $X are needed if the directory name contains spaces or other special characters.

If you are unsure about what is in X, you can check its content with

echo "$X"

(1) in the bash (and other) shells they are called parameters. See for example here for a simple tutorial, or here.

Why do not use variables for src and dest-Path?
Here a little script:

IFS='
'
SRC="/PATH/TO/SOURCE-PATH"
DST="/PATH/TO/DEST-PATH"
for i in `ls $SRC`
do
mv $SRC/$i $DST/.
done

the IFS is important, if you have filenames with spaces. Without IFS the for-loop do in some environments a line-break on this spaces. (SOURCE)


Is there a hotkey to switch between tabs in the default terminal app? Is there a hotkey to switch between tabs in Ubuntu's native terminal app? I'm using the netbook version of ubuntu.

You can also use Ctrl+PgUp/PgDn to go to previous/next tab.

Alt + Shift + n, where n is the tab number starting from 1, works for me on Ubuntu 18.04 with Gnome Desktop Environment.


Is there a way to tell which packages I've installed via apt-get, minus the auto-installed ones? I try to keep a log of the programs I installed via apt-get in the command line to carry them to my next Ubuntu installation. The thing is sometimes I install something to see if it suits me. After testing I sometimes forget to add those to my log.
When I try to find out from the history in software manager, it shows me a long list since it also includes the auto installed ones too.
Is there a way I can only sort out the ones that aren't automatically installed just because I installed gem or something? I want it to know only gem not the libraries that came with it, since they will be automatically installed anyways next time I install gem.
Also are there any tools to help with package installations? What I mean is that, there was once a tool I've used to keep track of the programs you compile and install by hand. It would track the makefile's doings and make it easier to uninstall or undo what it has done in the future. Is there a tool that you might have heard of out there?
Some ideas to make it easier in the future
One other solution I can think of is to write an install script that first logs the program name, then runs through apt-get install xxxx. Or is there a better way to pipe the command arguments of apt-get to log them, by aliasing the command or something? This would be better since it would keep auto-completion of package names when you press tab after sudo apt-get install chromium-br...

Apt keeps track of what is marked as auto-installed and what is marked as manually-installed. You can get the list of manually-installed packages with apt-mark showmanual.

Keep in mind that in addition to the things you manually-installed, this list will include things that the system marked as manually-installed in order to protect them from autoremove.

Synaptic has a nice graphical viewer with searching of the apt history log under File --> History. The history include packages you installed, the dependencies installed, and upgrades and packages removed.

The apt history log itself is in /var/log/apt/history.log

Type the following in to Terminal

cd Desktop
dpkg --get-selections | grep install > installed.txt

A text file will appear with all installed packages on your desktop.


.bashrc not executed when opening new terminal The code in .bashrc does not execute when I open a new terminal window in Ubuntu 12.04.
I noticed this when creating a .bash_aliases file.  The aliases did not show up when I opened a new terminal.  However when I type source .bashrc the aliases did show up.

.bashrc should be run everytime I open a new terminal window right?

How do I make this happen?

It isn't necessarily run; at the top of the standard .bashrc is this comment:

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

I believe there is an option to run bash terminal as a login shell or not.  With Ubuntu, gnome-terminal does not normally run as a login shell, so .bashrc should be run directly.

For login shells (like the virtual terminals), normally the file ~/.profile is run, unless you have either ~/.bash_profile or ~/.bash_login, but they are not there by default.  By default, Ubuntu uses only .profile.

The standard ~/.profile has this in it:

if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
        . "$HOME/.bashrc"
    fi
fi

This runs .bashrc if it is available - assuming $BASH_VERSION is present in your environment.  You can check for this by entering the command echo $BASH_VERSION, and it should display some information on version number - it should not be blank.

Instead of going all through that just go Edit -> Profile Preferences -> Title and Command -> "Run a custom command instead of my shell" and in Custom command box write bash and close it. The next time you'll open the terminal, it'll also run bash automaticlly.


shares-admin crashes when trying to add a share I'm running a fresh installation of xubuntu 16.10 and when clicking the "Add" button or the "Users" tab in shares-admin I get the following error:

Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
[1]    31900 segmentation fault  sudo shares-admin

I've tried launching with sudo and as a normal user and using the "Unlock" button, same issue.

Any ideas?

from terminal

1 sudo apt-get update
2 sudo apt-get install samba
3 sudo nano /etc/samba/smb.conf
4 add to config next lines
[share]
comment = Ubuntu File Server Share
path = /home/ubuntu/ubuntu (place of your share)
browsable = yes
guest ok = yes
read only = no
create mask = 7777

Save changes in the file and create folder
sudo mkdir -p /home/ubuntu/ubuntu
sudo chown nobody.nogroup /home/ubuntu/ubuntu

init 6 (reboot system)

After all this operations you will your share from any OS


copying files from one user to another in a single machine How to copy any files or directories from one user to another user in a same machine via terminal?

Suppose there is one file test.txt in home directory of USER1. I need to copy that file to the home directory of USER2 in my machine. How can I do it via terminal?

Assuming that you have sudo privileges  the following command will do.

sudo cp /home/USER1/FNAME /home/USER2/FNAME && sudo chown USER2:USER2 /home/USER2/FNAME

Will copy the file from USER1 to USER2, and then change the owner of the copy in /home/USER2 to USER2

If you do not have sudo privileges, then the two users will need to ensure that you have read permissions on the USER1 directory, and write access on the USER2 directory.  If you have these accesses, you can enter the command:

cp /home/USER1/FNAME /home/USER2/FNAME

This will copy the file in question, but USER2 may not be able to manipulate the file until they have appropriate permissions.

Before going to copy one user to another you need to login as su user and then you use the command cp

sudo cp /home/shyam/Desktop/sparkhadoop_2.11-1.0.jar /home/hadoop/Desktop


Disable PDF.js and use Evince instead Some PDFs render inside Firefox. I am very unhappy with that for several reasons.

Since Ubuntu ships with a good, stable and lightweight PDF-viewer, evince, I'd rather have all PDFs handled by that native viewer instead of the Firefox one.

I suspect it's because of either the mine-type, some extension, a disposition-header or some combination thereof, but some PDFs open already just fine in Evince. Others still open in the PDF.js.

How can I direct all PDFs to the native, evince, viewer?

If you'd rather not use the built-in PDF Viewer, you can use another PDF viewer like Evince or another default viewer on Ubuntu.

To switch from the built-in PDF viewer to another PDF viewer:

At the top of the Firefox window, click on the Edit menu and select Preferences
Select the Applications panel.
Find Portable Document Format (PDF) in the list and click on it to select it.
Click on the drop-down arrow in the Action column for the above entry and select the PDF viewer you wish to use.
Click Close to close the Preferences window

(Source https://support.mozilla.org/en-US/kb/disable-built-pdf-viewer-and-use-another-viewer)

The problem seems to be a setting in ~/.local/share/applications/mimeapps.list

It's this entry thats needs to be modified:

application/octet-stream=gedit.desktop (it may look different on your machine)

As soon as I changed this to:

application/octet-stream=evince.desktop;gedit.desktop

firefox would suggest to open a .pdf file with evince instead of gedit


cannot make sublime text 3 work on ubuntu 14.04 Downloaded different versions and from different places, still cannot get it work on 14.04. I could get it to run successfully on OS X and Ubuntu 12.04.

drwxrwxrwx  5 root    root       4096 Sep  5 17:14 ./
drwxr-xr-x 10 root    root       4096 Aug 19 17:39 ../
drwxr-xr-x  3 root    root       4096 Aug 26 20:51 opt/
drwxrwxr-x  4 achippa achippa    4096 Aug 26 20:50 sublime_text_3/
-rw-r--r--  1 achippa achippa 7557246 Sep  5 17:14 sublime_text_3_build_3065_x64.tar.bz2
-rw-r--r--  1 achippa achippa 6369566 Sep  5 16:53 sublime-text_build-3065_i386.deb
drwxr-xr-x  4 root    root       4096 Aug 26 20:51 usr/
achippa@ubuntu:/usr/local/src$ cd sublime_text_3/
achippa@ubuntu:/usr/local/src/sublime_text_3$ ./sublime_text
-bash: ./sublime_text: cannot execute binary file: Exec format error
achippa@ubuntu:/usr/local/src/sublime_text_3$ /usr/local/bin/subl
Unable to load libgdk-x11-2.0.so
Unable to load gdk_cairo_create from libgdk-x11-2.0.so
Unable to load gdk_cursor_new_for_display from libgdk-x11-2.0.so
Unable to load gdk_cursor_unref from libgdk-x11-2.0.so
...

With i386.deb I see a bunch of unable to load... errors. With x64_tar.bz2, I see an Exec format error. Which is the right file to download for 64-bit Ubuntu 14.04.

you'd better check your OS and the sublime deb package (or bz2) file are matched. I unzip the 64 bits sublime bz2 package into my home directory, and go the same "Exec format error" when I try to start sublime_text, and my os is 32 bits version of Ubuntu 14.10.

If you try to install the deb package is not match the OS architecture, it will report error message and you could not install that.

Hope this is helpful.


Alternatives for 'egrep -o "success|error|fail"  | sort | uniq -c' I sometime need to check some logs and I do this with this command:

egrep -o "success|error|fail" <filename> | sort | uniq -c

Sample input:

test error on line 10
test connect success
test insert success
test started at 00:00
test delete  fail

Sample output:

1 error
1 fail
2 success

I would like to know if someone knows a way to do this with a shorter command?

Before you ask why I would like to do this with an different command... No special reason, I'm just curious :)

No, I think that you are as good as it gets. Naturally, you could do it with one perl script,

perl -nle  's/.*(error|fail|success).*/$1/ && $a{$_}++ ; END {  print "$_ $a{$_}" for keys %a } ' test.txt

...but it is more complex and less intuitive.

This could be a dummy answer but I think, in this case, sort is quite useless; maybe you can omit it. Nevertheless here we are using three different commands for three different actions.

We can short it if some of them con be reached with some option of grep, but I don't see which... :)


Commands and the Custom Shortcut Keys In Ubuntu 16.04 I have added many custom shortcut keys to launch various applications such as Skype or Firefox.

In the case of Skype I have simply put the word skype in the command box. But when I put any terminal command in that box the shortcut key is ignored.
Just for the sake of argument I put echo 'abcd' in the command box and assign Ctrl+Alt+5 to it - nothing happens when I use that shortcut key.
I also tried to launch bash script and also python script from the command box of Customs Shortcut Key and again got nothing when I used the assigned shortcut key.

Are there certain restrictions on what can go in the command box of Custom Shortcut Keys? Or am I not using the command box correctly?

You need a console to be able to execute shell commands. If you are using gnome-terminal you can execute a command with -e - so try to assign your command like:

gnome-terminal -e 'top'


Plugged-in headphone cannot be detected but bluetooth headphone works well I recently upgraded my system from ubuntu 19.04 to 19.10, and I found a weird issue. When I physically plug a headphone in my laptop, I cannot find it everywhere, it seems like that it is not being detected. However, if I plug the same headphone into other devices, it works well and the headphone works well in Windows 10(dual system on the same PC).

What makes me confused is that if I use Bluetooth earphones in the laptop, it works quite well.
This problem occurs when I used Ubuntu 19.04 sometimes, but not frequently. However, when I switch to the 19.10, I can never detect my dear headphone :(.

The result of lspci | grep Audio is:

04:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Raven/Raven2/Fenghuang HDMI/DP Audio Controller
04:00.5 Multimedia controller: Advanced Micro Devices, Inc. [AMD] Raven/Raven2/FireFlight/Renoir Audio Processor
04:00.6 Audio device: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 10h-1fh) HD Audio Controller

I tried several methods, such as running sudo alsactl restore, and it says:

alsactl: load_state:1683: Cannot open /var/lib/alsa/asound.state for reading: No such file or directory
Found hardware: "HDA-Intel" "ATI R6xx HDMI" "HDA:1002aa01,00aa0100,00100700" "0x17aa" "0x380d"
Hardware is initialized using a generic method
Found hardware: "HDA-Intel" "Conexant CX8070" "HDA:14f11f86,17aa3820,00100100" "0x17aa" "0x3815"
Hardware is initialized using a generic method

I almost tried every methods that can be found, but none of them works.
Who can help me? Thanks!!!

After tried many solutions, I found this post today: https://forums.linuxmint.com/viewtopic.php?t=315230, and it does work for me.
Simply speaking: Every time you switch your system from Windows to Linux, DON'T USE REBOOT, SHUTDOWN the whole system and restart will solve the problem.
Hope this will help.

I would have asked you to elaborate a bit more, about which methods you have actually used to try and fix this. However, no rep...
I answer now, as I have the same sound card, and the same re-occurring problem, but on 18.04. However, the method seems quite drastic, but nothing else worked.

Following many other postings about nonfunctional headphone jacks I turned to remove alsa all the way, and reinstall it. Same for linux-sound-base. I am thinking, that the --reinstall could also work. Anyway:

sudo apt-get --purge remove linux-sound-base alsa-base alsa-utils
sudo apt-get install linux-sound-base alsa-base alsa-utils

Be mindful, and check what packages were removed. An addtional

sudo apt-get install ubuntu-desktop
sudo apt-get install ubuntu-drivers-common

might be necessary.

Sometimes, a simple alsactl restore is enough. Or a sudo alsa froce-reload.

Please check this thread if you are running a dual boot system.

Then please comment on what actually helped. I'd be interested.


Where do I put the php file so Firefox sees/runs it? I am brand new to web services and php. I want to experiment writing php code/files. I have installed

nginx 1.10
php 7.0.8 on Ubuntu 16.04.1

I can get the php file to execute from the command line, but I cannot figure out what to do / how to get Firefox to find and run it.

Default public web root for a standard nginx installation should be located in /usr/share/nginx/html

Try to create a test script to see if php is properly running and setup by creating a new file called test.php and following content

<?php phpinfo(); ?>

save the file in your default web root and you should be able to run it by opening your standard browser and navigating to localhost/test.php

It should display a php-configuration page and you should be able to write your own code.

The easiest way to set it up locally, would be by installing a simple LAMP server (Apache, MySQL, PHP).

Read the wiki for further information!

use
sudo php -S localhost:portno from command-line and open link in firefox or any browser


How do I add SSH Keys to authorized_keys file? I have an Ubuntu server on Amazon EC2, that I use for development, and today I stupidly cleared everything out of my ~/.ssh/authorized_keys file.  Luckily I have an SSH open, so I am still connected, and can fix the file, but when I try to put my key file back, it doesn't work.  I still get permission denied from the server on my local machine.

authorized_keys has the permissions 600. I have tried appending my SSH key with ssh-rsa and leaving the ssh-rsa off.  I also tried making the SSH key all one line, but that didn't work either.

Is there something else that I have to do like reload the file some how?

You should never save the file with its contents starting with -----BEGIN RSA PRIVATE KEY----- on the server, that is your private key. Instead, you must put the public key into the ~/.ssh/authorized_keys file.

This public key has the .pub extension when generated using ssh-keygen and its contents begin with ssh-rsa AAAAB3. (The binary format is described in the answers to this question).

The permissions of ~/.ssh on the server should be 700. The file ~/.ssh/authorized_keys (on the server) is supposed to have a mode of 600. The permissions of the (private) key on the client-side should be 600.

If the private key was not protected with a password, and you put it on the server, I recommend you to generate a new one:

ssh-keygen -t rsa

You can skip this if you're fully sure that nobody can recover the deleted private key from the server.

If this does not help, run ssh with options for more verbosity:

ssh -vvv user@example.com

On the server side, you can review /var/log/auth.log for details.

Here's a variation whereby you might have a list of public key filenames in a text file and the big batch of public key files are also in the same directory.

This variation can be helpful if you were giving a huge list of public key files to import :-)

$ for i in $(cat ListOfPubKeyFiles.txt) ; do cat $i | ssh User@Hostname "cat >> ~/.ssh/authorized_keys"; done


How do I remove a folder from the Ubuntu One "Folders" tab How do I remove a local folder from Ubuntu One operation?  I unchecked the "sync locally?" checkbox, whatever that happens to mean.  I prefer to just get rid of it from the Ubuntu One dashboard.

In nautilus, right click on the folder, enter the Ubuntu One submenu, click on "Stop Synchronizing This Folder". The same menu is also available under "File" when viewing the folder:

If the folder contains published files or shared folders you'll be warned,

And that's it, the folder is no longer extant. You need to refresh the nautilus window for the menu to be updated, however.

Alternatively, u1sdtool is a commandline tool with which you can list, create, delete, subscribe and unsubscribe from folders.

The answer is to go to your Ubuntu One account via a browser. Delete the folder as shown in the browser. At some indeterminate time in the future, which may or may not require re-enabling syncing or reloading the desktop Ubuntu One control panel, the folder will disappear from the desktop Ubuntu One control panel, without affecting the file system, so you will still have the actual folder in your Linux file system.

This is incongruous since the addition of the folder happens via the desktop Ubuntu One control panel so it's reasonable to expect there to be a way to do the deletion on the control panel, but I haven't found one.


How to transfer files from Windows 10 partition to new Ubuntu partition My brilliant techy son has convinced me to move to linux/ubuntu for everyday use, and installed Ubuntu on a separate partition on one of my pc's.  I need to save the Windows 10 partition for 2-3 programs I use occasionally that are only for Windows, but I want to transfer everything else, files and apps, to the Ubuntu partition on the same machine, so I can use ubuntu as my primary os.  Most of the files are already linux friendly, i.e. I use thunderbird for email, libreoffice & so forth.

I'm afraid I need step-by-step instructions, as I have never used ubuntu before.  Is there an article in the documentation that gives this how-to?  I looked and could not find it.

Your help will be greatly appreciated by this ancient who first learned to use a computer on a time-shared IBM 360!!  Regards, Laurel

This is possible, although it would probably be easier to configure your ubuntu system to load the windows drive on boot. Ubuntu is able to read the Windows filesystem formats natively. The benefit of this method is that any changes made in ubuntu will be reflected in windows the next time you use it.

First, you need to grab the unique identifier for your partition.

# List all drives
fdisk -l
# Get the unique ID for your drive
blkid -s UUID -o value /dev/sda2

Replace /dev/sda2 with the drive you want to mount at boot. Take note of this value, you will need it for later. Next you will create the new folder where windows will be mounted each time you turn on Ubuntu. If you want windows to be easily accessible from your home folder, then you could run this command to make a folder called windows:

mkdir ~/windows

Next, create a backup of the file we are about to edit.

cp /etc/fstab /etc/fstab.bak

The fstab file determines what drives are loaded at boot. Edit /etc/fstab and append the following at the bottom:

UUID=12102C02102CEB83     ~/windows     ntfs-3g

Replace the numbers after UUID= with the output of the earlier blkid command. Save the file and restart your computer. You should have the windows filesystem auto mounted in your home directory.


SSH Connection Error: No route to host There are three machines in this scenario:

Desktop A : user@1.23.x.x
Laptop A : user@1.23.y.y
Machine B : user@192.168.z.z

All the machines have Ubuntu 11.04 (Desktop A is a 64bit one) and have both openssh-server and openssh-client.

Now when I try to connect Desktop A to Laptop A or vice-versa by ssh user@1.23.y.y I get an error as

port 22: No route to host

in both the cases.

I own both the machines, now if I try same commands from my friend's machine, i.e. via Desktop B, I can access both my Laptop and Desktop. But if I try to access Desktop B from my Laptop or by Desktop I get

port 22: Connection timed out

I even tried changing ssh port no. in ssh_config file but no success.

Note: that 'Laptop A' uses WiFi connection while 'Machine A' uses Ethernet Connection and 'Machine B' is on an entirely different network.

@Lekensteyn Here it is ->

Laptop A && Desktop A -> Router/Nano_Rcvr provided to me by ISP. So to one Router two Machines are connected and can be accessed at the same time.
here is my ifconfig output for both the machines :-
Laptop

wlan0

      Link encap:Ethernet  HWaddr X:X:X:X:00:bc
      inet addr:1.23.73.111  Bcast:1.23.95.255  Mask:255.255.224.0
      inet6 addr: fe80::219:e3ff:fe04:bc/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:108409 errors:0 dropped:0 overruns:0 frame:0
      TX packets:82523 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000
      RX bytes:44974080 (44.9 MB)  TX bytes:22973031 (22.9 MB)

Desktop

eth0

      Link encap:Ethernet  HWaddr X:X:X:X:c5:78
      inet addr:1.23.68.209  Bcast:1.23.95.255  Mask:255.255.224.0
      inet6 addr: fe80::227:eff:fe04:c578/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:10380 errors:0 dropped:0 overruns:0 frame:0
      TX packets:4509 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000
      RX bytes:1790366 (1.7 MB)  TX bytes:852877 (852.8 KB)
      Interrupt:43 Base address:0x2000

Output of ip route show

      1.23.64.0/19 dev wlan0  proto kernel  scope link  src 1.23.73.111  metric 2

      169.254.0.0/16 dev wlan0  scope link  metric 1000

Output of traceroute -n 1.23.73.111

       traceroute to 1.23.73.111 (1.23.73.111), 30 hops max, 60 byte packets
       1  1.23.68.209  3008.787 ms !H  3008.786 ms !H  3008.784 ms !H

The routes look fine. I'll assume that those IP addresses are private ones (LAN) and not public accessible.

Since you're connected in different ways to the network (wifi / wired), it's very likely that your router has separated wired / wireless networks. Try connecting both of them on a wired (or wireless) connection. Another possibility is that a firewall on the Ubuntu machines is blocking connections.

Otherwise, configure your router to use the same network (subnet) for wireless and wired connections. Also make sure that the router does not block client-to-client communication.

Your router is possibly dropping all unsolicited packets, that's why your friend gets a "connection timed out" message on your public IP address. Configure NAT port forwarding so that the public IP address + port combination forwards to your LAN address.

Example network:

YOUR NETWORK (A)
    Router A (public address: 198.51.100.1)
    Desktop A - 10.0.0.2
    Laptop  A - 10.0.0.3

YOUR FRIENDS NETWORK (B)
    Router B (public address: 203.0.113.1)
    Machine B - 192.168.0.2

On Router A, setup NAT forwarding:

To make your desktop accessible:
  forward the public port 22 to 10.0.0.2
To make your laptop accessible:
  forward the public port 2222 to 10.0.0.3

If you've a firewall (ufw, iptables, ...) on the machines set, allow incoming traffic to port 22 (Desktop A) and port 2222 (Laptop A).

The desktop can now be accessed using SSH with:

ssh user@198.51.100.1 -p 22

The laptop can now be accessed using SSH with:

ssh user@198.51.100.1 -p 2222

If you want to access your friends machine, apply these instructions to his machine + router.

If you have changed/replaced your system hard drive incase then try removing the hostkey from .ssh/known_hosts file then try connecting again.


Ethernet Not Working In Ubuntu 16.04 LTS in dual boot system! I have a dual boot system with windows 10 and ubuntu 16.04 . Ethernet is working perfectly fine in windows 10 but on the contrary Ubuntu shows "Cable unplugged" . I have been surfing the web for about 3 days now but have not got any solution to my problem though I tried a lot of things. Please Help Me out!
Thanks in advance.

Try this: https://help.ubuntu.com/stable/ubuntu-help/net-wireless-troubleshooting.html

(these are just additional characters to satisfy the client)


How to type all the math, stat, greek, equations EFFICIENTLY in libreoffice? I am preparing a report related to physics which is full of Greek, stat and calculus things, I know there is this question how to insert a Greek symbol, but my problem is I cant fiddle with a drop down/ scroll list for for every symbol(my paper in FULL of those), is there a way to do something with my keyboard layout, and turn it into something like the one  Tony Stark uses in Ironman(I am not kidding please). I am literally tired for this fiddle-work for half of the day and have completed just 2 sheets, hmmm.

LaTex is the standard document markup language for scientific papers. It's pretty hard to get in to for beginners, but very much worth the effort. Given your time constraints I would advise you to do the following:

Use a combination of TexMaths (for LaTex integration into LibreOffice) and a LaTex GUI equation editor like Daum Equation Editor (requires Google Chrome / Chromium but works fine offline) to create your formulae.

Latex is old & gone except or those who are in their 40s...Use Daum equation Editor (Chrome plugin), a small plugin for a trivial equation editing


Screen goes blank when VLC is playing a video During playback of a video file (on the HDD) the screen attempts to go blank.  If I move the mouse the blank screen disappears and I am able to see the video again.
I have checked the settings; Tools>Preferences>All (to select the Advanced Menu)>Video and placed a check mark (ticked) Turn off Screensaver (which, by the way, was already selected) but this seems to have no effect.  The screen is still trying to go blank during video playback.
I do not believe that this is an issue with VLC at this point.  However, I have been wrong B-4.
Any help with this matter is greatly appreciated.

My OS is Linux Ubuntu Ultimate Edition 3.2

Thank you in advance.

If you have set your screensaver to automatically turn on after x minutes, that explains it. Try going into your screensaver settings, disable your screensaver and then re-test.

I would tell you where those settings were, but i have no idea regarding UE 3.2, sorry.

It may be problem with your VLC. Reinstall VLC player.


Unable to create new folders on Ubuntu and Permissions tab is all greyed out I freshly installed Ubuntu with lighttpd; I want to add a test file to check if my server works or not.

I am, however, unable to create files: when I right clicked and opened the "Permissions" tab I don't have any options which can be changed, everything is grayed out and it says root is the owner to the files.

How do I set the appropriate permissions?

Where do you want to create a new folder?

By the way, always you can do as root by running a command in terminal by using Sudo:

sudo mkdir you_folder_name

if you want to create new folder you can log in as root.

sudo -s

and create new folder where do you want. Or you can try this command:

sudo mkdir folder_name


How to backup data on my home drive from a Ubuntu Desktop 10.10 that crashed? I booted the system from ubuntu 12.0.4 desktop lts  live usb ... Now i need to know how I could access/backup the data on my home drive?

When i boot i only see the file system for the bootable usb drive and folders such as desktop etc... I do not see any option to access the file system for the crashed os on the hard drive of my laptop...

Siply go under root in terminal type su (on live media it has no password)< mount your home partition and than you can perform any data manipulations with your user home directory


How to automatically kill / terminate process as soon as it is launched? Is there a way to automatically kill a certain (sub)process the very moment it is launched? I've read in this answer how to filter a process by its name and kill it:
sudo ps aux | grep '<process name>' | awk '{2}' | xargs kill -9
But instead of e.g. setting up a script that executes above command periodically, I would like the system to watch out for the process in question and terminate it automatically as soon as it pops up.
Edit: This shorter command, which targets the process by its name instead of its PID, should do it as well:
sudo killall -I -s SIGKILL <process name>

A cron job won't work as the standard version does not support execution frequencies higher than 1 Hz (every 1 second). Plus, as you already mentioned, saving your credentials into a file is usually a bad idea


fglrx does not have /usr/lib/libGL.so lib I am trying to compile some OpenGL apps from source, but there is no /usr/lib/libGL.so, or /usr/lib/libGL.so.1 or even /usr/lib/libGL.so.1.2, however fglrxinfo says:
display: :0.0  screen: 0
OpenGL vendor string: ATI Technologies Inc.
OpenGL renderer string: ATI Mobility Radeon HD 4500 Series
OpenGL version string: 3.3.10237 Compatibility Profile Context

Which is what I expect and the gears demo also works.
How do I get those files? I tried the MESA files and then I got software rendering which is not what I wanted.

The libgl1-dev package is a meta-package that contains the required lib and can be replaced with software implementations libgl1-mesa-swx11 or dri accelerated version libgl1-mesa-dri.

The fglrx package contains /usr/lib/fglrx/libGL.so

To see which libs glxgears (or any other program) is using use

ldd "$(which glxgears)"


Touchpad not working acer aspire E5 I bought a new acer aspire E5-521 and installed ubuntu 14.04, but the touchpad doesn't work from the beginning. I already tried xserver-xorg-input-synaptics. It says a newer version is already installed. Then I tried what it says in the Debugging and it doesn't recognise the touchpad at all. Unfortunately I have no USB-Mouse to try if it`s working... What can I do?
Thank you for your help!

Latest kernels should fix that, as mentionned on Launchpad.

Reported working on 3.17-rc6

You can find 3.17 kernel in DEB package on http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.17-utopic/

Piece of warning: you might encounter some issues with kernels not released by Canonical (ubuntu), but it should anyhow "work".

I had a long fight to get the touchpad working (in basic mode, no 2-finger scrolling), finally working:

i8042.nopnp is needed for the problematic ACER Aspire E15 E5-573-C1SG touchpad (no Advanced/Basic mode for touchpad in "F2" BIOS)

/boot/vmlinuz-4.6.1 root=/dev/sda3 ro init=/sbin/e4rat-preload i8042.nopnp i8042.kbdreset psmouse.proto=imps ATHDELAY=1

ABOVE is for touchpad, below was "delayed modprobe ath10k_pci" (workaround) solution for WIFI ath10k_pci reproducibly crashing kernel on same Acer Aspire notebook:

If not blacklisted (or compiled in kernel), ath10k_pci crashes kernel...

Also crashes if started after x or if started too early (when would be safest ???) sleep 4 usually works:

To adjust sleep time (seconds), parse /proc/cmdline for ATHDELAY=1 or =88888 to postpone :

$ cat /etc/rc.local  # reminder: chmod +x /etc/rc.local
ATHD=`cat /proc/cmdline|awk '{for(i=1;i<=NF;i++){if($i ~ /^ATHDELAY=/){sub(/^ATHDELAY=/,""); print $i}}}' ` ; SLP=$(($ATHD+3)); (sleep $SLP; modprobe ath10k_pci ) &

This worked under Debian Jessie and custom compiled Linux 4.6.1 x86_64 kernel, but (HW + kernel specific, so) might apply to other distros/setups.  Marcell Gal, Hungary

MUST be module BUT blacklisted under linux 4.6.1 otherwise KERNEL CRASH at boot.

modprobe ath10k_pci works a few seconds after boot, and no crash, wifi works perfectly !

$ cat /etc/modprobe.d/ath10k-blacklist.conf
blacklist ath10k_core
blacklist ath10k
blacklist ath10k_pci


Firefox doesn't respect font hinting setting in Gnome? How to fix this? I disabled font hinting in Gnome tweaks, but Firefox sometimes (for certain fonts I think) ignores that and tries to align glyphs to pixel grid, resulting in uneven spacing between letters and/or distorted glyphs. I'd like to force Firefox to never use hinting, if possible, are there ways to do so?

Font settings in Gnome tweaks:

An example of bad font rendering (this is a line from gmail web interface where it shows the list of threads; there are extra spaces between letters in some places where they should not be, in particular "release" reads as "relea se"):

Same line after changing the zoom a bit (see how the bogus spaces are in different positions):

Firefox 64.0, installed from Ubuntu repositories via apt as usual, Ubuntu 18.04, with all recent updates. The display is not HiDPI, it has "regular" pixel density.

I tried to change font hinting by moving fontconfig files as described here https://askubuntu.com/a/29834/351113 (but used the /etc/fonts/conf.avail/10-hinting-none.conf as the source, of course) and it didn't solve this issue (after clearing Firefox cache and reboot)

Just to check it with something really obvious, I tried to disable font antialiasing in Gnome tweaks (which makes fonts obviously hideous) and it doesn't change font appearance in Firefox, so I'm pretty sure Firefox ignores Gnome font settings.

Creating ~/.fonts.conf with the appropriate contents also had no effect in Firefox.

As suggested in comments, I tried Firefox ESR and it is affected too.

Configuration files and directories: ~/.fonts.conf/, ~/.fonts.conf.d/ and ~/.fontconfig/*.cache-* are deprecated since fontconfig 2.10.1 and will not be read by default in the future versions of the package. New paths are $XDG_CONFIG_HOME/fontconfig/fonts.conf, $XDG_CONFIG_HOME/fontconfig/conf.d/NN-name.conf and $XDG_CACHE_HOME/fontconfig/*.cache-* respectively.

Ref: Fontconfig commit

Update: See thread Full font hinting not working in Ubuntu 18.04


Why won't Ubuntu tweak delete my Thumbnail Cache? In Ubuntu tweak 0.8.7 which is installed in my Ubuntu 14.04 LTS running unity I could not delete a particular file called 'fail' in the thumbnail cache. I am actually trying to remove that file with the 'Janitor' feature that is available with Ubuntu tweak. Every time I try deleting that file Ubuntu tweak crashes(i.e. closes). Why does this happen and how to delete it? By the way I could delete every other thumbnail cache file and also other kind of cache except this 'fail' file. Below is a screen shot:-

The ~/.cache/thumbnails/fail directory has somehow been owned by root when you(your user) should have been the owner. Ubuntu tweak crashed because it was trying to delete a file/folder which it is not permitted to and this has probably not been handled in it(might be bug, consider filing if not already filed against ubuntu-tweak).

First change the ownership of the folder by opening a terminal using Alt+F2 and typing "terminal" and then in the opened application, type the following:

sudo chown $USER:$USER ~/.cache/thumbnails/fail -R

and then reopen ubuntu tweak and try to clear the cache again.

Here the first $USER represents you as a user(is an environment variable set on boot and represents the user logged in) and the second one represents your group(the name of your group is same as your username, so can reuse the variable).

Refer to man chown for more.


Repeat a command every x interval of time in terminal? How can I repeat a command every interval of time , so that it will allow  me to run commands for checking  or monitoring  directories ?

There is no need for a script, i need just a simple command to be executed in terminal.

You can use  watch command, watch is used to run any designated command at regular intervals.

Open Terminal and type:

watch -n x <your command>

change x to be the time in seconds you want.

For more help using the watch command and its options, run man watch or visit this Link.

For example : the following will list, every 60s, on the same Terminal, the contents of the Desktop directory so that you can know if any changes took place:

watch -n 60 ls -l ~/Desktop

while true; do <your command>; sleep <time interval>;done

In this line of code, 1. the process will run continuously as we are using a while loop,
2. then do the command execution,
3. sleep for the time interval
as an example while true; do ./git.bash;sleep 20;done
this line automatically push my code to GitHub after every 20 second


How can I disable touchscreen while using Wayland? I am using Ubuntu Gnome 17.04.  My touchscreen is glitchey; I think it is a hardware issue.  I can disable my touchscreen when logged into Gnome using Xorg, but I can't figure it out when I login using Wayland.   Any advise?  Thanks! - Josh

Following steps in JNixus' answer on reddit gave me the result: touchscreen is disabled and touchpad still works:
https://www.reddit.com/r/Dell/comments/76jm9x/dell_xps_9343_linux_wayland_touchscreen_help/

Using the ability to disable a single USB device, we need just to create a UDEV rule. Create the file in

/etc/udev/rules.d/80-touchscreen.rules

With following information

SUBSYSTEM=="usb", ATTRS{idVendor}=="04f3", ATTRS{idProduct}=="20d0", ATTR{authorized}="0"

You can find idVendor and idProduct by running

cat /proc/bus/input/devices

You can reload the rules without restart

udevadm control --reload-rules && udevadm trigger

The other solutions do not work for my Lenovo Yago 710. Here's what I do:

Use lsmod to find the module for the touchscreen.

lsmod | grep touch

For me, it is hid_multitouch.
Disable it temporarily

sudo modprobe -r hid_multitouch

The modprobe -r unloads the kernel module (driver). The touchscreen should be disabled.
Make it permanent

Edit /etc/rc.local as

#!/bin/bash
modprobe -r usbhid

In Ubuntu 17.10, you may need to run

sudo systemctl enable rc-local.service

to make /etc/rc.local run on startup.


Cannot turn Bluetooth on on my Ubuntu 14.04 system My hardware has support for Bluetooth, but every time I need to use Bluetooth I have no option but to boot to Windows. I have tried many options, but most of them have failed to provide any solution. The basic problem is that I cannot turn the adapter on at all. This is what I get on the System Settings window:

As you can see, the Bluetooth and Visibility switches are frozen. I haven't yet found a way to remedy this. Ideas?

I had the same problem. But I follow the answer of Ralink RT 3290 Bluetooth Problem on Ubuntu 14.04 question, and luckly it solved the problem I had. I already modified the files that needed to be modified. You can download the file form http://www.filedropper.com/rtbth-393. All you have to do is go to the directory from terminal and run

make
sudo make install

And then reboot your computer. I attached a screen shot. It worked for me, hope it work for you too. Good luck.

Have you tried reinstall bluetooth, and enter this in the terminal:

 sudo apt-get install blueman
 sudo apt-get update
 sudo apt-get upgrade

and it might work fine this way.


Disable the confirmation of shutdown I have upgraded to 13.04 and now when I click on to the setting -. shut-down the is this stupid bar across asking if i want to shut-down, restart etc.
This was disables in all my previous versions, via gconf-editor and Tweak.

I have tried the terminal commands that are posted on the web and all the other information posted.

Can someone tell me how to remove this stupid Microsoft feature, when i cl lick ok to the shut-down button, I want to shut-down otherwise I would have pressed the restart or suspend button.

Cheers

Paul

Make an executable bash script on your desktop:

touch ~/Desktop/shutdown.sh; chmod +x shutdown.sh

Then, open the file, and paste the following inside:

#!/bin/bash

gksu shutdown now

And, then, whenever you want to shutdown, just execute the file. :)

UPDATE: Try this instead:

Change [password] to your password, and then save this into a file shutdown.desktop

[Desktop Entry]
Name=Shutdown
Exec=echo [password] | sudo -S shutdown now
Type=Application
StartupNotify=true
Path=/

Now, double-click to shutdown. You can also make one reboot.desktop, just change the part where it says shutdown to reboot. Hope this helps!


How can I launch Chromium from Dash/Unity with switches? I want to launch Chromium browser with the --no-referrers switch, which was mentioned on this site. However, I'm not sure how to do that.

Normally, I use the Dash to launch Chromium, how do I add the switch to block the referrers?

Thanks.

You need to edit the chromium-browser.desktop file a bit, but best practice is to edit a local copy of it in ~/.local/share/applications.

What you need to do

Copy the global chromium-browser.desktop from /usr/share/applications to ~/.local/share/applications

cp /usr/share/applications/chromium-browser.desktop ~/.local/share/applications

Open the file:

gedit ~/.local/share/applications/chromium-browser.desktop

Look for the first line, starting with

Exec=

Change it to:

Exec=chromium-browser --no-referrers

Save the file and log out/in to make Dash change its focus from the global chromium-browser.desktop file to the local one.

Alternatively

Maybe even better would be to set the option as a shortcut to your launcher. To do that:

Open the file (local copy, as described above) look for the line:

Actions=NewWindow;Incognito;TempProfile;

Change it into:

Actions=NewWindow;Incognito;TempProfile;No referrers;

At the very end of the file, add a section:

[Desktop Action No referrers]
Name=No referrers
Exec=chromium-browser --no-referrers
OnlyShowIn=Unity;

Then you'll have the option available as a shortcut, while you still can run `Chromium the "usual way".

(As said, after log out/in)

Download this. It is a program called Main Menu that lets you make launchers with custom commands. Create a new launcher and tell it to run the command chromium-browser --no-referrers. You can find a chromium logo on google and set it as the icon if you want. PS: To get the new launcher on the sidebar, search for it using the super (windows) key and drag it to the launcher.


Open terminal with multiple tabs and execute application which uniquely modifies PS1 variable for each tab What I'm trying to do:

Write a script to open 3 tabs.
cd into a different folder in each tab (ie: run a unique command).
get each tab to have a unique title by modifying its local PS1 variable
Ensure each tab stays open after the script is run

I want this scripted so I can click the script on my Desktop and have it open up terminals as I'd like for my daily development environment.

Description:

I have this script to try and open 3 terminal tabs with unique commands to be run in the tabs:

open_tabs.sh

#!/bin/bash

gnome-terminal --tab -- bash -ic "set-title title 1; exec bash"
gnome-terminal --tab -- bash -ic "cd ~; set-title title 2; exec bash"
gnome-terminal --tab

When I run it with ./open_tabs.sh, it opens up 3 new tabs, but unfortunately set-title doesn't work to set the tab title! It appears the PS1 variable isn't staying set with my set-title call. The exec bash is there to keep the tab open, per this answer and comments underneath it.

I have set-title defined as a function in ~/.bashrc like this. Its purpose is to set the title string at the top of any terminal window. It works perfectly when I use it manually. Ex: set-title hey how are you? will put "hey how are you?" at the top of my terminal window.

# From: https://unix.stackexchange.com/questions/177572/how-to-rename-terminal-tab-title-in-gnome-terminal/566383#566383
set-title() {
    # If the length of string stored in variable `PS1_BAK` is zero...
    # - See `man test` to know that `-z` means "the length of STRING is zero"
    if [[ -z "$PS1_BAK" ]]; then
        # Back up your current Bash Prompt String 1 (`PS1`) into a global backup variable `PS1_BAK`
        PS1_BAK=$PS1
    fi

    # Set the title escape sequence string with this format: `\[\e]2;new title\a\]`
    # - See: https://wiki.archlinux.org/index.php/Bash/Prompt_customization#Customizing_the_terminal_window_title
    TITLE="\[\e]2;$@\a\]"
    # Now append the escaped title string to the end of your original `PS1` string (`PS1_BAK`), and set your
    # new `PS1` string to this new value
    PS1=${PS1_BAK}${TITLE}
}

How do I fix this so that each tab runs a command, sets its title by modifying its PS1 variable, and stays open?

Note that gnome-terminal has deprecated its --title and --command options, hence these work-arounds.

Related:

bash: "command not found" when calling function defined in ~/.bashrc file in `bash -c` command while opening gnome-terminal tab
https://unix.stackexchange.com/questions/177572/how-to-rename-terminal-tab-title-in-gnome-terminal/566383#566383
Open Terminal with multiple tabs and execute application <== this is what I'm really trying to solve, but gnome-terminal's --command (-e) option is now deprecated!

# Option “--command” is deprecated and might be removed in a later version of gnome-terminal.
# Use “-- ” to terminate the options and put the command line to execute after it.

How to run a script without closing the terminal?

As is the case with most programming, solving the problem was extremely hard. I had to study a bunch about Bash variables, and how to use export and source (or the POSIX dot operator, .), and how bash loads, and what interactive -i bash mode was, etc etc.

I found man bash and man test to also be useful. Here's how to do what I want to do, which is:

Write a script to open 3 tabs.
cd into a different folder in each tab (ie: run a unique command).
get each tab to have a unique title by modifying its local PS1 variable
Ensure each tab stays open after the script is run

1st, add this to the bottom of your ~/.bashrc file:

# Function to allow a user to arbitrarily set the terminal title to anything
# Example: `set-title this is title 1`
set-title() {
    # Set the PS1 title escape sequence; see "Customizing the terminal window title" here:
    # https://wiki.archlinux.org/index.php/Bash/Prompt_customization#Customizing_the_terminal_window_title
    TITLE="\[\e]2;$@\a\]"
    PS1=${PS1_BAK}${TITLE}
}

# Back up original PS1 Prompt 1 string when ~/.bashrc is first sourced upon bash opening
if [[ -z "$PS1_BAK" ]]; then # If length of this str is zero (see `man test`)
    PS1_BAK=$PS1
fi

# Set the title to a user-specified value if and only if TITLE_DEFAULT has been previously set and
# exported by the user. This can be accomplished as follows:
#   export TITLE_DEFAULT="my title"
#   . ~/.bashrc
# Note that sourcing the ~/.bashrc file is done automatically by bash each time you open a new bash
# terminal, so long as it is an interactive (use `bash -i` if calling bash directly) type terminal
if [[ -n "$TITLE_DEFAULT" ]]; then # If length of this is NONzero (see `man test`)
    set-title "$TITLE_DEFAULT"
fi

2nd, create this script to open 3 unique tabs with 3 unique cd commands and 3 unique titles:

open_tabs.sh:

gnome-terminal --tab -- bash -ic "export TITLE_DEFAULT='title 1'; cd ..; exec bash;"
gnome-terminal --tab -- bash -ic "export TITLE_DEFAULT='title 2'; cd ../..; exec bash;"
gnome-terminal --tab -- bash -ic "export TITLE_DEFAULT='title 3'; cd ../../..; exec bash;"

Now open up a terminal and run the open_tabs.sh script:

./open_tabs.sh

Voila! It's magical! These 3 new tabs are now shown at the top of my terminal, and each has done the proper cd command I set, and each has the proper title I set!

This will all be placed into my dotfiles project: https://github.com/ElectricRCAircraftGuy/eRCaGuy_dotfiles.

Full and final solution: see here: Open Terminal with multiple tabs and execute application

I think you should use & to get your processes to run in background.

https://www.tecmint.com/run-linux-command-process-in-background-detach-process/


I added "notify-send hi user" to startup command but it is not working. How can i make it work? If I put "notify-send hi user" in terminal it shows notification. But when the same command is put into startup applications it does not work. I want to use this in my qt application

Try this

In terminal,

$sudo vim /home/user/hi.sh

#!/bin/sh
sleep 3
echo "Hi User!" | xargs -0 notify-send

save it.

In terminal

$gnome-session-properties

add
sh /home/user/hi.sh

Reboot and see if you can see Hi User!


iRedMail - Entered wrong mysql root password during install - how do I fix it? I just tried to install iRedMail on Ubuntu 16.04 following this tutorial: https://www.linuxbabe.com/mail-server/ubuntu-16-04-iredmail-server-installation

However, I entered the wrong root password during installation and could see a lot mysql errors saying the password was incorrect.

Is there any way I can redo this process? I also noticed that mail.domain.com/iredmail/ returned a 404 not found, but mail.domain.com/mail showed Roundcube but with this text

"DATABASE ERROR: CONNECTION FAILED!

Unable to connect to the database!
Please contact your server-administrator."

Re-run the install script again with the proper password.

Edit: The install script needs to be run with

sudo ./iRedMail.sh


How to undo an operation done in terminal? I had deleted an important file once
and later i had changed the permissions of a file
which i am not able to revert now. Is there any way through which i can undo delete or revert permissions on files while working with terminal?

And one more question about Ubuntu ... Why do we never get a dialog box asking 'are you sure you want to delete' as compared to windows.I see it as a flaw in Ubuntu GUI. Once you press delete,there it is in the trash but never prompts to ask if we really want it to be deleted and ofcourse, I know ppl would be like -- why you want reassurance before deleting...it is a part of HCI and should be implemented(I am sorry,just a beginner).

If deleted the file in a terminal with rm then it will not go to the trash, do it in filemanager and it will.

You 'might' be able to restore the file, but all the time you're using the system the area the file was in could be overwritten.

https://help.ubuntu.com/community/DataRecovery

You should be able to revert permissions on files.

https://help.ubuntu.com/community/FilePermissions

I think it may be in the trash.You may get to recover the important file from the trash.
otherwise I think you should download or make the file again.


Ubuntu 11.04 doesn't distinguish between audio outputs? My PC has two audio 3.5mm audio outputs:

back - used for speaker system
front - used for headset

This is my audio controller:

id:  multimedia description:    Audio
device product:     N10/ICH 7 Family High
Definition Audio Controller vendor:
    Intel Corporation physical id:   1b
bus info:    pci@0000:00:1b.0 version:
    01 width:   64 bits clock:  33MHz
capabilities:   pm msi pciexpress
bus_master cap_list configuration:
driver  =   HDA Intel latency   =   0
resources:   irq    :   44
memory  :   fea78000-fea7bfff

The problem is that up to ubuntu 10.10 I could right click the speaker symbol in notification area and switch between:

analog headphones (sound only over headphones)
analog output (sound on both headphones and speaker system)

This was very convinient because I didnt always have to shut down the speaker system if I only wanted to use headphones. Any idea what caused this change and how to fix it?

This is likely a PulseAudio issue.

Install the package padevchooser and then use it to configure your sound card.

Click the audio menu in the top right panel. Select Sound Preferences.

Switch to the Output tab. Choose the output you want to control in the Connector dropdown.


'Connection reset by peer' on lftp while uploading files I am working on a project where several Raspberry Pis gather sensor data and log them to several files, several times a day. I wanted to write a small script to upload all those files to an FTP server at the end of the day with crontab. So I wrote a script using lftp which worked at first but later started showing error.
Below is the script and verbose output. How can I fix it?
    #!/bin/bash
    HOST='ftp://xyz.com'
    USER='xxxxxx'
    PASS='xxxxxx'
    TARGETFOLDER='/home/xxxx'
    SOURCEFOLDER='/home/pi/yyyy'

    lftp -f "
    open $HOST
    user $USER $PASS
    debug -o lftp_debug.txt
    lcd $SOURCEFOLDER
    mirror --reverse --delete --verbose $SOURCEFOLDER $TARGETFOLDER
    bye
    "

output:
---- Connecting to xyz.com (xx.xx.xx.xx) port 21
<--- 220 (vsFTPd 3.0.3)
---> FEAT
<--- 211-Features:
<---  EPRT
<---  EPSV
<---  MDTM
<---  PASV
<---  REST STREAM
<---  SIZE
<---  TVFS
<--- 211 End
---> USER XXXX
<--- 331 Please specify the password.
---> PASS XXXX
<--- 230 Login successful.
---> PWD
<--- 257 "/home/XXXX" is the current directory
---> MKD /home
<--- 550 Create directory operation failed.
---> MKD /home/XXXX
<--- 550 Create directory operation failed.
---- CWD path to be sent is `/home/XXXX'
---> CWD /home/XXXX
<--- 250 Directory successfully changed.
---> PASV
**** control-socket: Connection reset by peer
---- Closing data socket
---- Closing control socket

##UPDATE 2##
Funny thing is when I log into the same FTP server through 'FTP' command with the same user and pass it works like a charm but when I log in through lftp with the same user and pass I was able to log into the server but as soon as I give ls command it shows the following output.
lftp user@xyz.com:~> ls
`ls' at 0 [Delaying before reconnect: 24]

##UPDATE 3##
I tried using SFTP instead and it worked properly. Hope this saves someone's time.

Do not use ftp. The problem you are having are likely related to the general confusion of connection direction in FTP. FTP uses two ports: One command connection, and one data connection. Traditionally the command connection was from client to server, and the data connection from server to client!

PASV is the opposite; it instructs the server to listen for the data connection from the client, and tell the client it's port number. It looks like this (unexpected to many) behavior is what's biting you.

However, in my opinion, continuing to use FTP is not an good alternative today. It's simply outdated, security wise and protocol wise.

You have several alternatives to FTP. If you use authentication, scp/sftp is a good alternative. It requires exactly one port, is authenticated and encrypted.

If you require anonymous submissions, http(s) is a good alternative. Either through a POST request, or with WebDAV. Http can also be set up to use authentication, and can be encrypted with TLS (https). It also opens only a single channel for both data and commands.

FTP is a 40 year old protocol. It's falling out of use, and as a consequence the software is not receiving as much attention as more popular webservers and ssh servers, and thus there's a higher chance of serious vulnerabilities surviving in the source code.

In addition the command for SCP'ing would be far simpler: scp * $user@$host:$targetfolder - and you could use key based authentication to avoid passwords in the script!


Apply MacBuntu Boot-screen/Splash in Ubuntu 16 After installing the MacBuntu transformation pack for my Ubuntu 16, when I boot my computer, the MacBuntu Boot-screen/Splash does not come. The apple logo does not show and I don't know why.

You might need to update the Plymouth to change the boot screen.

Run the following commands

    sudo update-alternatives --config default.plymouth
sudo update-initramfs -u

After the first command is executed it will ask you to select a Plymouth theme. Type in the number corresponding to the Macbuntu related Plymouth theme and hit enter. Next run the second command and after it is executed completely reboot the system to see changes.

You need to open the macbuntu.plymouth file and change the locations under [script]. Change every instance of "/lib" to "usr/share," being that apparently Ubuntu usually lacks the /lib files needed for this module, but you can redirect them to the existing ones in the /usr/share directory. Works every time for me.

sudo gedit /usr/share/plymouth/themes/macbuntu/macbuntu.plymouth

macbuntu.plymouth (Fixed)


ip forwarding enabled at every boot Recently I noticed that cat /proc/sys/net/ipv4/ip_forward returns 1, something that is not recommended and I generally do not enable things I do not need that increase my attack vector.

I thought, okay simply set net.ipv4.ip_forward=0 in /etc/sysctl.conf. After a reboot it still returned 1. Strange I thought, grepped the whole /etc directory for "net.ipv4.ip_forward" and found that ufw had it in the config file too, but commented. To be safe I also inserted net.ipv4.ip_forward=0 there. After a reboot ip forwarding was still enabled.
Temporary disabling works, by echoing zero to the proc file.

How could I trace which process changes that on boot?

Thanks in advance for help!

To enable the changes made in sysctl.conf you will need to run the command:

sudo sysctl -p /etc/sysctl.conf

Reference

How to Enable IP Forwarding in Linux

If you need to enable it in script you can use commands below to enable
sed -i 's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/' /etc/sysctl.conf
sysctl -p

or disable:
sed -i 's/net.ipv4.ip_forward=1/net.ipv4.ip_forward=0/' /etc/sysctl.conf
sysctl -p


Unable to update in ubuntu 14.04 While installing Google Chrome in my Ubuntu OS I'm getting the below error while updating.

You can delete the lock file with the following command:

sudo rm /var/lib/apt/lists/lock

You may also need to delete the lock file in the cache directory

sudo rm /var/cache/apt/archives/lock


Can't update to 20.04 from 19.10 So im rather new this whole linux stuff but i took a pc and installed 18.04 on it. after using that for a while i decided that i wanted a change in scenery so i upgraded to 19.10 since that was the version it told me was the latest... this all went fine, no complications at all. later on i was on my normal pc that runs windows and i made an ubuntu vm out of sheer boredom and saw that 20.04 was actually the latest release when i was looking for an iso as the one i had was still 18.04. so when i went back on to 19.10 machine i thought i would be as simple it was upgrading from 18.04, but boy was i wrong. the only error ive really gotten is "This version no longer supported. Please install a supported version." anyone have any ideas?

Ubuntu 19.10 is an edition with short time support. It is now end of life for just a little time, so indeed remaining installs cannot anymore be updated. Your only option now is to perform a fresh install.
A fresh install is in general the best approach. You then start afresh with a new system configured according to the latest insights. No old configuration data is lingering around.


How can I enable bonded network interfaces in Ubuntu 13.04/13.10/14.04 using NetworkManager This question is about network interface bonding in Ubuntu 12.04 Precise and newer (12.10 Quantal/13.04 Raring/13.10 Saucy/14.04 Trusty). Bonding is also known as network interface teaming, link aggregation, and port trunking.

There are instructions out there for setting up bonding by modifying /etc/network/interfaces (help.ubuntu.com, serverlab.ca) however I can't find any instructions or a tutorial on how to set it up using NetworkManager in Ubuntu.

How do I bond my wired (eth0) and wireless (wlan0) network interfaces together using NetworkManager?

Additional Info

As of NetworkManager 0.9.4 bonding is supported and NetworkManager 0.9.4 is included in Ubuntu 12.04 LTS Precise. NetworkManager is then updated in Ubuntu 12.10 Quantal to 0.9.6 and "slaves" were added in Ubuntu 13.04 Raring with NetworkManager 0.9.8

My answer is not the correct way, and doesn't provide the combined bandwidth of proper bonding, but does provide a sort of quick'n'dirty automatic "failover" that I've found acceptable for a laptop that is sometimes hooked up to ethernet.

Set a static IP address on both the Home Ethernet and Home Wireless profiles that you use, and use identical settings on both connections, including the IP address.  When using wireless and hooking up to ethernet, once the connection is established all packets will begin routing through the ethernet adapter exclusively.  When unplugged, the packets will resume transfer through the wireless, assuming it is still actively connected.

Completely the wrong way to do it, and doesn't provide any of the advanced benefits of bonding, but it will work for most laptop users.

I am using the Newest xUbuntu 14.04 Trusty Tahrir [or however you spell it] or this will work in ANY Ubuntu version or Flavor with or without network manager [UGH, that Network Manager software is a real pain compared to the interfaces definitions file IMHO].

Wouldn't you just sudo apt-get purge network manager and go ahead and use /etc/network/interfaces anyways?  It is there and once you manually specify [or not if you issue ifup [may need to use ifup -a (means all adapters) or possibly ifup after purging net manager it should reach out to DHCP and grab an address].

I use OpenVPN and have to as part of that use /etc/network/interfaces to manually specify my bridge connection and it's options.  Once you define [the default file should just go for DHCP without modification] your connections using the interfaces file you can just issue ifdown -a or ifup -a to disconnect and then reconnect to network after any modifications without restarting the machine.

Last once you use the interfaces file network manager will appear greyed out in the notification area.  This is normal you are no longer using Network Manager you are using ifup and ifdown.

And yes this is related to ifconfig so if you use ifconfig in terminal then you are already used to this system and have used it to view adapter info already ifconfig is part of the same package as ifdown and ifup and should be fully present and ready to go even from a fresh install you don't need to apt-get install anything for this to be usable.

Viola follow any /etc/network/interfaces directions needed and they work [and you get rid of a small annoying piece of software [If you google net manager you see people getting disconnected/reconnected randomly and other misc issues]. If you know how to handle the interfaces file this is FAR more easy AND WAY MORE STABLE [and not hard to learn, only took me roughly 30 min to iron out advanced options like setting the default DNS search domains, enabling promiscuous mode, etc] :-D

Hope that helps.


When will Ubuntu One for Windows be released? I wanted to know when will the Windows version of Ubuntu one be available? Does anyone have any information about it?

We will be releasing a public beta of the Windows client within the next couple weeks. When it's ready, we'll be sure to announce it on the Ubuntu One blog: http://voices.canonical.com/ubuntuone

Can we just assume that DropBox is the immediate solution: More space, less price, works on windows/linux/mac. I know its not a real "answer" but its my reason for not using ubuntu one. Also I could not even get it working since I think it wants some special Firefox plugin.


Nvidia over ATI: Choosing a video card Possible Duplicate:
  At Present Which is the best choice for a Ubuntu graphics card, AMD or nVidia?

This is more of a generic question, call it a pool of issues vs stability in Ubuntu world.
I am currently using an ATI HD video card. Although I got quite proficient in installing and dealing with ATI driver issues, I don't know anything about NVidia's problems or issues.

Looking through askUbuntu quite a lot, I see a lot of problems generated by the ATI video cards, and in comparison, I hardly see posts related to NVidia cards. Are the drivers for the latter so good that everything runs out of the box?

So, to keep it short, if I would to change my system now, should I go for an NVidia video card or should I stick to my ATI?

Currently the AMD drivers are more open to linux development. But before this Nvidia was way more stable for linux and AMD had the most issues. So AMD still has some catching up to do. I would say for now nvidia is still best to go with.
The most driver issues that I've experienced with nvidia was lately with optimus technology on newer laptops. The bumblebee project is doing a teriffic job at battling that however. It's a matter of adding a ppa or two, installing via apt-get and you're good to go.

It's your call. But even if you're not afraid to get your hands dirty I would not urge for AMD, because there's always something to do for the nvidia cards too to keep things running nice and smooth. If you want the least possible hastle it's a no brainer, nvidia.
Reasons being: 1) they're still ahead when it comes to driver stability.
2) nvidia used to be more stable and so it has a much larger comunity behind it to counter linux problems with nvidia cards.

As of now do not go for AMD cards. AMD cards has some issue due to which they are not usable in Gnome3 Environment. Luckily Ubuntu is not using Gnome3, otherwise I would have forced to use another distro. For last couple of months, I have used Gnome3 in many distros and they have the same screen flickering issue. Even after months, AMD did not resolved this issue. So better to stick with Nvidia.


Trying to get two websites on one server and ip Ok I've been looking around for a while and I'm pretty sure I have the virtualhost file configured properly.

<VirtualHost *:80>
ServerName example.com
Redirect permanent http://www.example.com/ /

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/example

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

ScriptAlias /cgi/ /var/www/html/cgi-bin/

<Directory /var/www/html/cgi-bin/>
    Options ExecCGI
    AddHandler cgi-script .py
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName example.net
Redirect permanent http://www.example.net/ /

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/example

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

<VirtualHost *:80>
ServerName test.com
Redirect permanent http://www.test.com/ /

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/test

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

This is one .conf file. Hopefully I can get 3 sites working on one ip address. I've looked around, and everything says that this should be working, but it's not. Typing in any of the domain names in on a browser only ever reveals one website, no matter what the DocumentRoot is set to.

Is there some other setting I should no about. Should I have multiple .conf files enabled. Should I work off of different ports.

Why is this not working.

First of all I got rid of the redirects as they were irrelevant.

Now I use ServerAlias
I also use DirectoryIndex
I set them up in different virtual hosts on same port using wildcard entry

Enabled all three and now it works.


how to make startup application to open the folder or inode/directory after booting? I think it will be awesome if after login the folder that locate not at the same localhost / can open it self like and application as skype and others. do we can make it because if this one works for it , it will help others people too that save musics and other file under the /home folder or the like me , i do need to click other partitions to listen songs and movie and other what i want is just single click when i do login. the partitions / folder / inode was open so i can simply click the Play button at the rhythmbox and click next just to watch the next edition of serial movies ^^
here the photos, i need this partition / hard disk to open during start-up "almacén hard disk. thx

for daniel request .

santos@santos:~$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 298.1G  0 disk
├─sda1   8:1    0     1K  0 part
├─sda2   8:2    0   100M  0 part
├─sda3   8:3    0  68.6G  0 part
├─sda4   8:4    0 130.9G  0 part /media/almacén
├─sda5   8:5    0  46.6G  0 part
├─sda6   8:6    0   2.3G  0 part [SWAP]
├─sda7   8:7    0  46.6G  0 part /
└─sda8   8:8    0   3.1G  0 part [SWAP]
sr0     11:0    1  1024M  0 rom

you need to edit your /etc/fstab file in order too mount the external hard drive partition on boot.
To do this type the following:

You need to get the UUID of your external hdd, type:

sudo blkid /dev/sda4

copy the line UUID="some-long-number"

now unmount the disk and make a folder to mount it in the future:

sudo umount /dev/sda4

then:

sudo mkdir /media/almacén

now type:

sudo nano /etc/fstab

and go to the end of the page using your arrow keys.

now copy&paste the following

#external hard drive almacén was on /dev/sda4 at the time of writing.
UUID=some-long-number  /media/almacén       auto        defaults        0     2

where UUID=some-long-number is the UUID you got from the 'blkid' command earlier
 (BUT WITHOUT THE " " )

Shutdown your computer, plug the external hdd back in and restart.
Your drive partition 'almacén' should now be mounted on '/media/almacén' on login.

You may need to create an autostart folder, but you can do it this way:

gnome-desktop-item-edit /home/yourUser/.config/autostart/nameYourShortcut.desktop --create-new

For the command in your new short cut that will be launched at startup use:

nautilus /the/directory/path/here


Missing files in /home directory after boot crash during software update I'm using Ubuntu 14.04; during a routine software update the PC crash for some reason. Here is the situation now:

Looping during desktop log-in: each time I try to log-in via the desktop it loops back to the same screen.
ctrl + alt + F1 and SSH log-ins work and I can browse the file directory.
Problem ->  /home directory is missing all the files and folders! There are indications that files are still on the hard drive (i.e. disk usage ~17GB data on it etc.)
Used "TestDisk" to make an image and PhotoRec to extract whatever I can. There are snippets of my files here and there but all scattered.

Any suggestions or help would be greatly appreciated.

Update: This message shows up too: "No directory logging in with home=/"

Update: Running "lsblk" outputs

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 931.5G  0 disk
sda1   8:1    0   100M  0 part
sda2   8:2    0   600G  0 part
sda3   8:3    0     1K  0 part
sda5   8:5    0   3.7G  0 part [SWAP]
sda6   8:6    0 327.7G  0 part /
sdb      8:16   0 238.5G  0 disk
sdb1   8:17   0   128M  0 part
sdb2   8:18   0 238.4G  0 part

Running df -h outputs

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda6       323G   17G  290G   6% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
udev             16G  4.0K   16G   1% /dev
tmpfs           3.2G  1.3M  3.2G   1% /run
none            5.0M     0  5.0M   0% /run/lock
none             16G  144K   16G   1% /run/shm
none            100M   40K  100M   1% /run/user

Update: Running ls -la outputs:

total 116

drwxr-xr-x  26 root root  4096 Sep 17 21:37 .
drwxr-xr-x  26 root root  4096 Sep 17 21:37 ..
drwxr-xr-x   2 root root  4096 Sep 14 15:53 bin
drwxr-xr-x   3 root root  4096 Sep 14 16:14 boot
drwx------   3 root root  4096 Sep 14 15:33 .cache
drwxrwxr-x   2 root root  4096 May 23 17:50 cdrom
drwxr-xr-x  15 root root  4180 Sep 18 11:52 dev
drwxr-xr-x 135 root root 12288 Sep 18 11:52 etc
drwxr-xr-x   2 root root  4096 Sep 14 15:20 home
lrwxrwxrwx   1 root root    33 Sep 14 14:59 initrd.img -> boot/initrd.img-3.13.0-35-generic
lrwxrwxrwx   1 root root    33 Aug 27 10:33 initrd.img.old -> boot/initrd.img-3.13.0-34-generic
drwxr-xr-x  24 root root  4096 Sep 14 16:14 lib
drwxr-xr-x   2 root root  4096 Sep 14 14:56 lib32
drwxr-xr-x   2 root root  4096 Sep 14 14:56 lib64
drwx------   2 root root 16384 May 23 17:48 lost+found
drwxr-xr-x   3 root root  4096 May 23 18:02 media
drwxr-xr-x   4 root root  4096 May 23 19:45 mnt
drwxr-xr-x   3 root root  4096 May 24 18:31 opt
dr-xr-xr-x 166 root root     0 Sep 18 04:52 proc
drwx------  10 root root  4096 Sep 14 17:02 root
drwxr-xr-x   2 root root  4096 Jul  6 08:41 .rpmdb
drwxr-xr-x  22 root root   760 Sep 18 11:54 run
drwxr-xr-x   2 root root 12288 Sep 14 16:14 sbin
drwxr-xr-x   2 root root  4096 Apr 16 18:21 srv
dr-xr-xr-x  13 root root     0 Sep 18 04:52 sys
drwxrwxrwt   4 root root  4096 Sep 18 11:54 tmp
drwxr-xr-x  11 root root  4096 May 24 18:15 usr
drwxr-xr-x  13 root root  4096 Apr 16 18:29 var
lrwxrwxrwx   1 root root    30 Sep 14 14:59 vmlinuz -> boot/vmlinuz-3.13.0-35-generic
lrwxrwxrwx   1 root root    30 Aug 27 10:33 vmlinuz.old -> boot/vmlinuz-3.13.0-34-generic

ls -la /home output:

total 8
drwxr-xr-x  2 root root 4096 Sep 14 15:20 .
drwxr-xr-x 26 root root 4096 Sep 17 21:37 ..


How do I install graphics.py on Ubuntu 14.04? I need to install graphics.py for class. How do I do that, and how do I install other Python modules?

Here is a guide:

  Start at Zelle’s Python page at http://mcsp.wartburg.edu/zelle/python/.

  The graphics module is listed as *graphics.py. RIGHT-CLICK on the link and then select >Save Link As

  On a PC save the link in C:\Python31\Lib\site-packages

  On a Mac save the link in

  /Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/site-packages/

  On Ubuntu save the link in

  /usr/lib/python3/dist-packages

to correct No module named Tkinter and _tkinter

sudo apt-get install tk-dev
cd /Python3.4.1
./configure
make
sudo make install


Steam dependencies can't be installed I found a few questions that were similar to this but none of them were enough like my particular case to be of any use.

Whenever I open Steam, a terminal opens up:

Steam needs to install these additional packages:
    libgl1-mesa-dri:i386, libgl1-mesa-glx:i386

I enter my password and hit enter:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libgl1-mesa-glx:i386 : Depends: libglapi-mesa:i386 (= 10.5.0~git20150204.661c8bb2-0ubuntu0ricotz~trusty)
 unity-control-center : Depends: libcheese-gtk23 (>= 3.4.0) but it is not going to be installed
                        Depends: libcheese7 (>= 3.0.1) but it is not going to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
Press return to continue:

This is a fresh install of Ubuntu 14.04 and Steam. The last time I tried this, I ended up screwing the system up trying to resolve these various dependencies. What steps do I need to take to fix this?

If it matters, this is 64-bit, I'm using my gtx980 graphics card's NVIDIA driver installed from a PPA, and I can provide any hardware info if necessary.

I tried using the
    sudo apt-get install libgl1-mesa-dri:i386 libgl1-mesa-glx:i386
command and a second time with the -f option, with the latter resulting in:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
libgl1-mesa-glx:i386 : Depends: libglapi-mesa:i386 (=
10.5.0~git20150204.661c8bb2-0ubuntu0ricotz~trusty)
unity-control-center : Depends: libcheese-gtk23 (>= 3.4.0) but it is not going to be installed
                    Depends: libcheese7 (>= 3.0.1) but it is not going to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

Try sudo apt-get install libgl1-mesa-dri:i386 libgl1-mesa-glx:i386.
If that fails, or it doesn't fix the problem, do sudo apt-get install -f.


How can I install chainer-cuda-deps? I am attempting to install chainer-cude-deps. When I try to install (sudo pip install chainer-cuda-deps), I get the following error:

    In file included from src/cpp/cuda.cpp:1:0:
    src/cpp/cuda.hpp:14:18: fatal error: cuda.h: No such file or directory
     #include <cuda.h>
                      ^
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-sLLkNT/pycuda/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-OAHHif-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-sLLkNT/pycuda

This is following the following previous steps:

sudo pip install chainer
sudo dpkg -i cuda-repo-ubuntu1410-7-0-local_7.0-28_amd64.deb

What should I do to try to install chainer-cuda-deps?

It is a problem of pycuda.
setup.py of pycuda checks nvcc command and guesses a root directory of CUDA.

https://github.com/inducer/pycuda/blob/master/setup.py#L30

..., and then it sets include directory of CUDA.

https://github.com/inducer/pycuda/blob/master/setup.py#L93

All you need is set path correctly before pip.

PATH=/usr/local/cuda-7.0/bin:$PATH
pip install chainer-cuda-deps

Please try it!

Put incidentally to write my environment
On the assumption #CUDA is that it is installed properly
CUDA Relationship of PATH (by rewriting your environment)
CUDA_ROOT=/usr/local/cuda-7.0
PATH=$PATH:/usr/local/cuda-7.0/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-7.0/lib64:/usr/local/cuda-7.0/lib
CPATH=$CPATH:/usr/local/cuda-7.0/include
CUDA_INC_DIR=/usr/local/cuda-7.0/bin:$CUDA_INC_DIR
Installing from source of #pycuda
git clone --recursive http://git.tiker.net/trees/pycuda.git
cd pycuda
python configure.py
sudo python setup.py install
sudo make install


transfer photo from ubuntu to iphone My pc is ubuntu 14.04. My iphone is ios9.

When I connect iphone with my pc via USB, I can copy any photo in my iphone (under directory DCIM) to my PC, then I'm able to open the photo on my PC.

However, when I copy a photo from the PC to the DCIM folder of my iphone, the photo is not show inside the icon "Photos" in iphone. That is, I cannot access the copied photo on my iphone. Any ideas?

As for now, only PTP photo access works with iOS 9 and later. Simply sorry to say but Camera/Photo Synchronization is not available with iOS 9 through libimobiledevice library. But you can upload photos to icloud library from your computer and later access them on your iPhone. That's what I'm doing

Iphone does not connect well with latest ubuntu version via USB cable.
I use an App on Iphone: Wifi Photo (there are a lot of other apps) and I can backup my photos via Wifi


How to move multiple files at once to a specific destination directory? I got a bunch of files in some directory (along with many other files) that I want to move.

Luckily, all the files I want to move contain a certain identifier in their names, so I can ls | grep IDENTIFIER to get the exact list of files to move.

But, how can I execute mv file /path/to/dest/folder/ at once, and not one by one (there's a lot of files to move)?

You could use

mv -t DESTINATION file1 file2 file3

and

mv -t DESTINATION  `ls|grep IDENTIFIER`

works, but I'm not sure if mv is invoked multiple times or not as grep will output a new line for each match.

If you are using fish shell most things are fortunate. So it simple goes like this, just key in the destination as the last file.

mv file1 file2 file3 DESTINATION


Can I download & Install the wallpapers from 12.10 on 12.04.1? I was googling regarding Ubuntu 12.10 (Quantal Quetzal); pretty much liked the wallpapers. Just out of curiosity, can I install the wallpapers from a higher release (12.10) on a previous release Precise (12.04.1) without upgrading to 12.10.

I have tried the following:-

ankit@stream:~$ sudo apt-get install ubuntu-wallpapers-quantal
[sudo] password for ankit:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package ubuntu-wallpapers-quantal

I have followed this post; but this for installing wallpapers from previous releases on the current release.

Any ideas how can this be achieved.

Yes just search in the Software centre for "Wallpaper".

You should get the default papers going all the way back to karmic or something like that.

I install them from other releases.

Source code

Launchpad Ubuntu Wallpapers


How to harden an SSH server? What measures can/should I take to make sure that security around my SSH server is absolutely impermeable?

This will be community wiki from the start, so lets see what people do to secure their servers.

Use public/private key pairs for authentication instead of passwords.

Generate a passphrase-protected SSH key for every computer that needs to access the server:

ssh-keygen
Permit public-key SSH access from the allowed computers:

Copy the contents of ~/.ssh/id_rsa.pub from each computer into individual lines of ~/.ssh/authorized_keys on the server, or run ssh-copy-id [server IP address] on every computer to which you are granting access (you'll have to enter the server password at the prompt).
Disable password SSH access:

Open /etc/ssh/sshd_config, find the line that says #PasswordAuthentication yes, and change it to PasswordAuthentication no. Restart the SSH server daemon to apply the change (sudo service ssh restart).

Now, the only possible way to SSH into the server is to use a key that matches a line in ~/.ssh/authorized_keys. Using this method, I don't care about brute force attacks because even if they guess my password, it will be rejected. Brute-forcing a public/private key pair is impossible with today's technology.

I wrote a small tutorial on doing this recently. Basically, you need to be using PKI and my tutorial also shows how to use Two-Factor Authentication for even more security.  Even if you use none of those things, there's also some tidbits about securing the server by removing weak cipher suites and other basics. https://joscor.com/blog/hardening-openssh-server-ubuntu-14-04/


MALWARE on my Ubuntu 16.04.01 lts I have malware which puts advertising in all my browsers.

Originally I installed Windows 10 and shortly thereafter, my computer was infected.

I erased the hard drive and installed Ubuntu 16.04.1 LTS. However, ads still appear in the Firefox browser plus the native Ubuntu web browser. A screenshot to show examples of the ads.

The left side of the picture is an normal browser without infection and the right side is the infected browser. When i see the same page in my other computer looks like the left-side image.

PS: Any thoughts on what kind of virus or malware this is?  In the other PC's Firefox browser (Firefox), on the same wifi with the same ISP, infection has not yet appeared.

I would use an AntiVirus vendor solution to examine the PC.
Avira has one available for non-commercial use. You install it on a USB device and then boot to it (which may require adjusting BIOS settings)

Link: https://www.avira.com/en/download/product/avira-rescue-system

To your question, this will (hopefully) identify the malware if indeed it exists. Of course, no solution is absolute.

For everybody who HAS a problem like me, i dont found a solution. The only solution is a low level format and reinstal everything!. Meanwhile i have a usefull and wonderfull browser named BRAVE. This browser blocks every advertising from the malware who try to put in my webpages so, its a "temporal" solution. The malware and me, meanwhile still living togheter, in company until im format my hard disk. But thanks to this browser, them cant take money from ads, so, i recommend it to all who is tired to se advertising everywhere. THANK YOU SO MUCH, to the community for help me and support me. My greetings to all!!


I can't upgrade to 12.10 Possible Duplicate:
  No facility exists in Update Manager (12.04) to upgrade to 12.10. Why?

I'm on 12.04 and I go to Update Manager but it keeps saying it's up-to-date even though it doesn't have 12.10.

Is there something I have to do, some dev channel I need to be subscribed to, to get this to work?

Check this guy out, [How To] Upgrade Ubuntu 12.04 to Ubuntu 12.10.


Cannot find install-sh, install.sh, or shtool in ac-aux This is my first time trying to compile and install anything on a linux machine. I got the latest version of https://github.com/processone/exmpp via git and read the instructions which state:

  2. Build and install

  Exmpp uses the Autotools. Therefore
  the process is quite common:

$ ./configure
$ make
$ sudo make install

after type ./configure I get the error

  Cannot find install-sh, install.sh, or shtool in ac-aux

Google was of little to no help. Not sure at all what I'm supposed to do. Any help would be much appreciated

I got it to create the configure script using the following tools:

libtoolize --force
aclocal
autoheader
automake --force-missing --add-missing
autoconf
./configure

I don't have all the dependencies so I can't test it right now, but this is generally how you would create a configure script from an ac file.

I had a similar problem when i tried to ./configure a source code and got the same error as posted. Finally resolved my issues by entering the code:

sudo apt-get install autotools-dev


New iBus in Ubuntu 13.10 I'm having a hard time figuring out how to type using the Japanese Anthy method in this new iBus on Ubuntu 13.10, since iBus is the default input method it's been changed since the last release. Is it even possible to do that?

It seems all the settings has been moved to the regional settings screen. I use gnome shell, and you can find everything under Region & Language / Input Sources settings.

u haven't install ibus on ubuntu 13.10.it supply langue support already.when u want to active your languague which ubuntu not have yet....u can go go to langue support ->install/remove  languagues... tick on your languages u want to install.apply..it work for me with vietnamese unikey(default vietnamese telex)
Regards..


Scheduling StartUp and ShutDown I use Torrents often, so I need to know how to make my computer start up and shut down automatically, Wi-Fi is switched on at six in the morning in my hotel and switched off at two AM. (I am able to schedule torrents, that's not a problem), I don't want my computer always plugged in to a power supply.

For a one-time shutdown you can use

shutdown -h 02:00

To schedule it you can use cron. There are some GUIs for it like gnome-schedule.

But to start machine on schedule you have to look at BIOS/UEFI settings.

Update: check the answers about MythTV and Wake on Plan below to schedule startup.

I suggest this command in your cron:

dbus-send --system --print-reply --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend

This does not need root.


How do I set the output of a function as a variable value in a bash script? I have the following function to count the number of files in a directory, within my bash script.

file_count() {
  no_of_files=$(find "$1" -maxdepth 1 -type f -printf '.' | wc -c)
}

I'd like to use it repeatedly on different directories and save the count into a variable for each directory. Currently to do this, I use

file_count $somedir
files_in_somedir="$no_of_files"

I'm aware that I'm setting the no_of_files variable outside of the function each time, and would like to make it local to the function, not settign an intermediate variable in the main script. This is just in case there's some mistake meaning that the variable doesn't change between calls of the function (mistyping the function name maybe), and the old value of no_of _files is used.

If my function were:

file_count() {
  local no_of_files=$(find "$1" -maxdepth 1 -type f -printf '.' | wc -c)
}

How would I easily set these directory count variables?

Bash functions are not like functions on other programming languages, they are more like commands. This means they have no classical return value, but

an exit/return code. This is an integer number in the range 0-255, where 0 means "success" and every other value represents an error. If you try to specify a number outside this range, it will be taken modulo 256 (add or subtract 255 from your number until it fits the range 0-255).

This code is automatically set to the return code of the last statement that got executed inside the function, unless you manually set it using the return command, like this:

return 1

output streams. Each Bash function can write arbitrary strings to the output streams (STDOUT and STDERR), just like normal scripts. The output can either be directly from the commands you run in the function, or set manually by using echo.

But instead of letting this output get displayed in the console, you can capture it when you run the function, e.g. using Bash's command substitution syntax, and store it in a variable in your main script:

example_function() {
    # do something useful
    echo "return this message"
}

returned_value="$(example_function)"

So your code would have to look like this:

file_count() {
    find "$1" -maxdepth 1 -type f -printf '.' | wc -c
    # the line above already prints the desired value, so we don't need an echo
}

files_in_somedir="$(file_count "$somedir")"

See Return value in bash script (on Stack Overflow) for more info.

I'm a C++ programmer, so I like to mimic the "getter and setter" philosophy, where you use tiny little functions to get and set the value of a variable.  I know there are some non-portable solutions out there like new versions of declare, but I like writing only portable code.  The downside to using getters and setters is that you need to create a function (or two functions) for every value you want to manage.  So... I made a "factory function" that handles creating getters/setters for you (below).  Then, you just drop the equals sign for setting, and everything else looks pretty similar (see usage)... except now, you can pass "pointer-like things" into functions.
makeGetSet() {
. /dev/fd/0 <<END_FUNC
${1}Val()  { [ "\${1}" ] && ${1}="\${1}" || echo "\${${1}}"; }
END_FUNC
}

Usage:
Setup: makeGetSet myVariable
Set: myVariableVal newValue
Get: anotherVariable="`myVariableVal`"
Print: myVariableVal

It does not require any particular shell (100% POSIX) with special features like indirection or namerefs, or the declare utility.  You just pass in your variable name to makeGetSet, and your getter/setter function has that same name with a "Val" at the end (e.g. myVariableVal).  Tested with bash and dash.
For your specific question, you would use it like this:
makeGetSet files_in_somedir

file_count() {
  "${2}" $(find "$1" -maxdepth 1 -type f -printf '.' | wc -c)
}

file_count "/some/directory" files_in_somedirVal


System Monitor fails to start - unable to find default local file monitor type Ubuntu 18.04 - System monitor fails to start.

Launching gnome-system-monitor from the terminal produces the following error:

(gnome-system-monitor:17633): glibmm-CRITICAL **: 09:35:39.143:
unhandled exception (type Glib::Error) in signal handler:
domain: g-io-error-quark
code  : 0
what  : Unable to find default local file monitor type

I have tried reinstalling with:

snap remove gnome-system-monitor
sudo snap install gnome-system-monitor

$ killall gnome-screensaver

I do not know why,but it works! There are too many gnome-screensaver in ps aux.

See bug report on launchpad: Unable to launch gnome-system-monitor


How to monitor NetworkManager connectivity? I want to start a certain application when NetworkManager connects to certain WiFi. But from DBus, I could not find such signal from NetworkManager except a notification of libNotify.
Is there a more direct way?

NetworkManager includes an nmcli program, which has a monitor command. Here is what its output looks like for me when I disconnect then connect to a Wi-Fi access point:

$ nmcli monitor
There's no primary connection
wlp4s0: unavailable
Networkmanager is now in the 'disconnected' state
wlp4s0: disconnected
wlp4s0: using connection 'CyberShadowPC'
wlp4s0: connecting (prepare)
Networkmanager is now in the 'connecting' state
wlp4s0: connecting (configuring)
wlp4s0: connecting (need authentication)
wlp4s0: connecting (prepare)
wlp4s0: connecting (configuring)
wlp4s0: connecting (getting IP configuration)
wlp4s0: connecting (checking IP connectivity)
wlp4s0: connecting (starting secondary connections)
wlp4s0: connected
Networkmanager is now in the 'connected' state
'CyberShadowPC' is now the primary connection

It looks like it should be easy to parse its output and run appropriate actions as necessary. Here's a bash script which runs a command when a NetworkManager connection becomes the active primary one:

#!/bin/bash
set -euo pipefail

connection_name=CyberShadowPC
command=(notify-send "Connected to $connection_name!")

LC_ALL=C nmcli monitor | \
    while read -r line
    do
        if [[ "$line" == "'$connection_name' is now the primary connection" ]]
        then
            "${command[@]}"
        fi
    done

While it's certainly possible to use dbus , personally I'd go with simple bash while loop + awk

while [ "$(iwconfig 2> /dev/null |  awk '/Access Point/ && /XX:YY:ZZ:11:22:33/ {print "true" }')" != "true" ]; do : ; sleep 0.25 ;done ; echo DONE

What is happening there ? While loop keeps running, testing output of iwconfig filtered out with awk. So far as the awk doesn't find  the mac address of the access that you want to connect to, loop continues running. As soon as awk sees that you've associated with that particular AP , the test condition [ "String1" != "String2" ] becomes false, loop breaks , and goes on to the echo DONE command. Of course , echo DONE is what can be replaced with the program that you want to run.

This command can be ran manually or placed into a script, and the script added to the Startup Application list.

Simple, straightforward, and does the job. Like I said in the beginning, it is possible to use dbus , but is not as simple.