title: Make screen start as Daemon for a Minecraft server

text: I made a script that runs fine manually, but can't get it to run with the description in How to start a script file on boot?. I have run `update-rc.d -f minecraft.start defaults` This is what my `/etc/init.d/minecraft.start` is like               #!/bin/bash     case "$1" in       start)         screen -S minecraft.start /home/phirephoenix/minecraft/bukkitserver/start_server.sh         echo "Server started on screen minecraft"         ;;       stop)         screen -X -S minecraft.start kill         echo "Server shutting down"         ;;       *)         echo "Usage: /etc/init.d/minecraft.start {start|stop}"         exit 1         ;;          esac          exit 0     ~      As the script works, I won't be adding it, since it's the default. And this is my startup log `/var/log/boot.log`               Begin: Loading essential drivers ... done.     Begin: Running /scripts/init-premount ... done.     Begin: Mounting root file system ... Begin: Running /scripts/local-top ... done.     Begin: Running /scripts/local-premount ... done.     Begin: Running /scripts/local-bottom ... done.     done.     Begin: Running /scripts/init-bottom ... done.     fsck from util-linux 2.20.1     /dev/sda1: clean, 66452/4325376 files, 1205648/17301248 blocks      * Starting configure network device [ OK ]      * Starting Mount network filesystems [ OK ]      * Starting Failsafe Boot Delay [ OK ]      * Stopping Mount network filesystems [ OK ]      * Starting Bridge socket events into upstart [ OK ]      * Starting SMB/CIFS File Server [ OK ]      * Starting configure network device [ OK ]      * Stopping OpenSSH server [ OK ]      * Starting OpenSSH server [ OK ]      * Starting NetBIOS name server [ OK ]      * Starting Mount network filesystems [ OK ]      * Stopping Failsafe Boot Delay [ OK ]      * Starting configure network device [ OK ]      * Starting System V initialisation compatibility [ OK ]      * Stopping Mount network filesystems [ OK ]      * Starting SMB/CIFS File and Active Directory Server [ OK ]      * Stopping cold plug devices [ OK ]      * Stopping log initial device creation [ OK ]      * Starting enable remaining boot-time encrypted block devices [ OK ]      * Starting configure network device security [ OK ]      * Starting configure virtual network devices [ OK ]      * Stopping configure virtual network devices [ OK ]      * Starting save udev log and update rules [ OK ]      * Stopping save udev log and update rules [ OK ]     Skipping profile in /etc/apparmor.d/disable: usr.sbin.rsyslogd      * Starting AppArmor profiles [ OK ]      * Stopping System V initialisation compatibility [ OK ]      * Starting System V runlevel compatibility [ OK ]      * Starting ACPI daemon [ OK ]      * Starting save kernel messages [ OK ]      * Starting automatic crash report generation [ OK ]      * Starting regular background program processing daemon [ OK ]      * Starting deferred execution scheduler [ OK ]      * Stopping save kernel messages [ OK ]      * Starting CPU interrupts balancing daemon [ OK ]      * Starting crash report submission daemon [ OK ]      * Starting domain name service... bind9 [ OK ]          **<BIG BLANK AREA RIGHT HERE, DON'T GET IT>**          **[screen is terminating]**     **Server started on screen minecraft**     apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName      * Starting web server apache2 [ OK ]      * Stopping System V runlevel compatibility [ OK ]      It does execute the echo inside start, but it also says screen is terminating. What is causing this problem here? I run Ubuntu Server, it seems `screen` is installed and working. So new approach, using the upstart feature (or what I should call it). I kind of understood the runtimelevel things after some short googeling, and it should now start on one of the four runtimelevels i have set, or stop, on halt/reboot etc. made `/etc/init/bukkit.conf` much like the one warlock made. All the # are added for commenting here, and are not on the actual script.               description     "Bukktiserver"     author          "jthanto@fixedyour.net"          start on runlevel [2345]     stop on runlevel [016]          pre-start script         echo " * Bukkitserver started"         # I don't know if this does anything at all     end script              exec sudo /home/phirephoenix/minecraft/bukkitserver/start_server.sh         # Had to sudo, or else it would get permission denied. Any ideas?      Now I can start the server with typing sudo start bukkit, but it still does not run automaticly. bukkit is in my `initctl list` with `bukkit stop/waiting` (For everyone wondering bukkit is a minecraft server software.) So. I use a .conf to make it a upstart service, want the script to run without me having to do anything (automaticly before any logon). Is there a problem with the actuall jarfile to be run is in my homefolder? I can't really remember if my homefolder is encrypted or not, but it might be. Could this be a problem? Will I have to use symlinks or something (if symlinks are almost like shortcuts, but they are not?) What am I missing here? Ps: I has also removed the screen startup thingy, with update-rc.d remove. ## The solution I ended up using I should not have relied on stuff in your encrypted homefolder for startup tasks, as this get mounted on logon. I ended up using the upstart script I posted before. And moved the whole server application to `/opt/minecraft/` and alter the script to that. Also removed the sudo as suggested. `/opt/` is mounted for boot. I guess `screen` would work aswell, and I will look into it if I can't find a pleasant way to get into the minecraft server software console.


title: How is replaceable text shown in a terminal?

text: For example after doing `apt-get update`, it shows `Reading package lists... 82%` with the percentage changing in the same line. How is that achieved? Is it possible to use it in a bash script?


title: Using a generated list of filenames as argument list -- with spaces

text: I'm trying to invoke a script with a list of filenames collected by `find`. Nothing special, just someting like this:               $ myscript `find . -name something.txt`      The problem is that some of the pathnames contain spaces, so they get broken up into two invalid names on argument expansion. Normally I would surround the names with quotes, but here they're inserted by the backquote expansion. I've tried filtering the output of `find` and surrounding each filename with quotes, but by the time bash sees them, it's too late to strip them and they are treated as part of the filename:               $ myscript `find . -name something.txt | sed 's/.*/"&"/'`     No such file or directory: '"./somedir/something.txt"'      Yes, that's the rules for how the command line is processed, but how do I get around it? This is embarrassing but I'm failing to come up with the right approach. I finally figured out how to do it with `xargs -0 -n 10000`... but it's such an ugly hack that I still want to ask: How do I quote the results of backquote expansion, or achieve the same effect in another way? **Edit:** I was confused about the fact that `xargs` _does_ collect all arguments into a single argument list, unless it's told otherwise or system limits might be exceeded. Thanks to everyone for setting me straight! Others, keep this in mind as you read the accepted answer because it's not pointed out very directly. I've accepted the answer, but my question remains: Isn't there some way to protect spaces in backtick (or `$(...)`) expansion? (Note that the accepted solution is a non-bash answer).


title: Turning percentages into decimals?

text: I've got a CSV file that has percentages here and there expressed in text format, e.g.               173.91,0.00%,36.10%,1.71      Question of the day is how do I turn that example into               173.91,0,0.3610,1.71      Edit to add: You should not rely on the position of the percentage fields. You should detect them based on the % sign.


title: umount failed: device busy

text: I have a folder in `/tmp` that is mounted as `ramfs`. After some action that my script does, I delete everything inside said folder with the command:               rm -R -f "$tmp_dir"/{*,.*}      Then, I try to unmount the directory, but on the first try it doesn't work because the device is busy. After sleeping for a 0.5sec, the unmount succeeds. I've verified that no process is using the folder or anything inside that folder with any of the following commands:               fuser -m "$tmp_dir"     fuser "$tmp_dir"     lsof +d "$tmp_dir"     lsof "$tmp_dir"      Why would the device be busy in the 1st try? * * * **Edit #1 (30 Sep, 18:32 UTC):**   When I execute `find "$tmp_dir" -delete`, the unmount succeeds on the 1st time!   But then the `find` command complains about `$tmp_dir` being busy. * * * **Edit #2 (30 Sep, 18:45 UTC):**   With `stat` I noticed a change in the size of the folder, before an after the success in the unmount:               $ stat '/tmp/tmp.nbljlVcmix'       File: `/tmp/tmp.nbljlVcmix'       Size: 0           Blocks: 0          IO Block: 4096   directory     Device: 17h/23d Inode: 121188      Links: 2     Access: (0700/drwx------)  Uid: ( 1000/     dor)   Gid: (    0/    root)     Access: 2013-09-30 20:37:51.430769893 +0300     Modify: 2013-09-30 20:37:51.430769893 +0300     Change: 2013-09-30 20:37:51.430769893 +0300     $ umount '/tmp/tmp.nbljlVcmix'     umount: /tmp/tmp.nbljlVcmix: device is busy.             (In some cases useful info about processes that use              the device is found by lsof(8) or fuser(1))     $ sleep 0.5     $ umount '/tmp/tmp.nbljlVcmix'     $ stat '/tmp/tmp.nbljlVcmix'       File: `/tmp/tmp.nbljlVcmix'       Size: 4096        Blocks: 8          IO Block: 4096   directory     Device: 806h/2054d  Inode: 2401825     Links: 2     Access: (0700/drwx------)  Uid: ( 1000/     dor)   Gid: (    0/    root)     Access: 2013-09-30 20:37:47.600513531 +0300     Modify: 2013-09-30 20:37:47.600513531 +0300     Change: 2013-09-30 20:37:47.610513892 +0300      * * * **Edit #3 (1 Oct, 11:04 UTC):**   I've copied all the code (single file) to: http://pastebin.com/RJP6eQiy (Valid for 1 Month) The relevant `umount` is in the `cleanup` procedure, line #346, that is `umount "$DEST_DIR"`.


title: kickstart bootloader --driveorder configuration

text: I use a kickstart file for a customized install CentOS. On certain machines, if a memory stick is in the USB port, it fails because it tries to install CentOS on the memory stick. Kickstart current config:               # install the bootloader (GRUB)     bootloader --location=mbr --driveorder=sda      The failure occurs because the memory stick is /dev/sda and the hard drive is /dev/hda. How do I change the --driveorder to ignore any USB memory stick on the system?? What is considered best practice for --driveorder for custom CentOS installations?? Can always tell customers to remove USB sticks before installation... Without the USB stick in the USB port, it installs fine on /dev/hda.


title: How to show only installed packages by executing "aptitude search"?

text: After executing the `aptitude search pattern` command, I need to see only installed packages in the search result. Is there any way to do that?


title: Extra overhead in MASQUERADE target

text: There's a part in iptables manual concerning SNAT and MASQUERADE targets. I know the key difference between the two, but I don't fully get the following sentence: > It is still possible to use the MASQUERADE target instead of SNAT even > though you do have a static IP, however, it is not favorable since it will > add extra overhead, and there may be inconsistencies in the future which > will thwart your existing scripts and render them "unusable". Does anyone know what "extra overhead" is in this case?


title: Performance of RAID 1 with 3 Disks under Linux

