title: Transposing multiple columns is a row

text: I need to transpose a file from this format               1 2 3 4       6 7 8 9        a b c d        f g h i j       to this format               1 2 6 7 a b f g       3 4 8 9 c d h k      two columns in a single row in the way posted above. Any suggestions??


title: Shell script to perform telnet session to ser2net

text: I have setup a xenserver (free) hosting a VM (Debian 7.5). On this xenserver I have attached a serial GSM modem. I have configured xen to run ser2net so I have a serial proxy available. This works perfectly local and remote (telnet). Now on the Debian VM I am running zenoss and I wish to use the paging functionality. I'm creating a bash script to simulate the telnet session and sending a message. This script is only working for 50%.               #!/usr/bin/expect     set timeout 20     set number [lindex $argv 0]     set message [lindex $argv 1]     spawn telnet 10.10.0.52 3333     #wait?     sleep 1     send AT+CMGS="$number"\r;     expect ">"     send "$message^Z";     interact     #...      Running the script:               administrator@debian:/home/zenoss$ ./sms.sh +32486000000 xxen     spawn telnet 10.10.0.52 3333     Trying 10.10.0.52...     Connected to 10.10.0.52.     Escape character is '^]'.     AT+CMGS="+32486000000"     > xxen^Z      I'm having problems sending the control character `Ctrl`+`Z` to initiate the send, it hangs. _(note: the ^Z is the real character inserted with vi)_ Plus how should I go about multiple recipients? And how should I exit and disconnect. EDIT: I tried > send "$message^Z"; to > send "$message"^Z; but got this result:               administrator@debian:/home/zenoss$ ./sms.sh +32486000000 xxen     spawn telnet 10.10.0.52 3333     Trying 10.10.0.52...     Connected to 10.10.0.52.     Escape character is '^]'.     AT+CMGS="+32486000000"     > extra characters after close-quote         while executing     "send "$message"^Z;     interact     #...     "         (file "./sms.sh" line 10)      UPDATE:               #!/usr/bin/expect     # - VAR     set ctrlz \032     set xt \135     set timeout 15     set host [lindex $argv 0]     set port [lindex $argv 1]     set number [lindex $argv 2]     set message [lindex $argv 3]     # - CONNECT     spawn telnet $host $port     sleep 1     # - SEND     send AT+CMGS="$number"\r;     expect ">"     send "$message$ctrlz";     expect "OK"     # - END


title: How to store an image file in bash variable?

text: After I use the following command,               pngString="$(cat example.png)"         echo -n "$pngString" > tmp.png      I can't open the tmp.png as a PNG file. Maybe some information is lost when I use `$pngString` to store the image file. So the question is: How can I store the complete image information using a variable in bash script?


title: About Ingo Molnar's Realtime Preemption patch

text: Does Ingo Molnar's Realtime Preemption patch support ARM cortex-A8?


title: "Software update" appears empty in Debian, but there are upgrades available

