pdf to jpg without quality loss; gscan2pdf

When I convert a pdf file to bunch of jpg files using               convert -quality 100 file.pdf page_%04d.jpg      I have appreciable quality loss. However if I do the following, there is no (noticeable) quality loss: Start gscan2pdf, choose file-> import (and choose file.pdf). Then go to the temporary directory of gscan2pdf. There are many pnm files (one for every page of the pdf-file). Now I do                 for file in *.pnm; do                   convert $file $file.jpg done      The resulting jpg-files are (roughly) of the same quality as the original pdf (which is what I want). Now my question is, if there is a simple command line way to convert the pdf file to a bunch of jpg files without noticeable quality loss? (The solution above is too complicated and time consuming).


can root user assume any uid

sorry if this is a stupid question. I know that the root user can access all files / commands on the system but can Can a root / su user assume any other uid? The reason I ask is looking at http://nelenkov.blogspot.co.uk/2012/05/storing- application-secrets-in-androids.html it says a deamon commands _"Allowed UIDs"_ are _"anyone but root, vpn and wifi (Only keys created with the same UID are visible/accessible)"_ - which suggests in this case the creators uid has higher privilege than root - is this correct? Please let me know if I have made any incorrect assumptions here :)


mbsync not fetching/pushing with [Gmail]/Folders

