title: How do I get most of my standard Linux utilities and commands on Android 3.1?

text: By standard, I mean just what users often get by default with one of the popular distros. For example, `uname`, `finger`, `vim`, `tmux`, etc. I have a Galaxy Tab 10.1 (Android version 3.1, already rooted) Also, I read somewhere about setting up a `chroot` on Android to run full- fledged Linux distros, such as Debian.   Is that possible?


title: How is bc different from dc?

text: What are the differences between `dc` and `bc` calculators? When should I use `dc` and when `bc`?


title: How to debug a buggy running GUI application?

text: Suppose the GUI applications are not given names in its GUI, so you don't know what to check in 'ps -A', i.e. the nameless applications in the task bar. How do I know which GUI application belong to what process and start debugging its errors (i.e. GUI frozen, program crash...)? With CLI applications, I can use attach the process to GDB and start investigating it.


title: How to put Mac OS X wireless adapter in monitor mode

text: I'm searching for a equivalent of "iwconfig eth0 mode Monitor" in Mac OS. From man iwconfig mode Monitor does the following: "the node is not associated with any cell and passively monitor all packets on the frequency"


title: Debian 7 on Macbook

text: I have just installed Debian 7.1 on my Macbook Pro 9,2. I'm trying to get the keyboard backlight to work properly. I can press the F5/F6 keys to get an OSD to show up on the screen, but the backlight doesn't change. The other buttons seem to work properly though, such as sound and backlight. It looks like this is a GNOME setting, as I was messing around with the shortcuts and set a new shortcut to be the KbdBrightnessUp key, and of course that means that I don't get an OSD anymore. I installed pommed, but that didn't do anything. Questions:   1. Where is the shortcut for the keyboard backlight brightness?   2. Is there some setting that I need to change in order to get the keyboard backlight to work?


title: Should I update my Fedora or not?

text: Here is my problem. My laptop has an NVidia Geforce 310 M graphic card. And since kernel 2.6 I had problems with the display. I had to use nomodeset option in the grub, if not my screen will be off when the xorg starts even though my computer is running. Fortunately, this problem was fixed in early 3.0 kernels. It was fine until kernel 3.4.x in which the problem was back. So I've been using the old kernel(3.3.x) from my grub list, and reported a bug at bugzilla. But they never replied to my questions about the bug on bugzilla. Now, the real problem is the update manager says there are software updates and it want to remove the old kernel and install some 3.4.x kernel which I'm not sure if they fixed the problem. If I don't get display, I lost my fedora I should re-install some other OS or OS with kernel 3.3.x What should I do?


title: Nvidia video card drivers for Linux compatibility

text: I'm looking to purchase a new graphics card but all vendors only provide drivers for Windows while Nvidia provides drivers for Linux, my question is whether I can use the drivers from nvidia or if they have to come from the manufacturer? For instance if I buy a something card GTX550 from Asus but they don't have a linux driver, can i use the GTX550 linux driver that nvidia provides?


title: When I set the default shell, it doesn't "take"

text: I want my default shell to be bash. However, whenever I log into my server, the shell is apparently `-bash`:               $ echo $0     -bash      If I run `bash`, I'm of course switched to bash for that session, but it doesn't stick, even if I do `chsh -s /bin/bash`. Is there some step that I'm missing if I want bash to be my default shell?


title: Problems copying large files to USB drive

text: I've got some issues when copying larger files to my USB drive. First of all, my system stopped recognizing my USB drives automatically. I now have to run `modprobe usb-storage` in order for my USB drive to be recognized. Once this is run, I can properly access my USB drives (USB pen drives). However, when I try to copy a larger file, the copying process will hang. My USB drive indicates to be busy, and my program also indicates it is writing information, but it simply hangs and does not move. Details:   * I tried using a GUI tool and the command line. Results are the same.    * I tried using different USB drives. Results are the same.   * I tried decreasing the `max_sectors` setting, as indicated here. This has one main result: instead of hanging at 200 MB, the file now copies for 60 MB instead before hanging.  Given the last observation, I feel it might have to do something with the max_sectors setting, but even lowering this does not help, so I'm not sure exactly where the issue can be. Please note that the system will copy a certain amount of information (60 or 200 MB, or whatever I set max_sectors to), and then act as if more info is being written, while in fact nothing happens. I have to manually remove the USB drive in order to be able to shut down my computer. EDIT: Please note that at this moment very few times I'm actually able to have my USB recognized. I am running `modprobe usb-storage` a dozen times, taking the USB out and connecting it again, and opening my file browser frequently, to try to 'force' recognition/mounting of the drive. It only happens once in many times. I feel this whole thing is related to one main issue with the USB drivers or something else in common, but I'm just not sure _what_ it is. Any ideas?


title: Allowing people temporary access to my server to run a command

text: I am going to be in the middle of nowhere for 10 days later this summer. I have a service that needs to stay running and if there is a problem when I am gone, I want to give one or two trusted people access to be able to restart that service. The service is a node.js application and even though they are very technical, I want it to be as simple as running a script via SSH (or a better option if there is one). What would be the best approach to accomplish this?


title: Quoting command substituted value

text: In bash you would do               touch "foo bar"     rm "$(echo foo bar)"      How would you do that in fish? This doesn't work for obvious reasons:               touch "foo bar"     rm "(echo foo bar)"


title: Why do we need NetworkManager?

text: I really do not understand the point of NetworkManager in Linux. Why does it replace the old methods of managing connections in Red Hat, for example?


title: Zsh completion duplicates folder names