text: I'm running Debian 7 on vmware workstation. When I run Applications - System Tool - Software Update I just get a blank window, nothing happens. Updating the system works fine with "apt-get update && apt-get -u dist- upgrade".   But when I do this, I get a GUI window with "Could not get update, failed to process request - more details: Operation was cancelled". I'm running gnome as a normal user (not root).   Not able to find anything interesting in /var/log/* Anyone got any ideas what's causing this?


title: e2fsck giving some error

text: I am playing with LVM and while doing `lvreduce`. I now get this error:               [root@localhost raja]# e2fsck -f /dev/vg1/lvol2     e2fsck 1.41.12 (17-May-2010)     e2fsck: Superblock invalid, trying backup blocks...     e2fsck: Bad magic number in super-block while trying to open /dev/vg1/lvol2          The superblock could not be read or does not describe a correct ext2     filesystem.  If the device is valid and it really contains an ext2     filesystem (and not swap or ufs or something else), then the superblock     is corrupt, and you might try running e2fsck with an alternate superblock:         e2fsck -b 8193 <device>      How can I fix this?


title: Bash Commands not working on Mac

text: Hello I open my terminal window on Mac Os 10.6.8 as I am trying to update my ruby to 1.9.3 and the terminal gives me this response immediately as I open it:               -bash: export: /Library/Frameworks/Python.framework/Versions/Current/bin': not a valid identifier      -bash: export:/Library/Frameworks/Python.framework/Versions/2.7/bin': not a valid identifier     -bash: export: /Library/Frameworks/Python.framework/Versions/Current/bin': not a valid identifier      -bash: export:/Library/Frameworks/Python.framework/Versions/Current/bin': not a valid identifier      -bash: export: /usr/bin': not a valid identifier      -bash: export:/bin': not a valid identifier      -bash: export: /usr/sbin': not a valid identifier      -bash: export:/sbin': not a valid identifier      -bash: export: /usr/local/bin': not a valid identifier      -bash: export:/usr/local/git/bin': not a valid identifier      -bash: export: /usr/X11/bin': not a valid identifier      -bash: export:/Users/oskarniburski/.rvm/bin': not a valid identifier      -bash: export: /usr/X11R6/bin': not a valid identifier      -bash: export:/Library/Frameworks/Python.framework/Versions/Current/bin': not a valid identifier      -bash: export: /Library/Frameworks/Python.framework/Versions/2.7/bin': not a valid identifier      -bash: export:/Library/Frameworks/Python.framework/Versions/Current/bin': not a valid identifier      -bash: export: /Library/Frameworks/Python.framework/Versions/Current/bin': not a valid identifier      -bash: export:/usr/bin': not a valid identifier      -bash: export: /bin': not a valid identifier      -bash: export:/usr/sbin': not a valid identifier      -bash: export: /sbin': not a valid identifier      -bash: export:/usr/local/bin': not a valid identifier      -bash: export: /usr/local/git/bin': not a valid identifier      -bash: export:/usr/X11/bin': not a valid identifier      -bash: export: /Users/oskarniburski/.rvm/bin': not a valid identifier      -bash: export:/usr/X11R6/bin': not a valid identifier      I tried to change my path but it did not work. I am not sure how to go about this problem and have been reading a whack load of forums. Any ideas? Here is the bash_profile:               $ /bin/cat ~/.bash_profile          # Setting PATH for MacPython 2.5     # The orginal version is saved in .bash_profile.pysave     PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}"     export PATH          # Setting PATH for MacPython 2.5     # The orginal version is saved in .bash_profile.pysave     PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}"     export PATH          # Setting PATH for Python 2.7     # The orginal version is saved in .bash_profile.pysave     PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"     export PATH          # Setting PATH for EPD_free-7.3-2     # The orginal version is saved in .bash_profile.pysave     PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}"     export PATH          # Setting PATH for Python 3.3     # The orginal version is saved in .bash_profile.pysave     PATH="/Library/Frameworks/Python.framework/Versions/3.3/bin:${PATH}"     export PATH          [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*     export PATH=/usr/local/bin:/Library/Frameworks/Python.framework/Versions/3.3/bin /Library/Frameworks/Python.framework/Versions/Current/bin /Library/Frameworks/Python.framework/Versions/2.7/bin /Library/Frameworks/Python.framework/Versions/Current/bin /Library/Frameworks/Python.framework/Versions/Current/bin /usr/bin /bin /usr/sbin /sbin /usr/local/bin /usr/local/git/bin /usr/X11/bin /Users/oskarniburski/.rvm/bin /usr/X11R6/bin     export PATH=/usr/local/bin:/Library/Frameworks/Python.framework/Versions/3.3/bin /Library/Frameworks/Python.framework/Versions/Current/bin /Library/Frameworks/Python.framework/Versions/2.7/bin /Library/Frameworks/Python.framework/Versions/Current/bin /Library/Frameworks/Python.framework/Versions/Current/bin /usr/bin /bin /usr/sbin /sbin /usr/local/bin /usr/local/git/bin /usr/X11/bin /Users/oskarniburski/.rvm/bin /usr/X11R6/bin          ##     # Your previous /Users/oskarniburski/.bash_profile file was backed up as /Users/oskarniburski/.bash_profile.macports-saved_2013-09-26_at_17:32:30     ##          # MacPorts Installer addition on 2013-09-26_at_17:32:30: adding an appropriate PATH variable for use with MacPorts.     export PATH=/opt/local/bin:/opt/local/sbin:$PATH     # Finished adapting your PATH environment variable for use with MacPorts.


title: List all connected SSH sessions?

text: I just SSH'd into root, and then SSH'd again into root on the same machine. So I have two windows open both SSH'd into root on my remote machine. From the shell, how can I see a list of these two sessions?


title: "Friendly" terminal color names in shell scripts?

text: I'm aware of libraries in languages such as Ruby and Javascript to make colorizing your terminal scripts easier by using color names like "red". But is there something like this for shell scripts in Bash, or Ksh, or whatever?


title: Why didn't Ctrl-C work?

text: I just hit `Ctrl``c` twice at my shell in an attempt to halt a process that is taking a long time to finish. `^C` was echoed twice, but the process just kept going. Why didn't `Ctrl``c` quit the process like it normally does?


title: SSD as a read cache for FREQUENTLY read data

text: I'm looking for ways to make use of an SSD to speed up my system. In “Linux equivalent to ReadyBoost?” (and the research that triggered for me) I've learned about bcache, dm-cache and EnhanceIO. All three of these seem capable of caching read data on SSD. However, unless I'm missing something, all three seem to store a file/block/extent/whatever in cache the first time it is read. Large sequential reads might be an exception, but otherwise it seems as if every read cache miss would cause something to get cached. I'd like the cache to cache those reads I use _often_. I'm worried that a search over the bodies of all my maildir files or a recursive grep in some large directory might evict large portions of stuff I read far more often. **Is there any technology to cache _frequently_ read files, instead of recently read ones?** Something which builds up some form of active set or some such? I guess adaptive replacement might be a term describing what I'm after. Lacking that, I wonder whether it might make sense to use LVM as a bottom layer, and build up several bcache-enabled devices on top of that. The idea is that e.g. mail reads would not evict caches for `/usr` and the likes. Each mounted file system would get its own cache of fixed size, or none at all. **Does anyone have experience with bcache on top of lvm?** Is there a reason against this approach? Any alternative suggestions are welcome as well. Note however that I'm looking for something ready for production use on Linux. I feel ZFS with its L2ARC feature doesn't fall in that category (yet), although you are welcome to argue that point if you are convinced of the opposite. The reason for LVM is that I want to be able to resize space allocated for those various file systems as needed, which is a pain using static partitioning. So proposed solutions should also provide that kind of flexibility. * * * _Edit 1: Some clarifications._ My main concern is bootup time. I'd like to see all the files which are used for _every_ boot readily accessible on that SSD. And I'd rather not have to worry about keeping the SSD in sync e.g. after package upgrades (which occur rather often on my Gentoo testing). If often-used data which I don't use during boot ends up in the cache as well, that's an added bonus. My current work project e.g. would be a nice candidate. But I'd guess 90% of the files I use every day will be used within the first 5 minutes after pressing the power button. One consequence of this aim is that approaches which wipe the cache after boot, like ZFS L2ARC apparently does, are not a feasible solution. The answer by goldilocks moved the focus from cache insertion to cache eviction. But that doesn't change the fundamental nature of the problem. Unless the cache keeps track of how often or frequently an item is used, things might still drop out of the cache too soon. Particularly since I expect those files I use all the time to reside in the RAM cache from boot till shutdown, so they will be read from disk only once for every boot. The cache eviction policies I found for bcache and dm-cache, namely LRU and FIFO, both would evict those boot-time files in preference to other files read on that same working day. Thus my concern.


title: Arch sometimes won't suspend

text: Sometimes the computer won't auto-suspend when the lid has been closed. When this happens re-closing the lid won't make it suspend until next reboot. After the reboot the auto-suspend works again. After a while it stops working again, I haven't been able to determine what changes the state from suspendable to unsuspendable. In the unsuspendable state "sudo pm-suspend" and "sudo systemctl suspend" don't make it stay suspended. I'm running a Lenovo X220 with Arch 64 bit. What should I do/try to make it work as it is supposed to? EDIT:added journalctl output: journalctl -xn               -- Logs begin at Sun 2013-08-25 11:05:23 CEST, end at Tue 2014-03-04 20:32:31 CET. --     Mar 04 20:32:06 x220 systemd[1]: systemd-suspend.service: main process exited, code=exited, status=1/FAILURE     Mar 04 20:32:06 x220 systemd[1]: Failed to start Suspend.     -- Subject: Unit systemd-suspend.service has failed     -- Defined-By: systemd     -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel     -- Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/be02cf6855d2428ba40df7e9d022f03d     --      -- Unit systemd-suspend.service has failed.     --      -- The result is failed.     Mar 04 20:32:06 x220 systemd[1]: Dependency failed for Suspend.     -- Subject: Unit suspend.target has failed     -- Defined-By: systemd     -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel     -- Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/be02cf6855d2428ba40df7e9d022f03d     --      -- Unit suspend.target has failed.     --      -- The result is dependency.     Mar 04 20:32:06 x220 systemd[1]: Service sleep.target is not needed anymore. Stopping.     Mar 04 20:32:06 x220 systemd[1]: Unit systemd-suspend.service entered failed state.     Mar 04 20:32:06 x220 systemd[1]: Stopping Sleep.     -- Subject: Unit sleep.target has begun shutting down     -- Defined-By: systemd     -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel     --      -- Unit sleep.target has begun shutting down.     Mar 04 20:32:06 x220 systemd[1]: Stopped target Sleep.     -- Subject: Unit sleep.target has finished shutting down     -- Defined-By: systemd     -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel     -- Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/9d1aaa27d60140bd96365438aad20286     --      -- Unit sleep.target has finished shutting down.     Mar 04 20:32:06 x220 sudo[21989]: pam_unix(sudo:session): session closed for user root     Mar 04 20:32:06 x220 kernel: video LNXVIDEO:00: Restoring backlight state


title: Set specific GPG key for specific recipient in mutt

text: I'm trying to make `mutt` use a specific GPG key when sending mails to a specific recipient, much like "per-recipient rules" in `OpenPGP / Enigmail`. For example, if I want to send an email to `coworker@company.com` I want to encrypt it with the public key `0xDEADBEEF` and when I send an email to `loveydovey@home.net` I want to encrypt it with some other public key `0xBA5EBA11`. To this end, I include the following lines in my `~/.mutt/muttrc` file:               send-hook '~t ^coworker@company\.com$' 'set crypt_autoencrypt ; set crypt_autosign'     crypt-hook '~t ^coworker@company\.com$' '0xDEADBEEF'     send-hook '~t ^loveydovey@home\.net$' 'set crypt_autoencrypt ; set crypt_autosign'     crypt-hook '~t ^loveydovey@home\.net$' '0xBA5EBA11'      The `send-hook` works as expected, but I still always have to pick the key. How can I make `mutt` choose the key as defined by `crypt-hook`?


title: Cloning packets with iptables

text: I can't figure out for sure, is there a way to clone packets with iptables on one machine? I have an UDP stream to the specific addres (e.g. 192.168.207.201:9702) and I want to do some processing on this machine and simultaneously send this stream to another machine (eg 192.168.207.202). I added the following rule on 192.168.207.201:               iptables -t mangle -A PREROUTING -p udp --dport 9702 -j TEE --gateway 192.168.207.201      and the packets go to the OUTPUT chains of filter and mangle tables, but for some reason they completely bypass all the chains of nat table, so I can't DNAT them. So is there a way to do what I want or is it absolutely impossible to do on one machine by means of iptables?


title: How do I load initrd into memory to be passed to kernel when using kexec?

text: As the MIPS port of `kexec` doesn't support the `\--initrd` param, I'm looking for workarounds to imitate the feature. According to Linux/MIPS wiki, MIPS kernels support `rd_start` and `rd_size` kernel command line arguments for specifying the location of initrd. I'm wondering would it be possible to load initrd into memory and pass it along the kernel parameters? If it's possible, where in memory I should load the file and how do I load it? I thought about concatenating the kernel and the initrd into one file, but how do I get the address where `kexec` has loaded the new kernel? A bit of background: I have a WNDR3700 wifi router running OpenWrt with a kexec'd kernel. My goal is to boot into a vanilla OpenWrt kernel stored on usb to ease upgrades. The problem (currently) is that the usb modules are not build into the kernel, but instead they are provided as loadable kernel modules. I'm able to boot from usb to another kernel using an embedded initramfs, but using an initramfs requires me to compile the kernel, doesn't it? So, alternatively, could I embed initramfs/initrd into an existing kernel binary/elf (without any ramdisk) and avoid recompiling the kernel? Also, obviously compiling the usb modules into the kernel requires recompiling the kernel, so that's not an option.


title: Remapping Left Control <LCTL> in xkb changes behavior of Alt + Left Shift

text: For some reason pressing any alt key (including `<MENU>`) together with `<LFSH>` toggles "Switch windows of an application". This can be turned off by commenting out                key <LCTL> { [    Tab,      Tab,       Tab,         Tab  ] };      in my xkb layout file. However, I would like to keep remapping left control `<LCTL>` to `Tab`. How can I do this without causing the above behavior? I am using Fedora 20 with kernel `3.14.7-200.fc20.i686`. The corresponding entry in `/usr/share/X11/xkb/symbols/us` is               partial alphanumeric_keys     xkb_symbols "workman-d" {              name[Group1]= "English (Workman special)";              include "us(workman)"              key <TLDE> { [ grave, asciitilde,        degree,           degree ] };         key <AE03> { [     3, numbersign,       section,          section ] };              key <TAB> { [    BackSpace,       BackSpace,       BackSpace,        BackSpace ] };         key <AD01> { [     q,          Q,            at,               at ] };         key <AD08> { [     u,          U,    udiaeresis,       Udiaeresis ] };              key <CAPS> { [    Control_L,       Control_L,       Control_L,        Control_L ] };         key <AC01> { [     a,          A,    adiaeresis,       Adiaeresis ] };         key <AC02> { [     s,          S,        ssharp,           ssharp ] };         key <AC08> { [     e,          E,      EuroSign,         EuroSign ] };         key <AC09> { [     o,          O,    odiaeresis,       Odiaeresis ] };              key <AB04> { [     c,          C,          cent,        copyright ] };              key <LCTL> { [    Tab,   Tab,       Tab,         Tab  ] };         key <LFSH> { [ Shift_L,     Shift_L,      Shift_L,        Shift_L ] };         key <MENU> { [ Alt_R,      Alt_R,         Alt_R,            Alt_R ] };          };      The xev output is   * `keycode 64 (keysym 0xffe9, Alt_L)` from pressing left alt   * `keycode 50 (keysym 0xffe1, Shift_L)` from pressing left shift   * `FocusOut event, serial 36, synthetic NO, window 0x2a00001, mode NotifyGrab, detail NotifyAncestor` from pressing left alt + left shift


title: show entered new password in unix "passwd" command

text: Is is possible to run the **passwd** command with an option to show the newly entered passwords? By default it doesn't show what I type and I don't want this.               [dave@hal9000 ~]$ passwd      Changing password for user dave.     Changing password for dave.     (current) UNIX password:      New password: bowman     Retype new password: bowman     passwd: all authentication tokens updated successfully.


title: Using sed with special characters

text: I have a directory full of XML files that look like this, for which I want to change the value of the "offset" element number from 1 to some other number               $ cat my.xml           <offset xmlns="">1</offset>      I wrote various combinations of this sed command, but nothing I tried runs without an error. I am pretty sure that I need to escape some of the characters, but those that I've tried always end in errors ("unexpected token", "unknown option", etc). I also tried without the -e flag, since it really isn't an expression.               sed -i -e s/<offset xmlns="">1</offset>/<offset xmlns="">99</offset>/ *.xml      Any help would be appreciated.


title: How to echo (a (executable-)string) to the prompt, so that the cursor flashes at the end of the line?

text: How to echo `(a (executable-)string)` to the prompt to make the cursor sit at the end of the line? So that I can hit `Enter` to execute or `Ctrl`-`C` to throw away the line. Is this possible at all? I know an (interactive) bash-script would probably be nicer, but I'd like to keep it simple. Example:               echo_to_prompt "rm -R ./tmp/logs/delete_me_every_once_in_a_while/"      would result in:               user@machine:~$ rm -R ./tmp/logs/delete_me_every_once_in_a_while/[CURSOR]


title: How can I see i/o stats for a briefly running process?

text: For long running processes like init, I can do things like               $ cat /proc/[pid]/io      What can I do if I want to see stats for a briefly running process such as a command line utility like ls? I don't even know how to see the pid for such a briefly running process...


title: Can I set up Kate to always fold (collapse) all foldable regions when opening a code file?

text: I'd like to set up Kate so that, if I open, for example, a C++ file, all classes it contains are folded? But not only the root levels, when I unfold a class, I'd like methods inside it to be initially folded too. Etc. Is it possible?


title: CLICOLOR and LS_COLORS in bash

text: I have the following setup in .bashrc for coloring of listings.               export CLICOLOR=1     export LS_COLORS='no=00:fi=00:di=00;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:';      This site shows the code for colors, and I want to change the directory color to `light color'. But making di as follows doesn't affect it. di=04;94 The interesting thing is that even after my commenting out LS_COLORS, I can see colored output as long as I have CLICOLOR=1.   * What should I do to make directory color to Light blue (94)?   * What's it for CLICOLOR and LS_COLORS? Why coloring works without LS_COLORS?


title: Unix/Linux Loader Process

text: Can anyone tell me which process of the operating system loads the ELF(Executable and Linking format) file into RAM ?


title: How do I tell whether I'm in a non-login shell or a login shell?

text: > **Possible Duplicate:**   >  How to check if a shell is login/interactive/batch And what's the benefits of non-login shell over login shell?


title: Can I use an if statement to detect if bash and dash are being run interactively?

text: After looking around for a while I've found several good pages describing how to check and see if a bash script is running interactively and there seem to be several methods, but one of them that I keep seeing over and over is checking the variable `$-` for the presence of `i` to signify that it is interactive. I'm looking for a way to use an `if` statement that would work with both `/bin/bash` and `/bin/sh` (which is typically aliased to `/bin/dash` on Ubuntu systems), or in fewer words   " **an interactive`if` test that is universal as possible**" For `bash` it seems these things should work: ### Case Statement               case "$-" in     *i*)    echo This shell is interactive ;;     *)  echo This shell is not interactive ;;     esac      ### If Statement               if [[ $- == *i* ]]     then         do_interactive_stuff     fi      But `$-` is apparently not set in `dash`. Possibly because `$-` is supposed to be the Flags passed to script variable which > was originally a ksh construct adopted into Bash, and unfortunately it does > not seem to work reliably in Bash scripts... [ for it's intended purpose > however] ...One possible use for it is to have a script self-test whether it > is interactive. ### So is there an (relatively simple) `if` test that can be used both with `bash` and `dash`? Or am I just "doing it wrong?" ps: I have been under the impression that `dash` is faster than `bash`, and unless the script needs "bash specific" functions it would be better to hashbang it as `#!/bin/sh` and let it use the system-default shell. I get that checking for an interactive shell in the way mentioned above _is_ "bash specific" but it seems odd to think there is not a more universal way. In the script I'm working on I don't need any other bash-specific functionality.


title: Will process ids be recycled? What if you reach the maximal id?

text: Process IDs are strictly increasing, but if your system runs long enough and there is a lot of processes terminating and starting, you could at some point reach the limit of the underlying integral type (on my system it seems to be a signed int) where no larger pid would exists. Would this cause old unused ids (of processes that finished) to be recycled (i.e. handed out a second time)? What if somebody is waiting for that pid to terminate but didn't check in a _looong_ time?


title: swapon: Operation not permitted

text: I'm running this as root, obviously. I've created a file called `/swap/sw1`, by dumping 512 megs of `/dev/zero` into it. I then ran `mkswap`, which said:               Setting up swapspace version 1, size = 524284 KiB     no label, UUID=f071fec6-0589-443f-9d46-1c126636418b      I'm assuming this means it worked fine. I've chmodded the file to 0600, and the file is owned by root. I then ran swapon:               $ swapon -v /swap/sw1     swapon on /swap/sw1     swapon: /swap/sw1: Operation not permitted      I've also tried adding this to fstab and calling `swapon -a -v`, but go the same problem. Why am I not allowed to use this file as a swap file? One note, which I think is irrelevant but I could be wrong - I'm running on an OpenVZ VM.


title: How do I make the "1.9.2" Ruby string point to the final release with RVM?

text: I'm using RVM to manage my Ruby environment on OSX, and currently it's interpreting '1.9.2' as `ruby-1.9.2-rc2` instead of the final release. How can I update this to make it behave as expected?


title: Slow performance when copying files to and from USB devices

text: When I copy files to and from USB devices (camera, HDD, memory card) my system becomes very slow. For example if I want to close a window I move the mouse but it takes about 2 seconds or more before the mouse cursor moves. When I finally get the cursor over the x and click it nothing happens for 10+ seconds. I've tried this with all desktop effects disabled but the issue persists. Software: Linux Mint 9 KDE Hardware:   * Asus SLI motherboard   * NVidia 6600 GPU   * 2 GB Ram   * 2 GB Swap   * AMD Athlox X2 @ 3800+ To me this hardware should not have any issues running this software and it doesn't until I copy files using USB. Where should I start looking to figure this one out? I'm kind of thinking the graphics driver may be part of the problem but I don't know for sure.


title: Getting DNS queries to 73.207.210.75.in-addr.arpa

text: My Linux system is doing a lot of DNS queries to 73.207.210.75.in-addr.arpa but I don't know of any reason it should be doing this. What is at in- addr.arpa? Any reason why these queries are occurring?


title: OpenVPN bridge. Can't access machines on local network

text: Followed this guide: https://wiki.archlinux.org/index.php/OpenVPN_Bridge This is my setup: I have a wireless router(192.168.2.1) which connects to the Internet through a PPPoE connection and acts as a gateway and DHCP server for the local network. I'm trying to make a VPN on a machine(192.168.2.201). I bridged the VPN tap0 with eth0 through br0 like in the guide. Connecting works ok and the client receives the proper IP but I cannot access other machines on the local network (ping works only server and client). This is my server.conf:               port 1194     proto tcp     dev tap0     ca ca.crt     cert server.crt     key server.key  # This file should be kept secret     dh dh1024.pem     ifconfig-pool-persist ipp.txt     server-bridge 192.168.2.1 255.255.255.0 192.168.2.202 192.168.2.210     push "route 192.168.2.0 255.255.255.0"     keepalive 10 120     comp-lzo     persist-key     persist-tun     status openvpn-status.log     verb 6      This is my client.conf:               client     dev tap     proto tcp     remote hostname.com 1194     resolv-retry infinite     nobind     persist-key     persist-tun     ca ca.crt     cert client.crt     key client.key     ns-cert-type server     comp-lzo     verb 6      If you need any more info just ask. Thank you.


title: How do I route traffic through specific interface for a specific process

text: I have a script that runs from cron every 15 minutes. The script is meant to ping my DNS server to update a dynamically changing IP. I want this script to ping through the `wlan` interface and not the `eth0`. However, other processes should use `eth0` as the primary interface to access the internet. How do I do this for a specific process only without disturbing other processes? Is there a way to direct traffic through interface like directing stdout? like `ls -al > /dev/tty2'`. Can `chroot` help me in this by giving me a sandboxed environment?


title: Fragmentation and ext4

text: Suppose I have a sparse file `F` on a Linux ext4 filesystem, and process `P1` is writing to a disjoint 50% subset of `F` while `P2` writes to the other 50% of `F`. I would like to minimize fragmentation while the file "grows". (I put "grows" in quotes because the file is pre-allocated as a sparse file, but as the blocks get written they fill in phantom blocks with actual data.) I realize since `P1` and `P2` are running in parallel that one may get ahead of the other, but barring this, is it best to have `P1` write blocks 1,3,5,7,... while `P2` writes 2,4,6,...? Or better to have `P1` write 1,2,3,4,...n/2 and `P2` write n/2+1, ...., n?


title: What happens when I copy a file from one network location to another

text: Suppose I have three networked computers: A, B and C. A mounts a directory from B and from C.               A/mnt/im-on-B/     A/mnt/im-on-C/      A then copies a file:               cp /mnt/im-on-B/file ../im-on-C/      What happens to the data - does it pass from B to C via A? Is this significantly more inefficient than `cp`ing the file from B to C directly?


title: How to access the Local FTP YUM repo from client Machine

text: I setup the FTP server on Machine A 192.168.1.105 and created the YUM repo. And placed following contents in it.               #vi rhel-localftp.repo          [rhel-localftp.rep]     name=bla bla bla     baseurl=file:///var/ftp/pub/Server(RPMs are under Server folder)     enabled=1     gpgcheck=0      then installed httpd everything worked fine on Machine A. Now turn of Machine B 192.168.1.106 I created the repository to access the RPMs from Machine A and contents are               #vi remoteftp.repo          [rhel-remoteftp.rep]     name=bla bla bla     baseurl=ftp://192.168.1.105/var/ftp/pub/Server     enabled=1     gpgcheck=0      and then i tried to install package and it gave me this error Note: There is no Firewall in between them ![enter image description here](http://i.stack.imgur.com/rcYTY.jpg) Do i have to install FTP server also on Machine B


title: Linux: Can I build a shortcut for a complex cd command without resorting to a shell script?

text: On a server I work on, I always have to work in a directory, let's call it `/foo/bar`. In that directory is a list of site directories. Inside each of _those_ directories is a directory for each developer. So, the tree looks like this:               /foo/bar/              site1/                    userA/                    userB/                    userC/              site2/                    userA/                    userB/                    userC/              site3/                    userA/              ...      I set up an alias for the root directory in my .bash_profile, `fb=/foo/bar`, so my workflow looks like this:               $ cd $fb     $ cd site2     $ cd userA      The first and third lines never change--I'm always going to go to the `userA` directory of whatever site directory I change to. My question: Is there a clever way I can compress this into a single command that I just pass the "site2" argument without having to build this into a shell script? Or is the shell script the only way?


title: Firefox not working past opening

text: Firefox is not working/responding after I open it. No buttons will work. It has been updated twice plus an uninstall and install. I am on PinguyOS 10.10 64bit. The same Firefox is working on Ubuntu 10.04 32bit and Windows7 32 bit. After install, Firefox was the same including my custom addons, should it not be a clean install? Install was done thru synaptic. The OS has been shutdown with no help for Firefox.


title: Which root paths should reside on fast media?

text: Which paths under / should be mounted on fast media, and which can be mounted on slower media without significantly affecting system performance? My guess: # Fast   * Partition: swap (2G)   * Partition: root      * /etc (16M)     * /bin (8M)     * /var (500M) # Slow   * Partition: boot   * /home   * /media   * /mnt   * /root   * /usr (5G) # Reason I have two older laptops that only take a 1.8" PATA drive. The laptops are ultra-portable and still performing their function well so I don't wish to "upgrade" (it's hard to get a more performant ultra-portable). The HDD in one laptop is failing. Sourcing 1.8" PATA drives is hard enough now, but will surely get more so. I opted to buy a PATA-CF card adapter that allows replacing the HDD with a master (and optionally) a slave CF card. High bandwidth CF cards are expensive; I'd like to have a limited capacity high bandwidth card to maintain system performance, and a lower bandwidth but higher capacity card for everything else. So - which paths do I mount where? # Context FWIW, I run Gentoo (several years experience). These laptops are older Pentium-M so on 32 bit x86 architecture.


title: Framebuffer on OpenBSD?

text: I am migrating from Linux to OpenBSD, and one of the things I miss from my old OS is how even the consoles looked nice (so nice you could actually watch movies in there) under framebuffer using a simple command on the bootloader. Is there any way I could do that on OpenBSD (creative/hard solutions are more than welcome)? If not, is there any way I could at least spawn some colors to the terminal?


title: Bash: How do you view text that has been "scrolled up too far" in the terminal?

text: I know there is a simple unix command that allows you to view things from the top and/or allows you to scroll indefinitely toward the top. Not sure what to call it, so it's difficult to google. Thanks to anyone who can explain how to do either one for me


title: Simple command that switches between two host files

text: I am using /etc/host to map localhost to a web domain. I would like a fast way of doing this rather than searching and replacing every time. I put this in my .bashrc file.               alias hostchange='     nowdir=$PWD;     cd /etc;     mv hosts hoststempname;     mv hostssecondary hosts;     mv hoststempname hostssecondary;     cd $nowdir'      I am getting this error and it won't progress regardless y or n.               mv: rename hosts to hoststempname: Permission denied     override rw-r--r--  root/wheel for hosts? (y/n [n])       I got it to work by adding sudo.               alias hostchange='     nowdir=$PWD;     cd /etc;     sudo mv hosts hoststempname;     sudo mv hostssecondary hosts;     sudo mv hoststempname hostssecondary;     cd $nowdir'      Is this legitimate, I'm taking a shot in the dark here?


title: Linux /etc/security/limits.conf equivalent file in Android

text: In **Linux** we can limit user processes by editing `/etc/security/limits.conf` file. Is there any equivalent file in **Android** for the same purpose.


title: How do I prevent Skype notifications during a call

text: If I am on a Skype call with a person (with Share Screen Option switched ON), I don't want to get notified if someone calls me or messages me. They shouldn't know who my contacts are. What should I do in order to achieve this?


title: Is it a good practice to use svn for two different applications but on the same server?

text: Is it a good practice to use SVN for two different applications but on the same server ? I'm asking this because, whenever I update one of the application with svn it does not ask for password everytime, however when I try to update second application with SVN it asks for password only for first time and then it don't. But as per my observations first application again asks for password right after when I update second application and vice versa.


title: Bash console progress dialog with command output

text: I have `dialog` installed, where I would like to have a nice progress dialog, like this:               +-------[ title ]--------+     |                        |     | +-[ console output ]-+ |     | | output line11      ^ |     | | output line12      | |     | | output line13      | |     | | output line14      # |     | | output line15      | |     | | output line16      v |     | +--------------------+ |     | #########80%#####::::: |     +------------------------+      So, for example when upgrading 5 packages in a distro, it shows the progress (here, 4 package is upgraded out of 5 ie. 80%), but shows the detailed output of the executed commands. Is this possible? I suspect it is, but I cannot get a working solution with `\--tailboxbg` and `\--gauge`.


title: Is there bdiff (1) in Linux?

text: There is `bdiff(1)` command in Solaris, which allow you to `diff(1)` files with size bigger than your RAM size (http://docs.oracle.com/cd/E19683-01/806-7612/files-23/index.html). Is there something like that in Linux? I tried googling but I don't find which package has `bdiff` in Ubuntu.


title: How to run chrome from command line by using process substitution?

text: I am using the following command without success -               $ google-chrome <(grep "simple" SimpleDoc.txt)      If I simply do a `grep`, I get -               $ grep "simple" SimpleDoc.txt     Very simple doc that contains plaintext.       I also wrote a python script called `showFileContents.py` to test process substitution and it works -               #! /usr/bin/python          import sys          arg1 = sys.argv[1]     f = open(arg1)     line = f.readline()          while line:         sys.stdout.write(line)         line = f.readline()          f.close()      Here's the output -               $ showFileContents.py <(grep "simple" SimpleDoc.txt)     Very simple doc that contains plaintext.      But when I try to do the same with               $ google-chrome <(grep "simple" SimpleDoc.txt)      the browser window shows nothing. With Firefox, I get an error saying that "Firefox can't find the file". Why is this happening and how can I use process substitution with chrome?


title: KDE global bindkey for 'accept-line'

text: Is there a way to bind Ctrl-j keys to send 'accept-line' in KDE? `readline` library has a nice feature called key bindings. There are quite a few default keybindings user may want to use. To see it, one can use `bind -p` command. I found keybinding `C-j` (accept-line) useful. With it you can not to use Enter key to send Return. Instead you can use Ctrl-j. It is especially useful if you can press Ctrl fast (say, it is swapped with Alt key). I also found a method to set up GTK apps. For example, to send message in Pidgin with `C-j` one can use this in `gtkrc-2.0` file:               binding "my-bindings"     {         bind "Return" { "insert-at-cursor" ("\n") }         bind "<ctrl>j" { "message_send" () }     }     widget "*pidgin_conv_entry" binding "my-bindings"      So with exception of KDE, all my apps can use accept-line. Is it possible to configure KDE so it'll interpret `C-j` as Enter? I need at least KRunner to understand this keys.


title: How to print 1st and 4th variable only if 4th variable is > or equal to 25

text: Networking:            [Test] => 10.729519791085          GAMES:            [Real] => 10          Fashion:            [Test] => 27.729519791085          Movies:            [Real] => 5          Food:            [Test] => 101.729519791085          Sports:            [Real] => 7      How to print 1st and 4th variable if value is greater or equal 25.


title: Dual-headed Bumblebee

text: I'm currently setting up Debian jessie on a Lenovo W540 laptop with an UltraDock docking station and an external monitor connected via VGA port. Bumblebee is already installed and working correctly and, if I start X with the external monitor attached, my desktop is mirrored to both screens. This behavior is consistent regardless of whether the external monitor is connected to the docking station or connected to the laptop directly. What do I need to do to configure X so that it will create a single large desktop spanning both screens rather than mirroring one display on the other? Will any additional configuration be required to get it to behave correctly (i.e., conforming to the size of the internal display alone) when the external monitor is not connected?


title: Custom bash completion with directories and a fixed set

text: I'm trying to setup a bash completion, and have two problems   1. For parameter one, I needed a completion for directories   2. For parameter two, a fixed array for completion, I just don't know how to let bash make a selection, before I always used a perl script for complex ones.               _some_func()     {         case $COMP_CWORD in         1)             # default completion ? how             ;;         2)             COMPREPLY=( "go" "unbind" )             # I should be using a program to echo "go" and "unbind",             # and let bash decide which one to complete , right ?              # that's the only two possible parameters here             ;;         esac     }          complete -F _some_func some_func


title: Simplest way to password protect a directory and its contents without having to create new files?

text: I would like to password protect or encrypt a directory and all the files within it (for the whole directory tree below it). I do not want to bother the whole home directory, I want a specific directory with some files and folders in it. I would like to be able to encrypt the directory or decrypt it using a password. Command line would be nicest to use. I don't want to have to create a new file as an encrypted version and then, delete the previous ones which are the non-encrypted version.


title: How does X map from kernel key scan codes to a keysym?

text: According to this page there is no direct mapping from udev key mappings to X, it has its own mappings. > X has a (quasi) total independent way of mapping keys: X reads the kernel > keycode table at startup, then maps the keycode to its independent keycode > table (it is the same as the kernel keycodes but different :)) Could somebody elaborate and also maybe explain or point to explanations of why X does this, ignoring udev?


title: Sound volume control does not work in Ubuntu

text: My sound volume control does not work when I'm logged in with my regular user, though the sound works correctly. What's weirder is that the sound control works when I'm logged in as guest. With my regular user I can't see any output peripherals in `Preferences->Audio` but it will show up when logged in as guest. The home directory of my regular Ubuntu user is also used as the home directory of my Mac Os X user. Could it be the case there is some kind of conflict? I already tried deleting the `.pulse` directory and `.pulse-cookie` but nothing changed. Only `.pulse-cookie` was recreated when I logged out/logged in. Do you have any idea of what could be happening?


title: NFS server dropped connection momentarily, now df, ls, and umount all hang

text: I have this fstab entry:               machine.local:/srv/files /res/files nfs defaults 0 0      It was working great until machine.local dropped the connection momentarily. Now, the share isn't accessible. `df`, `umount /res/files`, `ls /res` all hang forever. What should I do, short of a reboot?


title: Commands pasted into terminal are truncated

text: I have a list of commands I would like to paste into the terminal so that they run one after the other. Initially they run fine, but commands later on are being truncated. Example command:               ogr2ogr -nlt PROMOTE_TO_MULTI -progress -skipfailures -overwrite -lco PRECISION=no -f PostgreSQL PG:"dbname='natural_earth' host='localhost' port='5432' user='natural_earth' password='natural_earth'" 50m_physical/ne_50m_lakes.shp There are about 150 of these commands, they are stored in gedit with line wrapping off and are being pasted as a block straight into the terminal. Expected result:               $ ogr2ogr -nlt PROMOTE_TO_MULTI -progress -skipfailures -overwrite -lco PRECISION=no -f PostgreSQL PG:"dbname='natural_earth' host='localhost' port='5432' user='natural_earth' password='natural_earth'" 50m_physical/ne_50m_lakes.shp     0...10...20...30...40...50...60...70...80...90...100 - done. This works for about the first 30 commands, after which I get a varying level of truncation on the commands, for example:               $ ogr2o     ogr2o: command not found          $ ogr     ogr: command not found                    $ ogr2ogr -nlt PROMOTE_TO_MULTI -progress -skipfailures -overwrite -lco PRECISION=no -f PostgreSQL PG:"dbname='natural_earth' host='localhost' port='5432' user='natural_earth' password='natural_earth'" 50m_physical/ne_50m_graticules_all/ne_50m_grati          FAILURE:     Unable to open datasource `50m_physical/ne_50m_graticules_all/ne_50m_grati' So I am new to Linux. I was wondering if there was a better way to run these than copy & paste from gedit? I am running Linux Mint 15 "olivia" Cinnamon 32-bit.


title: Playing around with shortcuts and window sizes with awesome WM

text: I've been trying awesome WM for a few months now and i am really enjoying it.   I am now playing around with the `rc.lua` file, and I'm searching for a way to do two things.   1. With the shortcut `mod4+Enter` (by default) you create a new terminal. In _magnified mode_ (all floating) the term pops up quite small. I would like to be able to set the default size of a new term, BUT ONLY when it pops up (not when restarting awesome or anything else..)   I've tried to set a rule for that:              awful.rules.rules = {         (...)         { rule = { class = "URxvt" }, properties = { width = 900, height = 900 } }         (...)     }      But when i restart awesome it messes up everything :/   Any Idea on how to set a "only-when-pop-up" parameter for that?   2. I wand to be able to to something like `mod4 + doubleclick` on a window to maximize the size of a window (like the maximize button on any window in gnome)   Any idea on how I could do that?


title: Run mysqld_safe in background

text: I have a bash script that installs mysql for me. One line, that executes `mysqld_safe`, makes the script to hang - it won't continue to the following code. Obviously there's ampersand at line's end, but it won't help, see:               root@dor-desktop:/home/dor/Documents/LAMP_setup/webs_install# /usr/local/mysql/bin/mysqld_safe --skip-networking --skip-grant-tables --user=mysql --basedir=/usr/local/mysql --ledir=/usr/local/mysql/libexec &     [1] 20131     root@dor-desktop:/home/dor/Documents/LAMP_setup/webs_install# 130531 17:45:54 mysqld_safe Logging to '/usr/local/mysql/var/dor-desktop.err'.     130531 17:45:54 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var     ^C     root@dor-desktop:/home/dor/Documents/LAMP_setup/webs_install#       You can see that only `CTRL+C` helps to exit, but it exits my entire bash script... I've also tried using `nohup`, still didn't help, see:               root@dor-desktop:/home/dor/Documents/LAMP_setup/webs_install# nohup /usr/local/mysql/bin/mysqld_safe --skip-networking --skip-grant-tables --user=mysql --basedir=/usr/local/mysql --ledir=/usr/local/mysql/libexec &     [1] 19751     root@dor-desktop:/home/dor/Documents/LAMP_setup/webs_install# nohup: ignoring input and appending output to `nohup.out'     ^C     [1]+  Exit 1                  nohup /usr/local/mysql/bin/mysqld_safe --skip-networking --skip-grant-tables --user=mysql --basedir=/usr/local/mysql --ledir=/usr/local/mysql/libexec     root@dor-desktop:/home/dor/Documents/LAMP_setup/webs_install#       Any idea how to force `mysqld_safe` to run in background? * * * **Edit (May 31, 16:37 UTC):** The error log, `'/usr/local/mysql/var/dor-desktop.err'`:               130531 18:03:55 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var     130531 18:03:55 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.     130531 18:03:55 [Note] Plugin 'FEDERATED' is disabled.     130531 18:03:55  InnoDB: Initializing buffer pool, size = 8.0M     130531 18:03:55  InnoDB: Completed initialization of buffer pool     InnoDB: The first specified data file ./ibdata1 did not exist:     InnoDB: a new database to be created!     130531 18:03:55  InnoDB: Setting file ./ibdata1 size to 10 MB     InnoDB: Database physically writes the file full: wait...     130531 18:03:56  InnoDB: Log file ./ib_logfile0 did not exist: new to be created     InnoDB: Setting log file ./ib_logfile0 size to 5 MB     InnoDB: Database physically writes the file full: wait...     130531 18:03:56  InnoDB: Log file ./ib_logfile1 did not exist: new to be created     InnoDB: Setting log file ./ib_logfile1 size to 5 MB     InnoDB: Database physically writes the file full: wait...     InnoDB: Doublewrite buffer not found: creating new     InnoDB: Doublewrite buffer created     InnoDB: Creating foreign key constraint system tables     InnoDB: Foreign key constraint system tables created     130531 18:03:56  InnoDB: Started; log sequence number 0 0     130531 18:03:56 [Note] /usr/local/mysql/libexec/mysqld: ready for connections.     Version: '5.1.57-log'  socket: '/usr/local/mysql/mysql.sock'  port: 3306  Source distribution     130531 18:08:41 mysqld_safe mysqld from pid file /usr/local/mysql/var/dor-desktop.pid ended     130531 18:17:09 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var     130531 18:17:09 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.     130531 18:17:09 [Note] Plugin 'FEDERATED' is disabled.     130531 18:17:09  InnoDB: Initializing buffer pool, size = 8.0M     130531 18:17:09  InnoDB: Completed initialization of buffer pool     InnoDB: The log sequence number in ibdata files does not match     InnoDB: the log sequence number in the ib_logfiles!     130531 18:17:09  InnoDB: Database was not shut down normally!     InnoDB: Starting crash recovery.     InnoDB: Reading tablespace information from the .ibd files...     InnoDB: Restoring possible half-written data pages from the doublewrite     InnoDB: buffer...     130531 18:17:09  InnoDB: Started; log sequence number 0 44233     130531 18:17:09 [Note] Recovering after a crash using mysql-bin     130531 18:17:09 [Note] Starting crash recovery...     130531 18:17:09 [Note] Crash recovery finished.     130531 18:17:09 [Note] /usr/local/mysql/libexec/mysqld: ready for connections.     Version: '5.1.57-log'  socket: '/usr/local/mysql/mysql.sock'  port: 3306  Source distribution     130531 18:21:14 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var     130531 18:21:14 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.     130531 18:21:14 [Note] Plugin 'FEDERATED' is disabled.     130531 18:21:14  InnoDB: Initializing buffer pool, size = 8.0M     130531 18:21:14  InnoDB: Completed initialization of buffer pool     InnoDB: The log sequence number in ibdata files does not match     InnoDB: the log sequence number in the ib_logfiles!     130531 18:21:14  InnoDB: Database was not shut down normally!     InnoDB: Starting crash recovery.     InnoDB: Reading tablespace information from the .ibd files...     InnoDB: Restoring possible half-written data pages from the doublewrite     InnoDB: buffer...     130531 18:21:14  InnoDB: Started; log sequence number 0 44233     130531 18:21:14 [Note] Recovering after a crash using mysql-bin     130531 18:21:14 [Note] Starting crash recovery...     130531 18:21:14 [Note] Crash recovery finished.     130531 18:21:14 [Note] /usr/local/mysql/libexec/mysqld: ready for connections.     Version: '5.1.57-log'  socket: '/usr/local/mysql/mysql.sock'  port: 3306  Source distribution      * * * **Edit #2 (May 31, 16:46 UTC):** **Sorry!** I forgot to add that immediately after executing mysqld_safe, there's a `wait` command. The `wait` command exists in order to make sure that the daemon has started, so that I'd be able to execute `mysql -u root`. Please wait, perhaps I'll find a solution.


title: zsh - check arguments of a command before executing it

text: _Question:_ Is there an easy way how I can teach `zsh` to check the command line before executing it? I know that I can completely wrap a specific program with an extra script, but this is not what I want to do. _Example:_ Using tab completion, it could happen to me easily, that I overwrite my input file by calling `gcc` wrongly e.g.               gcc test.c -o test.c      instead of               gcc test.c -o test


title: How to use git for this particular purpose?

text: Here is the situation. There are two machines, laptop A and workstation B. B has a fixed IP, A has a dynamic IP, and I want to avoid the need of connecting from B to A (setting up an ssh tunnel for example; for the sake of the argument, assume that ssh from B to A is not possible). There is a git repository, `/home/user/foo.git`, on both machines. Problem: working on A, merge the changes on `A:/home/user/foo.git` and `B:/home/user/foo.git`. In the end, both repositories should be identical. The simplest solution I was able to come up with is as follows:               A:~$ cd foo.git     A:~/foo.git$ git commit -a     A:~/foo.git$ ssh B     B:~$ cd foo.git     B:~/foo.git$ git commit -a     B:~/foo.git$ logout     A:~/foo.git$ git pull ssh://B/home/user/foo.git     A:~/foo.git$ git push ssh://B/home/user/foo.git master      (before being able to do that, I had to change git config on B and add a post- receive hook as described in the answer to this stackoverflow question) My questions: 1) is the above correct? 2) is there a simpler way of achieving the same purpose?


title: Is there any convenient way to run remote program on local data?

text: I have two servers running Linux, namely _A_ and _B_. There is a large amount of data on _A_ , but I want to use the program _x_ on _B_ to process those data. It would be inefficient to transfer all data from _A_ to _B_ , while it is also annoying to solve all dependencies to get _x_ working on _A_. Therefore, the best solution should be to fetch _x_ and its library dependencies from _B_ into memory of _A_ and run _x_ on _A_ locally. So I would like to ask, is there any convenient way or existing tool to execute a remote program to process local data? My idea is to mount the root directory of _B_ on _A_ using tools like sshfs, bind mount the data directory into the root dir, and chroot into it. However, this is not very convenient and requires additional setup for file systems like `/proc`, `/dev`. To be more clear, there are mainly three inconvenient aspects:   1. I need root permission on _A_ , which is usually not granted for a typical user of a server.   2. I need to setup various kernel file systems in the mounted root dir of _B_ on _A_ , like `/proc`, `/sys`, `/dev`. Running as root on a server also requires additional carefulness.   3. After chroot, my personal configurations on _A_ are all replaced by those on _B_. I only want to use _x_ to process my data and would like to stay in a familiar environment :) BTW, I need chroot because I need to run program _x_ , which is on _B_ ; I could not mount data directory in _A_ onto _B_ because I want to avoid transferring data; so I could only transfer program from _B_ to _A_ , and I need chroot because _x_ needs different libraries which are not available on _A_.


title: How can a zsh script test whether it is being sourced?

text: The accepted answer for a similar question for `bash` does not seem to work for `zsh`. In fact, if I copy basically the same code given in that answer, to produce the script               #!/usr/bin/zsh -     # test.sh          [[ $_ != $0 ]] && echo "sourced\n" || echo "subshell\n"      the output hardly ever corresponds to the actual situation:               zsh% chmod +x ./test.sh     zsh% env -i /usr/bin/zsh -f     zsh% ./test.sh     sourced          zsh% /usr/bin/zsh ./test.sh     sourced          zsh% /bin/bash ./test.sh     sourced          zsh% source ./test.sh     subshell          zsh% . ./test.sh     subshell          zsh% env -i /bin/bash --norc --noprofile     bash-3.2$ ./test.sh     sourced          bash-3.2$ /usr/bin/zsh ./test.sh     sourced          bash-3.2$ /bin/bash ./test.sh     sourced          bash-3.2$ source ./test.sh     sourced          bash-3.2$ . ./test.sh     sourced      When the current interactive shell is `zsh`, the script gets it exactly wrong every time. It fares a bit better under `bash` (though in a way reminiscent of the stopped watch that gets the time exactly right twice a day). These truly _abysmal_ results give me little confidence in this approach. Is there something better?


title: Find files on disk that match a really long text list of files

text: I have a list of tens of thousands of file names. I want to find which of those files actually exist on disk (in a particular directory). I'm not sure how to start. I could try it with either Python or bash. The list of file names is an ascii file with one file name per line and no other content.


title: "sudo: apt-get: command not found." after removing some packages

text: Recently I executed this command:               sudo apt-get remove debian-keyring debian-archive-keyring      To prevent this such error message:               WARNING: The following packages cannot be authenticated!       openerp      My plan was executing these commands:               sudo apt-get remove debian-keyring debian-archive-keyring     sudo apt-get clean     sudo apt-get update     sudo apt-get -y install debian-keyring debian-archive-keyring      Accidentally I got this error message when trying to continue executing code:               [ps193731]$ sudo apt-get clean     sudo: apt-get: command not found     [ps193731]$ sudo apt-get -y install debian-keyring debian-archive-keyring     sudo: apt-get: command not found      As additional information I'm adding this information:   Result of `sudo dpkg --configure -a`:               [ps193731]$ sudo dpkg --configure -a     dpkg: dependency problems prevent configuration of apt:      apt depends on libstdc++6 (>= 4.6); however:       Version of libstdc++6 on system is 4.4.5-8.     dpkg: error processing apt (--configure):      dependency problems - leaving unconfigured     dpkg: dependency problems prevent configuration of libapt-pkg4.12:      libapt-pkg4.12 depends on libstdc++6 (>= 4.6); however:       Version of libstdc++6 on system is 4.4.5-8.     dpkg: error processing libapt-pkg4.12 (--configure):      dependency problems - leaving unconfigured     Errors were encountered while processing:      apt      libapt-pkg4.12      Result of `apt-cache policy libstdc++6 apt libapt-pkg4.12`:               [ps193731]$ apt-cache policy libstdc++6 apt libapt-pkg4.12     apt-cache: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by apt-cache)     apt-cache: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /usr/lib/x86_64-linux-gnu/libapt-pkg.so.4.12)      Result of `dpkg -l libstdc++6 apt libapt-pkg4.12`:               [ps193731]$ dpkg -l libstdc++6 apt libapt-pkg4.12     Desired=Unknown/Install/Remove/Purge/Hold     | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend     |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)     ||/ Name                       Version                    Description     +++-==========================-==========================-====================================================================     iU  apt                        0.9.7.9+deb7u1             commandline package manager     iU  libapt-pkg4.12             0.9.7.9+deb7u1             package managment runtime library     ii  libstdc++6                 4.4.5-8                    The GNU Standard C++ Library v3      Result of `sudo dpkg -C`:               [ps193731]$ sudo dpkg -C     The following packages have been unpacked but not yet configured.     They must be configured using dpkg --configure or the configure     menu option in dselect for them to work:      apt                  commandline package manager      libapt-pkg4.12       package managment runtime library      Content of `/etc/apt/sources.list`:               # Generated by ndn-autoupdate          deb http://debian.di.newdream.net/ squeeze ndn     deb http://debian.newdream.net/ squeeze main contrib non-free     deb http://security.debian.org/ squeeze/updates main contrib non-free     deb http://debian.newdream.net/ squeeze-updates main contrib non-free     deb http://www.backports.org/debian/ squeeze-backports main contrib non-free     deb http://nightly.openerp.com/7.0/nightly/deb/ ./      I also have the problem installing libstdc++6 version 4.6 or above for debian squeeze.   Because there no libstdc++6 version 4.6 or above for debian squeeze.   How can I fix the `apt` command to be useable again?


title: Uniq won't remove duplicate

text: I was using the following command               curl -silent http://api.openstreetmap.org/api/0.6/relation/2919627 http://api.openstreetmap.org/api/0.6/relation/2919628 | grep node | awk '{print $3}' | uniq      when I wondered why `uniq` wouldn't remove the duplicates. Any idea why ?


title: Search and replace with sed

text: Last week I accidently externalized all my strings of my eclipse project. I need to revert this and my only hope is sed. I tried to create scripts but failed pathetically because I'm new with sed and this would be a very complicated operation. What I need to do is this: Strings in `class.java` file is currently in the following format(method) `Messages.getString(<key>)`. Example :                   if (new File(DataSource.DEFAULT_VS_PATH).exists()) {             for (int i = 1; i <= c; i++) {                 if (!new File(DataSource.DEFAULT_VS_PATH                         + Messages.getString("VSDataSource.89") + i).exists()) { //$NON-NLS-1$                     getnewvfspath = DataSource.DEFAULT_VS_PATH                             + Messages.getString("VSDataSource.90") + i; //$NON-NLS-1$                     break;                 }             }         }      The key and matching Strings are in `messages.properties` file in the following format.               VSDataSource.92=No of rows in db =      VSDataSource.93=Verifying db entry :      VSDataSource.94=DB is open     VSDataSource.95=DB is closed     VSDataSource.96=Invalid db entry for      VSDataSource.97=\ removed.     key=string      So I need the java file back in this format:                   if (new File(DataSource.DEFAULT_VS_PATH).exists()) {             for (int i = 1; i <= c; i++) {                 if (!new File(DataSource.DEFAULT_VS_PATH                         + "String 2" + i).exists()) { //$NON-NLS-1$                     getnewvfspath = DataSource.DEFAULT_VS_PATH                             + "String 1" + i; //$NON-NLS-1$                     break;                 }             }         }      How can I accomplish this with `sed`? Or is there an easier way?


title: Confused with symlinks - link created within a desired directory

text: during installation of the program, following window popped up: ![enter image description here](http://i.stack.imgur.com/tdUTu.png) I continued with the installation and now I want to make symlink. The reason for this is that there is plenty of free space in `/galy/home/biomonika/SMRTDATA`, but not that much in `userdata`. After `ls` I see folder `userdata`. Now I am typing:               ln -s /galy/home/biomonika/SMRTDATA userdata      When I take a look with `ls -lah`, there are no arrows. However, when I go inside `userdata`, I see this:               SMRTDATA -> /galaxy/home/biomonika/SMRTDATA      This is not correct, is it? I want arrow from `userdata -> /galy/home/biomonika/SMRTDATA` if I understand this correctly.


title: How to know who accessed a file or if a file has 'access' monitor in linux

text: I'm a noob and have some questions about viewing who accessed a file. I found there are ways to see if a file was accessed (not modified/changed) through audit subsystem and inotify. However, from what I have read online, according to here: http://www.cyberciti.biz/tips/linux-audit-files-to-see-who-made-changes-to-a- file.html it says to 'watch/monitor' file, I have to set a watch by using command like:               # auditctl -w /etc/passwd -p war -k password-file      **So if I create a new file or directory, do I have to use audit/inotify command to 'set' watch first to 'watch' who accessed the new file?** Also is there a way to know if a directory is being 'watched' through audit subsystem or inotify? How/where can I check the log of a file? **edit:** from further googling, I found this page saying: http://www.kernel.org/doc/man-pages/online/pages/man7/inotify.7.html The inotify API provides no information about the user or process that triggered the inotify event. So I guess this means that I cant figure out which user accessed a file? Only audit subsystem can be used to figure out who accessed a file?


title: How to delete a file on remote machine via SSH by using a Shell Script?

text: I am writing a Shell Script where I have to delete a file on a remote machine via a Shell Script. Flow manually:               ssh username@domain.com      .. then at domain:               cd ./some/where     rm some_file.war      How to accomplish that task?


title: Does GRUB install itself on every disk?

text: I have 4 hard disks. One of them houses Debian, one Windows and others are just storage. Does GRUB install itself on every MBR of every hard disk? (I have not specified any path explicitly for GRUB installation, left it to Debian installer)


title: fdisk hangs on "Syncing disk" when resizing a raw QEMU image

text: I'm using fdisk to resize the partitions on a raw QEMU image. When I write the new partition table, it hangs at "Syncing disks." Note that I'm running fdisk as non-root since I don't need root to edit the image file. What would cause "Syncing disks" to hang like this?


title: Xterm with Solarized only showing dark background without font colors

text: I am trying to get the Solarized color scheme for xterm, but have not had much success with it. I am running Debian 6 and downloaded the `Xresources` to `~/.Xresources`. After loading the new settings with `xrdb -load ~/.Xresources`, I get a XTerm with the blueish background from the theme, but no font colors. ![Xterm with solarized theme](http://i.stack.imgur.com/N2FXU.png) The default xterm is capable of color, as you can see below: ![default xterm with Debian](http://i.stack.imgur.com/44jk0.png) How do I get the colors from solarized to show?


title: How do I begin with building a Linux system from scratch?

text: I tried to make an operating system with my on custom built kernel. It didn't work out too well. I am using Ubuntu and have downloaded Linux 3.2.7 from kernel.org . I am not trying to change the kernel in my Ubuntu system. I want to make my own OS with Grub, the Linux kernel and I want to be able to have this homebrew OS in a file type (such as iso) that I can put on a cd and boot on another computer. My question is: what exactly do I need to make this OS? Any comments or tutorials would be helpful.


title: Linux + Solaris how to verify the last execute process from list of process

text: I need advice: How to verify which is the last scan_sys.sh process that run in my linux or solaris ? my target is to kill all scan_sys.sh process , except the latest scan_sys.sh ( the last execute /usr/scan_sys.sh script )               ps -ef | grep scan_sys.sh      .               root   367     1   0   Nov 08 ?           0:21 /usr/scan_sys.sh     root 27517 27515   0 17:27:18 ?           0:01 /usr/scan_sys.sh     root 18939   367   0   Nov 15 ?           0:00 /usr/scan_sys.sh     root 18940 18939   0   Nov 15 ?           0:01 /usr/scan_sys.sh     root 27515   367   0 17:27:18 ?           0:00 /usr/scan_sys.sh


title: bash using grep and sed

text: This is for our weekly prac, no marking or grade (we don't even get the answers!) I'd really appreciate it if anyone has the time to help explain this exercise to me, as I'm trying to get this work done over the weekend and won't be able to get assistance from my tutor until next week. I've been doing a lot of reading and work covering bash programming, regex and grep. But the code below has just got me flummoxed. I'm even wondering, are the instructions incomplete or am I just not getting it? Specifically the following are preventing me from understanding the entire thing:               NAMES=`ls *.$1`          filed=$(file:$1).$2      Exercise 4.3   Suppose you are given a text file (called myfile) containing the following               #!/bin/bash          NAMES=`ls *.$1`          for file in $NAMES; do         filed=$(file%:$1).$2         mv file filed     done      Execute the following commands $ grep ' file ' myfile                $ grep 'file*' myfile           $ grep '^ *file*' myfile           $ grep 'file$' myfile           $ sed 's/ file* / script /g' myfile           $ sed ' /for/,/files/d' myfile           $ sed '/\$[A-Z]..[A-Z]*/d' myfile      Then explain the output or results


