title: Besides the journal, what are the differences between ext2 and ext3?

text: I just saw an answer question about filesystems for embedded hardware on another Stack Exchange site. The question was "What file system format should I use on flash memory?" and the answer suggested the ext2 filesystem, or the ext3 filesystem with journaling disabled a'la `tune2fs -O ^has_journal /dev/sdbX` This made me wonder... What would the advantage be to using ext3 (with journaling disabled) over ext2? As far as I understood, the only real difference between the two was the journal. What other differences between ext2 and ext3 are there?


title: Is it recommended to use zsh instead of bash scripts?

text: Can I assume that enough people have `zsh` installed to run scripts with a               #!/usr/bin/env zsh      as shebang? Or will this make my scripts un-runnable on too many systems? Clarification: I’m interested in programs/scripts an end user might want to run (like on Ubuntu, Debian, SUSE, Arch &c.)


title: Which would mount faster initrd or initramfs ?

text: I want to boot my linux as fast as possible. I have to make a choice between initrd and intiramfs. Which one should mount faster and have smaller size?


title: Suspend Linux (Mint) with external hard drive plugged in

text: I simply try to suspend the session while my external hard drive is plugged in (doesn't matter whether I have mounted or dismounted it, and this error does not apply to other filesystems, like flash drives). The computer does not suspend the session, and it goes back to the login screen, as if I had locked the screen. When I access the shell (and doing an ALT+LEFT after the CTRL+ALT+F1), I can see the following:               [ 5602.723820] dpm_run_callback(): scsi_bus_suspend+0x0/0x200 returns -5     [ 5602.723828] PM: Device 2:0:0:0 failed to suspend async: error -5     [ 5602.723820] PM: Some devices failed to suspend      Is there any way to fix this? Thanks.


title: Automatized restoring of display settings

text: I have two displays: my laptop's main monitor, running at resolution 1366x786 and second, external, running at resolution 1920x1080. My default display setting is to use both monitors at these resolutions, but the secondary monitor is at the left side of the primary monitor (instead of default right side). But some programs, especially games, change the resolution and usually use only one display (the second one is being disabled). After exiting such application it usually is restoring only the resolution of the first display, and the second one is disabled. After that I need to re-enable my default settings and do a lot of clicking in the settings panel. So my questions are:   1. Where can I find or how can I save my default two-display setting?   2. How can I automatize the restoration of my default settings? (maybe some bash script) The one-click solution would be great. I use Mint 16 and nvidia graphics.


title: How can I connect to a Mac OSX Maverick Shared Screen from Fedora 18?

text: I used to use TigerVNC to connect to a Mac MINI running Mountain Lion from my laptop running Fedora Core 18. After upgrading the Mac to Maverick, I now get the error "No Matching Security Types" I've tried every setting I can change through the GUI with the same result. I have also tried using other free VNC viewers, and still have had no luck. I know for a fact that Screen Sharing is working, I am able to connect using another Mac. Is there a way to do this without having to purchase a VNC viewer like RealVNC that I don't know will work? The other viewers I tried are:   * remmina (only appears to have SSH or SFTP as protocol options)   * NoMachine (only has SSH and NX as options)   * I downloaded gtkvncviewer but it doesn't appear to actually do anything and give no error report


title: How to install Liquidsoap & Airtime on CentOS 6.5?

text: That's the question, i already try some tutorials but i don't get any one to works What repositorys are needed? Is there any repo than i can add than have it to install it directly? Is there any way to avoid using Debian Box? I wanna keep the server without graphic interphase, although the webinterphase of Airtime is acceptable. I'm trying to use it to Broadcast music from an external HDD, to transmit when the DJ's will not be on air, like an AutoDj function I'm using icecast for the server, i do some test and it works, but i wanna automatize it and then i must add liquidsoap and/or airtime for this. This is the link to the page of the aplication http://savonet.sourceforge.net/ Any help? Thanks in advance. PS: Any suggestion of another software to do this than will be actualy supported would be very welcome. PS2: If you think i can receive a better answer in another StackExchange place, or think you know a forum, or a place/tutorial that can work, please let me know ;) I already try IRC btw... PS3: I'm asking this here because in the "Amateur Radio" Stack there are not so many online radio questions & because someone there put a doubt about if that was the place to post it, which i'm not sure if is or not... but like there is a Linux-Software question too, i want it to ask it here too.


title: How long is a TCP local socket address that has been bound unavailable after closing?

text: On Linux (my live servers are on RHEL 5.5 - the LXR links below are to the kernel version in that), `man 7 ip` says: > A TCP local socket address that has been bound is unavailable for some time > after closing, unless the SO_REUSEADDR flag has been set. I am not using `SO_REUSEADDR`. How long is "some time"? How can i found out how long it is, and how can i change it? I've been googling around this, and have found a few morsels of information, none of which really explain this from an application programmer's perspective. To wit:   * TCP_TIMEWAIT_LEN in `net/tcp.h` is "how long to wait to destroy TIME-WAIT state", and is fixed at "about 60 seconds"   * /proc/sys/net/ipv4/tcp_fin_timeout is "Time to hold socket in state FIN-WAIT-2, if it was closed by our side", and "Default value is 60sec" Where i stumble is in bridging the gap between the kernel's model of the TCP lifecycle, and the programmer's model of ports being unavailable, that is, in understanding how these states relate to the "some time".


title: kfreebsd ISO boot to grub menu

text: Having obtained the **kfreebsd** ISO image from here, I set up a VirtualBox VM to install from the ISO. When I boot up the VM, the session ends up with the grub menu instead of initializing the installation process or starting a shell.   1. How can I proceed from the GRUB menu to boot up kfreebsd for installation?   2. What could be causing the boot disc to enter grub instead of loading kfreebsd?


title: How can I use procmail to modify the body of an email and then forward it to an external address?

text: I'm struggling to get procmail to first transform, and then forward, a received email. Here's what I'd like to do:               :0 f     | ~/bin/encryptemail.pl | mail foobar@gmail.com      That is, I want to run the _encryptemail.pl_ script on the body of email that I receive, and then forward the encrypted email to _foobar@gmail.com_ . Piping the output to mail sort of works, except that the forwarded email is wrapped in a second set of headers. I'd like to cleanly forward the encrypted email so that the body of the original email has been replaced with the encrypted content.


title: Extract substring using regular expression on a Unix file

text: I have file with below contents .               /ABC/RTE/AD_900_VOP_123/OPP     /ABC/RTE/TRE/AD_900_VOP_145/BBB     /ABC/RTE/AN_900_VFP_124/FBF     /ABC/RTE/HD_900_FOP_153/WEW     /ABD/RDV/AD_900_VOP_123/OPP     /ABC/RTE/WD_900_VOP_123/GRR/TRD     /ABC/RTE/RTD/AR_900_VOP_443/SDD      How can I use regular expression on this file such that I get the output such as               AD_900_VOP_123     AD_900_VOP_145     AN_900_VFP_124     HD_900_FOP_153     AD_900_VOP_123     WD_900_VOP_123     AR_900_VOP_443


title: Why do iptables rules disappear when restarting my Debian system?

text: I add this rule:               sudo iptables -t nat -A OUTPUT -d a.b.c.d -p tcp \            --dport 1723 -j DNAT --to-destination a.b.c.d:10000        1. When restart computer rules are deleted. Why?   2. What I can do to make the rules persist?


title: Kill process when it stops to produce further output

text: Is there a shell tool which can probe if a subprocess is still producing output, and otherwise kill it after a specified timeout? I'm using `offlineimap` for Gmail backup, but that's very very very flaky. Processing stops regularily due to IMAP conditions or whatever. The process needs to be constantly restarted to see any progress. Hencewhy I'm currently using:               (ulimit -t 300 ; offlineimap)      in a loop. Which restarts the tool every five minutes; no matter what. That's somewhat unsatisfactory, as it either kills the process prematurely the few times when it's actually still performing some work, or still waits 4 minutes longer when it's already blocking. I would rather have something like:               offlineimap > output.log &     stillmakingoutput? --timeout 60 output.log || kill $!      That's probably doable with a custom exec/watching script, but isn't there some generic approach for such cases? stdout   output


title: Sed not working as intended

text: I would like to use this script with the intention of replacing all instances of the letter _Q_ within a file with the contents of the file "question.txt". Instead what happens is that all the instances of _Q_ in the file disappear and the contents of "question.txt" are printed at the bottom of the new file. Any ideas?               sed -i.bkp '/Q/{     s/Q//g     r /Users/ericbrotto/Desktop/question.txt     }' Commision.txt       **EDIT 1** I'm trying to find out what version I have, but keep on getting this: ![enter image description here](http://i.stack.imgur.com/XZnKj.png)


title: Why is procmail not being run?

text: I'm running Fedora 13 Linux, and sending mail to myself using mutt, and I can't seem to get procmail to run. Below is what my `.procmailrc`, `~/Procmail/rc.testing`, and `.forward` files all look like. As you can see, they are very simple. .procmailrc               HOME=/home/cory     SHELL=/bin/bash     PMDIR=$HOME/Procmail     LOGFILE=$PMDIR/pmlog     LOG="     "     LOG="My PATH is currently $PATH     My SHELL is currently $SHELL     "     VERBOSE=yes     MAILDIR=$HOME/Mail          INCLUDERC=$PMDIR/rc.testing      rc.testing               :0:     * ^Subject:.*test     IN-testing      .forward               #.forward     "|/usr/bin/procmail"      The Fedora Project documentation says that the existence of `.procmailrc` should "invoke Procmail whenever an MTA receives a new message." As I understand it, when I send myself a message using mutt, `.procmailrc` will be read by `procmail` and the logfile `pmlog` should be created in my `Procmail` directory. However, this log file never gets created, so it appears that procmail is never being run! The documentation also states "Fedora 13 provides two MTAs: Sendmail and Postfix. If both are installed, postfix is the default MTA." Since `which postfix` results with nothing on my machine, I assume sendmail is being used. Why doesn't sendmail invoke procmail?


title: Where Nautilus/Gnome keeps track or log of user activity?

text: Today I came across a file called `~user/.nautilus/saved-session-XXXXXX`. In it one could see some sort of logging user's activity via Nautilus. Also in `~user/.gconf/apps/gedit-2` one could find interesting things. Is there a file where Nautilus tracks user's activity? Is there a file which states files accessed, moved, copied, deleted, etc. via Nautilus?


title: How do I tell which GPG key an RPM package was signed with?

text: The cryptographic signature of an RPM can be verified with the `rpm -K` command. This returns a string containing `gpg` (or `pgp`) and ending in `OK` if the signature is in RPM's database and is valid. If the package is not signed but the checksums are valid, you'll still get `OK`, but no `gpg`. If the package is signed but the key is missing from the RPM database, you get `(GPG)` (capital letters) and `NOT OKAY`, followed by `(MISSING KEYS: GPG#deadbeef)`. That's handy if I want to figure out what key I should find to install to make my package installation work. But what if I want to verify _which_ of several keys in my RPM keyring was used to sign a given package?


title: Different Title formats for different Terminal apps?

text: I use a script which either activates an already running window of a program, or starts that program if it is not running. It uses different shortcut-keys; one for each of my most used apps — it checks for a unique window title format. This has worked fine, until today, when I decided to use `terminator` along side of `gnome-terminal`. These two terminal apps display the same title format, and I don't know how to change them independently (actually I don't know how to change them at all). I also use `konsole` (because it displays Unicode better than gnome-terminal), and it has a _profile-option_ which allows changes to the _tab-title format_ which is mirrored in the window's title, but `terminator` and `gnome-terminal` don't have this option. Is there some way to have different title formats for different terminals?


