title: sshfs will not use ~/.ssh/config (on Linux Mint 15)

text: Local:         Linux Mint 15 - Olivia     /proc/version: Linux version 3.8.0-19-generic (buildd@allspice) (gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1) )     ssh -V:        OpenSSH_6.1p1 Debian-4, OpenSSL 1.0.1c 10 May 2012     sshfs -V:      SSHFS version 2.4                    FUSE library version: 2.9.0                    fusermount version: 2.9.0                    using FUSE kernel interface version 7.18          Remote:        Ubuntu 12.04.3 LTS     /proc/version: Linux version 3.10.9-xxxx-std-ipv6-64 (kernel@kernel.ovh.net) (gcc version 4.7.2 (Debian 4.7.2-5) )     ssh -V:        OpenSSH_5.9p1 Debian-5ubuntu1.1, OpenSSL 1.0.1 14 Mar 2012      I'm trying to set up a password-less mount of a remote server using sshfs and fuse. The remote server is running on a non standard port and I will be using a ssh key pair to authenticate. When successful I will be repeating this for three more remote servers each with different keys so I do need to be able to specify which key maps to which remote server. I based my modifications off this tutorial   * The public key is in remote:authorized_keys   * I have added my local user to the `fuse` group.   * I have edited my local `~/.ssh/config` to have (per server): `               Host [server_ip]       Port = [port]       IdentityFile  = "~/.ssh/[private_key]"       User = "[user]"      ` Whenever I try to mount the remote server locally I get prompted for the remote user's password (not my private key's password). The remote user has a long randomly generated password that I'd like to not have to save or remember and so keys is how I want to do this. I can connect through ssh (combined with the `~/.ssh/config` file) using the command `ssh [ip]` so I know that the config file can be read correctly as I am asked for my key's passphrase not the remote user's. To even attempt to connect to the remote server I have to manually specify the full connection details in the command: `sshfs [user]@[ip]:[remote_path] [local_path] -p [port] What I've tried so far:   * ssh-add /path/to/key (successful addition)   * Specifying `PreferredAuthentication = publickey` in ~/.ssh/config   * sshfs -o IdentityFile=/path/to/key user@ip:/ /my/mnt/dir   * sshfs user@ip:/ /my/mnt/dir -o IdentityFile=/path/to/key   * temp rename of key to default of `id_rsa`   * sshfs -F ~/.ssh/config Is there a remote or local configuration file that I'm overlooking? Some switch or option that I need to include in the call to sshfs (tried -F) to force it to read and use my ssh config? Output of `ssh -v -p [port] [user]@[remote_ip]`               OpenSSH_6.1p1 Debian-4, OpenSSL 1.0.1c 10 May 2012     debug1: Reading configuration data /home/[me]/.ssh/config     debug1: /home/[me]/.ssh/config line 2: Applying options for [remote_ip]     debug1: /home/[me]/.ssh/config line 24: Applying options for *     debug1: Reading configuration data /etc/ssh/ssh_config     debug1: /etc/ssh/ssh_config line 19: Applying options for *     debug1: Connecting to [remote_ip] [[remote_ip]] port [port].     debug1: Connection established.     debug1: identity file /home/[me]/.ssh/[private_key] type 2     debug1: Checking blacklist file /usr/share/ssh/blacklist.DSA-1024     debug1: Checking blacklist file /etc/ssh/blacklist.DSA-1024     debug1: identity file /home/[me]/.ssh/[private_key]-cert type -1     debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.1     debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.1 pat OpenSSH_5*     debug1: Enabling compatibility mode for protocol 2.0     debug1: Local version string SSH-2.0-OpenSSH_6.1p1 Debian-4     debug1: SSH2_MSG_KEXINIT sent     debug1: SSH2_MSG_KEXINIT received     debug1: kex: server->client aes128-ctr hmac-md5 zlib@openssh.com     debug1: kex: client->server aes128-ctr hmac-md5 zlib@openssh.com     debug1: sending SSH2_MSG_KEX_ECDH_INIT     debug1: expecting SSH2_MSG_KEX_ECDH_REPLY     debug1: Server host key: [key]     debug1: checking without port identifier     debug1: Host '[remote_ip]' is known and matches the ECDSA host key.     debug1: Found key in /home/[me]/.ssh/known_hosts:7     debug1: found matching key w/out port     debug1: ssh_ecdsa_verify: signature correct     debug1: SSH2_MSG_NEWKEYS sent     debug1: expecting SSH2_MSG_NEWKEYS     debug1: SSH2_MSG_NEWKEYS received     debug1: Roaming not allowed by server     debug1: SSH2_MSG_SERVICE_REQUEST sent     debug1: SSH2_MSG_SERVICE_ACCEPT received     debug1: Authentications that can continue: publickey,password     debug1: Next authentication method: publickey     debug1: Offering DSA public key: /home/[me]/.ssh/[private_key]     debug1: Server accepts key: pkalg ssh-dss blen 433     debug1: Enabling compression at level 6.     debug1: Authentication succeeded (publickey).     Authenticated to [remote_ip] ([[remote_ip]]:[port]).     debug1: channel 0: new [client-session]     debug1: Requesting no-more-sessions@openssh.com     debug1: Entering interactive session.     debug1: Sending environment.     debug1: Sending env LANG = en_GB.UTF-8     debug1: Sending env LC_CTYPE = en_GB.UTF-8     Welcome to Ubuntu 12.04.3 LTS (GNU/Linux 3.10.9-xxxx-std-ipv6-64 x86_64)      Edit:   I found the problem. I was trying to mount the remote location to /mnt/new_dir using sudo. If I mount to a location within my local home then it works. `sshfs -p [port] [user]@[ip]:/ /home/[me]/tmp/mount`. I have now done a `sudo chown root:fuse /mnt/new_dir` and `sudo chmod 774 /mnt/new_dir` and I believe that all's working as intended. Are there any security issues with this set up that I need to be aware of? (My own user and root are the only members of of the `fuse` group.


title: How to create MBR partition /dev/ nodes FreeBSD for mounting

text: I currently have FreeBSD version FreeBSD 10.0-RELEASE. Installed using a ZFS root. I'm attempting to mount a MBR partitioned drive but I can't get the partition nodes, `/dev/ada4p1`, etc. The partitions are formatted to EXT2. Is there a kernel module or command I need to run to gain access to partitions on ada4?               [root@core /mnt]# ls -l /dev/ada*     crw-r-----  1 root  operator  0x76 May  2 10:29 /dev/ada0     crw-r-----  1 root  operator  0x79 May  2 10:29 /dev/ada0p1     crw-r-----  1 root  operator  0x7b May  2 10:29 /dev/ada0p2     crw-r-----  1 root  operator  0x7d May  2 10:29 /dev/ada0p3     crw-r-----  1 root  operator  0x8b May  2 10:29 /dev/ada0p4     crw-r-----  1 root  operator  0x9f May  2 10:29 /dev/ada0p4.eli     crw-r-----  1 root  operator  0x8d May  2 10:29 /dev/ada1     crw-r-----  1 root  operator  0x98 May  2 10:30 /dev/ada1.eli     crw-r-----  1 root  operator  0x8f May  2 10:29 /dev/ada2     crw-r-----  1 root  operator  0xa1 May  2 10:30 /dev/ada2.eli     crw-r-----  1 root  operator  0x91 May  2 10:29 /dev/ada3     crw-r-----  1 root  operator  0xa2 May  2 10:30 /dev/ada3.eli     crw-r-----  1 root  operator  0x93 May  2 10:29 /dev/ada4               [root@core /mnt]# fdisk /dev/ada4     ******* Working on device /dev/ada4 *******     parameters extracted from in-core disklabel are:     cylinders=7752021 heads=16 sectors/track=63 (1008 blks/cyl)          Figures below won't work with BIOS for partitions not in cyl 1     parameters to be used for BIOS calculations are:     cylinders=7752021 heads=16 sectors/track=63 (1008 blks/cyl)          Media sector size is 512     Warning: BIOS sector numbering starts with sector 1     Information from DOS bootblock is:     The data for partition 1 is:     sysid 131 (0x83),(Linux native)         start 1, size 3906250000 (1907348 Meg), flag 0             beg: cyl 0/ head 0/ sector 2;             end: cyl 1023/ head 254/ sector 63     The data for partition 2 is:     sysid 131 (0x83),(Linux native)         start 3906250752, size 3907784704 (1908098 Meg), flag 0             beg: cyl 1023/ head 254/ sector 63;             end: cyl 1023/ head 254/ sector 63     The data for partition 3 is:     <UNUSED>     The data for partition 4 is:     <UNUSED>


title: Print an SVG from the command line

text: How can I print an SVG, already scaled to a4 size, from the command line? I tried using `lpr`, but instead the printer just printed out the actual XML of the file, which isn't what I wanted.


title: How to install pagedown editor on ikiwiki?

text: How can I install the pagedown editor on ikiwiki step by step? There are some docs about this but I don't get it what to do in detail. http://ikiwiki.info/plugins/wmd/: This points to the new pagedown plugin page but the instructions are for the older wmd thing. http://ikiwiki.info/todo/pagedown_plugin/: Here the link to the git repro seems to be down. Here is a similar question with a RTFM style answer: http://ikiwiki.info/forum/howto_install_the_pagedown_plugin/


title: Video freezes on Xubuntu 13.10 with Intel Graphics

text: I have a PC with Intel 4600 graphics and a fresh install of Xubuntu 13.10 64 bit. Any video playback causes the system to freeze up. The audio plays, but the video plays at about 1 frame per second, and the entire system become unresponsive. I am sometimes able to recover with xkill, but often have to switch to a text terminal and reboot. However, youtube video does work. I even have played video inside a Windows XP virtual machine and it works fine. I've installed the restricted Ubuntu codec package, and VLC, but they have no effect. It seems there are no Intel graphics for 13.10, and I can't find anyone else complaining of this. Any ideas? EDIT: I got video to work in a Xubuntu 13.10 VM, and then natively by turning off hardware acceleration in VLC. The system is usable in this state, however, I'd rather not have to worry about any random program crashing the system if it attempts to use hardware acceleration. Is there some way to turn off hardware acceleration globally?


title: Save image as 24 bit png

text: Is there a way to save an image as 24 bit png? I didn't manage with GIMP. Keep in mind this is pixel art so keeping the exact colors are important. I tried several things in GIMP, but it always said this:               $ file Junction.png      Junction.png: PNG image data, 160 x 60, 8-bit/color RGBA, non-interlaced      Instead of 24 bit.


title: Could a hacker replace a Bitcoin wallet application with a malicious one in some Linux repository?

text: Bitcoin QT is arguably the most popular Bitcoin wallet application. If a hacker gets access to the data and the private key on some machine, he can steal all the Bitcoins from that wallet. Being a Linux application, Bitcoin QT is updated regularly when the application in the repository is updated (For example, on `apt-get upgrade` on Debian). Theoretically, if a hacker could get into some Linux repository, he could replace the application with a malicious one that steals both the private key and the wallet file and send it to a remote server. If possible, even through social engineering, the incentive for such attack is enormous - every Bitcoin is worth well over 1100$ nowadays, and raising rapidly. For example, if the hacker could successfully steal just 10000 bitcoins, he made 10 million USD that probably could never be traced. My question is - how likely/unlikely that to happen? Example for rooted repository incident


title: Chromium 32.0.1700.19 cannot display Chinese title

text: My system is Gentoo 64bit, Chromium 32.0.1700.19. With Chromium 31, it was able to display Chinese in the title correctly. But since version 32, Chinese are displayed as blank in the title, while the Chinese in the webpage can be displayed correctly. Some old Chromium bugs says font configuration could cause this problem. But Chromium does not have a log, I cannot find which font configuration caused this problem. Any idea?


title: after adding one more physical volume and enlarging logical volume, grub fails

text: Several years ago I installed Debian on my 500 GiB hard disk. During installation I chose to have encrypted filesystem. So installer created one small unencrypted boot partition (I guess that grub configuration is kept there) and one large LUKS encrypted partition. This large encrypted partition is a physical volume, which is the only member of a volume group, on which two logical volumes are created - one for swap and one for everything else. And everything was working fine in this configuration for several years without me thinking too much about it. Few days ago I bought new 2 TiB hard drive and decided to move my system to it. I copied my old hard drive to my new hard drive - bit by bit, simple by "cat /dev/sda > /dev/sdb". After that my computer was booting fine from my new hard disk, but it was only 500 GiB large, because it had partition table copied from the old hard disk. So I tried to enlarge it. First I created new (the third) partition on it. I created physical volume on it. I LUKS encrypted this physical volume (using "cryptsetup" command), with the same password as the old partition had. I added this physical volume to already existing volume group. I enlarged already existing logical volume, enlarging filesystem sitting on it as well. I did it all using Knoppix booted from CD. I did not alter grub configuration. Then (I was still at Knoppix) I tried to mount the filesystem from these two encrypted partitions - it worked well, it was one filesystem, 2 TiB large and all files were there. Then I tried booting from this hard disk. Grub asked me for a password to a LUKS encrypted partition and then failed with these messages: ![grub errors](http://i.stack.imgur.com/FcI8B.png) In these messages we can see uuid "EFc551-(...)" - I don't know of what this uuid is. Commands that grub executes while booting are those (the photo is blurry, but I hope you can read the text): ![grub commands](http://i.stack.imgur.com/Bgczk.png) String "9e5881c3(...)" which you can see in this command is uuid of the old encrypted partition. Now I want to achieve two things:   * understand what goes on,   * be able to boot from my 2 TiB hard disk. Could you help me to achieve that two goals? * * * **Final solution** Marmarek's idea was the right one. Contrary to what I thought at the beginning, in my setup (which is, I guess, default Debian setup) grub has nothing to do with LVM. Grub boots small unencrypted boot partition and it's job of that partition's init to decrypt and mount encrypted LVM volumes. So I didn't have to tinker with grub but with initrd. Marmarek suggested to recreate it under Knoppix using update- initramfs, but it did not work. Initrd created by update-initramfs lacked /conf/conf.d/cryptroot file (my original initrd had it) and because of that it didnt try to decrypt any partitions at all. I guessed that maybe it lacked that file because when I run update-initramfs command those partitions were not unencrypted and LVM volumes were not activated? So I just unpacked my original initrd image and put into its init file such line:               cryptsetup luksOpen UUID=some-uuid udisks-luks-uuid-this-uuid      I don't know if the last argument to cryptsetup must be exactly as I gave it - I just mimicked what I saw in some examples. The line had to be put in such place inside init where /dev is already mounted - I found such place by trial and error. This was the place right afte4r the line:               run_scripts /scripts/init-top      When I packed back this modified initrd and booted my computer, it asked me for two passwords and worked well. Thanks for help!


title: Find files containing one string but not the other

text: I am in a folder with lots of .txt file, I would like to find all the files which contain `stringA`, but don't contain `stringB` (they are not necessarily in the same line). Does anyone know how to do this?


title: How to insert text after the last configuration line?

text: I have to insert a line into a configuration files automatically, but with the added caveat that it should be inserted _before_ a multi-line footer comment and any preceding empty or whitespace-only lines _if the footer exists_. That is, **the new line should be inserted right after the last configuration line** , making for a single-line diff from the original file. In pseudo-code:   1. Go to the end of the file.   2. Go backwards to the first (that is, last in the file) configuration line (that is, a line which is not empty, whitespace-only, comment only or whitespace followed by a comment).   3. Insert text after the current line. Extended regular expression for configuration line: `^\s*[^[:space:]#]` Any common *nix tools such as `sed`, `awk`, `ed` or `ex` should work. * * * Possible solutions and their problems:   * Use `tac` twice to make this into a forward-searching problem rather than backward-searching. This means I'll have to store the result in a temporary file then replace the original, rather than doing this in a single command.   * Use `sed -i` with the reversal trick. This means storing the entire file in memory.   * `ex -c '1' -c '?^\s*[^[:space:]#]?' -c $'a\nmy new line\n.' -c 'wq' /path`, which I'm also given to understand stores the full file in memory. Is there a solution which circumvents both of these issues? Example starting file:               # Universe configuration     #          pi = 3 # A good #     e = mc**2 # To within a hair          [cut 200 trillion lines]          #      # END     #      Example input:               sol { mass = 42, start = 9.2 }      Expected output:               # Universe configuration     #          pi = 3 # A good #     e = mc**2 # To within a hair          [cut 200 trillion lines]     sol { mass = 42, start = 9.2 }          #      # END     #      General-purpose function based on @StephaneChazelas's solution


title: Hide all open windows on Ubuntu 12.04 LTS

text: Is it possible to have a button on the side bar to hide every open window on Ubuntu 12.04 LTS?


title: apache not starting in vagrant vm

text: I used Puphpet.com to create a Vagrant VM to be used for web development. The problem I am having is that the VM cannot start apache on boot.               $ sudo /etc/init.d/apache2 start     * Starting web server apache2                                                   *     * The apache2 configtest failed.     Output of config test was:     apache2: Syntax error on line 36 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/authz_default.load: Cannot load /usr/lib/apache2/modules/mod_authz_default.so into server: /usr/lib/apache2/modules/mod_authz_default.so: cannot open shared object file: No such file or directory     Action 'configtest' failed.     The Apache error log may have more information.      the system is ubuntu 12, not sure what modifications I have to make to the puppet config to fix the problem.


title: Prevent linux from auto scan and mapping partitions on some disk

text: TL;DR Linux scan disk (for example /dev/sdc) and add files to address partitions on that disk (for example /dev/sdc1) - how can I tell Linux to not do that for some disk? Long story: I used VM (QEMU+KVM) to install other OS on physical HDD - "/dev/sdc" (different from host, of course). Before installation disk was cleared (all partitions removed). First installation has failed. I have stop VM and launched GParted on host and it showed warning about corrupted file-systems on that disk. I noticed that in "/dev/" appeared "sdc1" and etc. Next installation succeed, and I noticed that there was no "sdc1" and etc. Host side GParted showed warning that partitions on "/dev/sdc" is not mapped. So I came to conclusion that linux partition mapping may be reason for corrupted file-system in this case. How can I temporary disable that feature?


title: Separate .muttrc into parts

text: My `.muttrc` file is starting to get quite large. What I would prefer is to create a `~/.mutt/config` directory to store various config files for the account, status bar, composition,... etc and then source them all into my main `.muttrc` file. How do you do this?


title: Debian Log In Failure With Correct Password

text: So I have a Debian distro at home (considering getting ubuntu), and I can't login. When I use the correct password is does this thing where it makes it look like it's going to login, and then it redirects to the login screen, but when I use an incorrect password it says "authentication failure". Does anyone know what could be causing this?


title: How to install xfontsel on Fedora 13? Any alternative?

text: I need xfontsel to select right font for xterm. But its not installed. I tried `yum` but it returned > Warning: No matches found for: xfontsel   >  No Matches found I googled for xfontsel source code to compile myself but didn't get any link for that.   1. How can I install xfontsel on Fedora 13?   2. Its not installed by default and neither it is available in `yum` repo. So does this mean Fedora will not include it anymore? Why?   3. Any alternative to xfontsel? I tried `xlsfonts` but it does not give preview of fonts. Thanks for your time and help. ## Edit               $ su -c "yum install xorg-x11-apps.i686"      This did the trick on my Fedora 13.


title: Save complete GNU screen session state

text: Is it possible to persist the "state" of a GNU screen window (or just a standard shell) so that I can reload everything after a reboot:   * The number of opened shells   * The name of each shell   * The current directory of each shell   * The history of each shell   * If possible, their environment variables


title: Move every file that is not a directory

text: I have a directory that I am trying to clean out that contains both files and subdirectories. What I am trying to do is simple: move all the files into another directory, but leave all the sub-directories as they are. I am thinking something like:               mv [*_but_no_dirs] ./other_directory      It seems like there should be a simple way to do this with wildcards `*` and regex... Anyone have ideas?


title: How to have multiple/several lines of window list in the GNOME 2panel?

text: How can I have several lines for the window list? I have to keep open many- many applications, and I need to know their name. E.g. on Windows: ![enter image description here](http://i.stack.imgur.com/1MK3F.png)


title: How to echo a bang!

text: I tried to create a script by `echo`'ing the contents into a file, instead of opening it with a editor               echo -e "#!/bin/bash \n /usr/bin/command args"  > .scripts/command      The **output** : > bash: !/bin/bash: event not found I've isolated this strange behavior to the bang.               $ echo !     !            $ echo "!"     bash: !: event not found          $ echo \#!     #!          $ echo \#!/bin/bash     bash: !/bin/bash: event not found        * Why is bang causing this?    * What are these "events" that bash refers to?    * How do I get past this problem and print "#!/bin/bash" to the screen or my file?


title: Fonts in chromium

text: (no, it isn't this) My bold fonts are completely deformed in some sites (mostly SE) in chromium. I have had this issue for a while on two Arch systems, but not in Ubuntu. Here is an example from a question I was viewing (getting carried away again ...): ![enter image description here](http://i.stack.imgur.com/8FR1b.png) As you can see, some letters are bigger than others, and it generally looks a mess. I tried messing with the chromium fonts, but it seems the problematic SE sites have their own fonts they want, which overrides chromium's settings. What is going wrong? Is this some kind of extreme hinting that totally malforms the letters? Or is there something I ought to install? Come to think of it, what font is it? The only fitting fonts I have installed are Helvatica (Neue) and Nimbus Sans.


title: Virtualbox under Proxmox

text: On a Jenkins Master-Slave configuration and need to run on the slaves Kitchen tests on several jobs. Kitchen for those who do not know it, runs infrastructure on demand using Vagrant and VirtualBox (in my case). Master and slave are both under Proxmox, so my questions is: is there a sane way to get running VirtualBox inside an OpenVZ container?, is there any workaround I can do to achieve this? I just don't want to create a physical node to run this kind of jobs.


title: VAAPI or VDPAU which one is a newer Tech?

text: I wanted to compile a variant of mplayer and came across these options: `VAAPI` `VDPAU`. I once read somewhere that one of these is for the newer graphic cards (like new gforce GT) and overlaps the other. Or I am totally wrong and they are different technologies for different hardware?


title: trying to open console on LCD using fbcon and USB keyboard

text: I'm trying to bring up virtual terminal on our embedded system's LCD using USB keyboard which is also connected to the system. I have UART connection to my PC so I've been using UART for console till now but I want to switch to framebuffer console on LCD during the boot at some point.. The USB host controller seems to work fine because I've seen USB memory is attached, read and written ok. And when I connect a keyboard and print the events at keyboard_event function, it prints events that seem normal and corresponding to my action(type of key, press or release..) I have a feeling that it's a configuration problem. In init/main.c, there is   `run_init_process(ramdisk_execute_command);`   (In my case, ramdisk_execute_command = "/sbin/init") And this immediately calls   `kernel_execve(init_filename, argv_init, envp_init);`   // above, init_filename and argv_init are "/sbin/init" same. I expect busybox to run after this (ramdisk had been installed before by a bootloader-like part). But I cannot see any prints on the LCD after this point. But I can see printks on the LCD until just before calling kernel_execve above. I'm using Linux 3.3. I understand I have to open a frame buffer console on LCD and connect it to a tty but I don't know how. Below are printed the current relevant settings. (In serial UART connection case, Linux boots ok up to the final busybox shell prompt printing things in busybox initialization after kernel_execve call. And `#cat /proc/fb0` returns 0 for your info. Only LCD/framebuffer console mode stops after kernel_execve.)               #### arch/sparc/boot/ourprocessor/prom_stage.c : #####     // "console=ttyS,mmio,0xff003000,115200n8 "        <== serial port case     "console=tty "                        <= frame buffer console case (below line too)     "fbcon=font:SUN8x16,map:0000 "               <= Is this boot argment correct?..          #### sbin/init: #####     #!/bin/busybox sh     export LD_LIBRARY_PATH=/lib     export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/mnt/nand/lib          exec /bin/busybox init     ### rcS #####     mknod /dev/tty0 c 4 0 <== Do I need to explicitly make tty0 and tty1 like this?     mknod /dev/tty1 c 4 1     mknod /dev/tty2 c 4 2     mknod /dev/tty3 c 4 3     mknod /dev/tty4 c 4 4          ### .config #####     CONFIG_FRAMEBUFFER_CONSOLE=y <= LCD/framebuffer console case. Otherwise none.     CONFIG_FONT_SUN8x16=y     CONFIG_LOGO=y      By the way, I'm not using /etc/inittab.(so use default init). The busybox init/init.c code says if there isn't the inittab file and console is not the serial port, it runs   `tty2::askfirst:/bin/sh`   `tty3::askfirst:/bin/sh`   `tty4::askfirst:/bin/sh`   (starting shell on tty 2, 3 and 4) then How do make tty2's shell appear on the LCD/framebuffer/framebuffer console? It's confusing and books are not so kind.


title: Is it possible to control window management in Gnome Shell using D-Bus?

text: I would like to programmatically be able to communicate with the Window Manager in Gnome 3, using D-Bus. The tasks I would like to accomplish are:   * listening for new windows    * get window flags (e.g. skip pager flag)   * get X window IDs    * maximise, minimise windows   * raise, lower windows   * hide windows The aim is to create an task-bar-like application.  I know of tools such as xdotools or wmctrl, but those are very thorough tools: there are no listeners to find out if new windows have been instantiated / mapped, the latte works with window title strings. I also tried using python-xlib, but lack of documentation or too technical documentation have made it very difficult to achieve anything. It seems D-Bus would be appropriate for such actions. Can I use D-Bus to do this, is there a way to do this using Python? Could you provide examples?


title: Poorly performing java application vs poorly performing server

text: This is a very generic question, but it has been coming up more and more often for me. I would like to try and determine an appropriate course of action for this generic case, as I think it could benefit me and other sysadmins in the future. The commonality in all cases though is java. The reason I am asking this question here rather than stack overflow is that this is a sysadmin question. I think it is very appropriate here. A user comes up to me and says "My application is very slow. The server you gave me has poor performance." This server could be bare metal, OpenVZ, or KVM. In all cases, OS is CentOS 6. When the user tells me this, they are referring to page load time (JIRA) or benchmark numbers. (Selenium or proprietary app) Now, I have a sneaking suspicion that the server itself is fine. I ssh onto the server, and notice that the load is less than 1. Memory usage is fine as well, ranging anywhere from 2-20 gigs of ram free. Finally, I check iowait with vmstat, and notice that it is 0. cpu idle is 99. Looking at java with top, I can see that cpu percentage is around 200% or so for that process. This is on systems with anywhere from 4 to 24 cores. (Of course, openvz does processor allocation different from KVM or bare metal.) In the cases that this occurs on an openvz or kvm guest, I hop onto the host as well, and see similar things. cpu idle is 99%. iowait is 0. memory is sometimes hundreds of gigs free. I have looked at these java processes and threads with strace, and strace -f. There are tons of futex, clock, and epoll. If I reverse grep those, I'm left with mostly ioctl, stat, sendto. Applications where this has happened: Selenium, JIRA, and misc proprietary java applications. Always java though. I have considered tuning the niceness of the java processes, but AFAIK niceness will only affect how processes are scheduled. If the load is low, it won't help to speed things up. Sometimes the application uses mysql, but looking at mysql in top shows almost no cpu usage there. I'm guessing that if that was the bottleneck, we would see higher cpu usage. Bottom line: How do I prove to the user that the server works just fine, but their application sucks? Theoretically, the application could be slow because it encountered a while loop that will never exit. Which leads me to believe that this task is impossible, analogous to solving the halting problem. o_O But perhaps I can tune java to behave a bit better, or perhaps there is a way to profile the running application, point to a chunk of code and say "There's your problem". Thanks!!


title: How can I know when a cron job was killed or it crashed?

text: Usually when a cron job crash, it will leave some error messages in the log. We run shell script and some java program with cron job. Recently we found some weird thing out from the log. Obviously the program was either crashed or killed because there is a program lock we set when the program was initialed, which was not released. We guess the program was killed because the log of the program didn't show the finish message. Who can possibly killed the job and how can I get notified through email when a cron job is dead? EDIT: I don't want the crontab way to receive email because it just push every standard output to the email. In my case there are a lot of other system output from different program because some of them ain't using log4j or they are echo by shell script. Because there are many users in the system, we can't require all the users to manage their program's standard output.


title: Default settings for VirtualBox machines?

text: How can I change the default settings of virtual machines that are created by VirtualBox? I don't need any floppy devices or sound enabled by default.


title: How to get the name of the user who executed a bash script as sudo?

text: I want to create a bash script that must be executed with sudo but should take into account the name of the non sudo user who executed it. So if user `bob` runs `sudo ./myscript.sh` I would like `myscript.sh` to know `bob` was the one who executed it. Let's look inside `myscript.sh`:               USER=$('woami')     # do something that takes into account user name      How can I know the name of the user who spawned the process? More specifically, what should I use instead of `whoami` to get `bob` and not `root`?


title: State/Toggling variables in tmux

text: I was wondering if there is a way of defining a state variable in ./tmux.conf, such that depending on this variable, the keyboard binding would invoke a different command. For example, I would like to use `M-F` to toggle the maximization of a pane in tmux (if the pane is not maximized, M-F would maximize it, otherwise it will unmaximize it) Here is the pseudo-code that I have so far:               # Maximize pane: -------     # IF PANE_MAXIMIZED=False:      # THEN: PANE_MAXIMIZED=True, and:     bind -n M-F new-window -d -n tmux-zoom  \; swap-pane -s tmux-zoom.0 \; select-window -t tmux-zoom          # Unmaximize pane -------     # IF PANE_MAXIMIZED=True:      # THEN: PANE_MAXIMIZED=False, and:     bind -n M-F last-window \; swap-pane -s tmux-zoom.0 \; kill-window -t tmux-zoom


title: How to scp with regular expressions

text: I'm trying to copy all files that do not begin with the letter "a", in ksh. Copying from the source machine to destination machine is _working fine_ : `scp -p !(a*) user@machine:/path/directory/.` But, if I am on the destination server and want to copy from the source server, is failing: `scp -p user@machine:/path/!(a*) .` Any ideas?


title: How to benchmark RAM memory with a Linux Distro?

text: I' ve just bought new RAM and I'd like to benchmark and compare with my old. How can I do that?


title: Bash script; optimization of processing speed

text: I was wondering if there are general guidelines for optimizing bash script. a) For example, it is more _convenient_ to write loops than lines of commands, but is it also _faster to process_ for the system? Example:               for i in a b c; do echo $i; done          echo a     echo b     echo c      b) Sometimes people present different solutions for the same problem. For example, sed, cut, awk, and echo are all able to strip digits from a string. I was wondering if you can say that the less digits a code has, the faster it is if you use: i) the same command, e.g.               STRING=abc.def     echo ${STRING} | sed 's/.def//g'     echo ${STRING} | sed '$s/....$//'      ii) different commands, e.g.               STRING=abc.def     echo ${STRING} | cut -d . -f 1     echo ${STRING} | sed 's/.def//g'


