Fastest way of finding files which contain exclusively some text

I'm trying to figure out the best and fastest way of finding files whose content is specifically " _something_ " Here's the reason: I have a process that I'm pretty sure stores its PID somewhere in a file, but I don't know where (and I want to find out). I have tried looking for filenames that may be used for storing said pid (`/var/run/myproc.pid`, and so on), but without success so far. I would like to give it a try searching for files whose content is **just** that number. I'd like to get the PID from `ps -aux` or `top`, or some tool like that and then search for files whose content is only that number. I've been googling around but all the answers seem to explain how to find files that contain " _something_ "... among its contents. I want something slightly different... I want an exact match of that " _something_ " Thank you in advance.


List all the html tags in a file

I want to know if there is a way to list all the html tags in a file. Lets say I have a file `file.html`               <html>     <head>     <title>Test</title>     </head>     <body>     This is a test     </body>     </html>      And I want to get a list of all the tags. That is:               <html>     <head>     <title>     </title>     </head>     <body>     </body>     </html>      I tried using sed,               cat file.html | sed 's/<[^>]*>//g'      But it removed all the html tags insted . . . .


Is there a way to make the history when pressing up in bash shared between shells?

I've seen this answer: Preserve bash history in multiple terminal windows This works for history, but I'm wondering if there is way to extend this so pressing "up" is shared as well?


Distro agnostic init script dependencies

I'm trying to write an init script which will be able to handle basic dependencies (for example, It has to be started (just) before MySQL service starts). Is there a distro agnostic way to write such a script? And if not, how many version of the init script would there have to be to cover Ubuntu, Debian and RHEL/Centos (5.x and 6.x)?


QEMU how to ping host network?

I'm trying to ping from guest to my host network without success.               qemu-system-x86_64 -hda debian_squeeze_amd64_standard.qcow2 -netdev user,id=user.0 -device e1000,netdev=user.0      I try to ping a random machine:               $ ping 10.0.2.21     Destination Host Unreachable      In the guest I'm only able to ping the host 10.0.2.2 (DHCP server).


How do I get 'realpath' to find my symbolic link?

I am on MacOSX using `bash` as my shell. I have symbolic link, created like this:               ln -s /usr/bin/python python2       I have a package that uses python2 and I want to create a symbol link in my current working directory to `/usr/bin/python` which is actually python2. When I do a `python2` from the command line I get this error:               python2: realpath couldn't resolve "/usr/bin/python2"      But invoking it like this `./python2` resolves the path correctly. My `PATH` has `.` in it. In fact I modified it, for testing, to only have `.` in it. How do I resolve this? Thanks! * * * ## Context A number of the suggested solutions below won't work for me. I tried to distill my question as focused and brief as possible so that people wouldn't drown in a sea of text, but clearly I need to provide more background. I'm trying to do develop on a package that I cloned from git. The original package, `git-multimail`, is/was developed on some variant of Linux (I'm guessing Ubuntu). **I've been trying to modify it to be able to use it and its test suite on MacOSX with as little modification as possible.** Here's why some of the proposed solutions aren't ideal:   1. **As root, create a`python2` symlink in /usr/bin/.** I'm looking for a solution that wouldn't require this. This was an obvious option at the beginning, but I'd like a solution that modifies the host system as little as possible. This is why I wanted to create a temporary symlink in the current working directory, add the CWD (i.e. `.`) to my path, and then destroy this when finished (i.e. the symlink).   2. **Create a wrapper script to call the python script with the existing python.** The problem with this is that much of the test suite uses the actual script_files as executables, depending on shebang to find the correct execution environment. This would mean editing the test suite considerably. In this context, (see below for a snippet of the test-framework), I would have to add a wrapper for every `.py` file; further the user/developer would have to be aware of different rules for using the package depending on what system they are on (i.e. on MacOSX make sure you don't use the python files without invoking them via the wrapper or explicitly calling `/usr/bin/python file.py`).              #! /bin/sh          D=$(cd $(dirname "$0") && pwd)     MULTIMAIL="$D/../git-multimail/git_multimail.py"     POST_RECEIVE="$D/../git-multimail/post-receive"          TESTREPO=$("$D/create-test-repo")          HOME="$D"     XDG_CONFIG_HOME="$D"     GIT_CONFIG_NOSYSTEM=1     export HOME XDG_CONFIG_HOME GIT_CONFIG_NOSYSTEM          cd $TESTREPO          test_email() {         REFNAME="$1"         OLDREV="$2"         NEWREV="$3"         echo "$OLDREV" "$NEWREV" "$REFNAME" | USER=pushuser "$MULTIMAIL"          }         3. **Changing all`python2` references to `python`.** The README suggests this, but this effectively makes version control useless since the system sees the change as new version, when in fact it's not (semantically). I've been using (3) but I'm trying to find a better solution. I'm willing to accept that this is just the way things are (i.e. there's not a suitable way to point 'python2' to `/usr/bin/python` that is portable and unobtrusive without a lot of changes to the test suite and actual framework).


copy files modified after specific date using cp switches

When I execute the command `find . -mtime -60` I get the list of files modified within the last 60 days. So when I execute `find . -mtime -60 -exec cp {} /tmp/1 \;` I can copy these files to a new directory for processing However if I want to preserve the timestamps, I am unable to copy just the files needed when I execute `find . -mtime -60 -exec cp -LR --preserve=timestamps {} /tmp/2 \;` What ends up happening is that ALL files in the source directory are copied instead of just the files I need. Any solution here?


Tomcat fake start on startup with init.d

I have my tomcat (tomee) installation at `/opt/tomee` and I can correctly launch it with:               $ /opt/tomee/bin/startup.sh     Using CATALINA_BASE:   /opt/tomee     Using CATALINA_HOME:   /opt/tomee     Using CATALINA_TMPDIR: /opt/tomee/temp     Using JRE_HOME:        /usr/lib/jvm/java-6-openjdk-i386     Using CLASSPATH:       /opt/tomee/bin/bootstrap.jar:/opt/tomee/bin/tomcat-juli.jar      It works at localhost:8080 . Now I want to launch tomcat on machine startup. So I make file at /etc/init.d/tomee :               #!/bin/sh          main () {       case "$1" in         stop)           echo "Stopping Tomee `date`"           sudo -u vagrant /opt/tomee/bin/shutdown.sh           ;;         start)           echo "Starting Tomee `date`"           sudo -u vagrant /opt/tomee/bin/startup.sh           ;;         restart|force-reload)           echo "Restarting"           sudo -u vagrant /opt/tomee/bin/shutdown.sh           sudo -u vagrant /opt/tomee/bin/startup.sh           ;;         *)         # wrong command           echo "Unknown command: '$1'"           ;;       esac     }          main "$1" 2>&1 >> /opt/tomee/init.log     exit 0      To check it:               $ sudo service tomee start     $ cat /opt/tomee/init.log      Starting Tomee Fri Mar  7 00:00:40 UTC 2014     Using CATALINA_BASE:   /opt/tomee     Using CATALINA_HOME:   /opt/tomee     Using CATALINA_TMPDIR: /opt/tomee/temp     Using JRE_HOME:        /usr     Using CLASSPATH:       /opt/tomee/bin/bootstrap.jar:/opt/tomee/bin/tomcat-juli.jar      And it still works fine - localhost:8080. Finally I set update-rc.d When I turn on the system, log file is written but Tomcat is not running:               $ cat /opt/tomee/init.log      Starting Tomee Fri Mar  7 00:00:40 UTC 2014     Using CATALINA_BASE:   /opt/tomee     Using CATALINA_HOME:   /opt/tomee     Using CATALINA_TMPDIR: /opt/tomee/temp     Using JRE_HOME:        /usr     Using CLASSPATH:       /opt/tomee/bin/bootstrap.jar:/opt/tomee/bin/tomcat-juli.jar     Stopping Tomee Fri Mar  7 00:04:43 UTC 2014     Using CATALINA_BASE:   /opt/tomee     Using CATALINA_HOME:   /opt/tomee     Using CATALINA_TMPDIR: /opt/tomee/temp     Using JRE_HOME:        /usr     Using CLASSPATH:       /opt/tomee/bin/bootstrap.jar:/opt/tomee/bin/tomcat-juli.jar     Starting Tomee Fri Mar  7 00:04:57 UTC 2014     Using CATALINA_BASE:   /opt/tomee     Using CATALINA_HOME:   /opt/tomee     Using CATALINA_TMPDIR: /opt/tomee/temp     Using JRE_HOME:        /usr     Using CLASSPATH:       /opt/tomee/bin/bootstrap.jar:/opt/tomee/bin/tomcat-juli.jar      I'm going crazy without any error, while using `service tomee start` or `/etc/init.d/tomee start` manually it works :( PS: Yes, I have noticed that JRE_HOME is different, but it with `service tomee start` it works anyway.


Trap: can't su as root, can't change group to wheel, ssh as root prohibited

Is this a trap? I made these steps in FreeBSD 10: > 1) ssh as root prohibited > > 2) logged as user > > 3) su as root > > 4) as root **chsh** changed name of user **"user"** to **"luser"** > > 5) exit from root And from this moment I can't **su root** cause the **luser** is not in the **wheel** group and I can't change group in **/etc/group** because I have no privileges for doing that. What can I do to login as root ?


syntax error in conditional expression while executing the shell script?

