hostapd will not start via "service" -- but will start directly

I am having trouble getting `hostapd` to start as a service. It fails when I try to start it:               $ sudo service hostapd start     [FAIL] Starting advanced IEEE 802.11 management: hostapd failed!      From what I understand, this uses the configuration in `/etc/default/hostapd`:               $ cat /etc/default/hostapd      # Defaults for hostapd initscript     #     # See /usr/share/doc/hostapd/README.Debian for information about alternative     # methods of managing hostapd.     #     # Uncomment and set DAEMON_CONF to the absolute path of a hostapd configuration     # file and hostapd will be started during system boot. An example configuration     # file can be found at /usr/share/doc/hostapd/examples/hostapd.conf.gz     #     #DAEMON_CONF=""     DAEMON_CONF=”/etc/hostapd/hostapd.conf”          # Additional daemon options to be appended to hostapd command:-     #   -d   show more debug messages (-dd for even more)     #   -K   include key data in debug messages     #   -t   include timestamps in some debug messages     #     # Note that -B (daemon mode) and -P (pidfile) options are automatically     # configured by the init.d script and must not be added to DAEMON_OPTS.     #     DAEMON_OPTS="-d"      My daemon configuration file is as follows:               $ cat /etc/hostapd/hostapd.conf     interface=wlan0     bridge=br0     driver=rtl871xdrv     country_code=USA     ctrl_interface=wlan0     ctrl_interface_group=0     ssid=KITT     hw_mode=g     channel=1     wpa=3     wpa_passphrase=georgeisyourfriend     wpa_key_mgmt=WPA-PSK     wpa_pairwise=TKIP     rsn_pairwise=CCMP     beacon_int=100     auth_algs=3     macaddr_acl=0     wmm_enabled=1     eap_reauth_period=360000000      Despite the service failing to start, I am able to start it directly on my own without error:               $ sudo hostapd -d /etc/hostapd/hostapd.conf     random: Trying to read entropy from /dev/random     Configuration file: /etc/hostapd/hostapd.conf     ctrl_interface_group=0     drv->ifindex=3     Configure bridge br0 for EAPOL traffic.     BSS count 1, BSSID mask 00:00:00:00:00:00 (0 bits)     Completing interface initialization     Mode: IEEE 802.11g  Channel: 1  Frequency: 2412 MHz     RATE[0] rate=10 flags=0x1     RATE[1] rate=20 flags=0x1     RATE[2] rate=55 flags=0x1     RATE[3] rate=110 flags=0x1     RATE[4] rate=60 flags=0x0     RATE[5] rate=90 flags=0x0     RATE[6] rate=120 flags=0x0     RATE[7] rate=180 flags=0x0     RATE[8] rate=240 flags=0x0     RATE[9] rate=360 flags=0x0     RATE[10] rate=480 flags=0x0     RATE[11] rate=540 flags=0x0     Flushing old station entries     Deauthenticate all stations     +rtl871x_sta_deauth_ops, ff:ff:ff:ff:ff:ff is deauth, reason=2     rtl871x_set_key_ops     rtl871x_set_key_ops     rtl871x_set_key_ops     rtl871x_set_key_ops     Using interface wlan0 with hwaddr 80:1f:02:d3:cb:b8 and ssid 'KITT'     Deriving WPA PSK based on passphrase     SSID - hexdump_ascii(len=4):          4b 49 54 54                                       KITT     PSK (ASCII passphrase) - hexdump_ascii(len=18): [REMOVED]     PSK (from passphrase) - hexdump(len=32): [REMOVED]     rtl871x_set_wps_assoc_resp_ie     rtl871x_set_wps_beacon_ie     rtl871x_set_wps_probe_resp_ie     urandom: Got 20/20 bytes from /dev/urandom     GMK - hexdump(len=32): [REMOVED]     Key Counter - hexdump(len=32): [REMOVED]     WPA: group state machine entering state GTK_INIT (VLAN-ID 0)     GTK - hexdump(len=32): [REMOVED]     WPA: group state machine entering state SETKEYSDONE (VLAN-ID 0)     rtl871x_set_key_ops     rtl871x_set_beacon_ops     rtl871x_set_hidden_ssid ignore_broadcast_ssid:0, KITT,4     rtl871x_set_acl     wlan0: Setup of interface done.


How to Install Fedora Live Desktop 20 in Windows 7?

I downloaded the `Fedora-Live-Desktop.iso` and mounting the image produces the following directories.               /isolinux     /LiveOS         |- livecd-iso-to-disk         |- osmin.img         |- squashfs.img      Now how can I make a bootable DVD from this image ? I don't think burning this `Fedora-Live-Desktop.iso` image file will install Fedora.


Ubuntu / Unity attach script to Launcher

I recently downloaded IntelliJ IDEA and start the app by running `. idea.sh`. The app appears in the launcher while I'm running it, but for some reason when I right click on it I don't get a 'Lock to Launcher' option like I do with other apps. How do I attach it to the launcher? Is it because I'm running a script and not an executable directly that disables that option?


Why does `cd` command not work via SSH?

I was trying to backup some files via SSH but instead of `tar`'ing the ones I wanted I got my home folder. I did some further testing and it boils down to this:               ssh root@server /bin/sh -c "cd /boot && ls -l"      Which to my surprise lists files in **`/root`** not `/boot`. But if I run the entire `/bin/sh` command from a terminal it properly `cd`'s and prints the `/boot` files. What's happening here?


nodm not working on bootup

I've setup and used `nodm` in the past (it is extremly simple and easy), but now cannot get it working. My base system is Ubuntu 13.04 server, but I have tried Debian and older Ubuntu servers as well. What I get is my system launching into a TTY, and every 60 seconds my screen flickering like `nodm` is trying to startup. If I manually launc it (`sudo nodm`) it starts and works as expected.


Can mouse wheel scrolling work in a /usr/bin/screen session?

Is there any way to use the mouse wheel to scroll through the output of a `screen` session? I can use the keypad scroll through previous output in screen after pressing `ctrl+a [`. Is it possible to do this with the mouse wheel? (I'm using putty, but I don't think it's a putty issue, I believe it's a `screen` issue.)


Will there ever be a Solaris 12?

I'm not trying to be inflammatory with this question! I can't any statements though from Oracle regarding the future of Solaris, and wondered if there were any press releases or official notification of future versions. As I understand it, work has been greatly scaled back on Solaris and it's not being developed at a great rate. Is Solaris 11 the final party, with endless security updates to come but nothing else?


flock(2) versus fcntl(2) over a NFS

The Perl 5.x documentation states that its implementation of flock(..) will use one of the following native calls, starting at 1 and working toward 3 if unavailable:   1. flock(2)   2. fcntl(2)   3. lockf(3) That's fine. However, you may have noticed their disclaimer that flock(2) should not be used over a NFS. The doc suggests using a -Ud_flock flag to force Perl to use flock(2). The man page of flock(2) (on Redhat) states a similar disclaimer about NFS issues. **My question is, why!?!? I can't seem to find an in-depth article or explanation of WHY flock(2) is unsafe over a NFS.** I've written several test scripts in C and Perl, on both Redhat (where flock(2) is being used) and on Solaris (where fcntl(2) is being used). I ran strace/truss to ensure that Perl was indeed using flock(2) and fcntl(2) respectively. I could not replicate any issues where a lock was not being honored! What gives??


How do I tell a script to wait for a process to start accepting requests on a port?

I need a command that will wait for a process to start accepting requests on a specific port. Is there something in linux that does that?               while (checkAlive -host localhost -port 13000 == false)       do some waiting          ...


What controls turning off during overheating on Linux

I started experience overheating (I have a few possible troublemakers for it and the cause is separate question) but I wondered what controls handling of overheating? Sometimes my computer:   * Halts properly ("System is going down NOW")   * Is halted by controller (screen turns blank, goodbye all not written to disk cache) Hence my question - how to change behavior to hibernation and/or hybrid- hibernations (well - arbitrary command - from that point I could handle)? Is is possible to specify treshholds to increase safe limits?


Suggestions for a command line IRC client that supports downloads?

It's been awhile since I've used IRC and the last time I did was on a windows system with mIRC. I'm interested in finding a command line client that supports downloads and some degree of automation for those downloads. Any suggestions?


Can the Fedora installer partition the disk itself?

I've been using Ubuntu for a little while now, but I plan on dual-booting with Fedora just to try it. Does Fedora give you the option to partition your disk and dual boot upon installation or do I have to partition the disk before I go into installation?


What are the ramifications of running binaries over NFS?

Our small business has about 10 employee workstations and an LDAP/NFS server infrastructure. We need to deploy our proprietary application (a compiled binary) on all of the workstations. But since we may be updating our application frequently, we are looking for better options than copying a new version to each station every time an update occurs. We are considering creating an `/opt` share on the NFS server, and mounting `/opt/shared` (or similar) on all of our stations. That way, when we update our application, we can simply put a new one on the NFS server rather than doing it on 10 different stations. Is this a viable option? Are there any drawbacks in performance, security, or maintainability?


how to find where buffers/cache are and how to clean them up?

I want to create 20gb ram disk for ANSYS to work in yet on `free -g` I see: ![enter image description here](http://i.stack.imgur.com/tzbIP.png) And personally I have not created any ram drives yet. So I wonder how to maximize avaliable ram: how to locate what is using buffers/cache and how to free desired space?


The common practice to share file for all users on the same machine?

There is a powerful server with few users on it. Each user has gigabytes of data to process. Sometimes a user may want to use other's file, and therefore writes output in other's folder. What's the common practice to do it? I can think of create a /share folder and make it rwx to all. Is this the common practice? Any better location for this folder? (Kind of feel that create a folder at / (root) for this purpose isn't good :S)


Using sort with alphanumeric filenames

I'm sorting the results of a `find` command which finds all of the files in the current directory:               find . -maxdepth 1 -type f -iname "*.flac" | sort      What I'm expecting is a list like this:               ./Track 1.flac     ./Track 2.flac     ./Track 3.flac     ...     ./Track 9.flac     ./Track 10.flac     ./Track 11.flac      What I'm getting is a list like this:               ./Track 10.flac     ./Track 11.flac     ./Track 1.flac     ./Track 2.flac     ./Track 3.flac     ...     ./Track 9.flac      Is there an option to `sort` which will put them in alphanumeric ascending order so that numbers are evaluated properly?


Sudden burst in free memory

I'm experiencing some strange memory management behaviour on Squeeze with Kernel 2.6. I'm trying to get to the bottom of this with nmon. Sometimes this will freeze up the system for 30 seconds to 5 minutes. The server has 4GB of RAM. The figures from nmon are:   * +1.6GB memfree.    * cached dropped by ~350MB   * swapcached dropped by ~80MB    * swap free jumped by ~200M   * active memory dropped by ~1.3GB When this happens, the server isn't near any limits. Very soon after it happens, the active memory creeps back up, along with cached... and naturally memfree drops. This doesn't appear to be a runaway process. The OS just seems to reallocate a bunch of ram very suddenly, then it slowly reallocates it back. Swappiness shouldn't be a factor because swap is barely ever touched. Is there any way to track what is happening? Why does this free memory suddenly appear in seconds, only to be given back to the cache within 30 minutes?


Can't login on OpenSuse:  "No logon servers"

