title: Including sub-parameters in help options to execute wisely without getopt or getopts?

text: I am writing a script which can choose a file and print specific content. For example,               san#./script.sh          Expected Usage : ./script.sh --file1 --dns      (Here it checks for file1, search for dns name and prints. Basically there are sub-parameters under a parameter) I tried for single parameter/Option as below :               options=$@          arguments=($options)          index=0;     for argument in $options     do         index=`expr $index + 1`;         case $argument in         -a | --fun1 ) run_function1 ;;         -b | --fun2 ) run_function2 ;;         -c | --fun3 ) run_function3 ;;         esac     done     exit;          [ ${1} ] || helpinfo      Can any one suggest for double parameter(sub options) ? Expected target options :               ./script.sh               OPTIONS : ./script.sh -h          ./script --fun1 stackoverflow             microsoft             Google          --fun2 Yahoo       Basically each function will look into one file. I have looked into getopt or getopts, But it doesn't have long option (--long is not possible, instead we can use only -l). But again not sure of sub parameters. Can any one help on this ? I don't want to use `getopt` or `getopts`.


title: Gdm3 doesn't start after upgrading system

text: I installed Debian a few days ago. The first thing I did was install the ATI graphics driver (I needed some additional software to install it) and some apps for everyday use. Today I upgraded the system and now `gdm3` doesn't start. In recovery mode the system works, but when I try to run X (`startx`), everything is like in normal mode. How can I get my system working again?


title: How to copy symbolic links while preserving the validity of the link?

text: Say under directory `/usr/local/boost_1_52_0/stage/lib`, I have a symbolic link: `libboost_timer.so`, which points to the regular file `libboost_timer.so.1.52.0` in the same directory. How can I `cp` the symbolic links to directory `/usr/local/lib` while pointing to the same file `/usr/local/boost_1_52_0/stage/lib/libboost_timer.so.1.52.0`. I have searched and tried several options. First one copies the regular file to the destination directory using the name of the link. Second one just copies the link itself, but the link is not valid in the new directory. Third one makes new link points to the original link, so it would de-reference twice to get the regular file. And I want to use the link file name, so directly making the links of the regular file would not work. How can I do this?


title: Launch a program when any wireless connection comes up using netcfg

text: I have written a program that transparently logs in to captive portals. As such, I'd like to run this any time that any wireless connection comes up using netcfg. It is possible to do this per-connection in the configuration file by using `POST_UP`, but this would require adding it to every connection that currently exists, and any connection that may be created in future, which is not feasible in my situation. I also do not wish to poll for network connections as a daemon. I don't see any information about doing this in `man netcfg-profiles`. How should I approach this? Does netcfg have any built-in configuration that allows a `POST_UP` to apply to multiple connections? It is acceptable for it to also apply to all connections (including wired), but if possible I'd like to avoid it.


title: All dependencies for third-party-compiled binary

text: I've got a binary, compiled by a third party and I need to know all the dependencies it requires. I'm not sure if `ldd` shows everything. I'm sure the binary uses GStreamer, and some codec packages, but `ldd` shows only GStreamer, without codec packs... Any ideas how to do it correctly?


title: Updated Fedora 18 - no sound devices, just dummy output

text: So, yesterday I updated the recently released Fedora 18, this has been done:               Packages Altered:     Updated grubby-8.20-1.fc18.x86_64                        @?fedora     Update         8.22-1.fc18.x86_64                        @updates     Updated java-1.7.0-openjdk-1:1.7.0.9-2.3.3.2.fc18.x86_64 ?     Update                     1:1.7.0.9-2.3.4.fc18.x86_64   @updates     Updated nss-3.14.1-3.fc17.x86_64                         @updates/17     Update      3.14.1-3.fc18.x86_64                         @updates     Updated nss-sysinit-3.14.1-3.fc17.x86_64                 @updates/17     Update              3.14.1-3.fc18.x86_64                 @updates     Updated nss-tools-3.14.1-3.fc17.x86_64                   @updates/17     Update            3.14.1-3.fc18.x86_64                   @updates     Updated xorg-x11-drv-intel-2.20.16-1.fc18.x86_64         ?     Update                     2.20.17-1.fc18.x86_64         @updates      After rebooting today - the sound's gone and Dummy Output is the only device left. So my wild guess would go towards the xorg-x11-drivers .. I tried adding myself to the 'audio' group - but to no avail. It's the usual Intel chipset. I have no clue where I should begin debugging this, any hints ? Edit: The older kernel `3.6.11-1.fc17.x86_64` works just fine. It's `3.7.2-201.fc18.x86_64` which is causing the problem. Edit 2: Today, after booting 3.7.2 up, problem seems to be gone. No clue why.


title: Remote linux using vnc and gdm without login

text: I remote linux server by using `vnc` and `gdm`. This link is very good but I would like to remote linux server using `vnc` viewer without login. May I know your suggestion?


title: Why does my firewall (iptables) interfere in my bridge (brctl)?

text: I set up a bridge `br0` "attached" to two interfaces:   * `eth0`, my physical interface connected to the real LAN,    * `vnet0`, a KVM virtual interface (connected to a Windows VM).  And I have this single firewall rule in the forward chain:               iptables -A FORWARD -j REJECT      _Now, the only ping that is working is from the VM to the host._ The `br0` interface owns the IP address of my host machine. `eth0` and `vnet0` do not "own" any IP, from the host point of view. The Windows VM has a static IP configuration. If change my `iptables` rule to `ACCEPT` (or even use a more restrictive `iptables -A FORWARD -o br0 -j ACCEPT`), everything is working fine! (i.e. I can ping any LAN machine from the VM, and the other way round too). All IP forwarding kernel options are disabled (like `net.ipv4.ip_forward = 0`). **So, how can the netfilter firewall block something that is not even enabled?** Furthermore, the VM - LAN traffic should only imply `eth0` and `vnet0`. Yet it looks like allowing FORWARD traffic with `-o br0` "works" (I did not check very carefully though).


title: Changing order of font style

