title: vi - how to add specific characters at the end of line

text: I would like to know if is possible in vi to add at the end of a line some specific character of ther line itself. Example: Before                   donald /mount/donald_01         mickey /mount/mickey_01         mickeym /mount/mickey_02      After some :%s%"last two characters"%"last two characters"/"last two characters"% command                   donald /mount/donald_01/01         mickey /mount/mickey_01/01         mickeym /mount/mickey_02/02      Thanks gb


title: How can I fix this dependancy error when updating clamav using yum?

text: I'm trying to update `clamav` on an old CentOS 5 mail server installation but keep getting a dependency error which I can't understand. I followed the method described here. Perhaps someone can show me the way through this?               [root@s1 ~]# yum list clamav     Loaded plugins: fastestmirror, priorities     Loading mirror speeds from cached hostfile      * base: centos.mirror.facebook.net      * extras: centos-distro.cavecreek.net      * rpmforge: mirror.hmc.edu      * updates: mirror.thelinuxfix.com     base                                                                                | 1.1 kB     00:00          dag                                                                                | 1.9 kB     00:00          extras                                                                                | 2.1 kB     00:00          rpmforge                                                                                | 1.9 kB     00:00          updates                                                                                | 1.9 kB     00:00          Excluding Packages in global exclude list     Finished     Installed Packages     clamav.i386                                                                                0.97.6-1.el5.rf                                                                                installed     clamav.i386                                                                                0.97.7-1.el5.rf                                                                                installed     [root@s1 ~]#                     [root@s1 ~]# yum update clamav     Loaded plugins: fastestmirror, priorities     Loading mirror speeds from cached hostfile      * base: centos.mirror.facebook.net      * extras: centos-distro.cavecreek.net      * rpmforge: mirror.hmc.edu      * updates: mirror.thelinuxfix.com     base                                                                                | 1.1 kB     00:00          dag                                                                                | 1.9 kB     00:00          extras                                                                                | 2.1 kB     00:00          rpmforge                                                                                | 1.9 kB     00:00          updates                                                                                | 1.9 kB     00:00          Excluding Packages in global exclude list     Finished     Setting up Update Process     Resolving Dependencies     --> Running transaction check     --> Processing Dependency: clamav = 0.97.6-1.el5.rf for package: clamd     ---> Package clamav.i386 0:0.97.7-1.el5.rf set to be updated     --> Finished Dependency Resolution     clamd-0.97.6-1.el5.rf.i386 from installed has depsolving problems       --> Missing Dependency: clamav = 0.97.6-1.el5.rf is needed by package clamd-0.97.6-1.el5.rf.i386 (installed)     Error: Missing Dependency: clamav = 0.97.6-1.el5.rf is needed by package clamd-0.97.6-1.el5.rf.i386 (installed)      You could try using --skip-broken to work around the problem      You could try running: package-cleanup --problems                             package-cleanup --dupes                             rpm -Va --nofiles --nodigest     [root@s1 ~]#       The above results are obtained after running the suggested:               package-cleanup --problems     package-cleanup --dupes     rpm -Va --nofiles --nodigest      **UPDATE** I ran `yum --disablerepo=\\* --enablerepo=rpmforge update clam\\*` in accordance with an answer and received the following terminal output:               [root@s1 ~]# yum --disablerepo=\* --enablerepo=rpmforge update clam\*     Loaded plugins: fastestmirror, priorities     Loading mirror speeds from cached hostfile      * rpmforge: mirror.hmc.edu     rpmforge                                                                                | 1.9 kB     00:00          Excluding Packages in global exclude list     Finished     Setting up Update Process     Resolving Dependencies     --> Running transaction check     ---> Package clamav.i386 0:0.97.7-1.el5.rf set to be updated     ---> Package clamav-db.i386 0:0.97.7-1.el5.rf set to be updated     ---> Package clamd.i386 0:0.97.7-1.el5.rf set to be updated     --> Finished Dependency Resolution          Dependencies Resolved          ===============================================================================================================      Package                   Arch                 Version                         Repository                Size     ===============================================================================================================     Updating:      clamav                    i386                 0.97.7-1.el5.rf                 rpmforge                 2.2 M      clamav-db                 i386                 0.97.7-1.el5.rf                 rpmforge                  34 M      clamd                     i386                 0.97.7-1.el5.rf                 rpmforge                 243 k          Transaction Summary     ===============================================================================================================     Install       0 Package(s)     Upgrade       3 Package(s)          Total download size: 37 M     Is this ok [y/N]: y     Downloading Packages:     (1/3): clamd-0.97.7-1.el5.rf.i386.rpm                                                   | 243 kB     00:00          (2/3): clamav-0.97.7-1.el5.rf.i386.rpm                                                  | 2.2 MB     00:00          (3/3): clamav-db-0.97.7-1.el5.rf.i386.rpm                                               |  34 MB     00:03          ---------------------------------------------------------------------------------------------------------------     Total                                                                          9.0 MB/s |  37 MB     00:04          Running rpm_check_debug     Running Transaction Test     Finished Transaction Test               Transaction Check Error:       package clamav-db-0.97.7-1.el5.rf.i386 is already installed       package clamd-0.97.7-1.el5.rf.i386 is already installed       package clamav-0.97.7-1.el5.rf.i386 is already installed          Error Summary     -------------          [root@s1 ~]#       Installed packages, according to `yum list clam\\*` are:               clamav.i386                                         0.97.6-1.el5.rf                                   installed     clamav.i386                                         0.97.7-1.el5.rf                                   installed     clamav-db.i386                                      0.97.6-1.el5.rf                                   installed     clamav-db.i386                                      0.97.7-1.el5.rf                                   installed     clamd.i386                                          0.97.6-1.el5.rf                                   installed     clamd.i386                                          0.97.7-1.el5.rf                                   installed     Available Packages     clamav-devel.i386                                   0.97.7-1.el5.rf                                   dag           clamav-milter.i386                                  0.97.7-1.el5.rf                                   dag           clamtk.i386                                         3.09-1.el5.rf                                     dag           clamtk.noarch                                       4.25-1.el5.rf                                     dag      I'm wondering why I'm still seeing `0.97.6-1.el5.rf` in the list?


title: How do I refresh the magnetic state on a disks with backups?

text: I have a couple of large disks with backup/archive material on them. They're **ext4**. Regarding the ones of those that will be stored for a couple of years without reading the whole disc again I've been thinking of a way to refresh the disks magnetic state. Shelf life of drives seems to be a matter of debate everywhere I've been looking for an answer, but it seems after a couple of years (say 5 or so) of storage it would be wise to refresh the data in some way (?) I've seen this suggested:               dd if=/dev/sda of=/dev/sda      Is it safe? Is it useful? What I'm looking to do is another thing than a `fsck` or a `dd if=/dev/sda of=/dev/null`, both of which will probably discover existing magnetic drop outs on the disk. What I want to do is to refresh the magnetic data before the magnetic charges on the disk lowers below a readable level. How can I do this?


title: How to bypass GNOME Terminal when sending keyboard input?

text: When running an interactive shell application, how can I send it a key (or key combination) which would normally be intercepted by GNOME Terminal? In this particular instance it's the `F10` key which is intercepted. Bonus points for a general-purpose solution which would work for things like `Alt`, `PgUp` and `Alt`-`Tab` (might be useful for a shell script to configure shortcut commands) or in other terminals as well.


title: How can I search for and highlight multiple strings in VIM?

text: In VIM, how can I search for multiple strings and have a different color highlight for each match?


title: Can I write the output the of time difference command to a file?

text: Can I write the output of the time difference command to a file? For example, I tried:               $ time foo.sh > bar.txt      But it only gives the output of foo.sh to bar.txt.


title: How do I find where Apache keeps the log files?

text: I need to find where Apache is keeping the access and error logs for a site. I have root access to a server where dozens of sites are hosted. I'm trying to debug one of those sites. When I browse the site, it doesn't show up on `/var/logs/apache2/access.log` or `/var/logs/apache2/error.log`. (The files **_are there_** , and other sites gets logged on those. In fact, there are hundreds of different log files). Neither `locate httpd.log` nor `find . -iname httpd.log` performed at `/` issue any results. The apache configuration for the site is:               ServerName REDACTED.com.br     DocumentRoot /var/www/xyz/wiki     AssignUserId xyz_wiki xyz_wiki          <Directory /var/www/xyz/wiki/data>     order allow,deny     deny from all     </Directory>     <Directory /var/www/xyz/wiki/conf>     order allow,deny     deny from all     </Directory>     <Directory /var/www/xyz/wiki/bin>     order allow,deny     deny from all     </Directory>     <Directory /var/www/xyz/wiki/inc>     order allow,deny     deny from all     </Directory>          php_admin_value open_basedir /var/www/xyz/wiki/:/mnt/vdImagem/www/xyz/wiki/


title: Linux PPP : how to debug disconnects with exit code = 16?

text: I'm using `pppd` and `wvdial` on my ARM Linux embedded system. I have a CDMA modem connected via a serial port and am connecting to the Verizon network. I am seeing that several times per day `pppd` exits with exit code 16 (see exact message from log below). How do I work out what is causing these disconnects? In particular what does the "LCP terminated by peer" message indicate?               Feb 18 12:31:04 ts7600-47aad3 pppd[3242]: LCP terminated by peer     Feb 18 12:31:04 ts7600-47aad3 pppd[3242]: Connect time 0.6 minutes.     Feb 18 12:31:04 ts7600-47aad3 pppd[3242]: Sent 1044 bytes, received 0 bytes.     Feb 18 12:31:04 ts7600-47aad3 pppd[3242]: restoring old default route to eth0 [1     92.168.98.1]     Feb 18 12:31:07 ts7600-47aad3 pppd[3242]: Connection terminated.     Feb 18 12:31:07 ts7600-47aad3 pppd[3242]: Modem hangup     Feb 18 12:31:07 ts7600-47aad3 pppd[3242]: Exit.     Feb 18 12:31:07 ts7600-47aad3 wvdial: Disconnecting at Tue Feb 18 12:31:07 2014     Feb 18 12:31:07 ts7600-47aad3 wvdial: The PPP daemon has died: A modem hung up t     he phone (exit code = 16)     Feb 18 12:31:07 ts7600-47aad3 wvdial: man pppd explains pppd error codes in more      detail.


title: grub error "superfluous RAID member" on update-grub

