title: How may I Obtain a RHEL/CentOS in OVA Format?

text: My company has an internal cloud that provisions VMs either in an OpenStack (KVM) or a VMware (ESX) hypervisor. It already provides RHEL 6.4 on the KVM, but I've used up the max number of VMs from that hypervisor and need to start using the ESX one. However, the ESX does not have any RHEL templates and takes uploads of virtual machines in "OVA" format. "OFV" can be converted into "OVA", so I could use that as well. Yet I can't find a download of either of these files. Is there any link to a direct download? If not, how may I create an OVF/OVA of a RHEL 6.4 or CentOS 6.4?


title: find not working right

text: if [[ "$1" == "" ]]      then          leftarray=($(find . -type l -printf "%p\n" 2>/dev/null))     rightarray=($(find . -type l -printf "%l\n" 2>/dev/null))          for var in "${rightarray[@]}"     do        maximumarray[$index]=`echo "$var" | tr -dc "/" | wc -c | tr -d " "`        index=$(($index+1))     done     #############     for numbers in "${maximumarray[@]}"     do        if [[ $numbers > $MAX  ]]        then        MAX=$numbers        fi     done     #############     for var in "${rightarray[@]}"     do             component=`echo "$var" |  tr -dc "/" | wc -c | tr -d " "`             if [[ $component -eq $MAX  ]]             then             echo "Output: '${leftarray[$temp]} -> ${rightarray[$temp]}'"             fi        emp=$(($temp + 1))     done      Here's the problem When running script without arguments or switches it should search through all directories and subdirectories of directory where you are. It does not work and I do not know why and it drives me crazy. This script should find the symbolic link with longest number of `"/"` in `-printf "%l\n"` and output it. It should work when there are more links with same number of "/" this script have also switch `-d <number>` and it has the same code as above but in find i use also -maxdepth and it works fine so I do not know why this does not work. Any help ?


title: Linux "/dev/SDA" goes read only file system on SDB device failure

