title: Rationale for making user space text segment start at 0x8048000

text: I read somewhere that (at least since Linux v. 2.6) all user-space code is placed at load address 0x8048000 in the virtual memory address space. My own observations confirm this. I have done a               cat /proc/......../maps      for several processes and the very first section of a process' program `text` always starts at '0x8048000'. Furthermore the C library startup code and all the other runtime goodies all seem to be mapped after this default value. This constitutes almost 128 M of address space, not a lot considering that 0xC0000000 - 0x8048000 is still almost 3G of address space for user space stuff. So my question is why? We are dealing with virtual addresses, interference or overlap with other programs is excluded by definition of the way VM works. Are there some fixed/default mappings in the range 0x00000000 to 0x8048000 ? Apart from the fact that the default start address falls on a page boundary, what is the rationale for having chosen this number as opposed to any other value?


title: Colorizing your terminal and shell environment?

text: I spend most of my time working in Unix environments and using terminal emulators. I try to use color on the command-lin, because color makes the output more useful and intuitive. What are some good ways to add color to my terminal environment? What tricks do you use? What pitfalls have you encountered? Unfortunately support for color is wildly variable depending on terminal type, OS, TERM setting, utility, buggy implementations, etc. Here's are some tips from my setup, after a lot of experimentation:   1. I tend to set `TERM=xterm-color`, which is supported on most hosts (but not all).   2. I work on a number of different hosts, different OS versions, etc. I use everything from MacOSX, Ubuntu Linux, RHEL/CentOS/Scientific Linux and FreeBSD. I'm trying to keep things simple and generic, if possible.   3. I do a bunch of work using GNU `screen`, which adds another layer of fun.   4. Many OSs set things like `dircolors` and by default, and I don't want to modify this on a hundred different hosts. So I try to stick with the defaults. Instead tweak my terminal's color configuration.   5. Use color for some unix commands (`ls`, `grep`, `less`, `vim`) and the Bash prompt. These commands seem to the standard "ANSI escape sequences". For example:              alias less='less --RAW-CONTROL-CHARS'     export LS_OPTS='--color=auto'     alias ls='ls ${LS_OPTS}      I'll post my `.bashrc` and answer my own question Jeopardy Style.


title: How to colorize output of ls ?

text: I'm running CentOS in Linux text mode. When I run the command `ls /usr/`, the output is too hard to read (dark blue on black). How can I change the text coloring? ![Screenshot of the ls output](http://i.stack.imgur.com/Q5MLf.jpg)


title: How can I install latest VLC player in cent os 6.4?

text: I have installed cent os 6.4 in my laptop, I want to know the method of installing VLC in cent os 6.4, Is it necessary to download the vlc package and compile or can I use ''yum install vlc'' to install the same ?


title: Can not install wine on debian amd64:

text: Can not install wine on debian amd64: > sudo aptitude install wine-bin Note: selecting "wine-bin:i386" instead of > the virtual package "wine-bin" The following NEW packages will be installed: > gcc-4.8-base:i386{ab} libasound2:i386{a} libc6:i386{a} libc6-i686:i386{a} > libdbus-1-3:i386{a} libdrm-intel1:i386{a} libdrm-nouveau2:i386{a} libdrm- > radeon1:i386{a} libdrm2:i386{a} libexpat1:i386{a} libffi6:i386{a} > libfontconfig1:i386{a} libfreetype6:i386{a} libgcc1:i386{ab} > libgcrypt11:i386{a} libgl1-mesa-dri:i386{a} libgl1-mesa-glx:i386{a}   >  libglapi-mesa:i386{a} libglu1-mesa:i386{a} libgnutls26:i386{a}   >  libgpg-error0:i386{a} libgpm2:i386{a} libgsm1:i386{a} libice6:i386{a} > libjbig0:i386 libjpeg8:i386{a} libllvm3.2:i386{a} libltdl7:i386{a}   >  liblzma5:i386{a} libmpg123-0:i386{a} libncurses5:i386{a} libodbc1:i386{a} > libp11-kit0:i386{a} libpciaccess0:i386{a} libpng12-0:i386{a} libsm6:i386{a} > libssl1.0.0:i386{a} libstdc++6:i386{ab} libtasn1-3:i386{a} libtiff4:i386{a} > libtinfo5:i386{a} libtxc-dxtn-s2tc0:i386{a} libuuid1:i386{a} > libv4l-0:i386{a} libv4lconvert0:i386{a} libwine:i386{a}   >  libwine-alsa:i386{a} libwine-bin:i386{a} libwine-gecko-1.4{a}   >  libwine-gl:i386{a} libx11-6:i386{a} libx11-xcb1:i386{a} libxau6:i386{a} > libxcb-dri2-0:i386{a} libxcb-glx0:i386{a} libxcb1:i386{a} > libxcomposite1:i386{a} libxcursor1:i386{a} libxdamage1:i386{a} > libxdmcp6:i386{a} libxext6:i386{a} libxfixes3:i386{a} libxi6:i386{a} > libxinerama1:i386{a} libxml2:i386{a} libxrandr2:i386{a} libxrender1:i386{a} > libxslt1.1:i386{a} libxxf86vm1:i386{a} wine-bin:i386{b} zlib1g:i386{a} 0 > packages upgraded, 71 newly installed, 0 to remove and 0 not upgraded. Need > to get 84.1 MB of archives. After unpacking 253 MB will be used. The > following packages have unmet dependencies: gcc-4.8-base : Breaks: > gcc-4.8-base:i386 (!= 4.8.1-7) but 4.8.1-6 is to be installed. > gcc-4.8-base:i386 : Breaks: gcc-4.8-base (!= 4.8.1-6) but 4.8.1-7 is > installed. libgcc1 : Breaks: libgcc1:i386 (!= 1:4.8.1-7) but 1:4.8.1-6 is to > be installed. libgcc1:i386 : Breaks: libgcc1 (!= 1:4.8.1-6) but 1:4.8.1-7 is > installed. libstdc++6 : Breaks: libstdc++6:i386 (!= 4.8.1-7) but 4.8.1-6 is > to be installed. libstdc++6:i386 : Breaks: libstdc++6 (!= 4.8.1-6) but > 4.8.1-7 is installed. wine-bin:i386 : Conflicts: wine64-bin but 1.5.30-2 is > installed. The following actions will resolve these dependencies: >   >   >       Keep the following packages at their current version:           1) > gcc-4.8-base:i386 [Not Installed]   >   > > 2) libasound2:i386 [Not Installed]   >  3) libc6:i386 [Not Installed]   >  4) libc6-i686:i386 [Not Installed]   >  5) libdbus-1-3:i386 [Not Installed]   >  6) libdrm-intel1:i386 [Not Installed]   >  7) libdrm-nouveau2:i386 [Not Installed]   >  8) libdrm-radeon1:i386 [Not Installed]   >  9) libdrm2:i386 [Not Installed]   >  10) libexpat1:i386 [Not Installed]   >  11) libffi6:i386 [Not Installed]   >  12) libfontconfig1:i386 [Not Installed]   >  13) libfreetype6:i386 [Not Installed]   >  14) libgcc1:i386 [Not Installed]   >  15) libgcrypt11:i386 [Not Installed]   >  16) libgl1-mesa-dri:i386 [Not Installed]   >  17) libgl1-mesa-glx:i386 [Not Installed]   >  18) libglapi-mesa:i386 [Not Installed]   >  19) libglu1-mesa:i386 [Not Installed]   >  20) libgnutls26:i386 [Not Installed]   >  21) libgpg-error0:i386 [Not Installed]   >  22) libgpm2:i386 [Not Installed]   >  23) libgsm1:i386 [Not Installed]   >  24) libice6:i386 [Not Installed]   >  25) libjbig0:i386 [Not Installed]   >  26) libjpeg8:i386 [Not Installed]   >  27) libllvm3.2:i386 [Not Installed]   >  28) libltdl7:i386 [Not Installed]   >  29) liblzma5:i386 [Not Installed]   >  30) libmpg123-0:i386 [Not Installed]   >  31) libncurses5:i386 [Not Installed]   >  32) libodbc1:i386 [Not Installed]   >  33) libp11-kit0:i386 [Not Installed]   >  34) libpciaccess0:i386 [Not Installed]   >  35) libpng12-0:i386 [Not Installed]   >  36) libsm6:i386 [Not Installed]   >  37) libssl1.0.0:i386 [Not Installed]   >  38) libstdc++6:i386 [Not Installed]   >  39) libtasn1-3:i386 [Not Installed]   >  40) libtiff4:i386 [Not Installed]   >  41) libtinfo5:i386 [Not Installed]   >  42) libtxc-dxtn-s2tc0:i386 [Not Installed]   >  43) libuuid1:i386 [Not Installed]   >  44) libv4l-0:i386 [Not Installed]   >  45) libv4lconvert0:i386 [Not Installed]   >  46) libwine:i386 [Not Installed]   >  47) libwine-alsa:i386 [Not Installed]   >  48) libwine-bin:i386 [Not Installed]   >  49) libwine-gl:i386 [Not Installed]   >  50) libx11-6:i386 [Not Installed]   >  51) libx11-xcb1:i386 [Not Installed]   >  52) libxau6:i386 [Not Installed]   >  53) libxcb-dri2-0:i386 [Not Installed]   >  54) libxcb-glx0:i386 [Not Installed]   >  55) libxcb1:i386 [Not Installed]   >  56) libxcomposite1:i386 [Not Installed]   >  57) libxcursor1:i386 [Not Installed]   >  58) libxdamage1:i386 [Not Installed]   >  59) libxdmcp6:i386 [Not Installed]   >  60) libxext6:i386 [Not Installed]   >  61) libxfixes3:i386 [Not Installed]   >  62) libxi6:i386 [Not Installed]   >  63) libxinerama1:i386 [Not Installed]   >  64) libxml2:i386 [Not Installed]   >  65) libxrandr2:i386 [Not Installed]   >  66) libxrender1:i386 [Not Installed]   >  67) libxslt1.1:i386 [Not Installed]   >  68) libxxf86vm1:i386 [Not Installed]   >  69) wine-bin:i386 [Not Installed]   >  70) zlib1g:i386 [Not Installed] >   >   >       Leave the following dependencies unresolved:                    71) > libgl1-mesa-glx:i386 recommends libgl1-mesa-dri:i386 (>= 7.2) >   > > 72) libncurses5:i386 recommends libgpm2:i386   >  73) libwine:i386 recommends libgsm1:i386 (>= 1.0.13)   >  74) libwine:i386 recommends libv4l-0:i386 (>= 0.5.0)


title: Gentoo mounting root as read only, why?

text: I just did a Gentoo fresh install but when I boot it the root filesystem mounts as read only. Once I login I can remount it with `mount -o remount,rw /` but it's not even recognizing my hostname. Someone on irc told me it could be that for some reason fsck bombs as root is always mount `ro` first and then `fsck` remounts it `rw`. I found someone having the same problems and I tried what he did but it didn't work for me Root file system is mounted read-only on boot on Gentoo Linux This is my fstab. **EDIT** I already fixed it, it was a problem with an option not enabled in the kernel               Pseudo Filesystems --->             [*] Virtual memory file system support (former shm fs)


title: Install Openbox on Tiny Core Linux (core ISO)

text: How do I install Openbox on Tiny Core Linux (core ISO)? I tried:               tce-load -wi openbox      Installation finished without errors. Then I did:               tce-run openbox      But then I got this error:               Openbox-Message: Failed to open the display from the DISPLAY enviroment variable.      Maybe I must install X first or something else? What am I doing wrong?


