How do free software companies make money?

How do companies that provide free (as in beer) software make money? I'm thinking of things like Linux distros, as some even provide free overseas shipping!


Ubuntu Desktop lost

On my Ubuntu 10.10 system, after configuring an external CRT to clone my desktop over S-Video, I've lost my desktop icon and right clicking on it does not show the menu or the menu bar. I've tried to resolve this with following commands:               sudo apt-get install ubuntu-desktop     sudo apt-get install gnome-panel     sudo chown -R $ USER: $ USER /Scrivania      Using the following sequence of commands I've gotten the main menu back, but nothing I have found so far will get back my desktop:               mkdir ~/.oldpanel     mv ~/.gconf/apps/panel ~/.oldpanel     gconftool-2 --shutdown     pkill gnome-panel     sudo apt-get install --reinstall ubuntu-desktop      Have you any idea how to resolve my problem?


How to run a command inside screen such that you can get back to the command's parent shell?

What's the best way to run a command inside a screen session such that its parent shell can be accessed? I want to be able to restart it from within the same screen session. The best I've managed to come up with is the following:               $ cat mr-t.sh      #!/bin/bash          top     exec /bin/bash      and then:               screen -e'^\\\' -S top-in-screen ./mr-t.sh      Then, if top stops running, I'll at least get a new shell within the same screen session I can work with. This isn't very elegant, though, and I can't quite convince myself that the signal will reliably be sent to the right process if I hit C-c. Moreover, C-z doesn't work at all. I'm using bash 3.2.48 on OSX and 3.2.39 on Linux. Both are probably patched by OS vendors. There's nothing special about the `top` command here, of course. [As an aside, `-e'^\\\\\'` reassigns the Magick Screen Key from C-a (a bad default if there ever was one) to C-\.]


I'm running Arch with 3.6.10 kernel, When vboxpci module is loaded, it tells me `vboxpci: IOMMU not found (not registered)`, But I checked my kernel config, I have the INTEL_IOMMU set already (I uses a Thinkpad X220)               CONFIG_GART_IOMMU=y     # CONFIG_CALGARY_IOMMU is not set     CONFIG_IOMMU_HELPER=y     CONFIG_IOMMU_API=y     CONFIG_IOMMU_SUPPORT=y     # CONFIG_AMD_IOMMU is not set     CONFIG_INTEL_IOMMU=y     CONFIG_INTEL_IOMMU_DEFAULT_ON=y     CONFIG_INTEL_IOMMU_FLOPPY_WA=y     # CONFIG_IOMMU_STRESS is not set      Kernel command: > BOOT_IMAGE=/boot/vmlinuz-linux root=/XX processor.ignore_ppc=1 apparmor=1 > security=apparmor intel_iommu=on Any suggestions? Althrough VBox starts, but still wondering why.


High availibility setup with NFS

### Web hosting HA setup I have 5 servers:               Server-1:     Webhosting Controlpanel (192.168.1.1)     Server-2:     Load balancer [Haproxy] (Public IP:192.168.1.2 and                    Virtual IP:192.168.1.3)     Server-3 & 4: Data Servers Mounted data from NFS so data is same on                    each server i.e /home (192.168.1.4, 192.168.1.5)     Server-5 :    NFS Server (192.168.1.6) shared directory /home      My problem is I'm not able to mount `/home` from virtual IP of "load balancer". I don't know how to configure HAproxy to access shared folders from servers. I can access the mounted directories `/home` from servers directly but I want to mount the `/home` by load balancer so that I have some HA setup. **NOTE** Load balancer is working for Apache I can see the Apache default page loading from virtual IP of the load balancer. Here is a model image of setup:           ![ss of image](http://i.stack.imgur.com/ozQcx.png)


Adding a file to /etc of initramfs in Debian Wheezy