text: The standard way to setup a RAID 1 under Linux is to use two disks of the same size. The write performance is almost as good as with a single disk drive. The read performance can be up to twice the speed of a single disk. For additional redundancy, we want to add another disk as a hot spare to the system. In the past the rebuild of RAID 1 and RAID 5 setups with disk sizes of 1-3TB did sometimes cause problems, because the "still living" disks are heavily stressed for the rebuild, and then also might fail... We have now read that with Linux we can also make a RAID 1 with 3 identical disks. That way the writes go directly to all 3 disks, and when a disk fails there is no need for a instant rebuild on the hot spare. So far things are clear for us. But what about performance?   * Will the writes be slower, because data has to be written to 3 disks at the same time?   * Will the reads be (up to) 3x faster, since it can read from 3 different disks? Other things to consider in such a setup?


title: how to set crontab PATH variable

text: I had a problem running a script from crontab. After some research I understood the problem was because PATH parameter doesn't include /sbin. I looked what it does include in /etc/crontab:               PATH=/sbin:/bin:/usr/sbin:/usr/bin      As a test - simple cron job to print the PATH variable:               * * * * * echo $PATH &> /root/TMP.log      the output is:               cat /root/TMP.log     /usr/bin:/bin      I don't understand this behaviour... How do I set the PATH variable..? Or better - how to add paths to it?


title: Limit the length of the output of "rss" command in conky

text: I'm running conky with desktop RSS. Is it possible to limit the max length of its title? I have something like this in my config: `${rss XXX 30 item_title 4}${goto 600}${rss YYY 30 item_title 4}` So it would be crucial that the first rss title won't exceed 600 in length, is it possible to limit that?


title: Increment Daily Config Value

text: I have a configuration file that contains a lookback value, which I need to increment by +1 each day. IE: 60, 61, 62 etc.... It doesn't look like `awk` will work because of the formatting of the config file. I was thinking `sed` could maybe append it to the existing file, but then I will need to set up a counter to work with this operation. Any ideas?


title: Sed: search and replace a patten with special characters which has a arbitrary string in between

text: I have a load of nfo files which I want to make some global substitutions for some values within each file e.g.                  a.nfo has the value <set>Tonight's Menu ( June 2012 )</set>        b.nfo has the value <set>Tonight's Menu ( April 2012 )</set>        c.nfo has the value <set>Speciel Menu ( April 2012 )</set>      Which I want to make all of them have the same value.                  a.nfo has the value <set>Tonight's Menu</set>        b.nfo has the value <set>Tonight's Menu</set>        c.nfo has the value <set>Tonight's Menu</set>      I've got this code which is almost working but not quite                   find -name '*.nfo' -print -exec sed -i.bak "s@\(<set>\).*\(</set>\)@\1Tonight's Menu\2@" {} \;      at the moment the result I get is                     <set>Tonight<set>Tonight's Menu ( June 2012 )</set>apos;s Menu</set>


title: Run shell script based on IPTABLES port access attempt

text: Is there a way in Linux (RHEL 5-6) using IPTABLES, that if someone tried to access port 21, as an FTP user, to log what the user name they are trying to authenticate as and additionally run a shell script passing that username as the first arg to the script? What I want to do ideally is email the user ID stating the new method of accessing this server, which is SFTP only now.


title: How to specify username and password in ftp command?

text: I want to automate a call to ftp in a shell script. If I type               $ftp somehost.domain.com      I am prompted for a username and password. I want to give that username and password as part of the call to ftp. The man page for ftp says I can issue a user command at the ftp prompt -- but I want to login to ftp all in one go. Is that possible? I don't see anything in the flags for ftp. I see that the -s option give me the option of specifying some ftp commands once I have the ftp prompt -- but I need to give the user name to get to the prompt...


title: Why does grep sometimes show the file name, sometimes not?

text: Can somebody please explain to me why I don't get the full path in example 1? example 1 - returning found line               grep MODIFY /opt/releases/packages/cr_c_cr6/sas/dbms/*/*;     outcome: MODIFY      example 2 - returning full path               grep MODIFY /opt/releases/packages/cr666/sas/dbms/*/*;     /opt/releases/packages/cr666/sas/dbms/sti/FA_DISCLOSURE.ddl:MODIFY QUANTITY NUMBER;      I have found a solution, but I want to understand what is happening here. 1 command, different outcome/handling.


title: Pipe the output of a command to rm command

text: Following command prints the path of the song being played.               mpc | head -n 1      songs/oldSongs/Mukesh_D/041 KANHAIYA = YAAD AAYI ADHI RAAT KO.mp3      Can I delete this file by modifying the command I used to print it?


title: Use sed to replace line of text with new line including variable

text: I was looking at this solution: Using sed to edit lines in a file with a variable and tried to apply it to my situation, but I have only recently discovered `sed` and haven't got the hang of it yet. If I have a file located `/tmp/mary.txt` and it looks like this:               Mary had a little lamb     with fleece as white as     snow. Everywhere that     Mary went, the lamb was     sure to go.      I want to replace a line of text in this file, specifically: `Mary had a little lamb` -> `Mary had 2 little lambs` I used this:               sed -i 's/*.had a little lamb.*/Mary had $(nproc) little lambs/' /etc/mary.txt      I am using `-i` for **inplace** and `s/` for **substitute** and it throws error:               sed: 1: "mary.txt": extra characters at the end of g command      * * * The other thing I am trying to do, is replace the word "lamb" on the first line with the result of `echo $PATH`               sed -i 's/*.had a little lamb.*/ Mary had a little '$(echo $PATH)'/' /etc/mary.txt      This throws the same error as above. I know these are two different scenarios, but can it be shown to me what I did wrong, so I can use this in future.


title: Ralink RT5370 Wireless usb dongle not working

text: lsusb               Bus 002 Device 014: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter      uname -a               Linux HOSTNAME 2.6.32-279.14.1.el6.x86_64 #1 SMP Tue Nov 6 11:21:14 CST 2012 x86_64 x86_64 x86_64 GNU/Linux      dmesg               usb 2-3: new high speed USB device number 12 using ehci_hcd     usb 2-3: New USB device found, idVendor=148f, idProduct=5370     usb 2-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3     usb 2-3: Product: 802.11 n WLAN     usb 2-3: Manufacturer: Ralink     usb 2-3: SerialNumber: 1.0     usb 2-3: configuration #1 chosen from 1 choice     usb 2-3: USB disconnect, device number 12     usb 2-3: new high speed USB device number 13 using ehci_hcd     hub 2-0:1.0: unable to enumerate USB device on port 3     usb 2-3: new high speed USB device number 14 using ehci_hcd     usb 2-3: New USB device found, idVendor=148f, idProduct=5370     usb 2-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3     usb 2-3: Product: 802.11 n WLAN     usb 2-3: Manufacturer: Ralink     usb 2-3: SerialNumber: 1.0     usb 2-3: configuration #1 chosen from 1 choice      OS               Scientific Linux release 6.3 (Carbon)      ..soooo... I plugged in this nano usb wifi. I can't see it in "ifconfig -a", neither I can see any drivers regarding "rt" in lsmod. How can I bring this wireless "card" to life? From ralink's website all I can see is a 0 Byte sized file for "driver" :D


title: Howto reduce skype video outgoing traffic?

text: # Issue background I'm having having problems with skype under linux. My video calls are all the time non-continuous and they're getting stuck. The situation is the same whether I use skype alone, or with a preload:   `skype`   `LD_PRELOAD=/usr/lib32/libv4l/v4l1compat.so skype &`   `LD_PRELOAD=/usr/lib32/libv4lconvert.so.0 skype &` Turning-off (compiz) graphical effects in KDE or switching to LXDE (`openbox- lxde --replace`) doesn't help much. From `atop` I can see that my outgoing traffic so is around 1500Kbps while incoming is around 150Kbps. When I select `stop my video` the outgoing traffic immediately falls to 70Kbps. So I suppose that the issue is that skype is sending too large video, which jams the network and results in stuck call. I went thru skype settings and I cannot find anywhere video size settings. I also don't know how to set-up video size in v4l which is underneath skype. **So how could I make skype sending smaller video?** # Technical info > $ cat /etc/debian_version   >  wheezy/sid > > $ uname -a   >  Linux Khedron 3.2.0-1-amd64 #1 SMP Sun Feb 5 15:17:15 UTC 2012 x86_64 > GNU/Linux > > $ skype --version   >  Skype 2.2.0.35               $ dpkg -l *v4l*     ii  lib32v4l-0              0.8.6-1      ii  libv4l-0                0.8.6-1      ii  libv4lconvert0          0.8.6-1      ii  qv4l2                   0.8.6-1      ii  v4l-conf                3.102-3      ii  v4l-utils               0.8.6-1  > $ lsusb | grep Chicony   >  Bus 001 Device 004: ID 04f2:b15e Chicony Electronics Co., Ltd   >  The HP webcam is identified as Chicony device.               $ lsmod | grep uvcvideo     uvcvideo               57744  0      videodev               70889  1 uvcvideo     media                  18148  2 uvcvideo,videodev     usbcore               128498  8      uvcvideo,btusb,usb_storage,usbhid,uas,xhci_hcd,ehci_hcd


title: Kernel Configuration: Which Processor Family to choose for 'Celeron M CPU 420' (Core Solo)?

text: I am trying to build custom kernel (version 3.12.13) for my old laptop and I am unable to determine the Processor Family from the provided list.               ( ) 486        ( ) 586/K5/5x86/6x86/6x86MX      ( ) Pentium-Classic        ( ) Pentium-MMX      ( ) Pentium-Pro      ( ) Pentium-II/Celeron(pre-Coppermine)       ( ) Pentium-III/Celeron(Coppermine)/Pentium-III Xeon     ( ) Pentium M        ( ) Pentium-4/Celeron(P4-based)/Pentium-4 M/older Xeon       ( ) K6/K6-II/K6-III        ( ) Athlon/Duron/K7        ( ) Opteron/Athlon64/Hammer/K8       ( ) Crusoe     ( ) Efficeon     ( ) Winchip-C6       ( ) Winchip-2/Winchip-2A/Winchip-3       ( ) AMD Elan     ( ) GeodeGX1        ( ) GeodeGX1     ( ) Geode GX/LX      ( ) CyrixIII/VIA-C3        ( ) VIA C3-2 (Nehemiah)        ( ) VIA C7     ( ) Core 2/newer Xeon     ( ) Intel Atom       According to this guide, 420 Celeron-M processors are Core Solo based, but I do not know which processor family should I select from above list. My cpuinfo:               processor   : 0     vendor_id   : GenuineIntel     cpu family  : 6     model       : 14     model name  : Intel(R) Celeron(R) M CPU  420  @ 1.60GHz     stepping    : 8     microcode   : 0x39     cpu MHz     : 1596.033     cache size  : 1024 KB     fdiv_bug    : no     hlt_bug     : no     f00f_bug    : no     coma_bug    : no     fpu     : yes     fpu_exception   : yes     cpuid level : 10     wp      : yes     flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov clflush dts acpi mmx fxsr sse sse2 ss tm pbe nx constant_tsc up arch_perfmon bts aperfmperf pni monitor tm2 xtpr pdcm dtherm     bogomips    : 3192.06     clflush size    : 64     cache_alignment : 64     address sizes   : 32 bits physical, 32 bits virtual     power management:      Would someone provide a pointer?


