title: Strange terminal behavior: 'j' key not working in urxvt

text: For some bizarre reason my 'j' key stopped working properly. Every time I hit the key, it prints "true". If I type 'jake', the terminal prints:                >>trueake      I don't know what lead to this. I guess it was after I installed something. I've tried rebooting, and did not work. How can I fix this? CTRL-j also prints 'true'. SHIFT-j works fine. Xterm works fine. I'm currently using OpenBSD 4.9.


title: Restrict usage of the same password during a time period

text: I need to configure a server with some requisites on the password changing: in addition to other requisites, I need to ensure that, on a password change, it is not repeated (last 5 passwords) and during 180 days. The first part (5 last passwords) can be easy done using `pam_pwcheck remember=5` option, but I don't know how to ensure the 180-days requisite. Any idea?


title: Booting a file system image from a HDD using GRUB2 with persistence

text: How do I preserve changes I make to files when running an operating system that is booted - using GRUB2 - from a file that contains a file system. I managed to get GRUB2 to boot an image file that resides on a HDD. So far so good, very useful for booting into FreeDOS for various non-Linux utilites. What I wish is that if I create a file - or change it - in this running OS, that it is written back to the image file, so that the next time I boot this image file, I can pick up where I left off, instead of starting over again with the same image that was booted the first time.


title: How to check if a currently running process is opened by root or user

text: I'm currently creating a BASH script to kill off processes. I first check if the process is running then kill it. But I would like to add a nested `if` to find out if that process was opened by root (not to the current script).


title: variable name lost when tab completing to export an environment variable with a path

text: I'm trying to setup an environment variable using tab completion, e.g.               snowch$ export JAVA_HOME=/usr/lib/jvm/java-6-oracle/      I used to be able to tab complete the folders after typing the `export JAVA_HOME=` part however, when I try pressing tab I lose the variable name:               export JAVA_HOME=/u[tab]      turns to:               export /usr/      How do I fix this? I am running Ubuntu 13.04. **EDIT** \- Debug output as requested in comments               $ bash --norc     bash-4.2$ . /etc/bash_completion     bash-4.2$ set -x     bash-4.2$ export JAVA_HOME=/u+ local compdir=./completions     + [[ /usr/share/bash-completion/bash_completion == */* ]]     + compdir=/usr/share/bash-completion/completions     + . /usr/share/bash-completion/completions/export     + return 124     + local cur prev words cword     + _init_completion -n =     + local exclude= flag outx errx inx OPTIND=1     + getopts n:e:o:i:s flag -n =     + case $flag in     + exclude+==     + getopts n:e:o:i:s flag -n =     + COMPREPLY=()     + local 'redir=@(?([0-9])<|?([0-9&])>?(>)|>&)'     + _get_comp_words_by_ref -n '=<>&' cur prev words cword     + local exclude flag i OPTIND=1     + words=()     + local cur cword words     + upargs=()     + upvars=()     + local upargs upvars vcur vcword vprev vwords     + getopts c:i:n:p:w: flag -n '=<>&' cur prev words cword     + case $flag in     + exclude='=<>&'     + getopts c:i:n:p:w: flag -n '=<>&' cur prev words cword     + [[ 6 -ge 3 ]]     + case ${!OPTIND} in     + vcur=cur     + let 'OPTIND += 1'     + [[ 6 -ge 4 ]]     + case ${!OPTIND} in     + vprev=prev     + let 'OPTIND += 1'     + [[ 6 -ge 5 ]]     + case ${!OPTIND} in     + vwords=words     + let 'OPTIND += 1'     + [[ 6 -ge 6 ]]     + case ${!OPTIND} in     + vcword=cword     + let 'OPTIND += 1'     + [[ 6 -ge 7 ]]     + __get_cword_at_cursor_by_ref '=<>&' words cword cur     + words=()     + local cword words     + __reassemble_comp_words_by_ref '=<>&' words cword     + local exclude i j line ref     + [[ -n =<>& ]]     + exclude='<>&'     + eval cword=1     ++ cword=1     + [[ -n <>& ]]     + line='export JAVA_HOME=/u'     + (( i=0, j=0 ))     + (( i < 2 ))     + [[ 0 -gt 0 ]]     + ref='words[0]'     + eval 'words[0]=${!ref}${COMP_WORDS[i]}'     ++ words[0]=export     + line=' JAVA_HOME=/u'     + [[ 0 == 1 ]]     + (( i++, j++ ))     + (( i < 2 ))     + [[ 1 -gt 0 ]]     + [[ JAVA_HOME=/u == +([<>&]) ]]     + ref='words[1]'     + eval 'words[1]=${!ref}${COMP_WORDS[i]}'     ++ words[1]=JAVA_HOME=/u     + line=     + [[ 1 == 1 ]]     + eval cword=1     ++ cword=1     + (( i++, j++ ))     + (( i < 2 ))     + local i cur index=19 'lead=export JAVA_HOME=/u'     + [[ 19 -gt 0 ]]     + [[ -n export JAVA_HOME=/u ]]     + [[ -n exportJAVA_HOME=/u ]]     + cur='export JAVA_HOME=/u'     + (( i = 0 ))     + (( i <= cword ))     + [[ 19 -ge 6 ]]     + [[ export != \e\x\p\o\r\t ]]     + [[ 0 -lt 1 ]]     + local old_size=19     + cur=' JAVA_HOME=/u'     + local new_size=13     + index=13     + (( ++i  ))     + (( i <= cword ))     + [[ 13 -ge 12 ]]     + [[  JAVA_HOME=/ != \J\A\V\A\_\H\O\M\E\=\/\u ]]     + cur=JAVA_HOME=/u     + (( index-- ))     + [[ 12 -ge 12 ]]     + [[ JAVA_HOME=/u != \J\A\V\A\_\H\O\M\E\=\/\u ]]     + [[ 1 -lt 1 ]]     + (( ++i  ))     + (( i <= cword ))     + [[ -n JAVA_HOME=/u ]]     + [[ ! -n JAVA_HOME=/u ]]     + [[ 12 -lt 0 ]]     + local words cword cur     + _upvars -a2 words export JAVA_HOME=/u -v cword 1 -v cur JAVA_HOME=/u     + ((  10  ))     + ((  10  ))     + case $1 in     + [[ -n 2 ]]     + printf %d 2     + [[ -n words ]]     + unset -v words     + eval 'words=("${@:3:2}")'     ++ words=("${@:3:2}")     + shift 4     + ((  6  ))     + case $1 in     + [[ -n cword ]]     + unset -v cword     + eval 'cword="$3"'     ++ cword=1     + shift 3     + ((  3  ))     + case $1 in     + [[ -n cur ]]     + unset -v cur     + eval 'cur="$3"'     ++ cur=JAVA_HOME=/u     + shift 3     + ((  0  ))     + [[ -n cur ]]     + upvars+=("$vcur")     + upargs+=(-v $vcur "$cur")     + [[ -n cword ]]     + upvars+=("$vcword")     + upargs+=(-v $vcword "$cword")     + [[ -n prev ]]     + [[ 1 -ge 1 ]]     + upvars+=("$vprev")     + upargs+=(-v $vprev "${words[cword - 1]}")     + [[ -n words ]]     + upvars+=("$vwords")     + upargs+=(-a${#words[@]} $vwords "${words[@]}")     + ((  4  ))     + local cur cword prev words     + _upvars -v cur JAVA_HOME=/u -v cword 1 -v prev export -a2 words export JAVA_HOME=/u     + ((  13  ))     + ((  13  ))     + case $1 in     + [[ -n cur ]]     + unset -v cur     + eval 'cur="$3"'     ++ cur=JAVA_HOME=/u     + shift 3     + ((  10  ))     + case $1 in     + [[ -n cword ]]     + unset -v cword     + eval 'cword="$3"'     ++ cword=1     + shift 3     + ((  7  ))     + case $1 in     + [[ -n prev ]]     + unset -v prev     + eval 'prev="$3"'     ++ prev=export     + shift 3     + ((  4  ))     + case $1 in     + [[ -n 2 ]]     + printf %d 2     + [[ -n words ]]     + unset -v words     + eval 'words=("${@:3:2}")'     ++ words=("${@:3:2}")     + shift 4     + ((  0  ))     + _variables     + [[ JAVA_HOME=/u =~ ^(\$\{?)([A-Za-z0-9_]*)$ ]]     + return 1     + [[ JAVA_HOME=/u == @(?([0-9])<|?([0-9&])>?(>)|>&)* ]]     + [[ export == @(?([0-9])<|?([0-9&])>?(>)|>&) ]]     + local i skip     + (( i=1 ))     + (( i < 2 ))     + [[ JAVA_HOME=/u == @(?([0-9])<|?([0-9&])>?(>)|>&)* ]]     + i=2     + (( 1 ))     + (( i < 2 ))     + [[ 1 -eq 0 ]]     + prev=export     + [[ -n '' ]]     + return 0     + local i action=variable remove=false     + (( i=1 ))     + (( i < cword ))     + [[ JAVA_HOME=/u == *=\$* ]]     + case $cur in     + cur=/u     + _filedir     + local i 'IFS=     ' xspec     + _tilde /u     + local result=0     + [[ /u == \~* ]]     + return 0     + local -a toks     + local quoted x tmp     + _quote_readline_by_ref /u quoted     + [[ /u == \'* ]]     + printf -v quoted %q /u     + [[ /u == \$* ]]     ++ compgen -d -- /u     + x=/usr     + read -r tmp     + toks+=("$tmp")     + read -r tmp     + [[ '' != -d ]]     + xspec=     ++ compgen -f -X '' -- /u     + x=/usr     + read -r tmp     + toks+=("$tmp")     + read -r tmp     + [[ -n '' ]]     + [[ 2 -ne 0 ]]     + compopt -o filenames     + COMPREPLY+=("${toks[@]}")     /usr/


title: Regex & Sed/Perl: Match word that ISN'T preceded by another word

text: I'd like to use `sed` or `perl` to replace all occurrences of a word that doesn't have a certain word in front of it. For example, I have a text file that contains a plot of a movie and I want to replace all occurrences of a character's last name with their first name, but only if their first name doesn't come immediately before their last name. Sample text might look like this:               John Smith and Jane Johnson talk about Smith's car.      I want it to look like this:               John Smith and Jane Johnson talk about John's car.      If I just do `sed 's/Smith/John/' file`, then I would have:               John John and Jane Johnson talk about John's car.      The first name that comes before the last name will always be the same. I don't have to deal with `John Smith` and `Frank Smith`. I just need a way to match `Smith` that doesn't have `John` preceding it.


title: Global keyboard shortcut (inittab?)

text: Is it possible to create a keyboard shortcut that will run:               shutdown -h now      When I press `Ctrl` \+ `9`, for example.


title: Finding files that use the most disk space

text: Is it possible to list the largest files on my hard drive? I frequently use `df -H` to display my disk usage, but this only gives the percentage full, GBs remaining, etc. I do a lot of data-intensive calculations, with a large number of small files and a very small number of very large files. Since most of my disk space used is in a very small number of files, it can be difficult to track down where these large files are. Deleting a 1 kB file does not free much space, but deleting a 100 GB file does. Is there any way to sort the files on the hard drive in terms of their size? Thanks.