I have added the file `/etc/initramfs-tools/etc/motd` so that it would be available in /etc of the initramfs environment. However, it does not turn up. This is my second try where I gave the file all permissions available (I've also used 600):               root@cow:~# ls -l /etc/initramfs-tools/etc/     total 8     drwx------ 2 root root 4096 Sep 19 00:57 dropbear     -rwxrwxrwx 1 root root  117 Sep 29 15:32 motd      After that I `sudo update-initramfs -u`, boot into the initramfs environment and log in through SSH via Dropbear, and the file is still not there:               ~ # ls -l /etc     total 20     -rw-------    1 root     0             4077 Sep 29 13:44 boottime.kmap.gz     drwx------    2 root     0                0 Sep 29 13:44 dropbear     -rw-r--r--    1 root     0             1991 Sep 29 13:44 ld.so.cache     -rw-r--r--    1 root     0               34 Sep 18 17:24 ld.so.conf     drwxr-xr-x    2 root     0                0 Sep 18 17:25 ld.so.conf.d     drwx------    2 root     0                0 Sep 29 13:44 lvm     drwx------    2 root     0                0 Sep 29 13:44 mdadm     drwx------    2 root     0                0 Sep 29 13:44 modprobe.d     -rw-------    1 root     0               15 Sep 29 13:44 nsswitch.conf     -rw-------    1 root     0               30 Sep 29 13:44 passwd     drwx------    2 root     0                0 Sep 29 13:44 udev      How should I add it? Why didn't the above way work?


How to find which Process is causing High CPU usage

Is there any way to find out from terminal which process is causing high CPU Usage ? It would also be useful to order processes in descending order of cpu Usage


PPPD hangs, running over console port

I am trying to run the PPP daemon on the console port of my board which has p2020 processor with Linux kernel 2.6.32. After running ppp interface ppp0 is not coming up and I get an error `pppd blocked for more than 120 sec`. I am not able to debug this. How can I prevent this error from occurring? syslog output given below.               INFO: task pppd:2957 blocked for more than 120 seconds.     "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.     pppd D 0fe61c98 0 2957 2953 0x00000002     Call Trace:     [eec93d10] [c021ace4] n_tty_set_termios+0x3f8/0x59c (unreliable)     [eec93dd0] [c0007920] __switch_to+0x54/0xb0     [eec93de0] [c0381e8c] schedule+0x1f0/0x2f8     [eec93e20] [c021f308] tty_ldisc_ref_wait+0x6c/0xb0     [eec93e60] [c0218888] tty_ioctl+0x13c/0x9dc     [eec93e90] [c00b0aa4] vfs_ioctl+0x34/0x8c     [eec93ea0] [c00b0cc8] do_vfs_ioctl+0x88/0x72c     [eec93f10] [c00b13ac] sys_ioctl+0x40/0x74     [eec93f40] [c000f998] ret_from_syscall+0x0/0x3c     INFO: task pppd:2957 blocked for more than 120 seconds.     "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.     pppd D 0fe61c98 0 2957 2953 0x00000002


Alsaaudio module, recording for specific amount of time

The below code records the audio for some time (I don't know how much) How to calculate the total time of its recording? For example, if I want to record for just one minute then how would I limit its time?               #!/usr/bin/env python          ## recordtest.py     ##     ## This is an example of a simple sound capture script.     ##     ## The script opens an ALSA pcm forsound capture. Set     ## various attributes of the capture, and reads in a loop,     ## writing the data to standard out.     ##     ## To test it out do the following:     ## python recordtest.py out.raw # talk to the microphone     ## aplay -r 8000 -f S16_LE -c 1 out.raw               # Footnote: I'd normally use print instead of sys.std(out|err).write,     # but we're in the middle of the conversion between python 2 and 3     # and this code runs on both versions without conversion          import sys     import time     import getopt     import alsaaudio          def usage():         sys.stderr.write('usage: recordtest.py [-c <card>] <file>\n')         sys.exit(2)          if __name__ == '__main__':              card = 'sysdefault:CARD=Device'              opts, args = getopt.getopt(sys.argv[1:], 'c:')         for o, a in opts:             if o == '-c':                 card = a              if not args:             usage()              f = open(args[0], 'wb')              # Open the device in nonblocking capture mode. The last argument could         # just as well have been zero for blocking mode. Then we could have         # left out the sleep call in the bottom of the loop         inp = alsaaudio.PCM(alsaaudio.PCM_CAPTURE, alsaaudio.PCM_NONBLOCK, card)              # Set attributes: Mono, 44100 Hz, 16 bit little endian samples         inp.setchannels(1)         inp.setrate(44100)         inp.setformat(alsaaudio.PCM_FORMAT_S16_LE)              # The period size controls the internal number of frames per period.         # The significance of this parameter is documented in the ALSA api.         # For our purposes, it is suficcient to know that reads from the device         # will return this many frames. Each frame being 2 bytes long.         # This means that the reads below will return either 320 bytes of data         # or 0 bytes of data. The latter is possible because we are in nonblocking         # mode.         inp.setperiodsize(160)              loops = 1000000         while loops > 0:             loops -= 1             # Read data from device             l, data = inp.read()                  if l:                 f.write(data)                 time.sleep(.001)


How do I get the DISTRIB_CODENAME?

Which is the shortest way to get the variable `$DISTRIB_CODENAME` from `/etc/lsb-release`? I want to make this somewhat shorter:               $ sudo add-apt-repository \       "deb http://some-repo/ubuntu $(grep CODENAME lsb-release |sed s/^.*=//g) main"


understanding ps -ef output

root@he:/home/he# ps -ef|grep init     root         1     0  0 08:40 ?        00:00:02 /sbin/init     root      3557  3545  0 10:09 pts/0    00:00:00 grep --color=auto init      What are various columns representing here?


Track down process that has notty

I have a Linux server (Red Hat 2.6 kernel) which had a spike in load due to an Rsync process which seems to have forked many times, but the process was run by rsyncuser@notty I didnt see any cron job scheduled for that time with an rsync that is run under that name, and I assume if there were it would have a tty. How do I track down what the actual command which caused these processes was?


I just want to install a package!

I spent a few hours trying to install a package and didn't succeed; it seems like that just happens sometimes in a Linux environment. Background: The package I want to install is available as 1) a `.deb` for x86 instead of x64, 2) a `.Run`, 3) source, and 4) an OSX installer. The OSX installer just works. On a fresh install of Debian 7, I have tried the `.deb`, the `.Run`, and compiling from source. All three led me through a series of hoops. The most basic problems appear to be that via any of these routes Debian 7 gave me too old a version of `LibC` and too old a version of `Ocaml`. Most of my time was spent executing one apt-get command after another trying to resolve dependencies. Question: What are some tools that make it easier to install packages by automating as much of the process as possible? All packages, even building from source, make it clear which versions of which dependencies they require, right? So why can't all the dependencies just be resolved automatically? I would be happy to even just make a directory on my system that contains a copy of every single dependency that my package requires so that it can run in its own little environment without modifying the versions of other packages on my system; I'm not sure if that's possible. I'm positive there must be SOME way to just say "give me the package called Foo, version 4.2.3" and have everything else done for me.


iptables rule to allow access to internet

I made default policy of my machine-               iptables -A INPUT -j REJECT #DROP ALL PACKETS TO INPUT CHANNEL      INPUT channel has been blocked. Now I want to allow only some specific services like I should be able to access the internet. So what rule should I add? Port 80 is for HTTP so I tried allowing that port by               iptables -A INPUT -p tcp --dport 80 ACCEPT      But it didn't work. Let me know how can I do this?


How Do I Block Read Access to a Symbolic Link?

I have this file structure:               > APPLICATION 1     >> CONTROLLER (@JuniorProgrammers)     >> MODELS (symlink to SHARED/MODELS)     >> VIEWS (@Designers)     > APPLICATION 2     >> CONTROLLER (@JuniorProgrammers)     >> MODELS (symlink to SHARED/MODELS)     >> VIEWS (@Designers)     > SHARED     >> MODELS (@SeniorProgrammers)      I need php to be able to read Folder 1.1 contents, but programmers who FTP into Folder 1 won't be able to read the symlink (they CAN see the symlink, but not FOLLOW it including all reads, and writes). The @ is the groups of users that have read/write access of each layer.


Why shouldn't someone use passwords in the command line?

Why do people fear writing passwords in the command line? The history file is located in `~/.history`, so it's available only to the user who executed the commands (and root).


enable IST timezone in puppet

I'm trying to run below Puppet manifest to set 'IST' timezone.               class { 'timezone':       timezone => 'IST',     }      When I run Puppet apply `timezone.pp`, it installs properly. But when I check the system date, It's the same as before. I don't see any change in timezone. Also when I change IST to PST or some other timezone, it works properly. Only IST is not working for me. I had installed timezone Puppet module and kept it in `/etc/puppet/module` directory. What am I missing?


CentOS(6.3) Gnome Desktop Environment does not respond!

After starting the Gnome desktop on CentOS (version 6.3), I was able to see everything (the desktop icons, time and date, the upper titles for Applications, system, and so on). But, when I try to click on any of them, there is no response! The mouse pointer just blinks and changes as if something is going to open, but nothing happens--everything remains as it is. Any Suggestions?


Using `kill -s 0 $pid` vs `[[ -e /proc/$pid ]]` to detect if PID is running

One of the idioms often used to check if process is running is to use `kill -s 0 $pid`. My question is, does it have any upsides over using `[[ -e /proc/$pid ]]` construct? The script I'm writing is both Linux and bash specific.


Unable to log into Heroku: syntax error, unexpected

I'm new to Heroku. After downloading the script and installing I get an error when I try to login:               $ wget -qO- https://toolbelt.heroku.com/install.sh | sh      This script requires superuser access to install software. You will be prompted for your password by sudo.               [sudo] password for <user>:     Add the Heroku CLI to your PATH using:     $ echo 'PATH="/usr/local/heroku/bin:$PATH"' >> ~/.profile     Installation complete     $ echo 'PATH="/usr/local/heroku/bin:$PATH"' >> ~/.bash_profile     $ export PATH     $ /usr/local/heroku/bin/heroku login          /usr/local/heroku/lib/heroku/command/addons.rb:2:in `require': /usr/local/heroku/lib/heroku/helpers/heroku_postgresql.rb:136: syntax error, unexpected '.', expecting kEND (SyntaxError)         .detect{ |k,v| k != 'DATABASE_URL' && v == primary_db_url }          ^         from /usr/local/heroku/lib/heroku/command/addons.rb:2         from /usr/local/heroku/lib/heroku/command.rb:14:in `require'         from /usr/local/heroku/lib/heroku/command.rb:14:in `load'         from /usr/local/heroku/lib/heroku/command.rb:13:in `each'         from /usr/local/heroku/lib/heroku/command.rb:13:in `load'         from /usr/local/heroku/lib/heroku/cli.rb:36:in `start'         from /usr/local/heroku/bin/heroku:24      I think either a library or ruby gem is missing but I'm not sure which one. Any pointing in the right direction is welcome.


Recover my history of past commands?

Always when I turn on my Fedora 18, my history command disappear. How can I recovery all my history since I installed my OS? In my ./bash_history show olny the command of the day when I turn off my PC disappear all my past command in ./bash_history.


Why is yum trying to go through a proxy and other strange behaviors?

I occasionally setup an SSH tunnel proxy to make it seem like I'm using the internet from another location. I set it up with:               ssh -D 8080 <remote host>      and the use the gnome shell Network settings dialog to set the proxy to `http://localhost:8080`. Currently the proxy is set to None, and my `ssh` connection is disconnected. My internet browsing is working fine. However **I cannot use`yum`**:               [root@Eiger yum.repos.d]# yum update     Loaded plugins: langpacks, refresh-packagekit     http://linuxdownload.adobe.com/linux/x86_64/repodata/repomd.xml: [Errno 14] curl     #7 - "Failed connect to localhost:8080; Connection refused"     Trying other mirror.        <repeated 9 more times>           One of the configured repositories failed (Adobe Systems Incorporated),      and yum doesn't have enough cached data to continue. At this point the only      safe thing yum can do is fail. There are a few ways to work "fix" this:               1. Contact the upstream for the repository and get them to fix the problem.               2. Reconfigure the baseurl/etc. for the repository, to point to a working             upstream. This is most often useful if you are using a newer             distribution release than is supported by the repository (and the             packages for the previous distribution release still work).               3. Disable the repository, so yum won't use it by default. Yum will then             just ignore the repository until you permanently enable it again or use             --enablerepo for temporary usage:                      yum-config-manager --disable adobe-linux-x86_64               4. Configure the failing repository to be skipped, if it is unavailable.             Note that yum will try to contact the repo. when it runs most commands,             so will have to try and fail each time (and thus. yum will be be much             slower). If it is a very temporary problem though, this is often a nice             compromise:                      yum-config-manager --save --setopt=adobe-linux-x86_64.skip_if_unavailable=true          failure: repodata/repomd.xml from adobe-linux-x86_64: [Errno 256] No more mirrors to try.     http://linuxdownload.adobe.com/linux/x86_64/repodata/repomd.xml: [Errno 14] curl     #7 - "Failed connect to localhost:8080; Connection refused"        <repeated 9 more times>      If I disable the `adobe-linux` repo, then it simply says:               [root@Eiger yum.repos.d]# yum update     Loaded plugins: langpacks, refresh-packagekit                One of the configured repositories failed (Unknown),      and yum doesn't have enough cached data to continue. At this point the only      safe thing yum can do is fail. There are a few ways to work "fix" this:               1. Contact the upstream for the repository and get them to fix the problem.               2. Reconfigure the baseurl/etc. for the repository, to point to a working             upstream. This is most often useful if you are using a newer             distribution release than is supported by the repository (and the             packages for the previous distribution release still work).               3. Disable the repository, so yum won't use it by default. Yum will then             just ignore the repository until you permanently enable it again or use             --enablerepo for temporary usage:                      yum-config-manager --disable <repoid>               4. Configure the failing repository to be skipped, if it is unavailable.             Note that yum will try to contact the repo. when it runs most commands,             so will have to try and fail each time (and thus. yum will be be much             slower). If it is a very temporary problem though, this is often a nice             compromise:                      yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true          Cannot retrieve metalink for repository: fedora/19/x86_64. Please verify its path and try again      It's weird that **it doesn't know the name of the repository that is failing** the second time. It's also weird that **it doesn't try any of the other repositories that I have configured** (fedora, fedora-updates, google-chrome, google-talkplugin, insync, intellinuxgraphics, rpmfusion-free, rpmfusion-free- updates, rpmfusion-nonfree, rpmfusion-nonfree-updates). This has been working for over a year and I haven't touched `/etc/yum*`. * * * I put my computer to sleep and woke it up a day later. **Now everything is working as normal.** I have no explanation for the behavior seen yesterday but I can no longer reproduce it.


Find out what 'apt-get install' did

This might be a really newbie question but here we go: How can I find out what commands a package ran to install the software with `apt-get install <package>`? For example, if I install a package that creates a user, how can I find out how it created that user?


Ubuntu server cannot access the Internet: appears DNS related

This is a Drupal website running Ubuntu 12.04 LTS on Linode. The server is just a website. It is not a DNS server or anything else. Here are my issues. It seems they are all related to DNS issues. (I've been troubleshooting this with Linode for a couple days and I also got help here regarding iptables. Now I can focus on the issues in this question.)   1. Our Mollom spam protection is not working on the Drupal site because the server cannot reach the external service. (more details below)   2. Drupal reports, "Your system or network configuration does not allow Drupal to access web pages, resulting in reduced functionality." (more details below - our Drupal config did not change)   3. the server cannot ping the Internet  ping google.com   ping: unknown host google.com   4. Other network services fail. For example: $ sudo ntpdate ntp.ubuntu.com Exiting, name server cannot be used: Temporary failure in name resolution (-3) 1 Jun 16:42:34 ntpdate[7420]: name server cannot be used: Temporary failure in name resolution (-3)   apt-get update Err http://us.archive.ubuntu.com precise Release.gpg   Temporary failure resolving 'us.archive.ubuntu.com' Err http://security.ubuntu.com precise-security Release.gpg   Temporary failure resolving 'security.ubuntu.com'   5. The server is running very poorly. Could errors like the following one be related to inability to access the Internet? Out of memory: Kill process 2300 (mysqld) score 129 or sacrifice child Killed process 2300 (mysqld) total-vm:354780kB, anon-rss:53180kB, file-rss:0kB Out of memory: Kill process 5937 (mysqld) score 60 or sacrifice child Killed process 5937 (mysqld) total-vm:344040kB, anon-rss:78988kB, file-rss:0kB Here are the Drupal errors in more detail. Drupal configuration was not changed before these errors started (afaik). 1. HTTP request status Fails Your system or network configuration does not allow Drupal to access web pages, resulting in reduced functionality. This could be due to your webserver configuration or PHP settings, and should be resolved in order to download information about available updates, fetch aggregator feeds, sign in via OpenID, or use other network-dependent services. If you are certain that Drupal can access web pages but you are still seeing this message, you may add $conf['drupal_http_request_fails'] = FALSE; to the bottom of your settings.php file. 2. Mollom API keys Service error The Mollom API keys could not be verified. Please try again later. This issue prevents members from registering for our site or posting comments. Here is the information I think may be relevant:               root@example1:/etc# cat /etc/resolv.conf     # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)     #     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN     nameserver 789.456.123.6     nameserver 789.456.123.7          root@example1:/etc# cat /etc/hosts     #127.0.0.1      localhost     127.0.1.1       example1.local          example1     192.168.150.8   example1                example1     123.456.789.55  example1.example.com    example1        www.example.com          root@example1:/etc# cat /etc/nsswitch.conf     # /etc/nsswitch.conf     #     # Example configuration of GNU Name Service Switch functionality.     # If you have the `glibc-doc-reference' and `info' packages installed, try:     # `info libc "Name Service Switch"' for information about this file.          passwd:         compat     group:          compat     shadow:         compat          hosts:          files dns     networks:       files          protocols:      db files     services:       db files     ethers:         db files     rpc:            db files          netgroup:       nis               root@example1:/etc# route -n     Kernel IP routing table     Destination     Gateway         Genmask         Flags Metric Ref    Use Iface     0.0.0.0         123.456.789.1   0.0.0.0         UG    100    0        0 eth0     123.456.789.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0     192.168.100.0   0.0.0.0         255.255.128.0   U     0      0        0 eth0               root@example1:/etc# cat /etc/network/interfaces     # The loopback network interface     auto lo     iface lo inet loopback     # This line ensures that the interface will be brought up during boot.     auto eth0 eth0:0          iface eth0 inet static      address 123.456.789.55      netmask 255.255.255.0      gateway 123.456.789.1      dns-nameservers 789.456.123.6 789.456.123.7          # eth0:0 - Private IPs have no gateway (they are not publicly routable) so all you need to specify is the address and netmask.     iface eth0:0 inet static      address 192.168.150.8      netmask 255.255.128.0          root@example1:/etc# ip addr     1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN          link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00         inet 127.0.0.1/8 scope host lo            valid_lft forever preferred_lft forever         inet6 ::1/128 scope host             valid_lft forever preferred_lft forever     2: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN          link/ether 76:49:bf:95:98:68 brd ff:ff:ff:ff:ff:ff     3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000         link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff         inet 192.168.150.8/17 brd 192.168.255.255 scope global eth0:0            valid_lft forever preferred_lft forever         inet 123.456.789.55/24 brd 123.456.789.255 scope global eth0            valid_lft forever preferred_lft forever         inet6 1000:aaaa::aaaa:aaaa:aaaa:aaa/64 scope global dynamic             valid_lft 2591730sec preferred_lft 604530sec         inet6 fe80::aaaa:aaa:fffff:ffff/64 scope link             valid_lft forever preferred_lft forever     4: teql0: <NOARP> mtu 1500 qdisc noop state DOWN qlen 100         link/void      5: tunl0: <NOARP> mtu 1480 qdisc noop state DOWN          link/ipip 0.0.0.0 brd 0.0.0.0     6: gre0: <NOARP> mtu 1476 qdisc noop state DOWN          link/gre 0.0.0.0 brd 0.0.0.0     7: sit0: <NOARP> mtu 1480 qdisc noop state DOWN          link/sit 0.0.0.0 brd 0.0.0.0     8: ip6tnl0: <NOARP> mtu 1452 qdisc noop state DOWN          link/tunnel6 :: brd ::     9: ip6gre0: <NOARP> mtu 1448 qdisc noop state DOWN          link/[823] 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 brd 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00               root@example1:/etc# ifconfig     eth0      Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx                 inet addr:123.456.789.55  Bcast:123.456.789.255  Mask:255.255.255.0               inet6 addr: 1000:aaaa::aaaa:aaaa:aaaa:aaa/64 Scope:Global               inet6 addr: fe80::aaaa:aaa:fffff:ffff/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:66713 errors:0 dropped:0 overruns:0 frame:0               TX packets:54198 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:7588512 (7.5 MB)  TX bytes:67678447 (67.6 MB)               Interrupt:77           eth0:0    Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx                 inet addr:192.168.150.8  Bcast:192.168.255.255  Mask:255.255.128.0               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               Interrupt:77           lo        Link encap:Local Loopback                 inet addr:127.0.0.1  Mask:255.0.0.0               inet6 addr: ::1/128 Scope:Host               UP LOOPBACK RUNNING  MTU:65536  Metric:1               RX packets:13579 errors:0 dropped:0 overruns:0 frame:0               TX packets:13579 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:852371 (852.3 KB)  TX bytes:852371 (852.3 KB)          root@example1:/etc#       Here's more info:               # ping -n 789.456.123.7     PING 789.456.123.7 (789.456.123.7) 56(84) bytes of data.     64 bytes from 789.456.123.7: icmp_req=1 ttl=63 time=2.46 ms     64 bytes from 789.456.123.7: icmp_req=2 ttl=63 time=1.80 ms     ^C     --- 789.456.123.7 ping statistics ---     2 packets transmitted, 2 received, 0% packet loss, time 1001ms     rtt min/avg/max/mdev = 1.802/2.132/2.462/0.330 ms          ping -n 173.194.37.100 (NOTE: this is google.com)     PING 173.194.37.100 (173.194.37.100) 56(84) bytes of data.     64 bytes from 173.194.37.100: icmp_req=1 ttl=55 time=14.2 ms     64 bytes from 173.194.37.100: icmp_req=2 ttl=55 time=14.1 ms     64 bytes from 173.194.37.100: icmp_req=3 ttl=55 time=14.5 ms     ^C     --- 173.194.37.100 ping statistics ---     3 packets transmitted, 3 received, 0% packet loss, time 2002ms     rtt min/avg/max/mdev = 14.188/14.325/14.513/0.168 ms      And more info:               root@example1:/etc# dig google.com     ; <<>> DiG 9.8.1-P1 <<>> google.com     ;; global options: +cmd     ;; connection timed out; no servers could be reached          root@example1:/etc# dig www.google.com @8.8.8.8     ; <<>> DiG 9.8.1-P1 <<>> www.google.com @8.8.8.8     ;; global options: +cmd     ;; connection timed out; no servers could be reached          root@example1:/etc# ping 8.8.8.8     PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.     64 bytes from 8.8.8.8: icmp_req=1 ttl=51 time=1.05 ms     64 bytes from 8.8.8.8: icmp_req=2 ttl=51 time=1.08 ms     --- 8.8.8.8 ping statistics ---     2 packets transmitted, 2 received, 0% packet loss, time 1001ms     rtt min/avg/max/mdev = 1.058/1.073/1.089/0.036 ms          root@example1:/etc# traceroute google.com     google.com: Temporary failure in name resolution     Cannot handle "host" cmdline arg `google.com' on position 1 (argc 1)          # The following lines are desirable for IPv6 capable hosts     ::1     ip6-localhost ip6-loopback     fe00::0 ip6-localnet     ff00::0 ip6-mcastprefix     ff02::1 ip6-allnodes     ff02::2 ip6-allrouters      Although I cannot reach the Ubuntu repos to install software the usual way, I downloaded nmap locally and then copied the deb package to the server using SCP. Here are the results of `nmap -sS -sU -p 53`:               Host is up (0.00085s latency).     PORT   STATE SERVICE     53/tcp open  domain     53/udp open  domain


I am using RHEL 6.0 and when i type the given command in terminal               telnet 127.0.0.1 6000      I am getting output as:               Trying 127.0.0.1...     telnet: connect to address 127.0.0.1: Connection refused      Why is this connection refusing?


What is the difference between Kali Linux minimal and normal?

Generally the minimal versions of distros come with a fewer selection of packages. Is this the same for Kali Linux minimal? What packages will be missing from the minimal installation? Is there a site where the packages are listed?


How do I disable a keyboard shortcut in gnome-shell?

There are tutorials all over the web on how to set various functionalities to activate on a keyboard shortcut, but so far I'm unable to figure out how to _un-set_ a keyboard shortcut. That is, how do I set a keyboard shortcut to _disabled_ once I've already set it to something else? For example, say I want to change the keyboard shortcut for "Launch Terminal". I go into _System Settings_ , select _Keyboard > Shortcuts_ and under _Launchers_ , next to _Launch Terminal_ I click on the word `Disabled` which then changes to `New shortcut`. I hit `Ctrl+t` or something like that and now the shortcut is set. How now do I change it back to `Disabled`?


Pass a Function to another user in Bash?

Is there any way that I can pass a Function from one user to another user? For example, I have a small Bash script that I execute as Root:               #!/bin/bash     user_func(){       whoami       exit     }     su vagrant -c 'user_func'      However, the user_func Function isn't defined for the Vagrant user, only for Root, and can't be executed. My other option would be to have multiple lines of               su vagrant -c 'cmd1'      su vagrant -c 'cmd2'     , etc       Or, execute multiple commands ex: `su vagrant -c 'cmd1; cmd2; cmd3;'`, but I'd prefer to not have the excess, especially when attempting to execute more than 5 commands as the Vagrant user. Is it possible to pass a Function to another user from within the same script (ex. not creating a script on disk as a different user and then executing that generated script)? Or is there another option that I am overlooking?


Benefits of rpm over deb in the context of a server?

This related question What are the pros/cons of deb vs. rpm? seems to be more focused on personal computers, but in the context of a server, why do most of the servers run either RedHat / CentOS or SUSE? Is there any notable improvement of rpm over deb? Or is it just because they are products provided by a company rather than a community?


How to backup (make a copy of) LiveCD changes?

Many LiveCD distributions (for example Lubuntu 12.10 I use) allow making changes, for example updating timezone, logging in to Google Chrome, updating and installing additional packages such as OpenVPN. They do that by overlaying read-write filesystem, in my case RAM-based tmpfs (or ramdisk, or ramfs, or USB pendrive), over CD-ROM based filesystem, in my case system image via squashfs but might be iso9660 or udf directly, using some union filesystem, in my case overlayfs (or unionfs, or aufs). I'd like to make copy of changes (e.g. using `dd`) and only changes of an existing running LiveCD (e.g. Lubuntu 12.10) and I don't want to make copy of whole '/' mountpoint, including both changes and original CD-ROM. How can I find device or mountpoint which I can point e.g. `dd` to? `mount` shows the following (excerpt):               /cow on / type overlayfs (rw)     tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)     /dev/sr0 on /cdrom type iso9660 (ro,noatime)     /dev/loop0 on /rofs type squashfs (ro,noatime)     tmpfs on /tmp type tmpfs (rw,nosuid,nodev)     none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)     none on /run/shm type tmpfs (rw,nosuid,nodev)     none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)      * * * _Original question_ : Persisting changes on Lubuntu 12.10 run from LiveCD on _Ask Ubuntu_ (no answers as of posting this one).


