title: recovering /home folder from faulty drive

text: I was going to try ddrescue to recover data from a faulty (beeping) laptop drive and a primary ext4 partition. Reducing the number of reads from the disk should reduce the recovery time and increase the chances of successful recovery, so I would like to only recover /home, and exclude all the non-critical subfolders, like /tmp or /home/guest/Downloads. I can`t find any option to only recover subfolders in the ddrescue manual, though. Maybe there are other better suited tools for selective data recovery which could maybe display the file system structure, and let me check/uncheck what to recover before starting? I had used a similar tool in the MSDOS era, so I`m not sure about the best tool for ext4 nowadays. Open source tools for Linux would be preferred, if possible.


title: how to write a startup dependency on Internet availability?

text: Some of the services on my Raspberry Pi (~ Debian) depend on the availability of Internet (especially `ntpd`, for cryptic reasons). Specifically, the availability of a network device or a link being up is not enough. When looking at `/etc/init.d/ntp` I see               ### BEGIN INIT INFO     # Provides:        ntp     # Required-Start:  $network $remote_fs $syslog     # Required-Stop:   $network $remote_fs $syslog     # Default-Start:   2 3 4 5     # Default-Stop:     # Short-Description: Start NTP daemon     ### END INIT INFO      which I believe means that `ntp` depends on `$network` to be able to start. I found a reference in `/etc/insserv.conf` but it does not say much about what is actually required to set it up:               #     # Low level networking (ethernet card)     #     $network        +networking +ifupdown      **Q1:** How exactly is `$network` defined via the `+networking +ifupdown` elements? (so that I can modify it and try to reach an actual host before declaring the network as 'up') **Q2:** If the network prerequisite is not met will the `ntp` start be delayed or will it fail?


title: How do I find seconds since midnight?

text: Using the `date` program, how can I calculate the number of seconds since midnight?


title: Disabling lid-closure sleep while on battery in Debian Squeeze

text: How do you disable lid-closure sleep at the GDM screen (not logged in) on Squeeze?


title: How to monitor incoming http requests

text: How can I monitor incoming `HTTP` requests to port `80`? I have set up web hosting on my local machine using `DynDNS` and `Nginx`. **I wanted to know how many request are made on my server every day.** Currently I'm using this command:               netstat -an | grep 80


title: Repeat the nth last command in vim

text: I've noticed vim can be pretty intuitive, but I'm having trouble finding a way to repeat the second-to-last command (or third-to-last, fourth-to-last, etc.). By typing `.` in normal mode it will repeat the last command. Pressing `3.` will repeat the last command three times. Let's say I type `oHello<Esc>` then `A, World!<Esc>`. I now get               Hello, World!      on the screen. Now, say I want to get               Hello, World!     Hello     Hello     Hello      without typing Hello. Does vim store the history beyond one command, so I could type something like `3,2.` (i.e. repeat the second-to-last command three times)?


title: How to use the pipe command to open a directory after find?

text: Is there a way to opend found directories (via `find`) all in one command? One of the things I tried to study several times and never been able to really get, is the effective use of pipe: is it maybe useful for this? I tried things like:               find . -type d -name ".dir-name" | open      but it doesn't work. `open` is the OSX command to open a file in the associated application (Finder for directories).


title: Move huge number of files into date structured directory order

text: I have about 1 million files in this directory: `/home/username/images/` Each of the files are called something like: `012345678910(Place)_0_20120414185957_28841.jpg` with the timestamp part of the filename changing on each picture. The code below contains code to sort/move the files into this date structure: `/home/username/sorted/2012/04/14/18/name_of_file.jpg` For a small sample of files it works fine, but for the huge directory my putty terminal gets disconnected after outputting               Directory $newdir does not exist.  Creating same.      I had other code which always died with the error code `argument list too long`. Here is the code:               #!/bin/bash     ALLFILES=(images/*)     for ((i=0; i<${#ALLFILES[*]}; i+=30000));     do         set $(echo "${ALLFILES[@]:i:30000}" | awk -F_ '{print $1, $2, $3, $4, $5}')         fullyear=$3         year=$(echo $fullyear |cut -c1-4)         month=$(echo $fullyear |cut -c5-6)         day=$(echo $fullyear |cut -c7-8)         hour=$(echo $fullyear |cut -c9-10)         newdir=$(echo /home/username/sorted/$year/$month/$day/$hour/)         if ! [ -d $newdir ]; then             echo Directory $newdir does not exist.  Creating same.             mkdir -p $newdir;         fi         mv "${ALLFILES[@]:i:30000}" $newdir;     done      Any ideas why the connection will not hold while performing the large loop?


title: Saxon rpm build fails due to "ant: command not found"

text: Hopefully this is a question I can ask this community. I'm currently working on building zookeeper-3.4.5-13 for a CentOS 5 environment. During this process I've been going down a long list of required packages ( mockito -> objenesis -> maven -> maven2 -> classworlds -> dom4j -> jtidy-> ant -> jakarata-common- net -> saxon ) and I'm running into an issue building saxon-6.5.5-3.3. When I build, I get to the %build section of the process and end up erring out with the following:               DEBUG: + exit 0     DEBUG: Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.mUxwgM     DEBUG: + umask 022     DEBUG: + cd /builddir/build/BUILD     DEBUG: + cd saxon-6.5.5     DEBUG: + LANG=C     DEBUG: + export LANG     DEBUG: + unset DISPLAY     DEBUG: + export CLASSPATH=     DEBUG: + CLASSPATH=     DEBUG: + ant -Dj2se.javadoc=/usr/share/javadoc/java -Djdom.javadoc=/usr/share/javadoc/jdom     DEBUG: /var/tmp/rpm-tmp.mUxwgM: line 32: ant: command not found     DEBUG: error: Bad exit status from /var/tmp/rpm-tmp.mUxwgM (%build)     DEBUG: RPM build errors:     DEBUG:     Bad exit status from /var/tmp/rpm-tmp.mUxwgM (%build)     DEBUG: Child returncode was: 1      The first to check is that ant was installed, and sure enough, it was:               DEBUG: ================================================================================     DEBUG:  Package                      Arch     Version                     Repository     DEBUG:                                                                            Size     DEBUG: ================================================================================     DEBUG: Installing:     DEBUG:  ant                          i386     1.6.5-2jpp.2                core   2.0 M     DEBUG:  java-1.6.0-openjdk-javadoc   i386     1:1.6.0.0-1.21.b17.el5      core    20 M     DEBUG:  jdom                         i386     1.0-4jpp.1                  core   328 k     DEBUG:  jdom-javadoc                 i386     1.0-4jpp.1                  core   305 k     DEBUG:  jpackage-utils               noarch   1.7.5-3.8.iot5              core    63 k     DEBUG:  xml-commons-apis      Any other information I can provide as needed, but if anyone could tell me why ant isn't found it would be appreciated. For more insight, this is being done with mock and going into the mock shell does show that any is missing from any locations that would be considered normal to run from.


title: Installing PCRE 32bit on RHEL 5 - resolving dependency for apache 2.4 install