title: PulseAudio cannot open shared library

text: I'm running Debian wheezy (x86) with GNOME on a Intel Core i7 machine. I'm having problems getting PulseAudio to work properly. Since GNOME 3 automatically installs PulseAudio I'm pretty much stuck with it. When running ALSA mixer from the console, I get the following error message:               ALSA lib conf.c:3314:(snd_config_hooks_call) Cannot open shared library libasound_module_conf_pulse.so     ALSA lib control.c:951:(snd_ctl_open_noupdate) Invalid CTL default     cannot open mixer: No such file or directory      The shared library does in fact exist ( **/usr/lib/i386-linux-gnu/alsa- lib/libasound_module_conf_pulse.so** ). I've done extensive googling on the issue and came up with no solution that actually works. One of the suggestions was to place the file in an alternative location, but this made no difference. In addition, many programs that actually attempt to use PulseAudio fail to start. Another error message I've seen is:               mybox:/# pulseaudio     pulseaudio: symbol lookup error: /usr/lib/i386-linux-gnu/libsndfile.so.1: undefined symbol: vorbis_version_string      ALSA works just fine, but I actually have to deinstall PulseAudio before I can use the mixer to set the volume, after which I can reinstall it. Then, some software that I can force to use ALSA (like XBMC) will work. The system contains both onboard Intel audio and nVidia HDMI sound drivers. I'm mostly interested in sound over HDMI right now if that matters:               mybox:/# aplay -L     null         Discard all samples (playback) or generate zero samples (capture)     pulse         PulseAudio Sound Server     default:CARD=Intel         HDA Intel, ALC887 Analog         Default Audio Device     sysdefault:CARD=Intel         HDA Intel, ALC887 Analog         Default Audio Device     front:CARD=Intel,DEV=0         HDA Intel, ALC887 Analog         Front speakers     surround40:CARD=Intel,DEV=0         HDA Intel, ALC887 Analog         4.0 Surround output to Front and Rear speakers     surround41:CARD=Intel,DEV=0         HDA Intel, ALC887 Analog         4.1 Surround output to Front, Rear and Subwoofer speakers     surround50:CARD=Intel,DEV=0         HDA Intel, ALC887 Analog         5.0 Surround output to Front, Center and Rear speakers     surround51:CARD=Intel,DEV=0         HDA Intel, ALC887 Analog         5.1 Surround output to Front, Center, Rear and Subwoofer speakers     surround71:CARD=Intel,DEV=0         HDA Intel, ALC887 Analog         7.1 Surround output to Front, Center, Side, Rear and Woofer speakers     iec958:CARD=Intel,DEV=0         HDA Intel, ALC887 Digital         IEC958 (S/PDIF) Digital Audio Output     hdmi:CARD=NVidia,DEV=0         HDA NVidia, HDMI 0         HDMI Audio Output     hdmi:CARD=NVidia,DEV=1         HDA NVidia, HDMI 0         HDMI Audio Output     hdmi:CARD=NVidia,DEV=2         HDA NVidia, HDMI 0         HDMI Audio Output     hdmi:CARD=NVidia,DEV=3         HDA NVidia, HDMI 0         HDMI Audio Output      I'm now completely at a loss what is wrong with my system. I haven't even messed with any of the settings yet, but I tried purging all the configuration and reinstalling just to be sure. To me, these error messages look like the packages are broken, but it's been like this for weeks now and several new package versions have been released in the meantime.Does anyone have an idea what's wrong? **Edit:** Some extra information requested by Jan Marek:               mybox:~# ldconfig -v | grep libasound     ldconfig: Can't stat /lib/i486-linux-gnu: No such file or directory     ldconfig: Can't stat /usr/lib/i486-linux-gnu: No such file or directory     ldconfig: Path `/lib/i386-linux-gnu' given more than once     ldconfig: Path `/usr/lib/i386-linux-gnu' given more than once             libasound.so.2 -> libasound.so.2.0.0      It appears `libasound_module_conf_pulse.so` is not listed, even though the path /usr/lib/i386-linux-gnu` is searched. More than once even, apparently? I'm not sure why that is, here is the relevant configuration:               ## /etc/ld.so.conf:          /usr/X11R6/lib          include /etc/ld.so.conf.d/*.conf          ## /etc/ld.so.conf.d/i486-linux-gnu.conf:          # Multiarch support     /lib/i386-linux-gnu     /usr/lib/i386-linux-gnu     /lib/i486-linux-gnu     /usr/lib/i486-linux-gnu          ## /etc/ld.so.conf.d/libc.conf          # libc default configuration     /usr/local/lib      As for the strace, I'm not entirely sure what it's trying to tell me.               11655 open("/usr/lib/i386-linux-gnu/alsa-lib/libasound_module_conf_pulse.so", O_RDONLY) = 3     11655 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0000\7\0\0004\0\0\0"..., 512) = 512     11655 fstat64(3, {st_mode=S_IFREG|0644, st_size=4168, ...}) = 0     11655 mmap2(NULL, 7028, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7785000     11655 mmap2(0xb7786000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0) = 0xb7786000     11655 close(3) = 0      I think that means that opening the file was successful, it read 512 bytes and then decided to close the file? I've added `/usr/lib/i386-linux-gnu/alsa-lib` to ld.so.conf which changes the behavior when I start alsamixer. With that line I get a segmentation fault instead. During the boot sequence I also used to get a bunch of these pulseaudio errors, so I will try rebooting when I get home (`service alsasound restart` had no effect)


title: Isolating cause of higher CPU usage on RHEL 6 vs RHEL 5

text: I'm currently looking to move our system from RHEL 5 to RHEL 6, but I've run into a snag with unexpectedly high CPU usage on the RHEL 6 machines. It appears that this may be due at least in some part to the use of `select` to do an interruptible sleep. Here's a simple example that shows the behaviour:               #include <sys/select.h>          int main()     {       timeval ts;       for (unsigned int ii=0; ii<10000; ++ii) {         ts.tv_sec = 0;         ts.tv_usec = 1000;         select(0, 0, 0, 0, &ts);       }            return 0;     }      On a RHEL 5 machine it will stay at 0% CPU usage, but on the same hardware with RHEL 6 installed it will use about 0.5% of the CPU, so when 30 to 50 programs are running using `select` to perform a sleep it eats up a large amount of the CPU unnecessarily. I opened a Bugzilla and I tried running OProfile and it simply shows 100% in main for the application and just over 99% in poll_idle when looking at the kernel (I have idle=poll set in my grub options so everything can be captured). Any other ideas of what I can do to try and isolate what the cause of the higher CPU usage is? UPDATE: I found the perf tool and got the following output:               # Events: 23K cycles     #     # Overhead  Command        Shared Object                                Symbol     # ........  .......  ...................  ....................................     #         13.11%  test_select_sma  [kernel.kallsyms]    [k] find_busiest_group          5.88%  test_select_sma  [kernel.kallsyms]    [k] schedule          5.00%  test_select_sma  [kernel.kallsyms]    [k] system_call          3.77%  test_select_sma  [kernel.kallsyms]    [k] copy_to_user          3.39%  test_select_sma  [kernel.kallsyms]    [k] update_curr          3.22%  test_select_sma  ld-2.12.so           [.] _dl_sysinfo_int80          2.83%  test_select_sma  [kernel.kallsyms]    [k] native_sched_clock          2.72%  test_select_sma  [kernel.kallsyms]    [k] find_next_bit          2.69%  test_select_sma  [kernel.kallsyms]    [k] cpumask_next_and          2.58%  test_select_sma  [kernel.kallsyms]    [k] native_write_msr_safe          2.47%  test_select_sma  [kernel.kallsyms]    [k] sched_clock_local          2.39%  test_select_sma  [kernel.kallsyms]    [k] read_tsc          2.26%  test_select_sma  [kernel.kallsyms]    [k] do_select          2.13%  test_select_sma  [kernel.kallsyms]    [k] restore_nocheck      It appears that the higher CPU usage is from the scheduler. I also used the following bash script to kick off 100 of these simultaneously:               #!/bin/bash          for i in {1..100}     do       ./test_select_small &     done      On RHEL 5 the CPU usage stays close to 0%, but on RHEL 6 there's a non-trivial amount of CPU usage in both user and sys. Any ideas on how to track down the true source of this and hopefully fix it? I also tried this test on a current Arch Linux build and Ubuntu 11.10 and saw similar behaviour, so this appears to be some type of kernel issue and not just a RHEL issue. UPDATE2: I hesitate a bit to bring this up because I know that it's a huge debate, but I tried out a kernel with the BFS patches on Ubuntu 11.10 and it didn't show the same high system CPU usage (user cpu usage seemed about the same). Is there some test I can run with each of them to test if this high CPU usage is just a difference in accounting of CPU usage that is making it look artificially high? Or if actual CPU cycles are being stolen by the CFS? UPDATE3: The analysis done involving this question seems to indicate that it's something related to the scheduler, so I created a new question to discuss the results. UPDATE4: I added some more information to the other question. UPDATE5: I added some results to the other question from a simpler test that still demonstrates the issue.


title: Is it possible to "partially" connect to a VPN

text: My university offers a remote access VPN to access paywalled journals, which I often want to use. However they require using the Cisco AnyConnect protocol. This is a bit annoying because it effectively disconnects and reconnects every connection I have and routes it through the university server. Is it possible to somehow connect to the VPN in a way where I can define that just the browser will go through the VPN, rather than everything? For example some tunneling trick which will allow me to run a proxy server and connect to it from my browser. (My Linux is Arch Linux on x86_64, if that matters somehow.)


title: I deleted /etc/alternatives/java

text: I'm on Ubuntu 12.04 on a 32-bits Dell machine. I was trying to install java JDK for 32-bits linux platform and I accidentally deleted the file /etc/alternatives/java. I would love to recreate my old good file in order to build the link with /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java OR with /usr/lib/jvm/jdk1.7.0_45/jre/bin/java I don't really which one I have to build, but to try I need my alternative executable.


title: How can a normal user trigger a root cron task to execute immediately, without delay?

text: I have a root cron task that runs every day. But I want to allow normal users to request that it run immediately, if they so wish. It is a harmless process and it can run as often as needed and these normal users are actually trusted users. But I don't want to give these normal users any special permissions. Can I allow a normal user to trigger the cron task to run immediately? If so, how? The user will be doing this via a Java app, so I'll probably be using Java's ProcessBuilder. ProcessBuilder (Java 2 Platform SE 5.0)   http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/ProcessBuilder.html I would be great if you can provide a solution with Java ProcessBuilder example code.


title: dovecot. Can't allocate memory, but free -m show available memory