Writing a Kernel from scratch

I'm not sure whether it's the right place for this question. I am writing a kernel from scratch and want links or tutorials where I can get a few pointers.


Keeping the number of files in the folder constant by deleting old files

I'm trying to create a script and run it in crontab every 5 min, so that the number of files in a folder always remain 50000. If there are more, I want the script to delete the old files.               #!/bin/bash     LIMIT=500000     NO=0     #Get the number of files, that has `*.pcap` in its name, with last modified time 5 days     ago          NUMBER=$(find /mnt/md0/capture/DCN/ -maxdepth 1 -name "*.pcap" |wc -l)     if [[ $NUMBER -gt $LIMIT ]]  #if number greater than limit      then       del=$(($NUMBER-$LIMIT))        if [ "$del" -lt "$NO" ]         then          del=$(($del*-1))        fi        echo $del        FILES=$(          find /mnt/md0/capture/DCN/ -maxdepth 1 -type f -name "*.pcap" -print0 |            xargs -0 ls -lt |            tail -$del |            awk '{print $8}'        )       rm -f ${FILES[@]}       #delete the originals           fi      It doesn't really work, it doesn't run as the number of files are too large. Is there any other method to get this done?


Integrating LDAP and Kerberos V to add users via a useradd-like interface

I'm currently trying to set up an integrated Kerberos V/LDAP system for authentication/authorization. From what I have managed to gather, there are at least two ways to integrate Kerberos V with LDAP:   1. Use LDAP as a backend to store Kerberos principals   2. User Kerberos and SASL authentication via GSSAPI to authenticate to the LDAP server (to be able to query and modify the LDAP entries using a Kerberos ticket) The two options aren't mutually exclusive. The thing is, I would like to make a hybrid of the two: not just use LDAP to store Kerberos principals, but also make sure that when I add a Kerberos principal, it's created with `objectClass=posixAccount` in order for it to appear as a Unix user entry to NSS for authorization purposes. To paraphrase, I would like to have to add new user accounts in only one place ( _viz._ , the `kadmin` server) instead of two. Is this possible? If so, how? If it's any help, I'm using OpenLDAP and MIT Kerberos on Debian Wheezy.


