title: Lost mouse pointer in XServer

text: Have tried many windows managers including TWM, xfce and Gnome, but my mouse pointer is gone. It is invisible, but it performs all the actions. If I do the right click the context menu opens and this is how I can tell what the current location of the pointer is. This is a newest stable built of Debian. How can I restore the mouse pointer? The output from lsmod is included below. Links to Xserver logs and dmesg output. Can anybody help? UPDATE: It does indeed work well with the 2.6.38 kernel. lsmod:               Module                  Size  Used by     nls_utf8                 908  1      nls_cp437               4489  1      vfat                    6570  1      fat                    34912  1 vfat     usbhid                 28008  0      hid                    50909  1 usbhid     cpufreq_conservative     4018  0      cpufreq_userspace       1480  0      cpufreq_powersave        602  0      cpufreq_stats           1940  0      ppdev                   4058  0      lp                      5570  0      sco                     5857  2      bridge                 33019  0      stp                      996  1 bridge     bnep                    7444  2      rfcomm                 25175  0      l2cap                  21709  4 bnep,rfcomm     bluetooth              36319  6 sco,bnep,rfcomm,l2cap     binfmt_misc             4907  1      fuse                   44256  1      ext4                  257803  1      jbd2                   56155  1 ext4     crc16                   1027  2 l2cap,ext4     loop                    9765  0      firewire_sbp2           9647  0      snd_intel8x0           19595  0      snd_ac97_codec         79148  1 snd_intel8x0     arc4                     974  4      ecb                     1405  4      ac97_bus                 710  1 snd_ac97_codec     rt2500pci              11303  0      snd_pcm_oss            28671  0      rt2x00pci               3773  1 rt2500pci     snd_mixer_oss          10461  1 snd_pcm_oss     ath5k                 104074  0      rt2x00lib              19101  2 rt2500pci,rt2x00pci     ath                     6014  1 ath5k     snd_pcm                47226  3 snd_intel8x0,snd_ac97_codec,snd_pcm_oss     i915                  223024  2      mac80211              123570  3 rt2x00pci,ath5k,rt2x00lib     snd_seq_midi            3576  0      cfg80211               87657  4 ath5k,rt2x00lib,ath,mac80211     snd_rawmidi            12513  1 snd_seq_midi     drm_kms_helper         18309  1 i915     snd_seq_midi_event      3684  1 snd_seq_midi     rfkill                 10264  3 bluetooth,cfg80211     eeprom_93cx6             963  1 rt2500pci     drm                   112088  3 i915,drm_kms_helper     snd_seq                35463  2 snd_seq_midi,snd_seq_midi_event     pcmcia                 16194  0      snd_timer              12258  2 snd_pcm,snd_seq     i2c_algo_bit            3497  1 i915     snd_seq_device          3673  3 snd_seq_midi,snd_rawmidi,snd_seq     yenta_socket           16403  3      rsrc_nonstatic          7057  1 yenta_socket     asus_laptop            11090  0      pcmcia_core            20450  3 pcmcia,yenta_socket,rsrc_nonstatic     i2c_i801                6462  0      parport_pc             15799  1      joydev                  6739  0      led_class               1757  3 ath5k,rt2x00lib,asus_laptop     parport                22554  3 ppdev,lp,parport_pc     i2c_core               12787  5 i915,drm_kms_helper,drm,i2c_algo_bit,i2c_i801     snd                    34375  9 snd_intel8x0,snd_ac97_codec,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_rawmidi,snd_seq,snd_timer,snd_seq_device     shpchp                 21220  0      evdev                   5609  13      video                  14605  1 i915     battery                 3782  0      processor              26327  1      button                  3598  1 i915     ac                      1640  0      rng_core                2178  0      output                  1204  1 video     pcspkr                  1207  0      soundcore               3450  1 snd     snd_page_alloc          5045  2 snd_intel8x0,snd_pcm     psmouse                44809  0      serio_raw               2916  0      pci_hotplug            18065  1 shpchp     ext3                   94204  1      jbd                    32169  1 ext3     mbcache                 3762  2 ext4,ext3     usb_storage            30833  1      sd_mod                 26005  6      crc_t10dif              1012  1 sd_mod     8139too                14949  0      ata_generic             2067  0      ata_piix               17736  3      uhci_hcd               16057  0      firewire_ohci          16725  0      thermal                 9206  0      8139cp                 13421  0      libata                115753  2 ata_generic,ata_piix     ehci_hcd               28681  0      firewire_core          31243  2 firewire_sbp2,firewire_ohci     crc_itu_t               1035  1 firewire_core     thermal_sys             9378  3 video,processor,thermal     mii                     2714  2 8139too,8139cp     usbcore                98733  5 usbhid,usb_storage,uhci_hcd,ehci_hcd     nls_base                4541  5 nls_utf8,nls_cp437,vfat,fat,usbcore     scsi_mod              101429  4 firewire_sbp2,usb_storage,sd_mod,libata


title: Tool to remove all non-package files on a system

text: If you want to keep for example a build or server system clean, it is very useful to be able to **check that all files are present and accounted for** by the package metadata. At work we have a very nice tool which, if run without any parameters, simply creates a file with `rm`/`rmdir` statements for any and all files/directories not mentioned by any package (excluding some trees like `/home`). This is _different_ from `rpm -V` and `debsums`, which only check the files already mentioned by a package. Is there a tool like this for DEB/RPM/Ports/other packaging systems? DEB would be the best, but porting from another system (or our own, if nothing else exists) would probably be feasible. PS: I am _not_ looking for alternative architectures. The issue here is to have absolutely every file on the system accounted for. VMs and such are not applicable.


title: BC - output normal form?

text: I have a big number:                 2923174917395723957      that would be:                 2,923*10^18      are there any parameters in bc that will give this OUTPUT?   e.g.:                 $ echo '2923174917395723956 + 1' | bc     2,923*10^18     $       Or something similar...the point is that it must have a short look   Thank you!


title: "Permission denied" when writing to /dev/stdout

text: Why cannot I write to `/dev/stdout`? I am logged in as the root user, what greater permission could I have?               root@ubuntu:/# tcpdump -i 2 -w /dev/stdout     tcpdump: /dev/stdout: Permission denied      The above command with `-w /dev/null` works. I am using stock Ubuntu Linux. Now, `stdout` redirects to `proc` which redirects to `/dev/pts`, which is a char dev and has `w` permission -- what else is there?               crw-rw-rw- 1 root root 1, 3 2013-08-26 00:29 /dev/null     lrwxrwxrwx 1 root root   15 2013-08-26 00:29 /dev/stdout -> /proc/self/fd/1     lrwx------ 1 root root   64 2013-08-26 10:10 /proc/self/fd/1 -> /dev/pts/0     crw--w---- 1 xxx  tty  136, 0 2013-08-26 10:11 /dev/pts/0     root@ubuntu:/# tcpdump -i 2 -w /dev/pts/0     tcpdump: /dev/pts/0: Permission denied


title: Define specific TTL for each interfaces

text: After some research, I was wondering if it was possible to define a TTL by interface as I can the Hop Limit definition in ipv6. To change the TTL in IPv4, I can change the file                /proc/sys/net/ipv4/ip_default_ttl       But this changes TTL for all interfaces. However in IPv6, you can put a different hop limit value for each interfaces               /proc/sys/net/ipv6/conf/eth*/hop_limit      So do I miss something? or there is no way to configure a different TTL for each interface ?


title: Which tool you use to mount a floppy usb with a tiling wm

text: I use a tiling wm without an desktop environment. So no notification when I plug in a usb stick for example. At the moment personally I use the mount and umount command line, but maybe you have most interesting usage. Do you use a file manager like pcmanfm or nautilus, but that trouble me to use it only for that. Or maybe you have a tool which automatically mounts the media when it is plugged. How do you usually manage this case.


title: New users cannot connect to server via SSH

text: An SSH server using RSA keys for authentication is running on Ubuntu 14.04. My original account can connect to the server using SSH (PuTTY). However, the following issue occurs:               Disconnected: No Supported authentication methods available (server sent: publickey)      if additional users are trying to authenticate, while these have been added to the `/etc/ssh/sshd_config` file as authorized users. Pageant runs on my machine so I am not sure what is going on. The private key is there. What am I missing?


title: How to use rsync to backup a directory without git subdirectory

text: I want to copy my `c` directory with all subdirectories excluding `./git` subdirectory. I do it using `rsync` :               echo "copy c and sh files "     rsync -a --include='*.c' --include='*.sh' --include='*/' --exclude='*' ~/c/ ~/Dropbox/Public/c     # remove .git directory = do not send it to dropbox. Thx to Tomasz Sowa     rm -rf ~/Dropbox/Public/c/.git      Can I do it better?


title: Is it possible to control xterm (or specifically a process that xterm has started) from another process?

text: If I start a process with xterm like this (where omxplayer is the process xterm is starting):               xterm -fullscreen -fg black -bg black -e omxplayer -o hdmi -r %f      Is it possible for me to write to xterm's standard input via a different process to control the omxplayer? If so, how? (I'm pretty unfamiliar with linux terminology so please excuse if I'm stating this incorrectly.) **Update** As per @strugee's comment, I'm not aiming to write to xterm's standard input, but rather I'm aiming to write to omxplayer's standard input.


title: Outputting sound from different monitors to different audio devices

text: I have got my computer set up in my living room on a desk with the TV 1 metre away. I want to be able to use my TV to watch videos from my computer. I am using Chakra Linux, I use the NVIDIA binary drivers and KDE 4.11.2. I'd like to have both screens attached to my computer at all times. I want to be able to drag windows to the corners of each screen to use the automatic resize option and I want to have applications on each screen output to different audio devices. I have attempted to use different X-server sessions for each screen, which has opened up a can of worms. Any suggestions how to proceed?


title: How to save brightness and Bluetooth configuration?

text: I am using the latest version of Elementary OS on my Lenovo u410, and every time I boot it, my Bluetooth is turned on, and my brightness is set to 100%. I know that elementary OS is a WIP, but is there any method/hack that I can use to keep my Bluetooth off, and my brightness not on 100%?


title: kvm killed by oomkiller