text: I need to install Apache 2.4 32bit version on RHEL 5. I am not installing 64bit apache because the application running on the RHEL5 machine needs apache 32bit (or that's what I thinks because of the past behavior). I receive "could not read symbols" while `make` which is probably due to pcre libs are of ELF 64bit when the installation expects it to be of ELF 32bit               **/usr/local/lib/libpcre.so: could not read symbols: File in wrong format**     collect2: ld returned 1 exit status     make[1]: *** [httpd] Error 1     make[1]: Leaving directory `/opt/myapp/httpd-2.4.7'     make: *** [all-recursive] Error 1      The configure for Apache 2.4 is run as:               CFLAGS="-m32"; export CFLAGS     LDFLAGS="-m32"; export LDFLAGS     "./configure" \     "--prefix=/opt/myapp/apache2.4" \     "--with-mpm=worker" \     "--enable-static-support" \     "--enable-ssl=static" \     "--enable-modules=most" \     "--disable-authndbd" \     "--disable-authn-dbm" \     "--disable-dbd" \     "--enable-static-logresolve" \     "--enable-static-rotatelogs" \     "--enable-proxy=static" \     "--enable-proxyconnect=static" \     "--enable-proxy-ftp=static" \     "--enable-proxy-http=static" \     "--enable-rewrite=static" \     "--enable-so=static" \     "--with-ssl=/opt/myapp/apache2.4/openssl" \     "--host=x86_32-unknown-linux-gnu" \     "host_alias=x86_32-unknown-linux-gnu" \     "CFLAGS=-m32" \     "LDFLAGS=-m32" \     "--with-included-apr" \     "--with-pcre=/usr/local" \     "$@"      I have installed PCRE without any error using:               ./configure --prefix=/usr/local --enable-pcre32      When I do pcretest it get this (Compiled with 8-bit support?):               $ /usr/local/bin/pcretest -C     PCRE version 8.33 2013-05-28     Compiled with       8-bit support       No UTF-8 support       No Unicode properties support       No just-in-time compiler support       Newline sequence is LF       \R matches all Unicode newlines       Internal link size = 2       POSIX malloc threshold = 10       Default match limit = 10000000       Default recursion depth limit = 10000000       Match recursion uses stack      But when I check the libs created (which are supposed to support 32bit apps) I get ELF 64bit.               $ file libpcre32.so.0.0.1     libpcre32.so.0.0.1: **ELF 64-bit** LSB shared object, AMD x86-64, version 1 (SYSV), not stripped


title: Erlang install on Freebsd 10 on Amazon ec2

text: I installed Erlang on amazon ec2 - on FreeBSD 10 with               fetch http://www.erlang.org/download/otp_src_17.0.tar.gz     gunzip -c otp_src_17.0.tar.gz | tar xf -     cd otp_src_17.0     ./configure --disable-hipe     gmake     gmake install      and I get this error:               configure: error: Perl is required to generate v2 to v1 mib converter script     configure: error: /bin/sh '/usr/home/ec2-user/otp_src_17.0/lib/snmp/./configure' failed for snmp/.     configure: error: /bin/sh '/usr/home/ec2-user/otp_src_17.0/lib/configure' failed for lib      How can I install Erlang on FreeBSD 10?


title: ex4 to btrfs conversion: If I accidentally lose power to the system during the conversion, will I lose the data?

text: I want to convert the 3TB 80% full ext4 block device into btrfs and I want to estimate the risks involved in the process. If I accidentally lose power to the system during the conversion, will I lose the data? > In my two-year experience with btrfs, the filesystem proved only to be > moderately safe during the power loss accidents - it destroyed some of my > data, if the power was lost two or more times in the row.


title: What filesystem metadata operations are actually journaled in ext4 & xfs?

text: I can't find a simple, straight answer about which filesystem metadata operations are actually persisted to the ext4 & xfs filesystem journals. Note that I am **not** inquiring about what POSIX declares to be "atomic". I'm more concerned about what subset of atomic filesystem operations are _effectively_ durable by virtue of running with a journal enabled without having to bend over backwards and `fsync(2)` all the time. Operations I'm fairly certain count:   * `creat(2)`   * `link(2)`   * `unlink(2)`   * `rename(2)`   * `mkdir(2)`   * `rmdir(2)` Operations I'm not entirely sure about:   * `symlink(2)` The `symlink(2)` case is the most troubling, since there does not seem to be any straightforward way to `fsync(2)` or `fdatasync(2)` the underlying datablocks that store the content of a symlink. Knowing that the journal takes care of this for me would be a relief.


title: Run series of command independent of each other

text: If I have a file with               cmd1          cmd2          cmd3 And I want to run them independent of each other, and independent whether it outputs an exit status or not (that means do not expect to end, just keep starting processes, which can fail or not. I know that `;` would run the next command, but that's not the case, because it waits until the previous command either fails or succeeds. I want to start all the commands at once. It is like something like `sleep 60m`; and then play music, sound a bell, run the browser, but obviously, there is not way to wait until the music plays to sound a bell, then after that run the browser. It has to happen at once. ADDED: how to, for example, read lines from file, open a terminal for each line and run it?


title: How to install, missing Intel Graphic Drivers

text: I have intel graphics card on my system (Scientific Linux 6.0), but the graphics is so poor as no drivers are installed.   So I have installed : > xorg-x11-drv-intel-2.21.2-1.el6.elrepo.x86_64   >  xorg-x11-drv-intel-devel-2.21.2-1.el6.elrepo.x86_64 And Updated for dependencies: > xorg-x11-drv-synaptics-1.6.2-13.el6.x86_64   >  xorg-x11-server-common-1.13.0-23.sl6.x86_64   >  xorg-x11-server-Xorg-1.13.0-23.sl6.x86_64   >  pixman-0.26.2-5.1.el6_5.x86_64   >  mtdev-1.1.2-5.el6.x86_64 But now my system graphics is not starting. It is perfectly working in `init 3`.   I have also changed the kernel parameters while booting: Added `nomodeset` and `i915.modeset=0`, but the problem remains same. **Update 1:** As per suggestion of @slm, the output of `lshw` is as below:               [root@localhost ~]# lshw -c video       *-display UNCLAIMED                 description: VGA compatible controller            product: Sandy Bridge Integrated Graphics Controller            vendor: Intel Corporation            physical id: 2            bus info: pci@0000:00:02.0            version: 09            width: 64 bits            clock: 33MHz            capabilities: msi pm vga_controller bus_master cap_list            configuration: latency=0            resources: memory:fe000000-fe3fffff memory:d0000000-dfffffff(prefetchable) ioport:f000(size=64)     [root@localhost ~]#          The configuration part only contains `configuration: latency=0`, that means the driver part is missing, what I need to do?


title: Specifying full range of printable ASCII characters in a glob pattern

text: I want to use a globbing pattern to match only printable (including space) ASCII characters `0x20` through to `0x7e`. This is being used inside a `super` `super.tab` database. I've arrived at the pattern: `[[ -~]]` This appears to work and does indeed restrict non-printing characters from being passed as arguments. Have I over looked anything, or is this the correct way to specify this range of characters? **Edit:** Based on _mikeserv_ 's suggestion to use `[[:print:]]`, I tried and it doesn't seem to work. Here's what the entry in my `super.tab` looks like:               dosuperthing  /system/dosuperthing.pl $Users  uid=0 arg1="[[:print:]]"      If I try `[[:print:]]`, `[:print:]` or `:print:` as globbing patterns for `arg1` it results in (respectively) the following being logged by `super` where I pass `abcdef` as my first argument: > `super: (admin) Your argument #1 <abcdef> must match pattern <[[:print:]]>` > > `super: (admin) Your argument #1 <abcdef> must match pattern <[:print:]>` > > `super: (admin) Your argument #1 <abcdef> must match pattern <:print:>` This is old legacy production code and I'm not able to tinker with it beyond tuning the acceptable `arg1-99` patterns inside `super.tab`.


title: linux + how to ignore (filter) file with space

text: Sometimes a file name is created from a couple of names and space between each name as the following:                  $ touch  "A B C"        $ ls        A B C      <-- one file but has three words !                                file1        file2        file3      How can I ignore (filter) the file that actually created from couple of names as "A B C"? Expected output                    $ ls <filter>          file1          file2          file3


title: Why isn't Linux embraced as the official GNU kernel?

text: While I knew for quite some time the existence of Hurd, and its mission as the official GNU Operating System kernel, **I was wondering how come Linux is not embraced as the official GNU kernel over the years, seeing as it is in a much better state than the Hurd?** Linux has been, more or less, serving this role 20+ years so far, however one can see that the GNU Project is keeping its distance when it comes to Linux. Why is this happening? Is it because of a dream that Hurd will (at some point in the future) be in a production quality level? Is it because the GNU project doesn't see its mission reflected as much as it wants in Linux? Is it for other political reasons?


title: How to get better desktop performance in linux?

text: Normally I do not care much about desktop - performance, since my servers do not run any gui. But at home I run some older hardware (Pentium) which gets sometimes very sluggish (mouse-movements in KDE). I observe that this is the case where there is some disk-io background activity going on. How can I set that disk-priority lower, so that my gui gets more attention? I already tried to set the disk-scheduler for my sata-drive from cfq to as - but that did not help. I remember that I had - long time ago - a similar problem on OpenSuSE - there I set a different general scheduler tick-rate (shorter as default, as far as I remember). But I do not remember what that was exactly, neither how to set that on my current Linux (CentOS 5, 32-Bit). Any hints are welcome.


title: I reset my password and now I can login, but without nautilus or program menu

text: I recently powered on some old notebook with Linux Mint 11 (Katya) installed, and I thought I remembered my user password, but turns out I didn't. So I reset that password using the instructions here. After doing that, I could login successfully with my new password, but right after that I got a series of error messages and was left with the plain Mint desktop: no program menu, no nautilus, no context menu; all I could do was restart or shutdown. Here are the errors, in order of appearance: > Could not update ICEAuthority file /home/my_user/.ICEauthority > > There is a problem with the configuration server. > (/usr/lib/libgconf2-4/gconf-sanity-check-2 exited with code 256) > > The panel encountered a problem while loading "OAFIID:GNOME_mintMenu". Do > you want to delete the applet from your configuration? Of course, I always answered "Don't delete". > Nautilus could not create the following required folders: > /home/my_user/Desktop, /home/my_user/.nautilus. Before running Nautilus, > please create these folders or set permissiones such that Nautilus can > create them. When I restarted, I selected recovery mode from the GRUB menu and managed to login into a terminal and navigate to my home folder. When I ran `ls` there, all my files were gone, and in their place were a `.desktop` file and a README. It seems Mint realized I changed my password and took it as an attempt to hack into the system, so it encrypted the files in my home folder... Kudos to Linux security schemes, but... what can I do now? Don't wanna reinstall, I need those old files. **UPDATE** : I tried running `ecryptfs-mount-private` like the README suggests, but it asked me for a passphrase, and the new one doesn't work. Figures, it needs the old one.


title: How to install DivFix++ under Scientific-linux 6.1?

text: I installed DivFix++ from http://sourceforge.net/projects/divfixpp/files/DivFix%2B%2B/v0.34/ DivFix++-0.34-2.1.x86_64.rpm               $ env LC_MESSAGES=C DivFix++     Fatal Error: Mismatch between the program and library build versions detected.     The library used 2.8 (no debug,Unicode,compiler with C++ ABI 1002,wx containers,compatible with 2.4,compatible with 2.6),     and your program used 2.8 (no debug,Unicode,compiler with C++ ABI 1002,wx containers,compatible with 2.6).     Abgebrochen     $ uname -a     Linux a 2.6.32-220.13.1.el6.x86_64 #1 SMP Tue Apr 17 15:16:22 CDT 2012 x86_64 x86_64 x86_64 GNU/Linux     $ rpm -qa | grep -i divfix     DivFix++-0.34-2.1.x86_64     $       **Question** : how can I get DivFix++ to work under Scientific-Linux 6.1? UPDATE#1 (I tried to install from source)               [USERNAME@MACHINE ~/Desktop/D/DivFix++_v0.34] ls     contrib  debian  DivFix++.cbp  DivFix++.fbp  docs  locale  makefile  resources  src  wx_pch.h     [USERNAME@MACHINE ~/Desktop/D/DivFix++_v0.34] make     `wx-config --cxx` `wx-config --cxxflags` -c src/DivFix++App.cpp -o src/DivFix++App.o     `wx-config --cxx` `wx-config --cxxflags` -c src/DivFix++.cpp -o src/DivFix++.o     `wx-config --cxx` `wx-config --cxxflags` -c src/DivFix++Core.cpp -o src/DivFix++Core.o     `wx-config --cxx` `wx-config --cxxflags` -c src/DivFix++Gui.cpp -o src/DivFix++Gui.o     `wx-config --cxx` src/DivFix++App.o src/DivFix++.o src/DivFix++Core.o src/DivFix++Gui.o `wx-config --libs` -o DivFix++     [USERNAME@MACHINE ~/Desktop/D/DivFix++_v0.34] DivFix++     Fatal Error: Mismatch between the program and library build versions detected.     The library used 2.8 (no debug,Unicode,compiler with C++ ABI 1002,wx containers,compatible with 2.4,compatible with 2.6),     and your program used 2.8 (no debug,Unicode,compiler with C++ ABI 1002,wx containers,compatible with 2.6).     Abgebrochen     [USERNAME@MACHINE ~/Desktop/D/DivFix++_v0.34]       Searching for wxwidgets:               [USERNAME@MACHINE ~]# rpm -qa | grep -i wx     wxGTK-2.8.12-1.el6.rf.x86_64     wxGTK-devel-2.8.12-1.el6.rf.x86_64     [USERNAME@MACHINE ~]#


title: How to track/fix a memory-related issue in a large C/C++ code on *nix systems

text: What strategy you use while tracking a memory-related issue? What tools do you use (open source as well as proprietary) to identify memory leaks, memory corruption etc? How would you track memory leaks if only gdb/dbx available on a system? For me, fixing memory leaks with only a debugger is very hard.


title: What's the "OBEY" Tux logo all about?

text: There's a variant on the Tux logo I keep seeing; recognizably Tux's head sat above a red "OBEY" text. Examples. It's striking, but what the heck does it actually _mean_ ? I've seen it mentioned as being based on the "Obama 'hope' poster" (given even more credence by some of the results in the above link); and to me it seems vaguely reminiscent of RedHat's old "Shadowman" logo. I'd be interested to know where this iconography first appeared and what it's about. (I mean, why "OBEY" rather than something more obviously aligned with FOSS-ey values; is it supposed to be ironic, or a reference to rabid zealotry ? I'm in the UK so I'm guessing there's some crucial cultural context I'm missing).


title: Arch Linux with Xfce-Desktop no longer starts

text: I run Arch Linux with XFCE. Recently, I decided to switch to PCmanfm as my file manager. I removed Thunar with: `pacman -Rc thunar` and rebooted. Now when I try to log in, my XFCE4 desktop flashes for a second, then returns to my login manager (Slim). Reinstalling thunar does not help. How can I get my desktop working again? It's okay if it's with thunar for now, I just need a working setup, PCmanfm will come later.


title: Error when installing Google Chrome on CentOS

text: I downloaded the 32 bit .rpm (For Fedora/openSUSE) to my CentOS machine. when installing it, I got the following error.               $ rpm -ivh google-chrome-stable_current_i386.rpm     warning: google-chrome-stable_current_i386.rpm: Header V4 DSA signature: NOKEY, key ID 7fac5991     error: Failed dependencies:             lsb >= 3.2 is needed by google-chrome-stable-12.0.742.124-92024.i386             libcurl.so.4 is needed by google-chrome-stable-12.0.742.124-92024.i386             xdg-utils is needed by google-chrome-stable-12.0.742.124-92024.i386      This much is clear (I guess), that I need the package `lsb` version greater than or equal to 3.2, `libcurl.so.4` and `xdg-utils`. But where will I get these from. I think installing the three above packages should resolve the installation error. _Addendum: Progress was made by installing the packages`lsb` and `xdg-utils` using the command `yum install <pkg_name>`. But I still have the `libcurl.so.4` library file as a missing dependancy. Any ideas as to how this can be resolved._


title: How to split a new window and run a command in this new window using tmux?

text: I have tried               tmux -c "shell command" split-window      but it does not seem to work. Using `tmux split-window`, one can split a new window. **UPDATE** : Using `tmux split-window 'exec ping g.cn'` can run the ping command , but when stoped the new window will be closed.


title: How to disable the beep sound system-wide

text: If I want to disable beep sounds from stuff like **`bash`** , I add this line to " **/etc/inputrc** ":               set bell-style none      Sadly, this doesn't work for some other events like GDM start-up and shut down. I thought that adding this line to " **/etc/modprobe.d/blacklist.conf** " would help:               blacklist pcspkr      That makes me wonder and doubt where the sound actually comes from.


title: Why is piped input okay to zenity, but <file malfunctions?

text: My question is as simple as what the `zenity --text` args say in the example... but what is causing this 100% CPU grab by the redirection?   ...(and by the way, is this particular usage of `<` actually called `redirection`. It seems like it is creating a direction, rather than _re_ -directing )..               echo "Peacocks talking of the colour grey."> test     cat test | zenity --text='This does NOT hog the CPU'   --list --column='#' --width=450      <test      zenity --text='This hogs 100% of CPU usage' --list --column='#' --width=450            I'm quite happy to use `cat test |` (because it isn't useless in this case; it works and < and `|` are somehow different, but I haven't been able to track it down again... To be clear: `<test` and `cat test |` both work. The zenity dialog appears and is fully functional in both cases, but for as long as the `<test` version of the dialog is kept open, it uses 100% CPU (of one core)... 94% on the single "core" VMs...


title: Best way to follow a log and execute a command when some text appears in the log

text: I have a server log that outputs a specific line of text into its log file when the server is up. I want to execute a command once the server is up, and hence do something like the following:               tail -f /path/to/serverLog | grep "server is up" ...(now, e.g., wget on server)?      What is the best way to do this?


title: Arch Linux on Virtualbox Internet Connection Issue on VirtualBox

text: I have successfully installed Arch Linux on VirtualBox but the internet is not working in it. There was no issue with the internet connection during the installation but when I boot from the virtual hard drive (using syslinux bootloader) I'm unable to connect to the internet. When I boot from the installation CD and mount the root partition and then use installed system from `# arch-chroot` internet works well without doing anything at all and `# ip link` shows two interfaces `lo` and `eth0` When I try to use `# systemctl enable dhcpcd@enp3s0.service` command, it gives an error 'Operation failed: No such file or directory however `# ip link` says there are two interfaces `lo` and `enp3s0`. I want to know why there are two different names for the same ethernet port? and more important how do I solve this problem?


title: Idiomatic location for file based sockets on Debian systems

text: I am writing a daemon process for a Debian system in `C` that uses a Unix Domain Socket. _If the deamon process's working directory is the root directory, is there an idiomatic directory to place the socket on the file system?_


title: How to prevent Windows partition to access(read) Linux partition files?

text: How to prevent Windows partition to access(read) Linux partition files within one physical hard disc? Right now a couple of programs can do that. E.g. Linux Reader I want to prevent that? What are my possibilities? I am currently running Windows 7 and would like to install as a dual boot Linux Mint 15.


title: Regex and piped commands with sed

text: I'm finding really hard to use `sed` command, plus I can't seem to find well written tutorials. Let me say that I worked with regular expression in other languages (Python, JavaScript, Java), so that _shouldn't_ be the problem. So, here are my questions (a "theoretical" one and a more practical one):   1. are regular expressions used in `sed` exactly the same as the ones used by Python/JS/Java? I read about BREs and EREs, but how much are they different? Shouldn't ERE be an _extension_ of BRE?   2. if I want to, say, just extract something from a piped output, what's the `sed` syntax to do that? Details about the second question: say I have the output of `uptime` piped with sed:               uptime | sed ...      Given an example output from `uptime`: `18:13 up 5:12, 2 users, load averages: 0,45 0,37 0,40`, I want to parse the single uptime in the form of two separated numbers (hours and minutes), and then I want to display them in the form of `xxhyym` (`xx` are the hours, `yy` the minutes). And to finish, here's what I'd do in Python:               hh, mm = re.match(r'\s+ up \s+(\d{1,2}):(\d{1,2})').groups()     print '%sh%sm' % (hh, mm)


title: When and why is /etc/init/failsafe.conf invoked on Ubuntu Server 12.04?

text: Could someone please tell me when during the boot process and why /etc/init/failsafe.conf is invoked? If possible, please point me towards a resource (keyword or link) where I could read more about the bootup process.


title: Can't drag and drop in Qt Creator

text: I recently installed the system upgrades for my Ubuntu distro (12.10). Since the upgrades, I can't drag and drop items in Qt Creator. I found a solution that requires editing of `xorg.conf`. My system has no `/etc/X11/xorg.conf` file. I tried on a previous install to copy-paste a sample `xorg.conf` and add the required edits, but this prevented me from even booting into a terminal. I now have a fresh install. How would I go about performing these edits without breaking my system? Alternatively, is there any other way to get the Qt Creator functionality back? **edit** I'm currently using Gnome Shell so the answer presented here does not help.


title: Can I name my own LFS distro?

text: The question is... about LFS (Linux From Scratch), if I would build a Linux system, with LFS, is it 100% mine? Could I say I made all this from scratch?


title: Sort lines based on a variable-width number at a fixed position

text: I'm trying to sort a file using the Sort command but its not working: The file contains lines like:               photo1     photo11     photo12     photo13     photo17     photo18     photo19     photo2     photo22     photo23     photo25     photo26     photo27      I'm using the command, `sort -k6 Photos` so that it start sorting after the string "photo", can someone tell where I'm going wrong??


title: Can I avoid screen from creating inner screens?

text: I just started using screen and "screen inception" makes learning screen even more confusing. Can I avoid screen from creating screens when I'm already inside a screen? ![enter image description here](http://i.stack.imgur.com/hvfXo.png) I'm using fish as my shell if that matters.


title: How to access ubuntu wubi installation

text: I installed ubuntu/wubi nearly a year ago on my windows 8 pc. It has been sitting on a separate partition untouched since then. I am trying to access it again as I'd like to use Ubuntu now. I cannot figure out how to boot to Ubuntu. When I go to "msconfig" -> "boot". I only see an option for Windows. The Ubuntu file hierarchy looks like this:               D:\ -> ubuntu -> disks, install, winboot      The disk file root.disk is about 18gb. Any help is greatly appreciated.


title: How to decrypt LUKS with the known master key?

text: From: https://code.google.com/p/cryptsetup/wiki/FrequentlyAskedQuestions               CLONING/IMAGING: If you clone or image a LUKS container, you make a copy      of the LUKS header and the master key will stay the same! That means that if      you distribute an image to several machines, the same master key will be used      on all of them, regardless of whether you change the passphrases. Do NOT do this!      If you do, a root-user on any of the machines with a mapped (decrypted) container      or a passphrase on that machine can decrypt all other copies, breaking security.      See also Item 6.15.       So: I have a notebook "A" (a Linux Desktop installed with LUKS & and I have root access to it) and I clone the whole disk of it to notebook "B", and the notebook "B" had it's LUKS password changed. **My question** : How can I mount/decrypt notebook "B" LUKS partition with **ONLY** the known master key from "A"?* (and I know the cipher type too) *UPDATE: What are the exact commands to mount the B's HDD on A?


title: Is service stop synchronous or asynchronous?

text: I did `sudo service ... stop` before shutting down the machine remotely, over SSH, but then I realized I didn't know if `stop` is synchronous or not and I wondered if I was not too fast to shut down the Ubuntu machine. So are my fears based on a wrong hunch or not ? Edit: My service is a personal one, it receives listens to stuff from a port and writes things now and then to a database. I fear that things don't have the time to be flushed if the service is stopped abruptly. `stop` takes care of flushing things but given the time it could take...


title: Is it possible to install RHEV on el6 clustered computer

text: Is it possible to use Linux (el6) clustered computer can be used as a hypervisor for RHEV 3.3/Ovirt 3.3?   * Cause, we can not combine RAM/CPU from two or more hypervisores to be considered as a one source of resource while creating a huge guest on RHEV. I know it support Baloonig and 150% for server and 200% for Desktop RAM aloocation but if I want to allocate RAM even more than that just to a one guest then? Any input for such situation!


title: regex suggestion

text: echo "223255/12345678                    " | grep '[0-9a-zA-Z/\-\?:\(\)\.,"\+]{1,34}'      According to the regex, it can have any of `0-9 a-z A-Z / - ? : ( ) . , " +` of upto 34 chars in any order. Am I right? In that case, why is it not printing the echoed value?


title: No panels in Ubuntu? libcanberra-tk cannot open shared object file

text: I booted up Ubuntu and have a background but no panels. Everything else seems to work fine, I can get into terminal and run Firefox for instance. I can create folders on my desktop, etc. I'm new to Linux so was kind of just guessing to figure out what to do, I tried launching gnome-panel:               $ sudo gnome-panel     gnome-panel: error while loading shared libraries: libcanberra-gtk.so.0: cannot open shared object file: Input/output error      Reinstalling gnome-panel doesn't help. I noticed I get the same error on anything I do:               $ gksudo firefox         Gtk-Message: Failed to load module "canberra-gtk-module": libcanberra-gtk.so.0: cannot open shared object file: Input/output error      Yet Firefox loads. Any ideas? I'm assuming "panel" is the correct word, what I'm talking about is the bar at the top where you can launch applications from.


title: How can I get a HASH of the LUKS master key?

text: From: https://code.google.com/p/cryptsetup/wiki/FrequentlyAskedQuestions > 6.15 Can I clone a LUKS container? > > You can, but it breaks security, because the cloned container has the same > header and hence the same master key. You cannot change the master key on a > LUKS container, even if you change the passphrase(s), the master key stays > the same. That means whoever has access to one of the clones can decrypt > them all, completely bypassing the passphrases. > > The right way to do this is to first luksFormat the target container, then > to clone the contents of the source container, with both containers mapped, > i.e. decrypted. You can clone the decrypted contents of a LUKS container in > binary mode, although you may run into secondary issues with GUIDs in > filesystems, partition tables, RAID-components and the like. These are just > the normal problems binary cloning causes. > > Note that if you need to ship (e.g.) cloned LUKS containers with a default > passphrase, that is fine as long as each container was individually created > (and hence has its own master key). In this case, changing the default > passphrase will make it secure again. I have two notebooks with root access installed with LUKS. I don't know if originally they where CLONED or not. **My question** : How can I create a HASH (ex.: sha512) from the LUKS master keys, so that I can compare the two, that if they are the same or not?


title: How do I bind to Shift+{Left,Right} in tmux?

text: I'm looking at `tmux` from `screen`, and have hit a bump while configuring the (highly configurable!) `tmux` key bindings. Problem is, in my `.screenrc` I have               bindkey ^[[d prev     bindkey ^[[c next     bindkey ^[[a title     bindkey ^[[b screen 1      and the bindings work (they originally came from `rxvt-tabbedex`). But in `tmux` there's apparently no way to bind commands to `Shift``Left`/`Right` combinations. Please prove me wrong.


How can nfs service in the kernel be disabled? As far as I can see there are no userland utils               # find / -name nfs* -print     /sys/kernel/slab/nfs_page     /sys/kernel/slab/nfs_inode_cache     /sys/kernel/slab/nfs_read_data     /sys/kernel/slab/nfs_write_data     /sys/kernel/slab/nfs_direct_cache     /sys/module/nfs     /sys/module/nfs/parameters/nfs4_disable_idmapping     /var/lib/pacman/sync/core/nfsidmap-0.23-3     /var/lib/pacman/sync/core/nfs-utils-1.2.2-3     /usr/include/rpcsvc/nfs_prot.x     /usr/include/rpcsvc/nfs_prot.h     /usr/include/nfs     /usr/include/nfs/nfs.h     /usr/include/linux/nfsd     /usr/include/linux/nfsd/nfsfh.h     /usr/include/linux/nfs2.h     /usr/include/linux/nfs.h     /usr/include/linux/nfs4.h     /usr/include/linux/nfsacl.h     /usr/include/linux/nfs3.h     /usr/include/linux/nfs_mount.h     /usr/include/linux/nfs_fs.h     /usr/include/linux/nfs4_mount.h     /usr/include/linux/nfs_idmap.h     /usr/share/man/man2/nfsservctl.2.gz     /proc/sys/fs/nfs     /proc/sys/fs/nfs/nfs_callback_tcpport     /proc/sys/fs/nfs/nfs_mountpoint_timeout     /proc/sys/fs/nfs/nfs_congestion_kb     /proc/sys/sunrpc/nfs_debug     /proc/sys/sunrpc/nfsd_debug     /proc/fs/nfs     /proc/fs/nfsfs     /proc/fs/nfsd     /proc/1/net/rpc/nfsd.fh     /proc/1/net/rpc/nfsd.export     /proc/1/net/rpc/nfsd     /proc/1/net/rpc/nfs     /proc/2/net/rpc/nfsd.fh     /proc/2/net/rpc/nfsd.export     /proc/2/net/rpc/nfsd     /proc/2/net/rpc/nfs     /proc/3/net/rpc/nfsd.fh     /proc/3/net/rpc/nfsd.export     /proc/3/net/rpc/nfsd     /proc/3/net/rpc/nfs     /proc/4/net/rpc/nfsd.fh     /proc/4/net/rpc/nfsd.export     /proc/4/net/rpc/nfsd     /proc/4/net/rpc/nfs     /proc/5/net/rpc/nfsd.fh     /proc/5/net/rpc/nfsd.export     /proc/5/net/rpc/nfsd     /proc/5/net/rpc/nfs     /proc/6/net/rpc/nfsd.fh     /proc/6/net/rpc/nfsd.export     /proc/6/net/rpc/nfsd     /proc/6/net/rpc/nfs     /proc/7/net/rpc/nfsd.fh     /proc/7/net/rpc/nfsd.export     /proc/7/net/rpc/nfsd     /proc/7/net/rpc/nfs     /proc/8/net/rpc/nfsd.fh     /proc/8/net/rpc/nfsd.export     /proc/8/net/rpc/nfsd     /proc/8/net/rpc/nfs     /proc/9/net/rpc/nfsd.fh     /proc/9/net/rpc/nfsd.export     /proc/9/net/rpc/nfsd     /proc/9/net/rpc/nfs     /proc/10/net/rpc/nfsd.fh     /proc/10/net/rpc/nfsd.export     /proc/10/net/rpc/nfsd     /proc/10/net/rpc/nfs     /proc/11/net/rpc/nfsd.fh     /proc/11/net/rpc/nfsd.export     /proc/11/net/rpc/nfsd     /proc/11/net/rpc/nfs     /proc/12/net/rpc/nfsd.fh     /proc/12/net/rpc/nfsd.export     /proc/12/net/rpc/nfsd     /proc/12/net/rpc/nfs     /proc/13/net/rpc/nfsd.fh     /proc/13/net/rpc/nfsd.export     /proc/13/net/rpc/nfsd     /proc/13/net/rpc/nfs     /proc/14/net/rpc/nfsd.fh     /proc/14/net/rpc/nfsd.export     /proc/14/net/rpc/nfsd     /proc/14/net/rpc/nfs     /proc/15/net/rpc/nfsd.fh     /proc/15/net/rpc/nfsd.export     /proc/15/net/rpc/nfsd     /proc/15/net/rpc/nfs     /proc/16/net/rpc/nfsd.fh     /proc/16/net/rpc/nfsd.export     /proc/16/net/rpc/nfsd     /proc/16/net/rpc/nfs     /proc/17/net/rpc/nfsd.fh     /proc/17/net/rpc/nfsd.export     /proc/17/net/rpc/nfsd     /proc/17/net/rpc/nfs     /proc/20/net/rpc/nfsd.fh     /proc/20/net/rpc/nfsd.export     /proc/20/net/rpc/nfsd     /proc/20/net/rpc/nfs     /proc/23/net/rpc/nfsd.fh     /proc/23/net/rpc/nfsd.export     /proc/23/net/rpc/nfsd     /proc/23/net/rpc/nfs     /proc/24/net/rpc/nfsd.fh     /proc/24/net/rpc/nfsd.export     /proc/24/net/rpc/nfsd     /proc/24/net/rpc/nfs     /proc/220/net/rpc/nfsd.fh     /proc/220/net/rpc/nfsd.export     /proc/220/net/rpc/nfsd     /proc/220/net/rpc/nfs     /proc/222/net/rpc/nfsd.fh     /proc/222/net/rpc/nfsd.export     /proc/222/net/rpc/nfsd     /proc/222/net/rpc/nfs     /proc/224/net/rpc/nfsd.fh     /proc/224/net/rpc/nfsd.export     /proc/224/net/rpc/nfsd     /proc/224/net/rpc/nfs     /proc/234/net/rpc/nfsd.fh     /proc/234/net/rpc/nfsd.export     /proc/234/net/rpc/nfsd     /proc/234/net/rpc/nfs     /proc/238/net/rpc/nfsd.fh     /proc/238/net/rpc/nfsd.export     /proc/238/net/rpc/nfsd     /proc/238/net/rpc/nfs     /proc/248/net/rpc/nfsd.fh     /proc/248/net/rpc/nfsd.export     /proc/248/net/rpc/nfsd     /proc/248/net/rpc/nfs     /proc/257/net/rpc/nfsd.fh     /proc/257/net/rpc/nfsd.export     /proc/257/net/rpc/nfsd     /proc/257/net/rpc/nfs     /proc/258/net/rpc/nfsd.fh     /proc/258/net/rpc/nfsd.export     /proc/258/net/rpc/nfsd     /proc/258/net/rpc/nfs     /proc/343/net/rpc/nfsd.fh     /proc/343/net/rpc/nfsd.export     /proc/343/net/rpc/nfsd     /proc/343/net/rpc/nfs     /proc/344/net/rpc/nfsd.fh     /proc/344/net/rpc/nfsd.export     /proc/344/net/rpc/nfsd     /proc/344/net/rpc/nfs     /proc/387/net/rpc/nfsd.fh     /proc/387/net/rpc/nfsd.export     /proc/387/net/rpc/nfsd     /proc/387/net/rpc/nfs     /proc/456/net/rpc/nfsd.fh     /proc/456/net/rpc/nfsd.export     /proc/456/net/rpc/nfsd     /proc/456/net/rpc/nfs     /proc/485/net/rpc/nfsd.fh     /proc/485/net/rpc/nfsd.export     /proc/485/net/rpc/nfsd     /proc/485/net/rpc/nfs     /proc/487/net/rpc/nfsd.fh     /proc/487/net/rpc/nfsd.export     /proc/487/net/rpc/nfsd     /proc/487/net/rpc/nfs     /proc/499/net/rpc/nfsd.fh     /proc/499/net/rpc/nfsd.export     /proc/499/net/rpc/nfsd     /proc/499/net/rpc/nfs     /proc/500/net/rpc/nfsd.fh     /proc/500/net/rpc/nfsd.export     /proc/500/net/rpc/nfsd     /proc/500/net/rpc/nfs     /proc/501/net/rpc/nfsd.fh     /proc/501/net/rpc/nfsd.export     /proc/501/net/rpc/nfsd     /proc/501/net/rpc/nfs     /proc/502/net/rpc/nfsd.fh     /proc/502/net/rpc/nfsd.export     /proc/502/net/rpc/nfsd     /proc/502/net/rpc/nfs     /proc/503/net/rpc/nfsd.fh     /proc/503/net/rpc/nfsd.export     /proc/503/net/rpc/nfsd     /proc/503/net/rpc/nfs     /proc/504/net/rpc/nfsd.fh     /proc/504/net/rpc/nfsd.export     /proc/504/net/rpc/nfsd     /proc/504/net/rpc/nfs     /proc/513/net/rpc/nfsd.fh     /proc/513/net/rpc/nfsd.export     /proc/513/net/rpc/nfsd     /proc/513/net/rpc/nfs     /proc/514/net/rpc/nfsd.fh     /proc/514/net/rpc/nfsd.export     /proc/514/net/rpc/nfsd     /proc/514/net/rpc/nfs     /proc/515/net/rpc/nfsd.fh     /proc/515/net/rpc/nfsd.export     /proc/515/net/rpc/nfsd     /proc/515/net/rpc/nfs     /proc/516/net/rpc/nfsd.fh     /proc/516/net/rpc/nfsd.export     /proc/516/net/rpc/nfsd     /proc/516/net/rpc/nfs     /proc/517/net/rpc/nfsd.fh     /proc/517/net/rpc/nfsd.export     /proc/517/net/rpc/nfsd     /proc/517/net/rpc/nfs     /proc/518/net/rpc/nfsd.fh     /proc/518/net/rpc/nfsd.export     /proc/518/net/rpc/nfsd     /proc/518/net/rpc/nfs     /proc/523/net/rpc/nfsd.fh     /proc/523/net/rpc/nfsd.export     /proc/523/net/rpc/nfsd     /proc/523/net/rpc/nfs     /proc/525/net/rpc/nfsd.fh     /proc/525/net/rpc/nfsd.export     /proc/525/net/rpc/nfsd     /proc/525/net/rpc/nfs     /proc/1056/net/rpc/nfsd.fh     /proc/1056/net/rpc/nfsd.export     /proc/1056/net/rpc/nfsd     /proc/1056/net/rpc/nfs     /proc/1145/net/rpc/nfsd.fh     /proc/1145/net/rpc/nfsd.export     /proc/1145/net/rpc/nfsd     /proc/1145/net/rpc/nfs     /proc/1188/net/rpc/nfsd.fh     /proc/1188/net/rpc/nfsd.export     /proc/1188/net/rpc/nfsd     /proc/1188/net/rpc/nfs     /proc/1191/net/rpc/nfsd.fh     /proc/1191/net/rpc/nfsd.export     /proc/1191/net/rpc/nfsd     /proc/1191/net/rpc/nfs     /proc/1219/net/rpc/nfsd.fh     /proc/1219/net/rpc/nfsd.export     /proc/1219/net/rpc/nfsd     /proc/1219/net/rpc/nfs     /proc/1284/net/rpc/nfsd.fh     /proc/1284/net/rpc/nfsd.export     /proc/1284/net/rpc/nfsd     /proc/1284/net/rpc/nfs     /proc/1289/net/rpc/nfsd.fh     /proc/1289/net/rpc/nfsd.export     /proc/1289/net/rpc/nfsd     /proc/1289/net/rpc/nfs     /proc/1379/net/rpc/nfsd.fh     /proc/1379/net/rpc/nfsd.export     /proc/1379/net/rpc/nfsd     /proc/1379/net/rpc/nfs     /proc/1380/net/rpc/nfsd.fh     /proc/1380/net/rpc/nfsd.export     /proc/1380/net/rpc/nfsd     /proc/1380/net/rpc/nfs     /proc/1412/net/rpc/nfsd.fh     /proc/1412/net/rpc/nfsd.export     /proc/1412/net/rpc/nfsd     /proc/1412/net/rpc/nfs     /proc/1421/net/rpc/nfsd.fh     /proc/1421/net/rpc/nfsd.export     /proc/1421/net/rpc/nfsd     /proc/1421/net/rpc/nfs     /proc/1432/net/rpc/nfsd.fh     /proc/1432/net/rpc/nfsd.export     /proc/1432/net/rpc/nfsd     /proc/1432/net/rpc/nfs     /proc/1444/net/rpc/nfsd.fh     /proc/1444/net/rpc/nfsd.export     /proc/1444/net/rpc/nfsd     /proc/1444/net/rpc/nfs     /proc/1445/net/rpc/nfsd.fh     /proc/1445/net/rpc/nfsd.export     /proc/1445/net/rpc/nfsd     /proc/1445/net/rpc/nfs     /proc/1446/net/rpc/nfsd.fh     /proc/1446/net/rpc/nfsd.export     /proc/1446/net/rpc/nfsd     /proc/1446/net/rpc/nfs     /proc/1448/net/rpc/nfsd.fh     /proc/1448/net/rpc/nfsd.export     /proc/1448/net/rpc/nfsd     /proc/1448/net/rpc/nfs     /proc/1473/net/rpc/nfsd.fh     /proc/1473/net/rpc/nfsd.export     /proc/1473/net/rpc/nfsd     /proc/1473/net/rpc/nfs     /proc/1499/net/rpc/nfsd.fh     /proc/1499/net/rpc/nfsd.export     /proc/1499/net/rpc/nfsd     /proc/1499/net/rpc/nfs


title: Get all images from website

text: I'm trying to wget all the images pictures from a website. I thought I knew how to use it, but I guess I don't. The images I'm trying to get come from here. The command I'm using is:               wget -prA.png http://gameinfo.euw.leagueoflegends.com/en/game-info/champions/      But I only get a index.html back? Could somebody explain this?


title: Unable to find headers in GCC

text: I am trying to compile a program using GCC in SCO, and I am unable to find the `ctype.h` file. I have managed to find the other files that were missing when compiling, like `string.h` etc. I was getting this returned **before** I found where most of the other files were:               In file included from test.c:76:     strutil.c:2: string.h: No such file or directory     strutil.c:3: stdio.h: No such file or directory     In file included from test.c:77:     pcutils.h:3: ctype.h: No such file or directory     In file included from test.c:78:     pcutils.c:2: string.h: No such file or directory     pcutils.c:3: stdio.h: No such file or directory     test.c:79: time.h: No such file or directory     test.c:81: stdio.h: No such file or directory      Most of those files are in `/opt/K/SKUNK99/Gcc/2.95.2pl1/usr/local/lib/gcc- lib/i386-pc-sco3.2v5.0.5/2.95.2/include/oldstyle` **Now it is showing this:**               In file included from test.c:77:     pcutils.h:3: ctype.h: No such file or directory      **Therefore my question is:**   * Where can I find the `ctype.h` file? This question is related to .profile in SCO


title: How do I get to use .local hostnames with Arch Linux?

text: If I'm using Ubuntu or Linux Mint (the only two flavours I've tried and know work for sure), I can run something like this:               wayne@myhost$ ssh wayne@otherhost.local      And the name is automagically resolved to whatever the IP of otherhost is on my local network. I've decided to start branching out into other distros, and I've got Arch running on my laptop - but if I try using the previous command I get `Could not resolve hostname otherhost.local: Name or service not known` What does it take to get this sort of automatic name resolution(?) to take place?


title: Ubuntu 11.04 Startup Applicatation vs /etc/init.d

text: **Is there any difference between these two methods for application to start on boot?** I need an application to start _before_ a logon occurs and am questioning whether or not Ubuntu's Startup Application menu will accomplish this for me. Otherwise, I can put a startup script in the init.d but then have to find some way of remebering thats where I stuck it (not be confused with /etc/rc.local which does not seem to work in Ubuntu 11.04) I have no other way of verifying that in fact the program is running without logging in at this time. Thanks.


title: Is there a way to sum up the size of files listed?

text: This is the command I am using to list some files:               find . -name \*.extract.sys -size +1000000c -exec ls -lrt {} \;     -rw-r--r--   1 qa1wrk15   test       1265190 Sep 29 01:14 ./var/can/projs/ar/rep/extract/Sep/29/ar.ARAB-PI_7.20110929.extract.sys     -rw-r--r--   1 qa1wrk15   test       1345554 Sep 29 01:14 ./var/can/projs/ar/rep/extract/Sep/29/ar.ARAB-PI_2.20110929.extract.sys     -rw-r--r--   1 qa1wrk15   test       1370532 Sep 29 01:14 ./var/can/projs/ar/rep/extract/Sep/29/ar.ARAB-PI_3.20110929.extract.sys     -rw-r--r--   1 qa1wrk15   test       1399854 Sep 29 01:14 ./var/can/projs/ar/rep/extract/Sep/29/ar.ARAB-PI_8.20110929.extract.sys      and so on. Now I want to calculate the total size of these files by summing up the 5th column. I thought of using `awk`, to do this so I tested the following in a particular directory               >ls -lrt | awk `{ print $1 }`     ksh: syntax error at line 1 : `{' unmatched      I don't understand what is the problem, why this **syntax error**. I am thinking to try               ls -lrt | awk `BEGIN {total = 0} {for(i=0;i<NR;i++){total+=$5}} END {printf "%d",total}       this also, but a simple `awk` script is not working. Please suggest or correct me if I am wrong, or if there is a workaround for this.


title: is it possible to trigger `ssh-add <key>` only when I ssh into a box? (from Cygwin)

text: I've got my `.bash_profile` set up to `eval $(ssh-agent)` so I can quickly connect to servers. If I add `ssh-add ~/.ssh/id_rsa_my_key` to my `.bash_profile` as well, I'll have to type the ssh key passphrase in every terminal window, even if I didn't intend to use that terminal window for logging into a server. I could create an alias to make it trivially easy to type the `ssh-add ~/.ssh/id_rsa_my_key` line (so I don't have to stop my train of thought about what I'm trying to accomplish and think instead about how I named my key) but I still have to remember to do that before I ssh into a box. I'm used to working in OS X, where all this is handled almost transparently by the Keychain, and I just `ssh` away without having to think about access. I'd rather not have to change my mental habits, even though I'm now primarily working from a Windows box. In Windows the ssh-agent dies as soon as I I'd also rather not do this with aliases or functions for ssh, if it can be avoided. I think that creating aliases and functions that replace normal commands and programs is a somewhat fragile and risky solution: if _another_ problem comes up in the future for which the only solution is to replace `ssh` then my alias or (more likely) function becomes yet more complex and brittle. Increasingly so the third time, etc. etc. Nonetheless, this _may_ be the only solution. Furthermore, to be useful, the function would have to somehow first check whether the key had already been added, otherwise I'd be adding it every time I logged in, which would accomplish nothing. Does `ssh` have some setting to do this automatically? Is there some better solution than adding `ssh-add ~/.ssh/id_rsa_my_key` to my `.bash_profile`?


title: Linux CentOS 5 SSH User Permission Denied

text: Today when I try to SSH into my server, I get a permission denied message (same for `sftp`). It used to work well before, I didn't change any server settings, except I was trying to modify a few folders `chown` permission. Root user can `ssh`/`sftp` without problem. (For root user, there is no `.ssh/authorized_keys` file, only a `.ssh/known_hosts` file. For normal user home folder does not have a `.ssh` folder).


title: Finding all large files in the root filesystem

text: I have a linux server, which currently has below space usage:               /dev/sda3              20G   15G  4.2G  78% /     /dev/sda6              68G   42G   23G  65% /u01     /dev/sda2              30G  7.4G   21G  27% /opt     /dev/sda1              99M   19M   76M  20% /boot     tmpfs                  48G  8.2G   39G  18% /dev/shm      As you can see. `/` is at 78%. I want to check, which files or folders are consuming space. I tried this:               find . -type d -size +100M      Which shows result like this:               ./u01/app/june01.dbf     ./u01/app/temp01.dbf     ./u01/app/smprd501.dbf     ./home/abhishek/centos.iso     ./home/abhishek/filegroup128.jar      Now this is my issue. I only want the name of those files located in folders that are consuming space at `/` and not at `/u01` or `/home`. Since `/` is base of everything, it is showing me every file of my server. Is is possible to get big files that is contributing to 78% of `/` ?


title: permission error with php/nginx and not using www-data

text: -edit- whats even more curious is if i `chmod 777 /var/run/php-fastcgi/php-fastcgi.socket` this works... if its not www-data, php-www (nor root) then what user is trying to access the socket :| -edit2- i added `chown www-data:$FASTCGI_GROUP $SOCKET` to the end of the script below (which is right after `spawn-fcgi`) and that solves the problem... but wtf, www-data is in the php-www group. why must it be owner. I didnt change FASTCGI_USER back to www-data bc it would defeat the purpose (it would allow the php files to access all my files as www-data which i dont want) Essentially what i wanted to do is have the php process not be www-data so if it gets compromised its damage is limited to the very few php sites i have. What i did was create the user php-www and add its group to www-data. When i log in as www-data i can access everything ih php-www however php-www cant access anything but my php sites. perfect. I got php+nginx running. But how changing it gives me a problem. I see www- data mention in a init.d script which changes the ownership of a folder. Its fine and i changed it to php-www. Thats not a problem. What is the problem is the spawn script.               #!/bin/bash          FASTCGI_USER=php-www     FASTCGI_GROUP=php-www     SOCKET=/var/run/php-fastcgi/php-fastcgi.socket     PIDFILE=/var/run/php-fastcgi/php-fastcgi.pid     CHILDREN=6     PHP5=/usr/bin/php5-cgi          /usr/bin/spawn-fcgi -s $SOCKET -P $PIDFILE -C $CHILDREN -u $FASTCGI_USER -g $FASTCGI_GROUP -f $PHP5      the user/group lines use to say www-data but now i changed them to php-www I started php-fastcgi and nginx. When i visit my site i get a 502 bad gateway error. When i look in nginx logs i see this line               connect() to unix:/var/run/php-fastcgi/php-fastcgi.socket failed (13: Permission denied) while connecting to upstream      Permission denied!?! why!?! www-data does have the group php-www and `stat` that folder and socket shows owner and group php-www. I can access the php file with bot php-www and www-data. Why am i get a permission error? and what am i doing wrong? in case you want to see my process               # ps aux | egrep "php|www"      shows               www-data   548  0.0  0.1   1908   492 ?        Ss   18:08   0:00 /usr/sbin/fcgiwrap     www-data   586  0.0  0.1   1908   488 ?        Ss   18:08   0:00 /usr/sbin/fcgiwrap     php-www   1611  0.0  1.9  19312  5020 ?        Ss   18:20   0:00 /usr/bin/php5-cgi     php-www   1612  0.0  0.7  19312  1856 ?        S    18:20   0:00 /usr/bin/php5-cgi     php-www   1613  0.0  0.7  19312  1856 ?        S    18:20   0:00 /usr/bin/php5-cgi     php-www   1614  0.0  0.7  19312  1856 ?        S    18:20   0:00 /usr/bin/php5-cgi     php-www   1615  0.0  0.7  19312  1856 ?        S    18:20   0:00 /usr/bin/php5-cgi     php-www   1616  0.0  0.7  19312  1856 ?        S    18:20   0:00 /usr/bin/php5-cgi     php-www   1617  0.0  0.7  19312  1856 ?        S    18:20   0:00 /usr/bin/php5-cgi     www-data  1776  0.0  0.6   5428  1684 ?        S    18:27   0:00 nginx: worker process     php-www   1967  0.0  1.9  19312  5020 ?        Ss   18:40   0:00 /usr/bin/php5-cgi     php-www   1968  0.0  0.7  19312  1856 ?        S    18:40   0:00 /usr/bin/php5-cgi     php-www   1969  0.0  0.7  19312  1856 ?        S    18:40   0:00 /usr/bin/php5-cgi     php-www   1970  0.0  0.7  19312  1856 ?        S    18:40   0:00 /usr/bin/php5-cgi     php-www   1971  0.0  0.7  19312  1856 ?        S    18:40   0:00 /usr/bin/php5-cgi     php-www   1972  0.0  0.7  19312  1856 ?        S    18:40   0:00 /usr/bin/php5-cgi     php-www   1973  0.0  0.7  19312  1856 ?        S    18:40   0:00 /usr/bin/php5-cgi     root      2110  0.0  0.2   3300   736 pts/1    S+   18:55   0:00 egrep php|www


title: Search MP3/Ogg files by tags/parameters from the command line

text: Is there any utility to search MP3/Ogg files by tags (or other characteristics) from the command line? (e.g. finding all audio files longer than 10 minutes with genre set to 'Rock'). I found this, which suggests using `mp3info`, but it's only for MP3 files and the proposed solution isn't the most elegant thing. Any other suggestions?


title: restore duplicity backup from amazon s3 in debian

text: I have applied the script provided here to backup my stuff in debian etch and it works, I tried to reverse the `SOURCE` and `DEST`, but I can't do the restoration. What happened?


title: Steam / Dota2 with Bumblebee

text: I'm trying to run Dota2 with Bumblebee and therefore I installed everything like mentioned here: https://wiki.archlinux.org/index.php/bumblebee. If I test my bumblebee install with:               optirun glxspheres64      Or               glxspheres32      Everything works fine. If I start steam without `optirun`, therefore on my internal Intel graphics card, everything works fine, no errors. If I try to start steam by:               optirun steam      And the try to launch `dota2`, the screen flickers for a moment and then dota2 is closed again. I piped the output into a file to provide you with the information you might need:   * http://pastebin.com/gmn9gGLk As far as I know I have all the necessary 32-bit libraries installed, but maybe I'm wrong? If you need additional output let me know, I'd be happy to oblige.


title: How to change the hash-spec and iter-time of an existing dm-crypt LUKS device?

text: How can I change the hash-spec and iter-time of an **existing** dm-crypt LUKS device? Clearly I can pass the options if I create a _new_ device, for example something like this:                sudo cryptsetup luksFormat --cipher aes-cbc-essiv:sha256 --key-size 256 --iter-time 2100 --hash sha512 /dev/loop0      But if the device already exists, how can I change for example `sha256` to `sha1` or change the iteration time without "destroying" the device. (Clearly you would have to retype your password since a new hash will be generated.)


title: Where to drop libraries according Filesystem Hierarchy Standard

text: I do operate a Linux-based build system. The build system itself is based on Jenkins, Nexus, Maven, Ant and Shell scripting. Some projects need some special tools and libraries for building. Especially we have some Ant-Tasks that are only needed by two projects. And we don't want to drop this tasks into the ant-folder. Whats your recommendation to place this ant-tasks into right location according to FHS? Moreover we have some general purpose xlt-templates, that we need to transform various XMLs in our development projects. The transformation sheets are needed by different but not all projects. Where to put all this XLTs?


title: ELF interpreter error - Can't install on my CentOS

text: I don't know if I'm permitted to ask about zPanel here, but I'll go ahead and try and hope for the best. Stackexchange has helped me a lot in different areas... I was following the instructions to install zPanel on my freshly installed CentOS 6.4 x64 VPS, but I'm facing this error which wont let me finish step 5 from this guide: http://www.zvps.co.uk/zpanelcp/centos-6 So, this is how I'm doing it:               [root@img ~]# ./installer-10-1-0-centos-64.sh.x     -bash: ./installer-10-1-0-centos-64.sh.x: /lib64/ld-linux-x86-64.so.2: bad ELF interpreter: No such file or directory      I've read through all online solutions and tried running these commands: `yum install glibc.i686` and `yum install glibc.i386` For the first package, it said it was installed. The second one wasn't found in my system. I've also ran this as the guide instructed:               yum install ld-linux.so.2 curl      But nothing happened. What do I do in order to proceed?


I am reading a 550MB file into /dev/null and I am getting               dd: writing '/dev/null': No space left on device      I was surprised. I thought /dev/null is a black hole where you can send as much as you want ( because its a virtual fs). Yes my disk is almost full when I get this error. What can I do other than deleting content from the disk?                ls -l /dev/null      -rw-r--r--    1 root     root             0 July 7 21:58 /dev/null      Instead of                crw-rw-rw-    1 root     root        1,   3 July 7 02:58 /dev/null      Command I am using:               time sh -c "dd if=$filename of=/dev/null"


title: Should I run fsck on boot for an amazon ec2 image?

text: I have an Ubuntu micro instance running on amazon EC2. Recently after logging in I was alerted:               *** /dev/xvda1 will be checked for errors at next reboot ***      I've rebooted a couple times using `init 6`, however when I log on I am still getting the same notice, so apparently `fsck` is not running at startup. I read this blog post which mentions that if the /etc/fstab `<pass>` column is set to `0` then a disk check will be skipped during reboot. Here is my `fstab` file:               <file system>           <mount point><type><options><dump><pass>     LABEL=cloudimg-rootfs   /            ext4  defaults 0     0     /dev/xvdh               /vol         xfs   noatime  0     0      This is the default configuration for an ec2 image from`ubuntu`.   * Is it normal for `<pass`> to be set to `0` here?   * Why would it be set to `0`?   * What is the best way to run `fsck` \- should I change this value or only run it manually when alerted?


title: Why would Ctrl-C behave differently than kill -2

text: I have a program which is supposed to handle SIGINT and gracefully shut down. When I run this program from a terminal without backgrounding it I can shut it down just fine using Ctrl-C. Inspecting the logs shows that everything worked as expected. When I open a separate terminal and call `kill -2 [pid]` or `kill -s INT [pid]` it does nothing. I see nothing in the logs and the program continues to run as usual until I hit Ctrl-C in the terminal I launched it from. Are there any differences between how Ctrl-C sends the signal and how kill does? **Additional Details:** The program in question is a Java application launched by a bash shell script which sets up some environment variables (namely `CLASSPATH`) and then calls `java [main class]`. Hitting Ctrl-Z and then running `ps` results in the following:               $ ps -f     UID        PID  PPID  C STIME TTY          TIME CMD     mdeck    10251 10250  0 11:48 pts/2    00:00:00 -bash     mdeck    13405 10251  0 18:12 pts/2    00:00:00 /bin/bash /usr/local/bin/myapp.sh     mdeck    13509 13405 25 18:12 pts/2    00:00:03 java com.company.MyApp     mdeck    13526 10251  0 18:13 pts/2    00:00:00 ps -f      The output of stty as requested by Gilles is below:               $ stty -a </dev/pts/2     speed 38400 baud; rows 40; columns 203; line = 0;     intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;     -parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts     -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8     opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0     isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke


title: Running a program to output in Dutch

text: I'm running KDE Arch linux and trying to update my system using pacman and have it output in Dutch. I've tried the following               sudo LANG=nl_NL.UTF-8 pacman -Syy     sudo KDE_LANG=nl_NL.UTF-8 pacman -Syy      But neither of them worked. I've also tried editing my `/etc/locale.gen` file and running `locale-gen` but that didn't work either. I know pacman supports localization, but I can't seem to get it to output in any of the major languages.


title: Is there a different linux kernel for different architectures?

text: If I want to build a custom kernel for an ARM architecture, do I need to : a) Download the kernel from kernel.org, make changes to the kernel, build it using some cross compiler (like code sourcery or something) b) Find an ARM specific kernel from somewhere, find some patches, compile it using some ARM specific tool ? Can any custom kernel be built for the ARM architecture ? I have little knowledge about kernels in general.