title: Can one move a relpath in one command?

text: This question is similar to one I asked recently, but the answers to that question, for the most part, do not extend to this one, AFAICT. The main difference between the two questions is that the earlier one was about copying while this one is about moving. Also, that earlier question was unnecessarily specific by referring to the relative path to a _file_. In this question I've removed this overspecificity. I find myself doing this often enough that I wonder if there's a standard Unix way to do it:               % mkdir -p /TARGETDIR/relative/path/to     % mv ./relative/path/to/x /TARGETDIR/relative/path/to      In other words, I don't want to just move `somefile` to `/TARGETDIR`, but actually I want to "move" (so-to-speak) its entire _relative path_. I know that I can write a shell function or a script to achieve the same effect, but I'd like to know if there already exists a way to do this with a single command?


title: How rename directories tree entry by entry

text: I have text file contain two columns:               current directory name                               the new name of the last entry          d_7154/d_7161/                                       'Main Integration'     d_7154/d_7161/d_9247/                                'Flows & Methodologies'     d_7154/d_7161/d_9247/d_8986/                         'General Guidelines'     d_7154/d_457/d_691/d_705/                            'Projects T to Z'     d_7154/d_457/d_691/d_6056/d_11253/d_11254/           'Templates'     d_7154/d_457/d_691/d_6056/d_11253/d_11254/d_11255/   'General Templates'     d_7154/d_457/d_691/d_6056/d_11253/d_11254/d_11256/   'Team Template'     ...     ...      Is there a recipe to rename the tree? The main problem that if I change name of directory on middle of the tree the rest of list become not relevant.