Set global environment variables at boot in Solaris 11

I am wanting to create a file in Solaris, so that I can export a few "items" whenever the machine is started up. i.e. I want to export ORACLE_HOME and ORACLE_SID and some other directories, of my own, when the machine has started up. These are the 2 Oracle folders I need to export:               export ORACLE_HOME=/oracle/product/11.1.0/db_1/     export ORACLE_SID=orcl      This is the other folder I need to export of my own:               export TESTFOLDER_DIR=/test/testfolder/bin/      It is highly irritating that I have to do it every time the machine has started up. I have tried Googling it, but I have not seen anything yet (still searching). It is easy to make the file with the export commands, but to put it somewhere that the machine will know to use them in startup, is the issue. Is there a way I could do it?


Disable RAID auto detect at runtime

In Linux, I'm partitioning two disks for RAID1 with fdisk. The first disk partitioning succedes, but the second fail because the raid starts automatically and occupy also the second disk (why? it should have a different UUID). How to temporary disable RAID autodetect? I guess there's a switch under `/proc/sys` filesystem. I know it's possible to solve the problem in other ways, like removing RAID information from the disks with `mdadm --zero-superblock` but I want to know if it's possible to disable RAID autodetect without rebooting the system with `raid=noautodetect nomdadm` in kernel parameters.


Moving Same files from different folders using shell script on AIX 5.4

There are two folders named Folder1 and Folder2. Folder1 has files with name:For example S-080001-0-0.xml with its corresponding same files in Folder2 named S-080001-0-0.xml The change in Folder2 is that,for same file in Folder1 which is S-080001-0-0.xml,Folder 2 contains multiple files with different value after hyphen,like -080001-0-0.xml,-080001-0-1.xml,-080001-0-2.xml,-080001-0-3.xml. My challenge is to move all the files of same name from these two folders.


Xen: Migrating LVM-based machines from Xen Opensource to Xen Cloud Platform

