title: Simulating a middle-button click on my touchpad often scrolls up the view

text: At times, when I simulate the mouse middle-button with my touchpad, my view auto-scrolls towards the top. I've seen this on my browser and my X terminal. Here's my touchpad settings:               $ synclient -l     Parameter settings:         LeftEdge                = 38         RightEdge               = 929         TopEdge                 = 38         BottomEdge              = 673         FingerLow               = 25         FingerHigh              = 30         MaxTapTime              = 180         MaxTapMove              = 52         MaxDoubleTapTime        = 180         SingleTapTimeout        = 180         ClickTime               = 100         EmulateMidButtonTime    = 75         EmulateTwoFingerMinZ    = 282         EmulateTwoFingerMinW    = 7         VertScrollDelta         = 24         HorizScrollDelta        = 24         VertEdgeScroll          = 0         HorizEdgeScroll         = 0         CornerCoasting          = 0         VertTwoFingerScroll     = 1         HorizTwoFingerScroll    = 0         MinSpeed                = 1         MaxSpeed                = 1.75         AccelFactor             = 0.166667         TouchpadOff             = 0         LockedDrags             = 0         LockedDragTimeout       = 5000         RTCornerButton          = 0         RBCornerButton          = 0         LTCornerButton          = 0         LBCornerButton          = 0         TapButton1              = 1         TapButton2              = 0         TapButton3              = 0         ClickFinger1            = 1         ClickFinger2            = 2         ClickFinger3            = 1         CircularScrolling       = 0         CircScrollDelta         = 0.1         CircScrollTrigger       = 0         PalmDetect              = 0         PalmMinWidth            = 10         PalmMinZ                = 200         CoastingSpeed           = 20         CoastingFriction        = 50         PressureMotionMinZ      = 30         PressureMotionMaxZ      = 160         PressureMotionMinFactor = 1         PressureMotionMaxFactor = 1         GrabEventDevice         = 1         TapAndDragGesture       = 1         AreaLeftEdge            = 0         AreaRightEdge           = 0         AreaTopEdge             = 0         AreaBottomEdge          = 0         HorizHysteresis         = 6         VertHysteresis          = 6         ClickPad                = 0


title: Drive keeps rebooting and wait for manual fsck

text: This is what my datacenter says > I've connected monitor to your server and it looks like it was rebooting and > is waiting for manual fschk again. Have you rebooted your server? Then fdcservers would do the manual fschk. Server is online again. But the next day, same thing happen again. What should I do I suspected it's hardware. How do I know which SSD need to be replaced? If I got to check logs, which logs I should see.


title: Does Arch-Linux work well on a macbook pro?

text: I'm considering installing it for a dualboot with osx, so is it buggy or anything?


title: Tmux monitor activity change highlight color

text: I'm setting up my `tmux.conf` and I want to have the activity monitor with different colors. I would like to change the color of the highlight of the alerted window in the status bar. The problem appears when I try to change the color of the background. I'm using this options shown from the `tmux` manual page.               # activity window     setw -g monitor-activity on     setw -g window-status-activity-bg red     setw -g window-status-activity-fg yellow      When I reload the configuration I can see that the color of the letters in the alerted window change to red but I can't find the way to change the highlight of the alerted window. I'm using `tmux` version 1.6 and I also tried unsuccessfully on version 1.8. What I'm missing?


title: How to change the USB keyboard layout in an OpenBSD console?

text: _I may be abusing the word console but I mean the mode without X i.e. pressing`^+Alt F1` and then log as other user where I want to use my chosen layout with USB keyboard._ X works, it configures the new USB keyboard to my choice when I plug it in. But the console keyboard layout is stuck to the setting specified by the kernel. I am trying to change that:               # usbhidctl -f /dev/uhid0 -w keyboard.encoding=us                                            usbhidctl: Failed to match: keyboard.encoding      Some info about the OpenBSD version:               # uname -rv     4.7 GENERIC.MP#449


title: DocBook DSSSL test failure

text: So I followed these (Linux From Scratch) instructions to test my build of DocBook DSSSL, and I get this:               $ onsgmls -sv test.sgm     onsgmls:I: "OpenSP" version "1.5.2"     onsgmls:test.sgm:1:61:W: cannot generate system identifier for public text "-//Davenport//DTD DocBook V3.0//EN"     onsgmls:test.sgm:1:61:E: reference to entity "CHAPTER" for which no system identifier could be generated     onsgmls:test.sgm:1:0: entity was defined here     onsgmls:test.sgm:1:61:E: DTD did not contain element declaration for document type name     onsgmls:test.sgm:2:8:E: element "CHAPTER" undefined     onsgmls:test.sgm:2:15:E: element "TITLE" undefined     onsgmls:test.sgm:3:5:E: element "PARA" undefined      I have tried to retrace my steps by uninstalling and reinstalling the dependencies... without success.


title: How can I de-fragment a drive using Ubuntu?

text: Is it necessary to defrag drives in Ubuntu? If so, how do I do it and how often should it be done?


title: Ubuntu 10.10: Why does external dial-up modem randomly disconnect from internet?

text: Background:   * Dial-up is the only option for this computer   * Gave up on the internal modem last week; now using an external USB modem.   * I finally have the computer talking to the internet.   * HOWEVER, after 1-5 minutes, the connection gets dropped (or something) for no apparent reason.   * It reconnects right away.   * Additional fact: it seems to be going _very_ slow, even for dial up.   * I'm _not_ an expert, so I don't even know where to look to find a log beyond the Gnome-PPP update window thing for clues. Question:   * Any idea about what's going on?    * Any help about were to look for clues?


title: the usage of < /dev/null & in the command line

text: I tried to run an example java program using the following command line. However, I do not know what is the trailing part `< /dev/null &` used for?               java   -cp  /home/weka.jar weka.classifiers.trees.J48 –t train_file  >& log < /dev/null &


title: Regex/pattern matching problem to extract data

text: What is the best way to remove distances in the following lines and output cdv format. Can this be done reasonably easily on the command line? I'd like to avoid having to write a full-blow script.               Greece 282 km, Macedonia 151 km, Montenegro 172 km, Kosovo 112 km     Central African Republic 797 km, Chad 1,094 km, Republic of the Congo 523      The output would be:               Greece,Macedonia,Montenegro,Kosovo     Central African Republic,Chad,Republic of the Congo


title: Best method for testing android kernel

text: I would like to test some of the features of android kernel like inserting a module and collecting certain parameters for research purpose. What would you think the best method for that?


title: Where place own application icons? How to get the current theme icons?

text: I'm developing a little application for Gnome, Unity and KDE desktops. I want the application icons to be fully theme aware. Now, I'm including the icons on the application directory on `/usr/lib/my- application/` as `SVG`, and I'm loading them with the full path. I suppose this is fine as the start point, but I want to integrate them on the system better. My motivation: I don't want to break the Humanity and Humanity-Dark themes --very worried about the Indicator panel looks. How do I provide Humanity and Humanity-dark icons? How do I know the current theme? Should I ask for it? I'm using mostly bash and python.


title: How to enclose in quotes if both single and double quotes are already used?

text: I don't remember the exact commands and tricks that I use sometimes which solves much of the work, so I try to log them into a file for future reference. What I typically do is just put whole command in echo and append it to the file quickly. This has always worked, but the following situation arrived for first time, where I was not able to do as stated above. ### Successfull logging               $ echo "cat file1.txt | paste -d, - - ## Step 3 " >> ~/globalLog.txt      ### Got stuck here               $ echo "cat file2.txt  | sed 's/"//g' > file3.txt ## Step 2 " >> ~/globalLog.txt      The above is giving a obvious error, as the quotes are not being properly closed (dropping to the second command propmt (`PS2` I guess?) for completing the command i.e. `>_` in my case), the single(`'`) quotes are being used by the sed command and the double(`"`) quotes are being used in one the sed expression for replacement. How would I enclose the complete command in such situation ?


title: Delete last line from the file

text: I use `sed` to quickly delete lines with specific position as               sed '1d'     sed '5d'      But, what if I want to delete the last line of the file and I don't know the count of lines (I know I can get that using `wc` and several other tricks). Currently, using a workaround with `head` and `tail`combined with `wc` to do so. Any quick twists here?


title: Error(?) in output of the dd command

text: When I run the following command:               dd if=/dev/sda of=output bs=512 count=1      In the middle of the output, I see this text:               GRUB ^@Geom^@Hard Disk^@Read^@ Error^M      What does it mean?


title: How can I convert raw printer commands back to a postscript or pdf file?

text: I have a string of raw printer commands that are for my postscript printer saved to a file. I believe there is a `lpr` option like `-o raw` which will read these raw command and send them to the printer. How can I specify a virtual printer driver so that I can send the raw commands to `lpr` and have then come out as a postscript (or ultimately pdf) file? Is there a simpler way to convert raw printer commands back into postscript?


title: Ubuntu 10.0.04 Microsoft mouse "extended functions" not recognized

text: Related to a question still answered: http://askubuntu.com/questions/240176/mapping-microsoft-mobile- mouse-4000-back-thumb-button I have a Microsoft-Explorer-Mini-Mouse (which happens to be a good product on Windows) http://www.amazon.com/Microsoft-5BA-00001-Explorer-Mini- Mouse/dp/B001F7ARTQ, however Ubuntu only recognizes it as a generic mouse with know thumb (back) button or tilt wheel. On Windows, you'd need to install some additional software for this mouse to enable these "extended" mouse functions. What can we do, on Linux, to make the OS interface with the device in a manner the device was designed for? If there are no solutions to get this mouse to work, can someone suggest Linux-friendly mouse with a middle tilt wheel and rear-thumb-back button?


title: How can awk cut certain fields and add to the end of each line?

text: I would like to convert a list containing bunch of svn URLs of issues:               cat list.txt         //svn.server.address/repos/project/module1/branches/issue-001-name1         //svn.server.address/repos/project/module2/branches/issue-002-name2         //svn.server.address/repos/project/module3/branches/issue-003-name3         ...      into newlist.txt that plus svn command and folder names to checkout them, like this:                   svn co //svn.server.address/repos/project/module1/branches/issue-001-name1 issue-001-module1         svn co //svn.server.address/repos/project/module2/branches/issue-002-name2 issue-002-module2         svn co //svn.server.address/repos/project/module3/branches/issue-003-name3 issue-003-module3         ...      I have tried something like:               eval $(awk -F'/branches/' '{print $2}' list.txt|awk -F'-' '{print "i="$1"-"$2}')     eval $(awk -F'/branches/' '{print $1}' list.txt|awk -F'/' '{print "j="$NF}')     name=$i"-"$j     awk '{print "svn co "$1" "n}' n=$name list.txt >newlist.txt      But it would always get the last variable, I'm totally newbie for this so any help would be greatly appreciated!


title: Memory management, bias to swapping