I have installed OpenSuse at work, and my admin fixed some problems with my login. The login worked at work, I also restarted PC and tried it after restart, it was fine too. But then I came home I couldn't login (both GUI and terminal doesn't work), it says **"No logon servers"**. I thought that's only a problem at home, but I tried it at work and I'm getting the same message. Login as root works, but my login not. How can I try to fix the "No logon servers" problem?


Porting GNOME keyboard shortcuts to URXVT

I recently switched from `gnome terminal` to `urxvt`. I am also a heavy `emacs` w. tabs user which uses a lot of key combinations similar to `urxvt` (tab related stuff) like `Shift-Left` and `Shift-Right`. These key- combinations are set for selecting text in `emacs`. Is there a way to map `ALT-1`, `ALT-2`, `ALT-3` for tabs `1, 2, 3 ..`? Is there an extension to do that ? Can it be achieved through the `~/.Xdefaults` file ?


A system-wide way to set or get $JAVA_HOME in Ubuntu?

I wonder whether Ubuntu itself provides a system-wide way to find the current JAVA_HOME or whether there is right place for setting JAVA_HOME. Mac OS X does well in this, for `/usr/libexec/java_home` command returns the current JAVA_HOME. But to Ubuntu, the materials I found always told me to set the $JAVA_PATH pointing to a static path like ````, which is stored in`~/.bash_profile```. I think, however, this approach has several drawbacks:   1. Once Java updates, the mini version number will change, which makes the static path no longer available.   2. After changing the JRE used in my system with `update-alternatives`, I have to modify $JAVA_HOME in .bash_profile. That extra work is annoying.   3. Some $JAVA_HOME-required programs, is not aware of `.bash_profile` at all. I have to set $JAVA_HOME in their start-up script, therefore a standard-and-easy way to get $JAVA_HOME seems critical to me. Well, any advice is welcomed. Thanks.


Why does MemTotal in /proc/meminfo change?

I monitor value from `/proc/meminfo` file, namely the `MemTotal:` number. It changes if a ram module breaks, roughly by size of the memory module - this is obvious. I know the definition for the field from kernel documentation:               MemTotal: Total usable ram (i.e. physical ram minus a few reserved               bits and the kernel binary code)      The `dmesg` also lists kernel data. What other particular actions make the `MemTotal` number change if I omit hardware failure of the memory module?


How can I compile DSniff on Kali Linux?

For some reason, Dsniff isn't found on my Kali system. So I downloaded the DSniff tar.gz file and extracted it on my desktop using:               tar zxvf dsniff-2.3.tar.gz     cd dsniff-2.3     ./configure && make && make install      I get the following error:               checking for Berkeley DB with 1.85 compatibility...configure: error: Berkeley DB with 1.85 compatibility not found.      How can I get Dsniff installed & working?


what does Curl's stand-alone hyphen (-) mean?

what's the stand-alone hyphen (between the `-C` & `-O`) stand for in this command?               curl -C - -O http://www.intersil.com/content/dam/Intersil/documents/fn67/fn6742.pdf      FWIW- I'm following a tutorial here.


apt-get equivalent of yum localinstall

When using Fedora I usually use `yum localinstall` as a way to install a rpm obtained outside the distribution repositories. I can't find an equivalent option in the `apt-get` man page. I'm running Ubuntu 11.04, if that matters. What is the `apt-get` equivalent of `yum localinstall`? Should I use `dpkg` directly in this case?


Execute Script automatically at shutdown on Fedora 15/16

With fedora 15 or 16, I don't find the directory for execute a shell script automaticaly at shutdown...


A secure way to confine FTP login users to a single directory

I needed to provide multiple users FTP logins, some able to write, some only to read, to a single FTP root directory. I very much wanted that they not see of the file system anything above that directory. After searching--it appears this is a common problem--I defined the user_local config option as the root directory and confined the users to that directory using the chroot_local_users option, or chroot jail. This basically works. My problem is that, though I do not know why, relying on chroot jail for security is frowned upon generally and most importantly by (at least one member of) the kernel development team. So, how can I confine my login users to (even) seeing nothing above the defined root directory without chroot jail?? (this is the "secure" part of the question alluded to in the title) Also, for security reasons (that I do not yet understand), modern versions of `vsftpd` do not allow the user's root directory to be writable, thus leaving two options: 1. or to disable the security feature and leave the root writeable or 2. to remove the write bits from the root and create a writable sub-directory therein. The former is playing with fire and the latter is ugly and error prone (users trying to write into the root and getting errors…) I chose the latter. So, how is FTP service done right? Meaning how can users be prevented from seeing irrelevant parts of the file system in secure way? Is FTP an inherently insecure way of distributing files? If so, is there a better way. Trying to get this right…


lvm: what's the purpose of a Volume Group?

Each Volume Group can have many resizeable Logical Volumes. each of Logical Volume can have different filesystem, encryption options etc. that means having a single Volume Groups is enough. so why LVM introduced the concept of Volume Groups? isn't it just an unnecessary abstraction layer? aren't Logical Volumes enough?


Replace all occurrences of a character in a variable using korn script

Part of the Korn script I am writing requires that I replace all occurrences of the `'` character with two occurrences (`''`). I am trying to log some SQL that I am generating in this script to a column in another table but single quotes need to be replaced with 2 instances of the single quote character. I know there must be examples of this functionality somewhere but I'm not finding a string replace example specific to variables anywhere.


Is it possible to simulate/force/fake an USB device unplug and replug on Linux?

So I've got a strange problem that I've been running onto. I've got a bitcoin usb miner, Bitfury, and I'm using CGMiner to mine. When I start the application, as root, the USB device is not detected automatically. CGMiner only detects the stick when it's re-plugged (it detects an hotplug event, and then works as intended) I'd like to set up a headless mini-server, and therefore, I'd rather not stand up and unplug and then replug the device everytime the servers restarts, as I'm too lazy for that, and it's somewhat difficult do to when I'm not physically at my home. So, is it possible to, like, turn off the USB system and restart it? Or is there a better way to do it? Currently, I'm running Fedora 20 on HP t5730 terminal, but I've encountered the problem on Raspbian on Raspberry PI, so I don't think it's something OS- side. Maybe it's the device itself, or CGMiner's fault, but I was yet unable to find anything on that topic.


wacom pen & touch cth-460 on debian

Following instructions at http://lik.noblogs.org/post/2010/05/07/wacom-debian/ Though, i downloaded and built linuxwacom-0.8.8-11               ./configure --enable-wacom --with-kernel=/usr/src/linux-headers-2.6.32-5-686      completes without any problem, then copy               sudo cp src/2.6.30/wacom.ko /lib/modules/2.6.32-5-686/kernel/drivers/input/tablet/wacom.ko      unplug and replug,               jcress@debian:~/Downloads/linuxwacom-0.8.8-11$ dmesg | grep wacom     [  878.879686] usbcore: registered new interface driver wacom     [  878.879694] wacom: v1.52:USB Wacom tablet driver     [  963.774142] usbcore: deregistering interface driver wacom     [ 1613.534147] usbcore: registered new interface driver wacom     [ 1613.534671] wacom: v1.52-pc-0.4:USB Wacom tablet driver      and dmesg | grep input doesn't list the wacom advice? Does this mean the module isn't working? EDIT: === fixed === I did dist-upgrade to testing and it 'just works'


Change character position with sed

The file contains:               dateutkfilename25012009      I want to change the position of character 16th to 17th with 18th to 19th. And then change position of character 16th to 19th with 20th to 23rd... so it will be:               dateutkfilename20090125      I've tried to change position of character 16th to 17th with 18th to 19th using below code, but I don't understand why it not works:               '/dateutkfilename/s/\(.\{16\}\)\([0-9]\{2\}\)\(.*\)/\(.\{18\}\)\([0-9]\{2\}\)\(.*\)/g'


Running multiple xserver displays "offscreen" or "headless"

I would like to run two or more displays, while I only have one GPU and one monitor. The second display does not have to display anything on the monitor, a dummy output would be ideal. I use startx to start a new display:               startx -- :1      so far so good, I can switch between the two displays on my computer using Ctrl+Alt+Fx (where x is a number, on my computer it is 7 or 8). Here's the problem, when both displays are available and I am currently on display 0 and I try to record display 1 I get a black screen in the recorded video. The main issue seems to be that the xserver is not refreshing when the tty is not active. I have confirmed that recording via. ffmpg's x11grab or using VLC works as intended. Other than this I have tried Xephyr, Xnest and Xvfb, while they do that I need, I am unable to use them because what I am running in display 1 is graphically very demanding (OpenGL) and I am also recording on top of that. I also tried using the xserver-xorg-video-dummy together with the Xdummy script to start the display, it works, but not with OpenGL applications. Any help with this issue is greatly appreciated!


Cron running job every 15 seconds

Could you advise me what to write in `crontab` so that it runs some job (for testing I will use `/usr/bin/chromium-browser`) every 15 seconds?


Is there a way to completely disable outbound opportunistic TLS support in SendMail?

CentOS 5.x SendMail 8.14.4 An overzealous network security feature is causing TLS negotiations to fail when my Sendmail server tries to talk to external hosts. This is causing sendmail to constantly requeue some messages because it won't fail over to unencrypted delivery. Is there a way to disable outbound TLS completely? I'm aware that I can add **Try_TLS:broken.server NO** entries for the individual mx records (or partial domains) but I'd prefer to just disable this entirely until the root cause gets resolved. As far as I can tell, there doesn't appear to be any way to tell SendMail to not use TLS whatsoever. I tried **Try_TLS:*** but that didn't work. I understand that the root cause is not my specific system but as I don't have control of the affected parts, I'd like to at least get mail flowing. Any ideas?


How to make ext4 filesystem sparse?

I am using Linux as guest OS in VirtualBox. I deleted huge number of files from its filesystem. Now i want to shrink the filesystem image file (vdi). The shrinking works by compressing filesystem image wherever it has "null" value in disk. It seems an application called zerofree can write "null" into free space of filesystem in such a way that it becomes sparse. But the instructions say it works only on ext2/ext3. I have ext4 on my guest OS.   1. Why won't it work on ext 4 (reason cited is "extents", but can someone shed more light on it) ?    2. Will it work, If i mount the **ext 4** as **ext 3** and then remount as **ext 4** ?   3. Any other tools that can do similiar thing as zerofree on ext ?


Recommended Linux distribution for statistics?

Given that **R** , **Python** and many other open source libraries used for stats have better support in Linux than Windows/OSX (rPy comes to mind), I find it odd that no one has asked this question before. So I do now: **What Linux distribution people doing stats/data analysis/Machine Learning prefer/recommend?** P.S.: I feel a bit embarrassed asking that, since by using Python's and R's inbuilt package management I should theoretically not be experiencing any conflicts with the base system. :P


How to diagnose a reliably unreliable connection?