text: i have a very peculiar issue that is running in my system. Using debian linux : My system boots up very normally with a primary and secondary hard disk. suddenly my secondary hard disk fails with some I/O Error DRDY UNC errors which tends make my primary SDA to read only filesystem.   1. how to avoid primary to be changed as read only   2. What are all the steps i need to do for removing the SDB reference from the system   3. Is it possible to detect SDB removal from the system     * i was not able notice anything on SDA becoming readonly file ssytem Kernel Log::               15:52:13::kernel::[  203.251575] ata1.01: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0     15:52:13::kernel::[  203.251641] ata1.01: BMDMA stat 0x65     15:52:13::kernel::[  203.251699] ata1.01: failed command: READ DMA EXT     15:52:13::kernel::[  203.251768] ata1.01: cmd 25/00:08:f8:17:00/00:00:25:00:00/f0 tag 0 dma 4096 in     15:52:13::kernel::[  203.251771]          res 51/40:00:f8:17:00/40:00:25:00:00/10 Emask 0x9 (media error)     15:52:13::kernel::[  203.251932] ata1.01: status: { DRDY ERR }     15:52:13::kernel::[  203.251990] ata1.01: error: { UNC }     15:52:13::kernel::[  203.373641] ata1.00: configured for UDMA/133     15:52:13::kernel::[  203.405721] ata1.01: configured for UDMA/133     15:52:13::kernel::[  203.406808] ata1: EH complete     15:52:13::kernel::[  205.661201] ata1.01: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0     15:52:13::kernel::[  205.661267] ata1.01: BMDMA stat 0x65     15:52:13::kernel::[  205.661324] ata1.01: failed command: READ DMA EXT     15:52:13::kernel::[  205.661393] ata1.01: cmd 25/00:08:f8:17:00/00:00:25:00:00/f0 tag 0 dma 4096 in     15:52:13::kernel::[  205.661396]          res 51/40:00:f8:17:00/40:00:25:00:00/10 Emask 0x9 (media error)     15:52:13::kernel::[  205.661556] ata1.01: status: { DRDY ERR }     15:52:13::kernel::[  205.661614] ata1.01: error: { UNC }     15:52:13::kernel::[  205.769671] ata1.00: configured for UDMA/133     15:52:13::kernel::[  205.817705] ata1.01: configured for UDMA/133     15:52:13::kernel::[  205.817776] sd 0:0:1:0: [sdb] Unhandled sense code     15:52:13::kernel::[  205.817836] sd 0:0:1:0: [sdb] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE     15:52:13::kernel::[  205.817930] sd 0:0:1:0: [sdb] Sense Key : Medium Error [current] [descriptor]     15:52:13::kernel::[  205.818105] Descriptor sense data with sense descriptors (in hex):     15:52:13::kernel::[  205.818193]         72 03 11 04 00 00 00 0c 00 0a 80 00 00 00 00 00      15:52:13::kernel::[  205.818722]         25 00 17 f8      15:52:13::kernel::[  205.818914] sd 0:0:1:0: [sdb] Add. Sense: Unrecovered read error - auto reallocate failed     15:52:13::kernel::[  205.819056] sd 0:0:1:0: [sdb] CDB: Read(10): 28 00 25 00 17 f8 00 00 08 00     15:52:13::kernel::[  205.819477] end_request: I/O error, dev sdb, sector 620763128     15:52:13::kernel::[  205.819542] Buffer I/O error on device sdb5, logical block 70778879     15:52:13::kernel::[  205.819625] ata1: EH complete     15:52:13::kernel::[  208.257956] ata1.01: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0     15:52:13::kernel::[  208.258023] ata1.01: BMDMA stat 0x65     15:52:13::kernel::[  208.258081] ata1.01: failed command: READ DMA EXT     15:52:13::kernel::[  208.258149] ata1.01: cmd 25/00:08:f8:17:00/00:00:25:00:00/f0 tag 0 dma 4096 in     15:52:13::kernel::[  208.258153]          res 51/40:00:f8:17:00/40:00:25:00:00/10 Emask 0x9 (media error)     15:52:13::kernel::[  208.258314] ata1.01: status: { DRDY ERR }     15:52:13::kernel::[  208.258372] ata1.01: error: { UNC }     15:52:13::kernel::[  208.377642] ata1.00: configured for UDMA/133     15:52:13::kernel::[  208.409704] ata1.01: configured for UDMA/133     15:52:13::kernel::[  208.409771] ata1: EH complete     15:52:13::kernel::[  210.667618] ata1.01: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0     15:52:13::kernel::[  210.667684] ata1.01: BMDMA stat 0x65     15:52:13::kernel::[  210.667742] ata1.01: failed command: READ DMA EXT     15:52:13::kernel::[  210.667810] ata1.01: cmd 25/00:08:f8:17:00/00:00:25:00:00/f0 tag 0 dma 4096 in     15:52:13::kernel::[  210.667814]          res 51/40:00:f8:17:00/40:00:25:00:00/10 Emask 0x9 (media error)     15:52:13::kernel::[  210.667974] ata1.01: status: { DRDY ERR }     15:52:13::kernel::[  210.668048] ata1.01: error: { UNC }     15:52:13::kernel::[  210.789641] ata1.00: configured for UDMA/133     15:52:13::kernel::[  210.821716] ata1.01: configured for UDMA/133     15:52:13::kernel::[  210.821783] ata1: EH complete     15:52:13::kernel::[  213.088237] ata1.01: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0     15:52:13::kernel::[  213.088302] ata1.01: BMDMA stat 0x65     15:52:13::kernel::[  213.088359] ata1.01: failed command: READ DMA EXT     15:52:13::kernel::[  213.088427] ata1.01: cmd 25/00:08:f8:17:00/00:00:25:00:00/f0 tag 0 dma 4096 in     15:52:13::kernel::[  213.088430]          res 51/40:00:f8:17:00/40:00:25:00:00/10 Emask 0x9 (media error)     15:52:13::kernel::[  213.088590] ata1.01: status: { DRDY ERR }     15:52:13::kernel::[  213.088648] ata1.01: error: { UNC }     15:52:13::kernel::[  213.209641] ata1.00: configured for UDMA/133     15:52:13::kernel::[  213.241715] ata1.01: configured for UDMA/133     15:52:13::kernel::[  213.241782] ata1: EH complete     15:52:13::kernel::[  215.508902] ata1.01: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0     15:52:13::kernel::[  215.508969] ata1.01: BMDMA stat 0x65     15:52:13::kernel::[  215.509028] ata1.01: failed command: READ DMA EXT     15:52:13::kernel::[  215.509098] ata1.01: cmd 25/00:08:f8:17:00/00:00:25:00:00/f0 tag 0 dma 4096 in     15:52:13::kernel::[  215.509101]          res 51/40:00:f8:17:00/40:00:25:00:00/10 Emask 0x9 (media error)     15:52:13::kernel::[  215.509263] ata1.01: status: { DRDY ERR }     15:52:13::kernel::[  215.509321] ata1.01: error: { UNC }     15:52:13::kernel::[  215.629629] ata1.00: configured for UDMA/133     15:52:13::kernel::[  215.661719] ata1.01: configured for UDMA/133     15:52:13::kernel::[  215.661787] ata1: EH complete     15:52:13::kernel::[  217.918569] ata1.01: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0     15:52:13::kernel::[  217.918636] ata1.01: BMDMA stat 0x65     15:52:13::kernel::[  217.918694] ata1.01: failed command: READ DMA EXT     15:52:13::kernel::[  217.918762] ata1.01: cmd 25/00:08:f8:17:00/00:00:25:00:00/f0 tag 0 dma 4096 in     15:52:13::kernel::[  217.918765]          res 51/40:00:f8:17:00/40:00:25:00:00/10 Emask 0x9 (media error)     15:52:13::kernel::[  217.918927] ata1.01: status: { DRDY ERR }     15:52:13::kernel::[  217.918986] ata1.01: error: { UNC }     15:52:13::kernel::[  218.041627] ata1.00: configured for UDMA/133     15:52:13::kernel::[  218.073729] ata1.01: configured for UDMA/133     15:52:13::kernel::[  218.073795] ata1: EH complete     15:52:13::kernel::[  220.328276] ata1.01: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0     15:52:13::kernel::[  220.328342] ata1.01: BMDMA stat 0x65     15:52:13::kernel::[  220.328400] ata1.01: failed command: READ DMA EXT     15:52:13::kernel::[  220.328469] ata1.01: cmd 25/00:08:f8:17:00/00:00:25:00:00/f0 tag 0 dma 4096 in     15:52:13::kernel::[  220.328472]          res 51/40:00:f8:17:00/40:00:25:00:00/10 Emask 0x9 (media error)     15:52:13::kernel::[  220.328633] ata1.01: status: { DRDY ERR }     15:52:13::kernel::[  220.328690] ata1.01: error: { UNC }     15:52:13::kernel::[  220.449628] ata1.00: configured for UDMA/133     15:52:13::kernel::[  220.481707] ata1.01: configured for UDMA/133     15:52:13::kernel::[  220.481776] sd 0:0:1:0: [sdb] Unhandled sense code     15:52:13::kernel::[  220.481835] sd 0:0:1:0: [sdb] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE     15:52:13::kernel::[  220.481928] sd 0:0:1:0: [sdb] Sense Key : Medium Error [current] [descriptor]     15:52:13::kernel::[  220.482104] Descriptor sense data with sense descriptors (in hex):     15:52:13::kernel::[  220.482193]         72 03 11 04 00 00 00 0c 00 0a 80 00 00 00 00 00      15:52:13::kernel::[  220.482720]         25 00 17 f8      15:52:13::kernel::[  220.482911] sd 0:0:1:0: [sdb] Add. Sense: Unrecovered read error - auto reallocate failed     15:52:13::kernel::[  220.483053] sd 0:0:1:0: [sdb] CDB: Read(10): 28 00 25 00 17 f8 00 00 08 00     15:52:13::kernel::[  220.483473] end_request: I/O error, dev sdb, sector 620763128     15:52:13::kernel::[  220.483538] Buffer I/O error on device sdb5, logical block 70778879     15:52:13::kernel::[  220.483621] ata1: EH complete     15:52:13::kernel::[  222.770949] ata1.01: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0     15:52:13::kernel::[  222.771016] ata1.01: BMDMA stat 0x65     15:52:13::kernel::[  222.771075] ata1.01: failed command: READ DMA EXT     15:52:13::kernel::[  222.771144] ata1.01: cmd 25/00:08:f8:17:00/00:00:25:00:00/f0 tag 0 dma 4096 in     15:52:13::kernel::[  222.771147]          res 51/40:00:f8:17:00/40:00:25:00:00/10 Emask 0x9 (media error)     15:52:13::kernel::[  222.771309] ata1.01: status: { DRDY ERR }     15:52:13::kernel::[  222.771367] ata1.01: error: { UNC }     15:52:13::kernel::[  222.881632] ata1.00: configured for UDMA/133     15:52:13::kernel::[  222.913731] ata1.01: configured for UDMA/133     15:52:13::kernel::[  222.913798] ata1: EH complete     15:52:13::kernel::[  222.941704] kjournald starting.  Commit interval 5 seconds     15:52:13::kernel::[  222.941731] EXT3-fs: mounted filesystem with ordered data mode.     15:52:13::kernel::[  225.202590] ata1.01: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0     15:52:13::kernel::[  225.202677] ata1.01: BMDMA stat 0x65     15:52:13::kernel::[  225.202737] ata1.01: failed command: READ DMA EXT     15:52:13::kernel::[  225.202806] ata1.01: cmd 25/00:08:f8:17:00/00:00:25:00:00/f0 tag 0 dma 4096 in     15:52:13::kernel::[  225.202809]          res 51/40:00:f8:17:00/40:00:25:00:00/10 Emask 0x9 (media error)     15:52:13::kernel::[  225.202969] ata1.01: status: { DRDY ERR }     15:52:13::kernel::[  225.203027] ata1.01: error: { UNC }     15:52:13::kernel::[  225.325628] ata1.00: configured for UDMA/133     15:52:13::kernel::[  225.357730] ata1.01: configured for UDMA/133     15:52:13::kernel::[  225.357801] ata1: EH complete     15:52:13::kernel::[  227.645290] ata1.01: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0     15:52:13::kernel::[  227.645356] ata1.01: BMDMA stat 0x65     15:52:13::kernel::[  227.645414] ata1.01: failed command: READ DMA EXT     15:52:13::kernel::[  227.645483] ata1.01: cmd 25/00:08:f8:17:00/00:00:25:00:00/f0 tag 0 dma 4096 in     15:52:13::kernel::[  227.645486]          res 51/40:00:f8:17:00/40:00:25:00:00/10 Emask 0x9 (media error)     15:52:13::kernel::[  227.645648] ata1.01: status: { DRDY ERR }     15:52:13::kernel::[  227.645706] ata1.01: error: { UNC }     15:52:13::kernel::[  227.765627] ata1.00: configured for UDMA/133     15:52:13::kernel::[  227.797703] ata1.01: configured for UDMA/133     15:52:13::kernel::[  227.797773] ata1: EH complete     15:52:13::kernel::[  230.098939] ata1.01: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0     15:52:13::kernel::[  230.099010] ata1.01: BMDMA stat 0x65     15:52:13::kernel::[  230.099069] ata1.01: failed command: READ DMA EXT     15:52:13::kernel::[  230.099138] ata1.01: cmd 25/00:08:f8:17:00/00:00:25:00:00/f0 tag 0 dma 4096 in     15:52:13::kernel::[  230.099141]          res 51/40:00:f8:17:00/40:00:25:00:00/10 Emask 0x9 (media error)     15:52:13::kernel::[  230.099303] ata1.01: status: { DRDY ERR }     15:52:13::kernel::[  230.099361] ata1.01: error: { UNC }     15:52:13::kernel::[  230.221629] ata1.00: configured for UDMA/133     15:52:13::kernel::[  230.253724] ata1.01: configured for UDMA/133     15:52:13::kernel::[  230.253795] ata1: EH complete     15:52:13::kernel::[  232.552618] ata1.01: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0     15:52:13::kernel::[  232.552690] ata1.01: BMDMA stat 0x65     15:52:13::kernel::[  232.552750] ata1.01: failed command: READ DMA EXT     15:52:13::kernel::[  232.552819] ata1.01: cmd 25/00:08:f8:17:00/00:00:25:00:00/f0 tag 0 dma 4096 in     15:52:13::kernel::[  232.552823]          res 51/40:00:f8:17:00/40:00:25:00:00/10 Emask 0x9 (media error)     15:52:13::kernel::[  232.552984] ata1.01: status: { DRDY ERR }     15:52:13::kernel::[  232.553045] ata1.01: error: { UNC }     15:52:13::kernel::[  232.672647] ata1.00: configured for UDMA/133     15:52:13::kernel::[  232.705717] ata1.01: configured for UDMA/133     15:52:13::kernel::[  232.705787] ata1: EH complete     15:52:13::kernel::[  234.995333] ata1.01: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0     15:52:13::kernel::[  234.995405] ata1.01: BMDMA stat 0x65     15:52:13::kernel::[  234.995465] ata1.01: failed command: READ DMA EXT     15:52:13::kernel::[  234.995534] ata1.01: cmd 25/00:08:f8:17:00/00:00:25:00:00/f0 tag 0 dma 4096 in     15:52:13::kernel::[  234.995537]          res 51/40:00:f8:17:00/40:00:25:00:00/10 Emask 0x9 (media error)     15:52:13::kernel::[  234.996798] ata1.01: status: { DRDY ERR }     15:52:13::kernel::[  234.996857] ata1.01: error: { UNC }     15:52:13::kernel::[  235.117634] ata1.00: configured for UDMA/133     15:52:13::kernel::[  235.149719] ata1.01: configured for UDMA/133     15:52:13::kernel::[  235.149793] sd 0:0:1:0: [sdb] Unhandled sense code     15:52:13::kernel::[  235.149852] sd 0:0:1:0: [sdb] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE     15:52:13::kernel::[  235.149946] sd 0:0:1:0: [sdb] Sense Key : Medium Error [current] [descriptor]     15:52:13::kernel::[  235.150121] Descriptor sense data with sense descriptors (in hex):     15:52:13::kernel::[  235.150209]         72 03 11 04 00 00 00 0c 00 0a 80 00 00 00 00 00      15:52:13::kernel::[  235.150734]         25 00 17 f8      15:52:13::kernel::[  235.150925] sd 0:0:1:0: [sdb] Add. Sense: Unrecovered read error - auto reallocate failed     15:52:13::kernel::[  235.151067] sd 0:0:1:0: [sdb] CDB: Read(10): 28 00 25 00 17 f8 00 00 08 00     15:52:13::kernel::[  235.151486] end_request: I/O error, dev sdb, sector 620763128     15:52:13::kernel::[  235.151551] Buffer I/O error on device sdb5, logical block 70778879     15:52:13::kernel::[  235.151637] ata1: EH complete     15:52:13::kernel::[  236.328133] udev[324]: starting version 164     15:52:13::kernel::[  236.847381] input: PC Speaker as /devices/platform/pcspkr/input/input1     15:52:13::kernel::[  236.869301] ACPI: SSDT 1f7ae190 0023C (v01  PmRef  Cpu0Ist 00003000 INTL 20051117)     15:52:13::kernel::[  236.870585] ACPI: SSDT 1f7ae460 00594 (v01  PmRef  Cpu0Cst 00003001 INTL 20051117)     15:52:13::kernel::[  236.909933] Monitor-Mwait will be used to enter C-1 state     15:52:13::kernel::[  236.910903] Monitor-Mwait will be used to enter C-2 state     15:52:13::kernel::[  236.911011] Monitor-Mwait will be used to enter C-3 state     15:52:13::kernel::[  236.911033] Marking TSC unstable due to TSC halts in idle     15:52:13::kernel::[  236.911382] processor LNXCPU:00: registered as cooling_device0     15:52:13::kernel::[  236.912582] ACPI: SSDT 1f7ae0c0 000CC (v01  PmRef  Cpu1Ist 00003000 INTL 20051117)     15:52:13::kernel::[  236.913512] ACPI: SSDT 1f7ae3d0 00085 (v01  PmRef  Cpu1Cst 00003000 INTL 20051117)     15:52:13::kernel::[  236.934806] Switching to clocksource hpet     15:52:13::kernel::[  236.951454] processor LNXCPU:01: registered as cooling_device1     15:52:13::kernel::[  236.963534] input: Power Button as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0C:00/input/input2     15:52:13::kernel::[  236.963651] ACPI: Power Button [PWRB]     15:52:13::kernel::[  236.963941] input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input3     15:52:13::kernel::[  236.964096] ACPI: Power Button [PWRF]     15:52:13::kernel::[  236.965371] usbcore: registered new interface driver usbserial     15:52:13::kernel::[  236.965496] USB Serial support registered for generic     15:52:13::kernel::[  236.965921] usbcore: registered new interface driver usbserial_generic     15:52:13::kernel::[  236.965996] usbserial: USB Serial Driver core     15:52:13::kernel::[  237.241394] input: Video Bus as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/LNXVIDEO:00/input/input4     15:52:13::kernel::[  237.241512] ACPI: Video Device [IGD] (multi-head: yes  rom: no  post: no)     15:52:13::kernel::[  237.261956] USB Serial support registered for FTDI USB Serial Device     15:52:13::kernel::[  237.262819] ftdi_sio 2-2:1.0: FTDI USB Serial Device converter detected     15:52:13::kernel::[  237.263068] usb 2-2: Detected FT232BM     15:52:13::kernel::[  237.263131] usb 2-2: Number of endpoints 2     15:52:13::kernel::[  237.263194] usb 2-2: Endpoint 1 MaxPacketSize 64     15:52:13::kernel::[  237.263256] usb 2-2: Endpoint 2 MaxPacketSize 64     15:52:13::kernel::[  237.263318] usb 2-2: Setting MaxPacketSize 64     15:52:13::kernel::[  237.264372] intel_rng: FWH not detected     15:52:13::kernel::[  237.264747] usb 2-2: FTDI USB Serial Device converter now attached to ttyUSB0     15:52:13::kernel::[  237.264864] usbcore: registered new interface driver ftdi_sio     15:52:13::kernel::[  237.264932] ftdi_sio: v1.5.0:USB FTDI Serial Converters Driver     15:52:13::kernel::[  237.274123] parport_pc 00:0d: reported by Plug and Play ACPI     15:52:13::kernel::[  237.274251] parport0: PC-style at 0x378, irq 7 [PCSPP,TRISTATE]     15:52:13::kernel::[  237.591236] i801_smbus 0000:00:1f.3: PCI INT B -> GSI 19 (level, low) -> IRQ 19     15:52:13::kernel::[  237.800484] Linux video capture interface: v2.00     15:52:13::kernel::[  238.122025] ata1.00: configured for UDMA/133     15:52:13::kernel::[  238.137758] ata1.01: configured for UDMA/133     15:52:13::kernel::[  238.137823] ata1: EH complete     15:52:13::kernel::[  238.272620] [drm] Initialized drm 1.1.0 20060810     15:52:13::kernel::[  238.287023] uvcvideo: Found UVC 1.00 device USB2.0 Camera (1871:0d01)     15:52:13::kernel::[  238.294155] ata1.00: configured for UDMA/133     15:52:13::kernel::[  238.309758] ata1.01: configured for UDMA/133     15:52:13::kernel::[  238.309823] ata1: EH complete     15:52:13::kernel::[  238.395897] i915 0000:00:02.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16     15:52:13::kernel::[  238.395973] i915 0000:00:02.0: setting latency timer to 64     15:52:13::kernel::[  238.405049] [drm] set up 7M of stolen space     15:52:13::kernel::[  238.406952] input: USB2.0 Camera as /devices/pci0000:00/0000:00:1d.7/usb1/1-4/1-4:1.0/input/input5     15:52:13::kernel::[  238.407199] usbcore: registered new interface driver uvcvideo     15:52:13::kernel::[  238.407274] USB Video Class driver (v0.1.0)     15:52:13::kernel::[  238.750953] [drm] initialized overlay support     15:52:13::kernel::[  240.456610] [drm:edid_is_valid] *ERROR* Raw EDID:     15:52:13::kernel::[  240.456679] <3>ff 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  .???????????????     15:52:13::kernel::[  240.456686] <3>3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  ????????????????     15:52:13::kernel::[  240.456692] <3>3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  ????????????????     15:52:13::kernel::[  240.456698] <3>3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  ????????????????     15:52:13::kernel::[  240.456704] <3>3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  ????????????????     15:52:13::kernel::[  240.456709] <3>3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  ????????????????     15:52:13::kernel::[  240.456715] <3>3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  ????????????????     15:52:13::kernel::[  240.456721] <3>3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  ????????????????     15:52:13::kernel::[  240.456726]      15:52:13::kernel::[  242.094550] [drm:edid_is_valid] *ERROR* Raw EDID:     15:52:13::kernel::[  242.094619] <3>ff 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  .???????????????     15:52:13::kernel::[  242.094626] <3>3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  ????????????????     15:52:13::kernel::[  242.094632] <3>3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  ????????????????     15:52:13::kernel::[  242.094637] <3>3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  ????????????????     15:52:13::kernel::[  242.094643] <3>3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  ????????????????     15:52:13::kernel::[  242.094649] <3>3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  ????????????????     15:52:13::kernel::[  242.094655] <3>3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  ????????????????     15:52:13::kernel::[  242.094661] <3>3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  ????????????????     15:52:13::kernel::[  242.094665]      15:52:13::kernel::[  243.733641] [drm:edid_is_valid] *ERROR* Raw EDID:     15:52:13::kernel::[  243.733710] <3>ff 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  .???????????????     15:52:13::kernel::[  243.733717] <3>3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  ????????????????     15:52:13::kernel::[  243.733723] <3>3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  ????????????????     15:52:13::kernel::[  243.733729] <3>3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  ????????????????     15:52:13::kernel::[  243.733735] <3>3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  ????????????????     15:52:13::kernel::[  243.733741] <3>3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  ????????????????     15:52:13::kernel::[  243.733747] <3>3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  ????????????????     15:52:13::kernel::[  243.733753] <3>3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  ????????????????     15:52:13::kernel::[  243.733757]      15:52:13::kernel::[  245.373529] [drm:edid_is_valid] *ERROR* Raw EDID:     15:52:13::kernel::[  245.373598] <3>ff 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  .???????????????     15:52:13::kernel::[  245.373605] <3>3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  ????????????????     15:52:13::kernel::[  245.373611] <3>3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  ????????????????     15:52:13::kernel::[  245.373617] <3>3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  ????????????????     15:52:13::kernel::[  245.373623] <3>3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  ????????????????     15:52:13::kernel::[  245.373629] <3>3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  ????????????????     15:52:13::kernel::[  245.373635] <3>3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  ????????????????     15:52:13::kernel::[  245.373641] <3>3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f  ????????????????     15:52:13::kernel::[  245.373645]      15:52:13::kernel::[  245.373698] i915 0000:00:02.0: VGA-1: EDID invalid.     15:52:13::kernel::[  246.065548] Console: switching to colour frame buffer device 100x37     15:52:13::kernel::[  246.072122] fb0: inteldrmfb frame buffer device     15:52:13::kernel::[  246.072126] registered panic notifier     15:52:13::kernel::[  246.072326] [drm] Initialized i915 1.6.0 20080730 for 0000:00:02.0 on minor 0     15:52:13::kernel::[  246.072563] HDA Intel 0000:00:1b.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16     15:52:13::kernel::[  246.072799] HDA Intel 0000:00:1b.0: setting latency timer to 64     15:52:13::kernel::[  246.861037] hda_codec: ALC888: BIOS auto-probing.     15:52:13::kernel::[  246.862623] input: HDA Digital PCBeep as /devices/pci0000:00/0000:00:1b.0/input/input6     15:52:13::kernel::[  247.216847] ata1.00: configured for UDMA/133     15:52:13::kernel::[  247.288131] ata1.01: configured for UDMA/133     15:52:13::kernel::[  247.288242] ata1: EH complete     15:52:13::kernel::[  247.326018] ata1.00: configured for UDMA/133     15:52:13::kernel::[  247.341769] ata1.01: configured for UDMA/133     15:52:13::kernel::[  247.343158] ata1: EH complete     15:52:13::kernel::[  247.646542] Adding 2095096k swap on /dev/sda6.  Priority:-1 extents:1 across:2095096k      15:52:13::kernel::[  247.801381] EXT3 FS on sda1, internal journal     15:52:13::kernel::[  248.014353] loop: module loaded     15:52:13::kernel::[  249.435364] kjournald starting.  Commit interval 5 seconds     15:52:13::kernel::[  249.438402] EXT3 FS on sda5, internal journal     15:52:13::kernel::[  249.441482] EXT3-fs: mounted filesystem with ordered data mode.     15:52:13::kernel::[  249.516710] kjournald starting.  Commit interval 5 seconds     15:52:13::kernel::[  249.519947] EXT3 FS on sda2, internal journal     15:52:13::kernel::[  249.523090] EXT3-fs: mounted filesystem with ordered data mode.     15:52:13::kernel::[  249.969583] r8169: eth0: link up     15:52:13::kernel::[  249.972585] r8169: eth0: link up     15:52:13::kernel::[  250.830980] fuse init (API version 7.13)     15:52:22::kernel::[  260.936015] eth0: no IPv6 routers present     15:52:22::kernel::[  261.320413] HDA Intel 0000:00:1b.0: PCI INT A disabled     15:52:22::kernel::[  261.338235] HDA Intel 0000:00:1b.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16     15:52:22::kernel::[  261.338298] HDA Intel 0000:00:1b.0: setting latency timer to 64     15:52:22::kernel::[  261.408174] hda_codec: ALC888: BIOS auto-probing.     15:52:22::kernel::[  261.409625] input: HDA Digital PCBeep as /devices/pci0000:00/0000:00:1b.0/input/input7     15:52:23::kernel::[  261.862230] udev[1471]: starting version 164     15:52:23::kernel::[  262.158543] intel_rng: FWH not detected     15:52:24::kernel::[  263.314541] ata1.00: configured for UDMA/133     15:52:24::kernel::[  263.329765] ata1.01: configured for UDMA/133     15:52:24::kernel::[  263.329777] ata1: EH complete     15:52:24::kernel::[  263.353665] ata1.00: configured for UDMA/133     15:52:24::kernel::[  263.369782] ata1.01: configured for UDMA/133     15:52:24::kernel::[  263.369794] ata1: EH complete     15:53:23::kernel::[  321.725059] usb 3-1: new low speed USB device using uhci_hcd and address 3     15:53:23::kernel::[  321.965094] usb 3-1: New USB device found, idVendor=04b3, idProduct=3025     15:53:23::kernel::[  321.965103] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0     15:53:23::kernel::[  321.965111] usb 3-1: Product: USB NetVista Full Width Keyboard.     15:53:23::kernel::[  321.965116] usb 3-1: Manufacturer: LITE-ON Technology     15:53:23::kernel::[  321.965421] usb 3-1: configuration #1 chosen from 1 choice     15:53:23::kernel::[  321.999751] input: LITE-ON Technology USB NetVista Full Width Keyboard. as /devices/pci0000:00/0000:00:1d.1/usb3/3-1/3-1:1.0/input/input8     15:53:23::kernel::[  322.000373] generic-usb 0003:04B3:3025.0002: input,hidraw0: USB HID v1.10 Keyboard [LITE-ON Technology USB NetVista Full Width Keyboard.] on usb-0000:00:1d.1-1/input0     16:05:12::kernel::imklog 4.6.4, log source = /proc/kmsg started.