text: I was having 768 MB RAM. In a general day MySQL was using 100-180 mb of RAM and MySQL was swapping 80-120 mb. I was having 50-60 mb free RAM. So I thought I should upgrade. Then I upgraded my RAM to 1 GB. After that, I have 200-350 mb free RAM. But MySQL uses same amount of RAM but still swaps 40-60 mb. That is my `free -m` result.                            total       used       free     shared    buffers     cached     Mem:           996        796        200          0         73         97     -/+ buffers/cache:        625        371     Swap:         2047         92       1955      This is my top result               top - 22:11:23 up 13:35,  1 user,  load average: 0.26, 0.33, 0.35     Tasks: 143 total,   1 running, 142 sleeping,   0 stopped,   0 zombie     Cpu(s): 20.2%us,  1.8%sy,  0.0%ni, 77.8%id,  0.2%wa,  0.0%hi,  0.0%si,  0.0%st     Mem:   1020564k total,   809836k used,   210728k free,    77808k buffers     Swap:  2097144k total,    94880k used,  2002264k free,   102596k cached            PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  SWAP COMMAND      2484 mysql     20   0 1845m 165m 4356 S 25.9 16.6 151:33.45  63m mysqld     13777 myuser  20   0  201m  22m 9836 S  0.0  2.3   0:00.42    0 php-cgi     13780 myuser  20   0  200m  21m 9820 S  3.3  2.2   0:00.47    0 php-cgi     13773 myuser  20   0  200m  21m 9820 S  0.0  2.2   0:00.70    0 php-cgi     13775 myuser  20   0  200m  21m 9812 S  5.3  2.2   0:00.42    0 php-cgi     13779 myuser  20   0  200m  21m 9812 S  3.0  2.2   0:00.31    0 php-cgi     13778 myuser  20   0  200m  21m 9812 S  3.6  2.2   0:00.31    0 php-cgi     13776 myuser  20   0  200m  21m 9812 S  3.0  2.2   0:00.31    0 php-cgi     13774 myuser  20   0  199m  20m 9812 S  0.0  2.1   0:00.23    0 php-cgi      2619 named     20   0  233m 9.8m 1388 S  0.0  1.0   0:04.57 5288 named      2689 root      20   0  328m 7528 6316 S  0.0  0.7   0:05.14 9648 httpd     13735 root      20   0  106m 4840 3756 S  0.0  0.5   0:00.26    0 sshd     12772 apache    20   0  328m 3932 2040 S  0.0  0.4   0:01.08 9392 httpd     13163 apache    20   0  328m 3916 2036 S  0.0  0.4   0:00.65 9400 httpd     13425 apache    20   0  328m 3912 2036 S  0.0  0.4   0:00.32 9404 httpd     13417 apache    20   0  328m 3908 2036 S  0.0  0.4   0:00.35 9412 httpd     13420 apache    20   0  328m 3908 2036 S  0.0  0.4   0:00.37 9412 httpd      Although I have 371 mb free RAM, my CentOS 6.3 system still swaps. Now swapping is 90 mb. My question is although I have much free RAM, why Linux still swaps? If it was a bad situation how can I diagnose more? Or shouldn't I care about it?


title: "UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte" error when attempting to remove nvidia-304 package

text: I'm trying to remove package `nvidia-304` from my system (Ubuntu 14.04) but I'm getting this error:               Do you want to continue? [Y/n] y     (Reading database ... 283298 files and directories currently installed.)     Removing nvidia-304 (304.117-0ubuntu1) ...     Removing all DKMS Modules     Error! There are no instances of module: nvidia-304     304.117 located in the DKMS tree.     Done.     update-alternatives: using /usr/lib/x86_64-linux-gnu/mesa/ld.so.conf to provide /etc/ld.so.conf.d/x86_64-linux-gnu_GL.conf (x86_64-linux-gnu_gl_conf) in auto mode     update-alternatives: using /usr/lib/i386-linux-gnu/mesa/ld.so.conf to provide /etc/ld.so.conf.d/i386-linux-gnu_GL.conf (i386-linux-gnu_gl_conf) in auto mode     INFO:Disable nvidia-304     DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude     DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad     DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here     Traceback (most recent call last):       File "/usr/bin/quirks-handler", line 65, in <module>         operation_status = main(options)       File "/usr/bin/quirks-handler", line 48, in main         quirks = Quirks.quirkapplier.QuirkChecker(options.package_disable, path=quirks_path)       File "/usr/lib/python3/dist-packages/Quirks/quirkapplier.py", line 38, in __init__         self._system_info = self.get_system_info()       File "/usr/lib/python3/dist-packages/Quirks/quirkapplier.py", line 64, in get_system_info         return quirk_info.get_dmi_info()       File "/usr/lib/python3/dist-packages/Quirks/quirkinfo.py", line 46, in get_dmi_info         'class', 'dmi', 'id', item)).read().strip()       File "/usr/lib/python3.4/codecs.py", line 313, in decode         (result, consumed) = self._buffer_decode(data, self.errors, final)     UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte     dpkg: error processing package nvidia-304 (--purge):      subprocess installed pre-removal script returned error exit status 1     Processing triggers for libc-bin (2.19-0ubuntu6.3) ...     Errors were encountered while processing:      nvidia-304     E: Sub-process /usr/bin/dpkg returned an error code (1)      I want to remove it because   1. it's not used   2. attempting to install `fslint` fails due to `nvidia-304` package not being fully configured All problems only started after upgrading from version 13.10 to 14.04 LTS. How can I fix this issue?


title: iptables routing marked packets from router to PC and routing them back to router

text: I'm trying to do deep packet inspection on HTTP packets. The purpose of this is to collect HTTP payload data and then create some proxy/cache-independent reports. Following this, the idea is to develop specific proxy/cache plug-ins (e.g. Squid) to use the reports. I'm using the following testing scenario (VirtualBox machines, all machines are CentOS 6.3): ROUTER:   Interfaces:   eth0 connected to 192.168.1.0/24 network (ip 192.168.1.10)   eth1 connected to 192.168.2.0/24 network (ip 192.168.2.20)   eth2 connected to 192.168.3.0/24 network (ip 192.168.3.30)   eth3 Internet access PC1 (deep packet inspection - DPI PC):   Interfaces:   eth0 connected to 192.168.1.0/24 network (ip 192.168.1.1) HTTP requests from PCs in 192.168.2.0 and 192.168.3.0 networks are marked with iptables and then routed to DPI PC.   ROUTER iptables script:               #ALL CHAINS POLICY = ACCEPT          # DPI PC IP     IP_DPI=192.168.1.1     # Interface to reach DPI PC from router     IF_DPI_OUT=eth0     # Internet access interface     IF_MASQ=eth3          # Flush everything     iptables -F     iptables -t nat -F     iptables -t mangle -F     iptables -X     iptables -t nat -X     iptables -t mangle -X          # Zero counters     iptables -Z     iptables -t nat -Z     iptables -t mangle -Z          # Enable MASQUERADING      iptables -t nat -A POSTROUTING -s 192.16.1.0/24 -o $IF_MASQ -j MASQUERADE     iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -o $IF_MASQ -j MASQUERADE     iptables -t nat -A POSTROUTING -s 192.168.3.0/24 -o $IF_MASQ -j MASQUERADE          ### HTTP packets redirection     # Mark  HTTP packets     iptables -t mangle -A PREROUTING -p tcp --dport 80 -m state --state NEW -s 192.168.2.0/24 -i eth1 -j MARK --set-mark 7     iptables -t mangle -A PREROUTING -p tcp --dport 80 -m state --state NEW -s 192.168.3.0/24 -i eth2 -j MARK --set-mark 7          # Create routing table named "http_redirect"     echo 202 http_redirect >> /etc/iproute2/rt_tables          # Marked packets use "http_redirect" table     ip rule add fwmark 7 table http_redirect          # Sent packets to DPI PC     ip route add default via $IP_DPI dev $IF_DPI_OUT table http_redirect          # Flush route cache     ip route flush cache      In DPI PC I do the same thing, packets are redirected to Router again:   DPI PC iptables script:               #ALL CHAINS POLICY = ACCEPT          IP_ROUTER=192.168.1.10     IF_ROUTER_OUT=eth0          # Flush everything     iptables -F     iptables -t nat -F     iptables -t mangle -F     iptables -X     iptables -t nat -X     iptables -t mangle -X          # Zero counters     iptables -Z     iptables -t nat -Z     iptables -t mangle -Z          ### HTTP packets redirection     # Mark  HTTP packets     iptables -t mangle -A PREROUTING -p tcp --dport 80 -i eth0 -j MARK --set-mark 7          # Create routing table named "http_redirect"     echo 202 http_redirect >> /etc/iproute2/rt_tables          # Marked packets use "http_redirect" table     ip rule add fwmark 7 table http_redirect          # Sent packets back to ROUTER     ip route add default via $IP_ROUTER dev $IF_ROUTER_OUT table http_redirect          # Flush route cache     ip route flush cache      Using iptables log I see that only the first packet (packet with SYN on) is redirected from ROUTER to DPI PC, and from DPI PC back to ROUTER, but once the packet gets ROUTER again it doesn't get routed through eth3 (Internet access). Then a new packet with SYN on and ID=previous_ID+1 is generated and the steps are repated again. With the following on a local PC (ip 192.168.3.3):               wget www.yahoo.com      Log of DPI PC:               Jan  8 19:29:03 localhost kernel: D:IN:eth0:HTTP:d80:    IN=eth0 OUT=      SRC=192.168.3.3 DST=200.152.175.146 LEN=60 TOS=0x00 PREC=0x00 TTL=63 ID=48079 DF PROTO=TCP SPT=49268 DPT=80 WINDOW=14600 RES=0x00 SYN URGP=0 OPT (020405B40402080A0139AFDB0000000001030305)           Jan  8 19:29:03 localhost kernel: D:IN:eth0:MARK-1.0    IN=eth0 OUT=      SRC=192.168.3.3 DST=200.152.175.146 LEN=60 TOS=0x00 PREC=0x00 TTL=63 ID=48079 DF PROTO=TCP SPT=49268 DPT=80 WINDOW=14600 RES=0x00 SYN URGP=0 OPT (020405B40402080A0139AFDB0000000001030305)           Jan  8 19:29:03 localhost kernel: D:OUT:eth0:HTTP:d80:    IN= OUT=eth0     SRC=192.168.3.3 DST=200.152.175.146 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=48079 DF PROTO=TCP SPT=49268 DPT=80 WINDOW=14600 RES=0x00 SYN URGP=0 OPT (020405B40402080A0139AFDB0000000001030305) MARK=0x7           Jan  8 19:29:04 localhost kernel: D:IN:eth0:HTTP:d80:    IN=eth0 OUT=      SRC=192.168.3.3 DST=200.152.175.146 LEN=60 TOS=0x00 PREC=0x00 TTL=63 ID=48080 DF PROTO=TCP SPT=49268 DPT=80 WINDOW=14600 RES=0x00 SYN URGP=0 OPT (020405B40402080A0139B3C30000000001030305)           Jan  8 19:29:04 localhost kernel: D:IN:eth0:MARK-1.0    IN=eth0 OUT=      SRC=192.168.3.3 DST=200.152.175.146 LEN=60 TOS=0x00 PREC=0x00 TTL=63 ID=48080 DF PROTO=TCP SPT=49268 DPT=80 WINDOW=14600 RES=0x00 SYN URGP=0 OPT (020405B40402080A0139B3C30000000001030305)           Jan  8 19:29:04 localhost kernel: D:OUT:eth0:HTTP:d80:    IN= OUT=eth0     SRC=192.168.3.3 DST=200.152.175.146 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=48080 DF PROTO=TCP SPT=49268 DPT=80 WINDOW=14600 RES=0x00 SYN URGP=0 OPT (020405B40402080A0139B3C30000000001030305) MARK=0x7           Jan  8 19:29:06 localhost kernel: D:IN:eth0:HTTP:d80:    IN=eth0 OUT=      SRC=192.168.3.3 DST=200.152.175.146 LEN=60 TOS=0x00 PREC=0x00 TTL=63 ID=48081 DF PROTO=TCP SPT=49268 DPT=80 WINDOW=14600 RES=0x00 SYN URGP=0 OPT (020405B40402080A0139BB930000000001030305)           Jan  8 19:29:06 localhost kernel: D:IN:eth0:MARK-1.0    IN=eth0 OUT=      SRC=192.168.3.3 DST=200.152.175.146 LEN=60 TOS=0x00 PREC=0x00 TTL=63 ID=48081 DF PROTO=TCP SPT=49268 DPT=80 WINDOW=14600 RES=0x00 SYN URGP=0 OPT (020405B40402080A0139BB930000000001030305)           Jan  8 19:29:06 localhost kernel: D:OUT:eth0:HTTP:d80:    IN= OUT=eth0     SRC=192.168.3.3 DST=200.152.175.146 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=48081 DF PROTO=TCP SPT=49268 DPT=80 WINDOW=14600 RES=0x00 SYN URGP=0 OPT (020405B40402080A0139BB930000000001030305) MARK=0x7       Log of ROUTER:               Jan  8 19:28:48 localhost kernel: R:IN:eth2:HTTP:d80:    IN=eth2 OUT=      SRC=192.168.3.3 DST=200.152.175.146 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=48079 DF PROTO=TCP SPT=49268 DPT=80 WINDOW=14600 RES=0x00 SYN URGP=0 OPT (020405B40402080A0139AFDB0000000001030305)           Jan  8 19:28:48 localhost kernel: R:IN:eth2:MARK-3.0    IN=eth2 OUT=      SRC=192.168.3.3 DST=200.152.175.146 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=48079 DF PROTO=TCP SPT=49268 DPT=80 WINDOW=14600 RES=0x00 SYN URGP=0 OPT (020405B40402080A0139AFDB0000000001030305)           Jan  8 19:28:48 localhost kernel: R:OUT:eth0:HTTP:d80:    IN= OUT=eth0     SRC=192.168.3.3 DST=200.152.175.146 LEN=60 TOS=0x00 PREC=0x00 TTL=63 ID=48079 DF PROTO=TCP SPT=49268 DPT=80 WINDOW=14600 RES=0x00 SYN URGP=0 OPT (020405B40402080A0139AFDB0000000001030305) MARK=0x7           Jan  8 19:28:48 localhost kernel: R:IN:eth0:HTTP:d80:    IN=eth0 OUT=      SRC=192.168.3.3 DST=200.152.175.146 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=48079 DF PROTO=TCP SPT=49268 DPT=80 WINDOW=14600 RES=0x00 SYN URGP=0 OPT (020405B40402080A0139AFDB0000000001030305)           Jan  8 19:28:49 localhost kernel: R:IN:eth2:HTTP:d80:    IN=eth2 OUT=      SRC=192.168.3.3 DST=200.152.175.146 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=48080 DF PROTO=TCP SPT=49268 DPT=80 WINDOW=14600 RES=0x00 SYN URGP=0 OPT (020405B40402080A0139B3C30000000001030305)           Jan  8 19:28:49 localhost kernel: R:IN:eth2:MARK-3.0    IN=eth2 OUT=      SRC=192.168.3.3 DST=200.152.175.146 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=48080 DF PROTO=TCP SPT=49268 DPT=80 WINDOW=14600 RES=0x00 SYN URGP=0 OPT (020405B40402080A0139B3C30000000001030305)           Jan  8 19:28:49 localhost kernel: R:OUT:eth0:HTTP:d80:    IN= OUT=eth0     SRC=192.168.3.3 DST=200.152.175.146 LEN=60 TOS=0x00 PREC=0x00 TTL=63 ID=48080 DF PROTO=TCP SPT=49268 DPT=80 WINDOW=14600 RES=0x00 SYN URGP=0 OPT (020405B40402080A0139B3C30000000001030305) MARK=0x7           Jan  8 19:28:49 localhost kernel: R:IN:eth0:HTTP:d80:    IN=eth0 OUT=      SRC=192.168.3.3 DST=200.152.175.146 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=48080 DF PROTO=TCP SPT=49268 DPT=80 WINDOW=14600 RES=0x00 SYN URGP=0 OPT (020405B40402080A0139B3C30000000001030305)           Jan  8 19:28:51 localhost kernel: R:IN:eth2:HTTP:d80:    IN=eth2 OUT=      SRC=192.168.3.3 DST=200.152.175.146 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=48081 DF PROTO=TCP SPT=49268 DPT=80 WINDOW=14600 RES=0x00 SYN URGP=0 OPT (020405B40402080A0139BB930000000001030305)           Jan  8 19:28:51 localhost kernel: R:IN:eth2:MARK-3.0    IN=eth2 OUT=      SRC=192.168.3.3 DST=200.152.175.146 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=48081 DF PROTO=TCP SPT=49268 DPT=80 WINDOW=14600 RES=0x00 SYN URGP=0 OPT (020405B40402080A0139BB930000000001030305)           Jan  8 19:28:51 localhost kernel: R:OUT:eth0:HTTP:d80:    IN= OUT=eth0     SRC=192.168.3.3 DST=200.152.175.146 LEN=60 TOS=0x00 PREC=0x00 TTL=63 ID=48081 DF PROTO=TCP SPT=49268 DPT=80 WINDOW=14600 RES=0x00 SYN URGP=0 OPT (020405B40402080A0139BB930000000001030305) MARK=0x7           Jan  8 19:28:51 localhost kernel: R:IN:eth0:HTTP:d80:    IN=eth0 OUT=      SRC=192.168.3.3 DST=200.152.175.146 LEN=60 TOS=0x00 PREC=0x00 TTL=62 ID=48081 DF PROTO=TCP SPT=49268 DPT=80 WINDOW=14600 RES=0x00 SYN URGP=0 OPT (020405B40402080A0139BB930000000001030305)       Packet with ID=48079:   1\. Gets to ROUTER's eth2 from host 192.168.3.3   2\. Gets marked with 0x7   3\. Gets routed to DPI PC via ROUTER's eth0   4\. Gets to DPI PC's eth0 (incoming)   5\. Gets marked with 0x7   6\. Gets routed back to ROUTER via DPI PC's eth0 (outgoing)   7\. Gets back to ROUTER's eth0   (packets doesn't get routed through eth3 and the steps are repeated again, with a new packet with ID=48080) Deep packet inspection is intended to be done between steps 4-6 once this schema works.   Packets necesarilly have to be routed from ROUTER TO DPI PC and from DPI PC back to ROUTER because later I'll use Squid on DPI PC. I'd appreciate anyone orientation, Thanks in advance


