title: bridged networking with kvm

text: I'm trying to get a guest virtual machine connected to my network using bridging. I've come across a couple of resources online, but they seem to be out of date, deal with xen or Ubuntu or don't seem to be complete. The host is running CentOS 5.5 and I'm using libvirt to manage the VMs so I use it to create the VMs and start and stop them. I have the bridge created (br0) and have attached eth0 to it. The VM doesn't seem to get an IP address, I want to use DHCP for addresses, I'll setup a static lease for the VM. ifconfig from the host:               br0   Link encap:Ethernet  HWaddr 00:1A:4D:53:C3:A6             inet addr:192.168.1.121  Bcast:192.168.1.255  Mask:255.255.255.0           inet6 addr: fe80::21a:4dff:fe53:c3a6/64 Scope:Link           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:5222 errors:0 dropped:0 overruns:0 frame:0           TX packets:470 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:0            RX bytes:753743 (736.0 KiB)  TX bytes:47868 (46.7 KiB)          eth0  Link encap:Ethernet  HWaddr 00:1A:4D:53:C3:A6             inet6 addr: fe80::21a:4dff:fe53:c3a6/64 Scope:Link           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:103200 errors:0 dropped:0 overruns:0 frame:0           TX packets:116575 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:1000            RX bytes:13605883 (12.9 MiB)  TX bytes:63269448 (60.3 MiB)           Interrupt:217 Base address:0xc000            eth1 Link encap:Ethernet  HWaddr 00:1B:21:0A:25:AA             inet addr:192.168.1.91  Bcast:192.168.1.255  Mask:255.255.255.0           inet6 addr: fe80::21b:21ff:fe0a:25aa/64 Scope:Link           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:3124648 errors:0 dropped:0 overruns:0 frame:0           TX packets:1693433 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:100            RX bytes:4531121842 (4.2 GiB)  TX bytes:119907573 (114.3 MiB)           lo   Link encap:Local Loopback             inet addr:127.0.0.1  Mask:255.0.0.0           inet6 addr: ::1/128 Scope:Host           UP LOOPBACK RUNNING  MTU:16436  Metric:1           RX packets:27294 errors:0 dropped:0 overruns:0 frame:0           TX packets:27294 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:0            RX bytes:34266420 (32.6 MiB)  TX bytes:34266420 (32.6 MiB)          virbr0 Link encap:Ethernet  HWaddr 00:00:00:00:00:00              inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0            inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link            UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1            RX packets:51332 errors:0 dropped:0 overruns:0 frame:0            TX packets:89020 errors:0 dropped:0 overruns:0 carrier:0            collisions:0 txqueuelen:0             RX bytes:2916963 (2.7 MiB)  TX bytes:132997389 (126.8 MiB)          vnet0  Link encap:Ethernet  HWaddr FE:52:00:1A:C8:4F              inet6 addr: fe80::fc52:ff:fe1a:c84f/64 Scope:Link            UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1            RX packets:25 errors:0 dropped:0 overruns:0 frame:0            TX packets:518 errors:0 dropped:0 overruns:0 carrier:0            collisions:0 txqueuelen:500             RX bytes:4226 (4.1 KiB)  TX bytes:51190 (49.9 KiB)      The output of `brctl show`               bridge name bridge id       STP enabled interfaces     br0         8000.001a4d53c3a6       no              vnet0                                                         eth0     virbr0      8000.000000000000       yes      Output from `route`:               Kernel IP routing table     Destination     Gateway         Genmask         Flags Metric Ref    Use Iface     192.168.1.0     *               255.255.255.0   U     0      0        0 eth1     192.168.1.0     *               255.255.255.0   U     0      0        0 br0     192.168.122.0   *               255.255.255.0   U     0      0        0 virbr0     169.254.0.0     *               255.255.0.0     U     0      0        0 br0     default         DD-WRT          0.0.0.0         UG    0      0        0 br0      Finally, here's the networking section of the vm I'm trying to configure:               <interface type='bridge'>       <mac address='54:52:00:1a:c8:4f'/>       <source bridge='br0'/>     </interface>


title: Sum of grep results

text: I need to output the sum of a grep results for a certain time, for now i hard coded the time grep but any help will be very much appreciated, my problem is i cant output the results on the script. If i use this line, it will give me an output of 1: `cat *.log | egrep '2011-07-01 (04:[0][0-9]:[0-5][1-9]|04:10:00)' * | grep -ach '0110 478655 .. 51' | awk '{SUM += $1} END { print SUM }'` and this line would give me an output of 0 : `cat *.log | egrep '2011-07-01 (04:[1][0-4]:[0-5][1-9]|04:15:00)' * | grep -ach '0110 478655 .. 51' | awk '{SUM += $1} END { print SUM }'` this code needs alot of improvements :               while read line     do     cd $DIR     ta1=`cat *.log | egrep '2011-07-01 (04:[0][0-9]:[0-5][1-9]|04:10:00)' * | grep -ach '0110 478655 ..  51' | awk '{SUM += $1} END { print SUM }'`     ta2=`cat *.log | egrep '2011-07-01 (04:[1][0-4]:[0-5][1-9]|04:15:00)' * | grep -ach '0110 478655 ..  51' | awk '{SUM += $1} END { print SUM }'`     ta=$((ta1 + ta2))     echo -e "Results =  $ta "     done      i wanted to add the results and put it on a while do statement, also i needed two grepping so i can sum up all the instances for a 15min cycle., any idea how to do a single grep statement instead?


title: Why do /usr and /tmp directories for Linux miss vowels in their spellings?

text: I have often started to think about this but never found a good answer. Why are these two Unix directories not `/user` and `/temp` instead? All the other directories under `root` seem to be exactly what one would guess them to be, but these two seem odd, I would have always guessed them as `user` and `temp`. Is there some historical reason for the spellings?


title: Why does ls accept duplicate switches?

text: I'm curious - is there a difference between `ls -l` and `ls -lllllllllllllllllllllllllllll`? The output appears to be the same and I'm confused on why `ls` allows duplicate switches. Is this a standard practice among most commands?


title: Detecting a "plug pulled" scenario with Linux

text: I was wondering if it's possible to detect a shutdown due to power loss on a Linux system. (Power loss defined as: pressing reset button, pressing power button, pulling the power cord) If so, how? (ie, if this is already something that people can do, what commands do I run?) The way I would imagine something like this working:   * When system comes back up, checks for an issued shutdown or reboot command, finds none.   * System checks for any sort of errors that have been logged that would require a reboot, such as kernel panic, etc (OOM maybe?) and finds none.   * If no smoking gun found as described above, the system logs something like "No cause for shutdown found, potential power loss detected."


title: I can't find tape device file inside /dev directory

text: I'm using tape storage drive HP LTO3 1x8 auto-loader which is connected to my server running CentOS. it is detected in CentOS correctly. ### cat /proc/scsi/scsi                Host: scsi2 Channel: 00 Id: 01 Lun: 00      Vendor: HP       Model: 1x8 autoloader   Rev: 1.50      Type:   Medium Changer                   ANSI  SCSI revision: 03      ### lsscsi               [1:0:0:0]    cd/dvd  NECVMWar VMware IDE CDR10 1.00  /dev/sr0     [2:0:0:0]    disk    VMware   Virtual disk     1.0   /dev/sda     [2:0:1:0]    mediumx HP       1x8 autoloader   1.50  /dev/sch0      _**But the tape device file (`st*` or `nst*`) inside the `/dev` directory has not been created._** I've loaded all the modules               Module                  Size   Used by     sym53c8xx              77039   0      aic7xxx                119025   0      st                     38660  0     autofs4                26888  3     sunrpc                243758  1     ipt_REJECT              2383  2     nf_conntrack_ipv4       9506  2     nf_defrag_ipv4          1483  1 nf_conntrack_ipv4     iptable_filter          2793  1     ip_tables              17831  1 iptable_filter     ip6t_REJECT             4628  2     nf_conntrack_ipv6       8748  2     nf_defrag_ipv6         12182  1 nf_conntrack_ipv6     xt_state                1492  4     nf_conntrack           79453  3 nf_conntrack_ipv4,nf_conntrack_ipv6,xt_state     ip6table_filter         2889  1     ip6_tables             19458  1 ip6table_filter     ipv6                  322029  29 ip6t_REJECT,nf_conntrack_ipv6,nf_defrag_ipv6     ppdev                   8729  0     parport_pc             22978  0     parport                37265  2 ppdev,parport_pc     e1000                 167662  0     microcode             112594  0     vmware_balloon          7199  0     ch                     13503  0     i2c_piix4              12608  0     i2c_core               31276  1 i2c_piix4     sg                     30124  0     shpchp                 33482  0     ext4                  364410  3     mbcache                 8144  1 ext4     jbd2                   88738  1 ext4     sd_mod                 39488  4     crc_t10dif              1541  1 sd_mod     sr_mod                 16228  0     cdrom                  39771  1 sr_mod     mptspi                 17051  12     mptscsih               36732  1 mptspi     mptbase                93845  2 mptspi,mptscsih     scsi_transport_spi     26151  3 sym53c8xx,aic7xxx,mptspi     pata_acpi               3701  0     ata_generic             3837  0     ata_piix               22846  0     dm_mirror              14101  0     dm_region_hash         12170  1 dm_mirror     dm_log                 10122  2 dm_mirror,dm_region_hash     dm_mod                 81500  12 dm_mirror,dm_log      ### output of dmesg | grep scsi               scsi0 : ata_piix     scsi1 : ata_piix     scsi 1:0:0:0: CD-ROM            NECVMWar VMware IDE CDR10 1.00 PQ: 0 ANSI: 5     scsi2 : ioc0: LSI53C1030 B0, FwRev=01032920h, Ports=1, MaxQ=128, IRQ=17     scsi 2:0:0:0: Direct-Access     VMware   Virtual disk     1.0  PQ: 0 ANSI: 2     scsi target2:0:0: Beginning Domain Validation     scsi target2:0:0: Domain Validation skipping write tests     scsi target2:0:0: Ending Domain Validation     scsi target2:0:0: FAST-40 WIDE SCSI 80.0 MB/s ST (25 ns, offset 127)     scsi 2:0:1:0: Medium Changer    HP       1x8 autoloader   1.50 PQ: 0 ANSI: 3     scsi target2:0:1: Beginning Domain Validation     sr0: scsi3-mmc drive: 1x/1x writer dvd-ram cd/rw xa/form2 cdda tray     sr 1:0:0:0: Attached scsi CD-ROM sr0     scsi: waiting for bus probes to complete ...     scsi target2:0:1: Ending Domain Validation     scsi target2:0:1: FAST-160 WIDE SCSI 320.0 MB/s DT IU RDSTRM RTI WRFLOW PCOMP (6.25 ns,      offset 127)     sr 1:0:0:0: Attached scsi generic sg0 type 5     sd 2:0:0:0: Attached scsi generic sg1 type 0     scsi 2:0:1:0: Attached scsi generic sg2 type 8     ch 2:0:1:0: Attached scsi changer ch0      Does anyone face this issue before and find a solution?