text: kvm version: `QEMU emulator version 1.1.2 (qemu-kvm-1.1.2+dfsg-6+deb7u3, Debian), Copyright (c) 2003-2008 Fabrice Bellard`   libvirtd version: `libvirtd (libvirt) 0.9.12.3`   debian version: `7.5` I'm running multiple VMs on a 16GB RAM machine, all together they use ~9GB RAM. Every now and then the linux oom killer comes over and kills a process. I guess it chooses the process using most of the memory - in this case a 6GB Windows VM:   `[431215.778365] Out of memory: Kill process 25086 (kvm) score 192 or sacrifice child` IMHO the machine shouldn't be in an OOM Situation as there are ~6.6GB cached memory available. You can see the memory distribution and the resulting oom kill here: ![memory distribution](http://i.stack.imgur.com/mvqJk.png) I now have set the `oom_adj` for the pid of the kvms to `-17`, so the oom- killer won't kill this process. But I'm still failing to understand why the kernel thinks it has to kill a process and won't go ahead and free some cached memory.   * Can anyone explain why this happens?   * Can you tell me how I can prevent the oom killer from killing my kvm processes without knowing the PID?


title: find greatest last-modified files of /dirA/file, /dirB/file

text: Suppose we have two directories, dirA, dirB, which the exact same PDF files, just different last modified. What is a bash script (no awk) that can search through each file name (assume always in both dirA, dirB) and for each filename, outputs which of the files (dirA/file or dirB/file) has the greater last-modified; file-modified-last? e.g.               if dirA/file.lastmodified > dirB/file.lastmodified      ##take action


title: If Statement with 2 Variables - Bash

text: I am trying to write a single IF statement which can check two variables at once. I have two variables, for example: $VARA $VARB Both with either contain a 0 or a non 0 value. I need an if statement which can check both and if either are not equal to 0, if will perform an action, if both are 0 if will perform a different action. With a single variable, I can do this:               if [ $VARA -ne 0 ]     then echo 'The operation failed! VARA is not equal to 0'     else echo 'The operation suceeded! VARA is equal to 0'     fi      However, I am not sure how to check both VARA and VARB at the same time. Thank you.


title: vmstat on virtual machine and large values

text: Hi I'm using `vmstat` to track machine performance during some tests (`jmeter`). This is virtual machine running on a big machine where lots of other virtual machines are installed (about 20 virtual machines). I'm using the following software versions:               $ vmstat -V     procps version 3.2.7            $ uname -a      Linux cmbpm 2.6.32-042stab044.11 #1 SMP Wed Dec 14 16:02:00 MSK 2011 x86_64 x86_64 x86_64 GNU/Linux      The problem is with results I get, here is a sample (I've converted spaces to single tabs for easier data processing):               procs   -----------memory---------- ---swap-- -----io---- --system-- -----cpu------      r  b   swpd    free    buff    cache   si  so  bi  bo  in  cs  us  sy  id  wa  st      0  0   1506720 6152768 0   824836  1   0   3   2   0   0   0   0   94  6   0      0  0   1506720 6170744 0   804392  60  64  14  16  0   122651  0   0   98  2   0      0  1   1506720 6168328 0   801744  145 8   300 52  0   117308  0   0   0   100 0      0  0   1505688 6173360 0   806852  233 13  1135    478 0   109158  1   0   387 1171860851  0      0  0   1505172 6168988 0   810140  380 0   0   513 0   117875  0   0   97  3   0      Problem is that some values are much bigger then they should be. Percentage values of CPU time (`\-----cpu------` section) sometimes greatly exceed 100%. Especially column `wa` (waiting for data) is problematic (value 1171860851 is extremely strange). Replacing those huge values with zero give reasonable results. My question is why does it give incorrect values and can it be fixed somehow?   I suspect that virtualization of the machine is a problem here.


title: Good method to compare time?

text: I need to check for the current time and abort the script if it is not proper time of day I am supposed to run it. Also, if anyone else runs it, it should abort. For example: I need my script to only run if it is started between 10 PM and and 2 AM (a 4 hour window). Currently I am doing the following. Taking the time with `date +%k%M` and comparing with hard coded numbers               #!/bin/sh     currTime=`date +%k%M`     check_time_to_run()     {         tempTime=$1         if [ $tempTime -gt 200 -a $tempTime -lt 2200 ]; then              echo "Time is between 2 AM and 10 PM. Aborting."             exit 1         else             echo "Time is after 10 PM and before 2 AM. Running normally."         fi     }          check_time_to_run $currentTime      I would like to know if there is any other efficient method with respect to time comparision in `sh` or `bash` ?


title: Execute John the Ripper on multiple processors using mpirun

text: I am a linux noob trying to optimize John the Ripper for a security class. I am trying to use both processors to run John by using the `mpirun` program as suggested in this tutorial. I installed `mpirun`, but when I run this command, I get the following error:               # sudo mpirun -np2 /usr/share/john --test=10      /usr/bin/mpirun: 1: eval: usr/share/john: Permission denied.      Why am I getting this error and how can I run John with two processors using `mpirun`? I am running Ubuntu 12.10 on a VMware Fusion machine on a Mac with an Intel Core i5


title: How to forget/remove Mobile Broadband connection settings from Mint 14

text: I've been using Ubuntu for a while now and wanted to switch to Mint. I connected my mobile broadband dongle (Vodafone) for the first time like in Ubuntu it all went fine but subsequent connections were denied. I tried connecting with other network dongles and they could connect me to the Internet. My main dongle with the most stable internet connection is Vodafone. How can I remove or forget the setting and do it as fresh again? If anyone has better options as well, I am willing to try it.


title: bzip2 -c versus -z

text: Wanted to check for understanding; while revisiting the topic of using dd over netcat I experimented with compressing the data with bzip2. In the man page, there's `-c` (compress or decompress to standard output) and there's `-z` (complement to `-d`: forces compression, regardless of the invocation name) Is `-c` simply a way to force the output to standard output, and using bzip2 at invocation implying you want to compress data if you don't use `-d`?


title: Security with Kernel IP Forwarding Enabled

text: I recently enabled IP Forwarding on a production web server that also acts as a VPN server. What, if any, security issues did I just set myself up for? And are there any iptables rules I should set up to limit forwarding to my VPN tunnel?


title: How to run my own program without specifying its path

text: Let's suppose I have compiled something and I run it like so:               $ /path/to/my/executable/mycmd     Hello World      What do I need to do to run it like               $ mycmd     Hello World       from everywhere in my computer?


title: Prevent unwanted buffers from opening

text: I'm using emacs for my daily javascript editing, to switch between buffers I use C-x LEFT and C-x RIGHT and I'm fine with this (even if I find it difficult to know the path of the file I'm modifying). My problems:   1. at the startup I always have `*scratch*` and `*Messages*` opened, I thought that putting `(kill-buffer "*scratch*")` in my .emacs would solve the issue, but it's not, do you have a suggestion?    2. when I open files I always do TAB autocomplete, so each time I'm creating a new `*Messages*` buffer containing the options for the completion, how do I prevent this from creating, or better, how do I make emacs kill it, after I've made my choice? Do say your opinion if you think I'm doing something that's not "the way it should be" with me navigating as I said at the top.


title: Cleanly swap all occurences of two strings using sed

text: Suppose I have a file that contains multiple occurrences of both StringA and StringB. I want to replace all occurrences of StringA with StringB, and (simultaneously) all occurrences of StringB with StringA. Right now, I'm doing something like               cat file.txt | sed 's/StringB/StringC/g' | sed 's/StringA/StringB/g' | sed 's/StringC/StringA/g'      The problem with this approach is that it assumes StringC doesn't occur in the file. While this isn't an issue in practice, this solution still feels dirty -- that is, it feels like an opportunity to learn more unix magic. :)


title: BEGIN and END with the awk command

text: According to the awk manual, BEGIN and END are not used to match input, but rather to provide start-up and clean-up information to the awk script. Here is the example given:               ls -l | \     awk 'BEGIN { print "Files found:\n" } /\<[a|x].*\.conf$/ { print $9 }'     Files found:     amd.conf     antivir.conf     xcdroast.conf     xinetd.conf      First this prints a string to output. Then it checks input for a pattern match, where the input starts with a or x followed by any character one or many times followed by the .conf. For any matches, the 9th column is printed. The fact that we are forced to use begin here, does that mean awk can only use at most one print function that does contain a BEGIN or END? If not, then why can't we just use the print function at the beginning without the keyword BEGIN? It seems the BEGIN is superfluous.


title: vcenter server on Linux?

text: I am working with VMware and preparing a vcenter server on a Windows server. I would like to know, how good is vcenter in linux - has anyone tried it? I would like to work with Ubuntu server, unless what someone suggests a better option.


title: Installing from source. How to resolve dependencies without destroying the package manager

text: I don't consider myself a total noob, but compiling and installing software is a pain and problem I cannot overcome. I just want to run down through my understanding of this process with someone more knowledgeable to clear my mind to get to the next level. Many scientific software I need are not distributed as packages. I understand "./configure" sets up the compilation variables and checking for dependencies "make" does the compilation "sudo make install" puts all the libraries and bins in their places. However it never works. I rarely get out of the a) "./configure" stage without entering dependency hell, and if I do, b) "sudo make install" will probably nuke my box. a) The dependency hell is very frustrating. Sometimes I have the library, but it doesn't like it. Or the library doesn't want to install. Or "configure" can't find it. Or my distro placed it somewhere it shouldn't be. Or there are two versions in my system. Problem is, I can't understand how to diagnose and therefore fix these problems. What are some good references to learn for someone who doesn't need to become a programmer? b) My understanding is "make install" will replace some libraries and change settings without my package manager being aware of this. Therefore, some programs won't run, others can't be updated. So, if I don't use "make install", and just keep the compiled binary in my user directory with a symbolic link added to the PATH, will I be in the clear? Finally, some philosophical positions. I love free (as in beer and freedom) software, but in my line of work I can't afford to be dogmatic about it - I need the program to install. Also, my box is single user, has tons of free HD so I don't really care about having multiple (dozens) of copies of libraries if that will solve my problems. Space is cheap. I appreciate your help and patience. G


title: Opendns setup failed. How to fix it?

text: I have problems trying to configure OpenDNS. I have contacted OpenDNS support but they did not answer. I cannot access websites like Twitter and Facebook. ![another example](http://i.stack.imgur.com/5NbBf.png) ![Twitter cannot be accessed.](http://i.stack.imgur.com/dbu37.png) I tried welcome.opendns.com (did not work, shows not using OpenDNS. ![OpenDNS not using.](http://i.stack.imgur.com/h7ggx.png) Using nslookup:                $ nslookup -type=txt which.opendns.com. 208.67.222.222     Server:     208.67.222.222     Address:    208.67.222.222#53          Non-authoritative answer:     which.opendns.com   text = "7.sin"          Authoritative answers can be found from:          $ nslookup -type=txt debug.opendns.com.     Server:     127.0.1.1     Address:    127.0.1.1#53          Non-authoritative answer:     debug.opendns.com   text = "server 3.sin"     debug.opendns.com   text = "flags 20 0 2f6 0"     debug.opendns.com   text = "id 13521181"     debug.opendns.com   text = "source 222.164.129.44:62574"          Authoritative answers can be found from:          $ nslookup www.exampleadultsite.com.     Server:     127.0.1.1     Address:    127.0.1.1#53          Non-authoritative answer:     Name:   www.exampleadultsite.com     Address: 67.215.92.210


title: scp current folder to destination folder name as ddmmyy

text: I want to add a cron job that scp a folder to a server with on the server the folder name is in another folder whose folder name is a timestamp like ddmmyy something like               scp -r <foldername> user@server:path/to/destination/ddmmyyhhmmss      ddmmyyhhmmss: date month year hour min sec


title: Debian Wheezy : problem installing .deb package that uses update-rc.d with dependancy numbers

text: I'm trying to install a .deb file, written by us, on a new Debian Wheezy system. The .deb file was originally written for Lenny so is fairly old. I've tracked down one point where the installation if failing by trying to install the package with dpkg -debug=3773 : it's trying to add some services using update-rc.d:               update-rc.d r-initialize-config start 12 2 .      This gives the error:               update-rc.d: using dependency based boot sequencing     insserv: Service r-interfaces has to be enabled to start service first-boot     insserv: exiting now!     update-rc.d: error: insserv rejected the script header      The script contains this as the header comments (this is the LSB header?)               ### BEGIN INIT INFO     # Provides: first-boot     # Required-Start: $local_fs r-interfaces     # Required-Stop:     # Default-Start: 2     # Default-Stop:     # Short-Description:     ### END INIT INFO      and the r-interfaces script is present and seems to run correctly. What is the requirements of programs started by the "Required-Start:" attribute? E.g. I changed r-interfaces to "ls" and got the same problem. r-interfaces is a transient script and does not run as a daemon, so maybe that's the problem. What does Required-Start: need?


title: Should I use symlinks in /usr/bin or use the PATH variable instead?

text: I was looking to download some tool and it said to update your PATH variable, but I thought `/usr/bin` was the "standard".


title: How to log iptables as of kernel 3.9.0?

text: What is the right way to log iptables as of kernel 3.9.0? I can no longer append a logging rule such as:               # iptables --new-chain droplog     # iptables --append droplog --jump LOG --log-level info     iptables: No chain/target/match by that name.      I used to enable IP tables logging support by checking this out:               IP: Netfilter Configuration  --->      <*> IP tables support (required for filtering/masq/NAT)         <*> LOG target support      But this option is missing from kernel 3.9.0, and seems to have been replaced by `CONFIG_NETFILTER_NETLINK_LOG`.


title: Allow user to see how many iptables rules are loaded, but not actual contents?

text: I want to allow user to check how many rules are present in filter table, but not able to view actual rules, is that possible? literally I mean `iptables -L | wc -l` (I know it's faulty), but sudo doesn't seem to support pipe commands like that, I mean, currently If I wanted to allow that, I need to grant permission to run `iptables -L` instead of `iptables -L | wc -l` Any thoughts?


title: Does yum update uninstall and install the dependencies?

text: If the dependencies of the two different versions of RPM are same, would yum update remove and install dependencies too?


title: Why I can't ping anymore?

text: In my Ubuntu 14.04 I have two ethernet interface. Eth0 is connected to main internet using DHCP auto and eth1 is to share with other PC's.               $ cat /etc/network/interfaces     auto lo     iface lo inet loopback     auto eth0     iface eth0 inet dhcp          auto eth1     iface eth1 inet static       address 10.0.0.1       netmask 255.255.255.0       #network 192.168.0.0       gateway 10.0.0.1       #broadcast 192.168.1.1       #dns-nameservers 192          $ ip addr     1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default          link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00         inet 127.0.0.1/8 scope host lo            valid_lft forever preferred_lft forever         inet6 ::1/128 scope host             valid_lft forever preferred_lft forever     2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000         link/ether 74:d4:35:e5:fb:03 brd ff:ff:ff:ff:ff:ff         inet 192.168.1.13/24 brd 192.168.1.255 scope global eth0            valid_lft forever preferred_lft forever         inet6 fe80::76d4:35ff:fee5:fb03/64 scope link             valid_lft forever preferred_lft forever     3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000         link/ether 74:d4:35:e5:fb:01 brd ff:ff:ff:ff:ff:ff         inet 10.0.0.1/24 brd 10.0.0.255 scope global eth1            valid_lft forever preferred_lft forever         inet6 fe80::76d4:35ff:fee5:fb01/64 scope link             valid_lft forever preferred_lft forever     4: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000         link/ether 80:86:f2:5f:85:d4 brd ff:ff:ff:ff:ff:ff          $ echo 1 > /proc/sys/net/ipv4/ip_forward     $ ping 10.0.0.2     PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.     From 10.0.0.1 icmp_seq=1 Destination Host Unreachable     ^C     --- 10.0.0.2 ping statistics ---     5 packets transmitted, 0 received, +1 errors, 100% packet loss, time 3999ms     pipe 4               $ sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE     $ sudo iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT     $ sudo iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT     $ ping 10.0.0.2     PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.     From 10.0.0.1 icmp_seq=1 Destination Host Unreachable     From 10.0.0.1 icmp_seq=2 Destination Host Unreachable     From 10.0.0.1 icmp_seq=3 Destination Host Unreachable     ^C     --- 10.0.0.2 ping statistics ---     5 packets transmitted, 0 received, +3 errors, 100% packet loss, time 3999ms     pipe 4      Now eth0 is internet and eth1 is up. I have Windows 7 connected on eth1 with IP 10.0.0.2 but Windows 7 can't ping to 10.0.0.1 and Ubuntu also can't ping 10.0. 0.2 What is wrong, how can I fix it?


title: How to configure dhcpd to register ipv4 with bind while having static ipv6 addresses?

text: I have IPv6 configured on my local network via `radvd`; it advertises a routable IPv6 block, that all the machines auto-configure.s I have IPv4 assigned to a NAT'd block via dhcpd and that updates named. My problem is that when I set the AAAA record for a host for it's IPv6 address (which doesn't change), named will then start rejecting name updates from dhcpd for the A record. named reports the following error:               'name not in use' prerequisite not satisfied (YXDOMAIN)      dhcpd will report the following error:               Has an A record but no DHCID, not mine      How can I either convince dhcpd to ignore the `AAAA` record when doing the named update.


title: AWK - how to reduce the greed of a regular expression?

text: I have an example:               echo "@article{gjn2010jucs, Author =   {Grzegorz J. Nalepa}, " | awk '{ sub(/@.*,/,""); print }'      Is it possible to write a regular expression that selects the shorter pattern?               @article{gjn2010jucs,      Instead of a long pattern?:               @article{gjn2010jucs, Author =   {Grzegorz J. Nalepa},      I want to get this result:               Author =   {Grzegorz J. Nalepa},      **EDIT:** I have another example:               echo ",article{gjn2010jucs, Author =   {Grzegorz J. Nalepa}, " | awk '{ sub(/,[^,]*,/,""); print }'      Is it possible to write a regular expression that selects the shorter pattern?               , Author =   {Grzegorz J. Nalepa},      Instead of a long pattern?:               ,article{gjn2010jucs, Author =   {Grzegorz J. Nalepa},      I want to get this result:               ,article{gjn2010jucs


title: How to confirm/verify WiFi is WPA2?

text: How do I, from the command line, confirm _on the host_ that the wireless network connection uses WPA2? The wireless router is set to use `WPA2 Personal` (WPA2 with a pre-shared key) and AES on the network, and I have added `wpa-ssid`, `wpa-psk` and `wpa-proto RSN` to /etc/network/interfaces, but iwconfig prints `Encryption key:off`. I am running Debian Wheezy/7.0. I checked the system logs but saw nothing of relevance, and the only current wpa_supplicant.conf on my system is one for D-Bus.


title: Login fails from Windows on NTFS-3G Samba Share

text: I have a Raspberry Pi (though could be any Debian Linux box) connected to an external hard disk formatted as NTFS. My disk mount in `fstab` is:               /dev/sda1 /media/disk  ntfs-3g  defaults,uid=1000,gid-1000,dmask=007,fmask=007  0  0      where user 1000 is the 'pi' user /media/disk/shared is my Samba root folder. Must be accessible from Windows and Mac Now, I can see the share in Windows, but I get permission denied. If I try mapping a drive to it, and attempt login using \machinename\pi the login fails. Any ideas? Edit-- smb.conf below. I've removed all comment lines (I assume lines beginning # or ; are comments)               [global]             workgroup = WORKGROUP        server string = %h server        dns proxy = no        log file = /var/log/samba/log.%m        max log size = 1000        syslog = 0        panic action = /usr/share/samba/panic-action %d        encrypt passwords = true        passdb backend = tdbsam        obey pam restrictions = yes        unix password sync = yes        passwd program = /usr/bin/passwd %u        passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .        pam password change = yes        map to guest = bad user             usershare allow guests = yes          [shared]        comment = Ali and Greg Shared Folders        writeable = yes        public = yes        browseable = yes        path = /media/disk/shared        guest only = yes        guest ok = yes             read only = no             create mask = 0777        directory mask = 0777          [printers]        comment = All Printers        browseable = no        path = /var/spool/samba        printable = yes        guest ok = no        read only = yes        create mask = 0700          [print$]        comment = Printer Drivers        path = /var/lib/samba/printers        browseable = yes        read only = yes        guest ok = no          [hdd]        comment = Samba server's HDD        read only = no        locking = no        path = /media/disk/shared        guest ok = yes


title: Whoami: cannot find name for user id 0

text: When I run `whoami` it says: > whoami: cannot find name for user id 0 My `/etc/passwd` file looks like this:               root::0:0:root:/root:/bin/bash


title: Outputting last modification date to another file?

text: I'm trying to read the number of lines in a file, and the last modification date of that file (e.g. if it was last modified Jan 18, 2013, it should output `2013-01-18`), then append the data to the given input file in the form `theFile: 4 lines, modified on 2013-01-18`. I tried to store both pieces of data in their own variables before outputting with echo.               #!/bin/sh     totLines=$(wc -l < $1)     modDate=$(date -r $1)     echo $1: $totLines "lines, modified on" $modDate >> $1      Is my method of finding the last modification date correct? I was told that it is, but I can't figure out why, since I can't find any information on what `date -r` does and I can't get it working in any script I try out. There's also using stat, but I can't get that working either with `stat -c %y $1` where I get `stat: illegal option -- c`


title: Should scripts that require sudo fail if they don't have it, or use sudo and prompt?

text: I have a script which gives me fine-grained control over my backlight brightness and requires `sudo` to run. It's essentially this:               backlight="/sys/class/backlight/acpi_video0/brightness"     echo $1 | tee $backlight      and lives at `~/bin/backlight-adjust`. The script needs `sudo` privileges, because `tee $backlight` is writing to a privileged location. So it'll fail if it's not run with `sudo`. This approach has a problem, because I can't just run `sudo backlight-adjust`, because `~/bin` is not in the `$PATH` in the `sudo` environment, only in my environment. So I'd have to to run `sudo env "PATH=$PATH" backlight-adjust` or something similar. Alternatively, I could have written it like this:               backlight="/sys/class/backlight/acpi_video0/brightness"     echo $1 | sudo tee $backlight      and prompt me for the password. The second approach works better for me because I don't have to remember to type sudo; it'll prompt me. And I can keep my `$PATH` intact. This feels more convenient overall, but **are there any reasons why I shouldn't do it the second way?** (I'm running Xubuntu 14.04 and my shell is GNU bash 4.2.45, if that makes a difference.)


title: Pernicious USB-stick stall problem. Reverting workaround fix?

text: There's an issue with Ubuntu that hasn't been fixed yet, where the PC freezes or gets really slow whenever it is copying to an USB stick (see Why is my PC freezing while I'm copying a file to a pendrive?, http://lwn.net/Articles/572911/ and http://askubuntu.com/q/508108/234374). A workaround is to execute the following commands as root (see here for an explanation) as root:               echo $((16*1024*1024)) > /proc/sys/vm/dirty_background_bytes     echo $((48*1024*1024)) > /proc/sys/vm/dirty_bytes      How do I revert these changes? When I restart my PC, will it get rolled back to default values?


title: Bash variables and types

text: I'm making a script that validate an IP address. I do this:               read pool     checkIp()     {         local  ip=$1         local  stat=1              if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then             OIFS=$IFS             IFS='.'             ip=($ip)             IFS=$OIFS             [[ ${ip[0]} -le 255 && ${ip[1]} -le 255 && ${ip[2]} -le 255 && ${ip[3]} -le 255 ]]             stat=$?              fi         return $stat     }          checkIp $pool     if [ $? -eq 0 ]         then             echo "valid"         else             echo "invalid"     fi      The problem is that now the requirement is to valid that from the 2nd octet the input can contain the wildcard "*" (i think is better to use CIDR notation but is not the case), and now i can't use `-le` because if there is not a number, it fails. I'd tried some forms but all conversions fails.


title: ls'ing through an entire directory tree to produce one pipeable list of files

text: This might have been answered already. But I wasn't able to find it. I have:               directory     directory/subdirectory/subdirectoryofsubdirectory     directory/sub-subdirectory/subdirectoryofsub-subdirectory/subdirectoryofsubdirectoryofsub-subdirectory     directory/sub-sub-subdirectory     directory/sub-sub-sub-subdirectory      each directory and subdirectory contains files. I want to list them all, pipe the list to cat, and cat the list to a text file. Can this be done with a 'one liner'? If so, please provide it. Or does it require a script and, if so, what commands/structures will I need to write the script?


title: Upgraded to Ubuntu 14.04 - Mail server missing dovecot-lmtp even though it is installed

text: So I upgraded to Ubuntu 14.04.1 from 12.04 the other day. Easy upgrade process. Everything worked fine except for my mail server stopped receiving mail. The logs show the mail arrives and is handled up until this:                Connect to MAILSERVER[private/dovecot-lmtp]: No such file or directory)      Similar error when a user tries to fetch their inbox. All mail is fetched up until the day of the upgrade, no new mail will arrive. The following is in postfix/main.cf:                postfix/main.cf:virtual_transport = lmtp:unix:private/dovecot-lmtp      apt-get install dovecot-lmtp says it is already installed. Did a dpkg- reconfigure, no help. My setup is maintained by ISPConfig if that helps. I already did reinstall though after upgrading to Ubuntu 14.04. Reinstalling ISPConfig fixed every issue with services except mail. UPDATE: - I overlooked the fact the previous setup was using courier and dovecot was not even installed. ISPConfig or Ubuntu upon upgrading changed this to dovecot, yet dovecot is not installed. With Dovecot installed it doesn't even start or write to the logs (dovecot reload yields errors, dovecot find logs shows me logs which are contain no dovecot entries).


title: Specifying virtualenv correctly in uwsgi.conf

text: I am trying to get a uwsgi environment working correctly on Arch, to run my Flask application from a virtualenv. I have installed uwsgi, nginx and virtualenv and these all work to a point. However I am seeing the following error in the `uwsgi` log:               Traceback (most recent call last):       File "./interface.py", line 1, in <module>         from flask import flask     ImportError: No module named flask     unable to load app 0 (mountpoint='') (callable not found or import error)     unable to find "application" callable in file index.py     unable to load app 0 (mountpoint='') (callable not found or import error)     *** no app loaded. going in full dynamic mode ***     *** uWSGI is running in multiple interpreter mode ***     spawned uWSGI master process (pid: 4795)     spawned uWSGI worker 1 (pid: 4796, cores: 1)     --- no python application found, check your startup logs for errors ---     [pid: 4796|app: -1|req: -1/1] 192.168.9.201 () {40 vars in 664 bytes} [Thu Dec 26 08:01:56 2013] GET / => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0)      This indicates that it can't load the flask module, which I am guessing is due to an incorrect `uwsgi.conf`:               [uwsgi]     uid = http     gid = http     plugin = python2     socket = %drun/%n.sock     chdir = /srv/http/example/htdocs     master = True     pidfile = %drun/%n.pid     logto = %dlog/%n.log     venv = /srv/http/example/htdocs     pyhome = /srv/http/example/htdocs     module = interface     callable = my_app     no-site = true      **Can anyone tell me what I should be setting`venv` and `pyhome` to, as I think this is where the problem lies? Or in fact if I should be setting both?** Also relevant, is when I run the following from a terminal, I can import the flask module without errors:               $ pwd     /srv/http/example/htdocs     $ . bin/activate     (htdocs) $ python     Python 2.7.6 (default, Nov 26 2013, 12:52:49)      [GCC 4.8.2] on linux2     Type "help", "copyright", "credits" or "license" for more information.     >>> import flask     >>>       **Am I just setting`venv` in `uwsgi.conf` incorrectly?**


title: Can I make vim change its cursor behavior?

text: I've been using vim for a few years as a secondary editor but for various reasons, I find myself using it more and more even when my primary editor is available. One problem that has always bugged me about `vim`, and that keeps me from using it more, is the way it handles cursor placement. The cursor can only be _on_ a character, rather than _between_ characters, as would be the case with any editor created since 1984. For just one example of why this is a problem, if I want to delete the last word on a line, I hit `$` to go to the end of the line, and then `db` to delete backward. This leaves a character to delete, because `$` didn't _really_ go to the end of the line, it went **_to the last character of the line_** , and `db` deleted only what was _before_ the current character. The problem isn't that I have to type an extra character, it's the extra thought involved in doing what ought to be simple, which distracts my attention away from what I'm actually trying to accomplish. It seems to me that the more modern idea cursor placement is in every way superior, and I'd like to switch `vim` to use that approach. I'm sure some hard-core `vim` fans will disagree with my view on that, but since one of the standard arguments for `vim`'s superiority is its infinite configurability:   * **can it deliver in this case?**   * **Can`vim` be made to place the cursor _between_ characters?**


title: creating a device image for a network location

text: I have a dedicated ubuntu server with hetzner.de. hetzner also provides a seperate backup space accessible via `samba/ftp/sftp/scp`. In their support document about backups, the following line is mentioned. > "The direct use of rsync is not possible. The backup space can however be > locally mounted using smbfs, sshfs or ftpfs, allowing a limited use of > rsync. To take full advantage of rsync (such as incremental backups using > hardlinks) an image file must be created, which should be mounted via > loopback." I would like to use rsync with incremental backups using hardlinks. I think by loopback they mean http://en.wikipedia.org/wiki/Loop_device. can any one help on how I can create a image from the network location.


title: Best live distro for working with files

text: What is the most **savvy** Live Linux Distro for working (open, coping, moving) with files (text documents, pictures, music files and videos). **Typical case** : _We have a computer (mostly with Windows and NTFS file system) and we need to explore it's file system. Not just copy files, but full functionality including watching video files._ Thanks In Advance!


title: Remove all `at` jobs

text: I know that to remove a scheduled `at` job I have to use `atrm "numjob1 numjob2"`, but is there an easy way to do that for all the jobs?


title: RHEL 6.5 won't boot after loading APF firewall

text: We have an RHEL 6.5 system which boots to the point of loading APF firewall and then just hangs indefinitely. The console shows the following:               ...     Loading autofs4: [OK]     Starting automount: [OK]     Starting SWsoft control panels server... [OK]     Starting APF: ip_tables: (C) 2000-2006 Netfilter Core Team     nf_conntrack version 0.5.0 (16384 buckets, 65536 max)      ![enter image description here](http://i.stack.imgur.com/ofYrQ.jpg) It then waits indefinitely on the screen above. The only way we have been able to work around this was to disable the APF service from starting at boot. /var/log/messages shows the following:               May  9 04:15:29 sapphire acpid: waiting for events: event logging is off     May  9 04:15:29 sapphire acpid: client connected from 6777[68:68]     May  9 04:15:29 sapphire acpid: 1 client rule loaded     May  9 04:15:30 sapphire automount[6797]: lookup_read_master: lookup(nisplus): couldn't locate nis+ table auto.master     May  9 04:15:31 sapphire kernel: ip_tables: (C) 2000-2006 Netfilter Core Team     May  9 04:15:31 sapphire kernel: nf_conntrack version 0.5.0 (16384 buckets, 65536 max)      /var/log/apf_log consistently shows the following as the last lines before boot hangs:               May 09 04:15:33 server apf(6915): {dshield} downloading http://feeds.dshield.org/top10-2.txt     May 09 04:15:33 server apf(6915): {dshield} parsing top10-2.txt into /etc/apf/ds_hosts.rules     May 09 04:15:33 server apf(6915): {dshield} loading ds_hosts.rules          May 09 04:30:50 server apf(2681): {dshield} downloading http://feeds.dshield.org/top10-2.txt     May 09 04:30:51 server apf(2681): {dshield} parsing top10-2.txt into /etc/apf/ds_hosts.rules     May 09 04:30:51 server apf(2681): {dshield} loading ds_hosts.rules          May 09 04:48:45 server apf(2653): {dshield} downloading http://feeds.dshield.org/top10-2.txt     May 09 04:48:46 server apf(2653): {dshield} parsing top10-2.txt into /etc/apf/ds_hosts.rules     May 09 04:48:46 server apf(2653): {dshield} loading ds_hosts.rules      So it would seem that loading of the DShield rules is causing boot to hang. After successfully booting, both iptables and APF are running fine. Can anyone suggest how to troubleshoot this?


title: Since Ubuntu persistent USB crashed, it fails to boot with black screen pre-login, what to do?

text: I'm using a persistent live USB version of Ubuntu 13.04. Recently it crashed while I was using it. When I restarted I couldn't get past the Ubuntu logo with the sequentially flashing dots anymore. Using variations of `Control` + `Alt` + `F1`, escape and by booting into `nomodeset` I have gathered this information that may help. ![](http://i.imgur.com/7rl7xXb.jpg) ![](http://i43.tinypic.com/2h4bwxd.jpg) ![](http://i.imgur.com/tTQAeEK.jpg) I cannot get to a console, I can get to here: ![](http://i.imgur.com/PTwWAZR.jpg) I don't know how to proceed. edit: I've viewed the files using another Ubuntu machine, it seems the drive is ok? ![](http://i.imgur.com/GgpMVZF.png)


title: How can I "relink" a lot of broken symlinks?

text: I have a directory tree which has a bunch of symbolic links to files under `/home`... however, I have moved `/home` to `/mnt/home` and need a way to "relink" all of the symlinks. Does such functionality exist or do I need to write a script to do so? As an example, I have something like the following:               [root@trees ~]# ls -l /mnt/home/someone/something     total 4264     lrwxrwxrwx 1 jnet www-data      55 2011-08-07 13:50 a -> /home/someone/someotherthing/a     lrwxrwxrwx 1 jnet www-data      55 2011-08-07 13:50 b -> /home/someone/someotherthing/b     lrwxrwxrwx 1 jnet www-data      55 2011-08-07 13:50 c -> /home/someone/someotherthing/c     lrwxrwxrwx 1 jnet www-data      55 2011-08-07 13:50 d -> /home/someone/someotherthing/d     lrwxrwxrwx 1 jnet www-data      55 2011-08-07 13:50 e -> /home/someone/someotherthing/e          /mnt/home/someone/something/subdir:     total 4264     lrwxrwxrwx 1 jnet www-data      55 2011-08-07 13:50 a -> /home/someone/someotherthing/subdir/a     lrwxrwxrwx 1 jnet www-data      55 2011-08-07 13:50 b -> /home/someone/someotherthing/subdir/b     lrwxrwxrwx 1 jnet www-data      55 2011-08-07 13:50 c -> /home/someone/someotherthing/subdir/c     lrwxrwxrwx 1 jnet www-data      55 2011-08-07 13:50 d -> /home/someone/someotherthing/subdir/d     lrwxrwxrwx 1 jnet www-data      55 2011-08-07 13:50 e -> /home/someone/someotherthing/subdir/e      I want a command which will find all the symlinks and relink to the same places but underneath `/mnt/home` instead of `/home` Does such a command exist?


title: Get application to show up in start search on openSUSE

text: I just switched my development environment to openSUSE so I can get more experience with Linux systems. I'm attempting to replicate the 'spotlight' feature on Mac OSX. I've edited the application launcher settings easily enough, with `Alt` + `space`. I can open the start menu with the focus on the search bar. At this point, I attempted to download Sublime Text 2 and have it show up in the search box. I went to the site and downloaded the package and used the Ark program to unzip (un-tar?) the file. I went into the newly created folder and clicked the application icon for Sublime and it opens just fine. But the search function does not list Sublime as an application. I moved the unzipped folder from `Downloads` to `/opt/` and this does not fix the problem either.


title: Is there a more proper place than /etc/rc.local for writing to configure binfmt?

text: I want to be able to run clr (>NET/mono) exes on my redhat machines, so I add the following to /etc/rc.local:               echo ':CLR:M::MZ::/opt/mono-head/bin/mono:' > /proc/sys/fs/binfmt_misc/register      This works fine, but is there a more appropriate config file specifically intended for configuring binfmt as opposed to the kitchen sink rc.local?


title: map "Ñ" to ":" in vim

text: I want map the key `Ñ` (`Shift`+`ñ`) to `:` in the normal mode of vim. I've searched vim configs with Ntilde but I've found nothing. Any idea?.


title: IO Error on RAID5 member. What to do about bad blocks?

text: I recently got an IO Error on one of my RAID5 members; on a 3 disk fakeRAID array. I didn't notice at the time - there was only a message in `/var/log/kern.log` - so I had continued running the machine from that partition for a good while longer. The BIOS / Intel RAID Manager didn't pick up any problems, but when I chose to boot from that partition, `/` was being mounted read-only. Now I'm booted from a recovery partition, and have just run `e2fsck -c -y` on the partition, which has picked up quite a few errors, including: "Multiply- claimed blocks", "Unattached inode", "Free inodes count wrong for group #xxx", etc.. It has also reproduced the IO error in `kern.log`, so dmraid has degraded the array and I can now tell easily which drive has failed. Now, what to do about the dodgy drive? I will get an advance RMA, but that takes about 5 days, so in the mean-time, I need a running machine, and a degraded RAID5 volume is not good karma! The messages I'm seeing from `dmesg` are:-               ata3.00: exception Emask 0x10 SAct 0x1 SErr 0x280100 action 0x6 frozen     ata3.00: irq_stat 0x08000000, interface fatal error     ata3: SError: { UnrecovData 10B8B BadCRC }     ata3.00: failed command: READ FPDMA QUEUED     ata3.00: cmd 60/00:00:00:0b:0c/01:00:14:00:00/40 tag 0 ncq 131072 in              res 40/00:04:00:0b:0c/00:00:14:00:00/40 Emask 0x10 (ATA bus error)     ata3.00: status: { DRDY }     ata3: hard resetting link     ata3: SATA link up 3.0 Gbps (SStatus 123 SControl 300)     ata3.00: configured for UDMA/133     sd 2:0:0:0: [sdb]     Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE     sd 2:0:0:0: [sdb]     Sense Key : Aborted Command [current] [descriptor]     Descriptor sense data with sense descriptors (in hex):             72 0b 00 00 00 00 00 0c 00 0a 80 00 00 00 00 00             14 0c 0b 00     sd 2:0:0:0: [sdb]     Add. Sense: No additional sense information     sd 2:0:0:0: [sdb] CDB:     Read(10): 28 00 14 0c 0b 00 00 01 00 00     end_request: I/O error, dev sdb, sector 336333568     ata3: EH complete     device-mapper: dm-raid45: CRITICAL: io error on device /dev/sdb in region=336329728; DEGRADING RAID set     device-mapper: dm-raid45: further device error messages suppressed      Am I right in thinking that (from the above `dmesg` errors) that only some regions of the drive are bad? If so, can I continue to use the drive whilst avoiding those bad blocks? I'm inclined to format the drive and rebuild the array on to it, until a replacement arrives. Is that a bad idea? Also, the SMART tests seem to be fine on all RAID disks...


title: What kind of bad things can happen if I disable APIC (not to be confused with ACPI)?

text: I'm dealing with some really old point-of-sale machines that run a point-of- sale flavour of SuSE 9. It turns out that its kernel is affected by an old bug that makes USB 2.0 functionality unstable （hotplugging of devices may result in "control timeout on ep0out" messages in /var/log/messages, and the hotplugged device becomes unusable). I first tried to work around it by unloading the ehci-hcd module, so that the USB 2.0 devices just fallback to USB 1.1. But now I discover that an HP laser printer connected to the POS machine prints extremely slowly in USB 1.1 mode. Some more search on Google suggests that the alternative solution is to put the noapic option in /boot/grub/menu.lst. But what kind of bad things can I expect to happen if I disable APIC, besides performance degradation? I hear that ACPI is closely related to APIC, but I'm not concerned about ACPI because we explicitly turn it off in GRUB anyway. In theory, would some devices simply not work when APIC is disabled? More information:   * single CPU, single core system (some Celeron 2.5 GHz)   * kernel 2.6.5- _something-something_


title: What does d signify in processes like syslogd and httpd?

text: Why there is a "d" after the name of processes like syslogd and httpd ? What is its significance ?


title: Understanding output redirection?

text: Is it correct to say that the only difference between the 'input redirection operator' and the 'pipeline operator', is that '<' redirects standard input from a file, and '|' redirects input TO a program?


title: A window disappeared after I pressed a key in Openbox, how do I bring it back?

text: I had Firefox running, then (possibly) as a result of a key combination I don't recall, it quickly vanished from screen and Task Bar/Window List. From my other question it was established the issue is likely that I made the window disappear, though it isn't on either of the two user-displayable desktops. I am running the Openbox Window Manager on Parted Magic. I don't have tools such as `wmctrl` or `xdotool` installed/available, which I understand have the ability to bring the window back to the current desktop, unhide, unshade, or maximize it. Does anyone know if Openbox exposes this fuctionality natively, or any other way to perform the same with Openbox built-in tools / ones that can be added/used with this distro?


title: Fedora 17-15 old lvm partition reporting incorrect size

text: After years i decided to upgrade from Fedora 15 to 18, but as per the guidelines only 2 versions can be jumped, so i decided to settle with Fedora 17 and ran `preupgrade` , all was going fine, till after sometime, it told me that i didnt had any space, so i canceled the initial process, made some space and tried again. This time- after reboot- when it was copying files, it encountered error(s) on couple of files, for which I had to boot back to terminal an uninstall the terminal. Eventually the setup completed and post the final boot the kernel 3.6 panic'd - unable to mount VFS After long tries of different ways, still nothing worked, so I decided to download the Live ISO from their server and install it. I selected- install on free space - assuming it would overwrite its files, but it didnt and created new partitions. **So, now the whole disk is running out of space** To manage that, I manually deleted the left overs of the old installation,while only keeping the backup. All set and done, the `df -h` is showing close to 50% free space in old LVM , but when i open the same in `gparted` its still showin 99% full. I ran `e2fsck` of the `dev/Volgroup00/root`, it also came clean. All the partitions are ext4 type. Please help me in reclaiming this lost space.


title: Why can't I source a script file from .xsessionrc?

text: I am running LXDE/Openbox on Debian Linux. On logging in I want to:   * add a user specific directory to the $PATH variable (A)   * execute some (non-graphical) commands (e.g. mount directories) (B) The setup should work for graphical login as well as login shells (e.g. SSH). Especially the part about extending the $PATH variable seems to be tricky... My ideal solution would be to put all the commands (A and B) in a separate script file (F) and source it from `.xsessionrc` (for graphical login via the session manager) and `.profile` (for login shells). Sourcing F from `.profile` works nicely, but sourcing from `.xsessionrc` seems to fail. So I made the workaround to set the new $PATH directly in `.xsessionrc` (and also in `.profile`) and just execute F (now containing only the commands B) from `.xsessionrc` and `.profile`. This works fine, but is not really satisfactory, as I now some duplicate commands (A) in `.xessionrc` and `.profile`. Is there some magic incanation that I have to do in order to source another file from `.xsessionrc` or are there any other obvious flaws in my thinking?


title: Tool to compare files on one disk with registry information on another?

text: Been a long time since I got very far under the hood in Unix so I'm probably not even using proper terminology when I say 'registry,' but here's the situation. I have a disk thats dying. Lots of i/o errors. So I'm in the process of copying all of the files from that disk over to another. But there are definitely files that aren't making it over. Is there a way that I can look at the 'registry' of files on the bad disk and compare that with the files that exist on the new disk and determine which ones are missing? I know I could try and do a `diff` between the two filesystems but am concerned that reading through every file on the bad disk is just going to error out - whereas I'm hoping that the list of what files exist on the bad disk is still sitting on undamaged sectors. Or does Unix (actually this is all OSX, not pure Unix) not even contain a global registry file?


title: rsync to copy files which has changed

text: I need to copy some files from a particular directory to a different location on a daily basis. I want to copy the changes only, so planning to use `rsync`. These files follows the following naming convention `mysql-bin.*` My command looks as follows               # rsync --update -raz --progress /var/lib/mysql/mysql-bin.*  /dbdata/binarylog/      My confusion is since I am planning to copy only few files from a directory rather than full directory contents , I have used `*` to copy only required files. Just want to know whether my command is correct to achieve the same.


title: why does `awk` fail when I put it in a bash script

text: on the prompt:               ls | awk '{printf("%s\t\t%s\n", $9, $3);}'      succeeds in printing what it is supposed to be printing. If I put it in a file, I get four or five empty lines (about the number of lines in the output of `ls`):               $ cat awk-file-owner-simple      #!/bin/bash     ls | awk '{printf("%s\t\t%s\n", $9, $3);}'     $ ./awk-file-owner-simple      _     _     _     _      Where `_` stand for empty lines (that can't be displayed using the code formatter of stackexchange).


title: Is it possible to raise a window using dbus in Gnome3?

text: I have recently shifted from KDE4 to Gnome3. In KDE you can create application specific keyboard shortcuts to raise windows. I typically create one each for firefox, thunderbird, my terminal etc. That way switching between windows is lightning quick. Gnome doesn't seem to have that kind of functionality. Also I do not like Gnome3's window switching scheme (alt-tab). Hence I was wondering if its possible to raise windows through DBUS? If it is, then it will be possible to write a script and assign a keyboard shortcut to that.


title: A linux distribution installable to CF card

text: I need to install a Linux distribution on a PC Engine ALIX 1D board. The main storage device of that board is a 2 GB Compact Flash card. My aim is to use this board as a middle device between two network gateway devices connected on a Virtual Private Network. This middle device will be running Wireshark to sniff packets traveling through the VPN. Any suggestions for a CF card installable (lightweight) Linux distro? I would really appreciate a distribution that is easy to install and has good community support.


title: mounting an encrypted dm-raid partition on login

text: I have a dm-raid1 with a LUKS encrypted partition `md0` on it and I would like it to be mounted automatically when I login, using pam_mount. So far I have configured the `pam_mount.conf.xml` as follows:               <?xml version="1.0" encoding="utf-8" ?>     <!DOCTYPE pam_mount SYSTEM "pam_mount.conf.xml.dtd">     <pam_mount>       <debug enable="1" />       <mntoptions allow="nosuid,nodev,loop,encryption,fsck,nonempty,allow_root,allow_other" />       <mntoptions require="nosuid,nodev" />       <logout wait="0" hup="0" term="0" kill="0" />       <volume         user="me"         path="/dev/mapper/data"         mountpoint="/mnt/data"         fstype="crypt"         cipher="aes-cbc-essiv:sha256"         fskeypath="/home/data.key"         fskeycipher="aes-256-cbc"         fskeyhash="md5" />       <mkmountpoint enable="1" remove="true" />     </pam_mount>      Further I added `@include common-pammount` to `/etc/pam.d/login` and `/etc/pam.d/gdm`. The problem though, is that /dev/mapper/data is not in place when it is about to be mounted. However, the mounting works if I do               cryptsetup luksOpen /dev/md0 data


title: Merge fields in a file

text: I have a file with 7 columns, a GFF file having chromosomal regions.I want to collapse the rows where REGION ="exon" to only one row in the file.The row has to be collapsed on the basis of regions being overlapping with each other.               REGION  START   END  SCORE STRAND FRAME     ATTRIBUTE      exon   26453   26644   .   +   .   Transcript "XM_092971"; Name "XM_092971"      exon   26842   27020   .   +   .   Transcript "XM_092971"; Name "XM_092971"      exon   30355   30899   .   -   .   Transcript "XM_104663"; Name "XM_104663"      GS_TRAN    30355   34083   .   -   .   GS_TRAN "Hs22_30444_28_1_1"; Name "Hs22_30444_28_1_1"      snp    30847   30847   .   +   .   SNP "rs2971719"; Name "rs2971719"      exon   31012   31409   .   -   .   Transcript "XM_104663"; Name "XM_104663"      exon   34013   34083   .   -   .   Transcript "XM_104663"; Name "XM_104663"      exon   40932   41071   .   +   .   Transcript "XM_092971"; Name "XM_092971"      snp    44269   44269   .   +   .   SNP "rs2873227"; Name "rs2873227"      snp    45723   45723   .   +   .   SNP "rs2227095"; Name "rs2227095"      exon   134031  134495  .   -   .   Transcript "XM_086913"; Name "XM_086913"                  exon   134034  134457  .   -   .   Transcript "XM_086914"; Name "XM_086914"                  Looking at the sample data above,only the last two rows can be merged into one row.So,the new row will become.               exon    134031  134495  .   -   .   Transcript "XM_086913"; Name "XM_086913"                  In case,the end of the other row would have been greater than its previous,that would be the END region in that case.Basically,if there is any overlap,then take the region which starts Earlier,and the one which ends later. There can be multiple rows of such instance,here only last 2 rows are there.One thing is that the ATRRIBUTE column will definitely show different Transcript names for such rows,which are mostly same in other cases. Any suggestions on how to proceed. UPDATED EXAMPLE: If the last 2 rows are like this                 exon  134031  134457  .   -   .   Transcript "XM_086913"; Name "XM_086913"                   exon  134034  134495  .   -   .   Transcript "XM_086914"; Name "XM_086914"      Then the Output should be :               exon    134031  134495  .   -   .   Transcript "XM_086913"; Transcript "XM_086914"      Basically the START from first and END from second.Since I want to cover the overlap in one row only,instead of 2 or 3 or more rows.Here the overlap is between 2 rows, but could be between more than 2 rows as well. **UPDATED EXAMPLE** (3/24/2014)               chr1    HAVANA  stop_codon  1120520 1120522 .   +   0   gene_id "ENSG00000162571.9"; transcript_id "ENST00000379288.3"; gene_type "protein_coding"; gene_status "KNOWN"; gene_name "TTLL10"; transcript_type "protein_coding"; transcript_status "KNOWN"; transcript_name "TTLL10-001"; level 2; tag "CCDS"; ccdsid "CCDS8.1"; havana_gene "OTTHUMG00000000851.3"; havana_transcript "OTTHUMT00000002420.2";     chr1    HAVANA  UTR 1115077 1115233 .   +   .   gene_id "ENSG00000162571.9"; transcript_id "ENST00000379288.3"; gene_type "protein_coding"; gene_status "KNOWN"; gene_name "TTLL10"; transcript_type "protein_coding"; transcript_status "KNOWN"; transcript_name "TTLL10-001"; level 2; tag "CCDS"; ccdsid "CCDS8.1"; havana_gene "OTTHUMG00000000851.3"; havana_transcript "OTTHUMT00000002420.2";     chr1    HAVANA  UTR 1115414 1115433 .   +   .   gene_id "ENSG00000162571.9"; transcript_id "ENST00000379288.3"; gene_type "protein_coding"; gene_status "KNOWN"; gene_name "TTLL10"; transcript_type "protein_coding"; transcript_status "KNOWN"; transcript_name "TTLL10-001"; level 2; tag "CCDS"; ccdsid "CCDS8.1"; havana_gene "OTTHUMG00000000851.3"; havana_transcript "OTTHUMT00000002420.2";     chr1    HAVANA  UTR 1120520 1121244 .   +   .   gene_id "ENSG00000162571.9"; transcript_id "ENST00000379288.3"; gene_type "protein_coding"; gene_status "KNOWN"; gene_name "TTLL10"; transcript_type "protein_coding"; transcript_status "KNOWN"; transcript_name "TTLL10-001"; level 2; tag "CCDS"; ccdsid "CCDS8.1"; havana_gene "OTTHUMG00000000851.3"; havana_transcript "OTTHUMT00000002420.2";     chr1    HAVANA  transcript  1115864 1119307 .   +   .   gene_id "ENSG00000162571.9"; transcript_id "ENST00000460998.1"; gene_type "protein_coding"; gene_status "KNOWN"; gene_name "TTLL10"; transcript_type "processed_transcript"; transcript_status "KNOWN"; transcript_name "TTLL10-004"; level 2; havana_gene "OTTHUMG00000000851.3"; havana_transcript "OTTHUMT00000002423.1";     chr1    HAVANA  exon    1115864 1116240 .   +   .   gene_id "ENSG00000162571.9"; transcript_id "ENST00000460998.1"; gene_type "protein_coding"; gene_status "KNOWN"; gene_name "TTLL10"; transcript_type "processed_transcript"; transcript_status "KNOWN"; transcript_name "TTLL10-004"; level 2; havana_gene "OTTHUMG00000000851.3"; havana_transcript "OTTHUMT00000002423.1";     chr1    HAVANA  *exon   1117121 1117195*    .   +   .   gene_id "ENSG00000162571.9"; transcript_id "ENST00000460998.1"; gene_type "protein_coding"; gene_status "KNOWN"; gene_name "TTLL10"; transcript_type "processed_transcript"; transcript_status "KNOWN"; transcript_name "TTLL10-004"; level 2; havana_gene "OTTHUMG00000000851.3"; havana_transcript "OTTHUMT00000002423.1";     chr1    HAVANA  *exon   1117150 1117826*    .   +   .   gene_id "ENSG00000162571.9"; transcript_id "ENST00000460998.1"; gene_type "protein_coding"; gene_status "KNOWN"; gene_name "TTLL10"; transcript_type "processed_transcript"; transcript_status "KNOWN"; transcript_name "TTLL10-004"; level 2; havana_gene "OTTHUMG00000000851.3"; havana_transcript "OTTHUMT00000002423.1";     chr1    HAVANA  exon    1118256 1118427 .   +   .   gene_id "ENSG00000162571.9"; transcript_id "ENST00000460998.1"; gene_type "protein_coding"; gene_status "KNOWN"; gene_name "TTLL10"; transcript_type "processed_transcript"; transcript_status "KNOWN"; transcript_name "TTLL10-004"; level 2; havana_gene "OTTHUMG00000000851.3"; havana_transcript "OTTHUMT00000002423.1";          chr1    HAVANA  transcript  1190648 1209229 .   -   .   gene_id "ENSG00000160087.16"; transcript_id "ENST00000473215.1"; gene_type "protein_coding"; gene_status "KNOWN"; gene_name "UBE2J2"; transcript_type "nonsense_mediated_decay"; transcript_status "KNOWN"; transcript_name "UBE2J2-003"; level 2; havana_gene "OTTHUMG00000001911.7"; havana_transcript "OTTHUMT00000005432.2";     chr1    HAVANA  exon    1209046 1209229 .   -   .   gene_id "ENSG00000160087.16"; transcript_id "ENST00000473215.1"; gene_type "protein_coding"; gene_status "KNOWN"; gene_name "UBE2J2"; transcript_type "nonsense_mediated_decay"; transcript_status "KNOWN"; transcript_name "UBE2J2-003"; level 2; havana_gene "OTTHUMG00000001911.7"; havana_transcript "OTTHUMT00000005432.2";     chr1    HAVANA  exon    1203113 1203372 .   -   .   gene_id "ENSG00000160087.16"; transcript_id "ENST00000473215.1"; gene_type "protein_coding"; gene_status "KNOWN"; gene_name "UBE2J2"; transcript_type "nonsense_mediated_decay"; transcript_status "KNOWN"; transcript_name "UBE2J2-003"; level 2; havana_gene "OTTHUMG00000001911.7"; havana_transcript "OTTHUMT00000005432.2";     chr1    HAVANA  CDS 1203241 1203372 .   -   0   gene_id "ENSG00000160087.16"; transcript_id "ENST00000473215.1"; gene_type "protein_coding"; gene_status "KNOWN"; gene_name "UBE2J2"; transcript_type "nonsense_mediated_decay"; transcript_status "KNOWN"; transcript_name "UBE2J2-003"; level 2; havana_gene "OTTHUMG00000001911.7"; havana_transcript "OTTHUMT00000005432.2";     chr1    HAVANA  start_codon 1203370 1203372 .   -   0   gene_id "ENSG00000160087.16"; transcript_id "ENST00000473215.1"; gene_type "protein_coding"; gene_status "KNOWN"; gene_name "UBE2J2"; transcript_type "nonsense_mediated_decay"; transcript_status "KNOWN"; transcript_name "UBE2J2-003"; level 2; havana_gene "OTTHUMG00000001911.7"; havana_transcript "OTTHUMT00000005432.2";     chr1    HAVANA  stop_codon  1203238 1203240 .   -   0   gene_id "ENSG00000160087.16"; transcript_id "ENST00000473215.1"; gene_type "protein_coding"; gene_status "KNOWN"; gene_name "UBE2J2"; transcript_type "nonsense_mediated_decay"; transcript_status "KNOWN"; transcript_name "UBE2J2-003"; level 2; havana_gene "OTTHUMG00000001911.7"; havana_transcript "OTTHUMT00000005432.2";     chr1    HAVANA  exon    1198726 1198766 .   -   .   gene_id "ENSG00000160087.16"; transcript_id "ENST00000473215.1"; gene_type "protein_coding"; gene_status "KNOWN"; gene_name "UBE2J2"; transcript_type "nonsense_mediated_decay"; transcript_status "KNOWN"; transcript_name "UBE2J2-003"; level 2; havana_gene "OTTHUMG00000001911.7"; havana_transcript "OTTHUMT00000005432.2";     chr1    HAVANA  exon    1192588 1192690 .   -   .   gene_id "ENSG00000160087.16"; transcript_id "ENST00000473215.1"; gene_type "protein_coding"; gene_status "KNOWN"; gene_name "UBE2J2"; transcript_type "nonsense_mediated_decay"; transcript_status "KNOWN"; transcript_name "UBE2J2-003"; level 2; havana_gene "OTTHUMG00000001911.7"; havana_transcript "OTTHUMT00000005432.2";     chr1    HAVANA  exon    1192372 1192510 .   -   .   gene_id "ENSG00000160087.16"; transcript_id "ENST00000473215.1"; gene_type "protein_coding"; gene_status "KNOWN"; gene_name "UBE2J2"; transcript_type "nonsense_mediated_decay"; transcript_status "KNOWN"; transcript_name "UBE2J2-003"; level 2; havana_gene "OTTHUMG00000001911.7"; havana_transcript "OTTHUMT00000005432.2";     chr1    HAVANA  *exon   1191425 1191505*    .   -   .   gene_id "ENSG00000160087.16"; transcript_id "ENST00000473215.1"; gene_type "protein_coding"; gene_status "KNOWN"; gene_name "UBE2J2"; transcript_type "nonsense_mediated_decay"; transcript_status "KNOWN"; transcript_name "UBE2J2-003"; level 2; havana_gene "OTTHUMG00000001911.7"; havana_transcript "OTTHUMT00000005432.2";     chr1    HAVANA  *exon   1190648 1191470*    .   -   .   gene_id "ENSG00000160087.16"; transcript_id "ENST00000473215.1"; gene_type "protein_coding"; gene_status "KNOWN"; gene_name "UBE2J2"; transcript_type "nonsense_mediated_decay"; transcript_status "KNOWN"; transcript_name "UBE2J2-003"; level 2; havana_gene "OTTHUMG00000001911.7"; havana_transcript "OTTHUMT00000005432.2";      The upper portion shows the overlap in "+" strand,and the below portion shows the overlap in "-" strand.The "-" strand has decreasing regions,so overlap will be like shown in the last 2 rows.Both are different genes.So overlap has to be per gene,as sometimes different genes have overlapping exons also but this is very rare as I have read in some posts. The gene information can be extracted from the last column,present as"gene_name". The two rows from gene_name=TTLL10 have overlapping exons,so they will be merged, in the final output.               chr1    HAVANA  *exon   1117121 1117195*    .   +   .   transcript_id "ENST00000460998.1"; gene_name "TTLL10";      chr1    HAVANA  *exon   1117150 1117826*    .   +   .   transcript_id "ENST00000460998.1"; gene_name "TTLL10";       The two rows from gene_name= UBE2J2 have overlap exons.                chr1   HAVANA  *exon   1191425 1191505*    .   -   .   transcript_id "ENST00000473215.1"; gene_name "UBE2J2";        chr1  HAVANA  *exon   1190648 1191470*    .   -   .   transcript_id "ENST00000473215.1";  gene_name "UBE2J2";       **SAMPLE OUTPUT** The rest of the rows remain same,and the above rows get merged for each gene.               chr1    HAVANA  *exon   1117121 1117826*    .   +   .   transcript_id "ENST00000460998.1"; gene_name "TTLL10";     chr1    HAVANA  *exon   1190648 1191505*    .   -   .   transcript_id "ENST00000473215.1";  gene_name "UBE2J2";       In case,the transcript_ids are different,both transcript id's would be printed although gene_name will remain same.for e.g If for gene,the transcript id's were different like below:                 chr1  HAVANA  *exon   1191425 1191505*    .   -   .   transcript_id "ENST00000473215.1"; gene_name "UBE2J2";        chr1  HAVANA  *exon   1190648 1191470*    .   -   .   transcript_id "ENST00000473215.2";  gene_name "UBE2J2";       This will merge to as above,but should have both transcript names.Since,I believe it might be needed and will be important later on to preserve the transcript information.                 chr1  HAVANA  *exon   1190648 1191505*    .   -   .   transcript_id "ENST00000473215.1"; "ENST00000473215.2"  gene_name "UBE2J2";


title: How to work with dfspace command?

text: I am trying to execute dfspace command but I am getting the error               root@Kali:~# /dfspace     -bash: /dfspace: No such file or directory


title: Lightdm service - contradictory results for `status` command

text: When I run in my gnome-terminal:               service lightdm status      everything looks OK and it is as expected:               lightdm start/running, process 1221      But when I run:               service --status-all 2>&1 | grep lightdm      the output is:                [ ? ]  lightdm      which, because of `?`, AFAIK means that the lightdm service doesn't have a `status` command. Now I want to understand from where came these contradictory results? Is this a bug?


title: How to bash-complete output of two arbitrary commands at the same time

text: Here goes:               function _command() {         local cur         COMPREPLY=()         cur=${COMP_WORDS[COMP_CWORD]}         if [ "$COMP_CWORD" -ge "2" ]; then             COMPREPLY=($( compgen -W '$(pwd)' -- "$cur" ) )         else             COMPREPLY=($( compgen -W "arg1 arg2" -- "$cur" ) )         fi     }     complete -F _command command      This works well, so long as I `source` it. What if I want it to auto-complete both outputs of `pwd` and some other arbitrary command, say `hostname`? What if I also wanted it to auto-complete on any file path?


title: CLEAN CACHE On X86 Desktop Boxes?

text: I was building `3.12.13` linux kernel and I came across the `CONFIG_CLEANCACHE` option. it would seems to reduce `I/O` considerably especially in conjunction with `CONFIG_FRONTSWAP`. But I want to know if it works in normal desktop boxs with `ext4` partitions. because it seems it needs some feature available on the machine such as `zcache` and appropriate `Filesystem`, Which if they are not available enabling them would cause a performance hit.


title: Easiest way to forward mail to a third-party email address

text: I have some home system monitoring scripts run via cron that will create output, and hence mail to the user that runs the script. I want to redirect this mail to my Gmail (or insert any other third-party mail) account. The method should   1. be able to authenticate with and use another SMTP server (e.g. Gmail's SMTP itself) rather than sending directly via sendmail etc, as services like Gmail are likely to mark my mail as spam if I don't use a legit service.   2. retry sending if failed as it will be run via a home Internet connection.


title: Where should I put software I compile myself?

text: I need to compile some software on my Fedora machine. Where's the best place to put it so not to interfere with the packaged software?


title: Play On Linux host machine reporting

text: Some of my favorite games are not yet available on `Steam for Linux`. Some of these non-compatible games are playable via `Play On Linux` (Wine wrapper + magic). How does Steam installed via `Play On Linux` report the host machine to `Valve/Steam`? Is it reporting `Windows`, or is it truly showing I'm playing on Linux and therefore supporting Linux Desktop?


title: ^C characters at start of line break bash command editing

text: I have a problem with command editing in `bash`. If **all** of the following are true...   1. My (single-line) prompt is particularly long.   2. The terminal window is relatively narrow.   3. I pressed Ctrl+C to exit the previous process, so that `^C` is displayed at the left of the line.   4. The command I'm editing wraps to the next line. ...then the editing is messed up. I end up replacing characters offset by 2 positions from the ones I thought I was editing. Similar things happen if, at step 4, I type in a command that spans multiple lines (rather than pressing Up). I can backspace onto the previous line, and then delete two characters of my prompt. Basically this:               (Some output)     ^Cuser@host:~/path/to/somewhere $ some long command     that wraps      Is broken by the `^C` that appears at the start of the line. I've tried some other commands (e.g. `sleep 30`), and the `^C` appears on a line by itself, and the prompt appears on the next line. This only seems to happen with **node.js** : `node some_command_that_wraps.js`. In case it's important, I have a brightly-coloured, git-integrated `PROMPT_COMMAND`. You can find it on github, in case I've done something stupid in that. **Update** My PS1 is (for example) set to (I've wrapped it slightly):               \[\e]0;\u@\h:\w\a\]     \[\e[0;93m\]\u@\h\[\e[0;96m\]:\w      \[\e[0;97m\]{\[\e[0;94m\]master\[\e[0;92m\]\[\e[0;91m\] ~1\[\e[0;97m\]}     \[\e[0m\]\[\e[0;96m\]\$\[\e[0m\]      ...which displays (with more colour):               roger@roger-p5q:~/Source/rlipscombe/bash_profile [master ~1] $       As far as I can tell, the escape characters are correctly non-countable (using `\\[` .. `\\]`). How do I either:   * Get bash to detect the `^C` and move to the next line?, or   * Not mess up the command editing?


title: How do I determine if the linux password was changed?

text: I'm developing an application which is distributed on a VM. The default password is always the same, but it's hash in `/etc/shadow` changes with every release. How can I programmatically (e.g., from a `bash` script) find out whether the password was changed? Checking the hash is not an option because if the password was changed to something else and back, it will be different. I also want to keep the check as simple as possible.


title: What does the command "$()" do in UNIX?

text: What does the command `$()` do in UNIX? Could someone explain what is the significance of `$` in the below examples;               $(echo var=10)        and               eval $(echo var=10)


My Lenovo Y500 intel i7 nvidia gt 560m LinuxMint 14 x64 halts during startup at:               stopping samba auto-reload integration      No error shown. No login prompt. I accidentally executed this in the wrong terminal:               sudo dpkg-divert --local --rename --add /sbin/initctl     sudo ln -s /bin/true /sbin/initctl       then I tried to fix it with:               mv /sbin/initctl /initctl     dpkg-divert --remove /sbin/initctl      How can I make my system start properly again?


title: How to know in which partition my application has been installed?

text: If I run `df -h` in an Oracle LINUX 5 server, I got below output:                $ df -h             Filesystem            Size  Used Avail Use% Mounted on             /dev/sda2              12G  8.8G  1.8G  84% /             /dev/sda4             3.8G  592M  3.0G  17% /home             /dev/sda1              99M   70M   24M  75% /boot             tmpfs                 942M     0  942M   0% /dev/shm             /dev/sdc1              51G  1.8G   46G   4% /u000      I installed MySQL 5.1.73-community-log in this server which is running. If I run below command:               mysql> show variables like '%dir%';          +-----------------------------------------+----------------------------+     | Variable_name                           | Value                      |     +-----------------------------------------+----------------------------+     | basedir                                 | /                          |     | binlog_direct_non_transactional_updates | OFF                        |     | character_sets_dir                      | /usr/share/mysql/charsets/ |     | datadir                                 | /var/lib/mysql/            |     | innodb_data_home_dir                    |                            |     | innodb_log_group_home_dir               | ./                         |     | innodb_max_dirty_pages_pct              | 90                         |     | plugin_dir                              | /usr/lib64/mysql/plugin    |     | slave_load_tmpdir                       | /tmp                       |     | tmpdir                                  | /tmp                       |     +-----------------------------------------+----------------------------+     10 rows in set (0.00 sec)      Please advice about:   * how can I Know in which partition, MySQL has been installed?   * Which Partition will be used by MysQL to store data?   * What is `/dev/sdc1` and how can I use the enough space available (46G)?   * What is `tmpfs`?


title: How to remove an apostrophe ( ' ) from couple of columns of a .CSV file?

text: I have a .CSV file with 7 fields, and the 3rd and 4th columns of the file has a number starting with an apostrophe ( ' ). Please see the example below.               col0,col1,col2,col3,col4,col5,col6,     1value0,1value1,'8972991766941,'8972991766941,1value4,1value5,1value6,     2value0,2value1,'8912988876583,'8912988876583,2value4,2value5,2value6,     3value,3value1,'8912981226981,'8912981226981,3value4,3value5,3value6,     2value0,4value1,'8912971783681,'8912971783681,4value4,4value5,4value6,      How do I get rid of the apostrophes in the 3rd and 4th columns only using either sed or awk?


title: How to config Vino to let vncviewer show the hostname of server instead of "LibVNCServer "?

text: When vncviewer connected a vncserver which is on Windows, the title of vncviewer will be the hostname of windows server. But when vncviewer connected to vino vnc server on Linux, the title of vncviewer is always "LibVNCServer", is there any way to display hostname of linux server on vncviewer title ?


title: How to find out which interface am I using for connecting to the internet?

text: I have eth0 and wlan0 according to ifconfig and I can `ping google.com`. How can I find out (with a normal user, not root) what interface is _active_ , as in, what interface did the ping (or whatever, ping is not mandatory) use? NOTE: using Ubuntu 11.04 or Fedora 14


title: How to block the user for a certain amount of time

text: Suppose, I am working in X environment, and I want to have an obligatory periodic rest. Is it possible to setup a root cron job, that will block my user for 5 minutes every 45 minutes? I am using Linux Slackware 14.0.


title: How to set conkys window width?

text: I use the following .conkyrc:      The key Question: How can I set the window width, so that I could have a wider "window" for my stuff?               background yes     use_xft yes     xftfont Terminus:size=8     xftalpha 0.8     update_interval 3.0     total_run_times 0     double_buffer yes     own_window yes     own_window_type override     own_window_transparent yes     own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager     minimum_size 0 0     draw_shades yes     draw_outline no     draw_borders yes     stippled_borders 8     border_margin 0     border_width 0     default_color ffffff     default_shade_color black     default_outline_color ffffff     alignment top_left     # gap_x - 1280x800 = 1105; 1024x768 = 820     gap_x 1513     gap_y 5     no_buffers yes     uppercase no     cpu_avg_samples 2     net_avg_samples 2     override_utf8_locale yes     use_spacer yes     text_buffer_size 4096     TEXT      Thanks for any suggestions :\


title: Heirloom-mailx and Saving to IMAP Folder with Spaces

text: If I try to save to a message to an IMAP folder with the command `save 1 +FOLDER/"Folder withSpaces"` in heirloom-mailx, instead of saving, mailx spits out `No applicable messages from {Folder/"Folder, withSpaces"}`. For folders without spaces, it successfully appends the message to the folder, as desired. Can anyone offer me a clue as to why this is, so that I may fix it? I've googled, but have been unsuccessful in finding an answer. Thanks!


title: Disable [base] repository in CentOS-Base.repo

text: I want to disable base repository in centos-base.repo with help of nano, but don't know how to do it. Please help.Thank you.


title: Where to find info on how to set up a vm in redhat 7.2

text: I have a RedHat 7.2 server that was set up by someone else long ago as an e-commerce server. It is still in use for that purpose and I dare not make significant changes to it as my Linux-fu is weak. But now I want to set up a virtual machine to run under redhat and can't find a source of information. Searches on Google seem to give plenty of info about how to set up a VM under, say, Windows to run Linux in, but not how to set one up in Linux itself. When I have the VM I shall be running Fedora in it and using its Samba to share directories with Windows 7. The reason for all this is that the Samba version I'm using (vsn.2.2.3a) is incompatible with Win7 and if I try to update to a version that does work with Win7 (3 or later), I hit a cascade of rpm dependencies that, after a lot of searching, I still don't know how to resolve. Can anyone give me pointers on where to start please? Thanks Roy


title: prevent bash completion from altering underscore variable $_

text: When using tab completion in bash, the `$_` variable is altered:               $ mkdir test     $ cd <TAB><TAB> $_     bash: cd: -d: invalid option     cd: usage: cd [-L|[-P [-e]]] [dir]      (The `<TAB><TAB>` will list all files in current directory, but I don't end up using the output and write `$_` instead. The command executed in this line will just be `cd $_`.) Expected behavior would be to change into `./test`. How can I prevent bash completion from altering `$_`?


title: Unmet acroread dependencies preventing Synaptic install

text: In Synaptic I am getting the error:               acroread:        Depends: acroread-l10n-en but it is not going to be installed or acroread-l10n        Depends: acroread-debian-files but it is not going to be installed        Depends: acroread-data but it is not going to be installed        Depends: ia32-libs-xulrunner but it is not going to be installed       This is unusual for me as Synaptic normally resolves dependencies automatically; moreover acroread is a very popular package. I want to know how to get around this. I'm on Deb 6 64 bit. acroread is being sourced from `deb http://www.debian-multimedia.org squeeze main non-free`. For possibly relevant details also see Security hurdles to enabling sources in repo. Edit (@enzotib):               # Debian packages for stable     deb http://mirror.transact.net.au/debian/ stable main contrib non-free     # Uncomment the deb-src line if you want 'apt-get source'     # to work with most packages.     # deb-src http://mirror.transact.net.au/debian/ stable main contrib non-free          # Security updates for stable     # deb http://security.debian.org/ stable/updates main contrib non-free          deb http://www.debian-multimedia.org squeeze main non-free     #contains Adobe Reader      @Gilles               peter@peter-deb:~$ apt-cache policy acroread acroread-debian-files ia32-libs-xulrunner     acroread-debian-files:       Installed: (none)       Candidate: 9.4.2       Version table:          9.4.2 0             500 http://www.debian-multimedia.org/ squeeze/main amd64 Packages     acroread:       Installed: (none)       Candidate: 9.4.2-0.0       Version table:          9.4.2-0.0 0             500 http://www.debian-multimedia.org/ squeeze/non-free amd64 Packages     ia32-libs-xulrunner:       Installed: (none)       Candidate: 1.8.1.3-0.5       Version table:          1.8.1.3-0.5 0             500 http://www.debian-multimedia.org/ squeeze/main amd64 Packages      @Gilles:               peter@peter-deb:~$ sudo aptitude install acroread     The following NEW packages will be installed:       acroread acroread-data{a} acroread-debian-files{a}        acroread-dictionary-en{a} acroread-l10n-en{a} ia32-libs{a}        ia32-libs-gtk{a} ia32-libs-xulrunner{a} lib32asound2{ab} lib32bz2-1.0{a}        lib32gcc1{a} lib32ncurses5{a} lib32stdc++6{a} lib32v4l-0{a} lib32z1{a}        libc6-i386{a}      0 packages upgraded, 16 newly installed, 0 to remove and 8 not upgraded.     Need to get 4,955 kB/102 MB of archives. After unpacking 254 MB will be used.     The following packages have unmet dependencies:       lib32asound2: Depends: libasound2 (= 1.0.23-2.1) but 1.0.24.1-2 is installed.     The following actions will resolve these dependencies:               Keep the following packages at their current version:     1)     acroread [Not Installed]                                2)     acroread-data [Not Installed]                           3)     acroread-debian-files [Not Installed]                   4)     acroread-dictionary-en [Not Installed]                  5)     acroread-l10n-en [Not Installed]                        6)     ia32-libs [Not Installed]                               7)     ia32-libs-gtk [Not Installed]                           8)     ia32-libs-xulrunner [Not Installed]                     9)     lib32asound2 [Not Installed]                                           Accept this solution? [Y/n/q/?] Y     No packages will be installed, upgraded, or removed.     0 packages upgraded, 0 newly installed, 0 to remove and 8 not upgraded.     Need to get 0 B of archives. After unpacking 0 B will be used.      More error info:               E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.     E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.     E: Unable to correct dependencies     E: Unable to lock the download directory


title: When is exFAT coming to Linux?

text: It seems that exFAT is to be the next standard filesystem for removable media. The problem is, it is designed by Microsoft and made proprietary. However, it is the standard FS for the upcoming SDXC cards. Since exFAT isn't available for Linux, will it eventually get there? And if so, when? Formating removable media for Linux, Windows and Mac OS X, is really becoming a problem. There's FAT32 but the file size limit is becoming a problem as well. I was hoping that UDF will be a cross platform filesystem, especially, since the latest revisions of UDF clearly state the targeting of hard drives. Microsoft, however, doesn't seem to care much about UDF on anything else than optical media, so I guess it'll become abandoned eventually. It seems, that exFAT will take the place of FAT32, but since it's not available for Linux, I shouldn't format my USB sticks in it. Should I just wait till exFAT is available for Linux? Also, since Microsoft doesn't seem to be poised to open the filesystem for free implementations - there's licenses, etc involved - I might wait till infinity... I still use FAT32 most of the time, but there are times, where I have to use something else, due to the file size limit. I usually reformat the drives in NTFS for that purpose, but still, the constant formating back and forth is quite a hassle.


title: Flash forms don't recognize Japanese text input

text: **PROBLEM** Ubuntu Natty Input method is SCIM-Anthy Example Website http://pigg-life.ameba.jp/ When playing this or any other flash community game it is possible to switch to the Japanese input but even after switching, only English appears in the flash text input field. Why is this? How can I make it work?


title: How can I do the `history` command and not have line numbers so I can copy multiple line commands?

text: Sometimes I do the `history` command so I can see 4 commands in a row. I want to copy those commands so I can run them again. I usually select them with the mouse and shift-ctrl-c which works ok, but I also get the line numbers. How can I do `history` and not have line numbers? I tried the man page but was overwhelmed.


title: Security hurdles to enabling sources in repo

text: When I run `sudo apt-get update` I have the following output:               Hit http://mirror.transact.net.au stable Release.gpg     Ign http://mirror.transact.net.au/debian/ stable/contrib Translation-en     Ign http://mirror.transact.net.au/debian/ stable/contrib Translation-en_AU     Ign http://mirror.transact.net.au/debian/ stable/main Translation-en     Ign http://mirror.transact.net.au/debian/ stable/main Translation-en_AU     Ign http://mirror.transact.net.au/debian/ stable/non-free Translation-en     Ign http://mirror.transact.net.au/debian/ stable/non-free Translation-en_AU     Hit http://mirror.transact.net.au stable Release                  Hit http://mirror.transact.net.au stable/main amd64 Packages     Hit http://mirror.transact.net.au stable/contrib amd64 Packages     Hit http://mirror.transact.net.au stable/non-free amd64 Packages     Get:1 http://www.debian-multimedia.org squeeze Release.gpg [198 B]     Ign http://www.debian-multimedia.org/ squeeze/main Translation-en     Ign http://www.debian-multimedia.org/ squeeze/main Translation-en_AU     Ign http://www.debian-multimedia.org/ squeeze/non-free Translation-en     Ign http://www.debian-multimedia.org/ squeeze/non-free Translation-en_AU     Get:2 http://www.debian-multimedia.org squeeze Release [22.0 kB]     Ign http://www.debian-multimedia.org squeeze Release     Get:3 http://www.debian-multimedia.org squeeze/main amd64 Packages [72.8 kB]     Get:4 http://www.debian-multimedia.org squeeze/non-free amd64 Packages [3,902 B]     Fetched 98.9 kB in 3s (32.6 kB/s)        Reading package lists... Done     W: GPG error: http://www.debian-multimedia.org squeeze Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 07DC563D1F41B907      I've scoured the web but can only find esoteric solutions I cannot understand. Is there a way to bypass the security feature blocking it without engaging in esoteric commandline?


title: tcp/ip - trigger action or event after period of no network activity on certain port(s)

text: Is it possible, perhaps using iptables or one of the wrappers/frontends to iptables, to trigger an action or run a script after a certain period of time has elapsed with no network activity on a certain incoming tcp or udp port? To put it as simply as possible, I'm trying to set up a host that will suspend/hibernate itself, shut itself off, shut off certain services or just generally perform some kind action if certain servers running on it go idle. However, the host will need to run arbitrary server applications listening on arbitrary ports, so I can't configure this at the application level. I'm thinking along the lines of how the Heroku and Google App Engine platforms will stop applications if they go idle long enough, but with arbitrary server applications rather than just a web server.