title: how to edit and color bash's tab completion list

text: Following is what i would like to have. When the tab completion is ambiguous, and bash prints the list of possibilities. I would like it to colour the next character I should press inside every word in the list. Following is what i have done so far. In my .bashrc i have defined the following function and have called the complete command               _colourunique() {         local word=${COMP_WORDS[COMP_CWORD]}         COMPREPLY=($(compgen -f -- "${word}"))         if [[ "$word" ]] && [[ ${#COMPREPLY[@]} -gt 1 ]]; then             local  w             local  i=0             for ((i=0;i<${#COMPREPLY[@]};i++)) ; do                 w=${COMPREPLY[$i]}                 n=${#word}                 COMPREPLY[$i]="${w:0:n}\033[91m${w:n:1}\033[0m${w:$((n+1))}"             done         fi     }          complete -D -F _colourunique      But it is not working... When i type               ls D[TAB]      It autocompletes as               ls D\033[91m      Instead of listing the possibilities Documents, Desktop etc. What could be going wrong here? Or is there some other direct way to accomplish this? ### UPDATE 1: I think i understand what is happening here. Since i add \033[91m to every word in COMPREPLY, bash sees this part is common to all, and autocompletes that common term into the command prompt itself. (instead of simply printing the list) So I don't think this method of editing COMPREPLY array is the way to do it. Is there any other method? ### UPDATE 2: To preserve the uniqness, i tried to add a $i and \b in the string.               COMPREPLY[$i]="${w:0:n}$i\b\033[91m${w:n:1}\033[0m${w:$((n+1))}"      Now it prints the possible tab completions as following.               D0\b\033[91mo\033[0mwnloads  D1\b\033[91me\033[0msktop      Which means, the list is printed as such. There is no evaluation of \b or \033[91m characters. :-( ### UPDATE 3: Since the replies looks like, there is no way to accomplish what i want in bash (unless i shift to zsh). I decided to settle for another option. I will try to append the next unique key stroke to end of every word, so that it stands out. Following is the code so far.               SanitiseString () {         local String="$1"         local j         for j in \\ \! \@ \# \$ \% \^ \& \* \( \) \+ \{ \[ \] \} \| \; \: \" \' \, \? \ ; do             String=${String//"$j"/\\"$j"}         done         echo "$String"     }          _colourunique() {         saveIFS=$IFS         IFS=$'\n'                                            local word=${COMP_WORDS[COMP_CWORD]}         COMPREPLY=($(compgen -f -- "${word}"))         if [[ "$word" ]] ; then             local  w             local  i=0             for ((i=0;i<${#COMPREPLY[@]};i++)) ; do                 w="${COMPREPLY[$i]}"                 n=${#word}                 w=$(SanitiseString "$w")                 if  [[ ${#COMPREPLY[@]} -gt 1 ]] ; then                     COMPREPLY[$i]="$w :${w:n:1}"                 else                     COMPREPLY[$i]="$w"                 fi             done         fi         IFS=$saveIFS     }          complete -D -F _colourunique      This will print the options with the next unique keystroke separated by : But the code still has two irritating issues. which i have to solve   1. It no longer appends the / at the end of autocompleted directories   2. It no longer does the intelligent spacing after the auto complete. Any suggestions?


title: Failed to check FreeRDP file descriptor

text: Using `xfreerdp` version 1.1.0:               oshiro@debian:~$ xfreerdp --version     This is FreeRDP version 1.1.0-beta1 (git n/a)     oshiro@debian:~$      I am getting the following error message:               oshiro@debian:~$ sudo xfreerdp /v:farm.company.com /d:company.com /g:rds.company.com /u:rds_username /p:rds_password /f     connected to rds.company.com:443     connected to rds.company.com:443     TS Gateway Connection Success     Got stub length 4 with flags 3 and callid 7     ...     Got stub length 4 with flags 3 and callid 192     WaitForSingleObject: unknown handle type 6715497     connected to rds.company.com:443     connected to rds.company.com:443     TS Gateway Connection Success     Got stub length 4 with flags 3 and callid 7     ...     Got stub length 4 with flags 3 and callid 22     Failed to check FreeRDP file descriptor     Got stub length 4 with flags 2 and callid 6     WaitForSingleObject: unknown handle type 0     oshiro@debian:~$       Anyone know how to stop the following error message coming up?               Failed to check FreeRDP file descriptor     Got stub length 4 with flags 2 and callid 6     WaitForSingleObject: unknown handle type 0      I have tried version xfreerdp 1.2.0, but that doesn't even load an rds window. xfreerdp 1.1.0 at-least shows the rds window for a short while until the above message is shown.


title: What's the difference between CONFIG_R8169 and CONFIG_R8169_VLAN?

text: .config from `/usr/src/linux-2.6.38.8` contains:               CONFIG_R8169=m     CONFIG_R8169_VLAN=y      What's the difference between `CONFIG_R8169` and `CONFIG_R8169_VLAN`?


title: Verify semantic integrity of filesystem

text: I just started up my linux box to find that one of my filesystem's had errors: I had to login as root to run `fsck` and hit `y` repeatedly. There were a _lot_ of errors. So many that I used silly putty and a Rubik's cube to hold down the `y` key (Using the auto-yes options isn't allowed in these kinds of cases). Even with with the `y` key held down, it took a couple of hours for it to finish the check, but when it did the system booted and I am able to access this file system. So as far as the computer is concerned, the file system in question is fine. But what I'd like to know is whether or not all of my files on it are fine. This particular filesystem has several thousand images on it, and I did a quick sanity check that I can view some of them, but I can't manually check every file to make sure its intact. Is there some way, either general or specific, that I can verify that none of the files on my filesystem were damaged? The filesystem is ext3.


title: When did directories stop being readable as files?

text: I have the 1st edition of The Unix Programming Environment book. In chapter 2, the authors state that directories are readable as files, and mention some facts about the format of these files. They give some usage examples such as `cat .` (in exercise 2-2). At least in Darwin, directories are no longer readable as files. At least, they appear to be zero-length files when read. When did this change occur, and is there any official documentation about it?


title: How to use 7z to compress via pipe?

text: I'm using this for creating backups securely (? - is it really secure? with a good password?):               # ENCRYPT     ORIGDIR="DIRECTORYNAMEHERE"; tar cvf - "${ORIGDIR}/" 2>/dev/null | gzip -9 - 2>/dev/null | openssl aes-256-cbc -salt -out "${ORIGDIR}.tar.gz.aes"          # DECRYPT     openssl aes-256-cbc -d -salt -in "ENCDIRECTORYNAMEHERE" | tar -xz -f -      **Q:** But how can I do this using 7z with max compression rate? Creating temporary files besides the only OUTPUT file is not good, because if I need to compress ~100 GByte sized files/directories on a 180 GByte FS I wouldn't have enough free space (if ex.: the compressed file would take ~60 GByte).


The Debian/Ubuntu package search pages are very useful to look up what version of a program is available in what distribution series, how programs are split along multiple packages etc. For example I want to investigate what version of `g++` is available in current Ubuntu: http://packages.ubuntu.com/search?keywords=g%2B%2B&searchon=names&suite=maverick&section=all I directly see that the default version is 4.4.4, also available is 4.5.1. In Natty it is 4.5.1: http://packages.ubuntu.com/search?keywords=g%2B%2B&searchon=names&suite=natty&section=all Via http://packages.ubuntu.com/natty/g++ you can browse coveniently through the dependencies and directly see which architectures are supported. You can also search the contents of the packages. For Fedora I've found https://admin.fedoraproject.org/pkgdb Searching for g++ returns nothing: https://admin.fedoraproject.org/pkgdb/acls/list/ _g++_ Ok, perhaps it is split differently: https://admin.fedoraproject.org/pkgdb/acls/list/?searchwords= _gcc_ This yields results and it seems that there is only one big `gcc` package which includes `g++`: https://admin.fedoraproject.org/pkgdb/acls/name/gcc But this is not true. Using `yum search` on a Fedora 14 system yields:                 gcc-c++      (which includes g++) Without access to an actual Fedora system, do I really have to somehow expect this and browse down into the package git tree to get the same information? I mean like this: http://pkgs.fedoraproject.org/gitweb/?p=gcc.git;a=blob;f=gcc.spec;h=683faf0cb3d528bd53fe6a4024fda3e84cc986d0;hb=HEAD (and then search for '%package' ?) The https://admin.fedoraproject.org/pkgdb/acls/name/gcc shows me that a gcc package is available in Fedora 13 and 14 but it does not show:   * the dependencies   * the actual versions   * the architectures   * sub-packages Ok, I can see the versions via going to https://admin.fedoraproject.org/updates/gcc Thus my question: What is the Fedora equivalent to the Debian/Ubuntu package search pages? What do you use to look similar information up? And what about getting this kind of information for other rpm based distros like Cent OS or RHEL?


title: Application-specific keymapping

text: In general, I want to make specific keymaps for application, that working only in it and doesn't affect any other app. For example, I already use my Caps key to toggle input language (via xorg.conf), but I want Capslock to behave like Esc in vim. Looks like xmodmap doesn't have any options related to that. I use Gnome and would also appreciate any third-party applications.


title: How to know the "level" of shells I am in?

text: If I open a terminal like `xterm` I will have a shell. Then if I use `ssh` or `zsh` I will have another "level" of shell. Is there a way to know how many times I have to `Ctrl+D` or type `exit` to exit all of them? My real intention is to exit everything except the "root" shell. It will also be nice to know what effect(s) terminal multiplexers (like `screen`) have on the solution. PS: Please feel free to change the title, I don't know if those are the correct terms.


title: Diff dpkg files with local copies

text: Is there a way of diffing the dpkg files with the one that are actually installed? Or barring that a way to find ones that have been modified?


title: ssh and character encoding

text: When I `ssh` into my VPS, I have `irssi` running in screen. When someone sends a unicode character (such as © or €), `irssi` displays garbage when I use it via the screen in a `ssh` session. If I connect to that `irssi` using irssi's proxy module, from irssi running on my local computer, it shows up correctly. Likewise, if I run ghci on my VPS (outside a screen) and enter in one of those characters, it crashes. So, obviously, there is a character encoding issue of some sort with my connection to my VPS, either in ssh or the system setup. How can I find out what is causing this, and solve it? Details: **Client system**   * Arch Linux x64    * UTF-8 encoding **VPS system**   * Ubuntu Server 10.04   * Unknown encoding used. How do I find this? (I just have to look in my /etc/rc.conf for Arch)


title: SSH reverse tunnel works except when I use a VirtualBox instance at one end. Why does VB break SSH?

text: VirtualBox seems to break my SSH ProxyCommand... here are the details: I want to open an SSH connection from my laptop to desktop over an SSH (reverse) tunnel. I want to do that in one step using ProxyCommand (and netcat). It works when run from the installed OS on my laptop. It fails when run from a VirtualBox guest on my laptop. My normal setup is that Kubuntu 12.04 is running in VirtualBox on the desktop and Kubuntu 12.04 is installed directly on my laptop. This works fine. However, if I try to do the exact same thing with a Kubuntu 12.04 VirtualBox instance on my laptop, it fails as I will detail below. Here's what my SSH tunnel looks like:               laptop--->nat--->middleman<--nat<--desktop      The desktop & laptop run Kubuntu 12.04 regardless of whether I'm using VirtualBox; and the middleman is Ubuntu 8.04. I'll describe my SSH tunnel in more detail. Regarding this leg:               middleman<--nat<--desktop      ...here is how it is established:               autossh -M 5234 -N -f -R 1234:localhost:22 user@middleman.com      That part is automatic and trouble-free. From the laptop:               laptop--->nat--->middleman      I can connect to middleman and then from the middleman to the desktop in two steps under all conditions:               me@laptop:~$ ssh -i ~/.ssh/id_rsa admin@middleman           admin@middleman:~$ ssh -i ~/.ssh/id_rsa localhost -p 1234      To do this in one step I use netcat ("nc") on middleman and I edit my SSH config file on laptop to use ProxyCommand and nc:               me@laptop:~/.ssh$ nano config      The contents are:               Host family_desktops       ProxyCommand ssh middleman_fqdn nc localhost %p       User admin       PasswordAuthentication no       IdentityFile ~/.ssh/my_id_rsa      Where `middleman_fqdn` is like "middleman.com" Then I just connect to "desktop" in one step:               me@laptop:~$ ssh family_desktops -p 1234      Here's the problem. This works when run directly from my laptop (where Kubuntu 12.04 is installed). But when I run it from VirtualBox instance of Kubuntu 12.04 (guest) on my laptop, it does not work. SSH asks for the password for middleman. There is no password set up, so I cannot connect. The strange thing is that running the two separate commands allows me to connect to my desktop and it doesn't ask for a password. The `ssh -vvv` option shows no errors and nothing helpful. I have been troubleshooting all day and I cannot find any difference in settings between the VirtualBox instance and the host OS on my laptop. I use the exact same id_rsa keys (public & private), the same user, and auth.log on the middleman server indicates it sees the same IP address in both cases. So why would running VirtualBox on my laptop make this SSH tunnel stop working (at least working in one step)?


title: Controlling process priorities

text: I have recently started trying to control stepper motors with the Raspberry Pi. I have succeeded in getting motion. The problem I am having though is that it seems the stepper motor is missing steps and operates very rough. I took my project to a local hacker space here in Chicago "Pumping Station One" to see if the CNC build club could help clue me in on the problem. Their opinion was that certain processes are taking priority and always executing that it may be causing the issue. I hooked my stepper up to an Arduino Uno and the stepper motor performed wonderfully. There was also mention of the Pi not having a RTC on it and the `delay()` function I use in my code for the pulse width might be getting out of sync. Has anyone experienced anything like this before? Is there anything you know of to test these theories? Maybe another explanation?


title: What is the simplest way to connect to wireless on a Debian system with nothing but essential?

text: I have a Debian Jessie system which, for reasons unrelated to this question, has nothing installed but the set of essential system packages. What is the simplest method for connecting to a wireless network? If it matters, my network is using WEP (yes, I know it's bad to use WEP). Bonus points if you suggest an answer requiring the _least number of packages needed_ (including dependencies), because I have to manually download every one of these. I've installed `wireless-tools`, `wpa_supplicant` and `isc-dhcp-client`, and messed around, but got nowhere. I've been able to set my link to up with `ip link set up wlan0`, but that doesn't actually get me to the point where I can input a password to connect to the router.


title: Alternative for "locate" on debian

text: I often use "locate" command on CentOs to find files. What's the alternative for this command on Debian ?


title: Booting from install disk, no USB keyboard

text: I'm trying to install Arch Linux on a new system with a Gigabyte GA-Z87N-WIFI board. Although I can use the USB keyboard (and mouse) in the BIOS, the keyboard doesn't seem to work at all once I boot off the boot DVD. There are several people who've solved this problem by enabling IOMMU in the BIOS. I couldn't find an option called IOMMU, but I found VT-d, which I believe is the same thing. It's enabled. Also, Arch detects my (wifi) network card and attempts to run DHCP on it. I don't know if this is relevant, but I think I remember reading that if IOMMU is disabled network cards aren't detected. EDIT: I tried disabling UEFI in the BIOS, just in case... No change. I still have no keyboard. EDIT 2: I think maybe appropriate kernel modules for my USB controllers aren't available (or aren't loading?) I went into hardware info from the install disk boot menu, and under PCI Devices, I can see three USB controllers. The "product" line reads: 8 Series/C220 Series Chipset Family EHCI Vendor is Intel Corporation. Module is unknown. Maybe this is the issue? Most other devices have modules listed. EDIT 3: This seems to be an issue with the install disk kernel, apparently it doesn't support the Logitech unifying receiver: https://bugs.archlinux.org/task/35991 The kernel mentioned in that bug report is in fact on the current 01/08/2013 install disk, and I have a unifying receiver. I managed to boot a Gentoo minimal install disk off a USB stick and the keyboard was fine. So I think I've answered my own question. Unless anyone has anything to add...?


title: Howto run interactive commands, as another user

text: I'm trying to write a bash script that   * context switches to another user (root, in this case)   * executes a set of commands to _i._ create a user (interactively prompting invoker for username) then _ii._ sets the password on that user    * gets a return value   * then carries on doing stuff, with that return value  I've so far tried an << EOF input ( _fig.1_ ), a function ( _fig.2_ ), and pulling / running a separate script ( _fig.3_ ). However I haven't gotten the results I need. Any help here? Hope I've explained it clearly.               sudo su - << 'EOF'     # do stuff...     EOF      _fig.1_               function myfunc()     {         local  myresult='some value'         echo "$myresult"     }      _fig.2_               sudo su - -c bash <(curl -fksSL https://<my-script-location>.sh)      _fig.3_


title: Zip folder without including path to folder and require only one argument

text: I'm trying to make a zip function that'll do all the steps I typically do when zipping a file or folder. Say my current directory is `~`, and I want to zip a folder named `Folder1`, whose file path is `~/Folder2/Folder1`. Issuing               cd ~/Folder2 && zip -r Folder1 Folder1 && cd -      does exactly what I want. Namely, it zips so that the output `Folder1.zip` does not contain folders that lead up to the folder I'm zipping (namely, `/home/user/Folder2`), it zips recursively, and it takes in the first argument of zip with the exact name as the file or folder I'm zipping (`Folder1.zip`). So I want to make a function in my `.zshrc` something akin to               coolerzip() { cd /path/to/file && zip -r file file && cd - }      where it need only take in one argument, which in this case, it will be `~/Folder2/Folder1`. Then `Folder1` will be the name for both `file`s in `coolerzip`, and I will `cd` right into `~/Folder2` so `Folder1` lies in my current directory before zipping. Is there any way I can achieve this so that `coolerzip` only requires one argument rather than three?


title: How to create a user with minimalistic permissions on OpenBSD?

text: I want to run the webbrowser (xxxterm) with a different user (XY) on an OpenBSD Desktop (different user from the one I use daily). I will reach the Browser with ssh -X in the local machine (or are there any better solutions?). The webbrowser needs NO audio, NO flash, NO html5, NO JAVA, NO plugins, NO JAVASCRIPT, etc. How can I create a user with the smallest possible permissions? Are there any tricks? (does the user only needs to be in his group, and not else?) Googled a few hours for keywords/tricks that I need to "expand" (mini howto to it) later:               mount /home with nodev, nosuid, noexec AND/OR with read-only option?     set high umask for users that are not XY     minimal groups needed for user     regularly check that the user isn't in the sudoers file     no o+rwx on the files in the system or suids     **restricted shell for the user?**     systrace restrictions? (or doesn't worth it?*)     pf limitations - user uid only needs http https ftp dns - no other network needed for any user besides root     put the webbrowsing in a qemu vm??     security/limits.conf - ulimit for the user?     chroot the xxxterm?     xxxterm as shell? (instead of ksh?)     only let a few dozen MByte quota for the user or zero?     guest session like? - start with a clear QEMU guest or chrome directory at every chrome exit/start?     privoxy for filtering chrome traffic? (proxy can be set to anything by the XY user..)     can pf limit that what process can use http https ftp dns?        * http://www.lightbluetouchpaper.org/2007/08/06/usenix-woot07-exploiting-concurrency-vulnerabilities-in-system-call-wrappers-and-the-evil-genius/ if this howto is completed it could be useful when having a ~~zombie~~ terminator apocalypse :D


title: Are Ubuntu PPA Repositories usable on Debian wheezy?

text: I'm using Debian wheezy and i wonder are Ubuntu PPAs hosted at Launchpad safe to be added & used on Debian?


title: Using URLs with parenthesis with Lynx

text: I often use Lynx on a remote computer to look at websites (faster than port- forwarding). Sometimes the URLs I want to go to have un-escaped characters (for example brackets) that Lynx seems to need encoded. for example `http://www.example.com/This(URL)is anExample.html` should be `http://www.example.com/This%28URL%29is%20anExample.html`. Is there an existing script for this? Alternatively is there some option for Lynx that would make it unnecessary?


title: How to have a pop-up window for password appear when opening application?

text: We have build `wireshark` adding some functionality related to our use, in Scientific Linux 6 system. After this when I start this using normal user, it will not allow me to use the network interface. I have to login via root to do the same. Is there any way that when I click on `wireshark`, and before the application starts a GUI will appear asking for the password for root? The same as when we open `Firewall`. Can I do this using a shell script?


title: How does ssh -X function?

text: When using `ssh -X` is the executable copied and run locally or is it run on the host machine. Since it is called X11 forwarding it makes me think that the window is drawn on my machine but running on the host.


title: What are the reasons Slackware still refuses to include PAM?

text: I know that Pat Volkerding didn't include PAM back in the day when it was considered by some to be messy or inconsistent, although that doesn't really seem to be the case today with PAM being standardized accross distributions. What are the reasons for Slackware not including PAM in recent versions of Slackware? Are there any other distributions that abstain from incorporating PAM?


title: Is there an alternative to CUPS?

text: When printing with Linux is there an alternative to using CUPS? After using it for a couple of weeks printing suddenly stopped working. The 'processing' light would come on and that would be the end. CUPS would list the job as finished. I cannot find any solution that works.


title: Automatic logging of scripts executed by users

text: That's a recurrent question of my workmates. We are a team of many people which works in the same Unix and Linux servers. The recurrent questions is if there are a log or something similar by default in the linux/unix OS where see when a user launch a sh/ksh script or any other executable program in the server. For example, Susan executes `write.ksh` at 10h23, Paul executes `files_rights.sh` at 11h03 and Yves executes `./rename_files` at 13h12. The sysadmin is on holidays but he will arrive tomorrow and want to see who execute what and when he/she did it.


title: Toggle touchpad in HP ProBook 4530s

text: I have a small problem. I installed Ubuntu 11.10 on my HP laptop and among some problems, I'm trying to solve a touchpad problem. It's working, but I can't toggle it on/off. In Suse Linux Enterprise Desktop (which was preinstalled) and Windows, the touchpad could be enabled/disabled by touching the left upper corner. In Ubuntu I touched that area many times, but nothing happened. I also tried to install SLED drivers from HP site using (first I converted the RPM package to a Debian package and then installed it, but that didn't fix the problem, I just have "Touchpad" in unity, when I'm typing "synaptics" but when I clicked - nothing happened.) How to fix this problem?


title: How can I bind multiple tmux commands to one keystroke?

text: Specifically I'm trying to give a notification after some command was completed. So, for example, if I reload my configuration file, I'd like to have some confirmation that it worked, which might be done something like this:               bind R source-file "$HOME/.tmux.conf" && display-message "Configuration reloaded."      _That_ , however, doesn't work. Nor do any other things I tried as ways of stringing commands together.


title: change owner of a file and it's parent directories

text: I have a file that has 10 parent directories. When I change the file's owner with `chown` command new owner still can't write to file because the file's parent directories still have a different owner. Is there a way to also change parent directories' owner? If not, what's the best way to temporarily grant a user permission to change a file inside nested directories?


title: Installing git "sudo: apt-get: command not found"

text: I am trying to install git. I run the following command: `sudo apt-get install git-core git-gui git-doc` But receive the following error: `sudo: apt-get: command not found` What should I do?


title: mode-specific emacs keybindings

text: I'm trying to get `emacs` (23.3 on Arch Linux) to map `Ctrl`+`F12` to the built-in "compile" function when in C-mode (actually CC-mode, which comes built-in as well). So far I've tried the following:               (defun my-c-mode-common-hook (define-key c-mode-map (kbd "C-<f12>") 'compile))     (add-hook 'c-mode-common-hook 'my-c-mode-common-hook)      and:               (eval-after-load 'c-mode       '(define-key c-mode-map (kbd "C-<f12>") 'compile))      But neither works; I get `<C-f12> is undefined`. Based on what I've read here, here, and here, I can't see why it isn't working. Any thoughts?


title: How do I update IcedTea?

text: I've only been using Linux for about a month. I'm running Mint 13. I'm trying to use www.goproblems.com but it tells me that my IcedTea is out of date. I hoped there was a package but I can't find it. I tried building it from source but that failed. I read that it requires GTK+, but when I checked that out, the site said GTK+ is dependent on 5 other packages that I might have to install, from source. My question is: **If there is an IcedTea package, where is it?** (Also, can someone recommend an online resource that teaches me how to do this well?)


title: How to get mplayer to play from stdin?

text: Why doesn't this work?               cat /dev/video1 | mplayer -      If I could get that to work, then I could play & record video at the same time using 'tee' to feed mplayer and mencoder. I want to play live video (from /dev/video1:input=1:norm=NTSC) and record it at the same time without introducing lag. mplayer plays the video fine (no noticeable lag). mencoder records it fine. But I can't figure out how to "tee" the output from /dev/video so that I can feed it to both at the same time. (I know ways to encode it, then immediately play the encoded video, but that introduces too much lag). If mplayer and mencoder would read from stdin, then I could use 'tee' to solve this. How can I do it? [BTW, I'd be happy with ANY solution that plays & records at the same time, as long as it doesn't add lag - I'm not wedded to mplayer. But encoding first and then playing adds lag.]


title: Creating a Live USB for Crunchbang

text: I am looking to run one of my computers on Crunchbang Linux, but I cannot seem to be able to find a way to create a live USB of it.


title: mdadm; previously working; after "failure", cannot join array due to disk size

text: ## Abstract I had a functional Raid 5 array, I rebooted the box, and then mdadm couldn't re-assamble one part. Seeing that it was only one part, I thought it would be easy to just re-sync. But that turned out not to work, because apparently now the device is not large enough to join the array!? ## Initial Raid Setup Sadly rather complicated. I have a Raid 5 combining two 3 TB disks with two linear raids (consisting of 1tb+2tb). I did not partition the disks, that is, the raid spans physical discs. In hindsight this is probably what caused the initial failure. ## After the fateful reboot mdadm would refuse to assemble one of the linear arrays, claiming that there existed no superblock (checking with mdadm --examine on both didn't return anything). Stranger yet, apparently they still had some partitiontable remains on them. At this point I thought that the quickest solution would be to just re-create the linear array, add it to the bigger raid5 array and then have it re-sync. Hence I opted to just remove those partition table entries, that is: partition them to freespace. And then I created a linear array spanning both of the disks.               # mdadm --create /dev/md2 --level=linear --raid-devices=2 /dev/sda /dev/sdc      However, when trying to add them back to the array, I get               # mdadm --add /dev/md0 /dev/md2             mdadm: /dev/md2 not large enough to join array      So I am I correctly guessing the disks shrank? ## Counting blocks I guess it's time for some block counts! The two components of the linear array:               RO    RA   SSZ   BSZ   StartSec            Size   Device     rw   256   512  4096          0   1000204886016   /dev/sda     RO    RA   SSZ   BSZ   StartSec            Size   Device     rw   256   512  4096          0   2000398934016   /dev/sdc      If mdadm's linear mode would have no overhead, the sum of the two sizes would be bigger than one of the 3tb drives (3000592982016). But that is not the case: /proc/mdstat reports that the linear array has size 2930015024, which is 120016 less than the required               # mdadm --detail /dev/md0 | grep Dev\ Size     Used Dev Size : 2930135040 (2794.39 GiB 3000.46 GB)      But that... is terribly fishy! Before rebooting (an albeit earlier incarnation) of this linear array was part of the bigger array! ## What I believe happend After the reboot, mdadm recognized that a part of the array was missing. Since it was the smallest member, the array device size was automagically grown to fill up the next smallest device. But that does not sound like uh, sensible behavior, does it? An alternative would be that for some reason I am no longer creating the maximum size linear raid, but... that's sort of nonsensical as well. ## What I have been pondering to do Shrink the degraded array to exclude the "broken" linear array and then try to --add and --grow again. But I am afraid that does not change the device size actually. Since I do not understand what exactly went wrong, I would prefer to first understand what caused this problem in the first place before doing anything hasty.


title: disable apt-listchanges (and other interactive stuff) during upgrades (reliably)

text: I have to admit, I really _really_ hate apt-listchanges. If I'm going to do a huge dist-upgrade, I want to just leave the computer there for a few hours. The asker of this serverfault question had a similar goal in mind, bu after implementing all of the suggestions in that post, I was still hit by `apt- listchanges`. Why is it so difficult to achieve non-interactivity with `apt`, an otherwise excellent program, given that the Unix philosophy aspires to it? I am hoping the changes I made to `/etc/apt/listchanges.conf` will help, but I want suggestions as to how to reliably do upgrades without any interaction whatsoever.               [apt]     frontend=none     email_address=root     confirm=0     save_seen=/var/lib/apt/listchanges.db     which=news      This is the command I used was               DEBIAN_FRONTEND=noninteractive \     apt-get \     -o Dpkg::Options::="--force-confnew" \     --force-yes \     -fuy \     dist-upgrade      I also added the following lines to `/etc/dpkg/dpkg.cfg`               force-confold     force-confdef


title: Fedora installer doesn't see my Windows 7 partitions

text: I tried to install Fedora 17 on the same disk I have Windows 7. First I got the message, that there are no free space to create partition, even in Windows part of disk was marked as unallocated. I spent two days to get to know that there's something like dynamic disc. OK. I converted it to basic one using EaseUs tool, which took about 20 hours. Ok, no problem. Now I have basic partition, but Fedora (also GParted) didn't see it. It acts like there was not any partition on my disk and wants to wipe it. I don't want to lose my Win7 partition and data. What should I do? This is how Win7 sees it (sorry for Polish language): http://i46.tinypic.com/259ansz.png This is how GParted sees it: http://i47.tinypic.com/i3c5dv.jpg Message from Fedora is: > "We could not detect partitions of filesystems on this device. This could be > because the device is blank, unpartitioned or virtual. If not, there may be > data on the device that can not be recovered if you use it in this > installation. We can remove the device from this installation to protect the > data." I'm getting really frustrated wasting my time on such stupid things. I have no idea what to do. Can anyone help?


title: Need help understanding to errors in /var/log/messages

text: Recently I've been checking my log and found two weird errors which I don't understand. The first one: `May 22 08:11:00 localhost dbus: [system] Rejected send message, 1 matched rules; type="method_call", sender=":1.25" (uid=42 pid=2827 comm="gnome-power- manager) interface="org.freedesktop.Hal.Device.LaptopPanel" member="GetBrightness" error name="(unset)" requested_reply=0 destination=":1.7" (uid=0 pid=2155 comm="hald))q` The second one (this one repeats a lot): `May 22 16:14:55 localhost NetworkManager[1991]: <warn> error requesting auth for org.freedesktop.NetworkManager.enable-disable-wwan: (6) Remote Exception invoking org.freedesktop.PolicyKit1.Authority.CheckAuthorization() on /org/freedesktop/PolicyKit1/Authority at name org.freedesktop.PolicyKit1: org.freedesktop.DBus.Error.NameHasNoOwner: Remote Exception invoking org.freedesktop.DBus.GetConnectionUnixUser() on / at name org.freedesktop.DBus: org.freedesktop.DBus.Error.NameHasNoOwner: Could not get UID of name ':1.49': no such name` Does anyone know what those mean?


title: Intel 82845G Video Crash workaround

text: I have the Intel 82845G video card and trying to get X11 working with it. It routinely crashes with artifacts. I know the existing history with this driver and X11 and I am about to buy a replacement video card but decided I will check here first to see if anyone has had any success with it. I tried it with Linux Mint XFCE, and Crunchbang openbox. I made sure the BIOS onboard video memory is at max, and different options in `xorg.conf` like disabling DRI. Eventually I want to use awesome wm. Will changing the wm have any effect on video crashing, or is this solely a problem between Intel's driver and X11 ?


title: What exactly is PKGBUILD and should I edit it when installing packages?

text: Whenever I use `yaourt -Syua` in my Manjaro Linux system, it'll give me               Edit PKGBUILD ? [Y/n] ("A" to abort)      and sometimes               Edit chromium-pepper-flash.install ? [Y/n] ("A" to abort)      Somewhere I read to just say no to editing these files. The wiki : https://wiki.archlinux.org/index.php/PKGBUILD Says the `PKGBUILD` is just some switches to alter when installing, so is it alright to just leave it default? I haven't found information about the `.install` files, what are they?


title: Open/Libre Office: Restricting Impress to PowerPoint-compatible content?

text: Is there a way to restrict the Open/Libre Office presentation-program Impress to just PowerPoint-compatible content? Preferably in a way that "shadows-out" or removes non-compatible animations and trans(... whatever) between slides. I made a presentation and saved it as a ppt-file, only to discover that several of my animations and ... had been removed/replaced - I assume because they were unsupported by PowerPoint. Alternatively, is there a list of compatible content?


title: How to let sendmail preserve plus detail for .forward?

text: I have a normal sendmail installation. A user has a `.forward` like this:               # cat ~elrond/.forward     elrond@somewhere     # sendmail -bv elrond+extra@localhost     elrond@somewhere...  deliverable: mailer esmtp, host somewhere., user elrond@somewhere      Note that the `+extra` is lost. What do I need to change to make the `+extra` be preserved? The usual `%3` for hashmaps does not work in the `.forward`.


title: What happens when I press "Shut Down" from the GUI?

text: I have been banging my head against this for quite a while now. It's related to this question. I would like to find out exactly what happens when I choose to shut down my Linux box from the GUI. This seems to be poorly (if at all) documented. Ideally, I'm hoping for a DE- and OS-agnostic answer. Barring that, I'm interested in the specific case of Mandriva 2010.1 and Debian 6.x (Squeeze) and 7.0 (Wheezy) all running Gnome. (If you're paying close attention, yes that's Gnome 2 and Gnome 3) Basically, I would like to know which command/script/sequence of scripts is started when I press "Shut Down" or "Restart" so I can modify their behavior. Some forum posts I looked at suggest hacking `/etc/polkit-1/*` but this directory structure is only a skeleton on my Debian (Squeeze) box, for example. Can anyone help? * * * **EDIT** **What I have tried so far**   * Replaced the `shutdown` executable with a script of my own. This doesn't work: when I press `shutdown` Gnome logs out without executing my script.   * Tried editing the Gnome 2 menu. No joy: the "Shutdown", "Log out" and "Lock Screen" options do not appear in the menu editor.   * Looked at `/usr/share/menu`, nothing helpful there. **Possible avenues for the solution**   * `strace`ing the GUI options (is this even possible?)   * Looking at `shutdown`'s source code   * Looking at `gnome-session`'s source code * * * **Update** As per my comments on the answer below, I have looked into `polkit` actions under `/usr/share/polkit-1/actions/` and found (in the file `org.freedesktop.consolekit.policy`) an action called `org.freedesktop.consolekit.system.stop-multiple-users` that throws the message               System policy prevents stopping the system when other users are logged in      I'm thinking (due to the `org.freedesktop.*` naming convention) that this is some kind of signal sent to the DM via D-BUS. Moreover, this message appears when trying to shutdown graphically while other users are logged in, so the mechanism that triggers it must be the same mechanism triggered when "Shut Down" or "Power Off" is selected from the GUI. Can anyone confirm/refute? Is there a possibility of somehow intercepting this signal or modifying it?


title: How/why can Firefox packages work on all Linuxes?

text: How/why can a Firefox 64bit (or 32bit) package work on different Linux distributions since each Linux distribution has a different version for gcc, glibc, linux kernel, etc. ?


title: mdadm raid1 and what chunksize (or blocksize) on 4k drives?

text: I want to use two 3 TB drives in a mdadm raid1 setup (using Debian Sequeeze). The drives use 4k hardware sectors instead of the traditional 512 byte ones. I am a bit confused because on the one hand the kernel reports:               $ cat /sys/block/sdb/queue/hw_sector_size     512      But on the other hand `fdisk` reports:               # fdisk -l /dev/sdb     Disk /dev/sdb: 3000.6 GB, 3000592982016 bytes     255 heads, 63 sectors/track, 364801 cylinders     Units = cylinders of 16065 * 512 = 8225280 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes      Thus, it seems that the kernel has some idea that the drive uses 4k sectors. The `mdadm` man page is a bit cryptic about the chunk size and raid1: > >        -c, --chunk= >               Specify chunk size of kibibytes.  The default when  creating > an >               array  is 512KB.  To ensure compatibility with earlier > versions, >               the default when Building and array with no persistent > metadata >               is  64KB.   This  is  only  meaningful  for RAID0, RAID4, > RAID5, >               RAID6, and RAID10. >   Why is it not meaningful for raid1? Looking at `/proc/mdstat`, the raid1 device md8 has 2930265424 blocks, i.e.               3000591794176/2930265424/2 = 512      Does `mdadm` use then a blocksize of 512 bytes? (/2 because it a two-way mirror) And is chunk-size a different concept than blocksize? Trying to let `mdadm` _explain_ a device:               # mdadm -E /dev/sdb -v -v     Avail Dev Size : 5860531120 (2794.52 GiB 3000.59 GB)     Array Size : 5860530848 (2794.52 GiB 3000.59 GB)      Where               3000591794176/5860530848 = 512      With a default `mkfs.xfs` on the md device, it reports:               sectsz=512     bsize=4096      I corrected this with a call of `mkfs.xfs -s size=4096 /dev/md8` **Edit:** Testing a bit around I noticed following things: It seems that the initial resync is done with a block size of 128k (and not 512 bytes):               md: resync of RAID array md8     md: minimum _guaranteed_  speed: 1000 KB/sec/disk.     md: using maximum available idle IO bandwidth (but not more than 200000 KB/sec) for resync.     md: using 128k window, over a total of 2930265424 blocks.      The displayed speed via `/proc/mdstat` is consistent for that blocksize (for 512bytes one would expect a performance hit):               [>....................]  resync =  3.0% (90510912/2930265424) finish=381.1min speed=124166K/sec      (For example when disabling the write cache the displayed speed immediately drops to 18m/sec) Under `/sys` there are actually some more relevant files besides `hw_sector_size`:               # cat /sys/block/sdb/queue/physical_block_size     4096     # cat  /sys/block/sdb/queue/logical_block_size     512      That means that the drive does not lie to the kernel about its 4k sector size and the kernel has some 4k sector support (as the output of `fstab -l` suggested). Googling a bit around resulted in a few reports about WD disks, which do not report the 4k size - fortunately this 3 TB WD disk does not do that - perhaps WD fixed their firmware with current disks.


title: What encryption to use for good performance?

text: I will install Ubuntu 11.04 to an encrypted VolumeGroup with the installer: http://i.stack.imgur.com/Skil9.png AES   Blowfish   Serpent   Which one is the fastest from these 3? Or Using AES with only a 128 bit key gives the best performance/speed? Does someone has a graph/statistics about them? (or e.g.: what is the performance/speed difference between using an encrypted VG or not using encryption at all.) If there aren't any statistics about this, then how could I do one? What tests are there on the "market"? Thanks.


title: Options for .hidden files?

text: What options exist for the `.hidden` file? I wanted to hide certain filetypes in a folder, but simply putting `*.out`, which I assumed would hide all files ending in `.out`, didn't work. :( I'm using Nautilus. UPDATE: I guess if this option doesn't exist, a bash shell could be created that, when executed in a directory, finds all files with matching endings and writes them to the `.hidden` file. I don't have any experience with the command-line but I'll try this :).


title: What is the fastest Virtualization solution for Linux?

text: Is it still XEN? Or is it VirtualBox, KVM, VmWare or else? With fastest I mean that the guest VM is fast (the smallest speed loss because of Virtualization)


title: Shell output help

text: What is the output of `date -u +%W$(uname)|sha256sum|sed 's/\W//g'` (on Arch Linux if it matters)?   How do I find that out?


title: Arch Linux installation- partitions help

text: While trying to set up partition from Arch Linux installation CD(using cfdisk) itself the following error showed up- > Bad primary partition 2: partition ends in final partial cylinder How do I fix it?


title: Kernel freezes on loading ramdisk. How to find out what's wrong?

text: I'm using an Ubuntu Server (13.04) Minimal installation (with the Xubuntu Metapackage as a desktop environment, if that matters) on x86_64 on my Samsung notebook. I'm currently forced to use the no-longer-maintained version of the proprietary AMD graphics driver (fglrx-legacy) as the open-source "radeon" driver heats the card 15°C more in idle. That's why I'd really like to try kernel 3.11 with the new power management features for AMD cards. The problem is, once I install a mainline kernel the system freezes after selecting the kernel in Grub with the messages:               Loading Linux 3.11.0-laptop ...     Loading initial ramdisk ...      And nothing happens. How can I find out whats wrong? Are there any logs from that early in the boot process stored somewhere? Some more information: The system works perfectly with the Ubuntu Raring Kernel self-compiled from Git (which is based on 3.8). It doesn't work with mainline Kernel 3.9 or 3.10 (same problem). I also tried a pre-compiled "generic" version of 3.10, doesn't work either. I have 4 partitions on the hard drive: `/boot` (unencrypted), `/`, `/home` and `swap` (all LUKS/dm-crypt encrypted). The notebook is a Samsung NP-R522H. The GPU is a Mobility Radeon HD 4650.


title: How do I add ncmpcpp search results to the current playlist?

text: Using the `ncmpcpp` MPD client, in the search function (F4) how can I add all the search results to the current playlist short of adding each item one-by- one? For example, say I search for all music where _genre == "instrumental"_. The help tells us to use `space` to add an item to the playlist, but what about the other 1,500 songs found? I'd like to add all search results to the playlist.


title: Is it safe to delete the quota.user file?

text: Is it okay to delete the `quota.user` file from the root directory? This file is 2.7GB in size and I need to wipe it from the system. I ran:               $ quotaoff -avug     $ mv quota.user quotaold.user     $ quotaon -avug     $ mv quotaold.user /another/place      So far all seems well. I was looking for a way to truncate this file but couldn't find anything so I decided to just try removing it instead. I am running _CentOS_ release 5 (Final) on Xen using cPanel.


title: Where have I set my bash PATH?

text: I want to remove `~/bin` from my PATH. I set it up months ago when Linux (Ubuntu) was very new to me, but I don't know how I added it... Nothing shows up when I search all the files listed below.   Where else could it be being set? It is being pre-pended after `$HOME/.profile` prefixes PATH with `$HOME/bin` If it makes any difference, I get the same PATH from both the command-prompt and a running script.               #!/bin/bash     {       echo "first dir of PATH is: '${PATH%%:*}'"       shopt -s nullglob       cat \         /etc/profile \         /etc/bash.bashrc \         /etc/profile.d/*.sh \         $HOME/.bashrc \         $HOME/.bash_aliases \         /etc/bash_completion \         $HOME/.bash_completion* \         $HOME/.profile \         $HOME/.profile_zap \         $HOME/.bash_profile* \         $HOME/.bash_login* \       | sed -rne '/~\/bin/p'     }      Output is:               first dir of PATH is: '~/bin'


title: Replacing multiline consecutive tags with a single line using sed and ignoring white spaces

text: I have a large XML file with several tags. One of the sub tag is as below:               <Products>       <SubProduct>    ----> this line is problem         <SubProduct>             <Name>One</Name>         </SubProduct>         <SubProduct>             <Name>One</Name>         </SubProduct>         <SubProduct>             <Name>One</Name>         </SubProduct>         <SubProduct>             <Name>One</Name>         </SubProduct>         <SubProduct>             <Name>One</Name>         </SubProduct>       </SubProduct>   ----> this line is problem     </Products>       As seen above, the Products tags will have multiple SubProduct tags. However, an extra SubProduct opening and closing tag is appearing as mentioned above (with comment 'this line is problem'). The solution would be to search for two consecutive open SubProduct tags and two consecutive close SubProduct tags and replace one in each with space. How can I achieve this using `sed`? How can I search for two consecutive tags where the tags are on separate lines as well as I do not know how many spaces will be present between the two consecutive tags (it could be 5 spaces or 10 spaces before or after the new line character).


title: How do I start a process with a nice value of -20 and not give it root privilege?

text: I would like to start a process with a nice value of -20. This requires me to use a command like - `sudo nice -n -20 matlab`. However, this starts matlab as root too. Is there a way to have matlab as non-root? My current approach is -`sudo nice -n -20 sudo -u myusername matlab` \- which, to me looks like a hack. Is there a direct approach to do this?


title: Using bash shell function inside AWK

text: Is it possible to use bash function inside AWK somehow? Example file (string, int, int, int) ` Mike 247808 247809 247810 ` Trying to convert values from decimal to hexadecimal. Function defined either in .bashrc or in shell script. `awk '{print $1 ; d2h($2)}' file` awk: calling undefined function d2h input record number 1, file file source line number 1


title: Strange temporary network outage in Linux

text: I'm facing a very annoying problem that I noticed a week from now and for which I can't find an answer: my network suddenly stops responding, usually coming back exactly 25 seconds later. I was using kernel 3.10.4 and now migrated to 3.11-rc4 to see if something changed, but no, the behavior is the same. And since it is a hard to spot problem due to the fact usual web surfing is in "bursts" and the outage is completely random, I can't really tell this problem was present in a previous kernel as well (I always use custom but unpatched kernels from kernel.org, all compiled by myself) I can't tell the kernel is the culprit either, but I can say there are no clues on the system logs (I checked both `/var/log/syslog` and `/var/log/messages` and there is nothing unusual there) and that hardware doesn't seem at fault, for the problem shows up using either one of my network cards: `lspci output:`               02:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5751 Gigabit Ethernet PCI Express (rev 01)     04:00.0 Ethernet controller: 3Com Corporation 3c905B 100BaseTX [Cyclone] (rev 30)      and I already tried to exchange the ethernet switch ports and still no one else where I work has a problem except me (although we use similar machines, I'm the only one using Linux, so I had to take some infamous jokes about it as well... hehe). I ran up wireshark on my machine and left it continuously pinging our gateway and another machine on the same network segment. Then, at the first sign of network malfunction I would check it and verify the gateway stopped responding pings, but the other machine was still there responding normally. Some other times is the other machine which stops responding and the gateway is fine, and some other times both stop responding. I don't know what else to do, so I'd like some help or tips on how to further debug this, since the system logs are completely normal. I have my kernel config file and a capture file from wireshark showing the situation. I can post here or at some pastebin site in case anyone finds it useful to understand the case, just please let me know the detail level I should use (I guess the packet level without the raw data would be enough).


title: Why do I get error "Could not chdir to home directory"

text: I work in support, and occasionally I'm given shell access to a remote Linux system. I frequently find that when the admin gives me remote access, that I get the following output upon login.               [joe@mycomputer ~]$ ssh bob+ldap@foo.edu     bob+ldap@foo.edu password:     Creating directory '/foobar/users/bob'.     Unable to create and initialize directory '/foobar/users/bob'.     Last login: Mon Jul 29 13:05:27 2013 from bar.edu     Could not chdir to home directory /foobar/users/bob: Input/output error     -bash: /foobar/users/bob/.bash_profile: Input/output error     -bash-4.1$          -bash-4.1$ echo $HOME     /foobar/users/bob      The admins I interact with know way more about Linux than I do. My questions are:   1. Why do I get "Unable to initialize directory"?     * Is that an error on their part, or is that intentional for security? I'm assuming they ran `useradd bob` without the -m option when they created my account.    2. Why is my shell name 'bash-4.1' and not 'bob'?  **Update**   I'm guessing that because I am not a normal user on the system, I don't have a network share foobar/users, just local storage. It seems strange that such a high percentage of servers I log into would configure their server the same way. * * * _Resources I have investigated_   * http://www.chc-3.com/charles/remote_access.htm   * http://www.nomachine.com/products.php   * http://superuser.com/questions/349142/remote-access-to-linux-server-from-windows


title: Pop-up event reminders in Korganizer, when synchronizing with Google Calendar

text: I have "connected" my Google Calendar with Korganizer. I create an event within my Google account. I want pop-up reminders to show up when I go home, even though the events weren't create by KOrganizer but were synced. I don't know if I did something wrong, but the events created by Korganizer don't have pop-ups either. I did check toggle reminder on. Any ideas?


title: Getting more details in ALSA volume

text: I've bought some new speakers, and they play much louder than my old ones. It's so much that I most of the time keep them at 1% to 3% in alsamixer, which is -103dB to -84dB. This obviously leaves little room for details in configuration. 3 options in total. What I would like is to be able to set them at 1.6% or 2.3%. Or even better: to tweak the function mapping percentages to dB, so I could make the load "area" take up less "room" in the percentage scale. Do you by any chance know if alsa supports this level of configuration?


title: How to setup default browser?

text: How to change default browser for opening url-s ? For sanity check, I tried:               xdg-open 'http://unix.stackexchange.com'      And it opens in other browser. I found information about assigning applications to filetypes with `xdg-mime default xpdf.desktop application/pdf` . However I don't know how to apply this knowledge for `url` ? Does `url` have mimetype ?


title: Where is the default icon used by Gnome when no icons are found?

text: Just to experiment, I moved the folder               /user/share/icons/      away, as in saved it on a USB drive and deleted it from Linux. Now, all icons are shown as the default "white" icon. Where is this icon stored? Can I modify it to change its appearance? I am using CentOS Linux desktop with gnome.


When looking at lsof output, what does "0t0" mean?


title: How to figure out where a link gets redirected

text: I currently working on a script that updates a file. The file has several versions. The important ones have static links. These get redirected to the actual file which then gets downloaded using `wget`. I have figured out that `wget` has a flag whcih prints the headers recived. There is a list of Locations. The last location meantoned in the header is the actual URL. I need to get that! My idea was to use `wget -S` to get the header (I need another flag that prevents the file from downloading and creating). Then use a pipe to parse the lines and catch the last line containing `location`. I guess this could be realized by using `grep -l -i "location:" | tail -l`. Then I should be left with a single line that can be easily parsed. So the command would look something like this:               # The -??? flag is the one that prevents the file from downloading. (I don't know it)     Location=$(wget -S -??? $URL | grep -l -i "location:" | tail -l)      My question what flag do I have to use to not download the file with `wget` or is there another way/command to accomplish this?


title: Granting SAMBA rights and privileges requires root password

text: Given a default Ubuntu installation, I get the following               myusername@EARTH:~$ sudo bash     root@EARTH:~# net rpc rights grant myusername SePrintOperatorPrivilege     Enter root's password:     Failed to grant privileges for myusername (NT_STATUS_ACCESS_DENIED)      Is there any workaround or do I really have to resort to unlocking the root account and setting its password?


title: Connect 2 laptops together in dualhead mode?

text: This probably isn't possible, but I thought I should ask just incase I'm wrong. Is it possible to connect 2 or more laptops together and drag files/folders from one screen to the other as if you were using a dual/triple/quad head graphics card on a single computer? I'm using Ubuntu 10.04.


title: eldoc makes emacs use 100% cpu

text: When I use eldoc, I add this to `.emacs`:                (add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)      (add-hook 'lisp-interaction-mode-hook 'turn-on-eldoc-mode)      (add-hook 'ielm-mode-hook 'turn-on-eldoc-mode)      and then when I use Emacs, it uses 100% CPU. But when I delete this code in `.emacs`, my Emacs works. Does anyone have any idea about this? Or how to debug the problem. Or something else to substitute for eldoc?


title: samba security share && user

text: This is my smb.conf:               [global]     workgroup = myworkgroup     netbios name = mercurio     server string = fileServer     security = share     map to guest = Bad User          [Share]     comment = Carella di condivisione globale     path = /home/share     guest ok = yes     public = yes     writable = yes      Everyone has r/w access to this folder and it is ok. Now I need to share another folder but with only some users. I think I must change security options but it is in the global section! there are some other problem. here the config:               [secure folde]     comment = Secure folder     path = /home/secure     valid users = ignazioc      but from my mac i see this message http://dl.dropbox.com/u/31437518/Screen%20Shot%202012-02-10%20at%2015.50.15.png (file not found) and this is the folder               drwxrwxrwx  4 ignazioc ignazioc  4096 Feb 10 09:39 secure/


title: What is the recommended way to build an apt mirror with multiple versions of packages?

text: We have a local apt mirror built with `apt-mirror` and it's working nicely, but since it considers valid only the latest version of every package, if there's the need to downgrade one of them (because of a regression or whatever) we can't rollback to the previous one, we can only go back to the first version available. For example, we are having a problem with Thunderbird 24.5.0 and we'd like to go back to 24.4.0, but:               $ apt-cache show thunderbird | grep Version     Version: 1:24.5.0+build1-0ubuntu0.12.04.1     Version: 11.0.1+build1-0ubuntu2      What is the recommended way to build an apt mirror that keeps more versions of the same package available?


title: What is ".xsession" for?

text: What is the purpose of the `.xsession` file in the home folder? What should be put in there? The desktop environments don't use that file and for the X startup from the tty there is `.xinitrc`.


title: What tools can I use for PDF indexing?

text: In our working group we used Recoll on a Ubuntu PC to index all the PDF. For a while we moved everything to a Redhat server. Is there a Recoll alternative which doesn't requires a GUI adn support searching through a web interface?


title: apache2 gui / Comanche Replacement

text: I opened an OLD redhat book to the section about Apache configuration and it talked about the Comanche GUI. I thought "That's great! Why hasn't anyone suggested that before?" Then I found out that project is (apparently) dead. Is there anything else like it that is still in development? If the answer is "Google it", I'd appreciate a hint as to what search terms to try.


title: Where to put `setxkbmap` command in Xfce?

text: What is the proper place for `setxkbmap` command in Xfce? What is the proper place for it in general - other DEs and bare WMs? I have the following command:               setxkbmap -layout "us(colemak), ru(typewriter)" -option "grp:menu_toggle"      Putting it in `.xsession` didn't work. I want to make this command run, to make it work globally in GUI. **Edit (18.09.12):** I went `xfce4-settings-manager` -> `Session and Startup` -> `Application Autostart`, then clicked "Add". There i tried to put two commands to make it work.   1. The full `setxkbmap` command that i gave above verbatim under "Command".   2. Created an executable file with the command in my PATH, put the file name under "Command". Both variants didn't work. However the _full path_ to the executable file with the command under "Command" text field worked.


title: Software distribution

text: I have a set of servers with Red Hat on board and an internal software (it is set of many files with configs and so on) that is in permanent development. There are several types of servers:   * development   * testing   * post-testing   * production There are up to 10 servers in each category, but each server works separately and doesn't depend from others. Furtermore in each stream I can have a minor subversions that are tagged in cvs repository. So I can't just build an testing.rpm for all testing servers and prod.rpm for all productions. Anyway I can see several ways to do that:   * Make own rpm repository, automatically build a set rpm packages for every server type and its subversion and use a cron to update a package.   * Use a shell script with own config on each server to do that   * Make update manually :) Which one is better? Or all of them are completely wrong and there is another way? :)


title: Storing `find` parameters in a variable

text: I'm running the following bash command:               find . \( -iname '*.aif' -o -iname '*.pdf' -o -iname '*.exe' -o -iname '*.mov' \         -o -iname '*.doc' \) -exec rm -f {} \;      I'm running the same parameters in another call to `find` later on in the script. Is there any way to store the `\( -iname '*.aif' -o -iname '*.pdf' -o -iname '*.exe' \ -o -iname '*.mov' -o -iname '*.doc' \)` part in a variable?


title: Best place to get nVidia driver update for CentOS 5.5

text: What is the best place to get an updated nVidia video driver for CentOS 5.5? Is there a CentOS package available that will update it? Or is it best to download it directly from nVidia? Also, I do not have an internet connection on the machine, so it will have to be a manual download and installation. Thanks, DemiSheep


title: only display df lines that has more fs usage then 80%

text: root@SERVER ~$ df     Filesystem  512-blocks  Free    %Used   Iused   %Iused  Mounted on     /dev/YXCV   655360      365632  45% 6322    13% /     /dev/ASDF   3801088     670648  83% 41759   32% /usr     /dev/ASR    1048576     500496  53% 5555    9%  /var      how can I pipe the df commands output to only display lines that has more usage then 80%? e.g.: it would only display:               /dev/ASDF   3801088     670648  83% 41759   32% /usr


title: Can the menu of emacs still be accessible in terminal?

text: when running Emacs inside terminal emulator, there is a menu bar on the top. ![enter image description here](http://i.stack.imgur.com/6daxX.png) Can we select a menu item, expand it and select a sub-menu item? Under Xemacs, we can, but I haven't found a way under Emacs in terminal yet. Thanks.


title: Does Fish have a "magic space"?

text: I gather that bash has a "magic space" function, where if I do e.g. `sudo !!<space>` it will blow in `sudo ./my_last_command`. Does something similar exist in fish?


title: Excluding a directory when zipping files

text: I've got a bash script that does something like this:               zip -0 ../backup/backup.zip \     -r ./* \     -x \*CVS\* \     -x *Thumbs.db* \      The directory it's backing up is a SVN archive (it used to be CVS back in the day). I've been unable to get it to exclude .svn and it's contents. What's the cleanest way to exclude .svn (recursively through the entire tree)?


title: Get system notification at a certain time?

text: Is there a way, in Linux or FreeBSD, to receive notification from system at a specified time? I'm thinking something in like of what inotify in Linux does for filesystem events. There IS a way to that using cron, but I'm asking if there is a lower-level interface that can be called programatically. If cron is an 'official' Unix interface for this kind of task, I'd like to know that, too.


title: Using relative paths in recoll

text: I am using recoll to index my files locally and so far it works really well. However, I'd like to have the paths be relative to the recoll.conf or recoll index directory so that I can move the files around as I see fit. Is this possible?


title: How can I randomize file names in a given directory?

text: Ok, this may sound like an odd request but it really has a good purpose! I have a Panasonic Plasma TV with an SD card slot, via which I can display a slideshow of JPEG photos. This is useful for preventing burn-in, if I step away from the TV for a few moments while cooking, or if I answer the phone, or whatever, it's handy to just start the slideshow to prevent a static image from showing up, and also let me see photos while I do something else. The problem is the slideshow always starts from the first photo alphabetically, meaning I always see the same images and never get to the end. What I'd like to do is have a script on my Unix machine which I can run on the SD card (mounted at `/media/sdcard`) and have it randomize the names of all the files under that directory. Doesn't _really_ matter how it randomizes them but I'd _prefer_ purely numeric names (for no apparent reason) Is there an easy way to accomplish this? Something like `find /media/sdcard -exec mv {} rand() \;`? For bonus points, any way to prevent the script from _overwriting_ two files in the event that there's a collision? These are copies of photos so if I lose one I still have the original, but still that would be inconvenient...


title: Is transferring files between android phone and linux supposed to be a easy task?

text: I want to copy some movie files from my Linux PC to my Android phone, however, it is much more easy to copy from Windows to my Android phone. In Windows, my phone would mount its internal memory card and SD card automatically, allowing me to transfer files between them. With my Linux distro, it always shows an error whenever I plug my phone in to the PC with a USB cable, then it may take some minutes to mount the internal memory card and SD card. Sometimes it fails to mount them too. I am wondering is this really a pain to do files transfer in all Linux distros, or if some other distro would perform better. I am using Linux Mint 13 Mate. If a newer distro could make my day easier I might switch over to it. My phone is an HTC One SV without rooting. P.S. As I remember, the first error message is "Error initializing camera: -60: Could not lock the device". Really it said camera even I am connecting a phone to it. Then I need to wait for some minutes and hope the SD card would mount successfully.


title: Move Data from Partition to Partition on Same Drive

text: Moving data from one drive to another is slow. Copying data on a drive to it's self is slow. Moving data from one drive to it's self is fast. If I'm moving data on the SAME drive but a different partition, shouldn't it be fast? I assumed the move would be a fat table change and not an actual move (copy/delete) of the data on the disk. How can I make sure this is what happens? FYI I'm on mac osx and I'm dealing with two fat32 partitions on the same external.


title: after enabling Xinerama (in AMD condor Dual-Head Graphics Card) the system graphics hangs

text: I have a problem in my AMD Condor Dual-Head Graphics Card When I enable Xinerama from "System → Preferences → AMD Catalyst Control center (Administrative)" my RHEL Server 6.3 (x64) Graphics hangs. I need to choose disable it from console `Alt`+`Ctrl`+`F2`, login as root, off Xinerama from `xorg.conf`. While switching from initlevel 3 to initlevel 5 I got following error.               Loading TSI condorvc device driver moduleinsmod: error inserting '/lib/modules/video/condorvc-mod.ko'': -1 File exists


title: How to mount remote file system

text: I want to mount my Windows `NTFS` share C:\ to Linux `ext4` file system, so I can see the file system tree as part of my Linux file system and transfer my files. PS. I am using `rhel6`.


title: how to multiply column of one file by column of anothe file?

text: I want your help in multiplying columns of one file by column of other another file where both files have the same number of columns and rows. I want the script to multiply the first column of the first file by the first column of the second file, the second column of the first file and the second column of the second file and so on. Here is my sample data and the required output below file1               2 3 4 4 . . .      5 6 7 8 . . .     . . . . . . .      file2               3 4 8 10 . . .      5 10 5 9 . . .     . . . . . . .       Required output file will be file1.file2               6 12 32 40 . . .      25 60 35 72 . . .


title: bash ${VAR//search/replace} and weird regex behaviour

text: I am trying to do some searching and replacing on a variable using the ${VAR//search/replace} parameter expansion. I have a pretty long and evil PS1, that I want to work out the size of after expansion. To do so I have to remove a bunch of escape sequences I stuff into it. However on trying to remove all the ANSI CSI SGR sequences I've fell across an issue with my syntax. Given my PS1 of:               PS1=\[\033]0;[\h] \w\007\]\[\033[1m\]\[\033[37m\](\[\033[m\]\[\033[35m\]\u@\[\033[m     \]\[\033[32m\]\h\[\033[1m\]\[\033[37m\]\[\033[1m\])\[\033[m\]-\[\033[1m\](\[\033[m     \]\t\[\033[37m\]\[\033[1m\])\[\033[m\]-\[\033[1m\](\[\033[m\]\[\033[36m\]\w\[\033[1m     \]\[\033[37m\])\[\033[35m\]${git_branch}\[\033[m\]\n$      (yes it's sick I know...) I'm trying to do:               # readability     search='\\\[\\033\[[0-9]*m\\\]'     # do the magic     sane="${PS1//$search/}"      However these seems to be greedy at the point of `[0-9]` (almost like `[0-9]` is treated like a `.` instead):               echo "${PS1//$search/}"     \[\033]0;[\h] \w\007\]\n$       If I remove the `*`, and change `[0-9]` to `[0-9][0-9]` (as that is more illustrative) I get closer to the expected result:               $ search='\\\[\\033\[[0-9][0-9]m\\\]'     $ echo "${PS1//$search/}"     \[\033]0;[\h] \w\007\]\[\033[1m\](\[\033[m\]\u@\[\033[m\]\h\[\033[1m     \]\[\033[1m\])\[\033[m\]-\[\033[1m\](\[\033[m\]\t\[\033[1m\])\[\033[m\]-\[\033[1m     \](\[\033[m\]\w\[\033[1m\])$(git_branch)\[\033[m\]\n$       Why is the `*` (zero or more) doing crazy things? am I missing something here? If I pass the same regex through sed I get the expected result:               echo $PS1 | sed "s/$search//g"     \[\033]0;[\h] \w\007\](\u@\h)-(\t)-(\w)$(git_branch)\n$


title: How do I modify this Perl solution so that it will substitute embedded double quotes with single quotes?

text: Previously in this question: "string having doublequotes in between apart from the enclosing quotes" @BernieReiter asked a follow-up question where he wanted to take CSV entries such as the following:               $ cat test.csv     17,"abc","Testurteil "sehr gut"","08/15"     99,"xyz","Testurteil "vernichtend"","4711"      And convert them so that instead of having embedded double quotes (`"..."`) within, they were substituted to be single quotes (`'...'`). The results should look like this:               17,"abc","Testurteil 'sehr gut'","08/15"     99,"xyz","Testurteil 'vernichtend'","4711"      @BernieReiter had also asked how he could take @StephaneChazelas' solution that he provided to that question, where he used this Perl solution:               $ perl -pi.back -le 's/"(?:[^"]|"(?=[^,]))*"|[^",]*/($r=$&)=~       s@(^"|"$|\\.)|"@$1||"\\\""@ge;$r/ge' file.csv      So how would one modify Stephane's solution?


title: What happens if you edit a script during execution?

text: I have a general question, which might be a result of misunderstanding of how processes are handled in Linux. For my purposes I am going to define a 'script' as a snippet of bash code saved to a text file with execute permissions enabled for the current user. I have a series of scripts that call each other in tandem. For simplicity's sake I'll call them scripts A, B, and C. Script A carries out a series of statements and then pauses, it then executes script B, then it pauses, then it executes script C. In other words, the series of steps is something like this: Run Script A:   1. Series of statements   2. Pause   3. Run Script B   4. Pause   5. Run Script C I know from experience that if I run script A until the first pause, then make edits in script B, those edits are reflected in the execution of the code when I allow it to resume. Likewise if I make edits to script C while script A is still paused, then allow it to continue after saving changes, those changes are reflected in the execution of the code. Here is the real question then, is there any way to edit Script A while it is still running? Or is editing impossible once its execution begins?


title: Cannot boot to Windows 7 partition using Grub

text: Windows 7 BOOTMGR is missing when I try to boot into the OS from GRUB. Im not anywhere near being a pro when it comes to partioning or whatever so here's a image of gparted: ![gparted hdd](http://i.stack.imgur.com/CUU63.png) And a copy paste of `/boot/grub/menu.lst`:               # general configuration:     timeout   10     default   0     color light-blue/black light-cyan/blue          # boot sections follow     # each is implicitly numbered from 0 in the order of appearance below     #     # TIP: If you want a 1024x768 framebuffer, add "vga=773" to your kernel line.     #     #-*          # (0) Arch Linux     title  Arch Linux     root   (hd0,4)     kernel /vmlinuz-linux root=/dev/sda4 ro     initrd /initramfs-linux.img          # (1) Arch Linux     title  Arch Linux Fallback     root   (hd0,4)     kernel /vmlinuz-linux root=/dev/sda4 ro     initrd /initramfs-linux-fallback.img          # (2) Windows     title Windows Seven 64bit     rootnoverify (hd0,2)     #makeactive     chainloader +1      Someone point me in the right direction to fix this problem... EDIT: I changed `rootnoverify (hd0,1)` to `rootnoverify (hd0,2)`, result is now a system that reboots immediately after attempted boot. (straight back to BIOS screen)....


title: Copying recursively files with spaces

text: At the moment I have a set of files of the form of:               /dir one/a picture.jpg     /dir two/some picture.jpg      What I want to do is copy and change the end to `-fanart.jpg` to the filename to:               /dir one/a picture.jpg             /a picture-fanart.jpg     /dir two/some picture.jpg             /some picture-fanart.jpg      I've manged to get it working for the situation where there are no spaces:               % for i in `find . -name "*.jpg"`; do cp $i "${i%.*}"-fanart.jpg ;done;      but I need help in getting it working where there are spaces.


title: Cannot access a website from  Firefox

text: I'm trying to access www.belgacom.be using Firefox from my Archlinux system and I get the following error:               Firefox can't find the server at www.belgacom.be      When I use Chromium, it works perfectly. I tried deleting the `~/.mozilla` directory, with no success. I've also tried running Firefox from another user session, with no luck. I'm running the latest version of Firefox. Any ideas?


title: I changed my hostname, rebooted and lost internet connection

text: I set a new hostname on my machine using:               sudo hostname NEWHOSTNAME      Then I restarted, and tried accessing the internet and nothing happened. I checked the hostname and it was set to `localhost.localdomain`. How can I reset my configurations so that I am again connected to the web? I'm running Red Hat Enterprise 6.0 (Santiago)


title: How to trace process scheduling of certain process?

text: For a project at my university I am researching ways to trace, log and manipulate the process scheduling of certain processes. I would like to launch an number of applications, everyone in a single process. At first I would like to trace and log their scheduled execution. But at the next step I would like to manipulate their scheduled execution in order to prefer a single process in it's first `$n` execution. Does someone know an existing approach to realize this (for instance a modified sched.h)?


title: How does prelink work

text: I was wondering how prelinking works. If I prelink my whole system and than delete glibc, will the system 'get up' after restart?


title: How to make sure the shell builtin echo is invoked so that its not visible in process list?

text: Is this going to be visible in the process listing if the below line is executed from a command line or a shell script               bash -c "echo $password"      or i just need to do `echo $password` from within bash on a command line or inside bash shell script is there any test i can do to check such visiblity. i was just trying this but i wasn't able to see it in the process listing with `ps -ef | grep testscript` testscript:               i=0     while (( i < 100 ))     do     ((i=i+1))     sleep 1     echo $$     echo hello     uname     done


title: How many files is equal to 1 inode

text: I am quite confused about the i-nodes. They say delete files to reduce the i-nodes but I have deleted 100s of log files from different cpanels on my server but inode count is still the same.


title: Expect can not expect the output

text: I have problem with my simple code, the expect can not expect the output               set timeout 10     set user username     set password password     spawn  ssh $user@000.000.000.000     expect "Password:"     send "$password\r"     expect eof     send "cv mk ghassan-test-5\r"     sleep 45     expect "ok" { send "cv set ghassan-test-5\r" }     sleep 20     expect -gl "Ok" { send "cv rbset ghassan-test-5\r" }     expect eof     sleep 20     expect -gl "Ok" { send "cv ls\r" }     sleep 10     expect eof`     send "exit\r"      the script run and and enter to the remote server but after `send "cv mk ghassan-test-5\r"` the output is generated, ..... **_Please wait while database is writing to disk. Writing the database file can take minutes... ok_** , but when the script run the next line `expect "ok" { send "cv set ghassan-test-5\r" }` it did not run and did not expect the `ok` since the `ok` but if i expect **_minutes insted of ok_** it work fine (the `ok` appear after 1 minute)


title: Is there a way to 'authorize' a command typed in by a user?

text: is there a way we can authorize a command typed by a user before it takes effect? For example, when a user types `cp file1 file2`, the command will not be executed and a root / root-equivalent user would have to login to 'authorize' the command typed by the user. Is there such a tool / solution that can do this?


title: Split long output into two columns

text: Is there a simple utility or script to columnate the output from one of my scripts? I have data in some form:               A aldkhasdfljhaf     B klajsdfhalsdfh     C salkjsdjkladdag     D lseuiorlhisnflkc     E sdjklfhnslkdfhn     F kjhnakjshddnaskjdh      but if this becomes two long, write the data in the following form (where still vertically ordered):               A aldkhasdfljhaf    D lseuiorlhisnflkc     B klajsdfhalsdfh    E sdjklfhnslkdfhn     C salkjsdjkladdag   F kjhnakjshddnaskjdh      From reading the manpage, I don't think that this is something `column` would be appropriate for but I'm not sure. It's easy enough to split in the form:               A B      C D      E F      by only printing `\n` every second line (what my current script does). Any ideas? Thanks!


title: How do permissions work when moving directories?

text: Recently I tried to move a directory that I own to another directory (which I also own), but I couldn't. I then noticed that I don't own the parent directory. This made me wonder what are the rules for moving a directory in UNIX. Do you need to have read/write permissions to both it and its parent? Also what happens if it contains files or directories that you don't own?


title: Cat into fifo not running through bash

text: I want to script these few lines               mkfifo my.fifo     cat >my.fifo &     cat my.fifo | nc remotehost.tld 10000      But the line               cat >my.fifo &      When i run it manually it works, but not through bash shell. what could be the reason for it?


title: No manual page for regex in section 3 - where is it?

text: I found What do the numbers in a man page mean? which explains the sections for command/library documentation quite nicely, and I was looking at the output for `man regex` and noticed the See Also referred to `regex(3)`. I tried to run `man 3 regex`, but got the following message:               No manual page for regex in section 3      My question is - where is it? This is on Ubuntu 10.04 if that makes a difference.


title: RRDtool setup for 5 minutes intervals but with data delivered every 30 minutes?

text: Can I setup the RRDtool so that the data values have intervals of 5 minutes but the data is delivered to RRDtool every 30 minutes? I need the chart to be clocked with 5 minutes interval as well (X axis) but refreshed every 30 minutes. Use case: I have a DIY weather station that communicates with the world with GPRS. It collects the weather data every 5 minutes and stores it until 6 sessions like this are done and then sends the bulk of 6 measurement information via GPRS. Sending the data every 5 minutes is inefficient in terms of power usage and the data transfer tolls.


title: Is there a convenient small Unix virtual machine I can install as an Android app?

text: Ubuntu for Android seems to be missing in action. I'm travelling tomorrow and I need to take a basic Linux machine with me. I'd rather just take my tablet than a laptop. So is there a reasonable simple Linux virtual machine that I can install as an Android app. and which I can ssh into with Putty from any PC I find (ideally via the USB cable)? I'd like to be able to run at least emacs, git and rsync. And ideally Python.


title: Advanced NTFS partition file recovery techniques for damaged drives (IO errors)?

text: I've recently suffered a maddeningly small but quite important amount of damage to a hard drive on a ESXi host affecting a couple VMs. There's a file that I would very much like to recover, and of course it was somehow left off of my regular backup. The most recent copies are 6 months old. Turns out I need that... oops. Details: 1) I have used ddrescue (AWESOME tool) within a Parted Magic bootable ISO to recover 99.98% of the VM's drive in question. Unfortunately, the errors appear to be almost entirely of RECENT file writes... so of course they're exactly the sectors I need to recover most. 2) The drive gives IO errors on bad sector reads, but it occasionally SUCCEEDS in reading a previously bad sector! So, recovery is still possible. Slightly more often than that will have some kind of major malfunction and spin the drive down and back up. Oh, and about 1/4 of those spin downs won't come back up. (Hard power cycle required, shutdown won't function) Last, just about every bad sector read comes with a nice audible clicking sound. 3) The important VM disk is NTFS formatted. 4) I can (usually) mount the damaged NTFS volume read-only, and I can (slightly less often) navigate to the folder that contains the file I need. However, the file in question appears to always give an IO error when I do an 'ls' of the folder. The other files in the folder do not give an IO error. 5) I've tried using ntfsinfo/etc... which sounds like exactly what I need... but it won't open the partition at all. (Frustrating, since 'mount' usually will) 6) The file is a Excel 2003-era XLS file, so I'm not sure I can come up with any strings to search the raw disk image for. (Possibly parts of the 6 month old version?) I'd really like to use something like the facilities of debugfs. However, from the man pages it appears the ntfs tools could do the work if only they could be made to open the partition. In particular, I am wondering if the IO errors might be purely within the metadata for the file, and if the directory record could be restored well enough to copy the file contents off. As a last resort, whatever partial file contents I can retrieve would be great. I've written (relatively simple) kernel modules before, so I could compile a special NTFS module with more debug info enabled (or added). (The file is worth at least a few days of tinkering to try to recover... plus I'm learning cool stuff in the process) Any pointers? **EDIT:** More drive error information: The /var/log/messages is showing a lot of NTFS-fs errors of course... but I finally bothered to translate the unhandled sense code message I usually get: sense key 0x3, ASC=0x11, ASCQ=0x4. (which appears to translate to UNRECOVERED READ ERROR - AUTO REALLOCATE FAILED). When the drive spins down, I see a "scsi0: _*_ BusLogic BT-958 Initialized" message. I'm not sure if it's the Linux SCSI driver, the ESXi driver, or the drive itself that decides to spin the drive down. If it was the Linux driver, then perhaps I could modify the driver to avoid spinning down. This whole ddrescue thing is made massively more painful by these power-cycle-requiring spindowns. **EDIT2:** using the "end_request: I/O error, dev sda, sector 7238859" log message right after I 'ls' the directory containing the file in question, I've targetted my ddrescue operation to that sector. I currently plan to take my chances and WRITE that sector back to the live disk if this succeeds. Perhaps I can slowly rebuild my way to the file in question this way. Still, most recoverable bad sectors are recovered in under 20 retries... this one is over 150 so far... *sigh* **EDIT3:** The sector error from 'ls' on the file I need is entirely uncooperative (1000+ tries overnight and no luck). I'm hoping that's just metadata when you do an 'ls' ? :) I do have most of a ddrescue copy, but that doesn't mount (or mounts without files). The damaged drive mounts correctly most of the time... maybe IO errors on the damaged drive force 'mount' to fall back to the mirror that works? ** EDIT4:** I've given up for now, pending further suggestions. I've removed the drive and rebuilt the box. I'll keep the drive around in case something comes up.


title: How do I setup dual-head monitors with an Nvidia drivers and one monitor rotated?

text: I have an integrated ION GPU, which is supported by the proprietary drivers and I've never been able to get the open source drivers to work. I would like my left screen to be normal, but the right hand screen to be rotated. How do I achieve this?


title: Only output most recent 10 (or n) lines of a lengthy command output

text: I have currently worked alot with shell and bash on linux.   I have made tons of backups scripts and much more. In many cases I have a command that outputs thousands of lines. I actually need these lines in order to see the progress of the command. But I do not need to see more than the 10 most recent lines. How can I do that? I already tried using a `pipe` and `tail`. But it did not work. I just got the last ten lines after the original command finished:               whatever command that has too much output | tail -f      It is important that the console does not get cleared or something like this because there is some important infomation that gets printed right before the command with the lengthy output.   An example:               echo "Very important information. MUST BE VISIBLE!"          # This gives me about 10,000 lines of output pretty fast!     # This output should be shrinked down to the most recent 10     tar -cvf "Bckup.tar" "folder to backup/"          # More code      I hope this clears it up. **EDIT:** The problem with `multitail` is that it takes up the entire screen. So if I had more than just one output (which I have. Multiple commands with important information are run before this. And I need to use it multiple times). Something like running this in screen with just 10 lines to display would be perfect. (I know that does not work). You could imagine that like there is some output from other commands. Then I call the command with the lengthy output. This output stays in a screen that only can display something like 10 lines. After the command is finished more output goes to the console and this should be right beneth it like normal output.               Output     Important Information     Other commands output     ----------------------------------------     some lines for the tar command                              ----------------------------------------     More output     ....     ....      _(Just without the lines)_


title: How do I use pacman on a loop-mounted Arch image for a different architecture?

text: I would like to install some packages on an ARM image before flashing it to an SD card. So far, I have loop mounted the image               sudo mount -o loop,offset=99614720 archlinuxarm-13-06-2012.img /mnt      and added the ARM mirrors to my `/etc/pacman.d/mirrorlist`. I've then tried to run               sudo pacman --root /mnt --arch arm --conf /mnt/etc/pacman.conf -S curl      But it fails with the following output...               warning: curl-7.26.0-1 is up to date -- reinstalling     resolving dependencies...     looking for inter-conflicts...          Targets (1): curl-7.26.0-1          Total Download Size:    0.48 MiB     Total Installed Size:   1.50 MiB     Net Upgrade Size:       0.00 MiB          Proceed with installation? [Y/n] Y     :: Retrieving packages from core...     error: failed retrieving file 'curl-7.26.0-1-arm.pkg.tar.xz' from mirror.lividpenguin.com : The requested URL returned error: 404      curl-7.26.0-1-arm                   492.9 KiB   293K/s 00:02 [##################################] 100%     (1/1) checking package integrity                              [##################################] 100%     (1/1) loading package files                                   [##################################] 100%     (1/1) checking for file conflicts                             [##################################] 100%     (1/1) checking available disk space                           [##################################] 100%     (1/1) upgrading curl                                          [##################################] 100%     call to execv failed (Exec format error)     error: command failed to execute correctly      Any ideas on how to get this to work without emulation? Any idea what is being `execv`-d? ### Update I have discovered it is trying to run `ldconfig`, which is obviously failing. Luckily, I don't need that to be run!


title: Zsh completion, enabling shift-tab

text: When zsh shows you a menu of possible completions, I'd like it to let me use `shift-tab` to access previous completion entries--is there an option that controls what key is used to access previous completion entries? And if so, what would I need to add to my `~/.zshrc` file in order to set it up. If it makes any difference, I currently can navigate through a completion-menu using the arrow-keys, but I dislike doing this since the arrow-keys feel out of place and awkward to use.


title: Exception handling when using tail -f to monitor a log

text: I have a main script calling the script to do the monitoring. I am trying to catch the exception that the log is missing or not accessible anymore. `tail -f` is used instead of `-F` since the logs are named with the current date. `trap` may be working but I am not sure what signal `tail -f` would return if the log being monitored is no longer there. Otherwise, should I just do a loop checking in the main script checking for `[ -r $Log]`?


title: MasterPDFEditor use black theme for PDF pages

text: @Crunchbang/Debian x32 I've been using MasterPDFEditor for quite some time & I'm impressed by its PDF annotation capabilities. However I decided to start using a black GTK+ theme & after that I cannot use this application, simply because it started using black backgrounds for all of my PDF files, while `evince` works nicely. Is there something I can do about it? _`evince`_    ![using evince](http://i.stack.imgur.com/iqbJ6.png) _`MasterPDFEditor`_    ![using MPE](http://i.stack.imgur.com/SOdIV.png)


title: What is the solution for the error grub rescue/no file system found?

text: I am using DELL-INSPIRON 15R with a dual boot of Windows 8 and Linux Mint Olivia 15. It has been working properly since it was installed. Now, it is showing the error that "no file system found. grub rescue->" What should I do for this?


title: date modifiers explained

text: Again, I found some interesting I don't understand in an `info` page, in `info date`to be precisely: > An optional modifier can follow the optional flag and width specification. > The modifiers are: > > `E`   >       Use the locale's alternate representation for date and time. This > modifier applies to the `%c`, `%C`, `%x`, `%X`, `%y` and `%Y` conversion > specifiers. In a Japanese locale, for example, `%Ex` might yield a date > format based on the Japanese Emperors' reigns. > > `O`   >        Use the locale's alternate numeric symbols for numbers. This modifier > applies only to numeric conversion specifiers. > > If the format supports the modifier but no alternate representation is > available, it is ignored. Question: An[other] example, how this modifiers are used. The description sounds to me like » _Will do stuff, if other stuff was set, but don't expect too much_ «. Sometimes I wonder where things like this come from and what their purpose is/was.


title: Truncated result returned by JOIN

text: I'm using join command under linux, but the results vary between different machines. I have two simple files:               cat 1.txt       a aaa,0.2     b bbb,0.3     c ccc,0.5          cat 2.txt     a aaa,0.2     b bbb,0.3     c ccc,0.6      I'm running the following command               join -a 1 -1 1 -2 1 -t "," -o 1.1' '1.2' '2.2 <(cat 1.txt| sort -t ",") <(cat 2.txt| sort -t ",")       Result on machine 1:               ,0.2a,0.2     ,0.3b,0.3     ,0.6c,0.5          join --version     join (GNU coreutils) 8.13          locale     LANG=en_US.UTF-8     LANGUAGE=en_US.UTF-8     LC_CTYPE="en_US.UTF-8"     LC_NUMERIC="en_US.UTF-8"     LC_TIME="en_US.UTF-8"     LC_COLLATE="en_US.UTF-8"     LC_MONETARY="en_US.UTF-8"     LC_MESSAGES="en_US.UTF-8"     LC_PAPER="en_US.UTF-8"     LC_NAME="en_US.UTF-8"     LC_ADDRESS="en_US.UTF-8"     LC_TELEPHONE="en_US.UTF-8"     LC_MEASUREMENT="en_US.UTF-8"     LC_IDENTIFICATION="en_US.UTF-8"     LC_ALL=en_US.UTF-8      Result on machine 2:               a aaa,0.2,0.2     b bbb,0.3,0.3     c ccc,0.5,0.6          join --version     join (GNU coreutils) 5.97          locale     LANG=en_US.UTF-8     LC_CTYPE="en_US.UTF-8"     LC_NUMERIC="en_US.UTF-8"     LC_TIME="en_US.UTF-8"     LC_COLLATE="en_US.UTF-8"     LC_MONETARY="en_US.UTF-8"     LC_MESSAGES="en_US.UTF-8"     LC_PAPER="en_US.UTF-8"     LC_NAME="en_US.UTF-8"     LC_ADDRESS="en_US.UTF-8"     LC_TELEPHONE="en_US.UTF-8"     LC_MEASUREMENT="en_US.UTF-8"     LC_IDENTIFICATION="en_US.UTF-8"     LC_ALL=      Clearly, the result on the first machine is wrong. It's been truncated. I've tried to use different locale settings but had no success.


title: how to change a complete line with sed c option

text: The sed command below is supposed to change the country for Sergio Oliva to Cuba from USA, but as you can see in the output that it's still USA. The book I'm using uses this example to illustrate using the `c` option to change a complete line. Can you explain why this example is not working as intended. command `sed '/\<Oliva\>/ c \ Sergio Oliva Cuba 1967 1968 1969' mrolympia.dat` output               Larry Scott USA 1965 1966      Sergio Oliva USA 1967 1968 1969      Arnold Schwarzenegger Osterreich 1970 1971 1972 1973 1974 1975      Franco Columu Argentinien 1976 1981      Chris Dickerson USA 1982      Samir Bannout Libanon 1984      Lee Haney USA 1984 1985 1986 1987 1988 1989 1990 1991      Dorian Yates Grossbritannien 1992 1993 1994 1995 1996 1997      Ronnie Coleman USA 1998 1999 2000 2001 2002 2003 2004