title: Device driver to capture wireless traffic using Wi-Fi adapter?

text: I wish to be able to read wireless traffic sent from my wireless keyboard. At first I thought I could just buy some board like Arduino, plug in a module like nRF24L01+ and use this combo. Since I'm not good at all with electronics I'd rather find another solution and, eventually, I thought that I already have a transreceiver for wireless comunication: my laptop Wi-Fi adapter. As I said, I don't know much about electronics, so I wonder if it's actually possible to write a linux device driver for my adapter in order to make it able to capture and process wireless communication other than Wi-Fi. Is this doable? Is this the best route I can follow, rather than using an Arduino with a wireless module? **EDIT** I'm not looking for an implementation of such a device driver, my goal is to write it myself. I'm just asking if there is something I'm not taking into consideration before starting this journey.


title: unix command to print till 3rd occurence of "/" in each line

text: I have one file contains data as follows...               /tutordashboard/manageTutorLogInStatus/?ua=TQ-AUTOCLOSE-REENTER&filterId=089089087087080&dt=1325757272     /tutordashboard/manageTutorLogInStatus/?ua=TQ-AUTOCLOSE-REENTER&filterId=089089087087080&dt=1873982869     /tutordashboard/manageTutorLogInStatus/?ua=TQ-BUTTON-DISABLED&sessionType=1&sessionId=4938718&filterId=97462&dt=1354822214604     /tutordashboard/manageTutorLogInStatus/?ua=TQ-BUTTON-DISABLED&sessionType=1&sessionId=4951063&filterId=95997&dt=1354807593071     /tutordashboard/manageTutorLogInStatus/?ua=TQ-BUTTON-DISABLED&sessionType=2&sessionId=4957338&filterId=99353&dt=1354752909284      How can I get the output that prints till 3rd occurrence of "/" in each line?


