title: bash does not autocomplete my command when using sudo?

text: I'm using SaltStack. I would like to auto-complete the minion name when calling `salt` command. The following line has been added into `~/.bashrc`:               complete -o default -o nospace -W "$(sudo ls -1 /var/cache/salt/master/minions)" salt      Then typing `salt in<tab>` --> `salt integration-<tab>`, I can see it works as expected:               $ salt integration-     integration-c   integration-u   integration-u2      To use with `sudo`, I have added `complete -cf sudo` into `~/.bashrc`, but it didn't work: `sudo salt in<tab` returned nothing. I also have tried to install `bash_completion` and added the following lines to `~/.bash_profile`:               if [ -f $(brew --prefix)/etc/bash_completion ]; then         . $(brew --prefix)/etc/bash_completion     fi      but no luck. Did I miss something? * * * **UPDATE Sat Jul 12 08:51:23 ICT 2014** Oh, the first thing I would like to say is sometime it works:               $ sudo salt integration-     integration-c   integration-u   integration-u2       sometime it doesn't. > So first, let's see how much your bash_completion package does. How can I check that? Here's my function:               # a wrapper method for the next one, when the offset is unknown     _command()     {         local offset i              # find actual offset, as position of the first non-option         offset=1         for (( i=1; i <= COMP_CWORD; i++ )); do             if [[ "${COMP_WORDS[i]}" != -* ]]; then                 offset=$i                 break             fi         done         _command_offset $offset     }          # A meta-command completion function for commands like sudo(8), which need to     # first complete on a command, then complete according to that command's own     # completion definition - currently not quite foolproof (e.g. mount and umount     # don't work properly), but still quite useful.     #     _command_offset()     {         local cur func cline cspec noglob cmd i char_offset word_offset \             _COMMAND_FUNC _COMMAND_FUNC_ARGS              word_offset=$1              # rewrite current completion context before invoking         # actual command completion              # find new first word position, then         # rewrite COMP_LINE and adjust COMP_POINT         local first_word=${COMP_WORDS[$word_offset]}         for (( i=0; i <= ${#COMP_LINE}; i++ )); do             if [[ "${COMP_LINE:$i:${#first_word}}" == "$first_word" ]]; then                 char_offset=$i                 break             fi         done         COMP_LINE=${COMP_LINE:$char_offset}         COMP_POINT=$(( COMP_POINT - $char_offset ))              # shift COMP_WORDS elements and adjust COMP_CWORD         for (( i=0; i <= COMP_CWORD - $word_offset; i++ )); do             COMP_WORDS[i]=${COMP_WORDS[i+$word_offset]}         done         for (( i; i <= COMP_CWORD; i++ )); do             unset COMP_WORDS[i];         done         COMP_CWORD=$(( $COMP_CWORD - $word_offset ))              COMPREPLY=()         _get_comp_words_by_ref cur              if [[ $COMP_CWORD -eq 0 ]]; then             _compopt_o_filenames             COMPREPLY=( $( compgen -c -- "$cur" ) )         else             cmd=${COMP_WORDS[0]}             if complete -p ${cmd##*/} &>/dev/null; then                 cspec=$( complete -p ${cmd##*/} )                 if [ "${cspec#* -F }" != "$cspec" ]; then                     # complete -F <function>                          # get function name                     func=${cspec#*-F }                     func=${func%% *}                          if [[ ${#COMP_WORDS[@]} -ge 2 ]]; then                         $func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}" "${COMP_WORDS[${#COMP_WORDS[@]}-2]}"                     else                         $func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}"                     fi                          # remove any \: generated by a command that doesn't                     # default to filenames or dirnames (e.g. sudo chown)                     # FIXME: I'm pretty sure this does not work!                     if [ "${cspec#*-o }" != "$cspec" ]; then                         cspec=${cspec#*-o }                         cspec=${cspec%% *}                         if [[ "$cspec" != @(dir|file)names ]]; then                             COMPREPLY=("${COMPREPLY[@]//\\\\:/:}")                         else                             _compopt_o_filenames                         fi                     fi                 elif [ -n "$cspec" ]; then                     cspec=${cspec#complete};                     cspec=${cspec%%${cmd##*/}};                     COMPREPLY=( $( eval compgen "$cspec" -- "$cur" ) );                 fi             elif [ ${#COMPREPLY[@]} -eq 0 ]; then                 _filedir             fi         fi     }      > if you type sudo `mkdir <tab><tab>`, does it show a list of directories? Yes:               $ sudo mkdir      .FontForge/        .djangopypi2/      .ievms/            .ssh/              .wireshark-etc/


title: Extracting a string from fdisk command

text: I want to write a shell script, which will run `fdisk -l` and extract a string `/dev/sdbn` from the output of `fdisk -l`. Using extracted word I want to mount it to `/mnt`. For Example:               Disk identifier: 0x00000000          Device     Boot    Start    End    Blocks    Id    System     /dev/sdb1    *         1    493    3956672    6     FAT16      How do I only extract the string `/dev/sdb1`?


title: annotate "include" file for grep with comments?

text: I do a `grep` sort that includes certain strings. That is, give me the lines in a file that DO contain certain strings. As in               grep -fv include file  > out      That command looks in `file` and sends to `out` every line that matches what is in the file `include`. No problem with that. Works fine. BUT How do I put comments in my `include` file? For example, I'd like to annotate that file with some (e.g. `#`) comments that explain what I'm including. So I'd like for `grep` to ignore any lines in the `include` file that start with `#`. How do I do that?


title: Change filename from lowercase to uppercase recursively

text: I have 1,000,000 files in some folders and subfolders. I want to rename them from lowercase to uppercase using shell commands. I don't want to modify the extension. only filename part. I have found this one:               rename 's/^([^.]*)\.(.*)$/\U$1\E.$2/' *      but it is not recursive and only works on files in current folder. Then I tried this one:               find . -depth  -execdir rename 's/^([^.]*)\.(.*)$/\U$1\E.$2/' {} \;      But no files changed. How can I use it recursively?


title: change date format and store in variable using awk

text: I have date in format YYYY-MM-DD in variable 'a'. I want to convert it in format YYYYMMDD and store in variable 'b'. The variable is in an awk variable. How can I do the same ?


title: Understaning of diff output

text: I have `file1.txt`               this is the original text       line2       line3       line4       happy hacking !        and `file2.txt`               this is the original text       line2       line4       happy hacking !       GNU is not UNIX        if I do: `diff file1.txt file2.txt` I get:               3d2       < line3       5a5       > GNU is not UNIX        How is the output generally interpreted? I think that `<` means removed but what do `3d2` or `5a5` mean? If I do:               $ diff -u file1.txt file2.txt       --- file1.txt        2013-07-06 17:44:59.180000000 +0200       +++ file2.txt        2013-07-06 17:39:53.433000000 +0200       @@ -1,5 +1,5 @@        this is the original text        line2       -line3        line4        happy hacking !       +GNU is not UNIX        The results are clearer but what does `@@ -1,5 +1,5 @@` mean?


title: Is it possible to find out which files are setting/adding to environment variables, and their order of precedence?

text: Some of my environment variables (`$PATH`, `$MANPATH` and friends) are partially set up in different source files. I find myself wishing for a command or method to quickly gather _what part_ , in a specific environment variable, came from _what file_. My $PATH, for instance, has obviously been set (added to) in `.bashrc`, `/etc/paths`, `/etc/paths.d/X11` … and I'm still looking for that last mysterious file which superfluously created a duplicate path definition in my `$PATH`. It takes a good while to manually pinpoint the files that contribute to environment variables. There must be a useful way to bypass this unnecessary labor of tracing all the setters … or am I the only one thinking along these lines?


title: Better way to add alternative using update-alternatives?

text: I'm sorry for my bad writing, I'm not a native speaker. I've looked up the manual of `update-alternatives` several times but I can't find out how to show the current link pointing to a specific alternative, and that information is needed when adding a new alternative. From the `update-alternatives` manual:               --install <link> <name> <path> <priority>      Let's say I want to add a new version of Java Runtime Edition, but I don't know the current symlink that links to the alternative (`<link>` parameter). What I currently do is:               sudo update-alternatives --install /tmp/randomStuff java /usr/local/java/jre1.7.0_25/bin/java 0      That command will output:               update-alternatives: renaming java link from /usr/local/bin/java to /tmp/randomStuff.      Reading the output I find out the old link that was pointing to the alternative, so I can finally run my command again with the right `<link>` parameter, changing `/tmp/randomStuff` to `/usr/local/bin/java`:               sudo update-alternatives --install /usr/local/bin/java java /usr/local/java/jre1.7.0_25/bin/java 0      That works fine, but as you see, running the command with `/tmp/randomStuff` as the `<link>` parameter is very awkward. So, here comes the questions: (1) Are there any `update-alternative` arguments that can output the current link that is pointing to a specific alternative, or (2) is there a way to install a new alternative without having to provide a new parameter, simply keeping the current `<link>`? Thanks for your help.


title: backlight doesn't work with Linux Mint 14 on my Gateway NV78 laptop

text: Here is my problem it is Bug 765438--the backlight will not work on my Gateway NV 78 laptop. Won't work with Linux Mint 14, ubuntu from ubuntu 11.04 onward won't work with ps-bcd. Of course it works great with any Windows system, It works with the Ubuntu super OS but not Linux Mint. There is a fix. I just have to open /etc/rc.local and edit a command Someone sent in this fix : enter `i915.broken=1` into command line create a script under `/etc/init.d`:               #! /bin/sh     echo "Fixing backlight for gateway NV78"     setpci -s 00:02.0 F4.B=00     exit 0      Include that script path in `/etc/rc/local` before `exit 0` Create script `/etc/pm/sleep.d/10_fix_backlight ` :               #!/bin/sh     # fixGateway NV78 backlight     PATH=/sbin:/usr/sbin:/bin:usr?bin     if [ ! -x /etc/init.d/fix_backlight }: then     exit 0      make the script executable:               sudo chmod 755 /etc/init.d/fix_backlight;     sudo chmod 755 /etc/pm/sleep.d/fix_backlight;      add `acpi_osi=Linux` to default grub start up script:               sudo gedit /etc/default/grub      add `acpi_osi=Linux` after quite splash screen then               sudo update-grub      That's the fix, but I have no idea at all what to do to accomplish this. I really don't want to visit a Linux technician for this help. Any guidance where these files are will help. I know where the /etc file is but can not open the /etc/rc/local file at all.


title: How to run Plasma on VPN server without leaving terminal?

text: How do I run KDE Plasma on local VPN server on Arch Linux on another VPN client without running it on the hosting server or leaving its terminal?


title: Install BCM 4365 drivers in Backtrack 5R3