text: My system (wheezy/sid: 2.6.32-5-amd64 #1 SMP x86_64 GNU/Linux) is running fine - I'm just wondering what some messages mean. I have two mdraid arrays running up on my system. Here's `cat /proc/mdstat`:               Personalities : [raid1] [raid6] [raid5] [raid4]      md1 : active (auto-read-only) raid5 sda3[0] sdc3[3] sdb3[1]           823103488 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/3] [UUU]          md0 : active raid1 sda2[0] sdc2[2](S) sdb2[1]           72628769 blocks super 1.2 [2/2] [UU]      I use `/dev/md0` as `/` and `/dev/md1` as `/home`. Whenever `update-grup` is running - or while grub comes up, I receive the error: `error: superfluous RAID member (2 found).`. To understand why I'd like to remove this, have a look at the result of `update-grub`:               error: superfluous RAID member (2 found).     error: superfluous RAID member (2 found).     Generating grub.cfg ...     error: superfluous RAID member (2 found).     error: superfluous RAID member (2 found).     error: superfluous RAID member (2 found).     error: superfluous RAID member (2 found).     error: superfluous RAID member (2 found).     error: superfluous RAID member (2 found).     error: superfluous RAID member (2 found).     error: superfluous RAID member (2 found).     error: superfluous RAID member (2 found).     error: superfluous RAID member (2 found).     error: superfluous RAID member (2 found).     error: superfluous RAID member (2 found).     error: superfluous RAID member (2 found).     error: superfluous RAID member (2 found).     error: superfluous RAID member (2 found).     Found background image: /usr/share/images/desktop-base/desktop-grub.png     error: superfluous RAID member (2 found).     Found linux image: /boot/vmlinuz-2.6.32-5-amd64     Found initrd image: /boot/initrd.img-2.6.32-5-amd64     error: superfluous RAID member (2 found).     error: superfluous RAID member (2 found).     error: superfluous RAID member (2 found).     error: superfluous RAID member (2 found).     error: superfluous RAID member (2 found).       No volume groups found     done      How can I get rid of these messages?


title: Program acting differently depending on user

text: I am trying to control an RC transmitter from a PHP site. The command works fine as user "xbian" in the command line:               sudo /home/xbian/433Utils/RPi_utils/codesend 34832404      for example, and it works fine. So I am using this code on the php page:               shell_exec("sudo /home/xbian/433Utils/RPi_utils/codesend {$num} >/tmp/debug.log 2>&1");      And this line in sudoers:               www-data ALL=NOPASSWD: /home/xbian/433Utils/RPi_utils/codesend      And as expect I get an output file: > sending code[34832404] Which I don't get without the sudoers line. So the command is running as sudo as it should but for some reason, after all this, it simply doesn't work like it does when I just run the shell command normally. The actual thing that requires sudo is the "WiringPi" library which is called in the C++ program "codesend". I assume something is going wrong there but I have no clue how to troubleshoot it. No errors occur in the codesend program and nothing else it output from the command. I'm running PHP 5.4.4 and using Prefork mpm. This page is only accessible on my local network so I am not too worried about security at this point, just getting it to work. How can I figure out where the problem is?


title: How to recover from a boot hang after deleting old swap?

text: I did a fresh installation of Fedora 20 in the free space of my hard drive after failing to upgrade from the older version. Everything seems to be working fine until I deleted the partition containing the older version to free up some space. Upon restarting the computer, I got the following message after waiting for a long time: > Warning: Could not boot > > Warning: /dev/fedora_old/swap does not exist > > Starting Dracut Emergency Shell I am still able to boot if I type `exit` on dracut prompt. But, that does not solve the root of the problem. There are a few suggestions on the web proposing:               dracut --force --regenerate-all      I am not sure what it does exactly and it doesn't seem to resolve the problem. What is the proper way to sort out the swap partition? It seems that the swap for the older OS was being used when the new OS is being installed despite it having its own swap partition. And how could I avoid such a problem in the future? This is what I have for `/etc/fstab`:               /dev/mapper/fedora_new-root00 /          ext4    defaults                   1 1     UUID=somehexdec               /boot      ext4    defaults                   1 2     UUID=someotherhexdec          /boot/efi  vfat    umask=0077,shortname=winnt 0 0     /dev/mapper/fedora_new-home00 /home      ext4    defaults                   1 2     /dev/mapper/fedora_new-swap   swap       swap    defaults                   0 0


title: Help configuring DBUS to start JACK

text: I have the Jack Audio Connection Kit (JACK) installed, but cannot seem to get `jack_control start` to start the service. I'm using Slackware64-current, which recently updated its `/etc/dbus-1/system.conf` to have a more restrictive configuration:               <!-- ... -->     <policy context="default">       <!-- All users can connect to system bus -->       <allow user="*"/>            <!-- Holes must be punched in service configuration files for            name ownership and sending method calls -->       <deny own="*"/>       <deny send_type="method_call"/>            <!-- Signals and reply messages (method returns, errors) are allowed            by default -->       <allow send_type="signal"/>       <allow send_requested_reply="true" send_type="method_return"/>       <allow send_requested_reply="true" send_type="error"/>            <!-- All messages may be received by default -->       <allow receive_type="method_call"/>       <allow receive_type="method_return"/>       <allow receive_type="error"/>       <allow receive_type="signal"/>            <!-- Allow anyone to talk to the message bus -->       <allow send_destination="org.freedesktop.DBus"/>       <!-- But disallow some specific bus services -->       <deny send_destination="org.freedesktop.DBus"             send_interface="org.freedesktop.DBus"             send_member="UpdateActivationEnvironment"/>     </policy>      Ever since the update, running `jack_control start` as a regular user produces the following error:               --- start     DBus exception: org.jackaudio.Error.Generic: failed to activate     dbusapi jack client. error is -1      It did not do this before. The new configuration file says I'm supposed to punch a hole for it in the service configuration files, but I'm baffled as to how I'm supposed to do that. I'm not even quite sure what DBUS has to do with JACK. If you could please help me by giving me a little background information or lending me your expertise regarding configuration of DBUS, I would be most grateful. Extra information:   * JACK2 SVN revision 4120 (2011-02-09)   * DBUS version 1.4.1   * DBUS-Python version 0.83.1


title: Default configuration I need to change?

text: A few days ago I installed a new linux os. Today i realize `/root` has `o+r (755)` so EVERYONE is able to see my root sql password in `/root/.my.cnf`. I freaked out and simply changed `/root` to `750`. My `/var/www` folder is `2755` but all the folders in it are `2750` (so certain users can browse to the folder without being blind). What software, file permissions and other DEFAULT configuration should I change?


title: What governs the limits of shell brace expansion?

text: In this example I refer to the expansion of a sequence of integers, but perhaps(?) the limits would be relevant to all aspects of brace expansion.. This more general view is also of interest to me. `seq` seems to handle much longer integer sequences than does {1..n} brace expansion (at least, that's the case in this example). eg 'seq -f @%12.0f 1 1000000000 >/dev/null' .. This expands 1 billion quite happily in 14m 04s However, `echo {1..10000000000} >/dev/null` crashes into oblivion from the CLI in 'gnome-terminal' and 'konsole' (...goodbye terminal session!) The best I could get out of brace expansion for an integer sequence, is approximately {1..15000000}.. only 15 million. Is this a limitation of the brace expansion itself, or of how `echo` handles the expanded data? It seems to be caused by using up all available RAM, but I thought it would use the `swap` area at that point... Also (btw), this 15000000 integer sequence, `echo {..}` takes 57.0s; whereas `seq` takes only 12.7s ...


title: Google chat video - Fedora / Google Chrome

text: The webcam is working, because i can see me with the "Cheese" app. ok.....      I installed: google-talkplugin_current_i386.rpm   then i opened chrome, and this is what i see:   http://i.stack.imgur.com/cUopi.png      the webcam part is black..      What can i do, so that "google chat" will recognize my webcam?   I've been on this for hours..and i'm tired now.. :\   can someone help?      i tried to disable all plugins, it's the same   i tried it in firefox..it freezez      the only problem is the video part..why can't i see the webcams picutre?


title: cat all lines from file, which are after "KEYWORD"

text: I have a file, with a "KEYWORD" on line number n. How can I print all lines starting from line n+1 until the end? For example, here I would liek to pro=int only lines DDD and EEE               AAA     BBB     CCC     KEYWORD     DDD     EEE


title: How to disable the radio button for a fixed interval of time after clicking them

text:
I want to disable all the radio buttons when one is clicked and then to enable it after a fixed interval amount of time after the radio button has been clicked.                   <input type="radio" value="LIKE" onclick="func(this.value)">LIKE
         <input type="radio" value="OK" onclick="func(this.value)">OK
         <input type="radio" value="DISLIKE" onclick="func(this.value)">DISLIKE


title: How to make my laptop safe & secure from any accidents like deleting by mistake?

text: This should be a general question. This Q sprung my mind yesterday late evening because I accidentally deleted files from another partition rather than from the partition I was intending to do. I'm working on Ubuntu 13.04. From launcher I clicked on the '2nd from top' icon (named files). There I clicked on 2 GB flash drive and it got mounted. I was intending to delete all the files here. Before that I was doing some other tasks on other windows. Then I returned back on the 'Files' window. Rather than clicking on the 2 GB flash drive I clicked on the 40 GB drive which was directly above the flash drive. This 40 GB was of Windows 7. Then I pressed 'ctrl-a' & 'shift-del'. Before this mistake stroked my mind, it had already deleted 7 GB of data (luckily other 33 GB was secure). Now, I'm very much concerned of how to secure my partitions/files & everything on my laptop. The solution should include the below point: On the files window, all partitions are listed & its only a matter of clicking on it to mount it. It should be that whenever it is clicked it should mount automatically on read only mode so that no accidental deletion occurs. I expect a **_general_** solution for securing my laptop. One thing I would like to add that I have taken backup of my Ubuntu partitions (/, /boot & /home) & so my Ubuntu data are safe but I can't take for all partitions because of lack of space.


title: How to auto-mount all USB-devices at same USB socket to same mountpoint

text: * I have a small computer with 2 USB sockets : A and B.   * I want **any external USB disk** , attached to **socket A** - to be mounted as " **deviceA** "   * I want **any external USB disk** , attached to **socket B** - to be mounted as " **deviceB** " **Expecially** :   Any amount of different disks may be attached to socket A. They all shall be mounted as "devicesA".   Because of this case I can not use UUIDs of disks and have to identify the sockets. I am using udev rules to automount the disks. How would I implement that?


title: Printing unique lines

text: Is there some better solution for printing unique lines other than a combination of `sort` and `uniq`?


title: How can I Forward a subDomain to a specific port?

text: My apologies if this has been asked before. I haven't found an adequate solution so... yeah. When a specific domain, "example.com" is accessed, I want it to act normally. In other words, it should go to port 80 as expected and interact with Apache. When a different sub-domain, "mc.example.com" is accessed, I don't want it to access the Apache web server. I want it to go interact with a different program, listening on, say, port 4096. Thus, going to "mc.example.com" would have the same/similar function as "example.com:4096". If it helps, the service is Minecraft When a third sub-domain, "vpn.example.com" is accessed, I want it to go interact with a different service, listening on, say, port 687. If it helps, the service is openVPN Is there a simple way to do this? If so, what is it? Does it involve configuring a VirtualBox in Apache (a method I tried and failed miserably. xD)? Or can it be done using ipTables? If it means anything, I am running 32-bit Centos 5.5(I believe. Its a recent version of Centos) Thanks for your help.


title: Check that fail2ban is running?

text: I just installed and configured fail2ban. I want to make sure it is working. I don't want to block myself from the server so I can't just login (poorly) a bunch of times. How do I see that fail2ban is working?


title: What is a device controller, and where does it fit in between the kernel and the device?

text: Can someone please explain the concept of a device controller (hard disc controller, NEC PD765 compatible controller etc.). * * * Here are some definition of key terms which might be needed for the explanation. Just to maintain the term sync :) **Kernel** - The software which provides abstraction for accessing hardware devices **Drivers** - low level programs written by hardware manufacturers which are loaded as kernel modules and provide the kernel with the knowledge on how to control the devices **Firmware** - hardware specific programs which define the internal logics on the hardware. The kernel usually has nothing to do with them except for the cases when the the firmware is uploaded to the device upon each start in which case the kernel does the uploading * * * Where does the device controller fit in and is it located on the device itself of on the motherboard? Do drivers provide the kernel with the interface towards the controller and not directly to the device itself? Was the idea behind the controller to be able to control devices from a different manufacturers with the same driver?


title: How to modify ulimit for open files on SUSE Linux Enterprise Server 10.4 permanently?

text: SERVER:/etc # ulimit -a     core file size          (blocks, -c) 0     data seg size           (kbytes, -d) unlimited     file size               (blocks, -f) unlimited     pending signals                 (-i) 96069     max locked memory       (kbytes, -l) 32     max memory size         (kbytes, -m) unlimited     open files                      (-n) 1024     pipe size            (512 bytes, -p) 8     POSIX message queues     (bytes, -q) 819200     stack size              (kbytes, -s) 8192     cpu time               (seconds, -t) unlimited     max user processes              (-u) 96069     virtual memory          (kbytes, -v) unlimited     file locks                      (-x) unlimited     SERVER:/etc #       How can I set the limit of the root user from 1024 to something else, PERMANENTLY? How can I set the ulimit globally? Will the changes take effect in the moment? p.s.: I already googled for it but can't find the file where I can set it permanently:               SERVER:/etc # grep -RiI ulimit * 2>/dev/null | egrep -v ":#|#ulimit"     init.d/boot.multipath:      ulimit -n $MAX_OPEN_FDS     init.d/multipathd:      ulimit -n $MAX_OPEN_FDS     rc.d/boot.multipath:        ulimit -n $MAX_OPEN_FDS     rc.d/multipathd:        ulimit -n $MAX_OPEN_FDS      and..:               SERVER:/etc # grep -RiI 'MAX_OPEN_FDS' * 2>/dev/null     init.d/boot.multipath:MAX_OPEN_FDS=4096     init.d/boot.multipath:  if [ -n "$MAX_OPEN_FDS" ] ; then     init.d/boot.multipath:      ulimit -n $MAX_OPEN_FDS     init.d/multipathd:MAX_OPEN_FDS=4096     init.d/multipathd:  if [ -n "$MAX_OPEN_FDS" ] ; then     init.d/multipathd:      ulimit -n $MAX_OPEN_FDS     rc.d/boot.multipath:MAX_OPEN_FDS=4096     rc.d/boot.multipath:    if [ -n "$MAX_OPEN_FDS" ] ; then     rc.d/boot.multipath:        ulimit -n $MAX_OPEN_FDS     rc.d/multipathd:MAX_OPEN_FDS=4096     rc.d/multipathd:    if [ -n "$MAX_OPEN_FDS" ] ; then     rc.d/multipathd:        ulimit -n $MAX_OPEN_FDS     SERVER:/etc #


title: Simple sed replacement of tabs mysteriously failing

text: This ought to be really simple, but for some reason it is not working:               sed -i.bak -E 's/\t/  /' file.txt      Instead of replacing tab characters, it's replacing `t` characters. I've tried every variation on this I could think of, playing with quoting, etc. I've Googled and found everyone else using pretty similar expressions and they seem to work for them. The `-E` is an OS X thing. I thought the failure might be a result of some weird quirk of OS X's `sed`, so I tried it with Ruby as well (without the `-i`), and got the same result:               ruby -pe '$_.gsub!(/\t/,"  ")' < file.txt > file.new      I'm using Bash 3.2.51 on OS X, and iTerm, although I can't see how any of those could be terribly relevant. I haven't set any weird environment variables, though I can post any that you think might be relevant. What could be wrong? **_UPDATE_** : I must have made some other mistake or typo when I tried the Ruby version, since Gilles points out that it _does_ work (and I've _never_ had him steer me wrong!). I'm not sure what happened, but I'm pretty sure it must have been my mistake.