title: Bash/Korn shell script edited on Windows throws error '...^M: not found'

text: _**Some background on the issue:_** I am new to scripting and wrote a simple Bash script in Windows using Notepad++. **cxStopAllServicesOnSERVER.sh**               #!/usr/bin/bash     cd "/some/path"     echo "Hi. Logs can be found at "`pwd`"/cxStartStopLogger.log"     echo "["`date`"]*** STOPPING ALL SERVICES ON SERVER ***" >> "cxStartStopLogger.log"     exit      Now after uploading it and setting the required file permissions, I tried executing it as follows:               bash-3.00$ cat cxStopAllServicesOnSERVER.sh #Let's have a look at the code.     #!/usr/bin/bash     cd "/some/path/"     echo "Hi. Logs can be found at "`pwd`"/cxStartStopLogger.log"     echo "["`date`"]*** STOPPING ALL SERVICES ON SERVER ***" >> "cxStartStopLogger.log"          bash-3.00$ # Code and hashbang 'looks' correct,      bash-3.00$ # if there is any issue with the format (EOL characters and such)      bash-3.00$ # we cannot see it using cat.     bash-3.00$      bash-3.00$ sh cxStopAllServicesOnSERVER.sh     cxStopAllServicesOnSERVER.sh[2]: /some/path^M:  not found     Hi. Logs can be found at /some/path/cxStartStopLogger.log     bash-3.00$ # Note that ^M appears at the end of the line.          bash-3.00$ bash -x cxStopAllServicesOnSERVER.sh     + cd $'/some/path\r'     : No such file or directory1.sh: line 2: cd: /some/path     ++ pwd     ' echo 'Hi. Logs can be found at /some/path/cxStartStopLogger.log     Hi. Logs can be found at /some/path/cxStartStopLogger.log     ++ date     + echo '[Sun' Nov 18 00:28:17 EST '2012]*** STOPPING ALL SERVICES ON SERVER ***'     bash-3.00$ # Note that '\r' return character appears at the end of the line.      _**Problem:_** When I change the code to korn shell I face the same issue. Appears that an incorrect character is getting added at the end of the line. _**NOTE:_** I found the solution and have posted the same as an answer. Feel free to update or improve it to help other beginners that may face the same issue. Thanks!