title: zsh kill Ctrl + Backspace, Ctrl + Delete

text: How to configure zsh such that `Ctrl`+`Backspace` kills the word before point? How to achieve that `Ctrl`+`Delete` kills the word after point? I use urxvt as terminal emulator.


title: Linux software raid assembled "itself" with failed drive. Why?

text: I have two raid1 arrays: md3 (sda3 + sdb3) and md5 (sda5 + sdb5). I deliberately failed the sdb disks because I wanted to change the partition table:               # mdadm /dev/md3 --fail /dev/sdb3     # mdadm /dev/md5 --fail /dev/sdb5      Some time later I checked /proc/mdstat and it says               Personalities : [raid1] md5 : active raid1 sdb5[1]           104792064 blocks super 1.2 [2/1] [_U]          md3 : active raid1 sda3[0]           52396032 blocks super 1.2 [2/1] [U_]          unused devices: <none>      **So although I failed sdb5, md5 was assembled with sdb5 instead of sda5. How could this happen?** I am using mdadm v3.3 and kernel is 3.14.3-200.fc20.x86_64


title: Batch file rename with substitution lookup

text: Using bash, how I can batch rename a large number of files, where I need to construct a new name for each file, based on its existing name and a 'contextual map' - don't know what else to call it – of name fragments. I have a lot of files in like this:               001.jpg     003.jpg     004.jpg     007.jpg     ...      and a map like this:               001,white     003,grey     004,red     007,green     ...      And now I want to rename all files, so that 001.jpg becomes 001-white.jpg etc.. How can I do this?


title: Count entries for each directory in tree

text: Say I have the following tree:               root:     d foo      d bar          /foo:     d A     - tmp.txt          /bar:     d B     - tmp2.txt          /foo/A:     - tmp3.txt          /bar/B:      d = directory and - = file I need to answer the following question: which directory (excluding the root) contains the least entries? I have tried                 find . | grep -oE '/([a-zA-Z]+/)+'      to get the number of occurrences for each directory. The problem is this command exclude empty directories, in this case /bar/B is excluded. Any guidance on how to solve this would be appreciated.


title: Read contents in a line in bash

text: I have a file with contents in this order which is separated by space                 4096 1230 4560 1024.... n      How can i read each number and pass it on to another command, eg divide each number by 1024.


title: Make a bootable CD without ISO file but from a CD

text: I have a Windows XP CD which I want to install on a USB Drive. However my own CD drive is broken. I have a friend's laptop on which Windows 7 is installed (and no idea if it has a CDROM of not). Please tell me how to do get the ISO from the CDROM to an USB pendrive? I am using Debian 7


title: linux cron: want to backup a folder

text: Hello I would like to backup a folder using cron on a centos. The folder `c2duo_mms` is located in `/usr/local/src/djcode/c2duo_mms`. I would like it backed ip every 1:00pm on Tuedays to my home folder `/home/sh`. Problem is I need help to do this problem. I am assuming you have to edit the crontab file? (a guess).


title: Installing Linux Mint 11 LXDE x64 on top of ubuntu-minimal

text: I want to install a 64bit version of Linux Mint 11 LXDE. It seems as though I should be able to easily install it on top of ubuntu-minimal if I knew the correct meta package(s).   1. Install ubuntu-minimal x64   2. Add linux mint repos to sources.list   3. Install linux mint LXDE meta package with ignore recommendations (similar to ubuntu-desktop) I've done this before with ubuntu-desktop and lubuntu-desktop. How can I get a list of meta-packages? Or a package dependency tree? EDIT: seems there is some confusion. "Linux Mint 11 LXDE" is a distro in itself. http://blog.linuxmint.com/?p=1793 It's the lubuntu to Linux Mint. I am trying to replicate this distribution by installing it on top of ubuntu-minimal. Which is way different than installing LXDE on top of either linux mint or ubuntu. Update: I tried to take all the packages marked as manual in Linux Mint 32 and installed them on ubuntu-minimal. This seemed to work fine, and I seem to have a Linux Mint install except now upstarts now hangs at "Checking Battery Status", which seems to be a common issue that people have when upgrading. It looks like I should also disable fglrx to see if it fixes it. In any case, I've since then tried using arch linux, but it's alot more work and I'm not sure I am going to stick with it.


title: Centos or Scientific Linux

text: When I need to create a new server I've always chosen Centos mainly for it's compatibility with Red Hat which i consider the standard de-facto for the general purpose linux server.   Now the problem is that Red Hat 6 has been out for quite a while and there is no sign of the Centos 6 (event Centos 5.6 iso is still missing).   As in the need to create a new server what will you do? Stay whit the old Centos 5.5 or switch to the recently released Scientific Linux 6.0?   I looked on SL 6.0 website and they declare great attention to compatibility with RH, I've never tried it by myself so I just wanted someone's real life opinion.


title: sorting filenames numerically when they have non-numeric prefix

text: I have files in the following format: `x1 x2 ... x10 x11 ... x101 ...` I want to rename these files, so they all have the same name length: `x001 x002 ... x010 ...` I can do this with files, that don't have the non-numeric prefix (just using `sort -n` followed by a `while read x;`), but sort doesn't recognize the numeric value, when it's not on the beginning of the file-name.


title: Check if display is powered on in Linux

text: Is there a way to check if a display is powered on in Linux? I tried `xrandr` and `xset` but neither of these two gives me any information about monitor power. Using `xrandr` I can identify if the vga cable is connected but not if power is connected. I need this because many of our lab systems keeps lying unused just because someone pulls out the power cable or something.


title: What program do I use to check mail?

text: I'm receiving "You have mail" messages and according to How to remove “You have mail” welcome message I should read my mail with `mail`. However I cannot find the command in my system (Ubuntu 10.04 server). What do I need to install?


title: How do I create a virtual secondary screen in X11?

text: I'm trying to use xvfb as a secondary screen, but I am struggling getting the two screens working together. xvfb does not seem to have the randr extension. So is there another possibility to create a virtual screen that could be in dual-head mode together with my real screen?


title: checking an argument to a bash script is a string of all digits

text: The Bash FAQ says If you're validating a simple "string of digits", you can do it with a glob:               # Bash     if [[ $foo = *[!0-9]* ]]; then         echo "'$foo' has a non-digit somewhere in it"     else         echo "'$foo' is strictly numeric"     fi      I thought, "Goody, that looks nice and simple". I then pasted exactly that into a script, except I added "exit 1" after the first echo and changed `$foo` to `$1`, so that it looked like               if [[ $1 = *[!0-9]* ]]; then         echo "'$1' has a non-digit somewhere in it"         exit 1     else         echo "'$1' is strictly numeric"     fi      I then tried to run this and got               $ sh foo.sh bar     bar     foo.sh: 6: [[: not found     'bar' is strictly numeric      I'm Bash illiterate, I'm ashamed to say, so I've no idea what could be wrong here. I had the impression, supported by the online Bash manual that the operator for matching with regexes is `=~`, but changing that doesn't make any difference. And that `[[` operator that seems to be problematic here looks standard, though I don't know what the difference is between `[[ ]]` and `[ ]`, which both correspond to testing the expression, as far as I know. I'm using Debian squeeze with bash               $ bash --version     GNU bash, version 4.1.5(1)-release (i486-pc-linux-gnu)      Debian says version `4.1-3`.


title: How do I get sound to work outside lightdm

text: If for whatever reason I `sudo stop lightdm` running on mint and just use a simple xinit session with mutter, is there some way I can get sound to work? Whenever I do that, it seems there's no sound.


title: Excessively high memory usage reported (3 GB) after reboot

text: **Brief problem description:** A 64-bit Gentoo on Intel Core-2 Q6600 reports about 3GB used out of 8GB total memory after reboot. This memory is neither claimed by any process, nor is it used by buffers/cache. **Context:** I have first noticed this behavior after the OOM killed the `emerge` process when trying to build octave from source. When the system became responsive again, there still remained about 3GB of reportedly used memory that was not used by any process. (Please note, that I can't say for sure that this was really on the beginning - maybe I just didn't notice before.) I tried reboot, as I am not familiar with the OOM possible issues, but the memory was reportedly used again. Then I tried Memcheck86+ which reported one "failing address" error on 3246.3MB (test repeated 5x). I lowered the RAM frequency and the error disappeared (test repeated 3x). However, on my Gentoo, 3GB is persistently reported as used with no apparent explanation (please see the diagnostic reports below). I have also tried a live distro (Parted Magic), which apparently behaves normally (about several hundreds of used memory after boot up). Any suggestions about the possible cause or even solution? **Edit:** _I am now able to overcome the problem, but still could not explain it. I describe what I've tracked so far:_   * The 3GB of memory is not used when started in a single-user mode.   * Starting `iptables` results in the 3GB usage, while dmesg reports: nf_conntrack: falling back to vmalloc   * subsequent stopping `iptables` does not revert the process, the memory remains used. Then I changed my kernel configuration so that the `nf_conntrack` is no longer built-in, but rather it is loaded as module. After reboot, `iptables` starts without the `falling back to vmalloc` message and also without consuming the 3GB. I have no idea, how this can be explained. Maybe some kernel developer can help explaining, what exactly could have caused this behavior? **Relevant reports:** ![enter image description here](http://i.stack.imgur.com/fqo7l.png) ![enter image description here](http://i.stack.imgur.com/Zhyyo.png)


title: Backup a Windows PC to a Linux Machine

text: What is a good backup strategy to backup a Windows 7 box to a Ubuntu box that are on the same network? The solution I am thinking would be to mount a Windows folder to Ubutnu then use `rsync`. But I'm new at this, so that might not be the best way to do it.


title: Exiting a pipeline if a former command fails

text: I'm trying to check the number of running and queued PBS jobs by parsing the output of `qstat -tn1` from a `bash` script. So far, this has worked:               count ()     {         qstat -tn1 | awk '             BEGIN { R = 0; Q = 0; }             $10 == "R" { R++ }             $10 == "Q" { Q++ }             END { print R, Q }'     }          if read -r R Q < <(count)         ...      However, I see that `qstat` occasionally fails for unknown reasons. In that case, it prints nothing to `stdout` and some error message to `stderr`, and exits with a non-zero status (fairly standard). However, `awk` doesn't know that `qstat` failed, and happily prints `0 0` for the empty input it received. Then `read` assigns 0 to both `R` and `Q` without knowing that `qstat` actually failed.   1. I need to initialize `R` and `Q` with 0 in the `BEGIN` block of the `awk` script, because there may be no running processes or no queued processes, and I need to print `0`, not just an empty string, for the number of such processes.   2. I could do `set -o pipefail`, which would allow `count` to exit with a non-zero status, but `read` cannot see the exit status, and `awk` gets executed and prints `0 0` for the empty input anyway.   3. I could try a named pipe and subprocesses, but having to manage them feels like an overkill too complicated. Is there any good way to allow the caller of `count` to detect its failure?


