title: Copying specific subfolders with directory structure to a new folder

text: I am having a the following directory structure:                               Main_Dir                        |       -----------------------------------       Subdir1       Subdir2       Subdir3          |             |             |      ---------     ---------     ---------      |   |   |     |   |   |     |   |   |                 fo1 fo2 f03   fo1 fo2 f03   fo1 fo2 f03      I want to copy all the subdirectories (`Subdir1`, `Subdir2`, `Subdir3`) to a new folder. But I only want to copy `fo1` and `fo2` folders in the new place. Not sure how could it be done.


title: TexLive and RHEL 6 — can I install 2011 *in addition* to 2007?

text: Our environment is Red Hat Enterprise Linux 6. By default, RHEL 6 comes with a version of TexLive from 2007. A user would like one of the extensions to TexLive ("PDFTex") to be updated. From everything I can find, the only way to accomplish this is to update TexLive as a whole. There's an "unofficial" repo online for TexLive 2011, which works with RHEL 6: http://jnovy.fedorapeople.org/texlive/2011/packages.el6/ I added this repo to my personal computer and installed it (all 960 packages!). It forcefully erased any trace of 2007. And for all intents and purposes...it appears to be working. However, we have hundreds of users of varying levels of technical knowledge. While it may appear to be fine for me (who has no idea how to really do anything with LateX), it's not realistically possible for me to test all 960 packages, while also confirming one by one that some feature someone may have relied on in the 2007 version didn't get implicitly canned or changed in the later version. Therefore I can't justify installing it to the network just yet. Is there any way that I can install all 960 packages in a completely isolated and independent location, so that the 2007 version can remain unchanged, while also giving users the chance to check out and informally act as testers for the 2011 version? I'm quite new at this so if I should provide any further or more detailed information, please let me know what.


title: Split tmux windows with same keys as in Emacs?

text: In emacs, you split a window with `C-x 2` (one above the other) or `C-x 3` (one next to the other). How can I get the same key bindings in `tmux`? Also, once a window is split, in emacs you cycle through them with `C-x o`. Can I configure `tmux` to use the same key?


title: Permit root to login via ssh only with key-based authentication

text: I have some doubts about certain ssh server configurations on `/etc/ssh/sshd_config`. I want the next behavior:   1. Public key authentication is the only way to authenticate as root (no password authentication or other)   2. Normal users can use both (password and public key authentication) If I set `PasswordAuthentication no` my first point is satisfied but not the second. There is a way to set `PasswordAuthentication no` only for root?


title: Adding more Emacs-like bindings to ZSH's line editor (ZLE)

text: I have a couple of questions regarding the emacs-like keyboard bindings in Zsh. As background to all the questions: I have Emacs-like keybinding activated with `bindkey -e` (activated by default) ### Copying and region highlighting: In Emacs, if you run `C-space` (`set-mark`), select a region and then copy it using `M-w`, Emacs puts the region in the kill ring and stops selecting text (i.e. if I move the point, no more text is selected). However, I can't get the same behavior in ZLE. Once I copy a region with `M-W`, the selection mode is still on, and if I move my cursor, the selection keeps changing. ### Stop selection: In Emacs, if I am selecting a region, and press `C-g`, the selection stops (the current mark is killed). In Zsh, by default, `C-g` starts a new line in the shell. So is there a ZLE command that I can bind to (maybe using something different from `C-g`) to stop an ongoing selection?


title: Auto indent / format code for Vim?

text: I'm trying to use Vim more and more when I can. One of my biggest grip between Vim and an IDE like Aptana is the ability to auto indent. Is there a means of auto formatting code (HTML, CSS, PHP) so it is properly indented? If so how do you install this into vim? I don't understand plugins very much. I tried reviewing this thread and it confused me more: How to change vim auto- indent behavior?


title: Emacs M-h selects paragraph + an extra line

text: In Emacs, when I type `M-h` (`mark-paragraph`), Emacs selects the paragraph under point plus an extra line (typically right above the paragraph). Is there a way to ask Emacs to just select the paragraph? **Note:** I have noticed this behavior under `shell-script-mode`, but haven't checked if it occurs with other major modes.


title: Can't get Hurricane Electric IPv6 tunnel to work on Fedora