Where I'm living now, the internet connection (wired) shows the following weird symptoms. They seem to be independent of whether I use host names or IP addresses.   * Pinging works   * Skype works   * Wget connects, but never receives a response. (Keeps waiting at "HTTP Request sent, awaiting response" until timeout.)      * Except for a small subset of domains, for which it works.    * ssh commands (`ssh host ls`) works.    * Interactive ssh works for a short while, but hangs quickly, e.g. during the first `ls` -- at the same point every time.   * Under Windows, everything works fine. What can I do to diagnose this further? So far, I've just been looking at the application layer. Since there is an apparent internet connection, there must be some way to tunnel Firefox, but I'd like to pin down the problem first. It is very likely related to large packets not making their way through. I've found out that there is an MTU, but setting it for eth0 does not solve my problem. I think that I'm behind PPPOE and a router. The external IPs are the same on Windows and Linux. Output of some commands: `ip link show`               1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN          link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00     2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1024 qdisc mq state UP qlen 1000         link/ether 00:26:aa:aa:aa:61 brd ff:ff:ff:ff:ff:ff     3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000         link/ether c4:17:aa:aa:aa:ff brd ff:ff:ff:ff:ff:ff     4: virbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN          link/ether 5e:49:aa:aa:aa:27 brd ff:ff:ff:ff:ff:ff      `ip route show`               192.168.1.0/24 dev eth0  proto kernel  scope link  src 192.168.1.4  metric 1      192.168.122.0/24 dev virbr0  proto kernel  scope link  src 192.168.122.1      169.254.0.0/16 dev eth0  scope link  metric 1000      default via 192.168.1.1 dev eth0  proto static       `ip addr show`               1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN          link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00         inet 127.0.0.1/8 scope host lo         inet6 ::1/128 scope host             valid_lft forever preferred_lft forever     2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1024 qdisc mq state UP qlen 1000         link/ether 00:26:2d:78:ac:61 brd ff:ff:ff:ff:ff:ff         inet 192.168.1.4/24 brd 192.168.1.255 scope global eth0     3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000         link/ether c4:17:fe:3b:56:ff brd ff:ff:ff:ff:ff:ff     4: virbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN          link/ether 5e:49:01:03:55:27 brd ff:ff:ff:ff:ff:ff         inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0         inet6 fe80::5c49:1ff:fe03:5527/64 scope link             valid_lft forever preferred_lft forever      I can send pings up to size 1468.               tim@milagros:/$ ping -M do -c 1 -s 1470 stackexchange.com     PING stackexchange.com (64.34.119.12) 1470(1498) bytes of data.        --- stackexchange.com ping statistics ---        1 packets transmitted, 0 received, 100% packet loss, time 0ms          tim@milagros:/$ ping -M do -c 1 -s 1468 stackexchange.com     PING stackexchange.com (64.34.119.12) 1468(1496) bytes of data.     1476 bytes from stackoverflow.com (64.34.119.12): icmp_seq=1 ttl=52 time=176 ms        --- stackexchange.com ping statistics ---        1 packets transmitted, 1 received, 0% packet loss, time 0ms        rtt min/avg/max/mdev = 176.539/176.539/176.539/0.000 ms                    tim@milagros:~/projekt/perl$ ifconfig eth0     eth0      Link encap:Ethernet  HWaddr 00:26:2d:78:ac:61                 inet addr:192.168.1.4  Bcast:192.168.1.255  Mask:255.255.255.0               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:161 errors:0 dropped:0 overruns:0 frame:0               TX packets:194 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:143947 (143.9 KB)  TX bytes:67727 (67.7 KB)               Interrupt:16


How can I run `watch` as a background job?

When I run:               watch 'cmd >> output.txt' &      the job gets suspended by the system: > 3569 Stopped (tty output) Is there a workaround?


What are software and hardware interrupts, and how are they processed?

I am not sure if I understand the concept of hardware and software interrupts. If I understand correctly, the purpose of a hardware interrupt is to get some attention of the CPU, part of implementing CPU multitasking.   1. Then what issues a hardware interrupt? Is it the hardware driver process?   2. If yes, where is the hardware driver process running? If it is running on the CPU, then it won't have to get attention of the CPU by hardware interrupt, right? So is it running elsewhere?   3. Does a hardware interrupt interrupt the CPU directly, or does it first contact the kernel process and the kernel process then contacts/interrupts the CPU? * * * On the other hand, I think the purpose of a software interrupt is for a process currently running on a CPU to request some resources.   1. What are the resources? Are they all in the form of running processes? For example, do CPU driver process and memory driver processes represent CPU and memory resources? Do the driver process of the I/O devices represent I/O resources? Are other running processes that the process would like to communicate with also resources?   2. If yes, does a software interrupt contact the processes (which represent the resources) indirectly via the kernel process? Is it right that unlike a hardware interrupt, a software interrupt never directly interrupts the CPU, but instead, it interrupts/contacts the kernel process?


how to prevent alias expansion by `eval` to an arbitrary alias, and keep the endless loop protection on a function?

IMPORTANT: do not use eval! (I learned this later..) In a function, `eval` expands `sleep` to its alias, so I prevent the endless loop this way:               function FUNCexecEcho() {        echo "EXEC: $@";       shopt -u expand_aliases       eval "$@";       shopt -s expand_aliases     };     alias sleep='FUNCexecEcho sleep ';     sleep 10      But then, all other aliases will stop working...   How to prevent expansion only to one arbitrary alias inside this function? PS.: the endless loop only happens on the second time you execute `sleep 10`


How to start an xterm from Nautilus, running in the folder I'm viewing?

This was easy in Thunar, but now I'm on a machine where I'm trying to do everything in the Gnome desktop world. In Nautilus, I'm in some deep-down folder. How do I open an xterm (rxvt, aterm, gnome's terminal app, whichever) with its working directory already set to the location Nautilus is showing?


How can I make the TTY use the appropriate charset?

**Note:** forked of this per recommendation here. * * * While I got the X keyboard layout right on my own after I fixed that stupid typo, I still can't set the console charset, key map, font map, or whatever you want to call it; even considering all [info] [on] the Arch wiki. For example, if I click the key for `Ç` (c cedilla), I get a damn `Ä` (majuscule `A` with a trema), `Tab` completion also gives this **wrong** non ASCII character on a TTY. I know the keyboard is right, if I pipe correct UTF-8 characters to a TTY, I get them wrong, and if I do it the other way around, they become right (say, to `/dev/pts/0`). I heard the console only has support for 128 (or is it 256?) characters at a time, but those can be set. I tried setting `FONT_MAP` on `/etc/vconsole.conf`, with no results. The file is now:               KEYMAP=pt-latin9     FONT=Lat2-Terminus16     FONT_MAP=8859-2      I think would solve the problem are those `MAP` variables. The worst is that these variables are poorly documented, both in the Arch Wiki, and in the `vconsole.conf` manual pages:               FONT=, FONT_MAP=, FONT_UNIMAP=         Configures the console font, the console map and the unicode font map.      How can I set them? Regarding other methods, I'm a bit confused of how I can apply what is in some of the more advanced articles. So far, I have simply copied `/usr/share/kbd/keymaps/i386/qwerty/pt-latin9.map.gz` to `/usr/local/share/kbd/keymaps/`, `gunzip`ed it, and read it while scratching my head. I'm sorry, even though I've had this problem since I have Arch as my system, this is to hard for me to find the solution on my own; so I hope you can help me.


What is the best practice for adding disks in LVM

According to the Linux manpages you can add raw disks as well as partitions to a volume group. In other documentation (RedHat, CentOS or openSUSE), all examples refer to adding partitions to the VG instead of raw disks. What is common (best) practice?


debian security /etc permissions

I'm setting up a debian box with shared webhhosts. These users don't have ssh permissions, just ftp. The users are allowed to use PHP and I setup `suphp` for that so the php processes runs under their own user account, etc. I'm a little bit worried about the security of the system files, especially the `/etc` folder. I notice that most files in this directory have permissions like:                   drwxr-xr-x  2 root root    4096 Mar  4 20:00 pam.d         -rw-r--r--  1 root root    1358 Mar  5 00:48 passwd         -rw-------  1 root root    1358 Mar  5 00:48 passwd-         drwxr-xr-x  2 root root    4096 Feb 18 14:22 pear         drwxr-xr-x  4 root root    4096 Apr 29  2010 perl         drwxr-xr-x  6 root root    4096 Feb 18 14:22 php5         drwxr-xr-x  2 root root    4096 Mar  4 17:42 phpmyadmin      Are the read-world permissions which debian standard gives the files in `/etc` really needed? What's the best mask I can give those files? Are there any files in `/etc` that should be world readable?


Where does Kali Linux mount smb shares

In Ubuntu I've noticed that smb shares are stored in `/home/{user}/.gvfs` directory. But In Kali there is nothing in this folder. So where is the SMB share folder in Kali. I've searched possible places like `/mnt`, `/media`. But I haven't found it. Could you please help me out?


Log output of GNU screen in real time?

I'm trying to get the output of a GNU Screen to a log file in real time. I've tried using tee, but that appears to not work with screen. The log function for screen will not work for this as it is not in real time, I'm pretty sure. Any ideas?


How can I shorten my customized PS1 prompt?