text: Is it possible to change the order of font style? ![enter image description here](http://i.stack.imgur.com/niAle.png) In qtconfig-qt4, the default style was no longer Regular. Is it possible to re-order it? Maybe with something in /etc/fonts/conf.d? Anyone know it?


title: Become root after login via plink from Windows host

text: I m trying to connect to a linux server from Windows host via plink. I couldnt figure out how to become root after logon. I have to login with ordinary user first as I can't change config of the `sshd`, then trying to become root. It seems that sending `su -` and `'password'` simply dont work as plink still claims I'm not root when I try to execute a script which must be executed by root. Is there a way for it?


title: How to protect thunderbird from accidentially sending an email

text: I need a way to make thunderbird prevent me from sending mails by mistake. For special, important mails, I would like to be able to individually block the send button, or make thunderbird ask me for confirmation before sending. This locking should not be standard behavior, nor should it be activated automatically based on some rules, I just want to use it for special emails. What I do so far is to leave the subject or the receipients empty till the mail is finished, such that thunderbird would ask me for these info when accidentially sending. However this is very impractical when replying to messages.


title: Xrandr does not recognize newmode option

text: I was trying to modify the screen resolution using xrandr. I used the following command.               xrandr -s 1680x1050      It returned an error.               size 1680x1050 not found in available modes      I figured I have to define and add the mode.               cvt 1680 1050      worked. After that I tried to add new mode               xrandr --newmode <model-line>      Here the newmode option is not recognized. The command does not go through.               usage: xrandr [options]      where options are      -display     -help. etc.      And the --newmode option is not even listed there.


title: Bash completion throwing syntax error

text: ### THE PROBLEM: Say I'm trying to change to a directory called 'build' which is in the directory I'm currently in. I start:               cd b      Then I hit tab once (knowing that no other directories in the current one begins with the letter `b`). I expect to see the following, ready for me to hit return or change or augment as needed.               cd build      However, on my netbook which runs Linux Peppermint 3, I find that this appears when I press the tab button:               cd bbash: command substitution: line 74: syntax error near unexpected token `done'     bash: command substitution: line 74: `            done'      ### THINGS I'VE TRIED:   * I've tried reinstalling the "bash-completion" package but this had no apparent effect.   * I've looked at the file `/etc/bash_completion` and specifically at line 74 but I can see nothing obvious there that would need correcting (`complete -f -X '*.Z' compress znew`). Perhaps I am looking in the wrong file.   * I find completion for commands like `git`, `gedit`, and `node` work okay. But trying to auto-complete a filename for `kate` also doesn't work.   * When I ran `bash -x` for debugging, a lot of code was printed in the terminal and this was at the end (note the comment):              + toks=(${toks[@]-} $(         compgen -d -- "$quoted" | {             while read -r tmp; do                 # TODO: I have removed a "[ -n $tmp ] &&" before 'printf ..',                 #       and everything works again. If this bug suddenly                 #       appears again (i.e. "cd /b<TAB>" becomes "cd /"),                 #       remember to check for other similar conditionals (here                 #       and _filedir_xspec()). --David                 printf '%s\n' $tmp             done         }     ))     bash: command substitution: line 74: syntax error near unexpected token `done'     bash: command substitution: line 74: `            done'      I tried adding the conditional mentioned back in but this had no effect.   * I've tried temporarily removing `etc/bash_completion.d` but this had no effect.   * I've tried `complete -p` to see a list of completions but I don't really know what I'm looking for. ### A FINAL PLEA I'm willing to get my hands dirty with the shell scripts if that's what takes; I can learn a bit more about this in the process. I really would it fixed though. Any suggestions appreciated.


title: ZFS Raid-Z with different size disks

text: I've searched, and I think I understand, but just want to verify that I have the right concept. I am building a new PC, and want to set up the old one as a file server. Ultimately, I would like two "drives" (volumes? pools?), both with redundancy. One for the OS, and the rest for the media. Drives:   * 5 x 1.0TB   * 2 x 1.5TB   * 1 x 2.0TB Can I partition like this:   * 1.0TB   * 1.0TB   * 1.0TB   * 1.0TB   * 1.0TB   * 1.0TB + 0.5TB   * 1.0TB + 0.5TB   * 1.0TB + 0.5TB + 0.5TB Then:   1. Combine all 1.0TB partitions into a single raid-z with 7.0TB usable capacity   2. Combine two 0.5TB partitions into two mirrors, with 0.5TB usable each   3. Pool the 7.0TB raid-z with a 0.5TB mirror for 7.5TB usable   4. Use the remaining 0.5TB mirror for the OS Is my thinking correct? Is there a better way of doing this? I know that, assuming this method is optimal, I wouldn't create a mirror using both 0.5TB partitions on the single 2.0TB drive. I would need to use one for each mirror, or I'd be defeating the purpose of a mirror :)


title: How to manipulate all parameters of a shell script at once?

text: While for a finite amount of parameters one can explicitly do something like               wrapped_function "${1#prefix}" "${2#prefix}" "${3#prefix}"  # etc.,      isn't there a simpler way to manipulate _all_ parameters at once?


title: need to display Hard error,transport error &soft error above 2 for the output of iostat -En | grep Hard like this

text: I am new to this field scripting. iam a solaris engineer.shall i get the answer of this script in KSH scripting" iostat -En | nawk '/Hard Errors/ {line=$0;gsub(/.*Hard Errors:/,"");if($1>2) printf("%s\n",line); }' "which are for hard error above 2,as "warning about iostat hard error , transport error & soft errors > 2 on system1 is "error". And here need to display any of the errors such as hard error , transport error & soft errors are above 2. Anybody can help for this.


title: Print range of files based on time range using awk?

text: I have done a few simple things with `awk` but I cannot find a way to do this! I have a text file containing entries named with year, julian date and time as such:               blah_2012251_130500_blah       blah_2012251_131000_blah       blah_2012251_131500_blah       ...       blah_2012253_063000_blah        and I am trying to find a way to create a new file with entries within a specific time range only. For example, year 2012 and day 251 at 2:02pm (140200) to 2012 day 252 to at 6:07am (060700) should contain files to span the times:               blah_2012251_140000_blah       blah_2012251_140500_blah     ...       blah_2012252_060500_blah     blah_2012252_061000_blah      Also, the files do not always increment every 5 minutes like in this example, so it needs to be an open range.


title: Can I start my main desktop graphical session remotely?

text: So my workstation at work got rebooted and I'm currently not logged in physically there with a graphical session. I have ssh access to it, and I can start a new X windows session and use my graphical applications remotely. I was just wondering if there was a way to start the main desktop session remotely, so that I can then connect and interact with it and next time I get in front of the workstation, I can just pick up where I left off...


title: Debian 6 internet problem: ifconfig doesn't show eth0

text: I just installed 64-bit Debian 6.06 on my ASUS K53S machine and internet is not working... Wireless is working fine. NetworkManager is doesn't show any wired connections and ifconfig in the terminal doesn't show any eth0 interface My `/etc/network/interfaces` file has the following lines               auto lo     iface lo inet loopback      Googling for it didn't help. Any help anyone?


title: Setting ulimits without PAM

text: How to do that? Without PAM on my GNU/Linux OS the number of open files is 1024 by default and cannot be raised above 4096 (via `ulimit -n NNNN` command) despiting what is written in /etc/security/limits.conf. So, how does it work without PAM and how to set limits in such case? ===upd=== I decided for myself to use PAM. For those who wants to exceed the hard limit of opened files without PAM, look up for the `RLIMIT_NOFILE` constant in `include/asm-generic/resource.h` and `INR_OPEN_MAX` in `include/linux/fs.h` which defines the number of 4096 files as hard limit for rlimits. Check also CAP_SYS_RESOURCE which is required to be able to call `setrlimit()` on a running system to exceed the limit. It seems there is no way to do a system call like `setrlimit()` in bash, but it may be implemented as a binary executable file. Or you can make a kernel patch.


title: How to output file & ignoring lines that start with "?"?

text: I do `svn status --show-updates` and then I want to either   * Q1: ignore (not to display) lines that start with `?`   * Q2: display only lines that start with `*` Note that there are few spaces before * occurs. That means that `*` is not the first character on the line. How can I do that?


title: Move /var/www/ to /srv/www/ on Fedora 16

text: I'm learning how to configure linux, apache, php, mysql. I followed these **steps** , how to set permissions for root:www-dev on the files and folders under /var/www/ Now I'd like to know how I can move the dir /var/www/ and I assume the permissions I've set will hold. I'm pretty sure I'll have to edit some apache configuration to let apache know it's directory has changed place. I'm not sure where mysql is located, I also assume php is a module of apache therefore it should be somewhere in /var/www/ I'm just experimenting trying to get a feel for linux in general, and how to config a simple web server. * * * My configuration at the moment is default except for the permissions I've set.               # yum install httpd     # yum install mysql mysql-server     # yum install php php-mysql


title: using parallel to process unique input files to unique output files

text: I have a shell scripting problem where I'm given a directory full of input files (each file containing many input lines), and I need to process them individually, redirecting each of their outputs to a unique file (aka, file_1.input needs to be captured in file_1.output, and so on). _**Pre-parallel_** , I would just iterate over each file in the directory and perform my command, while doing some sort of timer/counting technique to not overwhelm the processors (assuming that each process had a constant runtime). However, I know that won't always be the case, so using a "parallel" like solution seems the best way to get shell script multi-threading without writing custom code. While I have thought of some ways to whip up parallel to process each of these files (and allowing me to manage my cores efficiently), they all seem hacky. I have what I think is a pretty easy use case, so would prefer to keep it as clean as possible (and nothing in the parallel examples seem to jump out as being my problem. Any help would be appreciated! input directory example:               > ls -l input_files/     total 13355     location1.txt     location2.txt     location3.txt     location4.txt     location5.txt      Script:               > cat proces_script.sh     #!/bin/sh          customScript -c 33 -I -file [inputFile] -a -v 55 > [outputFile]      **Update** : After reading Ole's answer below, I was able to put together the missing pieces for my own parallel implementation. While his answer is great, here is my addition research and notes I took: Instead of running my full process, I figured to start with a proof of concept command to prove out his solution in my environment. See my two different implementations (and notes):               find /home/me/input_files -type f -name *.txt | parallel cat /home/me/input_files/{} '>' /home/me/output_files/{.}.out      Uses find (not ls, that can cause issues) to find all applicable files within my input files directory, and then redirects their contents to a separate directory and file. My issue from above was reading and redirecting (the actual script was simple), so replacing the script with cat was a fine proof of concept.               parallel cat '>' /home/me/output_files/{.}.out :::  /home/me/input_files/*      This second solution uses parallel's input variable paradigm to read the files in, however for a novice, this was much more confusing. For me, using find a and pipe met my needs just fine.


How to terminate GUI in SunOS from a shell-script running it from the terminal.


title: Fonts way to big with Awesome WM

text: I previously tried to use KDE with Awesome WM, and currently try just to use Awesome WM. I use a Vicious battery widget and `nm-applet` for networking. It works pretty well. However, all my fonts are way too big. I assume that the ThinkPad X220 screen sets a resolution around 120 DPI which then causes all fonts to become bigger: ![](http://chaos.stw-bonn.de/users/mu/uploads/2013-12-10/screenshot5.png) With KDE, I had the font resolution forced to 96 DPI, which worked well. When I start the KDE `systemsettings` and go into the fonts menu, change something and back again, some programs, like Dolphin and Firefox, will pick up the right font sizes. However, Konsole does not, and it does not make sense to me. See Konsole and Dolphin next to each other: ![](http://chaos.stw-bonn.de/users/mu/uploads/2013-12-10/screenshot6.png) Another thing that changed, even when I log in with KDE+Awesome again, is that all fonts appear to be a little thinner. I guess that some anti-alias changed, but I have no idea what that was. How can I get my fonts to behave normally?


title: wget downloaded file names with absolute path for use with apt-get

text: I'm looking for a way of updating a machine that is offline. For that purpose I found this explanation using --print-uris from `apt-get`. I have successfully installed new packages (and dependencies) with it. Very handy. However, when I tried to update the package list using the method described in the previous link, I ended up with a bunch of files all named `Packages.bz2.*`, where the `*` takes values from 1 to 23. As far I understand I have to extract them and the resulting file copy it to `/var/lib/apt/lists/`. Is there a way to download the files with wget but instead of all called Packages.bz2 with names similar (or preferably equal) to the ones originally used by apt-get `archive.ubuntu.com_ubuntu_dists_trusty_main_binary- amd64_Packages`, so when extracting them they stay with readable names. After doing that, is there anything more that I have to do in order to apt-get find updates (I intent to do an upgrade printing uris and then installing the packages). * * * An execution example:               sudo apt-get update --print-uris -y > update.list      This gives a file containing lines like:               'http://security.ubuntu.com/ubuntu/dists/trusty-security/main/binary-amd64/Packages.bz2' security.ubuntu.com_ubuntu_dists_trusty-security_main_binary-amd64_Packages 0 :     'http://security.ubuntu.com/ubuntu/dists/trusty-security/restricted/binary-amd64/Packages.bz2' security.ubuntu.com_ubuntu_dists_trusty-security_restricted_binary-amd64_Packages 0 :      This format can't be fed to wget, so we extract the urls by executing (this can be done directly in the previous command as shown in the linked page):               cat update.list | grep ^\' | cut -d\' -f2 > update.cut      Then we get a file with lines like:               http://security.ubuntu.com/ubuntu/dists/trusty-security/main/binary-amd64/Packages.bz2     http://security.ubuntu.com/ubuntu/dists/trusty-security/restricted/binary-amd64/Packages.bz2      Now this can be feed into wget using the option --input-file. I executed:               mkdir lists     cd lists     wget --input-file ../update.cut      An `ls` shows:               Packages.bz2     Packages.bz2.14  Packages.bz2.2   Packages.bz2.4  Translation-en.bz2     Translation-en.bz2.4     Packages.bz2.1   Packages.bz2.15  Packages.bz2.20  Packages.bz2.5  Translation-en.bz2.1   Translation-en.bz2.5     Packages.bz2.10  Packages.bz2.16  Packages.bz2.21  Packages.bz2.6  Translation-en.bz2.10  Translation-en.bz2.6     Packages.bz2.11  Packages.bz2.17  Packages.bz2.22  Packages.bz2.7  Translation-en.bz2.11  Translation-en.bz2.7     Packages.bz2.12  Packages.bz2.18  Packages.bz2.23  Packages.bz2.8  Translation-en.bz2.2   Translation-en.bz2.8     Packages.bz2.13  Packages.bz2.19  Packages.bz2.3   Packages.bz2.9  Translation-en.bz2.3   Translation-en.bz2.9      After this point the site I linked gives no more clues other than this should be put in /var/lib/apt/lists/. For that I do (after I copied the files to the offline machine):               sudo rm -R /var/lib/apt/lists/*     bunzip2 Packages.bz2.14     sudo cp Packages.bz2.14.out /var/lib/apt/lists/      But after doing that I can't search packages with `apt-cache` so I suppose that something went wrong ( I checked that the file Packages.bz2.14.out lists a package name 0ad and searched for that). For now I'm trying to get wget downloaded files with human readable names (I think some should be gpg files but don't know which ones because of the name). After that I want to be able to do packages searches with the new package list (in order to do upgrades and software installations). I'm not sure what happens if the gpg files are missing (maybe that's why I can't find packages) or should y check the gpg before copying it to `/var/lib/apt/lists/`.


title: bunzip2 to a different directory

text: Say I have a file `foo.tbz2` in a directory. I want to extract the `tar` file from the archive, but to a different directory. It seems like `bunzip2` will only extract the archive to the same directory as the archive. Am I missing something? This works, but I'm wondering if there is a better way:               cd /another/directory     bunzip2 -k -c /original/directory/foo.tbz2


title: Chromium does not Render webpage (arm)

text: I am trying to run Chromium (the browser) on a Ubuntu install within Android (ARM) and am facing a weird issue: Webpages are not rendering at all. Links etc within the page are still clickable, however the webpage area is completely blank. ![enter image description here](http://i.stack.imgur.com/bpeSG.png) Terminal output:               chromium-browser --user-data-dir='/home/zac'     [2495:2495:0710/143156:ERROR:browser_main_loop.cc(192)] GTK theme error: Unable to locate theme engine in module_path: "pixmap",     [2495:2495:0710/143156:ERROR:browser_main_loop.cc(192)] GTK theme error: Unable to locate theme engine in module_path: "pixmap",     [2495:2495:0710/143156:ERROR:browser_main_loop.cc(192)] GTK theme error: Unable to locate theme engine in module_path: "pixmap",     [2495:2495:0710/143156:ERROR:browser_main_loop.cc(212)] Gdk: shmget failed: error 38 (Function not implemented)     Failed to open /proc/cpuinfo     Failed to open /proc/cpuinfo     Failed to open /proc/cpuinfo     Failed to open /proc/cpuinfo     Failed to open /proc/cpuinfo     Failed to open /proc/cpuinfo     Failed to open /proc/cpuinfo     Failed to open /proc/cpuinfo     Failed to open /proc/cpuinfo     Failed to open /proc/cpuinfo     Failed to open /proc/cpuinfo     Failed to open /proc/cpuinfo     Failed to open /proc/cpuinfo     Failed to open /proc/cpuinfo     Failed to open /proc/cpuinfo     Gkr-Message: secret service operation failed: The name org.freedesktop.secrets was not provided by any .service files     Failed to open /proc/cpuinfo     Failed to open /proc/cpuinfo     Failed to open /proc/cpuinfo     Failed to open /proc/cpuinfo     Failed to open /proc/cpuinfo     Failed to open /proc/cpuinfo     Failed to open /proc/cpuinfo     Failed to open /proc/cpuinfo     Failed to open /proc/cpuinfo     Failed to open /proc/cpuinfo     Failed to open /proc/cpuinfo     Failed to open /proc/cpuinfo     Failed to open /proc/cpuinfo     Failed to open /proc/cpuinfo     Failed to open /proc/cpuinfo      If you need any more info, let me know!


title: Installer for applications in LInux

text: Wikipedia says > An installation program or installer is a computer program that installs > files, such as applications, drivers, or other software, onto a computer. > > Some installers are specifically made to install the files they contain; > other installers are general-purpose and work by reading the contents of the > software package to be installed.   1. Is an installer always used for binary installation and not doing any compilation work for source installation?   2. Does Linux have the concept "installer" for package installation? Wikipedia distinguishes between "installer" and "Package management system". In Ubuntu, it seems to me all binary installation is done by Package management systems `dpkg` or `apt` - so where is an "installer"?


title: bonding mode4 without 802.3ad switch support

text: using two switches without 802.3ad support I can configure bonding mode 4? ie: server linux with 2nics: put nic1 cable on switch1, nic2 cable on switch2 and put another cable from switch1 to pc1 and another cable from switch2 to pc1? Obviously with bonding active on both pc.


title: update nm-applet settings on Ubuntu command line

text: I am running Linux on VMWare on MAC. I am using Dongle to connect to external networks. I have created a hotspot, which works perfectly fine. The only problem is that when I stop hotspot my `nm-applet` disappears. I load it from command line again, but `Enable Wireless` settings are turned off. I have to check it manually to get connected to my default WiFi network again. Is there a way to change the `nm-applet` settings from command line?


title: How can I run a KDE plasma script from command line without GUI?

text: I want to run a plasma JavaScript file from command line, but the only solution I found so far involves a graphical script editor and requires a user interaction to run the script:               qdbus org.kde.plasma-desktop /MainApplication loadScriptInInteractiveConsole "$PLASMA_SCRIPT_FILE"      Is there any solution that does not require a user interaction?


title: rEFInd not seeing Windows 8.1

text: I recently installed Arch on my new SSD after my other one died, and in the process I accidentally wiped the EFI partition and the Windows recovery partition. Before I had rEFInd in place, it booted without issue, so I didn't think much of it, but now that rEFInd is in place I'm unable to boot into Windows. The menu entry is missing, and I assume that's because Windows 8 doesn't have an EFI entry on the EFI partition? The output of `efibootmgr` implies that it should still be bootable, as the bootloader for Windows is still intact.               ➜ ~ efibootmgr     BootCurrent: 0005     Timeout: 1 seconds     BootOrder: 0005,0000,0001,0002     Boot0000* Windows Boot Manager     Boot0001* Hard Drive      Boot0002* UEFI: Built-in EFI Shell      Boot0005* rEFInd Boot Manager      I've tried manually setting the next boot to the Windows Boot Manager using `sudo efibootmgr -n 0000`, but without much success. All it does then is flash the screen, then it goes straight back to rEFInd. The SSD is all GPT, so everything goes through the EFI stuff.


title: Symbolic Link with Existing Directory

text: If I already has a directory (A) with existing contents and another directory (B), how do I symbolic link such that the two directory's content merge.                  eg.   A                 -> folderA1/                -> a.bin                -> b.bin (from B folder)                -> c.bin (from B folder)              B                 -> b.bin                -> c.bin


title: What starts the login prompt in RHEL?

text: I don't have a service in my run level that starts the login prompt, so I was wondering what does.


title: If you SSH into another computer, how to access other X displays?

text: This is a query based on personal use. A troll in our local network had downloaded Crikey, the key-event simulator. He used it to simulate events on other computers, leading to unwanted things. For example, a person was playing the popular FPS Urban Terror. The attacker used Crikey to change the player's nickname (`/nick trollface`). As best as we understand, the attacker ssh'd into our computers, and then switched X windows somehow, and mimicked our events. I was wondering whether someone knew how he switched X Windows and did this.


title: Fix 'Enter passphrase for key: '

text: My SSH private key would automatically be unlocked earlier because I guess it was configured with Seahorse. It would just ask for my password and handle things on its own. For some weird reason, it doesn't seem to work anymore. I am sure that I did _not_ change any setting. Now whenever I try to log in to a remote server, it asks me for:                Enter passphrase for key: '$PATH_TO_KEY'      This is annoying! How can I fix it? I know I have to use `ssh-agent` and I tried to add the key but it just doesn't seem to work.


title: linux diff tools: create list of modified files

text: How do I create a list of modified files programmatically using linux command line tools? I'm not interested in the difference in any particular file (delta, patch). I just want to have a list of new or modified files comparing to previous product release. So that I can publish a new product update. update: `diff -qr` doesn't produce very convinient output. The output of `diff -qr` also needs to be processed. Is there any better way?


title: Standard key/value datastore for unix

text: I know about the **key/value** libraries for unix ( **berkeleydb** , **gdbm** , **redis**... ). But before I start coding, I wonder if there is a standard tool for unix that would allow me to perform the following operations:               $ tool -f datastore.db put "KEY" "VALUE"     $ tool -f datastore.db put -f file_key_values.txt     $ tool -f datastore.db get "KEY"     $ tool -f datastore.db get -f file_keys.txt     $ tool -f datastore.db remove "KEY"     $ etc...      Thanks


title: Bash, remove oldest files

text: I`m trying to delete old files from directory and leave only 3 newest files.               cd /home/user1/test          while [ `ls -lAR | grep ^- | wc -l` < 3 ] ; do              rm `ls -t1 /home/user/test | tail -1`         echo " - - - "          done      something is wrong with conditional statement, can someone help me correct it?


title: Directory appears as file?

text: So we copied some photos in a directory across to a NTFS partition last night, and they were viewable from ubuntu. Today the directory is not accessible from Windows, and when we booted back into linux, the directory appears as a file and Nautilus thinks its a gzip archive. ls -la gives the following:               -rw------- 1 kim kim 16769 Jun 17 22:47 DirectoryName      My assumption is that the "directory" and its pointers to the other files are still there, it just has the wrong attributes. I tried               sudo chmod a+rwx DirectoryName      But this didn't have any affect. Any ideas how I can convince my directory that its a directory again?? Or otherwise recover the files that are now orphaned on the drive? **update and solution** So I went home last night, tried to open the directory in Windows but it is still represented as a file in explorer. So I booted back into ubuntu to run               file MyDirectory      And the "file" is now gone. Not even appearing via ls anymore. So we took a different tack, and recovered the files from the SD card using this excellent tool. Thanks all for your help anyway


title: Dependencies problem with automake

text: I am using automake on Debian Squeeze for compiling a very simple C project with 6 source files. The issue comes when I try to compile the sources using the generated Makefile. One of the sources (ll_socket.c) uses system libraries like and . Those dependencies should appear in the ".deps/ll_socket.Tpo" file automatically generated; however, that file is empty and, therefore, when GCC tries to compile that file, it cannot find the dependencies for the compilation. Any ideas about how to solve this problem?


title: How to fix "Xlib: extension "RECORD" missing on display :1" in vnc session?

text: I am running a JNativeHook capture program on Ubuntu. When I run the session on default X session things are working fine. However when I run the same program from vnc session, it fails with "Xlib: extension "RECORD" missing on display". I checked that this extension is loaded in X which is started by display manager/init. However I am not sure if indeed is initialized during vncserver startup. I could not see anything related in the vnc log. I tried create custom xorg.conf with Module section, which explicitly loads RECORD extension as suggested by many posts but did not help. My environment: Xorg-server: 2.1.12.4-6 tightvncserver: 1.3.9 The same thing works fine on my CentOS 6.4 setup.


title: Migrating from one linux install to another: How to keep the second disk around?

text: I've got a linux box running Fedora 19 that I want to move to CentOS 6.4. Rather than trying to do something fancy with the current disk (which has also accumulated a lot of sludge over the years), I'm going to get a new disk, put CentOS on that, and then move the to-be-preserved bits of stuff from the old disk to the new one. I haven't done this yet, but I presume it should be semi-straightforward -- do the CentOS install on the new disk, mount the old disk on /olddisk or somesuch, and start copying. However, I'm not sure how to handle getting the machine to recognize the new empty disk as the target of the CentOS install (I suppose I can just pull the old disk during the installation), remember that this is the intended boot disk once the install has happened), and tweak /etc/fstab (right?) to set up the old disk on the desired mount point. (Both disks are, or will be, SATA.) I could probably hack it together without losing too much hair or doing too much damage, but could anyone offer some advice that would get/keep me on the right track? Thanks!


title: tmux set-titles doesn't work?

text: To start `tmux` on every shell login, the following was added to the `~/.bashrc` (on the server):               if [ $TERM != "screen-256color" ] && [  $TERM != "screen" ]; then         tmux attach || tmux new; exit     fi      I also want to change the window title to something like `user@server` (instead of `user@localhost`) when ssh into a host. Here's my `~/.tmux.conf`:               set -g prefix C-a     unbind C-b     bind C-a send-prefix          set -g set-titles on     set -g set-titles-string "#T"          bind-key o split-window -v     bind-key e split-window -h          bind-key w kill-pane          set -g terminal-overrides 'xterm*:smcup@:rmcup@'      As you can see, `set-titles` was set to `on`, but it doesn't work as expected. More informations: Outside of tmux:               $ echo $TERM     xterm      Inside of tmux:               $ echo $TERM     screen      `show -g`: https://clbin.com/h7oDh `tmux info`: http://sprunge.us/XHCB And here're the logs when running `tmux -vvvvv` for a bit:   * tmux-client-8441.log: https://clbin.com/eFwFF   * tmux-out-8443.log: https://clbin.com/MSKZv   * tmux-server-8443.log: https://clbin.com/JXwRN If I comment out the lines in `~/.bashrc`, from my laptop, ssh to the server, the title bar shows correctly (`quanta@server`), then start `tmux` from there also works as expected. But if I want to start `tmux` immediately after login, the title bar remains to be `quanta@Ubuntu` after ssh. * * * **UPDATE Fri May 10 07:51:23 ICT 2013** I have deleted the `exit` command in order not to close the shell session when the last `tmux` window is closed:               if [ $TERM != "screen-256color" ] && [  $TERM != "screen" ]; then         tmux attach || tmux new     fi      The strange thing is:   * ssh to server -> the title bar: `quanta@Ubuntu`   * detach from `tmux` -> the title bar switch to `quanta@server`   * attach to `tmux` again -> the title bar still shows correctly `quanta@server` * * * I'm not sure if it's related to the `PROMPT_COMMAND` environment variable or not: Outside of `tmux`:               $ echo $PROMPT_COMMAND      echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\007"      Inside of `tmux`:               $ echo $PROMPT_COMMAND     echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\033\\"


title: bash getopts, short options only, all require values, own validation

text: I'm trying to build up a shell script that accepts various options and `getopts` seems like a good solution as it can handle the variable ordering of the options and arguments (I think!). I'll only be using short options and each short options will require a corresponding value eg: `./command.sh -a arga -g argg -b argb` but I would like to allow the options to be entered in a non-specific order, as is the way most people are accustomed to working with shell commands. The other point is that I would like to do my own checking of option argument values, ideally within the `case` statements. The reason for this is that my testing of `:)` in my `case` statement has yielded inconsistent results (probably through lack of understanding on my part).   For example:               #!/bin/bash     OPTIND=1 # Reset if getopts used previously     if (($# == 0)); then             echo "Usage"             exit 2     fi     while getopts ":h:u:p:d:" opt; do             case "$opt" in                          h)                             MYSQL_HOST=$OPTARG                             ;;                     u)                             MYSQL_USER=$OPTARG                             ;;                     p)                             MYSQL_PASS=$OPTARG                             ;;                     d)                             BACKUP_DIR=$OPTARG                             ;;                     \?)                             echo "Invalid option: -$OPTARG" >&2                             exit 2;;                     :)                            echo "Option -$OPTARG requires an argument" >&2                            exit 2;;             esac     done     shift $((OPTIND-1))     echo "MYSQL_HOST='$MYSQL_HOST'  MYSQL_USER='$MYSQL_USER'  MYSQL_PASS='$MYSQL_PASS'  BACKUP_DIR='$BACKUP_DIR' Additionals: $@" Was failing for occurrences like this... `./command.sh -d -h`   When I want it to flag -d as requiring an argument but I get the value of `-d=-h` which is not what I need. So I figured it would be easier to run my own validation within the case statements to ensure that each option is set and set only once. I'm trying to do the following but my `if [ ! "$MYSQL_HOST" ]; then` blocks are not triggered.               OPTIND=1 # Reset if getopts used previously          if (($# == 0)); then             echo "Usage"             exit 2     fi          while getopts ":h:u:p:d:" opt; do             case "$opt" in                          h)                             MYSQL_HOST=$OPTARG                             if [ ! "$MYSQL_HOST" ]; then                                     echo "host not set"                                     exit 2                             fi                             ;;                     u)                             MYSQL_USER=$OPTARG                             if [ ! "$MYSQL_USER" ]; then                                     echo "username not set"                                     exit 2                             fi                             ;;                     p)                             MYSQL_PASS=$OPTARG                             if [ ! "$MYSQL_PASS" ]; then                                     echo "password not set"                                     exit 2                             fi                             ;;                     d)                             BACKUP_DIR=$OPTARG                             if [ ! "$BACKUP_DIR" ]; then                                     echo "backup dir not set"                                     exit 2                             fi                             ;;                     \?)                             echo "Invalid option: -$OPTARG" >&2                             exit 2;;                     #:)                     #       echo "Option -$opt requires an argument" >&2                     #       exit 2;;             esac     done     shift $((OPTIND-1))          echo "MYSQL_HOST='$MYSQL_HOST'  MYSQL_USER='$MYSQL_USER'  MYSQL_PASS='$MYSQL_PASS'  BACKUP_DIR='$BACKUP_DIR' Additionals: $@" Is there a reason that I'm unable to check if an `OPTARG` has zero-length from within `getopts ... while ... case`? What's the better way to run my own argument validation with `getopts` in a case where I don't want to be relying on the `:)`. Perform my argument validation outside of the `while ... case ... esac`?   Then I could end up with argument values of `-d` etc and not catching a missing option.


title: How do you migrate from dmraid to mdadm on a working 14.04?

text: I installed 14.04 LTS the other day on two Samsung 840 Pro's in RAID0 on my Intel FakeRAID BIOS setup (NO efi). It is running great, however during the initial boot the system seemed to have a broken Grub, so I used Boot-Repair from a live usb to fix it and apparently that converts mdadm back to dmraid. So, now here I am running in a really nice fast raid setup but with a deprecated mdraid. I wanted mdadm since it appears to be actively updated. How do you go back to mdadm on a working system without damaging your system? Is this even possible? Thank You! Regards, Rod


title: installing php-mysql on rhel6

text: I have rhel6 running on my server and installed mysql from Red Hat Enterprise Linux 6 / Oracle Linux 6 (x86, 64-bit), RPM Bundle. Now I want to host a php site on that machine. And when I run `yum install php-mysql` it throws me an bunch of conflicting files that looks like `file /usr/share/mysql/charsets/Index.xml from install of mysql- libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL- server-5.6.16-1.el6.x86_64` How can I install php-mysql on my server without removing my installed mysql


title: Shell command to read device registers?

text: On a single-board computer running Linux, is there a way to read the contents of the device configuration registers that control hardware? I think it would be a wrapper for inw(), more or less. I'm looking for something equivalent to the U-boot memory dump (md) command, to be used in the context of driver debugging.


title: Can I chain pgrep with kill?

text: I have noticed that `|` is used to send results of first command to the another. I would like to kill all processes that match a name.   This is what pgrep normally does:               $ pgrep name     5089     5105      And multiple arguments seem to work with `kill`:               sudo kill 5089 5105      But this is wrong:               pgrep name | kill      So how to do it properly?


title: Given keys in ~/.ssh/authorized_keys format, can you determine key strength easily?

text: ~/.ssh/authorized_keys[2] contains the list of public keys. Unfortunately, each public key does not specify the key strength ( number of bits ). Is there a utility that can process this file line by line and output the key strength? I checked man pages for `ssh-keygen`, but it looks like it would only work with private keys. Also, is there a tool that would output sha1 hash the same way as it is displayed in `pageant` Putty tool? The format I am looking for:               Key Algorithm  Strength  Hash                                             Comment     ssh-rsa        2048      00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff  user1@host1     ssh-rsa        2048      11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff:11  user2@host2


title: Install development files locally to build on system without root access?

text: There is a server that I do work on, running an older version of Linux. I don't have root access to the system, so I wanted to build a more recent version of a tool that I use a lot (Vim 7.3). I figured I would just build it and install it in ~/bin. However, it requires ncurses development files which are not installed system-wide. I found the ncurses-devel rpm, and extracted the 'lib' and 'include' folders, where would I put them and how would I tell the ./configure script to find them so I could properly configure and build the package locally? Edit: I ended up working around this by installing the identical OS in Virtualbox, and building the package there and copying over the binaries.


title: How to write software to compile with external libraries?

text: I want to code open source software with dependencies. I have skills in C/C++ and a minimum makefile knowledge. But im curious about coding this like `./configure && make` stuff and how to include dependencies to other libraries properly. Where can I find a easy to understand tutorial and is it a hard thing to learn it?


title: What fonts are good for unicode glyphs

text: So I was looking at this answer on stackoverflow and realized that my fonts aren't covering a whole lot of the utf-8 unicode spectrum (as I get lots of squares). Does anyone know a font that will cover all of that post?


title: How to show Nautilus toolbar and file tree sidebar?

text: I've installed the latest Scientific Linux 6. But when I opened the included Nautilus file manager, there is no file tree sidebar and no toolbar, nor status bar. How do I activate them?


title: “free-as-in-speech” vs. "free-as-in-beer”

text: What is the difference between "free-as-in-speech" and "free-as-in-beer"?


title: What is the bash shortcut to change to the previous directory?

text: Sadly, I only learned about this last year by stumbling upon it randomly on the internet. I use it so infrequently that I always forget what it is by the time I need it again. How do you change to your previous directory?


title: ZSH to auto-complete directories in command-line arguments?

text: _Transferred from regular StackOverflow..._ I'm a new ZSH convert on OSX (git status in the prompt was my main driver to make the leap). Everything seems to be working swimmingly but I'm missing something from BASH.. In BASH I would start to run a CLI PHP script that's built around Symfony's CLI tools. Typically I would run the command like this:               $> php doctrine --configuration=../conf/doctrine.xml migrations:migrate      In BASH I would be able to use the `TAB` key while typing out the `../conf/doctrine.xml` portion to complete the directories. In ZSH hitting the `TAB` key while typing out the directory results in... nothing. Is there a setting in ZSH or a configuration I can set to enable this behavior of attempting to complete almost anything that looks like a directory?


title: What can I use to monitor and log incoming/outgoing traffic to/from remote hosts?

text: I run a web server (Debian Squeeze on a VPS), and the graphs provided by the hosting company show consistently that around twice as much traffic is incoming to the server compared to the outgoing traffic. I am a little confused by this, so I would like to run some kind of logging utility on the machine that will not only confirm the upload/download figures, but also split them up by the remote host involved, so I can see if a large proportion of the incoming traffic is from one particular source. I suspect most of the outgoing traffic goes through Apache, but the incoming traffic may be mostly through Apache or could be dominated by other scripts and cron jobs, so I would prefer a tool that would monitor traffic at the interface level rather than something within Apache. Ideally I would like a tool that I can leave running for a few days, then come back and get an output of "bytes per remote host" for both incoming and outgoing traffic. Is this possible with a standard Linux tool and a bit of configuration (if so, how?) or with a specialist program (if so, which?)


title: how can I retrieve disk IO utilization in percents on HP-UX

text: I need to collect data about disk utilization for selected disks. I can use glance-plus monitoring tool to display the current data in percents (it looks similar to top), but I need to collect these values into a file so that I can create graphs from it. Unfortunately this isn't possible in glance so I wanted to create some own script for this purpose. I managed to create a script which collects number of blocks read / write per second, but I don't know how could I easily convert this to percents because I don't really know what the maximal utilization could be. The script is bellow:               #!/bin/sh     list=`iostat 10 2 | grep -v ' 0' | grep -v 'device' | grep -vE '^ *$' | sed 's/^........ *//' | sed 's/ .*//'`     value=0     for rt in `echo $list`     do     value=`expr $rt + $value`     done          echo `expr $value / 10`      is there any easier way to do this on hp-ux preferably using some free / default tools


title: Why Xubuntu installation disk disappears during installation settings?

text: I've tried to install Xubuntu 13.10 from USB. I burned it with Unetbootin. I choose _"Try xubuntu without installing"_ option. All works fine here. I can see my disk partition: ![Hdd look](http://i.stack.imgur.com/oQPM7.png) And I choose _"Install Xubuntu 13.10"_. It starts the typical installation steps. I want to erase my disk and install Xubuntu: ![erasure](http://i.stack.imgur.com/57vQ4.png) I chose the disk: ![disk-choosing](http://i.stack.imgur.com/esSuE.png) I chose to install on the disk, but it disappeared from desktop (you can compare with before slades): ![disk loosing](http://i.stack.imgur.com/btlrZ.png) I continued installing but it crashed. I tried few times and always the same result. Before this I used Ubuntu 12.04 LTS. My Hard Drive is `ext4` system. I couldn't figure out why this happened. Any suggestions? Can it depend on that I have swap partition before installing? How can I solve this issue and install Xubuntu? **Update:** I solved it by installed _"Xubuntu 12.04"_. I guess it was compatibility bug of my hard and Xubuntu version.


title: Does rm -rf * delete files recursively from the current directory or parent/root directory?

text: I wanted to delete files and folder recursively from a particular folder so I ran this command from that folder               rm -rf *      I assumed it would delete all files/directories under the current directory recursively. Something bad happened after that (my server is down, not even getting ping response).


title: Listing all devices as non-superuser

text: I'm trying to mount external hard drive. As I know, to mount manually, I should use `fdisk -l` to determine which device refers to the drive. When I'm doing so without `sudo` I have next output:               user@desktop:~/tmp$ /sbin/fdisk -l          Disk /dev/sda: 320.1 GB, 320072933376 bytes     255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Disk identifier: 0x000844b8             Device Boot      Start         End      Blocks   Id  System     /dev/sda1   *        2048      499711      248832   83  Linux     /dev/sda2          501758   625141759   312320001    5  Extended     Partition 2 does not start on physical sector boundary.     /dev/sda5          501760   625141759   312320000   8e  Linux LVM          Disk /dev/mapper/vg0-root: 348 MB, 348127232 bytes     255 heads, 63 sectors/track, 42 cylinders, total 679936 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Disk identifier: 0x00000000          Disk /dev/mapper/vg0-root doesn't contain a valid partition table          Disk /dev/mapper/vg0-swap_1: 8162 MB, 8162115584 bytes     255 heads, 63 sectors/track, 992 cylinders, total 15941632 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Disk identifier: 0x00000000          Disk /dev/mapper/vg0-swap_1 doesn't contain a valid partition table          Disk /dev/mapper/vg0-usr: 8996 MB, 8996782080 bytes     255 heads, 63 sectors/track, 1093 cylinders, total 17571840 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Disk identifier: 0x00000000          Disk /dev/mapper/vg0-usr doesn't contain a valid partition table          Disk /dev/mapper/vg0-var: 2998 MB, 2998927360 bytes     255 heads, 63 sectors/track, 364 cylinders, total 5857280 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Disk identifier: 0x00000000          Disk /dev/mapper/vg0-var doesn't contain a valid partition table          Disk /dev/mapper/vg0-tmp: 398 MB, 398458880 bytes     255 heads, 63 sectors/track, 48 cylinders, total 778240 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Disk identifier: 0x00000000          Disk /dev/mapper/vg0-tmp doesn't contain a valid partition table          Disk /dev/mapper/vg0-home: 298.9 GB, 298907074560 bytes     255 heads, 63 sectors/track, 36340 cylinders, total 583802880 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Disk identifier: 0x00000000          Disk /dev/mapper/vg0-home doesn't contain a valid partition table      With `sudo`:               user@desktop:~/tmp$ sudo fdisk -l     [sudo] password for user:           Disk /dev/sda: 320.1 GB, 320072933376 bytes     255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Disk identifier: 0x000844b8             Device Boot      Start         End      Blocks   Id  System     /dev/sda1   *        2048      499711      248832   83  Linux     /dev/sda2          501758   625141759   312320001    5  Extended     Partition 2 does not start on physical sector boundary.     /dev/sda5          501760   625141759   312320000   8e  Linux LVM          Disk /dev/mapper/vg0-root: 348 MB, 348127232 bytes     255 heads, 63 sectors/track, 42 cylinders, total 679936 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Disk identifier: 0x00000000          Disk /dev/mapper/vg0-root doesn't contain a valid partition table          Disk /dev/mapper/vg0-swap_1: 8162 MB, 8162115584 bytes     255 heads, 63 sectors/track, 992 cylinders, total 15941632 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Disk identifier: 0x00000000          Disk /dev/mapper/vg0-swap_1 doesn't contain a valid partition table          Disk /dev/mapper/vg0-usr: 8996 MB, 8996782080 bytes     255 heads, 63 sectors/track, 1093 cylinders, total 17571840 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Disk identifier: 0x00000000          Disk /dev/mapper/vg0-usr doesn't contain a valid partition table          Disk /dev/mapper/vg0-var: 2998 MB, 2998927360 bytes     255 heads, 63 sectors/track, 364 cylinders, total 5857280 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Disk identifier: 0x00000000          Disk /dev/mapper/vg0-var doesn't contain a valid partition table          Disk /dev/mapper/vg0-tmp: 398 MB, 398458880 bytes     255 heads, 63 sectors/track, 48 cylinders, total 778240 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Disk identifier: 0x00000000          Disk /dev/mapper/vg0-tmp doesn't contain a valid partition table          Disk /dev/mapper/vg0-home: 298.9 GB, 298907074560 bytes     255 heads, 63 sectors/track, 36340 cylinders, total 583802880 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Disk identifier: 0x00000000          Disk /dev/mapper/vg0-home doesn't contain a valid partition table          Disk /dev/sdb: 500.1 GB, 500105740288 bytes     255 heads, 63 sectors/track, 60801 cylinders, total 976769024 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x0002e78d             Device Boot      Start         End      Blocks   Id  System     /dev/sdb1            2048   976769023   488383488    7  HPFS/NTFS/exFAT      Why I can see plugged device only while launching the command with root rights?


title: CentOS 6 not regestering new hostname on Windows Server 2003

text: I rebuilt a Windows 7 Workstation with CentOS 6.5. The Windows 7 had a host name aaa attached to domain ddd.local. The new CentOS hostname is bbb. When I try to ping it:               $ ping bbb     ping: unknown host       However when I try the old host name it get the correct IP:               $ ping aaa     PING aaa.ddd.local (192.168.2.33) 56(84) bytes of data.     64 bytes from 192.168.2.33: icmp_seq=1 ttl=64 time=0.345 ms     64 bytes from 192.168.2.33: icmp_seq=2 ttl=64 time=0.374 ms      In fact I can ssh to it using username@aaa and it works. My `/etc/hosts` is:               127.0.0.1   bbb.ddd.local localhost       My `/etc/hostname` is:               bbb      My `/etc/sysconfig/network` is:               NETWORKING=yes     HOSTNAME=bbb.ddd.local     NTPSERVERARGS=iburst      I tried adding `DNS_HOSTNAME=bbb` to the `ifcfg-eth0` with no success. I have little, to possibly no access, to our companies DNS Server and any changes would have to go through a long process, something I would like to keep as the very last option. Please let me know how I can inform the DNS server to update the hostname for the specific network Card?


title: Can I change the shell used to run GUI applications from a Desktop Manager?

text: **A bit of background** I'm a developer and I install most of my tools in my home folder. So my shell's rc file is full of `JAVA_HOME`, `GROOVY_HOME`, `MAVEN_HOME`, ... variables. To expose all these environment variables to my GUI applications (think my IDE) I used to write a shell script by first defining those variables _again_ and then running the application; and finally adding a launcher in my application menu to run that script. One day I realized that I could just run my application via my shell. As all the variables defined in the shell's rc files were going to be set in the application environment. So the entry in my application menu became something like `/usr/bin/my-shell ~/my-ide/bin/start.sh` **Now the question** Can I instruct my DM to always use my shell to run all my applications? **Side notes** I use _ZSH_ and _Gnome_ , but a more generic solution would be appreciated. I've already set my default shell to _ZSH_ , but _Gnome_ doesn't seem to considered that a good enough reason to use that shell for everything.


title: Automatically install build dependencies prior to building an RPM package

text: I am trying to build the .rpm package. i have just followed the steps to do that. Till now all step was gone fine but now i just stuck with this step. I just ran the following command and got this error :               rpmbuild -ba asterisk.spec     error: Failed build dependencies:          gtk2-devel is needed by asterisk-1.8.12.2-1.fc15.x86_64         libsrtp-devel is needed by asterisk-1.8.12.2-1.fc15.x86_64         gmime22-devel is needed by asterisk-1.8.12.2-1.fc15.x86_64         graphviz is needed by asterisk-1.8.12.2-1.fc15.x86_64         graphviz-gd is needed by asterisk-1.8.12.2-1.fc15.x86_64         latex2html is needed by asterisk-1.8.12.2-1.fc15.x86_64         neon-devel is needed by asterisk-1.8.12.2-1.fc15.x86_64         libical-devel is needed by asterisk-1.8.12.2-1.fc15.x86_64         speex-devel >= 1.2 is needed by asterisk-1.8.12.2-1.fc15.x86_64         gsm-devel is needed by asterisk-1.8.12.2-1.fc15.x86_64         libedit-devel is needed by asterisk-1.8.12.2-1.fc15.x86_64         openais-devel is needed by asterisk-1.8.12.2-1.fc15.x86_64         alsa-lib-devel is needed by asterisk-1.8.12.2-1.fc15.x86_64         dahdi-tools-devel >= 2.0.0 is needed by asterisk-1.8.12.2-1.fc15.x86_64         dahdi-tools-libs >= 2.0.0 is needed by asterisk-1.8.12.2-1.fc15.x86_64         libpri-devel >= 1.4.12 is needed by asterisk-1.8.12.2-1.fc15.x86_64         libss7-devel >= 1.0.1 is needed by asterisk-1.8.12.2-1.fc15.x86_64         spandsp-devel >= 0.0.5-0.1.pre4 is needed by asterisk-1.8.12.2-1.fc15.x86_64         iksemel-devel is needed by asterisk-1.8.12.2-1.fc15.x86_64         jack-audio-connection-kit-devel is needed by asterisk-1.8.12.2-1.fc15.x86_64         libresample-devel is needed by asterisk-1.8.12.2-1.fc15.x86_64         lua-devel is needed by asterisk-1.8.12.2-1.fc15.x86_64         mISDN-devel is needed by asterisk-1.8.12.2-1.fc15.x86_64         bluez-libs-devel is needed by asterisk-1.8.12.2-1.fc15.x86_64         libtool-ltdl-devel is needed by asterisk-1.8.12.2-1.fc15.x86_64         unixODBC-devel is needed by asterisk-1.8.12.2-1.fc15.x86_64         portaudio-devel >= 19 is needed by asterisk-1.8.12.2-1.fc15.x86_64         postgresql-devel is needed by asterisk-1.8.12.2-1.fc15.x86_64         radiusclient-ng-devel is needed by asterisk-1.8.12.2-1.fc15.x86_64         net-snmp-devel is needed by asterisk-1.8.12.2-1.fc15.x86_64         lm_sensors-devel is needed by asterisk-1.8.12.2-1.fc15.x86_64         freetds-devel is needed by asterisk-1.8.12.2-1.fc15.x86_64         uw-imap-devel is needed by asterisk-1.8.12.2-1.fc15.x86_64      I am using fedora-15. How to resolve this error? Any idea and suggestion will be appreciated   Thanks


title: What tools can I use to recover files from an old harddrive?

text: I found an old hard drive of mine yesterday and found that it fits into my current laptop. When I started it up, however, it got to the Win XP loading screen and then restarted. Then I thought, if I run some Linux distro off a flash drive, then maybe I could browse the hard drive somehow and recover as many files as I can. I think there exists some program that reads raw data off damaged drives and then pulls out all the undamaged files that it can. If this program exists, what is it called and where can I find it? Or is there a Linux distro designed for this purpose? I'm sure I could write something myself to do the job but it would take forever, would involve a massive list of file headers to scan for, and I don't want to reinvent the wheel.


title: In Vim, how can I delete all text from the current cursor position until the next space?

text: In Vim, I know 'd$', that deletes everything to the end of line. But how can I delete all text from the current cursor position until the next space? `dw` doesn't work, since it treats symbols like colon as separator as well.


title: How to remove the "Received: from" from an e-mails source?

text: I'm using: thunderbird-10.0.3-1.el6_2.x86_64 on Scientific Linux 6.1 and if I send an e-mail (with Gmail) from my Thunderbird then I can see that the e-mail I sent contains a very-very bad thing:               Received: from [192.168.1.142] (31-149-121-34.pool.myisp.com. [31.149.121.34])      So ALL the e-mail that I'm sending containst my NATed IP address + my public IP address. Can I delete/remove these lines, so that they will be aren't in ALL the e-mails that I send?? UPDATE: if I send an e-mail with the gmail web interface, then:               Received: by 10.112.129.10 with HTTP; Sat, 14 Apr 2012 09:20:13 -0700 (PDT)      Aren't there any Thunderbird Add-ons that modifies my IP Address in the e-mail?


title: How can I remove a bunch of ancient packages on debian?

text: I'm running sid, and in the course of trying to cross-grade my system from i386 to amd64 I came across some ancient packages that I couldn't remove. Some background: I've had this system since potato, or maybe earlier. There are about a hundred packages like this, so I'd like a generic or scriptable answer. Here's one example:               bminton:/var/cache/apt/archives# dpkg --purge libstdc++2.10-dev     (Reading database ... 1352516 files and directories currently installed.)     Removing libstdc++2.10-dev (1:2.95.4-27) ...     install-info: No dir file specified; try --help for more information.     dpkg: error processing package libstdc++2.10-dev (--purge):      subprocess installed pre-removal script returned error exit status 1     Errors were encountered while processing:      libstdc++2.10-dev      The prerm script `/var/lib/dpkg/info/libstdc++2.10-dev.prerm script contains the following:               #! /bin/sh -e                    install-info --quiet --remove iostream-2.95      Manually running `install-info --quiet --remove iostream-2.95` gives the following error:               install-info: No dir file specified; try --help for more information.


title: Same target IP address when using tsocks

text: I need to use tsocks (to tunnel an ssh connection through an ssh tunnel to reach given machines), but there is a problem. There are two servers that has the same IP address (that I need to reach through ssh tunnels). So the config for this situation would look like this:               cat /etc/tsocks.conf     path {         reaches = 10.1.1.2/255.255.255.255         server = 127.0.0.1         server_port = 3000     }          path {         reaches = 10.1.1.2/255.255.255.255         server = 127.0.0.1         server_port = 2000     }      How can I resolve this problem?


title: Unknown hard disk partition?

text: I want to mount my second hard disk from my Linux VMware guest but when I try               mount -t ext3 /dev/sdb2      it is not available.               fdisk -l /dev/sdb      gives me unknown format:               /dev/sdb1            2048     4208639     2103296   2d  Unbekannt     /dev/sdb2         4208640   137902079    66846720   2d  Unbekannt     /dev/sdb3       137902080   976773119   419435520   83  Linux      sdb1 is the Linux swap, sdb2 is my boot partition and sdb3 my home partition. It's basically a standard SUSE 12.1 default partition layout.


title: How to set name to localhost in fedora15?

text: I want to set name to my localhost.for example I want **mysite.com** instead of **localhost/mysite** how to do that? I have searched but couldn't get a solution for Linux.


title: Dual boot Fedora 16 with OS X refit

text: Having trouble with installing Fedora 16 on my Macbook Pro. While the installation itself completes without and issues, the bootloader doesn't install correctly. I have rEFIt, which I already have installed from an earlier Ubuntu installation. So I'd really like to be able to use rEFIt to choose between OS X and Fedora. I haven't found much written out on the issue, so my question is: Is this even possible?


title: How to reset KDE wallet password in linux?

text: I have installed OpenSUSE on my laptop. I am trying to connect to my wifi. I entered my wifi password (correctly) and then it is asking for my KDE wallet password. I set the KDE password but forgot it. Is there any way to reset it or do I have to reimage my laptop?


title: Understanding /dev and its subdirs and files

text: $ ls -l /dev/stdin /dev/fd/0     lrwx------ 1 tim tim 64 2011-08-07 09:53 /dev/fd/0 -> /dev/pts/2     lrwxrwxrwx 1 root root 15 2011-08-06 08:14 /dev/stdin -> /proc/self/fd/0     $ ls -l /dev/pts/2 /proc/self/fd/0     crw--w---- 1 tim tty  136, 2 2011-08-07 09:54 /dev/pts/2     lrwx------ 1 tim tim     64 2011-08-07 09:54 /proc/self/fd/0 -> /dev/pts/2        1. I was wondering if all the files under /dev and its subdirectories are all file descriptors of devices?   2. Why are there so many links from each other? For example, /dev/fd/0, /dev/stdin, /proc/self/fd/0 are all links to /dev/pts/2.   3. If `l` in `lrwx------` mean link, what does `c` in `crw--w----` mean?


title: How to repartition pendrive again?

text: My 8GB pendrive originally contained only a FAT partition, but I tried to install OpenSUSE 11.4 on it. I created a 200MB partition for `/boot` and the rest was for the root partition. Despite the minimal size of basic OS installation (490MB) I got errors during install stating the rpm couldn't unpack packages (around 20% of the install process). After several such errors (which included bash rpm) I gave up, and restarted computer. Now I have a pendrive with no partitions at all, and I am unable to create any. `fdisk` fails with error "fdisk: unable to read /dev/sdc: Invalid argument", `gpart` fails with error "Floating point exception", Windows 7 refuses to format it, and when I check the properties I see capacity 0, used 0, available 0 space, and so on. How can I re-partition this disk? ### Edit 1 dmesg output after inserting pendrive:               [ 9980.463056] usb 1-1: new high speed USB device using ehci_hcd and address 4     [ 9980.579456] usb 1-1: New USB device found, idVendor=0930, idProduct=6544     [ 9980.579460] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3     [ 9980.579462] usb 1-1: Product: TransMemory     [ 9980.579464] usb 1-1: Manufacturer: TOSHIBA     [ 9980.579466] usb 1-1: SerialNumber: 000FEAFB7A60C971F3D40B8A     [ 9980.579916] scsi12 : usb-storage 1-1:1.0     [ 9981.580536] scsi 12:0:0:0: Direct-Access     GENERIC  USB Mass Storage 1.00 PQ: 0 ANSI: 2     [ 9981.580738] sd 12:0:0:0: Attached scsi generic sg2 type 0     [ 9981.585276] sd 12:0:0:0: [sdc] READ CAPACITY failed     [ 9981.585279] sd 12:0:0:0: [sdc]  Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE     [ 9981.585283] sd 12:0:0:0: [sdc]  Sense Key : Illegal Request [current]     [ 9981.585287] sd 12:0:0:0: [sdc]  Add. Sense: Invalid command operation code     [ 9981.585766] sd 12:0:0:0: [sdc] Write Protect is off     [ 9981.585769] sd 12:0:0:0: [sdc] Mode Sense: 65 44 09 30     [ 9981.585772] sd 12:0:0:0: [sdc] Assuming drive cache: write through     [ 9981.590519] sd 12:0:0:0: [sdc] READ CAPACITY failed     [ 9981.590522] sd 12:0:0:0: [sdc]  Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE     [ 9981.590525] sd 12:0:0:0: [sdc]  Sense Key : Illegal Request [current]     [ 9981.590529] sd 12:0:0:0: [sdc]  Add. Sense: Invalid command operation code     [ 9981.591780] sd 12:0:0:0: [sdc] Assuming drive cache: write through     [ 9981.591783] sd 12:0:0:0: [sdc] Attached SCSI removable disk      ### Edit 2 Thank you for all responses. Just one clarification -- it wasn't just a try to run a distro for pendrive (however I did it before and it worked). I keep linux on pendrive just for some tests, I run it once a year maybe. But today I tried to get valid boot partition, the rest of the system was not important. But of course, if this is pendrive death case, what I wanted to do with it in future didn't matter for this poor thing :-)


title: Python set up on mac

text: My /usr/bin contains the following installs of python               lrwxr-xr-x  1 root  wheel     76 Nov 18 06:17 pythonw2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7     lrwxr-xr-x  1 root  wheel     76 Nov 18 06:17 pythonw2.6 -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/pythonw2.6     lrwxr-xr-x  1 root  wheel     76 Nov 18 06:17 pythonw2.5 -> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw2.5     -rwxr-xr-x  2 root  wheel  62752 Nov 18 06:17 pythonw     lrwxr-xr-x  1 root  wheel     82 Nov 18 06:17 python2.7-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config     lrwxr-xr-x  1 root  wheel     75 Nov 18 06:17 python2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7     lrwxr-xr-x  1 root  wheel     82 Nov 18 06:17 python2.6-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6-config     lrwxr-xr-x  1 root  wheel     75 Nov 18 06:17 python2.6 -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6     lrwxr-xr-x  1 root  wheel     82 Nov 18 06:17 python2.5-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5-config     lrwxr-xr-x  1 root  wheel     75 Nov 18 06:17 python2.5 -> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5     -rwxr-xr-x  6 root  wheel    925 Nov 18 06:17 python-config     -rwxr-xr-x  2 root  wheel  62752 Nov 18 06:17 python     lrwxr-xr-x  1 root  wheel     63 Mar  6 13:23 python3.2 -> /Library/Frameworks/Python.framework/Versions/3.2/bin/python3.2      I would have thought that python would be a link to any of the versions installed, but it is not. It appears to be a python executable               15:00:33 /usr/bin $ python -V     Python 2.7.1      Another install shows the same version               15:01:36 /usr/bin $ pythonw2.7 -V     Python 2.7.1      Checksums are, however not the same               15:02:15 /usr/bin $ sum python2.7     60959 35 python2.7          15:03:18 /usr/bin $ sum python     10360 62 python      **I wonder .. is it ok to actually**               rm python     ln -s python3.2 python      System: MAC


title: Recursive chmod only folders or only files via script or nautilus menu?

text: This has been discussed before here. What I'd like to know is how to turn these: Recursive chmod only files within this folder:               find . -type f -exec chmod 0600 {} \;      Recursive chmod only folders within this folder:               find . -type d -exec chmod 0755 {} \;      into a bash script, so it could be something like: For files:               rchmodf 744 .      For directories:               rchmodd 755 .      and... also maybe into a nautilus right click menu option if that's possible.


title: How do I get QEMU to open without a BadWindow error after ssh'ing with X11 forwarding?

text: After ssh'ing to a machine (with -X) I run qemu and get the following:               X Error of failed request:  BadWindow (invalid Window parameter)       Major opcode of failed request:  25 (X_SendEvent)       Resource id in failed request:  0x37d       Serial number of failed request:  14       Current serial number in output stream:  17      But I can run xclock or gedit without a problem. (So other programs work fine through X11 forwarding.) How do I get QEMU to run without this error?


title: How to completely rebuild boot partition with grub as well?

text: openSUSE 11.4, I have boot partition on pendrive. The problem is when I boot computer, grub immediately shows error "file not found" (I have no clue which file) and switches to "rescue mode". I can boot computer from another pendrive, but I would like to use the original one (the one mentioned above). I tried to refresh grub using Yast, or manually by executing               grub --batch < /etc/grub.conf      or by copying all the files from working pendrive to the non-working (editing device.map after that), still no success, "rescue mode" is all I see. I know one way to rebuild the content of the pendrive (it contains only boot partition) by reinstalling entire system again, and this will force building boot partition again correctly, but I am looking for something more clever. So, how to rebuild entire boot partition+grub, not just polish 2 or 3 files within it.


title: How do I find the overlap of two strings in bash?

text: I have two strings. For the sake of the example they are set like this:               string1="test toast"     string2="test test"      What I want is to find the overlap starting at the beginning of the strings. With overlap I mean the string "test t" in my above example.               # I look for the command      command "$string1" "$string2"     # that outputs:     "test t"      If the strings were `string1="atest toast"; string2="test test"` they would have no overlap since the check starts form the beginning and the "a" at the start of `string1` .


title: What is a command line alternative to top for finding current CPU utilization that isn't dependent on screen width?

text: If I run `top -p <myPID> -n 1` with a terminal that isn't wide enough, the CPU utilization % is omitted from the output. When trying to find a process' cpu utilization via bash scripting, this is a huge problem, as the script won't work if the terminal you're running it in isn't wide enough. `ps -oe pcpu,pid,cmd` will give me the total average cpu, but not a running utilization. Is there a command that I can use to get the current cpu utilization of a process that isn't dependent on terminal width?


title: fedora 15, oracle 11, python3: can't find or open libclntsh.so.11.1

text: I am trying to use `cx_Oracle` on `Fedora 15` with `Oracle 11`. I have install `Oracle` and `InstantClient` rpms and also `cx_Oracle` rpm for `CentOS`. I am exporting `ORACLE_HOME` and other like this:               export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe     export PATH=$PATH:$ORACLE_HOME/bin     export ORACLE_SID=XE      However, `libclntsh.so.11.1` lies here: /usr/lib/oracle/11.2/client64/lib/libclntsh.so.11.1 I wonder, if that is not the problem. However Oracle was already installed in this `u01` directory (I don't know what is it, on Ubuntu it installed in the right place). Could you suggest me, what I can do with this?


title: Switching on virtual display outputs using xrandr

text: Simply put, is there an inverse to the following command?:               xrandr --output VIRTUAL1 --off      This command cuts off my virtual display output to my external monitor, but I would like to reinitialize my virtual display output as well. DETAILS: I am using the solution to configuring external monitor on Nvidia Optimus machines here. I am having trouble moving between single (laptop) display and extended monitors using xrandr. I use the following script to move to a single monitor setup:               xorg_process=$(ps aux | grep 'Xorg' | grep -v grep | awk '{print $2}')     sudo kill -15 $xorg_process     sudo rmmod nvidia     sudo tee /proc/acpi/bbswitch <<<OFF     xrandr --output VIRTUAL1 --off      and moving back to external monitors (without rebooting), I use this script:               sudo tee /proc/acpi/bbswitch <<<ON     sudo modprobe bbswitch     optirun true     intel-virtual-output     xrandr      Yet I get the following error at `optirun true`:               [16929.676769] [ERROR]Cannot access secondary GPU - error: [XORG] (EE) Server terminated successfully (0). Closing log file.          [16929.676811] [ERROR]Aborting because fallback start is disabled.      If I remove the line `xrandr --output VIRTUAL1 --off` in the first script, then I am able to execute both scripts to switch back and forth between two and one monitor setups without error, except that the one monitor setup still 'sees' the external monitor without displaying it. So, I need `xrandr --output VIRTUAL1 --off` to cut off the virtual display, but I also need to reinitialize it as well. Is there a way to undo the command `xrandr --output VIRTUAL1 --off` when moving back to external monitor setup?


title: High-level user on Media Temple DV managed server (Plesk)

text: I've recently set up a DV Managed server from Media Temple. I'm not sure if my question is specific to Media Temple, Plesk or Linux in general. I'm open to alternatives but basically what I am trying to do: **Usecase** : I'd like to have 1 "high-level" ssh login that has access across all domains associated with the DV server. I'm currently deploying sites for clients using git/github/ssh. In Plesk, I create Customers > Subscriptions (I add their domain(s) and user here). This creates a domain in the `var/www/vhosts/` directory. I'd like to have one ssh login that I can use to cd and git pull in that directory. Ideally I don't create a new user for each customer and set up ssh to work appropriately with git. I chatted with Media Temple a few times and they pointed me in a few directions but nothing really seemed to work. One article seemed to say what I wanted: > This example will create an SSH user with access to the /var/www/vhosts/ > directory, which is where all of your website files are kept. but after creating a high-level user, that user still does not have access to directories (domains) inside the `/vhosts/` directory Root would work, but I'm not comfortable always logging in as root. I could also forgo the Customers/Subscriptions and just put everything under 1 company - but that sort of defeats the purpose of how Plesk is set up with subscriptions. I'm sure that's all about as clear as mud. **Update** : I am using Plesk v11.5.30 in the Service Provider view.


title: Linux from Binaries

text: I thought Linux from Scratch was a pretty cool tutorial, but I felt having to wait for everything to compile was a bit nerve-wreaking. Is there a tutorial similar to LFS except pre-compiled binaries are used whenever possible? I would imagine that if you were running a specific liveCD (e.g. Ubuntu) you could just copy over a lot of the pieces of the liveCD for the system you're building (e.g. kernel, libraries, executables, etc.).


title: Basic OS for Wireless Transmitting & Receiving

text: I'm looking for some directions on where a good place is to start, on a project that I am starting. Basically I'm looking to make a stripped down OS that:   1. Transmits a wireless signal.   2. Picks up that signal. How would one go about this. Any directions? Thanks! **EDIT** I guess it would just be an embedded device. Part 1 would be like a "wireless card" that would run on its own and just "boot up" and look for a predetermined router or something and connect to it. Then the part that catches the signal would allow it to connect. That's it. I figured that the "router" part could be loaded on a computer.


title: upstart-udev-bridge is using 100% CPU (and a known fix doesn't help)

text: I'm running Linux Mint 12 on a Latitude D630 and every time I start my laptop (and sometimes when I come back from being suspended), `top` shows that `upstart-udev-bridge` is using 100% CPU (and if I do nothing about it, the fan starts running at full and eventually it would presumably overheat). I can stop it with `sudo stop upstart-udev-bridge` but I don't want to have to do that every time I start up. I tried this fix (which so far as I can tell works for everyone else who's had this problem), but it didn't seem to do anything. The problem's still there.


title: SSH to a host and enter password with shell script

text: I want to create a file like this : sshTOhost :               #!bin/bash     ssh -D 1500 user@host     #enter password (I don't know how)      can any one help me?


title: Setting environment variables for system users

text: I have a couple of system users that have no password set, login disabled and no home directories. They are used solely to run FastCGI processes for a couple of websites. I want to avoid hard coding in sensitive data into the source code such as passwords and wanted to use environment variables instead so the question is how do you set environment variables for system users with no home directory and no login ability. Normally I'd just put them in ~/.bashrc but obviously that won't work. I also can't put them in /etc/bashrc since that would mean all users would see the sensitive information. Has anyone got any suggestions at all? This is on Ubuntu Server 12.04 LTS if that makes a difference. Edit: As per the comment below I'm using Nginx for the HTTP server.


title: List all DNS Servers, including those pushed by VPN

text: I want to know which DNS servers are in effect when I run commands like nslookup, dig, host, ping, etc. The general answer is to `cat /etc/resolv.conf`, or to look at NetworkManager, but that's only going to show me the list of servers that I normally use. It won't show me any DNS servers that got pushed to me when I connect to a VPN. Is there a way to get an in-order list of DNS servers that commands like nslookup, dig, host, ping, etc will attempt to use?


title: How to property configure DNS . . . from a conceptual perspective

text: I'm not looking for actual tools or techical how to type answers here. I'm in a complex networking environment, and I'm trying to understand the constraints on my choice of a hostname / domain / DNS service for my host. I'm running a debian system in an environment where most people run corporate windows boxes that are "managed" by it. There appear to be several domains around. I would like to know what constraints should be informing my choice of which domain to particpate in, what hostname I can choose, etc? Note, the DNS that is configured if I use DHCP is NOT accessible to me. However, I have access to a different DNS that I can add records to myself. If this matters . . .


title: booting stops at "[OK] Reached Target Graphical Interface" after uninstalling NVidia drivers

text: I've installed drivers from nVidia Graphics Drivers repo in OpenSuse 13.1. The drivers didn't work well so I've uninstalled them. After this X-Windows would not start at all, with the last message:               [OK] Reached Target Graphical Interface      What happened?


title: How do I prevent access to a sub-directory on an NFS share?

text: I am trying to prevent access to a subdirectory on an NFS share. The directory structure is this:   * Downloads      * TV     * Software     * Books My /etc/exports file currently has this line:               /Downloads 192.168.10.0/24(rw,async,no_subtree_check)      This allows me to access the Downloads folder on my client machines and **all** its subdirectories. How do I prevent access to /Downloads/Software but still keep access to the other subdirectories?


title: IPtables string match

text: I'm trying to write iptables _string match_ rule To block **http://domain.com:8888** and **https://domain.com:8888** when it matches the supplied string in the rule. And another rule to redirect the ports also from 8888 to 7777. I tried following rules but unfortunately didn't work:               iptables -A INPUT -p tcp -s 0.0.0.0/0 -m string --string linuxcore --algo bm --sport 8888 -j DROP     iptables -t raw -A PREROUTING -m string --algo bm --string linuxcore -p tcp -i eth0 --dport 8888 -j DROP     iptables -t nat -A PREROUTING -p tcp --dport 8888 -m string --algo bm --string "linuxcore" -j REDIRECT --to-port 7777     iptables  -A INPUT -t nat -p tcp --dport 8888 -m string --algo bm --string "linuxcore" -j DROP


title: bash: disable new process PID message

text: It may look like this: `[2] 2847`. I guess the first digit is just an enumeration of processes created from the shell. The second is the PID. Anyway, I never care about that information so it is just annoying to see. Is there a way to turn it off? (I found that `set +bm` in `.bashrc` disabled the process termination message.)


title: Append timestamp to top command output

text: All,   I'm using               top -l 0 -s 1  -pid XXX -stats rsize | awk 'NR%13==0; fflush(stdout)' > output.txt        to store the rsize value of a process in a file. Currently the contents of output.txt look like this:               3828K+        3832K+       3836K+       3840K+       3840K        3840K         I would like to modify this one-liner to include timestamp along with the value. How do I modify the awk part of the above one-liner and add timestamp to it? The resultant output should look like this:               1338936728 3828K+       1338936729 3838K      I'm on a Mac OSX. I would like to make a timestamp Vs rsize plot.


title: How to access my Mageia web server VirtualBox guest from my host system web browser?

text: I have installed and setup a guest Mageia 2 on VirtualBox which I plan to use as a development web server. My host is Windows 7 (64-bit) and I want to access the web sites from this host web browser. I have set VirtualBox Network setting of Mageia guest OS to "Bridged Adapter" and I took the IP address of `eth0` and entered that on my host web browser. But I am getting a timeout so I am thinking that the host and guest OSes are not communicating. Prior to using Mageia, I had a Debian guest OS with the same setup and when I entered the IP address of the guest `eth0` to my host web browser, the "It works!" page is shown. And I did not do any configurations. I am thinking that it has something to do with the security features of my Mageia guest OS. Just a note, the Mageia guest OS is a minimal install -- no GUI and just the bare packages are installed along with the LAMP packages. So everything is CLI. I don't know where to start in getting access to my web server guest OS from host OS. Any tips?


title: access external hard drive to delete folder on terminal Mac

text: I want to delete a folder of portable hard drive on terminal in Mac. Are there any command line ?


title: why the second log files on /var/log are not compressed

text: the logs on `/var/log/` (Debian/Ubuntu) are stored as               x.log     x.log.1     x.log.2.gz     ...      like kernel logs, syslogs, etc. I see that as the log info increases, they are stored by splitting into smaller files (rather than keeping all in a single file). I wonder why the second file (`x.log.1`) is not compressed? Is it something to do with accessing more recent logs easier?


title: emacs org-mode clocktable - clock-in clock-out columns

text: Is there a way to configure the summary clocktable to have two extra columns for clock-in and clock-out times.               | Headline                                  | Clock-in | Clock-out | Time   |      |     |-------------------------------------------+----------+-----------+--------+------|     | *Total time*                              |          |           | *0:51* |      |     |-------------------------------------------+----------+-----------+--------+------|


title: zsh expand-or-complete for all files regardless of command/context

text: zsh has a feature where command line tab-completion performs context-aware completions, so you can do things like:               # Good:          $ wget g<tab>    # becomes:     $ wget gopher://          $ wget --hea<tab>    # becomes:     $ wget --header=      I like that feature, but sometimes it prevents me from completing filenames in contexts where zsh thinks something else is more appropriate:               # Bad:          $ file vs-debug.apk     vs-debug.apk: Zip archive data, at least v2.0 to extract     $ adb push v<tab>     # becomes:     $ adb push version      I have `^I` bound to `expand-or-complete` (the default widget). What I would like is to have a different key perform unfiltered filename expansion, eg:               # Desired behaviour:          $ adb push v<shift-tab>     # would become:     $ adb push vs-debug.apk      Nothing I saw in zshzle(1) looked appropriate, but I tried the following other widgets anyway:   * `expand-or-complete-prefix`   * `menu-expand-or-complete`   * `expand-cmd-path`   * `expand-word` I don't want to lose the context-aware completion. Any ideas for how I can perform unfiltered filename expansion/completion using an alternate key binding? I am using zsh 5.0.2 (x86_64-apple-darwin12.4.0) and zsh 4.3.17 (i686-pc- linux-gnu).


title: When using expect: SSHFS Transport endpoint is not connected

text: When I run my SSHFS connection script from bash, everything works perfectly. However, when I run the same script using the `expect` utility, I get the following error when I try to access the folder mount location:               Transport endpoint is not connected      Here is my expect script:               #!/usr/bin/expect -f     spawn standard_sshfs_connection_string_or_script     expect "password: "     send "my_password\r"      **Q:** Any Ideas? Note:   1. I've first already called: `fusermount -u mount_location`   2. Is there something about `spawn` creating a new process, perhaps the sshfs process closes prematurely? (Is there any way to ensure the sshfs process stays open?)


title: Interactive command usage reference: do you generally have that on Unix?

text: The question of why some commands rely on `manpages` whereas others rely on something like the `\--help` flag for providing command usage reference is not new. There is usually a difference in scope between _documentation_ for a command and a _command usage synopsis_. The latter is often a subset of the former. But even when most commands and utilities have manpages for instance, there exists differences in their formatting of the synopsis section which have very practical implications when trying to extract such information. In other cases one might find clues with the `strings` utility when a command has seemingly no documentation. I was interested with the commands I have on this _QNX_ platform and discovered the `use` command1 to display usage information. As explained in `usemsg`, the framework involves setting a standard usage record in the utilities source and once compiled this can be accessed with the `use` command and you can also wrap the native functionality etc. It is quite convenient as I could simply do               use -d dir >>file      on `/base` and `/proc/boot` to extract all the usage for all the commands on the system basically. So I then briefly looked at the source for GNU coreutils ls and FreeBSD ls to see if they did something like that and the former puts usage information in some _usage_ named _function_ (for `\--help` I guess) while the latter doesn't seem to put it anywhere at all(?). * * *   * Is this sort of solution(`use`) typical of what you find with _commercial Unix_ to present command usage reference interactively?   * Does POSIX/SUS recommend or suggest anything about presenting/implementing command usage reference in commands(as opposed to specifying notation for shell utilities)? * * * 1.`use` command:               use     Print a usage message (QNX Neutrino)          Syntax:     use [-aeis] [-d directory] [-f filelist] files          Options:     -a         Extract all usage information from the load module in its source form, suitable for piping into usemsg.      -d directory         Recursively display information for all files under directory.      -e         Include only ELF files.      -f filelist         Read a list of files, one per line, from the specified filelist file, and display information for each.      -i         Display build properties about a load module.      -s         Display the version numbers of the source used in the executable.      files         One or more executable load modules or shell scripts that contain usage messages.


title: Can I setup a local webserver using ArchLinux and VirtualBox

text: I intend to create a local webserver using ArchLinux and VirtualBox for testing purposes.   I just wonder if Arch Linux has what it takes to create a fully functional webserver?


title: Monitor bandwidth usage from different virtual hosts

text: I've got a VPS running Ubuntu and Apache and hosting several sites on it using virtual hosts. It would be very interesting to monitor which of these sites takes the most power and bandwidth, I've been looking for a tool for that but haven't found any. Do you guys know a tool or a way to do this?