we have several LVM-based VMs running on a Xen Opensource host. "LVM-based", in our case, means that there's a LVM volume for the root partition and another volume for the swap partition. The kernel and the initrd for the VM are outside of these volumes, as files in the Xen host. These VMs were created with xen-create-image, part of the xen-tools suite for Debian. We want to migrate these VMs to a XCP host, and we've found a script to do it (http://www.xen.org/files/xva/xva.py). But this script assumes that the disks listed in the configuration file are "virtual disks", ie., with their own partition table and stuff. This is not the case, obviously, and it doesn't work. What would you recommend to do this? Any homebrewn method? In the end, we could have to migrate the VMs by overwriting new ones with a big tar file from the old ones, but I'd like it to be our last resort. I thought that maybe we could create a disk like the one this script expects by using something that does the reverse of kpartx: instead of splitting a virtual disk into devices for each partition, bundle several partitions (or in our case, LVM volumes) in a virtual disk. But I don't know anything like that. Thanks in advance!


Extract a column from whitespace-separated fields that are not aligned

How can we extract a column from output in which whitespace is not in a regular format? For example, when we type `ps -ef`, it shows all the process, process id's.... etc. How can we get only the last column or any specific column?


How to install Linux on the Lego Mindstorms NXT

Has anybody ever successfully installed Linux on the Lego Mindstorms NXT Intelligent Brick? I've found plenty of things on Google, but none of them worked. I can't find the download for legOS, and the gcc I was told to download never actually built (although it spent over 5 minutes in an install script). There was no download page for NXC (Not Exactly C). NOTE: I have an Ubuntu Linux system, a Mac OSX Lion system, and access to Windows (although I would prefer to avoid Windows).


Vim unnamed register + or *

Im using Vim 7.3 in Ubuntu and I'm having a little problem copying to the system clipboard with the following command `"+y` but I'm getting the following error: `E354: Invalid register name: '+'` In my `vim --version`, I see `-xterm_clipboard`. The option to copy is from mouse right click is also grayed out. What steps do I need to take to enable the copying of text from my vim to the system clipboard?


Reduce eclipse tab size with GTK theming

In Eclipse on Fedora, these controls/widgets take up too much space: ![Eclipse Fedora screenshot](http://i.stack.imgur.com/qeFdT.png) How can I make those bars thinner with a `gtk-rc` file or GTK3 CSS theming? `UPDATED` : I found https://github.com/jeeeyul/eclipse-themes this plugin have some builtin configurations and options makes eclipse 4.2/4.3 much more nicer.


Linux: Kill process based on arguments

How can I kill a process based on its command line arguments? `killall`, `pgrep`, and `pkill` seem to only work based on the process name. I need this to be able to differentiate between a number of applications running inside Java virtual machines, where `java` is the process name for all of them and the actual application name can be found by looking at the command line arguments. This can be done manually with `ps aux | grep myapp.jar` and then manually killing the pid from the output, but I'd like a command to do something equivalent automatically.


How do I shut down a system through a ConsoleKit DBus message as user?

I found the following command line to shut down a Debian/GNU Linux system               dbus-send \       --system \       --dest=org.freedesktop.ConsoleKit \       --type=method_call \       --print-reply \       --reply-timeout=2000 \       /org/freedesktop/ConsoleKit/Manager \       org.freedesktop.ConsoleKit.Manager.Stop      It works if I execute the command as superuser, but as a non-privileged user it says:               Error org.freedesktop.ConsoleKit.Manager.NotPrivileged: Not Authorized      I would like to know if it is possible to modify such a command in such a way that, interacting with PolicyKit, it can grant the privilege to shut down the system to a normal user.


Finding a specific file in several sub-directories

I've the following problem : I have to write something to copy a file contained in directory A. The file is unique, and has a specific extension (.jil). Only problem, directory A can contains a sub-directory B (which can contain a sub-directory C, ...) and then my file won't be located in the directory A, but in one of his sub- directories. What command can I use to find this file without exploring all my directoties ?


Failed to get access to the Internet after disabling networkmanager on ArchLinux

How can I get access to the Internet after `networkmanager` is down? I disabled the `networkmanager` and uncommented the static IP settings I used to use and reboot, but I'm still unable to get access to the Internet. (Failed to `ping 8.8.8.8`, which means the problem isn't DNS.) Here's how this happened: I used to get access to the Internet on my ArchLinux machine by setting up a static IP address in `/etc/rc.conf`. This worked fine. Then one day I needed to do something difficult without a `networkmanager`, so I installed the `network-manager-applet` via `pacman`, which worked fine as well, until one day after I ran `pacman -Syu` and rebooted, many programs, including the `network-manager-applet` are unable to work, saying the system is missing `libpng14.so`. My workstation was connected to a wireless connection at that time (the same one before my last `pacman -Syu` and reboot), and I tried to run `pacman -Syu` again and the network seemed to still be working. So I didn't take it as a big problem at that time. But now, after I brought it to work (where I connect to the Internet via a wired network and a static IP), I found myself unable to get access again to the Internet, even after I removed `networkmanager` from the `DAEMONS` in `rc.conf`, and uncommented the static IP settings that used to work. And It's not DNS problems since I'm unable to `ping 8.8.8.8` or any other known IPs directly (it says `destination host is unreachable`). Here's my `rc.conf` files, the IP address and gateway stuff couldn't be wrong so hope you don't mind I use something like XX.XX.XX.XX instead:               LOCALE="en-US.UTF-8"     DAEMON-LOCALE="no"     HARDWARECLOCK="localtime"     TIMEZONE="Asia/Shanghai"     KEYMAP="us"     CONSOLEFONT=     CONSOLEMAP=     USECOLOR="yes"          MODULES=(wl)     UDEV_TIMEOUT=30     USEDMRAID="no"     USEBTRFS="no"     USELVM="no"          HOSTNAME="lastland"     interface=eth0     address=XX.XX.XX.XX     netmask=255.255.255.0     broadcast=XX.XX.XX.255     gateway=XX.XX.XX.XX          NETWORK_PERSIST="no"          DAEMONS = (syslog-ng network crond dbus kdm alsa)


Do I need acpid in a virtual machine?

I'm always wondering if power management facilities in a virtual machine is necessary? i.e acpid. And I'm not sure if they still function in a virtual machine.


Firefox error message when adding client certificate signed by CA

I'm getting this message when I'm trying to add a certificate to Firefox's "your certificate tab". I generated and signed it before by a server which also is a CA. > Failed to decode the file. Either it is not in PKCS #12 format, has been > corrupted, or the password you entered was incorrect. It asks me to enter a password and then this message is alerted. what's wrong? I'm following this tutorial. ### UPDATE #1 commands I used :                openssl genrsa -out rootCA.key 2048      openssl req -x509 -new -nodes -key rootCA.key -days 1024 -out rootCA.pem             openssl genrsa -out device.key 2048           openssl req -new -key device.key -out device.csr             openssl x509 -req -in device.csr -CA rootCA.pem \             -CAkey rootCA.key -CAcreateserial -out device.crt -days 500      The added certificate is device.crt, there's PKS12 which Firefox request on your certificates tab. Should I change its format?


Virtualbox kernel modules not loading at boot

I have been running virtualbox on an Ubuntu 12.04 laptop for a while and it has all worked smooth, but suddenly, probably after a kernel upgrade, the vbox* modules are not loading at boot, if I manually modprobe them, it all works fine, but that should not be needed ... Looking at the `/etc/init.d/virtualbox`, it seems as I should add `LOAD_VBOXDRV_MODULE=1` to `/etc/default/virtualbox`, but for other machines it works without that line... Any clues?


Blacklisting websites for certain users

This question is two part. First, If I had a list of websites that I would've liked to block. How do I tell my computer do to block those and any relevant subdomains? Secondly, How do I get this right on a per-user basis. For Example, telling the computer to block userA from accessing facebook should not block userB from facebook. Bonus points if the answer is a command-line one.


Does the Fedora installer not include default URLs for installation mirrors?

I installed Fedora 14 using a slightly non-standard method, i.e. loading the install media vmlinuz/initrd.img files via an existing grub2 instance. (I fetched them from a mirror). The installer works fine, but I was a little bit surprised that after selecting the network install route I had to manually enter the URL of a FC14 mirror. Luckily, I am having a secondary computer with network access available for looking up mirror URLs. Does the FC14 not include any default install mirror urls? Or am I missing something?


Are packages cryptographically signed in Fedora 14?

I am installing Fedora 14 and I am wondering if   1. the Fedora packages are cryptographically signed   2. package signatures are checked by the installer by default   3. package signatures are checked by yum when installing additional packages or doing upgrades


Wine cdrom mount locations on Linux Mint 10 (Ubuntu 10.10) -- problems post install/switching discs

I've been trying to install a few windows games with wine on Linux Mint 10 (based on ubuntu 10.10), but I am finding that my cd-rom mount points aren't standard. ie: rather than /media/cdrom I get /media/disc_name [ a la /media/Warcraft\ III] This seems to cause problems during the installation of multi-disc games, and games which require the disc to be in the drive after installation. In both cases the target disc cannot be found, even when the mount point is verified to match the original installation source, or updated in the installer to match the location of the second disc due to autonaming. Any ideas what I could do here? Near all cases result in a file not found error.


Function to evaluate variables in BASH

Given a variable name is there a function that will print its value? Often times I pass the name of a variable to a bash function and instead of doing the expansion while passing it I would like to expand it inside the function. Of course when I do this I end up having to create the string with the variable name then running exec. It would be much more succinct if I could just run a command that echoed the output!


How can I make custom key bindings work even while SSH-ed into another machine?

I've added               "\eOD": backward-word     "\eOC": forward-word      to my `.inputrc` to get ctrl-arrow key mappings sorted out in Cygwin allowing me to move forward and back fine. When I SSH to any other Linux system, I lose this binding. Can anyone help? I'm using PuTTYcyg 20101029, my terminal type is xterm, and I'm using Cygwin 1.7.9.


How to generate grub.conf from scratch in Fedora 14?

It seems that I hit following bug in Fedora 14 - I deselected installing grub into the MBR while using the graphical installer, because I want to use an existing grub instance. Now, I want to look up the grub.conf or menu.lst in the new installed Fedora 14 system to adjust my existing grub config - but I cannot find them anywhere. I just information about how grub-install and gruppy are not able to create a grub.conf from scratch. Thus my question: How to generate a grub.conf from scratch in Fedora 14, if it is missing? **Update:** The point is to get the set of default kernel options a grub.conf includes, when created by the Fedora installer. I have booted the fedora installation via grub and only setting the 'ro root=' options which worked. However, it would be great if someone could post a standard generated grub stanza from his/her Fedora 14 system to see the kernel parameter differences.


Running piped bash script in background

I'm attempting to build a monitoring script to watch localhost communication using netcat. I have two scripts that I've built, one to start the monitoring loop and one for the loop itself. They are as follows : **start.sh**               #!/bin/bash     netcat localhost 1099  | bash loop.sh &      **loop.sh**               #!/bin/bash     while read sInput; do          ...do something with $sInput     done      Simply running this application without in the foreground works fine but as soon as I try to run this script in the background it goes from running to stopped instantly. Could someone please educate me as to why this is happening and how to alleviate the problem. My end goal is to have a bash script that I can create an arch linux daemon script with and have everything work perfectly. Your help is appreciated.


unrecognized inateck hdd enclosure with linux Mint

I have put in a Hitachi 2.5 inch hdd inside a Inateck hdd enclosure. I have connected the enclosure to a Toshiba R630-156 using a usb2 cable on a usb3 enclosure port. I can hear and feel the hard drive is powered but I cannot see any messages in dmesg. i cannot see any related output in lsusb. I have enabled usb_storage kernel module but it does not seem to make any difference. I am not experienced with trouble shooting hardware issues so please refer to some documentation if you are using very specific terms in your explanation. please ask if you need anymore debug information. thanks.               $ cat /etc/lsb-release     DISTRIB_ID=LinuxMint     DISTRIB_RELEASE=17     DISTRIB_CODENAME=qiana     DISTRIB_DESCRIPTION="Linux Mint 17 Qiana"          $ uname -a     Linux rag-tos-laptop 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux          $ lsmod | grep usb     usb_storage            62209  0      btusb                  32412  0      bluetooth             395423  12 bnep,btusb,rfcomm     usbhid                 52616  0      hid                   106148  2 hid_generic,usbhid          $ lsusb     Bus 002 Device 004: ID 0930:0214 Toshiba Corp.      Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub     Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 001 Device 003: ID 0bda:58f5 Realtek Semiconductor Corp.      Bus 001 Device 004: ID 046d:c52e Logitech, Inc.     Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub     Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub          BIOS Information             Vendor: TOSHIBA             Version: Version 1.90               Release Date: 02/24/2011             ROM Size: 2048 kB             Characteristics:                     ISA is supported                     PCI is supported                     PNP is supported                     BIOS is upgradeable                     BIOS shadowing is allowed                     VLB is supported                     Boot from CD is supported                     Selectable boot is supported                     EDD is supported                     Japanese floppy for Toshiba 1.2 MB is supported (int 13h)                     3.5"/720 kB floppy services are supported (int 13h)                     Print screen service is supported (int 5h)                     8042 keyboard services are supported (int 9h)                     Serial services are supported (int 14h)                     Printer services are supported (int 17h)                     ACPI is supported                     USB legacy is supported                     BIOS boot specification is supported                     Function key-initiated network boot is supported                     Targeted content distribution is supported             BIOS Revision: 1.90             Firmware Revision: 1.40


How do i get screen to execute/load .zprofile when starting a new window?

How do i get screen to execute/load `.zprofile` when starting a new window?


Compiling and running linux test project

I'm trying to install _Linux Test Project (LTP)_ on Debian 6.0.2, kernel 2.6.33.20. Compilation and installation went fine and without errors, but when I try to run basic tests               $ ./runltp      I get following error:               FATAL: LTP not installed correctly     INFO:  Follow directions in INSTALL!      After inspecting `runltp` script I realised that I'm missing all `bin` directories in LTP (./bin, ./testcases/bin, ...). I followed all instructions in INSTALL and installed all dependencies. How can I fix that?


Is there a better way to unlock a file than move and copy?

My organisation uses Debian Linux running Samba for office file servers. Users run Outlook for their email, which crashes fairly regularly and leaves the outlook.pst file locked. Currently, our procedure for removing the lock (which allows the user to use Outlook again) is:   1. Manually open a terminal session   2. Go to the users dir holding the outlook.pst file   3. Remove the ~outlook.pst.tmp file (or similar name)   4. Rename the pst file (eg mv outlook.pst outlook.pstoff)   5. Copy the file back to outlook.pst (ie cp outlook.pstoff outlook.pst)   6. Remove the old file (ie rm outlook.pstoff)   7. chown outlook.pst to the user This could be scripted reasonably easier, but to be done properly it would need checking for available disk space before doing the copy. Is there some easier way to remove the lock on the file without copying it?


Increasing serial baud rate within Ubuntu under VirtualBox

I'm debugging a kernel module under VirtualBox with a guest and host OS as Ubuntu 10.10. I'm using the virtualbox serial port but I'm maxing out at the baudrate 115200. My grub config looks like this... console=ttyS0,115200 Is there a way for me to change that setting in the guest OS so that the virtual serial port works at a faster baudrate? I've tried to use setserial. That didn't give me an error, but when I recompiled with a faster baudrate for the console I didn't see a change. Thanks!


Can you create a volumegroup in LVM that all the Logical volumes created under it will be thin provisioned?

I would like to know if it is possible to create a volumegroup in LVM that all the Logical volumes created under it will be thin provisioned? This will be used on RHEL 6 which does include thin provisioning in LVM. I am open to alternatives as well.


Can you think of a way to stop the generation of a core file WHILE it is happening?

I was just wondering if you can think of a clever way to stop the creation of a `core` file while it is being produced. I understand that there are several way to disable the creation like setting `ulimits` or setting the directory read only, but is there any way to stop it while the creation has already started? Any way to simulate a disk full/permission denied to force the process to quit?


Copyed mysql files from previous system now error while connect, what to do?

Fist of all I have the files but the old system is gone. I took the folders in `/var/lib/mysql/` and gave then the permissions the mysql folder that was in there had. user mysql group root only accessible my user. Now when I want to access my localhost sites I get a mysql database error. But I think everything is as it was before. What do I need to do to make this work?               Cannot find or open table blabla/wp_options from     the internal data dictionary of InnoDB though the .frm file for the     table exists. Maybe you have deleted and recreated InnoDB data     files but have forgotten to delete the corresponding .frm files     of InnoDB tables, or you have moved .frm files to another database?     or, the table contains indexes that this version of the engine     doesn't support.     See http://dev.mysql.com/doc/refman/5.5/en/innodb-troubleshooting.html     how you can resolve the problem.      the logfile shows me a hell of a lot errors like this. Should I delete this .frm files now?


copying from a remote server to my hdd with alias or reducing long file paths

I want to copy files from a remote server to my desktop and vice versa. However, the issue is, my files to be copied from the server have quite long file paths with at least 7-8 subfolders which are more or less constant. It's hectic to use the entire file path all the time to perform simple copy actions. for eg, if I wanted to copy `filex` from the remote server I would have to type in:               scp -r username@remotesrvr.com:/fldr1/fldr2/fldr3/fldr4/..../myfile ./mydesktop      Is there a way to overcome this?


Using Linux text editor to prepare content for Microsoft Word

I need to prepare a long manuscript that must be submitted in a Microsoft Word document in order to meet the submission criteria. (Please no "Don't use Word" comments.) I want to use a text editor on my Linux computer (Ubuntu). I will eventually paste the content into a Word document when it is finished. I don't have access to Word just now and I cannot test this. I will probably use a mixture of different text editors as is usual. Is there anything I need to watch out for, such as line endings and text encoding, so that I don't need to rework the text when I paste it into the new format and OS?


Linux / JVM - OutOfMemoryError: unable to create new native thread

I have a memory problem with a Linux server (CentOS). It is a VM. Below is the context. It has 70Gb of RAM. There are 2 tomcat running on it. One tomcat is given a heap of 13Gb and the other one a heap of 20Gb. The one with 20Gb has the JVM option -Xss160k set (to try to solve my problem). These 2 tomcat can be using up to 48Gb of RAM (virt.) Linux is going to use the 70Gb and there will be about 35Gb of cached memory. The swap is 1Gb and it uses pretty much none of it (8Mb). Now the problem is that I get the following error from the tomcat every so often:               OutOfMemoryError: unable to create new native thread      If I am not mistaken, this happens if the OS itself runs out of memory and is therefore unable to create new threads. Now the question is: how is that possible when it has 35Gb of cached memory? Shouldn't it re-allocate it and use it as needed. Is there maybe some kernel option I can set to avoid this? For example it could use up to 65Gb, cache 30Gb and keep 5Gb free.


Cron job not running / not successful?

I have a couple of `cron` jobs set up to maintain a local copy of a remote database. The first one downloads the latest version of the database from the remote machine, which runs every day and is working fine. The second one imports the downloaded data, however it is not working. The job is just a simple shell script:               #!/bin/bash     mysql -u root -mypass -h localhost my_db < my_db.sql      The cron task is set up like this:               0 8 * * * bash /home/lampadmin/cron/my_db.sh      If I run the shell script manually, it works OK. What can I do to find out why it is not working through cron?


Linux 'mail' command: Can't open display

I've just installed the 'mail' command in Ubuntu (mailutils package) in order to view feedback from cron jobs. I type 'mail' at the prompt and see something like this:               "/var/mail/*$USER*": 1 message 1 unread     >U 1 *Name* *Date* Output from your job       I type `1` at the `?` prompt and get a lot of output about the message (From, Date, Subject...) but on the last line it says               Error: Can't open display:     ?      and I'm returned to the prompt. Does anyone have any idea what the problem might be?


PHP mail() and Debian Wheezy Not Working

I am currently running my on debian wheezy with php5 installed. I was trying use the mail() function, and I realised that I will require a MTA/exim installed before it will be possible because the default installation does not come with any. I was looking at a solution at: https://wiki.debian.org/GmailAndExim4 However, it says that This setting is for a typical desktop PC which has no resolvable host name. Are there any good references for the settings I can use for a hosting server?


Regex that would grep numbers after specific string

So I have a line:               ID: 54376      Can you help me make a regex that would only return numbers without "ID:"? **NOTE:** This string is in a file.


Transparent Ethernet over GRE not forwarding traffic

I am running on Linux 2.6.30.9 and have been trying to setup a transparent ethernet over GRE tunnel. The network topology used is as follows: ![enter image description here](http://i.stack.imgur.com/anJep.png) I want to bridge PC1 and PC2 using Transparent Ethernet over GRE. RouterA is connected to internet via ppp0 as RouterB. Both internet connections are PPPOE (PPPoEoA PVCs). So i do: In RouterA (linux 2.6.30.9):               ip link add testgre type gretap remote 193.152.243.206 local 95.121.205.77 ttl 255     brctl addif br0 testgre     ip link set testgre up      In RouterB (linux 2.6.30.9):               ip link add testgre type gretap remote 95.121.205.77 local 193.152.243.206 ttl 255     brctl addif br0 testgre     ip link set testgre up      Some commands output: In RouterA (similar output in RouterB):               # ip link show testgre     36: testgre: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1442 qdisc pfifo_fast state UNKNOWN qlen 1000     link/ether 5f:79:cd:4d:c6:57 brd c1:98:f3:ce:ff:ff          # brctl show     bridge name     bridge id               STP enabled     interfaces     br0             8000.5f79cd4dc657       no              eth0.5                                                             eth0.4                                                             eth0.3                                                             eth0.2                                                             wlan0                                                             testgre      Then i do PING request from PC1 to PC2:               ping 192.168.1.33      I run tcpdump in RouterA and I see the ARP Request frame over ppp0 (pcap file opened with Wirehark): ![enter image description here](http://i.stack.imgur.com/8O5QY.png) I run tcpdump in RouterB attached to ppp1 and i see that the ARP Request has arrived, but its not forwarded at L2 to PC2. I dont see the ARP request in PC2. I try with statics ARP entries but the ICMP Request has the same problem, it is not forwarded to PC2. There are not ebtables rules. Nor iptables rules (Default action is ACCEPT for ebtables and iptables). Should i add ppp0 to bridge interface or something like that? Any suggestions are welcomed.


Bash Auto-Completion feature for SSHing into Different Hosts

I have big list of servers which I normally `ssh` to all the time. Is there any way using `bash` or `zsh` so that I can keep the list of hostname and bash auto-completion goes through the file and gives me suggestion for the boxes starting with those letters whenever I type the first few letters of the hostname.


which shell will sudo use to execute a shell script without the shebang line

My environment is Ubuntu 12.04 LTS, and the `sudo` version is 1.8.3p1. First I login as a normal user:               $ whoami     fin          $ cat /etc/passwd | grep -i "root\|fin"     root:x:0:0:root:/root:/bin/bash     fin:x:1000:1000:This is a normal user:/home/fin:/bin/bash          $ ls -l /bin/sh     lrwxrwxrwx 1 root root 4 Mar 30  2012 /bin/sh -> dash          $ ls -l /bin/bash     -rwxr-xr-x 1 root root 920788 Apr  3  2012 /bin/bash          $ echo $SHELL     /bin/bash          $ ps | grep "$$" | awk '{ print $4 }'     bash          $ ls -l ./test.sh     -rwxr-xr-x 1 fin fin 37 Sep 27 16:46 test.sh          $ cat ./test.sh     ps | grep "$$" | awk '{ print $4 }'          $ ./test.sh     bash          $ sudo ./test.sh     sh      I suppose the last output should also be `bash` because `/etc/passwd` shows that root uses `bash`, am I missing any points about `sudo`?


Cannot send mail to top domain

I have a webserver with the domain name server1.mydomain.com, mydomain.com is currently directed to another server. If a mail is send to an e-mail address with my top domain, eg me@mydomain.com, I get an error in the exim/mainlog 'T="Mail delivery failed: returning message to sender" from <>'. Other mail addresses work fine. My hosts file currently looks like this:               Do not remove the following line, or various programs     # that require network functionality will fail.     127.0.0.1       localhost     120.113.245.121          server1.mydomain.com   server1      Anyone an idea what the problem could be?


io redirection to "cross" 2 programs

How to "cross" `stdin` and `stdout` of two programs? Specifically, I have 2 programs call `pgm1` and `pgm2`, they are interactive tic-tac-toe games. They both output a number (0to8) indicating position where it wants to mark and expect another number (0to8) indicating where the user wants to mark. The difference between the two is `pgm1` makes first move and `pgm2` makes second move. They both work fine via interactive user. Can they be made to play against each other using io redirection? I tried the following things in vain:     1. Open `pgm2` in a separate terminal (it waits for input), find it's pid. Then run `pgm1` in another terminal `./pgm1 < /proc/pid_pgm2/fd/1 > /proc/pid_pgm2/fd/0 `      2. Made 2 pipes using mkfifo, say `pipe1` and `pipe2` and ran the following in two different terminals: ` ./pgm1 < pipe1 > pipe2 ` and ` ./pgm2 < pipe2 > pipe1 `     3. tried the above two, running pgm1 before pgm2, running pgm2 before pgm1   I made sure to use `fflush(stdout)` in both the programs, immediately after using `printf()`. Could anyone tell me what i am missing / or going wrong / or is this even possible?


What is the point of the `cd` external command?

As referenced in this fine answer, POSIX systems have an external binary `cd` in addition to the shell builtin. On OS X 10.8 it's `/usr/bin/cd`. You can't use it like the builtin `cd` since it exits immediately after changing its own working directory. What purpose does it serve?


Fujitsu Life book Debian Weezy 64-bit

Has anyone managed to get a 64 bit Linux installation on the Fujitsu Lifebook A3130 Currently have 32-bit Debian Wheezy but having troubles with building/Compiling Android and CyanogenMod. Having consulted with xda-developers, it is suggested that I upgrade to 64-bit. There is just very little info I've been able to find so far about this laptop and 64-bit Linux, although the documentation for the processor says it is compatible.


The receiving of returns by Nagios from script through NRPE

I am using nagios3 and want to collect some information from nrpe_server. Next script is at nrpe_server:               #!/bin/sh     #set -x     # script for checking disk usage on ZFS     # requires min zpool version 13 or zfs version 4     # example, it's posible to have zfs ver 1 on zpool ver 15 (script support this)     # http://www.googlux.com/nagios.plugin.zfs.usage.html     # ------------ Variables     PROGNAME=`/usr/bin/basename $0`          # ------ Nagios plugin return values     STATE_OK=0     STATE_WARNING=1     STATE_CRITICAL=2     STATE_UNKNOWN=3     STATE_DEPENDENT=4          # ------------ Subroutines          # Program usage     usage() {     echo " \     Usage             ${PROGNAME} /zfs warn crit          Note:     1. ZFS filesystem must start with /     2. warn is warning free space in %     3. crit is critical free space in %     example: /tank 20 10     "     }          # End script with output, with performance data for NagiosGraph     endscript () {             echo "${RESULT}"             exit ${EXIT_STATUS}     }          # ------------ check if there are 3 arguments     if [ $# != 3 ]; then             usage             exit 3     fi          # --------- check if warning is bigger than critical size     if [ $3 -ge $2 ]; then             echo "Warning[%] must be bigger than Critical[%]"             exit 3     fi          # ----------- check if first argument is a filesystem     FS=`df -T $1 | tail -n 1`     if [ $? != 0 ]; then             echo "The $1 is not valid filesystem"             exit 3     fi          # ----------- check if filesystem is ZFS     # /var : zfs     # /export/atlant-dbbackup: zfs     # note - comment out: ZFS=`echo ${FS} | awk '{print $3}'`     ZFS=`echo ${FS} | awk '{print $2}'`          if [ "${ZFS}" != "zfs" ]; then             echo "The $1 is not ZFS"             exit 3     fi          # -------- get dataset of filesystem     DATASET=`df -h $1 | grep -v Filesystem | awk '{print $1}'`          # ----------- check if ZFS is min required version 4 or ZPOOL min required ver 13     ZFSVER=`zfs get -H version ${DATASET} | awk '{print $3}'`     if [ $? -ne 0 ]; then             echo "The ZFS version can't be determined, it's probably less then 4"             exit 3     fi     if [ ${ZFSVER} -lt 4 ]; then             #echo "The $1 is indeed ZFS, but version ${ZFSVER} which is less than 4 and not supported by this script"             #exit 3             # ---------- check if ZPOOL is min required version 13, or higher             ZPOOLVER=`zpool upgrade | head -1 | awk '{print $NF}' | awk -F. '{print $1}'`             if [ ${ZPOOLVER} -lt 13 ]; then                     echo "The script can't support zpool ver ${ZPOOLVER} (<13) and ZFS ver ${ZFSVER} (<4)"                     exit 3             fi     fi               # size in bytes     QUOTA=`zfs get -Hp quota ${DATASET} | awk '{print $3}'`     DIV=1024/1024     # --- check if there is quota at all     if [ ${QUOTA} -eq 0 ]; then     #        echo "There is no quota on zfs dataset ${DATASET}"         QUOTA=`df $1 | tail -n 1 | awk '{print $4}'`         DIV=1024     #        exit 3     fi          # --- check if zfs properties can be determined     # --- sometimes even zfs ver =4 this is not posible     for i in usedbydataset usedbychildren usedbysnapshots     do             if [ "`zfs get -Hp ${i} ${DATASET} | awk '{print $3}'`" = "-" ]; then                     echo "Somehow zfs property ${i} cannot be determined"                     exit 3             fi     done          # --- check if usedbydataset is not 0     # --- can happens with export/import zpools     if [ `zfs get -Hp usedbydataset ${DATASET} | awk '{print $3}'` -eq 0 ]; then             echo "Somehow zfs property usedbydataset=0, probably zpool exported/imported and script can't support it"             exit 3     fi          CHILDRENUSE=`zfs get -Hp usedbychildren ${DATASET} | awk '{print $3}'`     DATA=`zfs get -Hp usedbydataset ${DATASET} | awk '{print $3}'`     SNAPSHOT=`zfs get -Hp usedbysnapshots ${DATASET} | awk '{print $3}'`     #echo QUOTA=${QUOTA}     # size in Mbytes     QUOTA=`(echo "scale=2; ${QUOTA}/${DIV}" | bc -l)`     CHILDRENUSE=`(echo "scale=2; ${CHILDRENUSE}/1024/1024" | bc -l)`     DATA=`(echo "scale=2; ${DATA}/1024/1024" | bc -l)`     SNAPSHOT=`(echo "scale=2; ${SNAPSHOT}/1024/1024" | bc -l)`     #echo QUOTA=${QUOTA}     # real quota is actually quota-usedbychildren     QUOTA=`(echo "scale=2; ${QUOTA}-${CHILDRENUSE}" | bc -l)`          FREE=`(echo "${QUOTA}-${DATA}-${SNAPSHOT}" | bc -l)`          #echo "FREE=${QUOTA}-${DATA}-${SNAPSHOT}"          FREEPERC=`bc -l << E     scale=0     ${FREE}*100/${QUOTA}     E`          WARNING=$2     CRITICAL=$3          if [ ${FREEPERC} -gt ${WARNING} ]     then             RESULT="ZFS ver${ZFSVER} $1 OK Free space ${FREE}MB ${FREEPERC}% : ${QUOTA}, ${SNAPSHOT}, ${DATA}, ${FREE}"             EXIT_STATUS=${STATE_OK}     elif [ ${FREEPERC} -le ${WARNING} ] && [ ${FREEPERC} -gt ${CRITICAL} ]     then             RESULT="ZFS ver${ZFSVER} $1 WARNING Free space ${FREE}MB ${FREEPERC}% : ${QUOTA}, ${SNAPSHOT}, ${DATA}, ${FREE}"             EXIT_STATUS=${STATE_WARNING}     else             RESULT="ZFS ver${ZFSVER} $1 CRITICAL Free space ${FREE}MB ${FREEPERC}% : ${QUOTA}, ${SNAPSHOT}, ${DATA}, ${FREE}"             EXIT_STATUS=${STATE_CRITICAL}     fi          # ------- provide output and nagios return value     endscript      It receives thee argument from nagios3 correctly. When I running this script manually at nrpe_server from command line it returns correct information, for example:               # /usr/lib/nagios/plugins/check_zfs_usage.sh /tank/share 20 10     ZFS ver5 /tank/share OK Free space 2175113.43MB 73% : 2954615.25, 1053.55, 778448.27, 2175113.43      But when nagios3 running this script remotely through nrpe_server with the same arguments it receives back incorrect information:               ZFS ver /tank/share CRITICAL Free space MB % : , , ,      So what is wrong with the script, how to fix it?


Excluding a file in bash loop

In the following script, How do I exclude a directory in the loop? I want to do this because all files are symlinks pointing to this directory that exists in the same level, so I don't want to add it.                    cd /var/www     for dir in */     do             base=$(basename "$dir")             tar -czfh "${base}.tar.gz" "$dir"     done


Replace string containing newline in huge file

**Anyone know of a non-line-based tool to "binary" search/replace strings in a somewhat memory-efficient way?** See this question too. I have a +2GB text file that I would like to process similar to what this appears to do:               sed -e 's/>\n/>/g'      That means, I want to remove all newlines that occur after a `>`, but not anywhere else, so that rules out `tr -d`. This command (that I got from the answer of a similar question) fails with `couldn't re-allocate memory` :               sed --unbuffered ':a;N;$!ba;s/>\n/>/g'      So, are there any other methods without resorting to C? I hate perl, but am willing to make an exception in this case :-) I don't know for sure of any character that does not occur in the data, so temporary replacing `\n` with another character is something I'd like to avoid if possible. Any good ideas, anyone?


grep piping into sed, replacing inline; but I want sed to print the filename and changed line. Is it possible?

Here's my command (break intentional):               grep FOO "/Users/gjtorikian/blah" -l | xargs sed -i '' '/FOO/{s/FOO/BAR/g; w /dev/stdout     }'      At the high-level: `grep` for FOO in the `blah` directory; pipe in just the filename (because of `-l`) to `sed`; `sed` performs an inline replace (`-i ''`) and prints _only the changed term_ to `/dev/stdout`. If I were to omit the `-l` and pipe, I get this back from `grep`:               /Users/gjtorikian/blah/baz.cs:1:FOO     /Users/gjtorikian/blah/bar.js:1:FOO      What I want is `sed` to perform the inline replace, and then show me the file and term replaced; for example:               /Users/gjtorikian/blah/baz.cs:1:BAR     /Users/gjtorikian/blah/bar.js:1:BAR      Is such a thing possible? If it matters, I would prefer to keep it with only `grep`/`sed`. Do I have to do a second `grep` after the `sed` ?


How to operate USE flags? Is there a master class on Portage or Gentoo?

What man pages I need to read first?


Installing FreeBSD without removable media from CentOS 6

I've been tasked with installing FreeBSD 8 alongside CentOS 6, without the luxury of removable media. CentOS 6 is already on the machine, and running quite nicely. However, I cannot figure out how to get FreeBSD running. I've spent a good chunk of time trying various things, but I keep running into walls. Here are the two attempts that yielded the most success:   1. UNetBootIn: after a little bit of tweaking, it gave me a GRUB menu item to boot into sysinstall for FBSD 8. However, when I went to install it, I got a "Disks not found" error, which I have not been able to resolve. I've tried switching my hard disk from IDE to ACHI and back with no luck. I think this is likely the best way to do this, but I'm blocked.   2. Copying the contents of the installation ISO to my hard drive: I made a FAT32 partition for the ISO, and a GRUB entry that runs /boot/loader, but I get an error saying that the kernel cannot be loaded. When I use lsdev, I can see the partition that it's on, but I cannot seem to load the kernel. Using ls tells me that / does not exist.   3. Like #2 but using /boot/kernel/kernel instead of /boot/loader in my GRUB entry: This will successfully load the kernel, but gets messed up when it asks me to mount a root partition. Unfortunately, no matter which partition I tell it to use, the kernel rejects all of my attempted mount points. If anyone has any ideas about how to make any of these work, or can point me in the right direction, I'd be extremely grateful!


Sony runs which operating system? Oracle Linux or Crestron Extron or Minix or OS X?

Sony has TV, PlayStation, Camera random hardware's. Where many of those have GUI available too. I want to run my BASH script there with ncurses. But how do they drive there devices? Which operating system is used inside? Or they just use micro-controllers or is it open-solaris?   * Xperia by Sony Ericsson http://developer.sonymobile.com/wportal/devworld/search- downloads/opensource?cc=gb&lc=en


tmpfs and vm.swappiness

I have started tuning a bit Linux VM performance on my system (yes. I know that vm.swappiness=0 will kill kittens but I found 30-40 as much better for me as it improved my latency - probably at cost of throughput). I would like to ask how the tmpfs is counted (is it cache or program) for purpose of swapping and `vm.swappiness`. To give higher level I need a folder which:   * Usually is empty but usage might increase to up to 8x my main memory size   * Do not need to be preserved about reboots   * Is low priority as far as I/O is concerned (i.e. programs using it might wait) but it would be nice if it was fast Currently I'm using a normal FS. I heard (not tested) about problems with large tmpfs pushing the data on swap. Since I assume that tests were done with default `vm.swappiness=60` and tmpfs is simply occupying only cache the decreased `vm.swappiness` would make it easier swappable during memory pressure. Am I correct?


php-mysql not working

I'm running on RHEL6. I have installed `php` and `php-mysql`. `<?php phpinfo(); ?>` is working perfectly. But I can't connect to MySQL is there a way to confirm that `php-mysql` is not working on my server [EDIT] I'm trying to connect to a remote database from a webpage when I open up my webpage it displays `Can't connect to MySQL server on 'ipaddress' (110)` Remote database is working and I can successfully telnet to that ip from my ip and port 3306


How to copy in two folders simultaneously using GNU parallel by spawning multiple threads?

I am trying to copy files from `machineB` and `machineC` into `machineA` as I am running my below shell script on `machineA`. If the files is not there in `machineB` then it should be there in `machineC` for sure so I will try copying the files from `machineB` first, if it is not there in `machineB` then I will try copying the same files from `machineC`. I am copying the files in parallel using GNU Parallel library and it is working fine. Currently I am copying two files in parallel. Earlier, I was copying the `PRIMARY_PARTITION` files in `PRIMARY` folder using GNU parallel and once that is done, then onnly I was copying the `SECONDARY_PARTITION` files in `SECONDARY` folder using same GNU parallel so it is sequential as of now w.r.t `PRIMARY` and `SECONDARY` folder. Now I decided to copy files in `PRIMARY` and `SECONDARY` folder simultaneously. Meaning, I will copy two files in `PRIMARY` folder along with two files in `SECONDARY` folder simultaneously. Below is my shell script which I have -               #!/bin/bash          export PRIMARY=/test01/primary     export SECONDARY=/test02/secondary     readonly FILERS_LOCATION=(machineB machineC)     export FILERS_LOCATION_1=${FILERS_LOCATION[0]}     export FILERS_LOCATION_2=${FILERS_LOCATION[1]}     PRIMARY_PARTITION=(550 274 2 546 278) # this will have more file numbers     SECONDARY_PARTITION=(1643 1103 1372 1096 1369 1568) # this will have more file numbers          export dir3=/testing/snapshot/20140103          find "$PRIMARY" -mindepth 1 -delete     find "$SECONDARY" -mindepth 1 -delete          do_CopyInPrimary() {       el=$1       scp david@$FILERS_LOCATION_1:$dir3/new_weekly_2014_"$el"_200003_5.data $PRIMARY/. || scp david@$FILERS_LOCATION_2:$dir3/new_weekly_2014_"$el"_200003_5.data $PRIMARY/.     }     export -f do_CopyInPrimary          do_CopyInSecondary() {       el=$1       scp david@$FILERS_LOCATION_1:$dir3/new_weekly_2014_"$el"_200003_5.data $SECONDARY/. || scp david@$FILERS_LOCATION_2:$dir3/new_weekly_2014_"$el"_200003_5.data $SECONDARY/.     }     export -f do_CopyInSecondary               parallel -j 2 do_CopyInPrimary ::: "${PRIMARY_PARTITION[@]}" &     parallel -j 2 do_CopyInSecondary ::: "${SECONDARY_PARTITION[@]}" &     wait          echo "All files copied."      **Problem Statement:-** With the above script at some point I am getting this exception -               ssh_exchange_identification: Connection closed by remote host     ssh_exchange_identification: Connection closed by remote host     ssh_exchange_identification: Connection closed by remote host      Is there any better way of doing the same thing as the way I am doing currently? I guess, I can still use GNU Parallel to make it work?


Copying files with a specific pattern

I am trying to copy files from one location to another and given below are some sample ones:               aaa_bbb_ccc_ddd_cost_code_20140330.gz     aaa_bbb_ccc_ddd_revenue_zone_20140329.gz     aaa_bbb_ccc_ddd_benefit_extract_20140330.csv.gz     aaa_bbb_ccc_ddd_profit_zone_20150509.csv.gz     aaa_bbb_ccc_ddd_loss_zone_20140330.csv     aaa_bbb_ccc_ddd_username.csv.gz      from the above list, the files that should be copied should be in the following format:               aaa_bbb_ccc_ddd_cost[or]revenue[or]benefit[or]profit[or]loss_yyyymmdd.csv.gz      which means that the files               aaa_bbb_ccc_ddd_loss_zone_20140330.csv     aaa_bbb_ccc_ddd_username.csv.gz      shouldn't be copied. Also, I need to assign it to a variable and I am trying something like this but it doesn't seem to work:               FILENAME="egrep 'aaa_bbb_ccc_ddd_(cost|revenue|benefit|profit)_code_[0-9]{8}.csv.gz'"      The reason I am trying to assign this to a variable is because I need to use it later in the code for something like this:               SOURCE_DIR="/temp"     DESTN_DIR="/output"     FILENAME=`egrep 'aaa_bbb_ccc_ddd_(cost|revenue|benefit|profit)_code_[0-9]{8}.csv.gz'`     echo "FILENAME is:" $FILENAME     for SAMPLE_FILE in $(ls "$SOURCE_DIR/$FILENAME")     do     cp $SAMPLE_FILE $DESTN_DIR     done      Is there an alternate way in which this can be achieved?


An alternative to `xdotool type`

Is there an alternative to               xdotool type "a string"      It will be more useful if it is not an X11 app. Because X11 apps seem to be more vulnerable. Note: I will not use it in a terminal window. So `echo` is not an alternative to that. `echo` does not type. It just prints something in terminal.


"Too many arguments to function" error while installing php5-pdo_mysql from ports in FreeBSD

I'm having a trouble while installing php5-pdo_mysql in my FreeBSD environment. Everytime I trys to do /usr/ports/databases/php5-pdo_mysql make install the console gives me this error:               /usr/ports/databases/php5-pdo_mysql/work/php-5.3.5/ext/pdo_mysql/mysql_driver.c:     501: error: too many arguments to function 'pdo_mysql_globals.dbg->m->func_leave'          /usr/ports/databases/php5-pdo_mysql/work/php-5.3.5/ext/pdo_mysql/mysql_driver.c:     In function 'pdo_mysql_check_liveness':     /usr/ports/databases/php5-pdo_mysql/work/php-5.3.5/ext/pdo_mysql/mysql_driver.c:     519: error: too many arguments to function 'pdo_mysql_globals.dbg->m->func_leave'          /usr/ports/databases/php5-pdo_mysql/work/php-5.3.5/ext/pdo_mysql/mysql_driver.c:     534: error: too many arguments to function 'pdo_mysql_globals.dbg->m->func_leave'          /usr/ports/databases/php5-pdo_mysql/work/php-5.3.5/ext/pdo_mysql/mysql_driver.c:      In function 'pdo_mysql_handle_factory':          /usr/ports/databases/php5-pdo_mysql/work/php-5.3.5/ext/pdo_mysql/mysql_driver.c:     763: error: too many arguments to function 'pdo_mysql_globals.dbg->m->func_leave'          *** Error code 1     1 error     *** Error code 1          Stop in /usr/ports/databases/php5-pdo_mysql.     *** Error code 1          Stop in /usr/ports/databases/php5-pdo_mysql.      My php version is 5.3.3 and pear 1.9.1. I tried to upgrade port tree of php5 to 5.3.5 but it failed. Saying I have to update apache22 first, but then updating apache22 also failed. What should I do now?


Why is echo "bar" -n different from echo -n "bar"?

Compare               echo -n "bar"      with               echo "bar" -n      The former does what _I_ think it's supposed to do (prints "bar" without a newline), while the latter doesn't. Is this a bug or by design? Why is it different than many cli programs in that you can't move the options around? For example, `tail -f /var/log/messages` is exactly the same as `tail /var/log/messages -f`. I sometimes do the latter when I forget I wanted the former, because internally the options and arguments are rearranged, usually by getopt. **Update:** yes I originally nerf-ed my question. I removed the nerf you'll have to view history to make some of the answers make sense.


ImageMagick on multiple files

I have converted a single file from BMP to PNG with ImageMagick's `convert` using the command below               convert CD\ Front.bmp CD\ Front.png      I have many such files, thus I tried:               for f in */*.bmp ; do convert $f ${f%bmp}png; done      but this command hangs forever. What am I doing wrong?


Changing gnome terminal transparency with a command in Ubuntu?

How can I change the transparency of the Terminal windows in Ubuntu with a command? I already know about the profile method but want a command so that I can quickly swap between transparent and opaque. My terminal is GNOME Terminal 2.30.2


zsh completion doesn't correct ? (question mark) in paths

So, I've been pretty happy with my zsh completion and correction configuration for a while now, with this being a major exception. Configured as I have it, the shell routinely catches and corrects incorrect case when I perform tab completion. For instance, it will easily correct `ls ~/DOcuments/somedir` to `ls ~/Documents/somedir`. However, it is every bit as easy, and notably for precisely the same reasons and in precisely the same manner, to type (for example) `cd ~?Somedir<tab>`. Of course, the user might reasonably expect the question mark to be considered as a possible mistake, such that (in the absence of a better match) his entry will be corrected to `cd ~/Somedir`. But instead, I get this sort of error message:               No matches for: `user' or `named directory'      Or, if I've entered a couple characters after the question mark, I might get a list of suggestions which, I assume (based on their content and the above error message), are active user processes. Does anybody know an easy way for me to get the desired result?


Modify the right click options when clicking a desktop icon

I'm wanting to restrict a standard user from being able to right click a desktop icon in Linux (Raspberry Pi running Debian wheezy). I don't want to disable the use of the right click totally (like xmodmap can)... We still need them to use the right click options in normal tasks etc.. Is there such a way to disable this menu option without disabling the right button completely?


Backing up a partition

I am pretty new to linux. I mostly started learning after I purchased a couple of Raspberry Pis. I like to make backups of my images as I have often made the mistake of corrupting my data :). Normally I use dd:               dd of=mybackup.img in=/dev/diskX bs=2m      Since my image is on an SD Card, the back up image takes the whole size of the SD card. For example, the size of the actually images is around 30mb, but the SD card is 32gb. The backup images is 32gb. I normally will zip/compress the file down to about 2gb. Still, I would like to back up the partition only e.g 30mb. if I type               df      I see the partition:                Filesystem    512-blocks       Used  Available Capacity   iused     ifree %iused  Mounted on     /dev/disk3s1      114576      38192      76384    34%       512         0  100%   /Volumes/boot       Can I use `dd` to backup the partition `/dev/disk3s1`?


