What are the numbers after the version in the output of apt-cache policy?

This is the output of `apt-cache policy firefox`               firefox:       Installed: 26.0~linuxmint1+lmde       Candidate: 26.0~linuxmint1+lmde       Version table:      *** 26.0~linuxmint1+lmde 0             500 http://packages.linuxmint.com/ debian/import amd64 Packages             100 /var/lib/dpkg/status      The version is shown as `26.0~linuxmint1+lmde`, what is the `0` that comes after it? I have tried with various packages and there is always a `0` after the package version. Presumably, this can also take other values but I haven't seen it. I read through both the `man` and `info` pages of `apt-cache` and could not find anything relevant. The only explanation of `policy` is:                  policy [pkg...]            policy is meant to help debug issues relating to the preferences            file. With no arguments it will print out the priorities of each            source. Otherwise it prints out detailed information about the            priority selection of the named package.


Auto mounting other partitions in Arch Linux

Im using Arch Linux. Is there a way to automount other NTFS or Ext partitions automatically without writing about them in `/etc/fstab`?


Screen stretching on Mint Cinnamon after hard reboot

I've been running 64-bit Linux Mint Cinnamon for a couple of years now on my current hardware. I upgraded to Qiana a month ago and hadn't had any problems with it. This morning my machine locked up when I accidentally loaded a huge file via a python script that was apparently too big to fit in memory. I couldn't even get to a tty and had to hard reboot. The machine came back up, but now my desktop and all applications are stretched horizontally maybe 50 pixels, which looks ghastly and will seriously interfere with web development work. The login screen looks fine. Adjusting the horizontal size and position of my ViewSonic monitor display via the monitor itself doesn't affect the application stretching. I have an Intel 4 Series integrated graphics controller with no proprietary drivers. I haven't manually installed or updated any new packages for at least a week, although I do run `unattended- upgrades` for security repos.               $ xdpyinfo | grep dimensions       dimensions:    1600x1200 pixels (423x318 millimeters)      See here for `/var/log/Xorg.0.log`.


Trying to get firefox running on CentOS 6 minimal iso - can't open display

I've got minimal CentOS 6 running on an Oracle VirtualBox on a Mac. I'm trying to get Firefox up and running so I can download some web files into the VM. I installed Firefox (`yum --enablerepo=remi install firefox`). I also installed Xserver (`yum install xorg-x11-server-Xvfb`) as I wasn't sure if it was included in the minimal OS install. I then `export DISPLAY=10.0.5.52` and then tried to start `firefox` but it said: > Error: can't open display: 10.0.5.52. What do I need to do to get `firefox` to display?


Proper escaping of double quotations for curl post data?

I'm trying to test out a server, by sending it JSON data and reading the response. I need to `POST` data like `{"item":"value with spaces"}` but when I use `curl` I find that it sends the backslashes as well as the double quotes:               curl -d "{\"item\":\"value with spaces\"}" http://myserver.com/somerubyapp?get=stuff      The server actually receives `"{\"item\":\"value with spaces\"}"` including the double quotes on the ends of the string, the backslashes, and everything. Am I using `curl` incorrectly, or is it an issue with my shell, bash?


How to fix icedteanp plugin error?

I'm using openSUSE 11.3 with "latest updates". I have installed `vimprobable` and `uzbl`. Whenever I start one of those two browsers, I get the error message: > icedteanp plugin error: Failed to run etc/alternatives/../../bin/java.   >  For more detail rerun "firefox -g" in a terminal window. * * * After some time (about 1 minute), the message disappears by itself (or when I click the "close" button). The browser(s) continue loading and again, this error appears on specific sites. What can I do to fix this problem?


Stuck on "grub>" prompt when dual-booting Ubuntu

On the dual boot option screen I choose Ubuntu and only get:               grub>      I want to get into Ubuntu and start learning it a bit but am stuck. What would be the best way to fix my problem?


How to find Heap memory of a running process?

I would like to know how to find the heap memory of a process that is running in the background. Is there any command that allows such?


Replacement for TCT's pcat utility

I am looking for a utility to dump the memory of a running process that I can then examine for strings. In the past I have used pcat from The Coroner's Toolkit, but I am having a hard time finding a version that will work on RHEL 6.4 64bit. Given that TCT is in its twilight, is there a better utility to do this? Edit: I am looking for a utility. I will use scripts to get what is needed if necessary, but I was hoping for a standalone tool that I could get from the standard repo that will allow an untrained user to grab the process's memory.


Ideal Hardware for GNU/Linux Laptop

What's the best way to find a laptop with hardware that is amenable to installing and running GNU/Linux? I'm looking for something that will ideally work with GPL'd drivers and/or firmware. I took a quick look at linux-on-laptops.com, but they don't list some of the newer models for Lenovo, for example. Most of the test cases seem to be quite dated. Also, It's not clear where to start looking given so much information. Unfortunately, the FSF website doesn't list many laptop possibilities. LAC, referenced from the FSF website, doesn't mention wireless connectivity as being a feature of their laptops, probably because of firmware issues. I've been looking for a laptop that will accept the ath9k driver because those cards don't require firmware, but getting model type from generic specs pages is not always possible. Searching for lspci dumps online can be can be a roll of the dice. And then there's the issue of what kind of graphics card is ideal from a FSF perspective. From the FSF website: > This page is not an exhaustive list. Also, some video cards may work with > free software, but without 3D acceleration. This information should be > considered very tentative -- we are doing our best to update it. Does anyone know the details of what works and what doesn't? What good combinations are out there? What do you use? Where can I search? Or will I have to bite the bullet and use some proprietary packages? Thanks in advance.


How to use 'wine' and AviSynth and Avs2YUV with 'mplayer/mencoder' (or any player/encoder)

I have a lot of AviSynth scripts (.avs) which create a montage of text pics and video, but until yesterday I'd had no luck running AviSynth scripts in 'wine'.   I read about a 'Windows' program called Avs2YUV which, according to wineHQ, is _platinum_ and is "intended for use under Wine to interface between Avisynth and Linux-based video tools". I've had _partial_ success with a couple of _very simple_ scripts, but "partial" means I don't know how to use it properly, or the AviSynth-Avs2YUV combo doesn't work properly (or both). Below, are 2 scripts:   The first one outputs and saves video only (as intended), but I'd like to know if it is possible to pipe Avs2YUV's stdout directly into a Linux media player... I've tried a few options, but nothing seems to work. On the other hand, the saved .264 file does play, so AviSynth and Avs2YUV are doing something right here. ( _A quick pre-posting EDIT_ : I've just corrected a typo where I had put .avi instead of .264, and I realized that I really don't know what x264 does (I'm so used to avi encoding, but I have this feeling that it may be video-only encoder???? ... so I'll mention it now, I have no particular interest in x246.. It was in the example I followed.. I just want to produce a playable video+audio .. the wrapper and codecs aren't particularly important to me.. I'm happy with avi.. actually I prefer it because it works well with AviSynth.. Catch-22... The second one behaves very much as the first one, but it produces no audio; which it should. AviSynth scripts are well known, and are directly playable by many players (in Windows), but with this need to use Avs2YUY, I'm somewhat in unknown territory... I'd appreciate some pointers on these two issues, and perhaps there is an entirely different way to use AviSynth in wine, other than in conjunction with Avs2YUV... or is the idea of using AviSynth in Linux just a myth? Here are the scripts:               # Script-1: The saved file plays fine (the source has no audio),     #            but how can I play it directly     #     cd $HOME/.wine/drive_c     echo 'version()' > version.avs     wine  avs2yuv.exe  version.avs - \         | x264 --stdin y4m --output version.264 -     mplayer version.264     #      * * *               # Script-2: The saved file has no audio, but it should.     #        ...and like Script-1, how can I play it directly     cd $HOME/.wine/drive_c     echo 'avisource("video.avi")' > video.avs     wine  avs2yuv.exe  video.avs - \         | x264 --stdin y4m --output video.264 -     mplayer video.264


How to write terminal contents into a file

Here's my situation: I opened terminal and ran a program which displays live feed in terminal (text) that changes every second. Only "Enter" key can be used while this program is running (it exits that program). So you can't type anything else into the console. I would like to write the terminal contents into a file, like after every second. How can I do it? By opening 2nd console and using some command? Can't get it to work with setterm -dump command.


How to find data copies btrfs

I have deduplicated my btrfs filesystem with bedup, so now all duplicate files (above a certain size) are "reflink" copies. Is there any way to see, given a filename, what other files are the same reflinks?


Where did this copy of my home directory come from?

I was working on a project to control my digital camera using Ubuntu and gphoto2. At one point I noticed a new "~" directory in my project folder, /home/greg/project/~. When I enter this new "~" directory, it takes me backwards to my home directory /home/greg/ (as you might expect). I don't know exactly how this happened, but my suspicion is that when I ran gphoto2 on the command line and specified an output file, I typed "~/filename.jpg" expecting the file would show up in my home directory, but instead bash put a new "~" directory in the working directory. I'm wasn't aware something like that could be done (if that's what happened). More important than how it got there is how I should get rid of it. I can't remove the directory, because as far as I can tell it _is_ my home directory. It doesn't appear to be a sym-link, (at least not according to ls -l), but I'm not sure what that would even really mean.


My ISO Downloaded as Tar.Gz?

I was downloading a Linux-based operating system but instead of ISO, it came as tar.gz (OEM.tar.gz, I think but maybe not). How do I burn this OS to a flash drive?


Does the unix calendar program `pal` support line breaks?

The unix program `pal` is one of a variety of command-line calendar programs. Based on the `man` page, each line refers to an event, and it does not mention event descriptions that span multiple lines at all. I am trying to insert a multiline event description, and tried with `Line1\nLine2`, as well as `Line1\rLine2`, both of which were printed literally by `pal`. Does anyone know if there's a way to get multi-line event descriptions?


How can I start tmux automatically in fish shell while connecting to remote server via ssh

I switched from `bash` to `fish` shell. I liked it and decided to use it on my servers also. How can I start `tmux` automatically on `ssh` connection? I followed this instruction for bash but `fish` shell is different and this recipe doesn't work without cardinal rewriting.


Error while cross compiling using crosstool-ng. How to debug?

This is my build log:               [ERROR]          [ERROR]       [ERROR]  >>     [ERROR]  >>  Build failed in step 'Installing C library headers & start files'     [ERROR]  >>        called in step '(top-level)'     [ERROR]  >>     [ERROR]  >>  Error happened in: CT_DoExecLog[scripts/functions@172]     [ERROR]  >>        called from: do_libc_backend_once[scripts/build/libc/glibc-eglibc.sh-common@347]     [ERROR]  >>        called from: do_libc_backend[scripts/build/libc/glibc-eglibc.sh-common@143]     [ERROR]  >>        called from: do_libc_start_files[scripts/build/libc/glibc-eglibc.sh-common@60]     [ERROR]  >>        called from: main[scripts/crosstool-NG.sh@598]     [ERROR]  >>     [ERROR]  >>  For more info on this error, look at the file: 'build.log'     [ERROR]  >>  There is a list of known issues, some with workarounds, in:     [ERROR]  >>      '/usr/local/powerpc-eabi/share/doc/crosstool-ng/ct-ng.1.15.2/B - Known issues.txt'     [ERROR]       [ERROR]  (elapsed: 29:41.80)      I want to build a kernel after cross compiling that should work on a 32 bit machine. I am working on an amd64 bit and on a 32 bit Ubuntu os. What should my crosstool configuration file be to get this to work?