title: Slow sudo because of socket connections

text: Some time ago sudo started to behave very slow on our server. Some times we have to wait even a few minutes until it executes. I've checked all hostname and dns causes that forums all full of, but the problem still persists. I can confirm, that server names are resolved properly on this server. Debugging sudo with strace gives this interesting results:                0.000080 open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 3      0.000153 lseek(3, 0, SEEK_CUR)     = 0      0.000044 fstat(3, {st_mode=S_IFREG|0644, st_size=1809, ...}) = 0      0.000060 mmap(NULL, 1809, PROT_READ, MAP_SHARED, 3, 0) = 0x7f91b3dd3000      0.000042 lseek(3, 1809, SEEK_SET)  = 1809      0.000057 munmap(0x7f91b3dd3000, 1809) = 0      0.000038 close(3)                  = 0      0.000077 getgroups(0, NULL)        = 1      0.000039 getgroups(1, [0])         = 1      0.000045 getcwd("/home/myself", 4096) = 12      0.000053 ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0      0.000184 fstat(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 6), ...}) = 0      0.000111 readlink("/proc/self/fd/0", "/dev/pts/6", 4095) = 10      0.000095 stat("/dev/pts/6", {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 6), ...}) = 0      0.000079 uname({sys="Linux", node="OUR-SERVER", ...}) = 0      0.000072 ioctl(2, TIOCGWINSZ, {ws_row=65, ws_col=205, ws_xpixel=0, ws_ypixel=0}) = 0      0.000055 socket(PF_NETLINK, SOCK_RAW, 0) = 3      0.000044 bind(3, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 0      0.000042 getsockname(3, {sa_family=AF_NETLINK, pid=43381, groups=00000000}, [12]) = 0      0.000042 sendto(3, "\24\0\0\0\22\0\1\3T\373\206S\0\0\0\0\0\0\0\0", 20, 0, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 20      0.418298 recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"$\2\0\0\20\0\2\0T\373\206Su\251\0\0\0\0\0\3\0\3339\0\321\0\1\0\0\0\0\0"..., 4096}], msg_controllen=0, ms      0.000160 recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"\340\3\0\0\20\0\2\0T\373\206Su\251\0\0\0\0\376\377\0\2639\0\321\20\1\0\0\0\0\0"..., 4096}], msg_controll      ...      And the last 2 recvmsg lines a repeated about 4000 times!!! This 4000 socket receives are responsible for this slow down (notice the time on the first call - and these are only the first 2...). Our server is ubuntu 12.04 with sudo 1.8.3p1. I've even examined the sources of this sudo version, and these socket calls are not there... Please help :)