title: Sort the output of find before piping to openssh

text: I'm using this command to recursively generate a SHA-512 hash for each file in a directory hierarchy:               find . -type f -exec openssl sha512 {} \;      I'd like to sort the files in lexicographical order before generating the hashes. I can use `sort` like this:               find . -type f | sort      but I'm not sure how to then pipe the sorted file list into `openssl`. I tried this:               find . -type f | sort | openssl sha512      but this generates a single hash of the entire output of `sort`, whereas I want a hash for each individual file. `find` in some versions of bash includes an `-s` option ("Cause `find` to traverse the file hierarchies in lexicographical order"), but this isn't available in my version of `find`. Many thanks in advance for your help!


title: Why mounting an ISO is faster than extracting it?

text: When I tried to extract (used right click and extract) a 2Gb ISO file it took a lot of time. I tried to mount the ISO using `-o loop` and its works fast. Why is it so?


title: Make stdout and stderr be buffered by the same buffer

text: Is it possible to force glibc to use the same buffer for `stdout` and `stderr`? If I `tee` the both outputs:               ./tests/tests 2>&1 | tee log      I get mixed messages (i.e. messages are ordered inside `stdout` and `stderr` but not with respect to each other). I can turn off the buffering:               stdbuf -i0 -o0 -e0 ./tests/tests 2>&1 | tee log      But it cause large slowdown (I'm pushing hundreds of MB of log). Is it possible to do have buffering but have it shared between `stdout` and `stderr`? FD `1` and `2` points to the same output (as in example).


title: Set network connection for internet access

text: I have two network adapters: one for my normal LAN and my tethered phone as I don't have regular internet access here yet. When both are plugged in, KDE/Network Manager prefers to route all internet traffic via my home LAN, indicated by the blue "earth" icon and the fact it doesn't work. How can I configure this?


title: How to print password protected pdf with cups from command line?

text: I have a `*.pdf` file that is password protected. I have the password and I can view the pdf with `mupdf`. However, printing with `CUPS` via `lpr -P PRINTERNAME *.pdf` does not work. All my printing is done via the command line and cups `lpr` command and I don’t want to change that. Is there a way to have `CUPS` print password protected pdfs?


title: Openbox pipe-menu script error

text: This is the weirdest thing. The script **works when run from the shell** with no problems. When I run it as an Openbox pipe-menu I get the error " _Invalid output from pipe-menu_ ". After playing around with the script I found that it has specifically to do with printing the 5th column. To make matters even more confusing, this only happens with the month of July. All other months will show up correctly running the script. Here is the script as it should be. It **works** when executed from a terminal:               #!/bin/bash     echo "<openbox_pipe_menu>"     cal | while read i;do     echo "<item label=\"$i\"/>"     done     echo "</openbox_pipe_menu>"     echo "</openbox_pipe_menu>"      The output of the script:               $ ./date-menu.sh      <openbox_pipe_menu>     <item label="July 2014"/>     <item label="Su Mo Tu We Th Fr Sa"/>     <item label="1  2  3  4  5"/>     <item label="6  7  8  9 10 11 12"/>     <item label="13 14 15 16 17 18 19"/>     <item label="20 21 22 23 24 25 26"/>     <item label="27 28 29 30 31"/>     <item label=""/>     </openbox_pipe_menu>      Here is the simplified version that still fails when running as a pipe-menu:               #!/bin/bash     calRow () {     cal | gawk -v row=$1 '{ if (NR==row) { print $0 } }'     }     echo "<openbox_pipe_menu>"     echo "<item label=\"`calRow 5`\"/>"     echo "</openbox_pipe_menu>"      BUT...If I do the same script with any number but 5 it works like a charm:               #!/bin/bash     calRow () {     cal | gawk -v row=$1 '{ if (NR==row) { print $0 } }'     }     echo "<openbox_pipe_menu>"     echo "<item label=\"`calRow 2`\"/>"     echo "<item label=\"`calRow 3`\"/>"     echo "<item label=\"`calRow 4`\"/>"     echo "<item label=\"`calRow 6`\"/>"     echo "<item label=\"`calRow 7`\"/>"     echo "<item label=\"`calRow 8`\"/>"     echo "</openbox_pipe_menu>"      Here is the menu.xml file in case anyone wants to see it:               <?xml version="1.0" encoding="utf-8"?>     <openbox_menu xmlns="http://openbox.org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://openbox.org/                 file:///usr/share/openbox/menu.xsd">         <menu id="root-menu" label="Openbox 3">             <item label="Terminal emulator">                 <action name="Execute">                     <execute>x-terminal-emulator</execute>                 </action>             </item>             <item label="Browser">                 <action name="Execute">                     <execute>x-www-browser</execute>                 </action>             </item>             <item label="Virtualbox">                 <action name="Execute">                     <execute>virtualbox</execute>                 </action>             </item>             <!-- This requires the presence of the 'menu' package to work -->             <menu id="/Debian"/>             <separator/>             <item label="obmenu">                 <action name="Execute">                     <execute>obmenu</execute>                 </action>             </item>             <item label="ObConf">                 <action name="Execute">                     <execute>obconf</execute>                 </action>             </item>             <item label="Reconfigure">                 <action name="Reconfigure"/>             </item>             <item label="Restart">                 <action name="Restart"/>             </item>             <separator/>             <menu execute="obpipes/sysinfo.sh" id="pipe-sysinfo" label="System Info"/>             <menu execute="obpipes/date-menu.sh" id="pipe-datemenu" label="Date"/>             <menu id="client-list-menu"/>             <separator/>             <item label="Exit">                 <action name="Exit"/>             </item>         </menu>     </openbox_menu>


title: How to add another domain (SOA) to my bind9 installation when domain has not been delegated yet. What are the delegation steps?

text: I have a bind9 installation on my Debian Wheezy install. On this install I have a DNS-server which acts as the SOA for a domain, example1.com. My name server is also on the same domain, example1.com (see excerpt from db1.example.com below). This has been achieved by glue records at my hosting provider). Now I want to add another domain, example2.com to this bind9 installation, so that it is the master DNS-server for both domains. I already have: (from named.conf)               zone "example1.com" {         type master;         file "/etc/bind/db.example1.com";     };      (from db.example1.com)               $TTL    604800     @       IN      SOA     example1.com. root.example1.com. (                           1         ; Serial                      604800         ; Refresh                       86400         ; Retry                     2419200         ; Expire                      604800 )       ; Negative Cache TTL     ;     @       IN      NS      example1.com.      Now, I tried to add another zone entry in named.conf and a file db.example2.com (corresponding to the db.example1.com). But that leads to bind failing to start.   * What is missing? Does the delegation (by ISP) of the domain example2.com have to be done before adding it to my DNS-server?