title: Setting Mod4 in awesome

text: I'm trying to set up awesome. When I start it the `Mod4` (Windows) key is not working. So I tried to extent my `.Xmodmap`               clear Mod4     add Mod4 = Multi_key      When I run `xmodmap .Xmodmap` the `Mod4` works, but there is "some" left. If there is an open terminal and I press `Mod4`+`Ret` to open a new terminal the computer either beeps or on the old terminal there is some dead key (pressing a results in å). I tried several `clear` rules in the `.Xmodmap`, but neither worked. How can I best enable the `Mod4` in awesome? `xev` reports:               KeyPress event, serial 33, synthetic NO, window 0x1200001,         root 0x13c, subw 0x0, time 36080759, (-557,202), root:(187,223),         state 0x0, keycode 133 (keysym 0xff20, Multi_key), same_screen YES,         XLookupString gives 0 bytes:          XmbLookupString gives 0 bytes:          XFilterEvent returns: True          KeyRelease event, serial 33, synthetic NO, window 0x1200001,         root 0x13c, subw 0x0, time 36080859, (-557,202), root:(187,223),         state 0x0, keycode 133 (keysym 0xff20, Multi_key), same_screen YES,         XLookupString gives 0 bytes:          XFilterEvent returns: False


title: Urxvt cursor cutting off wide characters like 'w' and 'm'

text: I'm using the 14 px Gohu font, and it looks like these characters are offset one pixel to the left from the cursor which causes the cursor to ignore that part of the text when typing. ![Image](http://i.stack.imgur.com/Zmzj5.png) I am using bspwm + urxvt + compton. Things I have tried:   * Disable compton   * Set cursor to underscore This problem did not occur with the default font. What is causing this and how is it fixed?


title: Despite all attempts fan is still running very loudly and fast

text: I am running DELL Vostro 3750, operating system Linux Mint and despite all my attempts the fan is still running very fast and loud. So far I have tried first edit Grub according to this article. Than I tried to install nvidia drivers according to this manual but all got was a screen telling me that the X screen can't be started because no X devices were found. So I had to delete `/etc/X11/xorg.conf` file. Before I had ubuntu 12.04 and the problems were the same. There I also tried Jupiter and the bumlebee project. But no results. I am already totally desperate and any advices are welcomed. If I can provide any more information, just tell me what I should run or do and I will copy these information to my question. This is my computer's information:               System:    Host ntb Kernel 3.2.0-4-amd64 x86_64 (64 bit) Distro Linux Mint Debian Edition          CPU:       Quad core Intel Core i7-2670QM (-HT-MCP-) cache 6144 KB flags (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) bmips 17543.7                Clock Speeds: (1) 800.00 MHz (2) 800.00 MHz (3) 800.00 MHz (4) 800.00 MHz (5) 800.00 MHz (6) 800.00 MHz (7) 800.00 MHz (8) 800.00 MHz          Graphics:  Card-1 Intel 2nd Generation Core Processor Family Integrated Graphics Controller Card-2 NVIDIA GF108 [GeForce GT 540M] X.Org 1.12.4 Res: 1600x900@60.1hz                GLX Renderer N/A GLX Version N/A Direct Rendering N/A          Audio:     Card Intel 6 Series/C200 Series Chipset Family High Definition     Audio Controller driver snd_hda_intel BusID: 00:1b.0                Sound: Advanced Linux Sound Architecture Version 1.0.24          Network:   Card-1 Realtek RTL8111/8168B PCI Express Gigabit Ethernet controller driver r8169 v: 2.3LK-NAPI at port 3000 BusID: 04:00.0                Card-2 Intel Centrino Wireless-N 1030 driver iwlwifi v: in-tree: BusID: 02:00.0          Disks:     HDD Total Size: 750.2GB (-) 1: /dev/sda ST9750420AS 750.2GB          Partition: ID:/ size: 49G used: 7.6G (17%) fs: rootfs ID:/ size: 49G used: 7.6G (17%) fs: ext4          Sensors:   System Temperatures: cpu: 65.0C mobo: 65.0C                Fan Speeds (in rpm): cpu: N/A       **EDIT** : Ever since I asked this question I, time to time, tried to look for some complex solution to this problem. Eventually I hit on THIS absolutely perfect answer that helped me solve all my troubles with overheating and fan noise. Just follow the instructions and you will be fine. Especially I recommend using indicator-cpufreq.


title: PID of process causing error

text: I have this script:               #!/bin/bash     # -> dump.$pid     ulimit -c unlimited     # trap ERR     set -o errexit     # also trap error in the middle of a pipe (1)     # otherwise it will only trap the error on (2)     set -o pipefail          trap 'echo "ERR $?"' ERR          echo "a"     echo "1" | ./crash | cat     echo "b"     echo "2" | ./crash     echo "c"      Which works as intended:               $ ./script.sh >& script.log     $ echo "$?"     139     $ cat script.log     a     Segmentation fault (core dumped)     ERR 139      (without `pipefail` it would print "a b", without `errexit` it would print "a b c") However, since this is part of a larger pipeline and run on a batch system, a number of crashes might occur and the `argv` information in the `dump.?????` file is not enough. So: How do I print the PID (and therefore the expected core dump filename) of the process that caused the error from my script, so that it can be logged with all the rest? The crashing programs may be part of larger pipelines (especially they may not always be at the end of a pipeline, therefore the use of `pipefail`), and I'd like to avoid having to surround each invocation with wrapper code, or not being able to pipe data directly between programs.


title: Exit of "> " mode in Unix shell

