title: Can a command line program prevent its output being redirected?

text: I have become so used to do this: `someprogram >output.file` I do it whenever I want to save the output that a program generates to a file. I am also aware of the two variants of this _IO redirection_ :   * `someprogram 2>output.of.stderr.file` (for stderr)   * `someprogram &>output.stderr.and.stdout.file` (for both stdout+stderr combined) Today I have run across a situation I have not thought possible. I use the following command `xinput test 10` and as expected I have the following output:               user@hostname:~$ xinput test 10     key press   30      key release 30      key press   40      key release 40      key press   32      key release 32      key press   65      key release 65      key press   61      key release 61      key press   31      ^C     user@hostname:~$       I expected that this output could as usual be saved to a file like using `xinput test 10 > output.file`. But when contrairy to my expectation the file output.file remains empty. This is also true for `xinput test 10 &> output.file` just to make sure I do not miss something on stdout or stderr. I am really confused and hence ask here if the `xinput` program might have a way to avoid its output to be redirected? ### update I have looked at the source. It seems the output is generated by this code (see snippet below). It appears to me the output would be generated by an ordinary printf               //in file test.c          static void print_events(Display    *dpy)     {         XEvent        Event;              while(1) {         XNextEvent(dpy, &Event;);              // [... some other event types are omnited here ...]                  if ((Event.type == key_press_type) ||                (Event.type == key_release_type)) {             int loop;             XDeviceKeyEvent *key = (XDeviceKeyEvent *) &Event;                  printf("key %s %d ", (Event.type == key_release_type) ? "release" : "press  ", key->keycode);                  for(loop=0; loopaxes_count; loop++) {             printf("a[%d]=%d ", key->first_axis + loop, key->axis_data[loop]);             }             printf("\n");         }          }     }      I modified the source to this (see next snippet below), which allows me to have a copy of the output on stderr. This output I am able to redirect:                //in file test.c          static void print_events(Display    *dpy)     {         XEvent        Event;              while(1) {         XNextEvent(dpy, &Event;);              // [... some other event types are omnited here ...]                  if ((Event.type == key_press_type) ||                (Event.type == key_release_type)) {             int loop;             XDeviceKeyEvent *key = (XDeviceKeyEvent *) &Event;                  printf("key %s %d ", (Event.type == key_release_type) ? "release" : "press  ", key->keycode);             fprintf(stderr,"key %s %d ", (Event.type == key_release_type) ? "release" : "press  ", key->keycode);                  for(loop=0; loopaxes_count; loop++) {             printf("a[%d]=%d ", key->first_axis + loop, key->axis_data[loop]);             }             printf("\n");         }          }     }      My idea at present is that maybe by doing the redirect the program looses its ability to monitor the key-press key-release events.


title: Ligatures missing in some PDFs