text: I have recently moved to a university where all computers get a public IPv4 address. Since the teredo tunnel I was using doesn't work anymore and I have a public address, I am wanting to use Hurricane Electric's tunnel broker service on my Fedora 15 Gnome machine. I've already configured HE with my information and am just trying to get it working in Fedora. I'm using a modified configuration script from the Fedora Wiki (which didn't work without modifications). My `/etc/sysconfig/network` config:               NETWORKING=yes     HOSTNAME=quackpad-fedora     NTPSERVERARGS=iburst     NETWORKING_IPV6=yes     IPV6INIT=yes     IPV6_DEFAULTDEV=he-ipv6     IPV6_DEFAULTGW=2001:470:1f10:11d0::1/64   # Server IPv6 Address      And my `/etc/sysconfig/network-scripts/ifcfg-he-ipv6`               DEVICE=he-ipv6     BOOTPROTO=none     ONBOOT=yes                              IPV6INIT=yes     IPV6TUNNELIPV4=209.51.181.2        # Server IPv4 address     IPV6TUNNELIPV4LOCAL=***.***.*.***  # My IPv4 address     IPV6ADDR=2001:470:1f10:11d0::2/64  # Client IPv6 address      If I do `sudo ifup he-ipv6` I get (why does ifup-eth care about that?)                ERROR    : [/etc/sysconfig/network-scripts/ifup-eth] Device he-ipv6 does not seem to be present, delaying initialization.      If I do `sudo service network restart`               Sep  1 18:15:07 quackpad-fedora NetworkManager[938]: <warn> connection /org/freedesktop/NetworkManager/Settings/1 failed to activate: (2) Device not managed by NetworkManager or unavailable     Sep  1 18:15:07 quackpad-fedora NetworkManager[938]: <warn> connection /org/freedesktop/NetworkManager/Settings/2 failed to activate: (2) Device not managed by NetworkManager or unavailable     Sep  1 18:15:08 quackpad-fedora /etc/sysconfig/network-scripts/ifup-eth: Device he-ipv6 does not seem to be present, delaying initialization.     Sep  1 18:15:08 quackpad-fedora NetworkManager[938]: <warn> connection /org/freedesktop/NetworkManager/Settings/0 failed to activate: (2) Device not managed by NetworkManager or unavailable     Sep  1 18:15:08 quackpad-fedora systemd[1]: network.service: control process exited, code=exited status=1     Sep  1 18:15:08 quackpad-fedora systemd[1]: Unit network.service entered failed state.      What am I doing wrong here? Why do these keep failing?


title: How does this bash statemnet test ".$TOMCAT_USER" = . && TOMCAT_USER=tomcat work?

text: I am trying to understand the tomcat daemon.sh script which contains a bunch of lines along the lines `test ".$TOMCAT_USER" = . && TOMCAT_USER=tomcat` I figured out that `test ".$TOMCAT_USER" = . && TOMCAT_USER=tomcat` checks if an environment variable TOMCAT_USER is already defined if so it uses it and if not it uses the default value of tomcat What I understand is the how the statement is evaluated by bash. I am a bash scripting noob. I am looking for a step by step explanation of how this statement works.


title: Upgrading error

text: When I do apt-get update // apt-get upgrade i received this error whatever I do:               root@debian:~# apt-get upgrade     Reading package lists... Done     Building dependency tree     Reading state information... Done     You might want to run 'apt-get -f install' to correct these.     The following packages have unmet dependencies:      curl : Depends: libcurl3 (= 7.26.0-1+wheezy3) but 7.21.0-2.1+squeeze2 is installed      multiarch-support : Depends: libc6 (>= 2.13-5) but 2.11.3-4 is installed     E: Unmet dependencies. Try using -f.     root@debian:~#      This is not my server so I don´t know what is installed inside, the only thing I know is that I need to upgrade the php from 5.2 minimum to 5.3. The told me that Zend Server is installed but I don´t know which version either. The first thing I tried is this and everytime I get this error. cat /etc/issue says: Debian GNU/Linux 6.0 \n \l This is my /etc/apt/sources.list:               root@debian:~# cat /etc/apt/sources.list          # deb cdrom:[Debian GNU/Linux 6.0.6 _Squeeze_ - Official i386 NETINST Binary-1 20120930-15:55]/ squeeze main          #deb cdrom:[Debian GNU/Linux 6.0.6 _Squeeze_ - Official i386 NETINST Binary-1 20120930-15:55]/ squeeze main          deb http://ftp.es.debian.org/debian/ squeeze main     deb-src http://ftp.es.debian.org/debian/ squeeze main          deb http://security.debian.org/ squeeze/updates main     deb-src http://security.debian.org/ squeeze/updates main          # squeeze-updates, previously known as 'volatile'     deb http://ftp.es.debian.org/debian/ squeeze-updates main     deb-src http://ftp.es.debian.org/debian/ squeeze-updates main     deb http://ftp2.de.debian.org/debian squeeze main non-free     deb http://repos.zend.com/zend-server/deb server non-free     root@debian:~#      and this is my output using apt-get install -f curl:               root@debian:~# apt-get install -f curl     Reading package lists... Done     Building dependency tree     Reading state information... Done     curl is already the newest version.     You might want to run 'apt-get -f install' to correct these:     The following packages have unmet dependencies:      curl : Depends: libcurl3 (= 7.26.0-1+wheezy3) but 7.21.0-2.1+squeeze2 is to be installed      multiarch-support : Depends: libc6 (>= 2.13-5) but 2.11.3-4 is to be installed     E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).


title: GRUB error Fedora 15 when Dual Booting on MacBook Pro

text: I am having trouble getting Fedora 15 running on my MacBook Pro. I had Fedora 15 installed before on this MBP before, so I know it works. I basically followed the good old instructions of   1. Create a Windows partition in bootcamp (rEFIt was already installed from trying to get ubuntu running)   2. Boot from disk and install in Windows partition with bootloader on installed on the / partition   3. Install, reboot, and resync the MBR using rEFIt partitioning tool   4. Shut down the computer and start up on the parition you installed linux on Now I get a grub error:               error file not found     grub rescue>      Another weird thing is that I have two Linux boot instances showing up in rEFIt, but that is just a rEFIt issue. Any recommendation on what do to? EDIT: It seems like the error message is GRUB 2 error message and so that seems to lurking around somewhere, problem has been there since I formatted the drives. Any ideas?


title: How to build a custom kernel with localmodconfig that support hardware of multiple machines?

text: When configuring a server to run a single task, like an appliance, there might rise the need to build a custom kernel. For example to save disk space. > _Ubuntu Core 13.10 amd64 root filesystem is a **38 MB** download, where the > "linux-image-generic" meta package including required dependencies will > download **79 MB** of archives, and the size of a kernel-image-x.y.z-generic > package is still **14 MB**._ For building a kernel that is stripped from modules that your hardware will not use, the `make localmodconfig` command is the right tool for the job. However your virtual machine that runs your build and test environment loads different modules than your target deployment hardware. And/or after a while your deployment hardware might become eol, and different hardware is used. And at the frequency where kernel updates are released it might become too cumbersome to build a custom kernel for every different hardware configuration. How to quickly build a custom Linux kernel that runs on a few different hardware boxes?


title: Thinkpad T400: Suspend to HD doesn't resume

text: I've got a Thinkpad T400 with Gentoo Linux installed. Suspend-to-RAM works like a charm. However, Susped-to-Disk doesn't work: if I suspend, the Laptop powers down and accesses the HD for around 30s. However, if I switch it back on, it just boots as normal, but doesn't resume to the previous state. Here's the `/var/log/pm-suspend.log` just before the suspend:               Sun Oct 21 14:16:44 CEST 2012: Finished.     Initial commandline parameters:      Blacklisting 01grub.     Sun Oct 21 15:26:06 CEST 2012: Running hooks for hibernate.     Running hook /usr/lib64/pm-utils/sleep.d/00logging hibernate hibernate:     Linux rgs-lenovo 3.4.9-gentoo #1 SMP Fri Aug 31 18:55:03 CEST 2012 x86_64 Intel(R) Core(TM)2 Duo CPU P8600 @ 2.40GHz GenuineIntel GNU/Linux     Module                  Size  Used by     cdc_wdm                 8704  0      cdc_acm                14890  0      rfcomm                 21490  0      bnep                    9782  0      btusb                  10904  0      bluetooth             162465  5 rfcomm,bnep,btusb     mmc_block              16408  0      nls_iso8859_1           4521  0      nls_cp850               5362  0      vfat                    8384  0      fat                    45316  1 vfat     twofish_x86_64_3way    19478  0      lrw                     3622  1 twofish_x86_64_3way     twofish_x86_64          5539  1 twofish_x86_64_3way     twofish_common         14649  2 twofish_x86_64_3way,twofish_x86_64     aes_x86_64              7768  0      aes_generic            26983  1 aes_x86_64     xts                     2912  1 twofish_x86_64_3way     gf128mul                7431  2 lrw,xts     dm_crypt               13973  0      dm_mod                 62853  1 dm_crypt     rndis_host              6143  0      cdc_ether               4584  1 rndis_host     usbnet                 17584  2 rndis_host,cdc_ether     arc4                    1345  2      sdhci_pci              10056  0      sdhci                  20883  1 sdhci_pci     firewire_ohci          27077  0      mmc_core               82856  3 mmc_block,sdhci_pci,sdhci     firewire_core          49742  1 firewire_ohci     crc_itu_t               1635  1 firewire_core     iwlwifi               233406  0      snd_hda_codec_conexant    43770  1      mac80211              338064  1 iwlwifi     cfg80211              156724  2 iwlwifi,mac80211     snd_hda_intel          22760  4      snd_hda_codec          88731  2 snd_hda_codec_conexant,snd_hda_intel     snd_pcm                73911  3 snd_hda_intel,snd_hda_codec     snd_timer              18324  2 snd_pcm     snd_page_alloc          7332  2 snd_hda_intel,snd_pcm     loop                   15063  0      vboxnetflt             12915  0      vboxdrv              1759366  1 vboxnetflt     fuse                   60817  1      thinkpad_acpi          64233  0      snd                    59641  12 snd_hda_codec_conexant,snd_hda_intel,snd_hda_codec,snd_pcm,snd_timer,thinkpad_acpi                  total       used       free     shared    buffers     cached     Mem:       8062552    6417912    1644640          0     427824    4174720     -/+ buffers/cache:    1815368    6247184     Swap:     12582908          0   12582908          /usr/lib64/pm-utils/sleep.d/00logging hibernate hibernate: success.     Running hook /usr/lib64/pm-utils/sleep.d/00powersave hibernate hibernate:     Blacklisting 01grub.          /usr/lib64/pm-utils/sleep.d/00powersave hibernate hibernate: success.     Running hook /usr/lib64/pm-utils/sleep.d/01grub hibernate hibernate:          /usr/lib64/pm-utils/sleep.d/01grub hibernate hibernate: success.     Running hook /usr/lib64/pm-utils/sleep.d/49bluetooth hibernate hibernate:          /usr/lib64/pm-utils/sleep.d/49bluetooth hibernate hibernate: success.     Running hook /usr/lib64/pm-utils/sleep.d/75modules hibernate hibernate:          /usr/lib64/pm-utils/sleep.d/75modules hibernate hibernate: success.     Running hook /usr/lib64/pm-utils/sleep.d/90clock hibernate hibernate:          /usr/lib64/pm-utils/sleep.d/90clock hibernate hibernate: success.     Running hook /usr/lib64/pm-utils/sleep.d/94cpufreq hibernate hibernate:          /usr/lib64/pm-utils/sleep.d/94cpufreq hibernate hibernate: success.     Running hook /usr/lib64/pm-utils/sleep.d/95led hibernate hibernate:          /usr/lib64/pm-utils/sleep.d/95led hibernate hibernate: success.     Running hook /usr/lib64/pm-utils/sleep.d/98video-quirk-db-handler hibernate hibernate:     Kernel modesetting video driver detected, not using quirks.          /usr/lib64/pm-utils/sleep.d/98video-quirk-db-handler hibernate hibernate: success.     Running hook /usr/lib64/pm-utils/sleep.d/99video hibernate hibernate:          /usr/lib64/pm-utils/sleep.d/99video hibernate hibernate: success.     Sun Oct 21 15:26:08 CEST 2012: performing hibernate      In the `/var/log/syslog` I found the following line:               Oct 21 15:27:10 lenovo kernel: PM: Hibernation image not present or could not be loaded.      Here's my grub config:               title Gentoo Linux     root (hd0,0)     kernel /3.4.9-gentoo root=/dev/sda3 rootfstype=ext4 resume=swap:/dev/sda2 i915.modeset=1 fan_control=1      `/dev/sda2` is my swap partition. What could be wrong?


title: where is log file of Gnome 3?

text: I've just installed gnome3 on openSUSE 11.4 following these instructions but when from `kdm` I try to load gnome3, it just shows me a page saying that it cannot load and it doesn't give me any further information about what is the problem. Where should I look for log file that stores error messages?


title: Syntax errors in a bash script executed from tcsh

text: I wrote the line below in order to verify if the first or second fields of a list of numbers are equal to 146. I want to run the line from `tcsh`, with one line interpreted by `bash`. What's the problem here?               echo $numbers     146 146 0 16 16 10 42 12 10 32 32 3 2 32 26     tcsh          bash -c 'for i in 1 2; do if [ 146 = `echo $numbers | cut -f$i  -d' ' ` ]; then echo "NUM is OK "; fi done'      The errors:               ` ]; then echo "NUM is OK "; fi done: -c: line 0: unexpected EOF while looking for matching ``'     ` ]; then echo "NUM is OK "; fi done: -c: line 1: syntax error: unexpected end of file


title: supported 2014 distro with 2.6.x kernel

text: I'm cutting my teeth at putting together a Linux install for a PC104 board that supports <= kernel 2.6.x with a Disk-On-Chip. I've read up on Embedded.org and Yocto, but before I try compiling totally from source I'd like to try and use an available distro. Ubuntu 8.04 boots just fine from usb but I need sys/acl and zlib.h packages to build the mtd-tools binary that will allow me to mount the Disk-On-Chip. The universe/multiverse repos for hardy are now totally dead. Is there another distro the uses a 2.6.x kernel suitable for this task? Preferably one who's repos are not set to expire in the near future. Are all of the repos for Debian Etch still up? I'm open to a CentOS based solution as well.


title: How to add system alias?

text: I have this alias in my `.zshrc`:               alias grim='gvim --remote'      But this is not seen from ranger file manager, I believe that ranger runs a 'generic' shell skipping my `.zshrc`. I want to make this alias visible in every shell. I added it to `~/.profile` and to `/etc/zsh/zshrc` but no effect. To be specific a got this message:               /bin/sh: grim: not found


title: Chinese characters instead of Latin being written to file

text: When I run `sed` like this and print to a console everything is fine:               sed '/Q/{     s/Q//g     r /Users/ericbrotto/Desktop/question.txt     }' Commision.txt      But when I do this and output t a file:               sed '/Q/{     s/Q//g     r /Users/ericbrotto/Desktop/question.txt     }' Commision.txt > newFile      ...my new string (the one that was properly replaced in the previous output) now reads as a bunch of asian (I believe Mandarin) characters. Any ideas? This is a follow up problem to a question I posed earlier.


title: Turning an old computer into a network firewall

text: I have an old Dell Dimension with two ethernet cards, and I need to turn it into a firewall. I've tried FireStarter and IPCop, but I don't think I'm setting them up right. Here's the setup that I'm trying to accomplish: I need to have one ethernet card plugged directly into the modem, and the other ethernet card plugged into a 16-port switch/hub. Part of the problem is that I've never done this before and despite hours of Googling, I'm still not sure where to start. I don't need anything fancy or endlessly configurable - I just need some basic protection that I can tweak out later. The bottom line is that it's 10:45p, everyone else left the office at 5p, and I'm still trying to get this taken care of. Thanks in advance for any help.


title: How intelligent are unix utilities?

text: Unix utilities like sort, find, grep, diff et al are very handy to perform quick tasks, sometimes without writing any code at all. I wanted to know what algorithms do they internally use and how do intelligently decide a specific algorithm for a specific task? For example if sort gets a huge input file, will it use different algorithms for different data sizes? Does grep intelligently switch algorithms while searching different data sets?


title: Setting regions in a Screen session

text: I'm trying to get a 'Screen' with 4 tabs to split the screen into 4 regions. I'm running 4 instances of bfgminer. One instance per USB Hardware miner. Unfortunately it has to be this way. So I'm trying to get all 4 outputs on 1 screen. I am starting up screen with the following config file, to give me 4 tabs that I can switch between.                   screen -t  USB0         select 0         stuff "command /home/pi/Mining/bfgminer --scrypt -c miner.conf         screen -t USB1         select 1         stuff "command /home/pi/Mining/bfgminer --scrypt -c miner.conf         screen -t USB2         select 2         stuff "command /home/pi/Mining/bfgminer --scrypt -c miner.conf         screen -t USB3         select 3         stuff "command /home/pi/Mining/bfgminer --scrypt -c miner.conf              altscreen on         term screen-256color                                                   bind ','         prev                                                                           bind '.' next          #                                                                                #change the hardstatus settings to give an window list at the bottom of the             #screen, with the time and date and with the current window highlighted                 hardstatus alwayslastline                                                               #hardstatus string '%{= kG}%-Lw%{= kW}%50> %n%f* %t%{= kG}%+Lw%< %{= kG}%-=%c:%         hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%      I found it in an old post on here somewhere. And tweaked it a bit for my needs. From reading the Screen man pages, I think that the 'Regions' function should allow me to get all 4 tabs split on 1 screen instead of having to use `Ctrl`+`A`, `CTRL`+`,` just to look at the next screen. How can I get Screen to show all 4 instances of bfgminer, on one single screen? I'm going to be using ssh to get onto my Pi and check the miners from time to time, and it'll be a lot easier with only 1 logon, and screen to run.


title: Samba reporting not enough free space

text: After having some problems with my NAS, I switched to Debian/Lenny. I've managed to install and configure most of the software I need, but I've hit a brick wall with Samba. I can access the shares and read all the files, but if I try and send anything across it tells me there's not enough space. I'm using Windows, so I opened a command prompt and ran               > dir \\MyNAS.home\Public       1 File(s)     44,814,336 bytes       12 Dir(s)  507,998,060,544 bytes free The free space reported is correct (~500GB), so what's the problem? The following is my smb.conf:               [global]       workgroup = MEDUS       realm = WORKGROUP       netbios name = MyNAS       map to guest = bad user       server string = My Book Network Storage       load printers = no       printing = bsd       printcap name = /dev/null       disable spoolss = yes       log file = /var/log/samba/log.smbd       max log size = 50       dead time = 15       security = share       auth methods = guest, sam_ignoredomain, winbind:ntdomain       encrypt passwords = yes       passdb backend = smbpasswd:/opt/etc/samba/smbpasswd         create mask = 0664       directory mask = 0775       local master = no       domain master = no       preferred master = no       socket options = TCP_NODELAY SO_RCVBUF=65536 SO_SNDBUF=65536       min receivefile size = 128k       use sendfile = yes       dns proxy = no       idmap uid = 10000-65000       idmap gid = 10000-65000       dont descend = /proc,/dev,/etc       admin users =       null passwords = yes       guest account = nobody       unix extensions = no           [Public]       path=/shares/internal/PUBLIC       guest ok = yes       read only = no       dfree cache time = 10       dfree command = /opt/etc/samba/dfree      The `dfree command` parameters I added myself, in an attempt to fix the problem (which didn't work). However, I suspect that the NAS is reporting the correct disk space anyway, as evident from the results of the command I used above. I've also tried playing around with the `block size` command, to no avail. I _was_ able to create an empty text file on the share, and I repeatedly edited and saved the file -- it stopped at around 130 bytes. Does anyone have any idea what the problem might be?


title: How does X11 forwarding work?

text: How does X11 forwarding work? I am interested in knowing whether the processing to render graphics is done at the end of the host running the application or the host displaying the graphical interface? Should I use a GPU intensive application (game) - where should I have the GPU installed (server end / client end)? Of course the server will need the GPU if it is running CUDA / openCL applications, but what about the display? * * * This question was closed on StackOverflow. This was a link pointed to me, but I am looking to understand more of the underlying protocol and performance tweaks.


title: Linux: allowing an user to listen to a port below 1024

text: I need to allow an user (different from root) to run a server listening on port 80. Is there any way to do this?


title: Tuning a CentOS VM running on an MDRAID-based XenServer storage repository

text: I've run out of ideas for tuning disk write speeds on a handful of CentOS VMs running on a lab XenServer 6.2 host. Running under the free license (so vendor support not a concern), the lab host is a glorified desktop with 3 x WD3200AAKS disks I'm using for a bit of fun. Firstly, I installed XenServer on a USB stick and configured a software RAID5 array of the three disks to act as a storage repository. XenServer puts an LVM on this, which it then carves up into the virtual disks for the VMs. CentOS 6.4 is installed from the minimal CD, with either an ext3 or ext4 filesystem. i.e.:               /dev/sd[bcd] -> /dev/sd[bcd]1 -> /dev/md0 -> lvm -> vol1 -> xvda -> xvda1 -> ext3      The write speed in a freshly-installed VM was roughly 9.5MB/s (averaged across various `dd if=/dev/zero of=~/spool.tmp bs=<X>` and `dd if=/dev/zero bs=<X> | pv > ~/spool.tmp` runs). So I started from the top, looking at direct writes to the RAID device (`dd if=/dev/zero of=/dev/md0`), tweaking the `stripe_cache_size` of md0 (along with `blockdev --setra` for the md0 and underlying sd[bcd], and `max_sectors_kb` for good measure), until I got from approx 12MB/s to a more- reasonable 59MB/s. I recreated the storage repo and carved out a new VM, did the miminal install of CentOS 6.4 and tried my test again. I'm still only getting 9-12MB/s on average (peaking at about 19MB/s for a few seconds). With higher readahead settings, I can achieve an easy 200MB/s _read_ (`dd if=~/spool.tmp bs=4K | pv > /dev/null`), and my baseline /dev/zero read speed is approx 240MB/s, but I'm stuck with this lousy write speed and I don't know what else to try. What else can I look at? * * * Some detail below, of anything I thought might be pertinent, for reference:               [root@host ~]# parted     Model: ATA WDC WD3200AAKS-7 (scsi)     Disk /dev/sdb: 320072933375B     Sector size (logical/physical): 512B/512B     Partition Table: gpt          Number  Start          End            Size           File system  Name  Flags      1      1048576B       309237645823B  309236597248B               sdb1             2      309237645824B  310311388159B  1073742336B                 sdb2                 Model: ATA WDC WD3200AAKS-7 (scsi)     Disk /dev/sdb: 320072933375B     Sector size (logical/physical): 512B/512B     Partition Table: gpt          Number  Start          End            Size           File system  Name  Flags      1      1048576B       309237645823B  309236597248B               sdb1             2      309237645824B  310311388159B  1073742336B                 sdb2                 Model: ATA WDC WD3200AAKS-7 (scsi)     Disk /dev/sdd: 320072933375B     Sector size (logical/physical): 512B/512B     Partition Table: gpt          Number  Start          End            Size           File system  Name  Flags      1      1048576B       309237645823B  309236597248B               sdd1             2      309237645824B  310311388159B  1073742336B    ext3         sdd2                 [root@host ~]# cat /proc/mdstat     Personalities : [raid6] [raid5] [raid4]      md0 : active raid5 sdb1[0] sdd1[2] sdc1[1]           603977600 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU]           bitmap: 3/144 pages [12KB], 1024KB chunk          unused devices: <none>          [root@host ~]# cat /sys/block/md0/md/stripe_cache_size     4096     [root@host ~]# cat /sys/block/sd[bcd]/queue/max_sectors_kb     16384     16384     16384     [root@host ~]# blockdev --getra /dev/sd[bcd] /dev/md0     4096     4096     4096     512              [root@host~]# vgdisplay VG_XenStorage-c9e965db-ed0f-3fdb-7d40-abbf2bda20e4       --- Volume group ---       VG Name               VG_XenStorage-c9e965db-ed0f-3fdb-7d40-abbf2bda20e4       System ID                    Format                lvm2       Metadata Areas        1       Metadata Sequence No  24       VG Access             read/write       VG Status             resizable       MAX LV                0       Cur LV                6       Open LV               4       Max PV                0       Cur PV                1       Act PV                1       VG Size               575.98 GB       PE Size               4.00 MB       Total PE              147452       Alloc PE / Size       25663 / 100.25 GB       Free  PE / Size       121789 / 475.74 GB       VG UUID               jjdM19-L505-a0UW-tT4Z-ThbL-LK0A-Ml0bKr     [root@host~]# lvdisplay /dev/VG_XenStorage-c9e965db-ed0f-3fdb-7d40-abbf2bda20e4/VHD-ee6ae3d2-18ab-4b14-902c-4019b832ea59        --- Logical volume ---       LV Name                /dev/VG_XenStorage-c9e965db-ed0f-3fdb-7d40-abbf2bda20e4/VHD-ee6ae3d2-18ab-4b14-902c-4019b832ea59       VG Name                VG_XenStorage-c9e965db-ed0f-3fdb-7d40-abbf2bda20e4       LV UUID                euBFtP-e8Hf-EzoP-AVe1-4jZO-mb3x-SaiW2i       LV Write Access        read/write       LV Status              available       # open                 1       LV Size                16.04 GB       Current LE             4106       Segments               1       Allocation             inherit       Read ahead sectors     auto       - currently set to     1024       Block device           252:2          [root@vm ~]# parted     Model: Xen Virtual Block Device (xvd)     Disk /dev/xvdc: 17179869184B     Sector size (logical/physical): 512B/512B     Partition Table: msdos          Number  Start     End           Size          Type     File system  Flags      1      1048576B  17179869183B  17178820608B  primary  ext3          [root@vm ~]# blockdev --getra /dev/xvdc     4096     [root@centos02 xvdc1]# tune2fs -l /dev/xvdc1 | grep Block     Block count:              4194048     Block size:               4096     Blocks per group:         32768     [root@centos02 xvdc1]# tune2fs -l /dev/xvdc1 | grep RAID     RAID stride:              16     RAID stripe width:        32


title: file-roller doesn't use single-click anymore?

text: In the old days, I can navigate in file-roller with only single click, now I had to do a double click, anyone know if this is configurable?


title: 2 consecutive ssh logins

text: > **Possible Duplicate:**   >  Common multiple SSH connections file handling issue I used to do something like that often:               home $> ssh user@server1     user@server1's password:     server1 $> ssh user@server2     user@server2's password:     server2 $>      Server2 is available from server1 only, so I have to do stuff like that all time. So, question is. How can I do 2 consecutive logins in one command?               home $> ssh_many user@server1 user@server2     user@server1's password:     user@server2's password:     server2 $>


title: How to chain SSH?

text: > **Possible Duplicate:**   >  Common multiple SSH connections file handling issue I want to reach hosts that are only indirectly accessible with SSH/SCP/SFTP.      Are there more solutions for this?   Are there any **small** and **clean** howtos for it?      E.g.:                 SERVER-A     |     SERVER-B     |     CLIENT      I need to reach SERVER-A from the CLIENT with SCP.   SERVER-A is "behind" SERVER-B.


title: Sourcing bashrc file fails with ssh -t

text: ssh -vvv -F /home/me/.ssh/config serva -t "source ~/.bashrc"      This is the output I get when I use `-vvv` flag:               debug1: Authentication succeeded (publickey).                         debug1: channel 0: new [client-session]                               debug3: ssh_session2_open: channel_new: 0                             debug2: channel 0: send open                                          debug1: Requesting no-more-sessions@openssh.com                       debug1: Entering interactive session.                                 debug3: Wrote 128 bytes for a total of 2413                           debug2: callback start                                                debug2: client_session2_setup: id 0                                   debug2: channel 0: request pty-req confirm 1                          debug1: Sending command: source ~/.bashrc                             debug2: channel 0: request exec confirm 1                             debug2: fd 3 setting TCP_NODELAY                                      debug2: callback done                                                 debug2: channel 0: open confirm rwindow 0 rmax 32768                  debug3: Wrote 400 bytes for a total of 2813                           debug2: channel_input_status_confirm: type 99 id 0                    debug2: PTY allocation request accepted on channel 0                  debug2: channel 0: rcvd adjust 2097152                                debug2: channel_input_status_confirm: type 99 id 0                    debug2: exec request accepted on channel 0                            debug1: client_input_channel_req: channel 0 rtype exit-status rep     ly 0                                                                  debug1: client_input_channel_req: channel 0 rtype eow@openssh.com      reply 0                                                              debug2: channel 0: rcvd eow                                           debug2: channel 0: close_read                                         debug2: channel 0: input open -> closed                               debug2: channel 0: rcvd eof                                           debug2: channel 0: output open -> drain                               debug2: channel 0: obuf empty                                         debug2: channel 0: close_write                                        debug2: channel 0: output drain -> closed                             debug2: channel 0: rcvd close                                         debug3: channel 0: will not send data after close                     debug2: channel 0: almost dead                                        debug2: channel 0: gc: notify user                                    debug2: channel 0: output drain -> closed                          debug2: channel 0: rcvd close                                      debug3: channel 0: will not send data after close                  debug2: channel 0: almost dead                                     debug2: channel 0: gc: notify user                                 debug2: channel 0: gc: user detached                               debug2: channel 0: send close                                      debug2: channel 0: is dead                                         debug2: channel 0: garbage collecting                              debug1: channel 0: free: client-session, nchannels 1               debug3: channel 0: status: The following connections are open:       #0 client-session (t4 r0 i3/0 o3/0 fd -1/-1 cfd -1)                   debug3: channel 0: close_fds r -1 w -1 e 6 c -1                    debug3: Wrote 32 bytes for a total of 2845                         debug3: Wrote 64 bytes for a total of 2909                               The server side log has the following message: `sshd[18763]: Received disconnect from` ... I am using CentOS 6.4 ### Edit My original question was flawed. Sorry about that. What I wanted to execute bash shell with the rc file I wanted (~/.bashrc_temp) and then execute something else. I think PROMPT_COMMAND is the recommended option it seems like, or having the command executed within ~/.bashrc_temp itself, which is less than ideal, but I can probably put some conditional statements.


title: What timezone formats are there?

text: What timezone formats exists on UNIX systems? Can someone gather them in a short answer? How can I recognize them?


title: make: *** No targets. Stop while building linux kernel module

text: I am just trying to learn how to driver modules for Linux Kernel. I followed Linux Device drivers 3rd edition book and started my work. I created a sample program and makefile. Please find my makefile contents below.               obj-m += testModule.o     make -C /lib/modules/3.2.36/build M=$(PWD) modules      I saved this makefile in my home directory. Whenever I am trying to execute this file using               make      command I am getting               make: *** No targets.  Stop      error. Can someone please help me? Thanks in advance.


title: How to tail/grep/awk the last N bytes of a file, rather than lines

text: I have an application that is logging to a plain text log file (myapp.log) but it doesn't seem to be writing new line characters at the end of each log entry. If I execute a command like `tail -n 50 myapp.log` I actually receive hundreds of "lines" of text (log entries). This log file is very large, roughly 1GB, who knows how long ago the last CR and/or LF was inserterd. How can I just grab say, the last 2MBs for example?


title: debian apt-get dist-upgrade from squeeze to wheezy failing on vlc

text: I can't continue until I solve this bug, I've tried removing the dpkg so it redownloads it but it still has this error when trying to dist-upgrade, or now, apt-get -f install.               root@hayek:~# apt-get -f install     Reading package lists... Done     Building dependency tree            Reading state information... Done     Correcting dependencies... Done          [Omitted outout]          The following NEW packages will be installed:       cpp-4.6 gcc-4.6 libvlccore5 linux-headers-3.2.0-3-amd64 linux-headers-amd64       The following packages will be upgraded:       vlc vlc-data       2 upgraded, 5 newly installed, 1 to remove and 486 not upgraded.       1346 not fully installed or removed.       Need to get 0 B/19.3 MB of archives.       After this operation, 39.9 MB of additional disk space will be used.       Do you want to continue [Y/n]?           Reading changelogs... Done     (Reading database ... 204688 files and directories currently installed.)     Preparing to replace vlc 1.1.3-1squeeze6 (using .../vlc_1%3a2.0.3-dmo2_amd64.deb) ...     Unpacking replacement vlc ...     dpkg: error processing /var/cache/apt/archives/vlc_1%3a2.0.3-dmo2_amd64.deb (--unpack):      trying to overwrite '/usr/share/doc/vlc', which is also in package vlc-data 1.1.3-1squeeze6     Processing triggers for man-db ...     Errors were encountered while processing:      /var/cache/apt/archives/vlc_1%3a2.0.3-dmo2_amd64.deb     E: Sub-process /usr/bin/dpkg returned an error code (1)      does anyone know what to do?


title: signal handling in the unix kernel

text: I was reading The Design Of UNIX OS and had a doubt. A signal handling function can be specified in the signal() call. The handler is supposed to execute when the process receives that particular signal. An algorithm known as psig runs to handle signals if they are received by a process. In case of a user defined handler being specified, the psig algorithm modifies the user level context (i.e. pushes a frame at the top of the stack with the stack pointer pointing to the top of the stack) This frame indicates the execution of the handling function. If the above mentioned is true, the signal handling function should always be executed after a return from the signal() call (as the stack frame at the top of the stack will be seen by the kernel first). However, this is not true as i can specify a signal handler for a particular signal earlier in my code (lets say in main()) and send a signal at a later point of time in code. The signal handling function is only executed when the signal is sent (say by the kill() call) and not immediately after the signal() call. Can anyone please clarify?


title: Is there anyway to run gnome desktop via a remote x window ssh tunnel?

text: I'd like to run the DE remotely in a window of it's own on my local workstation. When I tried the naive `gnome-session` from an x-window tunnel it tried to takeover my local xfce desktop, got as far as changing the wallpaper before crashing.


title: I cannot enter the vertical line character in OSX terminal

text: I'm using a Mac and I'm piping some data from `curl` to `tar` and when I went to hit the `|` in the terminal I got the `o` with an umlaut. It totally works fine, as the unicode character still comes up as U+007C, which maps to the vertical line, but it doesn't display the right character. How do I fix it to show the right character?


title: Executing a remote command on SSH connection, before login

text: I am trying to find a way to execute a specific command when connecting to a server via SSH. By this I mean, the command will execute unconditionally on opening a connection, so this would preferably be run at the same time that a `Banner` option would be printed if set. I am not trying to run a command _after_ logging in. What I'm after, for example:               $ ssh bob@website.com     (Command essentially executed at this point, before the input prints.)     bob@website.com's password:       The reason I'm trying to do this is that I would like to run a short script which sends push notifications to my phone whenever a connection is made, regardless of whether I login or not. I had planned to use pam_exec, but this only triggers `auth` if a password is entered and enter is pressed, and the `account` and `session_*` modules only trigger on a successful login. If a connection is opened, but then closed such as when a user simply hits Ctrl+C, then the script will never be run. Is there any method for doing this? I'm not finding much information on the subject.


title: How to make `less -FX' play nice with a 2-line shell prompt

text: My shell prompt is two lines long (a fancier version of `[%n@%m %~]'$'\n''%#`. I have $LESS set to `-FX`. When I quit less, it leaves a single line at the end of my screen, and since my prompt has two lines, the first line of the less output scrolls outside of the terminal window. I'd rather lose the last line of the output then the first line. Is there any solution for this problem?


title: How can I cp different files to an alias that is changing

text: I would like to be able to replace               cp x.x ~/some/long/directory/that/is/deeply/nested/      with               cp x.x s1      where s1 is an alias that points to `/some/long/directory/that/is/deeply/nested/` However the destination frequently changes.   Today it is               /some/long/directory/that/is/deeply/nested/      next day it is               /some/long/directory/less/deep      next day it is               /some/other/directory/less/deep      Given that it is changing all the time is there an alias (or more likely function? as I think about it), is there a way I can do a cp with the destination being an 'interpreted' alias something like               cp x.x `s`      The 'source' file was also be many different values. I don't want an alias that just points to one (or a list of a few) location or is for 1 (or a list of a few) source file. I want it to be whatever the alias points to at that time and the filename would be supplied when invoking it. Source and destination could be any of thousands of values.


title: Spawning GDM/Display manager within already existing X11 session

text: I know that this is possible, I've seen it done, but I've forgotten the command. Basically, what I want to do (for various reasons) is to spawn a GDM/Gnome/etc session (a new one) from within my current session. I don't want to use another tty. I want it to be windowed, and appear under my current session, so I can easily Alt+Tab, start/stop the session easily. Ideally I'll be able to do something to the effect of: `<command> /path/to/gdm`


title: Why does this Bash NRPE plugin not return a variable to Nagios?

text: This is a very specific question I have here, maybe one has a simple answer for it. This script I have here works locally just fine:               #! /bin/bash     volts=`sudo vcgencmd measure_volts core|sed 's/volt=\([0-9\.]*\)V/\1/'`     echo -n "BCM2835 SoC Voltage is ${volts}V "     echo "| volts=$volts;1.5;1.5;0;1.5"      However if Nagios tries to get the information it only gets "BCM2835 SoC Voltage is V" as if the variable was not defined. There are also other plugins which pull the information from files and it works. So I managend to write the information in a temp file and write it back into the variable.               #! /bin/bash     sudo vcgencmd measure_volts core|sed 's/volt=\([0-9\.]*\)V/\1/'>/tmp/volts     volts=$(</tmp/volts)     echo -n "BCM2835 SoC Voltage is ${volts}V "     echo "| volts=$volts;1.5;1.5;0;1.5"      Now I am able to see the value in Nagios, but why does this only work locally and not remotely? Is it possible to make it without a temp file?


title: ext4 data recovery from gparted error

text: During resizing and moving 2.7TB partition in Gparted, I encountered an error that froze the whole program. (I dont have a screenshot or output from it, as fas as I remember, it was something about error when reading partition). I ran `mkfs.ext4 -S` and `fsck.ext4 -y`.   It took it couple of days,then the system was crashing because it ran out of RAM and SWAP (8+8GB). After adding 200GB of swap, `fsck` ran for about two weeks but suddenly stopped with an error, unfortunately I didnt screenshot. I tried running the same combination of `mkfs` and `fsck` again, but this time every time `fsck` ran, it made two cores of my CPU to go 100% and utterly froze the entire system. Not even `alt+sysrq REISUB` worked. This happened 2-3 times. The current output from `fsck` is: > `ext2fs_open2: Bad magic number in super-block fsck.ext4: Superblock > invalid, trying backup blocks... fsck.ext4: Bad magic number in super-block > while trying to open /dev/sdd1 The superblock could not be read or does not > describe a valid ext2/ext3/ext4 filesystem. If the device is valid and it > really contains an ext2/ext3/ext4 filesystem (and not swap or ufs or > something else), then the superblock is corrupt, and you might try running > e2fsck with an alternate superblock: e2fsck -b 8193 <device> or e2fsck -b > 32768 <device>` when running `sudo e2fsck -b 8193 or 32768`, the output is: > `e2fsck: Attempt to read block from filesystem resulted in short read while > >trying to open /dev/sdd1 Could this be a zero-length partition?` I tried running `testdisk` but it stops at 2026 cylinder and does not go any further no matter how long I wait. I do have a backup made by `ddrescue`, but because of that I completely ran out of free space on any of my drives. I fear, that error during moving/resizing partitions has made all the data on the partition chopped up and unintelligible to data recovery software. I will appreciate any kind of suggestion as to what my next step should be.   Should I give up and `dd` the image back to the partition and try again with `fsck`?   Thank You


title: Executing a shell on remote unix server through jumphost from local machine

text: I would like to excute a shell script on a remote unix server. Now, I dont have direct connectivity to this server. I must go through jumphost which is also unix box. I want to make a batch file which execute the script on the remote server in one go. Below diagram may help to understand this better. Local Machine-->Jumphost (Unix box)-->Remote unix server-->execute shell script My batch job will connect to jumphost using telnet and then it should connect to remote server and execute the script. How to do this in "one" go ??


title: Tracking huge buffer usage under Linux

text: I have a Linux server running under Debian Lenny with 4Go of RAM. It doesn't run much, just:   * Postfix/spamassassin (daemon mode)   * Bind9   * KVM (one guest - 1Go of RAM for it) Every day at exactly 3:05 UTC, the server completely drop to ground floor almost all of its memory. After that, I have more than 2G used by buffer and never cleaned up (unless I manually tell the kernel to drop the cache). I'v searched the web a lot and, at the begining, I though this was due to NFS buffer usage. I do backups over an NFS share drive using gzip/tar and the backup occured at 3:05. However, I'm now in a very strange situation because I moved the backup task at 1:40 (it completes in 2 mins) and I still drop all the RAM at 3:05. In my logs, nothing particular, except that at 03:05:01, cron open a session as root and immediately close it at 03:05:02 without doing anything. Of course, cron has been restarted and I checked the timing of the tasks - again, nothing particular. Any idea why this happens? Or, any idea about how to track what's using all those buffers? * * * **Edit** : The server is running in UTC, all times here are UTC. It's not running any NFS server and I don't have mlocate or slocate installed. For the crontab, daily and user crontabs, nothing is done at that hour. Here's the interesting part in my logs about cron: > auth.log-20110501:May 1 03:05:01 SRV CRON[15914]: pam_unix(cron:session): > session opened for user root by (uid=0)   >  auth.log-20110501:May 1 03:05:01 SRV CRON[15914]: pam_unix(cron:session): > session closed for user root   >  syslog-20110501:May 1 03:05:01 SRV /USR/SBIN/CRON[15915]: (root) CMD ([ -x > /usr/lib/sysstat/sa1 ] && { [ -r "$DEFAULT" ] && . "$DEFAULT" ; [ "$ENABLED" > = "true" ] && exec /usr/lib/sysstat/sa1 $SA1_OPTIONS 1 1 ; })


title: How to run my C program from anywhere within the System (Ubuntu 10.10)?

text: Friends, I want to add my C program's path to the environment variable PATH. My C program called "md5". So that I can execute it from anywhere (i.e any directory). My md5 program is located at `/home/ahuq/MappingServer/md5_program`. So what I did was to put:               export PATH=$PATH:/home/ahuq/MappingServer/md5_program      in the running shell. This only makes temporary changes and lets me run the `md5` program from anywhere temporarily.               root@ahuq-kitchen:/home/ahuq# md5 -sanis     MD5 ("anis") = 38a1ffb5ccad9612d3d28d99488ca94b      But I want to make this change permanent. I tried to put the line `PATH=$PATH:/home/ahuq/MappingServer/md5_program` at the end of `/home/ahuq/.bashrc` and `/home/ahuq/.profile` files. I logged out of the shell and went in again. But it didn't work:               root@ahuq-kitchen:/home/ahuq# md5 -sanis     No command 'md5' found, did you mean:     Command 'cd5' from package 'cd5' (universe)     Command 'mdu' from package 'mtools' (main)     Command 'mdb' from package 'mono-debugger' (universe)     md5: command not found      Maybe I am putting the `PATH` statement in the wrong place of the above mentioned files. There are a lot if-else-fi structures inside those two files. Do I need to put the `PATH` statement inside any of those structures? Do I just logout or do I have to restart the system to make the changes active?


title: bash script that print cpu usage,diskusage,ram usage

text: As we know that for sysadmins uses commands `top` for cpu usage, `free -m` for memory, `df -lh` for hdd space. I want to cut just usage details of cpu, memory, and Hdd. I need to make three commands and put it in bash script that print used details of cpu usage (used % average all cores in multi core cou), disk usage (only / partition %) , Ram (only used MB in %) as shown below. Desired output:               CPU: 70     RAM: 45     HDD: 10


title: Replacing stdout with stderr

text: Is it possible to redirect the output from a command to replace the text sent to stdout with the text from stderr?               $ ./script     this line is redirected to stdout     this line is redirected to stderr          $ ./script (insert redirections here)     this line is redirected to stderr      I know I could just use `1>/dev/null`, but I want to know if there's a way to do this with the text from stderr redirected to stdout.


title: mark or color empty directories for `ls`

text: `ls`'s `-F` flag allows to see the types of file and distinguish directories. Is there a way to add a functionality to distinguish an empty directory?


title: Can this find command be made more compact?

text: Please look at these two commands: `find ~/{Documents,Desktop,Downloads,Music,Videos} -mmin -120 -type f`   and   `find . ! -path "*opera*" ! -path "*mozilla*" ! -path "*google-chrome*" -mmin -120 -type f` While the first tells `find` to give results relating to specific folders, the second does the opposite. But is there a way to make the second command more compact or does `! path` have to precede each folder? The OS is Lubuntu 12.10.


title: Debian Squeeze on HP Pavilion d7 with Sandy Bridge and ATI 6740 - display problems

text: After a fresh install of Debian Squeeze 6.0.7 on an HP Pavilion d7 laptop - the option to install the `laptop` packages was checked on the installer - the monitor was not recognized on `gnome-display-properties`, that is, on `System > Preferences > Monitors`. The resolution was very low and couldn't be changed. `lspci` outputed `Sandy Bridge rev 9` and `ATI 6740` as the VGA controllers. `uname -r` outputed `2.6.32-5-amd64` as the kernel. Doing some googling it seems that the `2.6.32` kernel does not support Sandy Bridge, and upgrading to wheezy seems to work. I don't want to upgrade, so I did some more research and installing `mesa-tools` was recommended, but that was already built-in. I tried installing ATI's proprietary drivers, that is, `fglrx-driver`, and rebooting, but that didn't solve the problem either. So I gave up and tried to upgrade from squeeze to wheezy following this guide, but it failed miserably - not only the kernel wasn't updated, some packages failed to install, others wouldn't open, and I had a lot of errors on boot-up. So...   1. Can this problem be solved in squeeze? If updating the kernel is absolutely necessary, how should I do it? The `2.6.38` and the `2.6.39` backports seem to work with those VGA controllers, but they are no longer available on the official backports, and `3.2` seems to have a few issues with squeeze.   2. If there is no option but upgrading to wheezy, how should I do it - that is, from squeeze, without needing to download a new netinst. I'm currently downloading wheezy netinst from debian.org, which should solve all problems, but I've been using squeeze for so long on other computers and I really like the stability of it, so if it's possible to stay with squeeze that'd be great.


title: Why $SHELL doesn't change when I run new shell?

text: $ echo $SHELL     /bin/bash      $ /bin/ksh93      $ echo $SHELL     /bin/bash      $ file /bin/ksh93     /bin/ksh93: ELF 64-bit LSB executable, x86-64, version 1 (SYSV),      dynamically linked (uses shared libs), for GNU/Linux 2.6.8, stripped           $ getent passwd test111     test111:x:1008:1008:,,,:/tmp:/bin/ksh93      $ ssh test@localhost     test@localhost's password:      $ echo $SHELL     /bin/ksh93      $ bash      $ echo $SHELL     /bin/ksh93      I expect the `$SHELL` to change after running another shell. Why doesn't it? P.S. However the shell does change, only $SHELL variable remains the same:                $ dash      $ echo $SHELL     /bin/bash      $ T=test ; [[ $T = *est ]] && echo ok     dash: [[: not found


title: mount error 13 = Permission denied

text: One of my servers is set up to automatically mount a Windows directory using fstab. However, after my last reboot it stopped working. The line in fstab is:               //myserver/myfolder /mnt/backup cifs credentials=home/myfolder/.Smbcredentials      The `.Smbcredentials` file is:               username=myaccount     password=mypassword     domain=mydomain      I do a `mount -a` and I receive `mount error 13 = Permission denied`. If I do this enough it will lock out my Windows account, so I know it's trying. I've checked that my password is correct. What am i doing wrong?


title: Gentoo Kernel failing to boot

text: My machine has two hard drives -- `/dev/sda` and `/dev/sdb`. The first has Ubuntu installed. On the second, `sdb`, I want to install Gentoo. I did all the installation steps, `chrooted` and compiled the kernel, and installed `lilo`. In `lilo`'s configuration I have the following string:               append="root=/dev/sdb3"      /dev/sdb1 mounted as /boot. Lilo gives me a warning:               Warning: /dev/sdb is not on the first disk      When I try to boot I get:               unable to sync kernel panic. (Failed to find sdb3 on unknown device).      Is it any way related to the `lilo` warning? How do I fix it?


title: Present USE flags upon emerging a package in gentoo

text: I was wondering if there are any tools to present the compile time options/ flags of a package in Gentoo when emerging. I am referring to something like this


title: reserve resources for admin console

text: My servers is often almost DOS'ed by crawlers. I have not yet managed to figure out what exactly is responsible for the high load. CPU, memory and disk IO are not at the limit (could be network traffic). My question is, if anyone has an idea how to reserve capacity in the system to run a shell session (bash over ssh). Can this be done using cgroups? Right now load values easily go up to 60 and that make it hard to enter any command.


title: why does it take long for the bash prompt to return on high system load

text: When my server experiences high load and I run a command, there is a long delay after the command has finished before I get the prompt again. Any idea what is causing this?


title: Snapshot of drive

text: Does technology exist which allows you to take an instantanious snapshot of a drive? At the moment, I am using `dd` which takes a few minutes to create an image of a usb drive to my hdd. Is it possible to somehow take a snapshot instead? Not sure if this is technologically possible, but thought I should ask.


title: Evaluating uncorrectable ECC errors and fallback methods

text: I run a server which has just experienced an error I've not encountered before. It emitted a few beeps, rebooted, and got stuck at the startup screen (the part where the bios shows its logo and begins listing information) with the error: > Node0: DRAM uncorrectable ECC Error > > Node1: HT Link SYNC Error After a hard reset the system booted fine and has yet to report anything on edac-util. My research tells me that even with ECC memory and a system in ideal conditions, an uncorrectable error is still possible and probably will likely occur during the lifespan of the system at some point; some reports suggest at least once a year or sooner. The server runs CentOS 6.5 with several ECC modules. I am already in the process of trying to diagnose which module threw the error to make an assessment whether this is a fault or the result of something as unavoidable such as a cosmic ray. My research also suggests that when the system halts like this, there is nowhere for a log to be written and that the only reliable way to do this is to have the system attached to another with the log being written out through a serial port. Besides the usual edac-util, memtest, stress testing, and precautionary replacement, is there anything else I should take into consideration when addressing this error? I was unable to find any record of this crash in any of the CentOS logs I searched, which goes along with my belief that it is not possible to log this error to a local disk. The error was only reported to me by the bios after an automatic reboot. Is it advisable to be writing system logs out to serial at all times to log these kinds of errors? Is this kind of failure avoidable using a single system or is this only possible using an expensive enterprise solution? What can I do to provide fallback measures in these failure cases for a single production server; as in, the production server itself does not span multiple machines but a fallback server can exist.


title: Find out which process is in foreground on bash

text: I have a bash session open for which I have the PID, although I am not in control of the terminal (e.g. could be another user). This bash session has spawned some child processes. Is there any way to tell which (if any) of the child processes is currently in the foreground for that bash session?


title: Problems installing mysql on debian

text: I have a :               user@Node:~$ uname -a     Linux Node 2.6.32-042stab092.1 #1 SMP Tue Jun 24 09:10:28 MSK 2014 x86_64 GNU/Linux      With a :               user@Node:~$ cat /etc/debian_version      7.6      and I am having problems installing mysql server from repos !               user@Node:~$ sudo apt-get install mysql-server mysql-client     [sudo] password for user:      Reading package lists... Done     Building dependency tree            Reading state information... Done     The following extra packages will be installed:       libdbd-mysql-perl libmysqlclient18 mysql-client-5.5 mysql-common mysql-server-5.5     Suggested packages:       libterm-readkey-perl tinyca     The following NEW packages will be installed:       libdbd-mysql-perl libmysqlclient18 mysql-client mysql-client-5.5 mysql-common mysql-server mysql-server-5.5     0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded.     Need to get 0 B/5022 kB of archives.     After this operation, 74.5 MB of additional disk space will be used.     Do you want to continue [Y/n]? y     perl: warning: Setting locale failed.     perl: warning: Please check that your locale settings:         LANGUAGE = (unset),         LC_ALL = (unset),         LC_TIME = "en_US.UTF-8",         LC_MONETARY = "en_US.UTF-8",         LC_ADDRESS = "en_US.UTF-8",         LC_TELEPHONE = "en_US.UTF-8",         LC_NAME = "en_US.UTF-8",         LC_MEASUREMENT = "en_US.UTF-8",         LC_IDENTIFICATION = "en_US.UTF-8",         LC_NUMERIC = "en_US.UTF-8",         LC_PAPER = "en_US.UTF-8",         LANG = "en_US.UTF-8"         are supported and installed on your system.     perl: warning: Falling back to the standard locale ("C").     locale: Cannot set LC_CTYPE to default locale: No such file or directory     locale: Cannot set LC_MESSAGES to default locale: No such file or directory     locale: Cannot set LC_ALL to default locale: No such file or directory     debconf: unable to initialize frontend: Dialog     debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76, <> line 7.)     debconf: falling back to frontend: Readline     Preconfiguring packages ...     /usr/bin/locale: Cannot set LC_CTYPE to default locale: No such file or directory     /usr/bin/locale: Cannot set LC_MESSAGES to default locale: No such file or directory     /usr/bin/locale: Cannot set LC_ALL to default locale: No such file or directory     Configuring mysql-server-5.5     ----------------------------          While not mandatory, it is highly recommended that you set a password for the MySQL administrative "root" user.          If this field is left blank, the password will not be changed.          New password for the MySQL "root" user:                     Repeat password for the MySQL "root" user:                Selecting previously unselected package mysql-common.     (Reading database ... 28029 files and directories currently installed.)     Unpacking mysql-common (from .../mysql-common_5.5.38-0+wheezy1_all.deb) ...     Selecting previously unselected package libmysqlclient18:amd64.     Unpacking libmysqlclient18:amd64 (from .../libmysqlclient18_5.5.38-0+wheezy1_amd64.deb) ...     Selecting previously unselected package libdbd-mysql-perl.     Unpacking libdbd-mysql-perl (from .../libdbd-mysql-perl_4.021-1+b1_amd64.deb) ...     Selecting previously unselected package mysql-client-5.5.     Unpacking mysql-client-5.5 (from .../mysql-client-5.5_5.5.38-0+wheezy1_amd64.deb) ...     Processing triggers for man-db ...     locale: Cannot set LC_CTYPE to default locale: No such file or directory     locale: Cannot set LC_MESSAGES to default locale: No such file or directory     locale: Cannot set LC_ALL to default locale: No such file or directory     debconf: unable to initialize frontend: Dialog     debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)     debconf: falling back to frontend: Readline     Setting up mysql-common (5.5.38-0+wheezy1) ...     Selecting previously unselected package mysql-server-5.5.     (Reading database ... 28129 files and directories currently installed.)     Unpacking mysql-server-5.5 (from .../mysql-server-5.5_5.5.38-0+wheezy1_amd64.deb) ...     locale: Cannot set LC_CTYPE to default locale: No such file or directory     locale: Cannot set LC_MESSAGES to default locale: No such file or directory     locale: Cannot set LC_ALL to default locale: No such file or directory     debconf: unable to initialize frontend: Dialog     debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)     debconf: falling back to frontend: Readline     Selecting previously unselected package mysql-client.     Unpacking mysql-client (from .../mysql-client_5.5.38-0+wheezy1_all.deb) ...     Selecting previously unselected package mysql-server.     Unpacking mysql-server (from .../mysql-server_5.5.38-0+wheezy1_all.deb) ...     Processing triggers for man-db ...     locale: Cannot set LC_CTYPE to default locale: No such file or directory     locale: Cannot set LC_MESSAGES to default locale: No such file or directory     locale: Cannot set LC_ALL to default locale: No such file or directory     debconf: unable to initialize frontend: Dialog     debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)     debconf: falling back to frontend: Readline     Setting up libmysqlclient18:amd64 (5.5.38-0+wheezy1) ...     Setting up libdbd-mysql-perl (4.021-1+b1) ...     Setting up mysql-client-5.5 (5.5.38-0+wheezy1) ...     Setting up mysql-server-5.5 (5.5.38-0+wheezy1) ...     locale: Cannot set LC_CTYPE to default locale: No such file or directory     locale: Cannot set LC_MESSAGES to default locale: No such file or directory     locale: Cannot set LC_ALL to default locale: No such file or directory     debconf: unable to initialize frontend: Dialog     debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)     debconf: falling back to frontend: Readline     [ ok ] Stopping MySQL database server: mysqld.     140826  0:14:52 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.     140826  0:14:52 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.     140826  0:14:52 [Note] Plugin 'FEDERATED' is disabled.     140826  0:14:52 InnoDB: The InnoDB memory heap is disabled     140826  0:14:52 InnoDB: Mutexes and rw_locks use GCC atomic builtins     140826  0:14:52 InnoDB: Compressed tables use zlib 1.2.7     140826  0:14:52 InnoDB: Using Linux native AIO     140826  0:14:52  InnoDB: Warning: io_setup() failed with EAGAIN. Will make 5 attempts before giving up.     InnoDB: Warning: io_setup() attempt 1 failed.     InnoDB: Warning: io_setup() attempt 2 failed.     InnoDB: Warning: io_setup() attempt 3 failed.     InnoDB: Warning: io_setup() attempt 4 failed.     InnoDB: Warning: io_setup() attempt 5 failed.     140826  0:14:55  InnoDB: Error: io_setup() failed with EAGAIN after 5 attempts.     InnoDB: You can disable Linux Native AIO by setting innodb_use_native_aio = 0 in my.cnf     140826  0:14:55 InnoDB: Fatal error: cannot initialize AIO sub-system     140826  0:14:55 [ERROR] Plugin 'InnoDB' init function returned error.     140826  0:14:55 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.     140826  0:14:55 [ERROR] Unknown/unsupported storage engine: InnoDB     140826  0:14:55 [ERROR] Aborting          140826  0:14:55 [Note] /usr/sbin/mysqld: Shutdown complete          /usr/bin/locale: Cannot set LC_CTYPE to default locale: No such file or directory     /usr/bin/locale: Cannot set LC_MESSAGES to default locale: No such file or directory     /usr/bin/locale: Cannot set LC_ALL to default locale: No such file or directory     Configuring mysql-server-5.5     ----------------------------          Unable to set password for the MySQL "root" user          An error occurred while setting the password for the MySQL administrative user. This may have happened because the account already has a password, or because of a      communication problem with the MySQL server.          You should check the account's password after the package installation.          Please read the /usr/share/doc/mysql-server-5.5/README.Debian file for more information.          [FAIL] Starting MySQL database server: mysqld . . . . . . . . . . . . . . failed!     invoke-rc.d: initscript mysql, action "start" failed.     dpkg: error processing mysql-server-5.5 (--configure):      subprocess installed post-installation script returned error exit status 1     Setting up mysql-client (5.5.38-0+wheezy1) ...     dpkg: dependency problems prevent configuration of mysql-server:      mysql-server depends on mysql-server-5.5; however:       Package mysql-server-5.5 is not configured yet.          dpkg: error processing mysql-server (--configure):      dependency problems - leaving unconfigured     Errors were encountered while processing:      mysql-server-5.5      mysql-server     E: Sub-process /usr/bin/dpkg returned an error code (1)      I've also tried:               sudo apt-get purge mysql*      re-installed and had the same problem:               Unable to set password for the MySQL "root" user          An error occurred while setting the password for the MySQL administrative user. This may have happened because the account already has a password, or because of a      communication problem with the MySQL server.          You should check the account's password after the package installation.          Please read the /usr/share/doc/mysql-server-5.5/README.Debian file for more information.          [FAIL] Starting MySQL database server: mysqld . . . . . . . . . . . . . . failed!     invoke-rc.d: initscript mysql, action "start" failed.     dpkg: error processing mysql-server-5.5 (--configure):      subprocess installed post-installation script returned error exit status 1     Setting up mysql-client (5.5.38-0+wheezy1) ...     dpkg: dependency problems prevent configuration of mysql-server:      mysql-server depends on mysql-server-5.5; however:       Package mysql-server-5.5 is not configured yet.          dpkg: error processing mysql-server (--configure):      dependency problems - leaving unconfigured     Errors were encountered while processing:      mysql-server-5.5      mysql-server     E: Sub-process /usr/bin/dpkg returned an error code (1)      Suggestions ?


title: How to write/edit/update the OsIndications efi variable from command line?

text: In the need to enter the UEFI firmware setup utility while using ultra fast boot (keyboard drivers are not loaded during POST), I wish to write to the "Os Indications" efi variable. My OS is Ubuntu 14.04 kernel 3.13.0-35-generic. > `OsIndications` variable returns a UINT64 bitmask > > `OsIndicationsSupported` variable returns a UINT64 bitmask > > The `EFI_OS_INDICATIONS_BOOT_TO_FW_UI` bit can be set in the > OsIndicationsSupported variable by the firmware, if the firmware supports OS > requests to stop at a firmware user interface. The > `EFI_OS_INDICATIONS_BOOT_TO_FW_UI` bit can be set by the OS in the > OsIndications variable, if the OS desires for the firmware to stop at a > firmware user interface on the next boot. > > `EFI_OS_INDICATIONS_BOOT_TO_FW_UI`=`0x0000000000000001` - Page 312 of UEFI > spec 2.3.1C My firmware has the ability to enter the firmware setup utility at next boot:               $ hexdump /sys/firmware/efi/vars/OsIndicationsSupported-8be4df61-93ca-11d2-aa0d-00e098032b8c/data     0000000 0001 0000 0000 0000     0000008      I can create a new variable on `/sys/firmware/efi/efivars` using               $ printf\x07\x00\x00\x00\x00" > myvar-12345678-1234-1234-1234-123456789abc      However writing to the efi variable `OsIndications-8be4df61-93ca-11d2-aa0d-00e098032b8c` results in all sorts of `write error: Invalid argument`:               # printf "x00\x00\x00\x01" > /sys/firmware/efi/efivars/OsIndications-8be4df61-93ca-11d2-aa0d-00e098032b8c     -bash: printf: write error: Invalid argument          # printf "x00\x00\x00\x01" > /sys/firmware/efi/efivars/OsIndications-8be4df61-93ca-11d2-aa0d-00e098032b8c     -bash: printf: write error: Invalid argument          # printf "\x01" > /sys/firmware/efi/efivars/OsIndications-8be4df61-93ca-11d2-aa0d-00e098032b8c     -bash: printf: write error: Invalid argument          # cat enter-uefi-fw > /sys/firmware/efi/efivars/OsIndications-8be4df61-93ca-11d2-aa0d-00e098032b8c     cat: write error: Invalid argument          # cat enter-uefi-fw > /sys/firmware/efi/vars/OsIndications-8be4df61-93ca-11d2-aa0d-00e098032b8c/raw_var     cat: write error: Input/output error          # cat enter-uefi-fw > /sys/firmware/efi/vars/new_var     cat: write error: Invalid argument      According to https://ask.fedoraproject.org/en/question/8264/after-installing- fedora-i-cant-open-biosefi-setup/?answer=16402#post-id-16402 the last command should work in Fedora 17. How can I update the already existing OsIndications efi variable in Ubuntu 14.04 (trusty) from the command-line?


title: ElementaryOS / Specific layout

text: For switching layouts between three different languages I use `Ctrl`+`Shift` but this approach very slowly. I want to use specific combination for the specific layout. Like:   * English -> `Ctrl`+`Shift`+`1`   * France -> `Ctrl`+`Shift`+`2`   * Spain -> `Ctrl`+`Shift`+`3` How to do it on ElementaryOS ?


title: Installing Nvidia driver for GTX 760m under Linux

text: I tried installing Nvidia drivers using different ways: repository `nvidia- current`, `nvidia-331` and using downloaded file from Nvidia web site. Installations seems to be successful, although I got `pre-installation script failed` message from `.run` file. After installation I ran `sudo nvidia-xconfig` and reboot. In both cases the system doesn't seem to use installed driver. Going to nvidia-settings gives an error: > You do not appear to be using NVIDIA X driver. Please edit you X > configuration file (just run nvidia-xconfig as root), and restart the X > server. Running `nvidia-smi` give an error: > NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA > driver. Make sure that the latest NVIDIA driver is installed and running. `lsmod` command lists nvidia among other modules: > nvidia 10688804 0 So, I'm totally confused. How can I change that OS is using nvidia driver. How to get rid of error above? UPDATE: My `nvidia-settings` opens now, but it has not much settings inside: ![enter image description here](http://i.stack.imgur.com/cjczf.png) In the command line I see the following error: > ** (nvidia-settings:4334): WARNING **: PRIME: Failed to execute child > process "/usr/bin/prime-supported" (No such file or directory) > > ** Message: PRIME: is it supported? no The command `inxi -Gx` (whatever it does) gives me: > Graphics: Card: Intel 4th Gen Core Processor Integrated Graphics Controller > bus-ID: 00:02.0 X.Org: 1.14.3 **drivers: nouveau,intel (unloaded: > nvidia,fbdev,vesa)** Resolution: 1920x1080@60.0hz GLX Renderer: N/A GLX > Version: N/A Direct Rendering: N/A So I can conclude that nvidia driver is not used. How to fix it?


title: Extract incomplete RAR archive under linux (desktop)

text: I have many not compressed rar multi-part archives on my ftp server. Under Windows, with 7zip I have no problem with extracting part1 when I have not downloaded part2 from server yet. There is notification about errors, but if some files were complete in part1 - they extract correctly and I can use these files. Under linux - looks like there is 7zip with rar non-free module (I think 7z was installed when I was installing Gnome). How can I extract my files from incomplete multi-part archive under Linux? I'm using Debian 7 (amd64 architecture) with Gnome.


title: Show Custom Boot-Message

text: I would like to show a custom message during boot, or even better the program cmatrix. I boot with the "quiet" parameter so there are no startup messages, instead I would like to show a custom-message or the output of a program like cmatrix. Is this even possible? How could I achieve this with systemd?


title: Does Linux support Mac OS partitions format?

text: I want to install Linux alongside Mac-OS. There is something I'm in doubt about. _Does Linux support Mac-OS partitions format?_


title: Linux, resolv.conf -- adding MSDNS and Bind DNS nameservers where MSDNS isn't recursive?

text: How to resolve from a non-recursive MSDNS and if not found resolve from googleDNS (recursive)?               ## resolv.conf ##     nameserver 192.168.10.1   # msdns, non-recursive     nameserevr 8.8.8.8        # googleDNS, recursive       If I place the MSDNS first and `ping someLocalServer` it works, but if I `ping google.com` I get "unknown host". If I switch them around the opposite occurs, google pings fine, the "someLocalServer" gives me the "unknown host". I've tried messing with `nsswitch.conf` but this hasn't helped.               ## nsswitch.conf ##     host: file mdns_minimal dns mdns4      I've switched those tags around, `file dns mdns4` [or] `file mdns4 dns` [or] `file mdns_minimal [NOTFOUND=continue] dns` ... I have a Windows Domain and the windows DNS I've setup to be non-recursive. What I'm expecting is; if a local lookup fails, I expect the lookup to be handled by googleDNS. This setup works fine under Windows Server but not under a CentOS basic install.


title: How do I temporarily extract a flash drive or HDD in Linux?

text: Suppose I mounted a disk in this way:               mount /dev/sdb /mnt/tmp      I have some files opened on this filesystem and don't want to unmount it. However I want to temporarily extract the device, then reattach it later. I want all reads and writes to this filesystem to be performed in cache only or be hung until I reattach the device. If I thought about temporarily detaching in advance, I would have used the device mapper:               # ls -lh /dev/sdb     brw-rw---- 1 root floppy 8, 16 Sep 12 17:38 /dev/sdb     # blockdev --getsize /dev/sdb     2211840     # dmsetup create sdb_detachable --table '0 2211840 linear 8:16 0'     # mount /dev/mapper/sdb_detachable /mnt/tmp     (start working with the filesystem)     (suddenly need to detach the device)     # dmsetup suspend sdb_detachable     # dmsetup load sdb_detachable --table '0 2211840 error'     # blockdev --flushbufs /dev/sdb     (eject the device)     (maybe even use the cached part of the filesystem)     (reattach the device, now it appears as /dev/sdc)     # ls -lh /dev/sdc && blockdev --getsize /dev/sdc     brw-rw---- 1 root floppy 8, 32 Sep 12 17:51 /dev/sdc     2211840     # dmsetup load sdb_detachable --table '0 2211840 linear 8:32 0'     # dmsetup resume sdb_detachable     (filesystem is usable again)     (finished using it, now need to clean up)     # umount /mnt/tmp/     # dmsetup remove sdb_detachable     # eject /dev/sdc      How can this be accomplished if the device is mounted directly? Can I "steal" it into the device mapper?


title: Remove repeated words with suffix in a file

text: I have a list of records in a file as in below example               word_word1     word_word1_acc     word_word2_acc     word_word3_acc     word_word4      I need to remove only `word_word1_acc` line in the file as it is only a repetition of the first line. As in the example, I have multiple fields in each line. How can I do this?


title: Config File Sequence for ZSH?

text: I know there is an elaborate sequence of config files that BASH reads sequentially (or alternatively skips if a particular one is present), however I have for the most part adopted ZSH as my default shell. I have tended to mainly edit my `~/.zshrc` for everything but I am wondering if I should be editing other files as well. BTW I am often logging in to a non-graphical login shell on some machines so is there a different sequence for login ZSH sessions vs interactive ones?


title: What does White space mean when you mount ISO

text: I mounted redhat dvd media and I named in redhat.iso. And when i mounted it and did > ls it showed /media/RHEL- **5.6 i386 DVD**. What does this space mean between 5.6 and i386 and DVD. Because Im creating a DVD based Repository which i will use to Upgrade the Redhat linux. Im asking this because I have to assign this path in Baserul=file:///Absolute/Path to run > yum upgrade command which will upgrade redhat 5.5 to 5.6. And when assign it like this baseurl=file:////media/RHEL-5.6 i386 DVD it give me error that i can only use https, ftp or URL not " " # df -h Results ![FS](http://i.stack.imgur.com/QWcIS.png) # Instructions entered in dvd.repo               [dvd.repo]     name=dvd.repo     baseurl=file:///media/RHEL_5.6\ i386\ DVD/SERVER     enabled=1     gpgcheck=0      And when I omitted white space and wrote basurl like this baseurl=file:///media/RHEL_5.6\i386\DVD/Server and saved it and then used the command YUM CLEAN ALL and after that YUM LIST ALL it smashed me with this message ![error](http://i.stack.imgur.com/c9gAD.png)


title: watch command not showing colors for 'git status'

text: I'm trying to get `watch` to display colors from 'git status'. I've tried running watch with the `\--color` option, as suggested elsewhere here, but, still, `watch --color 'git status'` doesn't display colors.


title: how to change a pane to the main pane in tmux

text: In tmux, when i use main-vertical layout, it always selects the main pane that will be having the larger size. Is there any way we can make the current pane the larger size when using main-vertical? or changing the current pane to the main pane.?


title: How to set up two ipsec tunnels between 2 linux machines

text: conn %default     left=128.247.19.210     leftcert=/home/alphaCert.der     leftid="C=US, O=Test, CN=alpha.test.org"     right=128.247.19.33  # IP address of Host     rightid="C=US, O=Test, CN=beta.test.org"     keyexchange=ikev2     ike=aes128-sha1-modp2048!     type=tunnel     esp=aes128ctr-sha1-modp2048-noesn!     lifetime=168h     ikelifetime=168h     reauth=no          conn Beta-Udp1     leftprotoport=udp     leftsubnet=128.247.19.210/32     rightprotoport=udp                            rightsubnet=128.247.19.33/32                 auto=start                                                conn Beta-Sctp     leftprotoport=sctp     leftsubnet=17.16.81.50/32     rightprotoport=sctp     rightsubnet=17.16.81.51/32                 auto=start      Basically i want to set up an SCTP and UDP tunnel between 2 machines. 1) Can i use the same IP address for this and define 2 conn sections? 2) Or as i have done above, use 2 different ip addresses? ( 2nd one is VLAN). Why i ask this is when i do ipsec stausall is see                Security Associations (1 up, 0 connecting):


title: How to run a program on boot up?

text: So I have this program which I manually run as root :               sudo gammu-smsd -c /etc/gammu-smsdrc -d       What this does is it runs the Gammu (software to manage gsm modems) and 'daemonize' it. My problem is I want this program to automatically run on boot up . Is it ok to just edit root's crontab and stick this command there? Or there's some other way? (Im using Ubuntu 11.04.)


title: Can I automate mounting a cifs share without storing my password in plaintext?

text: I currently use a script which contains commands along the lines of               sudo /sbin/mount.cifs $SERVER_SHARE $MOUNT -o username=$DOMAIN_$USER,uid=$USER,gid=$USER,file_mode=0664,dir_mode=0775      to mount my cifs shared directories. This works fine, but I have to enter my password for each of these lines, so I would like to automate this process. In order to adhere to local security policy I must not add my password to the command line, nor may I store my password in plain text in a file (either the mount script or a credentials file). Do I have any other options for authenticating my cifs mount, or am I stuck entering my password for each and every share? Ideally I would like the equivalent of doing a `ssh-add`, where I only have to enter my password once and all subsequent `ssh` commands use that authentication and do not require me to enter my password again. If it makes any difference, I am using RHEL 5.8 as a normal user with very limited sudo access.


title: How to add Two Gateway on same machine

text: I have one test server that has Two Interfaces. To one interface i have assigned ip 172.16.122.1 and GW 172.16.xxx.xxx Now i connected cable to second interface and gave it ip 10.2.2.98. Now they both on different subnets. So how do I add the second gateway in /etc/sysconfig/network file. And when i will try to ping then through which interface will it ping the remote system.


title: How to print "$" in here-document

text: How can I echo "$" in a here-doc in bash? For example, I want to have a file with the content on remote server like `$ABC=home_dir`.               $ ssh hostname sudo -s <<EOF     echo "$ABC=home_dir" > file     EOF      But it would be treated as a variable. How can I print a literal `$`?


title: Is there a standard for writing a command synopsis?

text: It appears to me that everyone has their own idea on how to write a _synopsis_ describing _command usage_ for the end user. For example, this is the format from `man grep`:               grep [OPTIONS] PATTERN [FILE...]     grep [OPTIONS] [-e PATTERN | -f FILE] [FILE...]      Now this has some syntax that appears in other manpages. `[]` is recognized as optional, and `...` makes sense as multiple of the same input. But people use `|` or `/` for OR and there are others that will reverse what `[]` means. Or they do not give any indication as to where `[OPTIONS]` goes. I would like to follow a standard for what I write, but every website I look at tells me something different. Is there an actual _standard_ way of writing synopses, or is the convention just what people have been doing over time?


title: Is there a (light-weight) replacement for `rxvt-unicode`?

text: I am currently using `rxvt-unicode` as a terminal emulator. Since I also like the configurability of terminal emulators from GNOME and KDE, I wonder whether there is some kind of replacement for `rxvt-unicode` with _more_ features but _not_ as many dependencies as the GNOME or KDE terminals. Specifically, I am interested in the following:   * Tabs   * Font size changes on the fly (via `CTRL`+`+` or something similar)   * UTF-8 support (OK, `urxvt` already has this, obviously)   * Possibility to open a new tab/new window at the _current directory_


title: Only find first few matched files using find?

text: Say there may be hundreds of `*.txt` files in a directory. I only want to find the first three `*.txt` files and then exit the searching process. How to achieve this using the `find` utility? I had a quick through on its man page, seemed not such a option for this.


title: How to update an init script

text: What is the proper way to update an init script an ubuntu system? I am trying to upgrade my version of gitlab from 6-0 to 6-1, part of the upgrade consists of replacing the init script. Upgrade instructions - step 6               sudo rm /etc/init.d/gitlab     sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlabhq/6-1-stable/lib/support/init.d/gitlab     sudo chmod +x /etc/init.d/gitlab      I find that after updating the init script, calling script does nothing. Normally it prints out the processes id of the gitlab service               root@gitlab:/etc/init.d# /etc/init.d/gitlab status     root@gitlab:/etc/init.d# (notice how nothing happens)          #No gitlab process is running     root@gitlab:/etc/init.d# ps aux |grep gitlab     root      4519  0.0  0.1   9384   928 pts/0    R+   20:03   0:00 grep --color=auto gitlab      * * * **Steps I have taken to troubleshoot this:** Make sure it is executable               root@gitlab:/etc/init.d# ll gitlab     -rwxr-xr-x 1 root root 7195 Sep 28 19:29 gitlab*      Strace the script                   root@gitlab:/etc/init.d# strace ./gitlab     execve("./gitlab", ["./gitlab"], [/* 16 vars */]) = 0     brk(0)                                  = 0xb29000     access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)     mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd33a1a8000     access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)     open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3     fstat(3, {st_mode=S_IFREG|0644, st_size=22291, ...}) = 0     mmap(NULL, 22291, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fd33a1a2000     close(3)                                = 0     access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)     open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3     read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200\30\2\0\0\0\0\0"..., 832) = 832     fstat(3, {st_mode=S_IFREG|0755, st_size=1811128, ...}) = 0     mmap(NULL, 3925208, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fd339bc9000     mprotect(0x7fd339d7e000, 2093056, PROT_NONE) = 0     mmap(0x7fd339f7d000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b4000) = 0x7fd339f7d000     mmap(0x7fd339f83000, 17624, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fd339f83000     close(3)                                = 0     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd33a1a1000     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd33a1a0000     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd33a19f000     arch_prctl(ARCH_SET_FS, 0x7fd33a1a0700) = 0     mprotect(0x7fd339f7d000, 16384, PROT_READ) = 0     mprotect(0x619000, 4096, PROT_READ)     = 0     mprotect(0x7fd33a1aa000, 4096, PROT_READ) = 0     munmap(0x7fd33a1a2000, 22291)           = 0     getpid()                                = 4459     rt_sigaction(SIGCHLD, {0x40f100, ~[RTMIN RT_1], SA_RESTORER, 0x7fd339bff4a0}, NULL, 8) = 0     geteuid()                               = 0     brk(0)                                  = 0xb29000     brk(0xb4a000)                           = 0xb4a000     getppid()                               = 4458     stat("/etc/init.d", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0     stat(".", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0     open("./gitlab", O_RDONLY)              = 3     fcntl(3, F_DUPFD, 10)                   = 10     close(3)                                = 0     fcntl(10, F_SETFD, FD_CLOEXEC)          = 0     rt_sigaction(SIGINT, NULL, {SIG_DFL, [], 0}, 8) = 0     rt_sigaction(SIGINT, {0x40f100, ~[RTMIN RT_1], SA_RESTORER, 0x7fd339bff4a0}, NULL, 8) = 0     rt_sigaction(SIGQUIT, NULL, {SIG_DFL, [], 0}, 8) = 0     rt_sigaction(SIGQUIT, {SIG_DFL, ~[RTMIN RT_1], SA_RESTORER, 0x7fd339bff4a0}, NULL, 8) = 0     rt_sigaction(SIGTERM, NULL, {SIG_DFL, [], 0}, 8) = 0     rt_sigaction(SIGTERM, {SIG_DFL, ~[RTMIN RT_1], SA_RESTORER, 0x7fd339bff4a0}, NULL, 8) = 0     read(10, "#! /bin/sh\n\n# GITLAB\n# Maintaine"..., 8192) = 7195     stat("/usr/local/sbin/sudo", 0x7fffcbf518d0) = -1 ENOENT (No such file or directory)     stat("/usr/local/bin/sudo", 0x7fffcbf518d0) = -1 ENOENT (No such file or directory)     stat("/usr/sbin/sudo", 0x7fffcbf518d0)  = -1 ENOENT (No such file or directory)     stat("/usr/bin/sudo", {st_mode=S_IFREG|S_ISUID|0755, st_size=71288, ...}) = 0     clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fd33a1a09d0) = 4460     wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], 0, NULL) = 4460     --- SIGCHLD (Child exited) @ 0 (0) ---     rt_sigreturn(0x11)                      = 4460     exit_group(1)                           = ?      I am more familiar with Cent than Ubuntu, and I hear mixed opinions on manually executing update-rc.d. I've tried it anyway per the suggestion of this blog               root@gitlab:/etc/init.d# sudo update-rc.d -f gitlab remove      Removing any system startup links for /etc/init.d/gitlab ...        /etc/rc0.d/K20gitlab        /etc/rc1.d/K20gitlab        /etc/rc2.d/S20gitlab        /etc/rc3.d/S20gitlab        /etc/rc4.d/S20gitlab        /etc/rc5.d/S20gitlab        /etc/rc6.d/K20gitlab     root@gitlab:/etc/init.d# update-rc.d gitlab defaults      Adding system startup for /etc/init.d/gitlab ...        /etc/rc0.d/K20gitlab -> ../init.d/gitlab        /etc/rc1.d/K20gitlab -> ../init.d/gitlab        /etc/rc6.d/K20gitlab -> ../init.d/gitlab        /etc/rc2.d/S20gitlab -> ../init.d/gitlab        /etc/rc3.d/S20gitlab -> ../init.d/gitlab        /etc/rc4.d/S20gitlab -> ../init.d/gitlab        /etc/rc5.d/S20gitlab -> ../init.d/gitlab      No luck, the script still doesn't run. Is there anything else that must be done on ubuntu systems to upgrade init scripts? * * * **Update1:** Looking at /var/log/auth.log shows:               vagrant@gitlab:~$ sudo su -     root@gitlab:~# /etc/init.d/gitlab status     root@gitlab:~# tail /var/log/auth.log     Sep 28 20:52:31 gitlab su[2205]: pam_unix(su:session): session closed for user root     Sep 28 20:52:31 gitlab sudo: pam_unix(sudo:session): session closed for user root     Sep 28 20:52:34 gitlab sudo:  vagrant : TTY=pts/0 ; PWD=/home/vagrant ; USER=root ; COMMAND=/bin/su -     Sep 28 20:52:34 gitlab sudo: pam_unix(sudo:session): session opened for user root by vagrant(uid=1000)     Sep 28 20:52:34 gitlab su[2311]: Successful su for root by root     Sep 28 20:52:34 gitlab su[2311]: + /dev/pts/0 root:root     Sep 28 20:52:34 gitlab su[2311]: pam_unix(su:session): session opened for user root by vagrant(uid=0)     Sep 28 20:52:43 gitlab sudo:     root : TTY=pts/0 ; PWD=/root ; USER=git ; COMMAND=/bin/false -c /etc/init.d/gitlab status     Sep 28 20:52:43 gitlab sudo: pam_unix(sudo:session): session opened for user git by vagrant(uid=0)     Sep 28 20:52:43 gitlab sudo: pam_unix(sudo:session): session closed for user git      **Update2** I've done a diff of the init scripts between 6-0-stable and 6-1-stable. It appears to have been an almost complete rewrite. The diff is located here:   https://gist.github.com/spudstud/6747146#file-diff-gitlab-init-scripts You can see the actual 6-0 script here:   https://github.com/gitlabhq/gitlabhq/blob/6-0-stable/lib/support/init.d/gitlab and the 6-1 script here: https://github.com/gitlabhq/gitlabhq/blob/6-1-stable/lib/support/init.d/gitlab **Update3** Tried starting script using bash -x               root@gitlab:/etc/init.d# bash -x /etc/init.d/gitlab start     + RAILS_ENV=production     + app_root=/home/git/gitlab     + app_user=git     + unicorn_conf=/home/git/gitlab/config/unicorn.rb     + pid_path=/home/git/gitlab/tmp/pids     + socket_path=/home/git/gitlab/tmp/sockets     + web_server_pid_path=/home/git/gitlab/tmp/pids/unicorn.pid     + sidekiq_pid_path=/home/git/gitlab/tmp/pids/sidekiq.pid     + '[' root '!=' git ']'     + sudo -u git -H -i /etc/init.d/gitlab start     + exit      # Success, It appears that the script must be run as the user 'git'.