I've switched from offlineimap to mbsync, but I'm having a problem syncing certain directories from Gmail. Specifically, all of the [Gmail]/FolderName directories seem to be ignored by mbsync (when I run mbsync -l, it doesn't list any of these). I have a config like this **[edited to show full config]** :               Create Slave          # Account details necessary for logging into the remove server:     IMAPAccount GMAIL     Host imap.gmail.com     User user@gmail.com     Pass pass     UseIMAPS yes     # The certificate of the authority that verified the SSL     # certificate of your email provider:     CertificateFile /etc/ssl/certs/ca-certificates.crt          # The remote repository:     IMAPStore GMAIL-remote     Account GMAIL          # The local repository:     MaildirStore GMAIL-local     Path ~/Maildir/GMAIL/     Inbox ~/Maildir/GMAIL/INBOX     Trash ~/Maildir/GMAIL/[Gmail].Bin          # Channel connecting two repositories, describing the way the two     # are synchronized:     Channel GMAIL     Master :GMAIL-remote:     Slave :GMAIL-local:     Patterns  "[Gmail]/Sent Mail" "[Gmail]/Drafts" "[Gmail]/Bin" "[Gmail]/Spam" INBOX ARCHIVED     Create Slave     Expunge Both     SyncState *       Which seems to conform to examples I've seen online. Has something changed with mbsync or Gmail which causes mbsync to ignore [Gmail]/Folders?


Bridging two interfaces for intranet only

We have two ALT linux servers with real IPs. They both are in intranet via commutator. Each of them also has an additional LAN network interface. We want to connect these servers to each other additonally via patch-cord. Is it possible to build bridge with these two interfaces on such network configuration on both servers only for intranet keeping internet connections with same IP-s? Will such solution hurt existence configuration? ![enter image description here](http://i.stack.imgur.com/TnFe3.png)


NTP server not working properly

I have installed a very simple NTP server on a Red Hat server I own, the configuration is pretty basic:               driftfile /var/lib/ntp/drift     restrict default kod nomodify notrap      restrict -6 default kod nomodify notrap      restrict 127.0.0.1      restrict -6 ::1     restrict 192.168.200.0 mask 255.255.255.0 nomodify notrap     server 0.rhel.pool.ntp.org     includefile /etc/ntp/crypto/pw     keys /etc/ntp/keys      If I try to test this from localhost, it seems to work properly:               ntpq -p localhost          remote           refid      st t when poll reach   delay   offset  jitter     ==============================================================================      gw-ge.esaote.co 62.48.53.90      3 u   56   64  173   81.474  -163823 67736.2      If I try to query it from a remote machine, same result:               ntpq -p 192.168.200.151          remote           refid      st t when poll reach   delay   offset  jitter     ==============================================================================      gw-ge.esaote.co 62.48.53.90      3 u    -   64  367   75.500  -163838 61828.5      But, if I invoke `ntpdate`, doesn't work:               ntpdate 192.168.200.151     12 Mar 10:35:51 ntpdate[2688]: no server suitable for synchronization found


Sending most recently created file via Email

I'm trying to send a log file every 24 hours or so via email. Currently I am using mutt for this. You can call mutt like this:               mutt -s "Log" -a file_attachment example@example.com       I know I can list the most recently created files using find and mtime but I want to be able to define a bash function that will find the most recently created file in a directory and then send it as an email attachment. How can I accomplish this?


udev rules for PS/2 and game port don't match on attr, only env

When I build rules for either a PS/2 or game port connected device, udev will never match on attributes, but it will on environment values. The reason why this is an issue can be seen in the output below. The given environment values are rather unspecific, it isn't clear what devices are being referenced in the rules, while the attribute values can be very clear with the actual device name. Especially in the case of my Gravis GamePad, which has very esoteric ENV values, but an ATTR name of "Gravis GamePad Pro". This works:               ENV{XKBMODEL}=="pc105", RUN+="keymap $name microsoft-internet-keyboard"      This does _not_ work:               ATTR{name}=="AT Translated Set 2 keyboard", RUN+="keymap $name microsoft-internet-keyboard"      I get the environment values from running the following:               udevadm info -q all -n /dev/input/event0     P: /devices/pci0000:00/0000:00:1e.0/0000:02:04.0/gameport0/input/input5/js0     N: input/js0     S: input/by-path/pci-0000:02:04.0-joystick     E: DEVLINKS=/dev/input/by-path/pci-0000:02:04.0-joystick     E: DEVNAME=/dev/input/js0     E: DEVPATH=/devices/pci0000:00/0000:00:1e.0/0000:02:04.0/gameport0/input/input5/js0     E: ID_INPUT=1     E: ID_INPUT_JOYSTICK=1     E: ID_PATH=pci-0000:02:04.0     E: ID_PATH_TAG=pci-0000_02_04_0     E: ID_SERIAL=noserial     E: MAJOR=13     E: MINOR=0     E: SUBSYSTEM=input     E: UDEV_LOG=3     E: USEC_INITIALIZED=3244030793      And the attribute values from running:               udevadm info -n /dev/input/event0 --attribute-walk          Udevadm info starts with the device specified by the devpath and then     walks up the chain of parent devices. It prints for every device     found, all possible attributes in the udev rules key format.     A rule to match, can be composed by the attributes of the device     and the attributes from one single parent device.            looking at device '/devices/platform/i8042/serio0/input/input0/event0':         KERNEL=="event0"         SUBSYSTEM=="input"         DRIVER==""            looking at parent device '/devices/platform/i8042/serio0/input/input0':         KERNELS=="input0"         SUBSYSTEMS=="input"         DRIVERS==""         ATTRS{name}=="AT Translated Set 2 keyboard"         ATTRS{phys}=="isa0060/serio0/input0"         ATTRS{uniq}==""         ATTRS{properties}=="0"            looking at parent device '/devices/platform/i8042/serio0':         KERNELS=="serio0"         SUBSYSTEMS=="serio"         DRIVERS=="atkbd"         ATTRS{description}=="i8042 KBD port"         ATTRS{bind_mode}=="auto"         ATTRS{extra}=="0"         ATTRS{force_release}=="369-370"         ATTRS{scroll}=="0"         ATTRS{set}=="2"         ATTRS{softrepeat}=="0"         ATTRS{softraw}=="1"         ATTRS{err_count}=="0"            looking at parent device '/devices/platform/i8042':         KERNELS=="i8042"         SUBSYSTEMS=="platform"         DRIVERS=="i8042"            looking at parent device '/devices/platform':         KERNELS=="platform"         SUBSYSTEMS==""         DRIVERS==""      When constructing my rules, I'm mainly following the advice from this site which could very well be outdated. In particular, I'm paying attention to the bit which says: > ... it is legal to combine the attributes from the device in question and a > single parent device, you cannot mix-and-match attributes from multiple > parent devices - your rule will not work.


Configuring iptables by software

Is there a software, or a linux distro which has such a software built-in, which makes configuring the iptables easier? If not, I thought that some of the mostly used configuarations with a simple GUI can make it easier but I couldn't find any. Do you think it's a need? If there is, how can I find it?


Other Programs Cannot Connect To MySQL

So just recently when installing php-fpm, I had installed a few MySQL packages with it (I believe). I already had mysql installed. However now when any of my programs attempt to access the database, it fails to connect/times out. I can however access the database through ssh (databases, tables, and data are all there). When I searched for installed MySQL software, these are the results:               [root@dev ~]# yum list installed | grep mysql     compat-mysql51.x86_64 5.1.54-1.el6.remi @remi     mysql.x86_64          5.5.39-1.el6.remi @remi     mysql-libs.x86_64     5.5.39-1.el6.remi @remi     mysql-server.x86_64   5.5.39-1.el6.remi @remi     php-mysql.x86_64      5.4.31-1.el6.remi @remi      So is this the issue? Or is there another reason none of my programs can connect?


Converting html table into ncurses-like ascii table?

I have some documentation in an html table. I want to convert the table to an ascii table, like you see when you get a mysql command line result back, like this:               +------------+------------+     | header     | header     |     +------------+------------+     | cell data  | cell data  |     +------------+------------+     | cell data  | cell data  |     +------------+------------+      ... so I can include it in some code comments. How could I do this easily? I was thinking piping the output of lynx into a file, but lynx doesn't put ascii borders around tables :P I also want to control cell width, so that the content cells don't spill outside the accepted screen width of the code.


emacs does not see my fonts in gentoo

I copied my ~/.emacs file from ubuntu linux; I've installed Consolas font (and it works in gnome terminal, and as a default Monospace font); but Emacs does not see it               (custom-set-faces '(default ((t (:inherit nil :stipple nil :background "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 98 :width normal :foundry "microsoft" :family "Consolas"))) t))      That's how I set the font in emacs, but it does not work (It worked and still works in Ubuntu) What can I do? Font select menu (menu-set-font, I guess) looks very strange, consists of three options: Misc, Courier and Fontset, and there are no sign of my system fonts


Touchpad not recognized on linux (ASUS R751LB)

I have just bought a brand new laptop. Unfortunately, touchpad doesn't work on any linux distribution (tried mint Ubuntu 12.04, Ubuntu 14.04, Mint 14, Mint 16, also Mint 16 with recent 3.13.5 kernel). `xinput list` returns:               > Virtual core pointer                      id=2    [master pointer  (3)]     > ↳ Virtual core XTEST pointer                  id=4    [slave  pointer  (2)]      `synclient -l` returns: > Couldn't find synaptics properties. No synaptics driver loaded? `dmesg | grep -i mouse` returns: > [ 1.024913] mousedev: PS/2 mouse device common for all mice Touchpad works completely under Windows, even in Windows boot instalation menu. USB mouse works fine under linux. Seems like Linux just doesn't see any touchpad device in my computer. It's ASUS R751LB (more popular name: Asus X750). I already searched almost whole internet and seems like not many people has such an issue as me. Anybody has any ideas how to fix it? BTW. My keyboard fn key also doesn't work. However, I do care about fixing touchpad mostly. I don't think fixing fn key would fix touchpad, even if I have a touchpad toggle on/off button here - even it was turned off, it should be visible by drivers.


adduser: Specify only one name in this mode

I'm trying to add a user with this command on my debian server:               #!/bin/bash          APPUSER="test1"     APPGROUP="test2"          # User     adduser -c 'uwsgi user' --group $APPGROUP --system --no-create-home --disabled-login --disabled-password $APPUSER      However it tells me I can only specify one name, but I am only specifying one name as far as I can see. What's going wrong?


Using multiple layer of kernel modules for interfacing a hardware device?

I am trying to get a conceptual understanding of the purposes the kernel modules can have. The motivation for this question was a realization that interface to an actual hardware goes through multiple kernel modules. For example, the USB gadget driver has multiple kernel modules, where only one is used to actually communicate with the hardware. ( http://www.linux- usb.org/gadget/ ) What is the reason of implementing this "kernel module stack" structure? Doesn't it just complicate the process of getting a hardware device to work (you have to worry that you have 3 modules running instead of one)?


How do I upgrade the Debian Wheezy kernel offline?

I using Debian ( _Wheezy_ ) with the `3.2.0-4` `amd64` kernel version and want to upgrade my kernel to newest version, like `3.13.3 stable`, but I have no internet connection to my Debian OS. I have installed both of "usb-modeswitch" and "usb-modeswitch-data" packages but Debian doesn't detect my 3g-modem-usb dongle. I've downloaded the `3.13.3 tar.xz` kernel source from `kernel.org`. How can I compile and upgrade from 3.2 to 3.13.3 without an internet connection?


What is the minimum size for the medium used to clone a damaged hard drive?

I'm currently in the business of recovering data from a damaged---and dying--- hard-drive (check this question for background info). The damaged hard-drive is 250GB, and I intend to use `dd` or `ddrescue` to clone what is left of the disk (as suggested in How to clone a NTFS partition (WinXP) from a damaged disk to a new one?). For such a cloning operation, is a healthy 250GB external hard-drive sufficient? Or must the drive be bigger than that (say, 320GB)? And if the damaged source disk is indeed one sector _larger_ than the healthy destination disk, how exactly could this impact/confuse `dd` or `ddrescue`? * * * **EDIT:**   In the end I got the new disk and it is sector for sector the same size as the damaged disk: 488397168 sectors.


Command for display of Memory usage, Disk Usage and CPU Load

I want to diplay the Memory usage, Disk Usage and CPU Load in the following format:               Memory Usage: 33/512MB (6%)         Disk usage: 4.2/20GB (23%)      CPU Load: 0.01      How can I do that?


sed - how to replace either space or underscore_word

Currently I have this sed:               sed -i '/[^}.to]\.to[[:space:]]/ s/\(\S\)/expect(\1/' ../_spec_seded/"$file"      which adds "`expect(`" at the start of lines that have "`.to`" (but not "`{.to`") How can I make this so that it matches lines with both "`.to`" and also "`.to_not`"? I tried               sed -i '/[^}.to]\.to([[:space:]]|_not)/ s/\(\S\)/expect(\1/' my_file      basically changing `[[:space:]]` to `([[:space:]]|_not)` to try and match `.to` OR `.to_not` but this messed it up for both, not adding the expect at the start.


How to setup permission for virtfs in system libvirtd

I have troubles setting up the permissions for virtfs. I need to share a folder with several VMs in a way that user (same username, uid and gid on guests and host) can access it (have full permissions). I've tried various options but none gives the user the right permissions even with `access=client` option (of course the filesystem, ext4, is mounted with `user_xattr` and I've checked that I can set flags). How to setup virtfs in such configuration? I'll use NFS for a time but virtfs should be faster. **EDIT** : It looks like mapped permission works if the file is created from within the VM and passthrough permission works for root but not other users - noone can access not-root owned files from guest and permission cannot be changed to non-root.


NodeJS for Slackware

I want to run NodeJS on Slackware based distro named PuppyLinux. Since I am used to Ubuntu and CentOS (the simple Linux land), I found it pretty hard to find a NodeJS package to run on Slackware. I tried building it from source, but it took loooong time to install `gcc` and dependencies and then I found some silly compilation errors (can't find errno.h!) Are there any NodeJS (and npm) binaries to run on Slackware? Any one succeeded to build it?


ck patch for Linux 3.13

Does anyone have any news about the -ck patches for Linux 3.13 kernel tree? I've checked here but there's nothing yet...


How to enable two network interfaces both for internet in ubuntu12.04

My physical server A has two interfaces: eth0 and eth1. I intend to enable the two network interfaces both for internet in ubuntu12.04. I configure the /etc/network/interfaces as below:               auto lo     iface lo inet loopback     auto eth0     iface eth0 inet static     address 10.10.101.105     gateway 10.10.101.254     netmask 255.255.255.0     auto eth1     iface eth1 inet static     address 10.10.101.205     gateway 10.10.101.254     netmask 255.255.255.0      And the output of ifconfig is shown below:               eth0      Link encap:Ethernet  HWaddr e0:db:55:25:ed:10               inet addr:10.10.101.105  Bcast:10.10.101.255  Mask:255.255.255.0               inet6 addr: fe80::e2db:55ff:fe25:ed10/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:1148531 errors:0 dropped:0 overruns:0 frame:0               TX packets:554215 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000               RX bytes:1636019748 (1.6 GB)  TX bytes:40068201 (40.0 MB)               Interrupt:35          eth1      Link encap:Ethernet  HWaddr e0:db:55:25:ed:11               inet addr:10.10.101.205  Bcast:10.10.101.255  Mask:255.255.255.0               inet6 addr: fe80::e2db:55ff:fe25:ed11/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:56699 errors:0 dropped:0 overruns:0 frame:0               TX packets:6 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000               RX bytes:4077879 (4.0 MB)  TX bytes:492 (492.0 B)               Interrupt:38          lo        Link encap:Local Loopback               inet addr:127.0.0.1  Mask:255.0.0.0               inet6 addr: ::1/128 Scope:Host               UP LOOPBACK RUNNING  MTU:16436  Metric:1               RX packets:124891 errors:0 dropped:0 overruns:0 frame:0               TX packets:124891 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0               RX bytes:1484482588 (1.4 GB)  TX bytes:1484482588 (1.4 GB)      So, I think both the 2 network interfaces are up. However, I find I can access my physical server A from host B only via eth0(10.10.101.105), and fail to access it via eth1(10.10.101.205). When I use route -n to check the router table in my server, it shows:               vli05@vli05:~$ route -n     Kernel IP routing table     Destination     Gateway         Genmask         Flags Metric Ref    Use Iface     0.0.0.0         10.10.101.254   0.0.0.0         UG    100    0        0 eth0     10.10.101.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0     10.10.101.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1      What am I doing wrong? PS: The host B I am using ping command is in the same subnet of the physical host A I mentioned above. I just want to use ping to access the physical host A both via eth0(10.10.101.105) and eth1(10.10.101.205). Besides, the Output of `$ sudo netstat -tapn | grep :22` is shown below:               tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN                           1180/sshd     tcp        0      0 10.10.101.105:22        10.10.18.35:57651       ESTABLISHED                      13235/sshd: zjuvlis     tcp6       0      0 :::22                   :::*                    LISTEN      In this case, I am using host with IP 10.10.18.35 to ssh 10.10.101.105. But I fail to ssh 10.10.101.205(the corresponding IP of eth1) What's more, when I debug using telnet,               root@CO:/home/dujun/work_git/Ruby_reference/trace_ruby_code# telnet 10.10.101.205 22     Trying 10.10.101.205...     Connected to 10.10.101.205.     Escape character is '^]'.     SSH-2.0-OpenSSH_5.8      The result is same as `telent 10.10.101.105 22`


Can you provide an example use for `zrun`?

I was reading the manual pages for the package moreutils but I did not understand the page for `zrun`. My manual page is almost the same as the die.net one:               ZRUN(1)                                                                ZRUN(1)                    NAME            zrun - automatically uncompress arguments to command          SYNOPSIS            zrun command file.gz [...]          DESCRIPTION            Prefixing a shell command with "zrun" causes any compressed files that            are arguments of the command to be transparently uncompressed to temp            files (not pipes) and the uncompressed files fed to the command.                 This is a quick way to run a command that does not itself support            compressed files, without manually uncompressing the files.                 The following compression types are supported: gz bz2 Z xz lzma lzo                 If zrun is linked to some name beginning with z, like zprog, and the            link is executed, this is equivalent to executing "zrun prog".          BUGS            Modifications to the uncompressed temporary file are not fed back into            the input file, so using this as a quick way to make an editor support            compressed files won't work.          AUTHOR            Copyright 2006 by Chung-chieh Shan <ccshan@post.harvard.edu>                    moreutils                         2010-04-28                           ZRUN(1)      Can you provide an example use?


How to set automatically permission at automount without mask

I store my data on a NTFS parition to share it with my Windows. I use the dmask,fmask option in my fstab entry to avoid rwx default permissions to everyone, for coherence, security, and also because my zsh color profile rendering is then ugly when listing.               /dev/sda5       /mnt/Data       auto    defaults,force,rw,uid=1000,gid=1000,dmask=027,fmask=137   0   0      the problem with f/dmask is that I can't change related permissions of files once it's mounted. For example, I have unix scripts stored there and when I try a chmod +x the mask automatically discards any changes even in root. I thought about removing masks and execute automatically this kind of script :               chown -R me /mnt/Data     find -type f /mnt/Data -exec chmod -R 640 {} \;      but it isn't very elegant and can be very long for large amount of little imbricated files/directory. Is there any way or unknwon (at least from me) option of mount to do that ?


Disable PIN request for pairing on Raspbian

I'm running a Raspberry Pi with Raspbian Wheezy. I have a BT (Bluetooth) dongle attached to one of the USB ports (I have a model B RPi), I've downloaded and installed the following packages: bluez-utils, blueman, bluetooth and libbluetooth-dev, and all works fine. **But I have a question** : is it possible to disable the PIN request on my RPi side when I try to connect from a mobile phone? I know how to configure the PIN for the mobile phone, but I don't want my RPi asking for a PIN to pair the mobile phone.


How to measure rlogin time?

I need to monitor the time it takes to rlogin from one HP-UX machine to another. So I wrote this:               #!/bin/sh     result=`rlogin 10.10.10.1 << EOF     exit     EOF`     result2=`{ time $result >/dev/null; } |& grep real`     echo $result2      This shellscript works when I run it on a Linux machine, but for some reason it doesn’t work when I run it on HP-UX. Both are using /bin/sh. Why doesn't it work on HP-UX?


How to set up an encrypted directory to be mounted only during samba access?

(This is not about restricting client access, for which ext3 permissions do the trick) I'd like to encrypt the data on my NAS drive (Buffalo LinkStation Pro with SSH access enabled, if that matters) in a user-friendly way. Currently, a truecrypt container has to be manually mounted via SSH and also unmounted again (unless you solve my timeout question). Using a passwordless (but EFS encrypted) SSH key this is reduced to two PuTTY desktop shortcuts and entering the truecrypt password (until simplified further) for mounting. However, the ideal solution would be transparent. I first thought about trying to somehow have the share allow for EFS encryption, but that would probably involve more work and EFS for multiple users without an Active Directory server seems to be troublesome. But now my idea is an automated mount of e.g. an EncFS encrypted directory triggered automatically by a samba access from authorized users (using Windows clients). How can that be achieved? (Bonus points for displaying a honeypot share for unauthorized users...)


User's name appears as "bash-3.0" on SSH shell

I am working on a Redhat server and one of the users' names appears as "bash-3.0" on the "SSH Secure Shell Client." His name is appearing correct under `/etc/passwd`. How could this happen?   How can I fix this?


Equivalent of date --reference in Solaris

The GNU implementation of the `date` command has a nice feature to show the date of the last modification of a reference file, and using the `+FORMAT` parameter it is easy to get the date in any format, for example:               date -r /etc/motd +%Y%m%d_%H%M%S     # output in the format: 20121001_171233      Is there an equivalent in Solaris? I know I can do it using the `stat` function of `perl` like this:               perl -mPOSIX -e 'print POSIX::strftime("%Y%m%d_%H%M%S\n", localtime((stat("/etc/motd"))[9]))'      But isn't there a more elegant way? **UPDATE** This gives the same output as the perl script and it's "easier" for me:               ls -Ego /etc/motd | awk '{print $4 "_" $5}' | tr -d :- | sed -e 's/\..*//'      And yeah, probably there's no more elegant solution.


Kill many instances of a running process with one command

This is one of the questions that has troubled me often. Suppose I have thousand or more instances of any process(for e.g. say the process `vi`) running. How do I kill them all in one single shot/one line command/One command ? Any information provided will be appreciated ?


Something to convert a makefile.am to project in Visual Studio (2005)

I'm interested in porting a library to Windows so that I can contribute to this library's project. This library has a Makefile.am, and I can sort of figure out how the library should be built (but I'm fairly new to the concept of makefiles). I was wondering if there is an automatic way to translate a Makefile.am into something that Visual Studio 2005 can use. What I know so far: I do see that there are directives in the library's Makefile.am for building to a Windows target (i.e `if BUILD_WINDOWS ...some stuff... endif`). I also know that there's AutoMake for Windows, which generates the Makefile.in from the .am, but I have a knowledge gap as to how this Makefile.in would then be used. (Still researching this avenue). Is my only course to convert the makefile manually into a VS2005 project? It seems like it is easier to convert from Windows to Linux, but that may be just my imagination. Thanks for all your help!


Test command in unix doesn't print an output

When I type this in the terminal               test 4 -lt 6      I don't get any output. Why not? I need that 0 or 1


Do you need a shell for SCP?

I'm allowing a friend a local account on my machine, exclusively for SCP. Can I specify his account's shell as `/bin/true`, or in any other way limit the account, while still allowing SCP?


I want to make both Control keys as a Super key

I want to make both Control_L and Control_R as a Super key (Windows Key). Is this possible? I only made Control_R as a Super key but I could not make Control_L. Here is what I done.               xmodmap -e 'remove mod4 = Hyper_L'                         xmodmap -e 'add mod4 = Control_R'       This is xmodmap output:               shift       Shift_L (0x32),  Shift_R (0x3e)     lock           control     Control_L (0x25),  Control_L (0x42)     mod1        Alt_L (0x40),  Meta_L (0xcd)     mod2        Num_Lock (0x4d)     mod3           mod4        Control_R (0x69),  Super_L (0x85),  Super_L (0xce)     mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)      By the way, I made Caps_Lock as an additional Control_L, so I am not sure if this is the problem.


How to run a shell command in a server?

I am fairly familiar with computers and web stuff but this is a bit out of my comfort zone. I have a shell script (.sh file) I want to run in a Linux server I have one site hosted (the script is a backup script for a CMS I have installed on that server), but I have no clue on how to do it. Going through cpanel the only relevant thing I found was the SSH/Shell Access menu, and that prompts me to generate some key which I reckon should be used in a local software or something to connect to that server from my desktop, but I have no idea on what to do, where to go from here. I also heard something about Putty or whatever it is to use that same key but I opened that software and I am completely clueless. Pardon my extreme ignorance in the subject, also I hope this is the indicated Stack Exchange to ask this question.


Discrepancy between the two expansions

If you input the command `ls *` and `echo *`, you will notice the remarkable discrepancy between the results. The former recursively includes while the latter totally excludes files in subdirectories. Don't they behave the same for pathname expansion？


Linux realtime file sync

My QNAP NAS running, I believe, a version of busybox has the ability to setup synchronization to an external drive. In the UI the user selects the folders that they wish to synchronism and then the method of operation of the synchronization process. Options include: sync when drive attached; sync on a schedule; realtime syncing. The other options present make me believe that the underlying sync mechanism is just rsync and a schedule can obviously be achieved via cron. However I am interested in how the syncing is kicked off via drive attachment and in realtime as I wish to try and replicate some of this functionality on my Mac. Perhaps this could be achieved via something like Carbon Copy Cloner (which I have) but I am interested in knowing whether this is possible via the command line.


Find Directory and copy another directory to found directory?

I'm attempting to find a directory A that could be in a variable location and copy another directory B into the found directory. So, I'd like to find directory `A`, and copy Directory B into Directory A.               find -name "foo.bundle"; cp directory B into the found directory.      If there are multiple matching A directories, I want to copy B to each of them.


Does the inverse command of cut exist?

First question, so if the format's not correct, sorry! I like using the `cut` command in Linux with the `-c` flag. However, I'm interested in finding a command that sort of does the set inverse of `cut`. Essentially, given the input:               drwxrwxrwx 2 root root 4096 4096 4 20:15 bin     drwxrwxrwx 2 root root 4096 4096 4 20:15 Desktop      I would like to see everything _except_ “4096 4 20:15”. Here is the output:               drwxrwxrwx 2 root root bin     drwxrwxrwx 2 root root Desktop      I want to be able to literally cut out between characters x and y, if that makes sense. Any ideas? I can't imagine it'd be a hard script to write but if there already exists a command for it, I'd love to use it.


how to suppress bash octal number interpretation? (to be interpreted as decimal)

I have this:               date +"%H hours and %M minutes"      I use festival to say it up.. but it says like: "zero nine hours".. I want it to say "nine hours"! but date always give me 09... so I wonder if bash can easly make that become just 9? in the complex script I tried like               printf %d 09      but it fails.. not octal :( any idea?


Using GNU Parallel With Split

I'm loading a pretty gigantic file to a postgresql database. To do this I first use `split` in the file to get smaller files (30Gb each) and then I load each smaller file to the database using `GNU Parallel` and `psql copy`. The problem is that it takes about 7 hours to split the file, and then it starts to load a file per core. What I need is a way to tell `split` to print the file name to std output each time it finishes writing a file so I can pipe it to `Parallel` and it starts loading the files at the time `split` finish writing it. Something like this:               split -l 50000000 2011.psv carga/2011_ | parallel ./carga_postgres.sh {}      I have read the `split` man pages and I can't find anything. Is there a way to do this with `split` or any other tool?


How to make SLiM not render anything at login prompt?

I've just figured I don't actually need an image when logging into slim, especially if that image is a few megabytes large. Currently they're both set to 1x1 png images, however, then that image has to be rendered a few million times each frame, which isn't quite efficient either. How can I disable both the background image and the panel image in SLiM?


Remove watermarks from pdf file

Is it possible to remove annoying watermarks from `pdf` file in Linux? For example, every page contains text > This file was merged by application XY.


How to fix tab completion so it doesn't hide entries?

I'm using oh-my-zsh on Mac OS X with homebrew'ed zsh 4.3.12. I stumbled recently on a weird problem. In `scripts/not-used` I have several `.R` files:               breakdowns.R             eventloop.R              process-largeclients.R   process-qt.R     reprocess-pinning.R      calculate-qt-error.R     generate_decision_tree.R process-net.R     process-scalingexp.R      However, when I try `ls scripts/not-used/`+`Tab` the first completion is `ls scripts/not-used/_.R` where `_` represents cursor position. If I press `Tab` again, I get this weird completion:               $ ls scripts/not-used/.R                                                                               breakdowns.R  eventloop.R      How to unset this ugly (wrong) behaviour? The options that are set are:               alwaystoend autocd autonamedirs autopushd cdablevars completeinword     correctall extendedglob extendedhistory noflowcontrol     histexpiredupsfirst histignoredups histignorespace histreduceblanks histverify     incappendhistory     interactive login longlistjobs monitor promptsubst      pushdignoredups pushdminus pushdsilent pushdtohome     sharehistory shinstdin zle


Installing NetworkManager without internet connection

I have a slight problem, I uninstalled my Network Manager in Fedora Core 15, why I did this was because it did not show anymore, I thought I will re- install it using my wireless connection but I now can't connect to my wireless connection any longer, is there a way to install Network Manager to that Pc without any Internet Connection by using a RPM file that I can download from my other PC and then install it to my no internet pc, so that it can work again? Also what steps can I take if this is not possible to get Network Manager installed again?


Offline documentation of an RPM spec file or how to retrieve an example

I am taking a Red Hat exam that is offline. I am having issues remembering the syntax for an RPM SPEC file. Can anyone suggest how to retrieve an example or some documentation that should already be in the system? Cannot seem to find anything like that. (This is not cheating. We are allowed to use anything on the system.)


AUR and pacman GUI frontend for Arch

Do you know any good GUI for pacman and arch? Where I could view packages installed and possible to install? And of course do anything as in pacman.


How to enter non-ascii characters using hex or octal codes in vi

I'm trying to write a golfing library for postscript. But it needs to be condensed itself. So I need a convenient way to type-in arbitrary bytes within mostly ascii text. I know this can easily be done with absolutely any programming language, but can I do it in vi? (`:help octal` was no help).


Clear setuid permission using numeric mode

On an Ubuntu Linux I have a directory with the setuid bit set (`drwsr-xr-x`) which I want to unset. Neither `chmod 755` nor `chmod 0755` nor `chmod 00755` (I though maybe the first 0 is interpreted as just "this is octal") cleared the setuid bit. However, `chmod u-s` did. What is the correct numeric mode to clear the setuid bit?


midnight commander: rules for accessing archives through VFS

`Midnight Commander` uses virtual filesystem (`VFS`) for displying files, such as contents of a `.tar.gz` archive, or of `.iso` image. This is configured in `mc.ext` with rules such as this one (`Open` is `Enter`, `View` is `F3`):               regex/\.([iI][sS][oO])$         Open=%cd %p/iso9660://         View=%view{ascii} isoinfo -d -i %f      When I press `Enter` on an `.iso` file, `mc` will open the `.iso` and I can browse individual files. This is very useful. Now my question: I have also files which are disk images, i.e. created with `pv /dev/sda1 > sda1.img` I would like `mc` to "browse" the files inside these images in the same fashion as `.iso`. Is this possible ? How would such rule look like ?


File access after fsck very slow for first-time access?

My drive started to show up errors, I unmounted it and ran `fsck` on it. It's a 2TB drive installed on Debian Squeeze, using `ext3`. The `fsck` too about 17 hours. I found some, luckily mostly unimportant, files in `lost+found`. But when I tried to access anything on that FS, first time access (reading directory listing, reading file information, reading file data) is very slow and takes up to one or two seconds. Accessing anything a second time seems to be normal. Given that I've around 1.5TB data on it, that's a lot times for "first access after mount". However, I don't see anything in the logs regarding this, how can I figure out what is going on? Is this normal?


Can a RHEL 6.4 DS sync with a CentOS 5.4 DS

I have two CentOS 5.4 Directory Servers that sync information on a daily bases. I'm wanting to replace them with two RHEL 6.4 Directory Servers. Before the existing two are decommissioned all four need to be syncing on a daily basis until we are certain there aren't going to be any issues. Essentially the RHEL DS and the CentOS DS directory servers are the same things so I'm betting that they can sync, but my main question is if a RHEL 6 DS can sync with a RHEL/CentOS 5 DS? Again I'm thinking they can because the database should be nearly the same for both, but I'm hoping someone knows for certain. If they can't natively sync I'm hoping find the best way to configure them so that they can. My last issue is that the RHEL6 DS will have an additional schema (Samba). If the older DS doesn't have that schema will it just be left out when the servers sync?


not all initrd.img's are born equal?

I am trying to get a Red Hat 5.8 box booting via pxe. The box is a virtual machine on ESX5.0 it has a Paravirtual SCSI Controller and VMXNET3 network driver. Now these drivers do not come default in the RHEL5.8 kernel so I have followed some steps on the net to make my own initrd.img file. This is not yet working and any advice on how to get this done would be appreciated. However the main aim of my question is the following: on my imported repo there is at least two places where initrd.img files are available:               cobbler/ks_mirror/OEL5.8-x86_64/isolinux/     cobbler/ks_mirror/OEL5.8-x86_64/images/pxeboot/      I am curious to understand what the difference is. A small white lie, I am using Oracle Linux, not by choice, but is should be the same for all intents and purposes. I would also like to understand what the difference is between the initrd.img file that can be found in the /boot directory after a server is installed and the one found on the CDROM and/or cobbler repository. If I copy the initrd.img file from a box with vmwaretools installed, I get a kernel panic when trying to boot of the initrd.img file. There is a size difference so I have assumed that essentially the difference is that one contains more drivers and the other only drivers important to the server, but why the kernel panic. I feel that I am following instructions on the web on building or adding more drivers to my kernel a bit blindly and that if I understand slightly better what I am doing then maybe I will know where it goes wrong.


File size :size of content and what is seen different

Assume you have a file 342MB but when you get into that file and look the content of it; you see that everything occupy around 92 MB. No hidden file or any other thing exist on it. How can that be possible. Is there a solution to fix this. Here is before and after mount               /data>du -sh *     342M   backup               /mnt> du -sh *     4K   etc     79M   kernel     8K   lost+found     13M   platform      * * * **Edit** : Someone suggested hidden files, but there aren't any:               /mnt> ls -alrt     total 44     drwx------   2 root     root        8192 Mar 20 08:16 lost+found     drwxr-xr-x   2 root     root         512 Mar 20 08:16 etc     drwxr-xr-x  15 root     sys          512 Mar 20 08:16 kernel     drwxr-xr-x   6 root     root         512 Mar 20 08:16 .     drwxr-xr-x  41 root     root        1536 Mar 20 08:16 platform     drwxr-xr-x  41 root     root        9216 Apr  5 19:47 ..               df /mnt     /mnt               (/dev/lofi/2       ):  466192 blocks   162531 files      The command that show my backup file is 342 MB                du -sh backup      342M   backup      The command I used for mounting this backup file               lofiadm -a /home/backup     mount -F ufs /dev/lofi/2 /mnt      df -g output :                df -g /mnt      /mnt               (/dev/lofi/2       ):    8192 block size    1024 frag         size      657548 total blocks     466192 free blocks   400438 available   163520 total files      162531 free files     38535170 filesys id      ufs fstype       0x00000004 flag             255 filename length      du -s output :                du -s /mnt      189292  /mnt


Autotools does not detect my architecture correctly. How to handle?

I am trying to build the latest ffmpeg from the git repo. However, as you can see below, autotools does not detect correctly that **my box has 64-bit architecture (Ubuntu 12.04)**. Consequently, during the build, some x86 libs are required, but not present, and the build fails. How do I tackle this? > mvitkov@mms:~/projects/ffmpeg/build$ ../ffmpeg/configure --enable-shared   >  output:   >  _install prefix /usr/local   >  source path /home/users/mvitkov/projects/ffmpeg/ffmpeg   >  C compiler gcc   >  ARCH x86 (generic)_ On the other hand, autotools usually works fine: > mvitkov@mms:~/projects/x264/build$ ../x264/configure --enable-static output:   >  *platform: X86_64*


Gedit won't save a file on a VirtualBox share: Text file busy

I have a text file that I can change using other applications (for example `openoffice`). But when I try to change and save it using `gedit`, I am getting error from `gedit`:               Could not save the file /media/sf_Ubuntu/BuildNotes.txt.     Unexpected error: Error renaming temporary file: Text file busy      the permission of BuildNotes.txt is as follow:               -rwxrwx--- 1 root vboxsf  839 2012-10-26 12:08 BuildNotes.txt      and user id is:               m@m-Linux:/media/sf_Ubuntu$ id     uid=1000(m) gid=1000(m) groups=4(adm),20(dialout),24(cdrom),46(plugdev),105(lpadmin),119(admin),122(sambashare),1000(m),1001(vboxsf)      What is the problem and how I can fix it?


Printing colored text using script

When I type below command in the shell I get the OUTPUT in green color. **Command**               echo "\033[32mCONNECTING TO abpwrk\033[m";      **Output** (in green color)               CONNECTING TO abpwrk      But if I use the same statement in a small one line script and execute it.Then I get the output(in white color).               \033[32mCONNECTING TO abpwrk\033[m      What am I missing in the script.Do I need to define some extra parameters to initiate colors ? I am using k-shell.


nsswitch.conf versus host.conf

Suppose that `/etc/nsswitch.conf` file contains               hosts: files dns      and `/etc/host.conf` file has               order bind,hosts      then in which order the system would use `/etc/hosts` and DNS look-up to resolve a host name? In other words, which of the two configuration files takes precedence?


How to correctly remove mountnfs from /etc/init.d/

Cleaning up the boot process of a Debian squeeze installation running on kernel 3.2.0-0.bpo.3-amd64, I spotted several mountnfs scripts in /etc/init.d/:               # ls /etc/init.d/ | grep mountnfs     mountnfs-bootclean.sh     mountnfs.sh     umountnfs.sh      Removing fails, with commands like:               # update-rc.d -f mountnfs remove     update-rc.d: using dependency based boot sequencing      For " _mountnfs_ ", I have also tried: umountnfs, mountnfs-bootclean, nfs, nfs-common. **Update #1** Also tried without success: umountnfs.sh, mountnfs.sh. The result is that the mountnfs-bootclean, mountnfs and unmountnfs.sh are still in /etc/init.d/ and their corresponding run level folders. Just removing those files using `rm` doesn't seem the right way. I though that these init.d files belong to installed packages. However I can't really find any installed NFS package:               # dpkg --get-selections | grep nfs     libnfsidmap2                    install      How do I correctly remove all mountNFS scripts from init.d?


Connecting to wireless router

According to this manual I tried:               $ iwconfig     lo        no wireless extensions.          eth1      IEEE 802.11bg  ESSID:"g\xC6isQ\xFFJ\xEC)\xCD\xBA\xAB\xF2\xFB\xE3F|\xC2T\xF8\x1B\xE8\xE7\x8DvZ.c3\x9F\xC9\x9A"                 Mode:Managed  Frequency:2.412 GHz  Access Point: Not-Associated                  Bit Rate:0 kb/s   Tx-Power=20 dBm   Sensitivity=8/0                 Retry limit:7   RTS thr:off   Fragment thr:off               Power Management:off               Link Quality:0  Signal level:0  Noise level:0               Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0               Tx excessive retries:0  Invalid misc:0   Missed beacon:0          eth0      no wireless extensions.          $ sudo ifconfig eth1 up      Then I used wicd from this manual. It will find my wireless router, but when I click `connect`, the phase `obtaining IP address` is endless. I tried:               $ sudo iwlist scan     lo        Interface doesn't support scanning.          eth1      Scan completed :               Cell 01 - Address: C8:3A:35:1F:60:78                         ESSID:"MyDevice"                         Protocol:IEEE 802.11bg                         Mode:Master                         Frequency:2.412 GHz (Channel 1)                         Encryption key:off                         Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 6 Mb/s; 11 Mb/s                                   9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s                                   48 Mb/s; 54 Mb/s                         Quality=97/100  Signal level=-27 dBm                           Extra: Last beacon: 172ms ago          eth0      Interface doesn't support scanning.      Here is the content of `/var/log/wicd/wicd.log` Could you advise me how can I connect and how to correctly set `/etc/network/interfaces`?


How to easily maintain the latest versions of Apache/ MySQL/ PHP on CentOS 6.2?

We have a few servers running CentOS 6.2 deploying web applications using Apache/ MySQL/ PHP. In the past we've just regularly run "yum update" to keep all the software up to date. As of right now the installed versions are:   * Apache 2.2.15   * MySQL 5.1.61   * PHP 5.3.3 When the latest released versions are:   * Apache 2.4.1   * MySQL 5.5.21   * PHP 5.3.10 We're web developers with a bit of Linux knowledge rather than server administrators so we want to be able keep everything patched to the latest (or near) version without having to go into the depths of compiling software or too much command line jiggery-pokery. What is the best way for us to easily maintain the latest versions (or at least late as possible versions) on CentOS 6.2?


Allow incoming connections from Google Translate only

I have a small web server running on port 80, and I'd like to allow only Google Translate to have access to it. First I tried running `dig translate.google.com` and `dig translate.googleusercontent.com` to get the IP address for it, which returned addresses ranging from **74.125.234.74** to **74.125.234.110**. Then I opened the mentioned ports, but it did not work. Looking at iptables logs, I found Google has very different IP addresses to open the target website for translation. In a few tests they ranged from **74.125.186.40** to **74.125.187.169**. Now, what I've got so far is the following rule, that opens the door for this range:               -A INPUT -p tcp --dport 80 -m iprange --src-range 74.125.186.40-74.125.187.169 -j ACCEPT      The problems:   1. Everytime Google tries to access the page, it uses a different IP address, and probably **out of the range** I mentioned previously. I'd have to try many many times to take note of all the range.   2. I'm concerned about the security implications also, since I don't know whether all IPs in the range are safe to leave open (would they all belong to Google?) I tried `nslookup 74.125.186.40` to see if I could get a domain name for it, but it returns:               ** server can't find 40.186.125.74.in-addr.arpa.: NXDOMAIN


checking data in columns when a data or some may be missing or present?

I am not sure if this possible. say i have columns like :               Team      Colour      Game      Rainfall      PlayerName       XYZ       Blue        Cricket   Yes           Kapil      suppose i need to search for any data that is below `Game` i can do it using awk somthing like :                 awk '{for(i=1;i<NF;i++)             {              if($i == "Game")               {               GameData=i               next               }             if( i == GameData )               {               print "Column below Game is" $i               }             }           }'      but what if i am not sure value in some columns can be missing like any one of               XYZ       Blue           could be missing or both could be missing or present. **EDIT** : Lets say first letter `T` of team(first column) is always at the begining and first letter `C` of Colour is always after 10 characters from the begining, first letter `G` of Game is always after 20 characters from the begining and so on.


is linux/compiler.h a userspace header?

VirtualBox is looking for this file in `/usr/include` but it's missing in gentoo linux-headers Does someone know if that is userspace header and gentoo is missing it? Or if that is not it, then if virtualbox is doing it wrong? actual bug: https://bugs.gentoo.org/show_bug.cgi?id=408611#c6               In file included from /var/tmp/portage/x11-drivers/xf86-video-virtualbox-4.1.10/work/VirtualBox-4.1.10/include/iprt/mem.h:31:0,                      from /var/tmp/portage/x11-drivers/xf86-video-virtualbox-4.1.10/work/VirtualBox-4.1.10/src/VBox/Runtime/common/alloc/alloc.cpp:34:     /var/tmp/portage/x11-drivers/xf86-video-virtualbox-4.1.10/work/VirtualBox-4.1.10/include/iprt/types.h:112:30: fatal error: linux/compiler.h: No such file or directory     compilation terminated.               Reproducible: Always      also tested with kernel 3.6.6, 3.7-rc5 and some other, on virtualbox 4.2.0 4.2.2 4.2.4


Hardware problem after fresh Linux Mint install

I've installed Linux Mint, Mate 64bit on my machine. > My configuration:   * Desktop PC HP Pro 3400 Series MT   * Processor: Intel Core i3 2120 @3.30GHz   * Chipset: Intel Sandy Bridge   * Graphic Interface: NVIDIA GeForce GT 520 My computer hangs on with a warning, here is a summary:   * Watchdog detected hard LOCKUP on CPU 0   * after a list of modules : last unloaded module CSSI_wait_scan   * PID: 0, comm: swapper/0 Tainted   * After that there is a call trace. Related to this: How to feed linux new install drivers?


Linux Mint 15: How to change permission of /opt folder

I'm trying install Pycharm Community 3.0.1. I'm extremely new to Linux and don't really know how to install things without explicit instructions (which for more popular software has just been pasting lines of commands into the terminal), which after searching online I've only found the following instructions: Install Pycharm on Linux Mint However trying to move the extracted folder results in a "Permission Denied" error. How would I change the permissions of /opt so I can move the folder? Or is there a better way to install things like this? The original file was a .tar.gz folder.


vi / vim - how to automatically strip trailing spaces on save?

Is there a `.vimrc` setting to automatically remove trailing whitespace when saving a file? Ideally (to be safe) I would like to only have this functionality for certain files, e.g. `*.rb`


Appending timestamp stamp along with log file lines

I have a log file and I need to append timestamps to each line as they get added. So I'm looking for script that appends timestamps to each entry in log lines and which could run as a cron job. Could someone please help me with the idea on creating this script?


Extrat tar "Cannot open: File name too long"

I made a tar with a directory on a remote machine with:               tar -czvf      I scp it to my local machine, where I wanted to untar it:               tar -xzvf      But I get : `Cannot open: File name too long` On my local machine on lubuntu 12.04 I have: `tar (GNU tar) 1.26`. The remote machine is not accessible right now, I'll check the version after if needed. I would like to extract without having to make a new tar, especially since the remote machine is offline. And by the way if you know a way to make proper archive despite long name, I'll take it.


Regarding the output of "df -h" in Linux.               [root@]# df -h     Filesystem            Size  Used Avail Use% Mounted on     /dev/sda2             193G   82G  101G  45% /     tmpfs                 1.9G  272K  1.9G   1% /dev/shm     /dev/sda1             486M   28M  433M   7% /boot     /dev/sda3              49G  759M   45G   2% /home     [root@]#      Here I am unable to understand what is `/dev/sda1` `/dev/sda2` `/dev/sda3` `tmpfs` and correspoding Column (`mounted on`) `/boot` `/` `/home` `/dev/shm` .\ Can anyone please explain these terms?


Retrieving two matches from repeated pattern

How can I retrieve matches from two repeated patterns: `mappedname` & its value in the text below?.               MapName:abc     someDiffName=someDiffValue     x=3     y=6     NeedyMappedName=NeedyMappedValue     .     .     Flag=true      * * *               grep "MapName\|NeedyMappedName" fileName      If I run `awk` on the `grep` output, it will apply to each line so won't give the expected result. The output I would like to get is               abc,NeedyMappedValue      If I run `grep "MapName\|NeedyMappedName" fileName`' it will give me the required two lines. And when I extract the required values with `awk -F ":" '{print $2}'` it will give `abc` & I won't be able to extract the second required match, `NeedyMappedValue` from the filtered grep output. Is there any way to achieve this by running `awk` with some pattern with a different pattern for second line?


How can I use tee to print the input stream?

I have a pipe line that looks like this:               cat myfile | awk '$3 > 0 { print $1, $2 * $3 }' | tee >(printf) | perl myscript.pl      I would like to print the input to my Perl script using `tee`. How can I do this?


Make screen start as Daemon for a Minecraft server

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


How is replaceable text shown in a terminal?

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


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

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


Turning percentages into decimals?

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


umount failed: device busy

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


kickstart bootloader --driveorder configuration

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


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

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


Extra overhead in MASQUERADE target

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


Performance of RAID 1 with 3 Disks under Linux

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


how to set crontab PATH variable

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


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

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


Increment Daily Config Value

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


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

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


Run shell script based on IPTABLES port access attempt

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


How to specify username and password in ftp command?

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


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

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


Pipe the output of a command to rm command

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


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

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


Ralink RT5370 Wireless usb dongle not working

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


Howto reduce skype video outgoing traffic?

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


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

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


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

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


Restored VG has shifted volumes

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


Which driver for USB enclosure should I install?

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


How can I read CD-Text information from CDs

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


Imagemagick on open wrt router "UnableToOpenConfigureFile"

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


Traffic shaping with tc does not work

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


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

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