I currently have my prompt as               durrantm@Castle2012-Ubuntu-laptop01:~/Dropnot/webs/rails_apps/linker (master)     $       which I really like as it shows my username, machine, directory and git branch! How can I shorten the machine part though? i.e. how could In have it be:               durrantm@Castle...:~/Dropnot/webs/rails_apps/linker (master)     $       I tried various combination of h:0:6 but had no luck getting a correct syntax that would work. My .bashrc uses this:               function parse_git_branch () {       git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'     }          PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$(parse_git_branch)\n\$ '


Help with using rsync or cpio to do an incremental backup

I'm trying to do an incremental backup of all files on my NAS box that where modified in the last 24 hours (or so, can be more flexible). I'm using PuTTY to connect through SSH to a ReadyNAS 102 which has BusyBox v1.20.2 and uses Bash. I origianlly used: `find . -mtime -2 | cpio -cm /media/USB_FLASH_2` And then tried: `find . -mtime -2 | cpio -o | { cd /media/USB_FLASH_2 && cpio -imd; }` which got me the error: BusyBox v1.20.2 (Debian 1:1.20.0-7) multi-call binary. Usage: cpio [-dmvu] [-F FILE] [-H newc] [-tio] [EXTR_FILE]... Extract or list files from a cpio archive, or create an archive using file list on stdin Main operation mode: -t List -i Extract EXTR_FILEs (or all) -o Create (requires -H newc) -d Make leading directories -m Preserve mtime -v Verbose -u Overwrite -F FILE Input (-t,-i,-p) or output (-o) file -H newc Archive format.


Can one copy a relpath in one command?

I find myself doing this often enough that I wonder if there's a standard Unix way to do it:               % mkdir -p /TARGETDIR/relative/path/to     % cp ./relative/path/to/somefile /TARGETDIR/relative/path/to      In other words, I don't want to just copy `somefile` to `/TARGETDIR`, but actually I want to copy its entire _relative path_. Is there a simpler way to do this than the two-liner above?


dd command: Finding read/write throughput of a flash/SD?

I am running petalinux from sd card. And trying to find data copying rate from Sd card and from QSPI flash that is there on the Xilinx Zynq board. As suggested here , I am doing like this:               root@Xilinx-ZC702-14_7:/dev# echo 1 > /proc/sys/vm/drop_caches     root@Xilinx-ZC702-14_7:/dev# dd if=/dev/mtd2 of=/dev/null bs=128k count=200     84+0 records in     84+0 records out      But as per the above link it should also print the following lines:               26214400 bytes (25.0MB) copied, 5.971374 seconds, 4.2MB/s      That gives an idea of rate at which flash working. Why is this line missing in my case? Is there any alterantive to know this rate ?


Files with empty names

I was writing a widget for displaying files in a given directory and I wondered whether I need to cover the case where a file has an empty name. Testing showed not obvious results, so I was wondering whether someone has definite information               $ touch ""     touch: cannot touch `': No such file or directory          $ echo > ""     bash: : No such file or directory


Remove soft link but not the target

I have a directory that contains a link to another directory that I just created. I would like to remove the link but preserve the directory my link was pointing to. How do I do this?               > mkdir rgac     > ln -s /actual_dir_with_data/ /rgac/


Show completions under the prompt in Fish

Is there a way I can get the ultra compact auto-complete function from Zsh in Fish, so If I press `Tab` it won't write me all the possibilities permanently into my terminal but underneath the prompt?


autoreconf fails with 'Can't exec "libtoolize"'

Now I wanted to learn about autotools so I just started watching some tutorials on youtube. I made a folder named `hello`, and then made a `configure.ac` file:               AC_INIT([hello],[.01])     AC_OUTPUT       saved it and then ran `autoreconf -i` , obviously it didn't work the first time because it was not installed , then I installed `autoconf` by the command `sudo apt-get install autoconf2.13` . Now after this I again ran `autoreconf -i` but now I am getting the error as show below:               Can't exec "libtoolize": No such file or directory at /usr/bin/autoreconf2.50 line 196.     Use of uninitialized value in pattern match (m//) at /usr/bin/autoreconf2.50 line 196.


Ubuntu load and hang on live USB

I seem to have run into some difficulties trying to install Linux alongside my USB. I made a bootable USB stick and done all the UEFI firmware settings from which I disabled fast boot. Now when I run my USB from the boot menu, the first screen shown is the options for Linux: "try it for free", "install Ubuntu" and so on. Regardless of the option I choose, the screen just goes blank and that's it. Does anyone have any suggestions?


How to set CONFIG_PREEMPT_NONE in RHEL 6.4 (linux)

I am trying to tune the RHEL6.4 Kernel to handle server style load for of my application. With RHEL 6 scheduler has been changed to CFS and with RHEL 5 my application works fine. I would like change the preemptive option of the kernel to none. I don't know if changing this value in `/boot/config-2.6.32-358.el6.x86_64` will work or not. In addition I want to set the value to set in the `kernel.sched_features` for disabling preempt using the `sysctl` command.


How to redirect stdout and stderr to a file and display stderr to console?

I know how to redirect to a file, and use tee; on a basic level. So               $ alias outanderr='bash -c "echo stdout >&1; echo stderr >&2"'     # A fake "application" displaying both output and error messages.          $ outanderr 1>file      # redirect stdout to a file, display stderr     stderr          $ outanderr 2>file      # redirect stderr to a file, display stdout     stdout          $ outanderr 1>file 2>&1 # redirect both to a file, display nothing          $ outanderr | tee file; echo "-- file contents --" && cat file     # redirect stdout to a file, display both (note: order is messed up)     stderr     stdout     -- file contents --     stdout          $ outanderr 2>&1 | tee file; echo "-- file contents --" && cat file     # redirect both to a file, display both     stdout     stderr     -- file contents --     stdout     stderr      **The question is: what to write in place of the questionmarks to get the output below:**               $ outanderr ???; echo "-- file contents --" && cat file     # redirect both to a file, display stderr     stderr     -- file contents --     stdout     stderr      _Constaints:_   * Assuming bash.   * The order should be kept in the file.   * stderr contents are displayed in real time line by line, i.e. no buffering.   * Separate script files can be used.   * Magic may be necessary.


How do I create a folder with a username and date as the folder name?

I need to write a backup script. I need to be able to run the script from any computer and have it pull the username and date as the directory name. Each computer has an admin account and a user account. How can I pull the user account from a script and use it to name the backed up directory?


How to change a font/background color in transparent windows?

When you select something, the color of the selection usually changes to the font color, and the font color is being set to backgroud color. So, if you have a black background in a terminal, and the font is orange, you will get an orange selection and a black font color. What would happen if you had a transparent window, and the transparency was set to 100%? Just take a look at the following pics. The one with a black background: ![pic](http://i.stack.imgur.com/iID4T.png) And the transparent one: ![pic](http://i.stack.imgur.com/JYIqN.png) Is there a way to change the font/background color of transparent windows?


Booting directly in debian linux without giving username and password

I would like to skip the username and password prompt at boot-up from debian linux. I want to boot directly to the system without giving username and password.


How to run a remote sed command through ssh if the data includes double quotes ("")?

I'm trying to run through a list of servers and run the next command:               itaig@itaig-lt:~$ ssh root@$srvname "sed -i 's/VNCSERVERARGS[6]="-geometry 1920x1080"/VNCSERVERARGS[6]="-geometry 1152x864"/g' /etc/sysconfig/vncservers"      I've tried like that as well:               itaig@itaig-lt:~$ ssh root@$srvname "sed -i 's/VNCSERVERARGS[6]=\"-geometry 1920x1080\"/VNCSERVERARGS[6]=\"-geometry 1152x864\"/g' /etc/sysconfig/vncservers"     itaig@itaig-lt:~$      Both tries gave me a fresh prompt line and when checking the file on the remote machine nothing has changed. Is that possible to run such a command?


Running a cron job from another shell

I would like `cron` to run a script from a specific shell (Zsh). I thought the following would work:               00 02 * * * exec zsh; /path/to/script.sh      but apparently it doesn't, why? This also made me wonder, how do I find out what **shell** and **init scripts** does `cron` run first prior to running the entry in crontab?


How can I reverse the first part of a sentence?

I know that I can reverse any sentence: `echo "a,b,c,d" | rev` but what if I want to reverse only the first part of a sentence, I have tried this: `echo "a,b,c,d Access" | rev` and I get this: `sseccA d,c,b,a`, and what I really want is: `d,c,b,a Access` How can I do this?


Why am I getting horizontal tearing no matter what graphics card/distro/compositor/monitor I use?

This is a problem that has haunted me for years, and as a remedy I originally resorted to just using my Windows 7 partition. I've been back to using Linux for a long time now and would like to continue using it on the same machine, but my original problem persists. Basically, I get some crazy horizontal tearing that I can't seem to get rid of; when there's quick motion in video or games, it's very irritating. Here are some solutions I've already tried( **please read this before commenting** ):   * Enable "sync to vblank" in Nvidia settings.   * Turn on compositing   * Turn off compositing   * Set the vsync frequency in the compositor to that of the refresh rate of the monitor   * Use the non-free graphics driver   * Use the free graphics driver(example: nouveau)   * Turn off PowerMizer (a pretty lousy solution, even if it worked)   * Buy a new monitor   * Reinstall Linux   * Use a different distro   * Remove all other components and see what happens This same phenomena happens on Ubuntu, Mint, and Crunchbang. None of these communities could provide a working answer. I would prefer to use Crunchbang, so anyone with an answer applicable to Debian can help with this. My Nvidia graphics card is a GeForce GTX 660. The other graphics cards I have tried are an Nvidia(don't know the chipset), and an AMD/ATI(also don't know). The AMD card has more serious tearing, whereas the Nvidia cards usually just have a single-line tear. I have tried different monitors. I can't remember my last monitor, but right now I'm using a Samsung monitor with HDMI. Can this problem be caused by my motherboard? What can cause this?


start-stop-daemon doesn't stop programs which redirect stdout/stderr

I just discovered, that `start-stop-daemon` doesn't work well with programs redirecting their `stdout`/`stderr`:               # cat /root/_/1.sh     #!/usr/bin/env bash     set -eu     cmd="~yuri/_/${2:-1}.sh"     if [ "${3:-}" = redirect ]; then         cmd="$cmd >~yuri/_/stdout.log 2>~yuri/_/stderr.log"     fi     case $1 in     start)         start-stop-daemon --pidfile /var/run/1.pid --startas /bin/bash --name bash --user yuri \             --chuid yuri --background --make-pidfile --start -- -c "$cmd"         ;;     stop)         start-stop-daemon --pidfile /var/run/1.pid --exec /bin/bash --name bash --user yuri \             --stop         ;;     status)         pid=$(pgrep -u yuri -P 1 -x bash)         ps -fp "$pid"         ;;     esac          $ cat ~yuri/_/1.sh     #!/usr/bin/env bash     set -eu     echo stdout     echo stderr >&2     sleep 60          $ cat ~yuri/_/2.sh     #!/usr/bin/env bash     set -eu     echo stdout >~/_/stdout.log     echo stderr >~/_/stderr.log     sleep 60          # /root/_/1.sh start && sleep 1 && /root/_/1.sh status && /root/_/1.sh stop && sleep 1 && /root/_/1.sh status     UID        PID  PPID  C STIME TTY          TIME CMD     yuri      8259     1  0 22:49 ?        00:00:00 bash /home/yuri/_/1.sh          # /root/_/1.sh start 1 redirect && sleep 1 && /root/_/1.sh status && /root/_/1.sh stop && sleep 1 && /root/_/1.sh status     UID        PID  PPID  C STIME TTY          TIME CMD     yuri      9304     1  0 22:53 ?        00:00:00 /bin/bash -c ~yuri/_/1.sh >~yuri/_/stdout.log 2>~yuri/_/stderr.log     UID        PID  PPID  C STIME TTY          TIME CMD     yuri      9306     1  0 22:53 ?        00:00:00 bash /home/yuri/_/1.sh          # /root/_/1.sh start 2 && sleep 1 && /root/_/1.sh status && /root/_/1.sh stop && sleep 1 && /root/_/1.sh status     UID        PID  PPID  C STIME TTY          TIME CMD     yuri      9218     1  0 22:52 ?        00:00:00 bash /home/yuri/_/2.sh      Namely, `start-stop-daemon --stop` **restarts** the program instead of stopping it. Or so it seems. Am I doing it wrong? As far as I can tell, it's `\--no-close` option, that is supposed to remedy this. But I'm running `debian 6`, so the best solution I can think of right now is to compile `dpkg` package from sources (without installing it).So I mainly concerned with what goes wrong with using `squeeze`'s version of `start-stop-daemon`.


How do you remember command options?

I am curious to know what trick you use to remember options for various commands? Looking up man pages all the time is time consuming and not so cool!


Working with screen and emacs

I'm working with emacs (on the terminal) and I use screen to switch between terminals. The key combination `Ctrl`+`A` is grabbed by screen. Is there a way to change screen key binding?


Hosting my website from home

I'm looking to host a personal website from home. I have a good computer/software background but only a basic idea of how to properly host a site. The goal for the web hosting is to make the site(s) public on the www. The site is built, using PHP/MySql, and I'm familiar with how to get that to run in a "LAMP" environment, what I'm not familiar with is making it accessible to the world and the correct/safe/reliable ways to do so. I've got a box that is running FreeNAS right now but I'd like to convert it to a Linux server flavour, I was thinking Ubuntu with the GUI so that I could still run some of the same software I have running on the FreeNAS now for the household, and have the web hosting services on it as well. So my question(s) are as follows:   * Which server OS would do what I want, but not be too complicated for a beginner   * What additional software, or services should I install (i.e. Apache, Mysql, PHP etc...)   * What would be best practices to ensure home network security, and home server "section" security?      * Should I be running a VPN for additional security? I'm aware of the myriad of benefits of the VPN in general, I'm wondering about specifically in relation to web hosting from home. I'm not looking for any hand holding by any means, but if anyone could point me in the right direction that would be much appreciated.


How to shift filename numbers without collisions?

Consider this list of files:               $ touch index-{1,2,3,4,5,6,7,8,9}.txt      If I want to shift them _down_ so they start at zero, it's relatively easy:               $ rename --verbose 's/^index-([1-9])\.txt$/$1/; $_="index-" . ($_ - 1) . ".txt"' index-*.txt      This works because `man bash` specifies that globs are alphabetically sorted, so it will rename `index-1.txt` to `index-0.txt` _before_ renaming `index-2.txt` to `index-1.txt`. This breaks down if you want to shift _up_ , or if the numbers have _different lengths_ :               $ touch index-{10,11}.txt     $ rename --verbose 's/^index-([0-9]+)\.txt$/$1/; $_="index-" . ($_ + 1) . ".txt"' index-*.txt     index-10.txt not renamed: index-11.txt already exists     index-11.txt renamed as index-12.txt     index-1.txt not renamed: index-2.txt already exists      Possible long-term fixes:   * A `rename` option to try to reorder operations until there are no collisions.   * A `rename` option to move the files to a temporary directory first, and then move them back with the new name.   * A `rename` option to rename files in two steps, using unique names in the first step which won't collide with the original or new names.   * A way to do natural sorting + reversal of Bash globs. Is there a simple way to get around this?


How to determine Linux kernel architecture?

`uname -m` gives i686 and `uname -m` gives i686 i386 output in Red Hat Enterprise Linux Server release 5.4 (Tikanga) machine. I need to install Oracle Database 10g Release 2 on that machine. So, how can I decide whether kernel architecture is 32bit or 64bit?


How to check LVM mirroring under Linux?

How can I check the LVM mirroring under Linux? E.g.: are there any mirrors on a given machine & some details about them, etc.


How to revert chown command?

If I run:               sudo chown -R user:user /      Can I revert it to what it was before I ran it?


Encrypt boot file system

I just tried to set up Debian in a VM (just testing, before installing it on a real system). I have set up 4 drives in total. 2 drives that simulate pen drives, on which I want to install the boot loader and boot file system later, and another 2 drives. Every drive is configured as encrypted RAID1 (md0_crypt and md1_crypt). However, I can't put the boot filesystem on my md0_crypt, because I get the warning that one `cannot store the /boot FS on an encrypted partition, because it needs to load the kernel and initrd`. So, do I stand correctly that I cannot encrypt my /boot FS? Is the boot FS only for the boot loader (grub) or is there anything else? I would like to have the scenario that if I unplug my pen drive that the system can't be started anymore, since the /boot FS is installed on the pen drive.


Why does passing a HEREDOC as a string to `ruby -e` not work?

For reasons I don't understand, it seems to be impossible to pass a heredoc as an expression to a Ruby interpreter:               $ ruby -e <<END     heredoc> puts 'hi'     heredoc> END          ruby: no code specified for -e (RuntimeError)      The same thing happens with Perl, to make it painfully obvious that it has nothing to do with Ruby.               $ perl -e<<END     heredoc> print 'hi'     heredoc> END     No code specified for -e.      And even with `sed`:               $ echo "blah" | sed -e <<END     pipe heredoc> s/.*/Hi/     pipe heredoc> END     sed: option requires an argument -- e     usage: sed script [-Ealn] [-i extension] [file ...]            sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]      How can I pass a heredoc as an expression to Ruby? (or Perl, or Sed...)


Good Bye lvreduce, hello lvresize?

I've found a couple of times that using lvreduce, (first unmounting, shrinking ext4 with resize2fs, and fsck'ing) ends in:               mount: wrong fs type, bad option, bad superblock on /dev/mapper/sergiovhg-lv2,            missing codepage or helper program, or other error                 In some cases useful info is found in syslog - try            dmesg | tail or so.      However using the resize2fs tool with option -r works fine, eg:               lvresize  -r  -L600M ser`giovhg/lv2      Does anyone else has this kind of issue? I've found that "-r" makes the magic through fsadmin... am I wrong if I say that lvreduce and resize2fs are prone to errors? Thanks in advance!


Print text from terminal

I would like to use a Linux distro without a desktop environment, but I need to print out homework that I type up. I could always email it to myself and print from another computer, but it would be nice if I could just do something like `print homework.txt` from a bash prompt. Does anyone have a way of doing this?


Are there any guides on how to create a GRUB2 theme?

I'm going to turn my new Surface Pro 3 into a dual boot linux/Win 8.1 machine by following these instructions I found over at askubuntu. At the bottom of those instructions, the author created a spiffy GRUB2 theme to use. I would like to do something similar, but with my own graphics and the proper icon for whatever distro I choose (likely Mint). I'm just not sure how to do it. Are there any readily available tutorials/wikis/walkthroughs on how to create or edit a GRUB2 theme? My google-fu has failed me so far.


Is there a mock program that uses the CPU on multiple cores?

I am playing around with `htop`, `gprof`, etc. I'd like a program that basically just runs on multiple cores so I can profile it and learn how to use these tools. I know I can write my own `c++` code with `-fopenmp` and run a useless loop, but I was hoping there's a stock unix command I can use? Basically I just want a program that uses 100% of however many cores I tell it, until I ask it to stop. Does this exist?


Dual boot Mint on a Surface Pro 3?

I have a shiny new SP3 and I'd like to dual boot Mint 17 on it. I'm familiar with creating a dual boot system in general, but since the SP3 is a UEFI device, I'm a bit gun shy in this particular instance. I found these instructions at askubuntu, but I'm not sure if they're still relevant, or if there are any differences between Ubuntu and Mint I should be aware of. So, I basically just want to know:   1. Are the instructions I linked to above sufficient?    2. If not, what different/additional steps I should take?


How do you move files into the in-memory file system mounted at /dev/shm

Someone recently told me about /dev/shm. You all helped refine my understanding of what /dev/shm is What dev folder allows you tell the OS to cache something? The person who told me about /dev/shm said that I could use it to, say, unzip a big file more quickly than in a regular file system. I'm trying to do that now on an OS X machine. I run               sudo cp /Volumes/USB/rcv1rcv2aminigoutte.tar.bz2 /dev/shm      and get               cp: /dev/shm: Operation not supported      How do I load a file from the regular file system into the in memory file system mounted at /dev/shm Thanks as always. I learn a ton from asking questions on this site.


How can I use avahi without a network connection?

How can I test software that uses avahi while my laptop is disconnected from any router? All of the services run on the same machine, so Avahi would be advertising an IP address of 127.0.0.1 for all of the services. As an example, I am using a file at `/etc/avahi/services/postgresql.service` to register a database:               $ cat /etc/avahi/services/postgresql.service     <?xml version="1.0" standalone="no"?><!--*-nxml-*-->     <!DOCTYPE service-group SYSTEM "avahi-service.dtd">     <service-group>       <name>my_database_name</name>       <service>         <type>_postgresql._tcp</type>         <port>5432</port>       </service>     </service-group>      When I am connected to the router, `avahi-browse` shows the service:               $ avahi-browse -a | grep my_database_name     +  wlan0 IPv6 my_database_name                              PostgreSQL Server    local     +  wlan0 IPv4 my_database_name                              PostgreSQL Server    local      When I am disconnected from the router, `avahi-browse` no longer shows any services and my software cannot find the database:               $ avahi-browse -a      Here is my interface information when I am disconnected:               $ ifconfig     eth0      Link encap:Ethernet  HWaddr f0:de:f1:ac:a6:37                 UP BROADCAST MULTICAST  MTU:1500  Metric:1               RX packets:0 errors:0 dropped:0 overruns:0 frame:0               TX packets:0 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)               Interrupt:20 Memory:f3900000-f3920000           lo        Link encap:Local Loopback                 inet addr:127.0.0.1  Mask:255.0.0.0               inet6 addr: ::1/128 Scope:Host               UP LOOPBACK RUNNING  MTU:65536  Metric:1               RX packets:3637633 errors:0 dropped:0 overruns:0 frame:0               TX packets:3637633 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:1242209987 (1.2 GB)  TX bytes:1242209987 (1.2 GB)      I am running Ubuntu 14.04 but may need to do this on other distributions as well.