Is there a tool that pastes from clipboard one character at a time? Something that would simulate a real person typing, like in the movies ;) Of course I am referring to X applications, preferably KDE, but others will do also. **UPDATE** \- I need to type to GUI applications, not the terminal.


title: How can I install Skype in Ubuntu on ARM?

text: I wonder how to install and use Skype in Ubuntu (12.04) on ARM architecture (my Toshiba AC100, which originally ran Android). I suppose there must be Skype builds for Linux on ARM: for Android, and for Maemo/Meego/Tizen. Where can one get these builds and how to adapt them for a usual GNU/Linux system like Ubuntu? (But, generally, I believe that we must be able to solve our problems ourselves rather than depend on the publishers of non-free software. It wouldn't be such an ugly situation if the question was about free software: we could try to adpat it for ARM and build ourselves. Also, the Skype communication protocol is not open, posing more problems for our freedom and security. But this question merely asks for instructions for those who need Skype working on their ARM computers, without the concerns about freedom and considerations of other VoIP protocols and software.)


title: Is there a JavaScript shell?

text: Recently I've been working with JS and I'm very enthusiastic about this language. I know that there is _node.js_ for running JS at server side, but is there a shell that uses JS as a scripting language? If such thing exists, how usable & stable is it?


title: CentOS VPS not starting after installing zPanel

text: I've had some trouble earlier installing zPanel, but then I was told that I've been using the wrong package, I was supposed to use the 32-bit version, but kept trying with 64-bit. After figuring that, I've immediately re-installed my system (CentOS 6.4 32-bit) and started installing zPanel. Everything went fine and the installation finished and gave me these details in the end:               # MySQL Root Password    : XXXX     # MySQL Postfix Password : XXXX     # ZPanelX Username       : zadmin                          # ZPanelX Password       : XXXX      All good, except that my system is not starting up anymore! It simply wont boot up after the auto-reboot by zPanel. In SolusVM, the VPS is showing as online, but nothing's working. I can't access my IP via browser, can't access my IP via SSH (PuTTY) and same applies to SFTP with Filezilla - it's simply dead! I tried rebooting, booting, shutting down... everything! This is the guide I was following: http://www.zvps.co.uk/zpanelcp/centos-6 I would really appreciate some help.


title: What does "The following packages have been kept back" mean?

text: When doing an `apt-get upgrade` I sometimes get a message saying "The following packages have been kept back". For example:               $ sudo apt-get upgrade                                                                                Reading package lists... Done                                                                                Building dependency tree                                                                                Reading state information... Done                                                                                The following packages have been kept back:                                                                                linux-headers-server linux-image-server linux-server                                                                                0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.      What does this mean exactly? Obviously the packages have been held back and not installed, but why? The follow-on question would be: how does one upgrade these kept back packages?


title: IPv6 address changed after upgrade. Why? and how can I harden my .htaccess against this?

text: I noticed in my local webserver logs that the IPv6 address of my desktop changed after upgrading to Kubuntu 12.04.               inet6 addr: identical:identical:identical:identical:changed:changed:changed:changed/64 Scope:Global      Why did this happen, how can I avoid .htaccess rules from breaking during OS upgrades?


title: using curses with virtual terminals

text: I'm trying to use Curses on Fedora 12 to output status information to a virtual console (one of the terminals you can get to by pressing `Ctrl``Alt``Fx`). When I start up my application on one of the virtual consoles (`$TERM=linux`) the lines for the boxes come out as the characters such as `j`, `q`, `k` and a few other characters. Yet when I start it within a terminal window (`$TERM=xterm`) everything displays as it should. Can someone explain to me what I need to do to get the VT output to appear as the xterm? Is there a terminal setting that I can set from within my program to cause the output to be correct?


title: Checking if files exist in some remote folders with bash

text: I need to do a script to look in some folders and send an email if there are files in these folders.   I've tried to do something like this but I get errors with the command variable and print of the folder.               for folder in "FOLDER1" "FOLDER2";  do       command=`ssh -q user@host "ls /usr/local/username/`{print $folder}` | wc -l"`       #echo $command            if [ $command -ne '0' ]       then         #send error email        fi     done


title: What is a zombie process?

text: Could you tell me the meaning of a "zombie process" and give an example.


title: Apple Magic Trackpad resets settings after session

text: I was able to get the Apple Magic Trackpad working on Fedora 15 KDE 4.6. (I previously got it working on Linux Mint.) However, the settings -- particularly activating the single-finger left click and double-finger right click -- seem to reset after each user session. Does anybody know how to retain these settings between sessions? EDIT: When I turn on the computer and then activate the trackpad, then the settings do not load. However, when I logout and login, the settings load. That suggests to me that, since the trackpad is already active before login, its settings are successfully modified upon login. But when the trackpad is not active before login, then the default settings are meaningless because there is no trackpad to set. Therefore, is there a way to register the settings _after_ the trackpad is recognized by Bluetooth?


title: Fedora: Adding extra fonts in a safe manner

text: I installed few free fonts from smashingmagazine.com on my Fedora 14 laptop. I didn't like them much so I removed them from `/usr/share/fonts` using `rm -f`. The consequence was that my Google Chrome browser fonts changed automatically. Since Fedora 15 is around the corner, I don't care much about the issue. But after installing Fedora 15, I'd like to make sure that I can add and remove fonts safely from my laptop without affecting font settings in any other application (specially browser). How can I do that and what points should I keep in mind?


title: `ls -l` of a file and all the directories leading to it?

text: Before I start writing a (probably easy) script, is there a command that does the equivalent of the following one:               [:~/software/scripts] % ls -ld / /usr /usr/bin /usr/bin/tee      drwxr-xr-x 21 root root  4096 Mar 31 08:48 /     drwxr-xr-x 11 root root  4096 Jan 30 09:48 /usr     drwxr-xr-x  2 root root 73728 Apr 14 07:54 /usr/bin     -rwxr-xr-x  1 root root 26308 Jan 16  2013 /usr/bin/tee      without having to manually type all the partial paths? The idea would be to be able to say               ls --this-new-flag /usr/bin/tee        or               command -l /usr/bin/tee       and having the output above --- showing the detailed listing of all partial path leading to the final one. A shell expansion trick that can output `/ /usr /usr/bin /usr/bin/tee` given `/usr/bin/tee` will do, too.


title: Delete files if contents do not match pattern

text: There are hundreds of `.html` files in a directory. I need to delete files that don't contain word `bluecar` in their contents. I thought _sed_ with _rm_ would do that, but I don't know how to combine them.


title: Upgrading I2C client drivers to the newer binding model

text: I am trying to port some I2C device drivers I wrote for an other kernel to work with the newer I2C binding model. The kernel documentation goes through the steps of doing this: http://www.mjmwired.net/kernel/Documentation/i2c/upgrading-clients The thing that I don't understand is when using this new model, how does one specify the I2C address of the device? It used to be done like this:               static unsigned short normal_i2c[] = { 0x67, I2C_CLIENT_END };          I2C_CLIENT_INSMOD;      I don't think my bus/device supports detection.


title: Change the text on a single line number in multiple text files

text: Suppose that I have ten bash shell scripts: `script1.sh`, `script2.sh`, ..., `script10.sh`. Initially, all ten files are identical. Now, I would like to make two changes in each script:   1. In each file, I would like to change a particular line (say line 8) -- that is, deleting whatever is on line 8 and replacing it with a _"constant"_ string that I specify, such as `"This is line 8."` This is similar to this question, but there they wanted to replace `"AAA"` with `"BBB"`, whereas I would like to replace line 8 (whatever it is) with `"This is line 8."`.   2. In each file, I would like to change another particular line (say line 21) and replace it with a _"variable"_ string that I specify. For example, in `script1.sh` I want to change line 21 to `"XYZ"`; in `script2.sh` I want to change line 21 to `"PQR"`; and in `script3.sh` I want to change line 21 to `"ABC"`. Essentially this is just many calls to the function in **(1)** above -- except that I would be making the change in one individual file rather than in all files, and that I am specifying ten different strings rather than just one. So to obtain **(2)** here, perhaps I would just call **(1)** ten different times with different parameters. I am interested in solutions that use commonly available Linux programs like `bash`, `vi`, `awk`, `gawk`, etc.


title: sudo command executes without prompting for password

text: For some reason, I suddenly do not need to enter the password when issuing `sudo some_cmd`. Entered command just runs without ever prompting password, even if I am not logged in as user root. Commands that need root privileges still need to be invoked with `sudo` though. I am on Ubuntu 10.04. Any idea what might have caused this?


title: Konsole works, gnome-terminal doesn't?

text: I'm running on CentOS 5.7 (in case that matters) I have a program (not my own) that runs fine from Lonsole, but when I run it from `xterm`, `gnome-terminal` or `rxvt`, it just hangs. I'm doing this with a completely fresh account, no `.bashrc`, no alterations to defaults. Brand new vanilla install. On both terminals, `$-` is `himBH` so, both the same type of shell, I would think. If I ssh into the machine, even from itself (`ssh 127.0.0.1`), it works in all terminals. Any idea what could be wrong? EDIT: The program is `qconf`, part of SGE (GridEngine), in case that matters. It goes to a server and returns a list of machines that are allowed to make compute requests. I ran with traces, the diff looks like:               diff broken working     1,4c1,4     < execve("/opt/SGE/bin/lx24-amd64/qconf", ["qconf", "-ss"], [/* 49 vars */]) = 0     < brk(0)                                  = 0x1a48c000     < mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2ba0bec8a000     < mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2ba0bec8b000     ---     > execve("/opt/SGE/bin/lx24-amd64/qconf", ["qconf", "-ss"], [/* 48 vars */]) = 0     > brk(0)                                  = 0xa7cb000     > mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =     0x2b3b4716e000     > mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b3b4716f000     6,19d5          .     .     .     < futex(0x3a408030ec, FUTEX_WAKE_PRIVATE, 2147483647) = 0     < futex(0x6ba3c0, FUTEX_WAIT_PRIVATE, 2, NULL     \ No newline at end of file     ---     > open("/proc/cpuinfo", O_RDONLY)         = 3     > read(3, "p", 1)                         = 1     > read(3, "r", 1)                         = 1      [working goes on from here] Broken stops in mid futex output, which is odd.


title: Hindi fonts in xterm

text: xterm fails to display the Indian fonts (Hindi). Instead, it displays the garbage character. I'm using xterm version 293 on LFS I copied sample hindi text from here


title: CentOS 6.4 Kickstart bootloader problem

text: I am installing CentOS 6.4 via a kick start file that looks like this in my build:               # install the bootloader (GRUB)     bootloader --location=mbr --driveorder=sda --append="crashkernel=auto"      After the installation I see this in /root/anaconda-ks.cfg               bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"      The problem is I do not want 'quiet' appended the the kernel parms. quiet gives the moving progress bar during the installation instead of the detail. I want to see the details. Why does the installation add quiet to the bootloader when I never specified it?? How do I prevent CentOS 6.4 from adding this automatically during installation??? **UPDATE:** **My initial post was wrong.. rhgb kernel parm enables graphical progress bar during boot. So, in my case I needed to get rid of both rhgb and quiet.** **Updated my ks.cfg file and added suggested editing in the %post section. Works great now!!!**


title: Using multiple SSDs as cache devices with bcache?

text: If we have three SSDs installed in a system, with a spare partition for the unused space on the SSD (`/dev/sda2`, `/dev/sdb2` and `/dev/sdc2`). Can `bcache` be configured to use all three of those partitions to cache a single backing device (such as `/dev/md10` which is laid on top of `/dev/sd[defghij]1`). From what I have read elsewhere, it is possible that a particular SSD device can be used by `bcache` to cache multiple hard drives or RAID arrays. But nothing explains whether a backing device can be cached by multiple SSDs at the same time. For instance, you might have three 100GB SSDs instead of a single large 300GB SSD, and you want to use those as caching devices for a single 12TB array.


title: How to monitor network performance for each application in FreeBSD / PC-BSD?

text: I'm using a PC-BSD workstation, and I would like to know if there is a way to monitor which app / process is using the network. I use a Mac OS X (Mavericks) laptop, and the "Network" tab in the "Activity Monitor" allows to see which process is sending / receiving data to / from the network. But I don't see (or haven't found) anything like that in FreeBSD. Since Mac OS X is similar to FreeBSD under the hood, is there any graphical app (similar to System Monitor) or command-line utility (similar to `top`) to monitor network activity for each process?


title: What are special prompt symbols for busybox's sh support?

text: I want to setup a time prompt on PS1. But, there is no document about what are symbols the busybox support. Is there any one know? Here are all which I knew.               PS1='\u@\h: \w \$'


title: Mapping keyboard: at most primitive level

text: When I was using a comfort curve keyboard which had media keys, those keys worked as media keys in X ( with different users), in single-user mode and in multiuser-mode without X. Then I switched to an RK-9000, which is a quite excellent keyboard but has no media keys. ;...( But there are a few keys I never use. Scroll lock comes to mind as well as pause. So things like scrl-lck-cursor-up can be mapped to media on/off. I'm vaguely aware of a technique using xev/xmodmap but my understanding is that that technique is done at the X level, and is assigned to a particular user. I would like a more primitive way of redefining keys. Two things that occur to me are: 1) The way tty's are mapped to ALT-CTL-Fn ( in my distro, LMDE, I believe this is true of Fedora as well but might vary with distros ). This way works whether or not X is started. 2) When installing a distro, you are generally asked to choose a keyboard. Once you make the choice, it is my understanding that some keymapping is assigned. Uniformly at all levels and will will in multiuser X-less modes and single user modes. So how do I achieve this?


title: Is there a map of package names across the different package management systems?

text: I have amassed a small collection of *nix boxes (Fedora, Ubuntu, CentOS and Puppy) and there are a couple of projects I'm considering that I need to install additional libraries. Specifically, this OpenCV stuff: http://www.samontab.com/web/2011/06/installing-opencv-2-2-in-ubuntu-11-04/ However, his instructions are for Ubuntu, using apt-get, and I want to do the same on CentOS which uses "yum". So is there some place that maps packages across package managers? I tried this on Fedora:               sudo yum install build-essential libgtk2.0-dev libjpeg62-dev libtiff4-dev libjasper-dev libopenexr-dev cmake python-dev python-numpy libtbb-dev libeigen2-dev yasm libfaac-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev      There are a few hits, but a lot of "No package xxxx available". So, I'm hoping there is a place that shows what the package names are in what package manager.


title: How can I get Broadcom 4301 to work in Crunchbang Linux?

text: I've sunk about 6 hours into this and have not made much progress. I've installed Crunchbang, 32-bit, Waldorf on a Dell Inspiron D600. Before I took any steps, the network manager told me "firmware missing". Then I ran: > sudo apt-get install firmware-b43legacy-installer Now, the network manager can see my network but, after I enter the network key, it won't connect. And yes, I'm sure the key is correct. The instructions I've been following can be found here If you need further info, please ask in the comments.


title: Have to reinstall NVidia driver on every reboot

text: I am having an issue with my Nvidia driver after the latest update. Now, Every time I reboot the machine there is some conflict between two different version and I have to reinstall the driver before X starts. Here is the message from the log file:               Jun 11 20:28:20 localhost kernel: [   73.033810] NVRM: API mismatch: the client has the version 270.41.19, but     Jun 11 20:28:20 localhost kernel: [   73.033811] NVRM: this kernel module has the version 270.29.  Please     Jun 11 20:28:20 localhost kernel: [   73.033812] NVRM: make sure that this kernel module and all NVIDIA driver     Jun 11 20:28:20 localhost kernel: [   73.033813] NVRM: components have the same version.      Any ideas?


title: 'who' has no output

text: I'm new to Arch Linux, and I just built my system up. But when I ran `who` in urxvt, I got nothing. Anyone know what's going on? BTW. I use Slim + OpenBox. And here are parts of my configure files. rc.conf:               DAEMONS=(syslog-ng @network netfs dbus !bluetooth @crond @alsa @wicd @hal )      .xinitrc:               #! /bin/bash          xscreensaver &     rl=$(runlevel | grep -o [0-6])          case $rl in         4) exec openbox-session;;         5) exec gnome-session;;     #4) exec ck-lauch-session openbox-session;;     #5) exec ck-lauch-session gnome-session;;     esac      inittab:               id:5:initdefault:          rc::sysinit:/etc/rc.sysinit     rs:S1:wait:/etc/rc.single     rm:2345:wait:/etc/rc.multi     rh:06:wait:/etc/rc.shutdown     su:S:wait:/sbin/sulogin -p          # -8 options fixes umlauts problem on login     #c1:2345:respawn:/sbin/agetty -8 38400 tty1 linux     c2:2345:respawn:/sbin/agetty -8 38400 tty2 linux     c3:2345:respawn:/sbin/agetty -8 38400 tty3 linux     c4:2345:respawn:/sbin/agetty -8 38400 tty4 linux     c5:2345:respawn:/sbin/agetty -8 38400 tty5 linux     c6:2345:respawn:/sbin/agetty -8 38400 tty6 linux          # Serial Virtual Console for KVM and others VMs     #s0:2345:respawn:/sbin/agetty -8 9600 ttyS0 linux          # Hypervisor Virtual Console for Xen and KVM     #h0:2345:respawn:/sbin/agetty -8 38400 hvc0 linux          ca::ctrlaltdel:/sbin/shutdown -t3 -r now          # Example lines for starting a login manager     #x:5:respawn:/usr/bin/xdm -nodaemon     #x:5:respawn:/usr/sbin/gdm -nodaemon     #x:5:respawn:/usr/bin/kdm -nodaemon     x:45:respawn:/usr/bin/slim >/dev/null 2>&1          # End of file


title: How do I compile Python 3.2 on NetBSD? Error code 127

text: I'm getting strange errors when I try to compile Python 3.2 on NetBSD 5.1:               python ./Objects/typeslots.py < ./Include/typeslots.h > ./Objects/typeslots.inc     python: not found     *** Error code 127      What am I doing wrong? I'm trying to compile Python in the usual fashion:               ./configure     make     su     make install


title: Is there a way to stop screensaver on keyboard only?

text: Let's say you have screensaver running. When you move your mouse or hit any key on keyboard screensaver will be stopped. The problem is that with modern, laser based mice, slight vibration of desktop, causes mouse to send signal as "moved". So I would like to stop screensaver only with keyboard -- I could have screensaver running and move mouse with no effect on it (clicking could be ignored or not, I don't care). So -- is there a way to do it? If yes -- how? openSUSE 11.4, KDE3 (yes, **3** \-- the best DM so far).


title: Unable to install new package on debian armhf

text: I got a debian 7.4 armhf that have been running for month without any problems. A few days ago I made some updates, and after that it seams that my dpkg doesn't work correctly any more. When I try to install a new package using :               apt-get install packet_name      I get :               Reading package lists... Done      Building dependency tree             Reading state information... Done      The following NEW packages will be installed:         packet_name      0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.     Need to get 0 B/58,4 kB of archives.     After this operation, 184 kB of additional disk space will be used.     /usr/bin/dpkg: 1: /usr/bin/dpkg: ��������������     �������     ... loads more of � ...     ������ E: Sub-process /usr/bin/dpkg returned an error code (127)      I also get an error when trying to use dpkg directly :               dpkg -i package_name.deb      the error is :               /usr/bin/dpkg: line 1: $'\377\377\377\377\377\377\377\377     \377\377\377\377\377\377\377\377\377\377\377\377\377\377     \377\377\377\377\377\377\377\377\377\377\377\377\377\377     \377\377\377\377\377\377\377\377\377\377\377\377\377\377     \377\377\377\377\377\377          ...Load more of \377...          \377\377\377\377\377\377\377\377\377\377\377\377\377\377     \377\377\377\377\377\377\377\377\377\377\377\377': command not found      I imagine that this error is liked to the last packages I updates but I don't even know hos to get the list of the updated packages without using dpkg. Thanks a lot.


title: Graphics performance very bad with Radeon HD 5770 and Dual-Monitor setup

text: perhaps you can help me with the following problem and make my Linux world whole again! :) After a new installation on my old hardware, I noticed considerably worse performance, although the hardware was not altered. Overall operation seems fine. But if I start a youtube video and put it in full screen, I get horrible performance even several seconds of freeze. Also, running e.g. wesnoth is quite slow. I used to be able to run wesnoth on the big monitor while running a video on the second monitor simultaneously with no problem at all. My Graphics Card:               $ sudo lspci|grep VGA     01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Juniper XT [Radeon HD 5770]      My Screen Resolution(s): (output cropped a bit by some lower resolutions)               $ xrandr     Screen 0: minimum 320 x 200, current 3200 x 1080, maximum 8192 x 8192     DFP1 disconnected (normal left inverted right x axis y axis)     DFP2 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 521mm x 293mm        1920x1080      60.0*+   50.0     59.9     60.1     50.0     60.0          1600x1200      60.0          [...]     DFP3 disconnected (normal left inverted right x axis y axis)     DFP4 disconnected (normal left inverted right x axis y axis)     CRT1 disconnected (normal left inverted right x axis y axis)     CRT2 connected 1280x1024+1920+0 (normal left inverted right x axis y axis)     338mm x 270mm        1280x1024      60.0*+   75.0          1280x960       60.0          [...]      My Kernel and ATI drivers:               sys-kernel/linux-sabayon-3.12.14     x11-drivers/ati-drivers-13.12#3.12.0-sabayon      Direct rendering is enabled:               $ glxinfo | grep rendering     direct rendering: Yes      When measuring performance with glxgears:               $ glxgears     15868 frames in 5.0 seconds = 3173.469 FPS      This is my xorg.conf, presumable generated by amdcccle (which I used for configuration)               Section "ServerLayout"         Identifier     "Main Layout"         Screen      0  "amdcccle-Screen[1]-0" 0 0     EndSection          Section "Module"         SubSection "extmod"             Option      "omit xfree86-dga"         EndSubSection         Load  "i2c"         Load  "ddc"         Load  "vbe"         Load  "dri"         Load  "glx"         Load  "synaptics"     EndSection          Section "ServerFlags"         Option      "AllowMouseOpenFail" "true"     EndSection          Section "Monitor"         Identifier   "Generic Monitor"         HorizSync    28.0 - 80.0         VertRefresh  43.0 - 60.0     EndSection          Section "Monitor"         Identifier   "0-DFP2"         Option      "VendorName" "ATI Proprietary Driver"         Option      "ModelName" "Generic Autodetecting Monitor"         Option      "DPMS" "true"         Option      "PreferredMode" "1920x1080"         Option      "TargetRefresh" "60"         Option      "Position" "0 0"         Option      "Rotate" "normal"         Option      "Disable" "false"     EndSection          Section "Monitor"         Identifier   "0-CRT2"         Option      "VendorName" "ATI Proprietary Driver"         Option      "ModelName" "Generic Autodetecting Monitor"         Option      "DPMS" "true"         Option      "PreferredMode" "1280x1024"         Option      "TargetRefresh" "60"         Option      "Position" "1920 0"         Option      "Rotate" "normal"         Option      "Disable" "false"     EndSection          Section "Device"              #BusID    "PCI:01:00"         #Option "RenderAccel" "on"         #Option "XAANoOffscreenPixmaps"         #Option "BusType" "PCI"         #Option "ColorTiling" "on"         #Option "EnablePageFlip" "on"         # UseEvents is causing segmentation faults with         # NVIDIA 6xxx, 7xxx and >=275.xx.xx drivers         #Option "UseEvents" "True"         Identifier  "SabayonVga0"         Driver      "fglrx"         Option      "LogoPath" "/usr/share/backgrounds/sabayonlinux-nvidia.png"     EndSection          Section "Device"         Identifier  "amdcccle-Device[1]-0"         Driver      "fglrx"         Option      "Monitor-DFP2" "0-DFP2"         Option      "Monitor-CRT2" "0-CRT2"         BusID       "PCI:1:0:0"     EndSection          Section "Screen"              #Option       "AddARGBGLXVisuals" "true"         #Option       "RegistryDwords" "EnableBrightnessControl=1"         Identifier "Screen 0"         Device     "SabayonVga0"         Monitor    "Generic Monitor"         DefaultDepth     24         SubSection "Display"                  #Modes      "1024x768" "800x600" "640x480"             Viewport   0 0             Depth     8         EndSubSection         SubSection "Display"                  #Modes      "1024x768" "800x600" "640x480"             Viewport   0 0             Depth     16         EndSubSection         SubSection "Display"                  #Modes      "1024x768" "800x600" "640x480"             Viewport   0 0             Depth     24         EndSubSection     EndSection          Section "Screen"         Identifier "amdcccle-Screen[1]-0"         Device     "amdcccle-Device[1]-0"         DefaultDepth     24         SubSection "Display"             Viewport   0 0             Depth     24         EndSubSection     EndSection          Section "DRI"         Mode         0666     EndSection      Thank you very much for helping me out with this problem! PS: This is my first question here. Please feel free to suggest changes if my question could be optimized! Thanks! :)