text: In sh ( _not Bash_ ), how would we abort execution of command when the prompt is in `>` mode? For example, when entering a string with quotes only at the beginning, it makes the prompt look like `>`, without the ability to quit it normally, unless hitting `Ctrl + D`. Example:               root@MyPC:~# echo "hello     > I am     > (How do I exit of this mode?)      In case that I don't know which character delimits the string (`"` or `'` or simply escaping a newline/spaces with backslash), is there a way to let Bash know that I want to abort the execution of the current command?


title: Extracting data from complex file structure

text: I have a txt file that is a dump from a database, that contains one entry per line. The structure is like this:               1500     29/03/2010      18     02     09     47     17     45     28.248     0     0.01     130     12.721     7908     298,809     YES     3.046.550,39     6.500.000,00     17,444,222               1501     30/03/2010     27     54     28     50     22     03     37.223     0     0.00     97     22,466     7379     421.90     NO     20,262,429     25,000,000.01     17,995,281.33               ... the third record starts here      The database contains 21 fields. The previous lines shows the dump of two records of that database. The blank lines represent blank fields on the database. The first field (F0) is the number you see 1500, 1501... The second field (F1) is a date in the format day, month, year. Fields F2, F3, F4, F5, F6, F7 are six integer numbers. What I need is to extract F0, F2, F3, F4, F5, F6, F7 from this file creating one line for each one. Given the two records above, the final file would be               1500,18,02,09,47,17,45     1501,27,54,28,50,22,03      I know how to do that using a bash script that will be miles long and interact over each line, etc. But I also know that unix is a bag of tricks, specially the `sed` command and that this probably can be done with a simple line. I love to learn new stuff, so I ask you guys that are gods in Unix, how do I do that. I am on OSX Mavericks. Thanks.


title: Why are file handles a scarce resource?

text: I feel like every tutorial I read on resource management in server settings starts by asserting that file handles are a scarce resource, and we should therefore aim to keep the list of open files to a minimum. But I don't really understand _why_ they are a scarce resource. Isn't a file descriptor just a number? How much state does Linux, say, have to track per open file? Is the number of open files limited due to memory issues or something completely different?


title: How to get folder size ignoring hard links?

text: I use rsnapshot for backups, which generates a series of folders containing files of the same name. Some of the files are hard linked, while others are separate. For instance, `hourly.1/file1` and `hourly.2/file1` might be hard linked to the same file, while `hourly.1/file2` and `hourly.2/file2` are entirely separate files. I want to find the amount of space used by the folder `hourly.2` **ignoring** any files which are hard links to files in `hourly.1`. So in the above example, I would want to get the size of file2, but ignore file1. I'm using bash on linux, and I want to do this from the command line as simply as possible, so no big graphical or other-OS-only solutions please.


title: Debian dpkg broken after apt-get upgrade

text: I have been running Debian Wheezy for a long time. Today I ran a `dpkg upgrade`, which has somehow broken things badly. The upgrade aborted, and now `apt-get` and `dpkg` are not running.               # dpkg     dpkg: error while loading shared libraries: libselinux.so.1: cannot open shared object file: No such file or directory      I can download the .deb files that contain the missing files, but I cannot install them without working tools. How do I get out of this catch 22?


title: Can't SSH via password to a Remote Server

text: I've successfully VPNed to my University server on a Fedora 17 Linux terminal.               $ sudo openconnect -u UNIVERSITY_USERNAMEID sslvpn.nameofuniversity.edu     [sudo] password for PCUSERNAME:      Attempting to connect to xxx.xxx.xxx.xxx:xxx     SSL negotiation with sslvpn.nameofuniversity.edu     Connected to HTTPS on sslvpn.nameofuniversity.edu     GET https://sslvpn.nameofuniversity.edu/     Got HTTP response: HTTP/1.0 302 Object Moved     SSL negotiation with sslvpn.nameofuniversity.edu     Connected to HTTPS on sslvpn.nameofuniversity.edu     GET https://sslvpn.nameofuniversity.edu/+webvpn+/index.html     Please enter your username and password.     Password:     POST https://sslvpn.nameofuniversity.edu/+webvpn+/index.html     Got CONNECT response: HTTP/1.1 200 OK     CSTP connected. DPD 30, Keepalive 0     Connected tun0 as xxx.xx.xx.xx, using SSL      After this, I opened a new terminal and executed an `ssh` command which normally works when I'm on campus. I get the following output on the terminal:               # ssh -vvv -Y UNIVERSITY_USERNAMEID@server     OpenSSH_5.9p1, OpenSSL 1.0.0j-fips 10 May 2012     debug1: Reading configuration data /etc/ssh/ssh_config     debug1: /etc/ssh/ssh_config line 50: Applying options for *     debug2: ssh_connect: needpriv 0     debug1: Connecting to server [xxx.xxx.xx.xx] port 22.     debug1: Connection established.     debug1: permanently_set_uid: 0/0     debug1: identity file /root/.ssh/id_rsa type -1     debug1: identity file /root/.ssh/id_rsa-cert type -1     debug1: identity file /root/.ssh/id_dsa type -1     debug1: identity file /root/.ssh/id_dsa-cert type -1     ssh_exchange_identification: Connection closed by remote host      To no avail, I've appended the following to file `/etc/hosts.allow`               SSHD: ALL     SSHD: .nameofuniversity.edu : all     SSHD: ipaddress : all      What can be wrong here?


title: How many actual developers work on the Linux Kernel

text: For a study I am doing I was asked how many actual developers commit on a typical kernel version. I know there is Linus Torvalds as the main developer, followed by many second main developers. Several of which work in companies. But here comes my doubts:   1. Does a commit to the kernel from a company mean that many devs from that company worked to make that commit possible or was it just one man (The one that did the commit).   2. Are there 3rd party groups that help companies or main devs?   3. What could be the estimate of the total number of people involved in a particular version of the Kernel. Not only the total number of companies but the actual amount of people that contributed one way or another to the kernel.


title: How do I run my native `pacman` against a mounted image?

text: I have read and followed Is it possible to update, upgrade and install software before flashing an image?. I managed to mount the official Arch image, synchronise the database and update the preinstalled packages. Unfortunately, it was rather slow. I think it was slow because `pacman` was being emulated, which seems a little excessive. I did a little research and `man pacman` lists the following option > -r, --root   >  Specify an alternative installation root (default is /). This should not be > used as a way to install software into /usr/local instead of /usr. This > option is used if you want to install a package on a temporary mounted > partition that is "owned" by another system.   >  **NOTE** : if database path or logfile are not specified on either the > command line or in **pacman.conf** (5), their default location will be > inside this root path. Can we use exploit this option to install packages on a mounted image?


title: Use the terminal's autocomplete path feature for input to a shell script

text: I want to make a script that: (1) Gets a path giving the user the ability to use tab to autocomplete, then (2) gets a filename from the user, and then (3) creates a file at that path with extension .txt. **My question is:** How do I do 1.? How do I tell bash to ask for input that is an "autocompletable" path, preferably with part of the path (say ~/x/) already filled out by default? Note: the paths will almost always include spaces.


title: how to configure USB networking on fedora

text: I have a Samsung smartphone, which can be connected to a free WIFI network, but my laptop can't connect to that WIFI network. So I want to use my smartphone as a router/forwarder. I want to connect my laptop to the phone with USB. There's USB tethering in my smartphone, but I don't know how to configure my laptop network so that my laptop can connect to Internet via USB. Does anyone know how-to? my machine is fedorea 16 (3.6.10-2.fc16.x86_64)


title: How do I get my wireless USB mouse working

text: My wireless USB mouse is not plugging and playing. This is my first time using linux (Ubuntu 12.04) and I'm trying to get a development environment going to learn to use the shell, Python, and other things as I learn more. I have done my best to solve the problem, but I cannot find a solution. I have run `lsusb`, and I can see the Novatek device goes away when I enter `lsusb` without the usb nub plugged in. Is there anyway to use my mouse? On windows, it's plug and play. I don't know if that matters.


title: Makefile compiles unchanged files

