Launching a program and executing a command in bash script

How can I execute a command inside ROOT that I launch within the bash script? My aim is to have ROOT execute its GUI file browser and have it open if the user does not interfere with keyboard commands. I tried but failed since the GUI file browser stays open for a really short period of time. Is it possible that I modify the bash script and have the program open when the script terminates? The description of ROOT can be found in the following link: http://root.cern.ch/drupal/


Is there a difference of stability between Linux distros?

I've using Debian since 2010 for some home purposes and it has been stable. Is Debian still a good option if I need a server for heavy network, cpu, disk and memory usage? Last month I listened to some admins say that RedHat is the most stable in bulk operations and that CentOS is a free version of RHEL. Their opinion is that CentOS is the best free distro. CentOS is getting very popular in my country (Dominican Republic) and I've wondered if Debian is getting behind. Can RedHat, Debian, CentOS or Suse be used for bulk operations servers?


Spawn multiple dirty page flusher threads per device

In earlier `2.6.X` kernels, `pdflush` was used and it would spawn more `pdflush` threads if all current `pdflush` threads were busy for a second (read from The Linux Page Cache and pdflush). Since the `2.6.32` kernel, `pdflush` has been replaced by per-backing-device threads that are named `flush-MAJOR` (read from Linux 2 6 32 - Linux Kernel Newbies). **Is there a way to spawn multiple`flush-MAJOR` threads for a single backing device?** I am currently writing a large amount of data to a disk and while this is happening I am seeing the `[flush-8:32]` process at almost 100% cpu in `top`. I am wondering if there is a way to spawn more `flush-MAJOR` threads for a particular device that has a heavy I/O load. I don't know if it will help performance, but I would like to see what it does. I saw evidence that multiple flusher threads per device should be supported in Flushing out pdflush: > After review of the first attempt, Jens added functionality of having > multiple flusher threads per device based on the suggestions of Andrew > Morton. But I have no idea how to make this happen or if it happens automatically and I am missing it. I am running RHEL 6.4 with a 2.6.32-358.el6.x86_64 kernel.


I am getting the following error message when trying to bring up ./oc4j service (`oc4j_extended_101350.zip`).                       [oracle@sc-ifactory01p bin]$ ./oc4j -start             Starting OC4J from /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home ...             2014-08-01 14:09:28.682 NOTIFICATION Auto-unpacking /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/applications/dms.war...             2014-08-01 14:09:28.687 NOTIFICATION Unjar /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/applications/dms.war in /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/applications/dms             2014-08-01 14:09:28.692 NOTIFICATION Finished auto-unpacking /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/applications/dms.war             2014-08-01 14:09:28.693 NOTIFICATION Auto-unpacking /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/applications/JMXSoapAdapter-web.war...             2014-08-01 14:09:28.693 NOTIFICATION Unjar /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/applications/JMXSoapAdapter-web.war in /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/applications/JMXSoapAdapter-web             2014-08-01 14:09:28.698 NOTIFICATION Finished auto-unpacking /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/applications/JMXSoapAdapter-web.war             2014-08-01 14:09:28.736 NOTIFICATION Auto-unpacking /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/applications/jmsrouter.war...             2014-08-01 14:09:28.736 NOTIFICATION Unjar /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/applications/jmsrouter.war in /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/applications/jmsrouter             2014-08-01 14:09:28.739 NOTIFICATION Finished auto-unpacking /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/applications/jmsrouter.war             2014-08-01 14:09:28.746 NOTIFICATION Auto-unpacking /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/connectors/datasources/datasources.rar...             2014-08-01 14:09:28.747 NOTIFICATION Unjar /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/connectors/datasources/datasources.rar in /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/connectors/datasources/datasources             2014-08-01 14:09:28.748 NOTIFICATION Finished auto-unpacking /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/connectors/datasources/datasources.rar             2014-08-01 14:09:28.749 NOTIFICATION Auto-unpacking /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/connectors/OracleASjms/OracleASjms.rar...             2014-08-01 14:09:28.749 NOTIFICATION Unjar /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/connectors/OracleASjms/OracleASjms.rar in /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/connectors/OracleASjms/OracleASjms             2014-08-01 14:09:28.760 NOTIFICATION Finished auto-unpacking /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/connectors/OracleASjms/OracleASjms.rar             Aug 1, 2014 2:09:28 PM com.evermind.server.XMLDataSourcesConfig parseRootNode             INFO: Legacy datasource detected...attempting to convert to new syntax.             2014-08-01 14:09:28.778 NOTIFICATION Auto-unpacking /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/applications/javasso.ear...             2014-08-01 14:09:28.778 NOTIFICATION Unjar /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/applications/javasso.ear in /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/applications/javasso             2014-08-01 14:09:28.780 NOTIFICATION Finished auto-unpacking /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/applications/javasso.ear             2014-08-01 14:09:28.786 NOTIFICATION Auto-unpacking /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/applications/javasso/javasso-web.war...             2014-08-01 14:09:28.786 NOTIFICATION Unjar /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/applications/javasso/javasso-web.war in /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/applications/javasso/javasso-web             2014-08-01 14:09:28.790 NOTIFICATION Finished auto-unpacking /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/applications/javasso/javasso-web.war             2014-08-01 14:09:28.793 NOTIFICATION Auto-unpacking /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/applications/ascontrol.ear...             2014-08-01 14:09:28.793 NOTIFICATION Unjar /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/applications/ascontrol.ear in /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/applications/ascontrol             2014-08-01 14:09:29.281 NOTIFICATION Finished auto-unpacking /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/applications/ascontrol.ear             2014-08-01 14:09:29.283 NOTIFICATION Auto-unpacking /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/applications/ascontrol/ascontrol.war...             2014-08-01 14:09:29.283 NOTIFICATION Unjar /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/applications/ascontrol/ascontrol.war in /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/applications/ascontrol/ascontrol             2014-08-01 14:09:30.148 NOTIFICATION Finished auto-unpacking /apps/prd/oracle/10.1.3.5.0/oc4j/j2ee/home/applications/ascontrol/ascontrol.war             14/08/01 14:09:30 Error initializing server: OC4J administrator account is not configured correctly. Please make sure that at least one administration account is created and configured correctly.             14/08/01 14:09:30 Fatal error: server exiting      I am running this on RHEL 6.5 physical 64bit platform. I have pointed `jdk1.6.0_45` for JAVA_HOME. I am able to bring it up on a VM which has same RHEL 6.5 64bit platform. I tried everything that I and google can think of but can't seems to figure this one out. There are some users reported to add hostname on /etc/hosts file which I have already tried but didn't work on my physical system. Let me know if you have suggestions.


Trying to install fedora 19 beta TC3 (lxde spin) in virtualbox

I am trying to install fedora 19 beta TC3 (lxde spin), iso image from here:               https://dl.fedoraproject.org/pub/alt/stage/19-Beta-TC3/Live/x86_64/      I have virtualbox running in my Lubuntu 13.04 raring ringtail. When trying to install there, just after saying "install", it stops with message:               tsc:  fast TSC calibration failed      (this also happened with earlier images, like alpha and beta TC2) What am I doing wrong?


IPTables DNAT rule to local web server doesn't work with localhost?

I have linux box functioning as Wireless Access Point. Wireless clients connect and then browse the web. I am only allowing port 80. There are certain sites I'd like to block, but not by dropping the packet, but by redirecting them to a blocked.html page being served by a local web server. I have two nics. The one on the internet side is bound to 10.0.2.15. If I do a DNAT rule to redirect traffic to my web server using the internet NIC, the page is returned. If i redirect to 127.0.0.1, it is not. Why is that? Here is my IPTables configuration:               # iptables -S     -P INPUT DROP     -P FORWARD ACCEPT     -P OUTPUT DROP     -A INPUT -i lo -j ACCEPT      -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT      -A INPUT -p tcp -m tcp --sport 80 -j ACCEPT      -A OUTPUT -o lo -j ACCEPT      -A OUTPUT -p tcp -m tcp --dport 80 -j ACCEPT      -A OUTPUT -p tcp -m tcp --sport 80 -j ACCEPT      # iptables -t nat -S     -P PREROUTING ACCEPT     -P INPUT ACCEPT     -P OUTPUT ACCEPT     -P POSTROUTING ACCEPT     -N block-chain     -A PREROUTING -j block-chain      -A POSTROUTING -o eth1 -j MASQUERADE      # THIS WILL NOT RETURN THE PAGE TO THE CLIENT     -A block-chain -d 206.190.36.45/32 -p tcp -j DNAT --to-destination 127.0.0.1:80      # THIS WILL     -A block-chain -d 206.190.36.45/32 -p tcp -j DNAT --to-destination 10.0.2.15:80      -A block-chain -j RETURN


How can I create files in my home directory without root?

I created a user, then using root I created a folder for him. The folder has the same name as the user. When I am logged in as the user, I cannot create files or edit existing ones without using sudo. I used the command `useradd elephant` then created a password for him using `passwd elephant`. I'm running a fresh install of Arch Linux. Is there anything obvious that I am forgetting?


Determine FQDN when hostname doesn't give it?

In another question, I found that Puppet was generating certificates for my machine's FQDN but not the simple host name. In that example, `kungfumaster` was the hostname and was the value retrieved by running `hostname`. Puppet was generating certificates which specified the FQDN `kungfumaster.domain.com`. How did Puppet determine that this was my FQDN? I have tried all of the following and not seen anything matching `*.domain.com`:               $ hostname -a && hostname -d && hostname --domain && hostname -f && \          hostname --fqdn && hostname -A && hostname --long          kungfumaster     kungfumaster     kungfumaster      kungfumaster      How can I get `kungfumaster.domain.com` from Bash? I've noticed that `domain.com` does in fact exist in `/etc/resolv.conf`, but I haven't been able to find it anywhere else. I basically want to get the FQDN of the current machine as a string. The other solutions here on unix.se haven't worked for me. (ie: `dnsdomainname`, `domainname`, etc.)


Which live USB distribution offers selective persistence?

I'm looking for a **live USB Linux distribution that would offer semi- persistent functionality**. What I mean by that - **normally the system should work in a non-persistent mode** (read-only) and no writes should be performed to the medium at all. Occasionally, after controlled updates to the system, **I should be able to manually save the changes from that particular session** without remastering the original image (be it by CLI, a "save button" or entry in the shutdown menu). I used an old version of _Slax_ (version 5, maybe 4) for that very purpose a long time ago. Unfortunately, I would need something more recent now (current Wi-Fi drivers, browsers etc.). Most of the distributions I've encountered now either allow full persistence or none. The best I've found is selectively discarding changes per session, but still writing to the medium (unnecessary wear on the drive). Additionally, it would be nice if the distribution would load from power on to a working desktop completely unattended, surely the faster the better (but it's not that crucial). The most adequate solution I've found so far is a Puppy LiveUSB modified for Online Banking (you can see the interesting part in _Additional Information: The Details of Completed Changes_ ). But I would hope for some more mainstream distribution, at least in part audited by being used by a large userbase. **Do some of the more popular distributions offer this kind of functionality?** Or alternatively, **is there a way to tweak _casper-rw_** to behave in that manner?