title: Remove duplicates from basenames in two files

text: I have two long lists of filenames, and I want to merge these two by excluding duplicated filenames in the sense of basename. For example, I have something like               ../data_folderA/file_1      ../data_folderA/file_2     ...     ../data_folderA/file_n      in list A and               ../data_folderB/file_1      ../data_folderB/file_2     ../data_folderC/fffile_1      ../data_folderC/fffile_2     ...     ../data_folderC/fffile_n      in list B. I want to exclude the duplicated file file_1 and file_2 in the merged list. Is there any quick way to do this?


title: Transpose several columns (of varying lengths) into rows

text: A similar question to mine was asked that concerned transposing multiple columns into rows. However, the particular column format that I am dealing with is slightly different in that my file contains a **_varying_** number of columns that sometimes have duplicates. For example:               100       1       2     3            200  300       1    1       2    2     3    3          100       1       2       3          400  500  600  700  800  900       1    1    1    1    1    1     2    2    2    2    2    2     3    3    3    3    3    3          100 400 700        1   1   1     2   2   2     3   3   3      I would like to transpose these columns into rows that look like the following:               100 1 2 3     200 1 2 3     300 1 2 3     100 1 2 3     400 1 2 3     500 1 2 3     600 1 2 3     700 1 2 3     800 1 2 3     900 1 2 3     100 1 2 3     400 1 2 3     700 1 2 3       And then sort the rows by the values of the first column as follows:               100 1 2 3     100 1 2 3     100 1 2 3         200 1 2 3     300 1 2 3     400 1 2 3     400 1 2 3         500 1 2 3     600 1 2 3     700 1 2 3     700 1 2 3         800 1 2 3     900 1 2 3       And sum the values for duplicated rows as follows:               100 3 6 9         200 1 2 3     300 1 2 3     400 2 4 6     500 1 2 3     600 1 2 3     700 2 4 6        800 1 2 3     900 1 2 3       You will notice that because rows 100, 400, and 700 had duplicates, their columnar values have been summed. Any insights or suggestions are greatly appreciated.


title: How does ifconfig find a machine's external IP address?

text: Normally when I want to check the external IP address of a given machine, I simply `curl` some external website that sends me a response telling me what my IP address appears to it. However, I've noticed that `ifconfig` has my external IP address listed as well. Does `ifconfig` have some sort of "canonical" source on the web that it sends requests to determine a machine's IP address or does it have some other method of finding out a machine's IP address?


title: What numeric key codes do I need to send for the magic sysrq functionality in a VNC session?

text: I have access to the system console of a KVM guest through VNC. What key codes do I need to send for the magic sysrq sequence (`Ctrl`+`Alt`+"REISUB") in Linux? Edit: In Linux under `qemu`, running `showkey` and the command `sendkey alt- sysrq-h` in the QEMU monitor reveals keycodes 99 (`SysRq`?), 56 (`Alt`), and 35 (`H`). Using UltraVNC Viewer's Send Custom Key command, none of those numeric codes came out correctly when entered and viewed through `showkey`.


title: What happens under the hood when some data is sent/received on an uart (or similar)?