title: UberSVN and TortoiseSVN, Question regarding version numbers

text: I installed on my OpenSuSE server the UberSVN platform for Subversion system. It has subversion 1.7.9. I installed some time ago Tortoise client 1.7.11 and it works well, but today I found this: > "We're proud to announce that TortoiseSVN 1.7.11 has been released. It is > linked against Subversion 1.7.8" Are there some problems that Tortoise would use a different version to that installed on the server (1.7.8 Tortoise vs 1.7.9 Subversion)? Now I would update Tortoise to a new version, can I update with no problem to last 1.7.13 that: "We're proud to announce that TortoiseSVN 1.7.13 has been released. It is linked against Subversion 1.7.10" (I think yes). Or can I update to 1.8.0 that: We're proud to announce that TortoiseSVN 1.8.0 has been released. It is linked against Subversion 1.8.0" (I think no). I would write on UberSVN's forum but it seems in disuse for a while now.


title: Airdrop compatible

text: Is there anything in Linux that implements whatever it is that makes Airdrop in OS X work? I'm not really familiar with that program, so I'm not sure what protocol it's using to communicate. _update_ Specifically I'm looking for a program(s) that if I fired them up, I'd be able to receive and send files to an OS X machine, like I was using Airdrop. (this may be like needing samba to network with windows)


title: Mouse not working correctly