Linux Mint 16 randomly freezing and freezes always after suspend wakeup

I've just installed Linux Mint 16 Cinnamon on Dell Latitude E6420. During an hour of use the desktop would become unresponsive and I was unable to access any TTY. It just froze up. The same thing happened again after a forced reboot. I again booted up and it was fine for the whole session, an hour or so. I put the computer to sleep (suspend) and when woken up the next morning it would wake up frozen. I've checked `/var/log/syslog` and found some things I can't understand. See times between 00:06 when computer was put to sleep and 07:57 when computer was woken up. Specifically this line:               Apr 17 07:57:55 NIX-E6420 kernel: [  547.146134] Freezing user space processes ... (elapsed 0.001 seconds) done.      Why would Mint freeze user processes when its woken up?               Apr 16 23:57:47 NIX-E6420 modem-manager[793]: <info>  (ttyS4) closing serial port...     Apr 16 23:57:47 NIX-E6420 modem-manager[793]: <info>  (ttyS4) serial port closed     Apr 16 23:57:47 NIX-E6420 modem-manager[793]: <info>  (ttyS4) opening serial port...     Apr 16 23:57:53 NIX-E6420 NetworkManager[843]: <info> (eth0): IP6 addrconf timed out or failed.     Apr 16 23:57:53 NIX-E6420 NetworkManager[843]: <info> Activation (eth0) Stage 4 of 5 (IPv6 Configure Timeout) scheduled...     Apr 16 23:57:53 NIX-E6420 NetworkManager[843]: <info> Activation (eth0) Stage 4 of 5 (IPv6 Configure Timeout) started...     Apr 16 23:57:53 NIX-E6420 NetworkManager[843]: <info> Activation (eth0) Stage 4 of 5 (IPv6 Configure Timeout) complete.     Apr 16 23:57:59 NIX-E6420 modem-manager[793]: <info>  (ttyS4) closing serial port...     Apr 16 23:57:59 NIX-E6420 modem-manager[793]: <info>  (ttyS4) serial port closed     Apr 16 23:57:59 NIX-E6420 modem-manager[793]: <info>  (ttyS4) opening serial port...     Apr 16 23:58:05 NIX-E6420 modem-manager[793]: <info>  (ttyS4) closing serial port...     Apr 16 23:58:05 NIX-E6420 modem-manager[793]: <info>  (ttyS4) serial port closed     Apr 16 23:59:46 NIX-E6420 dbus[498]: [system] Activating service name='org.freedesktop.timedate1' (using servicehelper)     Apr 16 23:59:46 NIX-E6420 dbus[498]: [system] Successfully activated service 'org.freedesktop.timedate1'     Apr 16 23:59:46 NIX-E6420 dbus[498]: [system] Activating service name='org.freedesktop.systemd1' (using servicehelper)     Apr 16 23:59:46 NIX-E6420 dbus[498]: [system] Successfully activated service 'org.freedesktop.systemd1'     Apr 17 00:02:20 NIX-E6420 kernel: [  295.630421] nouveau W[   PFIFO][0000:01:00.0] INTR 0x01000000: 0x00000005     Apr 17 00:06:31 NIX-E6420 kernel: [  546.940568] PM: Syncing filesystems ... done.     Apr 17 00:06:31 NIX-E6420 kernel: [  546.942332] PM: Preparing system for mem sleep     Apr 17 07:57:55 NIX-E6420 NetworkManager[843]: <info> (eth0): carrier now OFF (device state 100, deferring action for 4 seconds)     Apr 17 07:57:55 NIX-E6420 kernel: [  547.146134] Freezing user space processes ... (elapsed 0.001 seconds) done.     Apr 17 07:57:55 NIX-E6420 kernel: [  547.147354] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.     Apr 17 07:57:55 NIX-E6420 kernel: [  547.148469] PM: Entering mem sleep     Apr 17 07:57:55 NIX-E6420 kernel: [  547.148546] Suspending console(s) (use no_console_suspend to debug)     Apr 17 07:57:55 NIX-E6420 kernel: [  547.169317] sd 1:0:0:0: [sdb] Synchronizing SCSI cache     Apr 17 07:57:55 NIX-E6420 kernel: [  547.169368] sd 1:0:0:0: [sdb] Stopping disk     Apr 17 07:57:55 NIX-E6420 kernel: [  547.169394] sd 0:0:0:0: [sda] Synchronizing SCSI cache     Apr 17 07:57:55 NIX-E6420 kernel: [  547.169651] sd 0:0:0:0: [sda] Stopping disk     Apr 17 07:57:55 NIX-E6420 kernel: [  547.186790] nouveau  [     DRM] suspending fbcon...     Apr 17 07:57:55 NIX-E6420 kernel: [  547.186793] nouveau  [     DRM] suspending display...     Apr 17 07:57:55 NIX-E6420 kernel: [  547.186813] nouveau  [     DRM] unpinning framebuffer(s)...     Apr 17 07:57:55 NIX-E6420 kernel: [  547.186902] nouveau  [     DRM] evicting buffers...     Apr 17 07:57:55 NIX-E6420 kernel: [  547.187841] mei_me 0000:00:16.0: suspend


Coloring line numbers in less?

Please consider the following example:               $ grep --color=always -n 'Format\|Files' /usr/share/doc-base/doc-base | less -R      Here, `grep` will color also the line numbers of the matches, and `less` will display it. I know I could show the entire file with line numbers in `less` with:               $ less -N /usr/share/doc-base/doc-base       My question is - is there a way, to get `less` to display the entire file with line numbers - but where the line numbers are colored (as in the case with the `grep` output)? Many thanks in advance for any answers,   Cheers!


Lots of text files into one big text file

I want to combine thousands of little text files into one big text file. I have them in directories with the structure: timestamp1/status.txt. For example: 20130430133144/status.txt. So far, I know that               cat */* > bigtextfile.txt      works for small numbers of files. But will it work for higher numbers? I wonder if cat is going to gather the content of all files and then try to save to the bigtextfile. Otherwise, I suppose there must another way to do it, like fetch one file, append it to bigtextfile, then fetch another and so on.


Masquerade not working sometimes

I have an issue with private network traffic not being masqueraded in very specific circumstances. The network is a group of VMware guests using the `10.1.0.0/18` network. The problematic host is `10.1.4.20 255.255.192.0` and the only gateway it is configured to use is `10.1.63.254`. The gateway server `$vpnGatewayAddress` should be masquerading all outbound traffic and forwarding it through `$outerGatewayAddress`, but for some reason, `10.1.4.20` ends up occasionally having `$outerGatewayAddress` in its routing cache, as you can see here :               ip -s route show cache 199.16.156.40     199.16.156.40 from 10.1.4.20 via $outerGatewayAddress dev eth0         cache  used 149 age 17sec ipid 0x9e49     199.16.156.40 via $outerGatewayAddress dev eth0  src 10.1.4.20         cache  used 119 age 11sec ipid 0x9e49      The problem occurs only with api.twitter.com After flushing the cache, I am able to ping it again, and the cache looks sane :               ip route flush cache 199.16.156.40          ping api.twitter.com     PING api.twitter.com (199.16.156.40) 56(84) bytes of data.     64 bytes from 199.16.156.40: icmp_req=1 ttl=247 time=93.4 ms          ip -s route show cache 199.16.156.40     199.16.156.40 from 10.1.4.20 via 10.1.63.254 dev eth0         cache  age 3sec     199.16.156.40 via 10.1.63.254 dev eth0  src 10.1.4.20         cache  used 2 age 2sec      Network information for the app server (without lo) :               ip a          eth0      Link encap:Ethernet  HWaddr 00:50:56:a4:48:20               inet addr:10.1.4.20  Bcast:10.1.63.255  Mask:255.255.192.0               inet6 addr: fe80::250:56ff:fea4:4820/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:1523222895 errors:0 dropped:407 overruns:0 frame:0               TX packets:1444207934 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000               RX bytes:1524116772058 (1.5 TB)  TX bytes:565691877505 (565.6 GB)      Network information for the VPN gateway (without lo too) :                eth0      Link encap:Ethernet  HWaddr 00:50:56:a4:56:e9                inet addr:$vpnGatewayAddress  Bcast:$broadcastAddress  Mask:255.255.255.192                inet6 addr: fe80::250:56ff:fea4:56e9/64 Scope:Link                UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1                RX packets:7030472688 errors:0 dropped:1802 overruns:0 frame:0                TX packets:6959026084 errors:0 dropped:0 overruns:0 carrier:0                collisions:0 txqueuelen:1000                RX bytes:7777330931859 (7.7 TB)  TX bytes:7482143729162 (7.4 TB)           eth0:0    Link encap:Ethernet  HWaddr 00:50:56:a4:56:e9                inet addr:10.1.63.254  Bcast:10.1.63.255  Mask:255.255.192.0                UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           eth0:1    Link encap:Ethernet  HWaddr 00:50:56:a4:56:e9                inet addr:10.1.127.254  Bcast:10.1.127.255  Mask:255.255.192.0                UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00                inet addr:10.8.1.1  P-t-P:10.8.1.2  Mask:255.255.255.255                UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1                RX packets:477047415 errors:0 dropped:0 overruns:0 frame:0                TX packets:833650386 errors:0 dropped:101834 overruns:0 carrier:0                collisions:0 txqueuelen:100                RX bytes:89948688258 (89.9 GB)  TX bytes:1050533566879 (1.0 TB)      eth0 leads to the outside world, and tun0 to an openvpn network of VMs on which sits the app server. `ip r` for the VPN gateway :               default via $outerGatewayAddress dev eth0  metric 100     10.1.0.0/18 dev eth0  proto kernel  scope link  src 10.1.63.254     10.1.64.0/18 dev eth0  proto kernel  scope link  src 10.1.127.254     10.8.1.0/24 via 10.8.1.2 dev tun0     10.8.1.2 dev tun0  proto kernel  scope link  src 10.8.1.1     10.9.0.0/28 via 10.8.1.2 dev tun0     $addressEndingWithAZero/26 dev eth0  proto kernel  scope link  src $vpnGatewayAddress      `ip r` on the app server :               default via 10.1.63.254 dev eth0  metric 100     10.1.0.0/18 dev eth0  proto kernel  scope link  src 10.1.4.20      Firewall rules:               Chain PREROUTING (policy ACCEPT 380M packets, 400G bytes)      pkts bytes target prot opt in out source destination           Chain INPUT (policy ACCEPT 127M packets, 9401M bytes)      pkts bytes target prot opt in out source destination           Chain OUTPUT (policy ACCEPT 1876K packets, 137M bytes)      pkts bytes target prot opt in out source destination           Chain POSTROUTING (policy ACCEPT 223M packets, 389G bytes)      pkts bytes target prot opt in out source destination           32M 1921M MASQUERADE all -- * eth0 10.1.0.0/17 0.0.0.0/0      redirect configuration :               sysctl net.ipv4.conf.all.send_redirects     net.ipv4.conf.all.send_redirects = 1     sysctl net.ipv4.conf.eth0.send_redirects     net.ipv4.conf.eth0.send_redirects = 1     sysctl net.ipv4.conf.tun0.send_redirects     net.ipv4.conf.tun0.send_redirects = 1      Why does the masquerade fail sometimes ? How can I prevent that ?


How to use a dongle as HotSpot on Linux?

I'm running Linux on a virtual machine on MAC OS. Currently, I've written a script to use a dongle to connect to a WiFi network and use web services. Now, I am looking to use my dongle as a WiFi Hotspot. So my wearable device can connect to my dongle and use the internet. Is it possible to do that? If yes then please guide me. Hardware Details are:   1. The dongle is a ZyDAS USB 2.0    2. I'm using VMWare Fusion to run Linux   3. Linux version (Ubuntu 12.04) : **Linux ubuntu 3.8.0-42-generic #62~precise1-Ubuntu**   4. I'm using the following python script to connect from Linux to the Wifi: **/usr/share/checkbox/scriptsss/create_connection**


