title: Emacs: Interface that mixes commands and arguments

text: I'm experiencing with ways to configure Emacs to enable me to type less, but achieving the same thing, by exploiting the fact that in programming, you do (type) more or less the same thing over and over. I need this for medical reasons, but also because it makes sense in general. The Emacs-interface I envisage is basically mixing commands with arguments. I'll just show an example and you'll understand immediately. OK, you don't have to be that sharp to see, that in C, the for loop, "less than something, increment by one", is very common. So I thought I'd write something like this:               (defun C-for-loop-new-int-less-inc (var start stop)       "Shortcut for putting a C for loop at point.        Note: There are some specifics to i."       (interactive "sVariable: \nnStarts at: \nnLess than: ")       (insert        (format "for (int %s = %d; %s < %d; %s++) {\n\n}"                var start var stop var) )       (previous-line)       (c-indent-line-or-region) )      And to reduce typing:               (defalias 'fnili 'C-for-loop-new-int-less-inc)      Now, `M-x fnili RET i RET 0 RET 10 RET` should get you               for (int i = 0; i < 10; i++) {          }      with the cursor at the second row, with indentation. While that's an improvement, how can I fire off the command like this:               fnii0l10i      That way, all the `RET`-wait-reorient cycles would vanish, instead you'd write the entire command, once, and it would be visible all the time. Now, I now I could write a function that takes a string, and then parses it, but I won't do that if Emacs already has support for such an interface that I seek. **Edit** So, "template facility" is the designation? I don't think it is **that** hard to do. If you want this for the entire C language, and for all possible twists and turns, then I agree. But to identify just a few time consuming cases (for, switch-case, the guard in header files) and implement those, that would be a helpful feature. Of course, if work has been done, I'm not doing it from scratch (as I said :), so I'll check out your links for sure. But... I think my example was too complicated so it overshadowed the actual question, which is about the interface: instead of hitting `RET` and getting a blank line for each argument, putting it all on a single command line. A much more simple example: Instead of `M-x man RET irssi RET`, how can I do `M-x man"irssi" RET`? In this example, it is not really beneficial (slightly perhaps) because it is only a single argument, and there is nothing complicated to it (that you need to keep in your brain), and you will seldom make a mistake that you have to "backtrack" to correct. But, in the for loop example command in the original post (fictitious, as I've never seen it, if it exists) - in that case, you would really benefit from it.


title: how to close the jobs one by one? is there any options?

text: There is list of jobs running.               pdf is opened     image is opened     text file opened      It's all in fg/bg . Is there any option to close the particular job forcefully? Also, I want to know if the jobs can be closed with the help of a command.


How can I search a wild card name in all subfolders? What would be the equivalent of DOS command: `dir *pattern* /s` in *nix?


title: Why does Redhat's daemon function not have a group setting?

text: **Background:** I'm a Ubuntu/Debian fan and most of my development experience has been on that platform but my current employer uses Redhat. I needed to write a simple init.d script and want the resulting program to run as an unprivileged user. Most resources I found suggest using the daemon function in lieu of start- stop-daemon. **Question:** Why doesn't the daemon function have an option to set the group like the start-stop-daemon? I'm sure there must be a reason for this, just not sure what that reason is.


title: openssl s_client hangs