Pass a command to ROOT from a shell script and having it stay open

I am writing a bash script to perform some analysis using the program ROOT. I want to run some initial command to load the result of the analysis, then continue using ROOT interactively. The analysis part goes along well but the problem is that after `root` is executes my initial command, it closes immediately. So far I have tried the EOF (here-file) construct to pass my initial command and I am a bit unfamiliar with shell scripting so I would like to get your opinions on how to keep `ROOT` running after the execution of the script. That is I would like to see the ROOT prompt instead of the sytem prompt.               ./runReader.py SummerStd 140PU_NM1      root -l SummerStd_140PU_NM1_his.root << EOF     TBrowser a;     EOF      The above code executes the analysis then runs `root`; however, it immediately terminates and I have no time to inspect the TBrowser since I have the system prompt instead of the ROOT prompt. I would like control to stay at `root`'s command prompt after the script sends the `TBrowser` command to the program, so I can enter additional commands by hand.


How to use parameter substitution in glob pattern (zsh)

I want to process a bunch of files ending in some suffixes, so I wrote the following zsh script but it did not work.               EXT=(.jpg .png .gif)     EXT=${(j.|.)EXT}    # EXT becomes '.jpg|.png|.gif'     for f in *($EXT); do     # should become '*(.jpg|.png|.gif)' but failed         process-one-file $f     done      Why doesn't it work? How can I mix parameter substitution and glob pattern?


in which file is hostname alias persistent, if not /etc/hosts?

In order to have an alias for my server, which can be seen in a "hostname -a" command, I edited the /etc/hosts file to add the alias at the end of the entry containing the hostname. For example, my hostname is host1 and I want to have alias hostalias, I have below entry in /etc/hosts:                   192.168.0.1 host1 hostalias      With this change I am able to use "hostname -a" to see hostalias. However, I can change it only once! If I edit the file /etc/hosts again to something like this:                   192.168.0.1 host1 hostalias2      the output of "hostname -a" is still hostalias. Even after I remove the hostalias2 and reboot the server, it's still saying hostalias. BUT, if I change the alias the first time after reboot, it takes effect. So in fact I have two questions:   1. Where is the hostname alias persistent, if not /etc/hosts (so it can survive a reboot).   2. Why can it only be changed once per boot? More information: It is a RHEL 6.2 server.


audio recording - record two sources simultaneously, merge into a single 2-track recording