text: I trying to send mail with PHP (engine - Drupal). But it can't send mail and write message about it in to log (nothing more that adressed). Part of `/var/log/mail.err` :               Feb 14 19:55:30 hivede13-3220 dovecot: master: Error: service(auth): fork() failed: Cannot allocate memory     Feb 14 19:55:30 hivede13-3220 dovecot: master: Error: service(auth): command startup failed, throttling     Feb 15 17:14:30 hivede13-3220 dovecot: master: Error: service(imap-login): fork() failed: Cannot allocate memory     Feb 15 17:14:30 hivede13-3220 dovecot: master: Error: service(imap-login): command startup failed, throttling      But `free -m` command after sending show next                            total       used       free     shared    buffers     cached\                  Mem:          1400       1011        388          0          0                           0                  -/+ buffers/cache:       1011        388                  Swap:            0          0          0      It's meant that 388m free for usage in applications, right? If yes - how can I improve situation? UPD. `top -b -n 1 | grep dovecot` output               1689 root      16   0 21244  912  644 S  0.0  0.1   0:00.00 dovecot     1690 dovecot   18   0 12780 1024  844 S  0.0  0.1   0:00.00 anvil                    Dovecot process id - 1689, `cat /proc/1689/limits` output               Limit                     Soft Limit           Hard Limit           Units          Max cpu time              unlimited            unlimited            seconds        Max file size             unlimited            unlimited            bytes          Max data size             unlimited            unlimited            bytes          Max stack size            10485760             unlimited            bytes          Max core file size        0                    unlimited            bytes          Max resident set          unlimited            unlimited            bytes          Max processes             771811               771811               processes      Max open files            1024                 1024                 files          Max locked memory         32768                32768                bytes          Max address space         unlimited            unlimited            bytes          Max file locks            unlimited            unlimited            locks          Max pending signals       771811               771811               signals        Max msgqueue size         819200               819200               bytes          Max nice priority         0                    0                         Max realtime priority     0                    0


title: Kate has no window borders, and thus no minimize, maximize, and close buttons

text: ### I usually use kate as my preferred text editor, however, whenever I open it there are no window borders, and thus no maximize, minimize, and close buttons. How can I fix this? I tried going thought the view menu, but was unable to find any settings to alter this. Moreover, it seems to be stuck in "always on top mode" and thus I cannot view my panel to use right click to close or modify it. Pressing `F11` produces no change. There is a scroll bar, but it doesn't appear to be controlled by the window manager (kwin) as it is much wider than normal and has a mini preview of the entire document as its background. I'd prefer not to override this feature if possible. I have an almost default install of Linux Mint KDE 16 x64. Related: How do I exit full screen after enabling via the right click context menu of kwin (KDE)?


title: Can we separate commands in LFS?

text: I am trying to build a Linux by using Linux from scratch tutorial ,but i can't explain this,when i run multiple command as this step describe:               CC=$LFS_TGT-gcc                \     AR=$LFS_TGT-ar                 \     RANLIB=$LFS_TGT-ranlib         \     ../binutils-2.24/configure     \         --prefix=/tools            \         --disable-nls              \         --with-lib-path=/tools/lib \         --with-sysroot      I get errors like :               configure: error: cannot run C compiled programs.      But when i separate this part:               CC=$LFS_TGT-gcc                \     AR=$LFS_TGT-ar                 \     RANLIB=$LFS_TGT-ranlib         \       from this part:               ../binutils-2.24/configure     \         --prefix=/tools            \         --disable-nls              \         --with-lib-path=/tools/lib \         --with-sysroot      And run them in two sequential sequence,it goes good,without error.as i know first part define some system variable and second part configure the program,but i don't realize why the combination give me an error? and is it okey to run them separately?


title: Two find commands comparison

text: Recently I received this `find` one-liner, but I'm not able to explain where the difference of the below two comes from: ### Example 1               [root@centos share]# find . -exec grep -i "madis" {} /dev/null \;          ./names:Madison Randy:300:Product Development      ### Example 2               [root@centos share]# find . -exec grep -i "madis" {} \;          Madison Randy:300:Product Development      As you can see, in the first one there is the specific file this string derives from and so far I'm really not able to find out why this is happening.


title: What's wrong with this sed expression?

text: $ echo "104_Fri" | sed 's/^\([0-9]+\)_\([A-Za-z]+\)$/\1;\2/'     104_Fri      I would like to match the digits at the beginning and the letters at the end - each as a group. Afterwards I want to output the first group, a semicolon and then the second group. I would expect this expression to yield:               104;Fri      Why does this not work?


title: CentOS 5 hplip newer version

text: I am attempting to install a newer version of HPLIP on a CentOS 5 server to all support for a newer printer. However I have been unable to do this so far. I found there was an updated package on repoforge found here http://pkgs.repoforge.org/hplip/. So I installed repoforge and attempted to install. When I tried using yum to install it simply states the latest version of hplip was already installed. Any ideas why I cannot install the repoforge version of hplip? Or does anyone know of a good way to install the newer hplip?. I have also tried to auto install .run file from the official site this locks up my ssh session and the .rpm file has dependency issues.


title: How can I test if a variable is empty or contains only spaces?

text: The following bash syntax verifies if `param` isn't empty:                [[ !  -z  $param  ]]      For example:               param=""     [[ !  -z  $param  ]] && echo "I am not zero"      No output and its fine. But when `param` is empty except for one (or more) space characters, then the case is different:               param=" " # one space     [[ !  -z  $param  ]] && echo "I am not zero"      "I am not zero" is output. How can I change the test to consider variables that contain only space characters as empty?


title: Is using shorthand quick substitution of history expansion problematic?

text: In my terminal (bash 3), I sometimes use the quick substitution               ^aa^bb^      > `^string1^string2^` >   >   >              Quick substitution.  Repeat the last command, replacing string1 > with string2.  Equivalent to `!!:s/string1/string2/` (see Modifiers below). >   For example               $ echo aa aa     aa aa     $ ^aa^bb^     echo bb aa     bb aa      Which is really handy in some cases. However, I found out that omitting the last `^` also works, i.e.               $ echo aa aa     aa aa     $ ^aa^bb     echo bb aa     bb aa      My question is: what is the consequence of omitting the closing `^`? Can I safely leave it out or are there any caveats?


title: Why does creating a ZPool result in this error?

text: When I try to create a ZPool, the following error occurs:               user@arch ~ % sudo zpool create -f -o ashift=12 -m /data media raidz /dev/disk/by-id/ata-ST2000DM001-1CH164_Z2F0TL8V /dev/disk/by-id/ata-ST2000DM001-1ER164_Z4Z030LK /dev/disk/by-id/ata-ST2000DM001-1ER164_Z4Z06PR     the kernel failed to rescan the partition table: 16       cannot label 'sda': try using parted(8) and then provide a specific slice: -1      I have tried running the command multiple times back to back (running `udevadm trigger` in between too), clearing the drives using `sgdisk -Z /dev/sdX`. I tried `parted /dev/sdX mklabel gpt` as well as `zpool labelclear /dev/sdX`. I have referred to the drives by `/dev/disk/by-id` as well as `/dev/sdX` but the same error occurs where the label changes depending on the order of the drives.


title: greedy and lazy regular expressions (comprehension question)

text: I am teaching myself regular expressions, and I got stuck at »greedy« vs. »lazy« repeatings. What I found out so far is that   * »greedy« means that the RegExp looks for as many matches as possible, where   * »lazy« means that the RegExp looks for as little matches as possible Most articles I found deal with a) using it in a programming language, while I am stuck here with `grep` and `egrep` or b) use `grep -P` to activate `Perl Mode`; but as I don't have any knowledge about Perl yet this isn't very helpful for me. **My comprehension question** : I came to this sledgehammer method:   * lazy repetitions will look for the shortest possible match   * if results are too long -> tone down the repeater with `?`   * if results are still too long -> look for another solution This is what I was able to figure out through examples and experiments with HTML code where I got to some but not overwhelming results. I would be grateful if somebody could tell me if and where I missed some important points with my summary.


title: Strange icon behaviour with Kubuntu