How to manage error_log and access_log of apache?

I noticed my `error_log` file grows larger and larger. I tried changing the LogLevel in `httpd.conf` from               LogLevel debug      to               LogLevel emerg      But I still see errors being posted about `favicon.ico` not being found and so on. If I delete `error_log`, I would have to restart `apache`, which causes some downtime for current viewers.   * Is there a way to tell `apache` **NOT** to write any `error_log`?   * OR is there a way to ensure it does not grow beyond 1 mb ( when it is not turned off )? I notice `access_logs` are being "archived", but I rather want them also not to be created at all. Do these archived `access_logs` ever get deleted or do I have to delete them myself?


Redirecting output depending on grep regex

I am using `gradle run` to start a REST server. The output of the REST server looks like this:               XXX.XXX.XX.XXX - <moreinfo>     randomtext     randomtext     XXX.XXX.XX.XXX - <moreinfo>     XXX.XXX.XX.XXX - <moreinfo>     randomtext     XXX.XXX.XX.XXX - <moreinfo>      `XXX.XXX.XX.XXX` here is an IP address, randomtext are error messages. All output is directed to stdout, sadly. How can I direct all lines starting with an IP address to a file called `err.log` and every other line to `all.log`? Unfortunately, `gradle run` can only be started once and doesn't stop, since it is a REST server. Maybe use a `tee` , `grep` combination?


What else can break if I remove export from a variable?

My problem is that when I started coding my script I encountered several variable scope issues which resulted in the bad habit of exporting almost all my variables. Now that my code has got quite large I was contemplating cleaning it and part of that is removing a bunch of useless exports. Unfortunately I'm not sure if my knowledge of variable scope is complete. Even after reading a few pages on the subject. What I know (and hopefully is right): 1-Exporting a variable makes it's content available to subshell processes:               export myvar="content"      2-Stuff done in parenthesis like this will be affected by removing exports (from what I understand this is the only way to declare / use a subshell):               $(grep "content" <<< $myvar)      3-Variables declared without setting their scope are global:               myvar="content"      4-Since I dont declare any local variables I dont have to worry about causing issues within my functions:               local myvar="i dont use this"      Questions: 1- Is there any point in proceeding with removing the useless exports beside my code not reeking of obvious noobishness? 2- If I do proceed with it, is there anything else I should be aware of that may be affected and break my code? or is there any of my knowledge wrong/incomplete? 3- If you know of a well written (and complete) variable scope reference please share the link. Thanks in advance for your help.


Share (masquerade) Internet connection from Debian desktop to a bunch of computers

I need to share the Internet connection of my Debian desktop to some other devices (a Mac Laptop, and an Android tablet). The Debian desktop is connected to the local network via `eth0`, and the rest of the devices are connected through a wireless network which, for some reason, doesn't allow internet connections. Of course, the desktop is connected to the internet. The laptop and the tablet _can_ "see" the Debian desktop (they can connect themselves through `ssh` and see the desktop files using `smb`). I've been googling around, and I've found how to share (masquerade) the connection and make it available to any machine in the network... I would like to limit the access only to my devices (or a limited list of devices). Is there a way to do that? If there is, can you point me in the right direction?


What's using all of the memory in my VM? It's not the disk cache

I have an issue where when I try to build a really large project, my machine starts swapping (several GB) even though there's plenty of memory (14 GB in fact). When I run `free`, it shows that it's not the disk cache:               $ free -m                  total       used       free     shared    buffers     cached     Mem:         12900       6350       6549          0          7         77     -/+ buffers/cache:       6266       6633     Swap:         9211        233       8978      So 6.3 GB of memory is actually in use, but if I look at top, sorted by % memory usage, nothing is using any memory:                 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                    38669 blong     20   0 1282m 378m  42m S    2  2.9   0:50.79 firefox                                                     1327 root      20   0  365m 126m 4056 S    4  1.0  40:23.94 Xorg                                                        2540 blong     20   0 1578m  67m  10m S    2  0.5  21:33.35 gnome-shell                                                13943 blong     20   0  579m  12m 5604 S    2  0.1   1:07.01 gnome-terminal                                             30093 blong     20   0  540m 8664 5572 S    0  0.1   0:03.96 icemon                                                      2558 blong     20   0  362m 5964 1808 S    0  0.0   5:17.44 vmtoolsd                                                    2526 blong     20   0  672m 5056 2000 S    0  0.0   0:26.81 gnome-settings-                                             2546 blong     20   0  354m 3484 2244 S    0  0.0   5:08.96 pulseaudio      Am I missing something? Restarting the VM fixes this, but I'd prefer to figure out what's actually happening.


Identifying running programs that are using the old version of a library I just replaced

After installing updates to address CVE-2014-0160 (the OpenSSL Heartbleed bug), I had to take care to restart anything that might be using libssl -- many services, such as Apache and my VPN software, still had the old vulnerable libssl loaded up, and my package manager made no attempt to rectify this. This got me thinking: After I update a shared library, how can I reliably find out which running programs currently have an old version of the library linked in? I am sure there must be a way to interrogate running processes either at the linker level or at the file descriptors level to determine whether the instance of a given shared library they have loaded is the same as the one currently on disk.


extracting specific substrings from string

I am trying to write a bash script. In a directory I have 2 fastq files: `A-122-3.BH7WBVADXX.lane_1_ **P1** _I24.hg19.sequence.fastq` `A-122-3.BH7WBVADXX.lane_1_ **P2** _I24.hg19.sequence.fastq` I just want to loop on P1 lets say something like this               for f in *_P1*     do        SOMETHING     done      Now In SOMETHING part I want to define some varables which i would be using later in my code I need to extract these values from my string: `A-122-3.BH7WBVADXX.lane_1_P1_I24.hg19.sequence.fastq` I need `ID = A-122-3-BH7WBVADXX-1` I need `PU = BH7WBVADXX` I need `LB = A-122-3` Then I will solve it further. NOTE : FILENAME ARE NOT OF SAME LENGTH. **A-122-3** PART VARIES FOR DIFFERENT SAMPLES AND ALSO THIS PART **I24** VARIES. Thanks


ImageMagick (or other) for UTF-8 text to image

I'm trying to create many single-character images using `convert`. The purpose is to provide a plastics specialist with images to print onto keyboard keycaps. The ImageMagick documentation suggests something like this:                printf "\u2318" | convert -size 100x100 label:@- -font unifont-Medium command.png      or                echo ⌘ | convert -size 100x100 label:@- -font unifont-Medium command.png      or                convert -size 100x100 label:'⌘' -font unifont-Medium command.png      which is supposed to print the place of interest symbol, but it instead produces a question mark. I have confirmed (using `charmap`) that the `unifont-Medium` fontset actually includes this glyph. I know that other fonts on my system can also provide this glyph, because I could see it before installing unifont, but I've not been able to work out what their name is. I also tried using LaTeX (e.g. TexLive with all the extras and the `utf8x` package) but none of the special characters are supported. There are a lot of forum questions about printing chinese characters with imagemagick and other special characters... the following does work for me:               convert -background lightblue -fill blue -pointsize 32 \           label:' é è à ù ç Ö ÿ ‘ ’ “ ” ° ² ³ € x ÷ '    label_i8n.gif      but it just doesn't work for the UTF-8 characters that are actually important to me. **How can I convert arbitrary unicode characters to images?** **UPDATE** : I gave up, looks like a bug. Instead, I created a bunch of scripts to generate and render SVG, open sourced here: kinesis-dvorak


Can I select a region for the screenshot via keyboard in import from ImageMagick? If yes, how can I do it? If no, what can I use instead of import?


shell script to find the combination of the array elements

I have a shell script in which I have defined an array. The array contains more than 2 elements. I need to find the combination of all the elements in my array. Suppose, if my array has the elements, _`{12345, 56789, 98765}`_ , I am trying to get the output as,               12345, 56789     12345, 98765     56789, 98765      I tried the php code from here.               <?php     function pc_permute($items, $perms = array( )) {         if (empty($items)) {             print join(' ', $perms) . "\n";         }  else {             for ($i = count($items) - 1; $i >= 0; --$i) {                  $newitems = $items;                  $newperms = $perms;                  list($foo) = array_splice($newitems, $i, 1);                  array_unshift($newperms, $foo);                  pc_permute($newitems, $newperms);              }         }     }     pc_permute(split(' ', '12345 56789 98765'));     ?>      I get the output as,               12345 56789 98765     56789 12345 98765     12345 98765 56789     98765 12345 56789     56789 98765 12345     98765 56789 12345      Is it possible to get the combination in 2 elements sized output? I am not concerned with the order and so if _`A B`_ is got as a combination, I do not need the reverse ( _`B A`_ ).


Apache, Group Permissions and User Uploads

I have a folder named "digitalgoods" with the following ownership -- apache:apache residing outside of the htdocs folder and is therefore not accessible to the public. However I need the same folder to be accessible by a set group of users (Jack, John, James) -- we'll call them all "uploaders". I want the "uploaders" to be able to each upload files as easily as possible to the "digitalgoods" folder, where apache can then access to serve via purchase. My question is what is the best way to set this up?? I am currently using SSH to access the server, but would it make more sense to install an ftp server for the users to gain access; and if so, what should I do from there in regards to accounts and permissions? Or should I set each user's home directory to "digitalgoods" and in some manner modify the permissions appropriately for access via SSH? I am attempting to make uploading files as painless as possible for the client. Any help in this regard is appreciated.


Starting my own application at the startup

I am working on zc702 board having ARM Cortex A 9 processor. I have a binary that I got after cross-compilation for ARM (LED blinking). Now I want that this file should execute as soon as the the kernel (petalinux) boots. I am having initramfs as my root file system. How do I proceed to do it? What files I have to modify? Please note that this is a volatile system, so I cannot make required changes in a running system. I have to instead put my binary in some folder in file system (rootfs.cpio). But where ?


Merge two audio sources with x11grab, possible?

