title: How to get started writing drivers?

text: I have a throw-away cheap laptop I'd like to twiddle around, a Thinkpad SL 500. What bothers me are two leds, the one for wireless connectivity, and the one for hibernation, which don't light up at all, although they're functional, I've tried it on windows. So I would like to write a kernel driver for them, nothing big, it just looks like a good idea to play around with the kernel. My question is _what methodology should I follow systematically to find out what devices are responsible for those leds_ (in general, not necessarily specific to my hardware), and what drivers are responsible for the other two leds that work, bluetooth and the battery indicator? And when I say methodology, I really mean the methodology, step by step, with reasons for each step, like in the answer I've gave to someone else over here: What does && mean in void *p = &&abc; I am profficient at fgrepping through big code repositories, using static code analysers & co, but I think my lack of hardware knowledge hinders me on this problem. PS: I'm using ArchLinux, so almost the latest kernel version.


title: Use Unix tools to look for a definition block in an XML.

text: I am using an XML that has definitions in this form -               <definition name="ticketOpen" extends="ticketUpdate">         <put name="title" value="Open Ticket" />         <put name="mainForm" value="open.jsp" />         <put name="XYZ" value="PQR" />                 ...     </definition>      If I want to search for the definition of "ticketOpen", I can use `grep` like this -               grep "definition *name *= *\"ticketOpen\"" definitions.xml      However, this only returns the first line of the definition. How can I specify that after finding the first matching line, `grep` (or any other utility) should then look for the closing tag `</definition>` and print all those lines in between them?


title: How to check Linux kernel?

text: I want to install a package and it has different versions for different OS. The description in the package site is like this               X86-64 Linux 3.0 Kernel      I looked it up and found people saying to use               uname -r     uname -m      I tried it and got this:               3.2.0-24-generic     x86_64      Does this tells me the Linux I'm using is x86_64 and 3.2.0 Kernel? What does"-24-generic" mean?


title: Compiling a C program that defines a function getline by GCC