title: Run SSH SOCKS5 proxy on system startup

text: I want to setup a linux server (Ubuntu Server 14.04 in this case) to be used as a SOCKS5 proxy by software on another client. Now this is pretty easy by running `ssh -f -N -D 0.0.0.0:1080 localhost` as explained by this guide. This works perfectly. Now what the guide isn't telling me is how do I automatically start the proxy on system startup? Just entering this command into `rc.local` isn't working because I have to provide a passphrase. Generating a ssh key with `ssh-keygen` and putting it into `/root/.ssh/` doesn't work either. Be noted that I don't really understand how the whole ssh public key thing works, so my error might lie there. Anything special I have to do when my public key is supposed be used for the local client and not a remote client?


title: Configuring setcifsacl to use local posix user instead of SID for CIFS share on Linux

text: I have a CIFS filesystem (from a NetAPP) mounted on a Red Hat 6 server using cifs_utils, and am sharing some directories from the CIFS filesystem out over HTTPS via WebDAV. I need to set some ACLs on the directories so that the local Apache user can access the files on behalf of the users who are accessing the share via WebDAV, but when trying to use setcifsacl from the cifs_utils package, it seems to expect an SID, and doesn't recognize the user apache, or the apache user UID (48). The man page doesn't give much information. Any suggestions? I am mounting the CIFS mount RW already. Mounting with the cifsacl option actually makes things worse, as files are stripped of all permissions (ls -la shows --------- for a file).


title: How to use grep to find all instances of one .txt file in another?

text: How would I use grep to compare if any line from one .txt document occurred in another? Further how would I use grep to find out the opposite? Would it be `grep -v`?


title: How to add a progress bar to cryptsetup luksFormat?

text: Example command.               cryptsetup --hash sha512 -c aes-xts-plain64 --key-size 512 luksFormat /dev/loop0      This can take quite a while for big files / on slow disks. How to add a progress bar?


title: execute shell script options

text: I typically use `cd Directory/Directory/` to point to the shell directory and then type `bash shell.sh`, but I was wondering if there is an easier way to execute my shell & the location with one line? I do bounce to different folders often. Example: unix folder with a shell script named alpha               cd Desktop/unix     bash alpha.sh


title: Changed to Nvidia xorg driver - now I have less temperature sensors?

text: I've just installed Debian Wheezy 7.5 on a Toshiba Satellite P100 laptop. By default, X was using the nouveau graphics driver. While this was still installed, I was getting 6 different temperature readings from lm-sensors. Here's an example of the output, I had:               acpitz-virtual-0     Adapter: Virtual device     temp1:        +50.0°C  (crit = +104.0°C)          coretemp-isa-0000     Adapter: ISA adapter     Core 0:       +52.0°C  (high = +100.0°C, crit = +100.0°C)     Core 1:       +52.0°C  (high = +100.0°C, crit = +100.0°C)          lm99-i2c-2-4c     Adapter: nouveau-0000:01:00.0-2     temp1:        +49.0°C  (low  =  +0.0°C, high = +85.0°C)                            (crit = +85.0°C, hyst = +75.0°C)     temp2:        +64.9°C  (low  = +16.0°C, high = +101.2°C)                            (crit = +101.0°C, hyst = +91.0°C)          nouveau-pci-0100     Adapter: PCI adapter     temp1:        +39.0°C  (high = +100.0°C, crit = +110.0°C)      However, the temperatures were much higher than above. The lm99/nouveau temp2 was hitting 95c while the computer was idle. And some others were in the 60c-70c range. The laptop felt quite hot. So I then installed the binary nvidia drivers hoping this might lower the temperature of the system. However, now when I look at lm-sensors, I only get three readings:               acpitz-virtual-0     Adapter: Virtual device     temp1:        +49.0°C  (crit = +104.0°C)          coretemp-isa-0000     Adapter: ISA adapter     Core 0:       +51.0°C  (high = +100.0°C, crit = +100.0°C)     Core 1:       +51.0°C  (high = +100.0°C, crit = +100.0°C)      I'm concerned that I can't see the extra readings I had before, so I can't be sure the system still isn't running hot. Anybody got any ideas how I can check, or anything I can look at? I've tried running the sensors-detect script, it added a couple of modules, but I still only get the three readings. Thanks.


title: Battery low custom rule (hibernation)

text: I love to abuse my laptop battery by using my laptop for quite some time (up to 25 minutes) even after the battery meter hits 0%. However, sometimes I forget about that or I am just away. This causes hard shutdown, which holds the potential to corrupt the filesystem. What is the best way to tell the computer to automatically hibernate 15 minutes after the battery reports it's empty? My idea is to write a Ruby or Bash script that would periodically poll the appropriate `/proc/` subystem, but I'm wondering whether there is anything in-built.


title: ARP request with wrong IP address

text: I have a strange problem with a Linux router. The setup is like this:               host1   ===  Linux router   ===   host2     a.b.c.d --- a.b.c.e/g.h.i.j --- g.i.h.k      Every five minutes host1 tries to reach host2. If host2 is down, the Linux router makes an ARP request for a.b.c.d on the left network with address g.h.i.j (i.e. from network on the right side). After receiving the MAC address from host1 the router sends an ICMP-unreachable packet with g.h.i.j as sender address. If host2 is up, everything is fine. The router makes the ARP request with its address a.b.c.e. On the router I have               $ uname -a     Linux pfc 3.6.9-voyage #1 SMP Tue Dec 11 09:53:27 HKT 2012 i586 GNU/Linux      There is no proxy_arp involved. The problem is: in my eyes the route should not use the IP address from the right hand network for the ARP request. Or am I missing something here?


title: What exactly is an environment variable?

text: I know that `VARIABLE=value` creates an environment variable, and `export VARIABLE=value` makes it available to processes created by the current shell. `env` shows the current environment variables, but where do they live? What comprises an environment variable (or an _environment_ , for that matter)?


title: xargs loop with input variable for use in multi-command

text: I have a text file with various IP addresses. I would like to cycle through each, and issue a command:               cat ips.txt | xargs -L 1 `ssh me@__IP__ echo "text" > file; reboot;`      But I'm unsure how to pass the xargs value to **_ _IP_ _**. Could someone explain how this could be accomplished?


title: "wpa supplicant: No network configuration found for current AP" - carl9170-driven wifi adapter glitching on Debian 7

text: I've got a Debian 7 machine with Linux3.2 kernel and a USB wifi adapter with Atheros chipset (D-Link DWA-16 Xtreme N Dual Band), which in theory should work. Indeed, I managed to establish a wifi communication with NetworkManager and it worked more or less fine for ~30 minutes, but then disconnected and failed to reestablish the connection. I failed to reestablish the connection with NetworkManager, it successfully associates and authenticates, starts 4-way handshake, but then deauthenticates due to reason 15 (4-way handshake timeout). Then I tried to do the same via the good old `ifupdown` by creating an entry in `/etc/network/interfaces`:               allow-hotplug wlan1     iface wlan1 inet static            wpa-ssid MyNet            wpa-psk <My key hash generated by `wpa_passphrase MyNet key`>            address 192.168.1.2            netmask 255.255.255.0            broadcast 192.168.1.255            gateway 192.168.1.1            dns-nameservers a.b.c.d      When I `sudo ifup wlan1`, it behaves reasonably, until:               wpa_supplicant[8258]: wlan1: Associated with <router's MAC>     wpa_supplicant[3402]: wlan1: No network configuration found for the current AP      (from `/var/log/syslog`). `Wireshark` sees ARP packages going from my wifi adapter to the router, but the router doesn't reply. Do you have any ideas about what could that mean and how to troubleshoot this? **SOLUTION:** Thanks to suggestion by peterph, I tried to create `wpa_supplicant.conf` and run `wpa_supplicant` as a standalone program both in foreground and background and then used `wpa-conf wpa_supplicant.conf` in `/etc/network/interfaces`.               sudo wpa_supplicant -iwlan1 -c/etc/wpa_supplicant/wpa_supplicant.conf -d     sudo wpa_supplicant -iwlan1 -c/etc/wpa_supplicant/wpa_supplicant.conf -B      I had the first part of troubles (with spontaneous disconnect after "status: associated") disappear, when I killed a running instance of `NetworkManager`. It seems to have interfered. Second part of trouble was with the 4-way handshake failing. It passed ok, when I disabled MAC address filtration on the Access Point. My wifi interface's MAC was in the list of available MACs, but for some reason it still was failing to connect with MAC filtering on the router. **UPDATE 2:** The problems are back. 4-way handshake is failing again. Reload of the driver won't help.