title: Multiseat X setup with a single dual head graphics card

text: I am considering trying to setup a multiseat system. It seems like this would be pretty straight forward if I had two graphics cards or if I didn't need hardware based OpenGL acceleration. Is it possible to setup a multi seat system with only a single dual-headed graphics card?


title: How to continue a script after it reboots the machine?

text: I'm writing a shell script in bash. At some point in the script, it detects that the machine needs to be rebooted before continuing. It issues:               sudo reboot      When the machine comes back up, there is is more work that this script needs to do. How do I configure something to continue doing the work in this script? I'm assuming that there is some place that I can write a shell script such that it will get executed at the next reboot. Where is such a place? I see that cron has an @reboot directive. I also know that services such as Apache are started on boot by upstart. Would either of those be appropriate mechanisms? If so, how would it be triggered? This script only needs to run once, not every reboot. So it will have to go somewhere that just runs on the next reboot, or be able to remove itself once it has run. This question asks about how to save your application state for after reboot. My script doesn't have much state, so I can manage that. I just need to know how to have this script trigger something to run after the next reboot. My specific version is Ubuntu Linux 14.04. The original script is started on the command line by a system administrator (as opposed to running from cron).


title: Running multiples query on Hbase shell without calling hbase shell again

text: To invoke shell again takes time , i want to execute multiple commands by invoking hbase shell once.Below code run only single query.               cmd="echo \"put 'test', 'row1', 'cf:a', 'value1'\"| hbase shell"      I want to run multiple queries on single hbase shell call.               put 'test', 'row1', 'cf:a', 'value1'     put 'test', 'row2', 'cf:b', 'value2'     put 'test', 'row3', 'cf:c', 'value3'      how can I achieve this ?


title: Proxy server with authentication not working at command line

text: I'm running Debian 6 in a VM on a network that requires Windows authentication to a proxy server before it can run any http/https/ftp connection. I've tried:               export http_proxy=http://domain\\username:password@proxyIPaddress:8080       and same for `ftp_proxy`, but I keep getting: "Proxy server requires authentication". My password does have a few special characters so I've escaped them using the backslash, just like I do for the domain name. If I hit the up arrow to view my history, the command looks correct (the escape backslashes are gone and the command and password look correct). What else should I try?


title: Fix partition alignment in FreeBSD

text: I'm working on a FreeBSD 8.x (pfSense 2.1) system and post-install, realised that the partition is misaligned to the disk (starts at sector offset 63). GParted doesn't recognise UFS so that is out. I've had a quick look at `sade`, `fdisk`, and `gpart` but can't work out how to non-destructively move the partition; is there an easy way to do so or should I simply dump out the config & rebuild?


title: autocomplete named directories

text: Autocompletion of a named directory doesn't seem to work before I use it the first time, as demonstrated by the following session:               % setfoo() { foo=/etc; }     % setfoo          % cd ~fo<Tab> # doesn't autocomplete ~foo     % ls ~foo # this works     % cd ~fo<Tab> # now it does autocomplete ~foo      Is there a way to enable autocompletion from the beginning? Notes:   * this works as expected if I set `foo` directly on the command line, not inside a function   * `setfoo() { foo=/etc; true ~foo; }` works, too, but I'm looking for a more proper solution


title: My server getting stuck on grub message while replacing server secondary HDD sdb1 to sdc1

text: My server getting stuck on grub message while replacing server secondary HDD `sdb1` to `sdc1` which is mounting on /home. I have define my `/etc/fstab` with LABEL=/home. My server has installed Cpanel and Server OS is centos5.6 I have mention my server `grub` and `fstab` configuration:               root@serv01 [~]# cat /etc/grub.conf      # grub.conf generated by anaconda      # Note that you do not have to rerun grub after making changes to this file      # NOTICE: You have a /boot partition. This means that      # all kernel and initrd paths are relative to /boot/, eg.      # root (hd0,0)      # kernel /vmlinuz-version ro root=/dev/sda3      # initrd /initrd-version.img      #boot=/dev/sda      default=0      timeout=5      splashimage=(hd0,0)/grub/splash.xpm.gz      hiddenmenu      title CentOS (2.6.18-371.6.1.el5)      root (hd0,0)      kernel /vmlinuz-2.6.18-371.6.1.el5 ro root=LABEL=/      initrd /initrd-2.6.18-371.6.1.el5.img      title CentOS (2.6.18-194.el5)      root (hd0,0)      kernel /vmlinuz-2.6.18-194.el5 ro root=LABEL=/      initrd /initrd-2.6.18-194.el5.img           root@serv01 [~]# cat /etc/fstab      LABEL=/  /  ext3    usrjquota=quota.user,jqfmt=vfsv0    1   1      LABEL=/home /home   ext3    usrjquota=quota.user,jqfmt=vfsv0    1   2      LABEL=/boot /boot ext3 defaults 1 2      tmpfs /dev/shm tmpfs defaults 0 0      devpts /dev/pts devpts gid=5,mode=620 0 0      sysfs /sys sysfs defaults 0 0      proc /proc proc defaults 0 0      LABEL=SWAP-sda2 swap swap defaults 0 0           root@serv01 [~]# df -h      Filesystem Size Used Avail Use% Mounted on      /dev/sda3 887G 115G 727G 14% /      /dev/sdb1 903G 467G 390G 55% /home      /dev/sda1 487M 23M 439M 5% /boot      tmpfs 4.0G 0 4.0G 0% /dev/shm      /dev/sdc1 903G 467G 389G 55% /media/newdisk       Now I want to replace my `sdb1` with `sdc1` My server get stuck on boot after.               One 2.40 GHz Quad-core Processor, Processor Bus:1066 MHz      Dell SAS 5 Host Bus Adapter BIOS      MPTBIOS-6.06.00.02 (2006.04.05)      Copyright 2000-2006 LSI Logic Crop.           HBA ID LUN VENDOR PRODUCT REVISION CAPACITY      ---- --- --- --------- ------------- ----------- -----------      0   0 0 ATA ST31000528AS    CC3E 953869 MB      0   1 0 ATA ST31000524AS    JC4B     953869 MB      0 0 LSILogic SAS1068-IT 0.06.40.00      Dell Corp. MPT boot ROM successfully installed!           IPMI Server Management Configuration Utility 1.5      Copyright 2003-2006 Dell Inc. All Rights Reserved           Baseboard Management Controller Revision 1.70           Press<Ctrl-E> for BMC Setup within 5 sec......           GRUB       Nothing comes after that message.