text: I have some PDFs which, when viewed in readers under Linux (tried `atril` from MATE and `evince` from GNOME), the ligatures (e.g. _fi_ , _fl_ ) are missing, as can be seen from the example (it should be _specifications_ ): ![enter image description here](http://i.stack.imgur.com/gHZ5E.png) But when I view the same PDF in the built-in reader of Firefox (`pdf.js`) the ligatures are there; thus I know the PDF is not defective. This looks like either this bug a missing font, but how to discover which one? This is the list of fonts in the PDF file: ![enter image description here](http://i.stack.imgur.com/M8mRH.png) I am using Debian unstable (jessie). What I have of fonts installed is               ii  ttf-bitstream-vera                    1.10-8                             all          The Bitstream Vera family of free TrueType fonts     ii  ttf-dejavu                            2.34-1                             all          transitional dummy package     ii  ttf-dejavu-core                       2.34-1                             all          transitional dummy package     ii  ttf-dejavu-extra                      2.34-1                             all          transitional dummy package     ii  ttf-mscorefonts-installer             3.5                                all          Installer for Microsoft TrueType core fonts


title: Creating my own "BBB image" for installing it in several BBBs?

text: I have been working with a Beaglebone Black for a while now, I have created a software for a device which I am happy with. Now I have a few more Beaglebone Blacks where I would like to install the same configuration, libraries and also my software, without going through all the libraries and software installation process over and over again, one by one. I wanted to know if there is a way to create an image (or even some kind of "distro") of my original Beaglebone Black, and install it in the others (from the USB or the SD card, whatever is the best way). I'm not a Linux expert, but I have been working with it in the last year, so I think I can manage to do some "not so noob" stuff.


title: How can I enable framebuffer in Debian

text: How can I enable framebuffer in Debian console? This is what I've already tried:   * Add the following lines to the "/etc/default/grub" file: GRUB_GFXMODE=1024x768 GRUB_GFXPAYLOAD_LINUX=1024x768 The following line is commented out               #GRUB_TERMINAL=console        * I've also add "set gfxpayload=keep" line below "set gfxmode={$GRUB_GFXMODE}" in the "/etc/grub.d/00_header" file.   * Execute "update-grub" Nothing happens. I switched to the second virtual console (Ctrl-Alt-2) and tried to execute the following command:               ~ $ fbi some_image.jpg     using "DejaVu Sans Mono-16", pixelsize=16.67 file=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf     open /dev/fb0: No such file or directory      Why? What am I doing wrong? How can I fix it?


title: Disable sliding feature of tray icons

text: ![](http://i.imgur.com/xz6Ms.jpg) I want to disable sliding feature of these icons. I want them to be static, you know just like Windows perhaps. When I hover my mouse over them they slide & it greatly annoys me to again relocate my mouse pointer. I just want to get rid of the sliding feature.


title: Full screen mode for Chromium or other applications on FreeBSD with Gnome 2

text: Can I set Chromium and some other applications on Gnome 2 in FreeBSD 9 to run in full screen mode? I mean a window that covers the top panel, not Chrome full screen or toggle full screen key binding.   BTW: I use Compiz-Fusion.


title: What do the colours in iptstate mean?

text: I'm running iptstate to try and resolve a VPN issue through my router, and some of the traffic is highlighted in green and some is highlighted in red as I move the cursor up and down the list. I don't know what the significance is - the man page doesn't provide any details. The red traffic is over gre protocol - and the greens are all tcp.


title: Is this method safe or recommended for moving a /home directory?

text: I have my linux install on a small disk. I want to put the home directory on a different hard-drive. I was thinking of using this and then this. Would this work? Is there a better way? Should I just move the entire thing to the new harddrive? The first article describes how to put your home directory into a new partition. The second one describes how to move a partition to a new hard drive.


title: Grub2 on wiped MBR

text: I'm trying to test grub2 on puppet in a VM and one of the tests is to make sure it'll still work on a wiped MBR. So I wipe the MBR with dd if=/dev/zero of=/dev/vda bs=512 count=1 Then I try to install grub2 with grub2-install /dev/vda and get Path ‘/boot/grub2’ is not readable by GRUB on boot. Installation is impossible. Aborting. If I try to install grub2 without wiping the MBR first it works just fine. Any ideas?


title: What's the difference between \b and \< in the grep command

text: In the man page of `grep`, I see               The symbols \< and \> respectively match the empty string at the beginning and       end of a word.  The symbol \b matches the  empty  string at  the  edge  of  a  word.      But I still can't figure out the difference. To me, `\b` is Perl's notation for word boundary, while `\<` is Vim's notation for the same purpose.   PS: English is not my native language. Pardon me if the difference is obvious to you.


title: Can I install Mint to another hard drive without booting from it?

text: Is there an easy way, given an ISO image for Linux Mint, to install it to an empty hard drive from within my existing Ubuntu installation? I don't have any CDs or appropriate USB devices at hand, so I'm looking for a convenient way to install it without going out and buying some.


title: (audio) Files transferred to Motorola Milestone does not stay there

text: I'm using gpodder to manage podcast on Ubuntu machine (thinkpad laptop). When I transfer files to the phone I see the files on the phone sd card via ubuntu file manager, however, when I disconnect the phone and browse the files from android I don't see the file. Connecting the phone back to the machine and browsing to the appropriate folder, I don't see the files.


title: Debian VNC (Remote Desktop) only allowing first connection, then turns off

text: Basically if I reboot the machine, I can `vnc` into it (using ultra vnc) but I can only do it once. It seems that the `vnc` daemon stops working after the first remote desktop session is closed. I have to reboot the machine to VNC into it… I've ran `apt-get update` and `apt-get upgrade`, the system is up to date… I can't figure out why it will only work once.


title: Remove Text from Active Programs in Panel

text: In the panel, how can I remove the text next to the icons of my active programs? All I want to show is the icon. Specifically, in the example below, I want to get rid of where it says "Disc...", "p2-...", "List....", "Ter...", and "*[Un...", but keep their associated icons. ![enter image description here](http://i.stack.imgur.com/Ug40e.png)


title: How to create bootable debian usb drive from an existing linux partition?

text: I've been using linux (ubuntu, debian, and salix) for a few years but have never been able to create a bootable usb drive from within linux. I've always had to use pendrivelinux which is a downloadable .exe I would like to not use windows at all anymore but have not found a guide for this particular problem that I have been able to get working. Can someone provide step by step instructions/links for creating a debian boot usb drive?


title: Can I set appearance for GNOME Debian?

text: Is there any tool to set appearance for GNOME Debian 7.2.0? I feel title bar is too thick and font is too big. I'm just leaving Ubuntu for Debian, so I'm not so familiar with it.


title: Best practice to use $? in bash?

text: When I read this answer about $? another question comes to mind. Is there any best practice for how to use $? in bash? * * * Let's have a example: We have a linear script and I we would like to know that all the command was executed ok. Do you think it is ok to call a small function (let's call it "did_it_work"), to check the error code and break if it's not.               #!/bin/bash           function did_it_work {         code=$1         if [ "$code" -ne "0" ]         then             echo "Error failure: code $code "             exit 1         fi     }          dir=some/path          mkdir -p $dir     did_it_work $?           cd $dir     did_it_work $?           run_some_command     did_it_work $?       This approach of course means that I have to manually solve the problem if there is any and rerun the script. Do you think this is a good idea or is there some other best practice to do this? /Thanks


title: Is it possible to have a screen macro for this?

text: Here's my `.screenrc`:               defscrollback 5000          vbell on     vbell_msg "   dierre!!!  ----  Wuff!!  "               screen -t GRINDER ssh dierre@grinder.dierre.lan     screen -t TRUNK          attrcolor b ".I"     termcap xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'     defbce "on"          # caption always "%3n %t%? @%u%?%? [%h]%?%=%c"     # hardstatus alwaysignore     hardstatus alwayslastline '%{gk}[ %{G}%H %{g}][%= %{wk}%?%-Lw%?%{=b kR}[%{W}%n%f %t%?(%u)%?%{=b kR}]%{= kw}%?%+Lw%?%?%= %{g}]%{=b C}[ %D %m/%d %C%a ]%{W}'      This will open two `screen`(s). The next step I have to do is:   1. `Ctrl+A -> S` to split the screen    2. `Ctrl+A -> \t` to go the the empty screen    3. `Ctrl+A -> "` to open the screen list Now I can choose the other screen and therefore I have a terminal with two splitted screen. Is there a way to create a macro for this? Really annoying to do it every time.


title: How do I stop emacs from asking me if I want to exit a modified file without saving?

text: If I am closing a file that has modifications, emacs warns me about this and says I should press y or n. Even when I press 'n', it still tells me that modified buffers exist and asks if I want to save anyway. Is there a way I can stop this second 'modified buffers exist' message from appearing? Once I have pressed 'n', it should be clear to emacs that I do **not** want to save. I **do** want it to ask me the first 'y or n' question, though.


title: copy smallest files first?

text: I have a large directory containing subdirectories and files that I wish to copy recursively. Is there any way to tell `cp` that it should perform the copy operation in order of file size, so that the smallest files get copied first?


title: Replacing 3 or more digits with equivalent number of *

text: I want to replace any 3 or more digit string in a text file with equivalent number of `*`.For example: abc-1234-45 --> abc-****-45               echo "abc-1234-45" | sed 's/[0-9]\{3,\}/*/'      I tried this but it only replaces it with one *. Kindly suggest a solution here.


title: Terrible performance on linux mint 16

text: I am having difficulty with getting linux mint to cooperate with my desktop. Specs:   * Mobo: Maximux IV Extreme-z   * CPU: i7 2600k   * GPU: 2x R9 290x   * Storage:      * (240GB) 2x OCZ Vertex 3 on RAID0 (Currently using fakeRAID, dmraid)     * 3TB HDD   * Sound: X-Fi Titanium HD Initially I had problems getting Mint to work on the raid, these are the steps I took to solve it               parted /dev/dm-0 (the RAID0 device)     mklabel gpt      then using gparted I made 4 partitions on the RAID0:   * (2MB) unformatted tagged with grub_bios   * (250MB) FAT32 tagged with boot   * (5120MB) linux swap   * (~240000MB) ext4 And one on the HDD: ext4 ~2.73TB so now the OS boots, though its into gnome, not the default cinnamon. I can either use this mode, or with Super Grub2 disk, start with the boot option 'i915.modeset=0'. this boots it into software rendering mode. Which brings me to my first question: Question 1: On my laptop, also using Mint 16, the integrated Intel HD 3000 graphics is detected and used, no assembly required. On my desktop, the integrated Intel HD 2000 graphics is not. Why? And what do I have to do to get it working? this last part is really optional, as I can get the 290x drivers working by doing this: download 13.12 Catalyst Driver for linux: following this (post #32 & #33) then, on reboot, xorg crashes. so i put this in the console               aticonfig --initial      Now the OS is running with hardware acceleration. Great. Except, only during the first login, after each boot, I can generally only use one window at a time, often having to Alt-F4 a window to close it. If I log out, and then back in, the interface is useable, as it should be, but slow. Windows experience screen tearing when moving around, and the whole experience just feels slow. Question 2: Why is the interface non-multitasking upon first log on after boot, but useable after re-logging in? And why does it feel so slow? How do I fix it? Question 3: When comparing specs between my laptop and desktop, I would be expecting faster performance overall, including boot time, on my desktop than what I am getting, and generally the experience is far smoother on my laptop than on my desktop. Why? Question 4: I remember reading somewhere that using a fakeRAID was ill advised in linux, as performance can suffer, would I be better off using mdadm software RAID? Thank you for taking the time to read this, and for any answers you can provide. Any help would be much appreciated. I have been working on the first two problems (RAID0 and Radeon driver) for about 3 days each.


title: how to get the stream URL of flash radio

text: I am listening to a radio stream (flash content in a browser). I want to play this stream directly with mplayer or the like. Doing `lsof -ni` shows me these two lines (among others):               plugin-co 13248 erik   16u  IPv4 5256160      0t0  TCP 192.168.1.15:51459->54.217.212.209:macromedia-fcs (ESTABLISHED)     plugin-co 13248 erik   17u  IPv4 4956101      0t0  TCP 192.168.1.15:59039->54.217.212.209:http (CLOSE_WAIT)      where I suppose the line with `macromedia-fcs` shows the connection to the stream. Who can I get the URL to the stream? Or is it enough to get the exact network address with port number to play the content with mplayer?


title: How to add a 3 lines in a file using shell script?

text: I have a file, that file contain 10 lines. And now I want to add 3 lines to end of the file using shell script. After add lines, If I run the script again I don't want to add same lines again. filename : test.txt               first line : **hello this rajkumar**      Second line: **good morningt**                Third line : **Thank you**


title: What keys are generated during Debian 7.4 (Wheezy) installation?

text: We are concerned lest `/dev/random` (or `/dev/urandom`) be hit too early in the installation process for adequate entropy to be developed. In a basic Debian 7.4 installation (SSH Server and basic utilities only) are any keys, fingerprints, etc. generated before the SSH host key?


title: How to tell Chromium-browser to run a url as single instance not multiple instances?

text: I have a web application which crawls data and any browser download it first the second one will not get that crawl informations. While using Chromium-browser in a PC i start as below:               $ chromium-browser -kiosk "http://pbx/adminkiosk/index?language=EN&username=2002&password=1234" &     sun@sun-Alienware-X51:~$ ps aux | grep "chromium-browser"     sun      31816  0.7  1.5 613092 61384 pts/4    Sl   15:44   0:03 /usr/lib/chromium-browser/chromium-browser -kiosk http://pbx/adminkiosk/index?language=EN&username=2002&password=1234     sun      31818  0.0  0.1 264484  7248 pts/4    S    15:44   0:00 /usr/lib/chromium-browser/chromium-browser -kiosk http://pbx/adminkiosk/index?language=EN&username=2002&password=1234     sun      31819  0.0  0.0   6464   408 pts/4    S    15:44   0:00 /usr/lib/chromium-browser/chromium-browser-sandbox /usr/lib/chromium-browser/chromium-browser --type=zygote     sun      31820  0.0  0.4 281364 18012 pts/4    S    15:44   0:00 /usr/lib/chromium-browser/chromium-browser --type=zygote     sun      31824  0.0  0.1 281364  5404 pts/4    S    15:44   0:00 /usr/lib/chromium-browser/chromium-browser --type=zygote     sun      31849  1.1  2.3 1052972 91968 pts/4   Sl   15:44   0:05 /usr/lib/chromium-browser/chromium-browser --type=renderer --lang=en-US --force-fieldtrials=ForceCompositingMode/disable/InfiniteCache/No/OmniboxHQPReplaceHUPRearrangeNumComponents/Standard/OmniboxSearchSuggestTrialStarted2013Q1/5/OneClickSignIn/BlueOnWhite/Prefetch/ContentPrefetchPrefetchOff/Prerender/Prerender15minTTL/UMA-New-Install-Uniformity-Trial/Experiment/UMA-Session-Randomized-Uniformity-Trial-5-Percent/group_15/UMA-Uniformity-Trial-1-Percent/group_45/UMA-Uniformity-Trial-10-Percent/group_06/UMA-Uniformity-Trial-20-Percent/group_02/UMA-Uniformity-Trial-5-Percent/default/UMA-Uniformity-Trial-50-Percent/group_01/ --disable-gl-multisampling --disable-accelerated-2d-canvas --disable-accelerated-video-decode --channel=31816.0.281183995     sun      31981  0.0  0.0  13584   924 pts/4    S+   15:51   0:00 grep --color=auto chromium-browser      Now because 2 instance opening 2 url the data that gets crawled is delivered to other instance without balance. As a result my apps does not work with Chromium but works with Firefox/Opera. How can i tell Chromium to stop this? And run the url only with one instance not twice?? EDIT: I tried flags but no luck               --process-per-site       --single-process


title: How not to connect to disabled networks when no configured network is available

text: How can I make `wpa_supplicant` **not** connect to expressly **disabled** open networks when no configured network is available? (How can I make it not connect to anything whatsoever?) This happens when my card fails to find my home network. In this case, `wpa_supplicant` connects to any other available network, even disabled networks. For example, my neighbour has an open network (SSID: `xfinitywifi`) with a strong signal. This network is expressly disabled in my `wpa_supplicant.conf`: (See this question also by me.)               network={       ssid="xfinitywifi"       key_mgmt=NONE       disabled=1       priority=0     }      This works most of the time. However, if my card happens not to find my home network, `wpa_supplicant` then just ignores `disabled=1` above, and connects to `xfinitywifi`. This can be shown from `wpa_cli` output (reformatted):               > disconnect     OK     > list_networks     0   neighbour1           any        [DISABLED]     1   xfinitywifi          any        [DISABLED]     2   neighbour2           any     ---CUT---     12  neighbour12          any     13  any                             [CURRENT]     >     > reconnect     OK     <3>CTRL-EVENT-SCAN-RESULTS     <3>WPS-AP-AVAILABLE      <3>SME: Trying to authenticate with 06:1d:d3:4c:37:00 (SSID='xfinitywifi' freq=2447 MHz)     <3>Trying to associate with 06:1d:d3:4c:37:00 (SSID='xfinitywifi' freq=2447 MHz)     <3>Associated with 06:1d:d3:4c:37:00      <3>CTRL-EVENT-CONNECTED - Connection to 06:1d:d3:4c:37:00 completed (reauth) [id=13 id_str=]      Notice that #13 (`any`) is the current network (`[CURRENT]`), which turns out to be #1, `xfinitywifi`, a **disabled** network (`[DISABLED]`).


title: Best practices for job/process tracking and multi-tasking

text: I run 10+ different commands from 10+ different directories, and I need a better process to track everything. I do a lot of debugging, and often times I need to work on multiple issues in parallel. I have lots of scripts that take 30-240 min to run, like:   * create work area   * compile code   * run code to reproduce issue with debug info   * run qualifications I find myself asking the following questions:   * What is running?   * Why is it running? What was I trying to accomplish when I started the script?   * What completed running and when? What was the exit code (pass/fail)? Currently I make notes in a text file regarding what I was doing in each directory, and I manually check terminals or log files to get the running status of everything. Seems like there should be a better way.


title: List all word pairs that appear in a line together in a file

text: How can I use awk to run through a file written as:               Sarah,Masha,Helen     Connor,Jessica,Jennifer,Candace     Betty,Sarah,Helen     John,Harold,Frank,Daisy      and put out all pairs that appeared in a line together without any repeats (Sarah Helen would appear only once here)? meaning,               Sarah Masha     Sarah Helen     Masha Helen     Connor Jessica     etc.      I've been trying to make some kind of for loop but it isn't working for me...


title: How to replace a symbolic link with a copy of a file it links to?

text: Having a (single, no batch filesystem processing needed) symlink, what a command line to use to replace it with a copy of the file it links to?


title: Is it possible for nohup to write the output both to the file nohup.out AND to the screen/terminal?

text: I am using the `bash` shell. I frequently use `nohup` to ensure that my processes are not stopped when I close the shell/terminal that started them. I use a syntax like:               nohup myprocess      When starting, `nohup` gives the message: > `nohup: ignoring input and appending output to 'nohup.out'` Then, `nohup` gives no more output to the screen; it is all written to `nohup.out`. Frequently, however, I would like to monitor the progress of my computation. I can do this by reading `nohup.out` using `vi` or `tail`, but this can be time consuming to do a lot, especially when my computations take several hours. Is there any way that I can print the output to **_both_** `nohup.out` (in case I lose internet connection and thus the terminal that started the process is closed) **_and_** to the screen? Thanks for your time.


title: How to configure the terminal so that a mouse click will move the cursor to the current mouse position

text: What I'm looking for is how to configure the terminal so that it behaves like nano -m. I know that xterm inside fvwm2 running on slackware does this but neither gnome or kde does it. I have tested installing fvwm2 in Ubuntu but xterm still does not have that feature.


title: What does the 'barrier' mount flag mean in Linux?

text: The manual for the 'barrier' mount option is: > barrier=0 / barrier=1 > > This disables / enables the use of write barriers in the jbd code.barrier=0 > disables, barrier=1 enables (default). This also requires an IO stack which > can support barriers, and if jbd gets an error on a barrier write, it will > disable barriers again with a warning. Write barriers enforce proper on-disk > ordering of journal commits, making volatile disk write caches safe to use, > at some performance penalty. If your disks are battery-backed in one way or > another, disabling barriers may safely improve performance. But I do not know what the sentence " _proper on-disk ordering of journal commits_ " means. Suppose normal order -- journal 1,data 1; journal 2, data 2.   Which of the following ordering results will happen if I set `barrier=0`?   1. journal 2, data 2; journal 1, data 1;    2. data 1, journal 1; data 2, journal 2.


title: How to enable `sudo` with custom functions?

text: Recently I learned you can enable `sudo` for custom aliases as follows:               alias sudo='sudo ' # note: the space is required!      The reason this works is the following: > If the last character of the alias value is a space or tab character, then > the next command word following the alias is also checked for alias > expansion. My question is: is there any way to enable `sudo` with custom functions too?


title: qmake error when installing PyQt5

text: I'm trying to install PyQt5 for python3 from source files. I install SIP correctly. Then when I want to prepare the make file for installing PyQt, I get this error:               #python3 configure.py          Error: /usr/bin/qmake failed to create a makefile. Make sure you have a working     Qt qmake on your PATH or use the -q argument to explicitly specify a working Qt     qmake.


title: How do I work with GUI tools over a remote server?

text: I have an Ubuntu server running on EC2 (which I didn't install myself, just picked up an AMI). So far I'm using `putty` to work with it, but I am wondering how to work on it with GUI tools (I'm not familiar with Linux UI tools, but I want to learn). Silly me, I'm missing the convenience of Windows Explorer. I currently have only Windows at home. How do I set up GUI tools to work with a remote server? Should I even do this, or should I stick to the command line? Do the answers change if I have a local linux machine to play with?


title: Weird output by echo

text: I was playing with `echo $$` a while back. Well that displays that pid of the shell. But then I did `echo !` which promptly displayed !. Then `echo !!` produced               echo echo !     echo !      `$echo !!!` gave               echo echo echo !!     echo echo !!      I couldn't understand the outputs. As far as I know, `echo !!` gives the last command that was executed on shell. But the outputs that I get here are weird for me to understand. I use bash shell.


title: Setting up touch driver to run through service

text: We are trying to integrate a touch panel to our Debian system. Touch driver (General touch) I am trying to run this application in Linux service.Below are the steps which i followed **Driver installtion**               cp -rf Gentouch_S/ /usr/local/Gentouch_S/     cp -f 10-evdev.conf /usr/share/X11/xorg.conf.d/10-evdev.conf     cp -f 69-gentouch.rules /etc/udev/rules.d/69-gentouch.rules      **Setting touch in service**                cp genTouchService /etc/init.d/genTouchSevice      chmod 755 /etc/init.d/genTouchSevice      update-rc.d genTouchSevice defaults      **Script details for :/etc/init.d/genTouchSevice**               #! /bin/sh     # /etc/init.d/genTouchSevice     #     # Carry out specific functions when asked to by the system     case "$1" in       start)         logger "Gentouch module started by service"         /usr/local/Gentouch_S/GT_service start         ;;       stop)         logger "Gentouch module stopped by service"         /usr/local/Gentouch_S/GT_service stop         ;;       restart)         logger "Gentouch module restarted by service"         /usr/local/Gentouch_S/GT_service restart         ;;            *)         echo "Usage: /etc/init.d/genTouchSevice {start|stop|restart}"         exit 1         ;;     esac          exit 0      On doing this, I was pretty sure that the application started via service during boot up. verified by log(2014 Aug 20 00:58:24::logger:: Gentouch module started by service) Even though the service started, When i touch my screen i dont see any touch events (No movement in pointer position too) So, Just tried restarting touch driver in below scenarios: **1 . service genTouchSevice restart**               No effeci, Still there was no touch event detection      **2./usr/local/Gentouch_S/ST_service restart**               My application was able to sense the touch events.      What is the error.Unable to find it


title: Re-escape brackets in PS1

text: As others have pointed out, color codes in `PS1` should be bracketed by `\\[` and `\\]` to avoid them taking up horizontal space. I've added the necessary code to `.bashrc`:               highlight()     {         if [ -x /usr/bin/tput ]         then             printf '\['             tput bold             printf '\]'             printf '\['             tput setaf $1             printf '\]'         fi         shift         printf -- "$@"         if [ -x /usr/bin/tput ]         then             printf '\['             tput sgr0             printf '\]'         fi     }          highlight_error()     {         highlight 1 "$@"     }      The last function is used in `PS1` in both normal and escaped command substitutions to be able to change the string based on the result of the previous command:               # Exit code     PS1="\$(exit_code=\${?#0}     highlight_error \"\${exit_code}\${exit_code:+ }\")"          ...          if [ "$USER" == 'root' ]     then         PS1="${PS1}$(highlight_error '\u')"     else         PS1="${PS1}\u"     fi      The issue is then that the escaped brackets are output as literals, so my prompt looks like this after running a command which doesn't exist:               \[\]\[\]127 \[\]user@machine:/path     $      Wrapping the escaped `highlight_error` in `printf %b` didn't help. How can I fix the output so that I can **use the functions for both normal and escaped command substitutions**?


title: Convert linked html files into a pdf file?

text: I would like to convert an online book (linked html files) into a pdf file. I tried the two-step way in http://kmkeen.com/mirror/2009-02-05-14-00-00.html   1. First, download the html files by              wget -nd -mk http://www.unknownroad.com/rtfm/gdbtut/      But it has downloaded a lot of nonrelated files. So I have to remove the unrelated files.   2. Then, I try to convert the downloaded html book into a pdf file:              htmldoc --webpage -f gdb.pdf html/index.html html/*.html      but the order of pages in the pdf file isn't correct. I wonder what good way to download and convert an online book (linked html files) into a pdf file? My OS is Ubuntu 12.04.


title: Flash video always plays on primary monitor in dual monitor setup

text: I have Linux Mint 16 and whenever I play videos using Chrome/Firefox (and they use Flash for video playback) and switch to full-screen mode, it always goes full-screen on the primary monitor. This is so annoying. I googled, and found couple of forum posts, but no solutions were provided in any of those threads. Is anyone aware of this issue and have found a fix?


title: to compare two fields in two different files

text: In `file1`, I have               1023M  BLD     123G   DEV     945K   Deployment     4899   INT      In `file2`, I have               1.2G   BLD     123G   DEV     345M   Deployment     499M   INT      I wanted to compare the first field of `file1` with first field of `file2`. I just wanted to print only the mismatching fields in `file3`


title: How to get the icon for a MIME type?

text: How to get the icon for a MIME type?   I don't want to use `g_file_info_get_icon()` because its input parameter is a file, not a MIME type. My use case: I have a wrapper file which embeds a media object, I can get the MIME type of the media object and want to find the icon of the MIME type. And I don't want to dump the media object to a separate file to use `g_file_info_get_icon()`.


title: How to handle backspace while reading?

text: How do I handle the backspaces entered, it shows `^?` if tried & how `read` counts the characters, as in `12^?3` already 5 characters were complete(though all of them were not actual input), but after `12^?3^?` it returned the prompt, weird. Please help!               -bash-3.2$ read -n 5     12^?3^?-bash-3.2$


title: strace for library calls

text: I know of strace, which is super handy for watching system calls. Is there an equivalent that can trace calls to external libraries? For example, I'm trying to debug some SSLeay misbehavior with a third-party binary that I cannot access the code for (and who's developer is unresponsive). I believe I have nailed down the problem, but I can't test this without seeing exactly how the data being signature-checked is being formatted for sending off to SSLeay.


title: How to get the filename if particular regexp is present in the file in Perl

text: In a directory containing many files, if a particular regexp (or format) was found in file, I'd like to get that filename Example:   1. If the word "rama" is found in file called ramayana, print the filename "ramayana"    2. if a file contains a particular format something like "`(TEXT - NUMBERS)`" in a file name called table, print that filename table in shell that was pretty easy,something like `grep "mytext" * | cut -d':' -f1 | uniq` but how to do it in perl Suggestions on helpful CPAN modules are appreciated, too.


title: Are there any fresh versions of Firefox for Scientific-Linux [or RHEL] available offically?

text: No, I not really want to compile Firefox from source, and I don't want to add any untrusted 3rd party repositories. Google tells me there aren't any solution for having a fresh version of Firefox on Scientific-Linux 6.1. Or are there any methods?


title: run script asynchronously / in a different process

text: I have a simple php script               <?php     for($i=0;$i<10;$i++){     sleep(1);     echo $i;     }      Which I run from the command line               php myfile.php &      I would expect I can do other things in the command line, even before the scripts ends.   I do get a prompt, but when I press the enter I get `[1]+ Stopped php myfile.php`


title: How do I temporary change my keyboard layout on Debian? (no X)

text: How can I quickly change my keyboard layout between US and German? `setxkbmap` does not apply here, as I only have an SSH shell. Persistent changes via               dpkg-reconfigure keyboard-configuration     dpkg-reconfigure console-data      are unwanted as well. I suppose the solution is very simple, but I did not find it.


title: Concatenate multiple files under subdirectories

text: My directory structure is given below `x:\Project_2012-158A\Sample_4041`               SampleSheet.csv     4041_CGTACG_L002_R1_001.fastq     4041_CGTACG_L002_R2_001.fastq     4041_CGTACG_L006_R2_001.fastq     4041_CGTACG_L006_R1_001.fastq      `x:\Project_2012-158A\Sample_4027`               SampleSheet.csv     4027_TAGCTT_L002_R2_001.fastq     4027_TAGCTT_L006_R1_001.fastq     4027_TAGCTT_L002_R1_001.fastq     4027_TAGCTT_L006_R2_001.fastq      `x:\Project_2012-158A\Sample_D425`               SampleSheet.csv     D425_ACTGAT_L008_R2_001.fastq     D425_ACTGAT_L008_R1_001.fastq     D425_ACTGAT_L004_R2_001.fastq     D425_ACTGAT_L004_R1_001.fastq      I want to concatenate the files with "R1" and "R2" separately for every sample. I know               cat file1.fastq file2.fastq > concatenation.fastq       will give concatenate but how do I do that for all the sudirectories with single script?


title: sudo: script launched from another script won't redirect standard output

text: I'm using AIX 5.3 with sudo 1.6.9p23. Sudoers file grants user `fcomartin` permission to run any command as user `oas`:               fcomarti   ALL=(oas) ALL User `oas` has a bash script called menu, which launches other scripts depending on the selected option. The problem is that some of the secondary scripts redirect standard output to text file `temp` which is owned by `oas` user. When this happens the system tells me that user does not have the right permissions to write. User `fcomarti` uses ksh, the used command is as follows:               sudo -u oas bash menu (bash because user `oas` uses bash). Menu starts and then menu launches monitorAv script. Inside monitorAv is the line `echo > temp`; it then errors saying user `fcomarti` does not have the right permissions to write. How can I resolve this?


title: Checkout a file from svn and append its timestamp to its name

text: Suppose I have a file in SVN at               http://example.com/file.txt      I want to check it out to `file-20131218-2000.txt` where December 18, 2013 at 8pm is when the most recent commit to that file happened according to `svn log`. What's a good way to do this in the bash shell?               $ uname -a     Linux my-computer 3.2.0-4-amd64 #1 SMP Debian 3.2.51-1 x86_64 GNU/Linux      My SVN version is 1.6.17.


title: NVIDIA: could not open the device file /dev/nvidia0 (Operation not permitted)

text: When I try to run chrome/ium on command line it says > NVIDIA: could not open the device file /dev/nvidia0` (Operation not > permitted) I don't know whether its related with high CPU usage on YouTube or similar video sites. I have done some search on the net and fixed actions as described, such as removing `/dev/shm` line on `/etc/fstab`, adding `vmalloc=64` or `256` to kernel parameter. None of them worked. Here are the permissions of the files:               crw-rw-rw- 1 root root 195,   0 Tem 21 09:05 /dev/nvidia0     crw-rw-rw- 1 root root 195, 255 Tem 21 09:05 /dev/nvidiactl      Same thing happens when try to do this as root.


title: How does install ATI Radeon HD 7730m (64 bit) driver on Linux Mint 17

text: ` DISTRIB_ID=LinuxMint DISTRIB_RELEASE=16 DISTRIB_CODENAME=petra DISTRIB_DESCRIPTION="Linux Mint 16 Petra" ` ` # lspci | grep VGA 01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Barts LE [Radeon HD 6790] ` ` # glxinfo | grep render direct rendering: Yes OpenGL renderer string: Gallium 0.4 on AMD BARTS GL_MESA_texture_signed_rgba, GL_NV_conditional_render, GL_NV_depth_clamp, GL_MESA_window_pos, GL_NV_blend_square, GL_NV_conditional_render, `


title: How to create a read-only snapshot in LVM, and then rollback to it after some work?

text: What are the commands to use in LVM in case I want to:   1. create a read-only snapshot of a volume;   2. (do some experiments in the volume);   3. and then rollback the volume to the snapshot?


title: Is it possible to change the default COUNT value of tail and head?

text: The `less` command accepts its defaults with an environment variable `LESS`, so you can               export LESS='-F -g -i -M -R -S -w -X -z-4'      at the beginning of your session. Is it possible to change the default lines count returned by `head` and `tail` in a similar fashion? _**An alias is not an option_** , because it breaks explicit option setting (e.g. in a script):               head -n 15 -5      fails with an error in both GNU and busybox `head` at least.


title: awk date identification from input file

text: I currently have daily files that come in via FTP with incorrect dates in the first column of the file. I have figured out how to deduct one day to derive the correct date and print this to a new file. However, as the files come in every day the file name will change and I want to cron the script. My question is how do I get my script to identify the date appended on the end of the in file file and append to the output file? data contained in file:               End Date,Name,Amount     02/07/2014,data1, data2     02/02/2014,data1, data2     02/06/2014,data1, data2     02/06/2014,data1, data2     02/06/2014,data1, data2     02/10/2014,data1, data2     02/12/2014,data1, data2     02/20/2014,data1, data2     02/20/2014,data1, data2     02/21/2014,data1, data2     02/28/2014,data1, data2      Script:               awk 'BEGIN{FS=OFS=","}          NR==1 {print}          NR>1 {            ("date -d \""$1" -1 day\" +%m/%d/%Y")|getline newline            $1=newline            print          }' wrongdates{date1}.csv > correctdates{date1}.csv      'Date1' format is usually `20140228` or `%Y%m%d` _*_ *further to the above I have discovered that this only works on my unix box and not on solaris. I have managed to move it over to nawk on the solaris box but it is now complaining that 'date -d' is not supported and when ever I try to change this I get 'date: bad conversion'. Furthermore the above does not take into account weekends when altering the dates with in the file as I only care about business days and I am trying to introduce if and else statements. as per the below                   nawk 'BEGIN{FS=OFS=","} NR==1 {print};NR>1 {if (date "$1" "+%u"==1) ("date -d \""$1" -1 day\" +%m/%d/%Y")| getline newline; $1=newline; {print}; else ("date \""$1" -3 day\" +%m/%d/%Y")| getline newline; $1=newline; print}' StateStreetPositions20140228.csv      I seem to be getting no ware with the syntax of my if and else statements.


title: How to change the disk signature of a raw image?

text: I am talking about disk signatures in context of the MBR. The area from 440 to 444 bytes. Let's say I got a bootable raw image (bootable in a virtual machine). How can I set the disk signature to a fixed (non-random) value while keeping the raw image bootable? How to automate (script) that? (If you are wondering if that is useful and for what... It is useful in context of verifiable builds.)


title: How can I create a Windows XP installation USB drive?

text: There are two partitions on my hard disk, one is Linux Mint and one is newly formatted. (a simplification) I have Windows XP installation disks and iso files, however my optical drive isn't working. I would like to create a USB flash drive to install Windows from so I can dual boot. **How can I do this from Linux?** I've tried using UNetBootin and it didn't work. I've heard that older versions may work, but not sure which.


title: NFSv4 which "domain" to put in idmapd.conf?

text: I'm using NFSv4 but suddenly when the NFS Server got rebooted, all the files on the Clients are having `nobody` ownerships after the Server is booted and started its whatever services again. Then I found some solutions to set the `Domain=_____` in the `idmapd.conf` file.   * But what am I suppose to put there (in both Server and Clients)?   * I only have IP addresses.


title: Script to change ownership of files

text: I am new to unix. I want to write a script to change the ownership of files from root to myuser. Script which will check the ownership and if found as root will change it to myuser. The script should also log errors to a file. I know how to change ownership of files but not sure about putting the same in a script Please help.


title: Attach to an existing ssh tunnel

text: I have an existing ssh tunnel which connects machine `A` to `C` over `B`.               #user@A: ssh -N user@B -L 9999:C:9999       Is there any way to create a new ssh tunnel on `D` and attach it to the existing tunnel so that i can connect machine `D` to `C`? I tried to use               #user@D: ssh -N user@A -L 9999:C:9999       but I get a `no route to host` error when trying to connect to `C` with               #user@D: telnet localhost 9999


title: `cd` all screens to the PWD of the current screen

text: Suppose that I am running `screen` on a remote server with four open screens. Is there a quick way to `cd` all the screens to the working directory of the currently-open screen?


title: mutt: trash macro

text: In my previous question I have learned how to implement `trash` functionality in `mutt`.               unset confirmappend     folder-hook . set trash="=trash"     folder-hook trash$ unset trash      That works well, except that I have to confirm every deletion. I would like it to work without the delete confirmation. So that I only need to press `d` and then `$` to sync, without being asked for confirmation. Can somebody please suggest how to do it?


title: ubuntu server 12.04 lts is there a way to enable sleep mode and wake on lan?

text: I was wondering if it were posible to make my server go to sleep after a set period of time, but still be listening for lan requests. I use my server as a media server that might get used 3 or 4 hours a day and it is really a waste of power to have it running all the time. However I don't want to run up to the second floor to switch it on when we want to watch a movie. I saw a few posts about stopping this from happening but how do you enable it?


title: Fedora 16 to Fedora 17 post-upgrade tasks

text: I have just successfully upgraded from Fedora 16 to Fedora 17 using the Preupgrade tool. One of the post-upgrade steps suggested here is to "remove unsupported packages". The guide says to run `package-cleanup --orphans` to obtain a list of said packages and then `yum remove` each one. Rather than blindly do this I thought I'd check to make sure that this wouldn't unintentionally remove any needed dependencies. For example, `ModemManager-0.5.3.96-1.fc16.x86_64` is the first package in the list. When I run:               yum remove ModemManager-0.5.3.96-1.fc16.x86_64      I see that it also wants to remove a number of dependencies that look like valid Fedora 17 packages:               =======================================================================================      Package                     Arch     Version                       Repository    Size     =======================================================================================     Removing:      ModemManager                x86_64   0.5.3.96-1.fc16               @updates/16  952 k     Removing for dependencies:      NetworkManager              x86_64   1:0.9.4.0-7.git20120403.fc17  @anaconda-0  6.7 M      NetworkManager-gnome        x86_64   1:0.9.4.0-7.git20120403.fc17  @anaconda-0  1.3 M      NetworkManager-openconnect  x86_64   0.9.4.0-7.git20120612.fc16    @updates/16  274 k      NetworkManager-openvpn      x86_64   1:0.9.3.997-1.fc17            @anaconda-0  679 k      NetworkManager-pptp         x86_64   1:0.9.3.997-1.fc17            @anaconda-0  467 k      NetworkManager-vpnc         x86_64   1:0.9.3.997-1.fc17            @anaconda-0  474 k      anaconda                    x86_64   17.29-1.fc17                  @anaconda-0   12 M      evolution-NetworkManager    x86_64   3.4.1-2.fc17                  @anaconda-0   14 k          Transaction Summary     =======================================================================================     Remove  1 Package (+8 Dependent packages)           If I do `yum list NetworkManager` I see:               Installed Packages     NetworkManager.x86_64         1:0.9.4.0-7.git20120403.fc17        @anaconda-0     Available Packages     NetworkManager.x86_64         1:0.9.6.4-1.fc17                    updates      I also notice that none of the dependencies listed by `yum remove` are in the orphaned package list.   * Is it safe for me to go ahead and remove these "orphaned" packages?    * Do I have to remove these orphaned packages (I'm not short on disk space)?


title: VNC Server: Disable local screen when remote VNC client connects

text: There is a Linux desktop/server co-located at **location-b**. I am stationed at **location-a** and use a VNC client to connect to **location-b**. To prevent others from watching my desktop actions, how can I disable/blank the remote desktop at **location-b** when my VNC client connects?


title: Problems using NTFS file system with kali linux

text: Using kali linux 1.0 in dual boot with windows 8. I have an NTFS partition (D: on windows) I usually mount it on both OS. I face the following problem Windows disk repair utility keeps on reporting errors frequently. After a repair it appears again after a few days. Is this avoidable problems or do i have to switch to some other file system?


title: How to Always make the ttyUSB0 none root access allowed?

text: Ubuntu 13.10 64-bit OS. I have a service running using Python serial the application running without root as username. But it has to access /dev/ttyUSB0 , so i need to do every time manually chmod -R 777 /dev/ttyUSB0 When i reboot the PC again i have to do it manually. Is there any way automatically make the /dev/ttyUSB0 to ttyUSBxxx always available by any users? So that i do not need to do that manually every single day on reboot?


title: UTF-8 in Terminator

text: I use the Terminator terminal emulator, and out of pure boredom, I installed and attempted to run this program: https://github.com/thiderman/doge However, it requires UTF-8 encoding to work. I opened Terminator's preferences, and went into the default profile's compatibility tab, and it was already set to UTF-8. I don't use any custom profiles. Output of `locale charmap # UTF-8` was `ANSI_X3.4-1968`. How can I make this work properly. I did test in UXterm, and it ran fine. I'm running Arch Linux using the GNOME 3 GUI. EDIT: Output of `locale -a`:               $ locale -a     C     POSIX     en_US     en_US.iso88591     en_US.utf8      It seems like I have a locale setting called "C", and I can't seem to bring UTF-8 to the top.


title: How do I find out the keycodes for Ctrl+up and down arrow for TERM=screen?

text: I am using tmux a lot, and I have already managed to tune my OS X terminal to send the correct key codes for Ctrl+left and right arrow (`\033b` and `\033f`). I found those information on the web. However, I also need Ctrl+up and down to work correctly. How do I find out which key codes tmux expects? The `TERM` variable is set to `screen` while inside of tmux. Can I query the terminal database on my Linux machine for the codes? At the moment, my OS X terminal simply sends arrow left and right, without the Ctrl modifier.


title: why debian repository does not contain lokkit?

text: I was using lokkit in redhat, and I want to use it in debian, but it seems that debian doesn't contain it...


title: Removing SQL permissions in webmin

text: This may seem like a dumb question, but can anyone tell me how to remove permissions for MySQL users using webmin? I really can't figure it out. ![enter image description here](http://i.stack.imgur.com/IkHqP.png)


title: Retrieve spanned archive from raw disk image

text: When I open the image in a hex editor, there is the header of a PK spanned archive (50 4B 07 08), then 4 more zip files following (50 4B). When copying the values and saving as a zip file, the files return corrupt etc. Am I copying the values wrong as I dont know exactly where the hex values end for that file maybe. Is there a way to find out? note: this files were hidden on purpose


title: NTFS USB-Connected Partition Will Not Mount

text: First Error, when connecting the drive or attempting to mount it manually:               Mount is denied because the NTFS volume is already exclusively opened.      The volume may be already mounted, or another software may use it which     could be identified for example by the help of the 'fuser' command.      So we try to umount it and get:               umount: /var/run/media/blah/foo: mountpoint not found      So we add a mountpoint somewhere else and try mounting there, and get the first error, then try umounting again, and get:               umount: /var/run/media/blah/foo: not mounted      ... no reference to the location I gave it on the mount - /media/foo (a location that exists) - but no complaint that the mountpoint is 'not found' this time. If I check with the mount command, it does show the device mounted:               /dev/sdb1 on /var/run/media/blah/foo type fuseblk     (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,     allow_other,blksize=4096)      Yet umounts fail. The 'force' option does nothing in any of these cases. So, it seems the device is 'already mounted' if I want to mount it, as evidenced by the output of 'mount' - but not mounted if I want to umount it. Note, the device was NOT connected to a Windows that hibernated, and running the command to delete the hibernate file (worth a shot) fails again with the 'not mounted' error. Also, the FAT32 partition on the same device works fine. Ideas please? Thanks.


title: File System in Linux

text: Why we need a filesystem. Can we use OS without file system because our kernel has already in build module. For example if we doesn't need /lib/modules directory .So why we need file system


title: Creating list of domains using httpd.conf

text: I am trying to create a bash script that can generate a file which contains a full list of domains - from Apache's configuration file - that a web server hosts. It actually seems quite easy. From what I see ServerName and ServerAlias are the key directives those will be necessary to generate this list. What confuses me is the possibility of having multiple number of Aliases. An example entry.               <VirtualHost IP_ADDR:PORT>         ServerName domain-1.tld         ServerAlias www.domain-1.tld         DocumentRoot /home/domain-1.tld/public_html         ServerAdmin webmaster@domain-1.tld         UseCanonicalName Off         CustomLog /usr/local/apache/domlogs/domain-1.tld combined         CustomLog /usr/local/apache/domlogs/domain-1.tld-bytes_log "%{%s}t %I .\n%{%s}t %O ."     </VirtualHost>      A second entry.               <VirtualHost IP_ADDR:PORT>         ServerName domain-2.tld         ServerAlias www.domain-2.tld some-other-domain.tld another-domain.tld         DocumentRoot /home/domain-2.tld/public_html         ServerAdmin webmaster@domain-2.tld         UseCanonicalName Off         CustomLog /usr/local/apache/domlogs/domain-2.tld combined         CustomLog /usr/local/apache/domlogs/domain-2.tld-bytes_log "%{%s}t %I .\n%{%s}t %O ."     </VirtualHost>      What would be the best approach in bash - to generation of this list?


title: Debian 7: Add repository for gcc-4.8 and g++-4.8

text: I want to be able to `sudo apt-add-repository` with a ppa for gcc-4.8 and g++-4.8. I was able to do this on Ubuntu using (after adding the ppa) `sudo apt-get install g++-4.8`. So far I have been able to install (apt-get) the python-software-properties, which allows me to use the apt-add-repository command/script. What are the gcc, g++ ppa's which I should be using for Debian 7? Thanks in advance.


title: Which driver should I use for my GeForce4 MX 440 on Fedora 20?

text: I have an old computer with an nVidia GeForce4 MX 440 graphics card. On Fedora 20 I have a selection of three nVidia drivers from the RPM Fusion repos:   * `kmod-nvidia`   * `kmod-nvidia-173xx`   * `kmod-nvidia-304xx` I'd use the akmod packages, but that's beside the point. So, for this old graphics card, which driver should I use? Or should I stick with the nouveau drivers?


title: How to install D-Link DWA-160 revision B2 with Ralink chipset on Debian Linux?

text: I just bought a D-Link DWA-160 revision B2. Little did I know that this revision comes with a Ralink chipset. The main reason why I got DWA-160 is because I already have one and I'm pretty happy with it. I mainly use it on a Windows computer, but I know that it works in Ubuntu 12.04 LTS for example, and it works out of the box. But my old DWA-160 is revision A2 and it uses an Atheros chipset.   * DWA-160, rev A2 - my old one - works well with Linux   * DWA-160, rev B2 - the new one - doesn't appear to have support on Linux Maybe it's not that it's impossible to get it to work on Linux, as much as it is a difficult task for me. I am new to Linux and I am really trying to embrace Linux, but problems like these are giving me hard time. I found this guide, and this appears to be the only guide on the whole holy web that has any viable information about this particular issue. But just looking at those commands makes my brain cook. So can someone please help me follow this guide by providing more digestible and understandable instructions? Also, this user explains how to do this on a Ubuntu Linux, can I still follow that guide point by point even on Debian Linux? I'm thinking that available dependencies and packages on each distro might be different. According to Debian Wiki article, the carl9170 driver supports DWA-160 rev. A1 and A2 (these are Atheros). It does not say anything about B1 or B2 (these are Ralink). This driver is provided with Debian 7.2.1 (Wheezy) which is what I have. I tried plugging in my DWA-160 in a USB port anyway, it didn't even blink. So what now?... just blindly follow the instructions given by that French guy and hope for the best?


title: Running a bash script as root prevents asynchronous execution?

text: The script below get's executed differently if run as a root user.               #!/bin/sh          gnome-terminal -x sleep 10      echo 'Why must I wait for sleep to finish?'      If its run as a regular user, message is printed alongside of the newly opened terminal that waits 5 seconds. If run as a root user, the message isn't printed until the first command doesn't end. System details:   * Ubuntu 12.4   * `whereis gnome-terminal` is the same for root and standard user What is the explanation for such behavior?


title: Small RAM-based /tmp

text: My VPS host's web interface for configuration gives me a dropdown box to set my /tmp. The default is "16MB ram" and the alternative is "harddisk". Is it possible that having only 16MB of /tmp available could cause trouble for some software? Or not?


title: How to limit the number of process that a user can create?

text: I think I have a program that creates countless forks of itself (not intentionally, I hope). I like to test this but I can't kill the machine, so how could I limit the number of process to execute this in a sage way?


title: how to prevent exported environment variables to be recognized/accessible by a child shell (bash)?

text: So, I need to prevent loads of exported variables to be recognized by a child shell. The problem is an application (Wine+UDK) wont build projects with too many (>65535) bytes on the environment, and mine has a lot (95323) after I use a project (ScriptEchoColor) that shares environment variables between any bash shells. I cant find a command that will allow me to spawn a child shell that wont accept current environment variables and instead will just use the ones that are set on my user profile and on the system as a whole. I tried many options shown at `bash --help`.


title: Add parameters to default profile in terminator

text: I would like to have some options which are not present in the GUI preferences of Terminator, such as `force_no_bell = True`. I want them to be set even for the default profile. But whenever I set it, and restart, Terminator sets the profile back to defaults (i.e `force_no_bell = False`). My `terminator.config` is all defaults except some flashy colors.               $uname -a     Linux TUXBOX 3.15.8-1-ARCH #1 SMP PREEMPT Fri Aug 1 08:51:42 CEST 2014 x86_64 GNU/Linux     $pacman -Q terminator     terminator 0.97-2


title: fdisk isn't showing my hard drive as properly formatted (but it is)

text: I've got 3 1TB drives which I've set up to use LVM. Here's the output of `pvdisplay`:                 --- Physical volume ---       PV Name               /dev/sda1       VG Name               vgpool       PV Size               931.51 GiB / not usable 728.00 KiB       Allocatable           yes (but full)       PE Size               4.00 MiB       Total PE              238467       Free PE               0       Allocated PE          238467       PV UUID               22ZgJ3-ep7X-flT6-KD1u-fWr1-Q8u9-2V28Ad            --- Physical volume ---       PV Name               /dev/sdc1       VG Name               vgpool       PV Size               931.51 GiB / not usable 728.00 KiB       Allocatable           yes (but full)       PE Size               4.00 MiB       Total PE              238467       Free PE               0       Allocated PE          238467       PV UUID               3b7vE1-gXPo-Moxm-5F46-vOPb-UpyF-mjo7ad            --- Physical volume ---       PV Name               /dev/sdb1       VG Name               vgpool       PV Size               931.51 GiB / not usable 728.00 KiB       Allocatable           yes        PE Size               4.00 MiB       Total PE              238467       Free PE               774       Allocated PE          237693       PV UUID               dFWNtb-WbyA-HSVz-urls-G0Y9-x2W0-jwsoTq      Everything looks good right? Now, I run `sudo fdisk -l`:               Disk /dev/sda: 1000.2 GB, 1000204886016 bytes     255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x00000000          Disk /dev/sda doesn't contain a valid partition table          Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes     81 heads, 63 sectors/track, 382818 cylinders, total 1953525168 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x2e962a62             Device Boot      Start         End      Blocks   Id  System     /dev/sdb1            2048  1953525167   976761560   8e  Linux LVM          Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes     81 heads, 63 sectors/track, 382818 cylinders, total 1953525168 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0xe95df8a7             Device Boot      Start         End      Blocks   Id  System     /dev/sdc1            2048  1953525167   976761560   8e  Linux LVM          Disk /dev/mapper/vgpool-lvstuff: 2997.4 GB, 2997362884608 bytes     255 heads, 63 sectors/track, 364408 cylinders, total 5854224384 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x00000000          Disk /dev/mapper/vgpool-lvstuff doesn't contain a valid partition table      My concern is that `fdisk` says `sda` doesn't have a valid partition despite me formatting each drive correctly as LVM (`8e`). This is my first time playing with LVM so did I do something wrong? * * * `lshal`:                 block.device = '/dev/sda'  (string)       block.is_volume = false  (bool)       block.major = 8  (0x8)  (int)       block.minor = 0  (0x0)  (int)       block.storage_device = '/org/freedesktop/Hal/devices/storage_serial_WDC_WD10EARS_00Y5B1_WD_WCAV5C337141'  (string)       info.capabilities = {'storage', 'block'} (string list)       info.category = 'storage'  (string)       info.parent = '/org/freedesktop/Hal/devices/pci_8086_3b22_scsi_host_scsi_device_lun0'  (string)       info.product = 'WDC WD10EARS-00Y'  (string)       info.udi = '/org/freedesktop/Hal/devices/storage_serial_WDC_WD10EARS_00Y5B1_WD_WCAV5C337141'  (string)       info.vendor = 'ATA'  (string)       linux.hotplug_type = 3  (0x3)  (int)       linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda'  (string)       storage.automount_enabled_hint = true  (bool)       storage.bus = 'pci'  (string)       storage.drive_type = 'disk'  (string)       storage.firmware_version = '80.00A08'  (string)       storage.hotpluggable = false  (bool)       storage.lun = 0  (0x0)  (int)       storage.media_check_enabled = false  (bool)       storage.model = 'WDC WD10EARS-00Y'  (string)       storage.no_partitions_hint = false  (bool)       storage.originating_device = '/org/freedesktop/Hal/devices/computer'  (string)       storage.removable = false  (bool)       storage.removable.media_available = true  (bool)       storage.removable.media_size = 1000204886016  (0xe8e0db6000)  (uint64)       storage.requires_eject = false  (bool)       storage.serial = 'WDC_WD10EARS-00Y5B1_WD-WCAV5C337141'  (string)       storage.size = 1000204886016  (0xe8e0db6000)  (uint64)       storage.vendor = 'ATA'  (string)


title: Merging flv files causes a massive size increase

text: I have 3 flv files which I wish to merge. I used the answer in this post: Merge multiple flv files? which suggested this option: mencoder -forceidx -ovc copy -oac pcm -o output.flv input1.flv input2.flv It seems to have worked except that the merged file is 400meg in size whereas the original 3 files were about 33meg each. Is this expected? Is there a way to join the 3 files without the massive increase in size?


title: How secure my server is... should I worry? How to increase protection

text: I updated my server yesterday to a new version of CentoOS including a new version of DirectAdmin panel. This new installation comes with Brute Force Monitor service. As far as I see, this BFM protects brute force tries. In just 24h of this new server, I see that my 5 sites had 10,000 brute force tries. Basically I see creatures from mud, scum, trying to use my mail server (dovecot) to send emails and also attacks to gain access thru ssh. Apparently these attacks are failing. My questions are:   1. are these attacks really failing?   2. what kind of protection is given by this BFM service? I ask this because I see some entries on BFM log reporting 4265 tries of the same IP? How is this allowed, isn't reasonable for BFM to ban that IP after 3 or 5 wrong tries?   3. should I be worried?   4. how can I protect my mail server even more? thanks


title: How to set ST_BUFFER_BLOCK in centos6.5

text: To enable large transfers to tape under Linux (>64 KB per write), i have to set the ST_BUFFER_BLOCKS for that i have to edit the file /usr/src/linux/drivers/scsi/st_options.h and change the definition of ST_BUFFER_BLOCKS but the file st_options.h is not present in my centos is there any other way through which i can set buffer block or it is having different name...??? if anyone face this issue please help me..thanks..!!!


title: Crontab with Github

text: I want to be able to push a repository to Github at midnight, every night. I know that Github isn't a back-up service, and, in no way am I expecting it to be this - I just want the best up-to-date version on Github and this works for me, and, my team. What I was thinking is this:   * Creating a Bash script that pushes the repository to Github normally    * In Crontab, execute the script at midnight every day of the week.  Would this be the best method to use? If so, this seems easy enough to do. My next problem :) I want an email to be sent to me, after the repository has been pushed, so it would just send an email saying: "Repository Pushed.. Ok" or if there was a problem, it would alert me to this. Is this possible? If so, could anyone please provide some examples of how to do this. Hope someone can help :)


title: execute file in server more safely?

text: We have a application which takes a C++, C, or Java file as input, executes it, and displays the output to the client. What are the best measures that can be taken so that no security related issues occur in the server in which program is executed. For example, the C++ program can open an fstream and create a custom file on our server I know some practices like:   1. Running it as normal user   2. Writing our own sandbox scripts which do not allow system calls, etc. Which is the best way to do this?


title: How does systemd-tmpfiles work?

text: I'm trying to change the value of `/sys/bus/usb/devices/4-3/power/wakeup` at every boot (4-3 according to my `lsusb`, it's the keyboard ID). The default value is:               # cat /sys/bus/usb/devices/4-3/power/wakeup     enabled      The classic "online" editing works as expected:               # echo disabled > /sys/bus/usb/devices/4-3/power/wakeup     # cat /sys/bus/usb/devices/4-3/power/wakeup     disabled      I'm using a systemd distro so I'd like to use the systemd-way to edit "temp files" I have created the following file:               # cat /etc/tmpfiles.d/disable-usb-wakeup.conf      w /sys/bus/usb/devices/4-3/power/wakeup - - - - disabled      but after every boot I still have the default value in this file (i.e. enabled) I'm doing something wrong? EDIT: I have done another test:               # cat /etc/tmpfiles.d/scheduler.conf      w /sys/block/sda/queue/scheduler - - - - deadline      and this one works fine! After boot I have:               # cat /sys/block/sda/queue/scheduler      noop [deadline] cfq       (the default one was the cfq scheduler) So, why this one works and the other one not?   * Because `/sys/bus/usb/devices/4-3/power/wakeup` is a symlink to `/sys/devices/pci0000:00/0000:00:12.1/usb4/4-3/` ?   * Because `/sys/bus/usb/devices/4-3/power/wakeup` contains only one word? (i.e. no spaces)


title: Brightness issues (etc.) with Nvidia Card in OpenBox

text: After a fresh install of Crunchbang Linux 11 on an Intel 486 powered machine I struggle with setting the display brightness which blasts at 100% … this is really, physically painful. My efforts to set up the `xorg.config` file usually results in booting in the most basic graphics mode. After all I've messed up the whole graphics department bad enough to the point of having to reinstall the whole thing.               01:00.0 VGA compatible controller: NVIDIA Corporation NV17GL [Quadro NVS] (rev a3) (prog-if 00 [VGA controller])             Subsystem: NVIDIA Corporation Device 015d             Flags: bus master, 66MHz, medium devsel, latency 64, IRQ 18             Memory at fd000000 (32-bit, non-prefetchable) [size=16M]             Memory at f8000000 (32-bit, prefetchable) [size=64M]             Memory at fc200000 (32-bit, prefetchable) [size=512K]             [virtual] Expansion ROM at fc000000 [disabled] [size=128K]             Capabilities: [60] Power Management version 2             Capabilities: [44] AGP version 2.0             Kernel driver in use: nouveau      **`uname`** output:               3.2.0-4-486 #1 Debian 3.2.54-2 i686 GNU/Linux      As I work on a really old keyboard (PS/2 Plug) I don't have any `Fn` keys or such which usually work perfectly fine. 100% brightness all the time cause headache, pain in the eyes an no more ability to concentrate anymore. Any idea or hint where did I took the turn into this dead end? * * * **Update** As Karol Babioch pointed out, brightness is controlled via `/sys/class/backlight/` - which is empty here. Any ideas?


title: Is there difference between Xvfb option `-extension` and `+extension`?

text: I'm facing `RANDR missing` problem with Xvfb and firefox. Some people suggested `Xvfb :1 -extension RANDR` can solve the problem. But I found a also `+extension` option. In my environment(CentOS6.5), the both fails. But I want to know at least if there is difference between `-extension` and `+extension`. I couldn't find entry about it in `man Xvfb`. Do someone know about it?


title: How to redirect whatever I enter in terminal to file

text: I am a novice just learning Fedora 13. I just wanted to know if its possible to redirect whatever I type in the terminal to a file, so that I would be able to see from the file, that a particular command gives this output. So whatever I am doing should go to a file.


title: The proper way to turn off an external sata encolsure?

text: I have an e-sata external enclosure with a port expander and 4 sata disks in it that I use for periodic backups. I have what I think is a sound method for powering it off, but not sure if it is the best method. After unmounting the filesystem and stopping the volume group on the disks, here is what I currently do:               echo 1 > /sys/block/sdg/device/delete      echo 1 > /sys/block/sdh/device/delete      echo 1 > /sys/block/sdi/device/delete      echo 1 > /sys/block/sdj/device/delete      or               smartctl -s standby,now /dev/sdg     smartctl -s standby,now /dev/sdh     smartctl -s standby,now /dev/sdi     smartctl -s standby,now /dev/sdj      or               echo "scsi remove-single-device 5 0 0 0" > /proc/scsi/scsi     echo "scsi remove-single-device 5 1 0 0" > /proc/scsi/scsi     echo "scsi remove-single-device 5 2 0 0" > /proc/scsi/scsi     echo "scsi remove-single-device 5 3 0 0" > /proc/scsi/scsi      Of these options, I like the last one because it is the only one that writes something to the log, e.g.               sd 5:0:0:0: [sdg] Stopping disk     ata6.00: disabled     sd 5:1:0:0: [sdh] Synchronizing SCSI cache     sd 5:1:0:0: [sdh] Stopping disk     ata6.01: disabled     sd 5:2:0:0: [sdi] Synchronizing SCSI cache     sd 5:2:0:0: [sdi] Stopping disk     ata6.02: disabled     sd 5:3:0:0: [sdj] Synchronizing SCSI cache     sd 5:3:0:0: [sdj] Stopping disk     ata6.03: disabled      And then I flip the power swtich on the enclosure to remove power from the disks. I've never had problems with any of these methods, but I do get a lot of complaints from the ata device when I poweroff. This is what the log shows when turning off the enclosure (note the disks are synced and stopped by this point via one of the methods above, this is just from flipping the switch):               ata6.00: failed to read SCR 1 (Emask=0x40)     ata6.01: failed to read SCR 1 (Emask=0x40)     ata6.02: failed to read SCR 1 (Emask=0x40)     ata6.03: failed to read SCR 1 (Emask=0x40)     ata6.04: failed to read SCR 1 (Emask=0x40)     ata6.15: exception Emask 0x50 SAct 0x0 SErr 0x4490801 action 0xe frozen     ata6.15: irq_stat 0x00400040, connection status changed     ata6.15: SError: { RecovData HostInt PHYRdyChg 10B8B Handshk DevExch }     ata6.00: exception Emask 0x100 SAct 0x0 SErr 0x0 action 0x6 frozen     ata6.01: exception Emask 0x100 SAct 0x0 SErr 0x0 action 0x6 frozen     ata6.02: exception Emask 0x100 SAct 0x0 SErr 0x0 action 0x6 frozen     ata6.03: exception Emask 0x100 SAct 0x0 SErr 0x0 action 0x6 frozen     ata6.04: exception Emask 0x100 SAct 0x0 SErr 0x0 action 0x6 frozen     ata6.15: hard resetting link     ata6.15: SATA link down (SStatus 0 SControl 300)     ata6.15: qc timeout (cmd 0xe4)     ata6.15: failed to read PMP GSCR[0] (Emask=0x4)     ata6.15: PMP revalidation failed (errno=-5)        * Is there anything I can to do to cleanly stop the ata device (ata6.15 in this case) similar to how I deal with the block devices prior to poweroff?  Note: I have seen this question which might seem like a dupe at first glance, but it focuses on deregistering the disks and doesn't address the portion of my question about properly closing the ata bus device, if able.


title: What is “access control” with X Server?

text: What is an access control restriction with an X Server? There is the `-ac` option that "disable access control restrictions" with e.g. Xephyr. I saw some example using that option, but I have no idea how it works and why it is necessary. Can you show me a example in which case I should use this option and in which case I shouldn't?


title: Mount Freecom Classic SL Network Drive (NDAS) in Ubuntu 11.10

text: Both the Network Drive and the Ubuntu machine are connected by Ethernet to a Linksys WRT54GL router (192.168.1.1). To access the Network Drive in Windows, I installed the NDAS software and mounted the drive in read/write mode by entering a 20-digit device ID and corresponding 5-digit write key. How do I mount the device in Ubuntu? Several questions on Ask Ubuntu mention Samba and CIFS. I'm guessing I will need to mount it as a network share, but I don't know how. Is there a step-by-step guide for mounting NDAS devices in Ubuntu?


title: Is there a way of deleting duplicates more refined than fdupes -rdN?

text: Recently I have the need to delete a lot of duplicates. I am merging three or four filesystems, and I want the space to be used economically. At first, `fdupes` seemed like it was the best tool for the job, but I am increasingly running into limitations. Consider the command `fdupes -rdN somedirectory/`. This makes a hash of all of the files in the subdirectories of somedirectory. And when it encounters duplicates, it deletes them, so that there is only one copy of everything. But what if I want to keep `somedirectory/subdirectory1/somefile` and there are, in fact, four duplicates, and the program encounters one of the duplicates first? Then it deletes `somedirectory/subdirectory1/somefile`, which I don't want. I want to be able to specify, somehow, which duplicates to keep. And so far, none of the standard programs for dealing with duplicates (duff, FSLint) seem to allow automation of that kind of behavior. I'd prefer not to roll my own, so that's why I'm asking this question. I'd like to be able to write something like               killdupes -rdN --keep=filesin,somedirectories,separated,by,commas somedirectory/


title: Do I own a watchdog?

text: Quite often times when I do a reboot, I get the following error message:               kernel: watchdog watchdog0: watchdog did not stop!      I tried to find out more about watchdog by doing `man watchdog`, but it says no manual entry. I tried `yum list watchdog` and found that it was not installed. However, when I look at the `/dev` directory, I actually found two watchdogs: `watchdog` and `watchdog0` I am curious. Do I actually own any watchdogs? Why does the kernel complain that it did not stop when I do a reboot?


title: Setting up VGA Passthrough on Ubuntu with KVM : error no iommu_group for device qemu-system-x86_64

text: I'm trying to configure the VGA Passthrough on the Debian SID because I want to use Debian on the first monitor and Windows 7/8 on the other one. I have tried with XEN and with KVM but in both case I haven't been able to reach the goal. This is the tutorial that I'm following:   * http://www.pugetsystems.com/labs/articles/Multiheaded-NVIDIA-Gaming-using-Ubuntu-14-04-KVM-585/ These are the specifications of my system:   * Motherboard   * CPU   * Graphics Card               root@ziomario-Z87-HD3:/home/ziomario# lspci -nn | grep NVIDIA 01:00.0 VGA     compatible controller [0300]: NVIDIA Corporation GK106 [GeForce GTX 660] [10de:11c0] (rev a1) 01:00.1 Audio device [0403]: NVIDIA Corporation GK106 HDMI Audio Controller [10de:0e0b] (rev a1)          root@ziomario-Z87-HD3:/home/ziomario# lspci -nn | grep VGA 00:02.0 VGA     compatible controller [0300]: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller [8086:0412] (rev 06)      and this is the error I get:               root@ziomario-Z87-HD3:/home/ziomario# sudo /usr/vm1      qemu-system-x86_64:          -device vfio-pci,host=01:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on: vfio: error no iommu_group for device qemu-system-x86_64:          -device vfio-pci,host=01:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on: Device initialization failed. qemu-system-x86_64:          -device vfio-pci,host=01:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on: Device 'vfio-pci' could not be initialized


title: How to quit Menu Item mode in the info command page

text: I am using `info` command, and when I press `m`, the keyboard prompt goes into a `menu item:` mode and I don't know how to quit from this mode. I tried `q` and `ESC`, but it didn't work. Finally, I used `Ctrl`+`C` to quit. Is there any decent way to quit the `menu item:` prompt mode in the "info" command?


title: How to prevent dwm from tag switching when launching Skype

text: I'm running dwm and Skype included in it's tag rules:               static const Rule rules[] = {         /* class      instance    title       tags mask     isfloating   monitor */         <snip/>         { "Skype",  NULL,       NULL,       1 << 6,       False,        -1 },         <snip/>     };      Problem is that when I launching Skype dwm always switching currently selected tags to Skype tag to show itself. While all other application in such case just silently load and doesn't affect selected tags.


title: Adding ppa's on Elementary OS freya doesn't work

text: I wanted to install FinalTerm on my elementaryos freya installation, so I added the ppa with `sudo add-apt-repository ppa:finalterm/daily`. However, when I tried running `sudo apt-get install finalterm` (after running update) it gives me:               kyr@kbx:~$ sudo apt-get install finalterm     Reading package lists... Done     Building dependency tree            Reading state information... Done     E: Unable to locate package finalterm      Why does this appear?


title: mobile not being recognized by Ubuntu13.04

text: I connected my China mobile to laptop via cable. On the phone I selected the option `mass storage`. Then it messages on the phone as "done". But as I was expecting I would be able to see the contents of the mobile (memory card, inbuilt disk) it didn't happen so. I checked `df -h` but it doesn't show my phone. When I click on the "file" menu of the Ubuntu launcher to see the devices of my computer, it doesn't show up. The same way when I was earlier connecting on my Windows 7, it used to reflect perfectly. But what may be the issue with my Ubuntu13.04? @terdon please find below the output               ravbholua@ravbholua-Aspire-5315:~$ dmesg | tail -n 40     [  687.926249] Buffer I/O error on device sdb, logical block 1     [  687.926252] Buffer I/O error on device sdb, logical block 1     [  687.926256] Buffer I/O error on device sdb, logical block 1     [  687.926272] Buffer I/O error on device sdb, logical block 495615     [  687.926279] Buffer I/O error on device sdb, logical block 0     [  687.926283] Buffer I/O error on device sdb, logical block 0     [  696.056096] usb 7-1: USB disconnect, device number 5     [ 1694.288050] usb 7-1: new full-speed USB device number 6 using uhci_hcd     [ 1694.471086] usb 7-1: New USB device found, idVendor=0e8d, idProduct=0002     [ 1694.471093] usb 7-1: New USB device strings: Mfr=2, Product=3, SerialNumber=4     [ 1694.471096] usb 7-1: Product: MT6225      [ 1694.471099] usb 7-1: Manufacturer: MediaTek Inc     [ 1694.471101] usb 7-1: SerialNumber: 533807205600090     [ 1694.476542] scsi6 : usb-storage 7-1:1.0     [ 1695.480108] scsi 6:0:0:0: Direct-Access     MEDIATEK  FLASH DISK      6225 PQ: 0 ANSI: 0 CCS     [ 1695.483121] scsi 6:0:0:1: Direct-Access     MEDIATEK  FLASH DISK      6225 PQ: 0 ANSI: 0 CCS     [ 1695.487030] sd 6:0:0:0: Attached scsi generic sg2 type 0     [ 1695.487241] sd 6:0:0:1: Attached scsi generic sg3 type 0     [ 1695.497177] sd 6:0:0:0: [sdb] 3964928 512-byte logical blocks: (2.03 GB/1.89 GiB)     [ 1695.502101] sd 6:0:0:0: [sdb] Write Protect is off     [ 1695.502108] sd 6:0:0:0: [sdb] Mode Sense: 03 00 00 00     [ 1695.505093] sd 6:0:0:1: [sdc] 1000 512-byte logical blocks: (512 kB/500 KiB)     [ 1695.508140] sd 6:0:0:0: [sdb] No Caching mode page found     [ 1695.508145] sd 6:0:0:0: [sdb] Assuming drive cache: write through     [ 1695.511104] sd 6:0:0:1: [sdc] Write Protect is off     [ 1695.511111] sd 6:0:0:1: [sdc] Mode Sense: 03 00 00 00     [ 1695.516140] sd 6:0:0:1: [sdc] No Caching mode page found     [ 1695.516146] sd 6:0:0:1: [sdc] Assuming drive cache: write through     [ 1695.538535] sd 6:0:0:0: [sdb] No Caching mode page found     [ 1695.538542] sd 6:0:0:0: [sdb] Assuming drive cache: write through     [ 1695.548183]  sdb: sdb1     [ 1695.551261] sd 6:0:0:1: [sdc] No Caching mode page found     [ 1695.551270] sd 6:0:0:1: [sdc] Assuming drive cache: write through     [ 1695.560464]  sdc: sdc1     [ 1695.586091] sd 6:0:0:0: [sdb] No Caching mode page found     [ 1695.586099] sd 6:0:0:0: [sdb] Assuming drive cache: write through     [ 1695.586103] sd 6:0:0:0: [sdb] Attached SCSI removable disk     [ 1695.592133] sd 6:0:0:1: [sdc] No Caching mode page found     [ 1695.592141] sd 6:0:0:1: [sdc] Assuming drive cache: write through     [ 1695.592146] sd 6:0:0:1: [sdc] Attached SCSI removable disk     ravbholua@ravbholua-Aspire-5315:~$       > EDIT @slm, I created the 2 device files `/dev/sdb` and `/dev/sdc` as shown below. But a surprise! Without connecting my mobile to laptop, I created the files and I confirmed it by running `ls`. But after connecting my mobile, those files disappeared!!! Why so and now how to proceed?               ravbholua@ravbholua-Aspire-5315:~$ sudo mknod /dev/sdb b 8 0     ravbholua@ravbholua-Aspire-5315:~$ cd /dev     ravbholua@ravbholua-Aspire-5315:/dev$ ls sd*     sda  sda1  sda2  sda3  sda4  sda5  sda6  sda7  sda8  sdb     ravbholua@ravbholua-Aspire-5315:/dev$ sudo mknod /dev/sdc b 8 0     ravbholua@ravbholua-Aspire-5315:/dev$ !-2     ls sd*     sda  sda1  sda2  sda3  sda4  sda5  sda6  sda7  sda8  sdb  sdc     ravbholua@ravbholua-Aspire-5315:/dev$ ll $_     brw-r--r-- 1 root root 8, 0 Nov  1 20:33 sdc     ravbholua@ravbholua-Aspire-5315:/dev$ ll sda     brw-rw---- 1 root disk 8, 0 Nov  1 20:09 sda     (the below is after connecting mobile)         ravbholua@ravbholua-Aspire-5315:/dev$ ls sd*     sda  sda1  sda2  sda3  sda4  sda5  sda6  sda7  sda8     ravbholua@ravbholua-Aspire-5315:/dev$ ls sdb     ls: cannot access sdb: No such file or directory     ravbholua@ravbholua-Aspire-5315:/dev$ ls sdc     ls: cannot access sdc: No such file or directory     ravbholua@ravbholua-Aspire-5315:/dev$      > EDIT @slm Now the device files `sdb` and `sdc` are visible. What I did now is that I created the files after connecting the device. But still unable to locate my mobile devices. You can see from the below codes that I wasn't able to mount the file sdb. But you know one thing, when I ran cat /dev/sdb it did output in non-readable format which I did quit by ctrl-c. Does that mean it was reading my mobile disk!               ravbholua@ravbholua-Aspire-5315:/dev$ sudo mount /dev/sdb /mnt     mount: /dev/sdb already mounted or /mnt busy     ravbholua@ravbholua-Aspire-5315:/dev$ df -h     Filesystem      Size  Used Avail Use% Mounted on     /dev/sda6       9.9G  5.8G  3.6G  62% /     none            4.0K     0  4.0K   0% /sys/fs/cgroup     udev            489M  4.0K  489M   1% /dev     tmpfs           100M  920K   99M   1% /run     none            5.0M  4.0K  5.0M   1% /run/lock     none            497M  672K  496M   1% /run/shm     none            100M   36K  100M   1% /run/user     /dev/sda5       284M  129M  141M  48% /boot     /dev/sda8       9.5G  7.6G  1.5G  85% /home     ravbholua@ravbholua-Aspire-5315:/dev$ sudo umount /mnt     umount: /mnt: not mounted     ravbholua@ravbholua-Aspire-5315:/dev$ ls sd*     sda  sda1  sda2  sda3  sda4  sda5  sda6  sda7  sda8  sdb  sdc     ravbholua@ravbholua-Aspire-5315:/dev$ sudo umount /dev/sdb     umount: /dev/sdb: not mounted     ravbholua@ravbholua-Aspire-5315:/dev$ cd /     ravbholua@ravbholua-Aspire-5315:/$ sudo mount /dev/sdb /mnt     mount: /dev/sdb already mounted or /mnt busy     ravbholua@ravbholua-Aspire-5315:/$


title: Where are userspace programs supposed to save their logs?

text: I am writing a script that I want to run without privileges. I want the errors that the script encounters to be logged to some log file. I do not not have privileges to write one to `/var/log`. And I do not want to have one in my home directory. Is there a location where userspace scripts may log runtime information? What is the best practice to have my script log information to `/var/log` without creating any potential security issues? I am hesitant to set uid / gid on the script.


title: how to patch PKGBUILD to lib32

text: I installed Poco library on my Arch64 system using AUR. Sources were downloaded, compiled and the package succesfully installed. But now I need to patch the PKGBUILD so that I can compile 32-bit version of the library and install it next to the 64-bit version. This is the original PKGBUILD:               # Maintainer: Robert Knauer      # Contributor: Rodrigo Grumiche Silva      # Contributor: nozog     # Contributor: davidhjelm     # Contributor: Ray Kohler      # Contributor: Nathan Owe           pkgname=poco     pkgver=1.4.6     pkgrel=1     pkgdesc="C++ class libraries for network-centric, portable applications, complete edition"     arch=('i686' 'x86_64')     url="http://www.pocoproject.org/"     license=('custom:boost')     depends=('unixodbc' 'libmysqlclient' 'openssl')     makedepends=('gcc' 'make' 'unixodbc' 'libmysqlclient' 'openssl' 'chrpath')     source=(       "${pkgname}-${pkgver}-all.tar.gz"::"https://sourceforge.net/projects/${pkgname}/files/sources/${pkgname}-${pkgver}/${pkgname}-${pkgver}-all.tar.gz/download"     )     sha256sums=(       'cf8229310f047e731cc6273a8df55e03b76f0ed7d5b5d251f99a0f80f6c2c763'     )          build()     {       cd "${srcdir}/${pkgname}-${pkgver}-all"       ./configure --prefix=/usr --no-samples --no-tests       make ODBCLIBDIR="/usr/lib"     }          package()     {       cd "${srcdir}/${pkgname}-${pkgver}-all"       make ODBCLIBDIR="/usr/lib" DESTDIR="${pkgdir}" install       install -Dm644 'LICENSE' "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"       # remove rpath information from binaries       chrpath -d "${pkgdir}/usr/bin/cpspc"       chrpath -d "${pkgdir}/usr/bin/cpspcd"       chrpath -d "${pkgdir}/usr/bin/f2cpspd"       chrpath -d "${pkgdir}/usr/bin/f2cpsp"       # remove debugging libraries       rm "${pkgdir}/usr/lib/libPoco"*"d.so"*     }      The first thing I tried was to take a look at another lib32-* AUR package, but I failed even to add the `-m32` flag.


title: Exiting a Bash script when a sudo child quits

text: I'm trying to launch a couple of sub-programs from a bash script and then wait on _either_ of them to quit before quitting the other and exiting the script.               CMD1PID=     CMD2PID=          exit_trap () {         echo "exit trap: killing jobs..."          sudo kill $CMD1PID $CMD2PID         exit     }          set -bm     trap exit_trap EXIT INT TERM          sudo cmd1 --args &     CMD1PID=$?          sudo cmd2 --args &     CMD2PID=$?          wait $CMD1PID $CMD2PID           (For reference, this is `GNU bash, version 4.2.37(1)-release (arm-unknown- linux-gnueabi)` on Debian Weezy) Unfortunately, this doesn't seem to work properly. I've tried several variants, such as:   * using curly braces around the commands and explicitly killing the shell process afterwards, ie `{ cmd1 --args ; kill -USR1 $$ ; } &` or similar, and then trapping on USR1   * using `kill 0` to kill the still-running commands at exit   * trapping `CHLD` - this has the disadvantage that I can't `sleep` between the commands if I need to, which I might eventually need to do. ...but the issues I tend to run into are:   * Killing one of the commands doesn't cause the parent Bash process to exit and/or kill the other command   * Killing the parent Bash process doesn't cause both commands to be killed I suspect that perhaps my requirement to use sudo is tripping me up, as other folks in other scripts seem to be having good luck with similar scripts. Is there a good way of doing what I'm trying to do in bash?


title: gunzip all .gz files in directory

text: I have a directory with plenty of .txt.gz files (where the names do not follow a specific pattern.) What is the simplest way to gunzip them? I want to preserve their original names, so that they go from whatevz.txt.gz to whatevz.txt


title: Significance of certain folders in linux kernel tree

text: While going through Linux Kernel Source tree, found certain folders, explanation of which was not seen in the popular sites. Could someone tell why these folders are there like:   * block - This is not the block folder in the driver directory    * security   * sound    * tools    * usr    * virt


title: How to tell mutt not to wait for an attachment program to return?

text: I use this line for images in my `mailcap`:               image/*; eog %s &;      but mutt immediately deletes the temp file and eog can’t load it.   When I remove the `&` mutt waits for eog to be closed until it escapes from the command line.


title: How do i extend a partition with a LVM and the contained physical volume and logical volume?

text: On my 240 GB SSD i had at first two partitions, one containing the Logical Volume with Linux Mint and the other had contained a NTFS partition to share with Windows. Now i removed the NTFS partition and want to extend my logical volume group to use the released disk space. How do i **extend the volume group** , my **logical volume containing /home** and the **filesystem (ext4)** on /home? Is this possible to do online? PS: Yes, i know that i have to backup my data :)               /dev/sdb/  (240GB)         linuxvg  (160GB) should use 100% of the disk space             swap             root             home (ext4, 128GB) should be extended to use the remaining space      output of `sudo vgdisplay`:                 --- Volume group ---       VG Name               linuxvg       System ID                    Format                lvm2       Metadata Areas        1       Metadata Sequence No  4       VG Access             read/write       VG Status             resizable       MAX LV                0       Cur LV                3       Open LV               3       Max PV                0       Cur PV                1       Act PV                1       VG Size               160,00 GiB       PE Size               4,00 MiB       Total PE              40959       Alloc PE / Size       40959 / 160,00 GiB       Free  PE / Size       0 / 0          VG UUID               ...            --- Logical volume ---       LV Path                /dev/linuxvg/swap       LV Name                swap       VG Name                linuxvg       LV UUID                ...       LV Write Access        read/write       LV Creation host, time mint, 2013-08-06 22:48:32 +0200       LV Status              available       # open                 2       LV Size                8,00 GiB       Current LE             2048       Segments               1       Allocation             inherit       Read ahead sectors     auto       - currently set to     256       Block device           252:0            --- Logical volume ---       LV Path                /dev/linuxvg/root       LV Name                root       VG Name                linuxvg       LV UUID                ...       LV Write Access        read/write       LV Creation host, time mint, 2013-08-06 22:48:43 +0200       LV Status              available       # open                 1       LV Size                24,00 GiB       Current LE             6144       Segments               1       Allocation             inherit       Read ahead sectors     auto       - currently set to     256       Block device           252:1            --- Logical volume ---       LV Path                /dev/linuxvg/home       LV Name                home       VG Name                linuxvg       LV UUID                ...       LV Write Access        read/write       LV Creation host, time mint, 2013-08-06 22:48:57 +0200       LV Status              available       # open                 1       LV Size                128,00 GiB       Current LE             32767       Segments               1       Allocation             inherit       Read ahead sectors     auto       - currently set to     256       Block device           252:2            --- Physical volumes ---       PV Name               /dev/sdb1            PV UUID               ...       PV Status             allocatable       Total PE / Free PE    40959 / 0      output of `sudo fdisk -l`:               Disk /dev/sdb: 240.1 GB, 240057409536 bytes     255 heads, 63 sectors/track, 29185 cylinders, total 468862128 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x00000000             Device Boot      Start         End      Blocks   Id  System     /dev/sdb1               1   468862127   234431063+  ee  GPT          Disk /dev/mapper/linuxvg-swap: 8589 MB, 8589934592 bytes     255 heads, 63 sectors/track, 1044 cylinders, total 16777216 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x00000000               Disk /dev/mapper/linuxvg-root: 25.8 GB, 25769803776 bytes     255 heads, 63 sectors/track, 3133 cylinders, total 50331648 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x00000000               Disk /dev/mapper/linuxvg-home: 137.4 GB, 137434759168 bytes     255 heads, 63 sectors/track, 16708 cylinders, total 268427264 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x00000000