title: Arch DVD colours

text: On my Arch machine, I wanted to play the DVD Skyfall. It opened with VLC, and everything worked, except that everything was a bit greenish. Why is that happening? Dragon player isn't better either. The odd thing is that, when I tested other DVDs, it worked. Skyfall also had no problems on my PowerBook, with Mac OS 10.5. This is a bit of an odd question, but I don't understand why that should happen.


title: Why my dconf-editor has fewer options in Elementary OS Luna than supposed to?

text: I am giving Elementary OS a try but trying to configure it a bit I see lesser options than supposed in dconf-editor. Following this source, they should look like this: ![enter image description here](http://i.stack.imgur.com/tJ0OM.png) Mine look like this: ![enter image description here](http://i.stack.imgur.com/ESOxb.png) So, I can neither follow the instructions from here. Why is that? Is this related to the latest release? A remedy?


title: Simulating READLINE_LINE in Bash < 4.0

text: I am trying to make some of my code bash 3.X compatible and I have a key- binding that utilizes READLINE_LINE inside its callback function. 3.0 versions of Bash don't supply the READLINE_LINE, so I need an alternative way to get at the currently typed, but unexecuted line. I think I need some simple code (C hopefully) to grab the currently typed but unexecuted command from a Bash terminal and print it out to stdout (I'll capture it from there). My function will then manipulate it and then put it back (I can do this already) I've explored Readline, and looked at command completion neither of those seem to be what I need. I've spent many hours reading about tty and readline and am at my whits end, the command is on the terminal so it must exist somewhere, right?


title: How does system know where the first logical disk starts?