Currently I'm running with the following setup.               ffmpeg \      -i http://pub1.di.fm:80/di_vocaltrance \      -f x11grab -s 1920x1080 -r 25 -i :0.0 \      -c:v libx264 -preset fast -pix_fmt yuv420p -s 1280x800 \      -c:a libmp3lame -ab 96k -ar 22050 \      -threads 0 \      -f flv "rtmp://...."      What I want to bake in:                -f alsa -ac 2 -i hw:0 -acodec pcm_s32le -aq 1 -ab 128k\      Is this possible? And perhaps even mix in "what I hear" (aka playback) so to speak? I've tried something along the lines of (but not fully understanding -map)                -i http://pub1.di.fm:80/di_vocaltrance -map 0:1 \      -f x11grab -s 1920x1080 -r 25 -i :0.0 -map 0:0 \      But that didn't really go so well. I'm so close now, this gives me sound channels, but everything sounds like I'm inside a small tin-can of sorts..               #!/bin/bash     KEY=`cat key.db`          ffmpeg \      -i http://pub1.di.fm:80/di_vocaltrance \      -f alsa -ac 2 -i hw:0 -acodec mp3 -aq 1 -ab 128k \      -f x11grab -s 1920x1080 -r 25 -i :0.0 \      -c:v libx264 -preset fast -pix_fmt yuv420p -s 1280x800 \      -c:a mp3 -ab 96k -ar 22050 \      -threads 0 \      -map 0:0 -map 1:0 -map 2:0 \      -f flv "rtmp://live.twitch.tv/app/$KEY"      It only appears when i mix the two sounds togeather.. Trying to get JACK in here as well but without any actual results (thought i'd pass everything via a mixer board to unload ffmpeg from the mixing) Running with:                -f alsa -ac 2 -i jack \      ....      Gives this however: > [alsa @ 0x1399280] cannot set sample format 0x10000 2 (Invalid argument) > jack: Input/output error


Standard unix util to split "foo.bar.baz" into "foo.bar" + ".baz"?

I want to split a string `$basename`, containing the output in two parts, `$stem` and `$ext`, such that:   1. the string `"${stem}${ext}"` is identical to the original string `$basename`;   2. either `$stem` or `$ext` may be empty (depending on the string in `$basename`);   3. if `$ext` is not empty, it must start with `.`, and contain no more `.`'s thereafter. It's not difficult to write a shell function to do this, but before doing so I'd like to know if there's a standard Unix command that does this. EDIT: FWIW, the way I'd code this in a (`zsh`) script would be               stem=${basename%.*}     ext=${basename#"$stem"}      EDIT: fixed typo (`${base#...` -> `${basename#...`), and incorporated Stephane Chazelas' suggestion (`...#$stem` -> `...#"$stem"`).


Lost files copied to a USB ZIP drive on Ubuntu

I have a problem regarding copying of files using Ubuntu's copy feature. The problems goes on like this: I copy a specific folder to my ZIP drive by creating a new folder each day (Backup). Now copy process starts and completes. No when I disconnect the drive from the system and re-plug, I find that all those files are now lost. Only the folder which I created manually, exists. Also, if I use the terminal to copy and create the directories, windows XP detects a corrupt file system in the drive and I again have to scan and fix the drive. The files, though are recovered, still I am thinking why this is happening. Might be due to the different way these OSes create and maintain the table. FAT32 is the file system in the ZIP (4 GB) drive. On XP (SP3) system it is NTFS and on Ubuntu (10.04) it is ext3. There are however no other problems while copying data from the drive. Even copying a single file to the drive works fine. Only copying inside a folder gives the problem. Also, once copy attempt is done, nothing further can be added to the folder. It gives error that the folder is not accessible or so. What could be the problem? Any workaround?


What is centos /root/core.* files? they eat my hard disk till it is full

I have a vps server with 130GB hard disk. Recently, the server is crash down, I access ssh and use `dh -h`,               Filesystem            Size  Used Avail Use% Mounted on     /dev/vzfs             130G  130G   0  99% /     none                  2.0G  4.0K  2.0G   1% /dev      Then use `du -sh /*` I find `root fold` with 59GB. then `du -sh /root/*`, a long list with some file like               ...     43M     /root/core.7856     59M     /root/core.7859     59M     /root/core.7862     43M     /root/core.7883     43M     /root/core.7885     43M     /root/core.7889     59M     /root/core.7892     59M     /root/core.7904     43M     /root/core.7906     59M     /root/core.7913     43M     /root/core.7915     59M     /root/core.7940     59M     /root/core.7942     43M     /root/core.7947     43M     /root/core.7951     ...      I access my server with `fileZilla`, 1204 core.* files create in recent 3 days. So what is centos /root/core.* files? How are they created? Could I delete them without damage my server? And how to avoid them to be created again? Waiting for some one help me urgently, thanks and regards. **FIX THE PROBLEM** The problem caused by linux mail system. I changed `/etc/mail/trusted-users` permission in `etc/mail/submit.cf` line 552. then, no `/root/core.* files` be created again.


Redirect stdout over ssh