title: What is qemu-img consistency check?

text: I would be glad if someone could explain the meaning of `qemu-img check <filename>` command. Man pages provide very poor information about it: > >        check [-f fmt] [-r [leaks | all]] filename >            Perform a consistency check on the disk image filename. >            If "-r" is specified, qemu-img tries to repair any > inconsistencies >            found during the check. "-r leaks" repairs only cluster leaks, >            whereas "-r all" fixes all kinds of errors, with a higher risk of >            choosing the wrong fix or hiding corruption that has already >            occurred. >            Only the formats "qcow2", "qed" and "vdi" support consistency >            checks. >   For instance, can I use this command in case of need to check the hash sum of the disk image (rather hash sums of the files stored on them)?


title: How to connect tata photon in X window manager in ubuntu 14.04 using command line

text: Due to some reason I had to shift from Gnome to X(basic X). So here on the desktop nothing appears (no launcher, no menu bar, nothing) but we can open command line in it using `Ctrl`+`Alt`+`Tab`. (I have started X window manager using `startx` from the `tty1`). Applications can be opened using terminal (for example the command Firefox opens the Firefox browser). Now I need to connect to the internet. I have tata photon and I don't know how to connect to the internet using it.   1. If I may know how to open the network manager using command line, I will connect tata photon with it but can it really connect to internet in X.   2. Or else can we connect to internet using command line. If yes then please tell me in detail since I have just shifted to Ubuntu from Windows.


title: how to run perl cgi script on apache

text:
I Successfully installed Apache web server in my local machine. My question is how to run perl cgi script on this server Actully I don't have any Idea that's why posted question here. my sample cgi script is               #!/perl/bin/perl -w     use strict;     use warnings;     print "Content-type: text/html\n\n";     print "
This is first!
\n";       Where to store this script by which extention either .cgi or .pl? What are the necessary should follow to execute this script . Please let me know I know this is very basic question. I could not found any better link on google so i posted.


title: Print line after nth occurrence of a match

text: I am looking to display the line 4598 in the following file. Effectively I want to display the line AFTER the nth occurrence of a match. In this case, the line after the 3rd occurrence of `<Car>`. How do I go about this?               <Car>     10456     </Car>     <Car>     70192     </Car>     <Car>     4598     </Car>


title: How to specify a custom include directory in Debian?

text: I am trying to compile my program on a **Debian** system via **ssh** and **without root privileges.**               PRETTY_NAME="Debian GNU/Linux 7 (wheezy)"     NAME="Debian GNU/Linux"     VERSION_ID="7"     VERSION="7 (wheezy)"      I have a header only library that I need to include. I did this by creating a `.bash_profile` and adding these lines:               CPLUS_INCLUDE_PATH=~/eigen3:$CPLUS_INCLUDE_PATH     CPLUS_INCLUDE_PATH=~/gsl/include:$CPLUS_INCLUDE_PATH     export CPLUS_INCLUDE_PATH      Then I run **make** and I get an error:               fatal error: eigen3/Eigen/Dense: No such file or directory     compilation terminated.      But the file is there:               *****@chinqchint-35:~/eigen3/Eigen$ ls | grep Dense     Dense      Please, what can be the source of this error? My workflow worked when I did it on **Ubuntu 12.04**. Also I am using **gcc 4.7**. **EDIT:** I reloaded my **bash_profile** and printed out the environment variables and I got the following value for `CPLUS_INCLUDE_PATH`               CPLUS_INCLUDE_PATH=/home/myname/gsl/include:     /home/myname/eigen3:     /home/myname/gsl/include:     /home/myname/eigen3:


title: Quicktime-like video trimming in Linux?

text: One thing I loved about Quicktime 10 in Mac OS X (despite all its other shortcomings) was the ability to very easily trim a video file. I.e., I open the video in Quicktime drag two sliders to indicate the segment I want to cut from the video, then click Save As. All of this can happen very quickly. I really want to recreate this ease in Linux (I am running the latest Fedora but would love a distro-adnostic solution), but so far the best I can do was to clip videos in OpenShot or Kdenlive. The problem there is that I need to _export_ the segment resulting in re-encoding which takes much longer. Is there a way to easily trim/clip videos in Linux? Thanks!


title: Why does LightDM / Unity-Greeter override my display settings?

text: I am using Ubuntu 14.04 with Gnome Shell. I have recently had to install the ATI propriety drivers to get my HDMI output to work. I have noticed that LightDM will always override my display settings which will then persist until I reset them. Some examples: I set the Gamma value for the display in the Catalyst Control Centre ("CCC") to max (so everything is washed out). I then reboot or log out and log back in. When LightDM loads the login screen it is briefly at max gamma. About a second later it is auto set to the default gamma. This setting persists after log in.   * If I go into CCC I can see that it is still set to max. If I move the slider at all it the gamma jumps up to max (i.e. something has overridden the CCC setting);   * I plug in a second monitor and set it up to be a mirrored display. If I then log out and log back in the display is set to the default set up (extended desktop) as soon as LightDM loads; or   * I plug in a second monitor and set it up to be a mirrored display. I then unplug the monitor and reboot and log in (i.e. LightDM never loads with the second monitor connected). Once logged in I plug in the second monitor. Low and behold, its comes up as mirrored exactly like I told it to do in CCC. Basically every time LightDM gets involved is displaces my custom settings with default ones.  What on earth is the logic for it behaving in this way? Also, how do I change it?


title: How can I forward a already forwarded ssh key into tmux?

text: I'm connecting through SSH from a machine where my keys are stored, forwarding to a second machine, and then try to use the keys from within tmux. I appear to "loose" the forwarding when entering tmux. How can "forward again" so that I can use my keys from within tmux?               $ ssh [server] -o ForwardAgent=yes     $ git pull       # Succeeds.     $ /bin/bash     $ git pull       # Still succeeds, despite new shell.     $ exit     $ tmux attach     $ git pull       # Permission denied (publickey)


title: Making udev rule for bluetooth keyboard

text: I'm using a logitech k810 bluetooth keyboard with my laptop running Debian Wheezy. (I got the keyboard working by following this guide.) By default the F1-12 keys are multimedia keys unless the FN key is pressed. I prefer the keys to be F1-12 by default. Luckily this guy made a program that reverses the key functions. Running the program works to get the keys as I like and it survives reboot. Unfortunately the program doesn't survive if I turn the keyboard off and on again (to save power.) For this reason I'm trying to make a udev rule to run the key reversal program when the keyboard connects. I've been trying the the following solution which is proposed in both the above links. So far it's not working.               andreas@crunchbang:/etc/udev/rules.d$ cat 00-k810.rules     KERNEL==”hidraw*”, SUBSYSTEM==”hidraw”, ATTRS{address}==”00:1F:20:76:41:30”, RUN+=”/srv/scripts/k810.sh %p”          andreas@crunchbang:/srv/scripts$ cat k810.sh     #! /bin/bash     line=`dmesg | grep -i k810 | grep hidraw`     [[ $line =~ (.*)(hidraw+[^:])(.*) ]]     device=${BASH_REMATCH[2]}     /srv/bin/k810_conf -d /dev/${device} -f on      The /srv/bin/ folder does indeed contain the program for key reversal (k810_conf). I don't know exactly what the program does but running it with the script like this works:               sudo /srv/scripts/k810.sh      So the problem has to be with udev not detecting the device properly. The MAC address is the one i get if I do:               hcitool scan      ... while the keyboard is in pairing mode. It's also the one I see in Blueman. Not sure if it's relevant but this is the output of `udevadm monitor` when the keyboard is turned on:               KERNEL[31976.490290] add          /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.6/1-1.6:1.0/bluetooth/hci0/hci0:12/0005:046D:B319.001C     (hid) KERNEL[31976.491464] add          /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.6/1-1.6:1.0/bluetooth/hci0/hci0:12/input39     (input) KERNEL[31976.491689] add          /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.6/1-1.6:1.0/bluetooth/hci0/hci0:12/input39/event12     (input) KERNEL[31976.491885] add          /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.6/1-1.6:1.0/bluetooth/hci0/hci0:12/0005:046D:B319.001C/hidraw/hidraw0     (hidraw) UDEV  [31976.496400] add          /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.6/1-1.6:1.0/bluetooth/hci0/hci0:12/0005:046D:B319.001C     (hid) UDEV  [31976.497196] add          /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.6/1-1.6:1.0/bluetooth/hci0/hci0:12/input39     (input) UDEV  [31976.499496] add          /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.6/1-1.6:1.0/bluetooth/hci0/hci0:12/0005:046D:B319.001C/hidraw/hidraw0     (hidraw) UDEV  [31976.500679] add          /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.6/1-1.6:1.0/bluetooth/hci0/hci0:12/input39/event12     (input)      Any ideas on why the above udev rule isn't working - and how I can make a working one?


title: Installed sqlite3 v3.8, but mac terminal still runs old version 3.6 by default

text: I have a Mac running OS X 10.6.8, which comes pre-installed with SQLite3 v3.6. I installed v3.8 using homebrew. But when I type "sqlite3" in my terminal it continues to run the old pre-installed version. Any help? Not sure if PATH variable has anything to do with it, but running echo $PATH results in the following: /usr/local/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin And the NEW version of SQLite3 is in the following directory: /usr/local/Cellar/sqlite I should add that I also downloaded the binary executable to my desktop, and that works if I click from my desktop, but doesn't work from the terminal. Any help would be greatly appreciated?


title: Python 2.7 on Samsung ChromeBook

text: I notice that there is a `/usr/bin/python` which is symlinked to `/usr/local/bin/python2.7` on Samsung Chromebook (`GOOGLE_RELEASE=4319.79.0`). But there is no file there and hence the directory entries show up in red. Is there some way of installing / activating Python?


title: Step by Step instructions to Download everything from : ( yum -y groupinstall "Desktop" "Desktop Platform" "X Window System" "Fonts" )

text: I am a super paranoid person that believes FBI and etc   is spying on me, as a result i have decided to re-install   centos-linux to my pc every week. Installing centos minimal edition via usb is simple   because the iso file is only below 400 mb and thus   i would have no trouble creating a centos usb drive   if i was in another country with slow or no internet. the problem here is this.. this line               yum -y groupinstall "Desktop" "Desktop Platform" "X Window System" "Fonts"      i have no idea how to, download all these to a folder, and then use the folder to install them all after a fresh install of centos linux minimal. i have so far found out that one can run..                yum groupinfo "Desktop"      yum groupinfo "Desktop Platform"      yum groupinfo "X Window System"      yum groupinfo "Fonts"      to get the name of each package from every one of those "categories" but it it gets confusing. they have "optional packages" and "Default packages" on top of "mandatory packages". this makes it confusing, to know which ones i should download to a folder via..                yumdownloader --resolve <package name>      it's also time consuming to go through each one and download it via `yumdownloader` how can i download all these to a folder and next time i re-install centos linux minimal, i can just run something like..               yum --nogpgcheck localinstall *.rpm      and they'd all be installed for me? so that i don't have to run               yum -y groupinstall "Desktop" "Desktop Platform" "X Window System" "Fonts"      and download everything again from the internet for every and each time i am re-installing centos minimal + gui. one may say, create centos usb drive with the large dvd iso files so repos are all in there. that is what i may do if i can not find a solution. the idea here is to have what is needed rather than to have everything in a usb that is never needed. it's nice to be organized.