title: Is there anything in RHEL 6.5 that would affect I/O speed for something <24K vs >24K?

text: Generally, transactions for my app of setting and getting data internally are measured in a couple of millis. However, over 24K in size, that time can jump to just over 100 millis. Is there anything in RHEL 6.5 64-bit that could cause that drastic of a change? Some strange I/O thing that dumps bigger objects to swap vs. memory, having to allocate multiple blocks, etc.?


title: Restored VG has shifted volumes

text: I'm recovering a PV on a mdadm RAID 1 with a single VG containing several LVs. The underlying devices have several bad sectors (one just a few, the other really much) and a silly typo made it necessary to restore the LVM configuration by grepping through the devices. Luckily I found it and the restored configuration looks like the original one. The only problem is that the logical volumes have no valid file system. With e2sl I found that one of the superblocks of my target fs is in the wrong logical volume. Sadly I have no idea how to correct or circumvent this issue.               root@rescue ~/e2sl # ./ext2-superblock -d /dev/vg0/tmp  | grep 131072000     Found: block 20711426 (cyl 1369, head 192, sector 50), 131072000 blocks, 129988776 free blocks, 4096 block size, (null)     root@rescue ~/e2sl # ./ext2-superblock -d /dev/vg0/home | grep 131072000     Found: block 2048 (cyl 0, head 32, sector 32), 131072000 blocks, 129988776 free blocks, 4096 block size, (null)     Found: block 526336 (cyl 34, head 194, sector 34), 131072000 blocks, 129988776 free blocks, 4096 block size, (null)     Found: block 1050624 (cyl 69, head 116, sector 36), 131072000 blocks, 129988776 free blocks, 4096 block size, (null)     Found: block 1574912 (cyl 104, head 38, sector 38), 131072000 blocks, 129988776 free blocks, 4096 block size, (null)     Found: block 2099200 (cyl 138, head 200, sector 40), 131072000 blocks, 129988776 free blocks, 4096 block size, (null)     Found: block 6293504 (cyl 416, head 56, sector 56), 131072000 blocks, 129988776 free blocks, 4096 block size, (null)     Found: block 6817792 (cyl 450, head 218, sector 58), 131072000 blocks, 129988776 free blocks, 4096 block size, (null)     Found: block 12584960 (cyl 832, head 81, sector 17), 131072000 blocks, 129988776 free blocks, 4096 block size, (null)     Found: block 20973568 (cyl 1387, head 33, sector 49), 131072000 blocks, 129988776 free blocks, 4096 block size, (null)     Found: block 32507904 (cyl 2149, head 238, sector 30), 131072000 blocks, 129988776 free blocks, 4096 block size, (null)     Found: block 63440896 (cyl 4195, head 198, sector 22), 131072000 blocks, 129988776 free blocks, 4096 block size, (null)     Found: block 89655296 (cyl 5929, head 139, sector 59), 131072000 blocks, 129988776 free blocks, 4096 block size, (null)     ^C      I'm feeling just an inch away from accessing my filesystem(s) again to recover some non-backed-up data. LVM Configuration:               root@rescue ~ # pvs       PV         VG   Fmt  Attr PSize PFree       /dev/md1   vg0  lvm2 a--  2.71t 767.52g          root@rescue ~ # vgs       VG   #PV #LV #SN Attr   VSize VFree       vg0    1   5   0 wz--n- 2.71t 767.52g          root@rescue ~ # lvs       LV        VG   Attr     LSize   Pool Origin Data%  Move Log Copy%  Convert       backup    vg0  -wi-a--- 500.00g       container vg0  -wi-a--- 500.00g       home      vg0  -wi-a--- 500.00g       root      vg0  -wi-a--- 500.00g       tmp       vg0  -wi-a---  10.00g      VG Configuration:               # Generated by LVM2 version 2.02.95(2) (2012-03-06): Sun Oct 13 23:56:33 2013          contents = "Text Format Volume Group"     version = 1          description = "Created *after* executing 'vgs'"          creation_host = "rescue"        # Linux rescue 3.10.12 #29 SMP Mon Sep 23 13:18:39 CEST 2013 x86_64     creation_time = 1381701393      # Sun Oct 13 23:56:33 2013          vg0 {         id = "7p0Aiw-pBpd-rn6Y-geFb-jyZe-gide-Anc9ag"         seqno = 19         format = "lvm2" # informational         status = ["RESIZEABLE", "READ", "WRITE"]         flags = []         extent_size = 8192              # 4 Megabytes         max_lv = 0         max_pv = 0         metadata_copies = 0              physical_volumes {                      pv0 {                         id = "GBIwI4-AxBa-6faf-aLfB-UZiP-iSS9-FaOrhH"                         device = "/dev/md1"     # Hint only                              status = ["ALLOCATABLE"]                         flags = []                         dev_size = 5824875134   # 2.71242 Terabytes                         pe_start = 384                         pe_count = 711044       # 2.71242 Terabytes                 }         }              logical_volumes {                      root {                         id = "1e3gvq-IJnX-Aimz-ziiY-zucE-soCO-YU2ayp"                         status = ["READ", "WRITE", "VISIBLE"]                         flags = []                         segment_count = 1                              segment1 {                                 start_extent = 0                                 extent_count = 128000   # 500 Gigabytes                                      type = "striped"                                 stripe_count = 1        # linear                                      stripes = [                                         "pv0", 0                                 ]                         }                 }                 tmp {                         id = "px8JAy-JnkP-Amry-uHtf-lCUB-rfdx-Z8y11y"                         status = ["READ", "WRITE", "VISIBLE"]                         flags = []                         segment_count = 1                              segment1 {                                 start_extent = 0                                 extent_count = 2560     # 10 Gigabytes                                      type = "striped"                                 stripe_count = 1        # linear                                      stripes = [                                         "pv0", 128000                                 ]                         }                 }                      home {                         id = "e0AZbd-22Ss-RLrF-TgvF-CSDN-Nw6w-Gj7dal"                         status = ["READ", "WRITE", "VISIBLE"]                         flags = []                         segment_count = 1                              segment1 {                                 start_extent = 0                                 extent_count = 128000   # 500 Gigabytes                                      type = "striped"                                 stripe_count = 1        # linear                                      stripes = [                                         "pv0", 130560                                 ]                         }                 }                      backup {                         id = "ZXNcbK-gYKj-LJfm-f193-Ozsi-Rm3Y-kZL37c"                         status = ["READ", "WRITE", "VISIBLE"]                         flags = []                         creation_host = "new.bountin.net"                         creation_time = 1341852222      # 2012-07-09 18:43:42 +0200                         segment_count = 1                              segment1 {                                 start_extent = 0                                 extent_count = 128000   # 500 Gigabytes                                      type = "striped"                                 stripe_count = 1        # linear                                      stripes = [                                         "pv0", 258560                                 ]                         }                 }                   container {                         id = "X9wheh-3ADB-Fiau-j7SR-pcH9-hXne-K2NVAc"                         status = ["READ", "WRITE", "VISIBLE"]                         flags = []                         creation_host = "new.bountin.net"                         creation_time = 1341852988      # 2012-07-09 18:56:28 +0200                         segment_count = 1                              segment1 {                                 start_extent = 0                                 extent_count = 128000   # 500 Gigabytes                                      type = "striped"                                 stripe_count = 1        # linear                                      stripes = [                                         "pv0", 386560                                 ]                         }                 }         }     }


title: Which driver for USB enclosure should I install?

text: I'd like to connect my old harddrive to my laptop via USB enclosure. I connected it but it only produced strange sounds, so I thought that the enclosure is corrupted. I connected the enclosure to another computer and it's working. The command **lsusb** shows: > Genesys Logic, Inc. USB 2.0 IDE Adapter [GL811E] So, I thought that it could be a problem with drivers (because on this computer more apps are installed). Can I find out which driver is used on this computer for this particular device and how can I install it on my laptop?


title: How can I read CD-Text information from CDs

text: What applications are available for GNU/Linux that allow read-out of CD-Text data from CDs? Command-line programs would be preferred.


title: Imagemagick on open wrt router "UnableToOpenConfigureFile"