I am working on a project in which I need to make a url call to one of my server from the bash shell script..               http://hostname.domain.com:8080/beat      After hitting the above url, I will be getting the below response which I need to parse it and extract value of `syncs` and `syncs_behind`               state: READY num_retries_allowed: 3 syncs: 30 syncs_behind: 100 num_rounds: 60 hour_col: 2 day_col: 0 oldest_day_col: 0      Now I need to hit the above url every 10 seconds for a period of 10 minutes and extract the value of `syncs` and `syncs_behind` from it and use to validate it with below condition -               syncs > 8     syncs_behind = 0      if the syncs is greater than 8 and syncs_behind = 0, then I will end my shell script with some message saying - "Data has been validated", otherwise I would keep on trying for 10 minute window.. If in that 10 minute window, this doesn't happen I will end the shell script anyway meaning I won't retry again. So I started with the below code and I saved the file as `beat.sh` with the below contents –               #!/bin/bash          COUNT=60   #number of 10 second timeouts in 10 minutes     SUM_SYNCS=0     SUM_SYNCS_BEHIND=0          while [[ $COUNT -ge "0" ]]; do          #send the request, put response in variable     DATA=$(wget -O - -q -t 1 http://hostname.domain.com:8080/beat)          #grep $DATA for syncs and syncs_behind     SYNCS=$(echo $DATA | grep -o 'syncs: [0-9]+' | awk '{print $2}')     SYNCS_BEHIND=$(echo $DATA | grep -o 'syncs_behind: [0-9]+' | awk '{print $2}')     echo $SYNCS     echo $SYNCS_BEHIND          #add new values to the sum totals     let SUM_SYNCS+=SYNCS     let SUM_SYNCS_BEHIND+=SYNCS_BEHIND          #verify conditionals     if [[ $SYNCS -gt "8" -a $SYNCS_BEHIND -eq "0" ]]; then exit -1; fi          #decrement the counter     let COUNT-=1          #wait another 10 seconds     sleep 10          done      And when I am running it as `./beat.sh`, I got below error -               ./beat.sh: line 23: syntax error in conditional expression     ./beat.sh: line 23: syntax error near `-a'     ./beat.sh: line 23: `if [[ $SYNCS -gt "8" -a $SYNCS_BEHIND -eq "0" ]]; then exit -1; fi'      Any thoughts what wrong I am doing here?


Postfix configuration - keep the envelops