text: Since a couple of days I started having a strange behaviour from Kubuntu, apparently it does not properly apply the icon set that I have chosen. My favourite set is KFaenza, and I've used it since a lot of time. All of a sudden, some of them are not displayed correctly, and the system falls back to the default Oxygen theme for those particular icons. As an example, I'm posting a screenshot from Kate: ![enter image description here](http://i.stack.imgur.com/DCkWn.png) As you can see the icons for "New", "Open", "Save" and some others are not from Kfaenza icon set but from Oxygen. I've tried to reinstall the icon set to rule out any accidental file deletion/corruption or bad configuration, but it didn't solve anything. As you can see from the following screens, the correct icons are present in their directory, but for some strange reason they are not used. ![enter image description here](http://i.stack.imgur.com/Bpixy.png) ![enter image description here](http://i.stack.imgur.com/7bR0I.png) What went wrong? How can I restore the icons to their set defaults?


title: Secure the content of a hard disk

text: I have to prepare a computer to give away, and I do not know who is going to use it. The computer has Debian installed, and the HDD is entirely encrypted. All users have their storage on the server. I have been believing that if it meet some conditions below this will safe huge works for all computer departments:   1. Anyone can power on/off computer as they wish    2. Only permitted users can use installed applications    3. Permitted Users can not view any configuration files, modify, store data and copy the HDD content even when they remove it to another computer   4. The HDD only works with the given computer. When it stolen or tap, it is automatic destroy all data inside. How can I go about doing that?


title: Excluding a directory name in a zsh recursive glob

text: I'm running zsh on Linux under `setopt extended_glob ksh_glob glob_dots`. I'm looking for something easy to type on the command line, with no portability requirements. I'm looking at a source code tree, with no “weird” file names (e.g. no `\` in file names, no file name beginning with `-`). Either of the following commands print the list of subdirectories of the current directory recursively:               find -type d     print -l **/*/      This is actually an svn checkout:               $ find -type d     ./.deps     ./.svn     ./.svn/text-base     ./.svn/prop-base     ./.svn/tmp     ./.svn/tmp/text-base     ./.svn/tmp/prop-base     ./.svn/tmp/props     ./.svn/props     ./lib/.svn     ./lib/.svn/text-base     ./lib/.svn/prop-base     ./lib/.svn/tmp     ./lib/.svn/tmp/text-base     ./lib/.svn/tmp/prop-base     ./lib/.svn/tmp/props     ./src/.svn     ./src/.svn/text-base     ./src/.svn/prop-base     ./src/.svn/tmp     ./src/.svn/tmp/text-base     ./src/.svn/tmp/prop-base     ./src/.svn/tmp/props      I want to exclude the `.svn` directories and their subdirectories which are present in every directory. It's easy with `find`:               find -type d -name .svn -prune -o -print      Can I do this with a short zsh glob? Ignoring dot files comes close (I need to do it explicitly because I have `glob_dots` set):               print -l **/*(/^D)      But this isn't satisfactory because it hides the `.deps` directory, which I do want to see. I can filter out the paths containing `.svn`:               print -l **/*~(*/|).svn(|/*)(/)      But that's barely shorter than `find` (so what am I using zsh for?). I can shorten it to `print -l **/*~*.svn*(/)`, but that also filters out directories called `hello.svn`. Furthermore, zsh traverses the `.svn` directories, which is a bit slow on NFS or Cygwin. Is there a convenient (as in easy to type) way to exclude a specific directory name (or even better: an arbitrary pattern) in a recursive glob?


title: Open a text file and let it update itself

text: How can I open a text file and let it update itself? Similar to the way `top` works. I want to open a log file and watch it update itself on the fly. I have just tried:               $ tail error.log      But just realised, that it just shows you the lines in the log file. I am using RHEL 5.10


title: How to re-run vim auto-indentation on a tex file?

text: I have a LaTeX source file with its indentation messed up. I am looking for a way to force vim (may be through one of `vim-latex-suite` commands) to **re- run** the automatic indentation commands over the whole file once again. I can easily get rid of the messed up indentation by eating up all the white spaces in the beginning of each line with a simple regex `:%s/^\s\+//`. My problem is how to re-run the automatic indentation commands over the whole file. ( I am basically looking for something like the `smart indent` in MATLAB Editor or some other text editor, which can re-indent already existing text).


title: Pantheon lost keyboard configurations

text: I install Pantheon yesterday and now every time `startx` my keyboard configurations back to `us`, but the correctly is `br+abnt2`. So I need to run in terminal (after `startx`) the command:               setxkbmap -layout br -variant abnt2      How can I fix that? I try put this settings all this files, but doesn't work:               Section "InputClass"        Identifier "evdev keyboard catchall"        MatchIsKeyboard "on"        MatchDevicePath "/dev/input/event*"        Driver "evdev"        Option "XkbLayout" "br"        Option "XkbVariant" "abnt2"     EndSection          ➜  xorg.conf.d  ls -l     total 28     -rw-r--r-- 1 root root  241 Jul  9 19:50 00-keyboard.conf     -rw-r--r-- 1 root root 1167 Jul  9 19:39 10-evdev.conf     -rw-r--r-- 1 root root  241 Jul  9 19:43 10-keyboard.conf     -rw-r--r-- 1 root root  377 Jun 27 16:33 10-quirks.conf     -rw-r--r-- 1 root root  142 Dec 28  2013 50-joystick.conf     -rw-r--r-- 1 root root 1847 May 13 16:16 50-synaptics.conf     -rw-r--r-- 1 root root  115 Dec 28  2013 50-vmmouse.conf


title: vim: hide first n letters of all lines in a file

text: I am analyzing log file using vim and the format looks like this `YYYY-MM-DD HH:MM:SS.USEC PID Name LogText` Since Most of the times I don't care about date and time. I want to hide them and just focus on the Name and LogText columns (To save some screen estate). Since the first three columns always occupy the first 35 letters in a line. Is there a way to make vim not display first 35 letters of each line ?


title: apparmor and Firefox

text: I am currently re-setting up the `apparmor` profile for `Firefox 19.0.2` on `Ubuntu 12.04` and I am slightly confused. I must of had `Firefox 7.01` last time I used this and if I do `apparmor_status` then regarding firefox I get               ..profiles are in enforce mode.     /usr/lib/firefox/firefox{,*[^s][^h]}//browser_java     /usr/lib/firefox/firefox{,*[^s][^h]}//browser_openjdk     /usr/lib/firefox/firefox{,*[^s][^h]}//sanitized_helper     ..profiles are in complain mode     /usr/lib/firefox-7.0.1/firefox.sh     /usr/lib/firefox/firefox{,*[^s][^h]}     /usr/lib/firefox/firefox{,*[^s][^h]}//null-34     /usr/lib/firefox/firefox{,*[^s][^h]}//null-34//null-35     ..processes are in complain mode.     /usr/lib/firefox/firefox{,*[^s][^h]} (3818)      /usr/lib/firefox/firefox{,*[^s][^h]} (17960)      /usr/lib/firefox/firefox{,*[^s][^h]} (21817)      /usr/lib/firefox/firefox{,*[^s][^h]}//null-34 (3819)      /usr/lib/firefox/firefox{,*[^s][^h]}//null-34//null-35 (3823)       Now in the dir `/etc/apparmor.d/` the profiles I have in relation to firefox are `usr.bin.firefox` and `usr.lib.firefox-7.0.1.firefox.sh`. Regarding the location of the firefox exec itself on my system - `/usr/bin/firefox` is a sym link to `/usr/lib/firefox/firefox.sh` i.e. there is no version number. Are these profiles in enforce mode some how sub profiles that are inheriting the parent profile and still in enforce mode despite the parent being in complain? Why is the profile shown in the status of the form `/usr/lib/firefox/firefox` not 1/usr/lib/firefox/firefox-7.01`? Finally I thought messages were supposed to go to `/var/log/messages` yet this file does not exist for me, despite processes being left in complain mode for some time...


title: Madwimax: modem connecting but no internet

text: I'm using the madwimax package to connect a Samsung USB modem to the internet. It has worked well before, on previous versions of Ubuntu, but now that I upgraded to Ubuntu 12.10 I have had problems connecting. Here's what I have: From my syslog, I see that the modem connects to well to the internet:               $ tail syslog     Nov 25 19:22:56 server_name kernel: [ 7643.313567] usb 1-1: >New USB device found, idVendor=04e8, idProduct=6761     Nov 25 19:22:56 server_name kernel: [ 7643.313585] usb 1-1: >New USB device strings: Mfr=1, Product=2, SerialNumber=0     Nov 25 19:22:56 server_name kernel: [ 7643.313598] usb 1-1: >Product: Samsung USB mWiMAX Modem      Nov 25 19:22:56 server_name kernel: [ 7643.313609] usb 1-1: >Manufacturer: SAMSUNG ELECTRONICS Co.Ltd.     Nov 25 19:22:56 server_name kernel: [ 7643.320211] scsi5 : usb-storage 1-1:1.1     Nov 25 19:23:02 server_name dhclient: DHCPDISCOVER on wimax0 to 255.255.255.255 port 67 interval 3     Nov 25 19:23:02 server_name dhclient: DHCPREQUEST of XXX.XXX.XXX.XXX on wimax0 to 255.255.255.255 port 67     Nov 25 19:23:02 server_name dhclient: DHCPOFFER of XXX.XXX.XXX.XXX from XXX.XXX.XXX.XXX     Nov 25 19:23:02 server_name dhclient: DHCPACK of XXX.XXX.XXX.XXX from XXX.XXX.XXX.XXX     Nov 25 19:23:02 server_name dhclient: bound to XXX.XXX.XXX.XXX -- renewal in 4311 seconds.      I see nothing weird in dmesg:               [ 6311.413438] scsi 3:0:0:0: >CD-ROM            Samsung  Install Disk     0.10 PQ: 0 ANSI: 0 CCS     [ 6311.445249] sr0: scsi3-mmc drive: 0x/0x caddy     [ 6311.445920] sr 3:0:0:0: >Attached scsi CD-ROM sr0     [ 6311.446619] sr 3:0:0:0: >Attached scsi generic sg1 type 5     [ 6311.455124] sr0: Hmm, seems the drive doesn't support multisession CD's     [ 6311.485119] sr0: CDROM (ioctl) error, command: Xpwrite, Read disk info 51 00 00 00 00 00 00 00 02 00     [ 6311.485629] sr: Sense Key : Hardware Error [current]      [ 6311.485644] sr: Add. Sense: No additional sense information     [ 6509.366803] usb 1-1: >USB disconnect, device number 5     [ 6739.568110] usb 1-1: >new high-speed USB device number 6 using ehci_hcd     [ 6739.701153] usb 1-1: >New USB device found, idVendor=04e8, idProduct=6761     [ 6739.701171] usb 1-1: >New USB device strings: Mfr=1, Product=2, SerialNumber=0     [ 6739.701184] usb 1-1: >Product: Samsung USB mWiMAX Modem       [ 6739.701195] usb 1-1: >Manufacturer: SAMSUNG ELECTRONICS Co.Ltd.     [ 6739.710107] scsi4 : usb-storage 1-1:1.1     [ 6740.709747] scsi 4:0:0:0: >CD-ROM            Samsung  Install Disk     0.10 PQ: 0 ANSI: 0 CCS     [ 6740.741201] sr0: scsi3-mmc drive: 0x/0x caddy     [ 6740.741873] sr 4:0:0:0: >Attached scsi CD-ROM sr0     [ 6740.742613] sr 4:0:0:0: >Attached scsi generic sg1 type 5     [ 6740.755544] sr0: Hmm, seems the drive doesn't support multisession CD's     [ 6740.781039] sr0: CDROM (ioctl) error, command: Xpwrite, Read disk info 51 00 00 00 00 00 00 00 02 00     [ 6740.781357] sr: Sense Key : Hardware Error [current]      [ 6740.781366] sr: Add. Sense: No additional sense information     [ 6964.229412] type=1400 audit(1353885097.721:13): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=14883 comm="apparmor_parser"     [ 6964.930207] type=1400 audit(1353885098.421:14): apparmor="STATUS" operation="profile_replace" name="/sbin/dhclient" pid=14882 comm="apparmor_parser"     [ 6964.934760] type=1400 audit(1353885098.425:15): apparmor="STATUS" operation="profile_replace" name="/usr/lib/NetworkManager/nm-dhcp-client.action" pid=14882 comm="apparmor_parser"     [ 6964.935108] type=1400 audit(1353885098.425:16): apparmor="STATUS" operation="profile_replace" name="/usr/lib/connman/scripts/dhclient-script" pid=14882 comm="apparmor_parser"     [ 6965.218809] type=1400 audit(1353885098.709:17): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/tcpdump" pid=14885 comm="apparmor_parser"     [ 6966.215718] type=1400 audit(1353885099.705:18): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=14933 comm="apparmor_parser"     [ 6966.929916] type=1400 audit(1353885100.421:19): apparmor="STATUS" operation="profile_replace" name="/sbin/dhclient" pid=14932 comm="apparmor_parser"     [ 6966.930401] type=1400 audit(1353885100.421:20): apparmor="STATUS" operation="profile_replace" name="/usr/lib/NetworkManager/nm-dhcp-client.action" pid=14932 comm="apparmor_parser"     [ 6966.930743] type=1400 audit(1353885100.421:21): apparmor="STATUS" operation="profile_replace" name="/usr/lib/connman/scripts/dhclient-script" pid=14932 comm="apparmor_parser"     [ 6967.212826] type=1400 audit(1353885100.705:22): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/tcpdump" pid=14935 comm="apparmor_parser"     [ 7098.436770] r8169 0000:02:00.0: >eth0: link down     [ 7098.436793] r8169 0000:02:00.0: >eth0: link down     [ 7098.437360] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready     [ 7100.029494] r8169 0000:02:00.0: >eth0: link up     [ 7100.030390] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready     [ 7408.143352] usb 1-1: >USB disconnect, device number 6     [ 7643.180108] usb 1-1: >new high-speed USB device number 7 using ehci_hcd     [ 7643.313567] usb 1-1: >New USB device found, idVendor=04e8, idProduct=6761     [ 7643.313585] usb 1-1: >New USB device strings: Mfr=1, Product=2, SerialNumber=0     [ 7643.313598] usb 1-1: >Product: Samsung USB mWiMAX Modem       [ 7643.313609] usb 1-1: >Manufacturer: SAMSUNG ELECTRONICS Co.Ltd.     [ 7643.320211] scsi5 : usb-storage 1-1:1.1      When I run the madwimax command, I see no errors either:               $ madwimax -v     Bus 001 Device 006: ID XXX:XXXX     Device found     Claimed interface     Chip info: cmc730_v2.1     Firmware info: u200_rev1-2.9.50-DA15     MAC: XXXXXXXXXXXXX     Allocated tap interface: wimax0      Although, I do not see the IP appearing here. I normally saw the IP connection appear, but I now only see that in the syslog, and it is confirmed by ipconfig:               $ ifconfig     eth0      Link encap:Ethernet  HWaddr XXXXXXXXXXX                 inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0               inet6 addr: fe80::201:c0ff:fe05:b366/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:65197 errors:0 dropped:0 overruns:0 frame:0               TX packets:38986 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:80731178 (80.7 MB)  TX bytes:3893255 (3.8 MB)          lo        Link encap:Local Loopback                 inet addr:127.0.0.1  Mask:255.0.0.0               inet6 addr: ::1/128 Scope:Host               UP LOOPBACK RUNNING  MTU:16436  Metric:1               RX packets:1277 errors:0 dropped:0 overruns:0 frame:0               TX packets:1277 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:304270 (304.2 KB)  TX bytes:304270 (304.2 KB)          wimax0    Link encap:Ethernet  HWaddr XXXXXXXXXXXXXXX                 inet addr:XXX.XXX.XXX.XXX  Bcast:XXX.XXX.XXX.XXX  Mask:255.255.248.0               inet6 addr: XXXXXXXXXX/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1386  Metric:1               RX packets:2 errors:0 dropped:0 overruns:0 frame:0               TX packets:7 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:500                RX bytes:698 (698.0 B)  TX bytes:1082 (1.0 KB)      I also flushed any iptables rules:               $ iptables -L -n     Chain INPUT (policy ACCEPT)     target     prot opt source               destination                   Chain FORWARD (policy ACCEPT)     target     prot opt source               destination                   Chain OUTPUT (policy ACCEPT)     target     prot opt source               destination      If I plug this USB modem into another computer, it connects just fine. Anybody any ideas?


title: Is it the de facto to use the grave (`) symbol, followed by a normal apostraphe (') to quote things?

text: For example, 'foo bar' would be quoted as `foo bar', or ``foo bar''. Is it encouraged or general practice to use this quoting syntax?


title: Search class names in jars

text: I'm using this command to search *.jar files for java classes, and I only get the name of the jars that contain those classes:               grep -ral --include=*.jar SignonEJB .      How can I also get the class names in the output?


title: Matching hexadecimals with gawk

text: I have a binary file with the following content (printed in hexadecimal):               $ xxd -p virus.com     5669727573b440bb0100b90500ba0000cd21      I can match the first 5 letters (which are the alphanumeric string 'Virus') with               $ gawk '/\x56\x69\x72\x75\x73/ { print "Match!" }' virus.com      Match!     $      But as soon as I include the 6th letter (which isn't alphanumeric)               $ gawk '/\x56\x69\x72\x75\x73\xb4/ { print "Match!" }' virus.com     $      won't match anymore. Why is that so and what can I do to match the whole pattern?


title: Cannot connect to ssh from crontab

text: I can create ssh connection from the command line with this command(without password):               ssh -R 9900:localhost:22 user@host      I need to run this command whenever the system reboots, so I put it in a bash script and added this line to crontab:               @reboot /home/me/script.sh > output      But in output I get this error: ssh: Could not resolve hostname myhost: Name or service not known I think it's because this script starts before internet connection is established. I put a `sleep(180)` before the ssh command, but it didn't help. Any suggestion?


title: Infinitely Nested Directories

text: Let me start off by saying this is a Mac Terminal I'm using. Not Linux, but I assumed I would get the best answers here as it has to do with Unix and the command line not really anything about Mac itself. Anyways here's the problem. In an attempt to be extremely lazy, I tried to write a function in my ~/.bashrc that would let me move into a "homework" folder, created a folder with today's date, move into said folder, and open vim with the given filename... all in one go. It looked something like...               export DATE="$( date +%d-%b )"     function hw() {       cd ~/Java/Programs/HW       mkcd $DATE       vim "$*"     }      mkcd is a function that makes the folder and moves into it at the same time. This is what my function looks like now and it works just fine. However in on of my many attempts to make this work I made a really really stupid error and ended up with some kind of infinite loop with my mkcd part... still not sure how I managed this and I've since deleted that code. Well what happened when I did this is quite obvious... I now have a folder named 27-Jan that has infinitely many folders named 27-Jan inside of it. (Like I said really stupid) Well to make it stop putting me deeper and deeper I hit ^c and viola I stopped... I changed back to my ~/ folder and did a quick sudo `rm 27-Jan/`. To my amazement (and worry) that didn't work. I tried a for more things to get rid of it but nothing did anything. So being clever like I am... I moved it to .Trash and stopped worrying about it. Since then I have emptied my trash a few times and never really noticed but that bloody folder won't go away! It's taking up zero bytes on my hard disk but it's still there with all it's little sub folders. **What I've Tried:**               sudo rm 27-Jan/     sudo rm -r 27-Jan/       This one said `override rwxr-xr-x caldwell/staff for 27-Jan/(many times repeated)/27-Jan?` To which I've responded `y` and `yes` and even `si` (in case it spoke spanish)... everytime it says `No such file or directory` and repeats the previous question. Has anyone ever seen anything like this? And do you know what I might be able to do to make it just go away?


title: Chromium OS says "Your system is repairing itself. Please wait" and then reboots

text: I downloaded ChromeOS-Vanilla-3851.0.2013_03_17_1641-r7af8fe3d.zip from chromeos.hexxeh.net, then extracted and "burned" to a 4GB USB drive with `dd if=ChromeOS-Vanilla-3851.0.2013_03_17_1641-r7af8fe3d.img of=/dev/sdb bs=4M`.   I can _boot_ it on my main computer, a Dell OptiPlex GX620, but I can't use it due to connectivity problems (see this question if you want to help.) I can, however, get it booted and working on the Netbook, which is a Toshiba NB255. I recently got a Laptop, it has no battery, and when trying to boot Chromium OS on it, it says "Your system is repairing itself. Please wait." and then reboots. I let it keep cycling for literally an hour, then decided that it was, in fact, _not_ actually repairing anything. What am I doing wrong? The laptop is a Dell Inspiron B130.


title: ifconfig: bad address '-apbridge'

text: I need to configure the network interfaces in my OpenWRT-router. hence I need to change some options in the /etc/config/network file. specifically **I want to remove the bridge connection**. I have tried each one of the following commands on my shell:               ifconfig lan -apbridge     ifconfig eth0 -apbridge      each command output is:               ifconfig: bad address '-apbridge'      I've tried these too:               ifconfig lan type -apbridge     ifconfig eth0 type -apbridge      each command output is:               ifconfig: bad address 'type'      I know I can just use nano editor and remove the option from the file directly, but in my case this is not practical. I need to remove the bridge connection from the command line.. how can I do that .. thanks


title: What year did the Unix "tar" program get released?

text: Here's an simple question: what year did the Unix "tar" (TApe ARchive) come out? I wasn't able to find the answer with Internet searches.


title: Why is the default choice for -I argument '{}'?

text: It seems you can pass in a variable name like 'file' for -I argument of `xargs`, but there are a plethora of examples that use {}. Is this because of the backward compatibility? Or does it help with the visibility of the variable location? Why many people use {} instead of a variable name?


title: Disable SSH password authentication on specific interface

text: I have an OpenWrt router, I want to disable password authentication on SSH, so that one can only authenticate with keys. This is easily achieved by following the guide in the documentation, however, I want to only disable password authentication on the WAN interface, is this possible?


title: How can I network these two computers using eth1394/firewire-net, automagically?

text: I have two partly-dead laptops. The first will not run X, and the second has some sort of problem with the monitor. I am not interested in repairing either of them, but since they both have firewire ports, I'd like to use some program to be able to transfer files from the second laptop (dead monitor) onto the first laptop (no X server). Ideally, I'd like to be able to browse the filesystems on the dead-screen laptop, _from the other laptop_ , and have total control over it. I need some help, though. At first, I couldn't seem to find much information about how to network them. But then I found that it was simply,               modprobe firewire-net     ip address add dev firewire0 <ip address>     ifconfig firewire0 up      which is nice. But I've never done any networking, so even though dmesg notes an IPv4 connection, I still can't transfer any files. For instance, I assigned the IP 10.10.10.11 to the first computer and 10.10.10.10 to the second, and when I type               ping -c 2 10.10.10.11       from the second, or               ping -c 10.10.10.10      from the first, I get the message:               connect: Network is unreachable.      But how can I make the module load at boot time, and the interface configure automatically, since the screen almost always dies on the second after about 10 minutes of use? Presumably, I need to add stuff to /etc/network/interfaces, right? And once the interface is connected, what program can I use to grab files on the dead-screen laptop?


title: X11 connection rejected because of wrong authentication -- on CentOS, for all users (including root)

text: I'm configuring a small computing cluster with CentOS. The last step is setting up X11 forwarding, and here I find problems that I cannot solve. On all compute nodes except one, I can set up everything by just installing xorg-x11-server-Xorg and xorg-x11-xauth with `yum`, then starting Xorg (as root). Signing in as any user with `ssh -X`, X forwarding works without a problem. However, on the last server, I get the following message when signing in with `ssh -X` (as root or as any other user) and trying to start an X application (Molden in this case):               X11 connection rejected because of wrong authentication.     Molden: cannot connect to X server host:11.0      I have tried several fixes I have found online, including   * Disabling SElinux   * Checking that the ownership of `.Xauthority` files are correct   * Deleting `.Xauthority`   * Checking that X11 forwarding is enabled in `/etc/ssh/sshd_config` (and no local `ssh_config` files exist that can overwrite this)   * Uninstalling and reinstalling xorg-x11-server-Xorg and xorg-x11-xauth to make sure both packages are installed directly by the root user, not through `sudo yum install` (I do not understand why this would affect anything, but it has been suggested) Using verbose mode and checking all system log files gives no further hints to how to solve the problem. The only guess I have is that the hostname configuration is somewhat different on the trouble-causing node. Changing the host name configuration on this server to be the same as on the other servers did not give any results. Any further suggestions?


title: Run jar file on startup as root without password

text: I developed a jar file I would like to run in all *nix platforms. I want to run the jar file on every restart with the root privileges without prompting any password. I googled for the solution but it shows I should write a script and add to folders. But I should be able to write the script from the jar itself. Is it possible to perform such operations, if not what are the other solutions?


title: Applying a change to every line?

text: How to add 4 spaces to every line between marks (bound with m-letter and current line). How to do the same when using visual block?


title: How to make file system on DVD

text: I ran the below command to check file system on a few DVDs.               sudo file -s /dev/sr0      The DVDs which were working had responded properly to this command. But the DVDs which were not getting burnt (by Brasero disc burner etc) showed the below error.               ravbholua@ravbholua-Aspire-5315:~/Downloads$ sudo file -s /dev/sr0     /dev/sr0: ERROR: cannot read `/dev/sr0' (Input/output error)      So, I feel the problem is with the DVDs or the file system of the DVDs. Now is there any method (like mkfs on other medias) to make file system for those DVDs?


title: User permissions problem Linux

text: Every time I create a new file from "eclipse", I need to run these two lines of code to get the r/w permission:               chmod -R 775 /var/www/folder/filename.extension      And/Or               sudo chown -R www-data:www-data /var/www      And, If I copy some files over that server folder, and access it from browser URL like :               localhost/folder/filename.extension      I get a Permission error by Apache Server. Isn't there any way so that I can get rid of this problem? ***Note:** The main error occurs when my `move_uploaded_file()` function tries to move the file to `/var/www/MyProject/` directory.


title: Linux Editor to make video for elearning

text: Does anyone know a solution to create video courses on Linux, i.e:   * recording in the same time the videos from the webcam, the powerpoint / openoffice document, the annotations on the document (using electronic whiteboard) and my speech   * a way to edit after creation to remove / add new video sequences


title: How do I get kopete to hide/ignore status changes?

text: I'm tired of kopete showing me every time someone goes away, online, it's annoying as it doesn't matter to me. How do I get kopete to hide these messages, or at least not alert me to them.


title: How do I get sudo -u $user to use the users env?

text: It seems when `sudo`ing down that using `sudo -u $user` that the environment of root is still being used. How can I make `sudo` use the users environment? as a special note not all users that I will be using this on have login shells.


title: How to change modMask in Xmonad when specific window is focused, or on specific workspace?

text: I am using left Alt as my primary modkey, but for certain application I would like to use Alt+keys as my bindings, and for that specific application I want left winkey to be my modkey. It seems that logHook is the right place to plug this logic in, but I have troubles understanding, how to do it. Greatly simplified, my configuration looks like               import qualified XMonad.StackSet as W     import XMonad     import XMonad.Hooks.DynamicLog          main = do       -- some stuff       xmonad $ defaultConfig {           modMask = mod1Mask  -- left winkey = mod4Mask, left alt = mod1Mask         , logHook = do               dynamicLogWithPP pp       }      where               pp = dzenPP {         -- more stuff     }      I could getName of current window in my logHook               winset <- gets windowset     let wname = fmap getName (W.peek winset) -- here I have some window identificator in Maybe      but I do not understand how to replace modMask in my main function, in defaultConfig, on the fly. I would also be happy if on one workspace modkey will be different. Say, on workspaces 1 to 8 it is an Alt key, and on 9th it's left Winkey. This would do fine too, and I bet such solution can be easily modified to be based on currently focused window.


title: why useradd havent created the standard files?

text: See I have created some user in my CentOS with `useradd` command. And I didn't get any kind of automatic standard dir creation and its not been versatile actually while I am creating that user. see the log please.               root@localhost raja]# useradd positiveman     [root@localhost raja]# passwd positiveman     Changing password for user positiveman.     New password:     BAD PASSWORD: it does not contain enough DIFFERENT characters     BAD PASSWORD: is too simple     Retype new password:     passwd: all authentication tokens updated successfully.     [root@localhost raja]# ls /home/august     [root@localhost raja]# ls /home/august/     [root@localhost raja]# cd /home/     [root@localhost home]# ls     august  positiveman  raja     [root@localhost home]# cd august/     [root@localhost august]# ls     [root@localhost august]# cd ..     [root@localhost home]# cd positiveman/     [root@localhost positiveman]# ls     [root@localhost positiveman]#      what might be the reason ?


title: Why can users delete each others files in this case

text: I have two users : bob and sally, who resepctively own two files : bob100 and sally100:               > ls -altrh /path/to/dir :           -rw-r--r--. 1 bob   test    0 Jan  7 12:59 bob100     -rw-r--r--. 1 sally test    0 Jan  7 13:06 sally100     drwxrwxrwx. 8 root  root 4.1K Jan  7 13:06 .      However, BOB can delete files in SALLY's account:               > runuser -l bob -c 'rm -f /path/to/dir/sally100'      Why is it that bob is allowed to delete a file which clearly only sally has write permissions on?


title: GDM3 setting incorrect refresh rate for my monitor on evert launch, despite it being set properly in xorg.conf

text: I wanted the ability to switch users with gdmflexiserver, so I switched from KDM to GDM, and ever since, it has been setting up incorrect refresh rate on every launch, requiring me to manually change it in `nvidia-settings`. Apparently, `xrandr --size 1440x900_75` does not work either, reporting 75 as a refresh rate not available for the given size. Is there any way I can get it to not do that?


title: How to create a relative symlink which works across PC

text: I have the following directory structure to start with               ~/a/bin     ~/a/src -> /home/user/b/sync/src      I created a symlink               cd ~/a/src     ln -s ../bin bin-xyz      now bin-xyz is a broken link, and there is no way of cd-ing into it. **What i am looking for?** How to create a symlink inside a symlinked folder such that the relative path is not broken. For example,                cd ~/a/src/bin-xyz       or                cd ~/b/sync/src/bin-xyz      should work provided that there is bin directory in ~/a/ or ~b/sync/ **Why i am looking for this ?** I am syncing ~/b/sync/src across machines, where ~/a/ is my workspace in both the machines but the user name of the machines differ. So, having a relative path that works means an easier work-flow for me. I am using bittorent sync for syncing. Thanks :-)


title: How to merge two .MTS files in Arch Linux!

text: I have two video files from a Panasonic camera in .MTS format and I want to merge them into one file and burn that file onto a TV-playable DVD. I tried importing them into kino and merging them, but the resulting file has somehow a very slow video playback and the audio is way out of sync. I selected the MPEG tab with file format '8 - DVD' with no deinterlacing. Can someone point me into the right direction for merging the two files correctly? Since exporting of the file takes around one hour, it's quite impractical to play around with different options :)


title: How to make a mouse driver from a tty?

text: I have an Arduino plugged in my computer through the uart/tty port. I would like to use it as a mouse but I have no idea where to start with kernel/device drivers/etc. Here is a little summary of what I did so far :   * managed to push info from Arduino to the computer: I push a button, Arduino transmits to computer, and a bash script can tell that a button was pushed   * started to read some stuff about device drivers and the Linux device drivers big book   * wrote a small driver to play with gpio pins (mostly copied/paste from internet) Now I would like my Arduino to act like a mouse, but not using the "mouse shields" or buy an Arduino that does it (mine is older, 2009). I am thinking of trying to use `udev` to redirect the USB from FTDI driver to something that I would write, and then fake that it is a mouse, but I am not really sure where to start and if it is viable. This would involve to reverse engineer the FTDI protocol and read the characters sent, and then make the mouse move programmatically. But I didn't even find a library that works on my Linux on VMware to move the mouse. I found xdotool which is binary that can make my mouse move but that's it. I am not even sure either that from USB I can parse the FTDI protocol that converts Arduino chars to USB, and if this is the right direction anyway or if there is a way to call the FTDI driver to do that for me. I welcome other solutions of course, but I would really like some guidance on that, I have been trying for months and I always end up buried in so many tutorials on the internet about everything.


title: Removing leading zeros from DATE

text: I made an alias of the date command to display date in the following format: > 2013.06.14.12.10.02 using this command:               alias date = date +"%Y.%m.%d.%H.%M.%S"      Everything works great, except I want to remove the leading zeroes from the output. There is no way to make it happen by changing the format. I think it can be done only by piping the output to other commands like `sed` and `awk`. The OS I am running is Ubuntu 12.04.2 LTS.


title: Maintain (or restore) file permissions when replacing file

text: I have a command that accepts a file as an argument, modifies the file, then writes it to the file name specified in the second argument. I'll call that program `modifyfile`. I wanted it to work "in place" so I wrote a shell script (bash) that modifies it to a temporary file then moves it back:               TMP=`mktemp`     modifyfile "$original" "$TMP"     mv -v "$TMP" "$original"      This has the unfortunate side effect of destroying the permissions on this file. The file gets re-created with default permissions. Is there a way to tell the `mv` command to overwrite the destination without altering its permissions? Or alternately is there a way to save the user, group, and permisssions from the original and restore them?


title: Is there a Unix command that searches for similar strings, based mostly on how they sound when spoken?

text: I have a file of names, and I want to search within it, not caring too much about whether I have spelled the name ( that I am searching for ) correctly. I know that `grep` has quite a bit of functionality to search for a whole slew of similar strings within a file or stream, but as far as I am aware, it does not have functionality to correct for spelling errors, and even if it did, since these are names of people, they wouldn't be found inside a standard dictionary. Perhaps I can make my file of names into a special dictionary, and then use some standard spell checking tool? Of particular importance in this application is the ability to mach similarly sounding words. For example: `"jacob"` should return `"Jakob"`. Even better would be if inter- language similarities were also accounted for, so that `"miguel"` should match `"Michael"`. Is this something that has been implemented already, or will I have to build my own?


title: MAC bash commands stop working properly

text: I was trying to install some stuff for scala development on my MAC, and probably I managed broke the shell/terminal while I was mindlessly running some scripts that I don't know. Now when I start the terminal it always starts with this line;               $ /sbin:sbin:/usr/local/bin': not a valid identifier      And now when I try, I see some bash commands does not work, for instance grep, syslog..etc I get an error saying;               -bash syslog: "no such file or directory"         Any idea what is wrong and how can I fix this


title: for loop to get more than one arguments

text: In python and some other programming languages, it is easy to get a vector instead of one variable everywhere and in loops. like python:               for variable in [[user1,pass1],[user2,pass2],[user3,pass3],...]         print variable[0]         print variable[1]      But how can I get two arguments in one cycle, in shell?


title: Are there any linux terminals which can handle all key combinations?

text: I like to use emacs in terminal mode (`-nw`), but it seems most (all?) terminals can't handle some key combinations - for example, `C-<RET>` or `C-M-%`. I know this is because most terminals emulate a VT-100, which didn't have these combinations. Are there any linux terminals (preferably KDE) which can handle these key combinations, or is this a fundamental limitation of all terminals?


title: Assigning static device path

text: I have 4 flash cards plugged in, sequentially named by system:   * /dev/sda1   * /dev/sdb1   * /dev/sdc1   * /dev/sdd1 I want to assign static pathes to them, so every time the system boots up their pathes will not change, no matter in what order they are plugged in. I think it should be possible to assign static path directly to device **UUID**. The OS I am running is _Red Hat Enterprise Linux 6_.


title: Where is my tablet's memory card mounted on laptop?

text: I connected my Asus fonepad7 tablet to my laptop via usb. My laptop automatically detects it & opens. But I'm unable to find where the memory card of my tablet mounted on laptop. Just see below, when I put cursor on the tablet device, it shows "mtp://[usb:002,003]/" ![Mount point](http://i.stack.imgur.com/EA2i7.png) As I'm unable to find the mount point, I can't use command line for accessing the tablet. Also, commands "mount" & "df" doesn't reflect anything regarding the tablet. I'm working on Ubuntu 13.04 > **EDIT#1** This edit is with ref. to the answer posted by edvinas.me I got the mount point as "/run/user/ravbholua/gvfs". But the issue is that all the files & folders are named as numerals. Please see below:               ravbholua@ravbholua-Aspire-5315:/run/user/ravbholua/gvfs/mtp:host=%5Busb%3A002%2C008%5D$ ls     65537     ravbholua@ravbholua-Aspire-5315:/run/user/ravbholua/gvfs/mtp:host=%5Busb%3A002%2C008%5D$ cd *     ravbholua@ravbholua-Aspire-5315:/run/user/ravbholua/gvfs/mtp:host=%5Busb%3A002%2C008%5D/65537$ ls     1   100  105   11  1301  1420  1533  1597  2    223  226  3   4    422  426  5  85  9     10  104  1072  12  1310  1496  1547  1806  212  224  232  30  421  424  430  6  86  900     ravbholua@ravbholua-Aspire-5315:/run/user/ravbholua/gvfs/mtp:host=%5Busb%3A002%2C008%5D/65537$ cp 30 ~     cp: cannot open ‘30’ for reading: Operation not supported      The name of the files & folders as shown in GUI is by names but here it is numerals. Also I'm unable to copy any file. Please look at the above code.


title: Vim - Tabs in :o Show up as ^I and Autocomplete Does Not Function

text: The title basically says it all - in Vim, my tab's show up as ^I, and I'm wondering if anybody knows why this might be. This is especially annoying when using :o to open a file, as the autocomplete does not function. I've looked all over but haven't been able to find anything, it even occurs with a blank .vimrc file. Is there a setting that would cause this, or a way I can remap the key to get it to function properly?


title: HPUX Logging Logins

text: I'm trying to enable security logging on some HPUX11 systems. I can get HPUX to generate a message that:   * a login is being attempted (username, no source IP)   * a login failed (no username or source IP) Strangely I don't get messages for:   * A login succeeded   * The source IP or username of a failed login Is there a way to tweak HPUX to give detailed information about users logging in, attempts and failures?


title: Format ps output without whitespace

text: I have the following `ps` command to get particular properties of all the running processes along with some properties: `ps --no-headers -exo "uname,ppid,pid,etime,%cpu,%mem,args"` I wish to have it formatted in CSV so I can parse it (note I have put the args at the end to make parsing easy (I don't think a `,` will exist in any of the other columns - please correct me if I am wrong) How do I remove the whitespace?


title: setfacl: Are these two commands the same?

text: I have a deployment script (based on capifony) that sets te permissions on specific servers for a Symfony2 installation. It contains the following two commands to do this for several directories:               setfacl -R -m u:www-data:rwx -m u:`whoami`:rwX app/cache     setfacl -dR -m u:www-data:rwx -m u:`whoami`:rwX app/cache      These two commands are on the Symfony2 site as a way to fix the permissions, however, these looked strikingly similar to me. So I had a look at the manpages for `setfacl`, and from what I could understand, the second command does exactly what the first one does with an additional option (which I don't quite understand). My question is, is my assumption correct? If so, would it have the same effect if I removed the first command?


title: Is it possible to stop specific BIND Log messages from being logged?

text: I have setup a BIND DNS server and a munin monitoring system which is configured to monitor BIND as well. The OS is Ubuntu Server 12.04.4 and the BIND version coming with it is `9.8.1-P1`. Munin runs every 5 minutes, and executes the bind command `rndc stats`, which is spamming my bind log files with this message:               29-May-2014 01:30:04.070 general: info: received control channel command 'stats'     29-May-2014 01:30:04.073 general: info: dumpstats complete     29-May-2014 01:30:04.150 general: info: received control channel command 'stats'     29-May-2014 01:30:04.150 general: info: dumpstats complete     29-May-2014 01:35:03.112 general: info: received control channel command 'stats'     29-May-2014 01:35:03.112 general: info: dumpstats complete     29-May-2014 01:35:03.229 general: info: received control channel command 'stats'     29-May-2014 01:35:03.230 general: info: dumpstats complete     29-May-2014 01:40:03.183 general: info: received control channel command 'stats'     29-May-2014 01:40:03.185 general: info: dumpstats complete     29-May-2014 01:40:03.348 general: info: received control channel command 'stats'     29-May-2014 01:40:03.348 general: info: dumpstats complete      Is there any way to fine grain BIND logging and exclude ONLY this message? Please note that I don't want to reduce the severity for `general` log messages, but only disable/exclude this specific message which is really flooding my log file. Below is my current logging configuration:               logging {             // reduce log verbosity on issues outside our control             category lame-servers { null; };                  // Use "severity dynamic" for debugging             channel b_default_log {                     file "/var/log/named/bind.log" versions 30 size 1m;                     print-time yes;                     print-category yes;                     print-severity yes;                     severity info;             };                  channel b_resolver_log {                     file "/var/log/named/resolver.log" versions 5 size 1m;                     print-time yes;                     print-category yes;                     print-severity yes;                     severity dynamic;             };                  channel b_config_log {                     file "/var/log/named/config.log" versions 5 size 1m;                     print-time yes;                     print-category yes;                     print-severity yes;                     severity dynamic;             };                  channel b_edns_disabled_log {                     file "/var/log/named/edns_disabled.log" versions 5 size 1m;                     print-time yes;                     print-category yes;                     print-severity yes;                     severity dynamic;             };                  // The query.log is needed for munin monitoring             channel b_query_log {                     file "/var/log/named/query.log" versions 20 size 10m;                     print-time yes;                     severity info;             };                  category default { b_default_log; };             category resolver { b_resolver_log; };             category config { b_config_log; };             category queries { b_query_log; };             category edns-disabled { b_edns_disabled_log; };     };


title: Solaris 10 non global zones and rc scripts

text: There are a handful of Solaris zones that run a `rc3.d/` script (which is normal), however, there is a single script that runs during boot and removes itself upon completion. (This is known from viewing the script elsewhere on another box, which is apart of some legacy/defunct programs.) For whatever reason the script reappears after every boot of the zone and executed--which has been verified by browsing `/var/svc/log/milestone-multi-user- server\:default.log` The problem/question begins with this: **What in the world can cause the script to reappear in`rc3.d/`?** In fact, there is no `rc2.d/ rc3.d/ init.d/` script which run beforehand that might `cp` the script over to `rc3.d/`, and the script itself does not seem to reside anywhere in the zone or global. And, a further note, I have not been able to find a (obvious) SMF service that might run a script to do the above action.


title: Conceptual difference between Linux and (Free)BSD Kernel

text: (I've already noticed that this question was asked before but I think it has not been answered in a way I'd like to understand the topic.) What are the conceptual and structural differences between a   * Linux Kernel   * BSD Kernel (let's say FreeBSD if it helps to be specific) While at the end of the day they are both kernels - I would assume that there might be differences in structure, functionality and specialization. In which scenarios would one kind of kernel have an advantage over the other? (Web Server, Database, Computing, etc.) Are there any joint efforts to concentrate forces for one common kernel or certain modules or would that be pointless anyway? PS: Different license types or shipping/packaging/maintaining approaches are not of importance in this context. I'm really interested in understanding how they differ on structural, functional/feature level and specialization.


title: Linux Mint 15 WiFi hotspot options

text: I'm trying to configure a hotspot in my Linux Mint 15. There are no specific manuals for 15, but I found this video which describes hot to make a hotspot in Mint 14. Creating it in Mint 15 not much differ, but I cannot find a button to configure hotspot. Here is how my Network Manager looks like when hotspot is on: ![enter image description here](http://i.stack.imgur.com/6ZXk4.png) I cannot find `Options` button. Hot can I configure SSID, security type and key without it?


title: Reduce bad block retry / wait times in Ubuntu

text: **How can I reduce the IO wait time and retry times so that the OS doesn't continually try to write to a failing drive?** I have an system that I use to make copies of demo content that gets loaned out to customers on to regular SATA desktop hard drives. We connect many drives at once via SAS and copy content to them using a script. Because the drives are loaned out, occasionally some come back damaged but I don't know that they are damaged, so the next time that drive gets reused in a copy operation, it slows down other drives as the system retries IO to that drive. Sometimes it can take hours before I notice the bad drive and remove it. After the drive is removed, the rest of the drives begin writing at normal speed. I do not care about recovering the bad drives. I just need to weed them out so they don't slow everything else down. I am also researching badblocks and smartmontools and considering writing a pre-check on the drives before I start writing. OS: Ubuntu Linux (12.04 lts)


title: Any way to cat few lines of man page to show on stdout for reference?

text: This is a simple question. Trying my best to put it in simple word. Hope you get it without much confusion - I read a man page for some command-switch/option which has a long description. I read it, press `q` to escape and try the option. But then I do need to go back to same man page section for some more info. So, I repeat the steps I would like to know if there is any way to output the contents of man page onto the stdout for referring it quickly. For example let's take short-one `cal`, may be something like > cat `man cal` would be effective and help achieve the desired requirement. Any hints?


title: Can I stop SElinux from working?

text: I suspect that SElinux is backdoor and I want to stop it from working on my system. I want to stop it and delete it from the system also if that is possible. ### Questions   * How can I delete it without leaving any trace of it?   * Is there precautions I have to do after uninstalling it?


title: How do I make the Xterm window title switch between the current running command and the current path?

text: I want to set the Xterm window title to switch between two states:   * When a command is running, show the command name (e.g. "less")    * When no command is running, show the current path (e.g. "src") I can create an Xterm window title with the current path with:               $ export PROMPT_COMMAND='echo -ne "\033]0;`basename ${PWD}`\007"'      And I can show the current running command by adding a `trap` statement to `.bashrc`:               $ trap 'echo -ne "\033]0;$BASH_COMMAND\007"' DEBUG      But I'm not able to automatically switch between the two. Is it possible? EDIT: @terdon shows a solution that works in a regular xterm, that's cool! But I failed to mention that I use the MacOSX Terminal.app. That shows still shows "bash" instead of the current path when no command is running. With a little tinkering I figured out how to solve this.


title: Debian CLI torrent program through VPN

text: Has anyone successfully set up a CLI-only (no web UI's!) torrent client that can tunnel all of its traffic through a VPN? (Either by sending all traffic through a particular interface or a SOCKS proxy)? I have a Private Internet Access subscription and would like to use it to download torrent files on my headless Debian 7 machine without having to tunnel all of the traffic on my system.


title: Symlink from one workstation to another without mount

text: I am trying to create a symlink of a file on one linux workstation to another linux workstation, without having to 'mount' any network shares. Here's what I am trying to do, but can't get it to work.               ln -s /link/to/local/file.mov //10.0.1.103/sharedFolder/symlinkFile.mov


title: Why is my Netstat not returning the desired output and just getting hung up?

text: My remote Linux machine is able to ping an IP address on an internet, but the same is unable to get the netstat report for that IP, please help through.               ping a.b.c.d     64 bytes from a.b.c.d: icmp_seq=1 ttl=64 time=0.509 ms     64 bytes from a.b.c.d: icmp_seq=2 ttl=64 time=0.249 ms     64 bytes from a.b.c.d: icmp_seq=3 ttl=64 time=0.273 ms     64 bytes from a.b.c.d: icmp_seq=4 ttl=64 time=0.357 ms      but netstat is unable to get the output of,               netstat -an a.b.c.d | grep <some port>      it's just getting hang and not even returning my prompt, while I already have been sure about the connections it should list, please help.


title: readarray (or pipe) issue

text: I stuck with an strange behaviour of `readarray` command. The `man bash` states:               readarray          Read lines from the standard input into the indexed array variable array      but these scripts don't work (array is empty):               unset arr; (echo a; echo b; echo c) | readarray arr; echo ${#arr[@]}     unset arr; cat /etc/passwd | readarray arr;  echo ${#arr[@]}      And these work:               unset arr; readarray arr < /etc/passwd ;  echo ${#arr[@]}     unset arr; mkfifo /tmp/fifo; (echo a; echo b; echo c) > /tmp/fifo & mapfile arr < /tmp/fifo ; echo ${#arr[@]}      What wrong with pipe?


title: Process specific ulimit still low after changes to soft and hard ulimits

text: I'm having trouble with increasing the open-files ulimit (`ulimit -n`) for a particular process on a Debian 6 server. AFAIK I've done everything to change the servers hard and soft limits in this case, (`ulimit -n` shows 200000), but when I check the `/proc/<process_id>/limits` file it's still showing the old limits:               Limit                     Soft Limit           Hard Limit           Units     Max open files            1024                 4096                 files      * * * _The steps that I have already taken to permanently increase the ulimits are:_ **Added to /etc/profile:**               # set ulimit n permanetly     ulimit -n 200000      **Added to /etc/security/limits.conf:**               *       soft    nofile  200000     *       hard    nofile  200000      **Uncommented this lime in /etc/pam.d/su**               session    required   pam_limits.so      **What am I missing?** Thank you! * * * Other (relevant?) info:   * The process is started in a `init.d` script with `start-stop-daemon`   * The `/etc/security/limits.d/` directory is empty


title: How to upgrade OpenSSL to 1.0.1h

text: I'm currently running Ubuntu 13.10 and my OpenSSL version is 1.0.1e. As per latest security warning, I'd like to upgrade it to 1.0.1h. I've tried `apt-get upgrade openssl` (don't want to upgrade everything) and `apt-get install openssl` but it doesn't work. The result of OpenSSL version is the same, OpenSSL 1.0.1e 11 Feb 2013 (The date is the important bit). How can I upgrade to 1.0.1h (preferably without having to compile it)?


title: Concatenating columns horizontally. Printing only rows that intersect on 1st column

text: Say I have two different commands that output contents by columns, e.g.:               $ command_1          7049857 abc fdg hsi     5409858 xxx fyy hsi     540958  abc zzz hsi     54230956  rbc sss hsi          $ command_2          7049857 0 fdg free     5409858 0 fyy free     540958  2 zzz free      I would like to silently grab columns with indices `x,y,z` from the output of `command_1` and the columns with indices `a,b,c` from the output `command_2` and print a new output: `x,y,z,a,b,c`. ## Example: Output the column column **1** and **2** from `commmand_2`: and the last column from `command_1`:               $ new_command          7049857 0  hsi     5409858 0  hsi     540958  2  hsi      ## What I have so far: I am relatively new to `awk`, but I know I can grab the corresponding columns from each of these commands with `awk`:               command_1 | awk '{print $x " " $y " " $z}'     command_2 | awk '{print $a " " $b " " $c}'      The above concatenates the columns vertically but I need to concatenate them horizontally. ## Printing only those rows that intersect on the first column: Say that it is possible that `command_2` has more or less rows than `command_1`. However, the first column of both commands holds **items belonging to the same category** (a multiple-digit ID, as in the example above) With this, assuming that the first column of both commands are sorted equally and that new or missing entries can only happen at the end, how could we make sure that we only print those rows for which we have entries in `command_1` and `command_2` (i.e. the intersection of both commands)? (the example above shows this)


title: Enable num-lock as default in Linux

text: There has been a similar question \- but IMHO there has to be a simpler solution. If num-lock is on in the BIOS - why is it turned off during linux boot and/or KDE/Gnome/whatever startup?


title: package manager with staging

text: my goal is to configure mirror-repository for packages (rpm, deb) which will have some features:   * staging (developing,testing,production)   * capability to back/forward stage   * doesn't take so much space (hard links to rpms/debs instead of copies)   * mirror from upstream I'm looking for any solution, maybe something is already available but i cannot find such tool. If not, i've got idea to make a shell script to make a job, but I prefer something out of the box.


title: copy from tmux to any editor not working

text: **I am trying to copy from`tmux` to my browser.** I followed the post Copying between tmux buffers and the system clipboard which tells me to add               setw -g mode-keys vi     bind-key -t vi-copy 'v' begin-selection     bind-key -t vi-copy 'y' copy-selection     bind y run-shell "tmux show-buffer | xclip -sel clip -i" \; display-message "Copied tmux buffer to system clipboard"      . My new `~/.tmux.conf` looks like the below one :               setw -g mode-keys vi     set -g mode-mouse on     set-option -g status on     set-option -g status-interval 2     set-option -g status-utf8 on     set-option -g status-justify "centre"     set-option -g status-left-length 60     set-option -g status-right-length 90     set-option -g status-left "#(~/tmux-powerline/powerline.sh left)"     set-option -g status-right "#(~/tmux-powerline/powerline.sh right)"          set-window-option -g window-status-current-format "#[fg=colour235, bg=colour27]?#[fg=colour255, bg=colour27] #I ? #W #[fg=colour27, bg=colour235]?"     bind-key -t vi-copy 'v' begin-selection     bind-key -t vi-copy 'y' copy-selection     bind y run-shell "tmux show-buffer | xclip -sel clip -i" \; display-message "Copied tmux buffer to system clipboard"      **After setup,** I tried   1. `Ctrl-b` [ (before copy mode)   2. `v` (copy mode)   3. `y` (yank)   4. `Ctrl-b y` (to move to system buffer)   5. Goto browser and paste with `Ctrl-v` Seems working upto **SETP 4** as I see the message > Copied tmux buffer to system clipboard But pasting somewhere ( **STEP 5** ) else is not working. I am using ubuntu 12.04.


title: Zsh: quickly bookmark commands

text: I just had an idea, I'm sure it must exist though I could not find anything on the web. This topic gets close to my idea but not enough: How to quickly store and access often used commands? I'd like to have a `.bookmark.zsh` file in which I store commands, not often used (I could create an alias for these), but more those which were a pain in the ass to write down, and that I could use some other times. Like I just typed:               rake db:drop --trace && echo 'dropped' && \       rake db:create --trace && echo 'created' && \       rake db:migrate --trace && echo 'migrated' && \       rake db:seed --trace && echo 'seed'      And I want to save it, so I type `bm -save 'description'` and it adds               rake db:drop --trace && echo 'dropped' && \       rake db:create --trace && echo 'created' && \       rake db:migrate --trace && echo 'migrated' && \       rake db:seed --trace && echo 'seed' # description`      in my `.bookmark.zsh` file. And then I can do `bm -find 'description'` (or ideally 'descr' 'desc' etc.) and I find the command back. Like bookmarks work! I'm pretty bad at shell so any tip would be super nicely welcomed!


title: File executable by all, yet still cannot be executed?

text: As shown by the following code:               ll     total 136     -rwxr-xr-x 1 kaiyin kaiyin  19067 May  9  2013 dbmeister.py     -rwxr-xr-x 1 kaiyin kaiyin   1617 Jul 29  2011 locuszoom     -rwxr-xr-x 1 kaiyin kaiyin 112546 May  9  2013 locuszoom.R               ./locuszoom     -bash: ./locuszoom: Permission denied      `locuszoom` is executable globally, but still can't be executed. The files are on a harddisk mounted at `/media/data1`.


title: DHCP IP lease attempt failed over ethernet and dhcp with netctl

text: My dhcp ethernet works fine in Windows but not in Arch Linux with netctl and dhcpcd. What am I doing wrong? **Output of "ip link"**               1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default          link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00     2: wlp2s0: [...]     3:  eno1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000         link/ether [my mac adress] brd ff:ff:ff:ff:ff:ff      **My netctl profile**               $ cat /etc/netctl/dhcp     Description='ethernet dhcp'     Interface=eno1     Connection=ethernet     IP=dhcp     #IP6=dhcp     #IP6=stateless      **Error message after "sudo netctl start dhcp"**               $ sudo journalctl -xn     -- Logs begin at Fr 2013-12-27 13:25:36 CET, end at Mo 2014-01-13 12:45:22 CET. --     Jan 13 12:44:50 laptop2 network[697]: DHCP IP lease attempt failed on interface 'eno1'     Jan 13 12:44:50 laptop2 network[697]: Failed to bring the network up for profile 'dhcp'     Jan 13 12:44:50 laptop2 systemd[1]: netctl@dhcp.service: main process exited, code=exited, status=1/FAILURE     Jan 13 12:44:50     laptop2 systemd[1]: Failed to start Networking for netctl profile dhcp.      Ok so it has problems getting the network up, doing it myself...               $ sudo ip link set eno1 up     ~$ sudo netctl start dhcp     Job for netctl@dhcp.service failed. See 'systemctl status netctl@dhcp.service' and 'journalctl -xn' for details.     ~$ sudo journalctl -xn     [...]     Jan 13 12:47:20 laptop2 network[1304]: Starting network profile 'dhcp'...     Jan 13 12:47:20 laptop2 network[1304]: The interface of network profile 'dhcp' is already up     Jan 13 12:47:20 laptop2 systemd[1]: netctl@dhcp.service: main process exited, code=exited, status=1/FAILURE     Jan 13 12:47:20 laptop2 systemd[1]: Failed to start Networking for netctl profile dhcp.      **This doesn't help either, setting it down again.**               ~$ sudo ip link set eno1 down      **Trying it with dhcpcd...**               $ sudo systemctl start dhcpcd     ~$ ping www.google.de     connect: Network is unreachable     $ ip link     [...]     3: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000     [...]     $ sudo systemctl stop dhcpcd          ~$ sudo netctl start dhcp     Job for netctl@dhcp.service failed. See 'systemctl status netctl@dhcp.service' and 'journalctl -xn' for details.          ~$ sudo journalctl -xn     -- Logs begin at Fr 2013-12-27 13:25:36 CET, end at Mo 2014-01-13 12:53:06 CET. --     Jan 13 12:52:36 laptop2 dhcpcd[1753]: version 6.1.0 starting     Jan 13 12:52:36 laptop2 dhcpcd[1753]: eno1: soliciting a DHCP lease     Jan 13 12:53:06 laptop2 dhcpcd[1753]: timed out     Jan 13 12:53:06 laptop2 dhcpcd[1753]: exited     Jan 13 12:53:06 laptop2 network[1707]: DHCP IP lease attempt failed on interface 'eno1'     Jan 13 12:53:06 laptop2 network[1707]: Failed to bring the network up for profile 'dhcp'     Jan 13 12:53:06 laptop2 systemd[1]: netctl@dhcp.service: main process exited, code=exited, status=1/FAILURE     Jan 13 12:53:06 laptop2 systemd[1]: Failed to start Networking for netctl profile dhcp.      After deleting the lease at /var/lib/dhcpcd/dhcpcd-eno1.lease6 and trying again, I still get the same error message. Writing "TimeoutDHCP=40" to /etc/netctl/hooks/timeout and making it executable also changes nothing.