title: Running google cloudprint on boot

text: I use this Python script on my Debian based Guru Plug to make it work as a print server for Google Cloudprint. With this I can print from my Android devices using apps like `PrinterShare` or `Cloud Print`. It works perfectly. However, I have to start the script manually if I for some reason have to reboot the plug computer. If would like to have it start automatically on boot, but so far I haven't succeded. In `/etc/rc.local` I have this line:               /usr/bin/python /usr/local/bin/cloudprint -d      Using `pgrep` I can see that the script is running upon boot but it does not work. And redirecting output messages to a log file reveals that it ask for my Google username. Normally it does not ask for authentification as this is stored in `/root/.cloudprintauth`. But obviously, when running from rc.local it is not able to read or find the file. So my question is: How do I enable the script to be able to find/read the authentification file when run from rc.local?


title: Pipe Password to Application When Asked

text: The following should be done in a bash script:               curl --digest --user schmijos https://bitbucket.org/u/p/get/tip.zip -o tip.zip      How can I automatically submit a password to _curl_ when it asks for it? Since I don't want to see the password in any logfile, I **won't** do the following:               curl --digest --user schmijos:$password https://bitbucket.org/u/p/get/tip.zip -o tip.zip


title: Debian Cannot Access Internet Despite Being "Connected"

text: I'm have a problem, I cannot access the internet. I'm using a dell inspiron 6400 with debian kernel 3.2 installed. My windows manager is xfce4. I was never able to figure out the wired network, however at my home I had the wireless network working just fine. I'm at my mom's house now, and I can't get the wireless to connect. I connected with wicd, and it says that I'm connected, however I can't access the internet(seems very strange). I have a CS assignment due before I get home, so I need to figure this out very quickly. Is there anything I can do to determine my connectivity? Thanks for the help guys, just ask if you need any additional info.


title: comm: file is not in sorted order

text: I used `comm` to compare two sorted files. Each line in these files are positive integer numbers. But the results show               comm: file 1 is not in sorted order     comm: file 2 is not in sorted order      How come the error even if these two files are sorted?


title: What software should I use to create a HPC (High performance compute) cluster with CentOS 6.5 VMs locally?

text: I've read about Torque, Slurm resource managers and Maui, Open Grid scheduler, Sonf of Grid Engine but I do not know which is more appropriate to use in a local environment? I've also read that I need to use a MPI library. I already have a cluster implemented with Conga but can I use it ?


title: gkSudo Error no matter what I do