text: I have installed Open Wrt on my TP-Link TL-WR740N/ND v4. Everything works fine but the Imagemagick. I have installed it into ram (no enough space on rom ) with `opkg`               # opkg install imagemagick imagemagick-png imagemagick-jpeg imagemagick-tools -d ram     ...     ...     # opkg list-installed | grep imagema     imagemagick - 6.7.8-1     imagemagick-jpeg - 6.7.8-1     imagemagick-png - 6.7.8-1     imagemagick-tools - 6.7.8-1      but not I am getting `UnableToOpenConfigureFile` as there is no configuration files. Anyone knows how to omit that ?               # convert -debug configure picture.jpeg picture.jpeg      2013-10-14T14:45:24+00:00 0:00.010 0.010u 6.7.8 Configure convert[2677]: utility.c/ExpandFilenames/939/Configure       Command line: convert {-debug} {configure} {picture.jpeg} {picture.jpeg}     2013-10-14T14:45:24+00:00 0:00.020 0.020u 6.7.8 Configure convert[2677]: configure.c/GetConfigureOptions/564/Configure       Searching for configure file: "/usr/share/ImageMagick-6.7.8/coder.xml"     2013-10-14T14:45:24+00:00 0:00.020 0.020u 6.7.8 Configure convert[2677]: configure.c/GetConfigureOptions/564/Configure       Searching for configure file: "/usr/lib/ImageMagick-6.7.8/config/coder.xml"     2013-10-14T14:45:24+00:00 0:00.030 0.030u 6.7.8 Configure convert[2677]: configure.c/GetConfigureOptions/564/Configure       Searching for configure file: "/etc/ImageMagick/coder.xml"     2013-10-14T14:45:24+00:00 0:00.030 0.030u 6.7.8 Configure convert[2677]: configure.c/GetConfigureOptions/564/Configure       Searching for configure file: "/usr/share/doc/ImageMagick-6.7.8/coder.xml"     2013-10-14T14:45:24+00:00 0:00.030 0.030u 6.7.8 Configure convert[2677]: configure.c/GetConfigureOptions/564/Configure       Searching for configure file: "/root/.magick/coder.xml"     2013-10-14T14:45:24+00:00 0:00.060 0.060u 6.7.8 Configure convert[2677]: configure.c/GetConfigureOptions/564/Configure       Searching for configure file: "/usr/share/ImageMagick-6.7.8/magic.xml"     2013-10-14T14:45:24+00:00 0:00.070 0.070u 6.7.8 Configure convert[2677]: configure.c/GetConfigureOptions/564/Configure       Searching for configure file: "/usr/lib/ImageMagick-6.7.8/config/magic.xml"     2013-10-14T14:45:24+00:00 0:00.070 0.070u 6.7.8 Configure convert[2677]: configure.c/GetConfigureOptions/564/Configure       Searching for configure file: "/etc/ImageMagick/magic.xml"     2013-10-14T14:45:24+00:00 0:00.070 0.070u 6.7.8 Configure convert[2677]: configure.c/GetConfigureOptions/564/Configure       Searching for configure file: "/usr/share/doc/ImageMagick-6.7.8/magic.xml"     2013-10-14T14:45:24+00:00 0:00.070 0.070u 6.7.8 Configure convert[2677]: configure.c/GetConfigureOptions/564/Configure       Searching for configure file: "/root/.magick/magic.xml"     2013-10-14T14:45:24+00:00 0:00.090 0.090u 6.7.8 Configure convert[2677]: configure.c/GetConfigureOptions/564/Configure       Searching for configure file: "/usr/share/ImageMagick-6.7.8/delegates.xml"     2013-10-14T14:45:24+00:00 0:00.090 0.090u 6.7.8 Configure convert[2677]: configure.c/GetConfigureOptions/564/Configure       Searching for configure file: "/usr/lib/ImageMagick-6.7.8/config/delegates.xml"     2013-10-14T14:45:24+00:00 0:00.090 0.090u 6.7.8 Configure convert[2677]: configure.c/GetConfigureOptions/564/Configure       Searching for configure file: "/etc/ImageMagick/delegates.xml"     2013-10-14T14:45:24+00:00 0:00.090 0.090u 6.7.8 Configure convert[2677]: configure.c/GetConfigureOptions/564/Configure       Searching for configure file: "/usr/share/doc/ImageMagick-6.7.8/delegates.xml"     2013-10-14T14:45:24+00:00 0:00.100 0.090u 6.7.8 Configure convert[2677]: configure.c/GetConfigureOptions/564/Configure       Searching for configure file: "/root/.magick/delegates.xml"     2013-10-14T14:45:24+00:00 0:00.100 0.090u 6.7.8 Configure convert[2677]: delegate.c/LoadDelegateList/1228/Configure       Loading delegate configuration file "built-in" ...     convert: UnableToOpenConfigureFile `delegates.xml' @ warning/configure.c/GetConfigureOptions/591.     convert: NoDecodeDelegateForThisImageFormat `picture.jpeg' @ error/constitute.c/ReadImage/544.     convert: NoImagesDefined `picture.jpeg' @ error/convert.c/ConvertImageCommand/3044.      **EDIT** I have now tried to copy my delegates from ubuntu box to router but no luck. Now I just got rid of `UnableToOpenConfigureFile`               # convert -debug configure picture.jpeg picture.jpeg      2013-10-14T15:14:34+00:00 0:00.000 0.000u 6.7.8 Configure convert[2789]: utility.c/ExpandFilenames/939/Configure       Command line: convert {-debug} {configure} {picture.jpeg} {picture.jpeg}     2013-10-14T15:14:34+00:00 0:00.010 0.000u 6.7.8 Configure convert[2789]: configure.c/GetConfigureOptions/564/Configure       Searching for configure file: "/usr/share/ImageMagick-6.7.8/coder.xml"     2013-10-14T15:14:34+00:00 0:00.010 0.000u 6.7.8 Configure convert[2789]: configure.c/GetConfigureOptions/564/Configure       Searching for configure file: "/usr/lib/ImageMagick-6.7.8/config/coder.xml"     2013-10-14T15:14:34+00:00 0:00.020 0.000u 6.7.8 Configure convert[2789]: configure.c/GetConfigureOptions/564/Configure       Searching for configure file: "/etc/ImageMagick/coder.xml"     2013-10-14T15:14:34+00:00 0:00.020 0.000u 6.7.8 Configure convert[2789]: configure.c/GetConfigureOptions/564/Configure       Searching for configure file: "/usr/share/doc/ImageMagick-6.7.8/coder.xml"     2013-10-14T15:14:34+00:00 0:00.020 0.000u 6.7.8 Configure convert[2789]: configure.c/GetConfigureOptions/564/Configure       Searching for configure file: "/root/.magick/coder.xml"     2013-10-14T15:14:34+00:00 0:00.020 0.000u 6.7.8 Configure convert[2789]: coder.c/LoadCoderList/693/Configure       Loading coder configuration file "/usr/share/ImageMagick-6.7.8/coder.xml" ...     2013-10-14T15:14:34+00:00 0:00.050 0.030u 6.7.8 Configure convert[2789]: configure.c/GetConfigureOptions/564/Configure       Searching for configure file: "/usr/share/ImageMagick-6.7.8/magic.xml"     2013-10-14T15:14:34+00:00 0:00.060 0.040u 6.7.8 Configure convert[2789]: configure.c/GetConfigureOptions/564/Configure       Searching for configure file: "/usr/lib/ImageMagick-6.7.8/config/magic.xml"     2013-10-14T15:14:34+00:00 0:00.060 0.040u 6.7.8 Configure convert[2789]: configure.c/GetConfigureOptions/564/Configure       Searching for configure file: "/etc/ImageMagick/magic.xml"     2013-10-14T15:14:34+00:00 0:00.060 0.040u 6.7.8 Configure convert[2789]: configure.c/GetConfigureOptions/564/Configure       Searching for configure file: "/usr/share/doc/ImageMagick-6.7.8/magic.xml"     2013-10-14T15:14:34+00:00 0:00.060 0.040u 6.7.8 Configure convert[2789]: configure.c/GetConfigureOptions/564/Configure       Searching for configure file: "/root/.magick/magic.xml"     2013-10-14T15:14:34+00:00 0:00.080 0.060u 6.7.8 Configure convert[2789]: configure.c/GetConfigureOptions/564/Configure       Searching for configure file: "/usr/share/ImageMagick-6.7.8/delegates.xml"     2013-10-14T15:14:34+00:00 0:00.080 0.060u 6.7.8 Configure convert[2789]: configure.c/GetConfigureOptions/564/Configure       Searching for configure file: "/usr/lib/ImageMagick-6.7.8/config/delegates.xml"     2013-10-14T15:14:34+00:00 0:00.080 0.060u 6.7.8 Configure convert[2789]: configure.c/GetConfigureOptions/564/Configure       Searching for configure file: "/etc/ImageMagick/delegates.xml"     2013-10-14T15:14:34+00:00 0:00.080 0.060u 6.7.8 Configure convert[2789]: configure.c/GetConfigureOptions/564/Configure       Searching for configure file: "/usr/share/doc/ImageMagick-6.7.8/delegates.xml"     2013-10-14T15:14:34+00:00 0:00.090 0.060u 6.7.8 Configure convert[2789]: configure.c/GetConfigureOptions/564/Configure       Searching for configure file: "/root/.magick/delegates.xml"     2013-10-14T15:14:34+00:00 0:00.090 0.060u 6.7.8 Configure convert[2789]: delegate.c/LoadDelegateList/1228/Configure       Loading delegate configuration file "/usr/share/ImageMagick-6.7.8/delegates.xml" ...     convert: NoDecodeDelegateForThisImageFormat `picture.jpeg' @ error/constitute.c/ReadImage/544.     convert: NoImagesDefined `picture.jpeg' @ error/convert.c/ConvertImageCommand/3044.


title: Traffic shaping with tc does not work

text: I want to limit the outgoing traffic to a specific bandwidth. My Code:               tc qdisc add dev vif1.0 root handle 1: htb default 30     tc class add dev vif1.0 parent 1: classid 1:1 htb rate 1mbit     tc class add dev vif1.0 parent 1: classid 1:2 htb rate 1mbit     tc filter add dev vif1.0 protocol ip parent 1:0 prio 1 u32 match ip dst 91.214.170.249/32 flowid 1:1     tc filter add dev vif1.0 protocol ip parent 1:0 prio 1 u32 match ip src 91.214.170.249/32 flowid 1:2      But nothing happens.. I have uploaded a 1GB file and can download it with 4MB/s vif1.0 is the interface name of my virtual machine


title: Why does building an Android kernel need a toolchain, but compiling the entire source does not?

text: As seen here, compiling the Android kernel requires a prebuilt GCC toolchain (or the equivalent from the Android NDK). Cross-compilation makes sense; we are compiling code _for_ a device with a different platform. However, the guide to compiling the Android source does not anywhere require that one download a toolchain or NDK, and my understanding is that none of the tools used (SDK, etc.) contain a toolchain, either. But of course compiling the source from scratch also builds the kernel. What's going on -- why do we need a gcc toolchain when building the kernel one way, but not the other?


title: Access devices on a shared internet connection from other devices on home network (Ubuntu, shared wireless to ethernet)

text: Laptop OS: XUbuntu 12.04 Home PC: XUbuntu 12.04 guest on Windows 7 host Embedded Things: Mix of Raspberry Pis or Beaglebones I'm trying to share the wireless connection on a laptop with multiple embedded devices connected to the laptops ethernet port, through a switch. So far all I've had to do was use **Network Manager** to set the **Method** drop down box in the **Wired** tab of the **Network Connections** dialog box to **Shared to other computers** , as instructed from other searches. Doing this allows the embedded devices to communicate with the outside world and get internet access. They are able to ping every device on my network. The opposite direction is the problem; the only device that can directly ping the embedded devices by IP (hostnames do not work) is the laptop that they are connected to. Here's the setup: ![](http://i.imgur.com/4WjXoy8.png?1) My home network is 192.168.1.x and the IPs being assigned from the shared ethernet port on the laptop are 10.42.0.x. Each embedded device has a static IP assigned to it. My goal is to have every device able to communicate with every other device, including virtual machines running on the **Home PCs**. This may not be the correct setup and I'm open to modifying anything, but it's the closest I've come so far. The purpose of this setup is to run http://www.ros.org/ on the laptop and embedded devices long term. I also need to run it short-term on a virtual machine on one of the **Home PCs** for development purposes. Since the embedded devices can all communicate with each other and the laptop, long term would work with the current setup.


title: How can I use bindkey to run a script?

text: In the Z shell, how can I use bindkey to bind a key sequence to a script?


title: generate SCRAM-SHA-1 hash of a password

text: I am looking for a simple way (perhaps using openssl) to generate SCRAM-SHA-1 hash of a password for use for Prosody Jabber Server. The passwords on the server are stored in the following form:               ["iteration_count"] = 4096;     ["stored_key"] = "f76e63cb5bb7f78e99b07196646c39a0f9422ef7";     ["salt"] = "5317fe92-be09-4e0c-8501-55e5fb325543";     ["server_key"] = "eb701c012450813185104934f88a9d07a7f211d9";      Can anybody suggest something ?