title: how to get effect of IP rules script in RHEL 6?

text: I have written one `ip.sh` file in that I have written one rule and then saved the iprules with the corresponding commands. Now when I opened `/etc/sysconfig/iptables` nothing is reflecting. I need the steps for this to get effect of new iprules and I want to restore the old file.


title: How to find out which program can open a given file?

text: Let's say I have a file `thesis.pdf` or `picture.jpg` Is there a command which returns a program to open this file with? I am aware of the command `file`, but it just returns the correct type of the file (I know that this is not specified by its extension in Linux) and not a program. I am expecting something like:               $ program 'picture.jpg'      gimp, gwenview, eog


title: Why isn't 'nethogs' installed with the setuid bit set?

text: I've been using `nethogs` for a while now, having to `sudo` every time, while `ping` has the setuid bit set. Today I set it for nethogs and it works:               $ ls -l $(which nethogs) $(which ping)     -rwxr-xr-x 1 root root  64496 Nov  2  2011 /usr/sbin/nethogs     -rwsr-xr-x 1 root root 44168 May  7 17:21 /bin/ping          $ sudo chmod u+s  $(which nethogs)          $ ls -l $(which nethogs)     -rwsr-xr-x 1 root root 64496 Nov  2  2011 /usr/sbin/nethogs          $ nethogs      Can you think of any reason not to install it by default like this?