text: Made an effort to get the object files in another directory, but that directory would otherwise reflect the source directory tree. Got that to work, but there is a missing piece at the `$(OBJ):` line (right?), so wether you change the source or not, it recompiles. Have a look.               SRC_PATH=../src/     CC=g++     CFLAGS=-c -Wall     LDFLAGS=-lSDL -lSDL_gfx     INCL=-I $(SRC_PATH)include/     EXE=run          SRC=$(wildcard $(SRC_PATH)*.cpp $(SRC_PATH)game/*.cpp $(SRC_PATH)player/*.cpp)     OBJ=$(subst ../src, ../obj, $(SRC:.cpp=))     OBJ_O=$(addsuffix .o, $(OBJ))          all: $(SRC) $(EXE)          $(EXE): $(OBJ)         $(CC) $(LDFLAGS) $(OBJ_O) -o $@          $(OBJ):         $(CC) $(CFLAGS) $(INCL) -o $(addsuffix .o, $@) $(subst ../obj, ../src, $@).cpp          clean:         rm -rf run $(OBJ_O)      **Edit** This works as intended: does not recompile. Also, is much easier to read without the complicated suffixes back and forth. See answers and comments below.               SRC_PATH=../src/     CC=g++     CFLAGS=-c -Wall     LDFLAGS=-lSDL -lSDL_gfx     INCL=-I $(SRC_PATH)include/     EXE=run          SRC=$(wildcard $(SRC_PATH)*.cpp $(SRC_PATH)game/*.cpp $(SRC_PATH)player/*.cpp)     OBJ=$(subst ../src, ../obj, $(SRC:.cpp=.o))          all: $(SRC) $(EXE)          $(EXE): $(OBJ)         $(CC) $(LDFLAGS) $(OBJ) -o $@          ../obj/%.o: ../src/%.cpp         $(CC) $(CFLAGS) $(INCL) -o $@ $<          clean:         rm -rf run $(OBJ)


title: gnome-keyring-daemon couldn't allocate secure memory

text: I run logcheck on my Debian Linux system to get alerted to unusual lines in my log files, and recently I saw the following in `/var/log/messages`:               gnome-keyring-daemon: couldn't allocate secure memory to keep passwords and or keys from being written to the disk      I don't know exactly what caused the message, just noticed it later in the logs. What does this mean, and how can I fix it?


title: PDF editor with regular expressions for bookmarks?

text: Are there any Unix-based PDF editors with automatic bookmark creation?


title: How is the Linux kernel stack organised for ARM architecture?

text: Can any one explain how exactly linux kernel stack organisation is handled? When a child process is created using the `fork()` system call, how is the kernel stack space initialized?


title: 8-bit input in gnome-terminal

text: I'm trying to switch from `xterm` to `gnome-terminal` but having trouble with alt keys. I have already disabled menu access keys, but I still need 8-bit inputs. In xterm I can set 8-bit inputs in Xresources using;               xterm*eightBitInput  true      is it possible to set alt key to generate 8-bit inputs in gnome-terminal? **edit:** it is also configurable using the option `meta sends escape` from `ctrl+left click` menu in xterm. **edit2:** started using terminator, still need 8-bit inputs. infact, any libvte based terminal supporting 8-bit inputs I would be interested.


title: Automatically acquire new IP address in new network

text: I'm running a Centos virtual machine on a laptop using a bridged network connection to avoid double-NAT issues, with the address assigned via DHCP. This works fine until I move the laptop to another network, at which point the VM doesn't notice that it's on a different network and continues to use the old IP address, resulting in a loss of connectivity. Currently I manage this by manually running `ifdown` and `ifup` to reset the network connection, but I'd prefer an automatic way to do this. Suggestions? Notes:   * All networks have DHCP servers.   * The VM correctly obtains an IP address lease on each network when bringing up the interface.   * I cannot change settings on the DHCP servers.   * The networks are in different IP address ranges.


title: Set Default/Global Gnome Preferences (Gnome 3)

text: I have recently switched to Gnome 3 from Gnome 2 (and switched to Linux recently before that), and Gnome 3 doesn't give me as many options to change settings via the GUI, and especially not to change default settings. Specifically, I'm trying to change the lid close action on my laptop, since I don't want it to suspend on lid close ever. (I changed this for my own user(s) via the gnome-tweak-tool.) I've taken a few unsuccessful stabs. I imagine this has to do with `sudo` for some user, whether `sudo` for _root_ or _gdm_. I've tried (in a console window in a Gnome session and in an SSH session from a remote machine):               > sudo gsettings get org.gnome.settings-daemon.plugins.power lid-close-ac-action     'suspend'     > sudo gsettings set org.gnome.settings-daemon.plugins.power lid-close-ac-action "blank"      For this, I receive an error about an inability to initialize X11. I've also tried:               > sudo -u gdm gsettings get org.gnome.settings-daemon.plugins.power lid-close-ac-action      But, this asks for _gdm_ 's password, which I've never set. I have continued with `passwd`, but it tells me: `Cannot unlock the password for `gdm'!` And, I could try forcing an unlock of the user, but this resistance to me indicates that perhaps I should abandon this path. I don't know if each of these warrants its own line of questioning, but in the end, I'm just trying to set the laptop lid close setting (the default for all users), though I'd like to know more generally how to set Gnome's default preferences.


title: Smart way to perform a similar replacement (not simple enough for diff) in multiple files?

text: I have a bunch of files (45, so too many to edit them manually without going crazy) which all require the same changes (as seen in the three diffs at the end of this question). Most tools used for search-and-replace on the commandline only support line- by-line replacements so they won't work. Is there some commandline tool available which can do the job? Basically performing a multi-line regex search&replace with backreferences without shoving the whole regex into a single line (i.e. it should be read from a file or stdin) should be enough, but maybe there's an even better solution to do this... * * *               --- a/editfile.html     +++ b/editfile.html     @@ -60,7 +60,5 @@           <script type="text/javascript">     -    $(document).ready(function() {     -        editFileInit(opts);     -    });     +    initPage('editFile', opts);      </script>      {% endblock %}                    diff --git a/gallery.html b/gallery.html     index 4a07f70..81084ad 100644     --- a/exodus/templates/gallery.html     +++ b/exodus/templates/gallery.html     @@ -87,9 +87,7 @@               <script type="text/javascript">     -        $(document).ready(function() {     -            galleryInit({     -                editTitleUrl: {{ csrf_url_for('gallery_editpictitle')|tojson|safe }},     -                delPicUrl: {{ csrf_url_for('gallery_delpic')|tojson|safe }}     -            });     +        initPage('gallery', {     +            editTitleUrl: {{ csrf_url_for('gallery_editpictitle')|tojson|safe }},     +            delPicUrl: {{ csrf_url_for('gallery_delpic')|tojson|safe }}              });          </script>                    diff --git a/stream_history.html b/stream_history.html     index 783fea4..ea837fa 100644     --- a/exodus/templates/stream_history.html     +++ b/exodus/templates/stream_history.html     @@ -25,8 +25,6 @@               <script type="text/javascript">     -        $(document).ready(function() {     -            songHistoryInit({     -                dataURL: {{ url_for('stream_history_json')|tojson|safe }}     -            });     +        initPage('songHistory', {     +            dataURL: {{ url_for('stream_history_json')|tojson|safe }}              });          </script>      If the indentation is not preserved it's not a big issue.


title: Sound not working when both the sound card and HDMI use the Intel HDA driver. How to exchange their device loading order?

text: I have an Acer Aspire One 522 netbook which has an Intel HDA sound card based on the Conexant CX20584 chipset. Although KDE does output sound when starting up, flash and probably many other apps which look for a `/dev/dsp` device just can't output sound through it, rendering a pretty much useless multimedia experience. When I checked my ALSA playback devices with `aplay -l`, I could see the main audio device was getting recognized as card 1 instead of 0, which was being hooked up to HDMI instead:               **** List of PLAYBACK Hardware Devices ****     card 0: Generic [HD-Audio Generic], device 3: HDMI 0 [HDMI 0]       Subdevices: 1/1       Subdevice #0: subdevice #0     card 1: SB [HDA ATI SB], device 0: CONEXANT Analog [CONEXANT Analog]       Subdevices: 1/1       Subdevice #0: subdevice #0      That way I get a `/dev/dsp1`, but it seems most apps are just hardcoded to use `/dev/dsp`, so I went looking for some way of exchanging the card indexes. After some research through ALSA documentation, I tried to assign indexes to the driver modules used by HDMI and Intel HDA with this `/etc/modprobe.d/asound.conf` file:               options snd cards_limit=2     options snd-hda-codec-conexant index=0     options snd-hda-codec-hdmi index=1     options snd slots=snd-hda-codec-conexant,snd-hda-codec-hdmi      That didn't work though, and based on some forgotten link on my endless quest for an answer, it seems to be because these `index` directives are supposed to coordinate module loading order, but both these Conexant and HDMI codecs happen to use the same Intel HDA driver module, so it seems not to apply in this case. That said, is there any way to define correct card indexes when the devices use the same ALSA driver module (intel HDA in this case)?


title: problem with text added to pdf under Xournal after exporting to pdf

text: Under Xournal, I add some text to a pdf file, and then I export to a pdf file. In the exported pdf file, the text I added is shown correctly, and selectable, but when I copy and paste the selected text out to a text editor, it is not the same text I added. For example, under Xournal, I add `locking` to a pdf file, and in the exported pdf file, when I select the text and copy and paste it into a text editor, the text is `PSGOMRK`. I wonder if it is a bug of Xournal? How can I make the selected text from the exported pdf file the same as the text I added under Xournal? My OS is Ubuntu 12.04, and the version of Xournal is 0.4.5. Thanks!


title: Setting environment variables at runtime in KDE4

text: Is it possible to set an environment variable at runtime, affecting all the programs started from the DE after that point (Desktop Environment, in my case KDE4) (without rebooting)? I know it it possible to set system-wide or user-wide environment variables in `.profile`, `/etc/environment`, etc., but logging out and back in is required before they are read. My aim is to store the current display resolution in 2 environment vars named `XRES` and `YRES` and update them when I switch to the secondary display.


title: Mailman / Postfix Configuration Assistance

text: I am writing for some help regarding Postfix configuration. I cannot seem to get Postfix configured properly to transfer mail to the mailing list installed on the same server. I followed many steps over the last few days, and the last one I followed is at http://www.postfix.org/VIRTUAL_README.html under the section Mailing Lists. Can someone please look at this and let me know what I am missing? Basically, Postfix has been configured for base email to be sent to `xxx@mail- test.company.org` and I would like the mail list to use `xxx@listtest.company.org`.               **DYN-DNS**      listtest.company.org        A   216.111.222.85        listtest.company.org        MX  216.111.222.85        listtest.company.org        TXT     "v=spf1 a ptr mx ip4:216.111.222.85 mx:mail-test.company.org -all"          mail-test.company.org       A   216.111.222.85        mail-test.company.org       MX  216.111.222.85        mail-test.company.org       TXT     "v=spf1 a ptr mx ip4:216.111.222.85 mx:mail-test.company.org -all"          **main.cf**     myhostname = mail-test.company.org     mydomain = company.org     myorigin = $hostname     alias_maps = hash:/etc/aliases, hash:/etc/mailman/aliases     alias_database = hash:/etc/aliases, hash:/etc/mailman/aliases      recipient_delimiter = +     virtual_alias_maps = hash:/etc/postfix/virtual      mydestination = $myhostname, listtest.$mydomain          /etc/postfix/virtual:         listname-request@listtest.company.org   listname-request         listname@listtest.company.org               listname         owner-listname@listtest.company.org     owner-listname          /etc/aliases:         listname: "/usr/lib/mailman/mail/mailman post mailman"         owner-listname: ...         listname-request: ...          **mm_cfg.py**     DEFAULT_URL_HOST   = 'listtest.company.org'     DEFAULT_EMAIL_HOST = 'listtest.company.org'     add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST)     MTA = 'Postfix'      The first part of the log shows the rejection of listtest.company.org -- whereas the second part shows successful transfer to mail-test.company.org **/var/log/maillog**               Aug 17 15:46:50 listserv postfix/smtpd[19870]: NOQUEUE: reject: RCPT from     Mail1.company.org[66.173.196.101]: 554 5.7.1 <XXXX@listtest.company.org>:      Relay access denied; from=<user@company1.ORG> to=<list@listtest.company.org>      proto=SMTP helo=<MAIL1.company.ORG>     Aug 17 15:46:50 listserv postfix/cleanup[19877]: D3F93209F1: message-     id=<050C37C3BC21CC4483AC395BAFEC94E506116BF5@mail1.informs.org>     Aug 17 15:46:50 listserv postfix/smtpd[19870]: disconnect from      Mail1.company.org[66.173.196.101]          Aug 17 15:46:50 listserv postfix/qmgr[19197]: D3F93209F1:      from=<user2@company.ORG>, size=6670, nrcpt=1 (queue active)     Aug 17 15:46:50 listserv postfix/cleanup[19877]: F37B120A3B: message-     id=<050C37C3BC21CC4483AC395BAFEC94E506116BF5@mail1.informs.org>     Aug 17 15:46:51 listserv postfix/qmgr[19197]: F37B120A3B:      from=<user2@company.ORG>, size=6819, nrcpt=1 (queue active)     Aug 17 15:46:51 listserv postfix/local[19878]: D3F93209F1:     to=<company_it@mail-test.company.org>, relay=local, delay=0.18,     delays=0.17/0.01/0/0, dsn=2.0.0, status=sent (forwarded as F37B120A3B)     Aug 17 15:46:51 app02-listserv postfix/qmgr[19197]: D3F93209F1: removed      Any help would be greatly appreciated.


title: How to send-key to break out of scroll mode in tmux?

text: I have a key-mapping in VIM that looks like this:               map <F5> :silent !tmux send-keys -t 0:0 C-m "python %" C-m<cr>      When I press F5, vim runs my current Python script in tmux session 0, window 0. However, if window 0 is currently in a scroll state (i.e. Shift-PgUp or mouse scroll), tmux will run the command but will not scroll on new output. How do I send a key to the tmux window that will break it out of scroll mode? (I want it to scroll on output) **Note** : I normally get out of scroll-mode by pressing Esc, but I couldn't figure out how to send an Escape key using `tmux send-keys`. I tried sending `C-[` but that didn't work.


title: What is the difference between cmask and umask?

text: What is the difference between the `umask` setting that can be found in `/etc/profile` and the `cmask` setting that can be found in `/etc/default/init`? What is the difference between the two? When will one take effect over the other?


title: Stop aria2c from parsing torrent file

text: When I download a torrent file with aria2c, it always try to parse it and add a torrent task, but all I want is get that file. Is it possible to stop aria2c from doing so? I didn't seem to find an option in manual


title: Automated partition selection in bash script

text: I'm trying to write a bash script to run from Linux on a CD or flashdrive that can mount Windows and change stuff, but I don't know how to go about detecting which partition/drive is Windows. My best guess would be somehow using awk to detect the largest thing in /dev, but I have no idea how to go about writing the expression.


title: ^P not working in zsh, where should I look at?

text: I copied my bashrc and start tweaking it for zsh, but I suddenly found `^P` wasn't functioning, It just print a `^P` on screen. What could be wrong? Or where should I look at now?


title: Accessing Windows Box from Linux Terminal SSH

text: I am familiar with accessing linux from windows, but how can I go about accessing files on a windows box from a linux terminal via ssh? I'd like to stay away from RDP and just grab files via the terminal.


title: Emacs depends on perl

text: Why does emacs depend on Perl? I thought it is all based on C/Lisp? Emacs Version 24.1.4.fc17 (Working on a fresh out of the box fedora17)


title: Command to hide everything except viewport in terminal window?

text: Is there a way to see only the viewport for terminal (Mac OS X 10.8.4)? (That is, can I hide the open/close/minimize buttons.) The need is for more for a visual desire than a practical one. I'm working on a command-line tool and I want to hide everything else for the user.


title: hosting my web portal on CentOS linux

text: I need to buy a VPS / dedicated server that provides a CentOS Linux with 4 x 500 GB harddrives in mirrored Raid. So that'd be 1TB of hard-drive space. The way I keep my pictures on my website is in a single folder, where all the picture of the same type go, with the id of the `mysql_row` in front, followed by a short description. Something like *1_thumb.jpg* or *123_index.jpg*, they all go in the same folder. The question is : Since I will have multiple hard-drives on my hosting `/dev/hda1`, `/dev/hda2` in Raid mirrored, Can they make a whole big 1TB partition from all of the hard-drives combined ? If so, I can use the current structure of my website. If not, then I need to rethink the way I keep my pictures saved.


title: What are ./ and ../ directories?

text: Simple question, but I'm not sure where to look and google doesn't respond to periods and slashes. I'm just trying to count the # of files & directories in the current directory (not including subfolders/files) and was trying to differentiate `ls -1 | wc -l` and `ls | wc -l` since they seem identical. A site I was looking at said **"Keep in mind that this is also counting the ./ and ../ directories."** regarding the one with `ls -1`, and I'm not sure if that means it includes the directories before or something (which I don't want), but it didn't seem to do that from testing. Could someone confirm which one of those would be most adequate for counting # of files & directories in the current directory only (not sub) and what they mean by ./ and ../ directories?


title: Mutt: gmail archive

text: I want to recreate the gmail archiving method. I sync (using offlineimap) my inbox and my all mail folders, and, by archiving, I want to keep the one in All Mail and delete the one in inbox. Also, when I read a new mail in inbox I would like to automatically mark as read the corresponding mail into all mail. I tried using the macro `index, pager A s><return>y` (I have set All Mail folder to $mbox), but the problem is that I get duplicate mails in the All Mail folder. Also, if I try to just delete the mail from Inbox, the corresponding one from All Mail gets deleted too. **Later edit:** Doing some more research into this topic I found that the duplicate mail in the All Mail mailbox stays there for 2 syncs: one to send it to gmail, which recognizes that it's a duplicate and deletes it, and one to delete it locally. So it seems that my macro works, but I would like to overcome this annoying issue.


title: What's the best way to format a HDD in Linux in order to leave no trace?

text: I'm running Debian and need a way to format the entire hdd in order to not leave any trace on it because I want to donate it to a friend. So what will be the best way in order to format it? If I reinstall the OS it will not fully format it. I'm looking for a way to completely format it and make it like when you buy it from the shop, completely new and never stored a thing before.


title: Linux equivalent of GraphClick?

text: Is there a piece of Linux software that does what GraphClick does in Mac OS X? That is, is there a Linux software that "is a graph digitizer software which allows to automatically retrieve the original (x,y)-data from the image of a scanned graph"?


title: Linux, wine && Lineage

text: I'm trying start **Lineage Interlude** client under:               $ lsb_release -a     No LSB modules are available.     Distributor ID: Ubuntu     Description:    Ubuntu 14.04.1 LTS     Release:        14.04     Codename:       trusty      with Wine:               # aptitude show wine     Package: wine                                 State: installed     Automatically installed: no     Multi-Arch: foreign     Version: 1:1.6.2-0ubuntu4      But Wine falls immediately after star with error:               $ wine l2.exe      err:module:attach_process_dlls "vorbisfile.dll" failed to initialize, aborting     err:module:LdrInitializeThunk Main exe initialization for L"Z:\\home\\setevoy\\Games\\TheMega\\Client Interlude - TheMega.ru - 29.05.2012\\system\\l2.exe" failed, status c0000005      Any suggestions How it can be fixed?


title: How can I groups numbers in a file

text: I have a file with numbers in float format.   I can review them via `sort -rn numbers.txt | less`   I would like though to be able to "group" them. I.e. easily see how many are in the same range.   To give an example of the file:               30.9695041179657       30.8851490020752       30.2127060890198       29.1361880302429       26.4587681293488        25.8535399436951        25.7361891269684        25.7305450439453        25.1068568229675        24.7598769664764        24.3106801509857        24.0782940387726         I don't care about accuracy. So I would like to know how many 25's are in the file e.g. in this case 4 and 30's etc for all numbers in the file.   So for this example an output like: 3 for 30, 1 for 29, 1 for 26, 4 for 25, 3 for 24.   Is there an easy way to do this?


title: kernel patches - knowing when to do them

text: I've never done a kernel patch before, and I've just recently started looking into how it's done. I notice that for a patch's filename, it tells us the kernel version (i.e dm-raid45-2.6.25-rc2_20080221.patch.bz2). So, I know that definitely for kernel 2.6.25, I'd need to apply this patch. But, I just want to make sure: If I've got a kernel that is more recent than the one mentioned - say, 2.6.26 - does this mean that this patch has already moved its way to the 2.6.26 kernel version and that I won't need to apply it at all? Thanks for clarifying!


title: ssh remote server on some port other than 22 without password

text: I am usually connecting to the remote server with > ssh user@server.com -p 11000 and then giving the password each time for user. How should I avoid entering the password each time I connect using ssh ?


title: Configuring cron.hourly

text: I am unable to configure a cron job to run by placing it in /etc/cron.hourly folder.               SHELL=/bin/bash     PATH=/sbin:/bin:/usr/sbin:/usr/bin     MAILTO=root     HOME=/          # run-parts     01 * * * * root run-parts /etc/cron.hourly     02 4 * * * root run-parts /etc/cron.daily     22 4 * * 0 root run-parts /etc/cron.weekly     42 4 1 * * root run-parts /etc/cron.monthly      The file under cron.hourly is :               lrwxrwxrwx 1 root root   40 2010-07-26 14:52 check -> /usr/local/xxxx/check-interface.bash      Permissions on the file :               -rwxr-xr-x 1 root root 1.6K 2010-09-13 11:22 /usr/local/xxxx/check-interface.bash      There seems to be no errors reported in the var/log/cron logfile. No mention of the script is done. :(


title: when does the system send a SIGTERM to a process?

text: My server program received a SIGTERM and stopped (with exit code 0). I am surprised by this, as I am pretty sure that there was plenty of memory for it. Under what conditions does linux (busybox) send a SIGTERM to a process?


title: "Conflicting versions" error while running eggdrop

text: I'm getting this error while running the eggdrop bot, while loading the `http.tcl` script: > conflicting versions provided for package "http": 2.7.5, then 2.5.2 How do I fix this?


title: Increasing nproc limit for a non-root user . Only effective by restart

text: I am increasing `nproc` limit for one of a development user account in my rhel6 system . After searching some rubust solution , I zerod at editing `/etc/security/limits.conf` with these two lines :                 @dev_user        hard    nproc          4096     @dev_user        soft    nproc          4096      For some cases I have to deal with so much number of threads that's why I want those numbers high . Also this solution serves the pupose well . BUT my problem is if any time I edit that file with `sudo` permission then it only becomes after the system restart. This dev_user have been provided `root` access with `sudo` permissions only. Here is my humble request to you to please suggest me some solution which should do the task without restart . Also increased limits should last long until unless no else edits it again.


title: How do I remap Caps_lock to Ctrl from inside emacs?

text: I use emacs on several machines between work and home, and I'm naturally interested in remapping that Caps_Lock key to save my finger from agony. On some platforms it's a bit more difficult to do than one would like, the interface to the X server is far from being user-friendly. On the other hand, I managed to set up a simple system to share my emacs configuration across machines. Since the remapping of the key is mainly useful inside emacs, is there a way to remap CapsLock to Control (and vice-versa) **inside emacs only**? If it makes any difference, I use emacs 24.1.


title: What does "pollsys" mean? Solaris "truss" output

text: > truss -p 6482     /2:     pollsys(0xE517AD88, 1, 0xE517AE30, 0x00000000)  = 0     /2:     pollsys(0xE517AD88, 1, 0xE517AE30, 0x00000000)  = 0     /2:     pollsys(0xE517AD88, 1, 0xE517AE30, 0x00000000)  = 0     /2:     pollsys(0xE517AD88, 1, 0xE517AE30, 0x00000000)  = 0     /2:     pollsys(0xE517AD88, 1, 0xE517AE30, 0x00000000)  = 0     /2:     pollsys(0xE517AD88, 1, 0xE517AE30, 0x00000000)  = 0     /2:     pollsys(0xE517AD88, 1, 0xE517AE30, 0x00000000) (sleeping...)     /2:     pollsys(0xE517AD88, 1, 0xE517AE30, 0x00000000)  = 0     /2:     pollsys(0xE517AD88, 1, 0xE517AE30, 0x00000000) (sleeping...)     /2:     pollsys(0xE517AD88, 1, 0xE517AE30, 0x00000000)  = 0     /2:     pollsys(0xE517AD88, 1, 0xE517AE30, 0x00000000)  = 0     /2:     pollsys(0xE517AD88, 1, 0xE517AE30, 0x00000000) (sleeping...)     /2:     pollsys(0xE517AD88, 1, 0xE517AE30, 0x00000000)  = 0     [...]      no manual page found. Please explain for Non-programmer.               > uname -a     SunOS toolbox048 5.10 Generic_139555-08 sun4v sparc SUNW,Sun-Blade-T6320


title: How to capture text formatting in bash?

text: The following shell script works but removes colored formatting generated by `rspec`:               #!/bin/bash     OUTPUT=`rspec`     echo "$OUTPUT"      How to preserve the colors?


title: Emacs move to next whitespace

text: In emacs there are the functions `forward-word` and `backward-word`. Are there also functions which move the point to the next/last whitespace?


title: Unable to login in fedora 16

text: I am new in Linux environment. I install the fedora 16 but I skipped to create at least one user account during installation. Now I am unable to log in to the Fedora graphical environment. How can I create log in account? Does there is any solution or I have to re install?


title: Avoid asking password if `su -m user command` is used under `user`?

text: If I run the script containing `su -m user service userservice start` under root user, I do not need to enter the password. But when I run it under `user` user, it asks passwords all the time. That really bugs me. Is it supposed to ask passwords for security reasons? Is there any way I could avoid asking password if `su -m user command` is run under `user`? **Edit1:** The reason I need to avoid password entering on `su` for current user is `/etc/init.d/scripts` which have `su -m user` statement for many services I have installed. And it is seems stupid to enter password every time if I'm restarting service which is supposed to run under current user. Actually, I need to enter password twice while I'm restarting some service. I might agree that it is a feature of _some_ init.d scripts and all I need to do is tweak the source a little bit, but I thought that it might be fixed somehow on the `su` level in order to avoid changing init.d scripts source code.


title: No locate.db even after running updatedb

text: Any clue what's up with this?               djc@miles rebar $ sudo updatedb     djc@miles rebar $ locate .dialyzer_plt     locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory     djc@miles rebar $ sudo su -l     miles ~ # cd /var/lib/mlocate/     miles mlocate # ls -l     total 51576     -rw------- 1 root root  6553600 Oct  1 03:13 mlocate.db.AkeorG     -rw------- 1 root root  6635520 Oct  3 03:14 mlocate.db.EY0KT9     -rw------- 1 root root  6639616 Oct  4 10:34 mlocate.db.EiWVGW     -rw------- 1 root root  6230016 Sep 30 03:14 mlocate.db.Shbi49     -rw------- 1 root root 13447168 Sep 29 14:40 mlocate.db.VAo6El     -rw------- 1 root root  6668288 Oct  4 03:12 mlocate.db.gTyzDl     -rw------- 1 root root  6635520 Oct  2 03:12 mlocate.db.o0nXlW


title: Does bc support hex calculations?

text: I'm trying to do a `hex` calculation directly with `bc`, I already specified the scale.               echo 'scale=16;c06b1000-c06a5e78' | bc      But I still get a zero. What could be wrong?


title: Source code of netstat

text: Can I view the source code of `netstat` on my Linux machine?


title: Replace text between brackets

text: I'm using `awk '{ gsub(/BAR|WIBBLE/, "FOO"); print }'` to replace text in data like:               SOMETHING [BAR, WIBBLE]     SOMETHING [BAR]      This gives the desired result of:               SOMETHING [FOO, FOO]     SOMETHING [FOO]      But now I've had to update the text that requires replacing to be something like:               awk '{ gsub(/BAR|WIBBLE|ME/, "FOO"); print }'      Which turns text like:               SOMETHING [ME, WIBBLE]      into:               SOFOOTHING [FOO, FOO]      How can I limit my replacement to just the text between the brackets (i.e. leave the `SOMETHING` alone)? **EDIT** I also need robustness across whatever text `SOMETHING` might be (e.g. `SHE GAVE ME THAT` shouldn't have `ME` replaced).


title: How can I be sure that a directory or file is actually deleted?

text: I know that most files, when deleted, aren't actually removed from the disk, and can be recovered later. How can I ensure that a directory I had deleted will actually be removed from the disk? Are there utilities for that? I'm using Debian Linux.


title: Mastering apt-get

text: I'd like to learn about `apt-get` so nothing bad can surprise me. I was looking for some tutorials but have found nothing that teaches it carefully including its internals. I found this article but it's insufficient for me. Where can I learn more (excluding documentation and manual pages)? _Mastering_ here does not mean that I will learn 100 switches of the `apt-get` command but it means that I will learn how it works on some more general level than reading its source code. Thank you.


title: What does ${1+"$@"} mean in a shell script, and how does it differ from "$@"?

text: In the Perl documentation, perlrun(1) suggests launching Perl scripts using a bilingual shell/Perl header:               #!/bin/sh     #! -*-perl-*-     eval 'exec perl -x -wS $0 ${1+"$@"}'         if 0;      What does `${1+"$@"}` mean? I tried using `"$@"` instead (using Bash as /bin/sh), and it seems to work just as well. * * * ### Edit Two answers below say that it's supposed to be `${1:+"$@"}`. I am aware of the `${parameter:+word}` ("Use Alternate Value") syntax documented in bash(1). However, I am unconvinced, because   1. Both `${1+"$@"}` and `"$@"` work just fine, even when there are no parameters. If I create simple.sh as              #!/bin/sh     eval 'exec /usr/bin/perl -x -S -- $0 "$@"'         if 0;     #!perl     use Data::Dumper;     print Dumper(\@ARGV);      and question.sh as              #!/bin/sh     eval 'exec /usr/bin/perl -x -S -- $0 ${1+"$@"}'         if 0;     #!perl     use Data::Dumper;     print Dumper(\@ARGV);      I can get both to work identically:              $ ./question.sh      $VAR1 = [];     $ ./question.sh a     $VAR1 = [               'a'             ];     $ ./question.sh a 'b c'     $VAR1 = [               'a',               'b c'             ];     $ ./question.sh ""     $VAR1 = [               ''             ];     $ ./simple.sh      $VAR1 = [];     $ ./simple.sh a     $VAR1 = [               'a'             ];     $ ./simple.sh a 'b c'     $VAR1 = [               'a',               'b c'             ];     $ ./simple.sh ""     $VAR1 = [               ''             ];        2. Other sources on the Internet also use `${1+"$@"}`, including one hacker who seems to know what he's doing. Perhaps `${parameter+word}` is an undocumented alternate (or deprecated) syntax for `${parameter:+word}`? Could someone confirm that hypothesis?


title: How to run script with the privileges expected of the script's general "intended user"?

text: During the development of a script, some bugs remain "latent" until the script is run by a different user. (For example, the script may access a file that only the person developing the script has access to.) Is there a way to run the script with the same privileges that the "intended user" of the script _would minimally have_? (Please note the question's wording. I specifically avoided writing "user with minimal privileges", because in some cases the "intended user" may be expected to more than "minimal privileges". The case that most readily comes to mind is the one where the "intended user" is expected to belong to a specific group.) Of course, one simple solution would be to create a dummy user with the desired privileges, but this solution requires having user-creation privileges, which is not always the case. I'm interested in solutions that could be used even when creating a dummy user is not an option.


title: CentOS doesn't see USB device

text: I'm running CentOS 6.3 inside of VirtualBox and am having trouble seeing my USB 2.0 thumb drive. In VirtualBox I go to Devices, USB drives and can capture my connected thumb drive. I've created a mount point in CentOS but fdisk doesn't show the drive (I'm expecting to see SDC) there. What am I missing?


title: How do I rename files with strange characters

text: I have file with greek or cyrillic characters. It is not owned by me, but by the web server user (www). I cannot use the shell as the web server user (www) or as root, but I've used a script (executed by the web server user) to set the modbits directory it is in to 777 and the file itself to 666. I am not able to rename (or delete this) file. Even using the inode and using `find` fails:               $ ls -i1     19120017 Idezbox - коробка.jpeg          $ find . -inum 19120017 -exec mv -i {} sane \;     mv: cannot move `./Idezbox - коробка.jpeg' to `sane': No such file or directory      Wildcards fail:               $ mv Idezbox*.jpeg sane     mv: cannot move `Idezbox - коробка.jpeg' to `sane': No such file or directory      The following Perl-script also fails:               find . -type f -print0 | \     perl -n0e '$new = $_; if($new =~ s/[^[:ascii:]]/x/g) {       print("Renaming $_ to $new\n");       rename($_, $new);     }'      It prints out:               Renaming Idezbox - коробка.jpeg to Idezbox - xxxxxxxxxxxxxx.jpeg      but the subsequent rename command has no effect.   However, note that there are 7 greek characters and 14 "x"-es. Moving to the directory above and trying to delete "Junk":               $ rm -riv Junk     rm: descend into directory `Junk'? yes     rm: cannot remove `Junk/Idezbox - коробка.jpeg': No such file or directory      Some requested output:               $ mount | grep "on /ifi/asgard/k00"     asgard:/ifi/asgard/k00 on /ifi/asgard/k00 type nfs (rw,tcp,rsize=32768,wsize=32768,hard,intr,addr=xxx.xxx.xxx.xxx)          $ df .     Filesystem           1K-blocks      Used Available Use% Mounted on     asgard:/ifi/asgard/k00                          104857600  53201568  51656032  51% /ifi/asgard/k00     $ ls -al     total 88     drwxrwxrwx  2 www     ifiweb   4096 2014-08-11 14:16 .     drwxrwsrwx 14 inf5270 inf5270  4096 2014-08-11 14:15 ..     -rw-rw-rw-  1 www     ifiweb  35176 2012-04-14 13:38 Idezbox - коробка.jpeg     -rwxrw-r--  1 gisle   ifi-a     139 2014-08-11 14:15 perl-rename.sh          $ who ami i     gisle    pts/122      2014-08-11 11:37 (safir.ifi.uio.no:13.0)      After having read through all comments and answers (thanks everybody!) I no longer think this is just about escaping or quoting the cyrillic characters. I need to look into the NFS angle. I'll update after doing that.


title: How to add specific directory for a file during tar file generation?

text: When I create a `.tar` file using the `tar` command, what option do I need to use to add a specific directory hierarchy to the file? For example:               Test_File.tar         |__   MAIN                 |__ SUB1                        |__ Process.txt


title: Can't boot into single user mode

text: I hosed my login (bad script /etc/profile.d) and I can't SSH into my system or boot it into single. I append " single" to the end of the kernel boot parameters and it just keeps booting like normal. I've also tried " s" with no avail. However, " emergency" does work. I'm running RHEL 6.3. Any ideas on what I'm doing wrong?


title: command to zip multiple directories into individual zip files

text: I have a single directory that contains dozens of directories inside of it. I'm new to command line and I'm struggling to come up with a command that will zip each sub-directory into a unique sub-directory.zip file. So in the end my primary directory will be filled with all of my original sub- directories, plus the corresponding `.zip` files that contain the zipped up content of each sub-directory. Is something like this possible? If so, please show me how it's done.


title: Is reparenting from the shell possible?

text: This question is closely related to How to "correctly" start an application from a shell but tries to tackle a more specific problem. How can I spawn an application from a shell and thereby making it a child of another process. Here is what I mean exemplified with two graphics:               systemd-+-acpid             |-bash---chromium-+-chrome-sandbox---chromium-+-chrome-sandbox---nacl_helper             |                 |                           `-chromium---5*[chromium-+-{Chrome_ChildIOT}]             |                 |                                                    |-{Compositor}]             |                 |                                                    |-{HTMLParserThrea}]             |                 |                                                    |-{OptimizingCompi}]             |                 |                                                    `-3*[{v8:SweeperThrea}]]             |                 |-chromium             |                 |-chromium-+-chromium             |                 |          |-{Chrome_ChildIOT}             |                 |          `-{Watchdog}             |                 |-{AudioThread}             |                 |-3*[{BrowserBlocking}]             |                 |-{BrowserWatchdog}             |                 |-5*[{CachePoolWorker}]             |                 |-{Chrome_CacheThr}             |                 |-{Chrome_DBThread}             |                 |-{Chrome_FileThre}             |                 |-{Chrome_FileUser}             |                 |-{Chrome_HistoryT}             |                 |-{Chrome_IOThread}             |                 |-{Chrome_ProcessL}             |                 |-{Chrome_SafeBrow}             |                 |-{CrShutdownDetec}             |                 |-{IndexedDB}             |                 |-{LevelDBEnv}             |                 |-{NSS SSL ThreadW}             |                 |-{NetworkChangeNo}             |                 |-2*[{Proxy resolver}]             |                 |-{WorkerPool/1201}             |                 |-{WorkerPool/2059}             |                 |-{WorkerPool/2579}             |                 |-{WorkerPool/2590}             |                 |-{WorkerPool/2592}             |                 |-{WorkerPool/2608}             |                 |-{WorkerPool/2973}             |                 |-{WorkerPool/2974}             |                 |-{chromium}             |                 |-{extension_crash}             |                 |-{gpu-process_cra}             |                 |-{handle-watcher-}             |                 |-{inotify_reader}             |                 |-{ppapi_crash_upl}             |                 `-{renderer_crash_}             |-2*[dbus-daemon]             |-dbus-launch             |-dhcpcd             |-firefox-+-4*[{Analysis Helper}]             |         |-{Cache I/O}             |         |-{Cache2 I/O}             |         |-{Cert Verify}             |         |-3*[{DOM Worker}]             |         |-{Gecko_IOThread}             |         |-{HTML5 Parser}             |         |-{Hang Monitor}             |         |-{Image Scaler}             |         |-{JS GC Helper}             |         |-{JS Watchdog}             |         |-{Proxy R~olution}             |         |-{Socket Thread}             |         |-{Timer}             |         |-{URL Classifier}             |         |-{gmain}             |         |-{localStorage DB}             |         |-{mozStorage #1}             |         |-{mozStorage #2}             |         |-{mozStorage #3}             |         |-{mozStorage #4}             |         `-{mozStorage #5}             |-gpg-agent             |-login---bash---startx---xinit-+-Xorg.bin-+-xf86-video-inte             |                               |          `-{Xorg.bin}             |                               `-dwm-+-dwmstatus             |                                     `-xterm---bash-+-bash             |                                                    `-pstree             |-systemd---(sd-pam)             |-systemd-journal             |-systemd-logind             |-systemd-udevd             |-wpa_actiond             `-wpa_supplicant      The process tree shows chromium and firefox as children of the `init` process that starts at boot and has `PID 1`. But what I want to achieve is to start firefox and chromium as children of `dwm`. Hence, I want a similar behaviour to what you can see under the `weston` part of the following process tree where firefox has `weston-desktop` as its parent:               systemd-+-acpid             |-bash---chromium-+-chrome-sandbox---chromium-+-chrome-sandbox---nacl_helper             |                 |                           `-chromium-+-3*[chromium-+-{Chrome_ChildIOT}]             |                 |                                      |             |-{Compositor}]             |                 |                                      |             |-{HTMLParserThrea}]             |                 |                                      |             |-{OptimizingCompi}]             |                 |                                      |             `-3*[{v8:SweeperThrea}]]             |                 |                                      `-4*[chromium-+-{Chrome_ChildIOT}]             |                 |                                                    |-{CompositorRaste}]             |                 |                                                    |-{Compositor}]             |                 |                                                    |-{HTMLParserThrea}]             |                 |                                                    |-{OptimizingCompi}]             |                 |                                                    `-3*[{v8:SweeperThrea}]]             |                 |-{AudioThread}             |                 |-3*[{BrowserBlocking}]             |                 |-{BrowserWatchdog}             |                 |-5*[{CachePoolWorker}]             |                 |-{Chrome_CacheThr}             |                 |-{Chrome_DBThread}             |                 |-{Chrome_FileThre}             |                 |-{Chrome_FileUser}             |                 |-{Chrome_HistoryT}             |                 |-{Chrome_IOThread}             |                 |-{Chrome_ProcessL}             |                 |-{Chrome_SafeBrow}             |                 |-{Chrome_SyncThre}             |                 |-{CrShutdownDetec}             |                 |-{IndexedDB}             |                 |-{NSS SSL ThreadW}             |                 |-{NetworkChangeNo}             |                 |-2*[{Proxy resolver}]             |                 |-{WorkerPool/2315}             |                 |-{WorkerPool/2316}             |                 |-{WorkerPool/2481}             |                 |-{chromium}             |                 |-{extension_crash}             |                 |-{gpu-process_cra}             |                 |-{handle-watcher-}             |                 |-{inotify_reader}             |                 |-{renderer_crash_}             |                 `-{sandbox_ipc_thr}             |-2*[dbus-daemon]             |-dbus-launch             |-dhcpcd             |-gpg-agent             |-login---bash---startx---xinit-+-Xorg.bin-+-xf86-video-inte             |                               |          `-{Xorg.bin}             |                               `-dwm-+-dwmstatus             |                                     `-xterm---bash             |-login---bash---weston-launch---weston-+-Xwayland---4*[{Xwayland}]             |                                       |-weston-desktop--+-firefox-+-firefox             |                                       |                 |         |-4*[{Analysis Helper}]             |                                       |                 |         |-{Cache2 I/O}             |                                       |                 |         |-{Cert Verify}             |                                       |                 |         |-{DNS Resolver #1}             |                                       |                 |         |-{DNS Resolver #2}             |                                       |                 |         |-2*[{DOM Worker}]             |                                       |                 |         |-{Gecko_IOThread}             |                                       |                 |         |-{HTML5 Parser}             |                                       |                 |         |-{Hang Monitor}             |                                       |                 |         |-{Image Scaler}             |                                       |                 |         |-{ImageDecoder #1}             |                                       |                 |         |-{ImageDecoder #2}             |                                       |                 |         |-{ImageDecoder #3}             |                                       |                 |         |-{JS GC Helper}             |                                       |                 |         |-{JS Watchdog}             |                                       |                 |         |-{Socket Thread}             |                                       |                 |         |-{Timer}             |                                       |                 |         |-{URL Classifier}             |                                       |                 |         |-{gmain}             |                                       |                 |         |-{localStorage DB}             |                                       |                 |         |-{mozStorage #1}             |                                       |                 |         |-{mozStorage #2}             |                                       |                 |         |-{mozStorage #3}             |                                       |                 |         |-{mozStorage #4}             |                                       |                 |         `-{mozStorage #5}             |                                       |                 `-weston-terminal---bash---pstree             |                                       `-weston-keyboard             |-systemd---(sd-pam)             |-systemd-journal             |-systemd-logind             |-systemd-udevd             |-tmux---bash             |-wpa_actiond             `-wpa_supplicant      One possible solution would be to use `nsenter` from `util-linux`. I could enter the namespace of the `dwm` process and fork a new firefox process which would then be the child of `dwm`. However, that seems like a lot of work. Is there some easier way to do this?


title: Emulating scroll lock behaviour to trigger USB KVM switch

text: At work, I use two computers: one Windows machine for intranet and mail, one Ubuntu machine on a separate network for development. In order to easily switch between the two I use a simple USB KVM switch (a Newstar) so I can use a single mouse and keyboard for both machines. Using the hardware key on the switch itself, I can switch between the two computers. However, I don't want to stretch my arm. That's physical effort, and it's not what IT is for. On the Windows machine, I can double-tap `Scroll Lock` to trigger the switch to the Ubuntu machine. On the Ubuntu machine, `Scroll Lock` does nothing - `xev` says it sends a KeyPress/KeyRelease event with keycode 78, but the scroll light stays off and more importantly, the switch does nothing. I have found a solution telling me to add `'add mod3 = Scroll_lock'` to `xmodmap`, but while that makes the light blink it doesn't trigger the switch. Since I _can_ double-tap `Scroll Lock` in text mode and make it trigger the switch, I'm guessing either X doesn't fully forward the keypress or something else swallows the event. So: How can I make this work? Or more accurately, how can figure out what sort of input will trigger the switch so I can emulate it in Ubuntu?


title: Explicit range beween values

text: Is there any clean way of calculating the range between elements of the second column of a text file using some bash magic? (I'm currently doing this using Python). Input: File 1               A   1-5     A   17-19     B   1-5     B   4-6      Expected output: File 2               A   1,2,3,4,5,17,18,19     B   1,2,3,4,5,6          _EDIT_ @Anthon: to cumulate elements I'm using something like this (then calculate the ranges using a for loop)               d_pos= {}      for row in open('File.txt'):          x, y = [ value.strip() for value in row.split('\t')]          if x in d_pos:                     d_pos[x].append(y)             else:                     d_pos[x] = [y]


title: Why Process/program becomes zombie?

text: If script is running fine from command line then, why the same script becomes zombie state after running through cron and How you will troubleshoot the same ? Here following real example :               [root@abc ~]# ps ax | grep Z     23880 ?        Zs     0:00 [checkloadadv.sh] <defunct>     23926 pts/0    S+     0:00 grep Z     [root@abc ~]# strace -p 23880     attach: ptrace(PTRACE_ATTACH, ...): Operation not permitted     [root@abc ~]# pstree | grep  checkload     init-+-crond---crond-+-checkloadadv.sh     [root@abc ~]# bash /usr/bin/checkloadadv.sh     System Load is OK : 0.05


title: How do I run this C program after starting X server?

text: The source for a program that automatically scales my laptop's keyboard brightness to its screen's brightness is given on the Arch wiki page for my laptop. I can compile it and when I run the program as root it works fine. Unfortunately, I do not know how to run this program every time I start my computer, and further the wiki states that I have to run it after I start the X server. Since I'm using Arch, I imagine I have to do something with `systemd`, but I have no idea what. Any help would be greatly appreciated. If it's relevant, the source is posted here.


title: get kernel source code

text: I need a specific kernel version to compile it with some additional modules. When I typing:               uname -r      I get               3.8.0-29-generic      I need this one.                uname -a      Linux "..." 3.8.0-29-generic #42~precise1-Ubuntu SMP Wed Aug 14 16:19:23 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux      Where can I find this version? Here https://www.kernel.org/ seems that there isn't..


title: How do you make a star symbol with the compose key in Linux?

text: I know how to make a heart with this sequence: `composeKey`, `<`, `3` But how do you make a star ★?


title: Why are cgroups mapped differently on these two systems by systemd

text: I have two systems, both running customized variants of OpenSuSE 12.2 (Mantis), both running exactly the same kernel. I get two very different outputs of `/proc/self/cgroup` or `/proc/$$/cgroup` on the two systems: System A (or a stock OpenSuSE 12.1):               cat /proc/self/cgroup      9:perf_event:/     8:blkio:/     7:net_cls:/     6:freezer:/     5:devices:/     4:memory:/     3:cpuacct,cpu:/     2:cpuset:/     1:name=systemd:/user/root/6      System B:               root@msx:/sys/fs/cgroup> cat /proc/self/cgroup      9:perf_event:/     8:blkio:/     7:net_cls:/     6:freezer:/     5:devices:/     4:memory:/     3:cpuacct,cpu:/system/serial-getty@.service/ttyS0     2:cpuset:/     1:name=systemd:/system/serial-getty@.service/ttyS0      Why are lines 1 different and why is line 3 present in one and absent in the other? I can find no configuration differences between the two systems. They run the same version of systemd (`systemd-44-10.1.1.x86_64`). If I duplicate the sysctl values it has no effect. The boot options are the same. I've compared everything in `/etc`, `/usr`, and `/lib` to see if there are any relevant configuration differences. (There are different installed RPMs but none that lay down any system configuration files, and I think I removed all the custom RPMs.) This is more than a curiosity factor because on System B, we cannot create a `SCHED_RR` thread, but on System A, we can. If I set `DefaultController` to `NULL` in `/etc/systemd/system.conf`, it works, and line 3 disappears (lines 1 remain different). It also works if I write the process ID of the invoking shell into `/sys/fs/cgroup/cpu,cpuacct`:               root@msx:/root> ./a.out     Creation of real-time thread FAILED - Operation not permitted     root@msx:/root> cat /proc/$$/cgroup     9:perf_event:/     8:blkio:/     7:net_cls:/     6:freezer:/     5:devices:/     4:memory:/     3:cpuacct,cpu:/system/sshd.service     2:cpuset:/     1:name=systemd:/system/sshd.service     root@msx:/root> echo $$ > /sys/fs/cgroup/cpu,cpuacct/tasks     root@msx:/root> ./a.out     root@msx:/root> cat /proc/$$/cgroup     9:perf_event:/     8:blkio:/     7:net_cls:/     6:freezer:/     5:devices:/     4:memory:/     3:cpuacct,cpu:/     2:cpuset:/     1:name=systemd:/system/sshd.service      Not sure why this works. My colleagues aren't satisfied that the problem is understood, as it shouldn't require this configuration change. Kernel is 3.4.47, `CONFIG_RT_GROUP_SCHED` is enabled, `CONFIG_AUTOGROUP` is enabled (disabling still doesn't work but it does fail differently) This is a spinoff of http://stackoverflow.com/questions/20412336/how-to-check- for-permissions-for-sched-setscheduler.


title: Imaging a corrupted NTFS

text: I have an ext. drive with a corrupted NTFS (in the sense that NTFS-3G refuses to mount it). I really want to just take an image of the drive, stash that somewhere for later, and reformat the drive so I can use it normally. I don't want to lose any of my files on the drive. Question: Is there a way to take an (compressed?) image of the drive that will preserve it bit-for-bit and allow me to do forensics later?