text: I am trying to look at some ssl certs with openssl's s_client. For some reason it hangs with the connection open after spitting out the cert info. Here is the command I am using and the output:               mike@sleepycat:~☺  openssl s_client -connect facebook.com:443     CONNECTED(00000003)     depth=1 O = VeriSign Trust Network, OU = "VeriSign, Inc.", OU = VeriSign International Server CA - Class 3, OU = www.verisign.com/CPS Incorp.by Ref. LIABILITY LTD.(c)97 VeriSign     verify error:num=20:unable to get local issuer certificate     verify return:0     ---     Certificate chain      0 s:/C=US/ST=California/L=Palo Alto/O=Facebook, Inc./CN=www.facebook.com        i:/O=VeriSign Trust Network/OU=VeriSign, Inc./OU=VeriSign International Server CA - Class 3/OU=www.verisign.com/CPS Incorp.by Ref. LIABILITY LTD.(c)97 VeriSign      1 s:/O=VeriSign Trust Network/OU=VeriSign, Inc./OU=VeriSign International Server CA - Class 3/OU=www.verisign.com/CPS Incorp.by Ref. LIABILITY LTD.(c)97 VeriSign        i:/C=US/O=VeriSign, Inc./OU=Class 3 Public Primary Certification Authority     ---     Server certificate     -----BEGIN CERTIFICATE-----     MIIDzDCCAzWgAwIBAgIQAWX5/4nQsxqIdTfN7yT+BDANBgkqhkiG9w0BAQUFADCB     ujEfMB0GA1UEChMWVmVyaVNpZ24gVHJ1c3QgTmV0d29yazEXMBUGA1UECxMOVmVy     aVNpZ24sIEluYy4xMzAxBgNVBAsTKlZlcmlTaWduIEludGVybmF0aW9uYWwgU2Vy     dmVyIENBIC0gQ2xhc3MgMzFJMEcGA1UECxNAd3d3LnZlcmlzaWduLmNvbS9DUFMg     SW5jb3JwLmJ5IFJlZi4gTElBQklMSVRZIExURC4oYyk5NyBWZXJpU2lnbjAeFw0x     MjA2MjEwMDAwMDBaFw0xMzEyMzEyMzU5NTlaMGoxCzAJBgNVBAYTAlVTMRMwEQYD     VQQIEwpDYWxpZm9ybmlhMRIwEAYDVQQHEwlQYWxvIEFsdG8xFzAVBgNVBAoTDkZh     Y2Vib29rLCBJbmMuMRkwFwYDVQQDExB3d3cuZmFjZWJvb2suY29tMIGfMA0GCSqG     SIb3DQEBAQUAA4GNADCBiQKBgQC4e9C0eD3zy0YR829bH7fd3PGGDp/3Rd7UR65Q     +jcsRoLZaer9k9tPEOd5ZmWR1MTzwVEmZ94fhoWf219K2Nx/v7fQaWYh5U0DETUo     bkDfR4zBAe+oMuFDIGrhEkUEdlWUOcpvScrtzRjRLyikTc4twjRlpB5RdnGGFopw     CRTNMwIDAQABo4IBIDCCARwwCQYDVR0TBAIwADBEBgNVHSAEPTA7MDkGC2CGSAGG     +EUBBxcDMCowKAYIKwYBBQUHAgEWHGh0dHBzOi8vd3d3LnZlcmlzaWduLmNvbS9y     cGEwPAYDVR0fBDUwMzAxoC+gLYYraHR0cDovL1NWUkludGwtY3JsLnZlcmlzaWdu     LmNvbS9TVlJJbnRsLmNybDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIw     CwYDVR0PBAQDAgWgMCkGA1UdEQQiMCCCEHd3dy5mYWNlYm9vay5jb22CDGZhY2Vi     b29rLmNvbTA0BggrBgEFBQcBAQQoMCYwJAYIKwYBBQUHMAGGGGh0dHA6Ly9vY3Nw     LnZlcmlzaWduLmNvbTANBgkqhkiG9w0BAQUFAAOBgQBnkJ5NVI4xzdKlATMc46Jy     +l7LY+DZH+HEfBz6e/YWNvwuj40I+GxkqASjGKyyOo8dIS9AydbaWuF9SgGTYnAO     J9awxd21Zy8YrDp8dr7TAEeqUwNkVeJloiQUpCQLjqIFsZ/paWxVbjZZlUBbDvwx     2iEmqGo+ziZWHirmhVut0A==     -----END CERTIFICATE-----     subject=/C=US/ST=California/L=Palo Alto/O=Facebook, Inc./CN=www.facebook.com     issuer=/O=VeriSign Trust Network/OU=VeriSign, Inc./OU=VeriSign International Server CA - Class 3/OU=www.verisign.com/CPS Incorp.by Ref. LIABILITY LTD.(c)97 VeriSign     ---     No client certificate CA names sent     ---     SSL handshake has read 2230 bytes and written 388 bytes     ---     New, TLSv1/SSLv3, Cipher is AES256-SHA     Server public key is 1024 bit     Secure Renegotiation IS NOT supported     Compression: NONE     Expansion: NONE     SSL-Session:         Protocol  : TLSv1.1         Cipher    : AES256-SHA         Session-ID: 5FFDA57069D60A3FBEBCC667B76B8CDF649DA6D04656985D828DE2AE74426645         Session-ID-ctx:          Master-Key: FA27B6E7A08420EE27F74A01136077C064891D49BA64BE508CD99242F52A482AC6AA44D7D4487A99728C04F2EA547352         Key-Arg   : None         PSK identity: None         PSK identity hint: None         SRP username: None         TLS session ticket lifetime hint: 86000 (seconds)         TLS session ticket:         0000 - 9d da 29 68 1c 35 19 21-da 2a 45 eb 17 71 83 42   ..)h.5.!.*E..q.B         0010 - 6d 5c 55 97 82 18 36 9a-b6 7d 10 2c 25 2f 31 43   m\U...6..}.,%/1C         0020 - 57 77 d1 f1 bf 30 26 a8-84 90 d1 6c 91 83 72 7d   Ww...0&....l..r}         0030 - 33 e6 a5 bf e3 82 d4 00-8d 44 c8 8a 03 71 58 6c   3........D...qXl         0040 - 28 f4 41 b4 71 67 6c e6-06 39 06 d5 3c 0d ed de   (.A.qgl..9..<...         0050 - ba e9 48 2c fe d5 6e a0-a4 cf 27 92 1b 96 79 dc   ..H,..n...'...y.         0060 - 9a d8 3c 6e 04 f0 2d 7c-05 d4 7b d5 8a a6 99 76   ..<n..-|..{....v         0070 - c3 57 11 3e 7c 0a 9d 46-a2 01 b9 a7 8a ce 5b 32   .W.>|..F......[2         0080 - 8e 40 30 f3 14 93 b4 e4-55 e0 9c e8 dc 2f 02 a8   .@0.....U..../..         0090 - ef d9 52 54 d2 16 f9 8d-23 e1 34 14 26 64 29 c8   ..RT....#.4.&d).         00a0 - c8 0a 09 97 24 eb 6c 92-ff 82 f5 e8 a1 6f 2a f2   ....$.l......o*.              Start Time: 1347376514         Timeout   : 300 (sec)         Verify return code: 20 (unable to get local issuer certificate)     ---      And this is where is stays without ever completing. How can I get this command to complete cleanly so I can use it in a script? I am running on Ubuntu.


title: Change completion behaviour with brace expansion in zsh

text: I have got used to using tab-autocompleting inside braces without expanding in zsh. This was possible, while I used zsh with a basic grml-config. Since I migrated to oh-my-zsh, I can't reproduce this behaviour. Example:               $ touch dir/{some_file,other_f<TAB>}      The behaviour I want:               $ touch dir/{some_file,other_file}      The behaviour I get:               $ touch dir/some_file dir/other_f      Instead of autocompleting, a tab expands the braces, defeating the purpose of the brace expansion, whenever I tab for any of the filenames. I have searched for an answer in the manpages and the zsh-sites for anything relevant, but I couldn't find anything satisfying. Since I am still fresh to zsh, I am not sure, what to look for exactly, though. I would appreciate any pointers on where to find any explanations relevant to this question. Thank you in advance for any helpful input!


title: How can I use the tmpfs to accelerate my chrome browser start up?

text: Every time when I am trying to start the chrome browser, it is a little bit slow because the chrome need to load the cache and that may cause a big amount of disk IO. My distribution is Debian Wheezy(7.0),and what should I do to make the browser start faster? Use the `tmpfs` and how?


title: What is TX status timeout and do I have to worry about it?

text: Recently, after performing a routine software upgrade, I notice a huge surge in the number of warnings from the kernel that goes like this: > warning kern [10839.717480] phy0 -> rt2800usb_txdone: Warning - Got TX > status for an empty queue 0, dropping   >  warning kern [10839.895305] phy0 -> rt2800usb_entry_txstatus_timeout: > Warning - TX status timeout for entry 11 in queue 2   >  warning kern [10839.895325] phy0 -> rt2800usb_entry_txstatus_timeout: > Warning - TX status timeout for entry 11 in queue 2   >  warning kern [10839.895327] phy0 -> rt2800usb_entry_txstatus_timeout: > Warning - TX status timeout for entry 11 in queue 2 I think it has something to do with either the newly installed `kernel-3.9.4-200` or `wpa_supplicant-1.1-1` as the warnings appeared soon after these were installed. From the message itself, I think it has something to do with the wireless transmission, but not sure whether this is something serious as it is filling up my log quite rapidly. I am using a TP-Link wireless USB adapter. Has anyone encountered such problem or know whether it is something that I need to worry about?


title: Extract marked strings from text file using Bash

text: I have files which are of the following style - these are parametrised configuration files; the values within the `#`characters are replaced with real values from a database depending on environment.               ABC=#PARAMETER_1#:#PARAMETER_2#     SOMETHING_ELSE=#PARAMETER_1#     SOMETHING_NEW=#PARAMETER_2##PARAMETER_3#      I would like to extract from these files the values between the hash/pound (`#`) characters, so that I can easily identify the parameters required. There is no standard column width or anything like that, the only standard being that anything between two `#` characters is replaced with a value from the database. This is the ideal cleaned, deduped output:               PARAMETER_1     PARAMETER_2     PARAMETER_3      I have seen this question, but the crucial difference is that there can be any number of variables on a particular line in my situation. I have tagged this question with Bash, but it doesn't have to be, it could be perl etc, it just needs to run from the command line in Unix.


title: How to restrict OpenSSHD when I'm logging in from dynamic IP address?

text: So I have an OpenSSHD on an Ubuntu machine using static IP address. My notebook PC has dynamic IP address -> "I mean really dynamic", so there couldn't be any ranges specified... I need to restrict the SSHD to only show that it's there to my notebook (so no one else could see that there is an sshd listening on some port, only me). I'm thinking about knockd (It's really simple to implement). Are there any solutions?


title: How to split vCards lines

text: Related to How to join vCards lines, vCard does a weird kind of line splitting: **If a line contains more than 75 characters, insert a "CR, LF, space" sequence.** Thus the following line:               123456789A123456789B123456789C123456789D123456789E123456789F123456789G123456789H123456789I123456789J123456789K123456789L123456789M123456789N123456789O123456789P123456789Q123456789R123456789S123456789U123456789V123456789W123      should be split into the following lines:               123456789A123456789B123456789C123456789D123456789E123456789F123456789G12345      6789H123456789I123456789J123456789K123456789L123456789M123456789N123456789      O123456789P123456789Q123456789R123456789S123456789U123456789V123456789W123      You can't just insert the line split sequence every 75 characters, because then there would be more than 75 characters per line again, and you can't just insert after counting 75 characters because it should only be inserted if the line is _longer_ than 75 characters. One way to do it is to repeat the following command until the input no longer changes:               sed -e 's/^\(.\{75\}\)\([^\r]\)/\1\r\n \2/' < file | sed -e '...' | ...      That's obviously not going to work with indeterminately long lines, and is horribly inefficient. How would you do this sort of replacement?


title: Change directory with space followed by '('

text: There are two directories I can change to:               Program Files/       Program Files (x86)/      I can change to first one by writing:               cd Program\ Files      But the second for second one:               cd Program\ Files\ (x86)      I get:               bash: syntax error near unexpected token `('      What is the right way to change to second directory?


title: Different domains for multiple VM's on host with one WAN IP

text: I've got only one WAN IP address bound to KVM host system and multiple VM's with internal IP's, say, 10.0.0.1/28. On the other hand I have multiple domain names bound to host system WAN IP. The problem is that I need to somehow route each request to specific VM based on domain name. Is it possible to solve this issue without buying lots of WAN IP's?


title: Remember password after `sudo -i`

text: If I do `sudo <command>` and enter the password, my Debian Squeeze remembers the fact I passed the password and never asks for it for i.e. 15 minutes. But if I do `sudo -i` and then `exit`, the system does **not** remembers the password and asks for it all over again every time I use `sudo -i`. Doing just once `sudo <command>` makes the system not ask for password even for a next `sudo -i`. Here are the scenarios I've described above: First one:   1. login (by SSH),   2. `sudo <command>`: system's asking for the password,   3. `sudo -i`: system **is not** asking for the password. Second one:   1. login (by SSH),   2. `sudo -i`: system's asking for the password,   3. `exit`   4. `sudo -i`: system's **again** asking for the password. Doing something beetween 2. and 3. makes the system remember the password. What is the reason of such a behaviour? Is it possible to make the system remember the password (fact I passed it) also after using `sudo -i`?


title: How to find VM OS installation media file in the Proxmox Web Interface?

text: I have installed Proxmox and wanted to create a VM by using the Proxmox web interface GUI (now the version is _2.0-38/af81df02_ ) However I have problem to **find my Guest VM OS installation CD/DVD ISO file** in the web GUI interface. ![enter image description here](http://i.stack.imgur.com/M3pRd.png) There is no ISO file can be found even I am very very sure I have copied the Ubuntu ISO file into the `/home/ISOs` directory which I have created in the "storage" tab. ![enter image description here](http://i.stack.imgur.com/eM03A.png) ![enter image description here](http://i.stack.imgur.com/aDhmK.png) Why I cannot find the "Installation Media File" in Proxmox after I have copied it to the correct local directory and created the correct path in the Proxmox "storage" tab?


title: Knoppix multiple desktops

text: I have knoppix 6.4.4 installed on a persistent usb drive. By default, compiz is set up and allows me to switch between my four desktops. The problem is, when I have two browsers open, one in desktop1 and one in desktop2, they both show it the taskbar in both desktops. I would like to keep them separate, each desktop showing only its current windows. This is how ubuntu sets up workspaces by default, but after much searching, I could not find any such settings on knoppix.


title: lpstat and localization under Mac OS X

text: How to force "lpstat" utility to show output messages in English under localized Mac OS X (version 10.6)? Example:               lpstat -v      Shows in Dutch:               apparaat voor Samsung_SCX_4300_Series: usb://.....      I need to force it to show the message in English in order to be able to parse the output by the application using regexp ("device for" prefix):               device for Samsung_SCX_4300_Series: usb://      I have tried running it with "LANG=en_US.UTF-8" prefix, "LC_MESSAGES=C" prefix, etc. but none of those appear to have any effect under Mac. English language is listed under system preferences on the second position.


title: how to recover mistakenly deleted root user line in /etc/passwd

text: I had an accident with /etc/passwd - using putpwent(), I replaced the first line of /etc/passwd with mine.   Unfortunately this line used to belong to root.   Now I don't have root permission, and I can't change it back.   The file belongs to user 0 group root:   `-rw-r--r-- 1 0 root 1.8K Jan 9 11:33 passwd` Any idea how to recover?


title: How can I send SMS messages from my mobile/router? (Linux/Textmode)

text: I love mails sent to me from my own system, but I want more... I want... for instance, texts about my system, and a little web-based SMS sender too. So, I buy a GSM (3G) router. This router can also send SMS messages, and here is my question: Is there some ( _commandline_ ) utility to use from Perl/Bash/PHP scripts to do so? And no, I do _not_ want to rely on a script that calls a free web-based SMS sender. I want to use _my_ router, _my_ number.


title: ssh_exchange_identification: Connection closed by remote host on vnx machine (linux)

text: I changed the password of my linux machine . I was able to login for sometime and after that I am not able to ssh. I am getting the following error:               ssh es4042cs -v     OpenSSH_5.1p1, OpenSSL 0.9.8j-fips 07 Jan 2009     debug1: Reading configuration data /etc/ssh/ssh_config     debug1: Applying options for *     debug1: Connecting to es4042cs [10.66.213.242] port 22.     debug1: Connection established.     debug1: permanently_set_uid: 0/0     debug1: identity file /root/.ssh/id_rsa type -1     debug1: identity file /root/.ssh/id_dsa type 2     **ssh_exchange_identification: Connection closed by remote host**


title: mp3info fails to make MP3 data fields readable by Android

text: I have been struggling for months on how to add mp3 tags readable by (of all things) Android? (mp3info doesn't seem to set the fields in a way readable by Android music players, and neither does RhythmBox). So far, my most success has been the embarrassment of ripping the CD from a Windows machine, letting it auto-recognize the album/artist/title fields, then transferring the files back over to Linux for listening.


title: How to connect a Wiimote to a Fedora 19 system?

text: How to connect a Wiimote for remote controlling purposes under Fedora? (actually, it is a 3rd party wiimote clone, like the ones sold on amazon for 15 $)


Why am I receiving this error message on Kubuntu since I upgraded to 12.04 and how can I make it stop appearing? It appears as a pop up balloon above the system tray. `Mail Dispatcher Agent: Could not access the outbox folder (Unknow error. (Failed to fetch the resource collection.)).`


title: rsstail Not Printing Output

text: I've installed rsstail 1.8 on my linux box and everything seems to be going smoothly, knock on wood, except for the part where rsstail isn't printing the streams. Running the command, I see that it's retrieving the feed, but nothing ever happens and I'm flummoxed as to why.               rsstail -i 300 -t -d -v -u http://www.nu.nl/feeds/rss/algemeen.rss -n 20     Monitoring RSS feeds:             http://www.nu.nl/feeds/rss/algemeen.rss     Check interval: 300     Retrieving RSS feed 'http://www.nu.nl/feeds/rss/algemeen.rss'...      Edit: I'm looking for this to do two things. Given a RSS feed, I'd like to go pull the last N entries for display and second track the feed and update with new articles. Despite pointing at feeds (I've tried CNN and others) it never displays the previous listings, even though browser eyeballing says stuff is there.


title: Mint update with NVIDIA breaks Cinnamon

text: I have Linux Mint 14 64-bit Cinnamon on a desktop with an NVidia GTX 680 graphics card. I downloaded and installed the drivers from the NVIDIA website (installed on TTY1 with `sudo service mdm stop`). The drivers work and the GPU is fully functional. However, after running the update manager (because it's a fresh install), the Cinnamon environment becomes severely broken. The title bars are missing and so is the bottom panel. `Alt`-`F2` doesn't work either. I can get the title bars back with `sudo metacity --replace` but the panels are still gone. Setting session to "GNOME Classic" works fine but I much prefer Cinnamon. How can I go about getting Cinnamon back?


title: Cannot start Wifi Hotspot from Fedora 20 - MATE but works on GNOME

text: I cannot start the Wifi Hotspot on Fedora 20 Mate Desktop Environment from NetworkManager. But when i log off and login to GNOME i am able to start it. I read some stuffs about hostapd but couldn't figure out. But as i can start the Hotspot on Gnome i guess my wifi interface definitely supports AP mode (read somewhere that it is required.). Now what am i missing here.? I installed hostapd which i think wasn't on my system and tried to change some configuration in hostapd.conf but could never start the service. This is how my conf file looks like :               rsn_pairwise=CCMP     interface=wlp3s0     driver=nl80211     ssid=xxxxxx     hw_mode=g     channel=6     macaddr_acl=0     auth_algs=1     ignore_broadcast_ssid=0     wpa=3     wpa_passphrase=xxxxxx     wpa_key_mgmt=WPA-PSK     wpa_pairwise=TKIP      Error when i try to start the service.               Sep 02 19:51:53 kingsTP hostapd[16470]: Configuration file: /etc/hostapd/hostapd.conf     Sep 02 19:51:53 kingsTP hostapd[16470]: nl80211: Failed to set interface wlp3s0 into AP mode     Sep 02 19:51:53 kingsTP hostapd[16470]: nl80211 driver initialization failed.     Sep 02 19:51:53 kingsTP systemd[1]: hostapd.service: control process exited, code=exited status=1     Sep 02 19:51:53 kingsTP systemd[1]: Failed to start Hostapd IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator.      But how come Gnome Network manager is able to start the hostpot even without hostapd. What is difference between this two environments. What exactly is required for running a hostspot and how to make it work on MATE.


title: Scrolling in Touchpad doesn't work on Acer Aspire S3

text: I'm on the latest Linux Mint release on an _Acer Aspire S3_. Unfortunately I can't scroll using my Touchpad. Google helped a little bit since I now know that there should be Touchpad options in System Settings -> Mouse. Unfortunately this is not true for me. Could somebody point me in the right direction?


title: How to switch between GPU's

text: How can I switch between two GPU's on-the-fly using Ubuntu 11.04? I have an Asus EEE1015PN intel N550 with two GPU's: GMA3150 and Nvidia ION2. For example Windows 7 will switch to the bigger CPU when I pull up a full HD movie.


title: How to know DHCP options value on debian/ubuntu and other linux

text: How to know all DHCP options and values (on the client side, Linux Ubuntu / Debian / ArchLinux ) provided by the server. I need to pass non-standard option to the client by the DHCP option code example:               222-223 Unassigned      224-254 Reserved (Private Use)      All DHCP Options here The file /var/lib/dhcp.lease does not contiend my options


title: gcc not found when installing mysqldb for django 1.4

text: I am trying to install the python module mysqldb which is the python interface for mysql. I need this module because I am creating a Django development server (Django 1.4, OpenSUSE) and the database package I wish to use is mysql. This is the tutorial I am following: https://docs.djangoproject.com/en/1.4/ref/databases/#mysql-notes I am using virtualenv, and inside my virtual environment I am executing this command:               $ pip install mysql-python      My first error was that the 'mysql_config' command was not found. After some reading I went into yast to install 'libmysqlclient-devel' which is defined as 'MariaDB development header files and libraries'. I do not have MariaDB installed, just mysql. I don't know if this will make a difference. After installing that, I type the same command and now have this error:               $ pip install mysql-python          unable to execute gcc: No such file or directory          error: command 'gcc' failed with exit status 1      I have no idea what this is. Before I came here I read some things about python-dev tools but I can't find any package for that in yast or any modules in pip search. Anyone know what this error means?


title: Search for man pages which contain ALL of the words 'foo' 'bar' and 'baz'

text: I'd like to search for man pages which contain ALL of the words 'foo', 'bar' and 'baz'. If possible, I'd like to search through all text (not just name & description) of all man pages. I'm guessing something like               man -K foo AND bar AND baz


title: Using sed with herestring (<<<) and read -a

text: I use `sed` with `<<<` and `read` to assign all words in a string to variables. What I do is:               read -a A0 <<< $(sed '2q;d' /proc/stat)      Hence, `sed` reads the second line of the file `file` and immediately quits. The line `sed` has read in is fed to `<<<` which does expands the input it receives from `sed` and `read -a` assign the resulting values of `<<<` to elements of an array. Is the usage of `<<<` and `sed` in this way a good idea or are there obvious reasons that speak against this and most of all, is there a faster way to do this?


title: Simple QoS configuration with PRIO Qdisc is not working

text: Im using `Ubuntu 12.10` OS and i want to prioritize ICMP traffic over any other traffic in the egress queue of `eth0` interface (as it is my default route to internet). By default this is the `qdisc` configured for `eth0`:               $ tc qdisc     qdisc pfifo_fast 0: dev eth0 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1        As I concern, the configuration above should prioritize traffic regarding datagram TOS mark. To test this assumption i send ping request to 8.8.8.8 using `ping` with the option `-Q` to set the DSCP value of the packets.               $ ping -Q 184 8.8.8.8      I start with round-trip time around 50ms but as soon i start to upload a huge file via HTTP to `Dropbox` service the ping time increase up to 400 ms and it gets unstable. I have checked that TOS mark for `Dropbox` traffic is 0. Then i try to accomplish the same task using `PRIO qdisc` with this steps:   1. I create `prio qdisc` named 1:              # tc qdisc add dev eth0 root handle 1: prio        2. I add `filter` matching ICMP packets -> `band 0`.              # tc filter add dev eth0 protocol ip parent 1: prio 1 u32 match ip protocol 1 0xff flowid 1:1        3. I add `filter` matching any other traffic -> `band 2`.              # tc filter add dev eth0 parent 1: prio 3 protocol all u32 match u32 0 0 flowid 1:3      This time there is no need to set DSCP mark but im getting the same result, this is ping time increases much while im uploading some file to `Dropbox`. By the way this is the output of some commands once i get `PRIO qdisc` and filters configured:               $ tc qdisc     qdisc prio 1: dev eth0 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1           $ tc filter show dev eth0     filter parent 1: protocol ip pref 1 u32      filter parent 1: protocol ip pref 1 u32 fh 800: ht divisor 1      filter parent 1: protocol ip pref 1 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:1      match 00010000/00ff0000 at 8     filter parent 1: protocol all pref 3 u32      filter parent 1: protocol all pref 3 u32 fh 801: ht divisor 1      filter parent 1: protocol all pref 3 u32 fh 801::800 order 2048 key ht 801 bkt 0 flowid 1:3      match 00000000/00000000 at 0          $ tc -s qdisc show dev eth0     qdisc prio 1: root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1     Sent 317176 bytes 2366 pkt (dropped 0, overlimits 0 requeues 0)      backlog 0b 0p requeues 0


title: Lynx incremental search

text: I am trying to run an incremental search using `lynx`. Imagine a page, for example, an `index_of` page which contains several folders which also contain other subfolders and files. I want to run `lynx` in a way that I can enter automatically in each folder/page and search for a string, so it returns me the link which contains the string found. For example, if I am looking for a specific datasheet in http://datasheets.chipdb.org/ so I would try something like `find . -name "mydatasheet.pdf" |lynx -dump http://datasheets.chipdb.org` but that I could run in all subfolders recursively. Maybe some `grep` or whatever. How could it be done?


title: Is there a command line tool for image manipulation?

text: I'm searching for a tool for command line image manipulation. I want something similar to pinpoint presentation tool where I edit a file and can directly see the results on another window. I can get a similar result with tikz and latex but I need to compile anything any time I change something and I am hoping for something more efficient.


title: Difference between command `ls 2 >tmp >tmp` and command `ls > tmp`

text: I am relatively new to Linux systems. I don't understand what is the difference b/w `ls 2>tmp >tmp` and `ls > tmp`. They both seem to do essentially the same thing, creating a file tmp and storing the result of `ls` command.


title: How do I tell sendmail to say it's localhost instead of using its FQDN to combat spam?

text: When I started using sendmail to receive mail for my domain the server's FQDN wasn't set up right so it would appear to be localhost when other MTA connected to it. This seems to work fine. i.e. something like:               My Server: 220 localhost.localdomain ESMTP     Client: EHLO example.com     My Server: 250 localhost.localdomain      I could also send mail fine since I masqueraded as the correct domain. I have never received a spam message at this domain. I believe spammers typically scan the internet looking for replies to port 25 and when they find it connect, take the domain name from either the greeting or the domain name after the 250 response and then try random usernames at that domain. Since they only get localhost as the domain name they can't try this and so only genuine people who know the domain name (having got the mail server address from the mx records in the DNS for the domain) can send mail to the domain. (My reverse DNS does not match my domain so they can't get the domain from this either). Unfortunately I have now set up the server with a proper FQDN which is now being shown. Now it goes something like this:               My server: 220 (My reverse DNS which is not my domain name)     (I set this using confSMTP_LOGIN_MSG,'(My reverse DNS) Sendmail; $b')     C: EHLO example.com     My Server: 250 (My FQDN) oh no:(      How do I change the bit after 250 to be something else other than my FQDN without getting rid of the FQDN on the server? Also are there any bad consequences to this apart from breaking the relevant RFC?


title: Running a 32-bit application in Debian Wheezy 64 bits: Missing libraries

text: I want to play the game Aquaria in a Debian Wheezy 64 bits. The installation went ok, but when trying to play the game I get these errors:               ALSA lib conf.c:3314:(snd_config_hooks_call) Cannot open shared library libasound_module_conf_pulse.so     ALSA lib control.c:951:(snd_ctl_open_noupdate) Invalid CTL hw:0     AL lib: alsa.c:1000: control open (0): No such file or directory     Message: SDL_GL_LoadLibrary Error: Failed loading libGL.so.1      I have added 32 bit compatibility with `dpkg --add-architecture i386` and I think that the required libraries are present in the system since typing `locate libasound_module_conf_pulse.so` yields: /usr/lib/x86_64-linux-gnu/alsa-lib/libasound_module_conf_pulse.so and `locate libGL.so.1`:               /etc/alternatives/glx--libGL.so.1-x86_64-linux-gnu     /usr/lib/mesa-diverted/i386-linux-gnu/libGL.so.1     /usr/lib/mesa-diverted/i386-linux-gnu/libGL.so.1.2     /usr/lib/mesa-diverted/x86_64-linux-gnu/libGL.so.1     /usr/lib/mesa-diverted/x86_64-linux-gnu/libGL.so.1.2     /usr/lib/x86_64-linux-gnu/libGL.so.1     /usr/lib/x86_64-linux-gnu/fglrx/fglrx-libGL.so.1.2     /usr/lib/x86_64-linux-gnu/fglrx/libGL.so.1      However, it seems that Debian is ignoring them. What can I do to play Aquaria? **EDIT 1: ldd aquaria**               linux-gate.so.1 =>  (0xf77e1000)     libSDL-1.2.so.0 => /opt/Aquaria/./libSDL-1.2.so.0 (0xf7748000)     libopenal.so.1 => /opt/Aquaria/./libopenal.so.1 (0xf76fa000)     libstdc++.so.6 => /opt/Aquaria/./libstdc++.so.6 (0xf760d000)     libm.so.6 => /lib/i386-linux-gnu/i686/cmov/libm.so.6 (0xf75c3000)     libgcc_s.so.1 => /opt/Aquaria/./libgcc_s.so.1 (0xf75b8000)     libc.so.6 => /lib/i386-linux-gnu/i686/cmov/libc.so.6 (0xf7455000)     libdl.so.2 => /lib/i386-linux-gnu/i686/cmov/libdl.so.2 (0xf7451000)     libpthread.so.0 => /lib/i386-linux-gnu/i686/cmov/libpthread.so.0 (0xf7437000)     librt.so.1 => /lib/i386-linux-gnu/i686/cmov/librt.so.1 (0xf742e000)     /lib/ld-linux.so.2 (0xf77e2000)


title: Corrupt files after extracting with Cygwin's GNU tar

text: I have a bunch of tarball backups which I just restored onto my new Windows 8.1 + Cygwin system using GNU tar: `zsh$ for file in **/*.tgz; do tar xvzf $file; done` To my surprise a lot of these extracted files were corrupt. I tried replacing GNU tar with BSD tar and repeated the process, but the same files were still corrupt. Then I tried extracting them with WinRAR, and they turned up just fine. Does anybody know what's going on?


title: What is the scheduling algorithm of the Native POSIX Thread Library?

text: According to Wikipedia, The Native POSIX Thread Library (NPTL) is: > a software feature that enables the Linux kernel to run programs written to > use POSIX Threads efficiently. Which algorithm is used to switch between NTPL threads?


title: Is there a correct way to list the subdirectories of the current directory?

text: I can find the subdirectories of a directory by               ls -d -- */      or               ls -l | grep "^d"      but both of these seem indirect, and I would imagine that there would be a standard way to find just the directories. Is there a right way to do this? And if not, will either of these lead to undesirable behavior on edge cases? (Symbolic links, hidden directories, etc.)


title: What determines whether an interrupt is IO-APIC-edge or IO-APIC-level?

text: Looking at the contents of `/proc/interrupts` on an x86 Linux, I see that some of the interrupts are `IO-APIC-edge` while others are `IO-APIC-level`. I wonder what determines the interrupt type, is it the interrupt generating device, the interrupt controller (APIC), the Linux kernel or the BIOS ? (the reason I wonder is because I moved a PCI card from a dual processor Pentium III system, where it was recognized as `IO-APIC-level` to a dual processor Xeon system where it was recognized as `IO-APIC-edge`)


title: Mathematica makes no sound under Ubuntu 11.04

text: After waiting for days for my license I now got the opportunity to install _Wolfram Mathematica 8_ at home. However, neither the `Play` nor the `Speak` functions are doing anything as it seems that Mathematica cannot produce any sound output due to unknown reasons. Might anyone have an idea how I can fix this?


title: Looking at the source files, where does Linux start executing?

text: I would like to read a bit of the source code to try and understand how it all fits together, but cannot see where to start. Which file in the Linux source code is the main file used to compile the kernel? I was half expecting to find a `kernel/main.c`, but there are many files under `kernel/` and I cannot see which one is the main one? Is it `kernel/sys.c`?


title: play quicktime from browser

text: When I try to play a quicktime trailer from http://trailers.apple.com/ my OpenSUSE 12.1 system freezes. This can sometimes be so extreme that I have to force shutdown the machine. Is it somehow possible to get quicktime for UNIX systems like OpenSUSE? **Systeminformation** OS: OpenSUSE 12.1 (default installation) Browser: Firefox Plugin: No Plugins


title: Is there a way to find out if a network outage occurred from logs?

text: I have a red hat server running an oracle database. I can see in oracles rdbms' alert logs that a network outage of some sort occurred.               ORA-16198: Timeout incurred on internal channel during remote archival     LGWR: Network asynch I/O wait error 16198 log 3 service       I want to know if the server registered something similar. I'm looking for NIC failures or simply a disconnection from the switch. Note that the outage was temporary. I can access the server through ssh and I can ping the database service and the server itself, so my only way to tell that something happened is from logs. Where can I look for that?


title: Is it possible to use OpenCL on a minimal OS without X?

text: I'm looking to use OpenCL for Bitcoin mining. Obviously it is technologically possible to use a GPU and OpenCL without X; Windows machines do it all the time. I'm wondering if there is a way to use OpenCL on a graphics card on Linux or similar without installing/running X. About a year ago I read that this was not possible, but I figure that what I read may be incorrect and/or things may have changed in the last year. Is it possible now? How can it be done? Would it provide any performance improvement (theoretical or actual) when mining Bitcoins?


title: Is it possible to run two VPN clients at the same time?

text: I would like to run two VPN clients at the same time: one Cisco client and one VPNC client. For now I have my VPNC client configured to route only some known IPs to the VNC interface and would like to add the same thing for the Cisco client at the same time. Is it possible ? Do I need a Cisco client to connect to a Cisco server or can I use an other client such as VPNc ? I installed the cisco one because it was the one suggested but I am wondering if this is mandatory ?


title: Prevent users from killing processes that they own

text: I have started some processes (window based) from user's `.bashrc` file. I want to prevent users from killing those processes. Is there a way to transfer the process to superuser so that a normal user cannot kill it? Or is there a way of starting some process which is owned by super user himself?


title: GNOME-TERMINAL messed up

text: If I ssh to a machine and:               man df      I see this: ![enter image description here](http://i.stack.imgur.com/M7UEL.png) I'm using GNOME-terminal/Ubuntu 10.04 LTS. So somehow the terminal is messed up, when I want to see the ex.: man pages.. How can I fix this?


title: windows - suse rsh denied

text: I'm trying to execute a command through rsh from a Windows host to a Suse (SLES 11 SP2) host. The Suse (192.128.40.10) has xinetd installed and the service is running. I also made sure that the `/etc/hosts.equiv` file has the IP of the Windows system (192.128.40.1). If I execute the following command :               rsh 192.128.40.10 -lroot pwd      I get this error :               cannot login as local user 'xxx', remote user 'root'     permission denied by rshd.      But I added the IP address and the username ('xxx') of the Windows host in the .rhosts file and saved it in `/root` (`$HOME`). Also, I changed the permission to 600. I do know that rsh is obsolete and better methods are available, I am working on a legacy software that uses rsh and so I need rsh to work. The Log generated on the Suse is :               Jun 11 10:04:11 nimc in.rshd[3600]: connect from 192.128.40.1 (192.128.40.1)


title: How to refresh all bash shells using a command/script?

text: Whenever I modify my `.bashrc` file, I have to go to each bash shell and source it again to effect the changes. Is there a better way to do this? Some command that run once will automatically do a `source ~/.bashrc` in all the open bash shells?


title: Problem installing markdown preview plugin for gedit on Linux Mint

text: I'm trying to install a markdown preview plugin for gedit, but when I try to active it, the entry greys out. Running gedit via the terminal, I get the following error message:               Traceback (most recent call last):       File "/home/<userid>/.gnome2/gedit/plugins/markdown-preview/__init__.py", line 31, in <module>         from gpdefs import *     ImportError: No module named gpdefs          ** (gedit:2107): WARNING **: Error loading plugin 'Markdown Preview'         Trying to find **gpdefs** , I only found one potentially related page, which suggest I needed gedit-plugins installed, which I did but this didn't seem to have any effect (other than assorted new plugins). Any suggestions?


title: hack mac g4 powerbook firmware to boot linux?

text: Is there a way to flash/hack/jailbreak the firmware for say a 15" G4 powerbook so that I can boot from linux live usb sticks? As it is many macs simply do not boot from usb, let alone usb sticks and the ones that do are a complete pain to set up. If someone were to write a kind of replacement firmware for ppc macs there would be a whole community switching to linux because many mac users have thousand dollar paper weights sitting around their house ever since Apple dropped support for ppc. MY QUESTIONS ARE:   1. Can anyone help me find a link to an alternative firmware which I can install on my g4 laptop to replace the mac version of open firmware which can not boot from usb?   2. Is the firmware the reason why a perfectly healthy live usb would not boot? if you cancelled out all the posibilities that the usb stick is faulty or how you installed the system on it is faulty all that is left is the firmware not allowing it right?   3. Can I just install a clean version of Sun Microsystem's open firmware that hasnt been tinkered with by apple and get it to boot live USBs? I'm so frustrated that my mac is a paper weight right now. The CD drive on it doesn't work so I need usb sticks to work. Plus depending on what distro you go with, with a lot of tinkering and playing whatever I install will only last a couple of days so I need to use live USBs so I can play around a lot and mess stuff up.


title: How Can I Automate the Change between a Python Script and a Nohup Python Script?

text: I have a Raspberry Pi connected to a digital temperature probe, which measures my fermenting beer. A python script reads the temperature every second and prints it to the console, and stores it in a MySQL database. I enjoy and benefit from watching the temperature from the console on my computer over SSH during the day time. However, during the night, I hit `Ctrl``c` and run the following:               nohup python thermometer.py      Which allows me to shut down my SSH and my computer while retaining the temperature gathering. At 7am I hit `Ctrl``c` and then run the following:               phython thermometer.py      I do not wish to do this manually any more. I would prefer some type of script that simply issued the `nohup` command at 12am and returned to the normal `python` command at 7am. How can I do this in the most "linux appropriate" manner? I am pretty new to Linux; for example, I learned of the nohup command on the RPi stackexchange... I guess that either a modified python script issuing an `os` command or a batch script would be most appropriate.


title: What's wrong with my Xorg's config?

text: I'm using gnome under Arch Linux in my laptop with a 1920*1080 monitor on the left of it, I set the monitor as my primary display in GNOME and everything works fine after I log in. However, GDM displays my log-in dialogue on my lap- top screen every time, and I noticed that my monitor was set defaultly on the right side of my laptop. I searched and found someone said mouse's position may have effect, which did not work on me. Then I add a new file tring to configure xorg: Here is the my condition under Gnome:               xrandr -q          Screen 0: minimum 320 x 200, current 3286 x 1080, maximum 8192 x 8192     VGA1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 510mm x 290mm        1920x1080      60.0*+        1680x1050      60.0          1280x1024      75.0     60.0          1280x960       60.0          1152x864       75.0          1024x768       75.1     60.0          832x624        74.6          800x600        75.0     60.3     56.2          640x480        75.0     60.0          720x400        70.1       LVDS1 connected 1366x768+1920+312 (normal left inverted right x axis y axis) 0mm x 0mm        1366x768       60.2*+        1024x768       60.0          800x600        60.3     56.2          640x480        59.9       HDMI1 disconnected (normal left inverted right x axis y axis)     DP1 disconnected (normal left inverted right x axis y axis)      Here is my conf:               /etc/X11/xorg.conf          Section "ServerLayout"         Identifier  "Layout0"         Screen  "Screen0"     EndSection          Section "Monitor"         Identifier   "VGA1"         Option  "Primary"   "true"         Option  "PreferredMode" "1920x1080"         Option  "Position" "0 0"     EndSection          Section "Monitor"         Identifier   "LVDS1"         Option  "PreferredMode" "1366x768"         Option  "Position" "1920 312"     EndSection          Section "Screen"         Identifier  "Screen0"         Monitor "VGA1"         Monitor "LVDS1"     EndSection      And this snippet may help:               /var/log/Xorg.0.log          [    15.229] (==) Log file: "/var/log/Xorg.0.log", Time: Fri Jul 12 22:58:56 2013     [    15.294] (==) Using config file: "/etc/X11/xorg.conf"     [    15.294] (==) Using config directory: "/etc/X11/xorg.conf.d"     [    15.332] (==) ServerLayout "Layout0"     [    15.332] (**) |-->Screen "Screen0" (0)     [    15.332] (**) |   |-->Monitor "LVDS1"     [    15.364] (==) Automatically adding devices     [    15.364] (==) Automatically enabling devices     [    15.364] (==) Automatically adding GPU devices      After all, nothing happened, my laptop is still my primary screen on the wrong side. What should I do for now?


title: Good GNU/Emacs tutorial

text: I'd like to learn emacs in depth. The problem is that they divide in 2 categories:   * Basics (That `C-x` `C-s` saves files and `C-x` `C-c` exists emacs etc.)   * Everything I'm currently use 1%-10% of emacs features and I'd like to increase it to 20%-40%. However I'd prefer not to have to read in depth to find out how feature is useful for me. Is there an intermediate tutorial for programmers (I know several programming languages including the functional ones but not LISP)?


title: ZSH tab completion: only complete files and not binaries

text: Is it possible to make a custom zsh completion file,so when hitting tab for filenames it avoids completing the binaries? For example,I have 2 files , myprogram.c and myprogram,the binary,is it possible so when I do vim myprog(tab) it automagically completes it to myprogram.c,not myprogram? Thanks in advance!


title: Clarify File Permissions

text: I've been searching for information about file/directory permissions, and I keep finding the same basic principles. What I can't find anywhere is a rationale for determining what permissions to give Owner, Group and Others. Exactly who/what falls into each of these classes? What are the implications of giving/not giving certain permissions to any of them? I'm concerned about making sure everything works properly without compromising security. For example, I'm developing a small site on a shared host (Linux) and I would be the only person involved in the development/maintenance of it. There's nothing for viewers to download, but members are allowed to upload images through the picmonkey.com API (which a php script finalizes with move_uploaded_file). The site's files are all .php, .css, .js, .html, .jpg and .gif (although there are .eot, .svg, .ttf and .woff files associated with one font). The directories and files all have the site's username as Owner and "inetuser" as Group. Some of the questions I have rolling around in my head are:   * When I log in with WS_FTP, am I Owner?    * Is a web browser an Other?   * Do the PHP scripts themselves fall into one of these classes?   * What permissions does each kind of file/dir need under these   circumstances?   * Is there a difference between read and execute on a .php file?   * Since I have no idea who "inetuser" is, would I be correct in not   giving Group any permissions? What if this was not the case (i.e.,   the site's username was also used for Group - which it is on my dev   site on a different host)? I would be grateful for any insight anyone could give me, as well as for any recommended articles or books that would answer these kinds of questions.


title: Can't send mail with sendmail

text: I use SENDMAIL, I noticed that none of my mail is sent. I have all my mail in the                /var/spool/mqueue      when I looked at the log and I have this error                MDeferred: Connection refused by cluster8a.eu.messagelabs.com.      What does this line mean.? i test to see if this remote host accepts incoming SMTP connections on SMTP port 25, by way of the following command: > telnet cluster8a.eu.messagelabs.com 25               telnet cluster8a.eu.messagelabs.com 25     Trying 85.158.139.103...     telnet: connect to address 85.158.139.103: Connection refused     Trying 216.82.251.230...     telnet: connect to address 216.82.251.230: Connection refused     telnet: Unable to connect to remote host: Connection refused


title: YUM package "NPM" makes trouble

text: When I try to install npm like this               sudo yum install npm      I get this error:               Fehler:  Multilib version problems found. This often means that the root             cause is something else and multilib version checking is just             pointing out that there is a problem. Eg.:                1. You have an upgrade for v8 which is missing some              dependency that another package requires. Yum is trying to              solve this by installing an older version of v8 of the              different architecture. If you exclude the bad architecture              yum will tell you what the root cause is (which package              requires what). You can try redoing the upgrade with              --exclude v8.otherarch ... this should give you an error              message showing the root cause of the problem.                2. You have multiple architectures of v8 installed, but              yum can only see an upgrade for one of those architectures.              If you don't want/need both architectures anymore then you              can remove the one with the missing update and everything              will work.                3. You have duplicate versions of v8 installed already.              You can use "yum check" to get yum show these errors.              ...you can also use --setopt=protected_multilib=false to remove         this checking, however this is almost never the correct thing to         do as something else is very likely to go wrong (often causing         much more problems).              Geschützte Multilib-Versionen: 1:v8-3.17.6.14-2.fc19.x86_64 != 1:v8-3.14.5.10-2.fc19.i686      I'm running Fedora 19 x86_64. There is this log, if it helps: https://pastee.org/wetpc


title: inexact text search

text: Is there any utility like `grep` or even `uniq` but for inexact search or I should write it myself? I mean it will look at 90% (number may vary) matching, or smth like that. For example I have file with several strings:               abc123     abd123     abc223     qwe938      In this case such utility should return the first three string or say they are similar. Of course I don't know any pattern of file's content like in case with `grep` or `uniq`.


title: Does POSIX guarantee that the standard utilities are in PATH?

text: In the "Command Search and Execution" section, the POSIX specification says that `PATH` is searched when finding a utility to execute (with some exceptions). Does the specification mention anywhere that `PATH` will be initialized to a value that guarantees that all standard utilities will be found? Or do I need to do something like the following to guarantee that I'll never get a "command not found" error when trying to run a standard utility?               PATH=$(command -p sh -c 'printf %s "${PATH}"')      (see the POSIX specification of the `command` utility)


title: Why does mkdir not have the -p flag set by default to allow for nested directory creation?

text: I see no reason why the `-p` flag on `mkdir` should not be set by default.                 -p, --parents     no error if existing, make parent directories as needed      It is a non-destructive command from what I can see. Have I missed something important about the way this works? Secondly is there an easy way to get this to be the default behaviour of `mkdir`?


title: LXC: Have rootfs mounted without nosuid

text: I have the container's rootfs in a volume mounted with the `nosuid` option. When I start the container, its / mounted is then also mounted `nosuid`, which breaks programs such as `sudo`. How can I avoid this? I'm not able to remount the the root partition within the container.


title: How to send non-local mail, with GMail(GApps) SMTP?

text: I have some (~3) Debian boxes, and I want to post system mail to my non-local mailbox. But I have a problem with configuring `exim4`. Also I don't like so much exim4's config. Too different, and also with my last try I had to store the password unencrypted. I have 2 questions:   1. How do I configure outgoing mail with GMail/GApps SMTP? (password stored encypted)   2. How to return **all** of **MY** and **ROOT** 's mails to my other address, sent trough the _new SMTP_? Any question, or info needed, just comment. I would really appreciate any tutorial! Thanks!


title: Does Control+C delete the files that you were downloading and installing?

text: If you are installing a package in the terminal and you use Control+C to stop it, does it also undo all the changes and remove the files that it downloaded?


title: How to disable screen saver and power management in linux by command line?

text: Is there a command line you can run that can enable in-habitation, disabling computer going to screen saver, sleep?


title: su authentication failure after setting new password

text: I compiled a new kernel(3.2) and I have it running on an ARM board. I wanted to enable some params on the `/proc` directories. Therefore I have to be logged in as root. Hence I did the following on my newly compiled system:               sudo passwd su      and set a new root password. Then I logged in as root. However I get the error message `su-Authentication failure`. How do I solve this problem? Has this to do with the `/usr/bin` file permissions? What setting should I change to be able to login as root?


title: Is it safe to give out my SSH public key for work?

text: I currently work remotely for a number of organizations which need me to access their servers regularly for maintenance and upgrades. Is it safe for me to add my RSA public SSH key to the `.ssh/authorized_keys` file to allow me to login much faster/without having to lookup passwords? I operate under the presumption that it'd be impossible to generate the private key from the public one, but am I right in my assumption? Taking it one step further, would there be any security risk whatsoever in posting the contents of my RSA public key to the internet? I know that if my private key is obtained, I'm in a lot of trouble, but other than that, are there any real possible security threats?


title: compiz scale plugin arrow movement breaks sometimes

text: The arrow keys cycles between the windows. But sometimes it won't let me switch to window down, just left or right and other times it won't let me go up. I'm not sure if this is a feature or a bug, more likely the latter.


title: How to extend my desktop to a second connected screen

text: I'm sure the answer to this question was already presented here in some where, but a quick search (here + Google) didn't find it. I connect a screen to my laptop, and it's blank. How do I extend my desktop to this screen?


title: Arch: can't use pacman: error while loading shared libraries

text: I just finished installing Arch and setting up my wireless connection. I wanted to install additional packages so I tried using pacman. But with every command I use I get the following error: > pacman: error while loading shared libraries: libcurl.so.4: cannot open > shared object file: No such file or library. But in /usr/local/lib I have the following files/folders: > libcurl.a libcurl.a libcurl.so libcurl.so.4 libcurl.so.4.2.o pkgconfig So how do I point pacman to these files?


title: Arch linux xfce4 with catalyst

text: I've recently installed xfce4 (switched from gnome3) as well as the Catalyst driver. I have quite a powerful computer along with quite a powerful graphics card (radeon 6950) however a lot of the features I want don't work. For example: terminal transparency does not work, and the mouse fragments sometimes when I move between monitors. I've been experimenting with the ATI control center settings, but nothing seems to fix this. I'd like to know if there are some optimisations I could look into (I already looked at the Catalyst page on the arch linux wiki) that would make my experience better. The reason I switched to catalyst from the opensource driver is so that I can run opencl apps, so the opensource driver is not an option. thank you!


title: Configure vmware-tools without an initrd image?

text: Is it possible to run `vmware-tools` without an initrd? I don't know why I should use an initrd and it makes my kernel compilation more complicated. I can boot into my kernel without initrd but when I want to install `vmware- tools` it gives me an error message:               There was an error generating the initrd (1). Error /sbin/mkinitd -k vmlinuz...       Can I reboot? Edit: It doesn't work without initrd. I've temporarily enabled it and it adds Kernel Modules: vmxnet3 vmxnet to the initrd?


title: How do I escape a dot character for an rsync command?

text: I'm trying to do...               ssh -av -e deploy@domain.com:/var/www/domain.com /Users/user/workspace/domain      But it's outputting this (I presume because of the period character):               OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011     Bad escape character 'deploy@domain.com:/var/www/domain.com'.      I have tried               ssh -av -e deploy@domain.com:/var/www/domain\.com /Users/user/workspace/domain      And various combinations with quotes. What is the right syntax?


title: how to scp in mc (and remember)?

text: I found that I can do scp in mc via `cd /#sh:radek@firebird` from the command line. Is there any way I can   * save this as a favorite?    * Maybe even with the password?


title: clone root directory tree using busybox

text: I have an TI DaVinci-based (ARM architecture kin to OMAP) system which netboots using TFTP and NFS-mounted root filesystem, and am trying to make it boot standalone without a netboot server. The basic approach is to copy the kernel image to the NAND flash and the root filesystem to a connected SATA disk (NAND flash is nowhere near big enough for the whole system), then configure u-boot to load the kernel from NAND flash and pass an appropriate `root=` argument. I'm stuck on the step of copying the filesystem. This question is relevant, but none of the recommendations work because I have only busybox versions of the `cp` and `cpio` tools, and the `--one-file-system` option is unsupported by busybox. How can I clone the root filesystem when I only have the tool capabilities provided by busybox? Would it help to run archive creation commands on the NFS server (x64 architecture running Ubuntu) and then unpack on the target?


title: How to mention rpm to look for dependent perl modules in the system

text: By default rpm looks for the perl modules inside the rpm itself and throws dependency error if it is not found. For eg., I have a perl script in the rpm that uses `Crypt::DES` perl module. I have that perl module in the system (`/usr/local/lib64/perl5/Crypt/DES.pm` ) and this directory is included in `@INC` When I try to install the rpm package: `[jai@orange x86_64]$ rpm -ivh abc-1-1.el6.x86_64.rpm` `error: Failed dependencies:` `...(some other perl modules)` `perl(Crypt::DES) is needed by abc-1.el6.x86_64` `...(some other modules)` But when I put that perl module (DES.pm ) inside the source of the rpm, it doesn't show the dependency error for that perl module. And my question is how to specify in rpm (may be in spec file) to look for perl dependencies in the system also?


title: Kernel failure with software RAID-1 due to single drive read errors

text: I am running Fedora 19 (kernel 3.11.3-201.fc19.x86_64) with a software RAID-1 (mdadm) setup on two identical Seagate 1GB drives:               # cat /proc/mdstat      Personalities : [raid1]      md1 : active raid1 sdb3[1] sda3[0]           973827010 blocks super 1.2 [2/2] [UU]          unused devices: <none>      Recently, some errors are presenting on one of the two drives: smartd has detected "1 Currently unreadable (pending) sectors" and "1 Offline uncorrectable sectors". The RAID array "rescheduled" some sectors. Then about a day later, the kernel produced various I/O messages/exceptions:               Oct 18 06:39:20 x smartd[461]: Device: /dev/sdb [SAT], 1 Currently unreadable (pending) sectors     Oct 18 06:39:20 x smartd[461]: Device: /dev/sdb [SAT], 1 Offline uncorrectable sectors     ...     Oct 18 07:09:20 x smartd[461]: Device: /dev/sdb [SAT], 1 Currently unreadable (pending) sectors     Oct 18 07:09:20 x smartd[461]: Device: /dev/sdb [SAT], 1 Offline uncorrectable sectors     ...     Oct 18 07:30:28 x kernel: [467502.192792] md/raid1:md1: sdb3: rescheduling sector 1849689328     Oct 18 07:30:28 x kernel: [467502.192822] md/raid1:md1: sdb3: rescheduling sector 1849689336     Oct 18 07:30:28 x kernel: [467502.192846] md/raid1:md1: sdb3: rescheduling sector 1849689344     Oct 18 07:30:28 x kernel: [467502.192870] md/raid1:md1: sdb3: rescheduling sector 1849689352     Oct 18 07:30:28 x kernel: [467502.192895] md/raid1:md1: sdb3: rescheduling sector 1849689360     Oct 18 07:30:28 x kernel: [467502.192919] md/raid1:md1: sdb3: rescheduling sector 1849689368     Oct 18 07:30:28 x kernel: [467502.192943] md/raid1:md1: sdb3: rescheduling sector 1849689376     Oct 18 07:30:28 x kernel: [467502.192966] md/raid1:md1: sdb3: rescheduling sector 1849689384     Oct 18 07:30:28 x kernel: [467502.192991] md/raid1:md1: sdb3: rescheduling sector 1849689392     Oct 18 07:30:28 x kernel: [467502.193035] md/raid1:md1: sdb3: rescheduling sector 1849689400     ...     Oct 19 06:26:08 x kernel: [550035.944191] ata3.01: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0     Oct 19 06:26:08 x kernel: [550035.944224] ata3.01: BMDMA stat 0x64     Oct 19 06:26:08 x kernel: [550035.944248] ata3.01: failed command: READ DMA EXT     Oct 19 06:26:08 x kernel: [550035.944274] ata3.01: cmd 25/00:08:15:fb:9c/00:00:6c:00:00/f0 tag 0 dma 4096 in     Oct 19 06:26:08 x kernel: [550035.944274]          res 51/40:00:1c:fb:9c/40:00:6c:00:00/10 Emask 0x9 (media error)     Oct 19 06:26:08 x kernel: [550035.944322] ata3.01: status: { DRDY ERR }     Oct 19 06:26:08 x kernel: [550035.944340] ata3.01: error: { UNC }     Oct 19 06:26:08 x kernel: [550036.573438] ata3.00: configured for UDMA/133     Oct 19 06:26:08 x kernel: [550036.621444] ata3.01: configured for UDMA/133     Oct 19 06:26:08 x kernel: [550036.621507] sd 2:0:1:0: [sdb] Unhandled sense code     Oct 19 06:26:08 x kernel: [550036.621516] sd 2:0:1:0: [sdb]       Oct 19 06:26:08 x kernel: [550036.621523] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE     Oct 19 06:26:08 x kernel: [550036.621530] sd 2:0:1:0: [sdb]       Oct 19 06:26:08 x kernel: [550036.621537] Sense Key : Medium Error [current] [descriptor]     Oct 19 06:26:08 x kernel: [550036.621555] Descriptor sense data with sense descriptors (in hex):     Oct 19 06:26:08 x kernel: [550036.621562]         72 03 11 04 00 00 00 0c 00 0a 80 00 00 00 00 00      Oct 19 06:26:08 x kernel: [550036.621606]         6c 9c fb 1c      Oct 19 06:26:08 x kernel: [550036.621626] sd 2:0:1:0: [sdb]       Oct 19 06:26:08 x kernel: [550036.621638] Add. Sense: Unrecovered read error - auto reallocate failed     Oct 19 06:26:08 x kernel: [550036.621646] sd 2:0:1:0: [sdb] CDB:      Oct 19 06:26:08 x kernel: [550036.621653] Read(10): 28 00 6c 9c fb 15 00 00 08 00     Oct 19 06:26:08 x kernel: [550036.621692] end_request: I/O error, dev sdb, sector 1822227228     Oct 19 06:26:08 x kernel: [550036.621719] raid1_end_read_request: 9 callbacks suppressed     Oct 19 06:26:08 x kernel: [550036.621727] md/raid1:md1: sdb3: rescheduling sector 1816361448     Oct 19 06:26:08 x kernel: [550036.621782] ata3: EH complete     Oct 19 06:26:08 x kernel: [550041.155637] ata3.01: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0     Oct 19 06:26:08 x kernel: [550041.155669] ata3.01: BMDMA stat 0x64     Oct 19 06:26:08 x kernel: [550041.155694] ata3.01: failed command: READ DMA EXT     Oct 19 06:26:08 x kernel: [550041.155719] ata3.01: cmd 25/00:08:15:fb:9c/00:00:6c:00:00/f0 tag 0 dma 4096 in     Oct 19 06:26:08 x kernel: [550041.155719]          res 51/40:00:1c:fb:9c/40:00:6c:00:00/10 Emask 0x9 (media error)     Oct 19 06:26:08 x kernel: [550041.155767] ata3.01: status: { DRDY ERR }     Oct 19 06:26:08 x kernel: [550041.155785] ata3.01: error: { UNC }     Oct 19 06:26:08 x kernel: [550041.343437] ata3.00: configured for UDMA/133     Oct 19 06:26:08 x kernel: [550041.391438] ata3.01: configured for UDMA/133     Oct 19 06:26:08 x kernel: [550041.391501] sd 2:0:1:0: [sdb] Unhandled sense code     Oct 19 06:26:08 x kernel: [550041.391510] sd 2:0:1:0: [sdb]       Oct 19 06:26:08 x kernel: [550041.391517] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE     Oct 19 06:26:08 x kernel: [550041.391525] sd 2:0:1:0: [sdb]       Oct 19 06:26:08 x kernel: [550041.391532] Sense Key : Medium Error [current] [descriptor]     Oct 19 06:26:08 x kernel: [550041.391546] Descriptor sense data with sense descriptors (in hex):     Oct 19 06:26:08 x kernel: [550041.391553]         72 03 11 04 00 00 00 0c 00 0a 80 00 00 00 00 00      Oct 19 06:26:08 x kernel: [550041.391596]         6c 9c fb 1c      Oct 19 06:26:08 x kernel: [550041.391616] sd 2:0:1:0: [sdb]       Oct 19 06:26:08 x kernel: [550041.391624] Add. Sense: Unrecovered read error - auto reallocate failed     Oct 19 06:26:08 x kernel: [550041.391636] sd 2:0:1:0: [sdb] CDB:      Oct 19 06:26:08 x kernel: [550041.391643] Read(10): 28 00 6c 9c fb 15 00 00 08 00     Oct 19 06:26:08 x kernel: [550041.391681] end_request: I/O error, dev sdb, sector 1822227228     Oct 19 06:26:08 x kernel: [550041.391737] ata3: EH complete     Oct 19 06:26:08 x kernel: [550041.409686] md/raid1:md1: read error corrected (8 sectors at 1816363496 on sdb3)     Oct 19 06:26:08 x kernel: [550041.409705] handle_read_error: 9 callbacks suppressed     Oct 19 06:26:08 x kernel: [550041.409709] md/raid1:md1: redirecting sector 1816361448 to other mirror: sda3      The computer continued to log some entries into syslog until about an hour later, and then finally became completely unresponsive. No "kernel oops" was recorded in syslog. The computer had to be rebooted, at which point the raid array was in a resync status. After the resync, all appears well and the drives seem to be working normally. I also noted that all the rescheduled sectors are exactly 8 sectors apart, which seems very strange to me. Lastly, after reboot and approximately a day or two later but significantly after the raid resync was complete, the drive reset the unreadable (pending) and offline uncorrectable sector count, which I believe is normal as the drive takes those sectors offline and remaps them:               Oct 20 01:05:42 x kernel: [    2.186400] md: bind<sda3>     Oct 20 01:05:42 x kernel: [    2.204826] md: bind<sdb3>     Oct 20 01:05:42 x kernel: [    2.209618] md: raid1 personality registered for level 1     Oct 20 01:05:42 x kernel: [    2.210079] md/raid1:md1: not clean -- starting background reconstruction     Oct 20 01:05:42 x kernel: [    2.210087] md/raid1:md1: active with 2 out of 2 mirrors     Oct 20 01:05:42 x kernel: [    2.210122] md1: detected capacity change from 0 to 997198858240     Oct 20 01:05:42 x kernel: [    2.210903] md: resync of RAID array md1     Oct 20 01:05:42 x kernel: [    2.210911] md: minimum _guaranteed_  speed: 1000 KB/sec/disk.     Oct 20 01:05:42 x kernel: [    2.210915] md: using maximum available idle IO bandwidth (but not more than 200000 KB/sec) for resync.     Oct 20 01:05:42 x kernel: [    2.210920] md: using 128k window, over a total of 973827010k.     Oct 20 01:05:42 x kernel: [    2.241676]  md1: unknown partition table     ...     Oct 20 06:33:10 x kernel: [19672.235467] md: md1: resync done.     ...     Oct 21 05:35:50 x smartd[455]: Device: /dev/sdb [SAT], No more Currently unreadable (pending) sectors, warning condition reset after 1 email     Oct 21 05:35:50 x smartd[455]: Device: /dev/sdb [SAT], No more Offline uncorrectable sectors, warning condition reset after 1 email      `smartctl -a /dev/sdb` now shows               ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE     ...       5 Reallocated_Sector_Ct   0x0033   096   096   036    Pre-fail  Always       -       195     ...     197 Current_Pending_Sector  0x0012   100   100   000    Old_age   Always       -       0     198 Offline_Uncorrectable   0x0010   100   100   000    Old_age   Offline      -       0     ...      Some questions arise: 1) Why would all the rescheduled sectors be exactly 8 apart? 2) Why would the kernel become unresponsive and require a reboot? Shouldn't this be _exactly_ the situation RAID-1 is meant to handle without the system blowing up? 3) Why would the unreadable and offline uncorrectable counts reset only 23 hours after the raid resync was complete?


title: tkdiff error on Linux Redhat 5.5

text: I installed `tkdiff` as root, and it runs fine under that user, but when I switch to a local user I get the error: > Application initialization failed: Can't find a usable init.tcl in the > following directories:   >  /usr/local/lib/tcl8.0 > /pune/tools/synopsys/vera/2009.12-6/vera_vD-2009.12-6_linux/lib/tcl8.0 > /pune/tools/synopsys/vera/2009.12-6/tcl8.0/library > /pune/tools/synopsys/vera/2009.12-6/vera_vD-2009.12-6_linux/library This probably means that Tcl wasn't installed properly. > Error in startup script: can't find package Tk 8.0   >  while executing   >  "package require Tk 8.0"   >  (file "./tkdiff" line 32) How do I fix this?


title: Restarting network service for a local VM via SSH

text: During the course of practicing switching my local VM from static IP to DHCP and vice versa via `system-config-network`, I decided I didn't like having to access the VM's console through virt-manager and instead decided to just SSH into it (admittedly out of laziness from not wanting to click back and forth in the gui). I can connect via SSH just fine and use system-config-network to update the settings, but when I try to run `service network restart` it just hangs forever with: `[root@host1 ~]# service network restart   Shutting down interface eth0:` While waiting for it to spit some kind of error, I access the VM's console via virt-manager and can see that the command ran successfully, the new IP information is updated, and all seems well from that angle; however, it was my understanding that my SSH connection should survive such a network restart, as per this question: How does SSH connection survive a network restart? My question is: If this weren't a local VM and I was trying to manage an actual remote host, what would be the best way to handle such a network restart? Is my approach to managing the VM's network 'remotely' misguided? The VM is set up using KVM and runs Centos 6.3; kernel 2.6.32-279.el6.x86_64; bridged networking. The physical host uses Centos 6.4; kernel 2.6.32-358.18.1.el6.x86_64 **Update** : upon checking /var/log/messages on the physical host, I came upon the following entry:   `not giving name host1 to the DHCP lease of 192.168.122.221 because the name exists in /etc/hosts with address 192.168.122.220` My derp moment: Made me realize that SSH couldn't pick back up because i'm using `ssh user@IPADDRESS` because I don't have hostname resolution set up yet. The IP address was changing and therefore couldn't be found. When I tried restarting the network without changing the IP, it picked back up just fine.


title: Set a different input method for each app window

text: Is there a way in KDE to set a different input method for each app window? For example, for coding I use one input method (english), but at the same time I chat in Skype window using my native language, and it's annoying each time to switch languages. P.S. I'm using KDE 4.10.5 (openSUSE 12.3) P.P.S. In Windows this is called "Let me set a different input method for each app window". Thank you for help!


title: How to make the command multi-line?

text: The following command:               thunderbird -compose to=abc@example.com,subject=testmail,body="something"      works, but only if it has no comma in the body tag. It works with:               "dsafdsafcc \/sda/fads ;.f af af a"      But it won't work if instead of a `;` a put a `,` . Alternatives, like `\,` also don't work. The `,` seems to break any string that I pass to `body`. How can I pass a complete text to `body`, with `,,` and new lines?


title: Installer tries to run sudo for root access

text: I downloaded Mac4lin from http://sourceforge.net/projects/mac4lin/ I proceeded by following steps 1.Extracted ZIP file. 2\. `./Mac4Lin_Install_v1.0.sh` it producing following output               [Admin@localhost Mac4Lin_Install_v1.0]$ ./Mac4Lin_Install_v1.0.sh      **************************************          Welcome to Mac4Lin Installer                This installer will install most of        Mac4Lin components and enable the UI               Note: Xfce users will need to                manually enable the UI               **************************************               *** Run this script as a normal user (not root!) ***     Press any key to start Installation or Ctrl+C to quit this install          Installing Mac4Lin UI...     Done!          Installing Mac4Lin Icons...     Done!          Installing Mac4Lin Cursors...     Done! Please enable the cursor theme from Appearances.     Alternatively, you can select the Mac4Lin Aqua/Graphite Meta package to enable everything with one click          Installing Mac4Lin Emerald Window Borders...     ./Mac4Lin_Install_v1.0.sh: line 58: [: missing `]'     Done!          Do you want to enable Metacity Compositor? If you are unsure about this or use Compiz, type 'n' [y/n]?      y     Enabling Metacity compositor...     Done!          Installing Mac4Lin misc. componenets...          Done! Nautilus location bar is now disabled by default     ~/Mac4Lin_v1.0 directory contains the components which are to be installed manually. Please install the Mozilla UI manually     If you use a 64bit install, you will need to manually install the AWN Pidgin 64bit plugin from ~/Mac4Lin_v1.0/AWN     Installing Mac4Lin Backgrounds...     Done!               The following componenets require root access. You can opt out of installing them as they can be manually installed as well.     Would you like to install these components. If unsure, type 'n' [y/n]?      y     Installing Mac4Lin GDM Login Theme and Sounds...     [sudo] password for Admin:      Admin is not in the sudoers file.  This incident will be reported.     [sudo] password for Admin:      Why it showing this error. How to resolve this error please let me know


title: Why is iterating over a file twice faster than reading it into memory and computing twice?

text: I'm comparing the following               tail -n 1000000 stdout.log | grep -c '"success": true'     tail -n 1000000 stdout.log | grep -c '"success": false'      with the following               log=$(tail -n 1000000 stdout.log)     echo "$log" | grep -c '"success": true'     echo "$log" | grep -c '"success": false'      and surprisingly the second takes almost 3 times longer than the first. It should be faster, shouldn't it?


title: Where is the .xprofile for Elementary OS Luna

text: I have this problem similar to this thread. http://askubuntu.com/questions/63863/unknown-monitor-intel-driver-want-to-set- vga-resolution-to-widescreen-tv/154818#154818 it fixed my resolution issue but it doesn't save when I logout. It says that I need to paste the cmd to .xprofile in the home folder. But in Elementary OS, I only say .profile ... when I vim it here is the contents:                ~/.profile: executed by the command interpreter for login shells.     # This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login     # exists.     # see /usr/share/doc/bash/examples/startup-files for examples.     # the files are located in the bash-doc package.          # the default umask is set in /etc/profile; for setting the umask     # for ssh logins, install and configure the libpam-umask package.     #umask 022          # if running bash     if [ -n "$BASH_VERSION" ]; then         # include .bashrc if it exists         if [ -f "$HOME/.bashrc" ]; then             . "$HOME/.bashrc"         fi     fi          # set PATH so it includes user's private bin if it exists     if [ -d "$HOME/bin" ] ; then         PATH="$HOME/bin:$PATH"     fi


title: bash script to check zabbix java gateway

text: I wrote simple script to check status of a service and when service is down search live processes for the service and kill them, then remove pid file and restart service. The problem is that the script is not always able to remove the pid file which results in that the script is not able to restart the service. This is the script:               #!/bin/bash     SHELL=/bin/bash     PATH=/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin     echo $(date +%d/%m/%Y-%H:%M)     service zabbix-java-gateway restart     sleep 1     service zabbix-java-gateway status > /tmp/status_zabbix_java_gateway     if grep  "is running..." /tmp/status_zabbix_java_gateway     then         echo "zabbix-java-gateway is runnign on $HOSTNAME"         echo " "     rm -rf /tmp/status_zabbix_java_gateway     else     echo "zabbix-java-gateway is stopped on $HOSTNAME"     echo " "     output=`ps aux|grep zabbix_java`     set -- $output     pid=$2     kill $pid     sleep 2     kill -9 $pid >/dev/null 2>&1     sleep 2     rm -rf /var/run/zabbix/zabbix_java.pid     echo "zabbix-java-gateway is stopped on $HOSTNAME!!!" > /tmp/mail_zabbix_java_gateway     mail -s "Zabbix Java Gateway is down on !!!" somemail@hotmail.com < /tmp/mail_zabbix_java_gateway     /etc/init.d/zabbix-java-gateway restart     rm -rf /tmp/mail_zabbix_java_gateway     rm -rf /tmp/status_zabbix_java_gateway     fi      Please give me some advice.


title: Efficient way to create multiple files

text: I have been testing find directory which is taking max inodes and while testing I had run               touch test_{1..1391803}.txt      But it's give me error `"-bash: /usr/bin/touch: Argument list too long"`, now I'm running below command, but it's seems it will take Hugh time               ruby -e '1.upto(1391803) { |n| %x( touch "test_#{n}.txt" ) }'      So the question is : is there any way to create multiple files in small amount of time ? should I touch 1 lac files per loop or any better way ? **Test Result :** **No. 1**               [root@dc1 inode_test]# time seq 343409 | xargs touch          real    0m7.760s     user    0m0.525s     sys     0m4.385s      **No. 2**               [root@test-server inode_test]# time echo 'for (i=1;i<=343409;i++) i' | bc | xargs touch          real    0m8.781s     user    0m0.722s     sys     0m4.997s      **No. 3**               [root@test-server inode_test]# time printf '%s ' {1..343409} | xargs touch          real    0m8.913s     user    0m1.144s     sys     0m4.541s      **No. 4**               [root@test-server inode_test]# time awk 'BEGIN {for (i=1; i<=343409; i++) {printf "" >> i; close(i)}}'          real    0m12.185s     user    0m2.005s     sys     0m6.057s      **No. 5**               [root@test-server inode_test]# time ruby -e '1.upto(343409) { |n| File.open("#{n}", "w") {} }'          real    0m12.650s     user    0m3.017s     sys     0m4.878s


title: What does yes $(yes yes) do?

text: Wondering what use the `yes` command might be, I stumbled upon this comment, and tried to execute               yes $(yes yes)      From what I understand, this should simply print out an infinite sequence of `yes`, but instead it outputs nothing and crashes my graphical terminal after a few seconds. (If I execute it on tty1, I see the login prompt after some time.) What is happening here?


title: Getting Sublime + xDebug to work on Debian

text: I have been trying to get sublime and xdebug to work on debian, but have had no luck. I can't seem to find any debian specific guides. I have tried using the ubuntu based guides, but they don't work on debian as the xdebugging step through does nothing. Does anyone know where I can find a debian based guide on how to get this configured. If not, can someone help me here? The ubuntu based guides all seem to go smoothly, but when I try to debug, it doesn't, and doesn't return any reason for not working.


title: stream a certificate to stdout to download it in php

text: **Related Questions :**   * when downloading certficate binary data , result is invalid certificate   * Download binary stream data from browser using PHP with web service “ downloaded file is corrupted ”   * suitable output of hexdump in bash to be input of hex2bin function in php How to convert a (complete) p12/pfx certificate to receive it in web service and redirects it to PJP page which I download it in there to browser. I used `xxd` , `hexdump` and `od`. Yet couldn't optimize the output of these commands to make it's appropriate input for hex2bin function in PHP to get the binary back to download the certificate.


title: Uninstall nspr in linux

text: I installed `nspr` by first downloading its `tar.gz` file, unzipped the file and finally by writing `sudo ./configure` I want to un-install it now. How can I do it ?


title: how to emulate "replace a b b a" with a sed?

text: I am trying to emulate a replace command which swaps two characters, with a sed script, but the obvious choice:               sed -e 's/a/b/g' -e 's/b/a/g'       does no work. Can you point me how to do it correctly?


title: How to get my USB key to auto mount

text: I'm currently working in a command line only environment. When I plug my USB key in, I see a new device file in `/dev`:               ...     sdi     sdi1     ...      If I simply `sudo mount /dev/sdi1 /media/tmp`, and `umount` it when I'm done, I have to repeat the process all over again. This alone could be accomplished with a little script but my key doesn't always show up as `sdi`. Is there a way for me to have it always auto-mount and maybe reserve `sdi` for it? _Note:_ Also, there seems to be orphaned device files in /dev if I forget to unmount and just pull the stick out.


What is the maximum value of the PID of a process? Also, is it possible to change the PID of a running process?


title: Set up Grub2 to boot Freebsd using either Ubuntu tools or LiveUSB to find what partitions?

text: I currently have Windows7 and Ubuntu 11.04 (Natty) installed on my computer. I also made a FreeBSD liveUSB (or installer, not sure; just `dd`ed their .img to the USB stick) and installed it without installing a bootloader (because I didn't want to mess up Grub2, and I thought Grub2 should be able to boot most anything). FreeBSD has it's own partition and inside that it has Freebsd partitions (maybe they are called slices?) as automatically allocated by the installer. I already tried running `update-grub` \-- it said it was an Unknown Linux and didn't add an entry for it. So, two questions:   1. How can I find what partition to tell Grub using either Ubuntu tools or the USB installer stick I have?   2. Once I find the partition, what would I put in `/etc/grub.d/40_custom`?


title: add new syslog facility

text: I would like to use syslog to log messages coming from my PHP based site. My question is - can I add custom facility name? I know there are predefined facilities like:               auth, authpriv, cron, dæmon, kern, lpr, mail, mark, news, syslog, user, UUCP and local0 through local7.      And as I understand I could use local0 - local6 facilities for this. But I just feel that if I could add something like this to syslog:               mySiteName.* /var/log/mySiteName.log      It would be visually easier to understand for others. Unfortunately above line results in:               rsyslogd-3000: unknown facility name "mySiteName"      So - is there a way to use custom facility name?


title: Sort behaves strangely on case sensitive sorting

text: Sort is sorting differently than I would expect. I have this file, call it `text.txt`:               a   1     A   1     a   11      (the space is always one `\t`) I want to sort them alphabetically by the first column. However, when I do `sort -k 1 text.txt` all I got is the text.txt file, not sorted. If I do it by the deprecated `+ -` notation, meaning `sort +0 -1 text.txt` it works as it should, meaning that I get this output:               a   1     a   11     A   1      This strange behaviour occurs only when I have lines that differs only by case. What am I doing wrong?


title: Unable to boot custom kernel

text: I am using ubuntu 11.04 I have a custom 2.6.36.4 kernel source (say in `linux_src`) Did `make mrproper` Copied my current configuration from `/boot` to `linux_src/.config` Did a `make menuconfig`, instructed it to load the configuration file `.config`. In general setup, I added the string `rr` to the kernel version number. Exited the configuration. Did a `make && make modules_install && make install` as superuser. This created the vmlinuz-2.6.36.4rr image in /boot; the corresponding directory in /lib/modules. System.map in /boot, but not initrd image So I ran the following command : `cd /boot && sudo mkinitramfs -k -o initrd.img-2.6.36.4rr` Finally I ran `sudo update-grub`. Grub found my new linux image and the new initrd image. On booting, the newly installed kernel was listed in my boot options. I selected it, and then the screen went blank (but not _black_ , it just showed some default ubuntu theme colored blank screen) and stuck there. I suspect the makeinitramfs process was the culprit. On the other hand when I had installed the same kernel using `make-kpkg` and `dpkg` I had to do no other thing, (not even initramfs) and the kernel had booted perfectly (I _don't_ want to use this method to install kernel). Please help. EDIT : I made some progress Instead of using : `cd /boot && sudo mkinitramfs -k -o initrd.img-2.6.36.4rr` I used `cd /boot && sudo mkinitramfs -k -o initrd.img-2.6.36.4rr 2.6.36.4rr` which i believe is the correct way to use mkinitramfs. However, now my boot process ends at "gave up waiting for the root device" and an initramfs prompt


title: How to use tail -f with grep to show surrounding lines

text: I would like to see the output in a _logfile_ greped by only one domain but also the following **two lines**. Example:               tail -f /var/log/apache2/modsec_audit.log |grep mydomain.de      this shows all lines, that contain _"mydomain.de"_ but the important information is in the line below the line, where the domain is included


title: Why does "User Contributed Perl Documentation" show up when I look for 'man' pages

text: When I               man -f <some string>      in addition to the expected Unix man pages, I get a bunch of odd looking entries that all have the header "User Contributed Perl Documentation". For example               man -f ip      in addition to things like               ip(4)            - Internet Protocol     ip2cc(1)         - lookup country from IP address or hostname     ipconfig(8)      - view and control IP configuration state     ...      also lists things like               IP::Authority(3pm)       - fast lookup of authority by IP address     IP::Country(3pm)         - fast lookup of country codes from IP addresses     IP::Country::Fast(3pm)   - fast lookup of country codes by IP address     IP::Country::MaxMind(3pm) - Look up country by IP Address     IP::Country::Medium(3pm) - cached lookup of country codes by IP address and domain name      all of which are idenfified as "User Contributed Perl Documentation". My 'man' path (from `man --path`), on OS X 10.8.2 is               /usr/local/git/share/man:/usr/share/man:/usr/local/share/man:/opt/X11/share/man:/usr/texbin/man      which is the same as it is on other machines that don't show these additional pages. Where are these coming from? Can I limit my results to only Unix shell pages by default?


title: How do the various configuration files determine MANPATH on Darwin?

text: On Darwin (12.2.0, OS X 10.8.2, bash 3.2.48(1)) my MANPATH appears to be determined by my PATH rather than by the various configuration files associated with `man` and the `man` path, `/etc/manpaths`, `/etc/man.conf` and several files in `/etc/manpaths.d`. How do these files figure into the MANPATH building process?


title: Is there a graphic tool to add new url schemes like XX://?

text: I would like to add a few url scheme, e.g `magnet://`, and add a simple mimetype for it. So that I would be able to handle these links within my browser. Is there any graphic tool I could utilize ?


title: Determining keycode assignments for X.org on a PC

text: At some point around late 2008 to early 2009, some keycode values (apparently, for the keys that weren't on an XT keyboard) on a standard PC keyboard when running X.org under Linux changed. I don't know whether this was due to a kernel change or an X change. Debian lenny and Ubuntu 8.04 used the old assignment; Debian squeeze and Ubuntu 10.04 used the new assignment. So I have two `xmodmaprc` files, one with the old keycodes and one with the new keycodes. How do I determine which one to load from my `.xinitrc` and `.xsession`? I want my startup files to be portable with no hassle, so I want to get rid of my present dependency on the machine name (!). And I don't want to introduce a dependency on Linux distribution versions (and anyway that would be information about the client, but it's information about the server that I need). I already have information about the server at this point in my script (all the symbols listed in `xrdb(1)` are available as environment variables); hopefully my question reduces to “What parameters to I compare to what values?”. Note that since I want my startup files to work on machines that I don't administer, keysym reassignments alone are no help. For example, I want to assign my favorite modifier to the `Win` keys, but I can't predict what keysym will be assigned when I log in. However, if there is an XKB concept I can use in place of keycodes (and is independent of any sysadmin customization, so keysyms won't do), I'm willing to switch to XKB.


title: Will $0 always include the path to the script?

text: I want to grep the current script so I can print out help and version information from the comments section at the top. I was thinking of something like this:               grep '^#h ' -- "$0" | sed -e 's/#h //'      But then I wondered what would happen if the script was located in a directory that was in PATH and called without explicitly specifying the directory. I searched for an explanation of the special variables and found the following descriptions of `$0`:   * name of the current shell or program   * filename of the current script   * name of the script itself   * command as it was run None of these make it clear whether or not the value of `$0` would include the directory if the script was invoked without it. The last one actually implies to me that it wouldn't. **Testing on My System (Bash 4.1)** I created an executable file in /usr/local/bin called _scriptname_ with one line `echo $0` and invoked it from different locations. These are my results:               > cd /usr/local/bin/test     > ../scriptname     ../scriptname          > cd /usr/local/bin     > ./scriptname     ./scriptname          > cd /usr/local     > bin/scriptname     bin/scriptname          > cd /tmp     > /usr/local/bin/scriptname     /usr/local/bin/scriptname          > scriptname     /usr/local/bin/scriptname      In these tests, the value of `$0` is always exactly how the script was invoked, _except_ if it is invoked without any path component. In that case, the value of `$0` is the _absolute path_. So that looks like it would be safe to pass to another command. _But_ then I came across a comment on Stack Overflow that confused me. The answer suggests using `$(dirname $0)` to get the directory of the current script. The comment (upvoted 7 times) says "that will not work if the script is in your path". **Questions**   * Is that comment correct?   * Is the behavior different on other systems?   * Are there situations where `$0` would not include the directory?


title: fmem compile error with make

text: I am a beginner in the Linux world and I'm trying to figure out how to run the make command. I'm trying to make use of `fmem` (a tool found on the internet), and it is said that "make" must be run from a terminal in the folder. However I get this:               root@bakie:/home/tux/Documents/fmem/fmem_1.6-0# make     rm -f *.o *.ko *.mod.c Module.symvers Module.markers modules.order \.*.o.cmd \.*.ko.cmd \.*.o.d     rm -rf \.tmp_versions     make -C /lib/modules/`uname -r`/build SUBDIRS=`pwd` modules     make: *** /lib/modules/3.10-3-686-pae/build: No such file or directory.  Stop.     make: *** [fmem] Error 2      Thanks for making me see clearer.


title: htop displays incorrectly on different vps

text: When I use "htop" command for linux (+F5), layout on 2 my vps different: ![First server](http://i.stack.imgur.com/1N0rg.png) ![Second server](http://i.stack.imgur.com/JfZS6.png) Why on my first server I see broken tree?


title: Show path from project root in ZSH Prompt

text: If my pwd is `~/repos/blog/app/views/`, I'd like to show only `blog/app/views` in the prompt i.e. I want to show only the project root. Project root is the parent directory of `.git` directory. Is there a way I can achieve this?


title: OpenMeetings latest release not unzipping

text: I am trying to install OpenMeetings for centos 6.5 32 bit but everytime I try to untar or unzip the latest binary release I get the following error:               tar -xzvf apache-openmeetings-3.0.0.tar.gz          gzip: stdin: not in gzip format     tar: Child returned status 1     tar: Error is not recoverable: exiting now      Then this with zip version                   unzip apache-openmeetings-3.0.0.zip      Archive:  apache-openmeetings-3.0.0.zip      End-of-central-directory signature not found.  Either this file is not      a zipfile, or it constitutes one disk of a multi-part archive.  In the      latter case the central directory and zipfile comment will be found on      the last disk(s) of this archive.