text: So for the last month or so on my Ubuntu 13.10, after installing nvidia drivers and then re installing nouveau drivers (because nvidia didn't work correctly) I got a problem with my mouse. I just made fresh install of 14.04 LTS, but problem persists. Problem is:   * Every 3rd or so click my mouse does not register left click.   * Sometimes mouse makes double click when I make just a single left click.   * Often mouse releases and reapplies left click when I am holding left button. For example when I try `xev | grep ButtonRelease` and click on rectangle, I often get double release output, sometimes even triple. I cannot even select text normally due to this problem, it usually goes like this: ![enter image description here](http://i.stack.imgur.com/KNq96.gif) I tried mouse in Windows 8.1 and it works perfectly. I am extremely frustrated because of this problem. I posted about this on Ask Ubuntu several weeks ago with no replies. **Update** : tested friend's wireless mouse and it works well. So maybe it's a defective mouse, but then why it works in Windows 8.1? **Update 2:** tested this mouse on friend's ubuntu 12.04 system and it works better, but still same problem happens. Does that mean it's defective mouse for sure? **Update 3:** I bought new simple Logitech mouse and the problem is solved. Apparently it was defective mouse.


title: apt-mirror clean script isn't deleting anything

text: I am using `apt-mirror` to create a local Ubuntu mirror. It does succeed in downloading files from another mirror (there's about a couple gigabytes each week), but never removing anything or indicates files that can be deleted. I might run out of free space, eventually. The output of `apt-mirror` always include > 0.0 bytes in 0 files and 0 directories can be freed. > > Run /var/spool/apt-mirror/var/clean.sh for this purpose. The `clean.sh` is ran every time `apt-mirror` executes, because the content of `/var/spool/apt-mirror/var/postmirror.sh` is just               /var/spool/apt-mirror/var/clean.sh      Running `clean.sh` produces this output: > Removing 0 unnecessary files [0 bytes]... done. > > Removing 0 unnecessary directories... done. Here's my `mirror.list` file:               ############# config ##################     #     # set base_path    /var/spool/apt-mirror     #     # set mirror_path  $base_path/mirror     # set skel_path    $base_path/skel     # set var_path     $base_path/var     # set cleanscript $var_path/clean.sh     # set defaultarch  <running host architecture>     # set postmirror_script $var_path/postmirror.sh     # set run_postmirror 0     set nthreads     20     set _tilde 0     #     ############# end config ##############          deb-i386 http://ubuntu.c3sl.ufpr.br/ubuntu/ trusty main restricted universe multiverse      deb-i386 http://ubuntu.c3sl.ufpr.br/ubuntu/ trusty-updates main restricted universe multiverse      deb-i386 http://ubuntu.c3sl.ufpr.br/ubuntu/ trusty-backports main restricted universe multiverse      deb-i386 http://ubuntu.c3sl.ufpr.br/ubuntu/ trusty-security main restricted universe multiverse           deb-amd64 http://ubuntu.c3sl.ufpr.br/ubuntu/ trusty main restricted universe multiverse      deb-amd64 http://ubuntu.c3sl.ufpr.br/ubuntu/ trusty-updates main restricted universe multiverse      deb-amd64 http://ubuntu.c3sl.ufpr.br/ubuntu/ trusty-backports main restricted universe multiverse      deb-amd64 http://ubuntu.c3sl.ufpr.br/ubuntu/ trusty-security main restricted universe multiverse           clean http://archive.ubuntu.com/ubuntu


title: PostgreSQL installation error in debian

text: I'm trying to install PgSql in the system with following specs:               Distributor ID: Debian     Description:    Debian GNU/Linux 7.1      Release:    7.1          x86_64      But I am getting an error like this                  The following packages have unmet dependencies:          postgresql-9.3 : Depends: libc6 (>= 2.15) but 2.13-38+deb7u1 is to be installed      How can I install the missing pakage? I tried `apt-get install libc6=2.13-38+deb7u1` and its showing `libc6 is already the newest version.` but still the issue persist.


title: GNU/Linux: automatic cloning of a system with partitions encrypted with LUKS+dm-crypt

text: I would like to have an up-to-date clone of a (Debian) GNU/Linux system on an external HDD and therefore be able to replace the internal HDD with the external HDD at any time and being up and running in no time. Since the system is on a laptop, I can't rely on a hardware-based mirroring solution. I wish the backup procedure to be as automatic and as hassle-free as possible. For instance, it could run automatically at shutdown whenever an external HDD is connected. I already have an external HDD with a clone of system partitions. The caveat is that the partition that hosts the **/** directory is encrypted with LUKS+dm-crypt and I would rather avoid entering passwords again for the backup. I could mount the external encrypted partition automatically before shutdown. Does a ready-made solution exists? Please only reply if it does, because if it doesn't, then I will post a specific question to implement a custom solution. Thanks for your attention.


title: Per-screen font config?

text: Is there a way to have different fontconfig settings per screen ? I have two 1080p monitors, however one is 13" and the other 27". I would like antialiased fonts on the small monitor, and non-antialiased fonts on the big monitor.


title: What is the point of CTRL-s?

text: `CTRL`+`s` stops all output to the terminal which can be restarted with `CTRL`+`q`. But, why does `CTRL`+`s` exist in the first place? What problem was trying to be solved by putting that control sequence in place?


title: Why is my bash prompt getting bugged when I browse the history?

text: Often when I start looking at history of commands some of the characters from a command displayed aren't erased, for example: What's happening:               prompt$ some_command     prompt$ some_commanother_command      What should have happened:               prompt$ some_command     prompt$ another_command      I can't erase those characters and bash ignores them when executing the command. They also disappear when a new prompt is being displayed (after pressing `Enter` for example). I asked other people who work on Linux at my workplace and they said that they have that problem sometimes too, but they didn't have an idea on how solve that issue. I have Ubuntu 11.10 and I'm using guake. Here is my `PS1`:               \e[0;31m\u \A ${PWD##*/}\e[0;32m$(parse_git_branch)\e[0;31m$\e[m      where `parse_git_branch` is               parse_git_branch () {         git name-rev HEAD 2> /dev/null | sed 's#HEAD\ \(.*\)# (\1)#'     }      As far as I know my colleagues have that problem even with less "fancy" PS1.


title: why bash history overlap the prompt when scroll up in the history?

text: I customized my bash prompt, PS1 value. `~/.bashrc`:               Color_Off='\e[0m'       # Text Reset     BGreen='\e[1;32m'       # Green     BPurple='\e[1;35m'      # Purple     BWhite='\e[1;37m'       # White     BIBlue='\e[1;94m'       # Blue     PS1="[\[$BGreen\w\]\[$Color_Off\]]\n[\[$BPurple\u\]\[$BWhite\]@\[$BIBlue\h\]\[$Color_Off\]]\$ "      When I scroll up in the history with up arrow from the keyboard, after a lot of command I can see these:               [/etc]     [bicocca@bicoccag]$ vi     [/etc]     [bicocca@bicoccag]$ vim     [/etc]     [bicoclear      The command overlaps the prompt. How I can resolve the issue? I tried to search in Google but I did not found anything. I am using RHEL6.4.


title: Why does this PS1 value cause unexpected behaviour?

text: > **Possible Duplicate:**   >  Why is my bash prompt getting bugged when I browse the history? I have set my `PS1` variable in `.bashrc` to be the following: `PS1='\e[35m[\W]:\e[0m '` It achieved what it was intended to (change the color of the prompt which displays `cwd` inside `[]` and before `:`), but when I search through my command history, sometimes parts of commands that I cycle over become attached to the prompt. For example:               [~]: echo "something"     something     [~]: date     Sun Nov 18 17:07:54 PST 2012     [~]: sudo apt-get install vim     ...      Now, say I want to return to my `echo "something"` command, I press up and get               [~]: sudo apt-get install vim      I press up again and this happens               [~]: sudo apt-date      up again               [~]: sudo apt-echo "something"      and if I delete everything on the command line by pressing backspace, it deletes all the way back to               [~]: sudo apt-      It has no affect on the command. For example, the line `[~]: sudo apt-date` will still print the output of `date` etc. Why is this happening and how can I achieve the desired prompt without the side effects?


title: meaning of Netstat local address column

text: Local address on netstat output: When I do `netstat -ntlp` there is a column called `Local Address`:   * sometimes it would output IP address as `0.0.0.0:7180`   * and sometimes `127.0.0.1:9001` What's the implications of both notations? Does specific IP address act like a filter for incoming connections? E.g. for `127.0.0.1:9001` it will only accept connections from localhost on port 9001? Thanks in advance.


title: gstreamer: no element >>x264enc<<

text: I want to encode a videostream to h264. But when I start the gstreamer program I get the following error.               No Element >>x264enc<<      I installed the gst-plugins-bad, gst-plugins-ugly and gst-plugins-good, so the plugin is installed on my PC. How can i tell my PC that the codec is installed? I use Debian Squeeze 6.05 with the Kernel 2.6.32.


title: How can I configure dnsmasq to resolve based on the source of the request?

text: I'm trying to get SiriProxy to work whenever I'm connected to my home network by setting up dnsmasq on my router running the Tomato firmware to send all requests to the Apple Siri server to my local machine running SiriProxy. The problem is, of course, that the machine running SiriProxy needs to access the "real" Apple Siri server. I don't know how often it changes IP addresses, so the simple solution would just be to point it at the IP address... However, is there a way to configure DNSMasq so it will only obey the "address" configuration option when the request is (or is not) coming from certain clients? Alternatively.. does anyone have a better solution?


title: How can I make monodevelop render text in KDE?

text: Monodevelop from git in KDE 4.10.2 does not render text in code edit tabs ![monodevelop run in xterm in kde - no text rendered, no errors](http://i.stack.imgur.com/LzfCE.png) I tried with xfce and text is rendered ok there. I tried disabling composition with alt shift f12 and restarting x server but it was no better. I also tried disabling font softening in monodevelop options and disabling plugins. I also tried temporarily deleting my KDE profile. This is dual screen setup on Nvidia with nouveau. OS is slackware64-current.


title: How should man pages be installed?

text: When distributing a custom utility I'll typically write a makefile that installs binaries to `/usr/local` by default               PREFIX ?= /usr/local     MANPREFIX ?= ${PREFIX}/man          install:         install utility ${PREFIX}/bin/         install utility.1 ${MANPREFIX}/man1/      The path to local binaries is fairly standard across different platforms, but the man path is not   * Linux: `/usr/local/share/man` or `/usr/local/man`   * MacOS - `/usr/local/share/man`   * BSD: `/usr/local/man` Is there a portable way to write this makefile? It seems unreasonable to expect users to set MANPREFIX to the correct path before installing. **EDIT:** BSD make support assignment of a shell command using `!=`, which could be used to test if a path exists               SHARE != [ -d ${PREFIX}/share/man ] && echo /share || true     MANPREFIX ?= ${PREFIX}${SHARE}/man      This is a new feature for GNU make, so it's likely not portable yet. This works in GNU make, but not BSD make:               MANPREFIX ?= $(shell [ -d ${PREFIX}/share/man ] && echo ${PREFIX}/share/man || echo ${PREFIX}/man)


title: bash script that shows mysql innodb log file size

text: I am creating bash script that gives me size of mysql innodb log file in **MB**. Currently I am getting its output in bytes. Please check it out following script and help to get output in MB.               #! /bin/sh            a=$(mysql -uroot -proot -e  "SHOW VARIABLES" | grep innodb_log_file_size | cut -f2)       b=$(echo "$a/$10240" )           echo {"Innodb_log_file_size":"'$b'"' }


title: Changing keyboard layout on Scientific Linux 6.0 and creating new keyboard shortcuts?

text: I have two questions regarding keyboard input and shortcuts: Is it possible to change the keyboard layout on Scientific Linux 6.0 and how can it be done? Is it possible to define new keyboard shortcuts so that the terminal can be launched for example, with CTRL+ALT+T ?


title: Rename two files

text: I would like to rename two files files by using a script. E.g.               mv plugin-cfg.xml plugin-cfg2.xml        and               mv plugin-cfgbk.xml plugin-cfg.xml        I need to do this in multiple directories. Question: How can I do this with just one command in each directory instead of two?


title: How to find files with a certain subpath?

text: I need to find all xml-files that are placed in folders named `config`. Also `config` must be somewhere under a folder named `trunk`. For example, I am interested in all files like below:               ~/projects/e7/trunk/a/b/c/config/foo.xml     ~/projects/d/trunk/config/bar.xml     ~/projects/trunk/config/other.xml     ~/projects/e/e/e/trunk/e/e/e/e/e/e/e/e/config/eeeee.xml      I tried the `find` command:               find ~/projects -regex "*/trunk/*/config/*.xml"      , but the output was empty. What is the correct way to find the required files?


title: Line endings when using GNU Screen

text: I'm seeing some slightly odd behaviour when using GNU Screen 4.00.03 on a Red Hat Enterprise Linux 6.4 system. If I connect without Screen, looking at the logs I can see each line is terminated with CRLF (`0x0D 0x0A`), exactly as expected. If I connect and run Screen, lines with two or more characters are terminated with CRLF as expected. Lines with no printed characters (eg from running a bare `echo`) are terminated only with LF (`0x0A`), and most bizarrely of all, lines with a single printed character (eg `echo x`) are terminated with BSLF (`0x08 0x0A`). I'm seeing this with PuTTY, and the above logs are from PuTTY logs. I'm also seeing this with automated Python frameworks using Pexpect, so I'm not blaming PuTTY for this. What's going on? How do I stop it?


title: Can I specify the layout of a vsplit command?

text: When I do the `:vsplit` command, it always opens the new file on the left side of the screen. Is there a way I can specify I want the new file to open to the right?


title: Network problems after Ubuntu upgrade

text: I'm having real problems having upgraded Ubuntu from 10.04 to 10.10. My main problem is I cannot get a network connection either wired or wireless. When I right click the Network manager applet the Enable Networking check box is greyed out and unchecked. Any ideas how to resolve this? Thanks


title: How to send a output of unix command from one server to another server?

text: How to redirect the output of a unix command from one server to another server. I should be able to send the unix command's output from server-1. Then I should be able to receive the output in Server-2 and write it into a file.


title: Getting Dropbox to sync over SSH

text: I am using Scientific Linux on my office computer and home laptop. I was usually signed in before I leave my office so when I made a change over SSH on my office computer, Dropbox would automatically sync the change. But this time I rebooted my office computer using SSH with `/sbin/reboot`, and after signing in again it would no longer update Dropbox. I guess this is because Dropbox needs to be signed in once locally to continue syncing. How can I set Dropbox syncing remotely over SSH on my office computer?


title: How to install video driver in Debian?

text: I have an old computer with an ATI Radeon 1150. I installed Debian but I don't have a driver for hardware accelerated OpenGL. What should I do?


title: Are dash, ash and sh script 100% compatible?

text: I wanted to know whether scripts written for dash, ash, and sh are 100% compatible? Are there any added features to dash or ash, or syntax change? From what I heard, ash is a direct descendant of sh.


title: Configuring Xorg.conf for i915 intel driver

text: I have a MotionComputing M1400 pen tablet. It runs Debian Squeeze, and today I noticed it was using software rendering for OpenGL, so I decided to try to use the `intel` driver. My chipset is the Intel 855GM. When I initially installed Debian, I had to modify xorg.conf so it would pick up my pen. That `/etc/X11/xorg.conf` is here. To install the driver, I added the ppa `ppa:glasen/intel-driver` and ran `sudo apt-get install xserver-xorg-video- intel`. Upon reboot, my cursor is visible, but I'm sitting at a black screen. My cursor changes to a text selection cursor when I move it over certain parts of the screen, which seem to be the login prompt. I went into tty6 and stopped gdm3 with `/etc/init.d/gdm3 stop` and then tried `Xorg -configure`, which failed. Here is the log file it produced. I tried to combine the `xorg.conf.new` it created with my original `xorg.conf` into a new `xorg.conf`, which is here, but that didn't work either. What should I do to get a graphical interface back?


title: Why does this one-liner clobber files?

text: I have written this to help me batch-encode some videos:               find -name '*.mkv' -exec HandBrakeCLI -Z "Android Tablet" \       -c "1-3" -m -O --x264-tune film -E copy --decomb -s 1 -i {} \       -o `echo {} | tr mkv m4v` \;      However, it fails catastrophically -- it takes each 700-900MB file and replaces it with a 36KB file. Notably, HandBrake is able to read and print the properties of the video file; it is only when it moves on to encode it that it fails because the file is invalid. So it appears that the overwriting occurs when it gets to...               -o `echo {} | tr mkv m4v`      ...but I am not sure why it should. I am simply trying to change the output filename from whatever.mkv to whatever.m4v The filenames do not have spaces. They are of the form `12-the-revenge.mkv`, for instance.


title: How to configure permissions to allow apache to securely have access to a file in a shared environment?

text: This is a follow up question from my previous, but I felt it might be more Linux based. http://serverfault.com/questions/414207/how-to-set-linux-permissions-to-allow- apache-to-have-access-to-a-file At my school we have a shared server environment with several users and several groups. Relavent Groups: `students` `daemon` (runs apache) I want to allow students to be able to have full access to files they own and no access to other students files.Two different students should not be able to even see each others files. I also want apache to be able to read and execute all student files. Specifically I want apache to be able to read a password file owned by each student, I also want the owner of the password file to have full access to it. From my understanding, the best way to do this is to change the group owner of the password file to be apache. So after reading this, http://serverfault.com/questions/357108/what-are-the-best-linux-permissions- to-use-for-my-website it seems a simple chgrp would fix it. But then I run into this: You must be owner of the file(s) as well as a member of the destination group (or root) to use this operation. So each of the students are not a part of the daemon group, they cannot run this command. Giving them that group would be pointless in that they would be able to see other student's password files as well. From the previous thread I gathered that the current security settings are unfit and I have scheduled a meeting with my system administrator tommarrow. But I'm still unsure what I should ask my systemadmin to do. I can't really ask him to manually change the permissions for every password file on the server, the filenames and locations are different and many students are not even set up yet. Allowing students to have full access to chgrp seems dangerous, My inclination seems to ask him to create some type of script that would prompt the student for a file and then run chgrp in place of the student, thus giving apache group ownership. This seems viable, but also pretty complicated as I'm still pretty new to Linux. Would he be able to do something like this easily? I've also considered ACL's but my train of thought goes right back to chgrp, giving students access to setacl seems dangerous.


title: Unable to host a server with Xpra, only connect to an existing one

text: I've downloaded and installed Xpra from their distribution hosted on winswitch. However, when I try to run it on my server I'm getting: > This xpra install does not support starting local servers. and indeed, it won't accept the `start` mode, only the `attach` mode. What am I doing wrong, and how can I host an xpra session after all? Running Red Hat Enterprise Linux Server release 6.0 (Santiago), Linux version 2.6.32-71.el6.x86_64


title: How to use rsync to backup large files by either appending or replacing

text: I am using rsync to backup some large files regularly:               rsync --archive --update --append-verify [source] [destination]      Most of the times, the files increase in size (like a log file), but sometimes they are "reset" to empty, from which point they start growing again. Now, the problem is, with either --append or --append-verify, the files that have been reset will be completely ignored/skipped, according to the rsync man page: > "If a file needs to be transferred and its size on the receiver is the same > or longer than the size on the sender, the file is skipped." I would like to achieve the following rsync behavior:   1. REPLACE if the source file is smaller than the destination file, otherwise   2. VERIFY that the destination file matches the first part of source file. If not, REPLACE the destination file   3. APPEND if the source file is bigger than the destination file Is this possible?


title: screenrc subshell for every window

text: .screenrc:               shell -${SHELL}     caption always "%n(%t) %= %{b}@%H[%l] : %{r}%c:%s"     termcapinfo xterm ti@:te@     termcap  xterm 'AF=\E[3%dm:AB=\E[4%dm'     terminfo xterm 'AF=\E[3%p1%dm:AB=\E[4%p1%dm'     startup_message off          screen -t server 0 rails s     screen -t spork 1 bundle exec spork     screen -t dev_log tail -f ./log/test.log      Pressing Ctrl+C in any of the screen windows above destroys it. I would like to have subshell for every so if I press Ctrl+C than I just exit to that subshell. Right now I'm running `screen` and creating all windows above manually, renaming them and it works great. I can terminate any program on any window, do something else and run it again. What I want to achieve is to have that set-up to run with just one command.


title: Easily get a particular column from output without sed or awk

text: Is there a quicker way of getting a couple of column of values than futzing with `sed` and `awk`? For instance, if I have the output of `ls -hal /` and I want to just get the file and directory names and sizes, how can I _easily_ and _quickly_ doing that, without having to spend several minutes tweaking my command.               total 16078     drwxr-xr-x    33 root  wheel   1.2K Aug 13 16:57 .     drwxr-xr-x    33 root  wheel   1.2K Aug 13 16:57 ..     -rw-rw-r--     1 root  admin    15K Aug 14 00:41 .DS_Store     d--x--x--x     8 root  wheel   272B Jun 20 16:40 .DocumentRevisions-V100     drwxr-xr-x+    3 root  wheel   102B Mar 27 12:26 .MobileBackups     drwx------     5 root  wheel   170B Jun 20 15:56 .Spotlight-V100     d-wx-wx-wt     2 root  wheel    68B Mar 27 12:26 .Trashes     drwxrwxrwx     4 root  wheel   136B Mar 30 20:00 .bzvol     srwxrwxrwx     1 root  wheel     0B Aug 13 16:57 .dbfseventsd     ----------     1 root  admin     0B Aug 16  2012 .file     drwx------  1275 root  wheel    42K Aug 14 00:05 .fseventsd     drwxr-xr-x@    2 root  wheel    68B Jun 20  2012 .vol     drwxrwxr-x+  289 root  admin   9.6K Aug 13 10:29 Applications     drwxrwxr-x     7 root  admin   238B Mar  5 20:47 Developer     drwxr-xr-x+   69 root  wheel   2.3K Aug 12 21:36 Library     drwxr-xr-x@    2 root  wheel    68B Aug 16  2012 Network     drwxr-xr-x+    4 root  wheel   136B Mar 27 12:17 System     drwxr-xr-x     6 root  admin   204B Mar 27 12:22 Users     drwxrwxrwt@    6 root  admin   204B Aug 13 23:57 Volumes     drwxr-xr-x@   39 root  wheel   1.3K Jun 20 15:54 bin     drwxrwxr-t@    2 root  admin    68B Aug 16  2012 cores     dr-xr-xr-x     3 root  wheel   4.8K Jul  6 13:08 dev     lrwxr-xr-x@    1 root  wheel    11B Mar 27 12:09 etc -> private/etc     dr-xr-xr-x     2 root  wheel     1B Aug 12 21:41 home     -rw-r--r--@    1 root  wheel   7.8M May  1 20:57 mach_kernel     dr-xr-xr-x     2 root  wheel     1B Aug 12 21:41 net     drwxr-xr-x@    6 root  wheel   204B Mar 27 12:22 private     drwxr-xr-x@   68 root  wheel   2.3K Jun 20 15:54 sbin     lrwxr-xr-x@    1 root  wheel    11B Mar 27 12:09 tmp -> private/tmp     drwxr-xr-x@   13 root  wheel   442B Mar 29 23:32 usr     lrwxr-xr-x@    1 root  wheel    11B Mar 27 12:09 var -> private/var      I realize there are a bazillion options for `ls` and I could probably do it _for this particular example_ that way, but this is a general problem and I'd like a general solution to getting specific columns easily and quickly. `cut` doesn't cut it because it doesn't take a regular expression, and I virtually never have the situation where there's a single space delimiting columns. This would be perfect if it would work:               ls -hal / | cut -d'\s' -f5,9      `awk` and `sed` are more general than I want, basically entire languages unto themselves. I have nothing against them, it's just that unless I've recently being doing a lot with them, it requires a pretty sizable mental shift to start thinking in their terms and write something that works. I'm usually in the middle of thinking about some other problem I'm trying to solve and suddenly having to solve a `sed`/`awk` problem throws off my focus. Is there a flexible shortcut to achieving what I want?


title: How can I copy a file from a usb drive to a directory on the hard drive in Centos 6?

text: I would like to copy some files from a usb to a ssd hard drive running CentOS 6.5 How do I do this?


title: Dual Booting with windows

text: I am trying to dual booting elementary OS with windows 7. Basically on my 160 GB HDD, i have following partitions:               sda1 which is C drive having windows 7.     sda5 which is D drive with data          and an 10 GB unallocated space.      Now my question is: Can I install Luna on that 10 GB space? Will both OS work if I allocated that 10GB partition for both OS and boot-loader? Last time I tried to install Luna with Windows, none of the OS loaded on next boot. I am a novice to this so your help will be appreciated.


title: Nginx : images not served in HTTPS

text: I have on my website an `admin/` subdirectory, which I'd like to be in HTTPS, so I tried the following configuration, based on this one :               server {         listen 80;              server_name blob.tld;         root /srv/www/blob;         index index.php index.html index.htm;              location /blog/admin/* {             return 301 https://$server_name$request_uri;         }              location / {             try_files $uri $uri/ $uri/index.php /index.html;         }              location ~ \.php$ {             fastcgi_split_path_info ^(.+\.php)(/.+)$;             fastcgi_pass 127.0.0.1:9000;             fastcgi_index index.php;             include fastcgi_params;         }     }          server {         listen 443 ssl;         server_name blob.tld;              root /srv/www/blob/;         index index.php index.html index.htm;              ssl_certificate /srv/www/blob.tld.pem;         ssl_certificate_key /srv/www/blob.tld.key;              ssl_session_timeout 5m;              ssl_protocols SSLv3 TLSv1;         ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;         ssl_prefer_server_ciphers on;              location /blog/admin {             fastcgi_split_path_info ^(.+\.php)(/.+)$;             fastcgi_pass 127.0.0.1:9000;             fastcgi_index index.php;             include fastcgi_params;             try_files $uri $uri/index.php /index.html;         }              location / {             return 301 http://$server_name$request_uri;         }     }      But then images in `admin/style/` are not served. I looked at the log files, that say :               /var/log/nginx/access.log:     127.0.0.1 - - [25/Apr/2014:15:06:27 +0200] "GET /blog/admin/style/lock.png HTTP/1.1" 403 46 "-" "Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit (KHTML, like Gecko) Chrome/32.0"          /var/log/nginx/error.log:     2014/04/25 15:06:27 [error] 23629#0: *404 FastCGI sent in stderr: "Access to the script '/srv/www/blob/blog/admin/style/lock.png' has been denied (see security.limit_extensions)" while reading response header from upstream, client: 127.0.0.1, server: blob.tld, request: "GET /blog/admin/style/lock.png HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000"      Given the error.log file, I think the problem comes from the first location instruction in the HTTPS server (the difference with the HTTP one being `~ \\.php$`). **So I tried to make the exact symetric** (with `\\.php$` instructions in another `location` instruction) :               server {         listen 443 ssl;         [...]              location /blog/admin/* {             try_files $uri $uri/ $uri/index.php /index.html;         }              location / {             return 301 http://$server_name$request_uri;         }              location ~ \.php$ {             fastcgi_split_path_info ^(.+\.php)(/.+)$;             fastcgi_pass 127.0.0.1:9000;             fastcgi_index index.php;             include fastcgi_params;         }     }      But then… no HTTPS at all. I still have the solution of letting images be served in HTTP, but that is kinda frustrating :               location  /blog/admin/style {         return 301 http://$server_name$request_uri;     }      I have nginx 1.1.19 and php 5.3.10 with php-fpm.


title: If I hardlink to a directory, will the contents be "preserved" as if I hard-linked to every file?

text: I've seen people on the internet talk about using hardlinks to force files to stay on disk as a backup, even if they're deleted in their original location. Would this work for a directory too? Why or why not? Assume that I'm using an ext4 filesystem, if it matters, but I'd also be interested in answers for other (UNIX/inode-based) filesystems, especially btrfs.


title: Upgrade Redhat using Command Line

text: I have 5.5 installed on some servers. Now I need to upgrade it to 5.6. I did it by using RedHat 5.6 DVD media using GUI. But my question is: can this be done without restarting the server and booting from DVD while I'm logged in and the 5.5 session is running? Can this be done on the command line, using the media which I inserted into the DVD drive? # Action taken based on Matteo Instructions   1. Mounted Redhat media on */media/RHEL_5.6 i386 DVD/Server*   2. created file in /etc/yum.repos/dvd.repo   3. Then run this command **rpm -ivh createrepo-0.4.blahblahblah.el5.noarch.rpm**   4. Then I tried to run this command **createrepo /media/RHEL_5.6 i386 DVD/Server** And terminal slapped back with this error > Error: Only One Directory allowed per run Normally i copy the RPMs from /media/RHEL_5.6 i386 DVD/Server to /RPMS directory then i run this command createrepo /RPMS and it work. So tell me what to do now. # Action Two inserted the lines in dvd.repo               [dvd.repo]     name=Red Hat Entp Linux $releasever -$basearch - dvd     baseurl=file:///media/RHEL_5.6 i386 DVD/Server/     enabled=1     gpgcheck=0      and when I used the command > Yum clean all it gave me error Options Error: Error Parsing 'file:///media/RHEL_5.6 i386 DVD/Server/ URL must be http, ftp, file or https not ""


title: tail -f, Determine if a file is no longer being written to

text: I am using `tail -f` to follow the growth of a log file. I am having trouble finding a way to detect if the process that is writing to the log file (when it crashes or is otherwise terminated) is no longer accessing or writing to the file. Here is the script I am using               tail -f log_file | while read LOGLINE     do       echo -e "${LOGLINE}"       if [[ "${LOGLINE}" == *ERROR* ]] ; then       echo -e "ERROR FOUND : ${LOGLINE}\n"            # handle the error here            fi     done      What is the easiest and most efficient way to detect that the process writing to the log file has stopped (or that tail -f is no longer recieving input) and echo a message to screen alerting me of the event?


title: How do I know which kernel configuration option enabled my driver?

text: TL;DR:   when I was trying to compile a driver for USB DAQ device I have reconfigured the kernel. The driver refused to compile under the default distro's kernel but everything works with my tweaked kernel. The driver consists of 2 kernel modules. I know which options I changed but I want to know which particular configuration option enabled my driver. Is there any way how to figure it out without trying (configuring and compiling kernel) every possible combination of the options? Longer story:   I have an Advantech USB-4702 DAQ device which comes with a driver for various distros, e.g. openSUSE 11.4. It has to be compiled from source and it compiles well on supported distributions (I tried openSUSE 11.4 32bit with kernel 2.6.37.6-24-desktop). When I was trying to get it work under SLES 11 SP 3 (64bit, kernel 3.0.76-0.11-default) I got compile errors. One of them was caused by this snippet in the source:               #ifndef CONFIG_USB     #  error "This driver needs to have USB support."     #endif      So I took a look at the configuration options of the running kernel (from /proc/config.gz) and found CONFIG_USB to be enabled (I guess I would not be able to use my USB keyboard and mouse if it was disabled). Then I started to play with the kernel configuration and enabled (some as modules) some of them. I compiled the kernel, installed it, rebooted. Then the driver compiled without any errors or warnings and I am able to use the device now. The question is, **how can I find out which particular option "enabled" compilation of the driver?** I know which options were changed, but I don't want to enable anything that is not necessary for the driver. And I don't want to go through configuring and compiling the kernel with every possible combination of the options.


title: Multiline variable with spaces, adding each line to an array

text: I have a problem I can't seem to figure out.. I'm making a script I will run in OSX to help me stay connected to open wifi hotspots. I am reading all surrounding wifi networks into a muntiline variable. These wifi networks have sometimes spaces in their names, which presents a problem for me. I want to loop through this multiline variable that contains spaces and add each line as it is to a new array cell. Adding my code below. Anyone that can help me sort this out?               #Looks for available networks     netarray=(`airport -s |     awk '$NF=="NONE"{print}' |      cut -c 1-32,51-54 |      sort -r -n -k 1.34,1.36 |      awk '{$NF=""; print}' |      sed -e 's/ $//' `)          #Test text added here     echo "netarray below"     echo "$netarray"     echo "cell 0 below"     echo ${netarray[0]}     echo "cell 1 below"     echo ${netarray[1]}     echo ""     #Until here      This gives me this output (See that TPE Free is cut):               netarray below     TPE Free HP-Print-93-LaserJet 1102     cell 0 below     TPE     cell 1 below     Free      airport -s gives me this output currently:                                       SSID BSSID             RSSI CHANNEL HT CC SECURITY (auth/unicast/group)                        fuck this 00:1f:1f:27:e4:ac -79  11      N  -- WEP                            BigA2 34:08:04:c3:9a:14 -85  11      N  US WPA(PSK/AES,TKIP/TKIP) WPA2(PSK/AES,TKIP/TKIP)                          TPE Free 78:cd:8e:a6:ff:30 -90  10      N  T9 NONE                          CHT3826 b0:b2:dc:c3:91:77 -82  11      Y  -- WPA2(PSK/AES/AES)                                KK 00:e0:4c:ac:e1:05 -84  11      N  -- WEP                      perfectidea f8:1a:67:53:eb:da -79  9,-1    Y  -- WPA2(PSK/AES/AES)                         tfb_18_28 b0:c7:45:ac:18:98 -87  7,+1    Y  -- WPA2(PSK/AES,TKIP/TKIP)         HP-Print-93-LaserJet 1102 08:3e:8e:7c:04:93 -86  6       N  -- NONE                        SG-OFFICE 74:d0:2b:dc:67:64 -80  6       Y  -- WPA2(PSK/AES/AES)                            holo15 b8:55:10:bd:3e:70 -82  5,-1    Y  -- WPA(PSK/AES/AES) WPA2(PSK/AES/AES)                   TOTOLINK N300RA 78:44:76:dd:bb:b4 -82  5,+1    Y  -- WPA(PSK/AES/AES) WPA2(PSK/AES/AES)                     ezstay 15F-28 78:44:76:dc:f1:a0 -85  2,+1    Y  KR WPA(PSK/AES/AES) WPA2(PSK/AES/AES)                            12F-32 20:10:7a:9f:d9:c1 -59  1       Y  -- WPA(PSK/AES,TKIP/TKIP)       The awk on airport command just cuts out the names of the Open networks and puts them on separate rows.


title: Match multiple regular expressions from a single file using awk

text: I'm trying to parse a HTML file using shell scripting. There are 4 different regular expressions that i need to catch: `name=` , `age=` , `classs=` , `marks=`. Using               grep "name=\|age=\|class=\|marks=" student.txt      I'm able to get the required lines, but along with these matching lines I also need to print the second line from each match which contains the score. Referring to the question: Print Matching line and nth line from the matched line. I modified the code to:               awk '/name=\|age=\|class=\|marks=/{nr[NR]; nr[NR+2]}; NR in nr' student.txt      But this does not seem to work. How do I search for multiple regular expressions in the same `awk` command?


title: How to terminate tmux session and processes it spawned

text: I noticed that i have a running process and I think it's because i initialized the process in byobu which is using tmux.               ps aux | grep sidekiq     1000     13786  0.0  0.0   8108   900 pts/4    S+   11:27   0:00 grep sidekiq      I have a tmux session called "3". As you can see below:               $ byobu             Byobu sessions...            1. tmux: 3: 1 windows (created Wed Aug 28 10:57:54 2013) [229x84] (attached)       2. tmux: daemon: 1 windows (created Thu Jul 11 12:59:09 2013) [127x83]       3. tmux: juggernaut: 1 windows (created Thu Jul 11 12:54:08 2013) [80x23]      I would like to exit that session and end all running processes that were created by that session.


title: Why SSH takes a long time to Connect

text: I have noticed that some Linux Servers in Network takes long time to connect using ssh. Situations:: There are two situations I have faced. 1: On some servers some times it takes a long time to **_ask for password_** 2: but on other servers When I insert the password **_it doesn't respond_** . And after some time say 20 0r 30 seconds it just say **Connection Closed** # Detail for 1 case               debug1: Authentications that can continue: publickey,gssapi-with-mic,password     debug1: Next authentication method: gssapi-with-mic     debug1: Unspecified GSS failure.  Minor code may provide more information     Cannot determine realm for numeric host address          debug1: Unspecified GSS failure.  Minor code may provide more information     Cannot determine realm for numeric host address          debug1: Unspecified GSS failure.  Minor code may provide more information               debug1: Unspecified GSS failure.  Minor code may provide more information     Cannot determine realm for numeric host address          debug2: we did not send a packet, disable method     debug1: Next authentication method: publickey     debug1: Trying private key: /home/umairmustafa/.ssh/id_rsa     debug1: Trying private key: /home/umairmustafa/.ssh/id_dsa     debug1: Trying private key: /home/umairmustafa/.ssh/id_ecdsa     debug2: we did not send a packet, disable method     debug1: Next authentication method: password


title: How do you remember the syntax for 2>&1 redirection

text: Do you have a mnemonic or system? This has bothered me for years I always have to look it up


title: Slow ecryptfs mount

text: If I create an encrypted share (internally done via `ecryptfs`) on a synology disk station DS109 (DSM 4.1), mounting is very slow (approx 40 seconds). It doesn't matter if I do it via the web-interface or via `synoshare --enc_mount myencryptedshare mypassphrase`. It also doesn't matter if there is data in the share or not, same 40 seconds for an empty share and for one with 1GB in it. Mounting with `encfs` works perfectly, so I guess it might not be an CPU issue, since `encfs` seems to be a bit slower in general than `ecryptfs`. Any idea what may be wrong? How can I debug this?


title: Find command for lookup up a directory tree

text: Is there any equivalent command, or options for, GNU `find` that will search up the directory tree? I'd like to look backwards through the tree for files with a given name. For example, say I'm in /usr/local/share/bin and I want to search look for a file called `foo`. Ideally I'd like the command to look for the file in the following order:   1. /usr/local/share/bin/foo   2. /usr/local/share/foo   3. /usr/local/foo   4. /usr/foo   5. /foo I know that I can write something like this as a shell function, but I was hoping there would be a command as rich as gnu `find` that I could leverage.


title: How to find and replace a particular string in a specific line

text: I developed a code which find and replaces a specific string in all xmls under all subdirectories. But i dont want all occurances to be replaced. In entire xml, code should find the tag xyz and replace xyz within this tag with abc. Other "xyz" in the xml should remain as it is. Can you please help me with this. Thanks...


title: Dual boot win/kali - virtualize the linux partition

text: I have one HDD. 2 partitions with Kali and Windows 8. GRUB is installed. Both OS work fine. I want to remove my Kali partition, and get it as a VM in my Windows 8 partition (I'm using VMware workstation). Is there a way to virtualize this Kali partition ? without damaging my windows 8 one ? Windows does not see the linux partition at all (at least with the Disk Manager, maybe another software is able to see it as GParted or EasyPart). Another solution is to erase my Kali partition and re-extend my windows 8 one, but I'm afraid the windows 8 partition would not boot after it. And it's less fun doing this way. But the Kali partition does not have important stuff that I want to keep/save. So if it's the only way to do it, I can format the kali partition. Hope I'm understable enough and at the right place to ask this kind of question. Many thanks.


title: I no longer see the output of rc scripts

text: **My current problem** After cloning the root filesystem of my debian system to an SSD (`cp -ax`) **I no longer see the output of my rc scripts** during boot from the SSD. I do see them during shutdown or when I run rc-scripts manually. I also see them when I boot into runlevel 1, login as root an then exit. Kernel is 3.8.2 compiled by myself. When the system boots, I see the kernel messages (which look like what `dmesg` would show), then there are no more messages for a while until I finally see a login prompt or a display-manger login. Some of the kernel messages really originate from rc scripts but I only see the kernel messages and not the output of the rc scripts like `[ ok ] starting foo` themselves. Other than that the system runs okay. I tried to boot a stock debian kernel (3.2.0-4-486) which lives on another partition (/dev/sda3) and pass it _my_ root (/dev/sda1), so it takes my rc- scripts. In this case I see the messages. On the internet I found a few reports about the exact same problem. But there was either no solution posted or the solution was "reinstall". A possibly related issue is that I cannot boot into single-user mode anymore (runlevel 1 works). It boots straight into initdefault (=3). I _suspect_ that the console is missing, sulogin fails and the boot process continues as if I had exited from sulogin. I also cannot boot into a shell (`sash`). I see a welcome message from sash, but it won't talk to me (no prompt). my current theories meander around   * Did cp -ax miss anything (e.g. /dev)?   * Does the faster disc cause a timing problem?   * Or is it something utterly trivial and I just cannot see it? **Edit May 4th** I finally realized that /dev/console needs to be present right from the start. So I created one, using `mknod` and now I see messages from the rc scripts again. While /dev/console _gets_ created early on by `udev`, that doesn't seem to fix things during boot. So my original problem is solved. Still I'd like to know   * why booting another kernel fixes the problem. /dev/console is present on /dev/sda3 (the location of the other kernel) before udev runs. This observation made me create /dev/console in the first place. But I don't understand why the kernel would take _this_ /dev even though I passed it another root.   * where /dev comes from during boot   * why /dev/console created by udev isn't good enough   * what other /dev nodes are needed   * why booting into init=/bin/sash still doesn't work


title: Reload /etc/default/locale without reboot?

text: After making changes to `/etc/default/locale`, is it possible to reload/active the new settings without a reboot?


title: date format in /etc/hosts.allow

text: I have following line in my /etc/hosts.allow               sshd: 1.2.3.4 : spawn (echo `date` ALLOWED from %a >> /var/log/%d.log) &      The problem is, the date command prints time in the standard format, such as               Thu May 16 15:54:55 CEST 2013      which is complicated to process with my script. I would like to have `date` to specify my own format, such as `date "+%F %T"`, to get following format:               2013-05-16 16:01:07      even if I escape the special characters (%), the following does not work:               sshd: 1.2.3.4 : spawn (echo `date "+\%F \%T` ALLOWED from %a >> /var/log/%d.log)      Could somebody please advise ?


title: How does this command make a user a sudoer?

text: According to this DevStack guide, the following commands will give sudo privileges to the `stack` user:               apt-get install sudo -y || yum install -y sudo     echo "stack ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers      How does that work? What does each part of those commands do?


title: How can I allow a group to execute a command as another user?

text: I'm conservative about my `sudoers` policy. I'm trying to allow `wheel` users to run `psql postgres postgres` as the `postgres` user (because when ident that's the only way it works).               root ALL=(ALL) ALL     %wheel ALL=/usr/bin/psql      here's the error                Sorry, user xenoterracide is not allowed to execute '/usr/bin/psql postgres postgres' as postgres on slave-vi.      The command I'm running is               sudo -u postgres psql postgres postgres       The policy works for executing things as `root`, but I just need this specific command to run as `postgres`.


title: What is the effect of setting the timeout value to 0 in /etc/resolv.conf?

text: In order to fix a problem with DNS resolution in a particular customer environment, their admin has suggested adding `options timeout:0` to the `/etc/resolv.conf` file on their CentOS 5 server. The man page on the OS for `resolv.conf` has this to say about the timeout setting: > timeout:n > > sets the amount of time the resolver will wait for a response from a remote > name server before retrying the query via a different name server. Measured > in seconds, the default is RES_TIMEOUT (currently 5, see <resolv.h>). And I see from here that there is a silent cap of 30 seconds, but I haven't found any documentation anywhere that tells me what the effect of setting this value to 0 will be. Does anybody know?


title: Unable to boot New solaris ramdisk image in SAM - Bad Magic number error

text: I am trying to create a new ramdisk for SAM with 1GB space from the provided "disk.s10hw2". Below are the following steps (following the thread in OTN: Booting problem with custom built solaris10 disk image on legion & sam.)   1. We have the disk.s10hw2 initial SAM image. We mounted that and created a backup using ufsdump : > ufsdump 0cvf /dev/rmt/0 /mntdir   1. Created an empty file of 1GB size: > dd if=/dev/zero of=new.img bs =1024 count=1000000   1. Used the new.img as a block device. > lofiadm -a new.img /dev/lofi/1   1. Created a UFS on top of the new.img file > newfs /dev/lofi/1   1. Restored the initial filesystem using ufsrestore > ufsrestore rvf /dev/rmt/0   1. Made the ram disk image bootable > /usr/sbin/installboot /mntdir/usr/platform/sun4v/lib/fs/ufs/bootblk > /dev/rlofi/1   1. Unmounted the image   2. Modified 1up.conf file in legion to the following: > device "memory" 0x1f80000000 +1024M { // Increase the memory size for the > new disk >   >   >       virtual_disk; >   >       load s0 shared "disk1.big";  // replace the disk with the new one you > created and use shared instead of rom >   >       } >     1. Changed the name of the disk in the SAM configuration   2. Created a soft link of the SAM S10image folder to the new.image ramdisk image location   3. Booted legion to create a new disk label for this new disk   4. Legion booted successfully with the new image with the "boot disk -vV" command. Once loaded, "sync" and then "halt" the system to write into the disk and prompt to the ok. At this point, terminated Legion using Ctrl-C.   5. Then loaded SAM with the new RAMDISK (changed the sam-1p.rc file to point to the new ramdisk). SAM gives out the following error: > ok boot disk –vV >   >   >       Boot device: /virtual-devices/disk@0 File and args: -vV >   >       Bad magic number in disk label >   >       Can’t open disk label package >   >       Can’t open boot device >   >   >   >       ok >   Not sure what I am doing wrong to boot the new disk properly to SAM. I am using SAM-T1 downloaded from the opensparc.net website. ALso, I am using a SPARC based machine with Solaris 10 installed on it.


title: X problems on Fedora 15

text: I just upgraded from F13 to F15 using the Installation DVD and it looked all went fine. When I first booted into F15, gdm was having troubles starting up. I tried removing Xorg and reinstalled and issued `Xorg -configure`. It came up with `Screens found, but none have usable configuration. FATAL ERROR: No screens found` **Attachments:** `Xorg.0.log` - Error log `/root/xorg.conf.new` - file created when doing `Xorg -configure`. `/etc/X11/xorg.conf` - My old `xorg.conf` file I was using for my Intel card. Originally got from the Nvidia Proprietary installer. I'm curious about these lines               [   117.519] (II) Loading /usr/lib/xorg/modules/drivers/vesa_drv.so     [   117.519] Refusing to touch device with a bound kernel driver     [   117.519] (WW) Falling back to old probe method for vesa      I just want to know if this can be corrected, before I go do a fresh install. I never thought an upgrade would be such a pain in the bottom. **EDIT:** I just found these line in my `dmesg`               [    5.144255] systemd[1]: /usr appears to be on a different file system than /.     This is not supported anymore. Some things will probably break (sometimes even silently) in mysterious ways. Consult      http://freedesktop.org/wiki/Software/systemd/separate-usr-is-broken for more information.      and the above link mentions there are 23 obvious cases during an F15 install. Could this be a reason for my X Problems? If so, how do I merge my `/usr` back to `/`? The complete dump of `dmesg`, just in case it happens to give you enough clues.


title: Fixing permissions on a buffalo NAS (XFS via SMB)

text: I have a `Buffalo dual harddrive NAS` and plugged one of the drives directly to an `SATA` port to speed up the file transfer (100 MBit is a 'bit' slow when transfering 2 TB of files). I used a live Ubuntu DVD to mount the volume. My problem now is, I can't delete or rename any of the files I copied directly via Linux to that drive. Windows 7 demands that I'm admin of this computer. I can't even see the permissions since I do not have permission to do so. Is there an easy way to fix this, preferably without hooking it back to the `SATA` port?


title: Reverse global and local marks in vi/vim

text: How can I reverse the capitalization convention of marks in vi/vim? Normally a lower-case mark like "a" means is local to the current file, but upper case marks like "A" are global to the session. Since I normally use only global marks I want the lower case to be the global marks. In other words I want to reverse the default convention.


title: Can I make alt-tab window always appear on the primary screen in Gnome?

text: Right now it appears on whatever screen the app I'm switching from is located. If I while alt-tabbing I accidentally stop on my radio player, located on my alt screen, it's most annoying.


I'm reproducing the Debian PRNG vulnerability from 2008 in a lab environment. Now I'm trying to SSH into the machine, but every time I try to send the private key I get:               Public key f3:6e:87:04:ea:2d:b3:60:ff:42:ad:26:67:17:94:d5 blacklisted (see ssh-vulnkey(1)); refusing to send it      Is there a flag I can give SSH to ignore the fact that this key has been blacklisted?


title: Commands for determining level of usage of server

text: I am scripting a new program that will connect to a cluster of machines in a VM park, and hopefully check their level of usage. The VM clients are a combination of RHEL and CentOS, and runs on multiple KVM hosts. I am hoping to be able to find the VMs that are no longer needed, by checking what they are being used for now. What would be good indicators for system usage, and which commands could help me with rating the system accordingly? I am thinking that if I combine commands like uptime, "chkconfig --list", last and ps I can determine the rate of usage, but at a very innacturate level. Hope you could help me with this conundrum. With system usage I am thinking of if the machine is in use, or if it could be shut down, without it harming any applications or users. With the examples, I can determine if there are servers that are a lot different than the rest, but I would not be able to state if it is in use or not.


title: Preventing duplicate entried in PATH (.cshrc)

text: I have little experience with Linux, so I will appreciate some help. I need to prepend directories to the path variable in my `.cshrc` file and I want to make sure that the entries are not repeated when compared to existing directories in the path variable. Can someone please advise suitable commands for that? The path on my machine is `:` separated, not space separated.


title: /usr/bin vs /usr/local/bin on Linux

text: Why are there so many places to put a binary in Linux? There are atleast these five:   1. `/bin/`   2. `/sbin/`   3. `/usr/bin/`   4. `/usr/local/bin/`   5. `/usr/local/sbin/` And on my office box, I do not have write permissions to some of these. What type of binary goes into which of these bins?


title: Why there are multiple folders for executable files in Linux?

text: I'm trying to understand Linux file system, and one of the question is: 1- Why there are multiple folders for executable files: `/usr/bin`, `/usr/sbin/` and `/usr/local/bin`? Is there any differences between them ? 2- If I have an executable file and I want to add it to my system, which of the third latter locations is the best for me ?


title: Phonon VLC backend settings

text: I am testing video hardware acceleration and I would like to know, where are settings of VLC-backend for phonon. Are changes made in VLC itself actual changes that are applied to the backend itself (which in turn should be system wide, not just for vlc)?


title: Cannot ping from Solaris 11.2 to OS X 10.9.4

text: Been struggling with this for too long now. Google results do not help. Scenario is ping works in one direction, from OS X to Solaris 11 on a wired LAN, but not the other way. Ie: Solaris cannot ping the OS X m/c ? Connectivity is through a basic setup on a comcast cable modem. No VLAN's, DHCP IP's (reserved) and on the same 255.x.x.x. subnet. Netstat, ipadm and if_config are not giving me any clues. Some ideas on this would be appreciated. Thanks. Important - Solaris can connect to the WAN.


title: using 64bit library for 32 bit application

text: We have 32 bit application on 64 bit rhel 6.4 . If I do ldd on the binary, it shows it is using 32 bit version of glibc. Is it possible to make it to point to 64 bit version of glibc? If yes, how can I do that? I have compiled the binaries using the -m32 flag.


title: Passing execution from initrd to real init and issues with missing devices under /dev/mapper

text: For Gentoo, I am able to (finally) boot my encrypted system with an initrd and LILO. I used the guide at http://whitehathouston.com/documentation/gentoo/initramfs_howto.htm However it appears that /dev/mapper/cryptvg-root is missing after the system has finished booting. Why would that be? Doing ls -al /dev/mapper shows only the file "control". Yet mount says that /dev/mapper/cryptvg-root is mounted at /. I thought perhaps I needed to add something to remap the /dev file system in the initrd to the real root file system before control is passed over. So I added this:               mount -o move /dev /mnt/root/dev      Before I do exec switch_root. However I still have no /dev/mapper/cryptvg-root when it has finished booting. What do I need to do so that control is passed properly prior to and during exec switch_root? If it should matter: /dev/sda1 = /boot (not encrypted) /dev/sda2 = / (encrypted)


title: How to execute consecutive command from history?

text: Suppose I want to execute a sequence of four commands that I have executed before. If the first one is 432 in the command-history, then I could do:               $ !432; !433; !434; !435      I'm curious, is there a more efficient way to accomplish this?


title: Bash: repeat last N commands

text: In bash you can repeat the last command by entering `!!`, or the third last command `!-3` for example. Is there a quick way to repeat the last 3 commands, without having to type out `!-1; !-2; !-3` explicitly?


title: lrzsz doesn't working in my Mac OS X

text: When I was used secureCRT in Windows, I often used `sz` and `rz` to transfer files between my linux server and client machine. But I can't use that way in iterm2 in MacOS X. `lrzsz` package has installed in my linux server(ubuntu 13.04)   But, > benjamin@my-ubuntu-13-04:~$ rz   >  �z waiting to receive.**B0100000023be50 The terminal client got a hang. What's the problem?


title: ldd tells me my app is "not a dynamic executable"

text: I have a 32-bit application (called uclsyn) I received from an astronomy professor. I managed to get it running on CentOS a year ago, but now when I am setting up a new CentOS VM, it won't run and I can't work out why. It keeps coming back with "Killed". This is the exchange on the command line:               $ ./uclsyn_linux     Killed          $ ldd ./uclsyn_linux     not a dynamic executable          $ file ./uclsyn_linux     uclsyn_linux: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped      On the machine which is does run on, "ldd ./uclsyn_linux" returns a whole list of dependencies. I've found the packages which provide these shared libraries, and they all appear to be installed. **Packages required**   * libSM-1.1.0-7.1.el6.i686   * libX11-1.3-2.el6.i686   * libgcc-4.4.6-3.el6.i386   * glibc-2.12-1.47.el6_2.9.i686   * libuuid-2.17.2-12.4.el6.i686   * libXau-1.0.5-1.el6.i686   * There are also a heap of libraries local to the application which I have checked and are already installed. **My environment** CentOS running under VirtualBox `uname -a`: Linux localhost.localdomain 2.6.32-358.el6.i686 #1 SMP Thu Feb 21 12:50:49 UTC 2013 i686 i686 i386 GNU/Linux


title: Run commands at random

text: I want to run one of the two commands `C1` and `C2` at random. How do I do that on commandline (bash)? Will appreciate if a one-liner is possible.


title: VNC & SSH : local (win-putty) -> hop (linux) -> remote (linux)

text: I'm gettin a headache trying to access a remote VLC & SSH. This is the situation : `Local` : Win box behind NAT, dynamic IP. I want to connect from here. `Hop` : Linux box, static IP server `Remote` : Linux box behind NAT, dynamic IP. I want to connect here As the `remote` has dynamic IP and is behind NAT, I make ssh reverse tunnels to the `hop` :               ssh -R 55900:localhost:5900 -R 50022:localhost:22 user@hop      This step seems to work. From the `hop`, I can ssh the `remote` connecting to localhost port 50022 :               ssh -p 50022 user@localhost      Then from the local, I make ssh tunnels to the hop, with putty : ![Making tunnels](http://i.stack.imgur.com/tWB7W.jpg) Once the second tunnel is made on `local`, when I try to reach the `remote` SSH or VNC, the connection is straight closed. For SSH (via another instance of putty), I get the error "Server unexpectedty closed the connection" For VNC (TightVNC Viewer) : "Connection has been gracefully closed" I tried to change some putty options after looking for solutions on the web, as "enable X11 forwarding", or "Allow agent forwarding", but without success. Any idea of how to solve this? Thanks


title: Can we create lvm volume group with mapped device?

text: I can create a lvm volume group with a loop device. But if I use dmsetup to map the loop device into several devices, then I can't create a lvm group with /dev/dm- _. Why is it not possible to create group with dm-_?


title: sudo does not allow me to run cp

text: Executing the following command on a CentOS 5 box:               $ sudo cp file1  file2      gives me the following error: > Sorry user my_username is not allowed to execute '/bin/cp file1 file2' as > root on site_name.com How can root access not be enough?


title: Vim: searching upward/downward in file from specific point/position

text: I want to search a word from my current cursor position in vim to upward in file. How to achieve this? Also how to do same for downward in file.


title: Allow www-data to perform specific commands

text: I need a PHP script to perform `git pull` however I am not naive enough to give it permissions on `git`. I've wrapped `git pull` in a script which `www- data` has permissions for, but I'm not sure how to give the script permissions on `git` itself:               $ sudo tail -n1 /etc/sudoers     www-data ALL=(ALL) NOPASSWD: /home/php-scripts/git-pull          $ cat /home/php-scripts/git-pull     #!/bin/bash     /usr/bin/git pull          $ ls -la /home | grep php-scripts     drwxr-xr-x  2 ubuntu ubuntu 4096 Sep  3 09:26 php-scripts          $ ls -la /home/php-scripts/git-pull     -rwxrwxr-x 1 ubuntu ubuntu 30 Sep  3 08:44 /home/php-scripts/git-pull          $ cat /var/www/public_html/git-wrapper.php     <?php          $output = array();     $value = 0;     exec("/home/php-scripts/git-pull", $output, $value);          echo "<pre>";       echo "Return Value: {$value}\n";          foreach ( $output as $o) {         echo $o."\n";     }          ?>      Note that `/var/www/public_html/` is in fact a git repository. I often perform `git pull` in that directory from the CLI. However, when I call this script in a web browser I see that the files were not updated via `git pull` and the following is output to the browser:               Return Value: 1      This is on Ubuntu Server 12.04 with Git 1.7.9.5. The remote repository is on the same server.


title: how to move files from one folder to other with appending time stamp to the name?

text: > **Possible Duplicate:**   >  Renaming a bunch of files with date modified timestamp at the end of the > filename? I want to move files from one folder to another folder with appending time stamp to file names. For example, I have two files called `file1` and `file2` in folder `f1`. I want to move these files to folder `f2` as file names `file1_22_jan_11:42` and `file2_22_jan_11:42`.


title: unetbootin: cannot mount squashfs on loop device

text: Im having a bit of fun with unetbootin with linux mint 16 setup in it. However when I try run the default menu item I get an error that ends with this: can not mount /dev/loop0 (/cdrom/casper/filesystem.squashfs) on //filesystem.squashfs) any ideas?


title: How can you combine all lines that end with a backslash character?

text: Using a common command line tool like sed or awk, is it possible to join all lines that end with a given character, like a backslash? For example, given the file:               foo bar \     bash \     baz     dude \     happy      I would like to get this output:               foo bar bash baz     dude happy


title: Top "id" is using 50-99% of CPU

text: My i386 Lubuntu install is running with a constantly 100% CPU. Using `top` I have diagnosed "%id" as using up a lot of CPU, usually between about 50% and 99%. Why is this happening, and how can I stop it?


title: Trouble getting iwlwifi driver working

text: I just installed Debian and I am having issues getting my wireless working. I installed Squeeze and also the nonfree firmware for `iwlwifi`. I thought I did everything right but I am still not getting online. My wireless hardware won't even turn on. So this is what I did: Put the `.deb` files in a flash drive, booted the system and from there I typed `dpkg -i <firmware>.deb` I restared my network first and then rebooted the PC after which I was still not getting a connection. I typed `aptitude show firmware iwlwifi` and it showed all the files that were in `/lib/firmware` which where all correct. `modeprobe iwlwifi` gives me a FATAL error saying the module isn't there and `ifconfig/iwconfig` only shows some eth0 and another interface that isn't wlan0 What could I be doing wrong? Was I supposed to download the "backport" firmware files instead? Output of `lspci -nn` and `dmesg|grep iwl`: http://paste.debian.net/179554


title: What are some quick ways of making N copies of a particular file?

text: Say, if I wanted to make N copies of a.txt, and wanted them to be numbered a1.txt, a2.txt, a3.txt, etc... How would I do such a thing succinctly?


title: how to send email as well as display it out

text: i am trying to run a script with the output to be emailed and watched(monitored), i try using this code:                   this are the output: >emailmessage         echo "output here" >>emailmessage         /bin/mail -s "$SUBJECT" "$EMAIL" < $emailmessage      and an email will be sent with the results but wont be displayed on my terminal, for now i use `echo "email sent!"` so i can be notified that the script was done running. How can i send it out and display it as well?


title: EACCES that should not happen

text: I have a situation on a Linux machine that I can't really explain. Some background: We're running apache with a c/c++ module that forwards requests to our application. It does so by reading a .port file which specifies a local port to send the requests to. After installation, it is not possible to connect using the web interface. After a bit of troubleshooting I bring out strace and see that the apache processes fail to read the .port file:               [pid  8105] stat("/tmp/somedir/application.port", 0x7ffff9694470) = -1 EACCES (Permission denied)      I check the permissions on the file:               % ls -l /tmp/somedir/application.port     -rw-r--r--. 1 appuser staff    5 Oct 16 14:10 application.port      So, anyone should be able to read that, right? I check who the apache process runs as:               % ps -ef | grep 8105     appuser   8105  3357  0 15:14 ?        00:00:00 /usr/sbin/httpd      So the apache process runs as the owner of the file. That should work too, right? Finally, I do:               % su - appuser     % stat /tmp/somedir/application.port       File: `/tmp/somedir/application.port'       Size: 5           Blocks: 8          IO Block: 4096   regular file     Device: 11h/17d Inode: 1400293     Links: 1     Access: (0644/-rw-r--r--)  Uid: ( 1001/ appuser)   Gid: ( 1001/   staff)     Access: 2013-10-16 14:10:03.357679902 +0200     Modify: 2013-10-16 14:10:03.357679902 +0200     Change: 2013-10-16 14:10:03.357679902 +0200      So, the "appuser" owns the file, runs the web server, but don't have the permission to do stat() on it from within the web server process? Does anyone have an idea about what could be going on here? I should also mention that this is not the first installation we've done, and the others work as expected. There might have been some manual fiddling during the installation of this particular machine, but I still don't see how we can end up like this. Restarting processes also does nothing to change the behavior. The machine is a RHEL 6 box.


title: Iterate over the output of a command in bash without a subshell

text: I want to loop over the output of a command without creating a sub-shell or using a temporary file. The initial version of of my script looked like this, but this doesn't work since it creates a subshell, and the `exit` command terminates the subshell instead of the main script which is required. It is part of a much larger script to configure policy routing, and it is halt the execution if it detects a condition that will cause routing to fail.               sysctl -a 2>/dev/null | grep '\.rp_filter' | while read -r -a RPSTAT ; do            if [[ "0" != "${RPSTAT[2]}" ]] ; then         echo >&2 "RP Filter must be disabled on all interfaces!"         echo >&2 "The RP filter feature is incompatible with policy routing"         exit 1       fi     done      So one of the suggested alternatives is to use a command like this to avoid the subshell.               while read BLAH ; do echo $BLAH; done </root/regularfile      So it seems to me that I should also be able use a command like this to avoid the subshell and still get the output from the program I want.               while read BLAH ; do echo $BLAH; done <(sysctl -a 2>/dev/null | grep '\.rp_filter')      Unfortunately, using that command results in this error.               -bash: syntax error near unexpected token `<(sysct ...      I get really confused since this does work.               cat <(sysctl -a 2>/dev/null | grep '\.rp_filter')      I could save the output of that command to a temporary file, and use redirect the on the temporary file, but I wanted to avoid doing that. So why is the redirection giving me an error, and do I have any options other then creating a temporary file?


title: Permanently remapping a key on Linux

text: I'm using an aluminum Apple keyboard with my Mandriva 2010.2 Linux system. I remap the Apple Command key (`⌘`) to `control` using the following `.Xmodmap` file:               keycode 134 = Control_R     remove mod4 = Multi_key     add Control = Control_L Control_R Multi_key      If I allow **xscreensaver** to activate and run for some time, it appears to undo this remapping. I subsequently have to run `xmodmap ~/.Xmodmap` again manually. Is there any way to avoid this? I'm using **XFCE** as my desktop environment.


title: Setting hostname variable right after SSH login

text: I have set of some (third-party) shell scripts, which are supposed to connect to remote host and start some daemons (hadoop, if that matters). These scripts rely heavily on hostname in order to configure pid folders, data directories etc. What I need to do now is to create some test/development environment on single machine, using Arch, which means:   * configure /etc/hosts to provide some aliases to 127.0.0.1, like data1, data2, data3 (that's the trivial part)   * configure passwordless SSH access to localhost (which is also trivial)   * somehow set the hostname for current SSH session, like if I connect using 'ssh data1' - then hostname should be "data1" - and this is what I can't figure out. so I need to solve 2 problems:   * how do I pass some environment variable or something like that to remote host, so it will be visible to all scripts there   * how do I set hostname on remote host for that session only and all this happens on the same computer.


title: find files not matching list of filename patterns

text: I find myself needing to find and identify extraneous files (out of about 900K files on a 2T drive). There are lots of files that I want to keep, and I have filename patterns for these known good files. What I want is to locate those files that don't fit any of the patterns. _How do I find files not matching a list of filename patterns?_ I can run `find` to get a list of all files, and I could use `grep -v` on the result, using a list of patterns stored in a file. Is this the canonical method, or do you have a concise way to find these non-conforming files? * * * _Clarification - based upon the answers, here is a little more information. I expect to have numerous patterns (>20, maybe >100), I want to store them in a file and certainly want an easy way to add new ones. I would prefer to avoid directly editing a large list of find parameters (fragile), but building that list might work._


title: grub-update in GRUB Legacy (0.97)

text: I have reinstalled grub, because I have done an install of Windows 7. The problem is that grub doesn't see Windows. I know, that in grub2 I can run grub-update and it will find all my systems. But I don't know how to do this grub legacy. I'm using Fedora 15.


title: HP Laptop refused to boot Arch or Fedora CDs but boots Debian based fine

text: My Laptop a HP Probook 4510s refuses to boot Fedora or Arch Linux CD'S, But will boot and install Debian based stuff ie Debian, Ubuntu. If it put a fedora or arch CD in it will just stick on BIOS screen and never do anything the CAPS lock key flashes and the HDD light constantly flashes at a rapid rate, no keystrokes work and I have to reboot with the CD/USB out to work normally again. Ive tried changing a bunch of BIOS setting including SATA/IDE resetting to defaults, I tried putting arch on a memory stick and still nothing, but if I stick the same Arch, fedora cd/usb in my girlfriends laptop they work fine, Any ideas?


title: How do I recursively check permissions in reverse?

text: There's a command, I think it comes with apache, or is somehow related to it, that checks permissions, all the way down. So if I have `/home/foo/bar/baz` it will tell me what the permissions are for `baz`, `bar`, `foo`, and `home`. Does anyone know what this command is or another way of doing this? The command basically starts at the argument, and works it's way up to `/` letting you know what the permissions are along the way so you can see if you have a permission problem.


title: Open a file given by the result of a command in vim

text: I find myself doing the following almost every day   1. Run a find (`find -name somefile.txt`)   2. Open the result in `vim` The problem is I have to copy and paste the result of the `find` into the `vim` command. Is there any way to avoid having to do this? I have experimented a bit (`find -name somefile.txt | vim`) but haven't found anything that works. Thanks in advance


title: systemd failure on binfmt services

text: Systemd has several failed services, and I don't know how to work it out:               # systemctl --failed     UNIT                              LOAD   ACTIVE SUB    JOB DESCRIPTION     proc-sys-fs-binfmt_misc.automount loaded failed failed     Arbitrary Executable File Formats File System Automount Point     systemd-binfmt.service            loaded failed failed     Set Up Additional Binary Formats      More details:               # systemctl status systemd-binfmt.service     systemd-binfmt.service - Set Up Additional Binary Formats           Loaded: loaded (/usr/lib/systemd/system/systemd-binfmt.service; static)           Active: failed (Result: exit-code) since Tue, 2012-11-27 07:42:11 CST; 36min ago             Docs: man:systemd-binfmt.service(8)                   man:binfmt.d(5)                   https://www.kernel.org/doc/Documentation/binfmt_misc.txt          Process: 213 ExecStart=/usr/lib/systemd/systemd-binfmt (code=exited, status=1/FAILURE)           CGroup: name=systemd:/system/systemd-binfmt.service          # systemctl status proc-sys-fs-binfmt_misc.automount     proc-sys-fs-binfmt_misc.automount - Arbitrary Executable File Formats File System Automount Point           Loaded: loaded (/usr/lib/systemd/system/proc-sys-fs-binfmt_misc.automount; static)           Active: failed (Result: resources)            Where: /proc/sys/fs/binfmt_misc             Docs: https://www.kernel.org/doc/Documentation/binfmt_misc.txt      Any suggestions?


title: Tell Conky to update from a separate process

text: I have Conky display my current volume with `${exec bash /path/to/script/getvolume.sh}`. However I have noticed that after changing the volume, I have to wait a while for Conky to update. Is it possible for me to write another script `changevolume.sh`, so that `./changevolume.sh 12` would not only change the volume but also make Conky update itself immediately afterwards so that I don't have to wait for the usual update interval period?


title: Deleting specific lines and duplicates from a 11gb wordlist text file

text: I have an 11gb wordlist file which is already sorted as each word is on its own line. I need to remove duplicates and lines starting from 077. I guess I need to run `sed` and `sort -u` together but I also want a live output (display whats happening in terminal) and if possible display the time left. All of this in one command and it must be able to run optimally at full performance under a LiveCD or possibly installed BackTrack 5 rc3. Time is not very important but if there is a way for me to calculate the ETA, I might be able to borrow my dad's i7 based CPU which should process it faster obviously otherwise I'll have to use an older core 2 CPU. The problem I'm facing with `sort` command is that under a VMWare player running it live, it doesnt have enough space so I have to specify temp files on my 32gb USB by using the `-T` command. I guess this won't be a problem had I installed Linux. So please give me the complete command, be it `sed`/`sort`/`awk` to do this (whichever is most optimal).


title: Want a seperate file to store mysql username, password, and database name

text: I have as script that dumps a mysql database, and compresses the file. What I want to do is have another (edit) file which can change the username, password and database name. Then somehow connecting that file to this script. In another file I want something that says for example.               username =  "username"     password = "password"     database = c2duo_db      Then in a script name **mysqlbackup.sh** some import the username password and database from the file.               #!/bin/sh          mysqldump -u"username" -p"password" --opt c2duo_db > /home/sh/c2duo_db-`date +%d%m%Y`.sql          cd /home/sh     tar -zcvf c2duo_db-`date +%d%m%Y`.tar.gz  *.sql


title: Any better method than this for sorting files by their creation date?

text: I needed to display a list of directories sorted by their creation date and I came up with this code snippet that I thought was kind of clever. Is there a more obvious way to do this that I'm missing?               printf "%-20s\t\t\t%-s\n" "DATE" "CASE"     printf "%-20s\t\t\t%-s\n" "----" "----"          find $idir -mindepth 3 -maxdepth 3 -type d -printf "%T@ %Tc\t\t%p\n" \          | sed "s#${idir}/##" \          | sort -h \          | sed "s#^[^ ]* ##"      ### Sample output               DATE                                    CASE     ----                                    ----     Fri 06 Sep 2013 11:17:41 AM EDT         dir1/Baseline/2013_09_06_11_16_10     Fri 06 Sep 2013 01:44:38 PM EDT         dir2/Baseline/2013_09_06_13_42_48     Sun 08 Sep 2013 05:02:46 PM EDT         dir3/6 Month/2013_09_08_17_02_05     Fri 13 Sep 2013 02:28:30 PM EDT         dir4/Baseline/2013_09_13_14_25_09      ### Details The above will look exactly 3 directories deep from the directory `$idir`. It then prints the creation time of any directories that are found at this depth. I then strip the `$idir` portion of the path off of the output (don't need it), sort it, and then chop off the `%T@` portion of the output. This was only so that I could more easily sort the output. Without the trailing `sed` the output looks like this:               DATE                                    CASE     ----                                    ----     1378480661.2612650000 Fri 06 Sep 2013 11:17:41 AM EDT           dir1/Baseline/2013_09_06_11_16_10     1378489478.3223970000 Fri 06 Sep 2013 01:44:38 PM EDT           dir2/Baseline/2013_09_06_13_42_48     1378674166.7427782000 Sun 08 Sep 2013 05:02:46 PM EDT           dir3/6 Month/2013_09_08_17_02_05     1379096910.4431689000 Fri 13 Sep 2013 02:28:30 PM EDT           dir4/Baseline/2013_09_13_14_25_09      Showing me a cleaner method!


title: Directory mounted under regular user is inaccessible from said user

text: I have Red Hat Enterprise Linux 6.5 and I just mounted an SSHFS directory. When I try to browse the mount as my regular user I can't browse it, but as root I can. Believing it was a problem with the UID under which the directory is mounted I listed the mount directory's permissions... and this is what I get.               [root@oc2222167007 sshfs]# ll     drwxr-xr-x. 1 nekomikoreimu daemon 4096 Jan 14 10:52 cogfvt1     [root@oc2222167007 sshfs]# exit     [nekomikoreimu@oc2222167007 sshfs]$ ll     ls: cannot access cogfvt1: Permission denied     d?????????? ? ?    ?       ?            ? cogfvt1      Why can't I read the directory as user `nekomikoreimu` when listing it as root clearly says this user is the owner?


title: Shell script to become root

text: How can we write a shell script to become root? That is I donot want to input the password at prompt it should be within the script itself. I was trying to make but failed to do so.Is it possible, if Yes please Explain.


title: Need to set a variable with "[]"

text: I have a tcsh script, in which I need to set a variable to this value defining my system type.               type=abc project=def sysname=["Linux"]      I tried various combinations to escape the `[` and `"` but have not been successful . I either get **Unmatched "** or, I am not able to echo the variable. I tried the below code.               set systype = "type=abc project=def sysname=\[\"Linux\"\]"


title: Can KWallet manage my ssh passwords?

text: I need a way to store some SSH passwords. Note that these are **login passwords** which I need to pass to ssh; key authentication is unfortunately not an option. I'd like to be able to have KWallet fill them in for me somehow, because I think Gnome-keyring can do this. Does anyone know if KDE has this functionality in KWallet? And if so, how I can set it up to make use of it?


title: apache virtualhost using mono-apache-server2 not mono-apache-server4

text: I know I'm running mono-apache-server4 but when I launch the site mono-apache- server2 is responding. **Why is my site not using 4.0?** # See htop: ![enter image description here](http://i.stack.imgur.com/dKcL8.png) # This is what I did: Installed Debian Wheezy along with apache and mod-mono:               apt-get install mono-apache-server2 mono-apache-server4 libapache2-mod-mono libmono-i18n2.0-cil      Then I edited the default virtual host file: `sudo nano /etc/apache2/sites- available/default`               <VirtualHost *:80>       ServerName mydomain.org       ServerAdmin myname@mydomain.com       ServerAlias www.mydomain.org       DocumentRoot /var/www/mydomain.org/       ErrorLog /var/www/logs/mydomain.org.error.log       CustomLog /var/www/logs/mydomain.org.access.log combined            MonoServerPath example.com "/usr/bin/mod-mono-server4"            MonoDebug mydomain.org true       MonoSetEnv mydomain.org MONO_IOMAP=all       MonoApplications mydomain.org "/:/var/www/mydomain.org/"       <Location "/">         Allow from all         Order allow,deny         MonoSetServerAlias mydomain.org         SetHandler mono         SetOutputFilter DEFLATE         SetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png)$" no-gzip dont-vary       </Location>       <IfModule mod_deflate.c>         AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript       </IfModule>     </VirtualHost>      And restarted apache2: ![enter image description here](http://i.stack.imgur.com/ICstk.png) # Update: I reinstalled using:               apt-get install mono-apache-server4 libapache2-mod-mono libmono-i18n4.0-all      But Jim's answer was the culprit.


title: refresh bash tab completion

text: I have a script for auto-completing my ssh-hosts. If I change my `~/.ssh/config` the auto-completion is not updated automatically, though. This does not surprise me. In a new shell, the new entry is picked up and usable, of course. How do I manually trigger a refresh of the completion in bash?


title: How to delete btrfs subvolumes with <FS_TREE> in their name

text: I have a bunch of btrfs snapshots like so:               20:17:37 [root@galaxy /]$ btrfs subvolume list -a / |grep apt     ID 271 gen 348 top level 5 path <FS_TREE>/@apt-snapshot-2013-04-17_21:44:30     ID 272 gen 352 top level 5 path <FS_TREE>/@apt-snapshot-2013-04-17_21:46:25     ID 273 gen 361 top level 5 path <FS_TREE>/@apt-snapshot-2013-04-17_21:51:13     ... # lots more      I would like to get rid of them. So I tried               20:21:31 [root@galaxy ~]$ btrfs subvolume delete '/<FS_TREE>/@apt-snapshot-2013-04-17_21:44:30'     ERROR: error accessing '/<FS_TREE>/@apt-snapshot-2013-04-17_21:44:30'     20:21:36 [root@galaxy ~]$ btrfs subvolume delete '<FS_TREE>/@apt-snapshot-2013-04-17_21:44:30'     ERROR: error accessing '<FS_TREE>/@apt-snapshot-2013-04-17_21:44:30'     20:21:43 [root@galaxy ~]$ btrfs subvolume delete '/@apt-snapshot-2013-04-17_21:44:30'     ERROR: error accessing '/@apt-snapshot-2013-04-17_21:44:30'     20:21:47 [root@galaxy ~]$ btrfs subvolume delete '@apt-snapshot-2013-04-17_21:44:30'     ERROR: error accessing '@apt-snapshot-2013-04-17_21:44:30'      What's the correct syntax to delete these snapshots?


title: No virtual memory (-v) item in output of ulimit -a

text: When I run command `ulimit -a`, I see no virtual memory item in the list of output of the command. It is unlimited for some user IDs though. Does that mean I am assigned no virtual memory?


title: Can I use seq to go from 001 to 999?

text: Can I use seq to go from 001 to 999?