title: What would be the "apt-cache show" equivalent on RHEL *without* requiring sudo/su?

text: How can I query the _local_ package cache of `yum` on RHEL (and derivatives) without requiring superuser privileges? **Note:** I am not interested in running an update of the package cache up front. All I am interested in is to query what the local package cache _already_ knows. * * * **Edit:** it turns out the problem wasn't the `yum` operation (`search`) itself in this case, but rather the fact that some of the files underneath `/etc/yum.repos.d/` were unreadable due to some fellow admin putting them there this way.


title: Don't snap windows to edge when moving between monitors

text: I am running Linux-mint 13 with XFCE. When I drag a window to the side of the screen it snaps to the side and fills up that vertical half of the screen. This is great, but I have two graphics cards so I can have two monitors. I can't drag a window from one monitor to the other because it snaps to the side of the the first screen. I have to open applications on the 2nd screen, and then they are stuck there. I assume I need to disable this feature (even though I quite like it). I can't find any option for it anywhere. How do I do this? Thank you.


title: Encrypting import's output with gpg at the same time

text: The `import` command saves screenshot in a file. Is there a way to encrypt that file at the same time using `gpg`, without saving the image file first? `gpg` accepts input from stdin but it seems that import doesn't support writing files to stdout, so I can't pipe output of the `import` to `gpg`.


title: Why does OpenSSL automatically send me Terminal mail?

text: I for some reason am getting messages from OpenSSL constantly (not literally constantly, but every hour or so) sent to my Terminal mail box saying: Message 1: Subject: Cron /usr/local/Cellar/openssl-osx-ca/1.0.3/bin/openssl- osx-ca /usr/local/bin/brew X-Cron-Env: X-Cron-Env: X-Cron-Env: X-Cron-Env: X-Cron-Env: Date: Wed, 4 Sep 2013 18:00:01 -0400 (EDT) /bin/sh: /usr/local/Cellar/openssl-osx-ca/1.0.3/bin/openssl-osx-ca: No such file or directory And I cannot seem to get rid of the messages, even when I delete them. Is there something wrong with my OpenSSl install?


title: Proper use of escape characters in desktop file

text: I have a command with a working .desktop Exec key as follows:               Exec=env XDG_CONFIG_HOME=/home/bean/.config/gedit/ gedit %U      I would like to use the `$HOME` variable instead and it works in the terminal but not when used in the .desktop file. Please correct me if I'm wrong, but I assume this is because of improper "escape characters". I have tried numerous variations of the command with `\` and `{}` but to no avail. After looking around I'm not even sure if what I want can be accomplished.


title: tee + cat: use an output several times and then concatenate results