text: I'm trying to compile by GCC an old C program that defines and uses a function named `getline`, which conflicts with the function of the same name in the GNU C library. How can you compile it? Passing `-ansi -D_XOPEN_SOURCE_EXTENDED` to GCC give me strange errors in `strings.h`:               /usr/include/strings.h:74:16: error: expected identifier or '(' before '__extension__'      The relevant lines in `strings.h` is:               extern char *index (__const char *__s, int __c)      __THROW __attribute_pure__ __nonnull ((1));


title: Write text messages between Unix and Windows

text: Is it possible to send text messages between two users of the same LAN, but the first running Windows with cmd and the second running Linux/Unix? I am not looking for an instant messaging service. I would like to type in the Linux shell something like               write user@192.168.x.x:port message      so that the Windows user can read in its cmd window the text `message`; then the Windows user should be able to reply with another command. Is it possible? I have read about the Windows `msg` command but it doesn't work in all the versions of the OS. Is there anything else? Instead of PuTTY, I would like to use the Linux shell and the Windows cmd.


title: How could I restrict directory content by file type?

text: Is there a way to restrict directory content by the file type? For example, I have an upload directory that I only want users to put images in, could I go a step further & actually put a restriction that will only allow images in it? I thought about a CRON Job to check the file extension but wondered is there was another way....


title: Run a diff between local and remote file

text: I'm connected on a host via `ssh` and I'd like to compare (let's say with `diff`) a certain config file against its counterpart on another host, also accessible via `ssh`, without having to manually download the remote file first.


title: How to "listen" to nginx writes to a file socket

text: I'm trying to get uwsgi and nginx to play nice. After moving to "file sockets" (hopefully I'm using the right terminology here) from TCP sockets, the only thing I get from uwsgi is a 400 with no helpful logging info. I'd like to inspect what exactly nginx is sending uwsgi. How do I do that? Everything I've read so far about bash and sockets relates to TCP or UDP connections. My assumption is that nginx is unable to write to the file socket at all or at least properly, so I'd like to "inspect" the file socket to see what, if anything, is being written there. Ideally I'd like a `tail -f` equivalent to point at the socket file. If this assumption wasn't correct that would mean either my browser is sending a malformed request (HIGHLY unlikely IMO, using Chrome) OR uwsgi is incorrectly reporting the nature of the error OR I'm misunderstanding the meaning of an HTTP 400 error. Are any of these a possible cause of the problem?


title: What does the @ (at) symbol before a filename mean in a curl command?

text: I am looking at an example of a `curl` command that uses the @ symbol before the filename to post data to the server.               curl http://localhost/ --data-binary @file.txt      What does this mean? Does it insert the contents of the file into the command? Is it specific to `curl`?


title: How can I limit the bandwidth used by a process?

text: I have a CentOS 5.7 server that will be backing up its files nightly. I am concerned that visitors to the various sites that the server hosts will experience degraded performance while the backup is transferring across the network. Is it possible to limit a process's maximum allowed throughput to a network interface? I would like to limit the SSH-based file transfer to only half of my available bandwidth. This could be on the server or client side; that is, I'd be happy to do this on either the client that initiates the connection or the server that receives the connection. (Unfortunately, I can't add an interface to dedicate to backups. I could increase my available throughput, but that would merely mean that the network transfer would complete faster, but still max the total capacity of the connection while doing it.) * * * ## Some Background Perhaps some background is in order. Stepping back, I had a problem with not having enough local space to create the backup itself. Enter SSHFS! The backup is saved to what is ostensibly a local drive so that no backup bits are ever on the web server itself. Why is that important? Because that would seem to invalidate the use of the venerable `rsync --bwlimit`. `rsync` isn't actually doing the transfer nor **can** it because I can't even spare the space to save the backup file. I can hear you ask: "So wait, why do you even need to make a backup file? Why not just `rsync` the source files and folders?" Because an annoying thing called "Plesk" is in the mix! This is my client-facing web host which uses Plesk for convenience. As such, I use Plesk to initiate the backups because Plesk adds all sorts of extra magic to the backup that makes consuming it during a restoration procedure very safe. _sad face_


title: Can you change a dynamic link target without recompiling?

text: I downloaded a program that unfortunately doesn't come as a source distribution. When I go to run it, I get the error > error while loading shared libraries: libjpeg.so.62: cannot open shared > object file: No such file or directory The program seems to have been linked against a specific version of libjpeg which my distro does not have. Creating a symlink named `/usr/lib32/libjpeg.so.62` to my actual `libjpeg.so` fixes the problem, but poking around in `/usr/lib32` just to make one program work seems stupid and over the top. Is there any way (sans recompiling) to make the program dynamically link `libjpeg.so` instead of `libjpeg.so.62`? FWIW, `file` info for the program is               ELF 32-bit LSB  executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped


title: Monitor a process in Debian

text: I want to create a service that monitors the existence of a certain process. I wrote the following shell script:               #!/bin/sh     while :     do     w=`ps u -A | grep -P ".+Sl.+/usr/local/MySource/endpoint" -c`     sleep 10     if [ $w -lt 2 ]      then     echo 0 > /sys/class/leds/alix\:2/brightness     killall -9 /usr/local/MySource/endpoint     nohup /usr/local/MySource/endpoint &> /dev/null &     last_endpoint_m=`date`     echo $last_endpoint_m > /tmp/endpoint_msleep     echo $w >> /tmp/endpoint_msleep     else     echo 1 > /sys/class/leds/alix\:2/brightness     fi     sleep 10     done      If the process exists, the script will switch off a LED on my machine and start the process. The LED should be `ON` while the process is running. I then run this script by adding the following line to `/etc/rc.local`:               nohup /usr/local/MyTools/additions/XR50_endpoint_m &> /dev/null &      When I run `ps`, I find that the `XR50_endpoint_m &` process is there. My Machine is an ALIX board with limited resources (embedded) running Debian. The question is:   The variable `$w` is always zero (I verified this from the output file `/tmp/endpoint_msleep`). Although the process exists and the script is working fine if I run it manually (`$w=2`)! What do you think the reason is and what is the best way to monitor a process?


title: How to inactive Wire Lan Connection when have not physical connection

text: I use `Ubuntu 14.04 LTS`. When I work at Company, I usually use `Wire Lan Connection` and set `static IP`. But, but when at Home, I usually use `Wireless Lan Connection` and IP information is provided by `DHCP`. At home, I must disable eth0 netword card to access IP range in the same subnet with wire connection. (Before disable eth0, my routing table still contains entry of eth0. How to inactive Lan Connection when have not physical connection?


title: Make tmux block until program completes

text: I am impressed by tmux's remote control features:               tmux new-window -t p12346 'echo foo;sleep 10'       This creates a new window in the session named p12346 and does not print anything on the screen. That is great. But how can I tell the above command to wait until the sleep finishes before returning? I.e. I want this do the same but to take 10 seconds to execute:               time tmux new-window -t p12346 'echo foo;sleep 10'       **Background** If this is viable then it might become a feature of GNU Parallel: The jobs currently running can be accessed as each their window through `tmux`, so you can follow the progress of each job in real time. So `tmux` will not be run in the foreground: The user will need to attach to it.


title: How to check how many External Hard Drives are connected to Linux Server

text: Is there a way to distinguish between the Internal Hard drives and External Hard drives. Actually i need to see how many External hardrives do we have and to which server are they connected . This is the Screenshot i took and by judging by its name SDE is external hard drive. But im not sure . So help me out. ![enter image description here](http://i.stack.imgur.com/qtXp4.png) ## Further actions Ok now i used lsusb and it said Western Digital Drive connected and its Drive No is SDE. But by using dmesg it said that sdb is also a removable disk. Any suggestions               'sd 0:0:1:0: Attached scsi removable disk sdb       Vendor: WDC       Model: WD2500YD-01NVB1   Rev: 10.0       Type:   Direct-Access                      ANSI SCSI revision: 05       Vendor: WDC       Model: WD2500YD-01NVB1   Rev: 10.0       Type:   Direct-Access                      ANSI SCSI revision: 05       Vendor: WDC       Model: WD2500YD-01NVB1   Rev: 10.0       Type:   Direct-Access                      ANSI SCSI revision: 05       Vendor: WDC       Model: WD2500YD-01NVB1   Rev: 10.0       Type:   Direct-Access                      ANSI SCSI revision: 05


title: Unable to connect to wireless

text: So I've been dual booting eOS with windows 7 for about 3 weeks now and I've absolutely loved it. I haven't had any problems until today. For some reason I cannot connect to my wireless router. I went out of town for a week and when I came back, eOS wouldn't establish a connection. My router is recognized and the following dialog pops up every 2 mins or so:               =======================================================================     Authentication required by wireless network     Password or encryption keys are required to access the wireless network 'abc1234'.          Password: *********          Cancel / OK     =======================================================================      I repeatedly hit ok and after 5 or so pop ups eOS just disconnects. I've double-checked that I'm entering the correct password but it never connects. I've reset my router, switched my wireless card off and back on, and logged into my router to see if there were any suspicious changes. The weird thing is that I can connect on Windows 7 just fine. I'm running the 64-bit eOS on a Thinkpad T430. Any suggestions? Edit: I'm able to connect to a mobile hotspot using my phone so I think it may be more related to the router configuration as Paulo pointed out.


title: How to exclude from a "Match Group" in SSHD?

text: There is a Match group in the SSHD config:               cat /etc/ssh/sshd_config     ...         Match Group FOOGROUP         ForceCommand /bin/customshell     ...      There are many users on the machine that are in the "FOOGROUP". **My question:** How can I exclude a given user that is in the "FOOGROUP" from the "Match Group"?


title: How to compile AMD Legacy driver on 64-bit kernel, Linux Mint 17

text: I'm trying to get the legacy driver for my HD 2400 GPU but I had an error while it was building. I looked at this answer, and have the same result, in the driver manager is empty: http://unix.stackexchange.com/a/106918/72663 In order to get past the missing `version.h` file I did this first:               $ sudo ln -s /usr/src/linux-headers-3.13.0-24-generic/include/generated/uapi/linux/version.h /lib/modules/3.13.0-24-generic/build/include/linux/version.h      When I run the catalyst tool to install the driver I'm getting this:               Creating symlink /var/lib/dkms/fglrx/8.97.100.7/source ->                      /usr/src/fglrx-8.97.100.7          DKMS: add completed.          Kernel preparation unnecessary for this kernel.  Skipping...          Building module:     cleaning build area....     cd /var/lib/dkms/fglrx/8.97.100.7/build; sh make.sh --nohints --uname_r=3.13.0-24-generic --norootcheck....(bad exit status: 1)     [Error] Kernel Module : Failed to build fglrx-8.97.100.7 with DKMS     [Error] Kernel Module : Removing fglrx-8.97.100.7 from DKMS      But I believe the problem is that `version.h` has moved, so this is all of my locations:               $ sudo find / -name version.h/var/lib/dkms/virtualbox-guest/4.3.10/build/include/VBox/version.h     /lib/firmware/carl9170fw/include/shared/version.h     /usr/include/linux/version.h     /usr/include/linux/dvb/version.h     /usr/src/linux-headers-3.13.0-24-generic/include/generated/uapi/linux/version.h     /usr/src/linux-headers-3.13.0-24-generic/include/config/arch/want/ipc/parse/version.h     /usr/src/linux-headers-3.13.0-24-generic/include/config/evm/hmac/version.h     /usr/src/virtualbox-guest-4.3.10/include/VBox/version.h     /usr/src/linux-headers-3.13.0-24/include/uapi/linux/dvb/version.h     /usr/src/linux-headers-3.13.0-24/include/xen/interface/version.h      I installed the 32-bit version of the kernel headers as seen here:               $ sudo apt-get install linux-headers-3.13.0-24-generic:i386     Reading package lists... Done     Building dependency tree            Reading state information... Done     linux-headers-3.13.0-24-generic:i386 is already the newest version.     0 upgraded, 0 newly installed, 0 to remove and 208 not upgraded.      I expect I need to change something in `make.sh` to fix the path, but I'm not certain what I should change, or just do an `ln -s ...` to get it to work easily. With a 64-bit 3.13.0 kernel, how do I install fglrx-8.97.100.7? If I can't get this to work with Mint Linux, would this be simpler with Ubuntu? I'm doing some programming with WebGL and can't get the acceleration I need to test my javascript code with the generic driver.


title: How to persist ulimit settings in OSX Mavericks?

text: Before Mavericks, one could use `/etc/launchd.conf` to persist ulimit settings, for example:               limit maxfiles 16384 unlimited     limit maxproc 16384 unlimited      It no longer works in Mavericks. What is the correct way to do it in Mavericks?


title: "Failed to build gem native extension" when installing xively-rb for raspberry Pi

text: I'm trying to install the `xively` Ruby gem on the Raspberry Pi - http://rubygems.org/gems/xively-rb However, during install the following occurs: > gem install xively-rb Building native extensions. This could take a while... > ERROR: Error installing xively-rb: ERROR: Failed to build gem native > extension. >   >   >     /usr/local/rvm/rubies/ruby-2.0.0-p353/bin/ruby extconf.rb >   > > Gem files will remain installed in > /usr/local/rvm/gems/ruby-2.0.0-p353/gems/yajl-ruby-1.2.0 for inspection. > Results logged to /usr/local/rvm/gems/ruby-2.0.0-p353/gems/yajl- > ruby-1.2.0/ext/yajl/gem_make.out I'm pretty sure I fixed this issue on Windows by install the dev version of ruby, but executing `rvm list` shows that I have the correct versions installed:               $ rvm list          rvm rubies             ruby-1.9.1-p431-dev [ armv6l ]     =* ruby-2.0.0-p353 [ armv6l ]            ruby-2.0.0-p353-dev [ armv6l ]          Where =* denotes the currently used ruby version.      How can I correct my setup to install `xively`?


title: What do numbers in INPUT,FORWARD,OUTPUT chains mean in iptables config file?

text: I came across the following config file:               # Generated by iptables-save v1.3.1 on Sun Apr 23 06:19:53 2006     *filter     :INPUT ACCEPT [368:102354]     :FORWARD ACCEPT [0:0]     :OUTPUT ACCEPT [92952:20764374]     -A INPUT -i lo -j ACCEPT     -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT     -A INPUT -i eth0 -p tcp -m tcp --dport 22 -j ACCEPT     -A INPUT -i eth0 -p tcp -m tcp --dport 80 -j ACCEPT     -A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7     -A INPUT -j DROP     COMMIT     # Completed on Sun Apr 23 06:19:53 2006       Does anyone know what `[368:102354]`, `[0:0]` and `[92952:20764374]` mean?


title: Apache - Generate private key from an existing .crt file

text: I have some apache instances running smoothly with a home-made generated certificate. Now I have to use a provided certificate, but what I had sent is only a .crt file. In tried to copy it into the proper directory, but when I try to restart the webserver, it logs:               SSL Library Error: 185073780 error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch      Which I think it's correct, because the .key file is the one I made myself. Is there any way to generate the proper .key file from the .crt?


title: Organize Email by Date Using procmail or maildrop

text: I would like to organize all incoming email into the following directory structure based on the date of the email:               ROOT --+-- YYYYMMDD --+-- HH --+-- mm --+-- YYYYMMDD-HHmmSS-000001            |              |        |        |            |              |        |        |      ....            |              |        |        |            |              |        |        +-- YYYYMMDD-HHmmSS-NNNNNN            |              |        +-- mm --            |              +-- HH --+-- mm --       Note that each email will be stored as a separate file and the name of the file is YYYYMMDD-HHmmss-NNNNN, where NNNNN is a running number. Can procmail or maildrop do this? If not, what other options are there? Thanks in advance.


title: Read space as input in shell script

text: How can i give space `" "` as input in shell script ? Ex :               echo " Enter date for grep... Ex: Oct  6 [***Double space is important for single date***] (or) Oct 12 "     read mdate      echo $mdate          In this i get output as "Oct 6" But i want "Oct  6"      How can i do it ?


title: How to receive meeting invitations from Office365, so that they can be parsed and added to a calendar?

text: How to receive iCalendar (.ics or .ical) meeting invitations from outlook.office365.com, so that they can be parsed and added to a calendar (such as remind + wyrd)? I've searched long and hard for an answer, but haven't found any, so I wonder if I'm just missing something really trivial. I am using Mutt 1.5.22 with OfflineIMAP 6.5.5 on Fedora 20 (Heisenbug). There are many scripts out there for parsing iCalendar messages into formats that can be imported into calendars. This is **not** my problem. My problem is that I'm not even receiving iCalendar messages, so I have nothing to parse. A meeting invitation arrives in my inbox as a base64 encoded text/html message. It is **not** a multipart message and there are **no attachments**. The body of the message contains a link to Microsoft Outlook Web Access (OWA). Following the link doesn't seem to do anything except take me to WebMail. The rest of the email body contains the description of the meeting invitation. I tried forwarding the invite and forwarding the invite as an attachment, but neither of these affected the format of the message. I inspected the headers of the message, but nothing stood out as being important. I've copied them here, in case they mean something to anyone:               Received: from [...] by [...] with Microsoft SMTP Server (TLS) id             [...] via Mailbox Transport; [timestamp]     Received: from [...] by [...] with Microsoft SMTP Server (TLS) id             [...]; [timestamp]     Received: from [...] by [...] with Microsoft SMTP Server (TLS) id             [...]; [timestamp]     Received: from [...] by [...] with mapi id [...]; [timestamp]     From: [meeting organiser]     To: [meeting attendees]     Subject: [meeting subject]     Thread-Topic: [meeting subject]     Thread-Index: [...]     Sender: [sender on behalf of meeting organiser]     Date: [timestamp]     Message-ID: <[...]>     Accept-Language: en-US     Content-Language: en-US     X-MS-Exchange-Organization-AuthAs: Internal     X-MS-Exchange-Organization-AuthMechanism: 03     X-MS-Exchange-Organization-AuthSource: [...]     X-MS-Has-Attach:     X-MS-Exchange-Organization-SCL: -1     X-MS-TNEF-Correlator:     Content-Type: text/html; charset="utf-8"     Content-Transfer-Encoding: base64     MIME-Version: 1.0      I also inspected the headers of the message in WebMail. There were more headers (some related to tnef), but again, nothing seemed related to calendars or invitations. I compared the headers of a "meeting invite" with the headers of a normal email. The only difference was that a normal email contains an extra header: "X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply". My .offlineimaprc's folderfilter is set to not sync the Calendar folder. This is because every time OfflineIMAP tried to sync, it would run into over a hundred instances of the same error when syncing the Calendar folder: "ERROR: IMAP server 'remote' does not have a message with UID '[...]'." Using Python's imaplib to inspect the Calendar folder:               >>> import imaplib     >>> i = imaplib.IMAP4_SSL("outlook.office365.com", 993)     >>> i.login("NAME@COMPANY.com", "PASSWORD")     ('OK', ['LOGIN completed.'])     >>> i.select("Calendar")     ('OK', ['159'])     >>> i.fetch(159, "(RFC822)")     ('OK', [None])     >>> i.fetch(159, "(RFC822)")      The second time I call fetch, it returns a message: "The server couldn't retrieve the following message. The message hasn't been deleted. You might be able to view it using either Outlook or Outlook Web App. You can also contact the sender to find out what the message says." In WebMail, I see that the Calendar folder (accessible via the Calendar tab) has permissions for visibility **outside organization**. It's currently set to "Not shared". Other options are "Availability only", "Limited details", or "Full details". Setting the permissions to "Full details" and then sending a meeting invitation to myself didn't have any effect on the format of the meeting invite. As a workaround for not receiving iCalendar message, I have Thunderbird open with the Lightning add-on. Somehow, the Lightning add-on knows how to receive meeting invitations. The messages still show up as text/html, but there's a link in Thunderbird's status bar. Clicking it opens a prompt asking whether to deny or accept the invitation. Anyone have any ideas why meeting invitations from Outlook 365 are arriving as simple text/html messages rather than iCalendar messages? Is there anything I can do? If the Lightning add-on can work with the invitations, then there must be a solution, such as using Microsoft Exchange Web Services (EWS). If the solution will require me to code up a tool, so be it. A push in the right direction would be greatly appreciated.


title: Upgrading SSD Capacity - Clone Drive

text: I currently have a 60GB SSD that I have as my OS drive for Windows 7 partition and Fedora17 partition. Most data is stored on my 500GB HDD. I have upgraded to a 120GB drive, and want to clone the 60GB drive over to my 120 drive. Right now my current layout is roughly 40GB for Windows 7 and 20 for Linux (GRUB - Windows -Linux). What I am trying to figure out is if I were to clone that directly to the 120GB I would be left with something like (GRUB - 40GB Windows - 20 Linux - 60 Spare). My linux install is pretty simple, and wont need too much more space, most of the space I would like to dedicate to Windows. Is having my extra space at the end (after my Linux partition) a problem? Or does it not matter? Or would I be better to remove my linux partition, clone the existing data to the new drive, and set up my Linux partition on the last 20 GB or so of the 120 drive? New to this... need some advice. Thanks.


title: Copy symlink AND where it points to using rsync

text: It doesn't need to be done by rsync, but it would be nice not have to write a script to do this, and rsync is very close to what I want. "rsync -a" (or -l) can preserve symlinks, and -L can dereference symlinks and copy it as if it is normal file/dir. However, is it possible to keep the symlink, and also copy the files/directories the links points to? Here's an example. Say we have this folder hierarchy: > dirA/link_to_file -> ../dirB/file > > dirA/link_to_dir -> ../dirC > > dirB/file > > dirB/not_this_file > > dirC/file > > dirC/file2 > > dirD/others and when I do "rsync -aR dirA dest" (or something else), I'd like to have exactly these appear in dest. > dirA/link_to_file -> ../dirB/file > > dirA/link_to_dir -> ../dirC > > dirB/file > > dirC/file > > dirC/file2 Is this possible with rsync? Thank you. Edit: Let's assume symlinks having absolute path or pointing to outside the source directory can be ignored.


title: How to change the cursor theme in CLI?

text: I want to change the cursor to be block-shaped. ![enter image description here](http://i.stack.imgur.com/zR0ZK.png) All applications (nano,vi,vim,…) should should have a square-style cursor like the picture above.


title: Reconnect if the link is stale

text: I run FreeBsd box with pppd over Ethernet. Everything works just fine with only one exception. Sometimes, not too often, the connection becomes stale. Everything looks like if it is ok: ifconfig shows it is up, ppp says that the link is ok, but traffic does not come through. What I do is run `killall pppd` and then restart ppp manually. It reconnects and things are great again. My question is: is there a setting in pppd (or mpd5, or anywhere else) that if set, makes ppp detect that the link is stale and reconnect automatically? If there isn't such a setting, maybe there is another solution?


title: Where does LVM store data?

text: My questions are similar to this thread Does LVM increase the risk of data loss?, however, I couldn't find a satisfying answer. So the question is, where does LVM store data/files, when I have a Volume Group (VG) of 3 physical disks? What happens when one disk fails? Can I just unplug that disk, tell LVM to remove that physical disk from the VG and just continue working with the other disks? So the real question is: Does LVM save a file on one disk or does LVM fragment the file and split it throughout the three disks? The first option can't possible be right, because what happens when I have a 3GB file, my VG says that 3GB are free, but in fact each disk only have 1GB of space left. So the latter is true? But then this means that I will definitely lose some other data other than from the failing disk?


title: Is it bad to have filesystems nearly full?

text: Example I have large/small sized filesystems **JFS2/EXT3** , whatever (and various OS, Linux, AIX), but some of them are on ex.: 90%, 95%, 98% usage. **Questions: Having filesystems nearly full does something bad? Performance problems or FS corruption or HW problem?** UPDATE:   * The question is regarding corporate environment. **Does anyone have authentic essays/URL's regarding the effects?** :)   * "Which directories are on these filesystems?" - any, ex.: SAP, ORACLE, etc.    * **The disks are usually from SAN.**


title: sysctl parameter for correct ARP response

text: I have a server that has some VMs, but the VMs can't communicate properly with the server because the server has several interfaces, and it responds on the wrong one. **Q** : We know that there is a kernel parameter that can ensure that ARP responses will come only from that interface where the request went. What is that `sysctl` setting? Server is Debian machine.


title: Force dhcp client to get a new lease

text: I have a linux DHCP server running on my network. I recently found out that I can assign specific IP addresses to clients based on their MAC address by modifying the `dhcpd.conf` file. Now is there something I can do from the server side that would invalidate a specific client's lease, forcing it to get a new one from the server (after I have added entries in `dhcpd.conf`), without releasing/renewing on the client side?


title: Broadcast to all users in friends list with kopete?

text: in kopete you can right click a group and send a message to the group. It also seems there's a hidden toplevel group that you can move users to. Is it possible to send a message to this toplevel group so that all users in your friends list receive it?


title: What's preventing ifenslave from bonding multiple OpenVPN-through-Tor tunnels in balance-rr mode?

text: This question builds on a previous question, Can Tor connections between hidden services be aggregated using ifenslave? (… and might Mevade be doing this?). In researching that, I came across VPN Bonding, which explains how to bond multiple SSH tunnels with ifenslave in balance-rr mode. And so I decided to try bonding multiple OpenVPN-through-Tor tunnels in that way. I installed OpenVPN in the workstation of one Whonix 7 instance, and created a certificate authority. I then generated certificates and keys for several OpenVPN servers, and for one client each. Next I created configuration files, and verified that the servers were running (on ports 5000, 5001, etc). Then, in the gateway, I created a hidden service for each OpenVPN server. Next, I installed OpenVPN in the workstation of another Whonix 7 instance, and set up the OpenVPN clients, pointing them to the corresponding hidden services. They all came up, with 1-2 second pings. However, I've had no luck usefully bonding them with ifenslave. I can create bond0 on each end, using mode "balance-rr". Running ifconfig shows the new bond0 interface, and all component tun interfaces report "UP POINTOPOINT RUNNING NOARP SLAVE MULTICAST". I see no errors in /var/log/messages, just the expected "Adding slave tun*" and "enslaving tun* as an active interface with an up link" messages. But ping fails on the bonded link. I did add "loop, lp, rtc and bonding" to /etc/modules. However, lsmod only showed three of them (loop, lp and bonding). Could the missing rtc be problematic? Or perhaps it's more likely that ifenslave simply can't bond interfaces with 1-2 second latency, and ~0.5 second jitter. Is there any hope for joy here?


title: How do I count all the files recursively through directories

text: I want to see how many files are in subdirectories in there subdirectories to find out where all the inode usage is on the system. Kind of like I would do this for space usage               du -sh /*      which will basically give me the amount of space used in the directories off root. but in this case I want the number of files, not the size.


title: What is the difference between X and XFree?

text: Why are there two programs for that?


title: Locating mail users and setup for RT

text: We have an AD where I work which handles usernames/email, authentication etc and all the rest. I've been trying to find our 'support' email address on there but soon realised that it exists not on the AD server, but on a CentOS (5.2) server running Request Tracker (RT). However, I can't actually find the configuration files/settings for this email add as I want to remove some forwarding settings etc. but am unsure where to look or how to work out what mail service I'm running, and where the crucial files are stored. All I've found so far is a fairly large text file with all the received emails in /var/mail. I've ran programs like top, ps to see if I can find if any mail application is running, but nothing stood out to me. I do know that postfix is installed on this server and have been searching the config files in /etc/postfix but it seems that mail isn't set with postfix on this box... I know next to nothing about Linux and mail, so any help is appreciated :D


title: Bash script to rename files from a text file source

text: I'm fairly new to bash; I can just about perform simple administrative tasks with simple commands 1 at a time. However, I've been tasked with renaming some files in a directory using a text file as the source for my renaming and would really appreciate a few pointers, as I am well out of my depth. Let me explain:               New File Name.xlsx 0.1  000011F4.dat      New File Name.xlsx 0.2  000011F5.dat      New File Name.xlsx 0.3  000011F6.dat      New File Name.xlsx 0.4  000011F7.dat      New File Name.xlsx 0.5  000011F8.dat      New File Name.xlsx 0.6  000011F9.dat       The source text file I have resembles the above somewhat. The intention is that the first 'column' is the new name for the file, the middle is the version and the third is the current filename. I need to rename the .dat files in the directory, changing them to the names presented in the first column. I also need to prepend the version number 0.1, 0.2 etc... to the beginning of each file. I have a few questions: Is it a massive problem that the files have whitespace in them? Would it be better adding " " around each file string? Basically I have no idea where to start and any help would be massively appreciated. As you can see it's slightly more complex than a usual renaming, giving the need to add the version column to the beginning of the filename and the whitespace in the list.


title: Programatically use visudo to edit sudoers?

text: I have a sudoers file stored in our svn repo. I want to svn export it to `/etc/sudoers` but can't do it because sudo detects that it was not edited by visudo and throws syntax errors. What exactly does `visudo -f` do and can I do the following               cd /tmp && svn export <URL>/sudoers &&  visudo < /tmp/sudoers"      without manual intervention?


title: Need help to create a Unix shell startup script

text: Is there a way to create a Unix shell script (on HP-UX) that will start on server at boot time only, and will execute the following commands in order:               # cd /mysql     # ./bin/safe_mysqld --user=root &     # ./support-files/mysql.server start      If there is such an option, then where should I put that script in order for it to work? The HP-UX stores its startup scripts in `/sbin/init.d/` but there are also links to all of the scripts in the `/sbin/rc#.d/` folders, perhaps I should put the link in `/sbin/rc3.d/` or maybe I should create a cron job that will execute the script on start? Any suggestions? * * * NOTE: This question is in addition to a Server Fault question here.   I just thought that this might be more appropriate place for such question.


title: How to safely move a file to another directory and remove duplicates

text: I want to move files from Downloads, Documents, Pictures, Music, et al to shared locations. This is for various reasons, including because I want to keep media in a central, shared place. I want to avoid clobbering existing files with the same name, but if the files have the same size, then I'm usually happy to keep the newer file. Also nice to move files with duplicate names but different sizes, but append something appropriate to the new file. Anyway, I have a perl script, 'ckmv', which does much of what I want, but I'm wondering whether there is a more idiomatic way in shell script? Do you ever have this need, what do you do? I just found this post, (how to move files from one folder to other with appending time stamp to the name?), which explains how to forge a new name by appending the file creation date. That makes sense, I may add that. Thankyou!


title: Applications for handling appointment wishes

text: This is not a "What is best" but a "Is there any at all (and which)?" question. A friend of mine wants to improve the handling of her customers' appointment wishes. The idea is that they can enter their suitable time spans on a web site and the application checks whether all of them (or: how many) can be combined. I am not familiar with this kind of optimization algorithm thus it would be much easier to use an existing tool than write one myself... Thus (if there is no such application) hints to resources about appropriate algorithms would be helpful.


title: Execute custom script when an interface gets connected

text: I using a USB wifi dongle to connect to the Internet. When the wireless connection dies, I lose some iproute rules too. How can I reset these rules when the interface connected again?


title: Need telnet to connect to phone system, but not full client mode

text: My telephone system (fritzbox 7170) outputs log data on telnet and some form of script is needed to start it from `crontab`, capture all data and write anything that comes in to a log file without delay. It also has to be able to detect any disconnects, as it has to reconnect as fast as possible (lets say within a few seconds) so that no calls are lost. The log-files will be used to monitor the line, send email alerts about all calls, change line status on my website and much more. Right now it works on Windows, but not on my Debian box (RaspberryPi). On Windows it looks like this; (and runs every 10 min)               taskkill /f /im telnet.exe     copy /B log.old+log.txt log.old     sleep 1     del log.txt /f     telnet.exe -flog.txt fritz.box 1012


title: How do I name a partition?

text: Currently, I have a partition where Crunchbang is installed, which shows up as a folder in Mint named either `0d71227f-66fc-45ac-8bfc-93280b93dc8c` or "10.0 GB Volume". First question is, of course, wtf? My main question is, however, how do I rename it to something less ridiculous? I tried renaming it as root, and I get the `device is busy` error.


title: Path errors when using GNU Stow

text: I am trying to get started with GNU Stow. I have defined `STOW_DIR` to point to a personal path:               STOW_DIR=/some/path      I then build a package of my choice from the tarball and install it under `STOW_DIR`. In this case, I am building `stow` itself (i.e. I am bootstrapping stow itself into Stow):               ./configure --prefix=$STOW_DIR/stow     make     make install prefix=$STOW_DIR/stow      And then I build the symlinks:               cd $STOW_DIR     ./stow/bin/stow stow      but at this point I get the following error: > `stow: ERROR: The stow directory ../../../../some/path does not contain > package stow (No such file or directory)` why?


title: How iconify xterm when it loses focus?

text: I am attempting iconify a `xterm` terminal when it loses focus in `fluxbox`. I am following this wiki: http://fluxbox-wiki.org/index.php?title=Make_xterm_act_like_a_PC_game_console And so far, I've got it appending this line               Control T : If {Matches (xterm)} {Delay {Iconify} 1}      to `~/.fluxbox/keys` file, which iconify the terminal **when I press`Control T`** shortcut. How can I get that behavior when xterm loses the focus?


title: How to send/receive Messages on RFCOMM Terminal

text: I have connected to another Bluetooth device via RFCOMM. Now i want to send/receive Messages, but just typing them into the Console won't send them.. where to do that? ![enter image description here](http://i.stack.imgur.com/VtUTs.png)


title: Script to prevent screen blanking using "mouse move" doesn't work

text: This is my attempt to make a script that will use a "mouse move" to prevent screen blanking while watching videos. I'm hoping to use the value for highest CPU% process in `top` and if CPU usage exceeds 5%, a mouse move should occur.               #!/usr/bin/env bash          sleep_period=60s           while true; do       if (( $(top -bn 1 | sed -nrs '8p' | awk '{ print $9 }') -gt 5 )); then          while (( $(top -bn 1 | sed -nrs '8p' | awk '{ print $9 }') -gt 5 )); do           xdotool mousemove 0 100           xdotool mousemove 0 50           sleep ${sleep_period}         done       else         sleep ${sleep_period}       fi     done      Unfortunately, it does not work. The errors are like this:               [07:20 PM] /bin $ noo.sh     /home/vasa1/bin/noo.sh: line 6: ((: 0.0 -gt 5 : syntax error: invalid arithmetic operator (error token is ".0 -gt 5 ")     /home/vasa1/bin/noo.sh: line 6: ((: 6.4 -gt 5 : syntax error: invalid arithmetic operator (error token is ".4 -gt 5 ")      How do I fix this? (Please note that I'm not experienced in scripting.) * * * Based on answers here, I put together:               #!/usr/bin/env bash          sleep_period=5m           while true; do       if [[ $(top -bn 1 | sed -nrs '8p' | awk '{ print int($9) }') -gt 8 ]]; then          while [[ $(top -bn 1 | sed -nrs '8p' | awk '{ print int($9) }') -gt 8 ]]; do           xset -dpms; xset s off           xset +dpms; xset s on           sleep ${sleep_period}         done       else         sleep ${sleep_period}       fi     done      Then, I reported this code over at Ubuntu Forums and Vaphell worked on it further. Below is Vaphell's version and is what I am using:               #!/usr/bin/env bash          sleep_period=5m           while true; do       if top -bn 1 | awk 'NR==8 { exit !($9>8); }'; then         xset -dpms; xset s off         xset +dpms; xset s on       fi       sleep ${sleep_period}     done


title: SSH lets me login with a password even though I set "PasswordAuthentication no"

text: I'm trying to turn off password authentication for SSH after setting up public key access. I have these set in my /etc/ssh/sshd_config file:               PermitRootLogin without-password     PasswordAuthentication no     ChallengeResponseAuthentication no      However, it still lets me login with a password.


title: ERROR: cube viewer is not available!

text: I have installed and configured the following:               cube-4.2.1     opari2-1.1.1     papi-5.2.0     scalasca-2.0     scorep-1.2.1      I am trying to run `scalasca -examine`, but I get the following error:               ERROR: cube viewer is not available!      Can you instruct me how to fix it? I ran the installation with the same configuration on Ubuntu 12.04 LTS and Kali 1.5 and got the same error on both the OS.


title: How to get time synced outputs (different timezones on servers)?

text: So imagine there are ~100 servers with different timezones (not all diff., but many-many timezones). There are outputs on the server logs like:               server1:BFE4C025   0420201413 P H sysplanar0     UNDETERMINED ERROR     server2:BFE4C025   0421032413 P H sysplanar0     UNDETERMINED ERROR      -> so they are in server time (different timezones) ->                0420201413 = 2013.04.20. 20:14     0421032413 = 2013.04.21 03:24      Converting ex.: 0421032413 to 2013.04.21 03:24 is trivial. But: again the server time differs, if I give out the "date" command on these two servers in the exact same time:               server1:Tue Apr 23 07:23:24 EDT 2013     server2:Tue Apr 23 13:23:24 MESZ 2013      I get this. But I need the mentioned logs (only that few line/server) in one timezone. Why? Because it's very-very usefull to know when did exactly things happen in your timezone, ex.: CET TZ. **Q** : how can I convert the server logs time to Central European time?


title: How to install precompiled ath9k driver?

text: I have a Ubuntu and I have cross compiled an ath9k driver for an ARM architecture. The problem is a can't make the install work as I want to work. README says the following: > ## Building for external kernels > > If you have a kernel you do not have installed but yet want to build the > compat-wireless-2.6 drivers for it you can use this syntax: > > make KLIB=/home/mcgrof/kernels/linux-2.6.23.9 > KLIB_BUILD=/home/mcgrof/kernels/linux->2.6.23.9 > > If you have a kernel installed, which is not your currently running kernel > (e.g. via distro updates; plus its corresponding kernel-dev package), you > can use this syntax: > > make KLIB=/lib/modules/2.6.30.6-53.fc11.x86_64 > > and to install to your system's root path for the non-running kernel: > > make KLIB=/lib/modules/2.6.30.6-53.fc11.x86_64 > KMODPATH_ARG='INSTALL_MOD_PATH=' install My build command is the following:               make ARCH=arm CROSS_COMPILE=/home/roncsak/building/toolchain-arm-linux-gnueabihf/gcc-lw-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/bin/arm-linux-gnueabihf- KLIB=/home/roncsak/building/linux/linux-3.0.35-boundary KLIB_BUILD=/home/roncsak/building/linux/linux-3.0.35-boundary      (Building is a success.) According to README I should install like this:               make ARCH=arm CROSS_COMPILE=/home/roncsak/building/toolchain-arm-linux-gnueabihf/gcc-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/bin/arm-linux-gnueabihf- KLIB=/home/roncsak/building/linux/linux-3.0.35-boundary KLIB_BUILD=/home/roncsak/building/linux/linux-3.0.35-boundary KMODPATH_ARG='INSTALL_MOD_PATH=/home/roncsak/building/targetfs/rfs/lib/modules/3.0.35' install      Unfortunatelly my install won't work. The result is the following:               make -C /home/roncsak/building/linux/linux-3.0.35-boundary M=/home/roncsak/building/ath9/compat-wireless-3.1.1-1 modules     make[1]: Entering directory `/home/roncsak/building/linux/linux-3.0.35-boundary'       Building modules, stage 2.       MODPOST 9 modules     WARNING: "ewma_init" [/home/roncsak/building/ath9/compat-wireless-3.1.1-1/net/mac80211/mac80211.ko] undefined!     WARNING: "ewma_add" [/home/roncsak/building/ath9/compat-wireless-3.1.1-1/net/mac80211/mac80211.ko] undefined!     make[1]: Leaving directory `/home/roncsak/building/linux/linux-3.0.35-boundary'     make -C /home/roncsak/building/linux/linux-3.0.35-boundary M=/home/roncsak/building/ath9/compat-wireless-3.1.1-1 "INSTALL_MOD_DIR=updates" INSTALL_MOD_PATH=/home/roncsak/building/buildDir/targetfs/rfs/lib/modules/3.0.35/ \             modules_install     make[1]: Entering directory `/home/roncsak/building/linux/linux-3.0.35-boundary'       INSTALL /home/roncsak/building/ath9/compat-wireless-3.1.1-1/compat/compat.ko       INSTALL /home/roncsak/building/ath9/compat-wireless-3.1.1-1/drivers/net/wireless/ath/ath.ko       INSTALL /home/roncsak/building/ath9/compat-wireless-3.1.1-1/drivers/net/wireless/ath/ath9k/ath9k.ko       INSTALL /home/roncsak/building/ath9/compat-wireless-3.1.1-1/drivers/net/wireless/ath/ath9k/ath9k_common.ko       INSTALL /home/roncsak/building/ath9/compat-wireless-3.1.1-1/drivers/net/wireless/ath/ath9k/ath9k_htc.ko       INSTALL /home/roncsak/building/ath9/compat-wireless-3.1.1-1/drivers/net/wireless/ath/ath9k/ath9k_hw.ko       INSTALL /home/roncsak/building/ath9/compat-wireless-3.1.1-1/net/mac80211/mac80211.ko       INSTALL /home/roncsak/building/ath9/compat-wireless-3.1.1-1/net/rfkill/rfkill-regulator.ko       INSTALL /home/roncsak/building/ath9/compat-wireless-3.1.1-1/net/wireless/cfg80211.ko       DEPMOD  3.0.35     WARNING: /home/roncsak/building/buildDir/targetfs/rfs/lib/modules/3.0.35//lib/modules/3.0.35/updates/net/wireless/cfg80211.ko needs unknown symbol rfkill_unregister     WARNING: /home/roncsak/building/buildDir/targetfs/rfs/lib/modules/3.0.35//lib/modules/3.0.35/updates/net/wireless/cfg80211.ko needs unknown symbol rfkill_blocked     WARNING: /home/roncsak/building/buildDir/targetfs/rfs/lib/modules/3.0.35//lib/modules/3.0.35/updates/net/wireless/cfg80211.ko needs unknown symbol rfkill_destroy     WARNING: /home/roncsak/building/buildDir/targetfs/rfs/lib/modules/3.0.35//lib/modules/3.0.35/updates/net/wireless/cfg80211.ko needs unknown symbol rfkill_resume_polling     WARNING: /home/roncsak/building/buildDir/targetfs/rfs/lib/modules/3.0.35//lib/modules/3.0.35/updates/net/wireless/cfg80211.ko needs unknown symbol rfkill_pause_polling     WARNING: /home/roncsak/building/buildDir/targetfs/rfs/lib/modules/3.0.35//lib/modules/3.0.35/updates/net/wireless/cfg80211.ko needs unknown symbol rfkill_set_hw_state     WARNING: /home/roncsak/building/buildDir/targetfs/rfs/lib/modules/3.0.35//lib/modules/3.0.35/updates/net/wireless/cfg80211.ko needs unknown symbol rfkill_alloc     WARNING: /home/roncsak/building/buildDir/targetfs/rfs/lib/modules/3.0.35//lib/modules/3.0.35/updates/net/wireless/cfg80211.ko needs unknown symbol rfkill_register     WARNING: /home/roncsak/building/buildDir/targetfs/rfs/lib/modules/3.0.35//lib/modules/3.0.35/updates/net/wireless/cfg80211.ko needs unknown symbol rfkill_set_sw_state     WARNING: /home/roncsak/building/buildDir/targetfs/rfs/lib/modules/3.0.35//lib/modules/3.0.35/updates/net/mac80211/mac80211.ko needs unknown symbol ewma_add     WARNING: /home/roncsak/building/buildDir/targetfs/rfs/lib/modules/3.0.35//lib/modules/3.0.35/updates/net/mac80211/mac80211.ko needs unknown symbol ewma_init     WARNING: /home/roncsak/building/buildDir/targetfs/rfs/lib/modules/3.0.35//lib/modules/3.0.35/updates/net/rfkill/rfkill-regulator.ko needs unknown symbol rfkill_unregister     WARNING: /home/roncsak/building/buildDir/targetfs/rfs/lib/modules/3.0.35//lib/modules/3.0.35/updates/net/rfkill/rfkill-regulator.ko needs unknown symbol rfkill_destroy     WARNING: /home/roncsak/building/buildDir/targetfs/rfs/lib/modules/3.0.35//lib/modules/3.0.35/updates/net/rfkill/rfkill-regulator.ko needs unknown symbol rfkill_alloc     WARNING: /home/roncsak/building/buildDir/targetfs/rfs/lib/modules/3.0.35//lib/modules/3.0.35/updates/net/rfkill/rfkill-regulator.ko needs unknown symbol rfkill_register     make[1]: Leaving directory `/home/roncsak/building/linux/linux-3.0.35-boundary'     mkdir: cannot create directory `/usr/lib/compat-wireless/': Permission denied     make: *** [install-scripts] Error 1      How should I do that right?


title: What process is running before I even get a prompt?

text: When I log in to a specific server I see the following: ![before ctrl+c](http://i.stack.imgur.com/zWptw.png) Note that I get get `Last login: ...` information but no prompt. I hit `Ctrl+C` and only _then_ do I get my prompt, thus proving that my username and password are correct, as per the below screen shot. ![after ctrl+c](http://i.stack.imgur.com/Ix9Ah.png) I've been having this problem since this morning on a web server we have in the office. It's no coincidence that the disks in the machine have been replaced today but all that's happened is the old disk has been cloned and all the other users of the system aren't having this problem. Does anyone know what might be going on?


title: Why does my mouse stop working a short time into my session?

text: Running Easy Peasy 1.6 clean installation. Hardware - EEE PC 900-HA. About 10 or so minutes into a new session after a reboot my mouse will stop working. It will still move the pointer, but it will no longer register clicks correctly. The behavior is very strange. For instance I can be clicking in either a firefox window or on the tab bar. If I clear the cache it will allow me to switch. Often if there are multiple windows open clicking will only switch between the windows and will not register the click in either window. The behavior is incredibly erratic. I have tried a clean installation of Easy Peasy 1.6 and also attempted to reinstall input-attach. UPDATE: my clean installation ran through a bunch of updates last night and the mouse worked for a while, but still started to stop working after 30-60 minutes. I tried letting it sit after logging on and it still just worked for a few minutes and then stopped. Any ideas, thinking about switching flavors if I can't figure it out soon. Update 2: When it works:               KeymapNotify event, serial 31, synthetic NO, window 0x0,          keys:  11  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0                    0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0             ButtonPress event, serial 31, synthetic NO, window 0x3e00001,          root 0x10b, subw 0x0, time 55427, (263,134), root:(263,158),          state 0x0, button 1, same_screen YES          ButtonRelease event, serial 31, synthetic NO, window 0x3e00001,          root 0x10b, subw 0x0, time 55531, (263,134), root:(263,158),          state 0x100, button 1, same_screen YES      When it doesn't: ![no alt-tab](http://i.stack.imgur.com/AUvNe.png) Sorry for the image, but alt-tab seems to break too. Pretty sure the keypress event is when I clicked into the window, but I'm not sure of it. If that isn't enough I can try it again and try to get it to copy, can't seem to get the edit menu to open when it's acting up.


title: -bash: phpize: command not found on Centos 6

text: When I try to run `phpize` I get               -bash: phpize: command not found      I have run `yum -y install php-devel` but that returns:               Loaded plugins: fastestmirror     Loading mirror speeds from cached hostfile      * base: mirror.softaculous.com      * extras: centos.schlundtech.de      * rpmforge: mirror1.hs-esslingen.de      * updates: ftp.plusline.de     Setting up Install Process     No package php-devel available.     Error: Nothing to do      How can I fix this?


title: ifup eth0 timeout during boot

text: I need to start `eth0` network interface during boot, but only if cable is plugged in. I have following in my `/etc/network/interfaces`               auto lo     iface lo inet loopback          auto eth0     iface eth0 inet dhcp      The problem is, when the cable is not plugged in, the computer still tries to reach the `dhcp` server and it takes long time to time out and eventually boot. Is there some way to skip the `eth0` configuration if link is not detected? I am using Debian Wheezy


title: how can we use awk to get multiple words after a significant word?

text: I want to connect to my DB only once to do multiple `SELECT` queries as follows:               #!/bin/bash     #Begin Code     query=$(echo "SELECT COUNT(*) from USER_IPTable;           SELECT User from USER_IPTable;           SELECT IP_Address from USER_IPTable;" | mysql -u root --password='PASS' MatchingDB)      this will return something like that:               COUNT(*) 3 User user1 user2 user3 IP_Address 192.168.1.17 192.168.1.24 192.168.1.17      I have managed to get the COUNT by using awk as follows:               numberOfUsers=$(echo $query| awk ' { print $2 } ')      my question is how can I use `awk` to get every word after the word `User` according to the count and to get every word after the word `IP_Address` according to the count too?


title: Difference between Device file and device drivers

text: I am beginner in device driver programming. I don't get the difference between device drivers and device files in Linux. Can anyone explain the difference?


title: dumpcap: SIOCSIWMODE failed: Operation not permitted

text: When I try to capture in monitor mode in Wireshark after capturing a few packets I get the following error:               Unknown message from dumpcap, try to show it as a string: Can't restore interface wlp18s0 wireless mode (SIOCSIWMODE failed: Operation not permitted).     Please adjust manually.      ##                 > ls /usr/sbin/dumpcap -l     -rwxr-x---. 1 root wireshark 83632 Nov  7 18:34 /usr/sbin/dumpcap               > getcap /usr/sbin/dumpcap     /usr/sbin/dumpcap = cap_net_admin,cap_net_raw+eip      Even when I run wireshark with root user I get that error. Any suggestion?


title: Boot fails after reinstall GRUB

text: I unfortunately had to install Windows 8.1 in my computer and after doing so, I tried to reinstall GRUB following the next steps:   1. Booted with the Live CD   2. Mounted my system partition:              mount /dev/sda5 /mnt        3. Switched to the mounted partition with `arch-chroot`:              arch-chroot /mnt        4. Reinstalled GRUB:              grub-install --target=i386-pc --recheck /dev/sda     grub-mkconfig -o /boot/grub/grub.cfg      Ok, I got GRUB back, Windows is working normally, but when I try to boot Arch, I get a message like:               Welcome to emergency mode! After login in, type "journalctl -xb" to view system logs, "systemctl reboot" to reboot, "systemctl default" to try again to boot in default mode.      When I log in and type `journalctl -xb`, I get more than 2000 lines, but the only noticeable error is this:               systemd[456]: Failed at step EXEC spawning /bin/plymouth: No such file or directory     Subject: Process /bin/plymouth coud not be executed and failed     Defined by: systemd     [...]      In fact, there's no such file on `/bin` directory (`/bin/plymouth`).   I'm about to reformat, because I need this computer working. How and why does this happen?


title: Changing the current directory using a script (ksh)

text: I'm launching my script from echo $PWD ---> /x. I want my script to change my current directory. So my script contains +- this :               cd /y     exit 0      However, when my script ends, I'm stils in echo $PWD ---> /x. I'd like to be in /y. Why doesn't it work ? I'm launching my script simply by doing : [myScriptName]


title: Conky infobar alignment left and right

text: I want to build a simple infobar using conky. Take the following example: ![enter image description here](http://i.stack.imgur.com/AtE5V.png) `dropbox zotero` should be aligned to the left. `SSID: Hier Volume...` should be aligned to the right. Currently I am working with `{offset 800}` to move the second output to the right. However, this is very inflexible when the right output changes. Sometimes it exceeds my screen. `.conkyrc`:               background yes     use_xft yes     xftfont Noto Sans:size=10     xftalpha 1     update_interval 1     total_run_times 0     # Run in own window     own_window yes     own_window_transparent yes     own_window_type desktop     # Don't show in window lists and on all desktops     own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager     own_window_colour white     double_buffer yes     draw_shades no     draw_outline no     draw_borders no     draw_graph_borders no     default_color black     alignment tl     maximum_width 1280     minimum_size 1280     gap_x 0     gap_y 2     no_buffers yes     uppercase no     cpu_avg_samples 2     override_utf8_locale no          ##############################################     #  Output     ##############################################          TEXT       ${exec basename $(ps -efa | grep dropbox |grep -v 'grep ' | awk '{print $NF}')} \       ${exec basename $(ps -efa | grep zotero |grep -v 'grep ' | awk '{print $NF}')} \       ${offset 800} ${battery BAT0} \       SSID: ${wireless_essid wls1} \       Volume: ${exec amixer -c 0 get Master | grep Mono: | awk '{print $(NF-2)}'} ${exec amixer -c 0 get Master | grep Mono: | awk '{print $NF}'} \       Keyboard: ${exec setxkbmap -print | awk -F"+" '/xkb_symbols/ {print $2}'} \       ${time %H:%M} \       ${time %a %d %b %Y}


title: Since yesterday's Debian update, X11 does not appear to load my ~/.Xmodmap file, what would the most proper way of loading it be?

text: Due to lack of multimedia keys on the current keyboard, I bind F12 to play/pause, but that stopped working since yesterday, after to a large batch upgrade from the last month or so. So, what I am wondering is, what is the proper way to load it? Is there a line I could put in .Xdefaults, or will I have to create additional files? Doing "xmodmap ~/.Xmodmap" in the terminal appears to load everything properly, but the new keybindings do not work.


title: Order a list of files, by date modified, then unzip them in that order

text: I have a list of zip files, that must be extracted by date modified, they contain updated images and the strange way the local mls provides them means that newer zip files container newer versions of those images. How I can run a command to list the files, then unzip them in that order, oldest to newest? I can output the list correctly in `ls`, but cannot get it to work.               ls -tr photo20* | -exec unzip -o {} -d /home/tar/public_html/images/listing_photos/idx/ \;


title: linux fedora 20 how to read data from usb drive

text: I installed Linux Fedora 20 on a new computer, and kept the hard drive from the old computer as a second backup of my data. The drive has two partitions, Windows XP on one and Fedora 12 on the other. I have put the drive in a caddy with a USB connection. `ls /dev/usb` gives the line `hiddev0` (in yellow on a black background), which I presume is that drive, so, please, how do I access the data on it. I have searched the Internet for a solution, there are a lot of suggestions, but none of them works for me. Thanks @enedil, here is the output:               [Harry@localhost ~]$ sudo fdisk -l     [sudo] password for Harry:           Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors     Units: sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Disklabel type: dos     Disk identifier: 0xb4309008     Partition 1 does not start on physical sector boundary.          Device    Boot     Start       End    Blocks  Id System     /dev/sda1             63 209712509 104856223+  7 HPFS/NTFS/exFAT     /dev/sda2 *    209713152 210737151    512000  83 Linux     /dev/sda3      210737152 976773119 383017984  8e Linux LVM               Disk /dev/mapper/fedora-swap: 2.3 GiB, 2432696320 bytes, 4751360 sectors     Units: sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes          Disk /dev/mapper/fedora-root: 50 GiB, 53687091200 bytes, 104857600 sectors     Units: sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes          Disk /dev/mapper/fedora-home: 313 GiB, 336089579520 bytes, 656424960 sectors     Units: sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes          [Harry@localhost ~]$


title: linux if else fails for some IP's

text: i am using the following code with if then to mount. It works for some IP's, it does not work for some IP's especially for FAILURE statement. Here is the code               is_mounted() {         mount | grep -qohw "$1"     }               {     pass=     for ip in  123.456.789  223.456.789     do         if is_mounted "$ip"         then             echo -e " STACK MOUNT \e[1;33mALREADY\e[00m AVAILABLE \e[1;33mPASSED\e[00m "             pass=1             break         fi         mount -t nfs -o ro,nolock "$ip:/opt/media/" /mount/stack &>/dev/null         if is_mounted "$ip"         then             echo -e " STACK MOUNT AVAILABLE \e[1;33mPASSED\e[00m "             pass=1             break         fi     done     [ "$pass" ] || echo -e " STACK MOUNT NOT AVAILABLE          \e[00;31mFAILED\e[00m"     } | tee /tmp/log      These are the IP's which were failing 139.41.170.10, 197.21.82.10, 139.41.170.11, 197.21.82.11, 139.31.125.11. Ideally should work for any IP. Also I want to use all these IP's ' **for ip in 139.41.170.10 197.21.82.10 139.41.170.11 197.21.82.11 139.31.125.11** '. Any AWK suggestion.


title: Mainline kernel supported Raspberry Pi competitor? (no GPU needed)

text: The Raspberry Pi uses its own kernel fork. For a headless server (no GPU needed), is there a device with similar specs, performance-wise, that can use the vanilla mainline kernel from kernel.org?


title: Linux: Recover files from .vdi file

text: Somehow my `.vdi` (Linux guest OS) file got corrupted. Now I have some files in it (Inside the `vdi` file) and I want to recover those files. How can I do that?


title: Convert image with imagemagick command line convert tool

text: I have an image `Image.png`. How do I use the ImageMagick command `convert` to make this file into a `Image.jpg` file with the following requirements:   1. File size is 200~500 kb.   2. Resolution in not less than 450 dpi   3. Image size 35 x 45 mm _**Edit:_** These are the exact requirements for making some documents through electronic government. IT isn't a problem that the quality will deteriorate, because the image is needed just for the process of making the document (not for the document itself). I'm newbie in dealing with image files, so I'm not entirely clear in understanding what these requirements mean with respect to a file. I figured out how to get `.jpg` from `.png`:               $ convert Image.png Image.jpg      Also, I found out how to set some specific DPI:               $ convert -units PixelsPerInch Image.png -density 450 Image.jpg      However, I'm not sure about millimeters, and how it's determined in an image file.


title: adding list of users to multiple groups

text: I have a shell script which add list of users which is listed in another file lets say `users.txt`. After that, I want my script to add users to multiple existing groups with condition, one user may present in multiple groups. so how to achieve this ? For example, I have `a, b, c, d, e, f, g` users which will be added according to my script, and I have `p, q, r, s, t` groups. from this,user `a` could be present in multiple groups `p, r, t`, and user `b` could be present in groups `p, q`, and so on.. so how to achieve this ? I'm newbie to scripting language,so If this doesn't works out using shell script, how to achieve this using different language (python, perl) ?


title: Full path in glob in Zsh

text: Say I run the following on `/some/path`:               for x in foo/*; do     print $x     done      Are there any parameters I can use to tell Zsh to print, not just the filename, but the full absolute path to `$x`? (without explicitly hard-coding `/some/path` in the `print` statement.


title: Bash Function Decorator

text: In python we can decorate functions with code that is automatically applied and executed against functions. Is there any similar feature in bash? In the script I'm currently working on, I have some boilerplate that test the required arguments and exit if they don't exist - and display some messages if the the debugging flag is specified. Unfortunately I have to reinsert this code into every function and if I want to change it, I'll have to modify every function. Is there a way to remove this code from each function and have it applied to all functions, similar to decorators in python?


title: using ssh-agent

text: I have my desktop in the office. When `X` starts, `ssh-agent` starts automatically. I have to add my `SSH key` once, at the beginning, and then I can use `ssh` without having to enter my password each time. However, when I connect to my desktop via `SSH` (i.e. from home) the `ssh- agent` is not accessible and I have to provide my key every time. Also, even if I start a new instance of `ssh-agent`, I still cannot connect to it. Is there a way to use `ssh-agent` on a remote system (to which I am connected via `ssh`?


title: How to install Octave in Scientific Linux 6.5?

text: I am following the installation instruction for Scientific Linux on Ocatve website:               # wget http://url/to/latest/epel-release-6-7.noarch.rpm     # yum localinstall epel-release-6-7.noarch.rpm      Then I type               # sudo yum install octave-forge       It shows:                 No package octave-forge available.      How can I install Octave in Scientific Linux 6.5?


title: How to create MPTCP connection using eth0 with failover to ppp0?

text: My embedded Linux system has multiple network interfaces, eth0, wlan0 and ppp0. I'd like to experiment opening a socket to a server via eth0, then take down eth0 and watch it fail over to using ppp0. How do I do that?


title: How reliable is (or will be) btrfs send/receive?

text: We have at work a 15TB NFS file server using XFS, with a distant clone for backups using `rsync`, over a moderately slow connection (100Mb ethernet). We are now thinking about using btrfs instead of XFS and use send/receive to synchronize the data more efficiently. However fs corruption is probably unavoidable (we already experienced a 4-days fs repair operation with our XFS system), so the question is: Will a future corruption be transferred and happily applied to the remote machine, if we use send/receive?


title: software raid priority (systemtap)

text: I'd like to know on which priority software raid works (level 1 if it matters). So I wrote simple systemtap script to do the job, but I'm not sure if I have done it correctly.               [root@asus-ux21e ~]# cat raid.stp      probe module("raid1").function("*") {         printf( "name: %s | prio: %d | nice: %d\n", task_execname(task_current()), task_prio(task_current()), task_nice(task_current()));     }      Could anyone review it, and tell me on which priority software raid works?


title: Jitter while screen recording with avconv

text: I've figured out how to record decent quality with `avconv` now, the problem that remains which I also have experienced with `ffmpeg` and `recordmydesktop` is that my desktop background keeps flickering through. I've disabled the desktop effects in Linux Mint 16 Petra, running Cinnamon. This is how it looks:     ![Jitter](http://i.stack.imgur.com/kyPx6.png) How can I avoid this? Should I use another Desktop Environment like XFCE? The command I am using:               $ avconv -f alsa -ac 2 -i plughw:2,0 -f x11grab -s 1920x1080 \         -r 30 -i :0.0 -acodec libvorbis -ar 44100 -vcodec huffyuv grab.avi


title: Clang with Code::Blocks on Debian Wheezy [Stable]

text: In my pretty default Debian install:               devsys@zotac:~$ lsb_release -a     No LSB modules are available.     Distributor ID: Debian     Description:    Debian GNU/Linux 7.4 (wheezy)     Release:    7.4     Codename:   wheezy      I used `apt-get install clang` to do a default install of the Clang compiler.               devsys@zotac:~$ clang --version     Debian clang version 3.0-6.2 (tags/RELEASE_30/final) (based on LLVM 3.0)     Target: i386-pc-linux-gnu     Thread model: posix          devsys@zotac:~$ which clang     /usr/bin/clang      Then I do `apt-get install codeblocks` to do a default install of the Code::Blocks IDE.               devsys@zotac:~$ which codeblocks     /usr/bin/codeblocks      When starting up, and in its about box, Code::Blocks (CB) reports its version as `10.05` CB did not mention clang when it started up and there is nothing in the CB log about clang. In the _Compiler and Debugger Settings->Global Compiler Settings->Selected Compiler_ I have what looks like the standard CB compiler selections (and these are also the only ones I can see when I create a new project):   * GNU GCC Compiler    * Intel C/C++ Compiler    * SDCC Compiler Tiny C Compiler   * GDC D Compiler   * Digital Mars D Compiler    * GNU ARM GCC Compiler    * GNU AVR GCC Compiler    * GNU GCC Compiler for Power PC    * GNU GCC Compiler for TriCore Under _Compiler and Debugger Settings->Global Compiler Settings->Toolchain executables->Program Files->C Compiler_ , when I open up the file browser I can scroll up and see `clang` and `clang++` under `/usr/bin`. So theoretically I can create a profile for clang, but my understanding is that CB should be able to do this for me.So:   1. Is there a way to get Code::Blocks to pick up on my Clang install?   2. If there is no automatic way, what is the proper way to manually tell Code::Blocks about Clang?    3. How should I have done the installation?


title: Modern Linux desktop handbook?

text: Within the last month, I have encountered a number of problems involving xf86-video-modesetting (independent of the rest), upower, dbus and systemd (I still can't get OOM to log via systemd). Is there a modern handbook that describes these systems, how they are configured and how they interact and altogether, how a modern Linux desktop works? I am bewildered -- I have been using Linux for twenty years and I feel extremely lost. Every documentation, tutorial, troubleshooting blogpost or forum discussion is suspect to be outdated. Consider the following: Just for suspend, we went through, if I remember correctly, hal+pm-utils, ACPI+/sys/power/state (I do not know half of /sys for sure) and now, systemd+upower (at least I think it's upower that actually suspends). For changing the speed of an intel CPU, we had speedstep, acpi-cpufreq and now pstate. There's hwinfo and solid-hardware. I have no idea whether the two works from the same source and if not which one is better.


title: umount /home does not work

text: I trying to merge my separate /home partition with my / partition in linux mint 13. I was told to umount /home, mount it on a different location and copy the contents to the /home directory on the / partition. I have tried, but I cannot umount /home. When I try to do so, I get a message:               umount: /home device is busy (which processes use this device can be possibly be found with lsof or fuser)      How can I unmount my /home and mount it on a separate location (/dev/sda2/mnt/home) to be able to copy the contents to /home?


title: su authentication failure, sudo missing

text: After removing the `vim-minimal` package, because it was conflicting with the GUI Vim I was trying to install, `sudo` has disappeared, and `su` is giving an authentication failure.               [portOdin@localhost ~]$ su     Password:      su: Authentication failure          [portOdin@localhost ~]$ sudo     bash: sudo: command not found...      I tried with zsh as well, and also created a new user, though had the same problems. If I could get `su` working, or if there is some alternative, I could reinstall with `sudo yum install sudo`. I'm using Fedora 20.


title: About escape with SSH pipe

text: I want to execute the awk command with long parameters,like this:               ssh host "netstat -rn|awk 'NR!=1 && NF>=6 && $1!="Destination" {printf "%-15s %-20s\n", $1, $2}'|sort -f "      but there are some errors: > syntax error The source line is 1. The error context is NR!=1 && NF>=6 && > >>> != <<< awk: Quitting The source line is 1. So,how can I fix it?


title: Cronjob to run script every 3 weeks on Wednesday

text: Is it possible to schedule a cron job that would run every three weeks on Wednesday (8AM) only? Or, if that is not possible, to run a job every 27 days or less but on Wednesday at 8AM.


title: How can I delete a file on client?

text: After copying files from `/home/foo/bar` the original files on the client must be deleted, EXCEPT for file `/home/foo/bar/special_file`. This file must remain on the client. I want to delete all the files in a directory, keeping only a specific folder safe. How can I do that? I can use `wipe -rcfs *` but it will wipe everything in the folder that is not desired.


title: How to edit /etc/hosts without sudo?

text: I have a machine that I can only access using SSH. I was messing with the hostnames, and now it says:               ssh: unable to resolve hostname      I know how to fix it in `/etc/hosts`. Problem is, I need `sudo` to fix them because my normal account doesn't have permissions. What's the best way to fix the hosts?


title: usermod -L after creating the home dir

text: so I see from some questions here, to lock an account, create it, then lock, e.g.               useradd -M lol;usermod -L lol      However.. I do have a home dir, by eg. `useradd -md /path/lol` Question is.. to avoid it being a login account, is now `usermod -L` ok? I need to use the account with files in it with `sudo -u lol` whatever... but do not wish lol to have a login state of true.


title: git archive including uncommitted modified files

text: so `git archive --format=tar HEAD` will give me a tar archive of the latest commit on the current branch. Is there a version that would include local modifications to tracked files that have not yet been committed?


title: unnecessary accounts in linux

text: It is recommended in hardening that unnecessary accounts be removed.   * Do these accounts include process and daemon accounts?   * What security problems exist with unnecessary user accounts?   * Can attackers damage systems with compromised unnecessary accounts?


title: How to see tar content including uid and gid?

text: I have a tar archive and want to see the content with the group-ids and user- ids. When using               tar --list -v --file file.tar      I see the user and group names, but I want to see the user-ids and group-ids instead. How can I achieve this? Or are the users itself stored in a tar archive, and not the ID?s?


title: Apache2 won't start in Arch Linux

text: I have seen many threads about this problem but the problem doesn't solved. I'm trying to start `httpd.service` by this command :               $ sudo systemctl start httpd.service      Error :               Job for httpd.service failed. See 'systemctl status httpd.service' and 'journalctl -xn' for details.      **P.S :**               $ journalctl -xn      The output of above command is :               -- Logs begin at Sat 2014-03-29 22:42:48 IRDT, end at Sat 2014-05-10 23:58:05 IRDT. --     May 10 23:55:51 localhost systemd[1]: Unit httpd.service entered failed state.     May 10 23:55:51 localhost sudo[18583]: pam_unix(sudo:session): session closed for user root     May 10 23:58:05 localhost sudo[19575]: kamix : TTY=pts/1 ; PWD=/home/kamix ; USER=root ; COM     May 10 23:58:05 localhost sudo[19575]: pam_unix(sudo:session): session opened for user root      May 10 23:58:05 localhost systemd[1]: Starting Apache Web Server...     -- Subject: Unit httpd.service has begun with start-up     -- Defined-By: systemd     -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel     --      -- Unit httpd.service has begun starting up.     May 10 23:58:05 localhost apachectl[19578]: httpd: Syntax error on line 59 of /etc/httpd/con     May 10 23:58:05 localhost sudo[19575]: pam_unix(sudo:session): session closed for user root     May 10 23:58:05 localhost systemd[1]: httpd.service: control process exited, code=exited sta     May 10 23:58:05 localhost systemd[1]: Failed to start Apache Web Server.     -- Subject: Unit httpd.service has failed     -- Defined-By: systemd     -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel     --      -- Unit httpd.service has failed.     --      -- The result is failed.


title: Grep : Find all possible cases of a word in text file

text: I have a directory with many text files. Out of these files, I am interested in a word "abcdefghi". I need to list all possible cases of this word such as   * abcdefghi   * abcdefghI    * abcDefghi   * ABCDEFGHI and all other possible combinations. It is possible with `grep` or `egrep`? I know, I can write a shell script with combos of grep and inverse grep, unique and achieve the outputs, but I am looking for portable solution.


title: How can I use a back-reference in place of a filename in sed?

text: I am trying to use `sed` to scan through a file and find a pattern, then use part of the matched pattern as a filename and insert the contents of the file at that location. I can get most of it to work, but I can't seem to figure out how to use a back-reference in place of the filename. The short version is that a need to pre-process a latex file and get rid of all the top level `\input` commands becauase `lilypond-book` is Stupid™.               # Setup files for example     $ echo "foo\n\\input{file2}\nfoo" > file1     $ echo "bar\nbar" > file2          # Use sed to find and replace latex \input commands     $ sed $'/^\\\\input{\\(.*\\)}$/ {r file2\n d}' file1     foo     bar     bar     foo      So far so good, but that has a hard coded file name and I need to use the result of the group match above (the part between the `{` and `}` delimiters) as the file name. Unfortunately this does not work:               $ sed $'/^\\\\input{\\(.*\\)}$/ {r \\1\n d}' file1     foo     foo      How can I use the matched pattern as the file name in a scenario like this?


title: GNU/Linux swapping blocks system

text: I have used GNU/Linux on systems from 4 MB RAM to 512 GB RAM. When they start swapping, most of the time you can still log in and kill off the offending process - you just have to be 100-1000 times more patient. On my new 32 GB system that has changed: It blocks when it starts swapping. Sometimes with full disk activity but other times with no disk activity. To examine what might be the issue I have written this program. The idea is:               1 grab 3% of the memory free right now     2 if that caused swap to increase: stop     3 keep the chunk used for 30 seconds by forking off     4 goto 1      -               #!/usr/bin/perl          sub freekb {         my $free = `free|grep buffers/cache`;         my @a=split / +/,$free;         return $a[3];     }          sub swapkb {         my $swap = `free|grep Swap:`;         my @a=split / +/,$swap;         return $a[2];     }               my $swap = swapkb();     my $lastswap = $swap;     my $free;     while($lastswap >= $swap) {         print "$swap $free";         $lastswap = $swap;         $swap = swapkb();         $free = freekb();         my $used_mem = "x"x(1024 * $free * 0.03);         if(not fork()) {         sleep 30;         exit();         }     }     print "Swap increased $swap $lastswap\n";      Running the program forever ought to keep the system at the limit of swapping, but only grabbing a minimal amount of swap and do that very slowly (i.e. a few MB at a time at most). If I run:               forever free | stdbuf -o0 timestamp > freelog      I ought to see swap slowly rising every second. (forever and timestamp from https://github.com/ole-tange/tangetools). But that is not the behaviour I see: I see swap increasing in jumps and that the system is completely blocked during these jumps. Here the system is blocked for 30 seconds with the swap usage increases with 1 GB:               secs     169.527 Swap:     18440184     154184   18286000     170.531 Swap:     18440184     154184   18286000     200.630 Swap:     18440184    1134240   17305944     210.259 Swap:     18440184    1076228   17363956      Blocked: 21 secs. Swap increase 2400 MB:               307.773 Swap:     18440184     581324   17858860     308.799 Swap:     18440184     597676   17842508     330.103 Swap:     18440184    2503020   15937164     331.106 Swap:     18440184    2502936   15937248      Blocked: 20 secs. Swap increase 2200 MB:               751.283 Swap:     18440184     885288   17554896     752.286 Swap:     18440184     911676   17528508     772.331 Swap:     18440184    3193532   15246652     773.333 Swap:     18440184    1404540   17035644      Blocked: 37 secs. Swap increase 2400 MB:               904.068 Swap:     18440184     613108   17827076     905.072 Swap:     18440184     610368   17829816     942.424 Swap:     18440184    3014668   15425516     942.610 Swap:     18440184    2073580   16366604      This is bad enough, but what is even worse is that the system sometimes stops responding at all - even if I wait for hours. I have the feeling it is related to the swapping issue, but I cannot tell for sure. My first idea was to tweak /proc/sys/vm/swappiness from 60 to 0 or 100, just to see if that had any effect at all. 0 did not have an effect, but 100 did cause the problem to arise less often. How can I prevent the system from blocking for such a long time? Why does it decide to swapout 1-3 GB when less than 10 MB would suffice? System info:               $ uname -a     Linux aspire 3.8.0-32-generic #47-Ubuntu SMP Tue Oct 1 22:35:23 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux      Edit: I tested if the problem is due to 32 GB RAM by removing 24 GB and trying with only 8 GB - I see the same behaviour. I can also reproduce the swapping behaviour (though not the freezing) by installing GNU/Linux Mint 15 in VirtualBox. I cannot reproduce the problem on my 8 GB laptop: The script above runs beautifully for hours and hours - swapping out a few megabytes, but never a full gigabyte. So I compared all the variables in /proc/sys/vm/* on both systems: They are exactly the same. This leads me to believe the problem is elsewhere. The laptop runs a different kernel:               Linux hk 3.2.0-55-generic #85-Ubuntu SMP Wed Oct 2 12:29:27 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux      Maybe something in the VM system changed from 3.2.0 to 3.8.0?


title: Converting DHCP to static on ubuntu 12.0.4

text: I am trying to set up a static IP address for my new Ubuntu server. I have been trying to do some research and found information that got me started on this reference page. One thing that was different for me. When I use the GUI to set up an internet connection. I select eth2 then I was connected to the internet using a DHCP IP. When I converted the IP now I no longer have access to the internet unless I use the connection established by the GUI. Here is what I have done   `sudo nano /etc/network/interfaces` I changed the existing info to               iface eth2 inet static     address <static ip>     netmask <mask>     gateway <gateway IP>      then I edited this file   `sudo vi /etc/resolv.conf` I added both of my DNS Server ips then after saving the file I have done   `sudo /etc/init.d/networking restart` I get the following error RTNETLINK answer: File Exists Field to bring up eth2 I have tried to change the Ethernet card number to eth1 and then to eth0 but still getting the same error. What can I do to correct this problem?


title: untar specific directory

text: tar tvf filename.tar gives me:                   -rwxrwxrwx 0/0          544795 2010-03-15 12:49 35 WOO WORDPRESS THEMES/bloggingstream.zip         -rwxrwxrwx 0/0         1659095 2010-03-15 12:51 35 WOO WORDPRESS THEMES/groovyblog.zip         -rwxrwxrwx 0/0          835642 2010-03-15 12:51 35 WOO WORDPRESS THEMES/myweblog.zip      Now if I try to extract only one specified file from `.tar` archive, like so:                   tar x "WOO WORDPRESS THEMES/bloggingstream.zip" -f filename.tar      I get the following error:               tar: WOO WORDPRESS THEMES/bloggingstream.zip: Not found in archive     tar: Exiting with failure status due to previous errors      How is that possible, when that path exists?


title: How do I enable kernel option MMC_UNSAFE_RESUME

text: I am trying sleep and wake up my Kobo Mini ebook reader manually by using the command `rtcwake`. The reader is using **busybox**.   `cat /proc/version` gives me this output:   `Linux version 2.6.35.3-850-gbc67621+ (gallen@gallen-P5KPL-AM-BM) (gcc version 4.4.4 (4.4.4_09.06.2010) ) #617 PREEMPT Mon Apr 22 11:07:47 CST 2013` rtcwake sets the reader to sleep but fails with this message:   `wakeup from "mem" at Wed Nov 13 18:02:44 2013   rtcwake: short write`   ...and does **not** wake up again. After some googling I tracked the error down to the removable micro sd card which the reader uses as its primary (and only) storage. Which means that the whole system is running on that sd card which is being removed on standby.   I also found another user with the same problem on a completely different device but also with a removable sd card as the primary storage. He solved the problem by enabling the kernel option/parameter `MMC_UNSAFE_RESUME`. Now my question: How do I set/enable/activate this parameter? Do I have to recompile the kernel? My problem is that I am a complete noob on this topic and Google ony finds source codes and discussions about source codes.


title: vixie-cron.x86_64 doesn't seem to execute jobs on crontab

text: I have installed crontab on CentOS 5.6 x64 via `yum install vixie-cron.x86_64` Here is my crontab -e               SHELL=/bin/sh     0       0       *       *       *       cat /root/mysql-backup.txt | xargs /root/mysql-cron.sh      Whenever I run this command manually it executes without problems: `cat /root/mysql-backup.txt | xargs /root/mysql-cron.sh` I am just wondering why my cron is not running. It's suppose to run every midnight to backup my mysql database. Are there any other particular steps to configure cron with crontab?


title: ssh with identical machines

text: I have two identical beaglebones that I'm working with. They have the same hostname and originally had the same IP, though I changed one to see if that made a difference. They're going to be deployed to 2 different networks. My problem is I lost the ability to ssh into both of them. The password has not been changed and I can log in from my wife's computer, but on mine I get:               Permission denied, please try again.      finally followed by               Permission denied (publickey,password).      This wasn't a problem until I set up static IPs on them. What have I done/what can I do to fix it? I'm running Ubuntu on both the beaglebones and my computer.


title: Bash autocomplete gives different file name than ls

text: An incredibly strange thing just happened. Through a serious typo, I entered               cp filename.xsl .^?~      Yeah, that's right, dot-caret-questionmark-tilde! Truth is stranger than fiction. It gets weirder. When I type               cat .      and then hit `TAB`, I get               ./    ../    .^?~      but when I do an `ls -a`, I get               .    ..    .?~      Finally, when I do               rm .?~      the remove command prompts me thus:               rm: remove write-protected regular file `.\177~'?      before successfully removing it. Why the descrepency of the existence of the caret?


title: Automate creation of an at job using expect

text: I am trying to write a script that will take time and process-name and pass them to at to schedule the job. I cannot send the EOT.                   #! /usr/bin/expect         # Usage: setupkill.exp time process.         # press ctrl-D to finish the at command.              set time [lindex $argv 0]         set process [lindex $argv 1]              spawn at $time         expect "at>"         send "/home/jagan/p/killprocess $process\r";         expect "at>"         send "^D";              interact      This script aims to kill a specific process at a given time.


title: Is this a bug? (Collate + duplex printing = unexpected behaviour)

text: Given the following facts:   * We have a document that consists of multiple pages   * We print multiple copies of it   * We print duplex (double-sided)   * We enable the option `collate` Under several Linux distro's I get the following result: First a stack of pages with page 1 on _both_ sides. Then a stack with page 2 on _both_ sides, &c. I can not think of any situation in which this would be the desired behaviour. I would however like to see a stack of (page 1 + 2), and then a stack of (page 3 + 4), &c. ### My questions:   * Do you recognize this behaviour?   * Do you also think this is a bug?   * If so, where should this be fixed? I realize that this a bit open and vague, but all the people that I have spoken lately (IRL @ the university printer, and such) think this is strange behaviour. At first I decided to avoid `collate`, but lately I got so agitated that I wanted to attack this problem. However, I would first like to hear some of your opinions/answers.


title: How Do I use autofs to map a USB drive by its ID?

text: ## Goal   * I have a USB drive -- let's say the drive's ID is _/dev/disk/by-id/thediskid_   * I would like to mount the drive -- by ID -- to a folder (let's call it /MOUNT_FOLDER) ## Question   * What is the best way to do this using autofs? ## Current Attempt **/etc/auto.master:**               +auto.master     /localam auto.linux     /[another mount]  [auto.othermount] --timeout=5 -- ghost     /MOUNT_FOLDER auto.ext-usb --timeout=5     / -      **/etc/auto.ext-usb:**               /MOUNT_FOLDER /dev/disk/by-id/thediskid      I know I'm missing something but I can't seem to get a good lead on what the proper syntax is. New to Linux; appreciate a pass if I'm overlooking something simple. Thanks!


title: sed behaves different on FreeBSD and on Linux?

text: I use both Linux and FreeBSD (specifically, I use Debian Linux and PC-BSD), and I found something weird about `sed`. I frequently need to convert "tab separated values" files to "comma separated values". The simplest way I know is to use `sed`, like this:               sed 's/\t/,/g' inputFile.txt > outputFile.csv      This works perfectly on Linux: It replaces every tab with a comma... but on FreeBSD, it doesn't replace anything!!! Am I missing something? Is there a syntax with FreeBSD `sed` that is different to the one on Linux?


title: Usage of inb, inl, inw to access kernel space from user space

text: What are some user space examples of using `inb`, `inl`, and `inw` to access kernel space in Linux?


title: Track [sh] <defunct> for debug purposes?

text: I have a big application (in C++), which generates from time to time defunct process. I know the application intensively uses linux commands inside. I would need to know which linux commands were called by those defunct sh process, is it possible to find out? Or, is it possible to set up Linux and get a sort of log when my application calls Linux commands? Thanks.   Luke


title: ssh problems only when connecting from remote IP

text: When I try to connect from a remote computer that is not in the local network via ssh I get into trouble... When I try to execute a TUI application it hangs and I cant do anything... I type `./menu` and then nothing happens. However this program runs with no problem when connecting with ssh with a local IP (another computer in the local network). But this 100% same program is installed also on another computer. When connecting via ssh to the other computer with a remote IP I get no problem! **SOLUTION**   I increased the MTU value of my router


title: When do you use brace expansion?

text: I understand what brace expansion is, but I don't know how best to use it. When do you use it?   Please teach me some convenient and remarkable examples if you have your own tip.


title: How do I set up a BitTornado tracker?

text: As the title suggests I would like to setup a BitTornado tracker for a local network. At the moment I am using OpenBitTorrent as my tracker but this seems strange as I don't want to do this over the net and I'm not sure how secure or legal it is. The "server" is running Bodhi Linux. I found a how-to on TuxCoder using this command to start the tracker               bttrack --port 6969 --dfile ~/.bttrack/dstate --logfile ~/.bttrack/tracker.log --nat_check 0 --scrape_allowed full      However I get back a deprecation warning:               /usr/lib/pymodules/python2.6/BitTornado/__init__.py:8: DeprecationWarning: the sha module is deprecated; use the hashlib module instead       from sha import sha     **warning** could not redirect stdout to log file:  <type 'exceptions.IOError'>      It may be that there is a better tracker out there. I'm not an expert, which is why I'm asking this question.


title: SVN changelist all my checkouts

text: Lets say I have 100+ files that I've checked out. Is there a way I can add all of them to a changelist without specifying them one by one, or adding them to file?