text: I'm trying to understand the ms-dos partition table, and there's the following diagram: ![screen](http://i.stack.imgur.com/wm7Fo.png) It comes from this site. Almost everything is pretty clear to me, but there's one thing I don't get. As you can see, the third partition is an extended partition, and it has several logical disks. The extended and primary entries in MBR look the same. Both have partition type, starting sector and number of sectors which describe the partitions.   * Where is the info that would link to the first EBR on the extended partition?   * How does the system know what to look for on the extended partition? Let's say that we've lost the extended entry in MBR. How to restore it? If I create a new extended entry via fdisk, it won't see the logical disks. How to connect the first EBR to the extended entry in MBR?


title: Migrate Ubuntu to bigger HDD

text: I have a multi-boot system and want to push my Ubuntu installation to a bigger partition on the **same** hdd, because I want the system to have more memory available. What I know so far is I can clone with `ddrescue` using following command.               sudo ddrescue -v --force /dev/sda_old /dev/sda_new      Is that all I have to consider? Does `ddrescue` do the filesystem formatting or do I have to do it manually? Of course after the whole process I have to set my bootloader with               sudo grub-mkconfig    # for creating the grub config file     sudo update-grub      # for saving the new config file


title: Editing a Java properties file with Bash

text: I have the following Java properties file that is maintained by humans.               # file.input = /very/old/name     # file.input = /old/name     file.input = /current/name     file.input.default = /default/name     other.file.input = /current/other/name     # Other comments     other.properties = must stay the same      I must create a script that will edit this file without touching at all at the rest of the files. Therefore I cannot dump new properties in the config file. Humans will often copy/paste a line and comment it for further use. My application must edit exclusively config file without touching any of the comments. In this particular case, I want to edit the line `file.input` to set the value to `/new/name` without any commented line being touched and without any other properties being touched as well (`file.input.default`, `other.file.input`). My script will not keep the current line for history purpose like humans usually do. Also, I don't know the current value set to the key `file.input`. Where am I stuck? At the very beginning. I'm not a Bash expert, I rarely use it except to call commands in sequence and I use some ifs sometimes. But that's all. I could use `perl` to use regular expressions, but perl is apparently not installed on this system. So I turned to `sed`, in turn, but I don't get any of this: it seems I can only replace a specific value to another. I could wrap that in the reading of the file, and rewrite it except for the expected line that I could change. Also, I would barely be able to handle human-added spaces in front of the property I want to change. So if you have an alternative please share it, because I start to become alienated.


title: Xorg: multiple keyboards, one configuration

text: On my laptop, I tweak some keybindings and keyboard preferences with `xmodmap` and `xset`. When I plug an external USB keyboard, the configuration for that new keyboard is the default, i.e., without my tweaks. If I `xmodmap` and `xset` again, then these preferences are applied to the newly plugged keyboard too, but on pluging/unpluging, they are again reseted to the default. Note that the pluging/unpluging never affects the configuration of the laptop keyboard, which stay tuned during the whole process. **Question:** How can I have _one_ xmodmap and xset preference set, which applies to any keyboard (plugged now and in the future). _Configuration_ : Arch Linux on 3.1.1 kernel, Xorg 1.11.2 with no homemade configuration, window manager: awesome 3.4.11, no kde or gnome stuff Thanks!


title: Using umask to set group permissions

text: A long time ago an old friend showed me a way to use an octal or hex umask with a group I think using `/etc/profile`. I'm not sure. I'm trying to create group on Debian so that every member of that group when creating a file will produce a file with default permissions `665`. And when creating a directory it will have default permissions `775`. What are some ways to do this for a group setting? Thanks


title: How to install aMSN on Scientific Linux?

text: I can't find aMSN in the Scientific Linux 6 repositories.. How can I install it?


title: Difference between UUID from blkid and mdadm?

text: Can someone explain the difference between the UUID's reported by `blkid` and `mdadm`? On one of our CentOS systems, for example:               [root@server ~]# blkid | grep /dev/md1     /dev/md1: UUID="32cb0a6e-8148-44e9-909d-5b23df045bd1" TYPE="ext4"          [root@server ~]# mdadm --detail /dev/md1 | grep UUID     UUID : f204c558:babf732d:85bd7296:bbfebeea      Why are they different and how would we change the UUID used by `mdadm`? I understand we would use `tune2fs` to change the UUID for the partition (which would change what is returned by `blkid`) but not sure how to change what `mdadm` uses.


title: Stream audio from Linux to Raspbmc

text: I'd like to stream audio (mainly Spotify) to my Raspberry Pi. I am running Fedora 19 and Raspbmc is running on the Raspberry Pi. I'd like to stream wireless. My first thought was to use AirPlay, as XBMC already supports it. However, they are using v2 which does not seem to work with Shairport, which seems to be the only solution to stream from my Linux laptop. I am open to use another protocol than AirPlay. However, I would very much like it to be integrated with XBMC. Is there some solution to achieve this? Bonus would be if I also could stream video.


title: reasons for a dd image of an almost-empty drive not be small after gzip

text: i just cleaned a 50GB partition with `dd if=/dev/zero of=/dev/sda1` then added some data to it (actually installed a linux distro) some 3Gb on ext4. and decided to make a image. `dd if=/dev/sda1 | gzip -9 > sda1.dd.gz` and to my surprise, that file has 45GB! my thinking would be that the this file would have some 4GB as most of the size would be tailing zeros that `gzip` would take care of. where am I wrong? anyway to check how back the fragmentation is after the add- data step? Also, if it is fragmentation, any way to fix it? i'm now writing /dev/zero to a file until the drive is full...


title: Read non-bash variables from a file into bash script

text: My bash script needs to read the variables from a text file that contains hundreds of variables, most of which conform to standard bash variable sytax (e.g., `VAR1=VALUE1`). However, a few lines in this file can be problematic and I hope to find a simple solution to reading them into bash. Here's what the file looks like:               #comment     VAR1=VALUE1     VAR_2=VALUE_2     ...     VAR5=VALUE 5 (ASDF)     VAR6=VALUE 6 #a comment     VAR7=/path/with/slashes/and,commas     VAR8=2.1     VAR9=a name with spaces     VAR_10=true     ...     VAR_N=VALUE_N      The rules about the file structure include :   * one variable (with value) per line   * the assignment (=) has no spaces around it   * the variable name is in the first column (unless it is a comment line)   * comments can follow the value (after #)   * the values can include spaces, parens, slashes, commas and other chars   * the values can be floating point numbers (2.1) or integers or true/false or strings.   * string values are not quoted, and they can be a thousand chars long or longer   * the variable name contains only letters and underscores UPDATE: **and numbers**. Most of the variables are of a type that would just allow me to source the file into my bash script. But those few problematic ones dictate a different solution. I'm not sure how to read them.


title: Possible problems in moving linux disks from one hardware to another

text: I currently have a server collocated in a datacenter. The hardware is a HP dual quad core xeon with 16 Gb DDR2 and 2 1Gb disks in raid1. I want to order another similar server to have as a replacement, if the first server has a hardware issue I can just move the disks to the replacement and not lose time debugging the hardware problem while the server is down. The problem in this situation is that I can't find the exact same hardware to buy as a replacement so I will have to buy something similar. My question is, what problems can I face when moving the disks to the new hardware, can I encounter any driver issues or something similar or it should work without a problem as long as the cpu architecture is the same (intel xeon x64) ? Thank you.


title: How to list all present optical drivers?

text: How can I list all the installed optical drivers with _udev_ or any other core-based tool (perl is also very good) ? P.S.: I know about the `wodim --devices` command, but it's an undesirable dependence.


title: Is a command's stdout to the terminal being logged?

text: I am interested in learning whether a command's output to the terminal is logged somewhere. Since that can be a bit too generic, what about `cat` (and `ccat`) in specific? If I use `cat` on a file, will the output that I get on the terminal be logged somewhere?


title: Is there any mail list frontend that provides forum like interface?

text: I would like to have my mail lists presented like a forum (let's say phpBB), instead of having to browse through this unorganized pile of data: http://lists.nongnu.org/archive/html/ranger-users/ Is there any app that can do that? Google Groups is a good example of such an interface, but it's only available for internal mailing lists.


title: Looking for "Camera Mouse" for Linux

text: I have come across a cool piece of software called Camera Mouse. It lets you control your mouse cursor with just a webcam. Is there software like that for Linux based operating systems? (I would prefer something from the Debian repository, but compiling from source is cool too)


title: # of reads/writes for LVM vs. "regular" partitioning?

text: I am going to be installing linux to a USB flash drive (an actual install, not a "live usb"). I need it to be completely portable, so I can't realistically have the high-access partitions (swap, var, etc.) located on a HDD instead. I've read a lot about the limited life of flash memory, as well as the advantages + disadvantages of LVM, but have not found any information that addresses my question. Assuming a reasonable amount of RAM (to minimize swappiness), can using or not using an LVM affect the number of reads/writes done and therefore prolong or shorten the drive's lifespan?


title: What package has GNU sed for Solaris?

text: I need to use the features of GNU sed, instead of the built-in version under Solaris 10. Which GNU package contains it? I don't see it listed in the coreutils, and my Google searches haven't helped pinpoint it.


title: What program will save a fillable PDF?

text: There are several nice fillable PDFs available for the RPG hobby. These have boxes that number values can be entered and simple formulas are calculated throughout the sheet. I'm finding that the programs I've tried cannot save this data. I've tried PDFEdit, XPDF, and Evince. Is there a Linux program that will save fillable PDFs? Or perhaps I'm not using the above correctly?


title: passing passwords to a script

text: I want to `scp` a file to a remote host, and from there, run a command on the file, and exit the remote session. If I write a usual script, call `scp` and then `ssh`, I am prompted to enter two passwords. Is there a way to copy, `ssh`, and run a command on a remote machine with one password? Also how to write scripts which need to interact with user to enter passwords? I do not want to use "read" as it's not safe. I do not want to use passwordless `ssh`, since my private key file may be compromised, which is even worse. I read something about "expect" but not sure if it's the right tool.


title: format / rewrite old ide flash module

text: I have an old PC where the disk is a 32mb IDE flash module. BIOS boots the Flash, works good.   But if I am in a Linux distro (tinycore/arch/puppy) the flash module is not recognized nor mountable. On the flash module there is a custom Windows MCE powered by Gio. I want to replace that with a Linux kernel but I failed trying to access that memory so far. I already tried setting the jumper in every variation.   Could it be that the Manufacturer prevent access to it in BIOS? Below is a picture of the flash ide module. Maybe someone has an idea how to format this? ![ide flash module](http://i.stack.imgur.com/J37zg.jpg)


title: Linux kernel headers' organization

text: While I was doing some reading on system calls, I did a search for "syscalls.h" to find the header file in LXR. The search results puzzled me. There is a dozen of "syscalls.h" files coming from directories under "arch/_arch_name_/include/asm". These are ok, they are architecture specific definitions or something else needed. The question is why do we have two different "syscalls.h" headers under both /include/linux and /include/asm- generic? Also, I want to find out that what /include/linux headers are for and what /include/asm-generic headers are for. How do they differentiate between each other? What is the logic behind having two separate header folders? How do they relate to each other? Thanks


title: How to disable shutdown so that an important process cannot be interrupted?

text: What is the simplest way to disable or temporarily suspend reboot/shutdown when an important process is running? The process takes too long to finish and cannot be paused/resumed so I like to avoid shutting down the pc while it is running. It is run from cron so unless I manually check for running processes, I wouldn't know that it is running. Thanks.


title: Understanding boolean operators in bash script

text: phone_missing=false     echo "missing $phone_missing"          if [ ! $phone_missing ]     then             echo "Lost phone at $readabletime"             $phone_missing=true     fi      I just can't wrap my head around this, as stupid it may sound. The line               echo "missing $phone_missing"      echos `missing false`, I would very much expected the statement               if [ ! $phone_missing ]      to be true and enter the `if` clause, but it doesn't? What am I missing here!?


title: Odd Inode/Ram cache drops happening in CentOS

text: I run a CentOS 5.7 machine (64bit) with 24GB ram and 4x SAS drives in RAID10 setup. This machine runs nginx/1.0.10, php-fpm & xcache. About a month back the RAM usage of this machine has changed. About every few hours the 'CACHE' is flushed from the RAM, this happens exactly when the 'Inode table usage' drops. I'm pretty sure these drops are related. (see the 2 attached images). ![enter image description here](http://i.stack.imgur.com/xCHT9.png) ![enter image description here](http://i.stack.imgur.com/d0o2x.png) This server hosts quite a lot of small files (20M all a few KB big). Not many files are deleted (maybe 100 per hour (total size a few MB max)), not enough to account for the huge Inode table drops. I also have no crons running which could cause these drops. `Sar -r` output: http://pastebin.com/C4D0B79i **My question:** Why are these huge RAM/Inode usage drops happening? How can I get Nginx/PHP to use all of my servers RAM?


title: Problem with mount namespaces under Fedora

text: I've run into an odd problem regarding mount namespaces on Linux. I have two systems, both X86_64 running kernel 3.2.3-2 under Fedora 16. I am attempting to mount a `tmpfs` filesystem in a child namespace created using the `unshare` command:               unshare -m /bin/bash      From the man page:                  mount namespace               mounting and unmounting filesystems will not affect rest of  the               system (CLONE_NEWNS flag),      On one system, this works as expected. That is, if I start with this:               # ls /mnt     file1 file2 file3      And then mount a `tmpfs` filesystem over `/mnt` in a child namespace:               # PS1="child# ' unshare -m /bin/bash     child# mount -t tmpfs tmpfs /mnt      The contents of `/mnt` are masked in the child namespace:               child# ls /mnt     child#      But continue to be visible in the parent:               # ls /mnt     file1 file2 file3      On the second system, the exact same sequence of commands will result in a mount that is visible in the parent namespace as well as in the child namespace. In other words, it appears that the `unshare` command is not actually resulting in a separate mount namespace. I am not aware of any substantial differences between the two systems. One is running a desktop environment, the other is not. SELinux is disabled on both systems. I'm looking for any suggestions as to what could be causing this difference in behavior.


title: What is the STATE column of the TOP command on Solaris?

text: I'm running a very large, memory intensive program on my new UNIX server and trying to fully understand the output of the "top" command. Here is what I see right now (showing only the first process):               load averages:  1.51,  1.48,  1.45;               up 59+12:23:36                              08:57:47     194 processes: 191 sleeping, 1 zombie, 2 on cpu     CPU states: 99.5% idle,  0.4% user,  0.1% kernel,  0.0% iowait,  0.0% swap     Kernel: 2045 ctxsw, 73 trap, 2891 intr, 1797 syscall, 23 flt, 48 pgout     Memory: 256G phys mem, 214G free mem, 22G total swap, 22G free swap             PID USERNAME LWP PRI NICE  SIZE   RES STATE    TIME    CPU COMMAND      15382 bd9439    22   1    4 7799M 7787M cpu/147  21.9H  0.39% sas      What is the meaning of the number in the "STATE" column following "cpu" (in this case 147)? The `man` page only says:                STATE           Current state (typically one of "sleep", "run",  "idl",           "zomb", or "stop").      This is a new Oracle T4-4 server running Solaris 10 not yet in "production", meaning this is the only thing running right now. Solaris 10 and top version 3.7:               bd9439@bsprd697 $ uname -a     SunOS bsprd697 5.10 Generic_148888-01 sun4v sparc sun4v     bd9439@bsprd697 $ top --version     top: version 3.7


title: How to log all domains accessed?

text: Maybe I could use `tcpdump`, filter out all non-HTTP packets to reduce disk consumption, and then parse the output looking for domain names. Maybe there is a better solution. Do you know one?


title: grep *stringA*[number]

text: I was wondering how can I grep an expression of the type               *stringA*[number]      In other words, I want to target lines that have the following pattern:                anything + stringA + anything + [number]      For example these strings would match:               stringA[3]     this is a test stringA because_[4]     nothing really stringA[5]      these strings would not match:               stringA     something else [7]      How can I do this with grep? (or grep -e)?


title: Logrotate doesnt start proftpd triggerd by cronjob

text: Im currently running of ideas. The proftpd doesn't restart, if logrotate is triggered by the cron task. Logrotate rotates all logfiles stops proftpd but does not start proftpd again. If i force the rotation with `logrotate -f /etc/logrotate.d/proftpd-basic` everything works fine.. Any kind of ideas are welcome. I got the following setup. **cat /etc/cron.daily/logrotate**               #!/bin/sh          test -x /usr/sbin/logrotate || exit 0     /usr/sbin/logrotate /etc/logrotate.conf       **cat /etc/logrotate.conf**               # see "man logrotate" for details     # rotate log files weekly     weekly          # keep 4 weeks worth of backlogs     rotate 4          # create new (empty) log files after rotating old ones     create          # uncomment this if you want your log files compressed     #compress          # packages drop log rotation information into this directory     include /etc/logrotate.d          # no packages own wtmp, or btmp -- we'll rotate them here     /var/log/wtmp {         missingok         monthly         create 0664 root utmp         rotate 1     }          /var/log/btmp {         missingok         monthly         create 0660 root utmp         rotate 1     }          # system-specific logs may be configured here      **cat /etc/logrotate.d/proftpd-basic**               /var/log/proftpd/proftpd.log     /var/log/proftpd/controls.log     {             weekly             missingok             rotate 7             compress             delaycompress             notifempty             create 640 root adm             sharedscripts             postrotate                     # reload could be not sufficient for all logs, a restart is safer                     invoke-rc.d proftpd restart 2>/dev/null >/dev/null || true                     #invoke-rc.d proftpd reload 2>/dev/null >/dev/null || true             endscript     }          /var/log/proftpd/xferlog     /var/log/proftpd/xferreport     {             monthly             missingok             rotate 7             compress             delaycompress             notifempty             create 640 root adm             sharedscripts             prerotate             endscript             postrotate                     # reload could be not sufficient for all logs, a restart is safer                     invoke-rc.d proftpd restart 2>/dev/null >/dev/null || true                     #invoke-rc.d proftpd reload 2>/dev/null >/dev/null || true                     # run ftpstats on past transfer log                     ftpstats -a -r -l 2 -d -h -f /var/log/proftpd/xferlog.0 2>/dev/null >/var/log/proftpd/xferreport || true             endscript     }


title: Ubuntu Linux 12.04 - Load Non-MBR grub from the old grub in MBR

text: I have installed Ubuntu linux 12.04 on sda10, and grub2 in sda5 . Actually I had a legacy grub installed in MBR, I want to load Ubuntu linux from the old grub. How could I do this? This question arise, because before I installed Ubuntu linux 12, I already have a grub installed in my pc, and working well with three other OS, after I installed Ubuntu linux 12 with grub in MBR, I can't load other system. So I have to install Ubuntu Linux grub in non-MBR, and want to find a way to load it from the old grub. Thanks.


title: How to restore kde plasma desktop

text: I was tried chrome remote desktop app with a friend. He has a Mac. By mistake he clicked cmd + s, I do not know if that is super + s combination, the thing is it killed all my kde plasma widgets. Is there a short way to restore it?


title: How can I prevent smartd from reporting that it cannot find a disk?

text: I have smartd monitoring my hard drives. It works fine generally, but the following error window has been consistently popping up every 24 hours.               This email was generated by the smartd daemon running on:       host name: sparhawk-XPS-17       DNS domain: [Unknown]       NIS domain: (none)     The following warning/error was logged by the smartd daemon:     Device: /dev/sdc [SAT], unable to open device     For details see host's SYSLOG.     You can also use the smartctl utility for further investigation.     Another email message will be sent in 24 hours if the problem persists.      There is no sdc connected, but nevertheless I try `sudo smartctl -a /dev/sdc`. The result is               smartctl 5.43 2012-06-30 r3573 [x86_64-linux-3.5.0-26-generic] (local build)     Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net     Smartctl open device: /dev/sdc failed: No such device      The only non–commented-out line in `/etc/smartd.conf` is               DEVICESCAN -m root -M exec /usr/share/smartmontools/smartd-runner      Is there a way to make smartd correctly identify the removal of this disk, and not complain about it? If this is not possible, then is there a way to make smartd only monitor sda and sdb?


title: Install Shutter on Centos

text: I'm trying to figure out a way to install shutter on Centos. Are there any repos somewhere?


title: pixelview bt878 card not being recognized

text: I'm having huge difficulties with using Pixelview pv-bt878p+ rev.9d with Linux. I'm using a stock Debian kernel, version 3.2.0-1-686-pae #1 SMP. When I load bttv module for that card I get this:               [  683.700105] bttv: 0: unloading     [  690.772928] bttv: driver version 0.9.19 loaded     [  690.772941] bttv: using 8 buffers with 2080k (520 pages) each for capture     [  690.773719] bttv: Bt8xx card found (0)     [  690.773767] bttv: 0: Bt878 (rev 17) at 0000:00:0f.0, irq: 12, latency: 64, mmio: 0xcfdfe000     [  690.773817] bttv: 0: using:  *** UNKNOWN/GENERIC ***  [card=0,autodetected]     [  690.775504] tveeprom 0-0050: Huh, no eeprom present (err=-6)?     [  690.775516] bttv: 0: tuner type unset     [  690.777636] bttv: 0: registered device video0     [  690.779489] bttv: 0: registered device vbi0      I know I can add some options to the module, so I've been trying with such:               modprobe bttv  card=72 tuner=38 radio=1 gpiomask=0x3F audiomux=33,32,35,35,40      and               modprobe bttv  card=70 tuner=38 radio=1 gpiomask=0x3F audiomux=33,32,35,35,40      Which I've found somewhere on the internet, and it fixed one's problems with similar card. For me it was unsuccessful. lspci for that card gives me this:               00:0f.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 11)             Flags: bus master, medium devsel, latency 64, IRQ 12             Memory at cfdfe000 (32-bit, prefetchable) [size=4K]             Capabilities: [44] Vital Product Data             Capabilities: [4c] Power Management version 2             Kernel driver in use: bttv          00:0f.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture (rev 11)             Flags: bus master, medium devsel, latency 64, IRQ 12             Memory at cfdff000 (32-bit, prefetchable) [size=4K]             Capabilities: [44] Vital Product Data             Capabilities: [4c] Power Management version 2      Perhaps some of you know how could I progress in my endeavour to start using this card under linux?


title: Problem when I use the webdings font in firefox or inkscape

text: I installed the `webdings font` in my computer, and it works well with `LibreOffice`.   But when I use the `webdings font` in a local html page : it doesn't work, the following unicode character is diplayed instead of the wanted character ``.   But if I export my local web page to PDF (with the `wkhtmltopdf` tool) I get the wanted character in the PDF.   So I don't understand why it doesn't work on my local web page (I tried with `firefox` and `chromium`). If someone has an idea? I also tried in `inkscape` but I was unable to display my character in it. A bit of code to clarify it :               /* the font in my css file */     @font-face {         font-family:'webdings';         font-weight: normal;         font-style: normal;         src: local('Webdings'), url('webdings.ttf') format('truetype'); }          .icone { font-family: webdings; }               &#xF0FC


title: Which virtual terminal is a given X process running on?

text: When X starts, it searches for the lowest unused VT, and attaches to it. My problem is that when there are several running X processes, I need to be able to identify which one is the currently active one. This is a *BSD question, because on linux it's easy: X sets its controlling terminal to be `ttyN`, or, on very old distributions, it's specified on the commandline as `vtN`. So, I'm running a service and I see that the currently active VT is `tty7`, and there are two X servers running, it's easy to tell which one corresponds to the current terminal. (This is a reasonable case: perhaps the user used GNOME/KDE's 'switch user' functionality or ran two servers using `startx`.) An example application that might want to follow the active X server is `x11vnc` (which is forked from the software I'm developing). On FreeBSD though, the controlling terminal does not tell you anything. When X is started from ttyv1, that remains the controlling terminal. ### Update I've done due diligence and read the X code. After some hunting around, it's now clearer to me what's going on. In lnx_init.c, the X server does `setsid` to make a fresh session for itself, then opens an fd to `ttyN` straight after to do a `VT_ACTIVATE` ioctl on it. Pretty standard; opening the fd to a terminal with no controlling process from a process with no controlling terminal associates the two, and the server keeps the fd open, so it's guaranteed that the terminal will remaining the controlling terminal for the X server. Now, in bsd_init.c, opening the fd to the tty to be used as the framebuffer doesn't make it a controlling terminal (and in fact, with no `setsid`, BSD Xserver started from `xinit` on ttyv2 will keep ttyv2 as its ctty!). ### Question further updated and cleaned up on 2012-04-09.


title: Disable tab autocompletion in interactive mode

text: I have `set disable-completion on` in my `~/.inputrc`, however this doesn't affect php in interactive mode (`php -a`). I would like to copy some code from another editor to the php interactive shell which uses tab characters as indention.


title: Adding a populated existing disk device to a QEMU raw image

text: I have a raw QEMU image (vda.raw), and I would like to resize it and add an existing partition, using data I have in a file that contains a raw ext3 file system populated with data (vdb.raw). The two files look like this:               $ file vda.raw     vda.raw: x86 boot sector; partition 1: ID=0x83, active, starthead 0, startsector 16065, 20948760 sectors, code offset 0x63     $ file vdb.raw     vdb.raw: Linux rev 1.0 ext3 filesystem data, UUID=14555b9c-4837-4b43-a8e8-fe4e19194e88, volume name "ephemeral0" (large files)      Is there a simple way I can create a new image by combining these two: where the contents of vdb.raw appear as a new disk partition in vda.raw? I'd like to avoid having to:   1. Resize vda.raw   2. Create a new partition in vda.raw   3. Mount vda.raw   4. Mount vdb.raw   5. Copy the contents of vdb.raw into vda.raw Is there a way I could, say, concatenate them with dd, and then fix the partition table to make it aware that there's a new partition in the image?


title: Writing data on particular sectors or blocks

text: Not sure if it's better suited for _superuser_ of _serverfault_ boards, let me know. I have a drive which I repartitioned with `fdisk`. Initially there was only one big partition, now there are a number of partitions. Now the new partition table won't be taken into account by the kernel until the next reboot. The point is that there are some data on this drive which are shared through NFS, and which should be present on the drive when rebooting. Also, I want to avoid modifying configuration files, even temporarily. So I would like to ensure these data are on the first partition, `/dev/sdb1`, corresponding to the previous single partition, so that they are immediately available at next boot. So is there a (simple) way to write data on particular sectors or blocks on the drive ? Is it the purpose of the `dd` "seek" option ? If I manage to do that the data will still be readable at next reboot once the new partition has been taken into account, right ? FWIW, the amount of data is not so large, 2.1 MB, but `/dev/sdb1` is only 82 MB and the drive is 160 GB. Thanks. Edit : For the whole history and why I cannot reload the partition table (which would be the best solution), see this question on _serverfault_. Edit2 : Ok, I may have found a workaround, which would be to copy files from elsewhere as soon as the machine is rebooted, before NFS is set up. Edit3 : Nevermind Edit2, the new `/dev/sdb1` wouldn't be formatted yet… Edit4 : Actually, this last edit probably discards the whole question, as it applies in any case. Should have think of that earlier…


title: linux launch script /etc/init with a specific user

text: I've created a script in /etc/init/mms-agent.conf :               start on runlevel [2345]     stop on runlevel [06]          exec /usr/bin/env python /home/mms/mms-agent/agent.py >> /home/mms/agent.log 2>&1      service mms-agent start/stop work fine, but i'd like to start this service with the user "mms" When I try to change the script as following :               exec su mms -c "/usr/bin/env python /home/mms/mms-agent/agent.py >> /home/mms/agent.log 2>&1"      I get 3 process running instead of 1 expected (su, bash + my python script):               mms       8864  0.0  0.2  37816  1332 ?        Ss   22:30   0:00 su mms -c /usr/bin/env python /home/mms/mms-agent/agent.py >> /home/mms/agent.log 2>&1     mms       8865  0.0  0.2  11452  1196 ?        S    22:30   0:00 bash -c /usr/bin/env python /home/mms/mms-agent/agent.py >> /home/mms/agent.log 2>&1     mms       8866  4.0  1.8  54672 10640 ?        Sl   22:30   0:00 python /home/mms/mms-agent/agent.py      What does that mean ? What is the best way to start a script with a user different than root ? Thanks PS :               exec start-stop-daemon --start -u mms --exec "/usr/bin/env python /home/mms/mms-agent/agent.py"      doesn't work, I got no error but the process isn't started.


title: How to fix unreliable Realtek Wireless card on Ubuntu 13.04

text: I have a Realtek RTL8188CE wireless card and it works fine when I have a strong signal, but if I get even slightly away from the wifi I lose connectivity even though there is a strong Rx signal. I suspect that the Tx power from my laptop is not strong enough, but running: `sudo iwconfig wlan0 txpower 23` was ineffective. The card would not let me set it above 20 dBm. How can I either fix the flakiness or increase the Tx power?


title: SFTP server on RHEL6 disconnects on ls

text: I've followed the steps outlined here to create a chrooted sftp environment. Everything works great EXCEPT for the command ls. When I do an ls, with any of the flags, I get disconnected immediately. When I do an strace on the PID, I get this (couldn't get it looking better than this. Any ideas? I'm at wits ends. >     `Process 7071 attached - interrupt to quit      select(5, [3], [], NULL, NULL)          = 1 (in [3])      read(3, "\0\0\0\n\v\0\0\0\2\0\0\0\1/", 16384) = 14      open("/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 5      select(5, [3], [4], NULL, NULL)         = 1 (out [4])      write(4, "\0\0\0\rf\0\0\0\2\0\0\0\4\0\0\0\0", 17) = 17      select(5, [3], [], NULL, NULL)          = 1 (in [3])      read(3, "\0\0\0\r\f\0\0\0\3\0\0\0\4\0\0\0\0", 16384) = 17      getdents(5, /* 3 entries */, 32768)     = 80      lstat("/.", {st_mode=S_IFDIR|0750, st_size=4096, ...}) = 0      stat("/etc/localtime", 0x7fff44193d90)  = -1 ENOENT (No such file or directory)      open("/etc/localtime", O_RDONLY)        = -1 ENOENT (No such file or directory)      open("/etc/passwd", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)      close(4)                                = 0      socket(PF_FILE, SOCK_STREAM, 0)         = 4      fcntl(4, F_SETFD, FD_CLOEXEC)           = 0      fcntl(4, F_GETFL)                       = 0x2 (flags O_RDWR)      fcntl(4, F_SETFL, O_RDWR)               = 0      connect(4, {sa_family=AF_FILE, path="/var/lib/pbis/.lsassd"}, 110) = -1 ENOENT (No such file or directory)      close(4)                                = 0      open("/etc/group", O_RDONLY|O_CLOEXEC)  = -1 ENOENT (No such file or directory)      socket(PF_FILE, SOCK_STREAM, 0)         = 4      fcntl(4, F_SETFD, FD_CLOEXEC)           = 0      fcntl(4, F_GETFL)                       = 0x2 (flags O_RDWR)      fcntl(4, F_SETFL, O_RDWR)               = 0      connect(4, {sa_family=AF_FILE, path="/var/lib/pbis/.lsassd"}, 110) = -1 ENOENT (No such file or directory)      close(4)                                = 0      lstat("/..", {st_mode=S_IFDIR|0750, st_size=4096, ...}) = 0      open("/etc/localtime", O_RDONLY)        = -1 ENOENT (No such file or directory)      open("/etc/passwd", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)      socket(PF_FILE, SOCK_STREAM, 0)         = 4      fcntl(4, F_SETFD, FD_CLOEXEC)           = 0      fcntl(4, F_GETFL)                       = 0x2 (flags O_RDWR)      fcntl(4, F_SETFL, O_RDWR)               = 0      connect(4, {sa_family=AF_FILE, path="/var/lib/pbis/.lsassd"}, 110) = -1 ENOENT (No such file or directory)      close(4)                                = 0      open("/etc/group", O_RDONLY|O_CLOEXEC)  = -1 ENOENT (No such file or directory)      socket(PF_FILE, SOCK_STREAM, 0)         = 4      fcntl(4, F_SETFD, FD_CLOEXEC)           = 0      fcntl(4, F_GETFL)                       = 0x2 (flags O_RDWR)      fcntl(4, F_SETFL, O_RDWR)               = 0      connect(4, {sa_family=AF_FILE, path="/var/lib/pbis/.lsassd"}, 110) = -1 ENOENT (No such file or directory)      close(4)                                = 0      lstat("/attreport", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0      open("/etc/localtime", O_RDONLY)        = -1 ENOENT (No such file or directory)      open("/etc/passwd", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)      socket(PF_FILE, SOCK_STREAM, 0)         = 4      fcntl(4, F_SETFD, FD_CLOEXEC)           = 0      fcntl(4, F_GETFL)                       = 0x2 (flags O_RDWR)      fcntl(4, F_SETFL, O_RDWR)               = 0      connect(4, {sa_family=AF_FILE, path="/var/lib/pbis/.lsassd"}, 110) = -1 ENOENT (No such file or directory)      close(4)                                = 0      open("/etc/group", O_RDONLY|O_CLOEXEC)  = -1 ENOENT (No such file or directory)      socket(PF_FILE, SOCK_STREAM, 0)         = 4      fcntl(4, F_SETFD, FD_CLOEXEC)           = 0      fcntl(4, F_GETFL)                       = 0x2 (flags O_RDWR)      fcntl(4, F_SETFL, O_RDWR)               = 0      connect(4, {sa_family=AF_FILE, path="/var/lib/pbis/.lsassd"}, 110) = -1 ENOENT (No such file or directory)      close(4)                                = 0      getdents(5, /* 0 entries */, 32768)     = 0      select(5, [3], [4], NULL, NULL)         = -1 EBADF (Bad file descriptor)      sendto(7, "<83>Feb 27 22:02:23 sshd[7071]: "..., 66, MSG_NOSIGNAL, NULL, 0) = -1 EBADF (Bad file descriptor)      close(7)                                = -1 EBADF (Bad file descriptor)      socket(PF_FILE, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 4      connect(4, {sa_family=AF_FILE, path="/dev/log"}, 110) = -1 ENOENT (No such file or directory)      close(4)                                = 0      exit_group(2)                           = ?      Process 7071 detached      `


title: Easiest way to duplicate directory over FTP

text: I want to duplicate a directory on an FTP server I'm connected to from my Mac via the command-line Let's say I have `file`. I want to have `files2` with all of `file`'s subdirectories and files, in the same directory as the original. What would be the simplest way to achieve this? (I´m a complete newbie to the UNIX command line, so sorry if the question is not clear enough; please ask for any clarification needed.) EDIT: With `mget` and `mput` you could download all files and upload them again into a different folder but this is definitely NOT what i want/need (I started this question trying to avoid duplicating with this download upload method from the dektop client)


title: Extending swap on Centos

text: I recently created a swap file on my centos 6 based VPS using this guide. Now I wanted to extend this swap and I was reading through this guide. However, I think I've created a swap file than a partition. How do I go about extending this swapfile? The current size is 512M and I need to extend it by another 1G. Any help would be appreciated since I'm a linux newbie.


title: Thunderbird: Override colors in received HTML emails

text: I need to override default colors in received HTML emails. I have followed this Howto, and modified my `userContent.css` accordingly. Basically, I need white text on dark background:               $ cat userContent.css     body {       color: white !important;        background-color: #303030 !important;     }          td {       color: white !important;       background-color: black !important;     }      This works OK for the background color, but the my desired font color (white) is being ignored, even when I use `!important`. How can I make sure, that all received HTML emails have white font on dark bacckground?


title: iPod Nano 6G on Linux

text: I see that Apple no longer supports `libgpod` for the iPhone4/iPod Touch 4 and Nano 6G. I see also that the system of databases for those new device has to be the same. I found many videos where you can see `libimobiledevice` works well with iPhone but none about the "new" Nano 6G and I couldn't get it to work - unlike my old Nano 1G that does. It's normal that the Nano 6G doesn't work? Is there a way, including with commercial programs, to sync my iPod Nano 6G under Linux (without dualboot or VM)? I'm running Fedora 16 x64.


title: Counting comma separated characters in a row

text: How can I count how many elements are separated with comma in a given column of a file (tab_delimited), using awk or sed? Exemple:               AC    1,23,5     DC    2,8,89      Would return:               AC    3     DC    3


title: Get input from editor (vim/nano/emacs/textmate?)

text: I was just curious if there's a way to get input not from `StdIn` but from `$EDITOR` - be it vim, nano, emacs or even a non-command-line-editor (MacVim/TextMate). What are the options/workarounds/bestpractices? Basically I'd wish for a workflow as with `heredoc` - but from the $editor instead.               $ sort -nr << FOO | uniq -c      pipe heredoc> foo      pipe heredoc> bar     pipe heredoc> baz     pipe heredoc> foo     pipe heredoc> FOO        2 foo        1 baz        1 bar


title: Is it possible to reference the most recently modified file in a command line argument?

text: I frequently download PDF files with heinous numeric file names from my browser. These automatically go into `~/Downloads`. Ideally I would like to just be able to open these files with:               evince "the most recently modified file"      without having to open `~/Downloads` to find the file name. Is there a simple way to specify "the most recently modified file" in `bash`? NOTE: I know that it is _possible_ to do this, but ideally I am looking for a solution that would be simpler than `ls -t`'ing `~/Downloads` to check the name.


title: How to multiply a data file with another index data file?

text: I want your help in multiplying my data file with another index data file. Both data files have the same number of rows. But the data file have more than 1000 columns while the index data has only one column. The index file is the factor by which I want to multiply the whole columns of the my data. Here is my sample data and the required output below Data.txt:               10  20  30  40  50     20  30  40  50  60     30  40  50  60  70     40  50  60  70  80     50  60  70  80  90     60  70  80  90  100     70  80  90  100 110     80  90  100 110 120      index.txt:               0.1     0.2     0.3     0.4     0.5     0.6     0.7     0.8     .     .     .     .      Required output file will be out.txt               1   2   3   4   5     4   6   8   10  12     9   12  15  18  21     16  20  24  28  32     25  30  35  40  45     36  42  48  54  60     49  56  63  70  77     64  72  80  88  96


title: How to check if `wget` supports a certain feature programatically?

text: Is there a way to programatically detect if the currently installed wget supports a given feature, for example, IRI support? I’m asking because I’d like to add these lines to my `.wgetrc`:               # Use UTF-8 as the default system encoding     local_encoding = UTF-8      But this makes wget unusable if it doesn’t support the `local_encoding` setting. So, I’d like to conditionally configure this setting, only if wget supports the feature. In Vim (`.vimrc` files) you can do this using `has()` and `exists()`:               if has("autocmd")       " Define autocommands here     endif      How can I do something similar for wget in `.wgetrc`?


title: How to search in PDF files recursively?

text: > **Possible Duplicate:**   >  grep pdf files? With a Linux machine, ex.: an Ubuntu, how can I search for a given word recursively in several PDFs?


title: sysrq won't reboot with a keystroke, but will with echo "b" > /proc/sysrq-trigger

text: CentOS 6.2, 2.6.32-220.el6.x86_64 laptop. SysRQ is enabled for keyboard input, as is witnessed by:               $ cat /proc/sys/kernel/sysrq      1      Common Magic SysRQ Keys are working such as `alt`-`sysrq`-`h`. However, other keystrokes do not appear to be working. Most notably, `alt`-`sysrq`-`b` for rebooting. However, I can get the reboot SysRQ option to work via `echo "b" > /proc/sysrq-trigger` I realize that `/proc/sys/kernel/sysrq` does not need to be enabled in order for echoing options to `sysrq-trigger` to work, so I'm assuming that there's some problem with the Magic SysRQ key combination actually being signaled. What would be causing the inability for some SysRQ keystrokes to work, but others not? And yet manually sending the option to `sysrq-triggers` _will_ work? # EDIT 1 Shamefully, I left out some information in the above question. Yes, I'm using a laptop, but I'm also using an external keyboard. I don't think I've used the built-in keyboard on my Dell XPS 1530 for years so it didn't even register in my mind that the keyboard situation could be part of the issue. On the Dell XPS 1530's built-in keyboard, the SysRQ key is technically a function key. "SysRQ" is printed in blue to signal that a person, theoretically, should press the `Fn` key to access it. However, when using the built-in keyboard, you merely have to press the standard `alt`-`sysrq`-`b` combination to cause a reboot! No function key required. My external keyboard is a Logitech Illuminated Keyboard, and it has its own `FN` key on it. However, SysRQ is not apparently mapped as an alternate key. I say "apparently" because `SysRQ` isn't actually printed on **_any_** of the keys. Instead, I assumed that `Print Screen` was the SysRQ key because that's what SysRQ has shared a key with in recent years. That seems to have been a fair assumption because, as I tested things out, most Magic SysRQ key combinations work using that key as `SysRQ`. Nevertheless, I've tried a plethora of combinations using the external keyboard, and none of them seem to work with the re[B]oot Magic SysRQ key. I know `alt` works and I know `print screen` works as the SysRQ key without need for the function key on the external keyboard. It just appears, at this moment anyway, that the `b` key is not being sent as be. Is there any way that I can see what key code is being sent to my terminal as I type on a keyboard?


title: /usr/bin/ptx: Can you provide a use case or two?

text: I was going through the list of files included in coreutils and I was able to come up with an example of how I could personally use all of the commands provided except for ptx. Can you give one or two (or three) examples of using ptx? The more varied the use case the better.               $ apropos ptx     ptx(1)         - produce a permuted index of file contents


title: Rename the last 8 characters in filename

text: I am receiving video files with different names but the final 8 characters of all are numbers (also different every time). This is the pattern of the file name:               custom text 00030402.avi      I have to make file name looks like this:               00\:03\:04\:02      So my question is how to rename the last 8 characters and preserve them to achieve this pattern.