text: I have recently installed Backtrack 5 R3. When I try to run:               sudo apt-get install bcmwl-kernel-source      I get the following error:               Error! Bad return status for module build on kernel: 3.2.6 (x86_64)     Consult the make.log in the build directory     /var/lib/dkms/bcmwl/5.60.48.36+bdcom/build/ for more information.     dpkg: error processing bcmwl-kernel-source (--configure):      subprocess installed post-installation script returned error exit status 10     Errors were encountered while processing:      bcmwl-kernel-source     E: Sub-process /usr/bin/dpkg returned an error code (1)      What does that mean and how can I fix it? I followed the instructions from a guide here on U&L. * * * ### /var/lib/dkms/bcmwl/5.60.48.36+bdcom/build/make.log               DKMS make.log for bcmwl-5.60.48.36+bdcom for kernel 3.2.6 (x86_64)     Wed Jul 10 21:04:16 PKT 2013     make: Entering directory `/usr/src/linux-source-3.2.6'            WARNING: Symbol version dump /usr/src/linux-source-3.2.6/Module.symvers                is missing; modules will have no dependencies and modversions.            LD      /var/lib/dkms/bcmwl/5.60.48.36+bdcom/build/built-in.o       CC [M]  /var/lib/dkms/bcmwl/5.60.48.36+bdcom/build/src/shared/linux_osl.o       CC [M]  /var/lib/dkms/bcmwl/5.60.48.36+bdcom/build/src/wl/sys/wl_linux.o     /var/lib/dkms/bcmwl/5.60.48.36+bdcom/build/src/wl/sys/wl_linux.c:219: error: unknown field ‘ndo_set_multicast_list’ specified in initializer     /var/lib/dkms/bcmwl/5.60.48.36+bdcom/build/src/wl/sys/wl_linux.c:219: warning: initialization from incompatible pointer type     /var/lib/dkms/bcmwl/5.60.48.36+bdcom/build/src/wl/sys/wl_linux.c: In function ‘_wl_set_multicast_list’:     /var/lib/dkms/bcmwl/5.60.48.36+bdcom/build/src/wl/sys/wl_linux.c:1435: error: ‘struct net_device’ has no member named ‘mc_list’     /var/lib/dkms/bcmwl/5.60.48.36+bdcom/build/src/wl/sys/wl_linux.c:1435: error: ‘struct net_device’ has no member named ‘mc_count’     /var/lib/dkms/bcmwl/5.60.48.36+bdcom/build/src/wl/sys/wl_linux.c:1436: error: dereferencing pointer to incomplete type     /var/lib/dkms/bcmwl/5.60.48.36+bdcom/build/src/wl/sys/wl_linux.c:1442: error: dereferencing pointer to incomplete type     make[1]: *** [/var/lib/dkms/bcmwl/5.60.48.36+bdcom/build/src/wl/sys/wl_linux.o] Error 1     make: *** [_module_/var/lib/dkms/bcmwl/5.60.48.36+bdcom/build] Error 2     make: Leaving directory `/usr/src/linux-source-3.2.6'


title: Dropbox icon is disappeared in Mint 16 Cinnamon