Cron job doesn't seem to be executing in ubuntu

I have a script located `/myscript/script.sh` and I have a cronjob that I submitted like this:               sudo crontab -e       The contents of the crontab are as follows:               */1 * * * * ./myscript/script.sh      The script requires root privileges as it deletes directories. Is there anything glaringly wrong with the way I've done this?


Matrix Structure for screen rotation

I can set my screen rotation to inverted with:               xrandr -o inverted     xinput set-prop 'ELAN Touchscreen' 'Coordinate Transformation Matrix' -1 0 1 0 -1 1 0 0 1      and back to normal with:               xrandr -o normal     xinput set-prop 'ELAN Touchscreen' 'Coordinate Transformation Matrix' 1 0 0 0 1 0 0 0 1      I found a HowTo here: https://wiki.ubuntu.com/X/InputCoordinateTransformation   So I guess for (90° to the right) it will be:               # ⎡ 0 -1 1 ⎤     # ⎜ 1  0 0 ⎥     # ⎣ 0  0 1 ⎦     right='0 -1 1 1 0 0 0 0 1'      But What is the right 'Coordinate Transformation Matrix' to the left?


Dynamically update completion list in zsh

I find zsh's result lists for `Tab` completion quite useful, however I'd like to tweak their behaviour a bit: They should appear when I `Tab` for the first time and afterwards dynamically update with every new letter added. The default behaviour is that the suggestions are only re-evaluated when you `Tab` again, I want to save this repeated keypress. ( **Update:** But only list the possible completions, it shouldn't automatically modify my actual prompt line even if there is only one option left.) Is there any way to achieve such behaviour?


Missing Xutf8LookupString call in Solaris 10

I'm trying to run a program in Solaris 10 that fails due to the lack of Xutf8LookupString function. It is a well-known issue but I'd like to know a way to "skip it". Would defining a different non-utf8 LC_CTYPE help? Would installing a different X server help? The problem doesn't happen on OpenSolaris? Is there a way I can "update" my Solaris system to use the same X libs as an OpenSolaris one? Thanks!


Disabling line wrap in Konsole

Is there a way to prevent konsole from wrapping lines? It would be great if I could do it without disabling any of the other features like extended colors and other of the fancier things.


Script to remove spaces and lowercase in file names

I am trying to write a script that will replace spaces with "-" and make all letters lower case for all files in the current directory.               for x in 'ls'         do             if [ ! -f $x ]; then                 continue             fi                  lc = `echo $x | tr '[A-Z]' '[a-z]'`             if [ $lc != $x ]; then                 mv $x $lc             fi         done          find -name "* *" -type f | rename 's/ /-/g'      I get the following output: call: rename from to files... However the names are not changing, example: `252680610243-Analyzed Sample2 2Jul12.txt` I changed the permissions with `chmod 706`, would this be causing the issue? What am I missing here? Here is the output of `bash -x lower.sh`:               + for x in ''\''ls'\'''     + '[' '!' -f ls ']'     + continue     + find -name '* *' -type f     + rename 's/ /-/g'     call: rename from to files...


Can not find link to download OpenSolaris source code

I want to understand how OpenSolaris ptools(process tools) works. How exactly pstack, pmap, pargs etc works, but I can't find any link to its full source code. I can only find an online version of the source. Any advice where I can download source code for offline use?


How to lower mouse acceleration if it is allready at lowest setting in gnome3 config

I want to lower mouse sensitivity in gnome3 desktop, but when I open appropriate settings panel I see that settings are at already lowest setting: ![Screenshot depicting the problem](http://i.stack.imgur.com/qLGuM.png) Is there any way to fix it?


Problem with SSH " Write failed: Broken pipe "

> **Possible Duplicate:**   >  What does the Broken pipe message mean in an SSH session? I run a program on server with `SSH` ! the program runs normaly and after a period of time i receve a message `Write failed: Broken pipe` and the program stops. What does this mean please ? and what is solution ? I read in : What does the Broken pipe message mean in an SSH session? That i can overcome this problem to update my server (and restart your sshd)               echo "ClientAliveInterval 60" | sudo tee -a /etc/ssh/sshd_config      Or client-side:               echo "ServerAliveInterval 60" >> ~/.ssh/config      But how to make it unlimited ? not only 60 seconds ! Thanks


find-command for certain subdirectories

Let's say I have a directory `dir` with three subdirectories `dir1` .. `dir3`. And inside I have many files and other subdirectories. I'd like to search for a file inside, say with a `*.c` ending, but I'd only like to search in subdirectory "dir/dir2" and all its subdirectories. How can I formulate that? Assuming I'm in `dir/` I have: `find . -name "*.c"` to search in all directories. How do I restrict to only `dir2`?


How is the kernel loaded?

I am trying to understand the Linux boot process, and after reading quite some amount of documentation there is one point that I still can't seem to understand. So the basicis is BIOS -> Grub MBR -> Grub CONF -> Kernel ... with a grub conf that can look like this               title CentOS (2.6.32-358.2.1.el6.i686)         root (hd0,0)         kernel /vmlinuz-2.6.32-358.2.1.el6.i686 ro root=/dev/mapper/VolGroup-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=VolGroup/lv_swap SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=VolGroup/lv_root  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet         initrd /initramfs-2.6.32-358.2.1.el6.i686.img       So based on my understanding of the documentation + post I read, kernel will be loaded + mount initramfs as root filesystem. Then init will be executed which will be in charge to do a bunch of various stuff to get the system up and running. My question is : How is the Kernel loaded? I mean since the kernel is in `/boot/vmlinuz-2.6.32-358.2.1.el6.i686` of my device (hd0,0) the filesystem needs to be mounted somehow first so it can be accessed. If (what I suspect) Grub mounts hd0,0 partition does it do first a pivot_root with initramfs then another pivot_root with the actual root= fs specificied as kernel parameter ? Any explanation / links that can help me understand a bit better how is this all working togetheris welcome,


How to maintain (top) row visible while scrolling?

I did it once, but cannot find out how any more: how to keep the top row of my LibreOffice Calc sheet visible when scrolling? (Intuitively it should be either in view or format, at best in right-click menu, but I can't see anything related ... )


How to copy only matching files, preserving subdirectories

Is there a way to do this: "How can I copy a subset of files from a directory while preserving the folder structure?", but without using rsync? Is it possible to be done using only cp, find and grep? I have very limited bash shell (i.e. its a git shell under windows :( ), so rsync is not an option. I know I can get cygwin, but I was wondering what I can do in this limited situation.


compgen : ignoring case

I'm trying to implement a custom **bash completion** as described here. However, it seems that `compgen` is **case-sensitive**. Is there a way to turn it **case-insensitive** in that context ?


Is there a way to find files containing only non-printing characters?

I've got a program that's behaving badly and has created a number of files with only a few non-printing characters. If I were to cat the files, I see nothing (since they are non-printing chars). However, these files will not show up if I use something like `-empty` or `-size 0` with the `find` command. Does anyone know of a way to search for files containing only non-printing characters?


Why do most linux distros default gnome?

Why the default desktop environment of most popular linux distros is gnome? KDE seems to me an equally good desktop environment. Is it for licence reason? historic? or else?


Is it possible to execute a VIM script in a non-interactive mode?

The Gnats bug tracker has a command (edit-pr) that opens a ticket in $EDITOR. My $EDITOR is VIM, and when this command opens the ticket in $EDITOR, I'd like to automatically perform some scripted edits without having to make any additional keystrokes. Is there a way to write a VIM script that can be run non-interactively like this?


how to install older version of subversion in Linux Mint

With Linux Mint, when I install `subversion` the `.svn` metadata folders are not compatible with `1.6.18` of Eclipse subversion plugin (`subclipse`). I assume the plugin can only process 1.6 compliant metadata. I want to downgrade to 1.6 version of subversion so that it would be compatible with my Eclipse subclipse plugin as well.               $  apt-show-versions -a subversion     subversion deinstall ok config-files     subversion 1.7.5-1ubuntu2 quantal archive.ubuntu.com     subversion not installed      The Mint package search does not yield any result for subversion package. http://packages.linuxmint.com/index.php


Linux Mint 16: Skype uses 100% of CPU core

I use Linux Mint 16 Petra 64bit Cinnamon. When I install Skype (either from repo, or directly from Microsoft) it soon starts using 100% of 1 CPU Core, doubling power consumption of my system. I tried removing the `~/.skype` folder and logging with different account. I tried removing the skype from repositories and install it directly from Microsoft. Is there anything I can do to troubleshoot and fix this problem? I can't reproduce this problem with older Mints, nor with Ubuntu Saucy and Raring. The doesn't manifest itself, if I launch skype and never log in (keep skype displaying the login screen). But if the skype was logged in before and had the high CPU consumption - clicking "Sign Out" doesn't help the problem (besides even if it did, there is little point in using skype without logging in) * * * Following the advise of @slm I can include the `strace` output. It seems that Skype is busy doing `poll` syscall... I thought that polling for resource introduces processor idling, not 100% usage.                strace -c skype     [ Process PID=31614 runs in 32 bit mode. ]          % time     seconds  usecs/call     calls    errors syscall     ------ ----------- ----------- --------- --------- ----------------       0.00    0.000000           0         1           execve     ------ ----------- ----------- --------- --------- ----------------     100.00    0.000000                     1           total     System call usage summary for 32 bit mode:     % time     seconds  usecs/call     calls    errors syscall     ------ ----------- ----------- --------- --------- ----------------      96.95   45.349256         493     92056           poll       1.26    0.588104           2    279026           clock_gettime       0.99    0.462877           3    183996    182979 recv       0.33    0.156517           2     79850       468 stat64       0.30    0.138574           2     79740           gettimeofday       0.10    0.047275          45      1040       174 futex       0.04    0.020046        1671        12           nanosleep       0.01    0.003025           4       792           writev       0.00    0.002037           2       871           write       0.00    0.001928           3       692       143 read       0.00    0.001482           2       944       561 open       0.00    0.000591           2       333       238 access       0.00    0.000584           1       466           mmap2       0.00    0.000577           1       421           madvise       0.00    0.000485           1       431           close       0.00    0.000462           4       120           munmap       0.00    0.000378           3       115           mprotect       0.00    0.000372           4        86           fstatfs64       0.00    0.000269           1       263           fstat64       0.00    0.000175           3        66        29 recvmsg       0.00    0.000113           1       121           time       0.00    0.000108           1       113         5 lstat64       0.00    0.000082           3        29           getdents64       0.00    0.000056           2        30           fadvise64_64       0.00    0.000047           3        15           openat       0.00    0.000046          15         3           shmdt       0.00    0.000045           2        24           sendmsg       0.00    0.000038           2        22           clone       0.00    0.000037           1        33           socket       0.00    0.000032           2        13           _llseek       0.00    0.000032          11         3           shmat       0.00    0.000032          11         3           shmget       0.00    0.000031           1        29           brk       0.00    0.000027           5         6           shmctl       0.00    0.000015           2         9           send       0.00    0.000013           0        27           fcntl64       0.00    0.000011           2         6         2 connect       0.00    0.000007           2         3           readlink       0.00    0.000007           1        13           rt_sigaction       0.00    0.000005           1         4           geteuid32       0.00    0.000005           1         4           getsockname       0.00    0.000003           0        10           uname       0.00    0.000003           3         1           eventfd2       0.00    0.000003           3         1           pipe2       0.00    0.000002           2         1           set_tid_address       0.00    0.000002           2         1           getpeername       0.00    0.000001           1         2           rt_sigprocmask       0.00    0.000001           1         2           getrlimit       0.00    0.000001           1         2           clock_getres       0.00    0.000001           1         1           set_robust_list       0.00    0.000000           0         2           unlink       0.00    0.000000           0         2           chmod       0.00    0.000000           0         3         3 mkdir       0.00    0.000000           0         1           pipe       0.00    0.000000           0        22           ioctl       0.00    0.000000           0         1           umask       0.00    0.000000           0         4           statfs       0.00    0.000000           0         4           fstatfs       0.00    0.000000           0         2           flock       0.00    0.000000           0         3           getuid32       0.00    0.000000           0         1           getgid32       0.00    0.000000           0         1           getegid32       0.00    0.000000           0         1           getresuid32       0.00    0.000000           0         1           getresgid32       0.00    0.000000           0         2           gettid       0.00    0.000000           0         1           sched_getaffinity       0.00    0.000000           0         1           set_thread_area       0.00    0.000000           0         4         1 bind       0.00    0.000000           0         1           listen       0.00    0.000000           0         2           sendto       0.00    0.000000           0         1           shutdown     ------ ----------- ----------- --------- --------- ----------------     100.00   46.775820                721911    184603 total      When I attach strace to running skype with `sudo strace -p $(pgrep skype)` I get tons of the following entries:               clock_gettime(CLOCK_MONOTONIC, {7553, 920730509}) = 0     recv(6, 0xf967e5a8, 4096, 0)            = -1 EAGAIN (Resource temporarily unavailable)     clock_gettime(CLOCK_MONOTONIC, {7553, 920937548}) = 0     poll([{fd=3, events=POLLIN}, {fd=7, events=POLLIN}, {fd=6, events=POLLIN}, {fd=9, events=POLLIN}, {fd=12, events=POLLIN}, {fd=28, events=POLLIN}], 6, 0) = 0 (Timeout)     recv(6, 0xf967e5a8, 4096, 0)            = -1 EAGAIN (Resource temporarily unavailable)     clock_gettime(CLOCK_MONOTONIC, {7553, 921039735}) = 0     recv(6, 0xf967e5a8, 4096, 0)            = -1 EAGAIN (Resource temporarily unavailable)     clock_gettime(CLOCK_MONOTONIC, {7553, 921089170}) = 0     poll([{fd=3, events=POLLIN}, {fd=7, events=POLLIN}, {fd=6, events=POLLIN}, {fd=9, events=POLLIN}, {fd=12, events=POLLIN}, {fd=28, events=POLLIN}], 6, 0) = 0 (Timeout)


'man' page is too narrow (not taking advantage of terminal size)

I'm making my first 'man' page and I'm using `groff` to do it. However, when I "compile" it and view it, it only takes up a certain amount of columns in my terminal. I've tried viewing other man pages just in case and they stretch with the width of my terminal. For a visual exmaple:               ---------------------------------------     | stuff(1)             stuff(1)         |     |                                       |     | NAME                                  |     |       a tool to do stuff but          |     |       it isn't really working         |     |                                       |     | DESCRIPTION                           |     |       yadadyadyadyadyadyadydy         |     |       segfwefwefwefwe                 |     |                                       |     |       srgswrgwrg                      |      ---------------------------------------      ... and so on, hopefully you get the idea. Most man pages take the full width. Right now, after writing my man page in a text file (using the groff/nroff "syntax"), I make it like this:               groff -Tascii -man ./path/to/man | more


Do tar archives include user/group name by default?

In `tar`'s `man` page I stumbled upon two options: >   * `\--numeric-owner`: always use numbers for user/group names >   * `\--owner=NAME`: force NAME as owner for added files > This made me wonder: When I `tar` a few files/folders (e.g. with `tar cf photos.tar photos/`) and publish the archive online, can my user/group name be extracted from it?


add "#" in begining to selected lines in File

Requirement : ADD someting (i.e #) in begining of every line in file A which is grep from file B File A               abcd     abdc     sdfg     asdfa     jon     ram      File B               jon     abcd      grep file B from file A and add "#" character in begining of the file in file A out put shoude be               #abcd     abdc     sdfg     asdfa     #jon     ram


Where can I download the /usr/dict/ packages?

I am looking for free lists of words in multiple languages. I understand that linux distributions do have such lists in /usr/dict. Is it possible to download these from somewhere without having to install linux? Tar balls (or equivalent) would be great. Thanks.


TOR Transparent Proxy - How does to the TCP redirecting work

I used an `iptables` ruleset based on the sample ruleset from https://trac.torproject.org/projects/tor/wiki/doc/TransparentProxy, Section Linux, Local Redirection Through `Tor`, to set up Tor as a transparent Proxy. I thought I had understood that ruleset, but there is one point I simply don't get: That TCP segments are only redirected to the port Tor listens on when the SYN flag is set. For example I want to visit `http://www.example.com`. My browser does a DNS request, gets the corresponding IP address and sends a TCP segment to that address, the SYN flag is set. According to the ruleset, the segment is redirected to the Tor port, so Tor functions as a proxy, routes the IP packet to `http://www.example.com` and delivers the answer from the website server back to my browser. My browser gets a packet back where the source IP is that from the server and the ACK flag is set in the TCP payload, right? So my browser sends the next TCP segment where the SYN flag is not set anymore to www.example.com's IP address. But, there is no corresponding rule in the NAT table because the SYN flag isn't set. So it shouldn't get redirected or get accepted in the output table afterwards. Nonetheless, everything is working fine. What point am I missing?


Mass file+folder+directory move

So we have a bunch of src files that are old and out-dated and need to be moved to our new NAS storage. (I don't know why we are keeping them).   * Is it possible to copy all the files and folders with their directories over to the new drive?    * The directories are not already made on the new storage drive.   * Can a command do this or do I have to make a script?  Has anybody done something similar to this?


How to safely give non-root access to lib so that Catalyst hardware acceleration can function?

I've installed AMD Catalyst 13.8 BETA2 by following these directions. It works fine on the administrative user it was setup with, but a non-admin user gets the black screen on login. Non-admin user works in software rendering mode but not hardware. **`cat /var/log/Xorg.0.log`**               [ 42815.421] (EE) AIGLX error: failed to open /usr/X11R6/lib64/modules/dri/fglrx_dri.so, error[/usr/X11R6/lib64/modules/dri/fglrx_dri.so: cannot open shared object file: No such file or directory]     [ 42815.421] (EE) AIGLX error: failed to open /usr/lib64/dri/fglrx_dri.so, error[/usr/lib64/dri/fglrx_dri.so: cannot open shared object file: No such file or directory]     [ 42815.421] (EE) AIGLX error: failed to open /usr/X11R6/lib/modules/dri/fglrx_dri.so, error[/usr/X11R6/lib/modules/dri/fglrx_dri.so: cannot open shared object file: No such file or directory]      From the installation, there was this command:               sudo ln -s lib /usr/lib64      `ls -l /lib` shows that root user and root group own the directory and subdirectories. How can non-admin users safely get the necessary access to these files? * * * **Note:** the symlink command has been corrected in the linked instructions.


How can I make C-j send a newline in the tmux command line?

I have grown fond of using `C-j` instead of `<ENTER>` to send newlines. Unfortunately, in the tmux command line (invoked with `prefix-:` by default), `C-j` does not do anything, even with `set -gw status-keys emacs` placed in `~/.tmux.conf`. (Note that `C-j` sends newlines for me in bash and I also have it mapped in other programs without trouble.) So, referring to the title of the question: _How can I make`C-j` send a newline in the tmux command line?_


How to set up smtp and send emails?

I'm new to raspberry pi. I installed the raspian OS on it. I want to send emails from it using my gmail account. I want to send from the command line interface and from php scripts. I followed this guide. http://iqjar.com/jar/sending-emails-from-the-raspberry- pi/ I did steps 1,2,3,4 from the link. When I send an email using the code below using               echo "Test text" | mail -s "Test Mail" me2@gmail.com      nothing happens, there is nothing printed on the screen, and I don't get the email. On "revaliases", if I replace "mail.google" with "smtp.gmail", then I get back a message saying               send-mail: Cannot open mail.google.com:587      or               send-mail: Server didn't like our AUTH LOGIN (530 5.7.0 Must issue a STARTTLS command first. ml2sm3592928igb.10 - gsmtp)      How can I fix this? Here are the two files below: ssmtp.conf               #     # Config file for sSMTP sendmail     #     # The person who gets all mail for userids < 1000     # Make this empty to disable rewriting.     # root=postmaster          # The place where the mail goes. The actual machine name is required no      # MX records are consulted. Commonly mailhosts are named mail.domain.com     # mailhub=mail          # Where will the mail seem to come from?     #rewriteDomain=          # The full hostname     hostname=raspberrypi          # Are users allowed to set their own From: address?     # YES - Allow the user to specify their own From: address     # NO - Use the system generated From: address     FromLineOverride=YES               root=me@gmail.com     mailhub=smtp.gmail.com:587     AuthUser=me@gmail.com     AuthPass=mypass     UseSTARTTLS=YES      revaliases               # sSMTP aliases     #      # Format:   local_account:outgoing_address:mailhub     #     # Example: root:your_login@your.domain:mailhub.your.domain[:port]     # where [:port] is an optional port number that defaults to 25.          root:me@gmail.com:mail.google.com:587


Specify word length in agrep?

I am using `agrep` to find similar spelling words, for example:               agrep -1 hack /usr/share/dict/words      But it returns too many words, so I also hope the length of the word is same as the keyword. How can I specify that?


How to list processes locking file?

Using `flock`, several processes can have a shared lock at the same time, or be waiting to acquire a write lock. How do I get a list of these processes? That is, for a given file X, ideally to find the process id of each process which either holds, or is waiting for, a lock on the file. It would be a very good start though just to get a count of the number of processes waiting for a lock.


Force grub to accept windows installation

I installed in my laptop some time ago a oracle linux server to make some test for my job., ok now i want to remove it and install windows from CD., but when i restart the pc he try to run the CD from inside, but GRUB passes over and run again the oracle linux server., so how can i force it to accept the uninstall? thanks


Find file names that don't contain a specified string

I'd like to execute the opposite of:               find . -name "*2013*"      Find all the files in the current directory that don't contain the string "2013" in their names. How can I do that?


swapping fields in columns by fixed pattern (yes, no, no, yes)

I want to produce a following list of pages (for imposition work); (number of pages is variable, but I make a sample of my needs using a list of 16 pages, logic is the same for longer lists)               1,16     8,9     15,2     10,7     3,14     6,11     13,4     12,5      I written this for cycle:               for ((x=16, y=1, z=8, w=9;x>=4, y<=4, z>=12, w<=12;x--, y++, z--, w++)); do echo "$x $y;$z $w"; done | tr ";" "\n" | tr " " ","      that, however, produces:               16,1     8,9     15,2     7,10     14,3     6,11     13,4     5,12      and not the list of pages I want. So, I need, with awk or other commands, to swap fields in some columns following this pattern (repeating every 4 couple of pages) **swap fields** **no swap fields** **no swap fields** **swap fields**               16,1 (swap: becomes: 1,16     8,9  (no swap: remains 8,9     15,2 (no swap: remains 15,2     7,10 (swap: becomes: 10,7     14,3 (swap: becomes: 3,14     6,11 (no swap: remains 6,11     13,4 (no swap: remains 13,4     5,12 (swap: becomes: 12,5      generalizing the logic of this imposition (I need to impose a single copy of an A6 book across an A4 page format) I wrote a more generalized script               #!/bin/sh     pages=$1     halfpages="`let DIVISION=$pages/2; echo $DIVISION`"     incr="$(echo "scale=0; $halfpages+1" |bc -l)"     dividedby4="$(echo "scale=0; $pages/4" |bc -l)"     lastupperpage="$(echo "scale=0; $pages-$dividedby4" |bc -l)"     u="u"     for ((x=$pages, y=1, z=$halfpages, w=$incr;x>=4, y<=4, z>=$lastupperpage, w<=$lastupperpage;x--, y++, z--, w++)); do echo "$x$u $y$u;$z $w"; done | tr ";" "\n" | tr " " "," | tr "\n" ","     exit 0      however I'm only able to produce: **16u,1u,8,9,15u,2u,7,10,14u,3u,6,11,13u,4u,5,12** instead of right: **1u,16u,8,9,15u,2u,10,7,3u,14u,6,11,13u,4u,12,5** that I pass to **Multivalent.jar**   * http://ifile.it/iqpjo4s/Multivalent.jar I attach a picture of right imposition of an A6 across an A4 to show the right sequence of imposition ![enter image description here](http://i.stack.imgur.com/XP206.png) what I try to obtain is a way to impose a whole A6 book across an A4 page in **ONE** signature consisting in all its pages (not the 8-Page Imposition), in order to cut at half A4 page, close the two halves one over another, reverse sheet obtained, cut at half and applying glue to left edge in order to apply cover to perform this task I need or to rethink my script from scratch or find a way to swap fields in columns by a fixed pattern (swap, no swap, no swap, swap) in order to correct wrong order produced by my script **EDIT** solved sending standard output of script to awk with this syntax:               awk -F "," '{         print $2 "," $1;         getline; print;         getline; print;         getline; print $2 "," $1     }'


Having trouble exporting FUSE via NFS

I've got a self-written FUSE file system I mount on my NFS server on mountpoint `/export/example/mount`. Then I export a parent directory of the FUSE via NFS. The `/etc/exports` contains the options `nohide,crossmnt,subtree_check,ro,no_root_squash` and allows free access to everyone:               /export/example *(nohide,crossmnt,subtree_check,ro,no_root_squash)      I can mount this export on my NFS client and access it. As soon as I access the FUSE within the NFS my client hangs until I `umount` the NFS (and I need to use option `-f` to accomplish that). I've tried mounting the FUSE as my working user and as root. The results are the same. The server is running a Ubuntu 12.04, the client a SuSE 9.3. The FUSE is written in Python and works locally without any trouble. Only the export via NFS fails. I have no security restrictions as all this is on a private network with only trusted users. Does anybody have an idea what could cause my trouble or (even better) how to solve the issue? I've thought about replacing the NFS with SSHFS to work around the problem, but that does not work as the client system is too old to support SSHFS (as it is based on FUSE, and FUSE isn't supported).


What information can I find out about an eventpoll on a running thread?

_Following on from a problem described in "How is it that I can attach strace to a process that isn't in the output of ps?"_ I'm trying to debug a process that hangs part way through. By using `strace -f` on my parent process, I was able to determine that I have a bunch of threads that are just showing:               # strace -p 26334     Process 26334 attached - interrupt to quit     epoll_wait(607, {}, 4096, 500)          = 0     epoll_wait(607, {}, 4096, 500)          = 0     epoll_wait(607, {}, 4096, 500)          = 0     epoll_wait(607, {}, 4096, 500)          = 0     epoll_wait(607, ^C <unfinished ...>     Process 26334 detached      Investigating further:               # readlink /proc/26334/fd/607     anon_inode:[eventpoll]      My gut tells me that I've managed to get some threads in a deadlock situation, but I don't really know enough about `epoll` to move forward. Are there any commands that can give me some insight into what these threads are polling for, or which file descriptors this epoll descriptor maps to.


Where does plink (from Putty package) search for remote commands?

I need to use `plink` (or something similar if you have something on mind) to get the output from Debian remote machine onto my Windows box. This works e.g. in this case : `plink 192.168.1.5 "ls" > log.txt` But when I want to use different command like e.g. `ifconfig` or what is my point of interest my alias for the script I get the error command not found :               Server sent command exit status 127     bash: showip: command not found     Disconnected: All channels closed      Where does the plink look for commands in this case ? I can easily execute aforementioned commands.


I need to install Kali Linux updates without Internet access on my laptop. I think I need to do this because I'm trying to install the WiFi driver but I get an error when I try to make:               make ARCH=x86_64 CROSS COMPILTE= -C /lib/modules/3.7-trunk-amd64/build M=/root/Desktop/rtl8723A_WiFi_linux_v4.1.3_6044.20121224      modules make: *** /lib/modules/3.7-trunk-amd64/build: No such file or directory. Stop.      make: *** [modules] Error 2      Trying to install the Realtek rtl8723au wireless driver WiFi driver:   * github.com/lwfinger/rtl8723au (from http://askubuntu.com/questions/318608/…)  It's for the Yoga13, I can `cd /root/blah/driver`, but when I `make` it just spits out the aforementioned error message, that was the entire error message. When using `dpkg -l | grep linux-` command, it yields this:               ii  firmware-linux-free         3.2               all       Binary firmware for various drivers in the Linux kernel     ii  firmware-linux-nonfree      0.37             all        Binary firmware for various drivers in the Linux kernel     ii  kali-linux-full             1.35             amd64      Penetration testing and security auditing distribution, full system     ii  kali-linux-sdr              1.35             amd64      Penetration testing and security auditing distribution, SDR tools     ii  linux-base                  3.5              all        Linux image base package     ii  linux-image-3.7-trunk-amd64 3.7.2-0+kali8    amd64      Linux 3.7 for 64-bit PCs     ii  linux-image-amd64           3.7+46+kali1     amd64      Linux for 64-bit PCs (meta-package)     ii  linux-libc-dev:amd64        3.7.2-0+kali8    amd64      Linux support headers for userspace development      The OS is a fresh install.


Overwriting an input file

Solutions that I have come across for replacing the contents of an input file with converted output involve using a temp file or the sponge utility. Stephane Chalezas's answer here indicates another way involving opening the file in read-write mode as below.               tr ' ' '\t' < file 1<> file      How does this actually work without corrupting the file in question?


Emacs, getting the output of the echo area

How can I insert directly the text displayed in the echo area? (also wrongly called the minibuffer). When I for example run `(+ 2 2)` in a buffer and execute it with `C-x C-e` it correctly displays the result '2' in the echo area. There is also a '2' in the Messages buffer. I'd like this '2' inserted below the line executed, in the same buffer, or something like that. Is there a command to, for example, pipe the echo area into the buffer or copy the last line of the Messages buffer into the present working buffer?


How to show network adapters with their statistics?

Is there any terminal command I can use to display all the network adapters like `eth0`, `wlano`and their data statistics like data transmitted & received?


Change the icon of an executable file from command line

I want to change the icon image of the executable files **from the command line**. I'm using KDE. Can any one help me in this regard.


Firefox seems fully loaded, but browser window does not appear for minutes

I think this started since the last Firefox update a few days ago, but I might be mistaken. The first time I noticed the problem was a few days ago anyway. What I do:   1. Click the Firefox icon   2. Wait. Nothing appears on my screen, while Firefox normally started in about three seconds.   3. Look in the system monitor; there is no load whatsoever. Firefox process is running.   4. Look in iotop; there is no load whatsoever.   5. Try `firefox -new-window about:blank` which opens a window like nothing odd is going on.   6. Close that window again. Firefox process remains open.   7. Use Chromium for the time being.   8. After about 5 to 10 minutes, Firefox opens by itself. Running Firefox from the command line offers no info as to why it's taking so long. The only warning it gives is:               (process:3543): GLib-CRITICAL **: g_slice_set_config: assertion `sys_page_size == 0' failed      But this also happens when Firefox starts normally. It does not seem related to the issue. Today I tried running Firefox with gdb. I'm by no means gdb expert and only used it once to provide someone else info about his application which was not working. So I ran `firefox --debug`, typed `start` at the (gdb) prompt, and got the following output (`#` denotes a comment added by me):               luc@luc-laptop2 ~ $ firefox --debug     GNU gdb (GDB) 7.5.91.20130417-cvs-ubuntu     Copyright (C) 2013 Free Software Foundation, Inc.     License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>     This is free software: you are free to change and redistribute it.     There is NO WARRANTY, to the extent permitted by law.  Type "show copying"     and "show warranty" for details.     This GDB was configured as "x86_64-linux-gnu".     For bug reporting instructions, please see:     <http://www.gnu.org/software/gdb/bugs/>...     Reading symbols from /usr/lib/firefox/firefox...(no debugging symbols found)...done.     (gdb) start     Function "main" not defined.     Make breakpoint pending on future shared library load? (y or [n]) n     Starting program: /usr/lib/firefox/firefox      [Thread debugging using libthread_db enabled]     Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".     [New Thread 0x7fffe9b17700 (LWP 3386)]     [Thread 0x7fffe9b17700 (LWP 3386) exited]          (process:3385): GLib-CRITICAL **: g_slice_set_config: assertion `sys_page_size == 0' failed     [New Thread 0x7fffe9b17700 (LWP 3389)]     [New Thread 0x7fffe2cff700 (LWP 3390)]     [New Thread 0x7fffe1ce7700 (LWP 3391)]     [New Thread 0x7fffe0eff700 (LWP 3392)]     [New Thread 0x7fffe06fe700 (LWP 3393)]     [New Thread 0x7fffdfbff700 (LWP 3394)]     [New Thread 0x7fffde9ff700 (LWP 3395)]     [New Thread 0x7fffdd0ff700 (LWP 3396)]     [New Thread 0x7fffdc4ff700 (LWP 3397)]     [New Thread 0x7fffdb18e700 (LWP 3398)]     [New Thread 0x7fffda781700 (LWP 3399)]     [New Thread 0x7fffd9f80700 (LWP 3401)]     [New Thread 0x7fffd90ff700 (LWP 3402)]     [New Thread 0x7fffd88fe700 (LWP 3403)]     [New Thread 0x7fffd80fd700 (LWP 3404)]     [New Thread 0x7fffd78fc700 (LWP 3405)]     [New Thread 0x7fffd67ff700 (LWP 3406)]     [Thread 0x7fffd67ff700 (LWP 3406) exited]     [Thread 0x7fffdd0ff700 (LWP 3396) exited]     [New Thread 0x7fffdd0ff700 (LWP 3407)]     [Thread 0x7fffdd0ff700 (LWP 3407) exited]     [New Thread 0x7fffd67ff700 (LWP 3418)]     [New Thread 0x7fffc62bb700 (LWP 3419)]     [New Thread 0x7fffdd0ff700 (LWP 3420)]     [New Thread 0x7fffc5aff700 (LWP 3421)]     [New Thread 0x7fffc52fe700 (LWP 3422)]     [Thread 0x7fffd67ff700 (LWP 3418) exited]     [Thread 0x7fffc52fe700 (LWP 3422) exited]     [New Thread 0x7fffc4afd700 (LWP 3423)]     [New Thread 0x7fffd67ff700 (LWP 3424)]     [New Thread 0x7fffc52fe700 (LWP 3425)]     [New Thread 0x7fffc42fc700 (LWP 3426)]     [Thread 0x7fffd67ff700 (LWP 3424) exited]     [Thread 0x7fffc52fe700 (LWP 3425) exited]     [Thread 0x7fffc42fc700 (LWP 3426) exited] # Up to here it took a long time          Entered ModifyHeaders.initConfigFile()[New Thread 0x7fffc52fe700 (LWP 3428)]       At this point I was asked for my master password, though still no browser window had appeared. At least a full minute passed by now. This game of starting and exiting threads goes on for a while, adding a few lines of output per minute, until it eventually starts. As said, when I run `firefox -new-window` from another console, a browser window opens instantly. Everything is loaded and works. After browsing in that window for a while (or just waiting a while, that works too), another browser window appears, I guess the one it has been trying to start all this time. This seems to happen randomly. Most of the time Firefox starts normally within 2-3 seconds like it always has. Also after a reboot, the problem does not consistently occur. However when it does happen, using `killall firefox` and trying again doesn't help; it will keep starting slowly until it fully started once. System info:   Linux Mint 15 Cinnamon; 3.8.0-19-generic #30-Ubuntu SMP x86_64; Firefox 23 from the Mint repository. Add-ons: Adblock Plus, Bugmenot, Cookies manager+, Cookies Ok, Firebug, Firegestures, Geolocater, Modify Headers, NO Google Analytics, Open Image In New Tab, Self-Destructing Cookies, Stylish (unused really), Tab Auto Reload, Tab Wheel Scroll, Tamper Data, User Agent Changer. Plugins: Cinnamon Integration, DivX® Web Player, IcedTea-Web Plugin, QuickTime Plug-in, VLC Multimedia Plugin, Windows Media Player Plug-in 10. Any ideas what this might be, or is there any additional information you need? **Edit:** Just had it again. It seems it happens after not using Firefox for a few hours (system was turned off), and Firefox has a few sockets open that have the status SYN_SENT. I've noticed that on this unsecured WLAN network, before you complete the captive portal, any packets to port!=80 will timeout. That might be it. Also my workaround with `firefox -new-window` didn't work until it asked me for my master password (I guess for syncing). Still no window at that moment so it's faster than waiting all the way, but it took 4 minutes anyway. When it happens again, I'll try disconnecting from the wireless network, killall firefox, and try again.


How to preload my .so everytime an application executes?

I've successfully used a hook under linux with this article: http://hackerboss.com/overriding-system-functions-for-fun-and-profit/ Now I want to make my .so file load every time `espeak` loads up. No matter if it's called from another application. How to do that?


Linux (Xubuntu) ram and cpu usage

I'd like to know if **Linux** is able to **see** and **use** all available **ram** and **cpu**. The reason why i ask is because in my Macbook for example i can not add more ram because it can read and use just 2GB, it is an old one (late 2006). My next purchase will be a pc dedicated to Linux but i am wondering if i will come into this problem again. Thanks to anyone who could help


Detect pattern repetition in a file

I want to make sure a file follows the following pattern:               ... ... ... foo ... foo_KO ... ...      ... bar ... ... ... ... bar_KO ...      The file is extremely long, so, in other words, I want to make sure of the following rule, in `sed` terms: **Every time ([a-z]*)_KO is matched, there is another field on the same line whose value is \1.** I hoope I'm clear enough. I'm on Solaris 10, using ksh. Example: **intput**               ... ... ... foo ... foo_KO ... ...      ... bar ... ... ... ... bar_KO ...      **output**               valid      * * * **input**               ... ... ... foo ... foo_KO ... ...      ... bar ... ... ... ... bar_KO ...     ... fubar_KO ... ... ... ... ...       **output**               invalid line 3       or               unmatched pattern fubar_KO


How can I save the last command to a file?

When I am running my analyses using the bash shell, I often want to save the commands I've used that gave me good results to a file in the same directory (my "LOGBOOK", as its called) so that I can check what I did to get those results. So far this has meant me either copy.pasting the command from the terminal or pressing "up" modifying the command to an `echo"my command" >> LOGBOOK`, or other similar antics. I found there was a `history` tool the other day, but I can't find a way of using it to get the previously executed command so that I can do something like `getlast >> LOGBOOK`. Is there a nice easy way to do this. Alternatively, how do others deal with saving the commands for results they have?


Is there a command in Linux to query a hostname from WINS server

Someone suggested the command `nmblookup`. But when I ran this command, it issued the following error.               $ nmblookup -U 10.140.8.106 -R 'name'     querying name on 10.140.8.106     name_query failed to find name name      Which configure file or command line options does `nmblookup` use relating to a query? How does it know the WINS server address? Thanks


What is syscall-template.S?

I've come across a file `syscall-template.S` more specifically its location is `.../sysdeps/unix/syscall-template.S`   1. What is this file?   2. Where is it. It is not on my system and I cannot find it in source packages, including `linux-image` and `glibc`.


rpm macros on CentOS 6.5

Trying to create a spec file for a CentOS 6.5 system. The rpm should check release to add specific Requires: lines based on the OS version....and it doesn't work at all: Spec file snippet:               %if 0%{?rhel} == 6     Requires: packageName     %endif     %description     Check dependencies and make OS modifications.           %files      /etc/rpm/macros.dist:               # dist macros.          %rhel 6     %centos 6     %centos_ver 6     %dist .el6     %el6 1      According to many web pages I've been to, the code should work but I never get a message that packageName is required when installing the rpm..What am I missing here?? **UPDATE...** Reinstalled my system and everything works OK now..Something must have mess up my environment on my test system...My original code now works


How to create a FTP user with specific /dir/ access only on a Centos / linux installation

So I'm on a VPS - CentOS Linux installation. I have vsFTPd on the server. I currently have SFTP access to the server via my root user, but am now trying to create a new user with FTP access to a specific directory only on the server, I've done the following:               1. mkdir /var/www/mydomain.com     2. mkdir /var/www/mydomain.com/html     3. useradd <-username>     4. passwrd <-username>     5. chown –R <-username> /var/www/mydomain.com     5. groupadd <-groupname>     6. gpasswd -a <-username> <-groupname>     7. chgrp -R <-groupname> /var/www/mydomain.com     8. chmod -R g+rw /var/www/mydomain.com      **What I'm struggling to do is to create the user to ONLY have access to** `/var/www/mydomain.com` - I experience that the user correctly logs into the wished folder, HOWEVER I can then browse "back" to other directories. **I want the user to stick in the specific folder and not being able to "browse" back**. Any ideas? I've found different articles on chrooting, but simply haven't figured it out to use it in the steps included above.


Checking compatibility between core utils and older GNU/Linux systems

I have **non-root** access to a grid of computers. The installed OS is the following:               $ uname -mrs     Linux 2.6.18-274.el5xen x86_64          $ cat /etc/*-release                                                                                Scientific Linux SL release 5.1 (Boron)      I built the latest version of core utils locally with               ./configure --prefix=<some_path>     make     make install      but before adding this new install to my `PATH` & `LD_LIBRARY_PATH`, I'm reluctant to start using a version of core utils that may not be compatible or safe to use with my OS. I know that one answer is " _test and see if it works_ ", but I would prefer to make sure that I will not run into problems later when doing real work with core utils (e.g. moving/deleting files, using `chmod`, etc.) Is this a legitimate concern? Are core utils fully backwards compatible with versions of GNU/Linux this old? How do I find out?


Parsing XML from a shell script

I have a datafile like this:               <Key name="com.ahsay.afc.cpf.UserGroup" content="" allowMultiple="Y">         <Value name="rsv-id" inheritParentAttribute="Y" type="string" data="1328200856753" />         <Value name="rsv-group-name" inheritParentAttribute="Y" type="string" data="group 1" />         <Value name="rsv-user-type" inheritParentAttribute="Y" type="string" data="backup-user" />         <Value name="rsv-owner" inheritParentAttribute="Y" type="string" data="" />         <Key name="com.ahsay.afc.cpf.User" content="" allowMultiple="Y">             <Value name="rsv-id" inheritParentAttribute="Y" type="string" data="13279083887401" />             <Value name="rsv-login-name" inheritParentAttribute="Y" type="string" data="name1" />         </Key>         <Key name="com.ahsay.afc.cpf.User" content="" allowMultiple="Y">             <Value name="rsv-id" inheritParentAttribute="Y" type="string" data="13279083887401" />             <Value name="rsv-login-name" inheritParentAttribute="Y" type="string" data="name2" />         </Key>     </Key>     <Key name="com.ahsay.afc.cpf.UserGroup" content="" allowMultiple="Y">         <Value name="rsv-id" inheritParentAttribute="Y" type="string" data="1328200856753" />         <Value name="rsv-group-name" inheritParentAttribute="Y" type="string" data="group 2" />         <Value name="rsv-user-type" inheritParentAttribute="Y" type="string" data="backup-user" />         <Value name="rsv-owner" inheritParentAttribute="Y" type="string" data="" />         <Key name="com.ahsay.afc.cpf.User" content="" allowMultiple="Y">             <Value name="rsv-id" inheritParentAttribute="Y" type="string" data="13279083887401" />             <Value name="rsv-login-name" inheritParentAttribute="Y" type="string" data="name3" />         </Key>         <Key name="com.ahsay.afc.cpf.User" content="" allowMultiple="Y">             <Value name="rsv-id" inheritParentAttribute="Y" type="string" data="13279083887401" />             <Value name="rsv-login-name" inheritParentAttribute="Y" type="string" data="name4" />         </Key>     </Key>      I know the login name of the record I want, and I need to match it to a group. Let's say I want to know what group `name3` is (the answer is `group 3`). Currently I can get the name of the group out of the file with:               perl -ne 'print "$_\n" foreach /name="rsv-group-name".*\ data="([^"]*)"/g;'      but I have no idea how to match it with a user. How can I do that in a script?


How to get directories and and subdirectories count fastest way?

I want to get the number of directories and sub directories.I tried following command which takes very long time . I tried waiting about an hour to finish the command. ### commands I used               $ find . -type d | wc -l      and               $ du -ch | wc -l       Both commands took more than 1 hour and did not complete the main folder size I'm trying to get information is about 120 GB.


How to run a script after connected with ssh

I've heard multiple answers of rights and wrongs and I still don't know if its possible. I ssh to a server then want to run a block of script.               while read server <&3; do   #read server names into the while loop         serverName=$(uname -n)      if [[ ! $server =~ [^[:space:]] ]] ; then  #empty line exception         continue      fi         echo server on list = "$server"      echo server signed on = "$serverName"      if [ $serverName == $server ] ; then #makes sure a server doesnt try to ssh to itself         continue      fi         echo "Connecting to - $server"         ssh "$server"   #SSH login         echo Connected to "$serverName"         exec < filelist.txt         while read updatedfile oldfile; do         #   echo updatedfile = $updatedfile #use for troubleshooting         #   echo oldfile = $oldfile   #use for troubleshooting                    if [[ ! $updatedfile =~ [^[:space:]] ]] ; then  #empty line exception                     continue # empty line exception                    fi                    if [[ ! $oldfile =~ [^[:space:]] ]] ; then  #empty line exception                     continue # empty line exception                    fi                  echo Comparing $updatedfile with $oldfile                 if diff "$updatedfile" "$oldfile" >/dev/null ; then                     echo The files compared are the same. No changes were made.                 else                     echo The files compared are different.                     cp -f -v $oldfile /infanass/dev/admin/backup/`uname -n`_${oldfile##*/}_$(date +%F-%T)                     cp -f -v $updatedfile $oldfile                  fi                   done              done 3</infanass/dev/admin/servers.txt      **I want to run the block of code after sshing to the servers.**


Efficient way of comparing in awk

#!/bin/awk     BEGIN {             while(getline var < compareTo > 0)             {                     orderIds[var]=var;             }     }     {             if(orderIds[$0] == "")             {                     print $0;             }     }      Running as               awk -v compareTo="ids.log.remote" -f sample.awk ids.log.local      This is working, but instead of using associative arrays ( like HashMap ), is there anything like a HashSet in awk? I got the timings               bash-3.2$ time grep -xFvf ids.log.local ids.log.remote > /dev/null          real    0m0.130s     user    0m0.127s     sys     0m0.002s     bash-3.2$ time grep -xFvf ids.log.local ids.log.remote > /dev/null          real    0m0.126s     user    0m0.125s     sys     0m0.000s     bash-3.2$ time grep -xFvf ids.log.local ids.log.remote > /dev/null          real    0m0.131s     user    0m0.128s     sys     0m0.002s     bash-3.2$ time awk 'NR == FNR {       orderIds[$0]; next       }     !($0 in orderIds)       ' ids.log.local ids.log.remote > /dev/null          real    0m0.053s     user    0m0.051s     sys     0m0.003s     bash-3.2$ time awk 'NR == FNR {       orderIds[$0]; next       }     !($0 in orderIds)       ' ids.log.local ids.log.remote > /dev/null          real    0m0.052s     user    0m0.051s     sys     0m0.001s     bash-3.2$ time awk 'NR == FNR {       orderIds[$0]; next       }     !($0 in orderIds)       ' ids.log.local ids.log.remote > /dev/null          real    0m0.053s     user    0m0.051s     sys     0m0.002s     bash-3.2$ time awk -v compareTo="ids.log.local" -f checkids.awk ids.log.remote > /dev/null          real    0m0.066s     user    0m0.060s     sys     0m0.006s     bash-3.2$ time awk -v compareTo="ids.log.local" -f checkids.awk ids.log.remote > /dev/null          real    0m0.065s     user    0m0.058s     sys     0m0.008s     bash-3.2$ time awk -v compareTo="ids.log.local" -f checkids.awk ids.log.remote > /dev/null          real    0m0.061s     user    0m0.053s     sys     0m0.007s      @Dimitre Radoulov Looks like your awk is faster. Thanks.


find with multiple -exec options; redirecting &>/dev/null for one exec command sends process to background

I have a find command with multiple -exec arguments and would like the output (both stdout and stderr) for one of the commands to be suppressed. When I use **& >/path/to/file**, it sends the process to the background instead of redirecting output.               find /some/path -type f -exec sh -c 'scriptA.sh "$1"' _ "{}" \; -exec sh -c 'scriptB.sh "$1" &>/dev/null' _ "{}" \;      I found a way around it by using the command below (which also uses the '&' character), but I would like to know why it sends the process to the background instead of redirecting output like it normally would. So why does the command below work, but the one above does not?               find /some/path -type f -exec sh -c 'scriptA.sh "$1"' _ "{}" \; -exec sh -c 'scriptB.sh "$1" >/dev/null 2>&1' _ "{}" \;      Thanks!


Set EDT emulation by default for Emacs

Using the Emacs editor I can set it to enable OpenVMS EDT editor keypad mode with this command:               M-x edt-emulation-on      How can I set it so that whenever I invoke Emacs, EDT emulation is the default on a Linux system?


configuration ethics (esthetics): /etc vs $HOME

Ok this may not be a very concrete question, and is perhaps subject to taste, yet I'm struggling to get this right so here it goes. I have a computer. This computer has linux on it (thank god). Arch Linux to be specific (with `awesome` wm). I am the single user on this computer. As to good practice I've set up two users: the `root` user and the everyday use `romeovs` user. This way I only use permissions when needed (using `sudo` for example). Over the years I have been pimping out my software suite, adding a bunch of applications to this computer. Notably: `vim`, `git`, `mpc`, `mutt`, `calcurse`, `ufw`, ... Now here is the rub: which of these applications' config files do I use? All of these supply an `/etc`-based _global_ configuration file, that affects _all_ users, as well as a _local_ `~/.config` (or, sadly, `~/`) config options. I've always worked using the local configuration setups, because this felt more natural. But as I grow more familiar with my computer, I feel this somehow lacks elegance. The contra's to this approach are:   * dicrepancy when switching to `root` user, even with `sudo` (e.g. when using `vim`)   * will not always work, e.g. when loading deamons from the arch linux `DEAMONS` array they are run by the `root` user and thus don't pick up local user configs.   * major `$HOME` directory clutter. Sadly there are very few apps that adhere to the `$XDG_CONFIG_HOME` philosophy. Benefits are:   * stuff is local, which feels more in the lines of the permissions splitting between `root` and `romeovs`.   * quick and easy acces to the files. no need to `sudo` to edit them.   * easier for `git` tracking of the config files.   * somehow feels safer: a user can screw stuff up without messign with the machine's global settings.   * it is more "a-package-update-may-overwite-my-config"-proof Let's get conrete: > What is the de-facto standard to split configuration on a single user > machine, especially for the system maintainer (single-user)?


Preventing multiple keypresses from RF remote

I needed to replace a Gyration remote control (which was for controlling MythTV) and it is no longer made. So I got a Keyspan TSBX-2404. It works in the sense that it communicates with the box (Fedora 15) but unlike the Gyration it sends multiple keypresses whenever I hit a button. For example, in xev if I press a button it will give 4-6 entries. It is controlling MythTV this way too--for example hitting the right arrow key will scroll two stops in a horizontal list rather than one. This is not acceptable, and I am wondering if there is some way to deal with it. For example, is there a setting in X that will filter out multiple keypresses that happen within a certain amount of time?


Get ssh to forward signals

I want to be able to send signals (SIGINT is the most important) through ssh. This command:               ssh server "sleep 1000;echo f" > foo      will start sleep on server and after 1000 seconds it will put 'f\n' in the file foo on my local machine. If I press CTRL-C (i.e. send SIGINT to ssh) it will kill ssh, but it will not kill sleep on the remote server. I want it to kill sleep on the remote server. So I tried:               ssh server -t "sleep 1000;echo f" > foo      But if stdin is not a terminal I get this error:               Pseudo-terminal will not be allocated because stdin is not a terminal.      and then SIGINT is still not forwarded. So I tried:               ssh server -t -t "sleep 1000;echo f" > output      But then the output in foo is not 'f\n' but instead 'f\r\n' which is disastrous in my situation (as my output is binary data). In the above I use "sleep 1000;echo f", but in reality that is supplied by the user, thus it can contain anything. However, if we can make it work for "sleep 1000;echo f" we can most likely make it work for all realistic situations. I really do not care about getting a pseudo-terminal at the other end, but I have been unable to find any other way of getting ssh to forward my SIGINT. Is there another way? Edit: The user could give commands that read binary data from stdin, such as:               seq 1000 | gzip | ssh server "zcat|bzip2; sleep 1000" | bzcat > foo      The user could give commands that are cpu intensive, such as:               ssh server "timeout 1000 burnP6"      Edit2: The version that seems to work for me is:               your_preprocessing |       uuencode a | ssh -tt -oLogLevel=quiet server "stty isig -echoctl -echo ; uudecode -o - |     your_command |       uuencode a" | uudecode -o - |     your_postprocessing      Thanks to digital_infinity for pointing me in the right direction.


Smallest GUI VNC setup

I'm setting up VNC on my VPS with 768mb ram. What would be the best setup to save the most memory? Right now I tried Gnome-core with `vncserver` but it uses a lot of RAM. I remember having a VNC running on only 512Mb with no problem. But on this new one I'm getting errors all the time because it's used up all my RAM.


How to edit /var/www files using phpstorm?

I want to edit the /var/www files using any editor like phpstorm or eclipse etc, without changing the default user/groups setting for /var/www. Since phpstorm is invoke by a script , I dont know how to make the phpstorm part of www-data group so it get write permission. What are other options otherwise ?


Any way to sync directory structure when the files are already on both sides?

I have two drives with the same files, but the directory structure is totally different. Is there any way to 'move' all the files on the destination side so that they match the structure of the source side? With a script perhaps? For example, drive A has:               /foo/bar/123.txt     /foo/bar/234.txt     /foo/bar/dir/567.txt      Whereas drive B has:               /some/other/path/123.txt     /bar/doo2/wow/234.txt     /bar/doo/567.txt      The files in question are huge (800GB), so I don't want to re-copy them; I just want to sync the structure by creating the necessary directories and moving the files. I was thinking of a recursive script that would find each source file on the destination, then move it to a matching directory, creating it if necessary. But that's beyond my abilities ... Any help greatly appreciated! Thanks UPDATE: Another elegant solution was given here: http://superuser.com/questions/237387/any-way-to-sync-directory-structure- when-the-files-are-already-on-both-sides/238086


Synchronizing same files with different filenames using rsync

I have a directory `~/music` that contains all my music files and a directory `/media/backup/music` that I wish to synchronize with the first one using `rsync`. Initially, I did a `rsync -a ~/music /media/backup` which created the `music` directory inside `/media/backup` with all my music files as expected. Since then I have modified a lot of filenames inside `~/music` and now I want to sync these changes. Doing a `rsync -ain` seems to register these modifications as _new_ files - and hence it will create a set of new files in the backup directory and not just update the exisiting target filenames. Most of my files are big and I don't want to re-copy them each time they change name. Is there a way to tell `rsync` to synchronize identical files with different names by only updating the filenames from the source and not creating new ones? I might use the `\--delete` option to delete extraneous files, but if there's a better way to this I'd like to know. * * * Example:               $ cd example     $ rsync -a var backup/                 # rsync var under backup/var     $ tree .     .     ├── backup     │   └── var     │       ├── JSON.gif     │       └── logs     │           ├── xinit.log     │           └── x.log     └── var         ├── JSON.gif         └── logs             ├── xinit.log             └── x.log               $ mv var/JSON.gif var/JSON-LOGO.gif    # rename some file     $ mv var/logs var/log                  # rename some directory     $ rsync -a var backup/                 # sync the changes     $ tree .     .     ├── backup     │   └── var     │       ├── JSON.gif                   # don't want this one     │       ├── JSON-LOGO.gif              # want -only- this one     │       ├── log                        # same here     │       │   ├── xinit.log     │       │   └── x.log     │       └── logs                       # don't want this one either     │           ├── xinit.log     │           └── x.log     └── var         ├── JSON-LOGO.gif         └── log             ├── xinit.log             └── x.log


Is there a backup tool that recognized renamed/moved files/directories?

> **Possible Duplicate:**   >  Any way to sync directory structure when the files are already on both > sides? I'm looking for a backup utility that recognizes files or folders in the source that have just been renamed or moved. Using `rsync` I get a lot of duplicates, when ideally it would reflect those operations on the target (like Microsoft's SyncToy does). Example:               Source:        Target:     ~/done/a       ~/done/a     ~/done/b       ~/todo/b     ~/todo-123/c   ~/todo/c     ~/todo-123/d   ~/todo/d


How to avoid unnecessary deletion and recopying of moved folders when using rsync?

I've read that rsync cannot detect moved folders, and simply delete and recopy them into the new folder structure. Since the only change I did to my master copy is the simple introduction of a top folder to contain my original files, i.e.:               folder1     folder2     folder3      into               top\folder1     top\folder2     top\folder3      I was wondering if I could just do the same manually in my backup copy, fix the modification times of both top folders somehow, so that succeeding calls to rsync would run normally. Will this work? If so, how? If not, what is the recommended way to solve this problem? Or should I be running rsync with different parameters in the first place? (instead of `rsync -a --delete /mnt/SRC /mnt/DEST` which I'm currently using) The directories are pretty large and so I'd like to avoid unnecessary recopying as much as possible.


In a bash shell script, writing a for loop that iterates over string values

In bash, I know that it is possible to write a `for` loop in which some loop control variable `i` iterates over specified integers. For example, I can write a bash shell script that prints the integers between 1 and 10:               #!/bin/bash          for i in {1..10}     do      echo $i     done      Is it possible to instead iterate over a loop control variable that is a string, if I provide a list of strings? For example, suppose that I have a string `fname` that represents a file name. I want to call a set of commands for each file name. For example, I might want to print the contents of `fname` using a command like this:               #!/bin/bash          for fname in {"a.txt", "b.txt", "c.txt"}     do      echo $fname     done      In other words, on the first iteration, `fname` should have the value `fname="a.txt"`, while on the second iteration, `fname` should have the value `fname="b.txt"`, and so on. Unfortunately, it seems that the above syntax is not quite correct. I would like to obtain the output: > a.txt > > b.txt > > c.txt but when I try the above code, I obtain this output: > {a.txt, > > b.txt, > > c.txt} Can you please help me determine the correct syntax, so that I can iteratively change the value/contents of the variable `fname`? Thank you for your time.


Can I force myself to enter a password when run certain processes?

I frequently work in an environment where, lets call them "pranksters" may gain access to my console. I am diligent in locking my screen whenever I walk away, but given enough time someone gets the chance to type `chmod -R 777 *` while i'm looking the other way / sharpening a pencil / whatever. Is there any way I can force re-entry of my password for certain commands (i'm thinking for `rm`, `chmod`, `chown`, `vi ~/.bashrc`, &c)? I have thought of chmodding .bashrc and .bash_profile to read-only for all users (including myself) and then alias chown / chmod / whatever to a script that requires a password but that seems so hacky. EDIT: I am not a sudoer on this machine


Why updating a running Linux system is not problematic?

It's years I use Linux systems on a daily basis, and I never had major problems by updating a system when it was running, but I still wonder why this is possibile. Let me make an example. Suppose a program "A" from a certain package is running on a system. This program, at a certain point, needs to open another file ("B") from the same package. After that, program "A" closes "B" because it doesn't need it anymore. Suppose now I update the package "A" and "B" belong to. "A" is not directly affected by this operations, at least for the moment, since it is running in RAM and the update just replaced "A" on the hard disk. Suppose "B" has been replaced on the filesystem, too. Now "A" needs to read "B" again for some reason. The question is: is it possible that "A" could find an incompatible version of "B" and crash or malfunction in some other way? Why nobody update their systems by rebooting with a live CD or some similar procedure?


mysql fail to start bash_completion errors

So after upgrading my debian system, mysql does not start anymore with command "service mysql start". I get:               Job for mysql.service failed. See 'systemctl status mysql.service' and 'journalctl -xn' for details. linksys:/home/users/stan# journalctl -xn     -- Logs begin at Mon 2014-07-28 10:03:56 PDT, end at Mon 2014-07-28 12:07:07 PDT.     -- Jul 28 12:07:07 linksys mysql[5509]: -su: 89: /usr/share/bash-completion/bash_completion: complete: not found         Jul 28 12:07:07 linksys mysql[5509]: -su: 92: /usr/share/bash-completion/bash_completion: complete: not found         Jul 28 12:07:07 linksys mysql[5509]: -su: 101: /usr/share/bash-completion/bash_completion: Syntax error: "(" unexpected (expec         Jul 28 12:07:07 linksys su[5536]: pam_unix(su:session): session closed for user mysql        Jul 28 12:07:07 linksys systemd[1]: mysql.service: control process exited, code=exited status=2        Jul 28 12:07:07 linksys systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.     -- Subject: Unit mysql.service has failed     -- Defined-By: systemd     -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel     --      -- Unit mysql.service has failed.      Looking at `/etc/init.d/mysql` it looks like the command to start mysql is: `su - mysql -s /bin/sh -c "/usr/bin/mysqld_safe > /dev/null 2>&1 &"` but I get more bash_completion errors:               -su: 29: /usr/share/bash-completion/bash_completion: [[: not found     -su: 35: /usr/share/bash-completion/bash_completion: [[: not found     -su: 51: /usr/share/bash-completion/bash_completion: shopt: not found     -su: 57: /usr/share/bash-completion/bash_completion: complete: not found     -su: 62: /usr/share/bash-completion/bash_completion: complete: not found     -su: 65: /usr/share/bash-completion/bash_completion: complete: not found     -su: 68: /usr/share/bash-completion/bash_completion: complete: not found     -su: 71: /usr/share/bash-completion/bash_completion: complete: not found     -su: 74: /usr/share/bash-completion/bash_completion: complete: not found     -su: 77: /usr/share/bash-completion/bash_completion: complete: not found     -su: 80: /usr/share/bash-completion/bash_completion: complete: not found     -su: 83: /usr/share/bash-completion/bash_completion: complete: not found     -su: 86: /usr/share/bash-completion/bash_completion: complete: not found     -su: 89: /usr/share/bash-completion/bash_completion: complete: not found     -su: 92: /usr/share/bash-completion/bash_completion: complete: not found     -su: 101: /usr/share/bash-completion/bash_completion: Syntax error: "(" unexpected (expecting "}")      No logs in /var/log/mysql/. Any ideas?


X11 Issues running with Terminal.app

I am trying to figure out why I can't use ghostscript or ghostview (or any other X11 applications) when I try to call them in the Terminal. I am using bash, and I also used Fink to get the packages I need. I am using GMT (generic mapping tools), and the commands within this gmt package that don't need x11 run perfectly fine, but when I try to display a postscript, using either the command $ gs or $ gv, I get these error messages, respectively:               gv: Unable to open the display. and GPL Ghostscript 9.10: Cannot open X display ':0'. **** Unable to open the initial device, quitting.      I have tried many edits that I've found online, such as adding editing the ~./profile, as shown below:               test -r /sw/bin/init.sh && . /sw/bin/init.sh          . /sw/bin/init.sh     export DISPLAY=:0      The saving grace here is that if I run the same commands from gmt in xterm (the terminal in X11), the graphic I need is created just fine. All I want to do is have X11 called through the terminal, but right now, I cannot get it working.


Difference between Unix OS Types

What is the difference between Linux, AIX, Solaris, MAC. Aren't these all some kind of Unix flavors ? Why do we need so many types. Why can't there be just one type ?


Exclude characters for SCP-filepattern

Is there a way to build an expression for `scp` with which I can manage to copy the file               file-name-version-1.2.1.jar      without copying the files               file-name-version-1.2.1-sources.jar     file-name-version-1.2.1-javadoc.jar      while not knowing the exact version numbers? `file-name-version-*.*.*.jar` wont work for obvious reasons. I'm looking for a syntax like               file-name-version-\d.\d.\d.jar      or something similar.


NFS Automount/HARD mount sharing top directory

In Linux, is it possible to "hard mount" a directory under an automounted directory? For example:               /top_dir/fred      (automounted)     /top_dir/jane      (automounted)     /top_dir/software  (hard mounted)      From the same "root" or top level directory, I have both hard mounted (persistent) and automounted subdirectories.


Synaptics Touchpad Configuration "take over" from Windows

I am using Arch Linux and Windows on Dual Boot, and I managed to configure my synaptics touch pad just as I wanted using the GUI settings that are available to me on Windows, but I am completly confused about what the right values are for my settings when looking at them in synclient. Can I actually somehow read out all these information on Windows and import them (even by writing them down by hand) to have the exact same functionality here?


How to use `expect` with `zipcloak` II?

This question is a followup on this question, as I figured out the solution I presented in the previous question does not work anymore. It worked sometime, but now `expect` does not work as expected. Here is the full code again:               #!/bin/bash     MYPWD="mypassword"          expect -c '          spawn zipcloak test.upd         expect "*Enter password*"          sleep 1         send  "'"$MYPWD"'\r"         sleep 1         expect "*Verify password*"          sleep 1         send  "'"$MYPWD"'\r"         sleep 1         '      This bash script does not encrypt the file `test.upd`, but creates files in my directory starting with "zi", like `zi0gA1rU` or `zi8Vv6OD`. Why is that? What are those files? Why does the above script sometimes work, and sometimes it does not? Is there no way to make `expect` to behave as it should? Where can I find the source code of `zipcloak`, so I can rewrite it to avoid using `expect`? Additional information:   * I have to execute this command as `root`, as the zipfile has root rights. Maybe that is important? zipcloak -v Copyright (c) 1990-2008 Info-ZIP - Type 'zipcloak "-L"' for software license. This is ZipCloak 3.0 (July 5th 2008), by Info-ZIP. Currently maintained by E. Gordon. Please send bug reports to the authors using the web page at www.info- zip.org; see README for details. Latest sources and executables are at ftp://ftp.info-zip.org/pub/infozip, as of above date; see http://www.info-zip.org/ for other sites. Compiled with gcc 4.6.1 for Unix (Linux ELF) on Jun 11 2011. ZipCloak special compilation options: [encryption, version 2.91 of 05 Jan 2007] After it stopped working, I needed to set the last `sleep` to 2. Then it worked again. But later, this also did not work anymore. So I set the `sleep` to 5 seconds. For now, my script is working. But NOT reliable. Debug output with `exp_internal 1` set:               spawn /usr/bin/test.upd     parent: waiting for sync byte     parent: telling child to go ahead     parent: now unsynchronized from child     spawn: returns {28746}          expect: does "" (spawn_id exp6) match glob pattern "*Enter password*"? no     Enter password:      expect: does "Enter password: " (spawn_id exp6) match glob pattern "*Enter password*"? yes     expect: set expect_out(0,string) "Enter password: "     expect: set expect_out(spawn_id) "exp6"     expect: set expect_out(buffer) "Enter password: "     send: sending "XXX\r" to { exp6 }          expect: does "" (spawn_id exp6) match glob pattern "*Verify password*"? no          Verify password:      expect: does "\r\nVerify password: " (spawn_id exp6) match glob pattern "*Verify password*"? yes     expect: set expect_out(0,string) "\r\nVerify password: "     expect: set expect_out(spawn_id) "exp6"     expect: set expect_out(buffer) "\r\nVerify password: "     send: sending "XXX\r" to { exp6 }     argv[0] = expect  argv[1] = -c  argv[2] =          exp_internal 1         spawn /usr/bin/zipcloak "test.upd"         expect "*Enter password*"         sleep 1         send  "XXX\r"         sleep 1         expect "*Verify password*"         sleep 1         send  "XXX\r"         sleep 1          set argc 0     set argv0 "expect"     set argv ""      **Update:** The output of the second script posted by glenn is:               spawn zipcloak test.upd     parent: waiting for sync byte     parent: telling child to go ahead     parent: now unsynchronized from child     spawn: returns {9956}     Gate keeper glob pattern for 'password: $' is 'password: '. Activating booster.          expect: does "" (spawn_id exp6) match regular expression "password: $"? Gate "password: "? gate=no     Enter password:     expect: does "Enter password: " (spawn_id exp6) match regular expression "password: $"? Gate "password: "? gate=yes re=yes     expect: set expect_out(0,string) "password: "     expect: set expect_out(spawn_id) "exp6"     expect: set expect_out(buffer) "Enter password: "     send: sending "mypassword\r" to { exp6 }     expect: continuing expect          expect: does "" (spawn_id exp6) match regular expression "password: $"? Gate "password: "? gate=no     mypassword          expect: does "mypassword\r\n" (spawn_id exp6) match regular expression "password: $"? Gate "password: "? gate=no     expect: timed out     argv[0] = expect  argv[1] = -c  argv[2] =         exp_internal 1         spawn zipcloak test.upd         expect {             -re {password: $} {send "mypassword\r"; exp_continue}             eof         }          set argc 0     set argv0 "expect"     set argv ""      **Update** I actually want to specify the filename and the password on the commandline to call the code as               ./myscript.sh test.upd pass      Here is the script:               #!/bin/bash     expect -c "          exp_internal 1         spawn zipcloak \"$1\"         expect {             -re {password: \$} {send \"$2\r\"; exp_continue}             expect eof         }     "      However, it creates again a file starting with `zi` and does not encrypt the actual file. I had no idea that every little seemingly logic change could break the entire workflow of the expect script. Here is the ouput:               spawn zipcloak test.upd     parent: waiting for sync byte     parent: telling child to go ahead     parent: now unsynchronized from child     spawn: returns {16791}     Gate keeper glob pattern for 'password: $' is 'password: '. Activating booster.          expect: does "" (spawn_id exp6) match regular expression "password: $"? Gate "password: "? gate=no     "expect"? no     Enter password:     expect: does "Enter password: " (spawn_id exp6) match regular expression "password: $"? Gate "password: "? gate=yes re=yes     expect: set expect_out(0,string) "password: "     expect: set expect_out(spawn_id) "exp6"     expect: set expect_out(buffer) "Enter password: "     send: sending "pass\r" to { exp6 }     expect: continuing expect          expect: does "" (spawn_id exp6) match regular expression "password: $"? Gate "password: "? gate=no     "expect"? no     pass          expect: does "pass\r\n" (spawn_id exp6) match regular expression "password: $"? Gate "password: "? gate=no     "expect"? no     expect: timed out     argv[0] = expect  argv[1] = -c  argv[2] =         exp_internal 1         spawn zipcloak "test.upd"         expect {             -re {password: $} {send "pass\r"; exp_continue}             expect eof         }          set argc 0     set argv0 "expect"     set argv ""


How do I start a screen session using an upstart job with a non privileged user?

I have struggled with this problem for two days and have tried many things to fix it to no avail. I'm hoping you guys can help me out. I am trying to create an Upstart job that starts a new `screen` session on boot, in which I would like to automatically start a `java` executable. Here is the .conf file I am currently trying to get to work, although I have tried several others:               description     "Run the bungeecord jar"          start on (local-filesystems and net-device-up IFACE=eth0 and runlevel [2345])     stop on runlevel [016]          exec start-stop-daemon --start -c ridog --exec /usr/bin/screen -- -dmUS BungeeCord java -server -XX:UseSSE=4 -XX:+UseCMSCompactAtFullCollection -XX:MaxPermSize=356m -XX:ParallelGCThreads=6 -XX:+UseConcMarkSweepGC -XX:+DisableExplicitGC -XX:+CMSIncrementalMode -XX:+CMSIncrementalPacing -XX:+UseCompressedOops -XX:+AggressiveOpts -Xmx256M -jar BungeeCord.jar          pre-stop script         screen -S BungeeCord -X foo "end^M"     end script      To my knowledge, the script seems to work fine, I can run `sudo start bungeecord` and get the intended result, however, restarting the machine does not work. Instead, I get this error in the `/var/log/upstart/bungeecord.log`:               Cannot make directory '/var/run/screen': Permission denied      I've looked up this error and the search results are obscure and inconclusive. I've tried running the command as root, this removes the error but still no `screen` session. I've tried different commands like this:               su ridog -c "screen -dmS BungeeCord java -jar /home/ridog/BungeeCord/BungeeCord.jar"      Nothing seems to work and I'm out of ideas, any help would be appreciated. Thanks.


xinetd cannot launch lighttpd

I want to launch `lighttpd` when someone tries to connect to port 80. I started with a simple test script to see if anything was working: `/etc/xinetd.d/www`               service www     {         disable         = no         socket_type     = stream         protocol        = tcp         port              = 80         log_on_success += USERID          log_on_failure += USERID         server          = /usr/server_test.sh         user            = root         instances       = UNLIMITED         wait            = no         log_type        = SYSLOG daemon debug     }      where `/usr/server_test.sh`:               #!/bin/sh     echo "www connection"     lighttpd -D -f /usr/lighttpd.conf &     webconfig -c /usr/cppcms.js &          service xinetd restart      When I try:               nc localhost 80      I get:               www connection 2013-11-25 16:37:13: (network.c.345) can't bind to port:  80 Address already in use      How do I get `xinetd` and `lighttpd` to work together, not fight over same port?


Install Win8 After Ubuntu

I've read that it's best to install win8 before linux. I already have Ubuntu set up with lots of goodies so I don't really want to re-install everything. Is it possible to install win8 now that I have linux already installed? Note: I couldn't find any articles that teach how to do this on Google.


start-stop-daemon makes cron pidfile with wrong pid

I have an init.d script to start crond which specifies the following for start():               start-stop-daemon -S --quiet --make-pidfile --pidfile /var/run/crond.pid --background --exec /usr/sbin/crond However, the PID is **always** one number higher than what's recorded in /var/run/crond.pid. Does anyone have any idea what's going on here? I have approximately ten other init.d scripts that also make the same calls, and only cron.d has this issue. **EDIT:** This is interesting:               # /usr/sbin/crond &     #     [1]+  Done                       /usr/sbin/crond     # echo $!     737     # ps -eaf | grep crond     738 root     /usr/sbin/crond     740 root     grep crond     #


coLinux strange networking trouble

Installed coLinux, Debian, sshd inside, pcap-bridged networking, and I can connect to ssh service from coLinux console and from LAN. Now, the strange part: I **cannot** connect to Linux guest ssh service from host computer, the port responds but doesn't transfer anything: 192.168.44.8 is the ip address of the linux               ssh -v 192.168.44.8     OpenSSH_6.2p1, OpenSSL 1.0.1e 11 Feb 2013     debug1: Reading configuration data /etc/ssh_config     debug1: Connecting to 192.168.44.8 [192.168.44.8] port 22.     debug1: Connection established.     debug1: identity file /home/sorcerer/.ssh/id_rsa type -1     debug1: identity file /home/sorcerer/.ssh/id_rsa-cert type -1     debug1: identity file /home/sorcerer/.ssh/id_dsa type -1     debug1: identity file /home/sorcerer/.ssh/id_dsa-cert type -1     debug1: identity file /home/sorcerer/.ssh/id_ecdsa type -1     debug1: identity file /home/sorcerer/.ssh/id_ecdsa-cert type -1     debug1: Enabling compatibility mode for protocol 2.0     debug1: Local version string SSH-2.0-OpenSSH_6.2      and hung there Also I use telnet to diagnose connection problems (it shows better that the port responds but nothing gets through)               telnet 192.168.44.8 22     Trying 192.168.44.8...     Connected to 192.168.44.8.     Escape character is '^]'.      and hung there Again, I can connect with no problem to coLinux via ssh from another computer on lan. LE windows has firewall, but I disabled/enabled with same result: is working from lan even with windows firewall enabled (and no special rule in firewall) and not working from windows host even with windows firewall disabled.