title: Jump to specific character in a line in VI

text: In VI, I know that if you do               :some_number      and hit enter, you will jump to the line specified by "some_number". Is there an equivalent for jumping to a specific character in a single line? Basically, I have a large csv and there is some characters that are breaking the parser; so I have to debug it. I'm getting an error message that basically says "unexpected character on line XXX character YYY". I know how to get to XXX but how do I get to YYY?


title: How to use Sony VAIO buttons to lock the screen?

text: I have a Sony Vaio VPCEG laptop, like this. I'm using Lubuntu 11.10. I'd like to use those 3 buttons (Assist, WEB and VAIO). They work with Windows 7, to recover the system and to open the browser. But in Linux, they don't work. How to set up them to lock the screen or to start the screen saver when pressed?


title: How good is the support for NUT-based UPSs against APC?

text: My choice of UPS is this -- **CyberPower** CP900EPFCLCD or **APC** Smart-UPS 750VA (SMT750I). I intend to connect UPS with USB for data transfer, not Ethernet. According to UPS HowTo http://tldp.org/HOWTO/html_single/UPS-HOWTO/, the first one is adviced to run with NUT, and the second with Apcupsd. Are those package equally good? Another issue -- support. When I run into problems, and I would look for some help, with which package (and community related to it) I will solve my problems faster? In short, **which package you think will cause less problems with configuring and using (with UPS)?** I am asking this, because those UPSs looks almost the same for me (*), the only thing I don't know now is how good are they when working with Linux. If you are a user of one of those UPS+packages, please simply answer with your experience "I had no problems at all" or "I had to install Windows to make it work properly". You don't have to know both of them to answer. (*) _The first one is cheaper (price for device, and less energy consumed), the other provides longer power support. For me it is a draw at this point._


title: Make kernel detect garmin device

text: I'm trying to connect a usb garmin forerunner device to my system, but the usb device is not detected. I have loaded the following mods: garmin_gps 11544 0 usbserial 25449 1 garmin_gps But I never see any device detected in neither lsusb nor dmesg when I connect the device. Other USB devices like disks and mp3 players seems to work fine. I'm unsure how I can continue debugging to find the issue and wonder if someone can guide me?


title: Shell and applications

text: Is it true that all commands that can run in bash are not actually part of bash? I'm gradually realizing I have been confusing the shell and the applications that can run in it.


title: Is there a linux equivalent of the Mac OS X command "textutil"?

text: On Mac OS X there's a very handy command called `textutil`, that can be invoked from the terminal and allows to convert a document from a format to another; Sometimes I use it to convert a RTF file into HTML, but it's also able to convert doc, docx, odt and other formats. I used to believe that it was a standard unix command, but I cannot find it and when I try to write `sudo apt-get install textutil` Ubuntu said that it have no idea of what `textutil` is... maybe I have searched in the wrong place for the command? Do you know if something similar exists for Linux? I need to invoke that command from a script that will run on a linux server.


title: Python-friendly machine configuration management systems

text: Are there machine configuration management systems akin to:   * Puppet   * Chef which are natively, or at least intimately, Python-friendly? Any recommendations with supporting evidence and/or backing reasoning as to why? (The two systems above have a penchant for Ruby.)


title: How can I automatically kill the process with the highest CPU load?

text: Sometimes programs will lock up in the background and cause high CPU usage. Is there any way I can programmatically ascertain which process is causing the highest CPU load at the moment and kill it?


title: Which linux is the most "free"?

text: I would like to make my very personal own linux baby, which is not to get whole world users get involved but myself to use it and do lots of experiment with it, so that when things does not work with other linux, i can show myown linux actually works and i will name it NeverMindMyOwnLinuxCanDoIt. So that when ever anyone need a solution, i can provide my own tested OS and get out of those company and license issues involved. Which Linux is really the freedom of choice that has no other involvement pure open and allow others to do what they want to do? I am thinking to go with Red hat linux and customize it for my own use. But can i?


title: xkbcomp doesn't update keymap for running xterms?

text: When I use setxkbmap all programs use the new layout but when I change the keyboard layout with xkbcomp to my own only newly started programs are affected (using xkbcomp with a file with a default keyboard that was created by xkbcomp it works). Why is that and how can I use xkbcomp and still get the new layout in already running programs?


title: Can't get DBUS data for automatic statuschange of pidgin

text: I'm using a script based on the work posted here: Update pidgin status using cron I'm trying to make a wicd script that automaticly disconnects before Wifi- disconnect and reconnects on Wifi-reconnect. But somehow dbus/pidgin can't seem to find the dbus session, eventhough the environment variable is set. **My setup:**   * Arch linux   * Pidgin 2.9.0   * Libpurple 2.9.0-2 Autoload script (runs on Xfce start):               #!/bin/bash     touch /tmp/dbus_session_data     env | grep DBUS_SESSION_BUS_ADDRESS > /tmp/dbus_session_data     echo 'export DBUS_SESSION_BUS_ADDRESS' >> /tmp/dbus_session_data      The tmp-file after runnign script:               [skaverat@eeepthought ~]$ cat /tmp/dbus_session_data      DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-gZMqzhdS2S,guid=9b8b3169f14346902127832000000043     export DBUS_SESSION_BUS_ADDRESS      Okay, let's get into another environment:               [root@eeepthought ~]# env | grep DBUSD     [root@eeepthought ~]# source /tmp/dbus_session_data      [root@eeepthought ~]# env | grep DBUS     DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-gZMqzhdS2S,guid=9b8b3169f14346902127832000000043     [root@eeepthought ~]# purple-remote getstatus     No existing libpurple instance detected.      purple-remote call in normal environment:               [skaverat@eeepthought ~]$ purple-remote getstatus     available      Any idea what could be wrong?


title: strange noise in some gui programs