I would like to run               something > file      on a remote system through ssh, but if I run               ssh host something > file      the redirection is executed locally as `ssh etc > file` I've tried it with `'` or `''` or `dd` or with a pipe `|` instead, but I can't get it to work. How can this be done?


Tmux key-bind like to use the windows/super for my meta key in Tmux Without X

I have RaspberryPI with no GUI==(no x.org) I like to bind the useless window/super key to be my prefix. Using Arch for ARM runs great. If think this is going to take more then simple mod in the tmux.conf file. After some Googling found post with a command: dumpkeys | grep -E "keycode *125|126" That command give me a blank line.


sudo environment: "g++: command not found"

I have a relatively fresh RHEL 6.5 install, on to which I have installed from source GCCC 4.9. After I installed GCC 4.9, I uninstalled the distro-provided older GCC version via:               sudo yum remove gcc      GCC _appears_ to be correctly installed and visible to both users and `root`, but when I try to issue a `sudo` command which needs the compiler, it cannot be found. It seems to me that `PATH` doesn't point to `g++` during `sudo`, but I don't understand why. `g++` is installed in:               [john@haley boost_1_55_0]$ which g++     /usr/local/bin/g++      And getting the version as a user and as `root` succeeds:               [john@haley boost_1_55_0]$ g++ --version     g++ (GCC) 4.9.0     Copyright (C) 2014 Free Software Foundation, Inc.     This is free software; see the source for copying conditions.  There is NO     warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.          [john@haley boost_1_55_0]$ sudo su -     root@haley /root # g++ --version     g++ (GCC) 4.9.0     Copyright (C) 2014 Free Software Foundation, Inc.     This is free software; see the source for copying conditions.  There is NO     warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.      But `sudo g++ --version` fails:               john@haley boost_1_55_0]$ sudo g++ --version     [sudo] password for john:      sudo: g++: command not found     [john@haley boost_1_55_0]$       Checking the `PATH` as `sudo`:               [john@haley boost_1_55_0]$ sudo echo $PATH     /usr/lib64/qt-3.3/bin:/usr/local/:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/home/john/bin:/usr/local/bin                                                                                ^^^^^^^^^      ... seems to indicate that the location of `g++` is actually in the path. Why is this failing, and what can I do to fix it? Answering questions in comments: yes, I can execute it using explicit paths under `sudo`:               [john@haley boost_1_55_0]$ sudo /usr/local/bin/g++ --version     [sudo] password for john:      g++ (GCC) 4.9.0     Copyright (C) 2014 Free Software Foundation, Inc.     This is free software; see the source for copying conditions.  There is NO     warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.          [john@haley boost_1_55_0]$       It was observed that I was doing-it-wrong when checking the `sudo PATH`. Doing it the right way reveals that in fact `/usr/local/bin` is _not_ in `sudo`'s `PATH`:               [john@haley boost_1_55_0]$ sudo env | grep PATH     13:PATH=/sbin:/bin:/usr/sbin:/usr/bin     [john@haley boost_1_55_0]$


differences between echo""> and > command

I am new to Linux. There is something that is unclear to me. What is the difference between `echo "" > logfile` and `> logfile` ? When I run the first one, the logfile size doesn't become zero and same name file will be created with 1 byte size. For the second one, logfile size will become zero and same name file will be created with 0 byte size. In what situations should the commands be used differently? For me, I use it when I want to free up the log files.


Linux equivalent of "Trusted Root Certification Authorities" on Windows?

Where I live we have a corporate firewall which is configured to need a certificate installed on the computers in the house for it to be able to scan for vulnerabilities in secure connections. Without it, a few things won't work as the firewall behaves as a man in the middle, and of course a few websites will deny access to prevent any harm as it looks dangerous. On Windows, I'd just need to double click the certificate (.p12 extension), insert the password and specify it to be put in "Trusted Root Certification Authorities" and be done with it. On Linux, I haven't had much luck in doing that. I'm running Arch.


Change working directory of 2 terminals at once

I've typically have gnome-terminal open with ~8 tabs, using 2 consecutive tabs for the same task (one has emacs, the other is used to do git checkins and unittest runs and so). When changing tasks, I need to move to a new directory - in both tabs. How can I change the work directory of the second tab to the one of the first tab, with as few steps as possible? Preferably keyboard only.


switch window manager when logging in in text mode

Suppose I don't start the display manager on boot and login through the terminal. How would I switch my window manager? With gdm or gdm3, you use a scroll box to select it.


Command-line web browser with Kerberos authentication?

**QUESTION:** Is there a Kerberos-friendly web browser usable via an SSH console? I have tried links but it does not seem to work with Kerberos (the webapp asks me for login/password even though I have a valid Kerberos ticket (which I got with `kinit`). **CONTEXT** : From my laptop I have command-line access to a server, and need to browse an intranet webapp hosted on that server, using Kerberos authentication. The server can not ping the laptop, so I can not run Firefox on the server and redirect the DISPLAY to my laptop


linux shell: find -exec in find -exec

I want to execute `chmod 555` on all files and directories I get with the following command (it returns the directory test and all files and directories in it):               find ~/.config/google-chrome -type d -name test -exec find {} \;


How to link Requires to BuildRequires in rpm spec?

Let's say I have such `Requires` entries:               Requires: a     Requires: b     Requires: c      and now I would like to state, that:               BuildRequires: <<Requires>>      meaning, that for build I require everything that is required for install. So, if I remove or add something in the first section, I won't have to edit the second any more, because it will be "linked". **The question is** -- how to express such dependency? _I know that such scheme is not good for public packages, but I am asking for home use -- I prepare quick packages for me and my family only, they are not distributed._


PHP Bash error suppresion

I'm using a PHP script from cli, the script calls `exec()` a few times. There are some minor errors sometimes, which are handled by the PHP script. I'm suppressing the errors by appending `2>/dev/null` to the end of each command... Is there any way to achieve that without adding the aforementioned?


How to do a regex search in a UTF-16LE file while in a UTF-8 locale?

EDIT: Due to a comment _Warren Young_ made, it made me realize that I was not clear on one quite relevant point. My search string is already in UTF-16LE order (not in Unicode Codepoint order, which is UTF-16BE), so perhaps the Unicode issue is somewhat moot, Perhaps my issue is a question of how do I grep for bytes (not chars) in groups of _2-bytes_ , ie. so that UTF-16LE `\x09\x0A` is not treated as TAB,newline, but just as 2 bytes which happen to be UTF-16LE `ऊ`? ... Note: I do not need to be concerned about UTF-16 surrogate pairs, so 2-byte blocks is fine. Here is sample pattern for this 3-character string `ऊपर`:   * `\x09\x0A\x09\x2A\x09\x30` but it returns nothing, though the string is in the file. _(here is the original post)_   When searching a UTF-16LE file with a pattern in `\x00\x01\x...etc` format, I have encountered problems for some values. I've been using `sed` (and experimented with `grep`), but being in the UTF-8 locale they recognize some UTF-16LE values as ASCII characters. I'm locked-in to using UTF-16, so recoding to UTF-8 is not an option. eg. In this text `ऊ` (UNICODE 090A), though it is a single character, `ऊ` is perceived as two ASCII chars `\x09` and `\x0A`. `grep` has a `-P` (perl) option which can search for `\x00\x...` patterns, but I'm getting the same ASCII interpretation. Is there some way to use `grep -P` to search in a UTF-16 mode, or perhaps better, how can this be done is perl or some other script. `grep` seems to be the most appealing because of its compactness, but whatever gets the job done will overrride that preference. PS; My `ऊ` example uses a literal string, but my actual usage needs a regex style search. So this perl example is not quite what I'm after, though it does process the file as UTF-16... I'd prefer to not have to open and close the file... I think `perl` has more compact ways for basic things like a regex search. I'm after something with that type of compact syntax.


View a remote Ubuntu desktop from Windows 7

I tried TightVNC and VNC Viewer (realvnc), and they both show checkboard screens (no screen only checkboard). Also, I tried RDP, same result: checkboard screen. I tried FreeNX, but I would like **stronger/better compression** since I have very fast CPUs on both client and server (though the RAM on the server is only 512MB burstable to 1GB). So, I have the processing power, and I want to take advantage of that to make the connection seamless.


Network issue in vsat

In my server-client architecture, I **multicast** 100 MB files to many clients from server via satellite link. Network traversal is through 5 hops. I have the 10Mbps ( i.e. 1250 Kilo Byte per second ) bandwidth link. When I multicast the first file to many client, first hop get the incoming speed is of ~9.0 mbps but the receiver end get the speed of only ~4.2 mbps. All clients are 10mb half duplex. I can see, there is low network usage; But I don't know where exactly. If server is sending at the speed of ~9.0 mbps, then client should got the same speed. I am using the reliable UDP for multicasting. Is there any way to find out, what is the incoming and outgoing bandwidth usage of each hop (for a particular port.) ? Is there exist any tool/utility/application who can serve the purpose. All the hops are at remote location, so that going over there is not possible.


how do I enable fluxbox instead of Gnome by default in Ubuntu

I'm working on a VPS which I can control with PuTTY and FreeNX. I don't have enough RAM for Gnome, so I want fluxbox to start by default instead of Gnome. how do I do that?


Assuming sshd allows only public key authentication, how do I log the fingerprints?

With OpenSSH, how can I log the fingerprints of the keys used for authentication? I would like to log it in production, so it would be best if this wasn't just some debug setting or similar.


In my Dell R310 server, i would like to install CentOS, but for RAID1 what special care i need?

I have my Dell R310 server to install CentOS latest version, it has 2 hot plug disk drive, about 250GB of each. - But i need to install RAID1 on it. My question is for RAID1 installation with CentOS is there any special ISO? Or i can use the regular one? Anyone can recommend some working document/screenshot/video links, for RAID1 installation only (i do not want to go with RAID0 or RAID5 etc tutorial, makes more confuse, i decided to only use RAID1 and learn from it)?


Copy/Move whole folder but with certain extentions

I have a backup copy of my site located in /tmp/backup and want to copy it to /home/mysite/public_html But my aim is to copy only the .php files (with nested folders) and replace. If I don't have nested folders i simply do `cp /tmp/backup/*.php /home/mysite/public_html` But how i can do it for the whole site with many folders?


aspell installs too many languages

I have installed `aspell-en` and `aspell-de`. I have expected this will give me the choice between `en` and `de` languages. However, the package has installed many versions of `en` and `de` languages and now when I want to select my spell language, I get too many to choose from.   * Is it possible to configure somewhere, which languages are offered/displayed?   * Can I limit the list to, lets say only `en_US` and `de_CH` ? I am sure I will never need `de_LI` and besides, I don't see any reason why `de_LI` should be a separate language anyway. I am using Debian Wheezy. ![Available languages](http://i.stack.imgur.com/CWKYq.jpg)


find numbers in parentheses and round them

Say I have a file called tables.tex (lots of tables formatted for tex, including a preamble) with lines like this:               some words (xyz, abc) & 0.00071 (0.07846) & 0.00411 (-0.13542) \\     some more words (1) & 0.00341 (-0.59991) & 0.00001 (0.99453) \\      I need to find all the numbers in parentheses that are not before the first '&' in a line that ends with a double backslash and replace them with a rounded version, rounded to 3 digits. So my output at the two lines above would look like this:               some words (xyz, abc) & 0.00071 (0.078) & 0.00411 (-0.135) \\     some more words (1) & 0.00341 (-0.600) & 0.00001 (0.995) \\      What is the most efficient way to do this? I have found answers on this site that describe how to do certain pieces of this operation in various ways (round numbers, print numbers in parentheses, awk, perl, etc), but I'm having trouble putting it all together in good (actually working) style.


How to Partition the FvwmButtons

I've read some _.fvwm2rc_ but I still want to know how we partition the `FvwmButtons` in Fvwm. How can we assign a specific slice to `Swallow` specific application?


remove duplicate files in 2 directories

I have two folders (w/ subfolders) containing files that both contain essentially the same content. Example:   * `/folder/files/data/new`   * `/folder/files/data/old` Is there way to delete all files in /new that are already in /old by _strictly filename_ (NOT date modified) to prevent me from re-reading duplicate files.


Multiple USB wireless devices?

I have a broadcom wireless card in my laptop and as far as I know, it acts as an USB device. I also have one USB stick wireless device (TL-WN422G - uses ath9k_htc driver) which I want to use at the same time as the first (Broadcom) device. The problem is, after I load ath9k_htc - iwconfig does not show the new USB device (the TL-WN422G - wlan1 / ath0 / whatever), but only the old one (wlan0 - Broadcom, checked by MAC). I tried this USB device (TL-WN422G) on my other computer that has PCI wireless card in it, and they both worked just fine together after I pluged it in... I get wlan0 (Ralink) and wlan1 (TL-WN422G). Is it some kind of a problem for the laptop that both devices are recognized as USB? How do I make wlan1 appear on my laptop? also, my system is fully up to date 2.6.35 kernel (Arch) **edit:** I've already downloaded the needed ar9271.fw from linuxwireless.org and I put it into /lib/firmware - something wrong in that? dmesg gives me this on laptop:               usb 1-5: new high speed USB device using ehci_hcd and address 9     usb 1-5: ath9k_htc: Firmware - ar9271.fw not found     ath9k_hif_usb: probe of 1-5:1.0 failed with error -22      and this on the computer that does work:               usb 1-5: new high speed USB device using ehci_hcd and address 4     usb 1-5: ath9k_htc: Transferred FW: ar9271.fw, size: 51280     ath: EEPROM regdomain: 0x809c     ath: EEPROM indicates we should expect a country code     ath: doing EEPROM country->regdmn map search     ath: country maps to regdmn code: 0x52     ath: Country alpha2 being used: CN     ath: Regpair used: 0x52     cfg80211: Calling CRDA for country: CN     Registered led device: ath9k-phy1::radio     Registered led device: ath9k-phy1::assoc     Registered led device: ath9k-phy1::tx     Registered led device: ath9k-phy1::rx     usb 1-5: ath9k_htc: USB layer initialized     usbcore: registered new interface driver ath9k_hif_usb


Help with a find command

I have a bunch of directories. Inside these directories is a cover letter and a zip archive of work. I wanted to run a quick and easy query to open up all the cover letters so I can decide if it's worth looking at the work folder.               find . | grep cover\.pdf | xargs open    #OS X has open linked to "open" the file      This doesn't work. I've also muddied around with various `print0`, `xargs -0` variations with little success. What's the proper way to do this?


Good website to link to for generic linux advocacy

I would like to have a link on website, both advertising the fact that I use (GNU/)linux, and pointing the curious reader to a source to learn more information. But I'm having trouble finding the right place to link. Desiderata:   * **Not distribution specific.** (It would seem inappropriate to link to anything but the distro I actually use, but Arch Linux is not really right for beginners.)   * **Beginner friendly.** Says in very simple terms what linux is for those who don't already have any idea. Links to download and beginner resources.   * **Not overly preachy.** Doesn't shame or scold people for being bad, naughty Windows/Apple/non-free-software users.   * **Professional looking and up to date.**   * **Presents linux in a positive light.** But I'm having trouble finding a destination that matches all these criteria. Here are some of the things I've considered, but don't seem right for one reason or another:   * Linux online! Provides decent summary, but the page is extremely unprofessional looking (IMHO); straight out of the mid-1990s.   * Linux.com or the Linux foundation: To me, these seem more aimed at those who already know what linux is, and want to learn more about the foundation, or recent linux-related news, rather than beginners; but the first link may be a possibility; some the pages buried deeper down are more promising.   * Switching to Linux page on Grokdoc; a very good source of information, but is just information only, no pizzazz. Thoughts?


is the behaviour of .* to include . and .. defined in LSB or POSIX or some other specification?

as title: is the behaviour of `.*` to include `.` and `..` defined in LSB or POSIX or some other specification?


Lock some accounts during some time periods

Is it possible to lock some accounts in order to be accessible only during specific time periods? For instance the account joe should only be accessible during office hours.


Will DVD+RW work on my laptop drive marked RW?

I purchase today moserbaer DVD that is: DVD+RW. Now I want to know whether my drive supports this DVD (i.e. the DVD can be burned)! On my drive its written RW & ReWritable. Also please see the below command output if it may help.               ravbholua@ravbholua-Aspire-5315:~$ sudo lshw | grep DVD     [sudo] password for ravbholua:                   description: DVD-RAM writer                  product: DVD-RW DVRKD08RS     ravbholua@ravbholua-Aspire-5315:~$       > EDIT I tried burning the DVD with my Ubuntu 13.10 iso but failed. Then I tried burning only 1 video file on the same DVD but that also got failed. I give the details below: I tried burning Ubuntu 13.10 iso as below: 1st I tried via command line but failed:               ravbholua@ravbholua-Aspire-5315:~/Documents/Other/special$ ls     ubuntu-13.10-desktop-i386.iso     ravbholua@ravbholua-Aspire-5315:~/Documents/Other/special$ sudo wodim -eject gracetime=30 ./ubuntu-13.10-desktop-i386.iso     wodim: No write mode specified.     wodim: Assuming -tao mode.     wodim: Future versions of wodim may have different drive dependent defaults.     Device was not specified. Trying to find an appropriate drive...     Looking for a DVD-R drive to store 895.00 MiB...     Detected DVD-R drive: /dev/dvdrw     Using /dev/cdrom of unknown capabilities     Device type    : Removable CD-ROM     Version        : 5     Response Format: 2     Capabilities   :      Vendor_info    : 'PIONEER '     Identification : 'DVD-RW DVRKD08RS'     Revision       : '1.02'     Device seems to be: Generic mmc2 DVD-R/DVD-RW.     Using generic SCSI-3/mmc DVD-R(W) driver (mmc_mdvd).     Driver flags   : SWABAUDIO BURNFREE      Supported modes: PACKET SAO     Speed set to 5540 KB/s     Starting to write CD/DVD at speed   4.0 in real unknown mode for single session.     Last chance to quit, starting real write in    0 seconds. Operation starts.     Errno: 5 (Input/output error), send opc scsi sendcmd: no error     CDB:  54 01 00 00 00 00 00 00 00 00     status: 0x2 (CHECK CONDITION)     Sense Bytes: 72 0B 00 00 00 00 00 0E 09 0C 00 00 00 02 00 08     Sense Key: 0x0 No Additional Sense, Segment 11     Sense Code: 0x00 Qual 0x02 (end-of-partition/medium detected) Fru 0x0     Sense flags: Blk 0 (not valid)      cmd finished after 79.878s timeout 60s     wodim: OPC failed.      Then I used Brasero (GUI) for that but that also couldn't burn the Ubuntu iso. The error log is below:               Checking session consistency (brasero_burn_check_session_consistency brasero-burn.c:1739)     BraseroBurnURI called brasero_job_get_action     BraseroBurnURI called brasero_job_get_action     BraseroBurnURI called brasero_job_set_output_size_for_current_track     BraseroBurnURI stopping     BraseroBurnURI called brasero_job_get_action     BraseroBurnURI called brasero_job_get_session_output_size     BraseroBurnURI output set (IMAGE) image = /tmp/brasero_tmp_EM0F9W.bin toc = none     BraseroBurnURI called brasero_job_get_session_output_size     BraseroBurnURI called brasero_job_get_action     BraseroBurnURI called brasero_job_get_current_track     BraseroBurnURI no burn:// URI found     BraseroBurnURI stopping     BraseroLocalTrack called brasero_job_get_action     BraseroLocalTrack called brasero_job_get_action     BraseroLocalTrack called brasero_job_set_output_size_for_current_track     BraseroLocalTrack stopping     BraseroLocalTrack called brasero_job_get_action     BraseroLocalTrack called brasero_job_get_session_output_size     BraseroLocalTrack output set (IMAGE) image = /tmp/brasero_tmp_EUZF9W.bin toc = none     BraseroLocalTrack called brasero_job_get_session_output_size     BraseroLocalTrack called brasero_job_get_action     BraseroLocalTrack called brasero_job_get_current_track     BraseroLocalTrack no remote URIs     BraseroLocalTrack stopping     BraseroChecksumImage called brasero_job_get_current_track     BraseroChecksumImage called brasero_job_get_action     BraseroChecksumImage called brasero_job_get_flags     BraseroChecksumImage called brasero_job_get_action     BraseroChecksumImage called brasero_job_get_action     BraseroChecksumImage called brasero_job_get_fd_in     BraseroChecksumImage called brasero_job_set_output_size_for_current_track     BraseroChecksumImage stopping     BraseroChecksumImage called brasero_job_get_current_track     BraseroChecksumImage called brasero_job_get_action     BraseroChecksumImage called brasero_job_get_flags     BraseroChecksumImage called brasero_job_get_action     BraseroChecksumImage called brasero_job_get_session_output_size     BraseroChecksumImage output set (IMAGE) image = /tmp/brasero_tmp_ZJFG9W.bin toc = none     BraseroChecksumImage called brasero_job_get_session_output_size     BraseroChecksumImage called brasero_job_get_action     BraseroChecksumImage called brasero_job_get_action     BraseroChecksumImage called brasero_job_get_current_track     BraseroChecksumImage called brasero_job_get_input_type     BraseroChecksumImage called brasero_job_set_current_action     BraseroChecksumImage called brasero_job_get_fd_in     BraseroChecksumImage called brasero_job_get_current_track     BraseroChecksumImage called brasero_job_get_current_track     BraseroChecksumImage Starting checksuming file /home/ravbholua/Documents/Other/special/ubuntu-13.10-desktop-i386.iso (size = 938475520)     BraseroChecksumImage called brasero_job_get_fd_out     BraseroChecksumImage called brasero_job_get_current_track     BraseroChecksumImage Setting new checksum (type = 2) d0508f909c2c71d96aeac5efb0329b33 ((null) before)     BraseroChecksumImage Finished track successfully     BraseroChecksumImage stopping     BraseroLibburn called brasero_job_get_action     BraseroLibburn called brasero_job_get_action     BraseroLibburn unsupported operation     BraseroLibburn deactivating     BraseroLibburn called brasero_job_get_action     BraseroLibburn called brasero_job_get_action     BraseroLibburn called brasero_job_get_device     BraseroLibburn Drive (/dev/sr0) init result = 1     BraseroLibburn called brasero_job_get_flags     BraseroLibburn called brasero_job_get_media     BraseroLibburn called brasero_job_get_fd_in     BraseroLibburn called brasero_job_get_tracks     BraseroLibburn Setting burnproof 0     BraseroLibburn Setting dummy 0     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn burn_drive_convert_fs_adr( /dev/sr0 )     BraseroLibburn Blanking/Formatting     BraseroLibburn called brasero_job_set_dangerous     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn burn_drive_is_enumerable_adr( /dev/sr0 ) is true     BraseroLibburn Async START UNIT succeeded after 0.1 seconds     BraseroLibburn mmc_set_streaming: end_lba=2295103 ,  r=5540 ,  w=5540     BraseroLibburn Allocating buffer via mmap()     BraseroLibburn Format type 26h "DVD+RW (fs=0,rs=0)", blocks = 4294967295     BraseroLibburn CDB: 04 11 00 00 00 00      BraseroLibburn Format list: 00 02 00 08 FF FF FF FF 98 00 00 00           BraseroLibburn syncing cache     BraseroLibburn Async SYNCHRONIZE CACHE succeeded after 0.1 seconds     BraseroLibburn Writing     BraseroLibburn called brasero_job_set_dangerous     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn dvd/bd Profile= 1Ah , obs= 32768 , obs_pad= 0     BraseroLibburn Something went wrong     BraseroLibburn called brasero_job_error     BraseroLibburn finished with an error     BraseroLibburn asked to stop because of an error         error       = 15         message = "An error occurred while writing to disc"     BraseroLibburn stopping     Session error : An error occurred while writing to disc (brasero_burn_record brasero-burn.c:2856)      Then I tried burning the DVD with a video file but now also it failed. What's the issue please? Why I'm failing to do!!!


Network manager behaving strange on a laptop?

I use Debain stable with Gnome3. The network manager has this unpractical behaviour:   When the laptop in powser-safe mode (lid shut), the wireless network is off. Good.   When I open the lid and log in, at first I have no connection. The network manager shows to be searching for a connection, when I right click on it it shows my home network as the selected one. After (usually) **several minutes** , I get prompted for the password for my home w-lan (that is allready entered into the prompt), then my computer actually connects to the w-lan and I'm good. I'd like to get rid of the waiting period. There's another, connected thing that's bothering me: When I login and do nothing for a while, my laptop is supposed to lock the screen (and does so most of the time). But the prompt for the w-lan password prevents locking the screen until the password is entered. How can I change the behaviour upon login, meaning to get the network manager to prompt me for my password and find a new connection at once?


Compressing all files that contain a particular string

How can you compress all files in a directory that contain the word “compress” anywhere within its contents?


Any other way to define an environment variable?

I'm quite new to Linux. Debian Wheezy is now running on my Laptop (64 bits). I recently installed Oracle 11g R2 database for evaluation purpose, and defined environment variables (such as `ORACLE_SID`) through a script `/etc/profile.d/oracle.sh`. This works fine, but for the "oracle" user. I change user by `su - oracle`.   The value of `ORACLE_SI`D is different from the one specified in the `/etc/profile.d/oracle.sh` file. As the oracle user has no file (such as `.bash_profile`, `.profile` etc.) in its home directory, where can this value come from? What is the overloading sequence of environment variables?


Search for all messages containing a sring only in those files which is mentioned in a text file

You are in a directory with a large number of FIX logs that are over 1GB in size. You have a text file containing the names of 10 of those files. How can you search for all messages containing “50=MSFT”, only in those ten files?


"Jagged" rectangle text in emacs

Suppose I have something like               this     is     text      I want to change it to be               "this"     "is"     "text"      The first quote I can insert simply by making a rectangle and doing `C-x r t`, but the trailing quote I can't add because they aren't all at the same alignment. Is there any way to add something to the end of all selected lines?


what is the command to display .eps files?

I'm have a file called `t-0.8.eps`. How can I open this file in the shell? I am using Mac and when I click `.eps` files the preview (the name of the software to read PDFs) says failed.


'ps' command hangs

A coworker ran into this issue twice and I don't know what's wrong. His `ps` command hangs, taking about 25% of the CPU.                  in_progress=1        sleep 10             while [ "$in_progress" -eq 1 ]; do           num_isp=`ps -e | grep isputility | grep -v grep | wc -l`           if [ "$num_isp" -eq 0 ]; then              in_progress=0           fi           sleep 10        done      Below is the output of the `ps` command that hung.                      F S   UID        PID       PPID  C PRI  NI ADDR    SZ WCHAN STIME TTY          TIME CMD     00100000 -     0   35672094    1204253  -  10   0    -  844K -     Apr16 ?        00:00:00 /bin/sh /home/customProgram     00100000 -     0   43548705   42545184  -  10   0    -  648K -     11:51 ?        00:00:00 ps –elf     00100000 -     0   41926696   35672094  -  10   0    -  648K -     Apr16 ?        03:53:01 ps -e     00100000 -     0   41926702   35672094  -  10   0    -  672K -     Apr16 ?        00:00:00 grep isputility     00100000 -     0   41926704   35672094  -  10   0    -  672K -     Apr16 ?        00:00:00 grep -v grep     00100000 -     0   41926706   35672094  -  10   0    -  640K -     Apr16 ?        00:00:00 wc -l      Running QNX `hogs` command (similar to `top`) shows `ps` is using ~25% of the CPU.               hogs -% 1 -n     PID             NAME  MSEC  PIDS SYSTEM     1            procnto  2116   71%    70%     41926696           ps   763   25%    25%      Can anyone point us in the right direction to figure out why `ps` hung and what we can do about it?


console vim in screen session: remap Ctrl-Shift-Left, Ctrl-Shift-Right to not delete lines

I have my gvim setup so that I can select word-wise with Ctrl-Shift-Right, Ctrl-Shift-Left etc. (yes, I know it's a bad habit, but it works for me..). Unfortunately, these key combinations delete text when used in console vim inside a screen session. I believe this is because the two key combinations produce the codes `<Esc>[1;6D` and `<Esc>[1;6C` on the terminal, which are interpreted as "delete next 6 lines" or "change next lines", respectively. Is there some way to stop screen or console vim from interpreting these key combinations? **UPDATE** : Content of my .screenrc:               sessionname daku     startup_message off     hardstatus on     hardstatus alwayslastline     hardstatus string "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %m/%d %C%a "


SSH X11 forwarding put on a different monitor

Is there a way to use ssh and X11 forwarding with multiple monitors, such that one screen gets the remote session and one keeps the current session? Note: In case I didn't clarify, I meant forwarding an entire session with `gnome-session` or `start-x` or similar. I knew that ssh could be used for single windows.


How does one determine the amount of space allocated to their command line?

How would one go about determining the amount of space allocated to their system for command lines. Is there anything else I need to be concerned with?


How to start first command from the list printed by command 'history | grep something'

For example, I have the following output from command:               loom@loom:$ history | grep MAKE       219  ../build.sh -DCMAKE_BUILD_TYPE=Debug ..       909  history | grep MAKE      How to write a command, that start the first command from the list? Also, I'd like to know how to start n-th command from output of `history | grep something`?


What does xargs do if it's used without any parameter?

[user@notebook ~] echo -e '1\n2\n3\n4'     1     2     3     4     [user@notebook ~] echo -e '1\n2\n3\n4' | xargs     1 2 3 4     [user@notebook ~]       **My question:** So xargs removes the newlines if it's used without parameters?


What is the utility of piping to `/dev/null`?

Seeing that `/dev/null`'s utility isn't immediately obvious to me, what is the use of `/dev/null` piping?


Slackware 14 can't find DVD after booting from it

I am installing Slackware 14 from a DVD onto a gigabyte 990fxa-ud3 motherboard. The DVD boots fine but when I run setup and choose CDROM as the source, it says that it can't find the CDROM drive. The DVD reader is a HP DVD1170 with a USB interface. Trying the modprob stuff here does not help. Edit: Trying some of the stuff here does not work either (setting IOMMU to enabled).


How to get volume level from the command line?

I have a text status bar on a tiling window manager and I am using tcl to feed information to it. At the moment I need a command line that output the volume level 0% to 100%. I am using Arch Linux.


Problem with sed

root@ROUTER:~# cat maccheck.txt      logread | egrep ': STA |DHCPACK' | awk '{print $1" "$2" "$3" "$9}' | sed -e 's/\( [0-9] \)/0\1/' | sed "s/.\{15\}/&:/; s/: /:/g" | cut -d : -f 1,2,4,5,6,7,8,9 | sed "s/.\{13\}/&X/;" | sed 's/:X/ /g' | sed 's/XX:XX:XX:XX:XX:XX/AAAA/g' | sort -u -r      it OK when it's here:               root@ROUTER:~# logread | egrep ': STA |DHCPACK' | awk '{print $1" "$2" "$3" "$9}' | head -1     Sep 2 03:03:25 XX:XX:XX:XX:XX:XX      but it's bad if I use the script that has further things in it:               root@ROUTER:~# sh maccheck.txt |head -1     Sep0 4 13:13 AAAA      so the "Sep0" is bad.. how to modify it to be "Sep"?               root@ROUTER:~# logread | egrep ': STA |DHCPACK' | awk '{print $1" "$2" "$3" "$9}' | sed -e 's/\( [0-9] \)/0\1/' | head -1     Sep0 2 03:03:25 AAAA      So the problem is with:               sed -e 's/\( [0-9] \)/0\1/'      **Q:** I need the same output, but without the "0" in "Sep", how to do it?


IPTables dropping UDP packet stream

I have a configuration where UDP packets containing encapsulated DNS data are sent to a KVM instance for processing. The KVM instance sits behind an IPtables firewall which is also doing NAT. The stream is coming in on average at about 25Mb per second. The stream comes in and works as expected with one exception. If I terminate the KVM instance and remove the IPtables rules, the stream no longer gets forwarded through the IPtables box. I expect this behavior. If I bring up another KVM instance with the same IP address, and add the same rules back into iptables, the stream does not get forwarded until I stop the stream on the sending side and leave it off for at least 30 seconds. If I start the stream after waiting 30 seconds, the traffic is again passed to the KVM instance. I'm thinking there is some kernel parameter related to UDP timeouts that I'm unaware of. Has anyone seen behavior like this? The IPtables box is running CentOS 6.4. The KVM instance is running Ubuntu 10.04.


executing any program in mc ends putty session if not logged in with root

Maybe there is a simple-obvious solution for this but I dont know how to make mc to be able to execute programs when I press enter/double click on it and I am not logged in as root... the executable has executable rights for all. I get this whenever I try to execute anything by hiting enter or double clicking or trying to call a program from the command line. When I run the program to be executed with sudo it opens it up nicely, but I like the pressing enter method and would not like to type always the file name. Or how could I setup only some executables to execute from mc? Here is my `/etc/mc` folder:               drwxr-xr-x. 121 root root 12288 Nov 14 10:59 ..     -rw-r--r--.  1 root root 12278 Aug 22  2010 cedit.menu     -rw-r--r--.  1 root root  788 Aug 22  2010 edit.indent.rc     -rw-r--r--.  1 root root  247 Aug 22  2010 edit.spell.rc     drwxr-xr-x.  2 root root  4096 Oct 15 10:50 extfs     -rw-r--r--.  1 root root  1024 Aug 22  2010 filehighlight.ini     -rw-r--r--.  1 root root  226 Aug 22  2010 mc.charsets     -rw-r--r--.  1 root root 17353 Aug 22  2010 mc.ext     -rw-r--r--.  1 root root  7936 Aug 22  2010 mc.keymap     -rw-r--r--.  1 root root  7936 Aug 22  2010 mc.keymap.default     -rw-r--r--.  1 root root  7913 Aug 22  2010 mc.keymap.emacs     -rw-r--r--.  1 root root  1979 Aug 22  2010 mc.lib     -rw-r--r--.  1 root root  9556 Aug 22  2010 mc.menu     -rw-r--r--.  1 root root 10126 Aug 22  2010 mc.menu.sr     -rw-r--r--.  1 root root  6259 Aug 22  2010 Syntax      The mc from `/user/bin`               -rwxr-xr-x.  1 root root      988432 Aug 22  2010 mc      For example, here is a file I would like to execute through mc with normal user:               -rwxrwxr-x  1 root hUSERS  205780 Jun 11 16:03 DBU3L      These are the putty log's last lines:               [44m*DBU3L[23;3H[1;1H[39m[49m[K     [K     [K     [K     [K     [K     [K     [K     [K     [K     [K     [K     [K     [K     [K     [K     [K     [K     [K     [K     [K     [K     [K     [K[1;80H[?1002l[?1001r[?1l>[24;1H(B[m[39;49m     [K     [?1049l>[?47l8[m$ ./DBU3L      `mv -v` output:               GNU Midnight Commander 4.7.0.2     Virtual File System: tarfs, extfs, cpiofs, ftpfs, fish, mcfs, smbfs     With builtin Editor     Using system-installed S-Lang library with terminfo database     With subshell support as default     With support for background operations     With mouse support on xterm and Linux console     With internationalization support     With multiple codepages support     Data types: char 8 int 32 long 64 void * 64 off_t 64 ecs_char 8      I saw in a forum a program called `sam` that could be used to solve the problem, but would not like to reinvent the wheel if this could be fixed by changing some rights or mc parameters.


Python: Move lines backward in a textfile

Imagine a text file which contains random text and two unique markers               01 text text text     02 text text text     03 __DELETE_THIS_FIRST__     04 text text text     05 text text text     06 text text text     07 text text text     08 __DELETE_THIS_LINE_SECOND__     09 a few     10 interesting     11 lines follow     12 __DELETE_THIS_LINE_THIRD__     13 text text text     14 text text text     15 text text text     16 text text text     17 __DELETE_THIS_LINE_FIRST__     18 text text text     19 text text text     20 text text text     21 text text text     22 __DELETE_THIS_LINE_SECOND__     23 even     24 more     25 interesting lines     26 __DELETE_THIS_LINE_THIRD__      I want a Python expression that moves the interesting lines between the END marker and thr THIRD marker to the position of the **PREVIOUS** BEGIN marker and also deletes all three markers. Which should result in:               01 text text text     02 text text text     09 a few     10 interesting     11 lines follow     04 text text text     05 text text text     06 text text text     07 text text text     13 text text text     14 text text text     15 text text text     16 text text text     23 even     24 more     25 interesting lines     18 text text text     19 text text text     20 text text text     21 text text text      The three markers are always a triple and occur multiple times in the file. FIRST marker always occurs before SECOND marker, which always occurs before THIRD marker Any ideas? Related: 126325


Start the script with sudo not working

I am trying to start the virtual machine (ORACLE VIRTUALBOX) using this script (script name: `start_vm001.sh`).               START_VM=`/usr/bin/VBoxHeadless --startvm testvm001`     EXECUTE_VM=`exec /sbin/start-stop-daemon --start --chuid 1001 \     --exec "$START_VM" -- $START_VM`     echo $EXECUTE_VM                    $ ./start_vm001.sh, # it worked     $ sudo ./start_vm001.sh # it not worked          ERROR OUTPUT: sbin/start-stop-daemon: unable to stat Oracle VM VirtualBox      Headless Interface 4.1.12_Ubuntu (C) 2008-2013 Oracle Corporation All rights      reserved. Invalid machine name or UUID! (No such file or directory)      How to run the script using sudo?


How to detect imminent MTD device failure

We write software that runs in third party devices. On one of the devices we support, the manufacture tells us not to write to the flash drive, or we risk using up the limited write operations it supports. Unfortunately, one of the requirements of our application is to persist some data across boots and we have no other alternative. I don't know exactly what the drive inside the device is, nor how it is configured, so one question is how can I go about finding this information? Some information I have managed to find: ` bash-3.2$ df | grep mtd /dev/mtdblock5 65536 7824 57712 12% /apps ` ` bash-3.2$ dmesg | grep -i mtd Kernel command line: root=/dev/mtdblock4 rootfstype=jffs2 rw ip=none console= mem=128M init=/sbin/init mtdparts=mtd:512k(bootloader),512k(env),2M(kernel_a),2M(kernel_b),59M(filesystem),64M(user) loglevel=3 panic=5 reboot=h 6 cmdlinepart partitions found on MTD device <NULL> Creating 6 MTD partitions on "<NULL>": ` I've had a look in proc and sysfs and didn't find anything useful. The device environment doesn't have any useful tools installed such as hdparam, lshw, etc that I can find. Another question is whether there are any heuristics software could use to detect whether the 'write limit' is approaching? Finally, is there any best practices that could be observed while writing to the disk to limit the negative effects? For example, are small bursts of writing better than sustained write operations? Is it data throughput that's the problem or is it a file-system thing? If I open a file without closing it and continue to stream data there, is it better than if I open, write and close for each new piece of data? Many thanks for any help you can provide, Dan.


How to install QGIS from source into user space?

I want to install QGIS from source on Ubuntu 13.10. (saucy). into `~/bin`. There is Python 2.7.5+ installed. Therefore, I cloned the repository to my machine and checked out the `master` branch. First I did what the QGIS documentation recommends:   1. `$ export CMAKE_INSTALL_PREFIX=$HOME/bin`   2. `$ cd QGIS`   3. `$ mkdir build-master`   4. `$ cd build-master`   5. `$ ccmake ..` CMake stops with the following error message: > CMake Error: The following variables are used in this project, but they are > set to NOTFOUND. Please set them or make sure they are set and tested > correctly in the CMake files: PYTHON_LIBRARY   >  linked by target "qgispython" in directory /home/jjd/QGIS/src/python   >  linked by target "python_module_qgis_analysis" in directory > /home/jjd/QGIS/python   >  linked by target "python_module_qgis_core" in directory > /home/jjd/QGIS/python   >  linked by target "python_module_qgis_gui" in directory > /home/jjd/QGIS/python   >  linked by target "python_module_qgis_networkanalysis" in directory > /home/jjd/QGIS/python Second try following the advise of Secagy ...   1. `$ export CMAKE_INSTALL_PREFIX=$HOME/bin`   2. `$ cd QGIS`   3. `$ mkdir build-master`   4. `$ cd build-master`   5. `$ ccmake -DPYTHON_LIBRARY=/usr/bin/python2 ..` This time CMake stops with: > BINDINGS_GLOBAL_INSTALL: Install bindings to global python directory? (might > need root) Running the above command with `sudo` does not make a difference. In the following I tried various build flags inspired by different posts **without success**. **References:**   * CMake error: PYTHON_LIBRARY-NOTFOUND while compiling QGIS [Solved]   * Building QGIS on Ubuntu 13.04 * * * ## Solution Actually, the message _"BINDINGS_GLOBAL_INSTALL: Install bindings to global python directory? (might need root)"_ shown at the bottom is **not an error** but a **help message**. So after supplying the include and library paths I could continue by pressing `g` in the ccmake wizard to start the generate task.   Here are the steps (customize the paths for your system!):   1. `$ cd QGIS`   2. `$ mkdir build-master`   3. `$ cd build-master`   4. `$ ccmake ..`   5. In the wizard set `CMAKE_INSTALL_PREFIX` to `/home/user/bin/qgis`. Make sure to append `qgis` here!   6. In the wizard set `PYTHON_INCLUDE_PATH` to `/usr/include/python2.7`. Should be already set.   7. In the wizard set `PYTHON_LIBRARY` to `/usr/lib/x86_64-linux-gnu/libpython2.7.so`.   8. Press `c`   9. Press `g`   10. `$ make -j2` The number should correspond to the number of processors in your machine.   11. `$ make install`   12. Add `export LD_LIBRARY_PATH=$HOME/bin/qgis/lib` to your `~/.bashrc` or `~/.zshrc` and re-source the shell.   13. Start QGIS from `~/bin/qgis/bin/qgis`.   14. You can also create a `.desktop` file as described here.


banshee audio player won't start?

When I try to run banshee, nothing happens and the only log in syslog is: > ptrace of non-child pid 29619 was attempted by: gdb (pid 29623) Also `ps aux | grep bansh` shows nothing. Maybe I'm in the wrong forum, cause I'm using Linux Mint 13 Maya LTS. Other hints may be that last week I used only PC suspend each day. From time to time (once in a day), the banshee player quits itself at the end of a song without any pattern. ### UPDATE #1 This comes out when running banshee from CLI:               Stacktrace:               Native stacktrace:              banshee() [0x4916ba]         banshee() [0x4e0d4f]         banshee() [0x41bc77]         /lib/x86_64-linux-gnu/libpthread.so.0(+0xfcb0) [0x7f03e283fcb0]         [0xa58670]          Debug info from gdb:          Could not attach to process.  If your uid matches the uid of the target     process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try     again as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf     ptrace: Operation not permitted.     No threads.          =================================================================     Got a SIGSEGV while executing native code. This usually indicates     a fatal error in the mono runtime or one of the native libraries      used by your application.     =================================================================          Aborted


How to Rescue Fullscreen Guake from Seahorse Modal Dialog

**Problem** I use guake to hide away my terminals when I'm not using them. When I am, they fullscreen an entire monitor. If I run a command requiring an unlock of a private key, Seahorse opens a modal dialog asking for the passphrase. Unfortunately, the dialog is drawn _behind_ guake. Perhaps I can simply blindly unlock the key, but the combination of invisibility and having mashed some keys before realising what's happened means this hasn't worked for me so far, and possibly just doesn't work at all. Certainly hammering `esc` and other "get me out of here" keys doesn't help. In case it needs mentioning, the shortcut to raise/hide guake obviously does not work either. I have several different keys with passphrases. Most of these keys are added to my ssh agent, but some are rarely used and I don't want to unlock every one of them on boot. It's these rarely used keys that cause the above problem. **Terrible Solution** So, I do have _a_ solution, but it feels horribly hacky. This relies on having `xdotool` installed. Ctrl+Alt+F1 to hop to another VT and run the following:               export DISPLAY=0:0     xdotool search 'guake.py' | while read W; do xdotool windowminimize "$W"; done      Now Ctrl+Alt+F7 back to the desktop environment, and guake has disappeared. I could simply switch to another VT and kill guake, but it's frustrating to reopen a dozen SSH sessions to various machines when I do. **Question** I'm looking for better ways to escape from the uninteractable modal dialog. Secret key combinations, ways to configure Seahorse to never ask me anything ever, WM tweaks to have it 'on top, no, really', etc. Any advice about how people manage their agent/key setups would peripherally be appreciated too.


git commit error - cannot run vim: No such file or directory

$ git commit       error: cannot run vim: No such file or directory     error: There was a problem with the editor 'vim'.     Please supply the message using either -m or -F option.      How can I overcome the error and define the editor?


Error while burning DVD

I'm working on Ubuntu 13.04. I purchased a few DVDs of Sony company from a few different shops but it failed to burn all these. Earlier I had used the Sony DVD only to burn the same date & it worked. I don't know why now none are working. But now the same data which didn't burn on Sony DVD was burned successfully on Amkette CD. I used Brasero disc burner. So, the problem seems to be of Sony DVD only. Below is the error log when I was burning Ubuntu 13.10 O.S. on Sony DVD.               Checking session consistency (brasero_burn_check_session_consistency brasero-burn.c:1739)     BraseroBurnURI called brasero_job_get_action     BraseroBurnURI called brasero_job_get_action     BraseroBurnURI called brasero_job_set_output_size_for_current_track     BraseroBurnURI stopping     BraseroBurnURI called brasero_job_get_action     BraseroBurnURI called brasero_job_get_session_output_size     BraseroBurnURI output set (IMAGE) image = /tmp/brasero_tmp_6MF87W.bin toc = none     BraseroBurnURI called brasero_job_get_session_output_size     BraseroBurnURI called brasero_job_get_action     BraseroBurnURI called brasero_job_get_current_track     BraseroBurnURI no burn:// URI found     BraseroBurnURI stopping     BraseroLocalTrack called brasero_job_get_action     BraseroLocalTrack called brasero_job_get_action     BraseroLocalTrack called brasero_job_set_output_size_for_current_track     BraseroLocalTrack stopping     BraseroLocalTrack called brasero_job_get_action     BraseroLocalTrack called brasero_job_get_session_output_size     BraseroLocalTrack output set (IMAGE) image = /tmp/brasero_tmp_OVE87W.bin toc = none     BraseroLocalTrack called brasero_job_get_session_output_size     BraseroLocalTrack called brasero_job_get_action     BraseroLocalTrack called brasero_job_get_current_track     BraseroLocalTrack no remote URIs     BraseroLocalTrack stopping     BraseroChecksumImage called brasero_job_get_current_track     BraseroChecksumImage called brasero_job_get_action     BraseroChecksumImage called brasero_job_get_flags     BraseroChecksumImage called brasero_job_get_action     BraseroChecksumImage called brasero_job_get_action     BraseroChecksumImage called brasero_job_get_fd_in     BraseroChecksumImage called brasero_job_set_output_size_for_current_track     BraseroChecksumImage stopping     BraseroChecksumImage called brasero_job_get_current_track     BraseroChecksumImage called brasero_job_get_action     BraseroChecksumImage called brasero_job_get_flags     BraseroChecksumImage called brasero_job_get_action     BraseroChecksumImage called brasero_job_get_session_output_size     BraseroChecksumImage output set (IMAGE) image = /tmp/brasero_tmp_U7D87W.bin toc = none     BraseroChecksumImage called brasero_job_get_session_output_size     BraseroChecksumImage called brasero_job_get_action     BraseroChecksumImage called brasero_job_get_action     BraseroChecksumImage called brasero_job_get_current_track     BraseroChecksumImage called brasero_job_get_input_type     BraseroChecksumImage called brasero_job_set_current_action     BraseroChecksumImage called brasero_job_get_fd_in     BraseroChecksumImage called brasero_job_get_current_track     BraseroChecksumImage called brasero_job_get_current_track     BraseroChecksumImage Starting checksuming file /home/ravbholua/Documents/Other/special/ubuntu-13.10-desktop-i386.iso (size = 938475520)     BraseroChecksumImage called brasero_job_get_fd_out     BraseroChecksumImage called brasero_job_get_current_track     BraseroChecksumImage Setting new checksum (type = 2) d0508f909c2c71d96aeac5efb0329b33 ((null) before)     BraseroChecksumImage Finished track successfully     BraseroChecksumImage stopping     BraseroLibburn called brasero_job_get_action     BraseroLibburn called brasero_job_get_action     BraseroLibburn unsupported operation     BraseroLibburn deactivating     BraseroLibburn called brasero_job_get_action     BraseroLibburn called brasero_job_get_action     BraseroLibburn called brasero_job_get_device     BraseroLibburn Drive (/dev/sr0) init result = 1     BraseroLibburn called brasero_job_get_flags     BraseroLibburn called brasero_job_get_media     BraseroLibburn called brasero_job_get_fd_in     BraseroLibburn called brasero_job_get_tracks     BraseroLibburn Setting multi 0     BraseroLibburn Setting burnproof 1     BraseroLibburn Setting dummy 0     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn burn_drive_convert_fs_adr( /dev/sr0 )     BraseroLibburn Writing     BraseroLibburn called brasero_job_set_dangerous     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn burn_drive_is_enumerable_adr( /dev/sr0 ) is true     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn Async START UNIT succeeded after 0.1 seconds     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn mmc_set_streaming: end_lba=2298495 ,  r=11080 ,  w=11080     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn Allocating buffer via mmap()     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn dvd/bd Profile= 11h , obs= 32768 , obs_pad= 1     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn DVD pre-track 01 : get_nwa(0), ret= 1 , d->nwa= 0     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn SCSI error condition on command 2Ah WRITE(10): See MMC specs: Sense Key 4 "Drive error", ASC 44 ASCQ D9.     BraseroLibburn called brasero_job_get_session_output_size     BraseroLibburn called brasero_job_set_current_action     BraseroLibburn Libburn reported an error SCSI error on write(784,16): See MMC specs: Sense Key 4 "Drive error", ASC 44 ASCQ D9.     BraseroLibburn called brasero_job_error     BraseroLibburn finished with an error     BraseroLibburn asked to stop because of an error         error       = 1         message = "SCSI error on write(784,16): See MMC specs: Sense Key 4 "Drive error", ASC 44 ASCQ D9."     BraseroLibburn stopping     Session error : SCSI error on write(784,16): See MMC specs: Sense Key 4 "Drive error", ASC 44 ASCQ D9. (brasero_burn_record brasero-burn.c:2856)