title: Repair GRUB from Arch live CD

text: I'm trying to install Arch on `sda8` (with swap on `sda7`) following the instructions here. I got to the part of setting up the WiFi a second time, but since I already have GRUB, I got lost at the section about installing a bootloader. I rebooted, and GRUB opened as usual: with Ubuntu and Windows options, but no Arch. I went to Ubuntu and tried various things to get GRUB to recognise Arch (usually involving `grub-install`). However, these made things worse, and now when I reboot and select Ubuntu, I get the message:               error: file `/boot/vmlinuz-3.13.0-24-generic' not found     error: you need to load the kernel first.      There are a few things I can still run:   * An Arch live CD   * A GParted live CD   * A LuPu live CD   * A Wubi version of Ubuntu 13.04 (Ubuntu running from the Windows partition `sda2`)   * Probably, by extension, Windows (I haven't tried yet) I'd rather not install another large live CD, since they take a very long time to download. So, how can I recover use of the actual Ubuntu 14.04 and get access to Arch? * * * **Edit** : I can now use Arch and Ubuntu.


title: Debian installation fails due to CDROM not being detected

text: This is a problem many users have, but there doesn't seem to be an effective solution that works for everybody. When trying to install Debian 7.6 (problem exists for other versions as well) from a USB device (created with YUMI/Universal USB Installer/UNetbootin), the installation process gives out an error notification saying that it was not able to detect a Release file/the CDROM drive. To my understanding, programs that make the USB device bootable should mount the device as the CDROM drive. As this is not being done properly (I think), I already followed instructions of people that were having the same problem. For some of them, running a shell command solved the issue. I tried that, but the command               mount /dev/sdb /cdrom      But it didn't work for me. Others have figured out that the problem may be caused by file name extensions (.deb instead of .udeb), but renaming them did not solve the issue for me either. Is there anyone who also has this problem/who can reproduce it and has a solution for this issue? Edit: Debian ISO I used Checksums and other releases


title: shopt -s nocaseglob is not working on Ubuntu

text: Case insensitive file name globbing is not working in bash on Ubuntu 11.04 64bit. The shell options specified in `.bashrc` are as follows:               shopt -s nocaseglob      shopt -s nocasematch      shopt also shows that `nocaseglob` and `nocasematch` are `on`. But for a directory change or opening a file, it doesn't work in case insensitivity mode. I wish to check whether any other option is needed to enable case insensitive filename globbing.


title: Module load map

text: How can I obtain a module load map? I've tried with the -m flag in insmod but it seems that since 2.6 there is no support for it. Thanks


title: Sort installed applications according by usage frequency?

text: My `/` is running low. So I am considering freeing up some space by uninstalling some packages. “Which installed software packages use the most disk space on Debian?” already covers sorting by _size_ , but I'd like to sort by how _frequently_ I use each package. How can I sort installed applications according to their usage frequencies? I'd like to consider uninstalling the least-frequently used apps. I checked the `dpkg` manpage, and couldn't find anything. I'm running Ubuntu.


title: Graphical glitch with multiple Linux distros

text: I have been trying to install a Linux distro on my laptop (HP DV6) for quite some time now. I have tried Ubuntu and Crunchbang but they both have the same issue... It looks to be a graphical glitch which appears before the login. Basically, I start the machine after installing the OS then after a little while the screen starts to mess up and then after a while I can make out what appears to be the logon screen and then after a few seconds the screen goes black and it hangs there. My laptop does have a APU (hybrid graphics card) so maybe that's messing it up. It has a dedicated GPU also.


title: Why does kernel-devel contain so many "empty" directories?

text: I have been a Windows kernel developer for many years. Now I start to develop Linux kernel modules. To begin with, I installed `kernel-devel` under `/usr/src/kernels/$(uname -r)`. However, after checking the installation folder, I am confused because there seem a lot of seemingly useless folders and files inside the directory. Many folders are empty except for two files: `Kconfig` and `Makefile`. Under Windows, to develop kernel device drivers, I just need an include folder containing all necessary header files, and an lib folder containing necessary libraries to link. Under Linux, I can't understand why there are so many seemingly useless folders. Any explanations?


title: Extracting first rows of .csv files into a single new .csv file

text: I have over 1000 .csv files in a folder on Debian Squeeze. I am trying to create a new .csv file containing ONLY the first rows of each of these 1000 .csv files. I tried:               read -r firstline < sourcefile_1.csv > headers.csv      But that only created a blank file. (And even if it did work, I would have copied only the first row of just one file.) How do I write a command that copies the first rows of all 1000 files in the folder and add it to the new .csv file? Thanks in advance!


title: How to kill a process in shell script which is running through cron?

text: I have a shell script which runs in cronjob. This shell script has to kill a process which is running and start the new process again. When I run the script manually it works perfectly fine, but when it runs through cron it does not kill the old process but starts a new process along with the old one. I am using the below line of code to kill the process: kill -9 ps | grep "server1" | grep -v grep | awk '{ print $1 }'


title: Changes to files don't show up until the partition is unmounted

text: I have a FAT32 filesystem mounted. After changing a file on it, I can read the file back and still see the old version. My changes don't actually persist until I unmount and remount the partition. Is this behavior normal? If yes, why does it make sense or why is it needed? Is there a way to set it up so changes appear automatically?


title: Where is bash's history stored?

text: If I run `history`, I can see my latest executed commands. But if I do `tail -f $HISTFILE` or `tail -f ~/.bash_history`, they do not get listed. Does the file get locked, is there a temporary location or something similar?


title: Git changelog grouped by day and user

text: Current code to generate change logs:               svn2cl --linelen 78 --reparagraph --include-rev --group-by-day      The closest I could get with vanilla options is               git shortlog --format='* [%h] %s' -w78,8,10      How do I emulate the `svn2cl` output as closely as possible? Example output:               2013-02-19  username                  * [r30695] path1: commit message             * [r30691] path2, path3, path4: looooooooooooooooooooooooooooong               commit message             * [r30690] path1, path3: commit message          2013-02-19  other_user             * ...          2013-02-18  username             * ...      **Two issues remain:**   * Include a human-readable list of paths before the commit message   * Pretty-print long commit messages


title: Communicate across X-desktop sessions on same machine?

text: I've got a Raspberry Pi running Debian/Raspbian (thus X server) that I'd like to drive two screens with. I'm programming something that will have a public- facing screen and an operator-facing screen. To give an example of the things I'm trying to do, say the operator will have a GUI where he or she can press 'cat' and a fullscreen cat will appear on the other monitor. The problem is that the Pi only has one HDMI output, making driving two monitors difficult unless you resort to SSH/remote desktop sessions with a second computer (eg a laptop). Now, I've done remote desktop on headless Pis before with very little difficulty. The issue that is brickwalling me right now is that when I remote desktop in, I get a completely independent second desktop than the one that's driving the primary monitor, ergo the monitor is inaccessible to me. How do I make it so that when I remote in, I get control over that monitor, but also screen area for a GUI that will only go on the remote computer? Also, how do I make it so when the program starts up, the public facing display goes fullscreen and the operator gui pops up on the other? I'd like to keep as much as possible on the Pi so that the only requirement of the remote computer be that it can do remote desktop. In other words, I don't want to divide my software into remote and local executables. Thanks. Any help would be greatly appreciated!


title: Setting the root password vs. sudo -i

text: Should one always set a root password, or is `sudo -i` acceptable? Two problems is in reading other posts (maybe junk I realize):   1. `sudo -i` eliminates the need for a password. Isn't that a problem for security reasons?   2. there are conflicting views on whether to change the password from its original hash value: > By default the root user is setup with a random hash during the install of > Ubuntu If one should use the original hash value, I have no idea what mine is. How do I retrieve it? Lastly, does the answer change if multiple people will be using the root account (password sharing best practices)?


title: How can I install hulahop

text: I cloned hulahop via git and I'd like to use it and try to run this example. I have a problem to find out how to build and install it. I also tried to install it with `apt-get` but I don't have this package available. [Xubuntu 10.04]


title: Unable to recognize old interfaces after motherboard update

text: I updated motherboard on x240 computer node, now the ethernet interfaces show up as eth2 and eth3 previously it was eth0 and eth1. I tried to delete `/etc/udev/rules.d/70-persistent-net.rules` file but the problem still persists. On boot it says that eth3 and eth2 cannot be recognized or mapped. The new mac addresses are clearly illustrated and mapped to name files eth2 and eth3. I did change in file ifcfg eth2 and eth3 and change its name to eth0 and eth1 respectively. But this too had little effect, do I need this change to be done in `70-persistent` file as well? I.e. change name to match the entry in `ifcfg`?. Is there a way i can bring the old mapping back? Thanks.


title: moc command not found?

text: On my Gentoo systems I've never had a problem with this and I run `moc` as I run any other command in the terminal. I recently switch to Fedora 15/16 and notice that running `moc` doesn't work. I get `bash: moc: command not found...`. Instead, I have to give its full path, `/usr/lib64/qt4/bin/moc`.   1. I would like to know why the Fedora folks have not set this up so calling `moc` just works without giving its full path (or, perhaps I've done something to break?)   2. As I'm very new to non-Gentoo systems, I would like to know of a universal way to call `moc` so that it works on any *nix system.


title: how to make firefox read stdin

text:
echo '
hello, world
' |  firefox     cat index.html | firefox      These commands don't work.   If firefox can read stdin, I can send html to firefox via pipe.   Is it possible to make firefox read stdin?


title: Upgrade OpenGL from 1.2 to 2 for Nvidia GT218 [GeForce 310]

text: To run my application `OpenGL version 2.0` _or higher_ is required. `glxinfo | grep OpenGL` yields:               Xlib:  extension "NV-GLX" missing on display ":1007.0".     OpenGL vendor string: Mesa project: www.mesa3d.org     OpenGL renderer string: Mesa GLX Indirect     OpenGL version string: 1.2 (1.5 Mesa 6.4.1)     OpenGL extensions:      `/sbin/lspci -v` yields:               01:00.0 VGA compatible controller: NVIDIA Corporation GT218 [GeForce 310] (rev a2) (prog-if 00 [VGA controller])             Subsystem: Device 1b0a:9060             Flags: bus master, fast devsel, latency 0, IRQ 169             Memory at fa000000 (32-bit, non-prefetchable) [size=16M]             Memory at d0000000 (64-bit, prefetchable) [size=256M]             Memory at ce000000 (64-bit, prefetchable) [size=32M]             I/O ports at ec00 [size=128]             Expansion ROM at fbe80000 [disabled] [size=512K]             Capabilities: [60] Power Management version 3             Capabilities: [68] MSI: Enable- Count=1/1 Maskable- 64bit+             Capabilities: [78] Express Endpoint, MSI 00             Capabilities: [b4] Vendor Specific Information: Len=14 <?>             Kernel modules: nvidiafb, nvidia-169_07, nvidia      What I've tried: Installing NVIDIA-Linux-x86-310.32.run driver (It supports my graphics card). Any pointers how to upgrade to OpenGL 2.0? System: CentOS 5.8 32 bit   `uname -a`:               Linux xxxxxxx 2.6.18-348.1.1.el5 #1 SMP Tue Jan 22 16:24:03 EST 2013 i686 i686 i386 GNU/Linux


title: how to queue a command to run after another command finishes?

text: Sometimes I start a program that takes a very long time to finish (`emerge`), then realize that I should go to bed instead of waiting for it. If I know this in the first place I would run               program; halt      However, now that I have started the program already, how can I "schedule" the computer to shutdown when that process finishes? Would `Ctrl+z` then `fg; halt` be OK?


title: Unable to find the kernel source tree in Kali/Debian

text: I'm trying to install the driver **NVIDIA-Linux-x86_64-340.32** on **Kali 1.0.9**. I have some trouble though. When stop the gdm3, enter init3 and then start the installation by `sh filename` NVIDIA tells me:               Error: Unable to find the kernel source tree      Then I go into **GUI** again and tries to get the available linux headers for my system by:               apt-cache search linux-kernel-headers      I get the following output :               linux-headers-3.14-kali1-all - All header files for Linux 3.14 (meta-package)     linux-headers-3.14-kali1-all-amd64 - All header files for Linux 3.14 (meta-package)     linux-headers-3.14-kali1-amd64 - Header files for Linux 3.14-kali1-amd64     linux-headers-3.14-kali1-common - Common header files for Linux 3.14-kali1     linux-headers-3.14-kali1-common-rt - Common header files for Linux 3.14-kali1-rt     linux-headers-3.14-kali1-rt-amd64 - Header files for Linux 3.14-kali1-rt-amd64     linux-headers-amd64 - Header files for Linux amd64 configuration (meta-package)     linux-headers-rt-amd64 - Header files for Linux rt-amd64 configuration (meta-package)      So I try installing the first one, and the `linux-headers-3.14-kali1-amd64` but have no luck because I get this output error:               Reading package lists... Done     Building dependency tree            Reading state information... Done     E: Unable to locate package linux-headers-3.14-kalil-amd64     E: Couldn't find any package by regex 'linux-headers-3.14-kalil-amd64'      So what should I have to do in Kali 1.0.9 ( **Debian** ) to install the NVIDIA drivers?


title: Extract the base file name from a URL

text: url=http://www.foo.bar/file.ext; echo ${url##/*}      I expected this code to print `file.ext`, but it prints the whole URL. Why? How can I extract the file name?


title: Getting a propmt when deleteing a non-directory

text: I want to get a prompt when attempting to delete a non-empty directory with `rmdir`. Is this possible?


title: Squid configuration for web application

text: I am working on a project where my software is trying to connect a server running in public domain on some unusual port. ( I have set this server in public domain myself ). My corporate firewall does not allow me to connect to this server on this unusual port. So I have configured web proxy on the same machine where my server is running (i.e web proxy and my server both have same IP address), with the hope I will use this web proxy to access blocked port from my corporate network. Now the problem is, my web-proxy does allow me to access everything else (i.e It is providing me anonymity very well) but when I try to access the server (which is running on the same IP address), I am unable to access it via web- proxy. I have allowed just my corporate IP address in the web-proxy to allow access and deny everyone else. Give is the configuration of Squid.               acl cspnet src A.B.C.D/32     http_access allow cspnet          # And finally deny all other access to this proxy     http_access deny all          http_port 8080          coredump_dir /usr/local/squid/var/cache/squid          # Add any of your own refresh_pattern entries above these.     refresh_pattern ^ftp:           1440    20%     10080     refresh_pattern ^gopher:        1440    0%      1440     refresh_pattern -i (/cgi-bin/|\?) 0     0%      0     refresh_pattern .               0       20%     4320      I don't want to configure Squid to work as accelerator for my server, I just want to access the unusual port of my server from my client from my corporate network. A.B.C.D is also the IP address where my server is running. I have also tried things like               acl safe_port port X     &     http_access allow localhost      But nothing seems to work. The same server is running on another IP address in public domain (which I have set-up), and with my web-proxy (which I have configured above) I can access that server (which is bind to a different IP address) from my corporate network, but not this one which lies on the same IP address. Any thoughts ? * * * Here is some more information. The client software which is trying to connect to my server is running on a console based (no interface available) embedded linux box. I think usage of SSH Tunnels will require me to first login via SSH tunnel (using some SSH client - i.e Putty) on the box and then I can run my client software. Secondly I can add support in my box software to login via SSH Tunnels but I don't want to waste time on this effort. I am not sure if connecting with SSH Tunnels can be seamless so I think the better solution is just to configure my linux box to use web proxy as system network configuration so that all network access are made via web proxy. * * * Ok. I have tried removing everything from the squid.conf and just left               http_access allow all      I am still not able to access to the server running on the localhost. That means problem is not in the squid.conf, I need to add something else somewhere to allow access of the server running on localhost via squid. * * * Ok. Another test. I also have a webserver (apachi) running on my server machine. Via web-proxy when I have tried to access my webserver, I have got my page. That (I believe) confirms the problem lies somewhere in my server which I am trying to access or not ? The server I am trying to access is listening on 9000 port.


title: set up email addresses that aren't attached to a user

text: I need to set up a lot of email addresses on a Linux machine, but I don't want to create a new user account for each one. The mail can stored in a regular maildir or mbox. (I'll be checking the mail through some Perl code running on a cronjob.) How do I do this?


title: /usr/bin/random using a lot of CPU

text: Using QNX 6.4.1, there is a command called `pidin times` that shows information about processes. I think it means PID INformation. Among other things, you can see how much CPU a process has used since it was started. I have a system that is showing almost 2 minutes of processor utilization for `/usr/sbin/random` after the system has been running for about 10 hours. That seems like a lot, as nothing in my code calls `/usr/sbin/random`. There is a lot of network activity (UDP and TCP) right now though, so I'm wondering if the network driver is calling `random` to get dynamic collision backoff times because of packet collisions. Could this theory be correct? (Okay, how plausible is it?) If not, is there something else I should check? There are currently latency problems with this system that did not exist yesterday and I'd like to find out what's going on. This particular clue may help isolate the problem. * * * **Update** Further investigation using `nicinfo` revealed no packet collisions at all. So there goes my dynamic collision backoff time theory. Any other ideas? * * * **Another Update** While this helped be find the answer to my problem (SSHD was using random, of course!!), be careful. If you use SSH, it needs a working `random` to allow you to log on. For some reason, the call in my script to `random.old` didn't work, and I just about bricked my embedded system. So be careful.


title: phpmyadmin doesn't work after installing php5-mysqlnd

text: I am currently running into some problems with phpMyAdmin. I set everything up correctly and made sure everything worked.   Then later after some developing on some pages I noticed I couldn't execute `mysqli_result::fetch_all()`. So I did my research and found out I only had to install the package `php5-mysqlnd`. So I did (`apt-get install php5-mysqlnd`). The installation did not fail and my PHP script xould execute the `mysqli_result::fetch_all()` method. **But** phpmyadmin doesn't work anymore. It simply can't connect to the MySQL server anymore (all logins fail).   _(Note: every other script still has no problem connecting and logging in into the MySQL server. I also did not change any passwords. Login over the console is also possible)_   I couldn't get it to work with the package installed. The I reinstalled `php5-mysql` (which uninstalled `php5-mysqlnd`) and phpmyadmin worked again! Not having the `mysqli_result::fetch_all()` method is not a major issue but if it is possible I would like to use it anyways. Simply because it is so convinient for debugging! I am running a nginx server and debian 7.5 3.10.23 system. Any help is apprechiated!


title: Step by step guide to setup display resolutions in xorg

text: The default xorg configuration file created does not allow me to set up the display resolution I want (1360x768). The auto configuration command `xorg -configure` didn't create the proper configuration file either (see below). What's steps do I need to follow in order to manually add the resultion I want as one of the available ones? Update: I'm running this:   * CentOS 5.5, Linux 2.6.18-53.el5   * X Window System Version 7.1.1   * Gnome version 2.16 Auto-configuration:   * The same hardware with other linux distribution worked fine right after installation, allowing me to set up the display to 1600x900.   * The xorg.config file created during the installation allows me to set only 800x600 and 1024x768.   * If I raun `xorg -configure`, then X server won't start (it says that it could not be started with that configuration file). I had to manually go back to the previous xorg.config file.


title: Get the complement of the result of an ls command

text: Let's say I have a directory with multiple files, all of which are either binary files (files with no declared extensions) and source files (`.c` extension). I do this: `$ ls` and get: `README.md hello-world.c hello-world get-name.c get-name` and I want to list only files with a specific extensions (say both `.c` and `.md`), I do: `ls *.c *.md` and that's ok! But what if now I want to delete all files that **do not** have a `.c` or `.md` extension, how can I do this? I know how to do it to files whose extensions are known to me, like: `ls *.c *.md | xargs rm` But how do I tell the command line to delete the files that **DON'T** match my criteria?


title: Command Line Photo Organiser Like Shotwell but to run on headless server

text: Does anyone know of a program (or even bash script) that can take photos from various folders and then consolidate them into one place and organise them into a directory structure by date in the way that Shotwell and simliar can if using a GUI? I have a headless server that I intend to auto sync family phones (all android) photographs to. The idea would be that newly uploaded photos go into a holding directory and then a script runs on cron to import these into the main picture repository. I'm currently looking to build this around Owncloud but the android app is very basic and just syncs pictures into the root of the Owncloud folder. I already have an archive of photos that spans about 10 years and is nicely organsied into folder by the various succession of Linux photo management apps that I have used. I do suspect that a nice bash script would suffice but I'm looking for a decent off the shelf solution first. If I have to write my own bash script then so be it, any tips you have would be appreciated.


title: How to clear the input in Bash

text: I have a bash script that is reading quite a bit of data /dev/random. I need the user to type randomly to seed the random daemon. However once the script completes everything typed will get dumped to command input. Here's the code:               for i in ${users_thing[@]}     do         pass[${num}] = $(dd if=/dev/random status=noexfer bs=1 count=128 | base64) & #generate password         echo -n "Creating password: `expr $num + 1` of $sizes "          #tell what's going of         echo -en "\033[s"         while [[ $(jobs) != *Exit* ]]  #while the program is still running          do             for j in ${spinny_thing[@]} #now spin             do                 echo -en "\033[u\033[1D$j        "             done         done         echo ""         num=`expr $num + 1`     done      So I would like to be able to dump the standard input without interrupting the foreground process so `read` is out because it pauses. Would it be possible to some how map it `/dev/null`?


title: XeTeX problem on Debian-based distro

text: Was not sure if this should go here or on TeX Stackexchange. Feel free to move if I made mistake. My setup is: GNU/Linux, kernel 2.6.32-5-686, CrunchBang Linux statler. I have installed xetex through apt-get (texlive-xetex). Problem is that whenever I try to compile a .tex file which LaTeX will compile without problems, I get the following from xetex: > This is XeTeX, Version 3.1415926-2.2-0.9995.2 (TeX Live 2009/Debian) (Fatal > format file error; I'm stymied) I have installed xelatex, my latex version is > me@box:~$ latex --version pdfTeX 3.1415926-1.40.10-2.2 (TeX Live > 2009/Debian) kpathsea version 5.0.0 Version of xelatex is > asha@andromeda:~$ xelatex --version XeTeX 3.1415926-2.2-0.9995.2 (TeX Live > 2009/Debian) kpathsea version 5.0.0 Searching, this seems to be related to a recent update to zlib, version zlib-1.2.6. Source. Other posts reveal that other programs have been affected as well, but I have not been able to find a description of a solution I can use. There was one example where someone reported on seuccessfully linking to the older version of zlib when building the tool in question from sources. This might be a bit above my Linux skills for now. What can I do with my present distro and setup to have xetex working ?


title: Permission change to exclusively all folders (or .extension files)

text: I want to change permissions of all **777** folders to **755** and also change all **777 php files** to **644**. How can I do this through shell? P.S: all files and directories are in `www` directory.


title: Whats a simple Window Manager to use for web development?

text: I'm looking for a **really** simple window manager that will allow me to run a browser, a terminal and not much else. I normally just use `chrome` along with `gnome-terminal` and a series of gnu `screen` sessions. The full gnome / unity / cinnamon desktop is overkill but I find the minimalist tiling window managers just conflict with the way I use screen.


title: How do I fix iptables in ChromeOS?

text: Using the shell in chrosh in ChromeOS I followed some (apparently terrible) advice to flush my IP tables. using the command               sudo iptables -F      I am now unable to connect to the internet at all. All web pages return the 'This webpage is not available' screen. I'd really like to not have to wipe my installation but it's the only way I know how to fix it. I've spent some time setting up Ubuntu using crouton and don't want my work to be undone so if anyone has any ideas how to fix this it would be greatly appreciated. [EDIT]1: https://code.google.com/p/chromium/issues/detail?id=181743 step 2 has allowed me to connect to the internet. Is this thorough enough? [EDIT]2: As requested, using               sudo iptables -L      Here is this output:               Chain INPUT (policy DROP)     target     prot opt source               destination              ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED      ACCEPT     all  --  anywhere             anywhere                 ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ssh           Chain FORWARD (policy DROP)     target     prot opt source               destination                   Chain OUTPUT (policy DROP)     target     prot opt source               destination              ACCEPT     all  --  anywhere             anywhere            state NEW,RELATED,ESTABLISHED      ACCEPT     all  --  anywhere             anywhere


title: LXC container to use "virtual" interface from host (namespace semantics)

text: So according to the documentation on the Ubuntu LXC documentation the following statement can be found at the time of this writing: > A NIC can only exist in one namespace at a time, **so a physical NIC passed > into the container is not usable on the host**. Now one can have a single physical network card (NIC) share several IPs like this in `/etc/network/interfaces` (Debian/Ubuntu):               auto eth0 eth0:1     iface eth0 inet static         address 192.168.0.100/24         gateway 192.168.0.1     iface eth0:1 inet static         address 192.168.0.200         netmask 255.255.255.0      The same can be done with the respective configuration on other distros as well. Now the question: can `eth0` and `eth0:1` be assigned to different namespaces or will assigning either one limit the other to the same namespace automatically?


title: Extract single file from tar to other folder

text: I've searched for multiple forums for this questions and have seen different answers but so far, nothing have worked yet even from the ones I've seen here. I want to extract a single file from a tar to a different directory. Ive tried this:               tar xvf file.tar -C /home/dir/ filename      or this:               tar -x filename -f file.tar -C /home/dir      But got this errors respectively:               x filename, 14826 bytes, 29 media blocks.     File -C not present in the archive.     File /home/dir not present in the archive.      and:               tar: /dev/rmt0: A file or directory in the path name does not exist.      The first extracted the file but in the same directory, not to the folder I wanted.


title: What does ifup do when "/etc/network/interfaces" has an invalid netmask address?

text: The interfaces file looks like below:               auto lo     iface lo inet loopback          auto eth0     iface eth0 inet static         address 192.168.0.130         netmask 250.255.255.0         gateway 192.168.0.254      As you can see the netmask address is sort of invalid. (250 instead of 255) The problem is when we use the following code to get the current IP address and netmask:               ioctl(iSock, SIOCGIFADDR, &stIFReq);     ioctl(iSock, SIOCGIFNETMASK, &stIFReq);      It **always** returns " **72,0,67,33** " (hex:0x48004321) on both ioctl functions. I wonder if this is some sort of error code or bug during `ifup`. I would like to know what type of checking `ifup` does on netmasks/ip addresses and what does it do if the address is judged as invalid. Additional info:   1. Linux version 2.6.35.3   2. BusyBox v1.18.5   3. [ifup] is not a script but a C program on the system


title: Help with giving group permissions to other user's files

text: I'm a linux beginner using Debian 7 and have created a new user (a website) with an htdocs directory like this:               $ sudo adduser website     $ sudo mkdir -p /home/website/htdocs     $ sudo chown -R website /home/website      Now I'd like users of another group (developers) to have access to the user's directory and tried:               $ sudo chown -R :developers /home/website      I can see that the group is assigned (`ls -la` or `stat`) and that the users are in the group but they don't have access right?               drwxr-xr-x     3     website     developers     4096 May 3 09:09     website      I also want to:   * Allow another group, 'contractors' access to website files    * Restrict access of website users to their home directories only   * Ensure new website files inherit these permissions  Do you have to use access control lists - or is there a better way to do this (like not using a separate user for each site)?


title: sed - change lines that start with one given word and end with another?

text: For example, given:               $ cat test001.txt     this     is a      test bucket     bucket line not this one.       bucket lein endy         bucket and others endy     and     a ttest      How can I change the lines that start with "bucket" with "(bucket", ignoring spaces? So far I have:               sed -i 's/^\sbucket/bucket(/g' test001.txt          but that doesn't work (no change and no error). Then I would like to only do it for lines that _also_ end with 'endy' (so only 2 of the 3 bucket lines).


title: Remove lines that do not start with a pattern from a given set of patterns

text: I have a file that contains data like this:               report aaaaaaaa       -  ..       -th bbbbbbbbb       -to ccccccccc          .. --. Question: I want to remove any line that does not start with following strings :               report       -th       -to that means the desire output will remove all those middle unwanted dots and hashes and will look like this :               report aaaaaaaa       -th bbbbbbbbb       -to ccccccccc `sed`/`awk`/`grep`/etc any solution that will work.


title: Where in Gnome libs, is 'True' and 'False' defined?

text: I'm trying to compile a program with gnome-libs, that uses `True` and `False`, in one of the arguments. But what header file defines them? I'm getting the following error:               guignome/guignome.c: In function ‘gui_MenuBarEntryShown’:     guignome/guignome.c:1060: error: ‘False’ undeclared (first use in this function)     [...]     guignome/guignome.c: In function ‘creategw’:     guignome/guignome.c:1309: error: ‘True’ undeclared (first use in this function)     guignome/guignome.c:1319: error: ‘False’ undeclared (first use in this function)      This is one portion of code where this error occurs:                   if (optvaltext!=NULL) {           if (strcmp(optvaltext,wme->menuentry->optvalue)) {             gtk_menu_item_configure(GTK_MENU_ITEM(wme->menuentrywidget),ElvFalse,False);           } else {             gtk_menu_item_configure(GTK_MENU_ITEM(wme->menuentrywidget),ElvTrue,False);           };              }; /* optvaltext!=NULL */      The file only includes `gnome.h` and `glade.h`:               #include <gnome.h>     #include <glade/glade.h>      ...well?


title: zsh: how to get file expansion working in print statement

text: I have the following code which prints recursively all files inside /usr/local/include:               % files=(/usr/local/include/**/*(^/))     % print -l $files      Is it possible to get rid of the temporary variable? I would like to simply retrive a list of all files matched with the pattern. I tried:               % print -l "(/usr/local/include/**/*(^/))"      with no success.


title: Fuduntu not recognized by GRUB

text: Yesterday I installed FUDUNTU. During the install my MBR (I use ubuntu as my main OS) was overwritten. When I recovered the MBR I discovered that FUDUNTU was not listed. Any idea?


title: Run last line of error message as a command

text: If you were trying to run a package that is not installed, for example:               me ~: gparted           The program 'gparted' is currently not installed. You can install it by typing:     sudo apt-get install gparted      How can I run the `sudo apt-get install gparted` line as a command? Not typing it, obviously.


title: How does ZFS grow/scale?

text: I am wondering how would one design a ZFS system to build something that is massively scalable, along the lines of your favorite cloud storage, but with all the neat benefits the come with ZFS. A more specific scenario that I am wondering about is when you've hit the maximum number of drives in your server (internal/DAS/SAN whatever) and you need to expand to another server, how, if it is indeed possible, would you create a zpool/account that would extend from one to the other, where part of the data is stored on server one and the rest on server 2? How would you even manage this? I was particularly considering FreeBSD, because I also do not know of a way to create a server farm/cluster with FreeBSD.


title: Auto-mounting to a directory other than /media in Fedora 13

text: I am using Fedora 13. I need to be able to configure how media are mounted automatically. For an example, I want to change the parent of all mounted media to be a directory other than /media. All the material on the Internet seem to be old. I grepped the rules.d of udev but could not find any reference to /media. Could anybody know how to do that? Thanks


title: Arch + LXDE + lxdm -> INIT: Id "x" respawning too fast: Disabled for 5 minutes

text: I've been trying to install LXDE with lxdm on Arch, and followed the instructions given at archlinux.org and lxde.org on how to set these things up together. Here's the manipulations I make to `inittab`:               # Boot to X11     id:5:initdefault:      and add:               x:5:respawn:/usr/sbin/lxdm >& /dev/null     xt:5:wait:/usr/bin/chvt 7      just as I'm told to do from the 2 websites. The final result I get is: `INIT: Id "x" respawning too fast: Disabled for 5 minutes` I tried manipulating things so that I might get it to work but it doesn't! Thanks so much for any helps ;-)


title: Where should I put a script that needs to execute once when the user logs in graphically?

text: Using Gnome 3 on Fedora 15, where should I put a script that needs to execute once when the user logs in graphically?


title: How can I find the number of files on a filesystem?

text: I want to know how many files I have on my filesystem. I know I can do something like this: `find / -type f | wc -l` This seems highly inefficient. What I'd really like is to do is find the total number of unique inodes that are considered a 'file'. Is there a better way? Note: I would like to do this because I am developing a file synchronization program, and I would like to do some statistical analysis (like how many files the average user has total vs how many files are on the system). I don't, however, need to know anything about those files, just that they exist (paths don't matter at all). I would especially like to know this info for each mounted filesystem (and it's associated mount point).


title: Windows and Linux

text: I am already using Linux, and really did not want to switch to windows, but as fate would have it, i need Windows for my office work. I have been working on OpenSuSE for almost 2 years and it has been my primary system. I now wan to install Windows and be able to use OpenSuSE with that. I know its a naive question but i know too little about windows, always been a linux user.


title: Why do I have to escape a "dot" twice?

text: I know that we can escape a special character like `*(){}$` with `\` so as to be considered literals.   For example `\\*` or `\$` But in case of `.` I have to do it twice, like `\\\\.` otherwise it is considered special character. Example:               man gcc | grep \\.      Why is it so?


title: How to deny access to specific port when destination is NOT a specific host?

text: I'm trying to DENY access to port 1000 when it is being accessed through any host or IP that is NOT a specific host. I.e.   If I try to access the service on `sub.domain.com:1000` I _should_ get in.   If I try to access the service on `sub.domain2.com:1000` I _should not_ get in, even though both of these domains are A-records pointing to the same server. I'm trying to accomplish this using iptables with the following rules, but it's not working. It's allowing connections to any destination host/ip, not just the one I have set an ACCEPT rule to.               iptables -A INPUT -p tcp --destination sub.domain.com --dport 1000 -j ACCEPT     iptables -A INPUT -p tcp --dport 1000 -j DROP      The sub.domain2.com in this example, hosts different services, which is why I can't simply remove that DNS pointer.


title: Re-set $TMUX after unsetting

text: I did the following to try and get Byobu to work (see http://stackoverflow.com/questions/19099018/byobu-error-sessions-should-be- nested-with-care-unset-tmux-to-force ) on a Ubuntu server droplet I rent from Digital Ocean but it didn't fix my problem.               TMUX= ''      I would now like to revert it to it's original setting but do not know what the default should be. Is anyone able to advise? I'm hoping I am correct in thinking this is the appropriate location to post this even though the original question I link to above is from the StackOverflow site.


title: tmux: Set default session for attach

text: I have two tmux sessions (0 and 1), each with a set of windows. When I run `tmux a`, I attach to one of the two sessions, usually 1 but sometimes 0. I always want to attach to 0 if I don't specify a target-session. I've been looking through the manpage and have found the following: `tmux a -t 0` - Specify session 0 explicitly. I'd rather set 0 as the default session and avoid specifying an argument. > If a session is omitted, the current session is used if available; if no > current session is available, the most recently used is chosen. There is no current session (because there are no clients attached yet), and the "most recently used" does not seem to apply: I can detach from session 0 but when I reattach I end up on session 1. This seems to be time-sensitive; if I detach and reattach very quickly, I return to session 0, but if I wait even 1 second, I attach to session 1. Of course, I can create a shell alias for `tmux a -t 0` and use that if there's no way to set a default attach session. I could also swap the windows between sessions so that the ones I want are in session 1 instead of 0. Both of these feel like workarounds that I hoped would be unnecessary. I am running tmux 1.3-2+squeeze1.


title: how do I trim each line in bash?

text: I would like to remove all leading and trailing spaces and tabs from each line in an output. Is there a simple tool like `trim` I could pipe my output into?


title: How can I use grep to search for lines that start with a certain character in bash

text: I want an alias ('ggg') that will look through my existing set of aliases and tell me all the ones that _begin with_ g. I have a lot of g* aliases :) I tried this: `alias ggg='alias | grep ^g'` but didn't give me any output (or error). The thing I'm most unsure about is the 'start of line' character.


title: List only file size and name and symlinks

text: When I use `ls -lah` I get lots of information for each file. How can I get only the name and filesize? Additionally I would like to keep the listing of symlinks with the arrow like               lrwxrwxrwx  1 rubo77    rubo77       4 Nov 21 01:53 test2 -> test


title: Skills required for a good Linux job

text: I am working as an IT Engineer in a reputed company in India. The problem is that though I was told that I would be given work on Linux, I am made to do work on Java and Windows. I am uncomfortable with Java and hate Windows. I have started learning Python by myself but it's tough to give it ample time due to ongoing job. Frankly, I am not an expert coder. I tried a lot to get into Linux kernel development during my college days but realized that I am not that good a coder. So I decided to do RHCE and go for server management. What I want to know is that what skill set is required to get a job in Linux projects. In August 2011, I am planning to take a break from job if this company doesn't give me a good Linux project. What skills shall I acquire in order to get a good Linux job. One thing that I've decided to do during that break is to pursue RHCE. After reading first of the set of three RHCE course books, I am confident that I can sail through it. Inputs from experts on this site are highly invaluable. My technical interests at the moment are - Python Programming, C/C++ programming, Linux Server Management and Cloud Computing. But the college degree that I have is by no means sufficient to get into some good company. The practical knowledge I have is not of an expert level. And the job experience I have is simply pathetic. PS - I am extremely frustrated in my current job. Though I think there's barely any need to mention it.


title: What is excessive swapping

text: This post led me to ask that question. > **Cache contention** > > On a large site, if you are using MyISAM, contention occurs in the database > tables when the cache is forced to clear after a node or a comment is added. > With tens of thousands of filter text snippets needing to be deleted, the > table will be locked for a long period, and any accesses to it will be > queued pending the purge of the data in it. The same is true for the page > cache as well. > > This often causes a "site hang" for a minute or two. During that time new > requests keep piling up, and if you do not have the MaxClients parameter in > Apache setup correctly, the system can go into thrashing because of > excessive swapping.


title: why “xdg-open” fails although “xdg-mime query defaut ” succeeds on Ubuntu 10.10?

text: > **Possible Duplicate:**   >  Why does "xdg-open" fail although "xdg-mime query defaut " succeeds on > Ubuntu 10.10? (Sorry to post the question again for text format reason) On Ubuntu 10.10, "xdg-open" fails to open the file and give me an error ""No application is registered as handling this file" error ". But "xdg-mime query defaut ..." succeed for the mime type. Why? Here is my process: 1. added a new mime type "application/vnd.xx" by "xdg-mime install mytype.xml" Then "xdg-mime query filetype " shows the the new mime type is recognized. 2.I wrote my desktop entry file "my-app.desktop" like this: [Desktop Entry] Name=xxx Comment=xxx Icon= Exec=/usr/bin/my-app %U Terminal=false Type=Application Categories=Utility; MimeType=application/vnd.xx; 3.I copied this desktop file to ~/Desktop, after I re-login, I saw the shortcut on the desktop and "xdg-mime query defualt application/vnd.xx" print out this desktop file. 4.but, xdg-open fails with the error "No application is registered as handling this file" error"! I've installed nautilus. Do I miss something? Could anybody share me some idea? Great thanks! Amanda


title: Establish openvpn tunnel in bash script

text: I'm trying to write a script which will establish an openvpn tunnel when the computer boots up. The main problem lies in inputting the pkcs12 password. I realise it's very bad practice to have a password stored in plain text, but I'm not too fussed about that -- the computer is very secure in all other respects so I'm pretty confident that nobody but me will be accessing it to view the password. I have added the `\--management` and the `\--management-query-passwords` options so that the password can be input via a telnet session. This works fine when I do it manually, but when I try and do it automatically with a bash script it fails. My guess would be that either I am not doing the carridge return after the password line properly, or that some other garbage values are sneaking in to the telnet session as inputs. Here is the relevant bits of code (xxx for stuff that is classified):               $ cat user.ovpn     #OpenVPN Server conf     tls-client     client     dev tun     proto udp     tun-mtu 1400     remote xxxxxxxxxxxxxxxxxxx 1194     pkcs12 user.p12     cipher AES-256-CBC     comp-lzo     verb 3     ns-cert-type server     tls-remote xxxxxxxxxxxxxxxxxxxxxxx     management 127.0.0.1 5558     management-query-passwords          $ cat telnet_commands.sh     #!/bin/bash     echo "open 127.0.0.1 5558"     sleep 1     echo -e "password 'Private Key' xxxxxxxxxx\r\n"          $ nohup openvpn user.ovpn &     $ ./telnet_commands.sh | telnet          $ #manually check whether this worked:     $ telnet 127.0.0.1 5558     Escape character is '^]'.     >INFO:OpenVPN Management Interface Version 1 -- type 'help' for more info     >PASSWORD:Need 'Private Key' password      Obviously this is not working -- the openvpn telnet management interface is still waiting for the password to be entered.


title: Make synchronized folder with TFS in linux

text: I am using TFS every where on CentOS and I want to run a service to listen on directory modifying this directory represent TFS local folder and for every (add or modify) it mirroring to TFS I tried to use inotifywait and listen to event create,modify but I confusion when adding directory, when adding a directory 'ssss' output:               /tfs_loacl_folder/business_layer/ CREATE,ISDIR ssss     /tfs_loacl_folder/business_layer/ssss/ CREATE 1     /tfs_loacl_folder/business_layer/ssss/ MODIFY 1     /tfs_loacl_folder/business_layer/ssss/ CREATE www     /tfs_loacl_folder/business_layer/ssss/ MODIFY www     /tfs_loacl_folder/business_layer/ssss/ CREATE 112     /tfs_loacl_folder/business_layer/ssss/ MODIFY 112     /tfs_loacl_folder/business_layer/ssss/ CREATE asd


title: Run supervisord without root access

text: Hi I'm really new to writing scripts and I searched a lot but all that I've found is scripts with full access. I don't have access to the /etc. I'm working in a host in the cloud but I have limited access this is why all my attempts were unsuccessful. So far I have this:                   #!/bin/sh         prog="supervisord"         prefix="/usr/local/"         exec_prefix="${prefix}"         prog_bin="${exec_prefix}/bin/supervisord -c /home/user/supervisor/supervisord.conf"         PIDFILE="/var/run/$prog.pid"              start()         {         echo -n $"Starting $prog: "         daemon $prog_bin --pidfile $PIDFILE         [ -f $PIDFILE ] && success $"$prog startup" || failure $"$prog startup"         echo         }              stop()         {         echo -n $"Shutting down $prog: "         [ -f $PIDFILE ] && killproc $prog || success $"$prog shutdown"         echo         }              case "$1" in              start)         start         ;;              stop)          stop         ;;              status)         status $prog         ;;              restart)         stop         start         ;;              *)         echo "Usage: $0 {start|stop|restart|status}"         ;;              esac      But I always get this error:                  Starting supervisord: script.sh: 27: script.sh: daemon: not found        script.sh: 28: script.sh: failure: not found      Please help I have no idea what is going on ...