title: How to get find -exec to call a shell script?

text: Taking from the last answer (by im3r3k) here: How do I recursively shred an entire directory tree? I'm trying to get the `find` command to call a shell script as described. So far I've tried:               find /home/shredtest/* -depth -exec /home/test.sh {}\;      where `/home/shredtest` is the directory whose contents I want to shred (but without removing `/home/shredtest` itself and where `/home/test.sh` is the script to run. I did `chmod +x /home/test.sh`. The `find` command above returns: > find: -exec CMD must end by ';' I've also tried:               find /home/shredtest/* -depth -exec /home/test.sh "{}"\;     find /home/shredtest/* -depth -exec /home/test.sh {}\;     find /home/shredtest/* -depth -exec sh /home/test.sh "{}"\;     find /home/shredtest/* -depth -exec sh \/home\/test.sh {}\;     find /home/shredtest/* -depth -exec sh \/home\/test.sh "{}"\;      all of which return the same error. So:   1. Why is the `-exec` failing to see the semicolon? Obviously it's there and escaped so something else must be wrong. I just don't see it.   2. Am I even going about this the right way or is there a better way to achieve this?


title: Can sshd restrict client tunnel endpoints to localhost?

text: Normally an ssh client can request TCP forwarding using the `-L` command line option. The server can disable this completely using `AllowTcpForwarding no`. If enabled, the client can request to connect the endpoint to a remote machine other than the sshd server using _host_ in `-L port:host:hostport`. Is there a way to configure sshd to limit the destination forwarding address to `localhost` (ie. the sshd server machine itself)?


title: Accumulate Filename in a Log file using shell script

text: I have files with their names as `ABC_-_123321.20140505_-_161500.CSV`   `ABC_-_654145.20140506_-_135020.CSV`   `String_-_SerialID.` **`Date`**`_-_` **`Time`**`.CSV` _StartDate, StartTime, EndDate_ and _EndTime_ are given as input. How can I get all **filenames** (or relative paths) having **Date** and **Time** between the given **Date** and **Time** ranges and write those to a Log file using a shell script? **Date** and **Time** are not the last accessed or modified date/timestamp and there are no whitespaces in filenames. And I can either take **Date** and **Time** input individually without any seperator between fields, for example   `20140706`   `165030`   or I can take input as   `20140706165030`


title: Xft font specification in Rxvt: is it a client-side or server-side font?

text: I have a headless Gentoo box and would like to run X app on it but forward the display to a Cygwin Xorg server running on my Windows PC. It works but I am not sure in this case if I specify some fonts to use in the X app, which font will be actually used? the one on the Gentoo box(where the X app is running)? or the one installed in my Cygwin (where the X app is being displayed)? For example I want to use font `DejaVu Sans Mono` in urxvt, my `~/.Xresources` on the Gentoo box looks like this:               URxvt*font: xft:DejaVu Sans Mono:size=12      On the Gentoo box I have the font installed and enabled. The following is the output of `eselect fontconfig list`                 [1]   10-autohint.conf       [2]   10-no-sub-pixel.conf       [3]   10-scale-bitmap-fonts.conf *       [4]   10-sub-pixel-bgr.conf       [5]   10-sub-pixel-rgb.conf       [6]   10-sub-pixel-vbgr.conf       [7]   10-sub-pixel-vrgb.conf       [8]   10-unhinted.conf       [9]   11-lcdfilter-default.conf       [10]  11-lcdfilter-legacy.conf       [11]  11-lcdfilter-light.conf       [12]  20-unhint-small-dejavu-sans.conf       [13]  20-unhint-small-dejavu-sans-mono.conf       [14]  20-unhint-small-dejavu-serif.conf       [15]  20-unhint-small-vera.conf *       [16]  25-unhint-nonlatin.conf       [17]  30-metric-aliases.conf *       [18]  30-urw-aliases.conf *       [19]  40-nonlatin.conf *       [20]  45-latin.conf *       [21]  49-sansserif.conf *       [22]  50-user.conf *       [23]  51-local.conf *       [24]  57-dejavu-sans.conf       [25]  57-dejavu-sans-mono.conf *      Then run xrdb on the Gentoo box to enable the resource (this makes me believe the font on Gentoo box will be used):               xrdb ~/.Xresources      When I start urxvt it complains: > urxvt: unable to load base fontset, please specify a valid one using -fn, > aborting. The output of both `xdb -query` and `appres URxvt` are same (only the 2 lines below):               URxvt*font:     xft:DejaVu Sans Mono:size=12     URxvt*scrollBar:        false      I think the font is installed without problem, output of `fc-list|grep "DejaVu Sans Mono"`:               /usr/share/fonts/dejavu/DejaVuSansMono-BoldOblique.ttf: DejaVu Sans Mono:style=Bold Oblique     /usr/share/fonts/dejavu/DejaVuSansMono.ttf: DejaVu Sans Mono:style=Book     /usr/share/fonts/dejavu/DejaVuSansMono-Bold.ttf: DejaVu Sans Mono:style=Bold     /usr/share/fonts/dejavu/DejaVuSansMono-Oblique.ttf: DejaVu Sans Mono:style=Oblique      The output of `strace urxvt` is quite long, the following is the part which appears to have something to do with the font being specified in `~/.Xresources`:               poll([{fd=6, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=6, revents=POLLOUT}])     writev(6, [{"1\1\t\0\240\17\34\0", 8}, {"xft:DejaVu Sans Mono:size=12", 28}, {"", 0}], 3) = 36     poll([{fd=6, events=POLLIN}], 1, -1)    = 1 ([{fd=6, revents=POLLIN}])     recv(6, "\1\0=\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 4096, 0) = 32     recv(6, 0x817b310, 4096, 0)             = -1 EAGAIN (Resource temporarily unavailable)     recv(6, 0x817b310, 4096, 0)             = -1 EAGAIN (Resource temporarily unavailable)     write(1, "urxvt: ", 7urxvt: )                  = 7     write(1, "unable to load base fontset, ple"..., 77unable to load base fontset, please specify a valid one using -fn, aborting.     ) = 77


title: How to change permissions from root user to all users?

text: I created a folder on the command line as the root user. Now I want to edit it and its contents in GUI mode. How do I change the permissions on it to allow me to do this?


title: Forcing 'yes' to new update license agreements?

text: Sometimes when a new version of a big piece of software is released (java, flash, etc), the developers will require that a license agreement be combed through and then ask you to type (yes/no) at the end. Is there a way of forcing my package manager to accept the agreement? I'm using zypper on OpenSuse.


title: GNU/Linux, IO performance problems

text: I have some problems with my system performance. As I was adviced here, I used `sar`:               $sar -u 5      and found out that the problems are caused by a low HDD performance, as I supposed (high `%iowait`). My disk is Western Digital AV-25, WDC WD5000BUDT-63G8FY0. Vendor specification can be found here. `/etc/fstab`:               # <file system>        <dir>         <type>    <options>          <dump> <pass>     devpts                 /dev/pts      devpts    defaults            0      0     shm                    /dev/shm      tmpfs     nodev,nosuid        0      0     /dev/sda2 / ext4 defaults,noatime,data=writeback,barrier=0,nobh,errors=remount-ro 0 1     /dev/sda3 /home ext4 defaults,noatime,data=writeback,barrier=0,nobh,errors=remount-ro 0 1     /dev/sda4 swap swap defaults 0 0      The problem is that from time to time some application (Minecraft game, Chromium browser, Eclipse) hangs up, my processor activity LED turns on, iowait goes to some 50% or more (I have dual core processor) and stays like this for a couple of seconds. Similar things happen when I use applications for the first time after reboot. The worst situation ever was forcing the system to use the swap partition (by some stress tool), the system went unusable. What can i do now to determine the exact cause of the performance problems? Is it the low hardware performance, some problems with linux io scheduler, application specific problems or something else? EDIT: Output of `hdparm -t -T /dev/sda` under no load:               /dev/sda:      Timing cached reads:   6244 MB in  2.00 seconds = 3129.13 MB/sec      Timing buffered disk reads: 230 MB in  3.01 seconds =  76.33 MB/sec


title: How to open tabs windows in Gnu-screen & execute commands within each one

text: when starts session named any name like this `screen -S name1` i want to open tabs windows in this screen session like when open tabs in gnome-terminal like this               gnome-terminal --tab -e "some commands"      so how to do this ?


title: Use sed to find whole word and replace

text: I have the following block of text in a file:               test3.legacy test4.legacy test3 test3.kami      I only want to search for `test3` as a whole and replace it with nothing. Unfortunately, all my attempts have removed **test3** from `test3.legacy` and `test3.kami`. I've tried:               sed 's/^test3://g' myfile.txt     sed 's/\btest3\b//g' myfile.txt     sed 's/\<test3\>//g' myfile.txt      without any luck. Any ideas how I can resolve this please? **EDIT:** Most attempts have resulted in the following: `.legacy test4.legacy .kami`


title: Getting input from a USB device listed with lsusb

text: I have a CF-1KB barcode reader connected to an RS232 to PS/2 adaptor and a PS/2 to USB adaptor. I'm not sure how the device works so I'm trying to figure it out by looking at what information I'm getting from the device. When connected to my computer, it gives me               [ 3673.610054] usb 4-1: new low speed USB device using uhci_hcd and address 3     [ 3673.900448] input: Generic USB K/B as /devices/pci0000:00/0000:00:1a.1/usb4/4-1/4-1:1.0/input/input16     [ 3673.900746] generic-usb 0003:13BA:0017.0003: input,hidraw0: USB HID v1.10 Keyboard [Generic USB K/B] on usb-0000:00:1a.1-1/input0     [ 3673.916733] input: Generic USB K/B as /devices/pci0000:00/0000:00:1a.1/usb4/4-1/4-1:1.1/input/input17     [ 3673.916890] generic-usb 0003:13BA:0017.0004: input,hidraw1: USB HID v1.10 Mouse [Generic USB K/B] on usb-0000:00:1a.1-1/input1      Output from `sudo cat /dev/hidraw0` and `sudo cat /dev/hidraw1` gives me either unreproducible gibberish each time I scan something or nothing at all. Where can I look to find useful data from the device?


title: Which library are LO headers belonging to?

text: I'm trying to configure `liquidsoap` and compile it from source. The `./configure` process gets stuck at this point:               checking lo/lo.h usability... no     checking lo/lo.h presence... no     checking for lo/lo.h... no     configure: error: LO headers not found.      Now it's quite difficult to find out which `lib` or package is needed. I searched the package manager (`aptitude` from Debian) for `lo` but this is quite pointless. I also was asking google for `LO headers` but I was not getting much results. What does `lo.h` belong to?


title: How can I install Skype in Fedora 14 64 bits?

text: I would like to install Skype in Fedora 14 64 bits. However, I encounter this error during the install:               $ yum install skype-4.1.0.20-fedora.i586.rpm     [...]     skype-4.1.0.20-fc16.i586 requires libXss.so.1     skype-4.1.0.20-fc16.i586 requires libQtXml.so.4     skype-4.1.0.20-fc16.i586 requires libQtNetwork.so.4     skype-4.1.0.20-fc16.i586 requires libQtDBus.so.4     skype-4.1.0.20-fc16.i586 requires libQtWebKit.so.4     skype-4.1.0.20-fc16.i586 requires libQtGui.so.4     skype-4.1.0.20-fc16.i586 requires libstdc++.so.6(GLIBCXX_3.4.15)     skype-4.1.0.20-fc16.i586 requires libQtCore.so.4     skype-4.1.0.20-fc16.i586 requires libXv.so.1     skype-4.1.0.20-fc16.i586 requires qtwebkit     [...]      If I try the Dynamic version, I encounter this error:               $ ~/bin/skype-4.1.0.20/skype      error while loading shared libraries: libXv.so.1:      cannot open shared object file: No such file or directory      Is it possible to install these dependencies? If so, how?


title: CakePHP shell as cron permissions issue

text: First to say that I know basics of Linux systems. I am familiar with cron jobs. I am using CakePHP shell as cronjob. The script is using model's method to download pages from site user entered. Everything works fine but when I create cron as user _bokac_ the script doesn't have the right privileges to create folders (I am guessing that) because if I delete cronjob for that user, and switch user to _www-data_ and create the same cron there, the script works, and creates required folders. How to make script do that with first user, _bokac_ ? I am not sure what or who created user _www-data_. Any help appreciated.


title: cron job schedule

text: I created a cron job using `* */2 * * *` schedule. Can anyone tell me what schedule this refers to? I guess it should execute every 2 hours, but it seems to execute every minute.


title: Help to understand Iptables Forward chain with DNAT

text: I have one server where iptables configured with all chains DROP in filter table               eth0 :- 10.0.0.2 [ Intranet assume as LAN ]     eth2 :- 172.16.0.2 [ External clients assume as WAN ]      Now What I am trying to achieving is , when client[172.16.0.1] HIT Port 80 On 172.16.0.2 then it should be nat to internal LAN IP that is 10.0.0.100. What I have configured to achieve the same [INPUT,OUTPUT,FORWARD Policy is Drop in Filter Chains]               iptables  -A INPUT -s 172.16.0.1/32 -d 172.16.0.2/32 -i eth2 -p tcp -m tcp --dport 80 -j ACCEPT     iptables  -A FORWARD -s 172.16.0.1/32 -j LOG --log-prefix "** TRACING FORWARD CHAIN **"      iptables  -A FORWARD -s 172.16.0.1/32 -d 10.0.0.100/32 -i eth2 -o eth0 -j ACCEPT     iptables  -A OUTPUT -p tcp -m state --state ESTABLISHED -j ACCEPT     iptables  -t nat -A PREROUTING -s 172.16.0.1/32 -d 172.16.0.2/32 -p tcp -m tcp --dport 80 -j DNAT --to-destination 10.0.0.100:80      `net.ipv4.ip_forward = 1` in `sysctl.conf` In Logs:               [17385.347409] ** TRACING FORWARD CHAIN **IN=eth2 OUT=eth0 MAC=xxxxxxxx SRC=172.16.0.1 DST=10.0.0.100 LEN=48 TOS=0x00 PREC=0x00 TTL=127 ID=9864 DF PROTO=TCP SPT=52874 DPT=80 WINDOW=8192 RES=0x00 SYN URGP=0      Now When I Set FORWARD POLICY ACCEPT then it is working but not working with Forward Drop Policy. So can anyone help me to understand forward policy and which rules should be added in forward policy.


title: What makes the Linux scheduler seem unpredictable?

text: The question refers to the output of a multi-threaded application, where each thread merely prints its ID (user assigned number) on the standard output. Here all threads have equal priority and compete for CPU quota in order to print on the standard output. However, running the same application a sufficiently large number of times will result in different order of IDs being printed on the screen. This order is due to the OS scheduler which is a piece of software and therefore deterministic. Nonetheless, its behavior seems non- deterministic, which brings me back to the initial question.


title: D-Link DI-624 H/W ver. D: Flashing OpenWrt

text: I have a D-Link DI-624 rev. D2 Router. It is based around an Atheros AR2316A-001 chipset, and has 8MB RAM. I opened the device to check for actual parts use in it, and I can confirm, it is indeed the AR2316A-001 chipset with PSC A2V64S40CTP (8MB RAM). I couldn't locate the flash chip, the original firmware is 1MB in size, I don't know if anything larger can be loaded onto the device. I was wondering, If I could load OpenWrt on it, so I compiled OpenWrt with the AR231x chipset as Target. Now, the compile process yielded those squashfs images:               openwrt-atheros-np25g-squashfs.bin     openwrt-atheros-ubnt2-pico2-squashfs.bin     openwrt-atheros-ubnt2-squashfs.bin     openwrt-atheros-ubnt5-squashfs.bin     openwrt-atheros-wpe53g-squashfs.bin      All those files are around 2.4MB to 2.5MB in size, which is far more, than the firmware available from D-Link (`di624revD_firmware_404.bin` is around 1MB). I was wondering which file I should try to upload if any. On the DD-WRT page for supported devices this router is listed, revision C, which uses the same chipset. The DI-624 has an interesting emergency feature comparable to other D-Link products, like the DIR-600: When holding down the reset button while connecting power to the device, the router goes into an emergency restore mode. Then, when going to 192.168.0.1 with a browser, you can upload another firmware, no matter how badly bricked the router is. In case anyone succeeded with flashing an alternative OS onto a DI-624, I'd very much like to know how. There was some guy at the OpenWrt forums that claimed he could boot Linux on the DI-624, but he didn't really explain how he did it. _I wasn't sure whether this question belongs here orelectronics.SE_


title: wait for autossh connection to complete

text: I'm trying to create a script that runs a few commands that take a long time to execute and require a constant connection, but               autossh user@server     wait $! #or wait ${!}          commandA     commandB      doesn't work (I'm assuming because `autossh` drops into the background). The GUI pops up asking for a password and while that is up the next few commands are run. How do I wait for an established connection before running the next commands? Update: autossh -f => "...causes autossh to drop to the background before running ssh..." so with the -f wait does nothing, without it, you wait on the ssh which will never end...