text: I don't know why, It wasn't happening yesterday. Was it because I turned the machine off and back on again this morning? Anyway here's the error. GkSudo won't run anything at all now. > (gksudo:3262): GLib-CRITICAL **: g_str_has_prefix: assertion `str != NULL' > failed This happens no matter what. Funny thing is, gkSudo comes up with the password box, I enter the root password, then the problem happens. I want my gksudo back can anyone help? I cannot find documentation for this error at all. I don't know where to look, this is my second ever day using Linux. I'm on Debian Gnome.


title: Debian: unable to set up SELinux

text: I'm trying to set up SELinux on Debian 6 according to (the instructions reported on the Debian wiki). I've run this commands:               apt-get install selinux-basics selinux-policy-default      selinux-activate      After reboot, the system should have taken a while to label the filesystems on boot and then rebooted a second time when that was complete. However, neither labeling nor rebooting occurred. The command:               check-selinux-installation      returns:               /usr/sbin/check-selinux-installation:19: DeprecationWarning: os.popen3 is deprecated.  Use the subprocess module.       @staticmethod     /usr/sbin/check-selinux-installation:23: DeprecationWarning: os.popen2 is deprecated.  Use the subprocess module.       def fix():     getfilecon:  getfilecon(/proc/1) failed     SELinux is not enabled.     Could not read the domain of PID 1.     /etc/pam.d/login is not SELinux enabled     FSCKFIX is not enabled - not serious, but could prevent system from booting...      This is strange because the kernel is SELinux-enabled, and the `grub.cfg` does contain the `selinux=1` option. Any suggestion?


title: How to run grep and show x number of lines before and after the match

text: `grep` returns just the line where it matched the regex and often what I want to really see is a few (say 2) lines above and below the matched one. Is there a simple way to achieve it? EDIT: OS: Ubuntu based Bodhi Linux. As mentioned in comments, -C does not work in vanilla but its GNU grep in my case.


title: List files that occur lexically after/greater than a given prefix (or, run database upgrade scripts in a proper order)

text: I'm trying to create a shell script that runs through a bunch of SQL scripts. I've these files:               $ ls upgrade/     01-foo.sql 02-bar.sql 02-baz.sql 03-foo1.sql 04-buz.sql      And I've got the version of the current db, e.g. `DB_VERSION=02` How can I now easily loop through and glob the files with a prefix greater than my $DB_VERSION, and run them in order ? i.e. I'd like to do               for f in ???? ; do         mysql < $f     done      and, with DB_VERSION=02, run the `03-foo1.sql` and `04-buz.sql` , in that order.


title: Linux Kernel 3.x new versioning scheme

text: As almost everybody knows, Linux moved from the 2.6.x version to the brand new 3.x version. I've seen around many comments also about the fact that the versioning number for the kernel was changed (wikipedia as the major source as you can see here :) ). The point is that, despite many information about changing the versioning scheme on a time-based format I wasn't able to find anywhere information related to the new versioning scheme. Does anyone know how the new versioning scheme works?


title: Is there a way to match an inet and inet6 IP set in a single rule?

text: Is it possible to have one IPv4 and one IPv6 IP set (`ipset(8)`) within the same rule? I have several rules that depend on one set of IPv4 addresses and another set of IPv6 addresses respectively, but are otherwise identical. * * * I should add that there is a feature in `ipset(8)` which sounded hopeful, but turns out to offer no solution to the problem at hand:               list:set         The list:set type uses a simple list in which you can store set names.         [...]         Please note: by the ipset command you can add, delete and test the         setnames in a list:set type of set, and not the presence of a set's         member (such as an IP address).


title: minimal TCP MSS in Linux

text: The TCP MSS in Linux must be at least 88 (include/net/tcp.h):               /* Minimal accepted MSS. It is (60+60+8) - (20+20). */     #define TCP_MIN_MSS             88U      My question is: where did they come up with "60 + 60 + 8" and why? I get that 20 + 20 comes from the IP header + TCP header. EDIT: After taking a closer look at the headers, the formula looks for me like this:               (MAX_IP_HDR + MAX_TCP_HDR + MIN_IP_FRAG) - (MIN_IP_HDR + MIN_TCP_HDR)      The question still stands: **why**? Why does the Linux kernel use this formula, thereby prohibiting (a forced flow of) TCP segments of, say, 20 bytes? Think iperf here. EDIT2: Here's my use case. By forcing a low MSS on socket/connection, _all_ the packets sent by the stack will have a small size. I want to set a low MSS when working with iperf for packets/second testing. I can't get IP packets smaller than 128 bytes (Ethernet frames of 142 bytes) on the wire because of this lower limit for the MSS! I would like to get as close to an Ethernet frame size of 64 bytes as per RFC 2544. Theoretically this should be possible: 18 + 20 + 20 < 64.


title: bash script to check file ownership

text: I'm trying to write a script which takes 3 arguments as input.   1. path : where the files we want to check the ownership of are found.   2. expected ownership : the expected ownership given as argument 2   3. group : argument 3 There will be a whitelist file as well, which will have some of the file names. If any of the whitelisted file names are found, they should be skipped. The script needs to print a message if any of the file's ownership doesn't match otherwise, it should print "all files have the expected ownership". I tired the script but it's not working.. am not sure how to work with whitelist file logic. Can someone please help me out.               #!/usr/bin/env bash     PATH=$1     Owner=$2     Group=$3     WHITELIST="(/tmp/file_whitelist.txt)"          listcount=0     whitelist_matches=0          while IFS="" read -r matchedentry; do         if [[ "$matchedentry" =~ $WHITELIST ]]; then             ((whitelist_matches++))         else             echo -e "$matchedentry\r"             ((listcount++))         fi     done < <(find "$PATH" -perm /u+w -user $Owner -o -perm /g+w -group $GROUP)          if (( $listcount > 0 )); then             echo "$listcount items are having by '$Owner' ($whitelist_matches whitelisted)."     else             echo "Files which are Not having correct ownership found ($whitelist_matches whitelisted)."     fi


title: Convert OpenSSH private key into SSH2 private key

text: Is there a way to convert existing pair of OpenSSH keys to the SSH2 (ssh.com format) pair of keys? **UPD** : since there are some answers about `ssh-keygen` suddenly appeared, I'll explain where I came from (also it will be a nice answer on "what have you tried?").               $> diff --report-identical-files <(ssh-keygen -e -f ~/.ssh/id_dsa) <(ssh-keygen -e -f ~/.ssh/id_dsa.pub)     Files /tmp/zshAGGWAK and /tmp/zshPZiIr6 are identical      In other words, `ssh-keygen` returns same keys for private and public input keys (hashes of original files are obviously different, I've checked them twice to ensure that they are valid private and public keys). It seems to be that `ssh-keygen` generates only public key for private or public input key. I'm doing it wrong or it is a normal behavior?


title: How does setting the Setuid bit affect shell scripts that run on boot of the system, before any login has occurred?

text: Would enabling the setuid bit on a shell script make a difference at all when that script is run on boot? Who would the effective user be?


title: Is Perl ever a better tool than awk for text processing

text: This question was inspired by a discussion on stackoverflow - see in particular the comment thread under Ed Morton's answer. I figured this was the site where I could get a definitive answer: > In what situations would you recommend using Perl rather than awk for > complex text (file) processing tasks? I am looking specifically for examples where Perl either   1. Makes something possible that is not possible with awk   2. Makes the implementation of a particular operation more efficient (faster)   3. Results in more readable / easier to maintain scripts I recognize that this risks being a "opinion / discussion / religion" type of question - but I hope that the three criteria above allow for an objective comparison of the benefits of these two tools. Also recognize that I am coming at this question as a person with considerable experience with 'nix, but zero formal training; I "learn things as I need them", and I am wondering if there is a reason for me to dig in and learn Perl. **update** based on a couple of comments, I would like to expand the question: > Are there particular Perl libraries that you use frequently, and that make > you reach for Perl over awk for a class of problems?


title: Why does my one instance of VLC have many processes?

text: As you can see from the image below (htop), I have several `vlc` processes running, all with only the command `vlc`. However, I'm only running one vlc instance. ![enter image description here](http://i.stack.imgur.com/6D7uu.png) What are the other instances? Would it be safe to terminate them? And how can I tell which process is attached to my current instance?


title: No sound with Mint 12 and Realtek ALC892

text: Installed Mint 11 last week and I've got no sound. I've read around, went through the trouble shooters. Poked and prodded. Still no sound. It worked right out of the install with this hard ware in Ubuntu... 10.04 or something. Installed Mint 12 since it just came out, with the same issues. Every ~30 seconds or so the speakers do that click thing you hear when you turn them on. They also do it on command when I un/mute them in alsaMixer. What I CAN get out of the speakers, is the input from the front mic. Plug in a mic, turn up the front mic in alsaMixer and the speakers amplify everything. Codec:               cat /proc/asound/card0/codec* | grep Codec      -> Realtek ALC892 card1   -> ATI R6xx HDMI Playback hardware               aplay -l      card 0: SB [HDA ATI SB], device 0: ALC892 Analog [ALC892 Analog]   card 1: HDMI [HDA ATI HDMI], device 3: HDMI 0 [HDMI 0]               lspci -v      Audio device: ATI Technologies Inc HD48x0 audio   Subsystem: Hightech Information System Ltd. Device aa30   Flags: bus master, fast devsel, latency 0, IRQ 51   Memory at fe7ec000 (64-bit, non-prefetchable) [size=16K]   Kernel driver in use: HDA Intel   Kernel modules: snd-hda-intel   Running the AlsaMixer, I've made sure that nothing is muted and volumes are up. I've tested the speakers with a different computer, sounds fine. Per Ubuntu's HDA intel instructions, I've also dinked around with               /etc/modprobe.d/alsa-base.conf      And that's where I hit a wall. AL892 doesn't show up in the list. And that may be my problem. My hardware may simply not be supported anymore (although it was previously). That would be a real kick in the pants. I'm no guru by far. I'm pretty much bumbling about reading forums and trouble- shooting sites, trying to piece together what's supposed to be happening. So any advice you guys have would be appreciated. **Resolution:**   While I'd like to say I figured this one out, I switched to Xubuntu, sound worked by default, and called it a day. Gnome3 looked interesting, but xfce runs fine.


title: Why doesn't 'which ruby' output anything?

text: On Debian 6, I uninstalled Ruby 1.8 and installed 1.9.1. Now if I run `which ruby` it doesn't output anything. Why can't it find ruby anymore?


title: shell script construct array for file elements

text: I have a file named input_file which contains some lines. I need to remove certain characters in the line and store them in an array. So to remove the characters, I use the sed command and storing in a variable as below.                           all_values=$(sed 's/^[^.]*\. //' < input_file)                 echo "$all_values"      It is working perfectly fine but I need `all_values` to be an array so that `all_values[0]` will contain the first line and `all_values[1]` the second line and so on. Since I have a file, I do not know the total array elements before hand. How can I construct an array for my case? EDIT: My input file is like below.               This is first element     This is second element     Though spaces, I should be one element


title: Is there a way to circumvent normal installation proceedures and manually install (M1400 Motion Computing Tablet)

text: ### TLDR version   * **Can I install Linux by booting the Live CD and then doing a dd if=/ of=/dev/hda?**   * **Can I somehow install Linux by copying files off of the installing ISO directly onto the harddisk drive?**   * **It seems that traditional ways of installing aren't working for me, what are my alternatives** * * * ### Background I recently purchased a `Motion Computing M1400` machine and I'm having a hard time installing an OS on it. I've tried the following OSes:   * `Puppy Linux` - Live Boots, but isn't the OS I want   * `Crunchbang` - I get installation boot options, but neither the livecd or installation commands work   * `Debian` - I can't get to the boot option screen   * `Android on x86` - I can live boot, but can't install.  Ideally my *goal is to dual-boot `Crunchbang` and `Android`, but I can settle for `Debian`. (Even a RH based OS) The machine doesn't have a CD or Floppy (without firewire), but it boots from USB. I've tried putting the install ISO on the USB with varying success, the closest I've gotten so far is using `unetbootin` to do the dirty work as other methods (cp .iso dev/sda1) haven't been as fruitful. I've tried installing it via a different laptop but the hard drives are not of the same interface so I have to plug the hard disk through the usb. For some reason I haven't been able to install it that way. * * *   * **Can I install Linux by booting the Live CD and then doing a dd if=/ of=/dev/hda?**   * **Can I somehow install Linux by copying files off of the installing ISO directly onto the harddisk drive?**   * **It seems that traditional ways of installing aren't working for me, what are my alternatives** * * * ## UPDATE I've tried installing a large variety of Distributions and perhaps my results may interest others. Sometimes burning them to CDs worked better than usb, but most of the time usb worked when it worked. **Successfully booted, Pen works out of the box** :   * bodhi 2.4.0   * Knuppix 7.2.0 **Successfully booted (sometimes vga port)** :   * JoliOS 1.2   * CorePlus   * Lucid Puppy 528.005   * Slacko Puppy 5.6   * Momonga 7   * Gentoo Minimal Install (No Gui) **Unsuccessful** :   * Haiku Alpha 4   * Centos 6.4   * Otakus 2   * MidnightBSD   * Berry 1.17   * Debian 7.1.0   * Kubuntu 12.04   * Ubuntu 12.04/13.04   * Seawolf (Redhat) 7.1   * Fedora 19   * Artistx 1.5   * Linux Mint 201303 (DEB)   * OpenSuse 12.3 Live DVD   * Arch Linux 2013.10.01


title: Hide a file extension using Terminal

text: I have about 40 files in my folder. I selected all the files and pressed command+I. Instead of opening one Get Info window, my Mac shows up 40 windows! Is there a terminal command to hide the file extension from being shown when I open this folder in Finder the next time?


title: Can not execute restart networking service on Ubuntu 14.04

text: I use `Ubuntu 14.04 LTS`, I try type `sudo /etc.init.d/networking restart` but no output's displayed and no action excuted.


title: upgrade xdebug without using apt?

text: I'm running debian 5.0.6 and have installed xdebug 2.0.3 via aptitude. Now I want to install PHPUnit, and when trying to do it through pear, I get the error that PHPUnit wants a more recent xdebug               phpunit/PHPUnit requires PHP extension "xdebug" (version >= 2.0.5), installed version is 2.0.3      Looking at the debian site, I don't see a package for 2.0.5. Is it safe to try upgrade xdebug outside of the apt system? I'm not entirely clear on how these things ( php, apache2, and xdebug ) are interrelated, and I don't want to break things and have downtime. My rough guess would be that I would build xdebug 2.0.5 and then restart Apache. If I go it alone, is aptitude going to trip up on that later, when an xdebug package comes out?


title: Why don't Page U/Down, Home/End work in less on Solaris over ssh from Ubuntu?

text: I need to work on a Solaris server over ssh from my Ubuntu (Lucid) laptop. I got Home/End Insert/Delete Page Up/Down working in csh and bash using bindkey and ~/.inputrc, respectively. But I can't figure out how to get them working in less. How can I figure out what the problem is, and fix it?


title: Can bash case statements cascade?

text: I'm trying to do something like this:               case $level in         3)             echo "Level Three"              2)             echo "Level Two"              1)             echo "Level one"             ;;     esac      where if $level = 3, it would output               Level Three     Level Two     Level One      while if $level = 1, it would output only               Level One      But when I try it, I get the error `syntax error near unexpected token ')'` because I didn't include the `;;`. Every other language I know of allows this, is there a way to do it in bash? Some sort of keyword that means "now go on and do the next case as if it matched"?


title: Run daemon on startup in Fedora 13 after wireless interface is up

text: I want to have `radvd` (the IPv6 router advertisement daemon) run on startup on Fedora 13. However, the network interface that it will use must be up, otherwise the daemon won't start. If I run the daemon manually when the system is running everything works fine. However, I can't figure out how to tell the Fedora 13 init system "run radvd on boot but **only after** wlan0 is up". wlan0 is managed by NetworkManager and it would be nice if I could keep it that way. I tried enabling `radvd` on boot using the GUI `system-config-services` tool; then `radvd` tries to start in the boot process (after NetworkManager) but fails because wlan0 does not exist. I also tried changing `ONBOOT=no` to `ONBOOT=yes` in `/etc/sysconfig/networking/devices/ifcfg-wlan0` but that also didn't help (I don't understand exactly how the configuration in `/etc/sysconfig/networking/` interacts with NetworkManager). It seems to me that this kind of thing should be straightforward with Upstart but I can't find an Upstart event that tells me "a network interface is up".


title: Mount windows Users directory as /home in linux virtual machine

text: I'm setting up a laptop for a friend and I'm going to put linux on it in a virtual machine and I want to make it as seamless as possible. I've mounted the \Users\Username directory in a VM before and that's not the hard part. What the issue is though is that Windows uses NTFS links from say My Documents to \Documents which linux can't see (or at least doesn't display). My question is what would be the best way to share a user's /home directory with their \Users directory? Is there an easy way to remove all those links and force windows to not use links to their \Users\whatever directories? Or my second thought would be to just mount it as a samba share and let the samba file system take care of all that stuff. Is that a better solution? The goal here is that I want to make using the linux machine as seamless and painless as possible.


title: What is the recommended way of setting a default IO scheduler on Linux?

text: I would like `deadline` to be the default IO scheduler for my system, and I don't want to lose that config when I reboot. What is the proper way of doing that? (I'm using Debian) Some hints:   * have a startup script doing `echo deadline >| /sys/block/sda/queue/scheduler`,   * use the kernel parameter `elevator=deadline` on GRUB startup config,   * use a `udev` rule like `SUBSYSTEM=="block", ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/scheduler}="deadline"`,    * etc.  What is the "preferred" solution? **EDIT:** can I have a configuration which set the iosched to `deadline` only for drives present at bootup, but not for subsequent hot-plugged drives (like USB keys)?


title: What do the three values mean on network monitoring tools

text: Often in network monitoring tools there are three values for one measure. Ex               rx: 2.0 kb/s 40 kb/s 10 kb/s      Are these similar to how cpu load works, they are taken at different length time spans. So one is every two seconds, then four seconds.. Thanks in advance. One example program would be iftop.


title: Having a bash script run at startup and display the results when I log in

text: I am running Ubuntu 11.04 and I want to be able to run a command like top so when I login it is running in a window. I been trying many things for a while now and can't seem to get it to work I added entries in the control panel under start up programs, but that didn't seem to work. I tried both having a script run, and actually typing the command, but neither was successful. Thanks in advance :-)


title: perl regex replacing globally when global not selected

text: I'm using Ubuntu 11.04 and wrote a small script that searches within text files for certain "tokens" and replaces with some a prewritten snippet from a template file of the same name. The text files that are being searched will have two and only two instances of each token. The first is a plain text and the second is an html version, and there are separate snippets for each. Here's the script:               for f in `ls -1 .templates/template_text`;     do         g=`cat .templates/template_text/$f`         find to_process/ -type f | xargs perl -i.old -p -e "s/$f/$g/";     done          for f in `ls -1 .templates/template_html`;     do         g=`cat .templates/template_html/$f`         find to_process/ -type f | xargs perl -i.old -p -e "s/$f/$g/g";     done      I'm running into a problem where even when I don't have "global" specified in the first regex, it still replaces both tokens. I'm not sure if this is because of how I'm calling perl, a bug, or some other issue. Any help would be appreciated. UPDATE: I was able to get the script working by using sed instead of perl.               for f in `ls -1 .templates/template_text`;     do         g=`cat .templates/template_text/$f`         h=`cat .templates/template_html/$f`         find to_process/ -type f -print0 | xargs -0 -I {} sed -i -e "0,/$f/s/$f/$g/" -e "0,/$f/s/$f/$h/" {}     done      Still interested in how to get it working with the perl command though.


title: Is it possible to use variables in count braces in Bash?

text: I'm searching for a solution to a Bash 4 problem I have. Bash 4 is able to iterate with leading zeros. For the line:               for i in {001..005}; do echo -n $i" ";done;echo      the output is               001 002 003 004 005      but when I try this:               a="005"; for i in {001..${a}}; do echo $i;done      or something similar, the result is:               {001..005}      What am I missing?


title: Use logrotate to store 7 daily, 4 weekly and 12 yearly db backups

text: I've been trying to use logrotate to store a database backup for:   * last 7 days (daily)   * last 4 weeks (weekly)   * last 12 months (monthly) I've done a logrotate script like this, but only the daily rotations are done. What I am missing or doing wrong? Is the date format *' _weekly_ '* string breaking the script? If so, how can achieve to set a distinctive name to each type of rotated file? For example using _'extension .week'_? _Note: I've used the prerotate and postrotate on weekly and monthly rotations to create a dummy file to check if these are beeing executed, but the files are never created._ _Note 2: the file /backups/db.sql is created correctly_               #daily (son)     "/backups/db.sql" {             daily             rotate 7         missingok         copy         compress     }          #weekly (father)     "/backups/db.sql" {             weekly             rotate 4         missingok         copy         dateext         dateformat _weekly_%Y-%m-%d.         compress         prerotate             touch /backups/weekly_pre.txt         endscript         postrotate             touch /backups/weekly_post.txt         endscript     }          #monthly (grandfather)     "/backups/db.sql" {             monthly             rotate 12         missingok         copy         dateformat _monthly_%Y-%m-%d.         compress         prerotate             touch /backups/monthly_pre.txt         endscript         postrotate             touch /backups/monthly_post.txt         endscript     }      If I execute logrotate manually with               logrotate -d /path/to/logrotate_job      I get               # logrotate -d /path/to/logrotate_job     reading config file logrotate_job     reading config info for "/backups/db.sql"     error: db_backup:11 duplicate log entry for /backups/db.sql     error: found error in "/backups/db.sql" , skipping     removing last 1 log configs          Handling 2 logs          rotating pattern: "/backups/db.sql"  after 1 days (7 rotations)     empty log files are rotated, old logs are removed     considering log /backups/db.sql       log does not need rotating          rotating pattern: "/backups/db.sql"  1048576 bytes (no old logs will be kept)     empty log files are rotated, old logs are removed      It seems that the same file cannot be rotated, so how can rotate the daily file if its name includes the date? Trying to set in weekly task: nodate prerotate cp dailyrotated to dailyrotated.week And setting in monthly nodate prerotate cp weeklyrotated to weeklyrotated.month


title: Restore os-prober script in /etc/grub.d

text: I accidentally removed `30_os-prober` script in the directory `/etc/grub.d`. How can I restore it without reinstalling Grub? I didn't find any manual or command list for `os-prober`. I'm on ArchLinux 3.10.25 x64 and use Grub 2.00.1282.


title: How to customize or reprogram function of specific keys on my keyboard and the LED on my laptop

text: When I disable bluetooth on my laptop, the light does not go off and the blinking of the Wi-Fi LED is starting to bother me. Since I sometimes use my laptop in a poor lighting condition an illuminated keyboard would be pretty cool. I am seriously considering to make some modification to my laptop and due to its location, I think that the LED from Wi-Fi, capslock and power would be sufficient to provide enough amount of light for my occasional glances to my keyboard. And while I find it challenging, the following are my attempts to frame the questions:   * Where can I find resources to study & explore the possibility of reprogramming the function of certain specific keys? For instance, I would like to be able to press `CapsLock` and `Return` on my keyboard to activate certain LED to be used to slightly illuminate my keyboard.   * Are there any command line ways to identify the simple output such as LED that are comparable to the `ls` command? I suspect that it can't be too far off from how the machine talks to the fan or the heat measurement done quite gracefully.   * Is there any simple or awesome hack to give my keyboard a back light? The USB led light that I've been using almost damaged my USB port on several occasions and solving this would give me peace of mind while providing a good excuse for me to get ever more up close and personal with my Linux. This is sort of a continuation of my previous question (http://askubuntu.com/q/409306/228497) as they are some of the things that have been tickling my curiosity.


title: bash howto script - if no answer or mutliline answer

text: I have a script, that reads some input `foo`, and based on that input tries to calculate the value for the variable `bar`. If it is successful, then it shall set `bar`. If not, the user should be able to input that value for `bar` manually. Currently I have:               read foo     bar=$(some manipulation with foo)     if [ $bar ]     then        echo $bar     else       read bar     fi      The problem I'm experiencing is that in some cases I get more than a single word answer back from the manipulation of foo. I know I could work around that with quotes or the new test, but that's not what I want. I'd like that if `some manipulation with foo` returns multiline output, that it asks to set `bar` manually. The same reaction as to no answer. How would I do that?


title: Remove Linux shell script stuck

text: This script should remove the contents of the dustbin directory. If the `-a` option is used the script should remove _all_ files from the dustbin. Otherwise, the script should display the filenames in the dustbin one by one and ask the user for confirmation that they should be deleted.               if test ! -f ~/TAM/dustbin/*     then       echo "this directory is empty"     else       for resfile in ~/TAM/dustbin/*        do         if test -f $resfile ; then           echo "Do you want to delete $resfile"           echo "Y/N"           read ans           if test $ans = Y ; then              rm $resfile             echo "File $resfile was deleted"           fi         fi       done     fi      The above is working, however it causes a few errors to be reported _even_ though it still carries out the code on the next line after the error without crashing. Errors:               ./remove: line 4: test: to many arguments      (This happens when there are more than 2 files in the dustbin.)               ./remove: line 4: test: root/TAM/dustbin/NewFile2: binary operator expected      (This happens when the file is newfile2 but not newfile3.) Also does anyone have any input on how I could do the `-a` to delete everything in the folder without asking about each file separately?


title: unable to connect ftp in pasive mode

text: I'm try to connect to ftp which I've just configured but using FileZilla, I'm getting the following logs               Status: Connecting to x.x.x.x:21...     Status: Connection established, waiting for welcome message...     Response:   220 (vsFTPd 2.3.5)     Command:    USER huntsnap     Response:   331 Please specify the password.     Command:    PASS ********     Response:   230 Login successful.     Command:    OPTS UTF8 ON     Response:   200 Always in UTF8 mode.     Status: Connected     Status: Retrieving directory listing...     Command:    PWD     Response:   257 "/home/my/home/dir"     Command:    TYPE I     Response:   200 Switching to Binary mode.     Command:    PASV     Response:   227 Entering Passive Mode (10,38,106,212,248,2).     Status: Server sent passive reply with unroutable address. Using server address instead.     Command:    LIST     Error:  Connection timed out     Error:  Failed to retrieve directory listing      I've configured `vsftpd` on Ubuntu server, don't know whats wrong with it. vsftp.conf File               listen=YES     anonymous_enable=NO     local_enable=YES     write_enable=YES     local_umask=022     dirmessage_enable=YES     use_localtime=YES     xferlog_enable=YES     secure_chroot_dir=/var/run/vsftpd/empty     pam_service_name=ftp     rsa_cert_file=/etc/ssl/private/vsftpd.pem     userlist_file=/etc/vsftpd.userlist     userlist_enable=YES     userlist_deny=NO     local_root=/home/to/my/home/     dirlist_enable=YES     download_enable=YES


title: Command line prediction

text: I've found an interesting paper: _Predicting UNIX Command Lines_ about command-line prediction (based on user past activity), and I wonder if any actual implementation of such thing exists?


title: Colourful terminal or console?

text: I love colors in my console, and I wonder if there is any way to get a terminal (I guess only a software is able to do that) printing almost everything in colors. Of course there is the `\--color=auto` things, but it works for a few commands (`ls`, `grep`...?). What I would want, is something way more colorful, that works also for commands that are not made to use colors, I don't know if it's possible. For instance, there is MobaXTerm for Windows (something like Cygwin) which uses a lot of color. Of course it's not only a terminal, but a complete software (another layer)... maybe it's the only way to get something seriously colorized? Any clue would be really appreciated.


title: rsync options to include only simple files

text: We intend to use a cron task to rsync files from one machine to another. Requirements are simple:   * File source is exactly one directory, and destination is one directory on the target machine   * Must allow only simple files, no symlinks, no directories   * And absolutely, positively no possibility of the transfer creating files anywhere else in the destination file system besides the intended directory. Problem is, the description of options for rsync are mind-boggling, and not only do some options change the effect of others, but even the order of the options is important. (AaacK!) **Can anyone please help describe a set of rsync options that will only allow transferring simple files between specified source and target directories?** We even know the names of the files in advance if that's helpful or could make the process more secure. Is it overkill to use the filter option for this?


title: Hiding encryption key in unpartitioned free space of SSD

text: Anyone know what can happen if we use the unpartitioned space of an SSD hard drive to hide some data, what would happen? I have read that there are some SSD firmware using these blocks for recycling (TRIM). If so hidden data would be lost. Could someone explain what would happen with the hidden data? Regards.


title: Why don't I need to escape a character class in sed but I need to escape the rest?

text: I am confused with sed.   I had a file with the following contents:               [ 2014/02/10 14:45:15 | INFO   ] Saving data for customer: 273667       [ 2014/02/10 14:45:15 | INFO   ] Saving data for customer: 273687       [ 2014/02/10 14:45:15 | INFO   ] Saving data for customer: 272667       [ 2014/02/10 14:45:15 | INFO   ] Saving data for customer: 373667       [ 2014/02/10 14:45:15 | INFO   ] Saving data for customer: 573667       [ 2014/02/10 14:45:15 | INFO   ] Saving data for customer: 263667        I wanted to remove everything except the customer id. So I run the following:               $ sed 's/^.*:\s\(\[0-9\]\{6\}\)/\1/g' customers.txt > customers2.txt        This did not do absolutely anything.   After thinking about it (and a lot of frustration) I tried to remove the escapes from the `[]`. So I run the following:               $ sed 's/^.*:\s\([0-9]\{6\}\)/\1/g' customers.txt > customers2.txt          This worked.   But now I can not really undestand how sed works. Why do I need to escape `(` for grouping and `{` for range but not `[` for the character class?


title: Linux Fedora Core 18 freezes on OpenSSH login

text: miagos:~ $ uname -a     Linux miagos 3.9.6-200.fc18.x86_64 #1 SMP Thu Jun 13 18:56:55 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux I have a reproducible issue, when my desktop Linux node stays online for more than ~24 hours and any attempt to `ssh` or `scp` login, the node just freezes.. no response at all, keyboard, mouse, IP stack halted, no ping response etc.. all frozen and requires a hard reboot. This only happens anytime after ~24 hours uptime; after a reboot there is no login issue. After reboot, around ~24 hours later, `ssh` will ask for my password and only after inputting correct password (attempting to spawn a shell) the machine locks up, a failed password re-asks as normal and an SSH session that does not open a terminal (strictly for Dynamic forwarding) works without lockup within the bug period. Now I really want to know how to place the node in some type of DEBUG (Kernel or Openssh?) setting to get a clue as the logs (via `journalctl`) doesn't display anything useful before lockup.


title: How do I create a local copy of a complete website section from OSX using wget?

text: This question follows from: How do I create a local copy of a complete website section from OSX using curl? After discovering OSX's native curl wouldn't do this task I downloaded wget from here: http://www.techtach.org/wget-prebuilt-binary-for-mac-osx-lion But performing:               ./wget -r -l 0 https://ccrma.stanford.edu/~jos/mdft/      takes hours and installs a ton of other stuff I didn't want that ISN'T contained in this folder: http://cl.ly/ENKr Moreover opening a particular page, many of the images are missing: http://cl.ly/ELXG This may be because I aborted the transfer after a few hours(!) How do I do this properly?


title: wireless enabled but can't browse internet

text: My laptop sees wireless ssid and connects but I get unknown host when trying to ping www.google.co.za, but I get replies when I ping 8.8.8.8, my other machine connected to the same router can surf the net no problems. I have tried adding nameserver but the laptop keeps loosing the configurations every now and then. Please help! `/etc/resolf.conf` after I added `nameserver 8.8.8.8` by hand:               # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)     # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN     nameserver 127.0.0.1


title: Does find support OR in its regexes?

text: For example, I want to find all files in a directory that end in 'm' or 'sh'. The following works correctly:               find . -regex '.*.m' -o -regex '.*.sh'      But this fails:               find . -regex '.*.(m|sh)'      What am I doing wrong?


title: Bluetooth LE scan as non root?

text: To perform a scan for bluetooth LE devices _hcitool_ apparently requires root privileges. For normal users the output is following:               $ hcitool lescan     Set scan parameters failed: Operation not permitted      Why does _hcitool_ need root privileges for a LE scan? Is it possible to somehow perform a LE scan as non-root?


title: Is highmem relevant in 64 bit Linux? If not, why?

text: Somewhere on the web, I read that 64bit Linux kernels do not have a highmem issue. I did not find any explanation/detail as to how/why it is not an issue. Can somebody explain?


title: Archlinux mute sound in browser only

text: Is there a way how to mute all sounds in browser only? I need it to be done from command line. I'm currently using alsa mixer for mute (command `amixer set Master toggle`), but I can't find any way how to mute browser and not the other apps.


title: ProxyCommand without socat, nc or Bash's TCP redirection?

text: `ssh_config`'s `ProxyCommand` allows to establish some connection to a proxy prior to establishing the connection to the actual target machine. Simple question: how can I leverage the dynamic or SOCKS proxy functionality _built into`ssh`_ such that I don't have to rely on `nc` or `socat` to be installed and TCP redirection to be compiled into the installed Bash? I have literally only found examples of the above all over the web.


title: How do I execute a remote shell script over SSH and be prompted for passwords by commands that require it in that script?

text: I want to do something like this               ssh user@remote-domain.com ./remote_script.sh      Contents of remote_script.sh               #!/bin/bash     hg pull      This example is much simpler than what I am actually doing. I know I can pass shell commands directly over ssh, but assume I want to run a remote script. Also I know Mercurial has hooks, but ignore that as well, I am only using Mercurial as an example here for brevity. This is what I expect to happen, a password prompt for the user:               user@repository-domain.com password:       This is the output:               ssh user@remote-domain.com ./remote_script.sh     remote: Permission denied, please try again.     remote: Permission denied, please try again.     remote: Permission denied (publickey,password).     abort: no suitable response from remote hg!      The remote shell session seems to be feeding something to the password input prompts and failing after 3 automated tries. I would really like the prompt to reach my local shell session. Perhaps that isn't possible. I don't want to give the remote server key authentication to the repository, I'd prefer the user be prompted each time. Is there any way to do this?


title: How to run a command without hitting Enter Key?

text: Accidently I mapped `Enter` via `xkbset` to `Pointer_button2`. Now every time I hit `Enter` some gibberish text appears. I thought of a workaround involving remapping it back, but that means I will have to run a command `xmodmap -e "keycode 135 = Pointer_Button2"` (or any other keycode but that of `Enter`). But I'm not able to run this command in terminal, without hitting `Enter`. How do I do so? I'm running Ubuntu 12.04.


title: Mounting USB camera on Ubuntu

text: I am quite new at Linux and I have to install this SwissRanger camera on Ubuntu. I am trying to follow their USB mounting instructions and I got stuck. From the instructions:               Modify the usbdevfs entry in /etc/fstab         by setting devmode appropriately, for example:     usbdevfs  /proc/bus/usb  usbdevfs  devmode=0666,noauto 0 0      I am not sure how to obtain the usbdevfs program, and also after which, does it automatically mean that the camera will be automatically mounted everytime I plug in the USB? Edit: There is no direct web-link, it is in a folder after running libmesasr- dev-1.0.14-706.i386.deb under the webpage http://www.mesa- imaging.ch/drivers.php


title: Replacing lines containing a pattern with sed

text: How can I replace a given character in a line matching a pattern with sed? For example: I'd like to match every line beginning with a letter, and replace the newline at the end with a tab. I'm trying to do so using: `sed -e '/^[A-Z]/s/\n/\t/g'` (the lines that I'm interested in also ALWAYS end with a letter, if this can help). Sample input               NAME_A     12,1     NAME_B     21,2      Sample output               NAME_A    12,1     NAME_B    21,2


title: Display the command being executing currently

text: I don't recall to have explicitly placed anything in my `.bashrc` file recently, but from yesterday I am able to see the command being displayed at the prompt before getting executed. I don't know how it got switched on and when? ### Example               $ ls *abc*     ls *abc*  # ---> This line is getting displayed for every command, same command as it is     abc.txt temp_abc.c     $ pwd     pwd       # ---> This line is getting displayed for every command, same command as it is     /home/mtk/temp/      My bash details               $ bash --version     bash --version     GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)     Copyright (C) 2005 Free Software Foundation, Inc.      It's weird and doesn't seems to be of much use. But I would like to know how to turn this feature on and off? What command/setting does this?


title: How to run just linux kernel in vmware?

text: I am VERY new to Linux and am wondering if you can just boot the Linux kernel by itself or does it absolutely HAVE to be apart of an operating system. My reasoning behind wanting to do this is so that I can learn Linux from the beginning, when it first started. I have a copy of the source code for the kernel version 0.01. I want a VERY minimal version of Linux just so I can learn a little at a time. I have messed around with a few distros, but I have not messed with command line.


title: How much swap space should I use?

text: What rules should I follow to determine how much swap space my linux-based computer should have today?


title: How to compile c, c++ and python code as "Released/Final" version?

text: I want to know if there are ways to compile C, C++ and Python code in order to not be able to reverse engineering it over Linux or not? I have heard there are some ways over Windows to do it, but I am working on Linux. I want to compile my code securely, as released or final version. **UPDATE** At least I want to make it hard for usual users to disassemble, I am using GCC for C and C++, also I would be thankful if you introduce me best compiler for Python.


title: Creating a Virtual filesystem to boot linux

text: I am trying to boot the linux kernel (bzImage) in QEMU but have had issues. After asking on U&L I found out that my problem was that I was booting the kernel without a filesystem to boot from. So how can I create a VFS to boot the kernel image?


title: How to troubleshoot kernel panic on boot

text: I'm trying to run Debian Linux on a Nokia IP710 firewall, but I can't get it to boot correctly: kernel panic every time. The firewall has a Pentium III 1Ghz and 512MB RAM. It has no vga, a very limited bios (ie no pxe/netboot), and no cdrom drive nor usb ports. Its operating system was Nokia IPSO, based on FreeBSD. IPSO was booted from a 32MB CF card on which there was the bootloader, and the OS was on the 40GB hard drive. I installed Debian (Wheezy) from within qemu on a 4GB compact-flash, and later on a hard drive with a 32MB as /boot. Both OS works fine when booted within qemu or on a x86 thin-client. However, they crash at each boot on the firewall with those logs:               [    2.676304] BUG: unable to handle kernel paging request at ffff8000     [    2.680166] IP: [<c1010aec>] io_apic_write+0xb/0x13     [    2.680166] *pde = 01442067 *pte = 00000000      [    2.680166] Oops: 0002 [#1]      [    2.680166] Modules linked in:     [    2.680166]      [    2.680166] Pid: 1, comm: swapper Not tainted 3.2.0-4-486 #1 Debian 3.2.32-1       [    2.680166] EIP: 0060:[<c1010aec>] EFLAGS: 00010086 CPU: 0     [    2.680166] EIP is at io_apic_write+0xb/0x13     [    2.680166] EAX: ffff8000 EBX: 00000031 ECX: 01000000 EDX: ffff8000     [    2.680166] ESI: 01000000 EDI: 0001a929 EBP: 00000002 ESP: dec2dea0     [    2.680166]  DS: 007b ES: 007b FS: 0000 GS: 00e0 SS: 0068     [    2.680166] Process swapper (pid: 1, ti=dec2c000 task=dec1ec00 task.ti=dec2c000)     [    2.680166] Stack:     [    2.680166]  00000010 00000002 c1010b5f 00000246 0001a929 01000000 c1010b95 0001a929     [    2.680166]  01000000 00000010 66858080 dec2df20 c1315489 00000010 c1011974 0001a929     [    2.680166]  01000000 00000001 00000000 00000002 0001a929 01000000 c1448d44 00000010      and after the call trace:               [    2.680166] EIP: [<c1010aec>] io_apic_write+0xb/0x13 SS:ESP 0068:dec2dea0     [    2.680166] CR2: 00000000ffff8000     [    2.680166] ---[ end trace 6f619dcb164ee6d0 ]---     [    2.680206] Kernel panic - not syncing: Attempted to kill init!     [    2.684175] Pid: 1, comm: swapper Tainted: G      D      3.2.0-4-486 #1 Debian 3.2.32-1      I also tried kernel 3.2.35, with the same result. There is also a bunch of PCI-related error messages:               [    2.467037] pci 0000:00:02.0: address space collision: [mem 0xff000000-0xff03ffff pref] conflicts with 0000:00:01.0 [mem 0xff000000-0xff03ffff pref]     [    2.488165] pci 0000:04:06.0: no compatible bridge window for [mem 0xff000000-0xff03ffff pref]     [    2.620180] pci 0000:00:03.0: enabling device (0000 -> 0003)     [    2.624179] pci 0000:00:03.0: can't find IRQ for PCI INT A; probably buggy MP table     [    2.628186] pci 0000:00:03.1: enabling device (0000 -> 0003)     [    2.632174] pci 0000:00:03.1: can't find IRQ for PCI INT B; probably buggy MP table      And 512 of these messages (with pin 0-255, twice):               [    1.172083] Unable to reset IRR for apic: 255, pin :3      I'd like to know how to troubleshoot these crashes. Most of the documentation I've read (like `Documentation/oops-tracing.txt`) does not mention the case when the kernel crashes at boot. The full bootlog saved from console is here. **Edit:** As per @jordanm suggestion, I ran memtest overnight (11hours). It went fine without any errors:                     Memtest86+ v4.20      | Pass100% #######################################      Pentium III 999.6MHz        | Test 81% ###############################              L1 Cache:   16K   9342 MB/s | Test #8  [Modulo 20, Random pattern]                L2 Cache:  256K   4253 MB/s | Testing:  196K -  512M  512M               L3 Cache:       None        | Pattern: ab46c0e3-17        Memory  :  512M    406 MB/s |-------------------------------------------------     Chipset : CNB20HE (ECC : Detect / Correct) Scrub+                 WallTime   Cached  RsvdMem   MemMap   Cache  ECC  Test  Pass  Errors ECC Errs      ---------  ------  -------  --------  -----  ---  ----  ----  ------ --------       11:06:12    512M       0K    e820      on   off   Std     9       0      -----------------------------------------------------------------------------


title: After running screen, screen doesn't seem to be running

text: I use ssh to log into a remote machine and then I use the `screen` command to create a virtual screen. Now, if I type in `exit` normally I should only exit the screen and return to the remote ssh terminal but the reality is the `exit` command exits the ssh and I return to the local terminal. Why? Besides, if I run a program/process in the virtual screen, I can't use `C-a d` to return to the remote ssh terminal, it just echoes back `^A^A^A^A^A^A^A^A^A^A^A^A^A^`, and doesn't return to the remote ssh terminal.               root@remote_lab:/home/esy# time bash test.sh  2>&1|cat > temp      What could be going wrong?


title: Is there a way to "stabilize" past built unstable Gentoo binary packages without rebuilding?

text: Here's the scenario:   * build some ~amd64 package versions on your binhost   * later those same package versions go stable in portage, so no version bumps involved   * even if packages are listed stable in portage, binhost clients still see binpkg metadata saying package is ~amd64 I want to avoid rebuilding whole packages basically just to toggle the stability keyword. Looking for some script, tool, oneliner that can take care of the whole package database in cron runs or manually.


title: where is this HOME environment variable and what do I have to add -H too it?

text: I recently attempted to run a boot up script which failed I didn't know why it failed so I posted a question about that here. chkconfig bootup script failing, script runs good manually Where the user schaiba suggested I add `>> /tmp/test.log 2>&1` at the end of my start up script to log and figure why it doesn't start. I realized that it has the following problem. > sudo: sorry, you must have a tty to run sudo failed I looked in my script and found this line, pretty much the important line that starts up my java program. (which is the `$cmd`)               javaCommand="java"                                         # name of the Java launcher without the path     javaArgs="-classpath .:recaptcha4j-0.0.8.jar:mysql-connector-java-3.0.17-ga-bin.jar ChatServer"                     # arguments for Java launcher     javaCommandLine="$javaCommand $javaArgs"                       # command line to start the Java service application          cmd="nohup $javaCommandLine >>$serviceLogFile 2>&1 & echo \$! >$pidFile"             # Don't forget to add -H so the HOME environment variable will be set correctly.        sudo -u $serviceUser -H $SHELL -c "$cmd" || return 1      When looking what to do with that error about sudo failing.. Lots of solutions state I should disable the Defaults `require-tty` in `etc/sudoers` which another article wrote would give me a security vulnerability where SSH users could see my root password, even though SSH already logs in root haha, anyways I don't want to disable any security. My guess is I need to add that -H to some Home environment variable which I have no idea what that means anyone know what I have to do there? Also `$SHELL` variable isn't found anywhere in the script, `$serviceUser` is another word for `root`.


title: route add no longer works when I connected to VPN via cisco anyconnect client

text: When I connected to a VPN server via `Cisco AnyConnect` client, my virtualbox routing information is gone.               # route     Kernel IP routing table     Destination     Gateway         Genmask         Flags Metric Ref    Use Iface     default         *               0.0.0.0         U     0      0        0 cscotun0     default         172.21.157.1    0.0.0.0         UG    256    0        0 eth0     172.23.36.90    172.21.157.1    255.255.255.255 UGH   0      0        0 eth0     172.23.236.0    *               255.255.254.0   U     0      0        0 cscotun0      Then I tried to restore it via:               # ip route add 192.168.56.0/24 via 192.168.56.1 src 192.168.56.1      The command succeed without error, but from `route` command it doesn't add anything               # route     Kernel IP routing table     Destination     Gateway         Genmask         Flags Metric Ref    Use Iface     default         *               0.0.0.0         U     0      0        0 cscotun0     default         172.21.157.1    0.0.0.0         UG    256    0        0 eth0     172.23.36.90    172.21.157.1    255.255.255.255 UGH   0      0        0 eth0     172.23.236.0    *               255.255.254.0   U     0      0        0 cscotun0      Any ideas? I've configured apparmor to block vpnagentd from running either iptables or modprobe command, if that's related.


title: Run a php file as service?

text: I created a .sh file and it is email.sh In this email.sh file I have these lines               #!/bin/sh     php /home/username/public_html/Worker.php      Now, I want to make that email.sh as a startup service in the server and this script always in the background of my Centos server. Can you please help me how to do this?


title: Map physical USB device path to the Bus/Device number returned by lsusb

text: I need to get the title of the attached USB device. I can do that with `lsusb`. udev allows some substitutions when I write rules: say, we can use `$kernel` to get name of the device, or `$devpath` to get path to the device. But problem is that `lsusb` returns string like that:               Bus 005 Device 032: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC      But udev's devpath is:               /devices/pci0000:00/0000:00:1d.0/usb5/5-2       Bus number is the same (`5`), but numbers are different: `Device 032` seems to be some logical number (when I reattach the device, this number increases), and `2` seems to be physical device number. So udev returns physical number, and I need to get logical number. Then, i can retrieve data like this: `lsusb -D /dev/bus/usb/005/032` So, how can I get logical device number `032` by physical path like `/devices/pci0000:00/0000:00:1d.0/usb5/5-2` ?


title: mouse in midnight commander works only under root

text: I posted a question a little time ago about mouse that doesn't work with terminal, and then I remarked that mouse works fine, but only under root. Can I change this behavior? It seems i need to _recompile_ kernel to enable support mouse for ordinary users in terminal, how to do this?


title: How to automatically mount remote directories on login / startup

text: Everytime I boot, I use `sshfs` to mount remote directories. I am thinking to put these short commands in my .bashrc, but that does not seem to be The Right Way™. What is the proper way to run `sshfs` on login?


title: How to stream h264 video from web-cam to network?

text: I have a web-cam which I want to use to stream h264 video. Now I'm streaming mjpg video with mjpg-streamer. And now I'd like to stream h264. I've found that it could be done with gstreamer, but I'm totally new to it. Also after reading some blogs/articles/etc it seems to me that there were some issues with h264 and gstreamer. Is it still true? May be there are some other methods to do this besides gstreamer? Any info would be helpful. Thanks in advance.


title: Rename multiple directories decrementing sequence number?

text: I have a directory which contains a number of subdirectories with names on the format `dir.##`. The prefix is always the same, and the suffix is 1-3 digits in a strictly incrementing sequence. Thus, something similar to:               dir.0     dir.1     dir.2     dir.3     ...     dir.9     dir.10     dir.11     ...     dir.298     dir.299     dir.300      First, I want to delete the first few such directories. This is trivial. Then, I want to rename all subsequent directories to shift the numerical suffixes such that e.g. `dir.7` becomes `dir.0`, `dir.8` becomes `dir.1`, `dir.10` becomes `dir.3`, etc. That is, shift each suffix (treated as a number) by a given, constant offset. **How do I perform such a rename operation** without renaming each directory separately and manually? I'm okay with using a separate tool for it, but it would be nice if I can do it all in bash without "exotic" software.


title: Bind MetaL in icewm

text: Anybody managed to bind the Windows key in IceWM ? It seems I can't bind it to anything since I disabled the "treat as Ctrl+Alt" option.               #  Treat Super/Win modifier as Ctrl+Alt     # ModSuperIsCtrlAlt=1 # 0/1     ModSuperIsCtrlAlt=0 # 0/1


title: Ctrl-Alt-F1 to F6 work differently for left and right sides of the keyboard

text: If I want to log in to the traditional text shell, I can only use the right side control and alt keys, the left side ones will do nothing. Once I switch to another shell, I now have to use the _left_ ctrl and alt keys if I want to switch back to the graphical shell (or a different text shell). I'm using Fedora 16. What gives?


title: Is there any way to prevent focus being grabbed by another application?

text: I am getting annoyed by windows under X opening and taking focus away from the current window which has focus. This is particularly annoying when you are typing a password into a password dialog and another application steals focus, so some of your keystrokes end up in the new application instead. I've always been irritated by this in Windows, but there's little that can be done about it there, and I can't help but feel that this should be fixable on Unix. I'm currently using Gnome as my desktop environment (on RHEL 5.8) and according to `wmctrl -m` I'm currently using `Metacity` as my window manager. While I would prefer to stick with these default options I would be happy to learn about window managers which _don't_ exhibit this behaviour.