How can I record two audio sources at the same time and create a file where one source is the left channel and the other source is the right channel of a lossless stereo audio recording? My distro is Kubuntu 12.04 LTS. My audio source hardware is listed at bottom. Specifically, I believe the two sources I want to record at the same time are:   1. alsa_output.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo.monitor/#2: Monitor of Scarlett 2i2 USB Analog Stereo   2. alsa_input.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo/#3: Scarlett 2i2 USB Analog Stereo FYI, this question **_might_** be relevant (but I don't understand the command shown there): how to merge two audio input source using avconv EDIT: this definitely seems relevant, but I am struggling to understand it: http://ubuntuforums.org/showthread.php?t=1962947 My first **_guess_** about how to do this is this simple script:               #!/bin/bash     OUTPUT="audio_`date +%Y-%m-%d_%H%M`"     avconv \     -f alsa -ac 2 -i <alsa_output.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo.monitor> \     -f alsa -ac 1 -i <alsa_input.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo> \     -map 0:0 -map 1:0 \     -acodec flac \     -threads 0 \     -y $OUTPUT      I assume I need to replace what is in angle brackets with the correct notation. I have no idea if the rest of the above script is even close... Here's my hardware info:               $ pacmd list-cards       Welcome to PulseAudio! Use "help" for usage information.       >>> 3 card(s) available.       [snip other cards]     index: 2     name: <alsa_card.usb-Focusrite_Scarlett_2i2_USB-00-USB>     driver: <module-alsa-card.c>     owner module: 6     properties:             alsa.card = "1"             alsa.card_name = "Scarlett 2i2 USB"             alsa.long_card_name = "Focusrite Scarlett 2i2 USB at usb-0000:04:00.0-2, high speed"             alsa.driver_name = "snd_usb_audio"             device.bus_path = "pci-0000:04:00.0-usb-0:2:1.0"             sysfs.path = "/devices/pci0000:00/0000:00:1c.4/0000:04:00.0/usb3/3-2/3-2:1.0/sound/card1"             udev.id = "usb-Focusrite_Scarlett_2i2_USB-00-USB"             device.bus = "usb"             device.vendor.id = "1235"             device.vendor.name = "Novation EMS"             device.product.id = "8006"             device.product.name = "Scarlett 2i2 USB"             device.serial = "Focusrite_Scarlett_2i2_USB"             device.string = "1"             device.description = "Scarlett 2i2 USB"             module-udev-detect.discovered = "1"             device.icon_name = "audio-card-usb"     profiles:             output:analog-stereo: Analog Stereo Output (priority 6000)             output:analog-stereo+input:analog-stereo: Analog Stereo Duplex (priority 6060)             output:analog-stereo+input:iec958-stereo: Analog Stereo Output + Digital Stereo (IEC958) Input (priority 6055)             output:iec958-stereo: Digital Stereo (IEC958) Output (priority 5500)             output:iec958-stereo+input:analog-stereo: Digital Stereo (IEC958) Output + Analog Stereo Input (priority 5560)             output:iec958-stereo+input:iec958-stereo: Digital Stereo Duplex (IEC958) (priority 5555)             input:analog-stereo: Analog Stereo Input (priority 60)             input:iec958-stereo: Digital Stereo (IEC958) Input (priority 55)             off: Off (priority 0)     active profile: <output:analog-stereo+input:analog-stereo>     sinks:             alsa_output.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo/#1: Scarlett 2i2 USB Analog Stereo     sources:             alsa_output.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo.monitor/#2: Monitor of Scarlett 2i2 USB Analog Stereo             alsa_input.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo/#3: Scarlett 2i2 USB Analog Stereo     ports:             analog-output: Analog Output (priority 9900, available: unknown)                     properties:                  analog-input: Analog Input (priority 10000, available: unknown)                     properties:                  iec958-stereo-input: iec958-stereo-input (priority 0, available: unknown)                     properties:                  iec958-stereo-output: Digital Output (S/PDIF) (priority 0, available: unknown)                     properties:      lsusb -v shows the Focusrite_Scarlett_2i2 as:               Bus 003 Device 002: ID 1235:8006 Novation EMS        idVendor           0x1235 Novation EMS       idProduct          0x8006       Here is more info on this hardware:               $ aplay -l     **** List of PLAYBACK Hardware Devices ****     [snip]     card 1: USB [Scarlett 2i2 USB], device 0: USB Audio [USB Audio]       Subdevices: 1/1       Subdevice #0: subdevice #0          $ arecord -l     **** List of CAPTURE Hardware Devices ****     [snip]     card 1: USB [Scarlett 2i2 USB], device 0: USB Audio [USB Audio]       Subdevices: 1/1       Subdevice #0: subdevice #0


Home and End keys in a gnuplot interactive terminal do not move cursor

When working interactively with gnuplot, the home and end keys do not move the cursor to the beginning and end of a line, but instead produce the characters "OH" and "OF", respectively. What's the reason for this, and how can I get the cursor to move to the beginning and end of a command?


mailx change the direction of the mail

I use mailx to send mails from servers to me. The problem is that it comes as RTL and not LTR. How can I define it in the command? here is the command:               cat /tmp/monitor.log | mailx -s "Daily status of ${ihostname}" me@example.com


Regain control of an X Server

I have a Gnome session running on my server. I started it with tightvncserver. Now it wont let me in anymore because of > Too many authentication failures - client rejected This seems to be a known issue I don't want to kill the vncserver, as it probably will kill the current Gnome session. I have some rendering software running and don't want to lose the calculations. Any ideas how to get hold of the Gnome session again?


How to avoid cp -r ~/some/folder/ . copying all files to the current folder's top level?

( **Update:** this happens on Mac OS X -- I am using Mountain Lion.) It sometimes happen that I use the `tab` key to complete the path, so my command may be:               cp -r ~/some/folder/ .      but it turns out that the line above has a different behavior from               cp -r ~/some/folder .      the second line will copy the folder into the current directory, as `folder`, but the first line will copy all 7 files, 6 subfolders into the current directory, contaminating the current directory. Since I don't do any source control using git or svn in that particular current directory, it actually has to be cleaned up manually, and it is quite a pain. Is there a way to prevent this from happening? Such as by making a function, alias, or Bash setting? I know I can remember this, but 2 months down the road, I can actually accidentally do the same thing again, so it is better to guard against this behavior. (I would rather needing to use `cp -r ~/some/folder/* .` and `cp -r ~/some/folder/.* .` if that is what I really want.)


Connecting 2 monitors to a laptop

I have a laptop running `Fedora 15`, `Gnome 3.0.1`, and `Mobile Intel® GM45 Express Chipset`. I have a VGA monitor connected to it, as well as a DisplayPort to DVI adapter to connect a second monitor. Both monitors are detected by the system and I can use them individually, but not both at the same time. Both monitors are the same. When I try to activate the second monitor using `System Settings -> Display` I've seen different behaviors.   * Either the images (from the 3 screens) get overlapped on the first 2 screens, jumbled up.    * Or one of the screens (laptop or monitor) stays active but becomes invisible. Meaning the screen is dark, but the mouse travels over there and there are windows over there.   * As well as this:  `xrandr --output VGA1 --mode 1680x1050 --rate 60`   `xrandr: cannot find crtc for output VGA1` Error which occurs with either of the inactive monitor. Here's the output of `xrand`:               xrandr      Screen 0: minimum 320 x 200, current 3120 x 1050, maximum 8192 x 8192     LVDS1 connected 1440x900+1680+0 (normal left inverted right x axis y axis) 303mm x 190mm        1440x900       60.0*+   40.0          1024x768       60.0          800x600        60.3     56.2          640x480        59.9       VGA1 connected 1680x1050+0+0 (normal left inverted right x axis y axis) 433mm x 271mm        1680x1050      60.0*+        1280x1024      75.0     60.0          1280x960       60.0          1152x864       75.0          1024x768       75.1     70.1     60.0          832x624        74.6          800x600        72.2     75.0     60.3     56.2          640x480        72.8     75.0     66.7     60.0          720x400        70.1       HDMI1 disconnected (normal left inverted right x axis y axis)     DP1 connected (normal left inverted right x axis y axis)        1680x1050      60.0 +        1280x1024      75.0     60.0          1280x960       60.0          1152x864       75.0          1024x768       75.1     70.1     60.0          832x624        74.6          800x600        72.2     75.0     60.3     56.2          640x480        72.8     75.0     66.7     60.0          720x400        70.1       HDMI2 disconnected (normal left inverted right x axis y axis)     DP2 disconnected (normal left inverted right x axis y axis)     DP3 disconnected (normal left inverted right x axis y axis)      What else should I try to have all 3 displays active at the same time? Is it possible?


Transferring XFCE customization from one system to another?

I configured XFCE on my desktop at home and wanted to setup my work system with the same configurations (figured it'd just be copying a few files) or even a script? In the past I used to just mark the changes on paper and have to repeat myself with what ever desktop env I used. Is there an easier way to replicate personalization changes from one system to the next?


How to setup SVN server securely?

I am a linux newbie but I need to setup a SVN server and have the following 2 requirements: 1) Users to be able to authenticate automatically (with ssh keys, with no password) 2) The repositories to be secure, meaning that they can't be destroyed by the above users I have read a lot about using svn+ssh but it turns out that it doesn't use svnserve and every user has physical access to the repo, which means it can delete is easily. It is unacceptable and I can't figure out what authentication method to use in order to fulfill the above 2 requirements. Can you help?


Bind9 -- How to find which programs are making which dns lookups?

Using bind9 on a laptop shows lots of nonsense domains when network connectivity is down:               Oct 18 19:56:18 lap3 named[1536]: error (network unreachable) resolving './NS/IN': 128.63.2.53#53     Oct 18 19:56:18 lap3 named[1536]: error (network unreachable) resolving 'drgvlofubl/A/IN': 128.63.2.53#53     Oct 18 19:56:18 lap3 named[1536]: error (network unreachable) resolving 'gjpszynvcz/A/IN': 128.63.2.53#53     Oct 18 19:56:19 lap3 named[1536]: error (network unreachable) resolving 'iqgwbuxrbt/A/IN': 192.5.5.241#53      How do I find out which program is making these queries? Adding 'debug' to /etc/resolv.conf doesn't appear to do anything (laptop is running Arch linux and seems not compiled w/ debug support?). Next step is to compile libresolv with debug enabled, unless there's something better to do.


Linux Distrib with build in Web filter solution

Is there any distribution with a built in solution for web content filtering for my network?


How to put fixed-width, vertically-oriented key-value pairs in a CSV file?