Linux motion user - run it as ssh key as pi to remote server

This question is related to the two other questions I had earlier, about enabling Raspberry Pi to act as a motion sensor that will try to ssh into a more powerful server when it detects motion (the more power server will then do additional processing via a script). So here's what I did:   * On the Raspberry Pi, I installed Linux motion app   * I also used `ssh-keygen` on the Raspberry Pi and then using `ssh-copy-id` copies public keys to the more power server, so that the Raspberry Pi can `ssh` to the server without having to type in the password.   * On the `motion.conf` file, there's a line for `on_motion_detected` event for when the motion is detected by Raspberry Pi, on that line, I have something like:  > ssh user@more.powerful.server '/exec/some/script/here'   * But the script on the more powerful server is never executed because the motion daemon is running as user 'motion', rather than the user (pi) that did the ssh-keygen that the remote server accepts. I know this because:   * If I change the `on_motion_detected` command to:  > on_motion_detected echo hello_world | wall this command gets executed and I see it on all the terminals that are ssh'd into the Raspberry Pi   * Or, if instead of on the on_motion_detected line, I simply run `ssh user@more.power.server '/exec/some/script/here'` on the Raspberry Pi's command line (as user 'pi'), it also gets triggered by the server. So the question is, how do tell the Raspberry Pi's operating system to 'use' the key of the 'pi' user when the 'motion' user tries to ssh into the more powerful server, in that `on_motion_detected` event?


Can I remove files in /var/log/jounal and /var/cache/abrt-di/usr?

I use Fedora and these directories contains a large amount of files, I wonder whether I can delete them? The system is running low on space.