text: I am trying to understand how computers work and I was thinking about peripherals. Here is what I understand so far but some parts are missing. Using an Arduino, I send some text every second (a then b then c, ...) via UART to a Pandaboard. I guess that there is a special chip on the Pandaboard or its microprocessor that is always listening to the rx pin. When it sees some voltage change, it starts recording the byte and sends an interrupt to the Linux system. The system stops everything, asks the chip for the new byte, then writes it to `/dev/ttyUSB3` for instance. First thing that I don't understand: if I do `cat /dev/ttyUSB3` I see the characters showing up every second (`a..b..c`). If I stop `cat`, wait 5 seconds, and do `cat` again, I see (`i..j..k...`) but I expect to see the missing characters (`d..e..f..g..h`) that were sent but not catted but I don't see them. How does cat work? What's in this `/dev/ttyUSB3` file? Conversely, if I do `echo "hello" > /dev/ttyUSB3`, the system will somehow tell the chip to send electrical signals on the tx pin. Does it send it byte by byte to the chip? Or all together?


title: Escaping blackslash in sed

text: I am trying to write a sed command to replace a line in a file. The sed replace required the current working directory, which starts making the command a bit messy because of the characters that need to be escaped. Here is what I have so far:               sed -i "s/^log.*$/log `echo pwd | sed 's/\//\\\//g'`\/redis\/redis.log\/" ./conf/redis.conf      However this give me an error with sed. I have tried to break it up into easier commands:               user@ubuntu:~/project$pwd | sed 's/\//\\\//g'     \/home\/user\/project      This returns what I want, but when I try to add in command substitution, it fails:               user@ubuntu:~/project$ echo `pwd | sed 's/\//\\\//g'`     sed: -e expression #1, char 9: unknown option to `s'      Any help would be appreciated


title: How to make URL's out of this text with least resources?

text: INPUT:               nyeeeeeeeeeeeeeee.txt:sadfsadf     sadjflsajfd:jasdlfjalsfd     foo/asdfsafd.txt:laksjdlfajsfd      OUTPUT:               nyeeeeeeeeeeeeeee.txt:sadfsadf     sadjflsajfd:jasdlfjalsfd     foo/asdfsafd.txt:laksjdlfajsfd      So I need to convert the INPUT to OUTPUT, the difference is that OUTPUT is "clickable" because this is in a HTML file. **Q:** How can I do this with awk, sed or perl? I know I can do a "read line by line", but what is the most resource efficient way to do this? (I only need 1 solution, not for all sed/awk/etc.) `:` is the delimiter.


title: How can I recreate a VT100 environment and connect an Esprit 250C Terminal?

text: I have an `Esprit 250c Modular Color RS/232 Terminal` "Intelligence Unit"   ( overview here, and pdf of features here ) ![esprit 250c](http://i.stack.imgur.com/FrEa4.png) I would like to make it work as a text-based tty terminal, maybe `VT100` as it seems to be one of the most common standards. Here are the connections this device has: ![device connections](http://i.stack.imgur.com/AZGTT.png) I also have a PC with a 9-pin serial port that I have running Ubuntu 14.04 and access to PCs and Macs. I have been looking into the utilities like `putty`, `screen`, `minicom`, `kermit` and so on. I also read up on the LTSP project and watched a few videos on how to create Ubuntu thin clients on YouTube. I have been reading up on things like the Text Terminal How To which seems to be one of the most complete resources but I still have a few questions. I'm very comfortable with Linux and understand the basics of how things like named pipes work and, and the history behind why terminals sessions are referenced as `/dev/tty1` etc. I get the impression that I'm doing the opposite of what most people are doing - namely using a terminal emulator program to connect to a remote "server" rather than trying to figure out how to create a "terminal text server" to power an antiquated device. Nevertheless, I have several questions regarding the "next steps" of my project:   1. I'm assuming I can run something like `minicom` on my linux box and connect the Esprit directly to that using the serial port. But...   2. How does the "handshake" work? Do I need to configure specific settings on both devices to allow them to talk? ( baud rate, dialing string, etc. ? )   3. Or once you plug in the serial cable is it really just as simple as if you pipe text to `/dev/ttyS0` have have it show up on the monitor of the Esprit?   4. If configuration does need to take place, do I need a special keyboard to access this? According to this chapter it seems like there used to be a few extra keys on most terminal keyboards, like the "setup" key, which are apparently no longer included in a standard 101-key keyboard)? If not, how do I press "setup" on a standard keyboard? ( I could not find any manuals with instructions for setup for the Esprit 250C ) ![](http://puu.sh/a3gGI/8b165cef02.png)   5. Does having a serial cable with more pins work differently from the smaller serial cable that has only 9 pins? Do serial ports with more pins work at a higher speed?   6. This device came with a plastic adapter for the bigger serial port ( `Serial 1` ) and on the back side is an RJ45 plug. It is labeled `MODEM CAB-5MODCM`. What is this for? It looks like it would allow you to do a serial connection via an RJ45 plug or RJ11 plug which I believe have 8 and 4 wires respectively. How many wires are used in the minimum RS232 communication? 6? 4? 2?   7. Any suggestions on specific next steps or common pitfalls to avoid?   8. If using something like an serial to RJ11 or RJ45 adapter, how do I know what pins to use? I've seen several of these with 'configurable pins':   ![enter image description here](http://i.stack.imgur.com/U1Ccl.jpg)


title: Getting rsync failures randomly

text: I am getting the following `rsync` errors randomly from my capistrano scripts.               rsync: stat "/app/test-0.1-SNAPSHOT.jar.SB4uq7" failed: No such file or directory (2)     rsync: rename "/app/test-0.1-SNAPSHOT.jar.SB4uq7" -> "target/test-0.1-SNAPSHOT.jar": No such file or directory (2)     rsync: mkstemp "/app/.run-test-reports.sh.dY7r8H" failed: No such file or directory (2)     rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1039) [sender=3.0.6]      I am using the following `rsync` command: `rsync -Oarvzp --progress "#{source}" "#{user}@#{destination_host}:#{destination}/"` Can someone help me in solving it ?


title: file size shown by "du -k" is different in different file systems (PRAMFS and FLASH)

text: I have a file "xyz.log" which is of size 1.72MB In FLASH file system : If I run `du -k xyz.log` output is `1761 xyz.log`. I copied the same file to RAM storage and run the `du -k xyz.log` output is `221 xyz.log`. If I run `ls -lrth`, the file size in both file systems is same (`-rw-r--r-- 1 root aspa 1.7M Jan 1 00:25 xyz.log`). RAM file system is `pramfs` and FLASH file system is `jffs2`. Why the disk usage of same file is different in different file systems and how to get the same disk usage in all file systems?


title: Process's father after setpgid(0,0);

text: I have a process **P1** (child of some parent process **P0** ) both in the same process group. **P1** somewhere in his code runs: `setpgid(0,0);` then a new process group is created (where the group leader is **P1** ).   * Who is now **P1** 's father: still **P0** , the session leader or some other?


title: Internal secondary hard disk suddenly failing to mount

text: In RHEL5, my internal secondary hard disk (1TB) suddenly fails to mount after some unexpected power failure and after my system got off. But it's showing in BIOS and while Booting checking as sdb device. I had tried list in `/sbin/fdisk -l`, but I didn't find that disk in list. It contains Some IMP data in it. Recently I added this 1TB HDD as a secondary and mounted it and it worked fine. How do you resolve this issue without losing data. I need an step-by-step solution as I'm new to Linux. If you need more information, please tell me so.


title: Configure bash and/or vim to execute source ~/.bashrc everytime I finish editing it

text: I would like to execute `source ~/.bashrc` every time I finish editing a file with `vim` (i.e. after `:wq` `vim` command). How should I configure `vim` or `bash` to work that way?


title: What is the corresponding freebsd command of these rpm commands?

text: I know about rpm, but I am newbie about freebsd packaging system. I learnt about how to create package and know I want learn how to get some information about packages or files. Can somebody give me corresponding freebsd commands of below rpm commands?               rpm -qlp <package> # list files of a package     rpm -qf <file>     # show package name that file belong to     rpm -aq            # show all installed packages


title: Is there a unix command line tool that can analyze font files?

text: Given a directory of font files (TTF and OTF) I'd like to inspect each font and determine what style (regular, italic, bold, bold-italic) it is. Is there a command line tool for unix flavored operating systems that can do this? Or does anyone know how to extract the metadata from a TTF or OTF font file? thanks!


title: What do all the pictures on the front of the "Unix and Linux System Administration Handbook" represent?