I have a text file with the following type of content: `OPERATION_CONTEXT VMD1HTE1A71_ns:.oc.GJ_OAD2 alarm_object 1130 On director: VMD1HTE1A71_ns:.temip.VMD1HTE1A71_director AT Fri 18 Oct 2013 06:56:39 All Attributes`                                        Identifier = 1130                                   State = Terminated                          Problem Status = Closed                   Clearance Report Flag = True                         Escalated Alarm = False                   Close User Identifier = "Auto-Clear"             Termination User Identifier = "Auto-Clear"                        Close Time Stamp = Fri 18 Oct 2013 05:01:46                  Termination Time Stamp = Fri 18 Oct 2013 05:01:46                      Creation Timestamp = Fri 18 Oct 2013 04:37:29                    Clearance Time Stamp = Fri 18 Oct 2013 05:01:40             Last Modification Timestamp = Fri 18 Oct 2013 05:01:46                          Previous State = Outstanding                          Managed Object = Alcatel_5529OAD VMD1HTE1A71_ns:.OAD2 MD "AMS" Node "INGJJMGRJMTSNB0001AG2OLT001"                         Target Entities = { Alcatel_5529OAD VMD1HTE1A71_ns:.OAD2 MD "AMS" Node "INGJJMGRJMTSNB0001AG2OLT001" }                              Alarm Type = CommunicationsAlarm                              Event Time = Fri 18 Oct 2013 05:01:40                          Probable Cause = Unknown                       Specific Problems = {  }                 Notification Identifier = 160315                                  Domain = Domain VMD1HTE1A71_ns:.dm.GJ_OAD2                            Alarm Origin = IncomingAlarm                      Perceived Severity = Major                         Additional Text = "                                                                       nativeProbableCause: Attempt Threshold Crossed                                                                       osTime: 20131018163727.250+0530                                                                       neTime: 20131011174021.0+0530                                                                       notificationId: AMS:160315                                                                       portNumber:                                                                       ftpNumber:                                                                       meNm: INGJJMGRJMTSNB0001AG2OLT001                                                                       mdNm: AMS                                                                       objectType: OT_MANAGED_ELEMENT                                                                       aliasValue: MGMT Security                                           Access:INGJJMGRJMTSNB0001AG2OLT001:IP10.70.6.6.T0.S841 "                       Original Severity = Major                     Original Event Time = Fri 11 Oct 2013 05:40:21      I want to create a CSV file from this text file with Column headers as the values before = in each line like Identifier, State, Problem Status and all the next lines containing the values under each Column header like 1130, Terminated, Closed etc. Apart from the lines with "=" i don't want anything else to be extracted into the CSV file. Another complication i faced in this is, some fields have a new line character like Additional Text. I want to get all the value for Additional Text in one column under Additional Text Column. Since i am new to Linux/Unix, i am not able to find a way to do this. What is the best way to do this?


Emacs create cursor

Is there a way to create an additional "dummy" cursor in Emacs (preferably multiple)? Ideally I'd like to be able to set its color separately from the original cursor and set its position. Then I'd have the regular cursor that behaves normally, and I'd have multiple extra cursors whose position has to be set by some other means.


Adding another linux system to grub 2

As far as I can gather from the fedora website, I need to edit the `/etc/grub.d/40_custom` script to read:               menuentry "Arch Linux" {             set root=(hd0,5)             linux /boot/vmlinuz-linux             initrd /PATH_TO_initramfs??         }      How do I finish this, and what else do I need to modify such that I can boot into both OSes from my Fedora grub installation? EDIT: now that I got this working, I thing it is important to note that `grub2-mkconfig` must be run (or it may be named `grub-mkconfig`) in order for the changes to such scripts as the one mentioned above to take effect.


tmux exits abruptly right after loading

I just compiled my own version of `tmux` with `libevent`. Whenever I run tmux from zsh, tmux starts, but exits quickly returning `[exited]`. I read here that the problem could be my configuration for `default-command`, `default- shell`, but I don't have a `.tmux.conf` file on my home directory, and as far as I know there is no version of tmux installed on the system. Interestingly though, tmux runs correctly with:               tmux new $SHELL      I have also tried creating an empty `.tmux.conf` with no luck, and `tmux -v` does not output anything else. any thoughts? ## Additional Info 1/3: Below are the last few lines from `strace -f tmux`               [pid 30927] writev(6, [{"\33[?1049h\33(B\33[m\33[?1l\33>\33[H\33[2J\33[?1"..., 976}, {"                                "..., 195}], 2)   = 8     [pid 30927] close(6)                    = 0     [pid 30927] epoll_ctl(3, EPOLL_CTL_ADD, 8, {EPOLLIN|EPOLLOUT, {u32=8, u64=8}}) = 0     [pid 30927] epoll_ctl(3, EPOLL_CTL_DEL, 8, {EPOLLIN|EPOLLOUT, {u32=8, u64=8}}) = 0     [pid 30927] epoll_ctl(3, EPOLL_CTL_ADD, 8, {EPOLLIN|EPOLLOUT, {u32=8, u64=8}}) = 0     [pid 30927] clock_gettime(CLOCK_MONOTONIC, {3625108, 599513697}) = 0     [pid 30927] gettimeofday({1361992488, 675759}, NULL) = 0     [pid 30927] clock_gettime(CLOCK_MONOTONIC, {3625108, 599693697}) = 0     [pid 30927] gettimeofday({1361992488, 675933}, NULL) = 0     [pid 30927] epoll_wait(3, {{EPOLLOUT, {u32=8, u64=8}}}, 32, 692) = 1     [pid 30927] clock_gettime(CLOCK_MONOTONIC, {3625108, 599962697}) = 0     [pid 30927] gettimeofday({1361992488, 676202}, NULL) = 0     [pid 30927] epoll_ctl(3, EPOLL_CTL_DEL, 8, {EPOLLIN|EPOLLOUT, {u32=8, u64=8}}) = 0     [pid 30927] sendmsg(8, {msg_name(0)=NULL, msg_iov(1)=[{"\4\0\0\0\20\0\0\0\7\0\0\0\377\377\377\377", 16}], msg_controllen=0, msg_flags=0}, 0) = 16     [pid 30909] <... epoll_wait resumed> {{EPOLLIN, {u32=7, u64=7}}}, 32, 4294967295) = 1     [pid 30927] epoll_ctl(3, EPOLL_CTL_ADD, 8, {EPOLLIN, {u32=8, u64=8}} <unfinished ...>     [pid 30909] clock_gettime(CLOCK_MONOTONIC,  <unfinished ...>     [pid 30927] <... epoll_ctl resumed> )   = 0     [pid 30909] <... clock_gettime resumed> {3625108, 600611697}) = 0     [pid 30927] clock_gettime(CLOCK_MONOTONIC,  <unfinished ...>     [pid 30909] gettimeofday( <unfinished ...>     [pid 30927] <... clock_gettime resumed> {3625108, 600777697}) = 0     [pid 30909] <... gettimeofday resumed> {1361992488, 676953}, NULL) = 0     [pid 30927] gettimeofday( <unfinished ...>     [pid 30909] epoll_ctl(3, EPOLL_CTL_DEL, 7, {EPOLLIN, {u32=7, u64=7}} <unfinished ...>     [pid 30927] <... gettimeofday resumed> {1361992488, 677094}, NULL) = 0     [pid 30909] <... epoll_ctl resumed> )   = 0     [pid 30927] clock_gettime(CLOCK_MONOTONIC,  <unfinished ...>     [pid 30909] recvmsg(7,  <unfinished ...>     [pid 30927] <... clock_gettime resumed> {3625108, 601290697}) = 0     [pid 30927] gettimeofday( <unfinished ...>     [pid 30909] <... recvmsg resumed> {msg_name(0)=NULL, msg_iov(1)=[{"\4\0\0\0\20\0\0\0\7\0\0\0\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 65535}], msg_controllen=0, msg_flags=0}, 0) = 16     [pid 30927] <... gettimeofday resumed> {1361992488, 677801}, NULL) = 0     [pid 30909] epoll_wait(3,  <unfinished ...>     [pid 30927] epoll_wait(3,  <unfinished ...>     [pid 30909] <... epoll_wait resumed> {}, 32, 0) = 0     [pid 30909] clock_gettime(CLOCK_MONOTONIC, {3625108, 601921697}) = 0     [pid 30909] gettimeofday({1361992488, 678171}, NULL) = 0     [pid 30909] fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 14), ...}) = 0     [pid 30909] mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b4474914000     [pid 30909] write(1, "[exited]\n", 9[exited]     )   = 9     [pid 30909] getppid()                   = 30904     [pid 30909] fcntl(0, F_GETFL)           = 0x8002 (flags O_RDWR|O_LARGEFILE)     [pid 30909] fcntl(0, F_SETFL, O_RDWR|O_LARGEFILE) = 0     [pid 30909] exit_group(0)               = ?     <... epoll_wait resumed> {{EPOLLIN|EPOLLHUP, {u32=8, u64=8}}}, 32, 691) = 1     clock_gettime(CLOCK_MONOTONIC, {3625108, 604208697}) = 0     gettimeofday({1361992488, 680447}, NULL) = 0     epoll_ctl(3, EPOLL_CTL_DEL, 8, {EPOLLIN, {u32=8, u64=8}}) = 0     recvmsg(8, {msg_name(0)=NULL, msg_iov(1)=[{"\5\0\0\0\20\0\0\0\7\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\0\0\177\0\0"..., 65535}], msg_controllen=0, msg_flags=0}, 0) = 0     close(8)                                = 0     close(9)                                = 0     close(10)                               = 0     close(11)                               = 0     close(12)                               = 0     close(13)                               = 0     close(14)                               = 0     close(15)                               = 0     epoll_ctl(3, EPOLL_CTL_DEL, 7, {EPOLLIN, {u32=7, u64=7}}) = 0     epoll_ctl(3, EPOLL_CTL_ADD, 7, {EPOLLIN, {u32=7, u64=7}}) = 0     stat("/tmp/tmux-4887/default", {st_mode=S_IFSOCK|0770, st_size=0, ...}) = 0     chmod("/tmp/tmux-4887/default", 0140660) = 0     exit_group(0)                           = ?     Process 30927 detached      ## Additional Info 2/3: Below is the output of `cat tmux-server-23582.log` from `tmux -v`:               > cat tmux-server-23590.log      server started, pid 23590     socket path /tmp/tmux-4887/default     new client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 14 from client 8     got 6 from client 8     got 0 from client 8     new term: xterm-256color     xterm-256color override: colors 256     xterm-256color override: XT      xterm-256color override: Ms ]52;%p1%s;%p2%s     xterm-256color override: Cc      xterm-256color override: Cr ]112     xterm-256color override: Cs [%p1%d q     xterm-256color override: Csr [2 q     new key Oo: 0x1021 (KP/)     new key Oj: 0x1022 (KP*)     new key Om: 0x1023 (KP-)     new key Ow: 0x1024 (KP7)     new key Ox: 0x1025 (KP8)     new key Oy: 0x1026 (KP9)     new key Ok: 0x1027 (KP+)     new key Ot: 0x1028 (KP4)     new key Ou: 0x1029 (KP5)     new key Ov: 0x102a (KP6)     new key Oq: 0x102b (KP1)     new key Or: 0x102c (KP2)     new key Os: 0x102d (KP3)     new key OM: 0x102e (KPEnter)     new key Op: 0x102f (KP0)     new key On: 0x1030 (KP.)     new key OA: 0x101d (Up)     new key OB: 0x101e (Down)     new key OC: 0x1020 (Right)     new key OD: 0x101f (Left)     new key [A: 0x101d (Up)     new key [B: 0x101e (Down)     new key [C: 0x1020 (Right)     new key [D: 0x101f (Left)     new key Oa: 0x501d (C-Up)     new key Ob: 0x501e (C-Down)     new key Oc: 0x5020 (C-Right)     new key Od: 0x501f (C-Left)     new key [a: 0x901d (S-Up)     new key [b: 0x901e (S-Down)     new key [c: 0x9020 (S-Right)     new key [d: 0x901f (S-Left)     new key [11^: 0x5002 (C-F1)     new key [12^: 0x5003 (C-F2)     new key [13^: 0x5004 (C-F3)     new key [14^: 0x5005 (C-F4)     new key [15^: 0x5006 (C-F5)     new key [17^: 0x5007 (C-F6)     new key [18^: 0x5008 (C-F7)     new key [19^: 0x5009 (C-F8)     new key [20^: 0x500a (C-F9)     new key [21^: 0x500b (C-F10)     new key [23^: 0x500c (C-F11)     new key [24^: 0x500d (C-F12)     new key [25^: 0x500e (C-F13)     new key [26^: 0x500f (C-F14)     new key [28^: 0x5010 (C-F15)     new key [29^: 0x5011 (C-F16)     new key [31^: 0x5012 (C-F17)     new key [32^: 0x5013 (C-F18)     new key [33^: 0x5014 (C-F19)     new key [34^: 0x5015 (C-F20)     new key [2^: 0x5016 (C-IC)     new key [3^: 0x5017 (C-DC)     new key [7^: 0x5018 (C-Home)     new key [8^: 0x5019 (C-End)     new key [6^: 0x501a (C-NPage)     new key [5^: 0x501b (C-PPage)     new key [11$: 0x9002 (S-F1)     new key [12$: 0x9003 (S-F2)     new key [13$: 0x9004 (S-F3)     new key [14$: 0x9005 (S-F4)     new key [15$: 0x9006 (S-F5)     new key [17$: 0x9007 (S-F6)     new key [18$: 0x9008 (S-F7)     new key [19$: 0x9009 (S-F8)     new key [20$: 0x900a (S-F9)     new key [21$: 0x900b (S-F10)     new key [23$: 0x900c (S-F11)     new key [24$: 0x900d (S-F12)     new key [25$: 0x900e (S-F13)     new key [26$: 0x900f (S-F14)     new key [28$: 0x9010 (S-F15)     new key [29$: 0x9011 (S-F16)     new key [31$: 0x9012 (S-F17)     new key [32$: 0x9013 (S-F18)     new key [33$: 0x9014 (S-F19)     new key [34$: 0x9015 (S-F20)     new key [2$: 0x9016 (S-IC)     new key [3$: 0x9017 (S-DC)     new key [7$: 0x9018 (S-Home)     new key [8$: 0x9019 (S-End)     new key [6$: 0x901a (S-NPage)     new key [5$: 0x901b (S-PPage)     new key [11@: 0xd002 (C-S-F1)     new key [12@: 0xd003 (C-S-F2)     new key [13@: 0xd004 (C-S-F3)     new key [14@: 0xd005 (C-S-F4)     new key [15@: 0xd006 (C-S-F5)     new key [17@: 0xd007 (C-S-F6)     new key [18@: 0xd008 (C-S-F7)     new key [19@: 0xd009 (C-S-F8)     new key [20@: 0xd00a (C-S-F9)     new key [21@: 0xd00b (C-S-F10)     new key [23@: 0xd00c (C-S-F11)     new key [24@: 0xd00d (C-S-F12)     new key [25@: 0xd00e (C-S-F13)     new key [26@: 0xd00f (C-S-F14)     new key [28@: 0xd010 (C-S-F15)     new key [29@: 0xd011 (C-S-F16)     new key [31@: 0xd012 (C-S-F17)     new key [32@: 0xd013 (C-S-F18)     new key [33@: 0xd014 (C-S-F19)     new key [34@: 0xd015 (C-S-F20)     new key [2@: 0xd016 (C-S-IC)     new key [3@: 0xd017 (C-S-DC)     new key [7@: 0xd018 (C-S-Home)     new key [8@: 0xd019 (C-S-End)     new key [6@: 0xd01a (C-S-NPage)     new key [5@: 0xd01b (C-S-PPage)     new key OP: 0x1002 (F1)     new key OQ: 0x1003 (F2)     new key OR: 0x1004 (F3)     new key OS: 0x1005 (F4)     new key [15~: 0x1006 (F5)     new key [17~: 0x1007 (F6)     new key [18~: 0x1008 (F7)     new key [19~: 0x1009 (F8)     new key [20~: 0x100a (F9)     new key [21~: 0x100b (F10)     new key [23~: 0x100c (F11)     new key [24~: 0x100d (F12)     new key O2P: 0x100e (F13)     new key O2Q: 0x100f (F14)     new key O2R: 0x1010 (F15)     new key O2S: 0x1011 (F16)     new key [15;2~: 0x1012 (F17)     new key [17;2~: 0x1013 (F18)     new key [18;2~: 0x1014 (F19)     new key [19;2~: 0x1015 (F20)     new key [2~: 0x1016 (IC)     new key [3~: 0x1017 (DC)     new key OH: 0x1018 (Home)     new key OF: 0x1019 (End)     new key [6~: 0x101a (NPage)     new key [5~: 0x101b (PPage)     new key [Z: 0x101c (BTab)     replacing key OA: 0x101d (Up)     replacing key OB: 0x101e (Down)     replacing key OD: 0x101f (Left)     replacing key OC: 0x1020 (Right)     new key [3;2~: 0x9017 (S-DC)     new key [1;2B: 0x901e (S-Down)     new key [1;5B: 0x501e (C-Down)     new key [1;6B: 0xd01e (C-S-Down)     new key [1;2F: 0x9019 (S-End)     new key [1;2H: 0x9018 (S-Home)     new key [2;2~: 0x9016 (S-IC)     new key [1;2D: 0x901f (S-Left)     new key [1;5D: 0x501f (C-Left)     new key [1;6D: 0xd01f (C-S-Left)     new key [6;2~: 0x901a (S-NPage)     new key [5;2~: 0x901b (S-PPage)     new key [1;2C: 0x9020 (S-Right)     new key [1;5C: 0x5020 (C-Right)     new key [1;6C: 0xd020 (C-S-Right)     new key [1;2A: 0x901d (S-Up)     new key [1;5A: 0x501d (C-Up)     new key [1;6A: 0xd01d (C-S-Up)     session 0 created     writing 8 to client 8     keys are 12 ([>1;3400;0c)     received xterm version 3400     input_parse: '/' ground     input_parse: 'h' ground     input_parse: 'o' ground     input_parse: 'm' ground     input_parse: 'e' ground     input_parse: '/' ground     input_parse: 'j' ground     input_parse: 'o' ground     input_parse: 'h' ground     input_parse: 'n' ground     input_parse: '/' ground     input_parse: '.' ground     input_parse: 'z' ground     input_parse: 'p' ground     input_parse: 'r' ground     input_parse: 'o' ground     input_parse: 'f' ground     input_parse: 'i' ground     input_parse: 'l' ground     input_parse: 'e' ground     input_parse: ':' ground     input_parse: '2' ground     input_parse: ':' ground     input_parse: ' ' ground     input_parse: 'n' ground     input_parse: 'o' ground     input_parse: ' ' ground     input_parse: 's' ground     input_parse: 'u' ground     input_parse: 'c' ground     input_parse: 'h' ground     input_parse: ' ' ground     input_parse: 'f' ground     input_parse: 'i' ground     input_parse: 'l' ground     input_parse: 'e' ground     input_parse: ' ' ground     input_parse: 'o' ground     input_parse: 'r' ground     input_parse: ' ' ground     input_parse: 'd' ground     input_parse: 'i' ground     input_parse: 'r' ground     input_parse: 'e' ground     input_parse: 'c' ground     input_parse: 't' ground     input_parse: 'o' ground     input_parse: 'r' ground     input_parse: 'y' ground     input_parse: ':' ground     input_parse: ' ' ground     input_parse: '/' ground     input_parse: 'n' ground     input_parse: '/' ground     input_parse: 's' ground     input_parse: 'w' ground     input_parse: '/' ground     input_parse: 'z' ground     input_parse: 's' ground     input_parse: 'h' ground     input_parse: '-' ground     input_parse: '4' ground     input_parse: '.' ground     input_parse: '3' ground     input_parse: '.' ground     input_parse: '1' ground     input_parse: '4' ground     input_parse: '/' ground     input_parse: 'b' ground     input_parse: 'i' ground     input_parse: 'n' ground     input_parse: '/' ground     input_parse: 'z' ground     input_parse: 's' ground     input_parse: 'h' ground     ' groundrse: '     input_c0_dispatch: '     input_parse: '     ' ground     input_c0_dispatch: '          session 0 destroyed     writing 3 to client 8     got 5 from client 8     writing 4 to client 8     lost client 8      ## Additional Info 3/3: And below is the output of `cat tmux-client-23582.log` from `tmux -v`: > cat tmux-client-23582.log got 8 from server got 3 from server got 4 from > server