I have a postfix server that delivers mail and send a copy of the outgoing mail to a second server for content analysis using the following configuration (addresses and IPs have been replaced): **main.cf content**               sender_bcc_maps = pcre:/$config_directory/sender_bcc      **sender_bcc content**               /^(.*)@(.*)$/                   ${1}@tst.example.com      **transport_maps content**               tst.example.com     smtp:[192.168.1.1]      Unfortunately, the configuration above doesn't preserve the envelop so I don't get the original recipient on the second server. The goal in having the original recipient is to catch BCCs. Is there a way to do it just by configuring Postfix? An example of a good result would be to have postfix add something like               x-bcc: test@example.com     or     x-original-recipient: test@example.com      to the email headers sent to the second server (and only them. We don't want to add a bcc header or anything like that to the email that is delivered to the users, obviously). I've looked everywhere and haven't found anything to add the original recipient. Maybe there's another way? Any suggestion to reach the final goal is welcome!


`find` with multiple `-name` and `-exec` executes only the last matches of `-name`

When I'm using `find . -type f -name "*.htm*" -o -name "*.js*" -o -name "*.txt"` it finds all the types of file. But when I add `-exec` at the end: `find . -type f -name "*.htm*" -o -name "*.js*" -o -name "*.txt" -exec sh -c 'echo "$0"' {} \;` it seems it only prints `.txt` files. What am I doing wrong? Note: using MINGW (Git Bash)


find -exec doesn't do what find output suggests

If I do this `find`:               find ${TRIADS_DIR}/*.dc.results -path "*amblock/stats.*HEAD" -o -path "*amblock/stats.*BRIK"      then I get what I expect in STDOUT:               tp101.day1.dc.results/amblock/stats.tp101_day1+tlrc.HEAD     tp101.day1.dc.results/amblock/stats.tp101_day1+tlrc.BRIK     tp101.day2.dc.results/amblock/stats.tp101_day2+tlrc.HEAD     tp101.day2.dc.results/amblock/stats.tp101_day2+tlrc.BRIK     ...      If I add an `-exec` clause to link the found files:               find ${TRIADS_DIR}/*.dc.results -path "*amblock/stats.*HEAD" -o -path "*amblock/stats.*BRIK" -exec ln -s {} ${TRIADS_GROUP} \;      then it only links the BRIKs:               stats.tp101_day1+tlrc.BRIK@     stats.tp101_day2+tlrc.BRIK@     ...      ### Questions   * What's happening?   * Is there a more efficient way to tell find to return .HEAD and .BRIK using a single wildcard expression? I tried things like:              find ${TRIADS_DIR}/*.dc.results -path "*amblock/stats.*{HEAD,BRIK}"      but couldn't get it to work.


TPROXY for redirecting UDP on arbitrary ports

I want to intercept all UDP traffic leaving tap1. And possibly reply to e.g. DNS-requests. To accomplish this I wrote some python code listening to localhost and use _iptables_ with a rule-set like this:               Chain PREROUTING (policy ACCEPT 2 packets, 333 bytes)      pkts bytes target     prot opt in     out     source               destination                 0     0 DIVERT     udp  --  tap1   any     anywhere             anywhere             socket         0     0 TPROXY     udp  --  tap1   any     anywhere             anywhere             TPROXY redirect 127.0.0.1:5001 mark 0x1/0x1               Chain DIVERT (1 references)      pkts bytes target     prot opt in     out     source               destination                  0     0 MARK       udp  --  any    any     anywhere             anywhere             MARK set 0x1         0     0 ACCEPT     udp  --  any    any     anywhere             anywhere      Policy routing is done with:               ip rule add fwmark 1 lookup 100     ip route add local 0.0.0.0/0 dev lo table 100      This setup was adapted from the kernel's Documentation/networking/tproxy.txt. This works flawlessly for a TCP socket opened with the IP_TRANSPARENT option. Unfortunately UDP sockets don't seem to be able to handle connections. For example if I do a `ncat -u localhost 1234` the socket will receive data but cannot send anything back. Wireshark will show exactly three packets for:   1. the incoming ncat packet (to localhost:1234)   2. the outgoing packet of my software (to :5001)   3. an ICMP Port unreachable (of course) For arbitrary ports to work I guess it's not feasable to set up proper (S)NATting rules. So, what's the necessary setup to make this work for _arbitrary_ incoming ports?


[solved]Package manager in FreeBSD 10

I was trying to install a package using `pkg add`, but I got the reply that > package manager not installed To install that I used:               tar -C /tmp -zvxf pkg-1.2.1_1.txz      and then:               /tmp/usr/local/sbin/pkg-static pkg-1.2.1_1.txz      It worked out for the first time. But when I rebooted my PC I got an error: > error exit delayed from previous errors How to install package manager from FreeBSD installation DVD now?


Howto find and move a text line inside a file?

I need to change a text line position inside a file; from one line position to another one, underneath a defined text. For example, I have the following text block (on /etc/pam.d/system-auth file)               account  required   pam_unix.so     account  sufficient pam_localuser.so     account  required   pam_permit.so     account  required   pam_tally2.so      And I want to 'move' the last line to be on the 2nd line (underneath the one which contains pam_unix.so) How can this by done using a Perl command?


exclude certain key combinations from being passed via rdesktop

When connected via `rdesktop` to a remote machine, normally all keys pressed inside the active rdesktop window are transferred to the remote machine. Is it possible to define key strokes, which are excluded? By that I mean, when pressed while the rdesktop window is active, these keystrokes will act locally. A concrete example is the key kombination `CTRL+ALT+LEFT` and `CTRL+ALT+RIGHT` which I use on my local machine to switch between virtual desktops. The remote machine does not have any virtual desktops, and this key combination has no effect there. But the key strokes are "eaten" by the rdesktop window nevertheless. I am not sure on what level this should be done. My guess is, that the keystrokes would have to be intercepted before they are passed to rdesktop. Is there any way to achieve this? My local machine is Debian Wheezy with LXDE.


Wait for move directory to be completed before attempting to delete it

I have a process running on one computer that spawns simulations by writing the simulation data to directory `pre/id`. Worker processes then copy a simulation from `pre` to a local disk, which can be on a different computer. `pre` is in a volume mounted with nfs. This part works well. When a simulation is done, the results are moved to the directory `result/id`, which is what is causing trouble. The supervising process can decide to keep such a directory or to delete it. Occasionally, when it tries to delete `result/id`, the move operation seems to be incomplete, and removing the directory fails. Everything runs on a variety of linux flavors. The workers move directories around using `mv` and then `touch result/id/done` to signal to the supervising process that the result can be read (and deleted). The supervising process uses `boost::filesystem::remove_all` to delete `result/id`. How can I reliably wait for the move operation to be completed, before attempting to delete it? * * * **Added:** This code moves the result directory to where the supervising process waits for it:               mv $tempDir $finishedCasesDir # copy case to result directory     touch $finishedCasesDir/$caseName/done      This is the C++ code that waits for `done` to appear:               if(is_regular_file(resultPath/"done"))     {       // get relevant result data       ...       // remove result directory       remove_all(resultPath);     }      And the error:               terminate called after throwing an instance of 'boost::filesystem3::filesystem_error'     what():  boost::filesystem::remove: Directory not empty: "results/711a35ed-818e-4084-ab43-47531fdd8d11"


How to put “glue” CWD (etc.) to part of the screen instead of putting into PS1?

_I suspect there’s some terminology for this question that I’m not aware of. It’s hard to check if a question has already been answered if one doesn’t know the proper vocabulary. So, sorry if this is a repeat question…_ * * * I’ve slowly become comfy with bash over the past 2 years or so. (I use the Homebrew package manager for OS X to install the latest version whenever the package is updated. At the time of this writing, that’s version 4.2.37.) The thing is, I’m one of those people who likes to have certain pieces of information on the screen at all times. For many hackers, this simply means customizing `PS1`. And I’ve done that. But it’s not enough. I’d like to have some more information displayed at all times, but I don’t want my prompt to grow into an unruly monster. * * * `less` provides an option to always display the status of a currently displayed manpage. One such option is the position of the current document. So, if (for example) you’re currently viewing the document 73% of the way through, it will display `73%` at the bottom of the screen. **Is there a way to “glue” some information like`CWD`, IP address, etc., into a “status bar” in bash?**


tail -f produces no output in Ubuntu live CD

For some test I start Ubuntu Live from USB. I'm trying to use _tail_ command to show debug log, but it doesn't work. I also test opening two terminals (`t1`, `t2`) with this code: `t1`:               touch a       `t2`:               tail -f a      `t1`:               for i in `seq 1 10`; do echo $i >> a; sleep 1; done      Nothing in `t2`! What can be the cause?


7zip context menu appears twice

7zips context menu appears twice to me when I right-click to a file.. Same thing happens in both dolphin and krusader. It looks like this: ![http://i.imgur.com/pO7KM.jpg](http://i.stack.imgur.com/KFIig.jpg) I've found 7zips readme.txt in /usr/share/kde4/services/ServiceMenus/ and this is one of the things in it:               3) installing the context menu for KDE   (dolphin or konqueror)       (tested on Ubuntu 10.10)     --------------------------------------------------        for all:        cp GUI/kde4/*.desktop /usr/share/kde4/services/ServiceMenus/      these are the 7zip files in that are located in that folder at the moment:               p7zip_compress2.desktop     p7zip_compress.desktop     p7zip_extract.desktop     p7zip_extract_subdir.desktop     p7zip_extract_to.desktop     p7zip_test.desktop      I guess some of them are extra but I am not sure which ones can be removed. I am using Arch with KDE and the packages are at the most recent versions. Did anyone else encounter this problem? Does anyone have an idea how to solve it so it would appear only once? I've been having this problem for a few months now (since I installed 7zip actually).


Use command grep and locate

How I can make the grep command locate certain words in the files specified by the routes found by the locate command?               locate my.cnf | grep user         (I want that grep command search the word "user" on the files found for locate command)


How to start plasma-desktop from SSH-console on desktop session?

I killed KDE's plasma-desktop on a openSUSE 11.2 machine, because it was eating too much CPU. How can I restart it via SSH or another tty session? On the affected computer there is only shown a blinking cursor on the screen, but I cannot type anything. If I try "kstart plasma-desktop" over SSH the error message of course is "kstart: cannot connect to X server", because I haven't enabled X11-forwarding. But nevertheless "kstart plasma-desktop" is not the completely correct, because I want to start plasma-desktop on a desktop session and not over SSH on my computer. I hope I have been somewhat clear. I am looking forward to your help!


Drop into an editor from inside aspell

I'm writing my doctoral dissertation using vim and LaTeX, and I spell-check the document using aspell. Sometimes I run across an error that can't suitably be fixed using the built-in spell-check options in aspell. For example the last time I ran into a spell check problem on a repeated word. In addition to fixing the spelling error, I also had to delete on occurence of the word, but aspell didn't give me a way to do that. Is there a way to drop into my editor at the point where aspell finds an error, in order to do more extensive fixes there?


Is my SSH key paired with me as a human, or with my user account on one machine?

In the past few days, I have been trying to acquaint myself with SSH, and I hope that I've understood it. One question remains, however -- is my key associated with me (as the user) or my user account on the machine?


Setting dual monitor with different resolutions using ati open source driver

I have **two** Monitors and am using Arch Linux, setup like this:   * 1280x1024(primary)    * 1680x1050.(secondary)   * ATI RADEON X1300   * Open source ATI driver On the boot screen my primary monitor(17") have correct resolution, my second CLONES the first and has same resolution(1280x1024). I have to run `xrandr` TWICE after starting X to get correct resolution.               xrandr --output DVI-0 --mode 1280x1024 --output DVI-1 --mode 1680x1050 --left-of DVI-0      I tried to make this permanent, by adding the `xrandr` command to `.xinitrc`, but it didn't work. Now, if I wan't to get the correct resolution on both monitors, after starting X, I run `xrandr` TWICE. I didn't define anything in `xorg.conf` (nor do I know how :) ) What can I do to fix this?


Mutter and Intel GMA 4500MHD

I am trying to use Mutter with my Intel GMA 4500MHD (on my Thinkpad T400) in Debian Wheezy. However, it says: > Not using GLX TFP and some effects get very slow. How can I fix that?


Pass xargs argument as a string to another command with '>'?

Suppose I have a bunch of files in `/tmp/`. I do               find . -type f | xargs -iFILES      And I want to do a `md5sum` in each file, outputting to a file with the same name, but with `.md5` extension.               find . -type f | xargs -iFILES md5sum FILES > FILES.md5      This is supposed to create a md5 file for each file found by find command. Instead, it creates a single FILES.md5 file on disk with checksums from all files. How do I say to md5sum command that the FILES represent the current filename and not a FILES literal string?


Add latency when accessing certain websites under linux

I've been playing with `tc` on my local machine. `sudo tc qdisc add dev eth0 root netem delay 2000ms` adds a 2-second latency to all traffic going through `eth0`. What I want is to be able to limit this latency to certain websites. I've tried playing with filters on specific IP addresses (Google's, for instance) but nothing seems to work. Any ideas on how I can do this using `tc`? Is it the best tool for the job?


Which of the bigger distributions offers the latest updates?

I am currently using Ubuntu and I appreciate the big community, the Software Center and the fact that it's very easy to use. But additionally I'd like to have the latest updates, like e.g. LibreOffice 3.4. Which distribution should I try?


How to install multiple versions of the same package in Gentoo?

I would like to install two (or more) versions of the same packages on my Gentoo system. I know for sure there won't be any file clash, since there very few files installed and each of them is named after the version. I know about slots, but these are specified in the ebuild files, and let's assume I don't want to edit any ebuild file for several reasons. I would like the installed versions to be part of the world package, so they can be reinstalled or uninstalled as usual. Is there a way to install multiple versions of the same package? Do you know of some Portage tricks to achieve that?


Finding screen resolutions without $DISPLAY through python or shell scripting

I am developing a personal project/idea for a headless Raspberry Pi that works without a GUI display. I am working on a text graphicsesque design. As the Raspberry Pi allows one to plug into most any screen, I want to be able to determine the screens resolution so I can create an optimal display. My problem lies in actually getting the screens resolution. I have tried a few methods in python, such as messing with `xrandr` and the the Tkinter module, but both have the same problem. There technically isn't a screen, just a console. Text editors like vim seem to be able to fit themselves without any problem. Can I get a screens resolution, without having to load up a display? All suggestions welcome, but my proficiencies are in the Python, C++, Java and Bash range.


Grep and regex, Why does the following return only a specific portion?

Why in the following:               echo this is a line. | grep -o -E "[a-z]+\."      The result is `line.` and not `this is a line.`? There is no word boundary or any other restriction on the regex.


How do I configure OpenVPN as a Gateway client for Witopia?

I have the following setup:   * Witopia SSL account   * Synology 409 NAS (with OpenVPN and Apache etc)   * PS3   * Mac    * Apple AirPort router (configured for NAT)   * Locked IPT-box (using DHCP and NAT traversing)               Internet     |     Router (192.168.0.1)     |     |--NAS     |--Mac     |--PS3     |--IPT-box      Requirements:   1. The NAS should handle the VPN connection with Witopia.    2. All connections originating outside the Router and who are routed to the NAS or Mac should reach its target. Nothing originating from outside should enter the VPN tunnel.   3. All connections that originates behind the router and are "aimed specificly" at the NAS should reach it and not be hijacked by the VPN tuinnel.(NFS, SBM, HTTP etc.)   4. Connections that originates from applications on the NAS and terminates anywhere outside the router should go through the VPN tunnel.   5. All connections from PS3 that terminates outside router should go through the tunnel. Connections from PS3 to NAS (SMB, NFS, DLNA etc) should not go through the tunnel, but be served by the NAS.   6. All connections to and from the IPT-box should go direct via the router, not the tunnel. Is this possible with the hardware that I already have? How and where should I configure it? /BE


Iso booting with grub2

I am using Linux Mint 10, and it is installed on `sda8`. I edited `/etc/grub.d/40_custom`:               #!/bin/sh     echo "Adding 40_custom.">&2     exec tail -n +3 $0     # This file provides an easy way to add custom menu entries. Simply type the     # menu entries you want to add after this comment. Be careful not to change     # the 'exec tail' line above.          menuentry "fedora ISO" {         loopback loop (hd0,8)/boot/iso/Fedora-14-i386-DVD.iso         linux  (loop)/isolinux/vmlinuz boot=isolinux iso-scan/filename=/boot/iso/Fedora$         initrd (loop)/isolinux/initrd.img     }      Then I ran `sudo update-grub2`. After rebooting, I chose “Fedora ISO”. The computer restarted. I tried following this guide, but it didn't help. Do I need to change the file permissions of the `boot` and `casper` folders or there is some other problem?


Is -r mandatory for grep?

In a directory I have a file that contains the word `string`.   When I do: `grep "string" .` no results are returned.   But when I do `grep -r "string" .` the file is returned.   Why is `-r` option needed? It does not look inside internal subdirectories.


Geany feature or plugin to show members of a class

Im using ubuntu 12.04. For c++, is there a functionality (or plugins that will provide this) in Geany which enables suggestion/hint list of all members of a class, also classes from a linked library? I mean like in Java, when you type dot(.) after an object instance variable, all of its members (methods and public variables are shown). This also applies when importing packages and classes. For example in Java(using Eclipse):               Vector<Object> vec = new Vector<Object();     vec.[here after typing a dot(.), all public members of Vector are shown as hints]      or in Visual C++:               std::[here, a list of all members of std are shown]      I'd like to have this kind of feature in Geany because its hard to memorize the correct function or header names in C++. Is there a functionality in Geany just like I mentioned above? Or any plugins to achieve this? I know there's autocompletion in Geany, but it only works when you already used or called that specific function/variable once. Thanks.


Slow Linux machine

Every time I login (via `ssh`) in my Linux/debian computer it takes too long for the password prompt to appear. Also, every time I try to run a python script or a `tcpdump` it takes too long until it starts. Anyone knows how to solve this?


Linux: How to calculate/find the slackspace of a file?

How would I go about finding the slackspace of a file, for instance.               fls -o 63 /images/diskimg.dd      istat -o 63 /images/diskimg.dd 31     icat -o 63 /images/diskimg.dd | xxd | less      In which of these commands would I use to find the slackspace? Or is there another? How would I also go about finding information that could be stored in the slackspace? I found out that using the -s option will allow me to look through the slackspace of the file with the icat command, still not sure to go about calulculating the slackspace size, dont fancy adding it up with icat.


On system memory... specifically the difference between `tmpfs,` `shm,` and `hugepages...`

I've been curious lately about the various Linux kernel memory based filesystems. _`Note:`_ As far as I'm concerned, the questions below should be considered more or less optional when compared with a better understanding of that posed in the title. I ask them below because I believe answering them can better help me to understand the differences, but as my understanding is admittedly limited, it follows that others may know better. I am prepared to accept any answer that enriches my understanding of the differences between the three filesystems mentioned in the title. Ultimately I think I'd like to mount a usable filesystem with _`hugepages,`_ though some light research (and still lighter tinkering) has led me to believe that a _`rewritable hugepage mount`_ is not an option. Am I mistaken? What are the mechanics at play here? Also regarding _`hugepages:`_                    uname -a     3.13.3-1-MANJARO \     #1 SMP PREEMPT \     x86_64 GNU/Linux              tail -n8 /proc/meminfo     HugePages_Total:       0     HugePages_Free:        0     HugePages_Rsvd:        0     HugePages_Surp:        0     Hugepagesize:       2048 kB     DirectMap4k:     8223772 kB     DirectMap2M:    16924672 kB     DirectMap1G:     2097152 kB      _(Here are full-text versions of/proc/meminfo and /proc/cpuinfo )_ What's going on in the above? Am I already allocating _`hugepages?`_ Is there a difference between _`DirectMap`_ memory pages and _`hugepages?`_ **Update** After a bit of a nudge from @Gilles, I've added 4 more lines above and it seems there must be a difference, though I'd never heard of _`DirectMap`_ before pulling that _`tail`_ yesterday... maybe _`DMI`_ or something? Only a little more... Failing any success with the _`hugepages`_ endeavor, and assuming harddisk backups of any image files, what are the risks of mounting loops from _`tmpfs?`_ Is my filesystem being _`swapped`_ the worst-case scenario? I understand _`tmpfs`_ is mounted filesystem cache - can my mounted loopfile be pressured out of memory? Are there mitigating actions I can take to avoid this? Last - exactly what is _`shm,`_ anyway? How does it differ from or include either _`hugepages`_ or _`tmpfs?`_


Will having dozens of inactive logins hurt performance

I work on a cluster shared with ~20 users, many of them operating remotely. It's quite common to open the login node, type `users` and see ~100 users listed, mostly the same user logged in multiple times. The cpu use from all these logins is negligible, as is the memory use, but somehow it just _seems wrong_. The login node is also often rather sluggish, so while it's difficult to dissociate this from network latency I wonder if it's related. Will these logins somehow slow down interactive sessions on the remote machine in ways that won't show up when I run `top` (i.e. even if they aren't consuming much memory / cpu)?


How to use wget --wait option when using input from a file?

I have a text file with a list of urls I want to download. I want wget to wait before downloading the next url. I'm using               cat urls.txt | xargs -n1 -i wget --wait=30 {}      However there is no wait between urls. Can I use wget's --wait option for this? Other alternatives?


How can I use $var in a shell brace expansion of a sequence?

I want to use `$var in` a shell brace expansion with a range, in bash. Simply putting `{$var1..$var2}` doesn't work, so I went "lateral"... The following works, but it's a bit kludgey.               # remove the split files     echo rm foo.{$ext0..$extN} rm-segments > rm-segments     source rm-segments      Is there a more "normal" way?


Monitor file access count by user

I have written a script which is deployed just by putting it in a globally accessible location for all users. I want to log the usage of this script. Is there a way in Linux to find out how many times a file was read/accessed?   And if possible to determine by who ? Edit: I do not have the root privileges, and `auditd` isn't an option, since its not already available.


Openning root terminal by keyboard shortcut

I am using Debian Linux and I am setting some shortcuts on it. So in keyboard window I went to shortcut, added `gnome-terminal`, and set `Ctrl` + `t` as the keys. But in Debian we also have "Root Terminal" so we can open a terminal session as root. I want to set a shortcut for this. What command I should allocate to it?


kickstart is frozen at 100%

I'm trying to install CentOS 6.5 into virtualbox using packer, but the install screen is freezing at 100%: ![enter image description here](http://i.stack.imgur.com/lkoGk.png) The other consoles are showing the following information: `Alt`+`F2` (blank screen) `Alt`+`F3`               ...     07:14:55,644 INFO   : transferring http://10.0.2.2:8081/centos-6.5/ks.cfg      `Alt`+`F4`               ...     INFO NetworkManager: <info> Activation (eth0) Stage 5 of 5 (IP Configure Commit) complete      `Alt`+`F5` (blank screen) * * * My kickstart config is here


Getting both AMD Catalyst and Touchpad to work on Samsung Laptop(NP730U3E)

I have a Samsung NP730U3E Laptop, and have huge problems finding a good Linux installation for it. I've tried several distributions, but all have had some major draw back:   * Ubuntu and UbuntuGnome (12.04 & 13.10) worked like a charm until I tried to install Amd Catalyst to get the AMD Radeon HD 8570M graphics card to work. At first it seemed like everything was fine, but on the first reboot everything crashed. It just went black and froze. I could get into the terminal via Ctrl+Alt+F2, but all graphical interfaces seemed dead.   * On Debian 7.4 on the other hand the graphics drivers worked like a charm! Stable and working! Unfortunately my touch pad didn't work, so that rendered it useless.   * Fedora 20 works great with the synaptics drivers for the touch pad, but Catalyst doesn't seem to install (have tried both 13.12 and 14.3 Beta drivers). It just outputs: > One or more tools required for installation cannot be found on the system. > > Install the required tools before installing the fglrx driver. Optionally, > run the installer with --force option to install without the tools. Forcing > install will disable AMD hardware acceleration and may make your system > unstable. Not recommended. > > See /usr/share/ati/fglrx-install.log for more details. The `/usr/share/ati/fglrx-install.log` looks as follows: > Supported adapter detected. Check if system has the tools required for > installation. fglrx installation requires that the system have kernel > headers for 3.7 release. > /lib/modules/3.11.10-301.fc20.x86_64/build/include/generated/uapi/linux/version.h > cannot be found on this system. One or more tools required for installation > cannot be found on the system. Install the required tools before installing > the fglrx driver. Optionally, run the installer with --force option to > install without the tools. Forcing install will disable AMD hardware > acceleration and may make your system unstable. Not recommended. Any ideas on how to get both the graphics drivers and touch pad to work?


Understand the Route table

I just setup the OpenVPN and it is working as expected. However, the routing table of the client is confusing me to no end. Here is the route table:               # route -n     Kernel IP routing table     Destination     Gateway         Genmask         Flags Metric Ref    Use Iface     10.8.0.5        0.0.0.0         255.255.255.255 UH    0      0        0 tun0     10.8.0.1        10.8.0.5        255.255.255.255 UGH   0      0        0 tun0     54.202.18.143   10.0.2.2        255.255.255.255 UGH   0      0        0 eth0     10.0.2.0        0.0.0.0         255.255.255.0   U     1      0        0 eth0     169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth0     0.0.0.0         10.8.0.5        128.0.0.0       UG    0      0        0 tun0     128.0.0.0       10.8.0.5        128.0.0.0       UG    0      0        0 tun0     0.0.0.0         10.0.2.2        0.0.0.0         UG    0      0        0 eth0      So lets dissect it line-by-line   1. Any packet destined for `10.8.0.5` has no gateway and will use `tun0`   2. any packet destined for `10.8.0.1` will use `10.8.0.5` as gateway via `tun0`   3. any packet destined for `54.202.18.143` will use `10.0.2.2` as gateway via `eth0`   4. any packet destined for `10.0.2.0/24` has no gateway and will use `eth0`   5. Lets ignore the 169.254.0.0 part   6. All other packets (destined for `0.0.0.0`) will us `10.8.0.5` as default gateway via `tun0`. **So this is default gateway, isn't it?**   7. Any packet destined for `128.0.0.0/7` will use `10.8.0.5` as default gateway via `tun0`   8. All other packets (`0.0.0.0`) will use `10.0.2.2` as default gateway via `eth0` **Questions:**   * Do I have 2 default gateways if we consider point 6 and 8? (there can be only 1 Default Gateway though, so I know I am wrong but can't justify) ( _probably answered, see below_ )   * Considering point 1 and 2, anything going for `10.8.0.1` is not really using any gateway via tun0. Is this correct?   * Considering point 3 and 4, anything going for `54.202.18.143` is not really using any gateway via `eth0`. Is this correct? **UPDATE...** After reading this, I found some more information. The below lines makes a lot of sense to me now:               0.0.0.0         10.8.0.5        128.0.0.0       UG    0      0        0 tun0     128.0.0.0       10.8.0.5        128.0.0.0       UG    0      0        0 tun0      So, the 1st line is defining `0.0.0.0/128.0.0.0` and second one is defining `128.0.0.0/128.0.0.0`. Essentially:               0.0.0.0/128.0.0.0 = 0.0.0.0/1 = 128.0.0.0 TO 255.255.255.255     128.0.0.0/128.0.0.0 = 128.0.0.0/1 = 0.0.0.0 TO 127.255.255.255      So, above 2 routes are covering the entire IPv4 Address range `[0.0.0.0 TO 255.255.255.255]`. It is a clever way of OpenVPN to add a default route without replacing the original default route and this default route will be routed via `tun0`. So I think I have an answer for my first question: > Do I have 2 default gateways if we consider point 6 and 8? NO, there is only one default gateway and that is :               0.0.0.0         10.0.2.2        0.0.0.0         UG    0      0        0 eth0


Find the owner of a directory or file, but only return that and nothing else

I am looking for a command that will return the owner of a directory and only that--such as a regex parsing the `ls -lat` command or something similar? I want to use the result in another script.


Why did 'apt-get install ffmpeg' fail?

I dont understand how or why apt-get install failed. It mentions ssmtp which is simple smtp which i use to send mail from my server to my google apps account. I dont understand what is wrong or how to fix it. I am using debian squeeze.               # apt-get install ffmpeg     ...     Setting up libswscale0 (4:0.5.2-6) ...     Setting up ffmpeg (4:0.5.2-6) ...     Errors were encountered while processing:      ssmtp     E: Sub-process /usr/bin/dpkg returned an error code (1)          # sudo apt-get install ffmpeg     sudo: unable to resolve host debian     Reading package lists... Done     Building dependency tree     Reading state information... Done     ffmpeg is already the newest version.     0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.     1 not fully installed or removed.     After this operation, 0 B of additional disk space will be used.     Do you want to continue [Y/n]? y     Setting up ssmtp (2.64-4) ...     hostname: Name or service not known     dpkg: error processing ssmtp (--configure):      subprocess installed post-installation script returned error exit status 1     configured to not write apport reports                                           Errors were encountered while processing:      ssmtp     E: Sub-process /usr/bin/dpkg returned an error code (1)


How to restart Java with a specific argument?

While running my Minecraft server, I noticed the following message outputted in the console.               24.01 02:11:04 [Server] INFO Warning, your max perm gen size is not set or less than 128mb.     It is recommended you restart Java with the following argument: -XX:MaxPermSize=128M      I was wondering what exactly the max perm gen size is, and more importantly, how can I restart Java via command line with this argument? I tried searching for how to restart Java, but there does not seem to be any documentation on how to do this via command line.


How to execute as the logged-in user in a sudo script (OSX)?

Is there a way to switch contexts like that? The script in my specific case is an installer postinstall script, which requires sudo privileges only for some of the tasks and **requires** the logged-in user to execute a LaunchAgent at the end of the script. If this agent is started with sudo privileges, paths to logs and other resources that are user specific (placed in the user dir) get messed up.


How to create a directory which will have access to the user who is installing a package?

I am packaging one of my projects on Debian. The project expects a directory to be created at `XDG_DATA_HOME` or `~/.local/share/` where the data files will be kept. Now I am trying to create and feed the initial data using `postinst` script shipped with the `.deb` package. The problem is since packages are installed as root, the directory is getting created as root and the user who is installing it won't have write permission on it. My question is how can I create the directory so that the user who is installing the package will have write permission on it and all subdirectories?


How to replace a hyphen with a word

I have the following text:               Since the 1-93 fragment contains additional     residues 84–93.      The first hypen found in "1-93" is fine when I process the text but the second one, am not sure it is a hypen or another character that caused my problems, so I need to replace this "–" in text so at the end to get: 84 to 93 instead. Kindly how to do that.


How to use gnome-session-save from cron?

I am trying to issue the `gnome-session-save --kill` command via crontab. I used the command `sudo crontab -e`. In the file is this:               PATH=/usr/bin     00 00 * * * gnome-session-save --kill      The command does not run as it is supposed to. `/var/log/syslog` shows it running successfully however. In the command I've also tried the full path to the command (`/usr/bin/gnome- session-save --kill`) without any luck either. Ubuntu 10.04LTS


Unable to mount volume, an operation is already pending (with multiple users)

I'm running Linux Mint 14 - pretty much whatever the default install settings are. When I have multiple users logged in and I plug in a flash drive, or digital camera, or any other USB storage, rather than popping up the automount, it does nothing. So if I use Caja (I guess the Nautilus equivalent) an try to mount it, it tells me:                                ![Unable to mount 4.0 GB Volume - An Operation is already pending](http://i.stack.imgur.com/eKVft.png) If I log into the other user account I see a window asking me what action I'd like to take. How can I turn off automount, and have it only try mounting when I click on it from within my file browser?


What exactly is 'scrollback' and 'scrollback buffer'?

What are "scrollback" and "scrollback buffer" in programs like `bash` and `screen`, and how do they relate to the tty, the programs being run, and stdin/ stdout/ stderr? Here is the only definition of "scrollback" I found so far (in the archlinux wiki): > Scrollback is a function that is implemented in a text console to allow the > user to go back to view the lines of text which have scrolled off the > screen. This is made possible by a buffer created just for this purpose > between the video adapter and the display device; the scrollback buffer. But, this raises more questions for me:   * Does it mean "function" as in "subroutine" or as in "feature"?   * Is there is a Unix standard or API for this scrollback buffer?   * In a "stack" of programs, such as `vim` launched in `screen` launched in `bash` launched in `ssh` launched in a terminal emulator, which of these programs are controlling the scrollback buffer? I also used `screen` to dump the scrollback to a file. This file had a lot of white space at the top, and it seems the "view" my terminal emulator shows me is simply the bottom few lines of the of the buffer.   * Is this why a program like `vim` can "clear" my entire terminal window, because it gets temporary access to the parent shell's scrollback buffer?    * Or does `vim` use its own scrollback buffer that is somehow overlaid on top of the parent scrollback buffer?


SED and PDSH: adding a line to a file on a slave node in a cluster

I am trying to add a new line containing `GATEWAY=10.0.10.1` to the `/etc/sysconfig/network` file on each of 32 slave nodes in a cluster.   I read this post on how to insert a line with sed. This works for me to add a line to a local file:               sed -i.bak -e "\$aGATEWAY=10.0.10.1" test/test1      This works for me viewing a file on node 32:               pdsh -w n032 cat test/test1      **This fails** for me trying to add a line to a file on node 32:               pdsh -w n032 sed -i.bak -e "\$aGATEWAY=10.0.10.1" test/test1      With this error:               n032: sed: -e expression #1, char 2: extra characters after command     pdsh@admin: n032: ssh exited with exit code 1      I own the file that I'm trying to change:               pdsh -w n032 ls -al test/test1      The above command shows that I own it and have read and write (`rw`) permissions. Why does it fail?


What does this code really do?

I am testing iThemes security plugin for Wordpress. It adds the following code:                       # Rules to help reduce spam             location /wp-comments-post.php {                 valid_referers jetpack.wordpress.com/jetpack-comment/ *.mysite.com;                 set $rule_0 0;                 if ($request_method ~ "POST"){ set $rule_0 1$rule_0; }                 if ($invalid_referer) { set $rule_0 2$rule_0; }                 if ($http_user_agent ~ "^$"){ set $rule_0 3$rule_0; }                 if ($rule_0 = "3210") { return 403; }             }      The author describes it as "This option will cut down on comment spam by denying comments from bots with no referrer or without a user-agent identified." I am not an expert on nginx.conf... but it looks like to me that ALL the conditions must be met. What does this code really do? What does `$rule_0 = "3210"` mean? Thanks


Shell script error handling while assigning STDOUT to variable

I am trying to implement error handling in my shell script as described in the 2nd answer in Best practice to use $? in bash? My script looks like this:               #!/bin/bash          try() {         "$@"         code=$?         if [ $code -ne 0 ]         then             echo "oops $1 didn't work"             exit 1         fi     }          try myvar=$(mktemp -p ./)      The script exits with a               ./test.sh: line 4: myvar=./tmp.scNLzO1DDi: No such file or directory     oops myvar=./tmp.scNLzO1DDi didn't work      Just,               myvar=$(mktemp -p ./)      of course works fine, and $myvar returns the full path and name of the temp file. How can I get the statement to assign the name of the tmp file to the variable myvar, while still passing the entire statement and it's results to try() so try() can do what it needs to? Thanks.


Allow a user to run a single command as root over ssh

I have a user account that is not designed for logging in interactively, but want to allow it to run a single command (as root). Is there a better way to accomplish this (without granting more rights than I intend to) than I have currently:   * Changing their shell to rbash, with sudo as the only executable in their path, as they need a valid shell in order to run any commands.   * Adding their account to sudoers with "ALL=(root:root) NOPASSWD: /sbin/executable"   * Adding an authorized_keys entry for the account with no-{X11,port}-forwarding,no-pty,command="sudo executable" Context: I am trying to grant a non-*nix savvy manager the ability to fix any print server troubles while I am away. Obviously first port of call is the CUPS web interface and physically walking over and inspecting the printer (which he can and does do now), but I can't expect him to ssh in and restart the appropriate services when that fails (and do not trust him with unrestricted sudo access anyway). Currently I am just giving him access to run /sbin/reboot, and I will change that to a script that restarts cups/samba/etc. instead when I get a chance.


What means the labels =>, ==>, ===>, ====>, -, -- and a certain number of spaces after them in an output of the command make install?

I'm writing a script and I need to mark several blocks of its output. To unify is not bad to use the labels like the output of the command such as `make install`. They are at the beginning of many lines. So I looked some content of the output: for `=>, ==>, ===>` and `====>`:               ...     ===> Fetching all distfiles required by autoconf-wrapper-20130530 for building     ===>  Extracting for autoconf-wrapper-20130530     ===>  Patching for autoconf-wrapper-20130530     ===>  Configuring for autoconf-wrapper-20130530     ===>  Staging for autoconf-wrapper-20130530     ===>   Generating temporary packing list     ====> Compressing man pages (compress-man)     ===>  Building package for autoconf-wrapper-20130530     ...     => SHA256 Checksum OK for pcre-8.33.tar.bz2.     ===>  Patching for pcre-8.33     ===>  Configuring for pcre-8.33     ...     ==> You should manually remove the "..." user.     ...      for `-`:               grep -m 3 '^- ' output.txt      > - you have a POSIX system   >  - you have jobcontrol   >  - your fifos are usable for `\--`:               grep -m 3 '^-- ' output.txt      > -- The C compiler identification is GNU 4.2.1   >  -- The CXX compiler identification is GNU 4.2.1   >  -- Check for working C compiler: /usr/bin/cc Is it commonly accepted labels, if so where are described?   What are the rules put these labels?   Are there any other similar labels?   Why is different the number of spaces after these labels?


Can anyone please tell me the correct answer?

[pgrosh@manners pgrosh]$ ps -ux          USER       PID %CPU %MEM  SIZE   RSS TTY STAT START   TIME COMMAND          pgrosh    4660  0.3  2.4  1272   740  p0 S    06:50   0:01 -bash          pgrosh    4686  0.0  1.3  1128   424  p0 T    06:51   0:00 more .alias          pgrosh    4740  0.5  2.3  1264   736  ?  S    06:54   0:01 -bash          pgrosh    4771 15.3  1.6  1184   496  ?  R    06:55   0:27 less usernames          pgrosh    4782 58.9  1.3   992   408  p0 R    06:57   0:44 find / -name bin          pgrosh    4801  0.0  1.3   936   404  p0 R    06:58   0:00 ps -ux       Which one of the following statements is true?   * all of these are true.   * the "bash" process with PID 4660 is "sleeping".   * the process with PID 4686 is "stopped", possibly by a Control+Z.   * the process with PID 4801 is a currently running process.   * the process with PID 4771 is "detached" and not associated with a terminal.


Putty connection failing from Home network

Im connecting to a server using Putty. I have a connection time-out every 2 minutes if I don't use it. I don't have the same issue while connecting from my office network using the same laptop. Settings changed:               Seconds between keepalives


Right settings of vsftpd?

I installed vsftpd on Linux Mint, I changed some settings to the configuration file so it permits anonymous users, however I want to redirect them to a certain directory where they can upload files. I'm just confused among the settings...


Bash script wait for processes and get return code

I am trying to create a script which will start many background command. For each background command I need to get the return code. I have been trying the following script :                #!/bin/bash     set -x     pid=()     return=()               for i in 1 2     do      echo start $i      ssh mysql "/root/test$i.sh" &      pid[$i]=$!     done          for i in ${#pid[@]}     do     echo ${pid[$i]}     wait ${pid[$i]}     return[$i]=$?          if [ ${return[$i]} -ne 0 ]     then       echo mail error     fi          done          echo ${return[1]}     echo ${return[2]}      My issue is during the wait loop, if the second pid finish before the first one, I'll not be able to get the return code. I know that I can run wait pid1 pid2, but with this command I can't get the return code of all commands. Any idea ?


How to install Cherokee web server on Debian Wheezy?

I'm trying to install Cherokee webserver on Debian Wheezy. All the docs and websites that I've visited suggest that `apt-get install cherokee` will do it, but when I do that, I see:               $ apt-get install cherokee     Reading package lists... Done     Building dependency tree     Reading state information... Done     E: Unable to locate package cherokee      When running `sudo add-apt-repository ppa:cherokee-webserver` (as described in the docs), I see:               -bash: add-apt-repository: command not found      The docs says: **Debian**               Install Cherokee from the apt repository     apt-get install cherokee cherokee-admin     Please, check the documentation for further      So I tried `apt-get install cherokee cherokee-admin`, which was also unable to locate the package. It doesn't make any sense: why would they tell you to use `apt`, if it's not available there? Some suggest that `cherokee` is dead, but I can see on the homepage it's very active, so something isn't right. Should I build it from source? On some forums they said that Cherokee never released a package for Wheezy. Is that true?


No USB 04b4:0307 microphone input after Ubuntu 10.04

I was very happily using VOIP SIP with Ubuntu 10.04. Since I upgraded to 12.04, not only has Ekiga become very buggy and inconvenient, but, the subject matter of this question: the microphone of my various USB phones and devices stopped producing any sound. Sound preferences (`pavucontrol`) show a flat VU-meter. The problem is almost certainly at the kernel level, more specifically in `snd-usb-audio`. Numerous tests I've made show that it appeared in the kernel versions from Ubuntu 10.10 until now. My question is not only to find a solution but how to contribute more if none. For example, could I pick `snd-usb-audio` from 10.04 and install it in 12.04 and how. Additionally, is it true that this question does not belong here in AskUbuntu but in here (on Unix & Linux)?


How can I make iptables service start automatically after reboot on CenOS/RHEL7?

I am having a few issues with a newly installed home server I am preparing. I have installed CentOS7 on it and I found that port 80 and 443 are off by default. I therefore added them to the iptables with the following commands:               iptables -I INPUT 5 -i eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT     iptables -I INPUT 5 -i eth0 -p tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT     service iptables save      I also installed the iptable service which was not present. The problem is that every time I reboot the machine the new configurations are wiped. I tried to add the the iptable service to chkconfig but I get the following error:               [root@CentOS-7]# chkconfig --add iptables     error reading information on service iptables: No such file or directory      I presume that the reason I get this error is because there is no iptable script in /etc/init.d/ however has anyone any ideas if I am actually doing the right thing and/or if there is an easier more solid way to do this? If not how can I solve this problem? In the end I just need to use my home server as a web/mail server... I have also tried to use the 'systemctl enable iptables' command as flemingovirus kindly suggested but with no success. After I entered the command I got the following output:               ln -s '/usr/lib/systemd/system/iptables.service' '/etc/systemd/system/basic.target.wants`/iptables.service'`      UPDATE: I have looked at the iptables and the command "service iptables save" has worked properly. The problem seem to be due to the service not starting at reboot. I have managed to get the service running at reboot after adding the following line to /etc/rc.local               systemctl start  iptables.service      however I wonder why the 'systemctl enable iptables' command is not working in this case. Am I missing something? Thanks


volume adjustment makes fullscreen video playing de-maximize

When playing youtube videos in fullscreen, any adjustment of audio (`volume +`, `volume -`, `mute`) using the volume buttons on my laptop makes the fullscreen de-maximize. To make matters still worse, apparently the already cached video gets lost, and I have to wait for several seconds before the video gets buffered and starts playing again. I don't have flashplayer installed. I only have plain firefox (Iceweasel) without any plugins. Could somebody please advise how to fix this? PS: I am using Iceweasel 17.0.7 on Debian


USB3 drive plugged in to PC makes computer hang on "welcome to grub"

I have a Seagate 2TB USB2 hard drive, ext4 formatted. If I plug it in to my system and boot, PC gets stuck at "welcome to grub". If I restart without the USB drive plugged in, the system boots normally. I can then plug the drive and use it. I am using `Debian GNU/Linux jessie/sid` updated to latest.   Ubuntu livecds/usbs boot fine. lsusb (of the external drive):               Bus 001 Device 006: ID 0bc2:3332 Seagate RSS LLC Expansion      grub-pc version: 2.00-14 Motherboard only has USB2 ports (Intel H55TC) BIOS is up to date (both old and new firmware experienced the same problem). What could be causing this?   (testable speculations are welcome, because I ran out of ideas). Note: Before I found the USB drive was the cause I would simply boot around 10 times, and eventually it will boot normally. Here is my grub.cfg               #     # DO NOT EDIT THIS FILE     #     # It is automatically generated by grub-mkconfig using templates     # from /etc/grub.d and settings from /etc/default/grub     #          ### BEGIN /etc/grub.d/00_header ###     if [ -s $prefix/grubenv ]; then     load_env     fi     set default="0"          if [ x"${feature_menuentry_id}" = xy ]; then     menuentry_id_option="--id"     else     menuentry_id_option=""     fi          export menuentry_id_option          if [ "${prev_saved_entry}" ]; then     set saved_entry="${prev_saved_entry}"     save_env saved_entry     set prev_saved_entry=     save_env prev_saved_entry     set boot_once=true     fi          function savedefault {     if [ -z "${boot_once}" ]; then         saved_entry="${chosen}"         save_env saved_entry     fi     }          function load_video {     if [ x$feature_all_video_module = xy ]; then         insmod all_video     else         insmod efi_gop         insmod efi_uga         insmod ieee1275_fb         insmod vbe         insmod vga         insmod video_bochs         insmod video_cirrus     fi     }          terminal_input console     terminal_output console     set timeout=5     ### END /etc/grub.d/00_header ###          ### BEGIN /etc/grub.d/05_debian_theme ###     set menu_color_normal=cyan/blue     set menu_color_highlight=white/blue     ### END /etc/grub.d/05_debian_theme ###          ### BEGIN /etc/grub.d/10_linux ###     menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-2f0165f3-2087-4157-b1e6-f707a995827b' {             load_video             insmod gzio             insmod part_msdos             insmod part_msdos             insmod diskfilter             insmod mdraid09             insmod ext2             set root='mduuid/019e28032b26f1e0e368bf24bd0fce41'             if [ x$feature_platform_search_hint = xy ]; then             search --no-floppy --fs-uuid --set=root --hint='mduuid/019e28032b26f1e0e368bf24bd0fce41'  2f0165f3-2087-4157-b1e6-f707a995827b             else             search --no-floppy --fs-uuid --set=root 2f0165f3-2087-4157-b1e6-f707a995827b             fi             echo    'Loading Linux 3.9-1-686-pae ...'             linux   /boot/vmlinuz-3.9-1-686-pae root=UUID=2f0165f3-2087-4157-b1e6-f707a995827b ro  hdd=noprobe             echo    'Loading initial ramdisk ...'             initrd  /boot/initrd.img-3.9-1-686-pae     }     submenu 'Advanced options for Debian GNU/Linux' $menuentry_id_option 'gnulinux-advanced-2f0165f3-2087-4157-b1e6-f707a995827b' {             menuentry 'Debian GNU/Linux, with Linux 3.9-1-686-pae' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.9-1-686-pae-advanced-2f0165f3-2087-4157-b1e6-f707a995827b' {                     load_video                     insmod gzio                     insmod part_msdos                     insmod part_msdos                     insmod diskfilter                     insmod mdraid09                     insmod ext2                     set root='mduuid/019e28032b26f1e0e368bf24bd0fce41'                     if [ x$feature_platform_search_hint = xy ]; then                     search --no-floppy --fs-uuid --set=root --hint='mduuid/019e28032b26f1e0e368bf24bd0fce41'  2f0165f3-2087-4157-b1e6-f707a995827b                     else                     search --no-floppy --fs-uuid --set=root 2f0165f3-2087-4157-b1e6-f707a995827b                     fi                     echo    'Loading Linux 3.9-1-686-pae ...'                     linux   /boot/vmlinuz-3.9-1-686-pae root=UUID=2f0165f3-2087-4157-b1e6-f707a995827b ro  hdd=noprobe                     echo    'Loading initial ramdisk ...'                     initrd  /boot/initrd.img-3.9-1-686-pae             }             menuentry 'Debian GNU/Linux, with Linux 3.9-1-686-pae (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.9-1-686-pae-recovery-2f0165f3-2087-4157-b1e6-f707a995827b' {                     load_video                     insmod gzio                     insmod part_msdos                     insmod part_msdos                     insmod diskfilter                     insmod mdraid09                     insmod ext2                     set root='mduuid/019e28032b26f1e0e368bf24bd0fce41'                     if [ x$feature_platform_search_hint = xy ]; then                     search --no-floppy --fs-uuid --set=root --hint='mduuid/019e28032b26f1e0e368bf24bd0fce41'  2f0165f3-2087-4157-b1e6-f707a995827b                     else                     search --no-floppy --fs-uuid --set=root 2f0165f3-2087-4157-b1e6-f707a995827b                     fi                     echo    'Loading Linux 3.9-1-686-pae ...'                     linux   /boot/vmlinuz-3.9-1-686-pae root=UUID=2f0165f3-2087-4157-b1e6-f707a995827b ro single                      echo    'Loading initial ramdisk ...'                     initrd  /boot/initrd.img-3.9-1-686-pae             }             menuentry 'Debian GNU/Linux, with Linux 3.2.0-4-686-pae' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.2.0-4-686-pae-advanced-2f0165f3-2087-4157-b1e6-f707a995827b' {                     load_video                     insmod gzio                     insmod part_msdos                     insmod part_msdos                     insmod diskfilter                     insmod mdraid09                     insmod ext2                     set root='mduuid/019e28032b26f1e0e368bf24bd0fce41'                     if [ x$feature_platform_search_hint = xy ]; then                     search --no-floppy --fs-uuid --set=root --hint='mduuid/019e28032b26f1e0e368bf24bd0fce41'  2f0165f3-2087-4157-b1e6-f707a995827b                     else                     search --no-floppy --fs-uuid --set=root 2f0165f3-2087-4157-b1e6-f707a995827b                     fi                     echo    'Loading Linux 3.2.0-4-686-pae ...'                     linux   /boot/vmlinuz-3.2.0-4-686-pae root=UUID=2f0165f3-2087-4157-b1e6-f707a995827b ro  hdd=noprobe                     echo    'Loading initial ramdisk ...'                     initrd  /boot/initrd.img-3.2.0-4-686-pae             }             menuentry 'Debian GNU/Linux, with Linux 3.2.0-4-686-pae (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.2.0-4-686-pae-recovery-2f0165f3-2087-4157-b1e6-f707a995827b' {                     load_video                     insmod gzio                     insmod part_msdos                     insmod part_msdos                     insmod diskfilter                     insmod mdraid09                     insmod ext2                     set root='mduuid/019e28032b26f1e0e368bf24bd0fce41'                     if [ x$feature_platform_search_hint = xy ]; then                     search --no-floppy --fs-uuid --set=root --hint='mduuid/019e28032b26f1e0e368bf24bd0fce41'  2f0165f3-2087-4157-b1e6-f707a995827b                     else                     search --no-floppy --fs-uuid --set=root 2f0165f3-2087-4157-b1e6-f707a995827b                     fi                     echo    'Loading Linux 3.2.0-4-686-pae ...'                     linux   /boot/vmlinuz-3.2.0-4-686-pae root=UUID=2f0165f3-2087-4157-b1e6-f707a995827b ro single                      echo    'Loading initial ramdisk ...'                     initrd  /boot/initrd.img-3.2.0-4-686-pae             }             menuentry 'Debian GNU/Linux, with Linux 3.2.0-3-686-pae' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.2.0-3-686-pae-advanced-2f0165f3-2087-4157-b1e6-f707a995827b' {                     load_video                     insmod gzio                     insmod part_msdos                     insmod part_msdos                     insmod diskfilter                     insmod mdraid09                     insmod ext2                     set root='mduuid/019e28032b26f1e0e368bf24bd0fce41'                     if [ x$feature_platform_search_hint = xy ]; then                     search --no-floppy --fs-uuid --set=root --hint='mduuid/019e28032b26f1e0e368bf24bd0fce41'  2f0165f3-2087-4157-b1e6-f707a995827b                     else                     search --no-floppy --fs-uuid --set=root 2f0165f3-2087-4157-b1e6-f707a995827b                     fi                     echo    'Loading Linux 3.2.0-3-686-pae ...'                     linux   /boot/vmlinuz-3.2.0-3-686-pae root=UUID=2f0165f3-2087-4157-b1e6-f707a995827b ro  hdd=noprobe                     echo    'Loading initial ramdisk ...'                     initrd  /boot/initrd.img-3.2.0-3-686-pae             }             menuentry 'Debian GNU/Linux, with Linux 3.2.0-3-686-pae (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.2.0-3-686-pae-recovery-2f0165f3-2087-4157-b1e6-f707a995827b' {                     load_video                     insmod gzio                     insmod part_msdos                     insmod part_msdos                     insmod diskfilter                     insmod mdraid09                     insmod ext2                     set root='mduuid/019e28032b26f1e0e368bf24bd0fce41'                     if [ x$feature_platform_search_hint = xy ]; then                     search --no-floppy --fs-uuid --set=root --hint='mduuid/019e28032b26f1e0e368bf24bd0fce41'  2f0165f3-2087-4157-b1e6-f707a995827b                     else                     search --no-floppy --fs-uuid --set=root 2f0165f3-2087-4157-b1e6-f707a995827b                     fi                     echo    'Loading Linux 3.2.0-3-686-pae ...'                     linux   /boot/vmlinuz-3.2.0-3-686-pae root=UUID=2f0165f3-2087-4157-b1e6-f707a995827b ro single                      echo    'Loading initial ramdisk ...'                     initrd  /boot/initrd.img-3.2.0-3-686-pae             }             menuentry 'Debian GNU/Linux, with Linux 3.2.0-2-686-pae' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.2.0-2-686-pae-advanced-2f0165f3-2087-4157-b1e6-f707a995827b' {                     load_video                     insmod gzio                     insmod part_msdos                     insmod part_msdos                     insmod diskfilter                     insmod mdraid09                     insmod ext2                     set root='mduuid/019e28032b26f1e0e368bf24bd0fce41'                     if [ x$feature_platform_search_hint = xy ]; then                     search --no-floppy --fs-uuid --set=root --hint='mduuid/019e28032b26f1e0e368bf24bd0fce41'  2f0165f3-2087-4157-b1e6-f707a995827b                     else                     search --no-floppy --fs-uuid --set=root 2f0165f3-2087-4157-b1e6-f707a995827b                     fi                     echo    'Loading Linux 3.2.0-2-686-pae ...'                     linux   /boot/vmlinuz-3.2.0-2-686-pae root=UUID=2f0165f3-2087-4157-b1e6-f707a995827b ro  hdd=noprobe                     echo    'Loading initial ramdisk ...'                     initrd  /boot/initrd.img-3.2.0-2-686-pae             }             menuentry 'Debian GNU/Linux, with Linux 3.2.0-2-686-pae (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.2.0-2-686-pae-recovery-2f0165f3-2087-4157-b1e6-f707a995827b' {                     load_video                     insmod gzio                     insmod part_msdos                     insmod part_msdos                     insmod diskfilter                     insmod mdraid09                     insmod ext2                     set root='mduuid/019e28032b26f1e0e368bf24bd0fce41'                     if [ x$feature_platform_search_hint = xy ]; then                     search --no-floppy --fs-uuid --set=root --hint='mduuid/019e28032b26f1e0e368bf24bd0fce41'  2f0165f3-2087-4157-b1e6-f707a995827b                     else                     search --no-floppy --fs-uuid --set=root 2f0165f3-2087-4157-b1e6-f707a995827b                     fi                     echo    'Loading Linux 3.2.0-2-686-pae ...'                     linux   /boot/vmlinuz-3.2.0-2-686-pae root=UUID=2f0165f3-2087-4157-b1e6-f707a995827b ro single                      echo    'Loading initial ramdisk ...'                     initrd  /boot/initrd.img-3.2.0-2-686-pae             }     }          ### END /etc/grub.d/10_linux ###          ### BEGIN /etc/grub.d/20_ipxe ###     menuentry "Network boot (iPXE)" --users "" --class network {             insmod part_msdos             insmod part_msdos             insmod diskfilter             insmod mdraid09             insmod ext2             set root='mduuid/019e28032b26f1e0e368bf24bd0fce41'             if [ x$feature_platform_search_hint = xy ]; then             search --no-floppy --fs-uuid --set=root --hint='mduuid/019e28032b26f1e0e368bf24bd0fce41'  2f0165f3-2087-4157-b1e6-f707a995827b             else             search --no-floppy --fs-uuid --set=root 2f0165f3-2087-4157-b1e6-f707a995827b             fi             linux16 /boot/ipxe.lkrn     }     ### END /etc/grub.d/20_ipxe ###          ### BEGIN /etc/grub.d/20_linux_xen ###          ### END /etc/grub.d/20_linux_xen ###          ### BEGIN /etc/grub.d/20_memtest86 ###     ### END /etc/grub.d/20_memtest86 ###          ### BEGIN /etc/grub.d/20_memtest86+ ###     menuentry "Memory test (memtest86+)" {             insmod part_msdos             insmod part_msdos             insmod diskfilter             insmod mdraid09             insmod ext2             set root='mduuid/019e28032b26f1e0e368bf24bd0fce41'             if [ x$feature_platform_search_hint = xy ]; then             search --no-floppy --fs-uuid --set=root --hint='mduuid/019e28032b26f1e0e368bf24bd0fce41'  2f0165f3-2087-4157-b1e6-f707a995827b             else             search --no-floppy --fs-uuid --set=root 2f0165f3-2087-4157-b1e6-f707a995827b             fi             linux16 /boot/memtest86+.bin     }     menuentry "Memory test (memtest86+, serial console 115200)" {             insmod part_msdos             insmod part_msdos             insmod diskfilter             insmod mdraid09             insmod ext2             set root='mduuid/019e28032b26f1e0e368bf24bd0fce41'             if [ x$feature_platform_search_hint = xy ]; then             search --no-floppy --fs-uuid --set=root --hint='mduuid/019e28032b26f1e0e368bf24bd0fce41'  2f0165f3-2087-4157-b1e6-f707a995827b             else             search --no-floppy --fs-uuid --set=root 2f0165f3-2087-4157-b1e6-f707a995827b             fi             linux16 /boot/memtest86+.bin console=ttyS0,115200n8     }     menuentry "Memory test (memtest86+, experimental multiboot)" {             insmod part_msdos             insmod part_msdos             insmod diskfilter             insmod mdraid09             insmod ext2             set root='mduuid/019e28032b26f1e0e368bf24bd0fce41'             if [ x$feature_platform_search_hint = xy ]; then             search --no-floppy --fs-uuid --set=root --hint='mduuid/019e28032b26f1e0e368bf24bd0fce41'  2f0165f3-2087-4157-b1e6-f707a995827b             else             search --no-floppy --fs-uuid --set=root 2f0165f3-2087-4157-b1e6-f707a995827b             fi             multiboot       /boot/memtest86+_multiboot.bin     }     menuentry "Memory test (memtest86+, serial console 115200, experimental multiboot)" {             insmod part_msdos             insmod part_msdos             insmod diskfilter             insmod mdraid09             insmod ext2             set root='mduuid/019e28032b26f1e0e368bf24bd0fce41'             if [ x$feature_platform_search_hint = xy ]; then             search --no-floppy --fs-uuid --set=root --hint='mduuid/019e28032b26f1e0e368bf24bd0fce41'  2f0165f3-2087-4157-b1e6-f707a995827b             else             search --no-floppy --fs-uuid --set=root 2f0165f3-2087-4157-b1e6-f707a995827b             fi             multiboot       /boot/memtest86+_multiboot.bin console=ttyS0,115200n8     }     ### END /etc/grub.d/20_memtest86+ ###          ### BEGIN /etc/grub.d/30_os-prober ###     ### END /etc/grub.d/30_os-prober ###          ### BEGIN /etc/grub.d/30_uefi-firmware ###     ### END /etc/grub.d/30_uefi-firmware ###          ### BEGIN /etc/grub.d/40_custom ###     # This file provides an easy way to add custom menu entries.  Simply type the     # menu entries you want to add after this comment.  Be careful not to change     # the 'exec tail' line above.     ### END /etc/grub.d/40_custom ###          ### BEGIN /etc/grub.d/41_custom ###     if [ -f  ${config_directory}/custom.cfg ]; then     source ${config_directory}/custom.cfg     elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then     source $prefix/custom.cfg;     fi     ### END /etc/grub.d/41_custom ###


How to find versions of scsi upper, middle and low level drivers

I have a SAS disk attached to the system through a SAS controller(LSI). How do I find the version of the driver of the SAS device entry. In the `modinfo`, I can see only `vermagic` and `srcversion` but not `version`. In the sysfs, inside `/sys/block/devices/sdc/drivers/` folder, I couldn't see `modules` folder which will have version file. Or how can I find the parent device (LSI controller) to which the hard disk is connected through `sysfs` for which I will try to find the driver version.


How do I test that two connected serial ports really transmit data?

I have a device with two serial ports which I connected together, and I SSH into it. I would like to send data via one of the serial ports and read it from the other, to see that they do transmit/receive data. I read on the topic but I'm confused about the various choice of programs that work with tty, and I don't know how to manage this process given that when I invoke one of these programs I either resign control to it, thus losing the ability to do other things besides using the port, or I get no control over it if I attempt to run it in the background. How do I achieve my goal?


AIX apache rpm dependencies

I am evaluating the Crowd SSO by Atlassian. Now to get apache to use CROWD for authentication, there is a connector available by the vendor. ## Problem Unfortunately they do not provide anything for my OS (AIX). Instead they provide source code with instructions. Now the example here uses `yum -y install autoconf automake gcc httpd-devel libcurl-devel libtool libxml2-devel mod_dav_svn subversion-devel` to download the required packages for which there is no alternate in AIX (AFAIK). So I went to AIX toolbox and got some packages. For the rest, I took Mr Perzl's help. And while installing the `rpms` ended up getting dependency errors. ## Question Do I go with   1. The solution given here dependency hell.   2. IBM way   3. Something else which Google and my limited exposure to AIX are not telling me. I am not *nix expert, rather at basic user level. And any installations are actually done by the admins. So I need expert advice so as to get it right and efficiently if possible. * * * Appreciate if someone would like to retag this question for getting attention from the right people.


Unable to connect after ChrootDirectory within sshd_config

After adding the following to my sshd_config file...               Match user myuser         ChrootDirectory /var/www/html         X11Forwarding no         AllowTcpForwarding no         ForceCommand internal-sftp      I am unable to connect using the user 'myuser' 'myuser' has read and write access to /var/www/html (in fact it is the owner) and that directory is set as its home directory. If I remove these lines I can connect, but I have access to folders below this (which I don't want) What am I doing wrong?


Can root/superuser read my read-protected files?

On shared unix hosting, if I have a file sensitive-data.txt and I issue: `chmod 600 sensitive-data.txt` Can root user still read my file? Specifically I'm wondering if it's safe to store my password in mercurial hgrc file. **UPDATE** Decided to use the mecurial keyring extension as it was super easy to setup:               pip install mercurial_keyring      and then add to hgrc:               [extensions]     mercurial_keyring =      However I'm still interested in the answer to this question.


How to kill a process in a terminal inside emacs

When I code, I usually use multiple buffers in emacs. Some buffers with my code, and a buffer with a terminal emulator (M-x term), There I compile, execute interpreters, etc. When I get an infinite loop in some computation, I cannot kill my process (As one could do with a normal terminal with Ctrl-C), since obviously the terminal embedded in emacs doesn't get the interrupt. Is there a way to do this?


JS indentation on Emacs

I'm following the Douglas Crockford's code convention, but I can't get the correct identation in JS mode in Emacs. I tried to customize the mode, try another mode like js3 but nothing seems to work. When I have parenthesis and I have to break the expression, Emacs does this:               this.offices.each(this.addOfficesToMap,                       this);      When the convention that I'm following that the code should look like:               this.offices.each(this.addOfficesToMap,         this);      Any idea of how I can change the indentation on braked expressions?


dd if=/dev/random is 'randomly' bottlenecked with BIG time lags, but I have no idea why

I get **wildly** different `real times` when I run the following command.               dd if=/dev/random bs=1k count=1       It doesn' happen for `if=/dev/null`, nor does it happen for `if=/dev/urandom` I've run it 500 times. Here are the general stats (per call). The times are in seconds.               Minimum   Maximum  Average   Median     00.002    89.999   4.50402   2.275       Does anyone have any suggestions about why this may be happening?   The system is Ubuntu 10.04 desktop. Bash version is 4.1.5(1)   It also shows the similar wild fluctuations in a VirtualBox VM running the same version of Ubuntu. * * * Here is the actual test code               cp /dev/null "$HOME/dd-random.secs"      for ((i=100;i<=500;i++)); do         if   ((i<10))  ;then zi="00$i"         elif ((i<100)) ;then zi="0$i"         else                 zi="$i"         fi          echo -ne "$zi\t" >>"$HOME/dd-random.secs"         exec 3>/dev/null 4>/dev/null             { time { dd if=/dev/random bs=1k count=1; } 1>&3 2>&4; } 2>&1 |tail -n 3|tr 'm\n' '\t' |sed -re "s/([0-9])s/\1/g" >>"$HOME/dd-random.secs"          exec 3>&- 4>&-         echo >>"$HOME/dd-random.secs"     done