text: If I call some command, for instance an `echo` I can use the results from that command in several other commands with `tee`. Example:               echo "Hello world!" | tee >(command1) >(command2) >(command3)      With cat I can collect the results of several commands. Example:               cat <(command1) <(command2) <(command3)      I would like to be able to do both things at the same time, so that I can use `tee` to call those commands on the output of something else (for instance the `echo` I've written) and then collect all their results on a single output with `cat`. It's important to keep the results in order, this means the lines in the output of `command1`, `command2` and `command3` should not be intertwined, but ordered as the commands are (as it happens with `cat`). There may be better options than `cat` and `tee` but those are the ones I know so far. I want to avoid using temporary files because the size of the input and output may be large. How could I do this? PD: another problem is that this happens in a loop, that makes harder handling temporary files. This is the current code I have and it works for small testcases, but it creates infinite loops when reading and writing from the auxfile in some way I don't understand.               somefunction()     {       if [ $1 -eq 1 ]       then         echo "Hello world!"       else         somefunction $(( $1 - 1 )) > auxfile         cat <(command1 < auxfile) \             <(command2 < auxfile) \             <(command3 < auxfile)       fi     }      Readings and writings in auxfile seem to be overlapping, causing everything to explode.


title: Create a Filter for Postfix on Virtual Mails

text: This is what I am trying to do: I have a server using Postfix on a Ubuntu precise 64bits and I have a table list of emails in /etc/postfix/virtual, like this:               artz@mydomain.com  artz@gmail.com     artz2@mydomain.com artz@yahoo.com      Now I want to put a filter that get all mails sent and add some prefix to the subject or add something else to the end of the mail. In the file /etc/postfix/master.cf I put:               filter    unix  -       n       n       -       10      pipe       flags=Rq user=filter argv=/home/filter/filtro.php -f ${sender} -- ${recipient}      I created the user filter and put the file /home/filter/filtro.php:               #!/usr/bin/php     <?php     $myFile = "/home/filter/testFile.txt";     $fh = fopen($myFile, 'a');     fwrite($fh, "\n-----------------------\n");     fwrite($fh, json_encode($_SERVER['argv']) );     ?>      It was just to see if it´s working. But it´s not. Anyone can see a light for my problem? Thanks!


title: Execute a line of commands with one sudo

text: For example if I want to create a file and enter text in one line I can redirect the output into a file with the use of the `>` operator:               echo "something" > /path/foobar      but if I don't have access to the folder `/path/` and need sudo priviledges, How can I achieve this same command as a normal user with sudo rights? I tried               sudo echo "something" > /path/foobar      but that doesn't work, because the sudo only counts for the `edit` but not for the right part   of the `>` Sure, I could become root before with `sudo su` or use `tee` instead:               echo "something" | sudo tee /path/foobar      But I would like to find a solution where I can work with the last line as replacement via               sudo !!      Isn't there a way to "recycle" the last line and just add `sudo` in front?


title: How to do arithmetic manipulations on entire rows in LibreOffice

text: I have a table of data which I want to do some arithmetic manipulations on. If I want to subtract say `11B` from `3B` I just do `=$B3-$B11`. But if I want to subtract each row 11 value from its corresponding row 3 value how do I do this? `$Each3-$Each11` I don't want to have to input a formula in each box.


title: Configuration - apache2.conf on Debian

text: Excuse me! But this is my second day on Debian, and I already have a lot of questions: I tried to save from the editor php file in / var / www / directory, but I get a message:               Unable to save /var/www/file.php     Error: Unable to create tmp file in /var/www      Is the problem in apache2.conf file, because of the options in it I can not change evan when I'm a root? How should be look configuration files for apache, php and mysql to work as normal in WAMP on Win?


title: What are the two sections of this dmidecode output?

text: I ran dmidecode on my system to verify certain processor information. However, I am not sure what the two sections of the output indicate.               $ sudo dmidecode -t processor     # dmidecode 2.11     SMBIOS 2.7 present.          Handle 0x0004, DMI type 4, 42 bytes     Processor Information         Socket Designation: CPU 1         Type: Central Processor         Family: Other         Manufacturer:                           ID: 00 00 00 00 00 00 00 00         Version:                                                         Voltage: 3.3 V 2.9 V         External Clock: Unknown         Max Speed: 2000 MHz         Current Speed: Unknown         Status: Unpopulated         Upgrade: Other         L1 Cache Handle: 0x0005         L2 Cache Handle: 0x0006         L3 Cache Handle: 0x0007         Serial Number: To Be Filled By O.E.M.         Asset Tag: To Be Filled By O.E.M.         Part Number: To Be Filled By O.E.M.         Core Count: 1         Core Enabled: 1         Thread Count: 1         Characteristics:             64-bit capable          Handle 0x0035, DMI type 4, 42 bytes     Processor Information         Socket Designation: P0         Type: Central Processor         Family: E-Series         Manufacturer: AuthenticAMD              Signature: Family 11, Model 15, Stepping 15         Flags:             MSR (Model specific registers)             CX8 (CMPXCHG8 instruction supported)             APIC (On-chip APIC hardware supported)             SEP (Fast system call)             ACPI (ACPI supported)         Version: AMD E-450 APU with Radeon(tm) HD Graphics         Voltage: 1.4 V         External Clock: 100 MHz         Max Speed: 1650 MHz         Current Speed: 1650 MHz         Status: Populated, Enabled         Upgrade: None         L1 Cache Handle: 0x002D         L2 Cache Handle: 0x002E         L3 Cache Handle: Not Provided         Serial Number: Not Specified         Asset Tag: Not Specified         Part Number: Not Specified         Core Count: 2         Core Enabled: 2         Thread Count: 2         Characteristics:             64-bit capable      The second section (`Handle 0x0035`) seems to be the processor information. What is the first section (`Handle 0x0004`) ? I have looked at the manpage, and some Google results as well, none of which were helpful.


title: is there an equivalent to systat in Linux?

text: Is there an equivalent to the amazing systat command in Linux-based operating systems? For those who don't know about it, the BSD's systat command is just amazing. It displays live graphs of network traffic, I/O, ICMP, IP, TCP, network sockets (like `netstat`), swap usage and so on. But the most amazing of all, is the `-vmstat` display. I'll paste a snapshot of the live display here:                   2 users    Load  0.10  0.12  0.13                  Apr 30 22:50          Mem:KB    REAL            VIRTUAL                       VN PAGER   SWAP PAGER             Tot   Share      Tot    Share    Free           in   out     in   out     Act   79096    5336   210828     9572  112208  count     5     All  144196   16988  2355132    30104          pages    19     Proc:                                                            Interrupts       r   p   d   s   w   Csw  Trp  Sys  Int  Sof  Flt    535 cow    1313 total       2          58      2923 1665 2493 1313  999 1094    299 zfod    999 clk irq0                                                            16 ozfod       uart0 irq4     20.0%Sys   3.7%Intr 29.7%User  0.0%Nice 46.6%Idle       5%ozfod   101 vr1 irq5     |    |    |    |    |    |    |    |    |    |    |       daefr       irq7:     ==========++>>>>>>>>>>>>>>>                           487 prcfr       stray irq7                                             38 dtbuf      786 totfr   128 rtc irq8     Namei     Name-cache   Dir-cache     35088 desvn        1 react       vr2 irq9        Calls    hits   %    hits   %     31092 numvn          pdwak    52 vr0 irq11         3254    3238 100                  8647 frevn          pdpgs    27 vr3 irq12                                                               intrn     6 ata0 irq14     Disks   ad0                                         86200 wire        ata1 ohci0     KB/t  14.90                                         89816 act     tps       6                                        209168 inact     MB/s   0.08                                            56 cache     %busy     7                                        112152 free      The manpage goes through great lengths to explain all the different parts of this arguably "crowded" display but what I quite miss in Linux about this are:   1. the interrupt-per-second summary (on the right) - sure i can `watch -n 1 cat /proc/interrupts`, but it's hard to tell what's really going on there...   2. the disk usage (on the bottom left) - just plain and simple `MB/s` and how busy the disk is (in percentage!) Before you answer, understand that I know very well:   * `top` \- pales in comparison: only looks at some of those aspects, in too broad strokes   * `vmstat` \- a classic, but is more useful to draw trends over time than figure out "what's going on _now_ exactly"   * `iftop` \- useful to diagnose network bottlenecks, but that's it   * `iotop` \- same for I/O   * `dstat` \- interesting, but doesn't have the same granularity per interrupt I could mention a lot more of those: basically, I am not aware of a single tool that shows that much of a complete snapshot of the state of a machine in a single 24x80 terminal screen, in any Linux-based distribution. Please prove me wrong. :)


title: Cannot connect to WIFI

text: I finally made the switch from windows to Linux. CentOS to be precise. Unfortunately, I am unable to have my wireless connection working, so accessing the web is a hassle. Following directions on the web i was directed to               yum install wireless-tools      It says "Package 1:wireless-tools-29-5.1.1.el6.x86_64 already installed and latest version" I was also directed to               sudo ifconfig -a      which resulted in               eth0      Link encap:Ethernet  HWaddr B8:88:E3:34:E5:07             inet addr:192.168.0.155  Bcast:192.168.0.255  Mask:255.255.255.0           inet6 addr: fe80::ba88:e3ff:fe34:e507/64 Scope:Link           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:397682 errors:0 dropped:0 overruns:0 frame:0           TX packets:229592 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:1000            RX bytes:578549471 (551.7 MiB)  TX bytes:17894242 (17.0 MiB)     lo        Link encap:Local Loopback             inet addr:127.0.0.1  Mask:255.0.0.0           inet6 addr: ::1/128 Scope:Host           UP LOOPBACK RUNNING  MTU:16436  Metric:1           RX packets:98 errors:0 dropped:0 overruns:0 frame:0           TX packets:98 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:0            RX bytes:7154 (6.9 KiB)  TX bytes:7154 (6.9 KiB)      people say that wlan0 is supposed to be there too. but I don't know how to get it in there.               lspci -v      the result               00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)     03:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8188CE 802.11b/g/n WiFi Adapter (rev 01)     Subsystem: Realtek Semiconductor Co., Ltd. Device 8195     Flags: bus master, fast devsel, latency 0, IRQ 11     I/O ports at 4000 [size=256]     Memory at f2d00000 (64-bit, non-prefetchable) [size=16K]     Capabilities: [40] Power Management version 3     Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+     Capabilities: [70] Express Endpoint, MSI 00     Capabilities: [100] Advanced Error Reporting     Capabilities: [140] Virtual Channel     Capabilities: [160] Device Serial Number 01-91-81-fe-ff-4c-e0-00     0c:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 07)     Subsystem: Lenovo Device 5000     Flags: bus master, fast devsel, latency 0, IRQ 31     I/O ports at 2000 [size=256]     Memory at f1404000 (64-bit, prefetchable) [size=4K]     Memory at f1400000 (64-bit, prefetchable) [size=16K]     Capabilities: [40] Power Management version 3     Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit+     Capabilities: [70] Express Endpoint, MSI 01     Capabilities: [b0] MSI-X: Enable- Count=4 Masked-     Capabilities: [d0] Vital Product Data     Capabilities: [100] Advanced Error Reporting     Capabilities: [140] Virtual Channel     Capabilities: [160] Device Serial Number dd-43-00-00-68-4c-e0-00     Kernel driver in use: r8169     Kernel modules: r8169


title: How to rsync just the current folder?

text: I want to sync some files from a remote server to my local computer. How can I make rsync to just copy the files with a certain file extension in the directory but no subdirectories? I assumed this to be an easy task, but embarassingly I'm not getting it for nearly 2 hours. So could someone give me an example? I did various experiments with something like the following command:               rsync -a --include=what? --exclude=what? -e ssh me@server.com:/test /test


title: Can I install LAMP over existing Apache installation?

text: I'm setting up my first VPS, and I installed and configured Apache before I realized that there was the LAMP package to do that for me. Can I run `sudo apt-get install lamp-server^` or do I have to uninstall the existing Apache first?


title: FreeBSD : Persistent naming for NICs

text: Is there anything equivalent to Debians udev rules on FreeBSD? I was hoping to set the name on devices according to the devices attributes such as PCI bus/MAC etc. However, FreeBSD only seems to allow you rename the device after it's already set the device name. i.e. after the card is detected at boot and depending on the order, assigning names such as em0, em1 ... I know that configuring rc.local should allow you to rename the interface but I prefer naming a device by it's attribute rather device name. e.g ifconfig_em0_name=eth0 Any help would be greatly be appreciated. Thank you.


title: Monodevelop doesn't run the project. When I try to run nothing happens

text: I've been trying to get Monodevelop up and running for almost a week now, first on my redhat and now on my fedora. The debugger doesn't work, when trying to debug I get this error: ![enter image description here](http://i.stack.imgur.com/l2zAE.png) I tried re-installing Monodevelop, but it's the same. I've looked at google, and the only thing I could find, was from three years ago, and it said it was a bug. And I can't run the project, because when I run it nothing happens, no ouput. Here is the program I tried to run:               using System;          namespace ArteriumTarreDal     {         class MainClass         {             public static void Main (string[] args)             {                 Console.WriteLine ("Hello World!");             }         }     }      EDIT: I'm running Fedora 20 x86_64 and just installed Monodevelop 4.0 through this instruction and repository: stackoverflow > For installation instructions with apt-get or yum, see: > http://software.opensuse.org/download/package?project=home:tpokorra:mono&package=monodevelop- > opt Same problem with Monodevelop 4.0: ![enter image description here](http://i.stack.imgur.com/7ha5a.png) Anyone got any clue what this is error is. And how to fix it? EDIT: I got it working on Fedora 20 x86_64 KDE, but I still can't find how to fix it on Gnome.


title: Using find command to find folder ignoring case

text: I would like to know if a particular folder is present or not. I used the following command               find /mnt/md0/ -maxdepth 1 -name 'dcn'||'DCN'      I want to know if folder name is DCN or dcn .   How would I do this ?


title: linux + get errors about libraries inspite lib rpm's already installed

text: I download the vpnc client from the following link                  https://www.unix-ag.uni-kl.de/~massar/vpnc/      Then I installed the vpnc on my Linux red-hat machine ( version 6.x ) as the following:               tar zxf vpnc-0.5.3.tar.gz     cd vpnc-0.5.3     make      .               make     make: libgcrypt-config: Command not found     gcc -O3 -g -W -Wall -Wmissing-declarations -Wwrite-strings  -DVERSION=\"0.5.3\"   -c -    o isakmp-pkt.o isakmp-pkt.c     In file included from isakmp-pkt.c:31:     math_group.h:38:20: error: gcrypt.h: No such file or directory     In file included from isakmp-pkt.c:31:     math_group.h:62: error: expected specifier-qualifier-list before âgcry_mpi_tâ     In file included from vpnc.h:24,                  from isakmp-pkt.c:32:     tunip.h:43: error: expected specifier-qualifier-list before âgcry_cipher_hd_tâ     isakmp-pkt.c: In function âparse_isakmp_packetâ:     isakmp-pkt.c:823: warning: format â%dâ expects type âintâ, but argument 2 has type     âsize_tâ     make: *** [isakmp-pkt.o] Error 1      please advice why I get errors about libgcrypt and libgcrypt ?? (those rpm’s already installed on my machine , so whats the problem here ? ) I checked the rpm's: and they installed on my linux machine               rpm -qa | grep libgcrypt     libgcrypt-1.4.5-9.el6_2.2.x86_64     libgcrypt-1.4.5-9.el6_2.2.i686               rpm -qa | grep gcrypt     libgcrypt-1.4.5-9.el6_2.2.x86_64     libgcrypt-1.4.5-9.el6_2.2.i686      remark - the link below described the vpnc installation: http://floppsie.comp.glam.ac.uk/Glamorgan/gaius/networks/13.html


title: List elements with spaces in zsh

text: I've been studying zsh scripting for all of 2 hours at this point and I've hit a wall. I want to go through a list of files that may have spaces in them. I'm open to completely different approaches than the following example so long as they're zsh since zsh is what I'm studying, not the task I'm trying to script.               files=(`ls`)     for f in $files; do         print $f     done      I'm obviously not just recreating `ls`, I just want `$f` to capture the entire file name each iteration of the loop.


title: Batch renaming files with pattern

text: I have some files named like these: 63018933.mp4?token=1325697436_b0c3e70c6e339380b4a484c576a8c287 63808488.mp4?token=1325697401_4ae5f7a68d93873c8881b303e7655e14 How do I rename all them to, for example 63018933.mp4(remove characters after mp4)?


title: Changing background color of gedit's whitespace highlighting

text: I've used NEdit since about 2003. NEdit's whitespace highlighting is subtle and I prefer it to the dot other editors put in whitespace. NEdit's background normally is light grey and whitespace is rendered as white without a dot (and tabs in a darker gray). However, NEdit doesn't support UTF-8 encoding, so I don't intend to use NEdit for much longer. I've (reluctantly) determined that gedit is the presently available editor that is closest to what I want. I am trying to replicate NEdit's look in gedit without success. I can change the style of the spaces shown with the "Draw Spaces" plugin by adding the following to the gedit style file:               <style name="draw-spaces" foreground="color"/>      The `foreground` property only changes the color of the dot. There does not appear to be a corresponding `background` property to change the background. I thought if I made `foreground` and `background` the same color then I could replicate NEdit's look. How can I change the background color of the whitespace highlighting in gedit without also changing the background color of the remainder of the text?


title: Linux equivalent for Microsoft Visio?

text: Visio is a great tool for creating diagrams, flowcharts, prototyping, etc. But it is Windows-only and is not free. Are there any graphical tools for Linux that can do many of these same tasks well?


title: Xpdf fit to page width in fullscreen mode

text: When I call the command:               $ xpdf file.pdf -z width -fullscreen      ...it does not have the desired effect. The individual options:               $ xpdf file.pdf -z width      ...and:               $ xpdf file.pdf -fullscreen      ...work as expected. Is it possible to achieve the desired effect in xpdf?


title: "The entry is a door" in Solaris "ls" man page

text: I found this in a man page for `ls` in solaris linux. http://www.unix.com/man-page/opensolaris/1/ls/ What does it mean when it says: > `D` the entry is a door?


title: Conntrack TCP Timeout for state stablished not working

text: Im using a private IP address and I want to keep alive SNAT entries in my Router (Gateway) for at least two hours (some windows apps of my network are using TCP keepalive set to 2 hours). Gateway is a Linux machine so i set `nf_conntrack_tcp_timeout_established` and `nf_conntrack_generic_timeout` values to 7400 seconds:               echo 7400 > /proc/sys/net/netfilter/nf_conntrack_tcp_timeout_established     echo 7400 > /proc/sys/net/netfilter/nf_conntrack_generic_timeout      Now, when a TCP connection is stablished shortly after i can see the new value:               # cat /proc/net/ip_conntrack     tcp      6 7399 ESTABLISHED src=192.168.0.192 dst=108.168.176.194     sport=51826 dport=5222 src=108.168.176.194 dst=95.63.14.117 sport=5222      dport=51826 [ASSURED] use=1      But few seconds later i read the value again and now the value has returned to 60 seconds:               tcp      6 39 ESTABLISHED src=192.168.0.192 dst=108.168.176.194      sport=51826 dport=5222 src=108.168.176.194 dst=95.63.14.117 sport=5222      dport=51826 [ASSURED] use=1


title: How to do a text replacement in a big folder hierarchy?

text: I want to search and replace some text in a large set of files excluding some instances. For each line, I want a prompt asking me if I need to replace that line or not. Something similar to vim's `:%s/from/to/gc` (with the `c` to prompt for confirmation), but across a set of folders. Is there some good command line tool or script that can be used?


title: Install single debian experimental packages?

text: I'm continually getting this error:               /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.14' not found      What I did before was add the Debian experimental repo and update to 2.17. But through a long chain of events, this ended up breaking almost everything on my system, and I had to reinstall. Is there any way to upgrade just this single package, without screwing up apt?


title: Forcing broswers to use a different host and port when viewing websites over ssh-tunnels

text: I've setup an ssh tunnel to a network that has a website I need to view. However, when requesting the page my browsers sends the host `localhost` and url `http://localhost:1234` in the HTTP headers. Is there a way to spoof this information, if there's a browser specific way of doing it that works for chromium or firefox, that will be useable. SSH Setup:               Host mytunnel         User myname         HostName host.example.com          ExitOnForwardFailure true         LocalForward 1234 host.example.com:80      The only way I can think of now is setting up a virtual machine that runs a DNS server and sets up the tunnels on the right ports.


title: grub: "Missing Operating System"

text: I tried editing the `menu.lst` file in order to dual-boot with Windows 7. I simply uncommented the Windows entry and added               map (hd0) (hd1)     man (hd1) (hd0)      according to the Arch Linux wiki. I rebooted and had a Grub menu with 3 options: Arch Linux, Arch Linux Recovery, Windows 7. Exactly as it should be. I selected Windows 7 and nothing happened. I hit Ctrl-Alt-Del and rebooted. Instead of grub, I got "Missing Operating System". Using the Arch Live USB flash drive, I mounted the `/boot/` partition (`/dev/sda1`) and discovered that I couldn't even get into the `grub` directory to look at or fix things. The output of `cd /mnt/boot` and `ls -l` is:               EXT2-fs (sda1): error: ext2_get_inode: unable to read inode block - inode=10041, block=41221     ls: cannot access grub: Input/output error     total 13667     d????????? ? ?    ?          ?            ? grub     -rw-r--r-- 1 root root 8411722 May  2 19:37 kernel26-fallback.img     -rw-r--r-- 1 root root 1764873 May  2 19:37 kernel26.img     drwx------ 2 root root   12288 May  2 19:12 lost+found     -rw-r--r-- 1 root root 1545080 Apr 22 18:32 System.map26     -rw-r--r-- 1 root root 2198640 Apr 22 18:32 vmlinuz26      So something about trying to boot to Windows seems to have destroyed grub, after things were going so well. (NB: With the 2nd (Windows) drive attached but not represented in `menu.lst`, Arch worked fine, booted properly, could mount and read partitions on the other drive.) I can't show you the `menu.lst` file because I can't see it. It had not been changed from the default except to uncomment the Windows entry and add the two lines given above. Out put of `fdisk -l`:               Disk /dev/sdb: 1000.2 GB...     ...                 Device Boot     Start       End     Blocks  Id  System     /dev/sdb1              1         5      40131  de  Dell Utility     /dev/sdb2              6      1327   10614784   7  HPFS/NTFS     /dev/sdb3   *       1327     63517  499537920   7  HPFS/NTFS     /dev/sdb4          63517    121602  466567168   f  W95 Ext'd (LBA)     /dev/sdb5          63517    121602  466566144   7  HPFS/NTFS     Warning: invalid flag 0x0000 of partition table 5 will be corrected by w(rite)          Disk /dev/sda: 1000.2 GB...     ...             Device Boot     Start       End     Blocks  Id  System     /dev/sda1              1         5      40131   6  FAT16     /dev/sda2              6      1327   10614784   7  HPFS/NTFS     /dev/sdb3   *       1327     63517  499537920   7  HPFS/NTFS     /dev/sdb4          63517    121602  466567168   f  W95 Ext'd (LBA)      I notice that the partition information for sda1-4 are exactly the same as sdb1-4, which they should not be. Also, I can't seem to mount anything from `sda` except `/dev/sda1/`, which contains the boot files and the unresponsive `grub` directory. If I do, I'm told `mount: you must specify the filesystem type`. If I specify `-t ntfs`, it fails and says it `doesn't have a valid NTFS`. If I specify `-t ext4` (which is what it should be), it says it's the wrong fs type. I can't think of any other details to include.


title: Silicon Wave USB Bluetooth Adapter doesn't work

text: I have been trying to use my usb bluetooth adapter(silicon wave) on ubuntu 11.10 server, it appears in the lsusb list but it doesn't work               Bus 005 Device 003: ID 0c10:0000     root@i5-PC:/home/john# hcitool scan     Device is not available: No such device      Now when I'm using ubuntu 11.04 server, It works perfectly and found all devices. How could I solve it by the command line?


title: what programming language was red hat enterprise linux written in

text: what was red hat enterprise linux written in? I assume C and C++, but I can't for the life of me figure it out, and I'm interested in forking it.


title: Copying clipboard-content to file automatically and continiously?

text: I need to make a list of some links on a web-page. I've been using right-click `copy link URL` and then pasting it (Menu_Edit->Paste) into `vim` running in `xterm` \-- then repeating. This is obviously a rather cumbersome approach, and surely there must be a better way. (The pasting goes fine, so I guess the links are stored as ascii-text.) So is there a way to automatically "record" each `copy link URL` (onto the clipboard) to a file - Ie. copying each change in the clipboard to a file? Is there a program that can do this, or perhaps some hidden file (eg. a named pipe) from which I could read the clipboard content? I see there are some "clipboard managers"... are any of them suited to do something like this? (which one? how?) I'm using LinuxMint MATE.


title: About hfsc parameters

text: I'm trying to use hfsc, so I've read the HFSC Scheduling with Linux I understand some concepts but shame on me, I don't understand how the values are calculated, for example: > The concept of the interaction with latency resides in the structure of the > service curves of the individual classes. By selecting a two-part service > curve, each section of which is linear, the transmission delay for the Voice > over IP class can be reduced to 30 ms. The first section of the service > curve features a 400 kbit slope of 30 ms duration, where the second section > exhibits a slope of 100kbit. This gain in decreased delay of approximately > 78 ms is earned at the expense of other classes. At no point, though, is the > sum of the curves allowed to exceed the service curve of the total link > capacity. In our example, the decreased delay for the Voice over IP class > occurs at the cost of party A's unspecified data class, whose service curve > must be adjusted in order not to to exceed the global limit. As a result, > the maximum transmission delay of this class increases from 30ms to a total > of 52.5 ms. For bulk data transport, such as FTP, for example, delay simply > plays a secondary role in contrast to that of throughput, which isn't > impaired by conforming to the service curve Great, really greate sorry but I have no idea where is 78 ms from, or the 52.5 ms.... The final example uses it the 52.5 ms rounding the value... I guess: > tc class add dev eth0 parent 1:10 classid 1:11 hfsc sc umax 1500b dmax 53ms > rate 400kbit ul rate 1000kbit Please could you explain how these values are obtained? I've read the man page and result me as willing as painful. Thanks in advance!


title: Is there any software for Debian to fix my GRUB

text: Sometimes, when I boot up my PC, I find that after the logo screen, an `_` (underscore) is blinking and the machine does not boot. After that I have to unplug it from the mains and restart it and then it runs fine. So, Please tell me what has happened to my PC? My specifications are               Debian 7, 512 MB RAM 3 GHZ PENTIUM D PROCESSOR 256 MB GRAPHICS


title: Why does du report a size of 0 for some non-empty files on a HFS+ partition?

text: What is the explanation for the difference:               $ ls -l /Applications/Safari.app/Contents/Info.plist     -rw-r--r--  1 root  wheel  15730 11 jui 15:02 /Applications/Safari.app/Contents/Info.plist          $ du -sh /Applications/Safari.app/Contents/Info.plist     0B     /Applications/Safari.app/Contents/Info.plist      Once the file is copied in my home folder, `ls` and `du` report the same number.               $ cp /Applications/Safari.app/Contents/Info.plist .     $ du -sh Info.plist; ls -l Info.plist     16K Info.plist     -rw-r--r--  1 ant  staff  15730 17 oct 16:53 Info.plist      Both directories are on this partition ( / )               diskutil  info /     Device Identifier:        disk0s2     Device Node:              /dev/disk0s2     Part of Whole:            disk0     Device / Media Name:      ml2013          Volume Name:              OSX.10.8     Escaped with Unicode:     OSX.10.8          Mounted:                  Yes     Mount Point:              /     Escaped with Unicode:     /          File System Personality:  Journaled HFS+     Type (Bundle):            hfs     Name (User Visible):      Mac OS Extended (Journaled)     Journal:                  Journal size 40960 KB at offset 0xc83000     Owners:                   Enabled      Here is the output of stat:               $ stat  Info.plist     16777218 8780020 -rw-r--r-- 1 root wheel 0 15730 "Oct 17 17:47:12 2013" \      "Jun 11 15:02:17 2013" "Jun 11 15:02:17 2013" "Apr 27 11:49:34 2013"\      4096 0 0x20 Info.plist


title: Allow a specific user to sudo to users that are part of group X

text: I have several users, which are all part of group X. And I want to be able to give user Y to sudo to members of group X. Obviously I don't want to edit sudoers everytime I add a user to group X, is there an elegant way to solve this? sudoers doesn't seem to have syntax for this.


title: restart fuse after editing fuse.conf

text: I'm setting up fuse so I can work with the mtp system on my galaxy nexus. And I'm going through a tutorial which tells me to restart my computer after editing `fuse.conf` `user_allow_other`. But I simply don't believe that I actually have to restart =P Is there a way to get the system to re-read the fuse.conf file without restarting?


title: Print row contain maximum and minimum value

text: I need to read the file (contains 16K rows)and print the entire row if any of columns and all columns contains max value (100) and all columns contain min value (0).The ouput example is given **input.txt (tab-delimited)**               Id sno1 sno2 sno3 sno4     E1 98   100  88   78     E2 33   99   78   66     E3 0     0   100  56     E4 0     0    0    0     E5 45   55   65   100     E6 0     0   99    88     E7 100 100  100   100      **Ouput.txt**               E1 98  100  88   78     E3 0    0   100   56     E4 0    0    0    0     E5 45   55   65   100     E7 100  100  100  100


title: shell script for auto-touching files

text: I have written a shell script to touch all the files in the `/tmp` directory. However, there was an error message saying that `/bin/touch: Argument list too long`. What's the cause of the problem?               #!/bin/bash          dayNo=1     while test $dayNo -le 200     do         touch `find /tmp/`         sleep 86000     done


title: Regarding getting Date - n days Date

text: Suppose I have a particular date stored in a variable (date_m) . I want ((date_m)-25) date. For eg: I have 15/09/2014 stored in my variable , then I want 21/08/2014 returned if I subtact 25 from the date stored in variable.


title: etckeeper for opensuse - bash script install and configure

text: I want to automate the installation of etckeeper on OpenSuse 12.3. My first issue is that etckeeper doesn't seem to be available in the standard OpenSuse repos.               zypper search etckeeper     Loading repository data...     Reading installed packages...     No packages found.      The second issue I anticipate is that when I use etckeeper manually I sometimes have to configure it (init) before it starts working. Here's the info about that from the readme: > The `etckeeper init` command initialises an /etc/.git/ repository. If you > installed etckeeper from a package, this was probably automatically > performed during the package installation. If not, your first step is to run > it by hand:               etckeeper init      I would like a script that will install it and have it init'd automatically with no end-user intervention required.


title: Is setting CentOS user home-dir as NGINX server block root secure for vsftpd?

text: This is what I did:   1. CentOS 6.2 server   2. installed nginx   3. installed vsftpd   4. in vsftpd.conf I set `chroot_local_user=YES`   5. created a new user "bleh"   6. created directory `/home/bleh/public_html/`   7. in virtual.conf I set location / { root to `/home/bleh/public_html/`   8. and finally did `chmod 755 /home/bleh/` Is this safe? Is this acceptable? I ran into all sorts of permission problems when I tried to use `/var/www/` as root. The above worked and the server is delivery data.


title: SFTP over reverse SSH tunnel?

text: I want to SFTP to a remote computer that is behind NAT. I can't modify the NAT router, so I have set up a reverse SSH tunnel using a middleman server. Here's what my SSH tunnel looks like:               laptop--->nat--->middleman<--nat<--desktop      The full details are here: Remote desktop over SSH reverse tunnel to replace TeamViewer I am currently using SSH and VNC over this tunnel. **How do I use SFTP over the tunnel?** I assume the command will look something like               sftp://localhost:port      SSH login is via **_key pair only (no password)_** so we need to consider that in the solution. And I use KDE, so I need to get this working with Dolphin file manager. I've heard that setting up SFTP authentication in Dolphin can be a pain... I'll be running Dolphin on the laptop and connecting to the file system on the desktop like this.               laptop(SFTP client)--->nat--->middleman<--nat<--desktop(SFTP server)      P.S. I would consider sshfs too, if that would be easier. I assume it won't because I don't have a domain name or IP address for the server.


title: How to disable the automatic mute after booting in gnome?

text: Whenever I start up, gnome sets the volume to mute automatically. So how can I ask it to remember the volume last time I set before shutting down?


title: How can I use tee and logger -t "some tag:"?

text: I've seen in another post which shows how to use tee and logger as shown below.               tee >(logger) <<< "System Load is OK : $Current_loadadv"      `>(logger)` is bash syntax to create a file descriptor that is going to a FIFO, which is then fed to the standard input of logger (this is one form of what is known as "process substitution" in bash). It then passes back the path to that file descriptor as an argument to tee, and since tee writes to its non-option arguments, the FD is written to, and logger receives your string. How can I modify the following command to use tag and logger above?               curl -Sks  http://x.x.x.x/scripts/somescript.sh | /bin/bash | logger -t "sometag"


title: Global /etc/profile setenv or export overwriting user settings in .profile

text: I need to call a modified version of a program in `/home/user_name/bin` rather than the (older) version in `/opt/program_name/current` on a CentOS 5.3 cluster. The program creates a tcsh script using python and then executes that script. I can overwrite the PATH to call the modified version of the program in `~/bin`, such that `which program_name` identifies the path to `~/bi`n. I have done this in `.bashrc`, `.profile`, `.tcshrc`, and `.cshrc`. However, each time the tcsh is executed, environmental variables from `/etc/profile` are loaded and the path gets reverted to `/opt/program_name/current`. These program-specific variables are set when `/etc/profile.d/program_name.sh` is called by `/etc/profile`:               # /etc/profile      for i in /etc/profile.d/*.sh ; do         if [ -r "$i" ]; then             . $i         fi     done     unset i Thus, when `program_name.sh` is called, the corresponding script is:               # /etc/profile.d/program_name.sh     setenv PATH ${PATH}:/opt/program_name/current How can I prevent `/etc/profile` from being accessed by my user account? I do not have su access and other users are still using the older version of the software in `/opt/program_name/current` so I can't update the software or modify settings in `/etc/profile.d/program_name.sh`


title: Completely disable GNOME for my user in Ubuntu

text: At the office we've been issued laptops with Ubuntu pre-installed. Unity is of course the OS default, but KDE is available. I prefer KDE and so have set KDM and KDE as my defaults. However some GNOME things are persisting, such as Guake, and the GNOME quick search (whatever it's called) starts on login. I just had GNOME's archiver open a zip file instead of KDE's. How can I finish converting _my_ account to use KDE components by default? For clarification I do not wish to uninstall GNOME. I simply want to stop GNOME software from starting in my account. Uninstalling GNOME or Unity would mean other users of the machine couldn't use these programs. **Update:** I think I found the origin of the problem of the autostarting applications. There is a whole folder at `/etc/xdg/autostart` of `.desktop` files that I think is loading these things. Not sure what needs to be done to disable them for KDE users only.


title: There are stopped jobs (on bash exit)

text: I get the message `There are stopped jobs.` when i try to exit a bash shell sometimes. Here is a reproducible scenario in python 2.x:   * `ctrl`+`c` is handled by the interpreter as an exception.   * `ctrl`+`z` 'stops' the process.   * `ctrl`+`d` exits python for reals. Here is some real-world terminal output:               example_user@example_server:~$ python     Python 2.7.3 (default, Sep 26 2013, 20:03:06)      [GCC 4.6.3] on linux2     Type "help", "copyright", "credits" or "license" for more information.     >>>       `ctrl+z`               [1]+  Stopped                 python     dylan@development:~$ exit     logout     There are stopped jobs.      Bash did not exit, I must `exit` again to exit the bash shell.   * **Q:** What is a 'stopped job', or what does this mean?   * **Q:** Can a stopped process be resumed?   * **Q:** Does the first `exit` kill the stopped jobs?   * **Q:** Is there a way to exit the shell the first time? (without entering `exit` twice)


title: How to create a gnu tarball that can be extracted by solaris tar

text: I am maintaining a legacy cygwin (with GNU tar v1.21) system and a legacy Solaris 9 system. The configuration of the Solaris 9 system is fixed and cannot be upgraded (i.e. I can't install gnu tar for Solaris). I am trying to create a tarball on the cygwin system that can extracted on the Solaris 9 system but unfortunately the directory structure (which is also fixed and cannot be renamed) plus file names exceed 100 characters and I've run into the Great Tar Wars of the last millennium. There is a large (conservative) userbase on the Solaris system so a solution that uses Solaris tar is preferred. Here are the errors I'm experiencing. Creating the tar on cygwin:               $ tar -cf dir.tar dir      or               $ tar -c --posix -f dir.tar dir      Gives the following on Solaris:               $ tar -xif dir.tar     tar: directory checksum errors      And the file names in dir are truncated. (i.e. ignoring checksum errors doesn't help) How do I create a tarball with long pathnames using GNU tar that can be extracted by Solaris tar? ## Edit #2: Unable to use Schily Tar (star) It appears that Joerg Schilling has been able to emulate the Solaris 7/8/9 tar format and provides a `suntar` option to create a Solaris tarball using star. Unfortunately `star` is not available on cygwin. :( ## Edit #1: Using --format=posix gives errors when extracting Errors when extracting --format=posix gnu tarballs using pax on Solaris 9 On cygwin:               $ ls example/this_is_a_path_name_greater_than_one_hundred_characters/when_combined_with_this_file_name_which_is_also_rather_long.txt | wc -m     128     $ tar -c --format=posix -f example.tar example      On Solaris:               $ pax -r -f example.tar     pax: ./PaxHeaders.4440/example : Unknown filetype     pax: example/PaxHeaders.4440/this_is_a_path_name_greater_than_one_hundred_characters : Unknown filetype     pax: example/this_is_a_path_name_greater_than_one_hundred_characters/PaxHeaders.4440/when_combined_with_t : Unknown filetype      Similar errors are given when extracting using Solaris tar.


title: What's the essential difference between grep foo $(CMD) and CMD | grep foo

text: It's really important because intuitively they are all similar for me. Could one realise that those two are really like one another for me, i.e. absolutely equal?


title: How to run long time process on Udev event?

text: I want to run a _ppp_ connection when my USB modem is connected, so I use this `udev` rule:               ACTION=="add", SUBSYSTEM=="tty", ATTRS{idVendor}=="16d8",\         RUN+="/usr/local/bin/newPPP.sh $env{DEVNAME}" (My modem appears in `/dev` as `ttyACM0`) **newPPP.sh:**               #!/bin/bash     /usr/bin/pon prov $1 >/dev/null 2>&1 &      ### Problem: The `udev` event fires, and newPPP.sh is running, but `newPPP.sh` process is killed after ~4-5s. `ppp` does not have time to connect (its timeout is 10s for dial up). How can I run a long time process, that will not be killed? I tried using `nohup`, but it didn't work either. System: Arch Linux **Update** I found a solution here, thanks to maxschlepzig. I use `at now` to run my job detached from udev process. But the one question remains unanswered: Why do `nohup` and `&` not work?


title: Samba share file permissions - users can't open files that I create

text: I have set up an Ubuntu server (12.04 LTS) for samba file sharing. The problem I'm having has to do with files that I create on the server. Other users can't open them because I created them under a group that is my username, instead of the group that is allowed to view the share. Why is this? It seems that everything else is working fine. Only allowed users are able to view their share folders but they can't open anything that I create.


title: procmail recipe with a regex doesn't work

text: In my `~/.procmailrc` I have the following lines:               :0     \* ^Subject:.*(O|o)pen( \|)(S|s)(onic|urge)     $MAILDIR/OpenSurge/      As you see, I would like to put any mail containing “Open Surge” (or any variant with space or capital letters) in the folder OpenSurge. But the messages containing this words only went to the default folder. Notice that I have a lot of others recipes with `^From:foo` and when I try `^Subject:.*OpenSurge` my recipe work with “OpenSurge” but I doesn’t work with the regexp `^Subject:.*(O|o)pen( \|)(S|s)(onic|urge)`. So, how can I match please with a regexp all possibilities of writing “Open Surge”?


title: Why does my laptop suspend twice/thrice?

text: The `awesome` WM doesn't suspend automatically when closing the lid, so I followed some instructions to get it working. I simply added a file `/etc/acpi/local/lid.sh.post` with the following contents:               #!/bin/sh     pm-suspend      Suspending works now, but after I open the lid and press the power button it shows the desktop for a fraction of a second before suspending again! The second time I press the power button it resumes properly. After that, any time I suspend I have to press the power button and wait _three_ times before it resumes properly. I've tried suspending four times in a row, and it doesn't seem to get any worse. Solved! If anybody else wants it, I made a script to do this in one command.


title: sed into csv format

text: I have a file of the form               VL-8299673,30.000,49.000,1.000,21.901,2630.000,428861.000     VL-8299673,1071.000,570.000,35.000,3963.608,632.000,366563.000     VL-8299673,36.000,867.000,24.000,6523.005,3544.000,176054.000     VL-8299673,5:281185.000     VL-8299673,44.000,372.000,67.000,7029.358,293.000,446448.000     VL-8299673,5:48479.000     VL-8299673,0:2.000,2:7.000,3:80.222,4:1153.000      it is supposed to be of the form               VL-8299673,1190.000,609.000,28.000,12676.158,1819.000,452813.000      but when there are zeros in the file it only shows the column numbers that are nonzero such as               VL-8299673,0:2.000,2:7.000,3:80.222,4:1153.000      I would like to write a sed command that makes a 7 length row with zeros included such as               VL-8299673,2.000,0,7.000,80.222,1153.000,0      Any ideas?


title: /sbin/init does not exist - Bailing out, you are on your own. Good luck

text: I'm trying to install arch linux. When I boot up, it gives me the message found below.               ERROR: Root device mounted successfully, but /sbin/init does not exist.     Bailing out, you are on your own now. Good luck.          sh: can't access tty: job control turned off     [rootfs /]# _


title: RaspberryPi drops Wifi connection

text: I am using Airlink Fully compatible Wireless N 150 Ultra Mini-USB Adapter (AWLL5099) with my RaspPi to get internet. I am also bridging this WiFi connection with an Ethernet cable to provide internet to my XBox 360. However, the WiFi drops out every 30-45 minutes. I am unsure why this is happening. The following is my /etc/network/interfaces setup:               auto lo     iface lo inet loopback          auto wlan0     iface wlan0 inet dhcp          auto eth0     iface eth0 inet dhcp          auto br0     iface br0 inet dhcp     bridge_ports wlan0 eth0      EDIT: Using hatesnakeslovepython's answer works! My connection no longer drops. I was using bridge_utils previously which is what introduced my problem. Exactly what the problem is I am not sure, but using the iptables setup fixed it.


title: How can a command have more than one output?

text: In this answer, at the very bottom, Gilles mentions that a command can have more than one output or input. Yes, there's `cat foo bar | something`, for having both `foo` and `bar` as inputs, and there's `tee` for outputs; but this doesn't really seem to be what he's talking about. How can a program have more than one input or output?


title: Search for a file inside a tar.gz file without extracting it and copy the result to another folder

text: I need to search for a file inside a `tar.gz` file without extracting it. After that, I need to copy the file that was searched (if ever there is) to another folder. So far I have this, but the copy part of this line gives me an error.               gunzip -c file.tar.gz | tar tvf - | grep filename | -exec cp {} /folder/another_folder \;      Or is there a better way to search for a file inside a `tar.gz` file without extracting it?


title: Web server won't show Drupal install page

text: My web server is showing an Apache 2 test page when it should be showing the Drupal install page. I've set up permissions correctly, so the last thing I've read it could be are the `iptables` firewall rules for port 80. I can't access `php.ini` or `.htaccess` on this machine, so I need a fix that doesn't involve those.


title: Query list of servers for memory/cpu allocated

text: Running RHEL 6.2, trying to write a bash script to SSH to a list of remote servers, and write the CPUs and Total Memory to a file, one line per host in the following format:               HOSTNAME1    CPUS: 12    MEMORY: 64     HOSTNAME2    CPUS: 08    MEMORY: 12      Here is what I have so far, it doesn't work fully, what I'm running in to is the part where the system SSHs to run `cat /proc/cpuinfo` and `free`. The bash script would be called like so: `./query_host_info.sh <DEST> <USER> <FILE>` The file it reads the lists of hosts from is a one-per-line file of hostnames.               #!/bin/bash          # username to connect via ssh     USER=$2     # destination path/filename to save results to     DEST=$3     # source list of hostnames to read from     FILE=$1          # Iterate through line items in FILE and     # execute ssh, if we connected successfully     # run proc/info and free to find memory/cpu alloc     # write it to DEST path/file     # if we dont connect successfully, write the hostname     # and "unable to connect to host" error to DEST path/file     for i in `cat $FILE`; do       echo -n ".";       CHK=`ssh -q -o "BatchMode yes" -o "ConnectTimeout 5" \                 -l $USER $i "echo success"`;       if [ "success" = $CHK ] >/dev/null 2>&1       then         `ssh -q -o "BatchMode yes" -o "ConnectTimeout 5" -l $USER $i "\             printf "$i    ";             echo "`cat /proc/cpuinfo | grep processor | awk '{a++} END {print a}';             free -g | sed -n -e '/^Mem:/s/^[^0-9]*\([0-9]*\) .*/\1/p'`";" >> ${DEST}`;       else         printf "${i}\tUnable to connect to host\n" >> ${DEST};       fi     done     # All line items have been gone through,     # show done, and exit out     echo ""     echo "Done!"     echo "Check the list 'checkssh_failure' for errors."     exit 0


title: Detect if HDMI Monitor is switched off

text: I have a Monitor connected to my machine through HDMI.   Now if anyone were to switch off the Monitor, through either the Soft Buttons on it, or by removing it's Power Cord, I wish to be notified and run a Shell Script. I tried many ways to identify when a monitor is switched on or off (It's always connected). The only technique that comes close is: `# ddccontrol -p` When the external monitor is connected, this returns all kinds of details about the monitor. I could write a script to parse the output for that. However this seems like a unreliable technique for un-supervised usage. Is there any way through which I could obtain a Yes/No answer to whether the Monitor is Switched On/Off? EDIT: It would be preferable if I can get a message on status change. Since this will be running continuously for days, I do not wish to poll for the status of the monitor. Instead in case it is switched off, I would like to be informed through a message.


title: Discrepancy between reported used memory and sum of application memory usage

text: I'm running a desktop system that quite regularly suffers from lack of memory, this prompted me to investigate _what_ causes the issue in the first place. Problem is, there's no single process that eats the memory, yet the system doesn't show it as available. What's more, the system does swap so it looks like the memory pressure is real. What's puzzling, is that the usage goes to normal (~1GB used) after I log out and back again so it looks like some weird interaction between userland and kernel and not a memory leak. In short:   * memory reported as used by `free`, excluding cache/buffers: 3173960 kB   * sum of USS of all applications: 2413952 kB   * SLAB size: 158968 kB   * zram (after compression): 75992 kB That gives, `3173960-2413952-158968-75992 = 525048 kB` unaccounted memory usage. What I'm missing or not counting? * * * Sum of applications memory usage:               # smem -t | sed -n '1p;$p'       PID User     Command                         Swap      USS      PSS      RSS        108 6                                      244524  2413952  2461340  2648488      Memory usage as reported by `free`:               # free -k                  total       used       free     shared    buffers     cached     Mem:       4051956    3449748     602208          0      26548     249240     -/+ buffers/cache:    3173960     877996     Swap:      4051952     242592    3809360      General memory statistic:               # cat /proc/meminfo      MemTotal:        4051956 kB     MemFree:          612260 kB     Buffers:           26636 kB     Cached:           249304 kB     SwapCached:       107892 kB     Active:          1774004 kB     Inactive:         885268 kB     Active(anon):    1712484 kB     Inactive(anon):   710788 kB     Active(file):      61520 kB     Inactive(file):   174480 kB     Unevictable:        9332 kB     Mlocked:            9332 kB     SwapTotal:       4051952 kB     SwapFree:        3809368 kB     Dirty:                40 kB     Writeback:             0 kB     AnonPages:       2343292 kB     Mapped:            95288 kB     Shmem:             36396 kB     Slab:             158968 kB     SReclaimable:      53900 kB     SUnreclaim:       105068 kB     KernelStack:        3528 kB     PageTables:        43600 kB     NFS_Unstable:          0 kB     Bounce:                0 kB     WritebackTmp:          0 kB     CommitLimit:     6077928 kB     Committed_AS:    4013288 kB     VmallocTotal:   34359738367 kB     VmallocUsed:      139852 kB     VmallocChunk:   34359570976 kB     HardwareCorrupted:     0 kB     AnonHugePages:    641024 kB     HugePages_Total:       0     HugePages_Free:        0     HugePages_Rsvd:        0     HugePages_Surp:        0     Hugepagesize:       2048 kB     DirectMap4k:     2310848 kB     DirectMap2M:     1882112 kB      Swaps are on `zram`:               # cat /proc/swaps      Filename                                Type            Size    Used    Priority     /dev/zram0                              partition       2025976 121252  100     /dev/zram1                              partition       2025976 121324  100          # awk ' { print $0 / 1024; sum+=$0 } END { print "sum:" sum/1024 } ' /sys/block/zram*/compr_data_size     37962.4     38030.1     sum:75992.5


title: Problems installing software

text: I am running Ubuntu 12.04 LTS and I would like to install FSLView. I cannot install it through Ubuntu Software Center, and when I try installing the package via the command line with `sudo dpkg -i fslview_4.0.0~beta1-1~nd12.04+1_amd64.deb` I get a simple error: > Errors were encountered while processing: fslview `apt-get upgrade` tells me:               09:58:29 Downloads > sudo apt-get upgrade Reading package lists... Done Building dependency tree        Reading state information... Done You might want to run 'apt-get -f install' to correct these. The following packages have unmet dependencies:  fslview : Depends: neurodebian-popularity-contest but it is not installable                Depends: libqt4-qt3support (>= 4:4.5.3) but it is not installed                Depends: libqtassistantclient4 (>= 4.6.3) but it is not installed                Depends: libqwt5-qt4 but it is not installed                Depends: libvtk5.8-qt4 but it is not installed                Recommends: fslview-doc but it is not installable                Recommends: qt-assistant-compat but it is not installed                E: Unmet dependencies. Try using -f.      What does "is not installable" mean? If I do `apt-get -f install`, FSLView only gets removed. How do I fix this?


title: Comparable editor for gedit with less dependencies?

text: I want to leave Gnome and install awesome on debian squeeze or wheezy, but I really can't work without gedit. Is there any text editor like gedit capable of editing columns, highlighting nearly any language, and building texfiles straight from the editor? The wealth of features is important to me because I want to use it as a central "IDE". I've tried Eclipse, but didn't care for it.


title: Error on building and installing memcached php extension

text: I have problems to run make on the latest memcached PHP extension, on CentOS 6.5:               pecl download memcached          tar zxvf memcached-2.2.0.tgz          cd memcached-2.2.0/          phpize          ./configure --disable-memcached-sasl --with-libmemcached-dir=/usr          make      Then i get the following error: https://gist.github.com/adionditsak/b704ef4328e7f258d7e0


title: Discover clients connected to a network

text: How can you discover who is connected to a wifi network near you? (you not being connected to it). I know that some tools can scan your own network, and that some tools like Wireshark can monitor packages (and you can see the MAC addresses of these packages). But what I want to find is a tool that is command-line based for networks where I don't belong. Is there any simple kismet or nmap command to output this information?


title: How do I know all IP related to the wireless LAN in ubuntu 14.04?

text: How I know all IP on my LAN Wireless using ubuntu 14.04


title: What is a socket?

text: Could someone explain to me what a socket is? I see it in many acronyms in context of SSL, etc. Also, why is it called a socket? Is it purely because it was what a name they invented? Or was it the first name they came up with?


title: How Does X build its modelist?

text: I have an embedded board running Linux 3.0.35 and X.Org 1.14.4. I'm modifying an existing framebuffer driver to support a new connector type. I'm reading the EDID, creating a new modelist using the fb_ functions, and can see the correct mode list in /sys/class/graphics/fb0/modes. However, the X server only seems to pick up these modes at start. If I start X with a monitor connected, it will see the correct mode list and xrandr will allow me to switch modes. However, if I start X without a monitor, after I connect it the framebuffer driver presents the correct modelist but not xrandr. The latter only shows the default mode I set if no monitor is detected. Given the version of kernel and X server I'm using, is there a standard way to notify the X server to reload its mode list? Do most X drivers expect to read the EDID over i2c themselves and generate their own mode list? Or do I need to do something with say a udev rule executed on monitor hotplug to run a script that uses xrandr to clear the mode list and add new ones based on the modes found in the framebuffer driver? Any other suggestions? Thanks.


title: read with history

text: How can I make the builtin `read` command support history, by pressing the up/down key to cycle through them? I've tried catching when you press the up key, however it doesn't seem to work with `read`:               read -p '> ' -n 3 foo     echo     echo -n "$foo" | hexdump      Pressing the arrow keys seems to work and I can detect it using this, however if I press `a``a``↑`, it will fail as it will only read the first character of the identifier of the up-arrow, while the third is needed to distinguish the different arrow keys.


title: xdelta3 fails to decode on block device

text: I'm trying to use `xdelta3` to bring a remote block device into sync with a local one. I'm able to easily generate a `xdelta3` patch file using the command:               xdelta3 -e -B 33554432 -v -9 -I 0 -s /dev/loop5p2 /dev/loop4p2 patch.xd3      However, when I try to decode on the remote system using the following command:                xdelta3 -v -d -B 33554432 -s /dev/sda2 patch.xd3 /dev/sda3      …I get the following error:               xdelta3: non-seekable source in decode: XD3_INTERNAL      As I understand it, this is caused by not having a large enough buffer. However, my `-B` argument is equal to the creator of the patch. In fact, I can double that size and it still won't work.


title: How to use ssh-agent with multiple (valid) keys and yet choose which one to use?

text: Let's say there are two keys `A` and `B`, both of which are valid for `user@host` public key authentication. Since `authorized_keys` is configured for different behaviour depending on the key, `~/.ssh/config` on the client uses something like               Host A.host         HostName host         User user         IdentityFile ~/.ssh/A     Host B.host         HostName host         User user         IdentityFile ~/.ssh/B      That works fine. However, the moment I use `ssh-agent` and add both keys `A` and `B` (e.g. in order to enter their passphrases at login instead of when I call the respective `ssh A.host` or `ssh B.host`), the connection will always use the same id for both virtual hosts. Is there any way to specify _which_ stored key `ssh` should use from `ssh-agent` without having to remove the other key?


title: How to append / extend zshell completions?

text: I am using zsh with oh-my-zsh. Unfortunately, oh-my-zsh does not use file `~/.ssh/config` for hostname auto-completion (see Issue #1009, for instance). This could easily archived by the following code:               [ -r ~/.ssh/config ] && _ssh_config=($(cat ~/.ssh/config | sed -ne 's/Host[=\t ]//p')) || _ssh_config=()     zstyle ':completion:*:hosts' hosts $_ssh_config      However, if I add the above commands to my `~/.zshrc` file, all other sources for hostnames (like `~/.ssh/known_hosts`), which are defined in file `~/.oh- my-zsh/lib/completion.zsh`, are overridden. How can I _append_ new completion rules for `':completion:*:hosts'` in my `~/.zshrc` file?


title: Find holes in an enumeration in awk

text: I have a file that looks like this               1400a_comp      49472                       2868636.1026583919660    GOOD           1400a_comp      49473                       2868647.1026579919650    GOOD           1400a_comp      49474                       2868659.1026575919639    GOOD           1400a_comp      49475                       2868670.1026571919627    GOOD           1400a_comp      49476                       2868682.1026567819614    GOOD           1400a_comp      49477                       2868693.1026563819603    GOOD       I want to search the file for instances where the second field does not increment by one and print the line number


title: Grub 2 os prober for windows 8

text: I try to use dual boot with fedora 20 and windows 8. I install first windows and then fedora. And grub dedectet automatic my windows. So the default `\etc\grub.d\30_os-prober` for windows is this:               case ${BOOT} in chain)          onstr="$(gettext_printf "(on %s)" "${DEVICE}")"     cat << EOF       menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class windows --class os \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' {     EOF       save_default_entry | grub_add_tab       prepare_grub_to_access_device ${DEVICE} | grub_add_tab            case ${LONGNAME} in         Windows\ Vista*|Windows\ 7*|Windows\ Server\ 2008*)         ;;         *)         cat << EOF           drivemap -s (hd0) \${root}         EOF         ;;       esac            cat <<EOF       chainloader +1     }      This create this `menuentry` and this don't boot my windows: **What I try** I create in my `/etc/grub.d/40_custom` manually a `menuentry` which works fine               menuentry "Windows" {       insmod part_gpt       insmod fat       insmod search_fs_uuid       insmod chain       search --fs-uuid --no-floppy --set=root your_UUID       chainloader (${root})/efi/Microsoft/Boot/bootmgfw.efi     }      So I try to adapt this for the `\etc\grub.d\30_os-prober` and add replace the last part with this:               cat <<EOF       search --fs-uuid --no-floppy --set=root $(grub_get_device_id "${DEVICE}")       chainloader (${root})/efi/Microsoft/Boot/bootmgfw.efi     }     EOF      but this create:               menuentry 'Windows Boot Manager' {           chainloader /EFI/Microsoft/Boot/bootmgfw.efi           boot     }      What not work. **My question** How should I change my 30_os-prober that it create my menuetry correct?


title: What does exec 3<&1 do?

text: I understand exec can do I/O Redirection on current shell level. but I only sees usage like               exec 6<&0   # Link file descriptor #6 with stdin.                 # Saves stdin.          exec 6>&1   # Link file descriptor #6 with stdout.                 # Saves stdout.      From that I understand that < is for input stream, > is for output stream. So what does `exec 3<&1` do? PS: I found this from Bats source code


title: Will Fedora's yum update install a "current" or beta version of the kernel and cause problems?

text: Short question is: should we always do a `yum update --exclude=kernel-*` to do an update in Fedora? I was a bit surprised that when I got a new Fedora machine at work (it used to be Red Hat Enterprise Linux (RHEL)), the first time it started up, it asked me to do an update, and I naturally said yes, and for anything it asked, I just used the default answer (usually replying "yes" by pressing ENTER). But it turned out that the kernel was somehow corrupted, having 3.6.9 and 3.6.10 components, and the machine would not boot up (would cause kernel panic), and had to use the second option to boot up in the boot menu. (the IT department told me it is the "last problem-free version", like a checkpoint version). But even that, the machine was very slow and my coworker told me later on that my kernel was running partly on earlier version and partly running with 3.6.9 or 3.6.10 components and they might not be totally compatible and that's probably why it was so slow. My coworker knew about Fedora for quite a while, and he was able to fix it by doing a series of `yum remove` and `yum downgrade`, and making the kernel and header and component all back to an earlier version (I think it was 3.3.4 but I will have to go back to work and check). So is it true that for Fedora, we always have to abort the default update request, and do a               yum update --exclude=kernel-*      to be safe that we won't get a kernel that is not yet stable or still in beta? This is somewhat counter-intuitive to me, as I know other update systems would usually use only the stable version, unless the user specifically types in a particular version which might be a beta version. Is there actually a way to update only the stable components, or do we need to use `yum update --exclude=kernel-*` all the time to be safe? (this was a bit surprising to me, as anybody at work using Fedora can be affected by this, and it could be hundred or even thousands of people, so what is a more correct way of doing the system updates?)


title: closing unused gnome terminals

text: while working I start lots of gnome-terminals and do something with them. `dd` on first terminal, 12 ssh sessions to a bunch of servers to do something. These sessions are finishing it's job and get disconnected for idle or because the session is closed after the command. However, I need a script which closes unused gnome-terminal processes. I thought about softly killing all zsh processes without child processes. This will hopefully close the terminal in a clean way.               init─┬─[...]          ├─gnome-terminal─┬─gnome-pty-helpe          │                ├─2*[zsh───ssh]          │                ├─zsh───dd          │                ├─zsh───pstree          │                ├─4*[zsh]                 <<<<          │                └─{gnome-terminal}          .          .          .      I thinking about writing a more or less simple bash script to check the running processes and end them if zsh has no child processes and no activity for 4 hours. I am unsure   * If this is a good idea generally.   * If somebody already published a tool to do this   * If there is a way to get the child processes of zsh (without `grep`ing and `awk`ing the `pstree` output ;)   * How I get the last activity (thought about a pre and post command in zsh)   * If there is a better way than `kill -HUP <zsh pid>` to end the processes Thanks in advance


title: Why is my hostname different in Emacs?

text: So I changed the name of my computer recently, by editing `/etc/hostname`. The bash prompt is `user@name`, so I know it has worked. But in emacs, in the window bar it says `emacs@name.tiscali.co.uk`. Tiscali is my internet provider. Before I changed it, emacs just had `emacs@oldname` in the window bar. How can I remove my IP's name from the window bar in emacs?


title: What would cause ps to report uid instead of username?

text: I have Eucalyptus installed on my Linux machine, and I've noticed that for processes owned by the eucalyptus user, **ps** reports the userid instead of the username. For example:               $ sudo -i -u eucalyptus     $ ps u     USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND     107      29764  0.0  0.0  19376  2104 pts/2    S    11:43   0:00 -bash     107      30198  0.0  0.0  15256  1180 pts/2    R+   11:44   0:00 ps u      What would cause this to happen? Note that there's a proper entry in /etc/passwd:               $ grep eucalyptus /etc/passwd     eucalyptus:x:107:115::/var/lib/eucalyptus:/bin/bash      Also note that **ls** property reports the ownership of files by the eucalyptus account:               $ touch foo     $ ls -l foo     -rw-r--r-- 1 eucalyptus eucalyptus 0 2010-09-23 11:47 foo


title: batch tool for sending files over webdav

text: I know there is cadaver for working with webdav. But it opens an interactive console. I want to write a script that will send files over webdav protocol in a batch mode. What tool can I use?