Grep patterns in selected lines

How to keep rows containing `pattern 1` only if the next line contains `pattern 2` and starts with `pattern 3` ? Exemple: keep line starting with an `A` only if the next line starts with a `B` and contains the pattern `B1` Input file               A   item1A     B   item1B2     A   item2A     A   item3A     B   item3B1     B   item3CB1     B   item3B2     A   item5A     B   item5B1     A   item6A      Expected output:               A   item3A     B   item3B1     B   item3CB1     A   item5A     B   item5B1      ( I'm currently trying with `grep -e ^A -e B1` but the side effect is that all `A` s lines are kept )


How to debug random reboots, with no kernel panic, of an embedded system?

I have two aValue RPC-10W1 embedded systems that reboots by themselves after 1-2 hours. Facts:   * The board will reboot within a time span of 1 to 2½ hours.   * The issue is present on two identical systems.   * The issue is present using aValue's own Linux firmware (Ubuntu 10.04).   * The issue is present with nothing other than power supply connected.   * The board is using Linux kernel 2.6.35.3.   * No kernel panic is shown in terminal. The Linux terminal is directed to a serial port at bootup.   * No warnings or errors are shown from `dmesg`. Things I've tried:   * Different root file systems:      * Stock Ubuntu 10.04 from aValue.     * Custom minimal file system created using LTIB. In aValue's user manual they describe how to use LTIB for their board.   * Compile my own kernel using the kernel sources supplied from aValue (came on a CD). Things I haven't tried:   * Check if the issue is present on their Android or WinCE releases. I've compared the Linux kernel source I received from aValue with the Freescale kernel source and they are the same + a huge single patch file from aValue. How can I proceed to determine what is causing these reboots?


Add <script> to the bottom of a html file?

I have a bunch of HTML files, and I need to add `<script src="ga.js"></script>` before each search instance of "`</body></html>`". How would I add that to the bottom of all these files?


RIPEMD-160 file digest

How can I make a file digest under Linux with the RIPEMD-160 hash function, from the command line?


How can I verify SSL certificates on the command line?

I'm trying to validate/verify that the rsa key, ca-bundle, and certificate stored here are ok. They are not being served by a webserver. How can I verify them?


Problem with java3d

I want to play this java simulation: http://www.compadre.org/OSP/items/detail.cfm?ID=9640 in java 3d mode on a linux (ubuntu) system. But it doesn't work. If I switch to java 3d-mode it complains that java 3d is not installed. `sudo aptitude install libjava3d-java` didn't help. Then I did a right click in this java app and selected Diagnostics-> About Java 3D. Then I get the message: > Java 3D was not found in: > /usr/lib/jvm/java-6-openjdk-i386/jre/lib/ext:/usr/java/packages/lib/ext Then I tried               cp /usr/share/java/*3d* \         /usr/lib/jvm/java-6-openjdk-i386/jre/lib/ext`      but I get the same error message again. I start the java app like this:               java -jar ejs_astronomy_SolarLunarEclipse.jar      I tried this on two systems, one freshly installed and also switched from openjdk to sun-jdk temporarily without any effect. Any idea how I can get this work?