text: I'm a newcomer to Unix and Linux, and I've been trying to get up to speed on everything. One of the guides I've used is the "Unix and Linux System Administration Handbook" It's a pretty great book, and I'm enjoying reading through it, but I'm really confused by all the things that are on the cover. While this may not be a typical question for Unix & Linux Stack Exchange, I don't think it is necessarily a bad question so I'm going to go out on a limb and ask:               What do all the crazy things on the cover of this book represent?      Attached is an image of the book and a reference key. Thanks for the history lesson. ![unix-administration- handbook.jpg](http://img585.imageshack.us/img585/130/unixadministrationhandb.jpg)   1. Flag   2. Flag (Finland's for Linus Torvalds?)   3. Bird / Cake   4. Guy in a lab coat with a baseball bat   5. Gnome   6. Clam   7. Python   8. Cowboy and two cats   9. Penguin   10. Gorilla   11. Old dude on another boat sailing away and apparently flipping off this boat   12. Two guys carved in wood with a shield   13. Octopus / Monster   14. Filing cabinet   15. Clock   16. Indian   17. Girl with a book   18. Computer using a canon   19. Window frame   20. Lady, fishing pole, and boot   21. Apple Core   22. Less and More   23. Bar of Soap / Can of Spam   24. Periscope   25. Heart / Valentine   26. Monster with Maracas ps: What is the significance of the ship?


title: Why do different terminals have different values for keys in the .inputrc file?

text: This question really started from here. I would like to know why different terminals like rxvt and xterm use different values when mapping key combinations? Whilst I am in rxvt or xterm how can I find out the value of a key sequence and easily add this to the .inputrc file?


title: CPU Placement in KVM

text: I have a configuration of KVM guests where the cpu placement is configured as follows:               <vcpu placement='static'>1</vcpu>      Now since I don't have a cpuset specified I was reading libvirt documentation and saw the following: "If both cpuset and placement are not specified, or if placement is "static", but no cpuset is specified, the domain process will be pinned to all the available physical CPUs." What exactly does this mean? I know CPU pinning states that you can only run tasks on a specific CPU that is specified. What does it mean to be "pinned" to all available physical CPUs?


title: How to ask for specific parameters with grep?

text: I need to look in `/usr/share/dict/words` for a 5-letter word that starts with `d` or `D`, followed by a lowercase vowel, and ends with `s`. I have tried everything but to no avail.


title: How can I make a switch accessible via the internet, that allows users to turn on or off a python script?

text: I have a python script running on a home laptop that runs Ubuntu 13.10. I want to give 2 or 3 people the ability to start or kill that script, but no other privileges. I don't want to give them access to the script itself, since the code is sensitive. Is there an easy way to do that?


title: wget changing image name from within page

text: The image is generated once every `n` minutes, and I want to get each of these to my local directory. I had no success in getting the png-image using the command:               wget -r -l1 --no-parent -A.png http://url.com/home/images/      since it is blocked by the site, and I cannot use               wget http://url.com/home/images/filename.png      since the name of the images changes from update to update. The image is however linked in `http://url.com/home/index.html` and I could get the file name from there. What is a robust way to do this? I know the pattern to search for: it is the only image that is called from the directory `/home/images/`.


title: Groupwise uniq command?

text: I am searching for a command to get from a file in this format:               hello 32     hello 67     hi    2     ho    1212     ho    1390     ho    3000      To this format (deduplicate by taking the last row of a "group"):               hello 67     hi    2     ho    3000      At the moment I am using a Python and pandas snippet:                   df = pd.read_csv(self.input().path, sep='\t', names=('id', 'val'))              # how to replace this logic with shell commands?         surface = df.drop_duplicates(cols=('id'), take_last=True)              with self.output().open('w') as output:             surface.to_csv(output, sep='\t', cols=('id', 'val'))      * * * Update: Thanks for the great answers. Here are some benchmarks: Input file is 246M and contains 8583313 lines. Order does not matter. First column has a fixed size of 9 chars. Example of the input file:               000000027       20131017023259.0        00     000000027       20131017023259.0        11     000000035       20130827104320.0        01     000000035       20130827104320.0        04     000000043       20120127083412.0        01     ...      * * *                                             time        space complexity          tac .. | sort -k1,1 -u        27.43682s   O(log(n))     Python/Pandas                 11.76063s   O(n)     awk '{c[$1]=$0;} END{for(...  11.72060s   O(n)      Since the first column has a fixed length, `uniq -w` can also be used:               tac {input} | uniq -w 9        3.25484s   O(1)


title: Get a progress indicator when importing MySQL databases

text: I often import MySQL databases, and this can take a while. There is no progress indicator whatsoever. Can one be shown, somehow? Either records imported, MB imported, or tables imported... anything is better than just waiting. Anybody any idea? I use this command: `mysql -uuser -p -hhost database < largefile.sql` Files are between 40-300 MB, and the host is within the local network.


title: How can I have different Emacs sessions loaded on different Emacs windows while using Emacs on daemon mode?

text: I'm currently using Emacs on daemon mode. I save my sessions using the desktop package. I also combine that with this in order to have several named sessions saved. If I have several Emacs windows open they all open up in the same session and if I switch to another session all the Emacs windows switch to the same session. I would like to be able to have different session in different Windows. How can this be done?


title: What's the easiest way to move from Linux Mint 13 to 14?

text: I want to switch to 14 as easily as possible. What's the best way? Do I have to remove 13 and install 14 from scratch, or is there another way?


title: What are "Allowable Drives" in Cent 6.4 Installation

text: Durring an install of CentOS 6.4, I see two locations where I can select "Allowable Drives" The first time I select "Allowable Drives" is to select which drives are added to my fstab. That makes sense, and I have no questions there. The second time I see "Allowable Drives" is while creating a partition. ![enter image description here](http://i.stack.imgur.com/wfU8a.jpg) According to the description > Allowable Drives: This field contains a list of the hard disks installed on > your system. If a hard disk's box is highlighted, then a desired partition > can be created on that hard disk. If the box is not checked, then the > partition will never be created on that hard disk. By using different > checkbox settings, you can have Disk Druid place partitions where you need > them, or let Disk Druid decide where partitions should go. > http://www.centos.org/docs/5/html/5.2/Installation_Guide/ch04s18s05.html I am adding an ext4 partition to disk sdb. I have gone through the partitioning several times, experimenting with checking sdb, sdb and sdd, and just sdd So far, the partition is created correctly regardless which drive is checked in this box. Can someone enlighten me what these options are supposed to change?


title: using stat to provide timestamp for touch

text: Am trying to OCR some documents insitu (from a linux command line on a windows share). The process of OCRing is find and I have muddled through using the find command to pipe the files through the loop correctly. However I need to preserve the original timestamp for modified. I am currently trying to use stat and touch as below:               #!/bin/bash     OLDIFS=$IFS              IFS=$(echo -en "\n\b")              for f in `find /mnt/library/Libra/Libra/Ashfords -name "*.pdf"`              do             ORIGTS=`stat -c "%Y" $f`             sudo /opt/ABBYYOCR9/abbyyocr9 -rl English -pi -if $f -f PDFA -paemImageOnText -pafpr original -of $f             touch -t $ORIGTS $f              done              IFS=$OLDIFS      Of course the touch command fails. running the commands separately I notice "stat -c" is something along the lines of this: 1334758696 which is like no date I know. I feel as if I am close but cannot work out how to convert the date I have in to a touch friendly version. Is it some form of seconds from something?


title: Official Description UNC (Universal Naming Convention)

text: Can anybody point to a man page or specification that defines the Universal Naming Convention (UNC)? I'm looking for the original source of the idea


title: 'ImportError: No module named _struct' error when managing packages

text: I'm running elementary OS 0.2 (based on Ubuntu 12.04) and starting today I'm seeing a weird error when attempting to install/upgrade packages. Just now for example I did a:               sudo apt-get update      which worked fine, followed by a:               sudo apt-get upgrade      which attempted returned this:               Setting up idle-python2.7 (2.7.3-0ubuntu3.5) ...     Traceback (most recent call last):       File "/usr/lib/python2.7/compileall.py", line 16, in <module>         import struct       File "/usr/lib/python2.7/struct.py", line 1, in <module>         from _struct import *     ImportError: No module named _struct     dpkg: error processing idle-python2.7 (--configure):      subprocess installed post-installation script returned error exit status 1     Errors were encountered while processing:      idle-python2.7     E: Sub-process /usr/bin/dpkg returned an error code (1)      What is going on? Obviously this is related to the `python` package but I can still run `python` scripts without issues. How can I fix this? * * * **Add** Following the advice given in the answer I tried:               sudo apt-get --reinstall install python python-support      This returned:               Reading package lists... Done     Building dependency tree            Reading state information... Done     0 upgraded, 0 newly installed, 2 reinstalled, 0 to remove and 0 not upgraded.     1 not fully installed or removed.     Need to get 0 B/192 kB of archives.     After this operation, 0 B of additional disk space will be used.     (Reading database ... 864980 files and directories currently installed.)     Preparing to replace python 2.7.3-0ubuntu2.2 (using .../python_2.7.3-0ubuntu2.2_i386.deb) ...     Unpacking replacement python ...     Preparing to replace python-support 1.0.14ubuntu2 (using .../python-support_1.0.14ubuntu2_all.deb) ...     Unpacking replacement python-support ...     Processing triggers for man-db ...     Processing triggers for doc-base ...     Processing 1 changed doc-base file...     Registering documents with scrollkeeper...     Setting up idle-python2.7 (2.7.3-0ubuntu3.5) ...     Traceback (most recent call last):       File "/usr/lib/python2.7/compileall.py", line 16, in <module>         import struct       File "/usr/lib/python2.7/struct.py", line 1, in <module>         from _struct import *     ImportError: No module named _struct     dpkg: error processing idle-python2.7 (--configure):      subprocess installed post-installation script returned error exit status 1     Setting up python (2.7.3-0ubuntu2.2) ...     Setting up python-support (1.0.14ubuntu2) ...     Traceback (most recent call last):       File "/usr/local/lib/python2.7/site.py", line 548, in <module>         main()       File "/usr/local/lib/python2.7/site.py", line 530, in main         known_paths = addusersitepackages(known_paths)       File "/usr/local/lib/python2.7/site.py", line 266, in addusersitepackages         user_site = getusersitepackages()       File "/usr/local/lib/python2.7/site.py", line 241, in getusersitepackages         user_base = getuserbase() # this will also set USER_BASE       File "/usr/local/lib/python2.7/site.py", line 231, in getuserbase         USER_BASE = get_config_var('userbase')       File "/usr/local/lib/python2.7/sysconfig.py", line 516, in get_config_var         return get_config_vars().get(name)       File "/usr/local/lib/python2.7/sysconfig.py", line 449, in get_config_vars         import re       File "/usr/local/lib/python2.7/re.py", line 105, in <module>         import sre_compile       File "/usr/local/lib/python2.7/sre_compile.py", line 14, in <module>         import sre_parse       File "/usr/local/lib/python2.7/sre_parse.py", line 17, in <module>         from sre_constants import *       File "/usr/local/lib/python2.7/sre_constants.py", line 18, in <module>         from _sre import MAXREPEAT     ImportError: cannot import name MAXREPEAT     Errors were encountered while processing:      idle-python2.7     E: Sub-process /usr/bin/dpkg returned an error code (1)      so it's a no go.


title: Shell script that copies while adding a user-provided filename suffix

text: I'm trying to write a shell script on Solaris that copies files from one directory to another. I need it to prompt the user for a date, and add that as a suffix to the destination filenames. How do I go about doing that?


title: How to analyze profile data from `perf record --a` (system-wide collection)?

text: I am using `perf` from linux-2.6.36-gentoo-r4. The `/proc/sys/kernel/perf_event_paranoid` is set to 0, so there should be no problems from there. Because long-running application I am profiling sometimes crashes for some indetermined reason (no information as to reason for it stopping working could be found by me), I turned to system-wide profiling with perf events. The application in question does parallelized numerical calculations, using MPI (Message Passing Interface) for communication. Before running the application (with `mpirun`) I have started recording system-wide profile data on _one_ of nodes it is run with:               $ perf record -o perf.all.cycles,graph.data -g -e cycles -a &      After I have realized that application crashed, I have killed the `perf` task. It had left               $ du -sh perf.all.cycles,graph.data      14G     perf.all.cycles,graph.data      14GB of data. Unfortunately `perf report` doesn't support the `-a` switch. **How can I analyze system-wide profiling data from`perf` tool**? * * * **Added 2011.08.12** Simply running `perf report` doesn't produce useful output:               $ perf report -i perf.all.cycles,graph.data     #     # (For a higher level overview, try: perf report --sort comm,dso)     #      That is the whole of output from 14GB profile data...


title: Where can I propose development ideas for Linux desktop?

text: I've got this idea for Linux desktop development which keep bugging me since a while. Now I can program a tiny bit, but it's just a hobby, so I'm not very good at it. So I want to propose my idea somewhere, because I think it would really stand out as a good tool for desktops. Where can I propose my idea so it can be thought through, improved and possibly developed by a team of interested and competent people?


title: Searching for a string on multiple zip files.

text: I have a folder that contains about 200 zip files. Each zip file contains only one text file in it. I would like to search for a specific string in all the text files in all the zip files. I tried this (which searches for any text file in the zip file that contains the string "ORA-") but it didnt work.               zipgrep ORA-1680 *.zip      What is the correct of doing it without uncompressing the zip files (on a SunOS 5.10 )? Thanks


title: Short domain name to FQDN expansion

text: Is it possible to configure where the system will look for the machine if I enter just a short domain name? I work in a grid environment where the machines are many and spread across multiple domains, but they have unique naming, therefore let say `skirit23` will only be found as `skirit23.ics.muni.cz` I could configure the full mappings, but that would be a big file (and constantly changing one). Therefore I was thinking if I could configure the system to look into the `ics.muni.cz` then try `ncbr.muni.cz` then try `fav.zcu.cz` etc...


title: Mounting an ext3 fs with user privledges

text: I'm trying to mount an ext3 file system from another linux installation so that the user, not root, will have full access to all the files. (I really do need user to have access to those files, because I would like to use them from another computer via sshfs, and sshfs will only give the user's access rights to the files.) If I do `mount /dev/sda1 /mnt/whatever` all files are only accessible by root. I've also tried `mount -o nosuid,uid=1000,gid=1000 /dev/sda1 /mnt/whatever` as instructed by a SuperUser question discussing ext4 but that fails with an error, and dmesg reports `EXT3-fs: Unrecognized mount option "uid=1000" or missing value` How can I do the mount?


title: Add consecutive numbers succintly and elegantly to index lines

text: I usually do this               $ wc questions       33   36 3105 questions     $ seq 1 33 > nums     $ paste nums questions     1       Content     2       ...     .     .     33      End Content      but I feel there could be faster way to do this, without the bad-looking dummy file. How with some basic *ix -tool? Any simpler way to do it? I use Vim so I am happy also with Vim-based solution but simple unix-based solution also works (actually probably better in some cases, I can always spawn inside the editor). Below a general case. **Input**               A     B     C     .     .     X      **Output**               1. A     2. B     3. C     .     .     N. X


title: List files sorted numerically

text: I have a bunch of files from `log1` to `log164`. I'm trying to LIST the directory (sorted) in a UNIX terminal but the sort functions are only providing the format like this:               home:logs Home$ ls -1 | sort     log1.gz     log10.gz     log100.gz     log101.gz     log102.gz     log103.gz     log104.gz     log105.gz     log106.gz     ...etc      What I want is               home:logs Home$ ls -1 | sort     log1.gz     log2.gz     log3.gz     log4.gz     log5.gz     log6.gz     log7.gz     ...{more here}     log99.gz     log100.gz     log101.gz     log102.gz     ...etc      Any suggestions in what I could use to do this?


title: See if file has been copied to USB

text: Is there a way to see if a file has been copied to an USB drive? (Ex: I have the file secret.db and I suppose that my friend has copied it into his USB drive. With `stat $filename` I cannot see the updated a/c/m/time because `cp` doesn't update the timestamps). Is there a way to know that or it is impossible? I'm using Ubuntu 12.04 with Bash v4.


title: How to open a local URL (webpage) on the command line

text: On MacOS X I can run               open /some/path/index.html      and this would open the page `index.html` with the default software that handles `.html` files. Is there something similar on Ubuntu Linux? I have used `gnome-open` in the past, but if there is no gnome installed, this command fails, of course.               gnome-open /some/path/index.html      Is there a generic "open this file with the default application" on Linux?


title: EUI64 and ipv6: how to use own EUI64 for IPv6 autoconfiguration

text: As I heard the extended unique identifier (EUI-64) can be used as the lower 64 bits of a IPV6 address. How can I set my own EUI64 = ( IEEE_company_ID + manufacture_ID) on the interface on Linux SUSE SLES11 to use it for Lilnk Local and SLAAC generation of ipv6 address on that interface? Is it possible?   Or generation of LinkLocal and SLAAC address uses only MAC48’s EUI64! Best wishes, Ivan


title: How to check the life left in SSD or the medium's wear level?

text: We all know that SSDs have a limited predetermined life span. How do I check in Linux what the current health status of an SSD is? Most Google search results would ask you to look up S.M.A.R.T. information for a percentage field called Media_Wearout_Indicator, or other jargons indicators like Longterm Data Endurance -- which don't exist -- Yes I did check two SSDs, both lack these fields. I could go on to find a third SSD, but I feel the fields are not standardized. To demonstrate the problem here are the two examples. * * * With the first SSD, it is not clear which field indicates wearout level. However there is only one Unknown_Attribute whose RAW VALUE is between 1 and 100, thus I can only assume that is what we are looking for:                   $ sudo smartctl -A /dev/sda                                                      smartctl 6.2 2013-04-20 r3812 [x86_64-linux-3.11.0-14-generic] (local build)         Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org              === START OF READ SMART DATA SECTION ===                                          SMART Attributes Data Structure revision number: 1                                Vendor Specific SMART Attributes with Thresholds:                                 ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE           5 Reallocated_Sector_Ct   0x0002   100   100   000    Old_age   Always       -       0           9 Power_On_Hours          0x0002   100   100   000    Old_age   Always       -       6568          12 Power_Cycle_Count       0x0002   100   100   000    Old_age   Always       -       1555         171 Unknown_Attribute       0x0002   100   100   000    Old_age   Always       -       0         172 Unknown_Attribute       0x0002   100   100   000    Old_age   Always       -       0         173 Unknown_Attribute       0x0002   100   100   000    Old_age   Always       -       57         174 Unknown_Attribute       0x0002   100   100   000    Old_age   Always       -       296         187 Reported_Uncorrect      0x0002   100   100   000    Old_age   Always       -       0         230 Unknown_SSD_Attribute   0x0002   100   100   000    Old_age   Always       -       190         232 Available_Reservd_Space 0x0003   100   100   005    Pre-fail  Always       -       0         234 Unknown_Attribute       0x0002   100   100   000    Old_age   Always       -       350         241 Total_LBAs_Written      0x0002   100   100   000    Old_age   Always       -       742687258         242 Total_LBAs_Read         0x0002   100   100   000    Old_age   Always       -       1240775277      So this SSD has used 57% of its rewrite life-span, is it correct? * * * With the other disk, the SSD_Life_Left ATTRIBUTE stands out, but its Raw value of 0, indicating 0% life left, is unlikely for an apparently-healthy SSD unless it happen to be in peril (we will see in a few days), and if it reads "0% life has been used", also impossible for a worn hard disk (worn = used for more than a year).                   > sudo /usr/sbin/smartctl -A /dev/sda         smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.11.6-4-desktop] (SUSE RPM)         Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org              === START OF READ SMART DATA SECTION ===         SMART Attributes Data Structure revision number: 10         Vendor Specific SMART Attributes with Thresholds:         ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE           1 Raw_Read_Error_Rate     0x000f   104   100   050    Pre-fail  Always       -       0/8415644           5 Retired_Block_Count     0x0033   100   100   003    Pre-fail  Always       -       0           9 Power_On_Hours_and_Msec 0x0032   100   100   000    Old_age   Always       -       4757h+02m+17.130s          12 Power_Cycle_Count       0x0032   099   099   000    Old_age   Always       -       1371         171 Program_Fail_Count      0x0032   000   000   000    Old_age   Always       -       0         172 Erase_Fail_Count        0x0032   000   000   000    Old_age   Always       -       0         174 Unexpect_Power_Loss_Ct  0x0030   000   000   000    Old_age   Offline      -       52         177 Wear_Range_Delta        0x0000   000   000   000    Old_age   Offline      -       2         181 Program_Fail_Count      0x0032   000   000   000    Old_age   Always       -       0         182 Erase_Fail_Count        0x0032   000   000   000    Old_age   Always       -       0         187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       0         194 Temperature_Celsius     0x0022   030   030   000    Old_age   Always       -       30 (Min/Max 30/30)         195 ECC_Uncorr_Error_Count  0x001c   104   100   000    Old_age   Offline      -       0/8415644         196 Reallocated_Event_Count 0x0033   100   100   000    Pre-fail  Always       -       0         231 SSD_Life_Left           0x0013   100   100   010    Pre-fail  Always       -       0         233 SandForce_Internal      0x0000   000   000   000    Old_age   Offline      -       3712         234 SandForce_Internal      0x0032   000   000   000    Old_age   Always       -       1152         241 Lifetime_Writes_GiB     0x0032   000   000   000    Old_age   Always       -       1152         242 Lifetime_Reads_GiB      0x0032   000   000   000    Old_age   Always       -       3072


title: How to save a session in Yakuake

text: I use the Yakuake drop-down terminal and would love if it could save my session of tabs somehow. When I have 6-7 tabs open, all named and everything, it is a giant pita having to re-create that on every reboot. Any ideas?


title: Installing oDeskTeam in Arch Linux

text: Here's my current situation: I need to install this annoying little app on Arch 64bits, but the odeskteam package one from the AUR repositories isn't working. I've tried the following: **-- Installing from AUR with Yaourt.** The installation outputs an error:               /tmp/yaourt-tmp-alainus/aur-odeskteam/./PKGBUILD: line 40: pkgextract.sh: command not found     ==> ERROR: A failure occurred in build().     Aborting...      **-- Installing from AUR with Yaourt, and removing line #40 as suggested in comments** :               /tmp/yaourt-tmp-alainus/aur-odeskteam/./tmp.sMpeyQoiTy: line 41: syntax error near unexpected token `}'     /tmp/yaourt-tmp-alainus/aur-odeskteam/./tmp.sMpeyQoiTy: line 41: `}'     ==> ERROR: Failed to source /tmp/yaourt-tmp-alainus/aur-odeskteam/./tmp.sMpeyQoiTy     Unable to read PKGBUILD      -- **Downloading the Arch Linux package from oDesk (here).** The installation complains about qt not being present.                % sudo pacman -U odeskteam-3.2.57-arch-x86_64.pkg.tar.xz                                                                 :(     loading packages...     resolving dependencies...     warning: cannot resolve "qt", a dependency of "odeskteam"     :: The following package cannot be upgraded due to unresolvable dependencies:           odeskteam          :: Do you want to skip the above package for this upgrade? [y/N] N     error: failed to prepare transaction (could not satisfy dependencies)     :: odeskteam: requires qt      After doing sudo `pacman -S qt`, which installs qt5, it still outputs the same. -- **Installing the windows version through wine.** I cannot paste here the plethora of errors that wine gave me, until I definitely erased everything that had to do with wine for the rest of my life. -- **Installing it in another computer with Ubuntu 13.04** , and trying to open it through SSH X11 Forwarding. The program opens on the other side, but locally throws an error: oDeskTeam Exited Abnormally. Can anyone suggest another method for having this installed? I don't want to use a VM just to install a little 900KB app.


title: How to invoke a shell built-in explicitly?

text: I want to customize the functionality of `cd` command as per my needs. I define following function - `function cd () { cd "$@" && pushd "$@"; }` The intent of this function is to automatically push the directory onto the stack so that it saves me the effort to manually type `pushd .` everytime. However the above function is an infinitely recursive function as the call to cd is interpreted to be the function itself and not the `cd` built-in. How do I reference the `cd` built-in in this function? I know that aliases can be escaped using `\`. What is the way to escape functions or reference built-ins in a more explicit way? _Note: I do not want to rename my function to anything else._


title: Unknown DAV provider: svn

text: I did something wrong On my CentOS 5.9, I did the following:               cd /usr/local/directadmin/custombuild     ./build rewrite_confs      But now I get an error restarting httpd:               [root@1332 conf]# service httpd restart     Stopping httpd:                                            [FAILED]     Starting httpd: Syntax error on line 213 of /usr/local/directadmin/data/users/admin/httpd.conf:     Unknown DAV provider: svn      @line 213, there is something like:               <Location />         DAV svn         SVNPath /var/svn/         AuthType Basic         AuthName "Dytech Solutions Subversion repository"         AuthUserFile /etc/svn-auth-file         Require valid-user     </Location>      My guess is that my DirectAdmin is automatically writing them locale httpd.conf files. And I messed up the SVN repositories somehow... I'm also guessing that it has to do something with an alternative apache config due to autobuild so the module isn't loaded normally. I found this link Where its states that: First, your httpd.conf needs to load the mod_dav_svn module. If you pass --enable-mod-activation to Subversion's configure, 'make install' target should automatically add this line for you. In any case, if Apache HTTPD gives you an error like "Unknown DAV provider: svn", then you may want to verify that this line exists in your httpd.conf:                    LoadModule dav_svn_module     modules/mod_dav_svn.so      But I'm afraid to break even more stuff Please help


title: enable SMART for HP hard disk

text: I would like to use SMART to perform a health check of my hard disk. I have an HP server of 4 years ago I believe. Everytime I try to use the following command                smartctl -a /dev/sda      I got an error message saying the following                Device does not support SMART           Error Counter logging not supported      Device does not support Self Test logging      Does it really mean that there is no way I can use SMART on these disk or is it just because I am missing some driver or my BIOS is too old? According to `dmidecode` I have bios 2.7 so it should be not too old. I am using CENTOS 6.4.


title: Using tail to follow daily log file in Bash

text: I have a task to use a bash script to monitor a couple of log files named with the current day, eg. YYYY-MM-DD.log. (1) I used `tail -f` to follow the file but unable to deal file rotation. Even if using `tail -F $FILENAME`, I can only follow the log for 24 hours max and need to restart again. What I wish to accomplish is to have something like `tail -F $CURRENTDATE`, so I can leave it running forever and every midnight It will switch to follow the new log file named with current date. But it seems the variable `$CURRENTDATE` is not dynamic. Is there another way to do this without `crontab`'ing the script every 24 hours? Maybe set a symbolic file or something? (2) Meanwhile, if `tail -f` is used, what signal will it return if the file it follows is missing or changes its name? How can I trap the exceptions during execution.


title: How to add additional Gnome-Shell and Unity workspace navigation shortcuts

text: I am very familiar with (and love) the workspace switching in Gnome-Shell and Unity (using `Ctrl`+`Alt`+[`Up`/`Down`/`Right`/`Left`]), but being a `vim` fan, it would also be great if I could add an additional shortcut which would use the vim keys for navigating, so that you could also use               <Ctrl-Alt-[hjkl]>      as appropriate. Now, I'm quite familiar with how to _override_ the exisiting shortcuts, but I would like to add _additional_ shortcuts. I have a hint of where to start, but am lacking a detail. When I go to the keyboard settings, I recognize that I could simply switch the short cuts for move workspace right/left and so on, but that doesn't help me add a new command at all. It seems that the right way to go about this is to add a new command in the 'Custom Shortcust' section of that page. Doing that I can set (for example) to be any command that I want, but I don't know what command I would need to send in order to tell Gnome to move a workspace down. I've searched around a bit but I'm having trouble finding anything along these lines. If you are familiar with Gnome3/Gnome-Shell/Unity commands, would you please help me find a command line command that I could execute in order to get what I want here? Thanks for your time. Chris


title: `cd` up the canonical path

text: Consider:               $ pwd     /home/user     $ ls -l     total 3604     lrwxrwxrwx 1 user user  19 Nov 27 12:11 pages -> /var/www/pages/          $ cd pages     $ pwd     /home/user/pages     $ readlink -f .     /var/www/pages          $ cd ..     $ readlink -f .     /home/user     $       When I'm in `/var/www/pages` I would like to go up to `/var/www` however running `cd ..` brings me to `/home/user`. Obviously this is due to having gotten to `/var/www/pages` via a symlink. **How can I`cd` up one directory when I'm in a symlink?**


title: How to change color of a character while tailing and tr

text: I regularly use this command line but I would like to change the color of the "|" to green in the output. Does anyone know how I can accomplish this?               tail -f file.log  | tr '\001' '|' | grep TEST


title: Determine which process is creating a file

text: Given file path, how can I determine which process creates it (and/or reads/writes to it)?


title: Find which process is modifying a file

text: A specific file on our production servers is being modified at apparently random times which do not appear to correlate with any log activity. We can't figure out what program is doing it, and there are many suspects. How can I find the culprit? It is always the same file, at the same path, but on different servers and at different times. The boxes are managed by puppet, but the puppet logs show no activity at the time the file is modified. What kernel hook, tool, or technique could help us find what process is modifying this file? * * * lsof is unsuitible for this, because the file is being opened, modified and closed very quickly. Any solution that relies upon polling (such as running lsof often) is no good. * * *   * OS: Debian testing   * Kernels: Linux, 2.6.32 through 3.9, both 32 and 64-bit.


title: How do I know which process created a file?

text: Some program keeps creating a `Desktop` folder in my home directory, although I configured `xdg-dirs` so that my home directory is my `DESKTOP` directory, so this shouldn't happen. Anyway, how do I know who is the culprit? I strongly suspect of Firefox but I want to be sure.


title: Need to delete mails for a range of dates in Linux

text: I have 1 million mails generated in a Linux sever due to a cron job. I want to delete the mails, but not all as this cron mails useful to troubleshoot and find out the issue with cron job's execution. So I need to keep 1 month's mail and remove the remaining.


title: Why am I getting DUP! reply when using ping -A

text: We have 2 VM's running on ESX 5.1. When I do a `ping -A`, after a while I get every second ping as a `DUP!`. When doing a normal `ping`, I get 5 or 6 `DUP!`s, and then it returns to normal. Any ideas what to check?


title: File handles and filenames

text: I read this post. Are file descriptors the same as file handle? While trying to configure the linux kernel, it asks `open by fhandle syscalls (FHANDLE) [Y/n/?]`. Why is this option provided? Does it affect performance of kernel or compiling time or just to have a uniform method of accessing files?


title: Which book of those two should i read to study networking for Unix/Linux administrator?

text: I'm quite a beginner to networking, I want to get the information that i need as a Linux/Unix admin. I have two books in hand right now:   1. TCP/IP Illustrated, Volume 1: The Protocols    2. UNIX and Linux System Administration Handbook The first one is 1059 pages long, only for networking, So it's so much detailed. The second one i feel is talking about networking in an outlined fashion, About 500 pages. I don't want to spend too much time studying for something that won't benefit me much. So what book of those two do you recommend me ? If there's another one, I'd be grateful if you told me about.


title: phpmyadmin 403 error

text: i mannually installed phpMyAdmin according to this doc:quick install.but i keep getting the 403 error, i can successfully get into other folders in the root dir, how can i sovle this? here is my config.inc.php:               <?php     /* vim: set expandtab sw=4 ts=4 sts=4: */     /**      * phpMyAdmin sample configuration, you can use it as base for      * manual configuration. For easier setup you can use setup/      *      * All directives are explained in Documentation.html and on phpMyAdmin      * wiki <http://wiki.phpmyadmin.net>.      *      * @package phpMyAdmin      */          /*      * This is needed for cookie based authentication to encrypt password in      * cookie      */     $cfg['blowfish_secret'] = 'jfdsajfdksa'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */          /*      * Servers configuration      */     $i = 0;          /*      * First server      */     $i++;     /* Authentication type */     $cfg['Servers'][$i]['auth_type'] = 'cookie';     /* Server parameters */     $cfg['Servers'][$i]['host'] = 'localhost';     $cfg['Servers'][$i]['connect_type'] = 'tcp';     $cfg['Servers'][$i]['compress'] = false;     /* Select mysql if your server does not have mysqli */     $cfg['Servers'][$i]['extension'] = 'mysqli';     $cfg['Servers'][$i]['AllowNoPassword'] = false;          /*      * phpMyAdmin configuration storage settings.      */          /* User used to manipulate with storage */     // $cfg['Servers'][$i]['controluser'] = 'pma';     // $cfg['Servers'][$i]['controlpass'] = 'pmapass';          /* Storage database and tables */     // $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';     // $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';     // $cfg['Servers'][$i]['relation'] = 'pma_relation';     // $cfg['Servers'][$i]['table_info'] = 'pma_table_info';     // $cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';     // $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';     // $cfg['Servers'][$i]['column_info'] = 'pma_column_info';     // $cfg['Servers'][$i]['history'] = 'pma_history';     // $cfg['Servers'][$i]['tracking'] = 'pma_tracking';     // $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';     // $cfg['Servers'][$i]['userconfig'] = 'pma_userconfig';     /* Contrib / Swekey authentication */     // $cfg['Servers'][$i]['auth_swekey_config'] = '/etc/swekey-pma.conf';          /*      * End of servers configuration      */          /*      * Directories for saving/loading files from server      */     $cfg['UploadDir'] = '';     $cfg['SaveDir'] = '';          /**      * Defines whether a user should be displayed a "show all (records)"      * button in browse mode or not.      * default = false      */     //$cfg['ShowAll'] = true;          /**      * Number of rows displayed when browsing a result set. If the result      * set contains more rows, "Previous" and "Next".      * default = 30      */     //$cfg['MaxRows'] = 50;          /**      * Use graphically less intense menu tabs      * default = false      */     //$cfg['LightTabs'] = true;          /**      * disallow editing of binary fields      * valid values are:      *   false  allow editing      *   'blob' allow editing except for BLOB fields      *   'all'  disallow editing      * default = blob      */     //$cfg['ProtectBinary'] = 'false';          /**      * Default language to use, if not browser-defined or user-defined      * (you find all languages in the locale folder)      * uncomment the desired line:      * default = 'en'      */     //$cfg['DefaultLang'] = 'en';     //$cfg['DefaultLang'] = 'de';          /**      * default display direction (horizontal|vertical|horizontalflipped)      */     //$cfg['DefaultDisplay'] = 'vertical';               /**      * How many columns should be used for table display of a database?      * (a value larger than 1 results in some information being hidden)      * default = 1      */     //$cfg['PropertiesNumColumns'] = 2;          /**      * Set to true if you want DB-based query history.If false, this utilizes      * JS-routines to display query history (lost by window close)      *      * This requires configuration storage enabled, see above.      * default = false      */     //$cfg['QueryHistoryDB'] = true;          /**      * When using DB-based query history, how many entries should be kept?      *      * default = 25      */     //$cfg['QueryHistoryMax'] = 100;          /*      * You can find more configuration options in Documentation.html      * or here: http://wiki.phpmyadmin.net/pma/Config      */     ?>


title: Bring up shutdown menu of Cinnamon via command line

text: How can I bring up the shutdown menu of Cinnamon via command line? **Note** : I don't want the user menu. This menu for switching or logging out a user is brought up via `Ctrl`+`Alt`+`Del`.


title: Uninstalling *.run file

text: I just installed a file called **SenchaCmd-4.0.2.67-linux-x64.run** by executing the following code:               ./SenchaCmd-4.0.2.67-linux-x64.run      Due to a problem I describe in detail here, I decided to uninstall SenchaCmd. However, it is not listed in Ubuntu Software Centre or Synaptic Package Manager. **How do I completely uninstall this program?** Running which, I found the installation location as:               /root/bin/Sencha/Cmd/4.0.1.45/sencha-4.0.1.45      If I executed **rm -rf /root/bin/Sencha** will that completely???


title: What is the difference between a Console, Shell, Terminal, Terminal emulator, Terminal multiplexer, and a Window manager?

text: For example. What is the difference between a default 'interface/console' of FreeBSD/archlinux, vs Terminal, vs Terminal emulator like Xterm, vs Terminal multiplexer like tmux, vs Window manager like awesome; and where does Bash and other 'shells' fit in all this?


title: Calling an email script from another script using ssmtp on ubuntu

text: I have an issue with a script, which works fine except that it only sends email when I run it directly from the shell but when called during crontab it doesn't send the emails. There are 2 scripts the main script which does a backup and it calls another script which sends the email. the backup script dump the summary of the operation in a file and reads the file again when to pass it to the email sender script to send. Based on how ssmtp works that's the architecture I have come up with. I needed to change the subject based on the success or failure of the operation. I have been using my gmail thus using the ssmtp library to send the email. How to make the backup script send the email when called by `crontab` schedule?               #!/bin/bash          # File system Parameters     #=========================================================================     TIMESTAMP=`date +%F-%H.%M.%S`     TODAYS_DATE=`date +%Y-%m-%d`          BACKUP_PATH="/mnt/backups/mongo"     SCRIPT_PATH="/root/script"     FILE_NAME="mongodb-$TIMESTAMP"          # Email Parameters     #=========================================================================     TEMPLATE_FILE="/tmp/template.txt"     EMAIL_SUBJECT_CONTEXT="Xylo"     EMAIL_RECIPIENT="myeamil"     EMAIL_SENDER="DB man"     #=========================================================================          BACKUP_PATH=$BACKUP_PATH/$TODAYS_DATE               echo; echo "files will be geneated in  $BACKUP_PATH" | tee $TEMPLATE_FILE     #=========================================================================          [ ! -d  $BACKUP_PATH ] && mkdir -p $BACKUP_PATH || :           if [ -d "$BACKUP_PATH" ]; then         cd $BACKUP_PATH              TMP_BACKUP_DIR="$BACKUP_PATH/mongodb-$TIMESTAMP"              echo; echo "=> $(date +%F-%H.%M.%S) Backing up Mongo Server: $MONGO_HOST:$MONGO_PORT" | tee -a $TEMPLATE_FILE; echo -n ' ' ;                   if [ "$MONGOUSERNAME" != "" -a "$MONGOPASSWORD" != "" ]; then             $MONGODUMP_PATH --host $MONGO_HOST:$MONGO_PORT -u $MONGOUSERNAME -p $MONGOPASSWORD --out $TMP_BACKUP_DIR >> /dev/null         else              $MONGODUMP_PATH --host $MONGO_HOST:$MONGO_PORT --out $TMP_BACKUP_DIR >> /dev/null         fi              echo; echo "=> $(date +%F-%H.%M.%S) Mongo Server: $MONGO_HOST:$MONGO_PORT  backup files generated"  | tee -a $TEMPLATE_FILE; echo -n ' ';              if [ -d "$TMP_BACKUP_DIR" ]; then                  if [ "$FILE_NAME" == "" ]; then                      FILE_NAME = "mongodb-$TIMESTAMP"             fi                  echo; echo "=> $(date +%F-%H.%M.%S) dumping file into  $FILE_NAME.tar.gz"  | tee -a $TEMPLATE_FILE; echo -n ' ';                  $TAR_BIN_PATH --remove-files -czf $FILE_NAME.tar.gz $TMP_BACKUP_DIR >> /dev/null                  if [ -f "$FILE_NAME.tar.gz" ]; then                      echo "=> $(date +%F-%H.%M.%S) successfully generated file $FILE_NAME.tar.gz of size: `du -sh $FILE_NAME.tar.gz` " | tee -a $TEMPLATE_FILE; echo;                      echo; echo "=> $(date +%F-%H.%M.%S) Uploading $FILE_NAME.tar.gz to $S3_BUCKET_NAME on s3" | tee -a $TEMPLATE_FILE; echo -n ' ';                          s3cmd put $FILE_NAME.tar.gz s3://$S3_BUCKET_NAME/$S3_BUCKET_PATH/$FILE_NAME.tar.gz                          filename=s3://$S3_BUCKET_NAME/$S3_BUCKET_PATH/$FILE_NAME.tar.gz             count=$(s3cmd ls ${filename} | awk "\$4 == \"${filename}\" { print \$4 }" | wc -l)     #            if [[ $? -eq 0 ]]; then              if [ $count -eq 0 ]; then                          echo "!!!!=> File $FILE_NAME.tar.gz could not be added to s3" | tee -a $TEMPLATE_FILE                     /bin/sh "$SCRIPT_PATH/s3_backup_email_sender.sh" "$EMAIL_RECIPIENT" "$EMAIL_SENDER" "$EMAIL_SUBJECT_CONTEXT BACKUP FAILURE [s3 Upload]" "$(cat $TEMPLATE_FILE)"                 else                         echo "=> $(date +%F-%H.%M.%S) File $FILE_NAME.tar.gz has successfully be added to s3" | tee -a $TEMPLATE_FILE                                /bin/sh "$SCRIPT_PATH/s3_backup_email_sender.sh" "$EMAIL_RECIPIENT" "$EMAIL_SENDER" "$EMAIL_SUBJECT_CONTEXT BACKUP SUCCESSFUL" "$(cat $TEMPLATE_FILE)"                      fi                 if [ -d "$TMP_BACKUP_DIR" ]; then                         rm -rf "$TMP_BACKUP_DIR"                 fi              else                      echo "!!!=> Failed to create backup file: $BACKUP_PATH/$FILE_NAME.tar.gz"  | tee -a $TEMPLATE_FILE; echo;                 /bin/sh "$SCRIPT_PATH/s3_backup_email_sender.sh" "$EMAIL_RECIPIENT" "$EMAIL_SENDER" "$EMAIL_SUBJECT_CONTEXT BACKUP FAILURE [Failed to gzip $FILE_NAME.tar.gz]" "$(cat $TEMPLATE_FILE)"             fi              else             echo; echo "!!!=> Failed to backup mongoDB or Nothing to Back up"  | tee -a $TEMPLATE_FILE; echo;              /bin/sh "$SCRIPT_PATH/s3_backup_email_sender.sh" "$EMAIL_RECIPIENT"  "$EMAIL_SENDER"  "$EMAIL_SUBJECT_CONTEXT BACKUP FAILURE [Nothing to back up]" " $(cat $TEMPLATE_FILE)"              fi      else          echo "!!!=> Failed to create backup path: $BACKUP_PATH" | tee -a $TEMPLATE_FILE          /bin/sh "$SCRIPT_PATH/s3_backup_email_sender.sh" "$EMAIL_RECIPIENT" "$EMAIL_SENDER" "$EMAIL_SUBJECT_CONTEXT BACKUP FAILURE [Failed to create backup folder]" "$(cat $TEMPLATE_FILE)"      fi      this is the sending script               #!/bin/bash     Now=$(date +"%Y-%m-%d")     SSMTP="$(which ssmtp)"               TEMPLATE="/tmp/s3_backup_mail.txt"          echo "To: $1" > $TEMPLATE     echo "From: $2" >> $TEMPLATE     echo "Subject: $3" >> $TEMPLATE     echo " " >> $TEMPLATE     echo  "$4" >> $TEMPLATE          $SSMTP $1 < $TEMPLATE     #rm $TEMPLATE


title: vncserver -compatiblekbd fails with unrecognized option

text: I found that when I connect to my computing cluster via vnc `Alt-x` is not recognized correctly as`M-`. I tried               vncserver -compatiblekbd      but I get               Unable to start Xvnc, exiting      Actually once my session was started and in the log I found:               Fatal server error:     Unrecognized option: -compatiblekbd`      How can I pass this option to vncserver and get the correct mapping of `Alt+x` ? ![screenshot of the effect of pressing Alt+x](http://i.stack.imgur.com/Z2gsj.png)


title: Why do I keep destroying my text files?

text: I have destroyed a bunch of non-essential files and I don't know why. I have been executing commands like:               tr -sc 'A-Za-z' '\n' > somefile.txt | less      there is no output (blank page with flashing END) and upon checking all the content from the file is erased. Another command that erased a full text file               grep someword > someotherfile.txt  | less


title: Bash Script Display Remote Screen Session to User

text: I'm kind of new to bash scripting and I'm having trouble figuring out how to accomplish this. I'm working on a script that is designed to backup and manage a java application that runs within a screen session. The goal is to be able to have multiple instances of the java application running on the different machines and to be able to control them over ssh from the script. A feature I would like to have is the ability to easily call up the screen session of one of the java instances and display it to the user. So if the screen session is running on Machine A and I want to show it to the user on Machine B, I want to be able to initiate an ssh connection and call that up programmatically. In short, I want to mimic the following user commands in a bash script:               ssh user@1.2.3.4     screen -r ScreenName  #Run from inside of ssh session


title: How to determine which module taints the kernel?

text: My kernel keeps panicking when connected to a certain wireless network. I'd like to send a bug report but my kernel is apparently tainted. From `/var/log/messages`:               Apr 17 21:28:22 Eiger kernel: [13330.442453] Pid: 4095, comm: kworker/u:1 Tainted: G           O 3.8.4-102.fc17.x86_64 #1      and               [root@Eiger ~]# cat /proc/sys/kernel/tainted      4096      I've not been able to find documentation for what the 4096 bitmask means ~~, but the`G` flag means that an external GPL module is loaded into the kernel~~. How do I find out which module is tainting the kernel? I've grepped for `[Tt]aint` in `/var/log/messages` or `dmesg` and don't find anything corresponding to when a module is loaded. My kernel is the latest kernel from Fedora 17: 3.8.4-102.fc17.x86_64. **UPDATE** : It may be due to the `rts5139` module. It shows up in `lsmod` but `modinfo rts5139` produces `ERROR: Module rts5139 not found.` When booting the previous kernel, 3.8.3-103.fc17.x86_64, this module is not listed by `lsmod` and the kernel is not tainted (`/proc/sys/kernel/taint` is 0). I've tried blacklisting this module               echo 'blacklist rts5139' >> /etc/modprobe.d/blacklist.conf      but rebooting still shows the kernel as tainted.


title: Debian PowerBook G4 WiFi Driver

text: How do I get wifi to work on my powerbook g4 with xfce debian? I have tried `sudo apt-get install bcm43xx-fwcutter` but it comes up with `E: Unable to locate package bcm43xx-fwcutter`. What do I do?


title: Jack vs Pulseaudio -- how is it faster?

text: I see a bunch of claims that Jack is faster than Pulse and has less latency. How is that so? Why does Pulse call itself lightweight, and the Jack guys call it fat? Could anyone break down the internals of these two daemons to a layman?


title: /proc/cpuinfo "cache" category: L1, L2 or total?

text: When I look in /proc/cpuinfo, one of the lines tells me I have 6144 KB of cache. Is this L1 cache, L2 cache, or the sum of both of them? In any case, how do I find out how much L1 and L2 cache my system has?


title: How can I run a shell script as a daemon under Redhat?

text: I've got a shell script, which is essentially a one liner with some logging, which I'm trying to run this from an init script. I'm using the `daemon` function inside of `/etc/init.d/functions` to run it, as Redhat does not appear to have `start-stop-daemon` available. When I call the init script (`/etc/init.d/script start`) it stays in the foreground, rather than completing and leaving the process running. What's the proper way for me to get this script daemonized? Script to be run:               # conf file where variables are defined     . /etc/script.conf          echo "Starting..." | logger -i     echo "Monitoring $LOG_LOCATION." | logger -i     echo "Sending to $MONITOR_HOST:$MONITOR_PORT." | logger -i          tail -n 1 -F $LOG_LOCATION |     grep WARN --line-buffered  |     /usr/bin/nc -vv $MONITOR_HOST $MONITOR_PORT 2>&1 |     logger -i      init script:               #!/bin/bash               # Source Defaults     . /etc/default/script          # Source init functions     . /etc/init.d/functions          prog=/usr/local/bin/script.sh          [ -f /etc/script.conf ] || exit 1          RETVAL=0          start()     {         # Quit if disabled         if ! $ENABLED; then                 echo "Service Disabled in /etc/default/script"                 exit 1         fi              echo "Starting $prog"              daemon $prog              RETVAL=$?              return $RETVAL     }          stop ()     {         echo -n $"Stopping $prog: "         killproc $prog              RETVAL=$?              return $RETVAL     }          reload()     {         echo "Reload command is not implemented for this service."         return $RETVAL     }          restart()     {         stop         start     }          condrestart()     {         echo "Not Implemented."     }          # See how we were called.     case "$1" in         start)             start             ;;         stop)             stop             ;;         status)             status $prog             ;;         restart)             restart             ;;         reload)             reload             ;;         condrestart)             condrestart             ;;         *)             echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"             RETVAL=1     esac      Last ~20 lines of execution with bash -vx:               + case "$1" in     + start     + true     + echo 'Starting /usr/local/bin/script.sh'     Starting /usr/local/bin/script.sh     + daemon /usr/local/bin/script.sh     + local gotbase= force=     + local base= user= nice= bg= pid=     + nicelevel=0     + '[' /usr/local/bin/script.sh '!=' /usr/local/bin/script.sh ']'     + '[' -z '' ']'     + base=script.sh     + '[' -f /var/run/script.sh.pid ']'     + '[' -n '' -a -z '' ']'     + ulimit -S -c 0     + '[' -n '' ']'     + '[' color = verbose -a -z '' ']'     + '[' -z '' ']'     + initlog -q -c /usr/local/bin/script.sh


title: Solaris development host

text: This posting aims to document how go about getting a development host on Solaris. A "development host" is one where you have all the appropriate tools to build and compile C or C++ applications. Putting development tools such as a compiler onto a host significantly increases the attack surface of that host so in my opinion you shouldn't have them on hosts that face the outside world. They also take up some disk space.