text: Dropbox icon was between Mint update manager and keyboard icon, but it was disappeared like the image below. ![enter image description here](http://i.stack.imgur.com/RJIw6.jpg) Dropbox is still running, how can I make it appear in task tray again without logging out? I'm using LinuxMint 16 Cinnamon.


title: Redirecting stdout to a file you don't have write permission on

text: When you attempt to modify a file without having write permissions on it, you get an error:               > touch /tmp/foo && sudo chown root /tmp/foo     > echo test > /tmp/foo     zsh: permission denied: /tmp/foo      Sudoing doesn't help, because it runs the command as root, but the shell handles redirecting stdout and opens the file as you anyway:               > sudo echo test > /tmp/foo     zsh: permission denied: /tmp/foo      Is there an easy way to redirect stdout to a file you don't have permission to write to, besides opening a shell as root and manipulating the file that way?               > sudo su     # echo test > /tmp/foo


title: Write a file in /var/lib/sysnews/

text: In that folder are stored the `news` files: they can be created by the system administrator to write some informations for the users, as suggested in this link. I tried as a normal user to add a file in `/var/lib/sysnews`, but nor this command               echo "Hello world" > /var/lib/sysnews      neither this command               sudo echo "Hello world" > /var/lib/sysnews      worked (it gives _permission denied_ error). The folder is owned by `root` user and by the `staff` group. My normal user was already in the `sudo` group; I added the `staff` group for my user, but with no results. I can add news only by creating a file in one of my folders and then typing               sudo mv myfile /var/lib/sysnews      but it is bothering. Is there a simpler way to add some news file to that folder without being root?


title: How to insert text into a root-owned file using sudo?

text: > **Possible Duplicate:**   >  Redirecting stdout to a file you don't have write permission on Running a command like `sudo echo 'text' >> /file.txt` fails with:               bash: /file.txt: Permission denied


title: sudo here-document / concatenation?

text: > **Possible Duplicate:**   >  Redirecting stdout to a file you don't have write permission on I'm new i'm trying to learn shell scripting. Is there a way to force a concatenation and override the privileges doing the following one line command? `read domain; echo "127.0.1.1 $domain " >> /etc/hosts` What i'm trying to do is just create a simple script to type in the domain and then add it to my hosts file for development. Since my hosts file has restrictive permissions (even though i'm the only user with sudo powers) it won't let go. The ideal output would just do the following: `127.0.0.1 foo.l`


title: permission denied when redirecting sudo sed output

text: > **Possible Duplicate:**   >  Redirecting stdout to a file you don't have write permission on I'm trying to install drupal according to the instructions given in this tutorial: http://how-to.linuxcareer.com/how-to-install-drupal-7-on-ubuntu- linux and am stuck on a step:               $ cd /etc/apache2/sites-available     $ sudo sed 's/www/www\/drupal/g' default > drupal     bash: drupal: Permission denied      The permissions for `/var/www/drupal` are set to 777.


title: Emptying a file for root user does not work

text: I use below command to empty a file               > file.txt      It works perfectly fine! But there are some files with `root` user permissions. So I tried               sudo > different-file.txt      and I got below verbose               usage: sudo [-D level] -h | -K | -k | -V     usage: sudo -v [-AknS] [-D level] [-g groupname|#gid] [-p prompt] [-u user name|#uid]     usage: sudo -l[l] [-AknS] [-D level] [-g groupname|#gid] [-p prompt] [-U user name] [-u user name|#uid] [-g groupname|#gid] [command]     usage: sudo [-AbEHknPS] [-C fd] [-D level] [-g groupname|#gid] [-p prompt] [-u user name|#uid] [-g groupname|#gid] [VAR=value] [-i|-s]             [<command>]     usage: sudo -e [-AknS] [-C fd] [-D level] [-g groupname|#gid] [-p prompt] [-u user name|#uid] file ...      This suggests that there is some syntax error in my command. What is wrong?


title: where should I put the sudo in this command?

text: > **Possible Duplicate:**   >  Redirecting stdout to a file you don't have write permission on `echo "some words" >> /etc/apt/source.list` `permission denied` `sudo echo "some words" >> /etc/apt/source.list` also return permission denied Then I think maybe the append operator is another command, I should put the sudo before it, so I try `echo "some words" >> sudo /etc/apt/source.list` also return permission denied how should I do this task?


title: Root user can't do everything?

text: > **Possible Duplicate:**   >  Redirecting stdout to a file you don’t have write permission on I'm quite new to Linux and I have a permissions questions. I'm using Linux Mint. If I go to `/opt` and do a `$ echo hi > file` it says permission denied. If I try with sudo, like this `$ sudo echo > file` it says permission denied. Isn't sudo to execute the command as superuser? How do I get permission denied as SU? If I do a `$ sudo su` and after that I do a `$ echo > file` it works. Is sudo su not the same as sudo?


title: Permission denied when trying to write to a file in /sys directory

text: I'm trying to manually set the speed of the fan on my Macbook Pro 7.1 which is running Crunchbang Linux Waldorf. I'm following the instructions in this blog article http://allanmcrae.com/2010/05/simple-macbook-pro-fan-daemon/ I need to write to a file but I'm getting permission denied when running this command               sudo echo 1 > /sys/devices/platform/applesmc.768/fan1_manual


title: Can't edit /proc/sys/net/core/wmem_max

text: Recently my wireless network has being stopping to transfer data from some irregular time intervals that vary from 30 seconds to 20 minutes, and every time I need to plug off and then on the wireless adapter. Using ping (`ping 8.8.8.8`) to see what happens, and when data transfer stops I receive this message: > ping: sendmsg: No buffer space available So I found out that a solution for this is to increase buffer size with this command:               sudo echo 83886080 > /proc/sys/net/core/wmem_max      Although I can't execute this command, when I hit enter I get this: > bash: /proc/sys/net/core/wmem_max: Permission denied Trying the command without `sudo` or with `gksu` returns the same message. Through GEdit I can open `/proc/sys/net/core/wmem_max` file, and opening as administrator it enables me to click the 'Save' button, although after changing the value and hitting the button it returns me this message: > Could not create a temporary backup file while saving > /proc/sys/net/core/wmem_max > > gedit could not backup the old copy of the file before saving the new one. > You can ignore this warning and save the file anyway, but if an error occurs > while saving, you could lose the old copy of the file. Save anyway? And even clicking in the 'Save anyway' button it returns the very same message.


title: Why do I get "Permission denied" when redirecting the output of sudo echo "xyz" to a file?

text: Why do I get               -bash: test: Permission denied      when I run               sudo echo "xyz" > test      The directory permissions are:               drwxr-xr-x 3 root root 4096 2014-08-05 16:26       I have no problem creating a file in the directory using `sudo`. But why can't I sudo echo into it?


title: Why can I copy files to, but not create files in, this directory?

text: > **Possible Duplicate:**   >  Redirecting stdout to a file you don't have write permission on I'm trying to create an `md5sum` for an ISO image created with the Ubuntu Customization Kit tools. The ISO is created by the tools, which have to be run with `sudo`, in               ~/tmp/remaster-new-files/       which has permissions:               drwxr-xr-x 2 root root remaster-new-files      So I `cd` to that directory and run               sudo md5sum my.iso > my.iso.md5      and I get the following error:               bash: my.iso.md5: Permission denied      I can create the md5 sum somewhere else and use `sudo mv` to move it into place, exactly where it would be if the `sudo md5sum` command succeeded. Also, if I change user to `root` with `sudo su root`, I can run the `md5sum` command successfully. Why can't I use `sudo` to create files in this directory, given that I can use `sudo` to move files to it?


title: How do I append text to a write protected file

text: > **Possible Duplicate:**   >  Redirecting stdout to a file you don't have write permission on I am trying to append a line of text to a write protected file. I tried to accomplish this with `sudo echo "New line to write" >> file.txt` but I get a permission denied error -- presumably because it is trying to sudo the string, not the act of appending it to a file. If I run `sudo vi file.txt` and authenticate I can happily write away. Any help would be greatly appreciated.


title: Script with root permission

text: > **Possible Duplicate:**   >  Redirecting stdout to a file you don't have write permission on I am creating a script to change the brightness of my laptop. I discovered that I can do this using               echo 1000  > /sys/class/backlight/intel_backlight/brightness      for example. But I must to do this as root, not with `sudo` command. Well, I created the file `/usr/bin/brilho` containing               echo "$1"  > /sys/class/backlight/intel_backlight/brightness      and now I can execute it with `brilho 1000`. But the problem is the permission. This does not work with `sudo brilho 1000` neither `brilho 100`. Again I have to change to root. So, I would like to know how to improve this to facilitate my job. Regards and thanks.


title: How do I use redirection with sudo

text: > **Possible Duplicate:**   >  Redirecting stdout to a file you don't have write permission on Yeah I could (and probably will) just escalate to root, but I'd like to know why this doesn't work?               sudo cat .mplayer/config >> /home/griff/.mplayer/config     zsh: permission denied: /home/griff/.mplayer/config      `sudo` is configured to be able to run any command, I've placed no restrictions on it.


title: How do you process an entire command as sudo that involves redirecting or piping?

text: I am trying to follow what I assume is best practises of using sudo instead of root account. I am running a simple concat file operation such as:               sudo echo 'clock_hctosys="YES"' >> /etc/conf.d/hwclock      This fails as to the right of the ">>" it is running as the normal user. Adding extra sudos also fails (expected behaviour since piping to the sudo command and not to the file). Example is just that but it has been verified and tested under the root account.


title: Can't add swap file on solaris

text: I'm trying to add a swap file on Solaris 10. I have already created a 2GB file `swap.file`. Then, I add a swap file with the command:               swap -a /swap.file      which shows an error: > /swap.file: size is invalid What am I doing wrong?


title: How to disable timeout of password prompt for partition decryption during boot?

text: I have a computer running OpenSUSE 12.1, 64-bit, default install. How it works currently:   1. I turn on the computer   2. It goes through the boot process   3. At some point during boot, I am asked for password to decrypt an encrypted partition  The problem is there is a timeout on this prompt, so I have to sit next to computer and pay attention to what is going on. How can I disable that timer, so I could for example turn the computer on and go away, and then return after 1 hour and still see this prompt?


title: Non-ASCII characters handled incorrectly on command line

text: I have a problem with non-ASCII characters in the Terminal on Mac. If I write:               echo ÆØÅ      Then press Enter, Arrow Up, Arrow Left, so the cursor is between the Ø and the Å, then write X, then the Å is converted to ?, and if I press Enter, the following is echoed:               ÆØ?X?      Pressing `Ctrl`+`A` and `Ctrl`+`E` with non-ASCII characters entered also causes a mess. My settings are as follows:               ~/.profile:     export LC_ALL="nb_NO.UTF-8"          ~/.inputrc:     set input-meta on     set output-meta on     set convert-meta off          Terminal > Settings > Advanced > Declare terminal as: xterm      Unsetting `LC_ALL` has no effect. Changing the `.inputrc` settings just seems to make things worse. I really hope someone has the answer to this.


title: Ubuntu 13.04 on Acer x64 PC, only boots after starting recovery

text: I have this strange problem with my Acer E1 421. First of all it's important to say that **I've upgraded this laptop's memory to 8gb RAM instead of 2**. I decided to remove Windows 7 x64, and install Ubuntu, because I just hate Windows. The problem is, the install went all fine, but when I try to boot my laptop, this happens in order:   * Boot laptop   * Gets past BIOS Diagnostics   * I see the purple Ubuntu thing   * Screen goes black and stays that way until I press the Power off button   * Boot laptop again   * Gets past BIOS Diagnostics   * I get an Ubuntu screen where I can choose Boot Normal/Recovery/...   * I press Recovery   * I don't do anything, simply click "Continue to Normal boot"   * It works Why do I always have to boot it up once, go through the whole recovery without actually doing anything, to get it booted? I'm using the GRUB bootloader.


title: Bus Error when run php-cgi

text: This is what I got when I run command "strace /usr/bin/php-cgi -v"               execve("/usr/bin/php-cgi", ["/usr/bin/php-cgi", "-v"], [/* 39 vars */]) = 0     brk(0)                                  = 0x11e4000     old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x77bd1000     uname({sys="Linux", node="ShanghaiDacGW", ...}) = 0     access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)     access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)     open("/etc/ld.so.cache", O_RDONLY)      = 3     ...     rt_sigaction(SIGPIPE, {0x10000000, [RT_69 RT_77 RT_78 RT_80 RT_81 RT_83 RT_84 RT_85 RT_86 RT_88 RT_89 RT_90 RT_91 RT_93 RT_94], SA_NOCLDSTOP}, {SIG_DFL, [], 0}, 16) = 0     --- SIGBUS (Bus error) @ 0 (0) ---     +++ killed by SIGBUS +++     Bus error      Any idea?


title: Guest Additions in VirtualBox

text: I'm setting up a development server with VirtualBox. I've installed Ubuntu 10.10 Server. I want to use filesharing to setup the files that I need to develop on but it seems that the CD drive is not mounting to install the Virtualbox guest additions. How can I configure this to setup the file sharing.


title: Gnome - windows always open top left

text: I find this a highly annoying "feature" on a wide screen monitor that my mostly used apps - terminal and gedit always open directly under the top-left corner of my screen and I have to drag them to my eye position each and every- time. I have tried installing the CompizConfig Settings Manager and using the feature to position windows centre, but this has had no effect - the force feature here isn't working for me either: Window Management -> "place windows" -> Fixed Window Placement -> Windows with fixed positions example: gedit 200 200 keep-in-work-area-to-yes I can use e.g. gnome-terminal --geometry=140x50+50+50 for the terminal but this doesn't work for gedit. Any ideas? Thanks


title: Execute a file in an application based on the file's extension in bash

text: After reading this answer about a zsh feature: > If a given extension has a suffix alias, you can execute a file with that > extention directly, and ZSH will launch the given program and pass the > filename as an argument. Is there something similar to bash? That is, if a given file has an extension, how to directly execute that file, automatically launching a program just by calling the file's name? So doing > program /path/to/foo.ext > > /path/to/foo.ext would equivalent to the same zsh feature? Is this feature available in newer versions of bash?


title: cursor position after pasting in vi / vim

text: One thing that has always bothered me in _vi / vim_ : If I "yank" (a.k.a. "copy") some text, then move to another place in the file and do a "paste", my cursor remains at the **beginning** of the text I just pasted. This is different from what most modern editors do, which is put the cursor at the **end** of the text I pasted. For example, assuming the "copy buffer" contains the word "awesome" which I want to paste after the word "an" in the phrase:               This is an editor      In, for example _gedit_ , after the paste:               This is an awesome editor                       ^ Cursor is here      In _vi_ :               This is an awesome editor                ^ Cursor is here      Can I change _vi_ to act like (for example) _gedit_ in this regard?


title: What would cause "crossover" between two USB2 webcams when using motion?

text: I am using the Motion package for linux to act as a security system with two Microsoft LifeCam HD-5000 webcams. In general it's working very well but I'm experiencing a weird issue. Every now and then the feed from one cam will exhibit "crosstalk" or "crossover" from the other cam, in sweeping bars, best described in this image (highlighted in red): ![WTF?](http://i.stack.imgur.com/yBnHJ.png) As you can see, the image is a mixed mess of the inside and the outside camera feeds. I believe this article from Motion's wiki is describing the same issue, however there is no solution there besides: > If you need more than 1 USB camera add extra USB PCI cards to your computer However that is talking about USB 1.1, and these are USB 2.0 cameras. Also, I do believe this system has two UCB cards and that the cameras are connected to two different USB busses:               root@chef:~# lsusb -t     /:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/2p, 480M         |__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/8p, 480M             |__ Port 2: Dev 3, If 0, Class=stor., Driver=usbfs, 480M             |__ Port 3: Dev 4, If 0, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M             |__ Port 3: Dev 4, If 1, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M             |__ Port 3: Dev 4, If 2, Class=audio, Driver=snd-usb-audio, 480M             |__ Port 3: Dev 4, If 3, Class=audio, Driver=snd-usb-audio, 480M     /:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/2p, 480M         |__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/6p, 480M             |__ Port 2: Dev 3, If 0, Class=HID, Driver=usbhid, 12M             |__ Port 3: Dev 4, If 0, Class=HID, Driver=usbhid, 1.5M             |__ Port 4: Dev 5, If 0, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M             |__ Port 4: Dev 5, If 1, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M             |__ Port 4: Dev 5, If 2, Class=audio, Driver=snd-usb-audio, 480M             |__ Port 4: Dev 5, If 3, Class=audio, Driver=snd-usb-audio, 480M     root@chef:~# lspci     00:00.0 Host bridge: Intel Corporation Core Processor DRAM Controller (rev 12)     00:02.0 VGA compatible controller: Intel Corporation Core Processor Integrated Graphics Controller (rev 12)     00:16.0 Communication controller: Intel Corporation 5 Series/3400 Series Chipset HECI Controller (rev 06)     00:1a.0 USB Controller: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller (rev 06)     00:1b.0 Audio device: Intel Corporation 5 Series/3400 Series Chipset High Definition Audio (rev 06)     00:1c.0 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 1 (rev 06)     00:1c.5 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 6 (rev 06)     00:1d.0 USB Controller: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller (rev 06)     00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev a6)     00:1f.0 ISA bridge: Intel Corporation 5 Series Chipset LPC Interface Controller (rev 06)     00:1f.2 IDE interface: Intel Corporation 5 Series/3400 Series Chipset 4 port SATA IDE Controller (rev 06)     00:1f.3 SMBus: Intel Corporation 5 Series/3400 Series Chipset SMBus Controller (rev 06)     01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 01)     02:00.0 Ethernet controller: Broadcom Corporation NetLink BCM57788 Gigabit Ethernet PCIe (rev 01)      So my questions are:   1. Does anyone know what could cause crossover like this?   2. Any other troubleshooting suggestions?   3. I am guessing I will need to ask the developers of Motion for support, so before I do, can anyone confirm that I do have the cameras connected to two different PCI cards as they suggested?


title: Can someone diagnose this JACK error message?

text: OK. I start JACK without starting the JACK server. I get:               23:09:22.730 Patchbay deactivated.     23:09:22.765 Statistics reset.     Cannot connect to server socket err = No such file or directory     Cannot connect to server socket     jack server is not running or cannot be started     23:09:23.059 ALSA connection graph change.     23:09:23.250 ALSA connection change.      Then I press the 'play' button. I get:               23:10:07.865 Startup script...     23:10:07.866 artsshell -q terminate     Cannot connect to server socket err = No such file or directory     Cannot connect to server socket     jack server is not running or cannot be started     sh: artsshell: not found     23:10:08.268 Startup script terminated with exit status=32512.     23:10:08.268 JACK is starting...     23:10:08.269 /usr/bin/jackd -dalsa -dhw:0 -r44100 -p1024 -n2     23:10:08.275 JACK was started with PID=1764.     Cannot create thread 1 Operation not permitted     Cannot create thread 1 Operation not permitted     jackdmp 1.9.6     Copyright 2001-2005 Paul Davis and others.     Copyright 2004-2010 Grame.     jackdmp comes with ABSOLUTELY NO WARRANTY     This is free software, and you are welcome to redistribute it     under certain conditions; see the file COPYING for details     JACK server starting in realtime mode with priority 10     Cannot lock down memory area (Cannot allocate memory)     audio_reservation_init     Acquire audio card Audio0     creating alsa driver ... hw:0|hw:0|1024|2|44100|0|0|nomon|swmeter|-|32bit     Using ALSA driver HDA-Intel running on card 0 - HDA Intel at 0xdfebc000 irq 42     configuring for 44100Hz, period = 1024 frames (23.2 ms), buffer = 2 periods     ALSA: final selected sample format for capture: 32bit integer little-endian     ALSA: use 2 periods for capture     ALSA: final selected sample format for playback: 32bit integer little-endian     ALSA: use 2 periods for playback     Cannot use real-time scheduling (RR/10)(1: Operation not permitted)     AcquireSelfRealTime error     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     23:10:15.341 Could not connect to JACK server as client. - Overall operation failed. - Server communication error.       If I press nothing, the above read error message repeats infinitely. I installed JACK from repositories and this is what I got.


title: Wireless card won't connect right away

text: I have a netgear wg311 wireless card on my Debian machine. I have it connected using wpa_supplicant. When I type this.               wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant.conf -iwlan0 -Dwext      I get this               TRL-EVENT-SCAN-RESULTS CTRL-EVENT-SCAN-RESULTS Trying to associate with 68:7f:74:47:50:96 (SSID='BigGiraffe' freq=2462 MHz) Associated with 68:7f:74:47:50:96 WPA: Key negotiation completed with 68:7f:74:47:50:96 [PTK=CCMP GTK=TKIP] CTRL-EVENT-CONNECTED - Connection to 68:7f:74:47:50:96 completed (auth) [id=0 id_str=] –      but the connection doesn't work for 5-10 minutes. Anyone know what might be causing this? /etc/network/interfaces               iface wlan0 inet dhcp     wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf     wpa-driver wext     wpa-key-mgmt WPA-PSK     wpa-proto WPA     wpa-ssid BigGiraffe     iface default inet dhcp          auto wlan0      error message on startup               wpa_supplicant: wpa-roam can only be used with the "manual" inet METHOD, run parts /etc/network/if-pre-up.d/wpa_supplicant exited with return code 1.      and it trys to DHCP DISCOVER 255.255.255.255 at 6 different ports.


title: "Fake" DNS for a single host

text: I am running a bind9 dns server at my home network, serving for all my internal servers in my domain local / 192.168.x.x - one of those, extweb.local 192.168.1.33 is also visible from the internet as home.sickel.net (well, not exactly, but you get the idea) Is it possible to set up my internal dns so that it resolvs home.sickel.net as 192.168.1.33? All other hosts on sickel.net are run externally and should not be resolved by my internal dns. (All this mainly to make things easier for the rest of the family, so that they always can refer to the server as home.sickel.net no matter if they are at home or accessing it through the www) All the servers on my home network runs debian. They are all in the same subnet, connected through a single gateway to the internet.


title: Why aren't crontabs stored in user home directories?

text: I'm curious to know: why are crontabs stored in /var rather than in the user's home directories? It makes it a total pain to isolate these files for upgrades but I suspect that there is a logical reason...


title: Virtualbox installation

text: I'm trying to install virtualbox. But when I run dpkg -i {dpkg package} I get following error:               sudo dpkg -i virtualbox-4.1_4.1.18-78361~Ubuntu~precise_amd64.deb      Selecting previously unselected package virtualbox-4.1.     (Reading database ... 245018 files and directories currently installed.)     Unpacking virtualbox-4.1 (from virtualbox-4.1_4.1.18-78361~Ubuntu~precise_amd64.deb) ...     Setting up virtualbox-4.1 (4.1.18-78361~Ubuntu~precise) ...     Adding group `vboxusers' (GID 124) ...     Done.      * Stopping VirtualBox kernel modules                                                                                [ OK ]       * Uninstalling old VirtualBox DKMS kernel modules                                                                                [ OK ]       * Trying to register the VirtualBox kernel modules using DKMS                                                                                Error! Bad return status for module build on kernel: 3.11.0-12-generic (x86_64)     Consult /var/lib/dkms/vboxhost/4.1.18/build/make.log for more information.           * Failed, trying without DKMS      * Recompiling VirtualBox kernel modules                                                                                * Look at /var/log/vbox-install.log to find out what went wrong      In vbox-installation.log I have this:               CC [M]  /var/lib/dkms/vboxhost/4.1.18/build/vboxdrv/r0drv/linux/memobj-r0drv-linux.o     /var/lib/dkms/vboxhost/4.1.18/build/vboxdrv/r0drv/linux/memobj-r0drv-linux.c: In function ‘rtR0MemObjNativeMapUser’:     /var/lib/dkms/vboxhost/4.1.18/build/vboxdrv/r0drv/linux/memobj-r0drv-linux.c:1451:38: error: ‘VM_RESERVED’ undeclared (first use in this function)                      vma->vm_flags |= VM_RESERVED; /* This flag helps making 100% sure some bad stuff wont happen (swap, core, ++). */                                       ^     /var/lib/dkms/vboxhost/4.1.18/build/vboxdrv/r0drv/linux/memobj-r0drv-linux.c:1451:38: note: each undeclared identifier is reported only once for each function it appears in     make[2]: *** [/var/lib/dkms/vboxhost/4.1.18/build/vboxdrv/r0drv/linux/memobj-r0drv-linux.o] Error 1     make[1]: *** [/var/lib/dkms/vboxhost/4.1.18/build/vboxdrv] Error 2     make: *** [_module_/var/lib/dkms/vboxhost/4.1.18/build] Error 2     make: Leaving directory `/usr/src/linux-headers-3.11.0-12-generic'      I did sudo apt-get install build-essential linux-headers-`uname -r` but the problem still exist. Thanks for all answers


title: Are dropbear and OpenSSH host keys compatible?

text: The title basically says it all. But mind: **host key** , not the login key. And if they're not compatible out of the box, is there a way to convert between them - and what would be the steps in that case? Rationale: it would be nice to be able to bring up a dropbear instance in the scope of the initrd, if boot fails, but do so by incorporating the host keys (via initramfs-tools hooks) from OpenSSH that is normally installed on the host.


title: GPU usage monitoring (CUDA)

text: I installed CUDA toolkit on my computer and started BOINC project on GPU. In BOINC I can see that it is running on GPU, but is there a tool that can show me more details about that what is running on GPU - GPU usage and memory usage?


title: What are the URIs starting with file:// or application://?

text: Using Linux, I have more than once seen URIs of files and applications starting with `file://` and `application://`. What are those URIs and how to use them?


title: Illustrate the difference of two squares via the command line

text: So, after 10 years of wanting to study the book that Ramanujan relied upon for a lot of his early strides in mathematics, it's 2012, and the book is finally online. To celebrate, I want to go through each of the propositions using my command line, finding a way to interact with each one. In `octave` syntax, first one is `a^2 - b^2 = (a-b) * (a+b)` That's familiar from algebra, of course. For now, I just want to be able to make a picture of this difference of squares. I've looked at gnuplot, and it doesn't seem to be designed to do simple geometric shapes. NB: I don't want to plot the function `f(x, y) = x^2 - y^2`. I want to draw two squares of a given size in different colors, one inside the other, to illustrate the difference of squares graphically. What I'd like to be able to do is type something like               $plotsquare --center origin --colors=black,gray black=8x8 gray=3x3 -q -o plot.png      'black' being an 8x8 square, 9 being a 9x9 square; the gray square inside the black square illustrates the difference of squares. Does anything like that exist?


title: SSH easily copy file to local system

text: If I'm logged in to a system via SSH, is there a way to copy a file back to my local system without firing up another terminal or screen session and doing scp or something similar or without doing SSH from the remote system back to the local system?


title: scp to Local Machine After SSHing

text: From my local machine I can copy files from a remote machine               scp remote:/some/file/path ~      But what if I'm already SSHed into the remote machine? Can I do something like this               ssh remote     cd /some/file     scp path local:~      where `local` somehow resolves to the machine I SSHed _from_. This would of course be possible if the local machine is running an SSH server and the remote is configured to connect to it, but that isn't always an option. Is something like this possible?


title: Copy file over existing SSH session?

text: > **Possible Duplicate:**   >  SSH easily copy file to local system Let's give the following example: > I've connected to `ssh user@myserver.com`.   >  I need to copy a local file over to the remote server, without exiting SSH. Is this possible? I know I could suspend the process via `Ctrl`+`Z`, `scp` the file, then `fg` the SSH process back to the foreground, but is there a way to do this from within an active SSH session without leaving it?


title: Is it possible to download to files while in a SSH interactive?

text: Here I am, poking around a remote server via SSH, and I want to find out about/read/edit/whatever a file. I don't like `vi` or other CMI stuff, I want to read it locally. Is there any way I can download it without exiting my interactive SSH session? (Even better, would there be any way to run local commands without exiting it?)


title: Download a file from a remote machine while SSH'd into it?

text: It often happens that I'm SSH'd into another machine and I'd like to download a file onto my local machine without having to open a new terminal and scp. For example, something like this:               local $ ssh remote     remote $ ls     remote_file     remote $ download remote_file     …     remote $ ^D     local $ ls     remote_file      Is there any way — even a terrible hack — to let me download a file while I'm SSH'd into the remote host, without using SCP? I'd considered playing some tricks with, ex, `$SSH_CLIENT`, but that won't work when my local machine is behind a NAT (which is basically all the time).


title: Is it possible to download a file locally when I've already ssh'ed into a remote computer?

text: > **Possible Duplicate:**   >  SSH easily copy file to local system Most of the remote download commands seem to involve commands like scp, which are usually used without ssh'ing first (if I recall correctly). I'd prefer a route that's as frictionless as possible.


title: How to copy files from one machine to another using ssh

text: I'm using Linux (centos) machine, I already connected to the other system using `ssh`. Now my question is how can I copy files from one system to another system? Suppose, in my environment, I have two system like `System A` and `System B`. I'm using `System A` machine and some other using `System B` machine. I'm connected to `System B` machine. How can I copy a file from `System B` to `System A`?


title: Gnome-sound-applet not detecting sound card

text: Everything was working until today, the gnome-sound-applet does not detect any sound card. Alsamixer however is working and I can change volume. I noticed that pulseaudio is not running and that start-pulseaudio-x11 gives me an error :               E: [pulseaudio] main.c: Daemon startup failed.      and                 lspci|grep Audio      gives               00:08.0 Audio device: NVIDIA Corporation MCP79 High Definition Audio (rev b1)      Any idea ?


title: Extracting parts of filename

text: I'm trying to use a part of the file name to be inserted into a new file created using the script. For eg: `dcn_2014_01_31_14_17_45_505.pcap` and `dcn_2014_01_31_14_32_27_656.pcap` should give `2014_0131_1417_to_1432_utc.pcap`. I can get it up to `dcn_2014_01_31_14_17_45_505_to_dcn_2014_01_31_14_32_27_656.pcap` . How do I select each number so as to get the desired output? I have used the following script:               TAG1=$(basename ${FILES[0]} | sed 's/.pcap//')     TAG2=$(basename ${FILES[$N-1]} | sed 's/.pcap//')          #merge the files     mergecap -w /mnt/md0/capture/DCN/"${TAG1}_to_${TAG2}".pcap ${FILES[@]}      Where FILES[] is an array of 15 files.


title: IMAP folders: how big is too big?

text: I've switched from using Thunderbird to `offlineimap` and `mutt`. My mailboxes have over 50k messages. After tweaking some settings, `mutt` is very responsive with this many messages. `notmuch` is extremely fast for searches. But `offlineimap` can take several minutes to sync all the folders. After a little research, it appears that IMAP was not intended for use with very large folders. If that's the case, then what kind of emal workflow should I be using to keep folders smaller?


title: How do I recover from the Heartbleed bug in OpenSSL?

text: CVE-2014-0160 a.k.a. Heartbleed is a vulnerability in OpenSSL. It looks scary. How do I determine whether I am affected? If I'm affected, what do I need to do? Apparently upgrading isn't enough.


title: Can ssh return directory list?

text: I have ssh access to other Suse box and I want to list particular directory on the suse box. It will be done from other suse box. I will run this from php later on. Is something like that possible?


title: Problem while running "newgrp" command in script

text: I want to change the working group in my script. So I wrote a line `newgrp test_grp1` in my script. But my script is automatically exited after running this line. Are there any solution to overcome this problem?               #/bin/ksh     ...     newgrp test_grp1     ...      **Note:** I am using Unix AIX OS.


title: How to use a custom crypto algorithm in ipsec?

text: I wrote a custom algorithm using the kernel crypto API (by modifying the existing SHA1 and DES algorithms), compiled and added the .KO object to kernel. How can I use my algorithm in `ipsec` and other app that use cryptographic communication?


title: How to stop python from looking for .py files

text: I have a system with very little resources (embedded). Because of that I only installed the python .pyo files (=byte compiled & optimized) for my program. Now when such a program runs, python keeps looking for .py files (probably to see if the .pyo needs to be updated). The funny thing is that it does that a lot: 25000 stat64() calls (and 8304 getcwd calls()) in 5 minutes!               getcwd("/tmp", 1026)                = 9     getcwd("/tmp", 1026)                = 9     stat64("MyProgram.py", 0xbeb94b0c) = -1 ENOENT (No such file or directory)     stat64("/usr/local/lib/python2.5/MyProgram.py", 0xbeb94b0c) = -1 ENOENT (No such file or directory)     stat64("/usr/local/lib/python25.zip/MyProgram.py", 0xbeb94b0c) = -1 ENOENT (No such file or directory)     stat64("/usr/local/lib/python2.5/MyProgram.py", 0xbeb94b0c) = -1 ENOENT (No such file or directory)     stat64("/usr/local/lib/python2.5/plat-linux2/MyProgram.py", 0xbeb94b0c) = -1 ENOENT (No such file or directory)     stat64("/usr/local/lib/python2.5/lib-tk/MyProgram.py", 0xbeb94b0c) = -1 ENOENT (No such file or directory)     stat64("/usr/local/lib/python2.5/lib-dynload/MyProgram.py", 0xbeb94b0c) = -1 ENOENT (No such file or directory)     stat64("MyProgram.py", 0xbeb94cc8) = -1 ENOENT (No such file or directory)     getcwd("/tmp", 1026)                = 9     stat64("MyProgram.py", 0xbeb94bc4) = -1 ENOENT (No such file or directory)      How can I prevent python from doing this?


title: When would you use an additional file descriptor?

text: I know you can create a file descriptor and redirect output to it. e.g.               exec 3<> /tmp/foo # open fd 3.     echo a >&3 # write to it     exec 3>&- # close fd 3.      But you can do the same thing without the file descriptor:               FILE=/tmp/foo     echo a > "$FILE"      I'm looking for a good example of when you would have to use an additional file descriptor.


title: LXC: How can I mount a drive/directory without restarting the container?

text: If I configure LXC's fstab and restart, there's no problem with the mount, but do I have to restart?


title: Storing output of command in shell variable

text: I have an operation using `cut` that I would like to assign result to a variable               var4=echo ztemp.xml |cut -f1 -d '.'      I get the error: > ztemp.xml is not a command The value of `var4` never gets assigned; I'm trying to assign it the output of:               echo ztemp.xml | cut -f1 -d '.'      How can I do that?


title: curl command output in a variable

text: I am connecting to mySQL database using a shell script. After connecting to the mySQL database, I execute a query. The query gives me 300,000 URLs as the result. For each of the 300,000 URLs I need to check if the URLs actually exist and need to update the table that the URL is checked for its existence. I have planned on using the curl command. I am giving the command as below.               curl -s --head http://myurl/ | head -n 1 | grep "HTTP/1.[01] [23].."      If I just give the command in my shell, I am getting the response (like 301, 200 etc). However, I need it in a variable so that I can use it for some manipulation purposes. For example, like below.               $var = curl -s --head http://myurl/ | head -n 1 | grep "HTTP/1.[01] [23].."     echo $var;     if ($var == "some value")     {          do something;     }     else     {         do some other thing;     }


title: How to put value of echo pipe netcat commands into variable

text: I have this command succession:               echo -ne "/dev/shm/test.sh" | netcat 89.196.167.2 4567      and let's say it return a string like, for example "Hello...bla". (on the 89.196.167.2 i have made a server that takes ssh comands and executes them and returns the result to the client, and it is running ok, it return what i need, so this is not the problem) I want to put this returned value, "Hello...bla", into a variable and use it. If i try this:               var=echo -ne "/dev/shm/test.sh" | netcat 89.196.167.2 4567;echo "$var"      it doesn't work... Bash returns this:               -bash: -ne: command not found      Can you please help me with a solution?


title: Read the output of a command into a variable

text: I am making a bash script but I'm totally new and got lost. I've made this code               cat * | grep "|*parameter1*|" | grep "|*parameter2*|" | cut -f 8,11,12,15,21,23,34 -d "|" | wc -l      which works just fine, but I need to read the `wc -l` output into a variable so I can make an average after that with another bash command. Then, print out that average and make it readable to the user.


title: How to put a command's result into a variable?

text: > **Possible Duplicate:**   >  Storing output of command in shell variable Can anyone advise please how can I put the result of `jps | awk '$2~/Bootstrap/{print $1}'` into a variable so that I can use with other commands?


title: How can I assign the result of a command to a shell variable?

text: I want to assign the result of an expression to a variable and concatenate it with a string, then echo it. Here's what I've got:               #!/bin/bash     cd ~/Desktop;     thefile= ls -t -U | grep -m 1 "Screen Shot";     echo "Most recent screenshot is: "$thefile;      But, that outputs:               Screen Shot 2011-07-03 at 1.55.43 PM.png     Most recent screenshot is:       So, it looks like that isn't getting assigned to $thefile, and is being printed as it's executed. **I'm rather new to this; I'm sure I'm just missing something basic.** Thanks for your patience!


title: How to install Kali linux on to a specific (existing) partition on a USB stick

text: I'm endeavoring to put Kali linux onto a USB stick - I know it's already written up, but I'd like to use only a portion of the total space (the aforementioned link will use the entire drive space). Let's have my 16GB usb stick mounted as sdb ... the goal is:               16 GB total, split like this...     ----------------------------     |     11     |  01  |  04  |   (GB)     ----------------------------          sdb1      sdb2   sdb3     (partition ID)          FAT32     FAT32  FAT32    (format)         storage   fatdog  kalipart (label)        * sdb1 is FAT32 and the main storage area (so that [windows can see it][2] along with any other OSes)   * sdb2 is bootable and has Fatdog64 (6.3.0) and Precise Puppy (5.7.1) installed (multi-booting from one syslinux menu)   * sdb3 is the target partition for Kali to use The objective is to multi-boot Fatdog64, Puppy, and Kali linux. Currently, sdb2 is bootable (syslinux) and successfully passes to Fatdog and Puppy, both on sdb2. Next I'd like to add chainloading to Kali on sdb3. It seems to me that the best way to do that is to load GRUB4DOS from syslinux (both on sdb2), map sdb3 and chainload to sdb3 from GRUB4DOS. So I ask: How do I install Kali onto an existing partition on this USB stick? Other options:   * Install live Kali onto the USB stick/partition from the Kali distro itself - but this doesn't seem to be an option the same way it is with Fatdog/Puppy/Ubuntu   * Boot direclty to sdb3, chainloading to sdb2 if necessary (not preferred, but an option) > Update: > >   1. I have tried copying the files from a mounted iso to sdb3 using > Fatdog64 and noticed several errors, mostly in copying the firmware files. > Here's two examples: >   >     >     Copying /mnt/+mnt+sda1+isos+kali-linux-1+0+6-i286+kali- > linux-1+0+6-i286+iso/firmware/amd64/microcode_1.20120910-2_i386.deb as > /mnt/sda3/firmware/amd64-microcode_1.20120910-2_i286.deb >     ERROR: Operation not permitted >     Copying /mnt/+mnt+sda1+isos+kali-linux-1+0+6-i286+kali- > linux-1+0+6-i286+iso/debian as /mnt/sda3/debian >     ERROR: Operation not permitted >   > > These errors look like permissions errors, but I can't tell if they affect > booting or not (I can troubleshoot other errors later, I'd prefer to keep > this question to just multi-boot). > >   2. I'm chainloading GRUB4DOS from the SYSLINUX installed by default via > Fatdog64 ... >   >     >     label grub4dos >     menu label grub4dos >     boot /boot/grub/grldr >     text help >     Load grub4dos via grldr (in /boot/grub) >     endtext >   > > ... and then once in GRUB4DOS, I have successfully chainloaded GRUB2 (on the > kali partition) ... >   >     >     title Load GRUB2 inside of kali >     find --set-root /g2ldr.mbr >     chainloader /g2ldr.mbr >   > > ... but all this gives me is a `grub>` prompt, and I haven't figured out any > proper combinations of GRUB4DOS commands to load GRUB2 with a GRUB2 config > file - and to add to the confusion, I thought the live CD iso of Kali ran on > syslinux. (@jasonwryan @user63921) > >


title: Linux: How to check whether a process is slowed down by other running processes

text: I have one process running on a RHEL 6.3 machine. Somehow this is taking a longer processing time than the same process running on another machine. How is it possible to know why this process is running slow or if any other parallel running process is slowing down this process?


title: Hit "sasl_decode error=-1" while sending mail via sendmail server on RHEL

text: Having installed sendmail and openwebmail on RHEL workstation 6.3, I can send email through webmail(cgi-bin/openwebmail/openwebmail.pl), but failed to interact with sendmail server in Perl script as following:               use Net::SMTP;          my $smtpserver = 'mail.server.com';     my $smtpport = 25;     my $smtpuser   = 'test';     my $smtppassword = 'test';     my $smtp = Net::SMTP->new($smtpserver, Port=>$smtpport, Timeout => 10, Debug => 1);     die "Could not connect to server!\n" unless $smtp;     $smtp->auth($smtpuser, $smtppassword);     $smtp->mail("Ann");     $smtp->to("hello\@world.com");     $smtp->data();     $smtp->datasend("To: hello\@world.com\n");     $smtp->quit;      While running this Perl script on Windows 7, the output is below:               Net::SMTP>>> Net::SMTP(2.31)     Net::SMTP>>>   Net::Cmd(2.29)     Net::SMTP>>>     Exporter(5.64_01)     Net::SMTP>>>   IO::Socket::INET(1.31)     Net::SMTP>>>     IO::Socket(1.31)     Net::SMTP>>>       IO::Handle(1.28)     Net::SMTP=GLOB(0x2be1e80)<<< 220 mail.server.com ESMTP Sendmail 8.14.4/8.14.4     ; Fri, 11 Apr 2014 19:48:30 +0800     Net::SMTP=GLOB(0x2be1e80)>>> EHLO localhost.localdomain     Net::SMTP=GLOB(0x2be1e80)<<< 250-mail.server.com Hello [9.110.10.236], please     d to meet you     Net::SMTP=GLOB(0x2be1e80)<<< 250-ENHANCEDSTATUSCODES     Net::SMTP=GLOB(0x2be1e80)<<< 250-PIPELINING     Net::SMTP=GLOB(0x2be1e80)<<< 250-8BITMIME     Net::SMTP=GLOB(0x2be1e80)<<< 250-SIZE     Net::SMTP=GLOB(0x2be1e80)<<< 250-DSN     Net::SMTP=GLOB(0x2be1e80)<<< 250-ETRN     Net::SMTP=GLOB(0x2be1e80)<<< 250-AUTH DIGEST-MD5 PLAIN     Net::SMTP=GLOB(0x2be1e80)<<< 250-DELIVERBY     Net::SMTP=GLOB(0x2be1e80)<<< 250 HELP     Net::SMTP=GLOB(0x2be1e80)>>> AUTH DIGEST-MD5     Net::SMTP=GLOB(0x2be1e80)<<< 334 bm9u...     3VnV5VXB6MlBJeHY5TVE9IixyZWFsbT0iaHV...     Net::SMTP=GLOB(0x2be1e80)>>> YXV0a...     Net::SMTP=GLOB(0x2be1e80)<<< 334 cnNwYXV0axODVhOA==     Net::SMTP=GLOB(0x2be1e80)>>>     Net::SMTP=GLOB(0x2be1e80)<<< 235 2.0.0 OK Authenticated     Net::SMTP=GLOB(0x2be1e80)>>> MAIL FROM:<hello>     Net::SMTP: Unexpected EOF on command channel at E:\tool\smtp.pl line 35      It showed that client got authenticated but didn't received any data after invoking "$smtp->mail()", it seems server closed the connection at this point. On the server side, there were some error messages written into /var/log/maillog:               sendmail[16761]: AUTH=server, relay=[9.110.10.6], authid=test, mech=DIGEST-MD5, bits=128     sendmail[16761]: AUTH: sasl_decode error=-1     sendmail[16761]: s3BBmUQj016761: [9.110.10.236] did not issue MAIL/EXPN/VRFY/ETRN    during connection to MTA      maillog showed authentication method is DIGEST-MD5, but it's failed to invoke sasl_decode. Anyone can give any clue for this problem? Thanks a lot. PS: my sendmail.mc is pasted at github


title: Emacs - Strange Whitespace

text: (I posted this same general question here on StackOverflow thinking it had something to do with my emacs configuration, but after following a comment there, I think it is exclusive to `urxvt`) My problem is that, under seemingly random circumstances, the point will be hidden by a large block of the same color as the point. What is interesting about it is that it does behave as the point/console cursor does when I unfocus the terminal window, in that the normally fully-opaque box becomes hollow. So, essentially, the point will suddenly appear wider than normal. I use emacs in `urxvt` only, and I can currently replicate the behavior by pressing space around 5-6 times, at which point the point appears to be 2 wide. This point-widening does not occur when I am in `tmux` or use `lxterminal`


title: Adding timestamp before each STDOUT line inside perlscript

text: In a perl script, I am capturing all the `STDOUT` and `STDERR` using the below code:               open STDOUT, '>>', "$log_file" or die "Can't redirect STDOUT: $!";     open STDERR, ">&STDOUT"  or die "Can't add to  STDOUT: $!";     main();      Here I am logging all those are generated from `main()` but how can I add a timestamp infront of each line of `STDOUT` ?


title: sudo add-apt-repository - command not found (GParted Live CD)

text: I am trying to burn a DVD using GParted (not a DVD _of GParted_ ). I see that GParted uses a Debian distro (Wheezy). I am trying to install dvd+rw-tools:               sudo apt-get install dvd+rw-tools      > Package dvd+rw-tools is not availble, but is referred to by another package. > This may mean that the package is missing, has been obsoleted, or is only > availble from another source Fine. Then I try to add another repository:               sudo apt-add repository ppa:ferramroberto/extra      > sudo: add-apt-repository: command not found Then, I try to install `python-software-properties`:               sudo apt-get install python-software-properties      And get > Unable to locate package python-software-properties How can I make this work?


title: Arch Linux RPI: How accurate is the time on the RPi in Linux?

text: Currently I'm working on a application on my RPi which will be monitoring a set of GPIOs in real-time where the exact time when the GPIO turns HIGH is crucial for my application. And I need to know how the time is being dealt with on the RPi with the Arch Linux OS, is it synchronized towards a UDP NTP Time Server? If that's the case is it being updated continuously in a background thread/deamon like other Linux stuff? Or is perhaps updated each time a call to get the time is made? Because two events might occur on two (or more) GPIOs simultaneously I need to implement the fastest solution possible to get the real-time functionality. The actual date is not important when the specific event happen, instead the exact time relative to the other events is. ( **i.e** the data recorded will be shown in a graph where the spacing between the events should be as exact as possible.) So the question could be broken down to: How is time handled on the RPi with Arch Linux, and how accurate is it in a multi-thread environment? Thanks in advance.


title: Linux and Windows compatible home drive

text: I want to have a singular home drive for both my Win7 and Arch partitions, so I initially set the partition to NTFS, as so:                 5gb /      20gb C:     475gb /home + D:      which worked up until I started developing in SDL (which doesn't like the NTFS partition for permission reasons) so now I'm wondering if there's another format I can use in both windows and linux that isn't fat32 (I have some big (4+Gb) files for game dev)


title: Convert mysql count(*) to int in bash?

text: I'd like to execute this and check if count is 0, 1 or > 1 in bash.               mysql -e "select count(*) from mydb.mydb;"      The output is:               +----------+     | count(*) |     +----------+     |        0 |     +----------+      I don't know how to parse this. Also this will be used in a cron job, so I can't have any output.


title: using inotify to monitor access to a file

text: I would like to have a trigger and when a particular file is accessed by some process, I would like to be notified (i.e. a script should be run). If I understand correctly, this could be achieved with `inotify`. If I have a file `/foo/bar.txt` how would I set up `inotify` to monitor that file? I am using Debian Wheezy with kernel 3.12 (my kernel has inotify support)


title: Maintain Xserver applications running even after closing the remote conecction

text: We have a Ubuntu server (mainly a compute server), which does not have X-server installed on it. One can use something like Byobu or Screen to have programs running on the server even after the SSH connection is closed. However when one runs GUI based applications (using ssh -X), the application gets killed when the SSH connection is closed. Is there a work around this where the GUI based application (like say eclipse) keeps running even when the SSH connection is closed.


title: bc doesn't support log and factorial calculation?

text: Is there any other command line calculator that supports `log`, `n!` calculations ? At least `bc` can't do that, it told me parse error It's best if I could use script, e.g `echo '5!' | program`


title: How to find Debian packages that would free up the most space

text: Say I have a Debian machine where I would like to free up space on '/' by removing useless packages. To find good candidates of packages to review, I would like to focus my attention on the largest ones first. It seems that the standard solution to do this is to list all installed packages by their installed size. However, this solution has a lot of drawbacks, because it ignores dependencies and ignores whether a package was automatically or manually installed:   * If a package is large but many manually installed packages depend on it, then maybe it is not a good candidate to consider for removal (e.g., removing libicu52 is a bad idea even though it's large)   * If a package depends on another package, then removing the second one will also save up the space obtained by removing the first one (e.g., removing libwine also removes wine)   * If a package A depends on another package B and a third package C was only automatically installed as a dependency to B, then removing A will remove B and C will be auto-removed, which should be accounted for (e.g., removing wesnoth-1.10-data removes wesnoth-1.10, which means that wesnoth-1.10-music would be removed). It seems that a right tool for this job should only propose manually installed packages for removal, and should sort them by the space that would be reclaimed by removing them and then running autoremove (removing automatically installed packages that are no longer necessary). Of course you could simulate this by a variant of this solution, but it is both slow and ugly. Hence my question: is there a standard tool that looks at the dependency graph of packages and computes this information? (I am considering to write a script for this, but I'd like to make sure it doesn't exist yet.)


title: How to view files hidden by a mount on Debian 6

text: I have been trying for a while to view files, hidden by a mount on my device sporting Debian 6, to no avail, and being new to Linux, I am compelled to ask the question: How do you view files hidden by a mount on Debian 6? I have gone over the many duplicates I came across as I was drafting this question the first 1 or 10 times and the following answers did not help in my case:   1. Answer to "Access to original contents of mount point"   2. Answer to "Where do the files go if you mount a drive to a folder that already contains files?"   3. Answer to "What happened to the old files if we mount a drive to the directory? [duplicate]" I also found this, but it was a little intimidating to try that with my limited knowledge of what I am even doing. I also asked Linux users around me, who all (both) say that it's impossible to see my files without `umount`ing. So just to make things clear, this is what I am working with:               /tmp # mkdir FOO     /tmp # cd FOO/     /tmp/FOO # touch abc     /tmp/FOO # cd     ~ # mount /dev/sda1 /tmp/FOO/     ~ # ls /tmp/FOO/     bbb     ~ # cd /tmp/     /tmp # mkdir BAR     /tmp # cd     ~ # mount --bind / /tmp/BAR     ~ # cd /tmp/BAR/     /tmp/BAR # ls     bin      etc      lib      media    proc     sbin     sys      usr     dev      home     linuxrc  mnt      root     selinux  tmp      var     /tmp/BAR # cd tmp/     /tmp/BAR/tmp # ls     /tmp/BAR/tmp #      @John1024:               ~ # mount | grep /tmp/     /dev/sda1 on /tmp/FOO type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=cp932,iocharset=cp932,errors=remount-ro)     /dev/root on /tmp/BAR type jffs2 (ro,relatime)      What and to where should I `mount --bind` to see the files that were in `/tmp/somefolder`? Could the functionality of the solutions linked above be related to what build of Debian I am using? Edit: For clarification, these are some of the commands I tried:               ~ # mount --bind /tmp/somefolder /tmp/anotherfolder     ~ # mount --bind / /tmp/anotherfolder     ~ # mount --bind /dev/sda1 /tmp/anotherfolder


title: Do I require a file system when I do not want to store any data

text: I asked a question here Is it mandatory to have a file system One of the comments is : > how a system without file system would work on linux as even a printer or > ethernet card is considered as a file ? What is your goal here ? ...Kiwy Feb > 24 at 14:18 Now here is a log message when booting linux without a file system (which is hanging at the end):                   [Tue Apr 08 20:07:18.298 2014]      [Tue Apr 08 20:07:18.298 2014]      [Tue Apr 08 20:07:18.298 2014] U-Boot 2013.07 (Apr 08 2014 - 14:27:03)     [Tue Apr 08 20:07:18.298 2014]      [Tue Apr 08 20:07:18.298 2014] Memory: ECC disabled     [Tue Apr 08 20:07:18.298 2014] DRAM:  1 GiB     [Tue Apr 08 20:07:18.308 2014] SF: Detected N25Q128A with page size 64 KiB, total 16 MiB     [Tue Apr 08 20:07:18.341 2014] *** Warning - bad CRC, using default environment     [Tue Apr 08 20:07:18.341 2014]      [Tue Apr 08 20:07:18.341 2014] In:    serial     [Tue Apr 08 20:07:18.341 2014] Out:   serial     [Tue Apr 08 20:07:18.341 2014] Err:   serial     [Tue Apr 08 20:07:18.341 2014] U-BOOT for Xilinx-ZC702-14.7     [Tue Apr 08 20:07:18.341 2014]      [Tue Apr 08 20:07:18.341 2014]      [Tue Apr 08 20:07:18.341 2014] SF: Detected N25Q128A with page size 64 KiB, total 16 MiB     [Tue Apr 08 20:07:18.697 2014] Linux     [Tue Apr 08 20:07:18.697 2014]      Load Address: 0x00008000     [Tue Apr 08 20:07:18.697 2014]      Entry Point:  0x00008000     [Tue Apr 08 20:07:18.697 2014]    Verifying Hash Integrity ... OK     [Tue Apr 08 20:07:18.697 2014] ## Loading fdt from FIT Image at 01000000 ...     [Tue Apr 08 20:07:18.697 2014]    Using 'conf@1' configuration     [Tue Apr 08 20:07:18.697 2014]    Trying 'fdt@1' fdt subimage     [Tue Apr 08 20:07:18.697 2014]      Description:  Flattened Device Tree blob     [Tue Apr 08 20:07:18.697 2014]      Type:         Flat Device Tree     [Tue Apr 08 20:07:18.697 2014]      Compression:  uncompressed     [Tue Apr 08 20:07:18.697 2014]      Data Start:   0x0111d344     [Tue Apr 08 20:07:18.697 2014]      Data Size:    11179 Bytes = 10.9 KiB     [Tue Apr 08 20:07:18.697 2014]      Architecture: ARM     [Tue Apr 08 20:07:18.697 2014]      Hash algo:    crc32     [Tue Apr 08 20:07:18.697 2014]      Hash value:   a7a92b47     [Tue Apr 08 20:07:18.697 2014]      Hash algo:    sha1sha1+ OK     [Tue Apr 08 20:07:18.702 2014]    Booting using the fdt blob at 0x111d344     [Tue Apr 08 20:07:18.702 2014]    UncomprOK     [Tue Apr 08 20:07:18.702 2014]    Loading Device Tree to 07ffa000, end 07fffbaa ... OK     [Tue Apr 08 20:07:18.702 2014]      [Tue Apr 08 20:07:18.702 2014] Starting kernel ...     [Tue Apr 08 20:07:18.702 2014]      [Tue Apr 08 20:07:19.453 2014] u @c0a7b000 s5568 r8192 d14912 u32768     [Tue Apr 08 20:07:19.453 2014] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 260096     [Tue Apr 08 20:07:19.453 2014] Kernel command line: root=mtd:jffs2 rw rootfstype=jffs2 console=ttyPS0,115200     [Tue Apr 08 20:07:19.453 2014] PID hash table entries: 4096 (order: 2, 16384 bytes)     [Tue Apr 08 20:07:19.453 2014] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)     [Tue Apr 08 20:07:19.453 2014] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)     [Tue Apr 08 20:07:19.453 2014] __ex_table already sorted, skipping sort     [Tue Apr 08 20:07:19.453 2014] Memory: 1024MB = 1024MB total     [Tue Apr 08 20:07:19.453 2014] Memory: 1036960k/1036960k available, 11616k reserved, 270339 16                         [Tue Apr 08 20:07:19.625 2014] I reach build/linux/kernel/xlnx-3.8/source/net/socket.c:                              [Tue Apr 08 20:07:19.625 2014] DMA: preallocated 256 KiB pool for atomic coherent allocations     [Tue Apr 08 20:07:19.625 2014] xgpiops e000a000.ps7-gpio: gpio at 0xe000a000 mapped to 0xf004e000     [Tue Apr 08 20:07:19.625 2014] GPIO IRQ not connected     [Tue Apr 08 20:07:19.625 2014] XGpio: /amba@0/gpio@41220000: registered, base is 255     [Tue Apr 08 20:07:19.625 2014] GPIO IRQ not connected     [Tue Apr 08 20:07:19.625 2014] XGpio: /amba@0/gpio@41200000: registered, base is 251     [Tue Apr 08 20:07:19.625 2014] usbcore: registered new interface driver usbfs     [Tue Apr 08 20:07:19.625 2014] usbcore: registered new interface driver hub     [Tue Apr 08 20:07:19.625 2014] usbcore: registered new device driver usb     [Tue Apr 08 20:07:19.625 2014] Switching to clocksoutyPS0 at MMIO 0xe0001000 (irq = 82) is a xuartps     [Tue Apr 08 20:07:19.629 2014] console [ttyPSxusbps-ehci xusbps-ehci.0: irq 53, io mem 0x00000000     [Tue Apr 08 20:07:19.670 2014] xusbps-ehci xusbps-ehci.0: USB 2.0 started, EHCI 1.00     [Tue Apr 08 20:07:19.675 2014] hub 1-0:1.0: USB hub found     [Tue Apr 08 20:07:19.675 2014] hub 1-0:1.0: 1 port detected     [Tue Apr 08 20:07:19.681 2014] xi2cps e0004000.ps7-i2c: 400 kHz mmio e0004000 irq 57     [Tue Apr 08 20:07:19.686 2014] xadcps f8007100.ps7-xadc: enabled:   yes reference:  external     [Tue Apr 08 20:07:19.709 2014] xwdtps f8005000.ps7-wdt: Xilinx Watchdog Timer at f00ea000 with timeout 10s     [Tue Apr 08 20:07:19.709 2014] sdhci: Secure Digital Host Controller Interface driver     [Tue Apr 08 20:07:19.709 2014] sdhci: Copyright(c) Pierre Ossman     [Tue Apr 08 20:07:19.709 2014] sdhci-pltfm: SDHCI platform and OF driver helper     [Tue Apr 08 20:07:19.729 2014] usbcore: registered new interface driver usbhid     [Tue Apr 08 20:07:19.729 2014] usbhid: USB HID core driver               [Tue Apr 08 20:07:19.729 2014]  I am at build/linux/kernel/xlnx-3.8/source/drivers/hid/usbhid/hid-core.c                    [Tue Apr 08 20:07:19.729 2014] VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4     [Tue Apr 08 20:07:19.781 2014] MTD: MTD device with name "jffs2" not found.     [Tue Apr 08 20:07:19.781 2014] List of all partitions:     [Tue Apr 08 20:07:19.781 2014] No filesystem could mount root, tried:  jffs2     [Tue Apr 08 20:07:19.781 2014] Kernel panic - not syncing: VFS: Unable to mount root fs on mtd:jffs2     [Tue Apr 08 20:07:19.781 2014] CPU1: stopping     [Tue Apr 08 20:07:19.781 2014] Backtrace:      [Tue Apr 08 20:07:19.781 2014] Function entered at [<c0011094>] from [<c01c6408>]     [Tue Apr 08 20:07:19.781 2014]  r6:c0246418 r5:00000000 r4:00000001 r3:60000193     [Tue Apr 08 20:07:19.781 2014] Function entered at [<c01c63f0>] from [<c0011fbc>]     [Tue Apr 08 20:07:19.781 2014] Function entered at [<c0011f78>] from [<c0012270>]     [Tue Apr 08 20:07:19.781 2014]  r4:c0247ef4 r3:c0011f78     [Tue Apr 08 20:07:19.781 2014] Function entered at [<c001220c>] from [<c00084e4>]     [Tue Apr 08 20:07:19.781 2014]  r5:ef07bf68 r4:f8f00100     [Tue Apr 08 20:07:19.824 2014] Function entered at [<c0008484>] from [<c000da00>]     [Tue Apr 08 20:07:19.824 2014] Exception stack(0xef07bf68 to 0xef07bfb0)     [Tue Apr 08 20:07:19.824 2014] bf60:                   c0a838d0 00000000 00000003 00000000 ef07a000 c01cd528     [Tue Apr 08 20:07:19.824 2014] bf80: ef07a000 c025c418 0000406a 413fc090 00000000 ef07bfbc ef07bfc0 ef07bfb0     [Tue Apr 08 20:07:19.824 2014] bfa0: c000e94c c000e950 60000113 ffffffff     [Tue Apr 08 20:07:19.824 2014]  r6:ffffffff r5:60000113 r4:c000e950 r3:c000e94c     [Tue Apr 08 20:07:19.824 2014] Function entered at [<c000e924>] from [<c000eacc>]     [Tue Apr 08 20:07:19.824 2014] Function entered at [<c000ea40>] from [<c01c4208>]     [Tue Apr 08 20:07:19.824 2014]  r5:00000001 r4:c024cf68     [Tue Apr 08 20:07:19.824 2014] Function entered at [<c01c4118>] from [<001c37c8>]     [Tue Apr 08 20:07:19.844 2014]  r6:10c03c7d r5:00000015 r4:2f06406a r3:c01c37b0     [Tue Apr 08 20:07:19.844 2014] MTD: MTD device with name "jffs2" not found.     [Tue Apr 08 20:07:19.844 2014] List of all partitions:     [Tue Apr 08 20:07:19.844 2014] No filesystem could mount root, tried:  jffs2     [Tue Apr 08 20:07:19.844 2014] Kernel panic - not syncing: VFS: Unable to mount root fs on mtd:      I am booting from flash. Now from the log it is very clear that many of the drivers are already loaded even though file system loading is failed (because I intentionally did not put the file system rootfs.jffs2 in flash ). Now referring to the comment above, if everything is file in linux, how come drivers are successfully loaded? You can see USB,GPIO, SD everything is coming before it asks for file system (and failed). So is it technically correct to say that > linux MUST have a file system **Some background** What I am trying to achieve is to have linux running on a system where a control application will be running. The application just captures some data and send it to some slaves. There is not question of storing data AT ALL. So would like to completely get rid of file system. As per my understanding file system is required for storing data and since I willnot storing any data so why have file system and increase the resource usage ? **Update** _Although I have mentioned this in **background** , but to be specific the sending of the data would take place using USB or Ethernet, so it is natural to have corresponding drivers._


title: Shell script fails to run on startup

text: I want an executable program to run on startup. For this reason, I created a shell script: `/etc/init.d/server`. Then I run `chmod +x name_of_script` and `update-rc.d server defaults`. _server (script):_               #!/bin/sh     cd /home/root/     ./Server_msg      Server_msg prints the messages from a client. Messages are received on static IP address 192.168.1.200. _**Note** : The connection is wireless: Static IP address 192.168.1.200 gets assigned to the device, by a script running also on startup, which loads the Wi-Fi driver's adapter._ _**The problem:_** When I added script _server_ to run on startup as well, system is unable to run both scripts. Any ideas?


title: POSIX conformance: NetBSD 5.1 <sys/time.h> gettimeofday declaration

text: I'm compiling some code which requests POSIX 1003.1 1993 conformance via `-D_POSIX_C_SOURCE=2`. The code includes the header `<sys/time.h>` and wants to call `gettimeofday`, but on NetBSD 5.1 there is a compiler warning about that function not being declared. Looking into NetBSD's header, we see that the declaration of `gettimeofday` is wrapped with a test for `_POSIX_C_SOURCE` being at least `200112`. Was `gettimeofday` really only introduced to POSIX in 2001? That hardly seems right. In 1993, there was already `clock_gettime` with nanoseconds and different clock types, and `getttimeofday` is ancient 4.2 BSD stuff. In the GNU C library's `<sys/time.h>`, `gettimeofday` is not wrapped by anything at all. Which is is right: NetBSD header, or my code relying on `_POSIX_C_SOURCE=2` to reveal the declaration of `gettimeofday` (and glibc, for providing it unconditionally)?


title: Why does grep change the length of output lines?

text: I often use `dpkg` or `aptitude` combined with `grep` when I want to list certain packages available or installed on my system, but I noticed that when I add `| grep`, the output lines look a little bit different. Here's a pure `dpkg` output, the first command was typed when the terminal was smaller, the second one when the terminal was maximized: ![screen](http://i.stack.imgur.com/SqvOc.png) As you can see, the output differs depending on the size of the window -- the spaces are reduced in the case of a smaller one. Now, what happens when we add `| grep`: ![screen](http://i.stack.imgur.com/PbOCY.png) A part of the first output was dropped to the second line. But when I maximised the terminal and typed the command once more, the line is in one piece. Moreover, the columns have the same fixed size (the same spaces between them). This is an `aptitude` output: ![screen](http://i.stack.imgur.com/tHJ2h.png) Both commands were typed in the maximised window, but the `grep` line has narrower columns, and some text of the third column was cut off. Why does it happen? Is there a way to stop `grep` from resizing the lines? I don't know how to add an image without changing its parameters, I hope you see what I'm talking about.


title: Understanding the iptables rules created by FirewallD

text: I am having a hard time trying to figure out what the iptables rules generated by FirewallD say. Focusing on the "public" input zone, I have the following rules:               *filter     :INPUT ACCEPT [0:0]     :FORWARD ACCEPT [0:0]     :OUTPUT ACCEPT [123:456]     :INPUT_ZONES - [0:0]     :INPUT_ZONES_SOURCE - [0:0]     :INPUT_direct - [0:0]     :IN_public - [0:0]     :IN_public_allow - [0:0]     :IN_public_deny - [0:0]     :IN_public_log - [0:0]     :OUTPUT_direct - [0:0]     -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT     -A INPUT -i lo -j ACCEPT     -A INPUT -j INPUT_direct     -A INPUT -j INPUT_ZONES_SOURCE     -A INPUT -j INPUT_ZONES     -A INPUT -p icmp -j ACCEPT     -A INPUT -j REJECT --reject-with icmp-host-prohibited     -A OUTPUT -j OUTPUT_direct     -A INPUT_ZONES -i wlan0 -j IN_public     -A INPUT_ZONES -j IN_public     -A IN_public -j IN_public_log     -A IN_public -j IN_public_deny     -A IN_public -j IN_public_allow     -A IN_public_allow -p tcp -m tcp --dport 22 -m conntrack --ctstate NEW -j ACCEPT     -A IN_public_allow -d 224.0.0.251/32 -p udp -m udp --dport 5353 -m conntrack --ctstate NEW -j ACCEPT        * What does the `-` means in the custom chains `INPUT_ZONES` and `INPUT_ZONES_SOURCE`?   * What happens when the rule jumps to `IN_public_log`?   * Why is there no `DROP` policy at all?


title: How to disable the try again password in ssh command

text: I want the ssh command to only allow one chance in typing the password, if the password was wrong at the first time the ssh will return               Permission denied (publickey......).      Is there a flag that tells the ssh to request only once the password? Instead of:               [nir@dhcppc4 ~]$ ssh pokemon@192.168.1.103     pokemon@192.168.1.103's password:      Permission denied, please try again.     pokemon@192.168.1.103's password:      Permission denied, please try again.     pokemon@192.168.1.103's password:      Permission denied (publickey.....).      I want:               [nir@dhcppc4 ~]$ ssh pokemon@192.168.1.103     pokemon@192.168.1.103's password:      Permission denied (publickey.....).      The solution must be on the client side (e.g. some flag to the ssh command or using pipeline), I cant touch `sshd_config`, or any other system config file. Because -in general- I build 3rd party software (so I can;t generate keys nor config system files) that access the servers in the LAN, the passwords are saved in the DB (therefor doesnt need second attempt). And in my code if I'll be able to assume that I only have one attempt to `ssh`/`scp` it will simplify the relevant code.


title: setxkbmap for macbook pro (US)

text: I recently installed awesome on my ubuntu oneiric, a nice window manager. This doesn't seem to inherit the keyboard settings that were set in the Unity settings. Now, the problem is, I can't seem to find the correct keyboard layout to set (using setxkbmap). The control panel in Unity just states "US", bet with               setxkbmap -layout us      some keys don't work correctly on my macbook pro 8,2. Does anyone here know the correct settings?


title: Is there a way to integrate the unix "man pages" into OSX's Dictionary app?

text: I was thinking it would be cool to be able to look things up in the man pages the same way one looks up words with the "Dictionary" app. Is there a way to add the man pages that OSX supplies into the Dictionary app so when you right click on a "word" (or in this case, a unix function/keyword/etc.), and click "Look Up in Dictionary", it can search for the word in the man pages too and integrate the search results into the Dictionary window? So when the window pops up, the tabs across the top would be "All", "Dictionary", "Thesaurus", "Apple", "Wikipedia", "Man Pages". Or is this too wishful of thinking?


title: openBSD w/ KDE 3.5 - no text in menus or any gui's

text: I just installed KDE 3.5 on my new openBSD 5.4 i386 box. At the moment I don't know that much about openBSD or Unix. For that matter, this is my learning- box. I installed KDE from a mirror, and when it finished it said something about "You may wish to update your font path for /usr/local/share/ghostscript/fonts". Of course, not knowing what this is I proceed forth into KDE. As soon as it runs I notice that there's no text in the drop-down menus where things like different languages should be. I proceed until I reach the desktop and notice that there's no text in any of the menus for anything... What am I doing wrong here? *** Edit *** After messing around with the GUI elements of KDE for a while I found something interesting: If I have a window open (let's say Control Center) and none of the text shows up in the left-hand pane (like Appearance, Desktop, and Internet & Network) if I drag the window a bit the text will appear... This trick does not work for the little KDE start button on the taskbar though (since I can't move it around). I tried changing the font to something else, but it has the same effect... The plot thickens


title: What does "tail -f " do?

text: I don't understand the function of the option `-f` added to the `tail` command. I know that `tail` views the "last" part of a file. The manual says that > `-f` outputs appended data as the file grows But I don't really understand what that means. I know the meaning of each word in the previous quotation, but I don't understand the meaning of the whole sentence.


title: How frequently is the proc file system updated on Linux?

text: How frequently is the `proc` file system updated on Linux? Is it 20 milliseconds (time quantum)?


title: Reboot shortcut

text: I need to haved a shortcut on my desktop to a URL which reboots my debian server and then says "reboot successfull" in the browser, if that was the case. I do not want a putty reboot shortcut or something, I've thought about CGI but what do you recommend?


title: Extract name of file without extension in shell script

text: > **Possible Duplicate:**   >  Best way to remove file extension from a string?   >  How to rename multiple files by removing the extension? I have a metric boatload of .txt files I'd like to load into a database. The tables have the same name as the .txt files, but without the extension. So I'd like to execute the command               for f in *.txt; do mysql -u root -p -e "LOAD DATA LOCAL INFILE '$f' INTO TABLE $f" -D rn4; done      However, the last `$f` is giving me headaches as I want it to only use the name, not the extension. So for the file `piRNA.txt` the command would look like               mysql -u root -p -e "LOAD DATA LOCAL INFILE 'piRNA.txt' INTO TABLE piRNA" -D rn4      How do I do this? To make the answer useful for others, please do not just give me the command, but please write a line or two about how to extract the name in the general case.


title: getting file name from the input path to the file in shell scripts

text: > **Possible Duplicate:**   >  Best way to remove file extension from a string? Say that I have a script called `script.sh` In the shell I type               script.sh ../folder/file.py      and in that file I know `echo $1` will output `../folder/file.py` But is there anyway of getting just the filename without the extension... `file` only?


title: How to rename multiple files by removing the extension?

text: I have a number of tiff files named:               sw.001.tif     sw.002.tif     ...      and I want to remove the `.tif` at the end of each of the files. How can I use the `rename` command to do this?


title: Which to choose - BSD or Unix-style commands where available?

text: Commands like `ps` come with a lot of parameters, especially because they give the use an option to choose between Unix and BSD style flags. I hope you get my point here. So, when there's such an option available, which should I choose for maximum compatibility across all linux systems? (max. compatibility is one of the priorities for instance) I know that Unix style is quite obvious, but BSD commands for some reason include more readable information (column titles for example, CPU column etc). Of course, please correct me if I am wrong, but that's what I felt.


title: What is the difference between -j DROP and -j STEAL?

text: I often see that people set `STEAL` target in iptables rules. It's possible to get this target by installing (on debian) `xtables-addons-common` and `xtables-addons-dkms`. I was curious why people prefer `STEAL` over `DROP`, so I checked the manual, but there's only the following info:                  STEAL            Like the DROP target, but does not throw an error like DROP when used            in the OUTPUT chain.      Does anyone know what error? For example, we could take the two following rules:               -A OUTPUT --protocol tcp --match multiport ! --dports 80,443 --match set --match-set bt_level1 dst --jump STEAL      and:               -A OUTPUT --protocol tcp --match multiport ! --dports 80,443 --match set --match-set bt_level1 dst --jump DROP       What is the difference between them?


title: Reinstall Debian

text: I have a Debian based server but I don't have physical access to it and it doesn't have a DVD-drive or similar. I only have root access. Is it possible to format and reinstall Debian just by using the root account? I was thinking of solutions like installing to a separate partition and after install format the current partition or perhaps using VMWare and always run it as a VM although this would impede performance. This is because my Debian server is currently in my home country(at my parents) while I moved to another country. Do you think perhaps I should dump the server altogether and go for a hosted solution? I normally would prefer to keep my server because hosted solutions normally cost you more than having your own server and paying only for electricity.


title: I want to tar X directory not including its parents

text: tar cvf /var/lib/backup/sample.tar /home/user/.project      However, when I extract, I get its parents as well               /backup/       - /home/          - /user/             - .project/      This tar commands does it job because it doesn't include anything else in its parents (other folders under `user` for example). I want to do this programmatically, so changing the current working directory into `/home/user/` is not really an option. Is it possible to do that?


title: copying files from one directory to another

text: I have to copy a set of files from one folder to another folder and I'm using the following command:               cp -rf `head -n 100 /home/tmp/abc.txt` /home/tmp/test/files      the file contents in `abc.txt` is like:               ./folder1/example.tar.gz     ./folder2/example.tar.gz     ./folder3/example.tar.gz      But while executing the above `cp` command I'm getting:               cp: will not overwrite just-created `/home/tmp/test/files/example.tar.gz' with `./folder3 /example.tar.gz'     cp: will not overwrite just-created `/home/tmp/test/files/example.tar.gz' with `./folder1/example.tar.gz'      I can understand that because the name of the .gz files are the same that are showing in the error. What I want to do is to have the same folder structure inside `/home/tmp/test/files` as listed in `abc.txt`, like:               /home/tmp/test/files/folder1/example.tar.gz     /home/tmp/test/files/folder2/example.tar.gz     /home/tmp/test/files/folder3/example.tar.gz      But I'm getting only one `example.tar.gz` inside files folder after executing the above `cp` command. So what is the way to get what I mentioned above?


title: Linux running slow with 0 swap left

text: Our Linux server is responding very slowly. `top` doesn't show any excessive CPU usage. I noticed that even though there's about 5GB of free memory, the system is using all of swap with no free swap left. Could this be reason for system running slow? Is there any solution other than reducing the number of processes? Secondly, even though there is free memory available, why is Linux swapping already? I thought swap is used only when there’s not actual memory left.               free -m                  total       used       free     shared    buffers     cached     Mem:         32045      26218       5826          0        127        123     -/+ buffers/cache:      25967       6077     Swap:        16387      16387          0      Update:   * swapiness is at default level: 60    * I don't think it's a numa system    * I see a couple of java processes running with 8GB heap: `-Xms8000m -Xmx8000m` Seems nuts on first look, but possibly someone had reasons for doing this. I think this is what's eating up most of swap, but I need to further investigate how the java heap affects Linux swap and memory/performance in general. Any pointers on impact of above java heap config on system performance will be really helpful.


title: How to have tail -f show colored output with vim?

text: In this question, Gilles answered > Yet another possibility is to run `tail -f` in an **Emacs** shell buffer and > use Emacs's syntax coloring abilities. Because I'm a vim user, I'd like to do this with _vim_ , not _emacs_.   Does _vim_ have this feature?