text: I have Debian testing, I use XFCE. Recently, shortly after dist-upgrade, I noticed that XFCE terminal has some noise in it - especially near the end of long lines or when I use midnight commander. The noise looks like that: ![](http://i.stack.imgur.com/Ycfzc.png) I started using gnome-terminal instead and problem disappeared. Now I noticed I have similar problem with GIMP - the toolbox contains noise instead of tools: ![](http://i.stack.imgur.com/oEp7y.png) I can't even guess where should I start investigation. Is it problem with GIMP, XFCE, GTK, X, hardware? Or something else? I tried to start raw X, without any window manager (without Gnome, without XFCE etc) and problem is still the same - so I guess it's not X's fault. What do you advice?


title: Bash function to compare two binary files

text: I need a function to compare 2 binary files, here the requirements:   * 2 files, not 3 or 4   * files can't be assumed to exist   * avoid running checksum (CRC/MD5/SHA/...) until one must   * if running multiple checksums, do so from least expensive to most expensive (order above)   * print out meaningful error messages   * usage: binary_compare_two_files file1 file2 Here's what I have got, I think it can be done much better than this. How?               #!/bin/bash          function binary_compare_two_files() {            REQUIRED_ARGUMENTS=2            n_arguments="$#"            if [ ! "${n_arguments}" -eq $REQUIRED_ARGUMENTS ]; then         printf 'Invalid number of arguments. Required: %d, supplied: %d\n' \           $REQUIRED_ARGUMENTS $n_arguments         echo 'usage: binary_compare_two_files file1 file2'         return       fi            file1="${1}"       file2="${2}"            if [  ! -f "${file1}" -o ! -f "${file2}" ]; then         echo 'Invalid arguments. Both arguments need to refer to existing files.'         return       fi            file1_size=$(stat -f "%z" "${file1}")       file2_size=$(stat -f "%z" "${file2}")            if [ ! ${file1_size} -eq ${file2_size} ]; then         return $((file1_size - file2_size))       fi            file1_md5=$(md5 -q "${file1}")       file2_md5=$(md5 -q "${file2}")            if [ ! "${file1_md5}" == "${file2_md5}" ]; then         return -1       fi            return 0     }      I have opted not to use diff/bdiff because I am not sure whether those `stat` and check for sizes first... I would need to look at the src.


title: How can I use codecs etc. from one file to encode another with avconv?

text: I'm trying to use my camcorder as a portable TV, so I would like to use files from the camcorder (a Sony Handycam HDR-CX280) to encode my other video files in a format it will play. Here's the output of `avconv -i` on two different sample video files from my camcorder:               avconv version 0.8.10-6:0.8.10-0ubuntu0.13.10.1, Copyright (c) 2000-2013 the Libav developers       built on Feb  6 2014 20:59:46 with gcc 4.8.1     Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '#MAH00466.MP4':       Metadata:         major_brand     : MSNV         minor_version   : 22675568         compatible_brands: MSNVmp42isom         creation_time   : 2014-02-22 15:10:21       Duration: 00:00:31.20, start: 0.000000, bitrate: 6137 kb/s         Stream #0.0(und): Video: h264 (Main), yuv420p, 1280x720 [PAR 1:1 DAR 16:9], 6006 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc         Metadata:           creation_time   : 2014-02-22 15:10:21         Stream #0.1(und): Audio: aac, 48000 Hz, stereo, s16, 127 kb/s         Metadata:           creation_time   : 2014-02-22 15:10:21     At least one output file must be specified      and               avconv version 0.8.10-6:0.8.10-0ubuntu0.13.10.1, Copyright (c) 2000-2013 the Libav developers                                                                                built on Feb  6 2014 20:59:46 with gcc 4.8.1                                                                                [mpeg @ 0x94e8fe0] max_analyze_duration reached                                                                                Input #0, mpeg, from 'M2U00038.MPG':                                                                                Duration: 00:00:39.23, start: 1.000000, bitrate: 752 kb/s                                                                                Stream #0.0[0x80]: Audio: ac3, 48000 Hz, mono, s16, 48 kb/s                                                                                Stream #0.1[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x564 [PAR 188:135 DAR 16:9], 104857 kb/s, 60 fps, 60 tbr, 90k tbn, 120 tbc                                        At least one output file must be specified


title: joining 2 files on 2 columns but at different column numbers using awk

text: I have 2 files which has to be joined on $1,$2 of 1st file and $1,$8 of 2nd file using awk.Can anyone please provide the solution for this as this is an urgent requirement. Thanks in Advance file1:               111,123abc,eee,ttt,yyy     222,234bcd,ttt,yyy,333      file2: 111,hhhh,eeee,rere,,23,2014,123abc 222,jjkj,7878,uhjj,1,45,2013,234bcd 333,aaa,hhh,jjjj,2,78,590,567acd output:               111,123abc,hhhh,eeee,rere,,23,2014     222,234bcd,jjkj,7878,uhjj,1,45,2013


title: Window title in X shows wrong application name

text: I am using LXDE environment in Debian, but I think my question is general. When I have a window opened (i.e. terminal emulator running bash) the window has a window title with the text `/bin/bash`. When I start `mc` in the terminal, the title changes to `mc [martin@localhost]`. The same text also appears as the window name on the window panel, where I can switch between opened windows. My problem is, the window name does not refresh, it still shows `mc [martin@localhost]`, even when I am already logged on another machine. Only when I start `mc` does the title refresh again. Is there a way to make the title refresh automatically?


title: can color-theme bind to a buffer?

text: I want to use different color-theme for different file types. I tried to use **add-hook** to set the color-theme for the major-mode, but it only applies when the buffer is first load. If I switch to another buffer and switch back, the color-theme will stay the same as it is in the previous buffer. Then I tried to set the **window-configuration-change-hook** , but the window blinks every time I press C-x, or M-x, or whatever that change the window properties. Is there a better way to set the color-theme for each buffer?


title: gcc make install error

text: I'm trying to compile `gcc` with `make install` to a drive wich is an linux from scrach bulid to a directory called tools and it gives me this:               make[1]: Entering directory `/media/BOSS/sources/gcc-build'     /bin/bash ../gcc-4.8.1/mkinstalldirs /tools /tools     /bin/bash: line 3: cd: ./fixincludes: No such file or directory     make[1]: *** [install-fixincludes] Error 1     make[1]: Leaving directory `/media/BOSS/sources/gcc-build'     make: *** [install] Error 2      I'm currently compiling it for lfs also I'm in a separate directory on a 32 bit computer on Emmabuntüs Log file soon


title: apt: reinstall older version of a package without altering dependent packages

text: I have got some problem with sound. In order to investigate the problem I tried to reinstall older version of package libasound2 (I have upgraded it recently). I typed `apt-get install libasound2=1.0.1.23-2.1` and the manager wanted to unistall lots of software I use and I don't like idea that I have to install it again. How can I change the version of selected package without all the problem with dependent software?


title: How to substitute awk argument?

text: I want simplify awk command for common usage so instead of writing `awk '{print "rm -r"$4 }'` each time I want to write `myawk "rm -r"$4`. I've tried to write such function `myawk() { awk '{ print $1 }' }` and it dosn't work.. How can I write function such that in Ubuntu?


title: Gnome 3.12 on Debian Jessie freezes when I open dialogues

text: I recently did the upgrade from Gnome 3.8 to Gnome 3.12, in Debian Testing (Jessie), and I can't figure this one out. When I try to open certain dialogue boxes in some applications (for example, the file properties dialogue in Nautilus), the dialogue either does not display at all, or else displays semi-transparently. In either case, the entire screen becomes non-functional. The mouse pointer keeps on working, but clicking works in no part of the screen, neither does the keyboard work. The only exception is that, if I guess where the dialogue's close button is, I can click there to close out the dialogue, and then the screen becomes usable again. (Alternatively, I can type ESC to close the dialogue, with the same effect.) Likewise, if I open, say, two copies of the image viewer (eog), opening the second copy has a similar effect, as does opening the Gimp (except that sometimes there I have no way of closing the offending window except by switching to another virtual terminal and doing `killall gimp`. In order to get this situation to arise, typically a lot of windows need to be open: specifically, in my case:   * The Cairo Dock toolbar   * The TaskBar (TaskBar@zpydr) Gnome extension.   * VirtualBox, running Windows 7. When I was using Gnome 3.8, running these together never posed an issue, but now I have to close at least one of them (usually the TaskBar extension) in order to avoid the issue. Other details of my system:   * Processor: amd64 (using 64-bit version of Debian)   * Display adaptor: Radeon HD 4200 (using the open-source driver, xserver-xorg-video-ati).   * Kernel: 3.14 (package linux-image-3.14-2-amd64)   * VirtualBox version: 4.3.14 (direct from Oracle)   * Cairo Dock version: 3.3.2-1 (using Debian's version) Other details:   * Switching to Metacity (`metacity --replace`) eliminates the problem (but, of course, that eliminates all the benefits of gnome-shell).   * The TaskBar extension is usually sufficent to generate the problem. Sometimes if only the TaskBar is enabled (but neither Cairo Dock nor VirtualBox), the offending dialogue box comes "alive" again after a few minutes.   * However, I also sometimes have the problem with Cairo Dock and VirtualBox are open together (with the TaskBar disabled). Any ideas what might be wrong? Something strange in my system, or a bug? **EDIT:** I was able to confirm that a fresh install of Debian Testing (Jessie) produced the same results within a VirtualBox virtual machine. I tested it on VirtualBox 4.3.14 (both with and without version 4.3.15 of the guest additions -- version 4.3.14 of the guest additions doesn't install correctly on Debian) with both the TaskBar and Cairo Dock installed. Same behavior. **EDIT:** The same thing occurs on Fedora, also in a VirtualBox virtual machine.


title: cannot locate cacti files under /srv/www/cacti

text: I am installing `cacti` on SLES-11-SP2 following instructions on Open Suse Cacti guide but I cannot locate the `cacti` files under `/srv/www/cacti` after the installation.   Do you have any idea where they are ?


title: How to search for available software in repositories though CLI?

text: I want to be able to search all available software like one would using "Synaptic Package manager" or "Ubuntu Software Center" through Command Line.` I want a better way than pressing Tab after typing a few letters after "sudo apt-get install ". It is not enough and can't search deep like Synaptic Package Manager.


title: Why isn't a straightforward 1/5/15 minute moving average used in Linux load calculation?

text: Until recently i thought the load average (as shown for example in top) was a moving average on the n last values of the number of process in state "runnable" or "running". And n would have been defined by the "length" of the moving average: since the algorithm to compute load average seems to trigger every 5 sec, n would have been 12 for the 1min load average, 12x5 for the 5 min load average and 12x15 for the 15 min load average. But then i read this article: http://www.linuxjournal.com/article/9001. The article is quite old but the same algorithm is implemented today in the linux kernel. The load average is not a moving average but .. an algorithm for which i don't know a name. Anyway i made a comparison between the linux kernel algorithm and a moving average for an imaginary periodic load: ![load graph](http://i.stack.imgur.com/0sjSR.png). There is a huge difference. Finally my questions are:   * Why this implementation have been choosen compared to a true moving average, that has a real meaning to anyone ?   * Why everybody speaks about "1min load average" since much more than the last minute is taken into account by the algorithm. (mathematically, all the measure since the boot; in practice, taking into accound the round-off error.. still a lot of measures) Thank you for your time


title: Loop a list through awk

text: I'm sorry if this is extremely elementary, but I just can't figure out how to do this, and my research has failed me as well. I have two files: data.csv and list.txt. Here's an example of what they look like data.csv:               "John","red","4"     "Basketball","orange","2"     "The Mike","blue","94"     "Lizard","purple","3"     "Johnny","pink","32"      list.txt:               Mike     John     purple     32      Now, I am trying to figure out how I can make a loop               awk -F "\"*,\"*" '/**LIST ITEM**/ {print $1}' data.csv > output.txt      where the command runs for each line of list.txt, replacing **LIST ITEM**. How can this be accomplished? I'm running this though Terminal on MacOSX 10.5.7. EDIT: The desired output for the above example would be               The Mike     John     Johnny     Lizard     Johnny      EDIT2: To be more clear, I am trying to avoid doing this:               awk -F "\"*,\"*" '/Mike/ {print $1}' data.csv     awk -F "\"*,\"*" '/John/ {print $1}' data.csv     awk -F "\"*,\"*" '/purple/ {print $1}' data.csv     awk -F "\"*,\"*" '/32/ {print $1}' data.csv      And instead, run it in one command, somehow looping through all the lines of list.txt.


title: Trouble with grep -o regex

text: I'm trying to use a grep command with the --only-matching flag, but it's not behaving as I would expect it to. This command: `echo "1/2/3/4/5" | grep -oE "^([^/]+/){0,2}"` Gives this output:               1/2/     3/4/      I was expecting just `1/2/` What's going on..? `3/4/` shouldn't match `"^([^/]+/){0,2}"` because it's not at the beginning of the line.. ( _running GNU grep **2.5.1_** )


title: How do I add an associative array to a variable from an external ini file?

text: I'm modifying a simple script to add function and learn more about how to write bash scripts. Currently, the script creates associative arrays using a function:               declare -A site theme     add_site() {         local shortcut=$1         site[$shortcut]=$2         theme[$shortcut]=$3     }     add_site x1 example1.com alpha     add_site x2 example2.com beta      Now I'd like it to read an ini file for the variables. However, the documentation I've come across all instruct how to source the file, but only uses single arrays for examples. How do I create the arrays using a data file that looks like the following to make an associative array:               [site1]     shortcut=x1     site=example1.com     theme=alpha          [site2]     shortcut=x2     site=example2.com     theme=beta


title: how to center vertically tiled watermark

text: I use imagemagick to add a watermark to my photos. The command line is the following:               composite -tile -gravity center watermark.png somefile.jpg somefile.jpg      But the watermark isn’t centered vertically. It looks like this: ![Image with watermark](http://i.stack.imgur.com/rrfqj.jpg) I’d like it to start from the center. How can I do it?


title: Steam with Wine having bug with popups

text: I'm on Arch Linux 64 bits running Steam on a 32 bits Wine and whenever Steam opens a popup, it starts gliding towards the lower right corner, only stopping when I hover it with my mouse and disappearing when I take my mouse off of it. http://www.youtube.com/watch?v=5IJBn5pP-AA It keeps saying               fixme:appbar:SHAppBarMessage unknown msg: 4     fixme:appbar:handle_appbarmessage SHAppBarMessage(ABM_GETSTATE): stub     fixme:appbar:handle_appbarmessage SHAppBarMessage(ABM_GETAUTOHIDEBAR, hwnd=(nil), edge=3): stub     fixme:appbar:handle_appbarmessage SHAppBarMessage(ABM_GETAUTOHIDEBAR, hwnd=(nil), edge=1): stub     fixme:appbar:handle_appbarmessage SHAppBarMessage(ABM_GETAUTOHIDEBAR, hwnd=(nil), edge=0): stub     fixme:appbar:handle_appbarmessage SHAppBarMessage(ABM_GETAUTOHIDEBAR, hwnd=(nil), edge=2): stub     fixme:appbar:SHAppBarMessage unknown msg: 4     fixme:appbar:handle_appbarmessage SHAppBarMessage(ABM_GETSTATE): stub     fixme:appbar:handle_appbarmessage SHAppBarMessage(ABM_GETAUTOHIDEBAR, hwnd=(nil), edge=3): stub     fixme:appbar:handle_appbarmessage SHAppBarMessage(ABM_GETAUTOHIDEBAR, hwnd=(nil), edge=1): stub     fixme:appbar:handle_appbarmessage SHAppBarMessage(ABM_GETAUTOHIDEBAR, hwnd=(nil), edge=0): stub     fixme:appbar:handle_appbarmessage SHAppBarMessage(ABM_GETAUTOHIDEBAR, hwnd=(nil), edge=2): stub      when the popup is gliding. Also, it doesn't show it but when I'm in another "tab" of the window manager, popups still open at the same positions on the screen, even though I can't see the steam interface anymore.


title: Prevent watch breaking colors

text: I'm altering scripts at work that monitor log files to single out certain items and colorize them. The final output is a list of 6-digit numbers in several columns. I've been able to add a `~` to the start of the number, and it doesn't break anything in the final output, but it's rather ugly and hard to read. However, when I try to colorize the number, either in preceding bash scripts or the final processing of the data in a perl script, the color text gets clobbered. For example, the original number, which I will put into `$num`:               123456      I input this in perl (or, much the same thing in bash):               "\e[1;34m" . $num . "\e[0m"      And here's what I get:               [1;34m123456[0m       I've also tried this, an escaped version, but get the same thing:               "\x1B[1;34m" . $num . "\x1B[0m"      If this makes a difference, here's the real stack of scripts (it's a mess):   * Perl called inside shell script, which then pipes to `grep`/`cut`/etc.   * shell script with more `cut`/etc., then pipes to .pl    * shell script watches that output Maybe `watch` doesn't like color then? I don't know `perl` too well, so I guess it wouldn't hurt to show what I'm seeing around the print lines:               my $format = ("%-8s") x scalar(@{$a[0]});          printf("$format\n", @$_)


title: Possible to extract title and pagenum of each page in a djvu file

text: This is a djvu version of the questions I asked before for pdf files. I have tried a similar idea as fred has given to the previous question. But I am now stuck at how to get the number of pages of a djvu file, because I don't know which command can be used for that purpose. For the sake of completion, I now just rephrase the question here: I was wondering if there are some ways to extract title and pagenum of each page in a djvu file? Either by some applications, or by programming in some programming language with some djvu libraries? The title of each page is supposed to be the first line of the page, for example, in slides/presentation files. The output is supposed to be a text file, with following format:               title_of_first_page pagenum_of_first_page     title_of_second_page pagenum_of_second_page     ...      Thanks and regards!


title: How to make BT keyboard available at login and OS selection screens

text: Is it possible to have my bluetooth keyboard active before I enter into the desktop environment? I'm unable to type in my login and password at the login screen because the Debian hasn't associated with my bluetooth keyboard until I manually tell it too. Also can I extend bluetooth keyboard useability to Grub's dualboot screen as well? At this stage I have to plug in my wired keyboard just to deal with these two events. Can you show me how to set up my wireless keyboard to be automatically available at the boot screen, or at least at the login screen. I'm currently using the default Bluetooth manager with Unity, Ubuntu 11.04, and pairing is rather difficult and non-automated, and does not extend to outside of the desktop environment. (In fact I have to remove it and re-pair it every time and it does not even work reliably.) ![enter image description here](http://i.stack.imgur.com/Szmf3.jpg) ![enter image description here](http://i.stack.imgur.com/FG9xl.jpg) ![enter image description here](http://i.stack.imgur.com/JlILN.png)


title: Linux Mint Change Screen Resolution

text: I installed Linux mint 10.I have nvidia geforce 9500 GT.After installing `nvidia-current` package,my screen resolution become 800*600.There is no 1024*768 in Monitors menu. Running `inxi -Gx` shows,               Graphics:  Card nVidia G96 [GeForce 9500 GT] X.Org 1.9.0 Res: 800x600@61.0hz                 GLX Renderer N/A GLX Version N/A Direct Rendering N/A      No idea what is going wrong.Any pointers?


title: How to use the grep result in command line?

text: When I use `grep` to find some text which I need, it will display lines containing a match to the given pattern. For example,               # grep -r ".*Linux" *     path0/output.txt:I hope you enjoyed working on Linux.     path1/output1.txt:Welcome to Linux.     path2/output2.txt:I hope you will have fun with Linux.      then, I want to edit the file `path2/output2.txt`, hence, I type `vim path2/output2.txt`. But, I don't think it is an effective way. How can I copy the path after `grep`?


title: Is it possible to get network interface index not via /sys?

text: So what I'm looking for is an interface index (or name) but the real one. `if_nametoindex(3)` and `ioctl(2)` don't seem to help me here. Now the only way I found how to do this is via `/sys`. Let me demonstrate on example what I need:               # cat /sys/class/net/bond0.1007/ifindex      26     # cat /sys/class/net/bond0.1007/iflink     23                                  <-- I need either this or a reference to bond0     # cat /sys/class/net/bond0/ifindex      23      Is there a way to do it with a function call or the only way is `sysfs`? Thanks


title: Changing the IP Address in Solaris 11

text: I am trying to change the IP address in Solaris, but am failing to do so. The IP address needs to be a fixed number, like 10.0.11.10 I have tried changing the IP address in `/etc/hosts` which I changed the hostname and the IP address, but when I try `ping` the computer name, it says:               Ping request could not find host SolarisTest. Please check the name and try again.      I have done what they told me to try on this site. But still stuck. They say to do this: "If using Solaris 9 or above, users may need to edit the IP address in `/etc/inet/ipnodes`" which I did, and the file looks exactly the same as the `/etc/hosts/` file. I already changed the IP address in the `/etc/hosts/` file.   * Please can someone show me how to **change the IP address on Solaris 11**? **Edit** I have tried `ifconfig -a` and it showed me the old IP address `10.0.10.80` and I changed `/etc/hosts/` to show `10.0.11.10` - so I have no idea why it is always changing. **2nd Edit** This link also shows stuff about how to change the IP address, as I have tried that as well, and also got nowhere.


title: How to restrict to run commands in specific directory through SUDOERS?

text: I can run `chown` and `chmod` commands by `sudo` system-wide, but want to run these commands in only `/var/www/html` directory. How can restrict commands to run only in specified directory by `sudo` permission? Not system-wide. Example: By following command 777 permission applied to `index.html` file.               sudo chmod 777 /var/www/html/index.html      Now I want to perform two actions   1. Restrict `sudo` to run `chmod` and `chown` only in `/var/www/html`   2. These command should not run in other places/directory.i.e user cannot use this command in `/var/www` or `/var/ftp`


title: Git pager is less, but what is causing the output coloring?

text: `less` itself isn't capable of doing syntax highlighting, according to this thread. However, `git diff` nicely shows colored output in less, its default pager. When I redirect the output of `git diff` into a file, no color escape sequences are visible. Does `git diff` know where it's being sent, and formats the output accordingly? How would one do that? * * * I just noticed that git colors the `diff` output (e.g. `git diff`), however, it doesn't know how to syntax highlighting in general. e.g.               git show 415fec6:log.tex      doesn't enable any TeX-like syntax. * * * Reading the `git` sources, I found the following hints in `diff.h`:               int use_color;      * * * I was previously referring to _syntax highlighting_ , but that was not correct. What I mean is output coloring, see e.g. ![example color output](http://i.stack.imgur.com/cbBQu.png)


title: Why did using xargs fail in this case?

text: I tried to understand the usage of `xargs` and did the following experiment.               ls | xargs | touch      I want to refresh the files dates and directoris in the curent directory. Though it is a bit _silly_ ,for I could use a simpler form to achieve the same effect. In my mind, `xargs` reads from the `STDIN` and turn it into the arguments for the other command(`/bin/echo` by default if the command is not specified). Am I misunderstanding something? It failed and I am wondering why.


title: Looping over directory entries in bash and saving to an array

text: (See update at the foot of the question). This is a followup question to "Make directory copies using find". This question involved manipulating a bunch of directories, This got too complicated to handle in a single command, so I decided to go with an approach which saved the list of directories to a bash array, despite reservations about portability. It seems that the POSIX shell standard (the Unix shell standard, as I understand it) does not have arrays. The makefile I'm using appears below. This works except for the last step. A summary of what I'm trying to do follows. As discussed in the earlier question, I want to loop over the directory `x86-headers`, and collect into a bash array, a list of its top level subdirectories that contain the file `C/populate.sh` (but may also contain other files). In my test setup, for example there is only one directory in `x86-headers` which contains the file `libc/C/populate.sh`, namely `libc`. I then perform some operations on these subdirectories. The most important of these is that I make a temporary copy of each directory which looks like `libc.tmp_g4zlb`. Namely dirname followed by 'tmp_' followed by a 5 digit random string. So, some questions: 1) As discussed in the earlier question, I'm looping over the directory 'x86-headers'. Here I am still using find. @Gilles indicated in his answer that this was not ideal. He might be right. Problems with find here: a) The values returned look like `./libc`. I don't want a leading `./`. b) The find command I'm using lists all directories. I only want to consider those that contain a file with the relative path of `C/populate.sh`. The approach Gilles was using might be better, but I don't understand it. See the `gilles` target below. I'd like to get the list of the directories and save them to an array. 2) The bit that I'm having problems with is the last step, namely               echo "(progn (require 'parse-ffi) (ccl::parse-standard-ffi-files :$$i'.tmp_'$(RND)))" | \     /usr/lib/ccl-bootstrap/lx86cl -I /usr/lib/ccl-bootstrap/lx86cl.image; done \      The relevant bit is that I'm trying to pass the temporary value `libc.tmp_g4zlb` to ccl, which is a Common Lisp compiler. Without the substitution, it would look like               echo "(progn (require 'parse-ffi) (ccl::parse-standard-ffi-files :libc.tmp_g4zlb))" | \     /usr/lib/ccl-bootstrap/lx86cl -I /usr/lib/ccl-bootstrap/lx86cl.image; done \      This works. The version using `$$i` above doesn't. The problem seems to be the leading `./`. Without that, it should work. For the record, the error I get is               ? > Error: Too many arguments in call to #<Compiled-function CCL::PARSE-STANDARD-FFI-FILES #x488B8406>:     >        3 arguments provided, at most 2 accepted.      > While executing: CCL::PARSE-STANDARD-FFI-FILES, in process listener(1).      This is, however, not the error that I get when passing `./libc.tmp_g4zlb` to the compiler. That error looks like               > Error: Filename "/home/faheem/test/foo/x86-headers/.\\/libc.tmp_g4zlb/C/**/" contains illegal character #\/     > While executing: CCL::%SPLIT-DIR, in process listener(1).      So it is possible there is something else going on. 3) Does the overall approach look reasonable? Please feel free to suggest possible improvements, even if it involves a completely different strategy.               #!/usr/bin/make -f     # -*- makefile -*-          export SHELL=/bin/bash     export RND:=$(shell tr -cd a-z0-9 < /dev/urandom | head -c5)     export CCL_DEFAULT_DIRECTORY=$(CURDIR)          clean:         rm -rf x86-headers/libc.tmp*          foo: clean         PATH=$$PATH:$(CURDIR)/ffigen4/bin; \         echo $$PATH; \         export CURDIR=$(CURDIR); \         echo $$CURDIR; \         array=( $$(cd x86-headers && find . -mindepth 1 -maxdepth 1 -type d) ); \         cd x86-headers && \         for i in "$${array[@]}"; do \         echo $$i; done; \         for i in "$${array[@]}"; do \         mkdir -p $$i."tmp_"$(RND)/C; done; \         for i in "$${array[@]}"; do \         cp -p $$i/C/populate.sh $$i".tmp_"$(RND)/C; done; \         for i in "$${array[@]}"; do \         cd $$i".tmp_"$(RND)/C; ./populate.sh; done; \         for i in "$${array[@]}"; do \         echo $$i'.tmp_'$(RND); done; \         for i in "$${array[@]}"; do \         echo "(progn (require 'parse-ffi) (ccl::parse-standard-ffi-files :$$i'.tmp_'$(RND)))" | \         /usr/lib/ccl-bootstrap/lx86cl -I /usr/lib/ccl-bootstrap/lx86cl.image; done; \          gilles:         cd x86-headers;         for x in */C/populate.sh; do \         echo -- "$${x%%/*}$$suffix"; done; \      UPDATE: It is possible that the question (or questions) got lost in all the details. So, let me try to simplify things. In his answer, Gilles wrote               for x in */C/populate.sh; do       mkdir -- "${x%%/*}$suffix"       mkdir -- "${x%%/*}$suffix/C"       cp -p -- "$x" "./${x%%/*}$suffix/C"     done      As I commented on his question, `x` here matches patterns of the form `*/C/populate.sh`. Also, `${x%%/*}` matches the first part of the string, namely the top level directory name. Now, something like               for x in */C/populate.sh; do                                                                                myarr[] = "${x%%/*}"                                                                                done      would create an array containing a list of top level directories, which is what I want. However, I don't know what syntax to use. I need to use a counter which runs over the loop, like `i=0, 1,...` to index `myarr` on the LHS. If I had a working piece of code like this, it would go some way towards solving my issue.


title: How to know if a Linux command can read from STDIN?

text: I noticed this problem when I became confused with pipe, one command send its executing output to the `STDOUT`, which is the `STDIN` for the other command, which can read from `STDIN`. How do I know if a Linux command can read from `STDIN`? Is there a feature to distinguish commands that can read from `STDIN` from those cannot?


title: Using rsync in a cronjob when a password is needed

text: Basically I have a bash script that fetches data from my server to perform a backup. As it is now I have to start that script manually, enter the password, and then wait for it to finish. I would like to set up a cronjob that handles the backup. But I really don't know how to handle the password in a cronjob. Also I can't use keys for this, because my provider does not provide the mechanisms I need to configure them. I have SSH access to my home folder, but in my home folder I don't have write access except for the `http(s)docs` directory. So I cant create the necessary `~/.ssh/` directory and its contents for login via keys.


title: POSIX and Bash, sh shorthand, for compound if statement

text: I prefer to do my `sh` commands in shorthand, And I prefer to be in POSIX. Truthfully, if the script can run on Dash, that is good enough. Which means using the test command `[`, not the extended `[[`. I have an example from an autostart script, which I'm not sure about.               if which dbus-launch >/dev/null && test -z "$DBUS_SESSION_BUS_ADDRESS"; then        eval `dbus-launch --sh-syntax --exit-with-session`     fi      So my guess is that if `dbus-launch` and `$DBUS_SESSION_BUS_ADDRESS` is empty, then do the `eval`. How do I write this in shorthand? I appreciate any help on this subject.


title: Why does my TCSH prompt change after cd?

text: My .cshrc file contains the following:               set prompt = "%{\033[0;32m%}%S%B\! <%~> :%b%s %{\033[0m%}"      Each time I `cd` out of my home directory, the prompt formatting resets to display:               33 /~/newdirectory/ :       What am I doing wrong?


title: Do USB emulators exist for Linux?

text: I'm looking for software that lets me have many virtual USB drives on my Ubuntu installation. I want them to be seen by virtual machines in VirtualBox so I can do backup operations. I need the drives to be presented on USB bus and not as virtual hard disks.


title: Masquerading as another user from sudoers file?

text: My `/etc/sudoers` file has following entries:-               ## Allow root to run any commands anywhere     root    ALL=(ALL)       ALL     agupta ALL= /sbin/,/usr/sbin/,/bin/,/bin/cat /etc/sudoers     ADMINS ALL= !/usr/bin/su, !SHELLS     alice ALL =(%Children) /sbin/, /usr/sbin/, /bin/      alice is a member of the Children group; please find below are details for alice:-               [alice@localhost ~]$ id alice     uid=1005(alice) gid=1004(Children) groups=1004(Children)      When I try to run this command `/bin/cat /etc/sudoers` i get following errors:-               [alice@localhost ~]$ sudo  cat /etc/sudoers     Sorry, user alice is not allowed to execute '/bin/cat /etc/sudoers' as root on localhost.localdomain.      In /var/log/secure, I can see the following entries being populated:-               Mar 21 06:40:40 localhost sudo:    alice : command not allowed ; TTY=pts/0 ; PWD=/home/alice ; USER=root ; COMMAND=/bin/cat /etc/sudoers      Any suggestions on this? * * * **Edit 1** Modified the file by removing the impersonation from the file i.e.               alice ALL = /sbin/, /usr/sbin/, /bin/      I was able to run the command `sudo cat /etc/sudoers` . I want to try out masquerading: but I am not able to make it work on my system * * * **Edit 2**               ## Allow root to run any commands anywhere     root    ALL=(ALL)       ALL     agupta,myself    ALL=(wheel)  ALL     jane ALL=(%parents) ALL      Command I ran:-               [jane@localhost ~]$ sudo -u paul cat /etc/sudoers     [sudo] password for jane:     cat: /etc/sudoers: Permission denied      Logs in /etc/log/secure:-               Mar 15 15:26:24 localhost sudo:     jane : TTY=pts/2 ; PWD=/home/jane ; USER=paul ; COMMAND=/bin/cat /etc/sudoers      Members of the group parents:-               [root@localhost ~]# id jane     uid=505(jane) gid=504(parents) groups=504(parents)     [root@localhost ~]# id paul     uid=504(paul) gid=504(parents) groups=504(parents)      Am, I still making any silly mistake?


title: Problem with configure and build php 5.2 on redhat 5

text: I downloaded php binaries and tried to build the same using following command.               ./configure --with-apxs2=/usr/sbin/apxs --with-mysql      But i'm getting the error related to mysql client library.               checking for MySQL support... yes      checking for specified location of the MySQL UNIX socket... no     checking for MySQL UNIX socket location... /var/lib/mysql/mysql.sock     configure: error: Cannot find MySQL header files under yes.     Note that the MySQL client library is not bundled anymore!      I confirmed that I have mysql client installed.               $ yum list mysql*     Loaded plugins: rhnplugin, security     Installed Packages     MySQL-client-community.x86_64    5.1.48-1.rhel5   installed     MySQL-server-community.x86_64    5.1.48-1.rhel5   installed


title: set hlsearch not working in vi

text: I want the result to be highlighted when I search for it in a file.So,I opened a file with `vi`(version 7.2) and then used command `:set hlsearch` to enable highlighting.But even then I don't get my search results highlighted.Any idea what else to check ? **Edit** Now I tried same thing with `vim` and it works fine there.Is hlsearch only for vim ?


Is there a way to bind TAB so that it outputs 2 space characters? I know you can do this in a text editor like Vim, but I wanted to carry over this functionality to `cat >>`.


title: Installing Pencil on openSUSE

text: I have installed openSUSE 11.4 today and I am trying to install Pencil on it. I downloaded the ArchLinux tarball from the site, and after extracting it, the _pencil.sh_ file didn't install, giving a bash error (permission denied). I also tried searching for it on YaST, but didn't find it there. I need some help.


title: less -j is not working for me

text: `less -jn` where n is a line number to jump to is not working for me. It just has no effect. I'm running less version 436 on Ubuntu 11.04. I also tried `less --jump-target=200` and `LESS='-j200' less filename`.


title: GPGPU/CUDA in KVM or Xen

text: We would like to enable direct access to CUDA-enabled GPUs within either KVM or Xen (or Citrix Xenserver). Specifically, we want to use PCI passthrough to access an NVIDIA Tesla S2050 unit, which is composed of 4 Tesla C2050 devices. I'm aware that Xenserver 5.6 supports SLI Multi-OS-enabled GPUs, but my understanding is that the C2050s are not SLI Multi-OS devices. I would prefer to avoid RPC-like solutions due to performance and maintenance issues that I've experienced. Amazon EC2 offers Xen VMs with Tesla M2050 GPUs, which I believe are quite similar to our C2050s, so it seems like what I would like to do should be possible. Has anyone successfully passed a non-SLI Multi-OS GPU to Linux VM from either KVM or Xen and successfully run a CUDA application? If so, what virtualization solution did you use and what GPU was used?


title: Does ie4linux work under Fedora?

text: I'm trying to install ie4linux, following this tutorial ### root               yum install wine cabextract      ### normal user               wget -q http://www.tatanka.com.br/ies4linux/downloads/ies4linux-latest.tar.gz     tar xfz ies4linux-latest.tar.gz     cd ies4linux-*     sed -i 's/which wineprefixcreate/which iptables/g' lib/functions.sh     ./ies4linux --no-flash --no-desktop-icon --no-menu-icon --no-gui --beta-install-ie7 # Same as above but with IE7 support (beta)      But when installing, the installer suddenly terminates:               /home/user/.ies4linux/downloads/ie6/HU/ADVAUTH.CAB: No such file or directory     /home/user/.ies4linux/downloads/ie6/HU/CRLUPD.CAB: WARNING; possible 6968 extra bytes at end of file.     /home/user/.ies4linux/downloads/ie6/HU/HHUPD.CAB: WARNING; possible 6720 extra bytes at end of file.     /home/user/.ies4linux/downloads/ie6/HU/IEDOM.CAB: WARNING; possible 6968 extra bytes at end of file.     /home/user/.ies4linux/downloads/ie6/HU/IE_EXTRA.CAB: WARNING; possible 6968 extra bytes at end of file.     /home/user/.ies4linux/downloads/ie6/HU/IE_S1.CAB: WARNING; possible 6968 extra bytes at end of file.     /home/user/.ies4linux/downloads/ie6/HU/IE_S2.CAB: WARNING; possible 6968 extra bytes at end of file.     /home/user/.ies4linux/downloads/ie6/HU/IE_S3.CAB: WARNING; possible 6968 extra bytes at end of file.     /home/user/.ies4linux/downloads/ie6/HU/IE_S4.CAB: WARNING; possible 6968 extra bytes at end of file.     /home/user/.ies4linux/downloads/ie6/HU/IE_S5.CAB: WARNING; possible 6968 extra bytes at end of file.     /home/user/.ies4linux/downloads/ie6/HU/IE_S6.CAB: WARNING; possible 6968 extra bytes at end of file.     /home/user/.ies4linux/downloads/ie6/HU/SETUPW95.CAB: WARNING; possible 6968 extra bytes at end of file.     /home/user/.ies4linux/downloads/ie6/HU/VGX.CAB: WARNING; possible 6896 extra bytes at end of file.      How can I install this on Fedora 14?


title: Debian stable: Only GNOME classic with custom 3.16

text: I compiled a custom 3.16.2 today, which works flawlessly except that GNOME only starts in classic mode. Maybe this is due to changes in the drm i915 driver, but how would I debug this? System is a Lenovo T400, Debian stable 32bit, Intel GM45 graphics chipset.


title: Nautilus Global Settings

text: I'm trying to figure out a way to set a flag on Nautilus for all/new users. It's just set `always_use_browser` to `True`. I didn't find any way to set it globally, just locally. I spent hours doing a workaround which uses gconftool-2, but to solve this issue, I think it could be more simple than applying and avoid resources usage to run my (dirty) solution. Does Gnome have file/command to set this nautilus flag (`always_use_browser=True`) globally?


title: Good tutorial for setting up a KVM/Xen box and advice on which would be better

text: I've got a dual xeon, 2GB, 75GB hd server that I'd like to turn into my dedicated virtual environment. Currently I'm using VirtualBox locally to run a mock cluster for Cassandra and Nginx/Haproxy, but it's starting to overload my system. I'd like to run Arch for this box and have a minimal desktop environment with either KVM or Xen managing all the VM's. Anyone know of a good tutorial or should I just do the base arch install and then find a good tutorial for setting up Xen/KVM and managing the machines? Also, which would be better for this type of environment. I've read that kvm is the way to go because it's much easier to setup and manage but I do not mind a more difficult setup if I can make better use of the hardware with Xen.


title: Compiling GNU/Linux with -O3 optimization

text: It's said that compiling GNU tools and Linux kernel with `-O3` gcc optimization option will produce weird and funky bugs. Is it true? Has anyone tried it or is it just a hoax?


title: modify path globally

text: Is there a standard for `$PATH` and the order of things that are supposed to be in there? out of the box Arch Linux doesn't have `/usr/local/bin` in the `$PATH`. I want to add it but I'm not sure if there's a predefined pecking order for system paths. Also where is the right place to do this? for right now I modified `/etc/profile` but I'm not sure that's the right place in Arch for user modifications. Anyone know if there's a better place?


title: Kill a tmux session and select another tmux session

text: I am trying to bind `X` to do the following:   * prompt the user whether the session should be killed   * if `y` is entered, kill the session   * after the session is killed select another session (last, previous, or next session) ### Some similar commands that aren't quite right   1. Kill the session and close the terminal:              bind X confirm-before -p "Kill #S (y/n)?" kill-session        2. Prompt the user for the name of the session to kill and select next session after kill:              bind X command-prompt -p "kill:"  "switch-client -n \; kill-session -t '%%'"        3. I haven't been able to find examples of similar commands. Here's a solution something that doesn't work:              bind X confirm-before -p "Kill #S (y/n)?" "SESSION='#S' \; \     switch-client -n \; kill-session -t \"$SESSION\""


title: difficalty to save traceroute output in shell variable?

text: I need to filter and store `traceroute` output in shell variable (array). But I am getting some unusual output. As I try to explain in following lines. My present directory is `temp`, having some files:               /temp$ ls      ask.html  data_dump (2)  DB-Assignemnt .sql          When I run `traceroute` on command line its output is correct as I desired.               /temp$ traceroute -m 5 www.google.com  | awk '{print  $2 , $3}'     to www.google.com     172.22.0.1 (172.22.0.1)     ABTS-North-Static-085.3.160.122.airtelbroadband.in (122.160.3.85)     * *     203.101.83.197 (203.101.83.197)     182.79.254.249 (182.79.254.249      If I save output in a variable `a` `/temp$ a=$(traceroute -m 5 www.google.com | awk '{print $2 , $3}')` When I `echo $a` The output is not understood to me. > ~/temp$ echo $a   >  to www.google.com 172.22.0.1 (172.22.0.1) ABTS-North-Static-   >  085.3.160.122.airtelbroadband.in (122.160.3.85) ask.html data_dump (2) DB- > Assignemnt .sql **ask.html data_dump (2) DB-Assignemnt .sql ask.html > data_dump (2) DB-Assignemnt .sql ask.html data_dump (2) DB-Assignemnt .sql**   >  203.101.100.186 (203.101.100.186) Why `ls` executed itself and input is save in variable `a`.


title: Linux support for RTP-MIDI?

text: I have been spoiled by the ease with which I can connect my iPad up to MIDI applications on my Macbook using the native support for midi-over-the-network (apparently RTP-MIDI) provided by the CoreMIDI subsystem in both OS X and iOS. Is there a compatible Linux implementation? I have found some tantalizing references out there that indicate there _may_ be one, but I haven't been able to find any concrete information.


title: When importing a key during a yum installation, where is that key stored?

text: I'm installing a piece of software for which I had to use a third-party repository. After adding the repository with `rpm -Uvh http://[site]`, I installed with `yum install [package]`. One of the prompts that came up during installation read:               Importing GPG key 0xABCABCAB "Fname Lname <email@somewhere.com>" from /etc/pki/rpm-gpg/RPM-GPG-KEY-somewhere-fname     Is this ok [y/N]: y      Does anyone know where this key is stored? I'm finished with that particular repo and don't want the additional repo/key lingering unnecessarily on my machine. I've already tried `gpg --list-keys` as both a regular user and root, but the key isn't listed there. As a work around would simply removing the repo also remove the key associated with it?


title: Review changes in .tex files

text: I have two files `paper.tex` and `paper_suggested_changes.tex` the latter is a modified version of the former with corrections. I need to go through the two files and choose which changes to accept or reject, how would I go about this?


title: List only regular files (but not directories) in current directory

text: I can use `ls -ld */` to list all the directory entries in the current directory. Is there a similarly easy way to just list all the regular files in the current directory? I know I can use find               find . -maxdepth 1 -type f      or stat               stat -c "%F %n" * | grep "regular file" | cut -d' ' -f 3-      but these do not strike me as being overly elegant. Is there a nice short way to list only the regular files (I don't care about devices, pipes, etc.) but not the sub-directories of the current directory? Listing symbolic links as well would be a plus, but is not a necessity.


title: Why is my shell script hanging on `apt-get -y upgrade`?

text: Ubuntu :               sudo DEBIAN_FRONTEND=noninteractive apt-get -y update     sudo DEBIAN_FRONTEND=noninteractive apt-get -y upgrade     sudo reboot      Script is always interrupted after upgrade and then it will stay on the command line, it will never reboots. How to run non-interactive shell scripts correctly, is there a way ?


title: Upgrade from Fedora 17 -> 18 problem

text: I tried to update Fedora 17 to 18 from within yum using the directions on the fedora web site. When I rebooted I ended up in the CentOS installer screen. I am not sure how that happend but I can't seem to get out of it into even a basic shell. EDIT: I managed to solve the problem by backing up the system and reinstalling it


title: How can I install rpmfusion to then install a video player in Fedora 12?

text: I have Fedora 12 and no wish to change. I want to play dvd videos, but these need VLC or mplayer, and they need rpmfusion. There are many sets of instructions on installing rpmfusion, but they all fail with some mysterious extra requirement, or need Fedora 19, if I read it correctly, or some other arcane error. The most likely help was at http://www.redips.net/linux/yum-install-mplayer- fedora12/ which said enter: rpm -Uvh http://download1.rpmfusion.org/free/fedora/pmfusion-free-release- stable.noarch.rpm !!!!! Now even more frustration: That's not what I typed! Although the full command line shows in the edit window for this post, half of it is missing in the preview. Grrrr.... But this command (the full thing of which only half shows above) gives: bash: syntax error near unexpected token `newline' But I can't find or remove a 'newline' in the command. I've already spent most of the day on this -- Please can someone help? Excuse my being fussy, but please no answers suggesting I change to another Fedora release, or not directly addressing the real problem, at least as a first step: how to get rpmfusion in Fedora 12 in a way that actually works.


title: Exit status ($?) of 148 upon Ctrl+Z

text: I just customized my `.bashrc` to include the exit status of the last command, so I get fancy prompts like               ☑ larsmans@host:~$      and I no longer have to re-run commands to see their exit status because I ran some other command in between. This uses `$?` to determine the exit status. However, I noticed that when a command is backgrounded with `Ctrl`+`Z`, the shell also sets `$?`, so I keep seeing               [1]+  Stopped                 vim     ☒ larsmans@host:~$ echo $?     148      Is this `148` a magic pseudo-exit status that I should check for?


title: Directory permissions vs file permssions

text: If I have two users called `john` and `sally`. Both are part of the `users` group. `john` creates a directory with permissions `775`. `sally` then puts a file there with `644` permissions. Even though the file obviously has no group write privileges. Can `john` then modify/delete that file in the directory he owns but the file he does not own?


title: xmms2 notification with album art under Awesome

text: I have the following in my `.config/awesome/rc.lua`:               --{{{ Display noify with current xmms2 playlist     function xmms2()         local f = io.popen("nyxmms2 status -f '${artist} - ${album} - ${title}'")         local fr = ""         for line in f:lines() do         fr = fr .. line .. '\n'         end         f:close()         naughty.notify({ title = "Currently playing:", text = fr, timeout = 5})     end     --}}}      I would like to add album art to this. Does anyone have an idea of how to do this? I am looking for something like this mpd setup but for xmms2.


title: process id and killing process - ps commmand

text: Please see the output of below **ps** command:               abc@smaug:~/Desktop$ ps ax | grep firefox      2213 ?        Sl     2:01 /usr/lib/firefox/firefox      2644 pts/0    S+     0:00 grep --color=auto firefox      Please explain both rows and what process id can be used to kill firefox process? Process id **2644** keeps on changing everytime I run that command.


title: Reach service on VM with private address

text: I have this configuration: ![ss of image](http://i.stack.imgur.com/57exH.png) _source:https://www.lucidchart.com/publicSegments/view/5256a1e5-afb0-4c7a-96fa-35750a00527d/image.png_ Basically, I have to reach a service which is running on the virtual machine with IP address 192.168.0.20 from a remote machine; this service is reachable on the port 80 and is working via a browser. However, I can't modify any firewall configuration on the hypervisor (the physical machine I can reach with its public IP).


title: What is the difference between ps and top command?

text: What is the difference between `ps` and `top` command ? I see that both can display information about running processes . Which one should be used when ?


title: Is adding ./bin a bad idea

text: I can't think of any reason why adding `./bin` to my `PATH` environment would be a very bad idea. I usually create `bin` folders in my projects that I am working in and I hate doing `bin/command`, it would be nice, to have `command` be picked up by bash as long as I am in the directory with a `bin` folder and that `bin` folder contains a `command` executable. I need convincing :D


title: Blocking gzip HTTP content with Iptables or Snort?

text: I'm looking to drop a connection if a website contains a certain word or phrase. The issue is, the site is typically compressed with gzip. Any ideas?


title: Text File Renaming Using Script

text: I have thousands of text files inside a folder and they are named in a certain way. For example:               Image_234_Data_7778_n0.txt     Image_234_Data_7778_n1.txt     Image_234_Data_7778_n2.txt          Image_954_Data_4478_n0.txt     Image_954_Data_4478_n1.txt     Image_954_Data_4478_n2.txt          Image_104_Data_9878_n0.txt     Image_104_Data_9878_n1.txt     Image_104_Data_9878_n2.txt      And so on... I would like to make a sourcefile (which would be used to rename the files and keep track of 'which is which') that should read:               1_1.txt:Image_234_Data_7778_n0.txt     1_2.txt:Image_234_Data_7778_n1.txt     1_3.txt:Image_234_Data_7778_n2.txt          2_1.txt:Image_954_Data_4478_n0.txt     2_2.txt:Image_954_Data_4478_n1.txt     2_3.txt:Image_954_Data_4478_n2.txt          3_1.txt:Image_104_Data_9878_n0.txt     3_2.txt:Image_104_Data_9878_n1.txt     3_3.txt:Image_104_Data_9878_n2.txt      And so on... Can anyone help me with some code which could do this for me?


title: Why rm command unrecognized w flag in AIX?

text: I have a bash script that retain the last 5 copies in AIX like this:               rm `ls -lt /path/the_file_* | tail -n +6`      But I get this error:               rm: Not a recognized flag: w      **UPDATE** The `ls` command return this:               -rw-r--r--    1 user   group1           14 Mar 11 09:54 the_file_20130311.bz2      Any clue on this?


title: Why isn't hydra being disconnected?

text: I have SSHD running on port 5800 on some machine. (It is a my machine at home.) If I run this manually in a terminal:               # ssh someIP -p 5800       The connection is lost because I am disconnected after 3 consecutive mistakes. OK. Now I do a brute force with hydra on this port with ssh as specified service and password root. It seems to run and tries passwords, but now I wonder why I am not disconnected this way. Is this because hydra instantiates a new connection for every new password, closes it after trying the password, and opens a new connection again for the next password attempt?


title: Postfix, SMTP Server, PHPMailer

text: I have an PHP Forum `(vanilla forums)` and for its registration emails I installed `Postfix`. Now As I figured it out, vanilla forums uses `PHPMailer` for email sending procedure.   Now my questions are:   * Is `Postfix` an `SMTP Server`? Could it fulfill the requirements that `PHPMailer` needs to send registration emails?    * Should I install a separate `SMTP Server` for this kind jobs? (i.e scripts like `PHPMailer` that need `SMTP Server`). If yes Which `SMTP Server` should I install?   * Does installing a separate `SMTP Server` conflict with `Postfix`?


title: Apache installation configuration can't find PCRE? ( pcre-config for libpcre not found )

text: These are the requirements and instructions on how to install Apache on Linux. http://httpd.apache.org/docs/current/install.html So I've installed everything (`c++ compiler`, `apr` and `apr-util`) to be able to install Apache correctly. The only thing left is PCRE, I've installed it and it's located in my `/usr/local/src/pcre-8.32` As I'm trying to `sudo ./configure --with-included-apr` I get this error:               checking for pcre-config... false     configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/ What am I doing wrong?


title: Trying to install 32-bit java plugin on Centos 6.5 64-bit mozilla firefox

text: Long story short, my employer's webstart VPN requires 32-bit java to launch. I managed to get this working on a 64-bit CentOS 5.6 vm, but I cannot remember what I did or it's not working on 6.5... Anyway, I installed Oracle's 32-bit `java` in `/usr/java/jdk1.8.0_11-32-bit` I have these links:               /usr/lib/mozilla/plugins/libjavaplugin.so -> /usr/java/jdk1.8.0_11-32-bit/jre/lib/i386/libnpjp2.so     /usr/lib64/mozilla/plugins/libjavaplugin.so -> /usr/java/jdk1.8.0_11-32-bit/jre/lib/i386/libnpjp2.so     ~/.mozilla/libjavaplugin.so -> /usr/java/jdk1.8.0_11-32-bit/jre/lib/i386/libnpjp2.so      And they're all intact. The 64-bit java plugin worked (it was in `/usr/lib64/mozilla`)—I got rid of that, first. `/usr/java/jdk1.8.0_11-32-bit/jre/bin/java` works ok, so I think I have all the compat libs.


title: Nas4free (freeBSD) wont make it past bootloader without keyboard?

text: I've got an old Compaq machine re-purposed as a Home NAS using Nas4free. I've had it connected up to a monitor and keyboard (PS/2) for a while, (which boots fine, no issues) but I would like to have it boot and run with no peripherals. However when I remove the keyboard, it never gets past the bootloader screen. Specifically, this is what it says:               -     FreeBSD/x86 boot     Default: 0:ad(0,a)/boot/loader     boot: 7      Now I've been through the BIOS settings, there isn't an option to not check for a keyboard, nor is there an option to not halt on error. I should mention that I was originally running _FreeNAS 8_ , however due to issues with plugins and the like I've moved to nas4Free (the old _FreeNAS 7_ ). This issue was _not_ present using FreeNAS 8. **Further Info** :   * _Nas4free_ version 9.1.01 (based on _FreeBSD_ 9.1 RELEASE) See here   * x86 Pentium III, 800mhz   * 512 MB RAM Am I on the right track, is this a "your keyboard must be connected" issue, or is it something else? Is there a possible workaround?


title: How does systemd survive a kill -9?

text: Between the recent "Why does 'kill -9 0' end my console session" and "How to get a kernel panic" questions, I got a bur under my saddle and tried `kill -9 1` on a mostly up-to-date Arch linux laptop. I did it as user ID "root". I fully expected some kind of crash or panic or shutdown, but nothing happened. I did `kill -9 1` again, to no effect. Arch linux machines run `systemd` these days, so: how does `systemd` survive a kill -9? I expect there's special case code in the Linux 3.7 kernel, but maybe some other reason exists that I haven't thought of. What about other things that run with PID 1? Slackware still uses `init` I believe, but I'm scared to try it on my production Slackware server. DD-WRT on my wireless router runs /sbin/init of some sort.


title: How to run linux on PS3?

text: I'm learning numeric computation and have a Core i5, 4gb laptop which I find to be slow for some tasks. I've read that a single PS3 has the processing power of 30 clustered PCs. Basically I'm thinking of purchasing a PS and installing Linux on it and then running my python programs on it. I've read that Sony has disabled the ability to install Linux with firmware update 3.21 Is there a way to run Linux on recent versions of PS? Is there a hack around the new limitation? If I went out and bought one would I be able to run Linux or not?


title: Tool to reduce a partition's size and create a new one from the command-line

text: At the moment I don't have any free space:               (parted) mkpart      Partition type? primary/extended? primary      File system type? [ext2]? ext4      Start? 60G     End? 62.9G     Warning: You requested a partition from 60.0GB to 62.9GB.      The closest location we can manage is 250GB to 250GB.          Disk /dev/sda: 250GB     Sector size (logical/physical): 512B/512B     Partition Table: msdos     Disk Flags:          Number Start End Size Type File system Flags     1 2097kB 62.9GB 62.9GB primary ntfs     2 62.9GB 63.4GB 524MB primary ext4     3 63.4GB 250GB 187GB primary boot, lvm      I want to reduce the size of an NTFS partition (1) so I can make a new one. I need a console tool like `parted`, not a GUI like `gparted`.


title: Duplicity causing rootfs to fill up with deleted files

text: I've been using Duply with Duplicity to send incremental backups to Amazon S3 from my Ubuntu machine. I noticed it caused about twice as much data going out from S3 to the internet which is strange because I only send data to S3. When I ran `ps ax | grep duply` I noticed Duply was started about a 100 times or more. Which might cause this. I can't seem to figure out why this happens. Today the rootfs which is 20 GB in size filled up completely with deleted files from Duplicity. When I ran `lsof +L1` I saw a huge list of deleted files being held open in /tmp. So I killed every single one of the Duply processes and my lost disk space was instantly back. My root crontab:               # Daily backups     *  2  *  *  *       duply website backup && echo /home/website backup done!     30 2  *  *  *       duply mysql backup && echo /home/mysqldump backup done!     45 2  *  *  *       duply files backup && echo /data/files backup done!     *  3  *  *  *       duply storage backup && echo /data/storage backup done!      I believe this it setup so it runs at 2 AM, 2:30, 2:45 and 3 AM. The largest back-up takes about 15 minutes and is the last one which runs at 3AM daily.


title: Turn on Swap after resize /

text: I resized with lvresize the swap from 4 to 2G and can't turn it on.               swapon /dev/VolGroup/lv_swap     swapon: /dev/VolGroup/lv_swap: swapon failed: Invalid argument          lvdisplay /dev/VolGroup/lv_swap       --- Logical volume ---       LV Name                /dev/VolGroup/lv_swap       VG Name                VolGroup       LV UUID                h7DEfK-cdVr-UzeQ-8qDJ-rAhH-ejYS-k2wyY6       LV Write Access        read/write       LV Status              available       # open                 0       LV Size                2.06 GiB       Current LE             66       Segments               1       Allocation             inherit       Read ahead sectors     auto       - currently set to     256       Block device           253:1


title: which DE to use for setting up defaults

text: I'll use awesomewm as my main DE but without installing any actual DE(like KDE, GNOME, XFCE etc) I have to setup too many basic stuff like mouse cursor themes, gtk/qt theme engines and themes, clipboard manager, sound manager, screen manager(like lxrandr, arandr etc.), auto-mounter ... Now I was thinking if it's possible to just install a DE and get it's settings for those, and then move to awesomewm with all those settings are set up. Is it possible, and if so, which DE do you recommend for that purpose ?


title: How do I change XFCE tiling to maximize on top edge?

text: In XFCE 4.10, you can enable an option that allows windows to tile automatically when dragged to the edges. The default is to tile to half the screen (half-top, half-bottom, half-left, or half-right). I want to change this so that dragging to the top edge maximizes a window, but I don't see any options in the settings anywhere to change this. Can this be done or am I out of luck here?


title: How to set up hjkl for less?

text: `less` already uses j/k for vertical scrolling, but not h/l for horizontal scrolling (in `\--ch` mode). The l key isn't bound to anything anyway, and h is just a synonym for H, so I wouldn't overwrite any important bindings. How can I make h and l scroll horizontally?


title: How to get switch MAC address if it's a layer2 one?

text: arp -a      doesn't show it. How can I get the MAC of it then? (on ex.: from a Linux)


title: How to make vi working in single-user-mode?

text: When booting FreeBSD (I use 8.4-amd64) in single-user mode, mounting root filesystem in RW mode and trying to `vi` some text file, I get all of this file contents in one line. This makes `vi` unavailing to edit text configs. ![](http://i.stack.imgur.com/tKGSC.png) ![](http://i.stack.imgur.com/N89Lm.png) When running multi-user, all works OK. How to fix this?


title: Autojump auto-complete feature does not work

text: On my configuration, autojump _autocomplete_ feature does not seem to work. To be clear, autojump works properly, only the autocomplete feature fails to work. When I press the `<TAB>` key, the autocompletion menu is not displayed but the directory name I typed is partially enclosed in quotes. Here is what happens. **Note that after typing liba, I pressed the`<TAB>` key multiple times**. I would have expected autojump to cycle through `/tmp/liba1` and `/tmp/liba2`. Also not that `/tmp/liba2` only appears after I pressed the`<ENTER>` key. ![Autojump autocompletion attempt](http://i.stack.imgur.com/cF6nQ.gif) I am using :   * Konsole 2.12.4 (KDE 4.12.4) (but I have the same issue with xterm)   * Liquidprompt   * Bash 4.3.11   * Autojump 21.6.9 Here is the bottom of my `.bashrc` file :               # Alias definitions.     # You may want to put all your additions into a separate file like     # ~/.bash_aliases, instead of adding them here directly.     # See /usr/share/doc/bash-doc/examples in the bash-doc package.          if [ -f ~/.bash_aliases ]; then         . ~/.bash_aliases     fi          # enable programmable completion features (you don't need to enable     # this, if it's already enabled in /etc/bash.bashrc and /etc/profile     # sources /etc/bash.bashrc).     if ! shopt -oq posix; then       if [ -f /usr/share/bash-completion/bash_completion ]; then         . /usr/share/bash-completion/bash_completion       elif [ -f /etc/bash_completion ]; then         . /etc/bash_completion       fi     fi          # Liquidprompt     source ~/.liquidprompt/liquidprompt     # Autojump     . /usr/share/autojump/autojump.bash


title: Is Debian 6 EOL or not?

text: I read that support for Debian 6 ended this month. And here I read that there is LTS until 2016. https://www.debian.org/News/2014/20140424 Is this for paying customers only? Or can we safely keep using Debian 6?