text: I'm seeing a strange problem when completing folders with zsh 5.0.2 (and oh- my-zsh). When I go to tab complete folder names for a relative path, the folder names often duplicate and lose colour highlighting. It's frustrating as I then have to tab complete through each directory twice to get to the one I want. It only happens if what I'm completing from finishes with a "/" so for example, "dev/" or "dev/code/" would cause the problem, but "dev/c" would not. Also the problem doesn't seem to happen for absolute paths "/home/dave/dev/" is fine. I've attached an animation showing the problem below: ![Duplicating completion](http://i.stack.imgur.com/FVBs6.gif) I don't have anything particularly fancy in my zsh config (which is here: https://github.com/actionshrimp/dotfiles/blob/master/zshrc) Any ideas what could be causing this?


title: filefield nginx progress module not showing upload progress bar

text: Using module: https://drupal.org/project/filefield_nginx_progress on a clean Drupal 7.26 Followed all instructions from the main page Recompiled nginx 1.4.4 with http://wiki.nginx.org/HttpUploadProgressModule   `nginx -V` shows the module Now when I try to upload a file it just hangs on "Starting upload..." then I get the error:               An unrecoverable error occurred. The uploaded file likely exceeded the maximum file size (200 MB) that this server supports.      Though file is just 5Mb In watchdog I am getting the error:               page not found     http://domain.com/progress      What I am doing wrong?


title: Using sed to perform substitutions in a file

text: I was trying to replace dates in a huge file using sed. I tried :               sed -ie 's/2014-[0-9]{2}-[0-9]{2}/2014-05-07/g' test      However, nothing happened at all, my file test is not modified. Do you know what I am missing here ? Thank you very much.


title: Proxychains don't work with socks & auth

text: I would like to use a socks5 proxy (with authentication) with some programs. I found proxychains. I installed this and added my proxyIP, port, user and password to `/etc/proxychains.conf.` A test like `proxychains wget google.com` failed (timeout).               proxychains wget google.com > ProxyChains-3.1 (http://proxychains.sf.net) --2012-06-18 17:15:37-- http://google.com/ Auflösen des Hostnamen »google.com«... 173.194.70.100, 173.194.70.101, 173.194.70.102, ... Verbindungsaufbau zu google.com|173.194.70.100|:80... |S-chain|--94.x.x.x:999--173.194.70.100:80- The proxy works. I tested with proxyfire in winXP. What is the problem? Did I forget something? Do you know an alternative?


title: Error while starting slapd

text: In my CentOS 6.5 machine I just made a new import with the `slapadd` command to load a new LDIF (from another server). The `dc` values are exactly the same and it was working with a previous load. Between two loads I clean the database with `rm -f /var/lib/ldap/*` But now when I try to start the slapd service with `service slapd start` I get this error:               Starting slapd:         [FAILED]      I checked if there is an error log somewhere but cannot find it:   * Nothing lokking like `*ldap*` or `*slapd*` in `/var/log` folder   * The `log.000000xxx` files in /var/lib/ldap are looking binaries Is there any way to find what is the cause why slapd does not start properly?


title: Current state of AMD graphics driver for Linux?

text: I've used Linux distros quite a lot and remember horrible AMD support for graphic cards. I'm building a new rig, atm, and would like to know if the situation improved?


title: What difference is between ARM Debian for Raspberry PI and Ordinary debian x32/X64 for desktop?

text: I would like to know, how big is difference between ARM debian for Raspbery PI and x32/x64 debian for desktop. I would like to buy in future some ARM mini pc like raspbery PI and use it as for example cheap IPv6 router, machine to connect remotely from the internet and to control whatever I will need. It will be something better than only router, it will be small server with low TDP. Is there any problem with packaging system? Is there enough packages for ordinary use? What about RAM consumption?


title: How long could I work with stable release after it is no more supported?

text: I'm still working on Debian squeeze which will be supported for only about 1 more year (it is server with KVM). How long is it possible to work on an old version of Debian (after Debian gets old) when is it no more supported? How long is it secure and stable to work on an old version of Debian, in my case Squeeze (after is it no more supported)?


title: Fonts bug in terminal (Arch)

text: I' ve installed droid fonts, after that in terminal I see the word not well, someone is on another ![enter image description here](http://i.stack.imgur.com/jIZt6.png) As you can see the problems are especially with 'm' and 'w' What's the problem?


title: Wallpapers' s folder in XFCE4

text: I've just installed XFCE4 on Arch Linux, now I'd like to add an image in the wallpaper folder, someone know the full path. I'm searching, but I haven't found yet.


title: Should stdin or filenames be discarded if both are provided?

text: `grep` and `sed` ignore stdin if you provide a filename parameter:               $ echo foo > test.txt     $ echo foobar | grep f test.txt      foo     $ echo foobar | sed -e 's/foo/bar/' test.txt      bar      Is this established best practice? If so, why?


title: Defragging RAM / OOM failure

text: This question is fairly lengthy, so I'll ask the questions at the top and then go through my method of coming to the questions:   1. Did (Busybox based) rm not execute because there wasn't enough contiguous RAM?   2. If so, is there a lightweight method of defragging the DMA - without resorting to a system restart?   3. If not, what caused it? How can I prevent it from happening in the future? After our test system had been running fairly intensively over the last few days - I telnet'd into the system and checked the test results. When I came to delete some data, the system returned the command line (as if the command had executed correctly). When I came to check the directory for another set of results, I saw the file still existed (using ls). After this, I noticed more and more of my shell commands wern't performing as expected. I'll start off with an output from **dmesg** after rm failed to execute correctly: > Allocation of length 61440 from process 6821 (rm) failed > > DMA per-cpu: > > CPU 0: hi: 0, btch: 1 usd: 0 > > Active_anon:0 active_file:1 inactive_anon:0 inactive_file:0 unevictable:6 > dirty:0 writeback:0 unstable:0 free:821 slab:353 mapped:0 pagetables:0 > bounce:0 > > DMA free:3284kB min:360kB low:448kB high:540kB active_anon:0kB > inactive_anon:0kB active_file:4kB inactive_file:0kB unevictable:24kB > present:8128kB pages_scanned:0 all_unreclaimable? no > > lowmem_reserve[]: 0 0 0 > > DMA: 31*4kB 47*8kB 42*16kB 64*32kB 1*64kB 0*128kB 0*256kB 0*512kB 0*1024kB > 0*2048kB 0*4096kB = 3284kB > > 14 total pagecache pages > > Unable to allocate RAM for process data, errno 12 Initially, I thought I was unable to run the program in the largest portion of contiguous memory. Meaning the DMA was too fragmented and I would have to find a way of getting the system to defragment the memory. Then I did a quick math/sanity check and realised that the program should have been able to run in the sole 64kB contiguous memory slot. Rm was requesting 61440 bytes (60kB). I did a good old "manual defrag" and rebooted the system. When I rebooted the sytem I output /proc/buddyinfo: `Node 0, zone DMA 2 8 3 12 0 1 0 1 0 1 0` Which I suspect map to:   * 2 x 4 kB   * 8 x 8 kB   * 3 x 16 kB   * 12 x 32 kB   * 1 x 128 kB   * 1 x 512 kB But if one sums the above list of values, it doesn't match up with the output of **/proc/meminfo** :               MemTotal:           6580 kB     MemFree:            3164 kB     Buffers:               0 kB     Cached:              728 kB     SwapCached:            0 kB     Active:              176 kB     Inactive:            524 kB     Active(anon):          0 kB     Inactive(anon):        0 kB     Active(file):        176 kB     Inactive(file):      524 kB`     Unevictable:           0 kB     Mlocked:               0 kB     MmapCopy:            844 kB     SwapTotal:             0 kB     SwapFree:              0 kB     Dirty:                 0 kB     Writeback:             0 kB     AnonPages:             0 kB     Mapped:                0 kB     Slab:               1268 kB     SReclaimable:        196 kB     SUnreclaim:         1072 kB     PageTables:            0 kB     NFS_Unstable:          0 kB     Bounce:                0 kB     WritebackTmp:          0 kB     CommitLimit:        3288 kB     Committed_AS:          0 kB     VmallocTotal:          0 kB     VmallocUsed:           0 kB     VmallocChunk:          0 kB      **To recap, my questions are:**   1. Did rm not execute because there wasn't enough contiguous RAM?   2. If so, is there a lightweight method of defragging the DMA - without resorting to a system restart?   3. If not, what caused it? How can I prevent it from happening in the future? I am using Lantronix's XPort Pro (8MB, Linux OS) running uClinux version 2.6.30. The shell in use is hush.


title: Having a problem installing snort on fedora 17

text: I've installed the latest versions of libpcap and libdnet. There is however a problem with daq. I configured snort with `--wth-daq- libraries=/usr/local/lib/daq and --with-libpcap-libraries=/usr/lib` flags, however snort still cannot find my daq_static library. However when I build daq, all my modules are being built correctly and I see the static libraries when I go to the directory `/usr/local/lib/daq`. Also when I configure daq, I also use the `--wth-libpcap-libraries=/usr/lib`. Another thing that I don't understand is when I look in usr/lib directory for my libpcap, I see a file that is libpcap.a. What kind of file is that? Also I don't know how to check where snort is looking when it wants to find some library. Maybe there is a bash command or something I could use like strace thats for libraries instead of system calls. The last thing I want to mention is that I am configuring and building snort from `/usr/local/share`. Though technically I don't think it should really matter from where I build. BTW whats the difference between the `--with-daq- include` and `--with-daq-libraries` flag? Aren't they the same? Thanks for any help. If there is anything in my question you don't understand or would like more specification, I will do my best to clear things up.


title: Protecting postfix from bruteforce attacks

text: a few days ago I've set up a VPS, including personal SMTP service using postfix + procmail under Debian / Wheezy. I am already seeing a LOT of hammering onto the SMTP and other ports. Here's an excerpt: > Jul 31 09:06:25 [myserver] postfix/smtpd[15372]: warning: > mail.thethirdroom.org[81.137.228.117]: SASL LOGIN authentication failed: > authentication failure Jul 31 10:00:02 [myserver] postfix/smtpd[20616]: > warning: > host245-192-static.36-88-b.business.telecomitalia.it[88.36.192.245]: SASL > LOGIN authentication failed: authentication failure There are multiple login attempts per second. Now, I am running sshguard to keep people from bruteforcing there (except if it was a distributed attempt), but postfix is still kind of vulnerable since sshguard does not support that. Can anyone hint me at how to make this thing more secure? Thanks a lot! TL;DR: SMTP server getting hammered, would like to ban IPs after n faulty attempts.


title: Randomly draw a certain number of lines from a data file

text: I have a data list, like               12345     23456     67891     -20000     200     600     20     ...      Assume the size of this data set (i.e. lines of file) is `N`. I want to randomly draw `m` lines from this data file. Therefore, the output should be two files, one is the file including these `m` lines of data, and the other one includes `N-m` lines of data. Is there a way to do that using a Linux command?


title: Synchronize directory tree with deduplication?

text: I have two Linux servers that have a large amount of data (1TB+) that need to be synchronized over a slow connection (100 KB/s). A lot of the data overlaps, but are in different locations. I would like some sort of rsync / unison tool where I can mirror the servers. It would need to be more intelligent and identify if the file exists at the destination (possibly in another location with the same checksum). If it does, then it moves the file locally on the destination server rather than copying the file from scratch from the source server.


title: Make all SELinux contexts permanent

text: I've done a lot of `chcon`-ing lately,but if I understand it correctly, these will be erased on the next relabel. Is there any way to make the current contexts (preferably just under a certain directory) permanent? I understand there's a way to do it using `semanage`, but that means going back through and checking the context of every file and invoking `semanage` to set a rule. So is there some automated way to do it?


title: How to mount NFS 3 volumes on Fedora 17?

text: I installed the package `nfs-utils` and tried it via:               # mount -t nfs server:/mnt /mnt     mount.nfs: rpc.statd is not running but is required for remote locking.     mount.nfs: Either use '-o nolock' to keep locks local, or start statd.     mount.nfs: an incorrect mount option was specified      Ok, probably need to start that - via systemd - right?               # systemctl start nfs-lock.service      Job failed. See system journal and 'systemctl status' for details.     # journalctl     Jun 15 23:22:18 host rpc.statd[24339]: Version 1.2.6 starting     Jun 15 23:22:18 host rpc.statd[24339]: Opening /var/run/rpc.statd.pid failed:                                              Permission denied     [..]     Jun 15 23:22:18 host systemd[1]: nfs-lock.service: control process exited,                                               code=exited status=1     Jun 15 23:22:18 host systemd[1]: Unit nfs-lock.service entered failed state.      Looks like a SELinux related problem?               Jun 15 23:22:18 host setroubleshoot[3211]: analyze_avc()        avc=scontext=system_u:system_r:rpcd_t:s0        tcontext=unconfined_u:object_r:var_run_t:s0        access=['unlink'] tclass=file tpath=rpc.statd.pid     Jun 15 23:22:18 host setroubleshoot[3211]: SELinux is preventing        /usr/sbin/rpc.statd from unlink access on the file rpc.statd.pid.     Jun 15 23:22:18 host setroubleshoot[3211]: analyze_avc()        avc=scontext=system_u:system_r:rpcd_t:s0        tcontext=unconfined_u:object_r:var_run_t:s0        access=['write'] tclass=file tpath=rpc.statd.pid     Jun 15 23:22:18 host setroubleshoot[3211]: SELinux is preventing        /usr/sbin/rpc.statd from write access on the file rpc.statd.pid.      Ok - now the question is: what SELinux configuration or what file label do I have to change?               # systemctl status nfs-lock.service     nfs-lock.service - NFS file locking service.           Loaded: loaded (/usr/lib/systemd/system/nfs-lock.service; enabled)           Active: failed (Result: exit-code) since Fri, 15 Jun 2012 23:22:18 +0200;                   13min ago          Process: 24338 ExecStart=/sbin/rpc.statd $STATDARG                   (code=exited, status=1/FAILURE)          Process: 24334 ExecStartPre=/usr/lib/nfs-utils/scripts/nfs-lock.preconfig                   (code=exited, status=0/SUCCESS)           CGroup: name=systemd:/system/nfs-lock.service      Is a package missing - or am I using the wrong service?


title: External screen shaking with Fedora

text: I have a really weird problem with my laptop ASUS K53SV. It has two graphics card (Intel + Nvidia) and nvidia optimus, but I'm actually using just the intel one. My operating system is Fedora 16. When I connect my external screen, a Samsung 2033HD, I have problems with it. It's shaking, like it had some refresh rate problems. The actual resolution is 1600x900, refresh rate 60Hz. I tried to change the VGA cable, but the problem is still the same. The point is that the same monitor works without any problem at the same resolution with my netbook (an ASUS 1215P with Fedora as well and an intel graphic card), and the same laptop doesn't have any problem if I connect it to a different screen (samsung 24 inch 1920x1080). I just tried to boot with two different distributions: with Fuduntu I have the same problem (I suppose because it's based on Fedora), while with Ubuntu the screen is working fine at 1600x900. The following is my `xrandr` output. I already tried without success to change the refresh rate.               Screen 0: minimum 320 x 200, current 2966 x 900, maximum 8192 x 8192     LVDS1 connected 1366x768+0+0 (normal left inverted right x axis y axis) 344mm x 193mm        1366x768       60.0*+        1024x768       60.0          800x600        60.3     56.2          640x480        59.9       VGA1 connected 1600x900+1366+0 (normal left inverted right x axis y axis) 443mm x 249mm        1600x900       60.0*+        1280x1024      75.0          1440x900       59.9          1280x800       74.9     59.8          1152x864       75.0          1024x768       75.1     70.1     60.0          832x624        74.6          800x600        72.2     75.0     60.3     56.2          640x480        72.8     75.0     66.7     60.0          720x400        70.1       HDMI1 disconnected (normal left inverted right x axis y axis)     DP1 disconnected (normal left inverted right x axis y axis)      I can't believe it, what should I do/try?


title: Trouble booting CentOS

text: I switched from an Ubuntu to the CentOS yesterday. But it seems I have messed my installation somehow, since OS will only start correctly if the USB with the installation is plugged in. Long story: I've downloaded a live DVD CentOS 6 from the public repository, and using it with unetbotin created USB installation. That USB was used to install CentOS. During the installation, (only 1 ) hard disk was mounted under /sdb and USB installation was mounted under /sda. I "think" I selected to boot from the /sdb. Output of `sudo fdisk -l`               Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes     249 heads, 62 sectors/track, 126540 cylinders     Units = cylinders of 15438 * 512 = 7904256 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x671e6467             Device Boot      Start         End      Blocks   Id  System     /dev/sdb1               1       26533   204800000    7  HPFS/NTFS     /dev/sdb2           26533       28557    15624193    5  Extended     /dev/sdb4   *       28569      126540   756238336   83  Linux     /dev/sdb5           26533       28557    15624192   82  Linux swap / Solaris          Disk /dev/sda: 8086 MB, 8086618112 bytes     37 heads, 13 sectors/track, 32836 cylinders     Units = cylinders of 481 * 512 = 246272 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x90909090             Device Boot      Start         End      Blocks   Id  System     /dev/sda1   *           5       32837     7896064    b  W95 FAT32           Wierd thing:   if the USB stick is not connected to the machine, the boot screen will show up ( with both new installation of the CentOS and old Windows installation). But after I select either of them, after few seconds the machine will reboot. If the USB is connected, the same or similar boot screen shows up I OS starts normally. I've tried to reinstall GRUB using `grub-install` using /dev/sdb and /dev/sda options, but I wasn't able to make progress. Also, I don't understand purpose and content of the `device.map` file:               (hd0)   /dev/sda     (hd1)   /dev/sdb      I tried removing /dev/sda from the device.map, which also doesn't help. `grub.conf` from /boot/grub/               # grub.conf generated by anaconda     #     # Note that you do not have to rerun grub after making changes to this file     # NOTICE:  You do not have a /boot partition.  This means that     #          all kernel and initrd paths are relative to /, eg.     #          root (hd1,3)     #          kernel /boot/vmlinuz-version ro root=/dev/sdb4     #          initrd /boot/initrd-[generic-]version.img     #boot=/dev/sda     default=0     timeout=5     splashimage=(hd1,3)/boot/grub/splash.xpm.gz     hiddenmenu     title CentOS (2.6.32-220.2.1.el6.x86_64)             root (hd1,3)             kernel /boot/vmlinuz-2.6.32-220.2.1.el6.x86_64 ro root=UUID=6cbcc55f-3342-4e85-a4c2-8355e73962f2 rd_NO_LUKS LANG=en_US.UTF-8  KEYBOARDTYPE=pc KEYTABLE=croat rd_NO_MD quiet SYSFONT=latarcyrheb-sun16 rhgb crashkernel=128M rd_NO_LVM rd_NO_DM             initrd /boot/initramfs-2.6.32-220.2.1.el6.x86_64.img     title CentOS (2.6.32-220.el6.x86_64)             root (hd1,3)             kernel /boot/vmlinuz-2.6.32-220.el6.x86_64 ro root=UUID=6cbcc55f-3342-4e85-a4c2-8355e73962f2 rd_NO_LUKS LANG=en_US.UTF-8  KEYBOARDTYPE=pc KEYTABLE=croat rd_NO_MD quiet SYSFONT=latarcyrheb-sun16 rhgb crashkernel=128M rd_NO_LVM rd_NO_DM             initrd /boot/initramfs-2.6.32-220.el6.x86_64.img     title Other             rootnoverify (hd1,0)             chainloader +1      EDIT: more information   by deleting "quiet" and "rhgb" from the grub.conf I was able to see the error message : No devices found .


title: What should I use when cut doesn't cut it?

text: I have a file `cities` like this:               [1598] San Diego, US (inactive)     [4517] St Louis, US (inactive)     [6346] Orlando, US (inactive)      I want to cut out the city names, so that I have:               San Diego     St Louis     Orlando      This is the best I could come up with:               cut -d ',' -f1 cities | cut -d ']' -f2      But that still leaves me with a space before the names. Is there a `cut` like command that I can use that accept delimiters of several characters so I can cut on `]`?


title: What is the difference between Ubuntu and Debian?

text: Are they both different flavors of Linux? I often see these two used interchangeably or together, which is confusing. Either they may be competing versions of Linux, or parts of the same thing...but not both :) Can anyone clarify the difference/similarity between them?


title: Faster way to rename duplicate files (identified by fdupes) in another directory?

text: I have a directory full of pdf files of journal articles, most of which are named by their bibtex key. Some time ago I made a backup on an external hard drive, but I haven't kept it up to date and there are tons of duplicates with different names. I want to get the two directories back into sync and delete the extra files. Using fdupes I have identified a bunch of these, and now I have a nice paired list of them. However, most of the duplicates on the external drive have meaningless names. I'd like to rename them to be the same as the duplicate in the first directory, rather than deleting them and copying them over again, because there are so many of them. So I don't want to just use rsync. For example, if the fdupes output is:               /home/articles/bibtex.pdf     /external/articles/morearticles44.pdf      Is there a faster way than writing               mv /external/articles/morearticles44.pdf /external/articles/bibtex.pdf      for each pair of duplicates?


title: Brightness too low in Debian Wheezy

text: I have just installed Debian Wheezy in my Toshiba Laptop and it works great. However, sometimes the brightness level is too low when starting the system. If I use the keys `Fn+F6` to decrease and `Fn+F7` to increase it, a bar appears in the screen, increasing or decreasing but the brightness level did not change. Do you have any ideas? PS: I'm using the gnome fallback mode.


title: passwordless ssh is not working in CentOS 6.4?

text: I am setting up passwordless login from this link but I can't get it to work. When I do `ssh localhost` it always asks for a password. I have also referred to this question: ssh password less authentication doesn't work               [impadmin@pearl ~]$ ssh localhost     The authenticity of host 'localhost (::1)' can't be established.     RSA key fingerprint is 6c:d3:3b:cc:05:7f:10:e8:17:cc:4c:14:be:01:bb:f7.     Are you sure you want to continue connecting (yes/no)? yes     Warning: Permanently added 'localhost' (RSA) to the list of known hosts.     impadmin@localhost's password:     Permission denied, please try again.     impadmin@localhost's password:     Permission denied, please try again.     impadmin@localhost's password:     Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).      **Update**               ls .ssh/ -l     total 16     -rw-------. 1 impadmin impadmin  396 Apr  9 17:04 authorized_keys     -rw-------. 1 impadmin impadmin 1675 Apr  9 17:03 id_rsa     -rw-r--r--. 1 impadmin impadmin  396 Apr  9 17:03 id_rsa.pub     -rw-r--r--. 1 impadmin impadmin  391 Apr  9 17:05 known_hosts      I am trying to achieve password less login on same machine for user impadmin to install Hadoop.


title: linux + how to install glibc.i686

text: I try the following, but I get `No package glibc.i686 available`. What do I need to do in order to install the glibc.i686? Or maybe there is another way to solve this problem?                yum install glibc.i686      Loaded plugins: product-id, refresh-packagekit, security, subscription-manager      Updating certificate-based repositories.      Unable to read consumer identity      Setting up Install Process      No package glibc.i686 available.      I have Linux RedHat 6.3 ( from `uname -a` I get -> `86_64` )


title: How Debian PTS finds that there's a new upstream version?

text: For example, the package aisleriot says: > A new upstream version is available: 3.12.1, you should consider packaging > it. How does the Package Tracking System knows?


title: how to correctly delay the execution of a startup script based on a tested condition?

text: I need to start a service (namely `ntp`) only when true Internet connectivity is in place (not only a link up). I seem to have noticed that some startup scripts delay themselves when a condition is not met (usually until a network device is available). How to do correctly do this this in a startup script?   * the startup script would run a check (another script)   * based on the result it would either actually start the service or be delayed for some time, and re-execute the check I can imagine a bash `while` condition but the script would be blocking and before jumping into backgrounding I wanted to make suere that there is no out- of-the-box solution, built-into the startup mechanism and environment. Note: this is a followup to a previous question about startup script dependencies.


title: Extract time stamps and find the difference

text: I have a large set of logs as shown below:               June   5 15:51:56.606  [3997]:   TR#153. State machine - state = CC_STATE_IDLE, event = EVT_ISDN_SETUP     June   5 15:51:56.607  [3997]:   TR#153):  SC registration SUCCESS.     June   5 15:52:00.368  [3997]:   TR#153. DSP:4 Channel:26 Type: Modem State: Data      June   5 15:52:01.837  [3997]:   TR#153. Receive transaction data: prot 1 data length: 159.-------------------->>     June   5 15:52:02.073  [3997]:   TR#153. Send transaction data: 55 <<-------------------     June   5 15:52:04.361  [3997]:   TR#153):Disconnect initated by 32 process.     June   5 15:52:57.382  [3997]:   TR#153. State machine - state = CC_STATE_IDLE, event = EVT_ISDN_SETUP     June   5 15:52:57.383  [3997]:   TR#153):  SC registration SUCCESS.     June   5 15:53:01.327  [3997]:   TR#153. DSP:4 Channel:26 Type: Modem State: Data      June   5 15:53:04.291  [3997]:   TR#153. Receive transaction data: prot 1 data length: 347.-------------------->>     June   5 15:53:05.071  [3997]:   TR#153. Send transaction data: 103 <<-------------------     June   5 15:53:06.209  [3997]:   TR#153. Receive transaction data: prot 1 data length: 24.-------------------->>     June   5 15:53:07.239  [3997]:   TR#153):Disconnect initated by 32 process.      I would like to find the time difference b/w the events 'EVT_ISDN_SETUP' and 'Disconnect', essentially each transactions duration. For this I need to extract the time stamp from corresponding lines first and find the difference. I tried the Perl code here to find the difference for one instance and it worked fine. My task would be then to successfully get the time stamps b/w the interested events and then feed to Perl code and print the difference along with TR#ID. How do I go about it?


title: indirect variable expansion in POSIX as done in bash?

text: Is it possible, or is there some elegant hack to do indirect variable expansion in POSIX as can be done in Bash? For context, I'm trying to do the following:               for key in ${!map_*}     do         # do something     done      EDIT: To clarify, I'd like to access shell variables that begin with `map_`.


title: Placement of application and user files on linux system

text: In which directories should I place the following?   I have an application with few .net assemblies, a default database (containing default application settings), a directory with 100's of images, a directory for sounds (e.g. mp3's). e.g.               somedir/myapp.exe       somedir/myassembly1.dll       somedir/myassembly2.dll            somedir/images/1/image1.png       somedir/images/1/image2.png       somedir/images/2/image1.png            somedir/sounds/1/sound1.mp3       somedir/sounds/1/sound2.mp3       somedir/sounds/2/sound1.mp3        A requirement is that I want to allow my user to replace the sounds and images as they see fit so basically that path (e.g. `/var` or `/usr`) should typically have write access to a normal user.


title: How to delete VirtualBox networking rule?

text: I add a rule:               VBoxManage modifyvm "xp" --natpf1 "guestrdp,tcp,127.0.0.1,33890,,3389"      I list it:               VBoxManage showvminfo "xp" | awk '/NIC/ && /Rule/ {print}'     NIC 1 Rule(0):   name = guestrdp, protocol = tcp, host ip = 127.0.0.1, host port = 33890, guest ip = , guest port = 3389      But how can I delete it?


title: How can I setup group permission for different user on multiple Linux installations?

text: I have two Linux installations on my computer, with `/home` on a different partition but shared for the two installs. And each install has a different username to avoid conflicts. The thing is, I'm a developer, I don't want mix users, but I want to setup permissions for a shared folder. Example,   * Ubuntu, main user: `raul`, home folder: `/home/raul`   * Fedora, main user: `ricardo`, home folder: `/home/ricardo`   * I want a `/home/shared` where `raul` & `ricardo` have permissions over this folder, maybe `www-data` and `root`, but any other user on any Linux distro. I hope you got my problem. EDIT: This seems to be more complex than expect. This note is the best I can explain, with my actual English level, so please be nice. On the same computer, I have distros A and B installed. Distros A and B are sharing `/home` in another partition but have different users... so I have `/home/a` for user `A` in distro A, `/home/b` and you know... So I like to have a folder for example `/home/shared` where users `A` and `B` can both read and write to the folder, like part of the same group, BUT user `A` doesn't exist on distro B and vice versa. Then how do I tell each distro to make me a group with a user from another distro?


title: Installing PHP 5.3.3-24 on CentOS 6.5 (Final)

text: I require a slightly older version of PHP for my server because I need to be able to exploit a CVE (CVE-2006-7243) that was patched in the newer versions. **NOTE:** This is a legitimate use case where we're setting up a web based penetration testing system for Computer Science students at my University. PHP 5.3.3-24 would be perfect. The current one that `yum` tries to install is 5.3.3-27. I've tried sourcing old RPM's and found a lot here: http://www.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/ but none of them being the version I would like. How should I tackle installing this version of PHP?


title: Mutt - sent and drafts in the INBOX

text: I'm using offlineimap + mutt + msmtp to handle my email. I would like to have an unorthodox configuration, where all of my current mail (received, sent, and drafts) reside in the INBOX (or at least a single primary folder) and all the rest to be in the archive. This way I can push emails that I no longer need anymore to the archive and have all my current tasks and things that I need to keep track of easily accessible. Any thoughts on how to do this? Would mutt be the place to do this sort of sorting, or would I want to set up some sort of post-sync hook in offlineimap to take care of shuffling things around?


title: Execute code on shutdown on Fedora 19

text: I need to catch any OS shut down and execute some actions before letting the OS be shutted down. I'm using Fedora 19 and C++. I'm able to catch a shutdown signal given by the console with the following C++ code :               myAct.sa_handler = myStructure::mySignalHandler;     sigaction(mySignal, &act, NULL);      The `mySignal` signal can be activated via `/etc/init.d` and a custom code executed before a shutdown is made. On Fedora 12 Kernel 2.6, this solutions works perfectly. The solution works on Fedora 19 Kernel 3.9.5 if I try to shut down the computer using the graphic interface. However, I can't manage to execute my code when a command is used in a terminal to reboot or shut down the computer on Fedora 19 kernel 3.9.5 The solution doesn't work anymore since it dropped the usual `init.d` script system. Putting my script on the `/usr/lib/systemsd` location doesn't work, the script is executed, but the other scripts are also executed. Thus, the systems shuts down not treating my commands. How may I solve that problem?


title: Check that only root can edit a script before executing it

text: I have a script that needs to run as root. It also has a configuration file which is read using source:               source conf.sh      I would like to check that normal user can't edit `conf.sh` and therefore get root access. I can check who's the file owner and what permissions group and others have:               if [[ "$(stat -c "%a" conf.sh | egrep ".2.|.3.|.6.|.7.|..2|..3|..6|..7")" != "" ]] || [[ "$(stat -c "%u" conf.sh)" != "0" ]]; then         #don't execute the file"     fi      Am I missing anything here? Are there any best practices?


title: How do I make multiple directories at once in a directory?

text: I know with mkdir I can do `mkdir A B C D E F` to create each directory. How do I create directories A-Z or 1-100 with out typing in each letter or number?


title: Can't make links after make install successful

text: After install a package successfully, the tutorial says I have to make links if I want create links in /usr/local/bin. But:               ooker@ooker-Aspire-4741:~/gromacs-4.6.5/build$ sudo make links     make: *** No rule to make target `links'.  Stop.      I have to use `source /usr/local/gromacs/bin/GMXRC` everytime to launch it, but it only available in the current shell. If I want to run it in another shell, I have to do again. Otherwise it will says the package is not installed. This is the tutorial: http://www.gromacs.org/Documentation/Installation_Instructions_4.5#Final_Installation What should I do?


title: How can I replace ^I into tab spaces in vim editor for .java file?

text: When I open my .java file in vim, I could see a couple of lines prefixed with one / more `^I` characters. It looks like tabs in Eclipse that has got converted into `^I`. I would like to replace a single `^I` into spaces with 4 characters. E.g `^I^I^I^IList<History> rulePackagesHistory = result.getHistory();` How can do that in vim editor?


title: Set which grub loader to use after dual booting two linux OSes

text: I installed a second Linux distro recently which replaced the old grub that was already in place with its own fresh installation. I would like keep using the grub loader from the first OS, Ubuntu.


title: Resync NumLock light with NumLock status

text: I plugged a second keyboard into my computer to test something, and now my NumLock light is out of sync with the lock status (the light is off when NumLock is on, and vice-versa). How can I get the two back in sync? I'm running Gentoo Linux, if it matters.


title: Reorder tmux windows

text: How can I efficiently reorder windows in tmux? For example, having this set of windows:               0:zsh  1:elinks  2:mutt  3:irssi  4:emacs  5:rss  6:htop      What would I have to do to move `rss` to between `elinks` and `mutt`, ending up with:               0:zsh  1:elinks  2:rss  3:mutt  4:irssi  5:emacs  6:htop      I know how to use `move-window` to move a window to a yet-unused index, and I could use a series of them to achieve this—but, obviously, this is very tedious.


title: Mode_switch + Shift not the same as Shift + Mode_Switch?

text: I've this in my `~/.Xmodmap`:               keycode  47 = Mode_switch NoSymbol Mode_switch     keycode  25 = w W backslash bar      `Shift`+`Mode_switch`+`W` produces bar, which is what's intended. However `Mode_switch`+`Shift`+`W` produces W. Why is this? As I was writing this question, I've made this replacement:               keycode  47 = Mode_switch Mode_switch Mode_switch      and now the problem disappeared. However I've seen `Mode_switch NoSymbol Mode_switch` used many times. Can someone explain why the change fixes the problem? Any pitfalls to this method?


title: linux x.org alternative

text: We have so many options for window managers, shells, desktop environments, distros, and kernel architectures under Linux, but why after (maybe) 20 years do we only have X.org server (including its predecessor) as the bottom layer of GUI? I know about XFree86, and Y, but most of them are stuck. Is it so hard to create a new (i.e modern) one? Or is there any other reason we are stuck on X.org?


title: SDK for Developer

text: Is there any SDK for developers under Linux? I mean more than man pages, it would be more like MSDN Library or Windows SDK under windows, where all documentation about programming and developer guide is documented and structured in one place.


title: Will symlinks be maintained if the target's path remains the same but everything is transferred to a new disk?

text: (I think the answer is yes, but I'd like to be certain before I actually do it!) What I'm trying to do: install a new sd card in my "rooted" Android phone that uses A2SD. The fact that it's an Android system is irrelevant to the question I'm asking, though. If you don't know what A2SD is, there's a good (but long) explanation here. Essentially, and for the purposes of my question, symbolic links are being created from the system to an ext2/3/4 partition on the sd card to conserve internal disk space. Normally, one would go about switching SD cards by doing a nandroid+ext backup, which is an image of the phone's internal storage + the ext partition. However, for reasons I've yet to determine (I'm awaiting a good answer on another forum), I can only create the basic nandroid backup (i.e., I can't image the ext partition). Based on my Googling, I'm not confident that I'll be able to image this partition before I switch the SD cards. Therefore, I'm looking at a workaround. I have copied the entire contents of my ext partition to my computer. I will be partitioning the new card with gparted. When I move the contents to the new card, the file structure will be exactly the same. In other words, the paths to the target files/directories will be the same as before. BUT the physical location/address/whatever of each file will have changed. From what I understand of symbolic links, because it stores the path and not an address, and because the path won't be altered, all the links should remain intact. Is this correct?


title: Bash completion for `unset` command

text: How can I setup bash completion for the `unset` command, like when you use `echo $XXX`, you can get a completion for `XXX`?


title: change colour depth

text: How do I change the colour depth? It says online to edit the `xorg.conf` file, but I don't have that. I am running Debian XFCE on a Powerbook G4


title: display login window as list of users

text: How do you display the login window as a list of users instead of having to type the username? I have Debian XFCE on a Powerbook G4. ![screenshot](http://i.stack.imgur.com/KDXnn.png)


title: Why does find:s -or fail when I add a -print0 at the end?

text: I am writing a little script the modifies some movies in a directory tree, and I would like to parse that tree with a bash for loop or similar. So I started to find the files with               find -iname *.mov -or -iname *.mkv -or -iname *.avi      and he shows me some files of each kind just as expected. But then I try to loop over the result with this (since there is whitespace in some of the dir names).               find -iname *.mov -or -iname *.mkv -or -iname *.avi -print0 | while read -d $'\0' line     do         echo $line     done      But now he only returns the avi files! So it seems like when I add the -print0 he ignores my -or and the other -iname. What is going on here, what am I missing? Do I need to send the result from find into a tmpfile before looping over the result?


title: Solaris Command to Stop Listening on a Port

text: I have a legacy application (that I do not control) that occasionally crashes without properly closing the ports it is listening on. Is there a Solaris command to stop listening on a given port, short of rebooting the box?


title: How to temporarily switch from ssh to my local shell?

text: I'm using cygwin. and use it with ssh to login into a ubuntu server. sometimes, I want to switch back to my cygwin and then quickly switch to ubuntu shell. How to do this?


title: AltGr key released when rappidlby pressing other keys

text: I have a Norwegian Lenovo USB keyboard. When I hold AltGr and press v and b rapidly, it produces `“bvbv` instead of `“”“”“”`. I get the latter, expected, result when pressing v and b slowly. Never letting go of AltGr. `xev` shows that the AltGr key is released when pressing b for the first time when doing this rapidly. (Output.) Any idea what could be causing this? Updated Debian Jessie with GNOME desktop.


title: Linking failure [ld cannot find library]

text: I am trying to configure Linux kernel [Angstrom distribution] via `make menuconfig`, but I get these errors.               make: Warning: File `/usr/src/linux-2.6.32.61/arch/arm/Makefile' has modification time 11511 s in the future     make[1]: Warning: File `scripts/Makefile.host' has modification time 11393 s in the future       HOSTCC  scripts/basic/fixdep     /usr/lib/gcc/arm-angstrom-linux-gnueabi/4.3.3/../../../../arm-angstrom-linux-gnueabi/bin/ld: cannot find -lgcc_s     collect2: ld returned 1 exit status     make[1]: *** [scripts/basic/fixdep] Error 1     make: *** [scripts_basic] Error 2      The same occurs when I tried to compile Hello_world.c program.               /usr/lib/gcc/arm-angstrom-linux-gnueabi/4.3.3/../../../../arm-angstrom-linux-gnueabi/bin/ld: cannot find -lgcc_s     collect2: ld returned 1 exit status      I noticed that libgcc_s.so is missing. How can i fix this? Any help would really be appreciated.


title: VPN piggybacked on two mobile phone wifi hotspots

text: I cannot get 1Gbps at home, so instead of wasting money on slow landline internet with extra traffic limits and ridiculous overage fees, only to wait in the console until my stuff downloads/uploads, I'd like to utilise the unlimited internet from the two mobile phones I have to establish a VPN to a good network elsewhere.   * The problem is that tower reception in my area is bad, so, I want to mix Portable WiFi Hotspots from two different phones on separate physical networks and operators.   * I'd also want to ensure that I get internet even if one of the two hotspots gets offline. This comes from the general potential reliability issues of the mobile networks, but also from the perspective that one of the phones will be my primary phone to take away with me, and it'll only have its hotspot enabled when necessary, whereas the other hotspot will be always-on.   * One phone is expected to have LTE, the other -- UMTS/HSPA; both might occasionally go into EDGE, due to poor coverage. This probably means that latency will be all over the place, which would probably be true even without EDGE in the equation.   * Both phones have unlimited traffic, but after a certain pre-defined usage of a certain number of GB, they experience throttling.   * Obviously I'm looking into having two regular UNIX boxes on both sides of the VPN to do all the mixing. I mostly do OpenBSD, so, a solution that's capable of running on OpenBSD is highly preferred, but I'd be happy to learn about the state of the art for these kinds of things in Linux, too, as well as general advice of what's the best way to create something like this. How do I solve this problem? My main concerns are to ensure reliability, failover, full use of available bandwidth, as-low-as-possible latency for SSH (and possibly SIP, too), all whilst mixing the two underlying connections. This last part reminds me of SCTP, but I'm not exactly sure if it is to apply here.


title: Copy & paste in a terminal without SHIFT

text: In all terminal emulators that I know of, `Ctrl` is used for sending control codes such as `Ctrl`+`C` and `Ctrl`+`Z`. On most systems this conflicts with common keyboard shortcuts. Thus on all those systems except OS X, `Ctrl``Shift` is used for copy-pasting and more, which I find really annoying. If I got a penny for every time I opened the Firefox inspector accidentally, I would be rich. I tried mimicking Apples behavior of using `Cmd` for keyboard shortcuts, but this is practically impossible to achieve across the whole desktop. The other alternative is to use another combination for sending control codes. Is there any terminal emulator that supports this? I found Sakura allows setting the modifier for key combos, but not for control characters. Another desirable feature is non-messed-up line wrapping, but that is of secondary importance.


title: When patching what's the difference between arguments -p0 and -p1?

text: What's the difference between `patch -p0` and `patch -p1`? Is there any difference at all?


title: Grub installed by Scientific Linux does not boot Windows

text: I installed SL6.1 on a laptop that has a Vista install as well. After I installed SL6.1 I figured that I would have a boot option but no. How can I reconfigure GRUB to recognize Windows too?


title: How to add methods to rush (Ruby shell)?

text: I am starting to learn the basics of rush (ruby shell), and I know it is possible to invoke methods such as `home['foobar.c'].vi`. However, say I wanted to edit it with _GNU Emacs_ , **how do I add a new method** that does that for me, so I can only invoke `home['foobar.c'].emacs`? P.S. There is a configuration file `env.rb`, in which you can put Ruby code.


title: Wait for process to finish before going to the next line in shell script

text: I have a script I made to create a backup. I need to make sure the backup is ready before it runs the `/home/ftp.sh` command. How can I do so? I use CentOS 5.6               #!/bin/bash     tar -Pcf /home/temp_backup.tar /home/myfiles/     wait %%     /home/ftp.sh


title: Distributing a script: Should I use /bin/gawk or /usr/bin/gawk for shebang?

text: Is gawk in /bin or /usr/bin usually? I would go with `#!/usr/bin/env gawk` but then I can't use arguments. Right now I'm using `#!/bin/gawk -f`. The script is very long and contains a lot of single quotes and works with stdin. The GNU Awk manual has section 1.1.4 Executable awk Programs where it uses #!/bin/awk in its example but goes on to say: > Note that on many systems `awk` may be found in `/usr/bin` instead of in > `/bin`. Caveat Emptor. What do most people do? I've read sed is supposedly standardized in /bin whereas perl is supposedly standardized in /usr/bin (same page as sed link but they won't let me make a third link for this post). What about awk/gawk? Does anyone know which is more common or popular?


title: Logrotate: "log does not need rotating" why?

text: I have the following new logrotate configuration:               /var/log/nexus/nexus.log {         rotate 7         missingok         compress         delaycompress         copytruncate         daily     }      When I run `logrotate -d nexus`, I get the following:               reading config file nexus     reading config info for /var/log/nexus/nexus.log          Handling 1 logs          rotating pattern: /var/log/nexus/nexus.log  after 1 days (7 rotations)     empty log files are rotated, old logs are removed     considering log /var/log/nexus/nexus.log       log does not need rotating      My /var/log/nexus/ folder contains the following:               nexus.log     oldlogs.tar.gz      Why isn't LogRotate rotating the nexus.log file? What I was expecting was that the nexus.log file would have been truncated and a new file, something like nexus.log-201106241000, would have been created.


title: Capture symbolic link into Unix/Linux variables

text: Say I have a folder with a series of symbolic links:               ussdv103:en195d; default$  pwd     /oradba/app/oracle/admin/database1     ussdv103:en195d; default$  ls -ltr     exp -> /oradba/app/oracle/acfsmounts/global/STREAM2a/database1/exp     dpdump -> /oradba/app/oracle/acfsmounts/global/STREAM2a/database1/dpdump     backup -> /oradba/app/oracle/acfsmounts/global/STREAM2a/database1/backup      Then I issue the following commmands to link it to a different STREAM directory:               unlink $ORACLE_BASE/admin/database1/backup     unlink $ORACLE_BASE/admin/database1/dpdump     unlink $ORACLE_BASE/admin/database1/exp     mkdir -p /oradba/app/oracle/acfsmounts/global/STREAM1a/database1/backup     mkdir -p /oradba/app/oracle/acfsmounts/global/STREAM1a/database1/dpdump     mkdir -p /oradba/app/oracle/acfsmounts/global/STREAM1a/database1/exp     ln -s $ORACLE_BASE/acfsmounts/global/STREAM1a/database1/backup $ORACLE_BASE/admin/database1/backup     ln -s $ORACLE_BASE/acfsmounts/global/STREAM1a/database1/dpdump $ORACLE_BASE/admin/database1/dpdump     ln -s $ORACLE_BASE/acfsmounts/global/STREAM1a/database1/exp    $ORACLE_BASE/admin/database1/exp      Then I would use the following command to copy data from the old STREAM directory to the new STREAM directory:               cp -p -r /oradba/app/oracle/acfsmounts/global/STREAM##/database1/ /oradba/app/oracle/acfsmounts/global/STREAM1a/.      But I have to replace ## so that it reflects the location of the old STREAM directory, so the command will look like this:               cp -p -r /oradba/app/oracle/acfsmounts/global/STREAM2a/database1/ /oradba/app/oracle/acfsmounts/global/STREAM1a/.      How can I capture information about the old STREAM directory **before** unlinking it so that my copy command **automatically** replaces **##** with the correct location of the old STREAM directory? Is there a Unix/Linux variable I can assign the old symbolic link to and then reference that in the copy command?


title: Utility to TRIM unallocated space on drive

text: I have a drive (SD card) with a few ext4 partitions but also some unallocated space. The `fstrim` utility can only work within a filesystem. Before I reinvent the wheel and write one, is there another utility that can TRIM the unallocated space (or that can TRIM an explicitly specified range)? I can verify that the majority of the unallocated space on the device is _not_ currently known to be free by the controller, as I've observed that, on this particular card, reads to trimmed space return 0's, but a scan of the device shows plenty of garbage data left over. Edit: I am having an issue using `hdparm`. The example below discards the first sector, but I am seeing the same results regardless of the range I specify. `fstrim` has no issues on the device:               root@ubuntu:~# hdparm --please-destroy-my-drive --trim-sector-ranges 0:1 --verbose /dev/mmcblk0           /dev/mmcblk0:     trimming 1 sectors from 1 ranges     outgoing cdb:  85 0d 06 00 01 00 01 00 00 00 00 00 00 40 06 00     outgoing_data:       00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00          ioctl(fd,SG_IO): Invalid argument     FAILED: Invalid argument      I am investigating further but does anybody have any insight?


title: grub error : "File not found" for separate /boot/efi partition

text: I've installed CentOS 6.4 on UEFI enabled machine, created `/boot/efi` partitions. But my grub is not automatically starting, if I start the PC, I start in Windows 8.   I can only start CentOS by entering the BIOS boot options and select CentOS. I tried to modify the `grub.conf` file by modifying this               title XXXXX        root (hd0,8)      to               title XXXXXX        root (hd0,3)      Where `(hd0,8)` is my root partition, `(hd0,3)` is my /boot/efi partition. But now the problem still occurs, I have to open Cent OS from the Bios boot options as well as another error, when I open CentOS I get `file not found` error. How can I fix all this mess?


title: User space to kernel space transition

text: Both physically (hardware, rings) and logically (software), what is user space to kernel space transition? And vice versa. Or more generally what goes on when there is a "space" (or ring) transition taking place? And what makes it costly (one of the main issue of Minix)? This question follows for comments under this answer.


title: output of top gets truncated to 80 columns when run by cron

text: I have got the following logging script:               #!/bin/bash     top -b -c -n 1 >> /var/log/toplog/top.log      And the following record in my crontab:               */1 * * * *     /home/clime/scripts/toplog.sh      The problem is that lines in top.log are being cut to 80 chars, e.g.:                1512 root      20   0 80756 1436  572 S  0.0  0.1   0:05.92 /usr/libexec/postfi      This does not happen if I run the command directly from console. I have tried to use COLUMNS variable:               */1 * * * *     COLUMNS=999 /home/clime/scripts/toplog.sh      But that leads to every line being long exactly 999 characters - unused space is padded with spaces, which is not what I want. How to fix this strange issue? My system is centos 6.3.


title: my linux can't see atrix 4g's second sd card device

text: My device is a Motorola Atrix 4G (ME860). It has an 11G internal SD card, and I inserted a new 16G SD card into the SD Card slot. When I connect the phone to my computer with a USB cable, it shows two removable disks on my computer system, on Windows. But on Linux (my Gentoo box), it shows only one device (`/dev/sdc` \- the internal 11G SD card). I can't see the other 16G SD card device. How can I mount the external SD card on Linux? `dmesg` info:               <7>[ 1136.355862] hub 1-1:1.0: state 7 ports 6 chg 0000 evt 0002     <7>[ 1136.356126] hub 1-1:1.0: port 1, status 0101, change 0001, 12 Mb/s     <7>[ 1136.459809] hub 1-1:1.0: debounce: port 1: total 100ms stable 100ms status 0x101     <6>[ 1136.532634] usb 1-1.1: new high speed USB device number 12 using ehci_hcd     <7>[ 1136.625519] usb 1-1.1: default language 0x0409     <7>[ 1136.634493] usb 1-1.1: adding 1-1.1:1.0 (config #1, interface 0)     <7>[ 1136.636506] usb-storage 1-1.1:1.0: usb_probe_interface     <7>[ 1136.636527] usb-storage 1-1.1:1.0: usb_probe_interface - got id     <6>[ 1136.636661] scsi13 : usb-storage 1-1.1:1.0     <7>[ 1136.636788] usb 1-1.1: adding 1-1.1:1.1 (config #1, interface 1)     <5>[ 1137.642196] sd 13:0:0:0: [sdc] Attached SCSI removable disk     <3>[ 1140.358324] sd 13:0:0:0: [sdc] No Caching mode page present     <3>[ 1140.358333] sd 13:0:0:0: [sdc] Assuming drive cache: write through     <3>[ 1140.363312] sd 13:0:0:0: [sdc] No Caching mode page present     <3>[ 1140.363321] sd 13:0:0:0: [sdc] Assuming drive cache: write through     <6>[ 1140.367887]  sdc:


title: Share an external IP with several virtual hosts

text: For a centos server hosting a few LAMP virtual machines (using VirtualBox), I have a single external IP. I would like to be able to use this single host external IP to address the virtual machines. Like forwarding ports to specific machines from the outside:               2.2.2.2 > external IP [WAN]     10.0.0.1 > host IP (tiger) [LAN]     10.0.0.2 > virtual client #1 (zebra)     10.0.0.3 > virtual client #1 (mouse)      so external IP is forward via router to host IP (tiger) it will then look at port and send it to zebra or mouse. Both virtual clients might (should) not be using the same ports for Apache etc. Preferably the routing solution will be done at the host as I have no access to the router itself (but can ask for specific settings if the admin can pull it off) Hope I'm clear.


title: Linux VPS host with graphical interface using RDP (not VNC)

text: Our CEO's latest brain-waive is "More people will use our software product if it were all accessible from the web". He wants to dump a lot of (but not enough) resources in to taking a complex Linux-based GUI product we already have and re-writing it as a web application. I hope to head off this this disaster by demoing how we could just expose our existing software to the web using something like Guacamole \+ X11rdp. Problem is I really don't have time to set such a demo up. So I was wondering anyone could recommend me an existing VPS service which offers a purely JavaScript + HTML5 GUI interface (no Java Applets/Flash etc.). **Most importantly this must not use VNC as the video transport protocol as its performance sucks**. Anything that has an existing RDP based set-up would be great. Even an X11 protocol implemented in pure JavaScript would be better for our application. As I say this is just for a demo so it doesn't have to be beautiful/scalable. I assume any such existing feature will be aimed at system administrators and might have a bunch of other irrelevant admin tools; this doesn't matter. I just need to show that without installing any software on say an OS X or Windows machine it is technically possible to provide a usable experience with our Linux-based GUI product from a web-browser.


title: How to pass wildcards in command line

text: So this works:               foo -a -b -c "path/file.ext"      And this too if I want to pass all files from directory:               foo -a -b -c path/*      But if I add the quotes               foo -a -b -c "path/*"      It doesn't work anymore: it says "no such file..." And I think I need to add the quotes in order to escape arguments (I'm using PHP and `escapeshellarg`).


title: Read what is written to /dev/tty*

text: How can I read what is written to `/dev/tty*`(`*` = `0` \- number of _tty_ )? I tried `sudo tail -f /dev/tty1` on one terminal(`X`) and then `sudo cp .emacs /dev/tty1` from another. `X` didn't show the the content of `.emacs`but pressing `Ctrl-Alt-F1` I could see the content of the `.emacs`. Background. Is this question of the same category as this?


title: Mobile Broadband disconnects as soon as connected - Crunchbang

text: For months now my mobile broadband (GSM) stick has worked with Crunchbang. Yesterday it stopped. When I plug it in, it appears in the network manager and I can connect to it, but as soon as it is connected it disconnects. I switched to Liquorix kernel about 1.5 weeks ago and the stick worked with it as well, until now. Switching back to the original kernel does not fix it. Computer: Lenovo U410 GSM stick: Sierra Wireless USB 308 Has anyone run into this before and knows how to fix it? EDIT: Added dmesg output               usb 1-1: new high-speed USB device number 5 using xhci_hcd     usb 1-1: config 1 has an invalid interface number: 9 but max is 0     usb 1-1: config 1 has no interface number 0     usb 1-1: New USB device found, idVendor=1199, idProduct=0fff     usb 1-1: New USB device strings: Mfr=3, Product=2, SerialNumber=4     usb 1-1: Product: USB MMC Storage     usb 1-1: Manufacturer: Sierra Wireless, Incorporated     usb 1-1: SerialNumber: SWOC22905731     usb-storage 1-1:1.9: USB Mass Storage device detected     usb-storage: probe of 1-1:1.9 failed with error -5     usbcore: registered new interface driver usb-storage     usb 1-1: USB disconnect, device number 5     usb 1-1: new high-speed USB device number 6 using xhci_hcd     usb 1-1: config 1 has an invalid interface number: 7 but max is 4     usb 1-1: config 1 has no interface number 2     usb 1-1: New USB device found, idVendor=1199, idProduct=68a3     usb 1-1: New USB device strings: Mfr=3, Product=2, SerialNumber=4     usb 1-1: Product: USB 308     usb 1-1: Manufacturer: Sierra Wireless, Incorporated     usb 1-1: SerialNumber: 355385035042361     sierra 1-1:1.0: Sierra USB modem converter detected     usb 1-1: Sierra USB modem converter now attached to ttyUSB0     sierra 1-1:1.1: Sierra USB modem converter detected     usb 1-1: Sierra USB modem converter now attached to ttyUSB1     sierra 1-1:1.3: Sierra USB modem converter detected     usb 1-1: Sierra USB modem converter now attached to ttyUSB2     sierra 1-1:1.4: Sierra USB modem converter detected     usb 1-1: Sierra USB modem converter now attached to ttyUSB3     usb 1-1: Incompatible driver and firmware versions     usb 1-1: USB disconnect, device number 6     sierra ttyUSB2: resubmit read urb failed.(-19)     sierra ttyUSB2: resubmit read urb failed.(-19)     sierra ttyUSB2: resubmit read urb failed.(-19)     sierra ttyUSB2: resubmit read urb failed.(-19)     sierra ttyUSB2: resubmit read urb failed.(-19)     sierra ttyUSB2: resubmit read urb failed.(-19)     sierra ttyUSB2: resubmit read urb failed.(-19)     sierra ttyUSB2: resubmit read urb failed.(-19)     sierra ttyUSB0: Sierra USB modem converter now disconnected from ttyUSB0     sierra 1-1:1.0: device disconnected     sierra ttyUSB1: Sierra USB modem converter now disconnected from ttyUSB1     sierra 1-1:1.1: device disconnected     sierra ttyUSB2: Sierra USB modem converter now disconnected from ttyUSB2     sierra 1-1:1.3: device disconnected     sierra ttyUSB3: Sierra USB modem converter now disconnected from ttyUSB3     sierra 1-1:1.4: device disconnected      EDIT: Trying to set usb_modeswitch               sudo usb_modeswitch -v 119 -p 68a3 -S      Output from that:               Looking for default devices ...         No devices in default mode found. Nothing to do. Bye.      EDIT: Fixed typo in the usb_modeswitch command               sudo usb_modeswitch -v 1199 -p 68a3 -S      The command ran properly that time but to no effect. SOLUTION: After testing the device on multiple computers and multiple OS's it would seem that there are hardware problems. I can't add this as an answer yet.


title: How to remove emacs 23 related packages and leave installed emacs 24

text: I installed `emacs 24` in `Linux Mint 16`, and want to uninstall `emacs 23`. I thought `sudo apt-get remove emacs23` is enough, but it was not. This is my packages list relating `emacs`.               $ sudo dpkg --get-selections | grep emacs     emacs                       install     emacs23                     deinstall     emacs23-bin-common              install     emacs23-common                  install     emacs23-common-non-dfsg             install     emacs23-lucid                   install     emacs24                     install     emacs24-bin-common              install     emacs24-common                  install     emacs24-common-non-dfsg             install     emacs24-el                  install     emacsen-common                  install      To uninstall `emacs 23`, I tried `$ sudo apt-get remove emacs23*`. But it will also remove `emacs 24` also.               The following packages will be REMOVED:       emacs emacs23-bin-common emacs23-common emacs23-common-non-dfsg emacs23-lucid emacs24 emacs24-bin-common emacs24-common emacs24-common-non-dfsg emacs24-el      Can't use `*` as a `apt-get` argument? How should I remove `emacs 23` correctly?


title: Pointing domain name to server

text: I am still a newbie when it comes to Linux, and I recently bought 2 domains from NameCheap. Running a LEMP stack on Debian 7 and want to know how I can create name servers like `ns1.example.com` and `ns2.example.com` on my server, because that's what I need to set in my domain settings for them to point to my server. I am using Google's public DNS name resolver `8.8.8.8` and `8.8.4.4` (in my `resolv.conf` file), if that's of any help. I have found some lengthy tutorials on YT and elsewhere, but to me they weren't so clear because in every one they are setting up some kind of made up local domain (with Bind9). And haven't found anything that handles setting up name servers and making registered domains point to the server. If anybody could explain to me how I could achieve this (so that `example1.com` points to let's say `[ip]/site_dir1`), or tell me what I need to be searching for to get this done, it would be greatly appreciated.


title: Network issue - only one machine can't access webpage on another machine

text: I'm trying to figure out why my MacBook is unable to reach the web page served by my Raspberry Pi while other computers on my local network (or on external networks) have no problems seeing the web page. So I set up tcpdump on both the Mac and Pi and captured an attempt from both sides. My first question is the following: (in two parts) A) If an outgoing packet shows up in tcpdump, does that _guarantee_ that the packet was actually transmitted? (i.e. can there be anything downstream of the tap point that could prevent the packet from being sent?) B) If an expected incoming packet doesn't show up in tcpdump, does that _guarantee_ that the packet was never received? (i.e. can there be anything upstream of the tap point that could discard a received packet before tcpdump sees it?) These questions come from my observations of the tcpdump logs:   1. The Mac sends a short packet to the Pi   2. The Pi receives that packet and sends a short packet back to the Mac   3. The Mac receives that packet and sends two packets to the Pi; the 2nd packet has the browser info etc.   4. Neither of those packets is ever received by the Pi. If both my assumptions A & B above are correct, then this means my router is for some reason treating packets for the Mac differently from, e.g., packets for my WinXP machine. (I'm assuming it must be at my router because, outside of there there's no way of knowing what machine on the internal network the packet belongs to and therefore no way to treat different machines differently.) So if all of my assumptions are correct, any ideas on what's going wrong, or what I should look at next?


title: In Fedora, how do I turn off the automatic dictionary suggestions?

text: I just installed Fedora 19 in VirtualBox using an image from virtualboxes.org. It suggests words from a dictionary wherever I type. It's slow and it won't let me type what I want, since it automatically inserts the topmost dictionary suggestion. How do I turn it off? ![Terminal](http://i.stack.imgur.com/4hIxQ.png)


title: clonzilla + what the password for debian linux

text: Please advice what the password in debian Linux (debian Linux in clonezilla software - disaster recovery tool) Example I use the clonzilla (backup & restore tool) in order to clone Linux systems I boot the clonezilla on machine1 and escape to CMD ( from clonzilla ) in order to get debian Linux Machine1 - Debian Linux network:                192.168.20.100/24      Now I want to copy to my debian Linux some files from other machine - machine2 ( Linux red-hat 6.X) Machine2 network:               192.168.20.10/24      So I do the following on my machine2 in order to copy script.pl to my debian Linux ( machine1 )                 scp –rp  /tmp/script.pl  192.168.200.100:/tmp       root@192.168.20.100's password:      please advice what the password for debian Linux ?


title: What is the difference between X11R7.7 and X Server 1.14.4?

text: When I issue the command X -version in terminal window, I get the output: X.Org X Server 1.14.4 On the X.org website, it says that latest release is X11R6.7. I am confused why there are two version of the same thing. Please help!


title: User Access Permissions

text: I have recently taken ownership of a (FreeBSD) FileServer and need to identify which shares users have access to on an individual basis. Is there an easy way to achieve this with a single command?


title: php indent in web-mode with Emacs

text: I'm using Emacs web-mode and write a setting for it like this.               (require 'web-mode)     (add-to-list 'auto-mode-alist '("\\.php\\'" . web-mode))          (defun web-mode-hook ()       "Hooks for Web mode."       (setq web-mode-markup-indent-offset 2) ;; html indent       (setq web-mode-css-indent-offset 2)    ;; css indent       (setq web-mode-code-indent-offset 2))     (add-hook 'web-mode-hook 'web-mode-hook)      But indent of php code remain 8. (HTML indent is 2 as I expected) Why does not change the offset indention of php?


title: Wget command that returns [a list of] all webpages on a webserver

text: Let's say we have a website `www.example.com` with the following pages:               www.example.com/page1     www.example.com/unknown     www.example.com/unknown      Is there a Wget command that would produce the following output:               page1     page2     page3      How would this command change if the website structure was:               www.example.com/xxxx/page1     www.example.com/xxxx/page2     www.example.com/xxxx/page3      Essentially I have a server ip address and would like to be able to list all the pages held on the server, to see if there are any I am interested in to download. For instance I can do `wget -r www.example.com/page1` and I want to know if there are any other directories (`page2`, `page3`, etc) that I might be interested in. I have researched the `--spider` option and others, but with no joy.


title: tree command for multiple includes and excludes

text: Could you please give me an example of using the tree command to filter out result as follows:   * to ignore directories (say `bin`, `unitTest`)   * only listing certain files having extensions (say `.cpp`, `.c`, `.hpp`, `.h`)    * providing full path-names of only the resultant files matching the criteria.


title: Files in RPM packages

text: There is something strange with RPM packages. The listed contents, enumerated by `rpm -ql` differ from the actually presented files. For instance, I downloaded a `openldap-servers-2.4.26-8.fc16.i686.rpm` and ran the one-liner:               rpmfile=openldap-servers-2.4.26-8.fc16.i686.rpm; diff <(rpm2cpio $rpmfile | cpio -t | sed -e 's!^\.!!g') <(rpm -ql -p $rpmfile)      It compares the contents of the `rpm` unpacked by `rpm2cpio` with output from `rpm -ql` And got:               9122 blocks     20a21,22     > /etc/openldap/slapd.conf     > /etc/openldap/slapd.conf.bak     21a24     > /etc/pki/tls/certs/slapd.pem      `rpm -ql` states that there are 3 files in the package which actually are absent.   Is there an explanation for that?


title: Make copies of a single directory to multiple directories with different names

text: I'm trying to replicate a single directory (with sub-directories) to a bunch of new directories based on a list. For example I can: `mkdir Fred Barney Thelma Louise Foo Bar` How would I copy a premade directory (with some empty sub-directories) to the same set of names? For example: `cp -r master_folder/ Fred Barney Thelma Louise Foo Bar` Any suggestions much appreciated!


title: Merge floppy images in Raspbian

text: On my Raspberry pi I am trying to install windows 95 in dosbox. I know that it probably won't work, but I want to try. I cannot download the large CD image so I downloaded a set of 13 floppy images. The setup wizard, instead of asking me for the location of the drive that the floppy is in, prompts me to insert the floppy in the same drive, which AFAIK you can't do in Dosbox. TL;DR I would like to know how to merge 13 floppy images into one large image that the setup wizard can read. I am running Rasbpian


title: Quoting and escaping

text: I have a shell script, the arguments of which are collected in quote as a single argument and passed to a perl script.               /usr/local/API/check_api.sh "-D x.x.x.x -C Test_Internal_Cluster -u user -p pass  -i 300 -l runtime -s list"      which result to               /usr/bin/perl /usr/local/check_api.pl -D x.x.x.x -C Test_Internal_Cluster -u user -p pass -i 300 -l runtime -s list      I want to give an argument like this:               "Test Internal Cluster"      to the perl script. When I am using               "Test\ Internal\ Cluster"      as the argument to the shell script its parsing as               Test Internal Cluster      to the perl script, but I want that to be in double quotes. If I am using this:               ""\"Test Internal Cluster\"      It converting to: `'"Test' Internal 'Cluster"'` This seems simple but not able to use proper quoting and escaping to achieve. The shell script is:               #!/bin/bash -xv          Perl=/usr/bin/perl     Api=/usr/local/API/check_api.pl          if [ $# -gt 0 ]; then       if [ -x $Api ]        then             output=$($Perl $Api $1)             exitstatus=$?             F1=$(echo $output | awk -F':' '{print $1}')             F2=$(echo $output | awk -F':' '{print $2}' | awk -F'|' '{print $1}')             F3=$(echo $output | awk -F':' '{print $2}' | awk -F'|' '{print $2}')             echo " $F1: $F3 | $F2"       else             echo "check_api.pl not found"      fi      exit $exitstatus     else         echo "Usage : $0 '-D <DC> -C <Cluster> -u <userbame> -p <password> -i <interval> -l <command>  -s <subcommand>'"     fi      Here you can see the whole argument passed to the shell script is collected to `$1` and passed to the `check_api` perl script. The issue is happening with cluster name with space (passed to -C). And the whole argument passed to the shell script should be in single/double quotes. I haven't quoted the variable $1 because the perlscript is not accepting the whole argument as a single as below which I found in debug mode - where the whole argument is quoted if $1 is quoted.               /usr/bin/perl /usr/local/check_api.pl '-D x.x.x.x -C Test_Internal_Cluster -u user -p pass  -i 300 -l runtime -s list'      and throws error as incorrect usage But without quoting the $1 the argument passed to perl script works like this and which gives me the result:               /usr/bin/perl /usr/local/check_api.pl -D x.x.x.x -C Test_Internal_Cluster -u user -p pass -i 300 -l runtime -s list      But I am failed with a cluster with space in its name. In case of a space in cluster name if I am running in the command line directly(not from shell script) it works fine without any issue:               /usr/bin/perl /usr/local/check_api.pl -D x.x.x.x -C "Test Internal Cluster" -u user -p pass -i 300 -l runtime -s list      which I wanted to achieve from shell script.


title: Keeping xterm terminal alive on crunchbang linux debian wheezy

text: I like to keep a number of terminals open at different locations on my development VM. For this I use `terminator` because I got a big screen and I can divide the terminals anyway I want. But after some time these terminals close one after another. I don't use ssh so any keepalive options would not work. Is there any place where I can configure the terminal so that it does not timeout or close? I am using `GNU bash, version 4.2.37` as shell and `terminator` on 'xterm`


title: Making an alias which maps arguments to the middle of the command

text: I want to alias `killapp X` to `pidof X | xargs kill` or `kill `pidof X``, but I can't think of a way to do this with just an alias on `killapp`. How could I do this so I don't have to do `killapp X` `?


title: Problem at boot-time: "Loading user-defined modules [FAIL]"

text: After I updated my Kernel to version 3.0, i always get this line when my Arch- Linux system is booting up:               Loading User-specified Modules    [BUSY]    [FAIL]      I have no idea what could cause this to happen. My `MODULES`-array in the `/etc/rc.conf`-file looks like this:               MODULES=(fuse wl !b43 !ssb !usblp vboxdrv vboxnetflt)      I checked the modules which are loaded (using `modprobe`) and they all load just fine. My idea was, that one of the Blacklisted modules in my `MODULES`-array got kicked out of the kernel or renamed and now the system can't find it (to block it). So i checked all available kernel-modules using:               ls -R /lib/modules/3.0-ARCH/kernel/ | grep <module-name>      I found all of the modules in the array except for the last two (from VirtualBox). However, trying to manually load them with `modprobe` works and `lsmod` shows that they are probably loaded after boot. Also, I checked the `/var/log/kernel.log`-logfile (nothing obvious here). So, I need ideas on what could probably cause this to happen or where I can find the corresponding logfile (since there is a `daemons.log`-file, but no `modules.log`-file).


title: android partition and kernel 3.14

text: I mount a cell phone to my debian i can browse android `SD card` and `internal memory`, So i the following output of mount command when i browse android `sd card`:               sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)     proc on /proc type proc (rw,relatime)     udev on /dev type devtmpfs (rw,relatime,size=10240k,nr_inodes=207517,mode=755)     devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)     tmpfs on /run type tmpfs (rw,nosuid,relatime,size=1226480k,mode=755)     /dev/disk/by-uuid/a14aae90-33de-4707-afce-9fdfbd6cd7d2 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)     securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)     tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)     tmpfs on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,mode=755)     cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd)     pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)     cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)     cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)     cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)     cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)     cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls)     cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)     cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)     systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=34,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)     debugfs on /sys/kernel/debug type debugfs (rw,relatime)     hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)     mqueue on /dev/mqueue type mqueue (rw,relatime)     fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)     tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)     tmpfs on /run/user type tmpfs (rw,nosuid,nodev,noexec,relatime,size=102400k,mode=755)     /dev/sda3 on /archives/ISOs type ext4 (rw,relatime,errors=remount-ro,data=ordered)     rpc_pipefs on /run/rpc_pipefs type rpc_pipefs (rw,relatime)     binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)     nfsd on /proc/fs/nfsd type nfsd (rw,relatime)     gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)      **NOTE:** sda3 is my partition on my laptop. _my question is_ where's mount point of android? **UPDATE:** I can browse with GUI, but can't find its `mount point`, i done the following commands:               root@debian:~# df -a > df.mounted   ##### When cell phone is connected      root@debian:~# df -a > df.unmounted   #### When cell phone is disconnected     diff -u df.mounted df.unmounted      But i didn't any difference between two files. My systesm:               root@debian:~# uname -a     Linux debian 3.14-2-686-pae #1 SMP Debian 3.14.15-2 (2014-08-09) i686 GNU/Linux     root@debian:~# cat /etc/issue     Debian GNU/Linux jessie/sid \n \l


title: gunzip a folder with many files

text: I have a folder with 36,348 files gz files. I want to unzip all of them. Running:               gunzip ./*      results in               -bash: /usr/bin/gunzip: Argument list too long      Whats the easiest way to get around this? Thanks!


title: How to implement a rotation scheme with rsync

text: I have an ever growing remote directory of files that I'd like to sort and filter before I `rsync` them, with the goal of always keeping only the latest N files in my destination directory (i.e. a rotation scheme, more or less). Since `rsync` doesn't seem to have options for this, I've been using the technique of "inserting an arbitrary remote command", described here: http://stackoverflow.com/q/950062/787842 with which I came up with this command, that I execute as a cron on the destination host:               rsync -vrzO --delete \         -e ssh <remote_host>:'$(cd <remote_dir> && ls -t $PWD/* | head -n 25)' \         <destination_dir>      This works well the first time (i.e. when the dest dir is empty): only the 25 freshest files get copied. But then when the window "slides forward" (i.e. when the arrival of a newer file should push an older one out, locally), the problem is that the `--delete` option doesn't work as I'd expect. My guess is that since the filtered out remote files still exist (i.e. they're just being temporarily hidden by the inserted `'$(..)'` command), then `rsync` simply cannot filter them out locally. Is my understanding correct, and is there a better way?


title: Running a bash script as a less privileged user with upstart

text: This is the script, `/home/jack/myscript.sh`, which I want to run:               export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.26/     /home/jack/myapp/apache-tomcat-6.0.32/bin/./catalina.sh run      The upstart file, `/etc/init/myapp.conf`, that I have written:                 description "Myapp Server"       start on runlevel [2345]       stop on runlevel [06]       respawn       respawn limit 10 5       exec `su jack -c /home/jack/myscript.sh`      So, if I want to run the script as user `jack`, would my above configuration work? Is there a better way of doing it?


title: Download recursively with wget

text: I have a problem with the following wget command: `wget -nd -r -l 10 http://web.archive.org/web/20110726051510/http://feedparser.org/docs/` It should download recursively all of the linked documents on the original web but it downloads only two files (`index.html` and `robots.txt`). How can I achieve recursive download of this web?


title: count number of lines, bash grep

text: Hello I am grepping results to file, and then doing cat to show its content on the screen, I want to know how many lines of results I have in my results file and the += it to some counter. What will be the best way? Any relevant flag to `grep` or `cat`?


title: Read a variable with "read" and preserve backslashes entered by the user

text: I'm using `read` to read a path from a user like so:               read -p "Input the file name: " FilePath      The user now enters this string:               \Supernova\projects\ui\nebula      What can I do to replace `\` with `/`. The result I want is:               /Supernova/projects/ui/nebula       By the way, the command:               echo $FilePath      outputs the result:               Supernovaprojectsuinebula      I have no idea what's wrong with it.


title: How can I get my PS1 prompt to show time, user, host, directories and git branch

text: I've seen others add all this information to their PS1 prompt. I like the approaches that colorize the elements and also do a carriage return at the end


title: Why do text editors set the mtime on save when no changes have been made?

text: When I am using sublime, and I've made no changes then the icon in the editor shows the file is unchanged. However, if I click to save it, it still sets the filesystem mtime time to now. Should a non-changing save really update the "modified" time? * * * Simple example: Create an empty file               $ touch example.file     $ stat -l example.file      -rw-r--r-- 1 matthew staff 0 Jul  9 14:45:41 2013 example.file      Touching it updates the mtime               $ touch example.file     $ stat -l example.file     -rw-r--r-- 1 matthew staff 0 Jul  9 14:45:57 2013 example.file      Editing it, but making no changes, also updates the mtime               $ vim example.file     # :wq # write and quit, making no changes     $ stat -l example.file     -rw-r--r-- 1 matthew staff 0 Jul  9 14:46:10 2013 example.file


title: How to check if a user can access a given file?

text: *nix user permissions are really simple, but things can get messy when you have to take in account all the parent directory access before reaching a given file. How can I check if the user has enough privileges? If not, then which directory is denying access? For example, suppose a user `joe`, and the file `/long/path/to/file.txt`. Even if `file.txt` was chmoded to 777, joe still has to be able to access `/long/`, and then `/long/path/` and then `/long/path/to/` before. What I need is a way to automatically check this. If `joe` does not have access, I would also like to know where he has been denied. Maybe he can access `/long/`, but not `/long/path/`.


title: Copying OS from one drive to another migrating from MBR to GPT - what to watch out for?

text: I'm looking at replacing my current MBR-partitioned 2 TB system drive with quite possibly a 3 TB drive. Copying the files should not pose a problem, but **are there any gotchas to watch out for** , particularly with regards to the boot loader, keeping in mind that MBR doesn't support anything more than 2 TB so I'll have to move to GPT? Or is it sufficient to partition the new drive, copying all files, update /etc/fstab in its new place, physically replace the old system drive with the new and then re-running grub-install? I'm using Linux with GRUB 2 (specifically 1.99-27+deb7u1 on Debian Wheezy) on a single-boot system (no second OS installed to take into consideration).


title: Converting an if-else statement into a switch statement

text: I'm having trouble turning this program from an if-else statement into a switch statement. Any help would be appreciated.               #!/bin/bash          for x in $@     do      array[$i]=$x      i=$((i+1))     done               # initial state     state=S0          for((i=0;i<${#array[@]};i++))     do          if [ $state == S0 ]        then        if [ ${array[$i]} == I0 ]        then          state=S1          output[$i]=O1        elif [ ${array[$i]} ==  I1 ]        then          state=S0          output[$i]=O0        fi          elif [ $state == S1 ]       then       if [ ${array[$i]} == I0 ]        then         state=S1         output[$i]=O1       elif [ ${array[$i]} == I1 ]        then         state=S0         output[$i]=O0       fi          fi          done     echo "final state="$state     echo "output="${output[@]}


title: How to migrate an IDE VM to a virtio VM?

text: On my KMS host I installed a windows server 2012 guest a few months ago. The VM runs raw using IDE (HDD). I would like to improve the performance by using virtio. I performed these actions:   * shutdown the VM    * edit the XML config file    * replace the disk tag by:              <disk type='file' device='disk'>       <driver name='qemu' type='raw' cache='none' io='native'/>       <source file='/var/lib/libvirt/images/myvm.img'/>       <target dev='vda' bus='virtio'/>     </disk>        * save the XML config file    * restart the VM with virt-manager    * I have a BSOD and the vm auto reboot    * Auto repair started, asking my keyboard language    * two options: repair or stop the PC    * I tried both but always BSOD after boot. What is missing in my procedure?


title: Why does printf ignore the IFS when printing out the result of my script?

text: This is a follow up to a question posted on SO. I've written a script called `except` which should print all filenames / directories except the ones given like so.               $ ls     a b c d     $ rm $(except b d)     $ ls     b d      The script I've written so far looks like this               shopt -s extglob     shopt -s nullglob          old_ifs=$IFS     IFS='|'     matches="!($*)"     IFS=' '          printf '%s' $matches     IFS=$old_ifs      This works more or less but the main problem is that printf doesn't seem to respect `IFS` set to `` (blank). It just prints them without a space between. If I instead use echo, it works (except for the added newline). But for compatibility reasons I want to use printf for this task. How can I achieve this? What am I doing wrong? I also tried using the `%q` modifier which also didn't result in the desired output.               printf '%q' $matches


title: Run XMonad's startup hook only on initial startup

text: I have the following `startupHook` in my `xmonad.hs`               , startupHook = spawn "~/.xmonad/autostart"      I am starting many apps and daemons in this script and it is written to run _only_ once on startup. But this is being run everytime I hit `Mod-q`, i.e., to reload and test out my changes to `xmonad.hs`. I could conditionally run the programs in the autostart script but that turned out to be quite flaky. So, I was wondering if there is a way to xmonad to run this startup hook only on the initial startup and not on reloads. I tried googling around but came up empty. Is such a thing possible? Edit: I am running xmonad 0.11 installed from cabal on ubuntu 12.04.


title: what is OS hardening in linux or unix?

text: The term **OS hardening** itself is misleading/vague to me as i am reading to understand it online here. It seems to me that its something related to making linux/unix box more secure.