Why is ping so slow?

My setup: Server in the cellar + GBit switch. Long cable to the roof. GBit switch. I have three computers in the roof. One has only 100MBit ethernet, one laptop with GBit and a new computer. Ping times from the old 100MBit computer: 0.5ms on average Ping times from laptop: 0.4ms on average Ping times from my new computer: 5ms or 30ms or 200ms on average but I often see ping times up to 980ms. In general, the throughput is very unstable. I replaced the switch in the roof. No change. I replace the cable which connects the new computer to the roof switch. No change. I installed a PCI network card with an Intel GBit chip (82541PI) and used that instead of the built in Realtek RTL8111/8168B. No change. Yes, I'm sure that I plugged the cable into the correct port because I now get a different IP address from my DHCP server. The very same network card worked perfectly find on my old computer using the same operating system (openSUSE 12.1). `ifconfig` says:                     UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:15679 errors:0 dropped:0 overruns:0 frame:0           TX packets:13077 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 Sendewarteschlangenlänge:1000       `ethtool` says:                   Speed: 1000Mb/s         Duplex: Full         Port: Twisted Pair      What could be causing this behavior? **[EDIT]** I found something interesting:               # cat /proc/interrupts                 CPU0       CPU1       CPU2       CPU3       CPU4       CPU5       CPU6       CPU7              0:        178          0          0          0          0          0          0          0  IR-IO-APIC-edge      timer       1:          6          0          0          0          0          0          0          0  IR-IO-APIC-edge      i8042       8:          1          0          0          0          0          0          0          0  IR-IO-APIC-edge      rtc0       9:          0          0          0          0          0          0          0          0  IR-IO-APIC-fasteoi   acpi      12:         10          0          0          0          0          0          0          0  IR-IO-APIC-edge      i8042      16:    3302428          0          0          0          0          0          0          0  IR-IO-APIC-fasteoi   ehci_hcd:usb1, nvidia, mei, eth1      17:        184          0          0          0          0          0          0          0  IR-IO-APIC-fasteoi   snd_hda_intel      23:      16721          0          0          0          0          0          0          0  IR-IO-APIC-fasteoi   ehci_hcd:usb2      As you can see, interrupt 16 serves one USB port, the graphics card, "mei" (?) and `eth1`. I guess that would explain why it's slow. How do I assign interrupts in 2012?


How to iterate through a comma-separated list and execute a command for each entry

I have been give a command which outputs a comma-separated list for autosys jobs in the variable `$all_jobs`:               box=box-of-jobs;all_jobs=$(jobscout -box $box | egrep "^\w+" | tr '\n' ','  | sed s/.$//);       I want to call a sendevent command for each item in the list:               sendevent -verbose -S NYT -E JOB_OFF_HOLD -J $job --owner me      So for example if `$all_jobs` evaluated job1,job2,job3 I want to call               sendevent -verbose -S NYT -E JOB_OFF_HOLD -J job3 --owner me     sendevent -verbose -S NYT -E JOB_OFF_HOLD -J job2 --owner me     sendevent -verbose -S NYT -E JOB_OFF_HOLD -J job1 --owner me      I'm sure I could write a ksh script to loop through, but I know these things can often be written much faster using awk/sed, both of which I'm not very familiar with so it's beyond my megre skills. I'm using ksh (rather than bsh).


executing multiple greps in a single find command

I want to use find command to find some files containing multiple patterns at the same time. I tried something like this:               find . -name "*.xml" -exec grep -iH keyword1 + && grep -iH "keyword2" {} \;      But the above command doesn't work. Is it possible to do it in bash?


Configuration management, shared files, etc with a Laptop

I have a couple computers sitting around in my home network. They all run the same version of Ubuntu, and I would like to unify their configuration to some extent. At my university, you can log in to any computer with your university account and have all your data right there. I assume they use central authentication and have `/home` mounted over the network. That is what I would like to have to some extent. The problem is that the computers I and my girlfriend use the most are laptops that are taken out of the house regularly. So logging in over the network only is not really an option. Having no files locally is not an option either. I would like to use the computers that I have for a HTCondor cluster, but most jobs will end up on my laptop since it is the fastest machine. I assume that it is a problem if it is not connected to the network occasionally. Is it possible to have   * the same user accounts (and passwords, if that makes sense)   * some common files (maybe `/common/$USER`)   * common set of installed packages   * giving computing power to the HTCondor pool on all machines without coupling them so tightly that they do not function outside the network? I have heard the buzzwords keberos, nfs, sshfs, btsync, chef, puppet, nagios, ldap, but I am not sure whether the core idea makes sense in the first place, i. e. whether it would actually save work instead of creating even more.


What does the "interruptible sleep" state indicate?

I had Firefox running on a Parted Magic LiveCD, then (possibly) as a result of a key combination I don't recall, it quickly vanished from screen and Task Bar/Window List. However:   1. `ps ax | grep firefox` returns the below (and the unneeded `grep firefox` line). Both `ps` and the GUI Task Manager, show firefox with seemingly unchanging RSS, VM-SIZE and 0% CPU usage.              johndoe      1916 36.6 14.0 923772 504372 tty1    Sl   13:30  12:15 firefox      2. `pstree | grep firefox` returns:              init─┬─2*[ROX-Filer───firefox───25*[{firefox}]]      3. `strace -p 1916` returns, and seemingly stays on this line forever: `futex(0xac975608), FUTEX_WAIT_PRIVATE, 1, NULL` I understand from an answer to What do the STAT column values in ps mean? that `S` (in `Sl`) indicates that the process is in an `interruptible sleep` state. Can anyone elaborate as to what the state is, in more detail? **EDIT** I will start a new question, with more specifics on my distro, to address the original 2nd question.


Unable to transfer files via SFTP when using a normal user account

I'm unable to transfer files via `WINSCP>sftp` to a GNU/Linux server. When transferring a file using root account, there's no problem. However, when I transfer using another account, the file being transferred shows 0 bytes and nothing happens when opening it. The folder I transfer files is `/home/avex` and the account I'm using to transfer is _avex_. I've verified that the folder has read and write permission and the owner of `avex` folder is _avex_ user. What would be the cause for such output here? and How do I transfer the file under _avex_ user ?


Several groups can have the same groupID?

0:root@SERVER:/root # grep 300 /etc/group     ipsec:!:300:admgrp     0:root@SERVER:/root #       ?? Several groups (ipsec/admgrp) can have the same groupID (300)?? how can this be? /AIX 6.1/


KMail extremely slow/frozen when operating on local maildir folder

KMail seemingly freezes when trying to open a message or executing any command on the local email folders (maildir) such as moving or marking of messages. Sometimes the triggered action is executed with very long delay or when restarting akonadiserver. Furthermore, Akonadi and the attached MySQL server are busy (but not fully occupied). For me, the problem probably came up after switching from MySQL to MariaDB on Arch Linux or after an update from KDE 4.11.1 to 4.11.2. The special issue here is that there is no specific error message or warning in Akonadi or KMail related to the source of the problem. Moreover, neither re-initializing all Akonadi databases nor re-installing or even downgrading kdepim packages solves the problem.


Why do I get this message whenever I open a terminal?

I keep getting this strange message when I open a terminal:               me@batcuter:~$      Message from syslogd@batcuter at Apr 21 14:10:38 ...       such IMContext          Message from syslogd@batcuter at Apr 21 14:10:38 ...       such IMContext          Message from syslogd@batcuter at Apr 21 14:10:43 ...       invalid char is given at scim_bridge_string_to_uint (): -          Message from syslogd@batcuter at Apr 21 14:10:43 ...      valid message: Close the connection.      I have no idea what's happening...   1. Where can I read these logs?   2. Should I be afraid of a malicious cyberattack?


vi: how to use a line as a command?

cat a.txt     echo hi     echo hu     echo ha      **Q:** how can I execute ex.: the second line in a.txt when it is opened with vi? so "vi a.txt" -> then SOMEMAGICCOMMAND -> then the "echo hu" is executed as a command. How?


Cron log on debian systems

On Redhat systems cron logs into `/var/log/cron` file. What is the equivalent of that file on Debian systems?


How can I improve nscd's cache hit rate?

**My Goal:** Let nscd maintain a fairly large DNS cache in excess memory since I have it available. **Description:** I have a webserver that has a broadly dispersed but high-repeat user base. It has plenty of memory so I thought I'd improve response time by caching lookups but according to `nscd -g` I'm only at a 6% cache hit rate (meaning `nscd` is most likely introducing more latency saving to the cache or looking through the cache for an entry it will never find, than it's preventing by going out to the network):               hosts cache:                      yes  cache is enabled                 yes  cache is persistent                 yes  cache is shared                 211  suggested size              216064  total data pool size                2328  used data pool size               36000  seconds time to live for positive entries                  20  seconds time to live for negative entries                4455  cache hits on positive entries                   0  cache hits on negative entries               17357  cache misses on positive entries               42348  cache misses on negative entries                   6% cache hit rate                  17  current number of cached values                  40  maximum number of cached values                   3  maximum chain length searched                   0  number of delays on rdlock                   0  number of delays on wrlock                   0  memory allocations failed                 yes  check /etc/hosts for changes      Probably a large contributor to the 6% hit rate is the fact that apparently it's only cached 17 entries. Doing a `strings /var/db/nscd/hosts` shows that the host cache entries it has created are mostly for machines on our internal network. It's good to have these cached since the daily re-publish of the website is likely sped up but my goal is to speed up end user experience without making any real configuration changes. This is the relevant segment of `nscd.conf`:                   threads                 10         server-user             nscd         debug-level             0         paranoia                no         [.....snip......]         enable-cache            hosts           yes         positive-time-to-live   hosts           36000         negative-time-to-live   hosts           20         suggested-size          hosts           10657         check-files             hosts           yes         persistent              hosts           yes         shared                  hosts           yes         max-db-size             hosts           33554432      Basically, I need help understanding how my host cache can be so small even though I've set the positive TTL's on the host cache to be incredibly high. I'm sure it's the small number of actual cached entries that is causing the hit rate to be so low. I'm assuming since the hit rate is 6% but my positive TTL is fairly large, that means my current workload _is_ performing DNS host lookups, but they're just not being save. I have no idea why these aren't being saved nor what to check next. What I had expected would be a fairly large DNS cache now. Even if the hit rate stayed small (i.e: clients weren't repeating as often as I thought) I'd still expect _those_ DNS lookups to be cached but looking at the "current number of cached values" that doesn't appear to be happening either.


Perform Cisco's DNS Doctoring on FreeBSD

How to perform a change in the DNS response from a DNS server to be a different IP address than the DNS server actually answered for a given name? http://www.cisco.com/en/US/products/hw/vpndevc/ps2030/products_tech_note09186a0080094aee.shtml Currently using PF (Packet Filter) on FreeBSD 9.0-RELEASE. Please help.


How to disable auto suspend when I close laptop lid?

I'm using archlinux. It never auto-suspend before a recent system upgrade(maybe I updated the kernel?). I think it is related to `laptop-mode` or `acpid`, so I stop them:               /etc/rc.d/laptop-mode stop     /etc/rc.d/acpid stop      I also edit `/etc/laptop-mode/laptop-mode.conf`:               ENABLE_LAPTOP_MODE_TOOLS=0      Then I edit `/etc/acpi/actions/lm_lid.sh`, commented out the last line:               # /usr/sbin/laptop_mode auto      But all of above don't work. Following lines were found in `/var/log/kernel.log`(unrelated lines omitted):               Oct 23 15:29:20 localhost kernel: [18617.549098] PM: Syncing filesystems ... done.     Oct 23 15:29:20 localhost kernel: [18618.001898] PM: Preparing system for mem sleep     Oct 23 15:29:30 localhost kernel: [18618.039565] Freezing user space processes ... (elapsed 0.01 seconds) done.     Oct 23 15:29:30 localhost kernel: [18618.052596] Freezing remaining freezable tasks ... (elapsed 0.01 seconds) done.     Oct 23 15:29:30 localhost kernel: [18618.065999] PM: Entering mem sleep     Oct 23 15:29:30 localhost kernel: [18618.066167] Suspending console(s) (use no_console_suspend to debug)     Oct 23 15:29:30 localhost kernel: [18618.097917] sd 0:0:0:0: [sda] Synchronizing SCSI cache     Oct 23 15:29:30 localhost kernel: [18618.098103] sd 0:0:0:0: [sda] Stopping disk     Oct 23 15:29:30 localhost kernel: [18618.270537] snd_hda_intel 0000:00:14.2: power state changed by ACPI to D3hot     Oct 23 15:29:30 localhost kernel: [18619.274374] PM: suspend of devices complete after 1196.192 msecs     Oct 23 15:29:30 localhost kernel: [18619.274691] PM: late suspend of devices complete after 0.313 msecs     Oct 23 15:29:30 localhost kernel: [18619.440877] ohci_hcd 0000:00:14.5: wake-up capability enabled by ACPI     Oct 23 15:29:30 localhost kernel: [18619.642144] ACPI: Waking up from system sleep state S3     Oct 23 15:29:30 localhost kernel: [18620.049424] PM: noirq resume of devices complete after 333.503 msecs     Oct 23 15:29:30 localhost kernel: [18620.049852] PM: early resume of devices complete after 0.334 msecs     Oct 23 15:29:30 localhost kernel: [18622.418605] PM: resume of devices complete after 2371.906 msecs     Oct 23 15:29:30 localhost kernel: [18622.419018] PM: Finishing wakeup.     Oct 23 15:29:30 localhost kernel: [18622.419019] Restarting tasks ... done.     Oct 23 15:29:30 localhost kernel: [18622.464752] video LNXVIDEO:01: Restoring backlight state      I think this is not caused by `pm-susend`, because `/var/log/pm-suspend.log` don't log anything. I don't want my laptop go to sleep when I close the lid. How to do it? Kernel version: 3.6.2-1-ARCH


Backup & restore from Linux to Windows while Linux is running

I have a lab with some Linux machines, some are Red Hat 5.1 machines installed on HPDL580 HW, and some are Linux installed on BLADE IBM machines. Also I have laptop computer with Windows XP. My question: I want to backup the Linux machine as an image on my Win laptop, and then I need to restore the image to another HW, while the Linux machine I am restoring from must be up during backup process (I mean I can't shutdown the Linux machine). Please advice which free tool/application I can run on my Win XP laptop in order to backup the Linux machine and then restore to a second Linux machine from the imgae located on my Windows XP laptop. What is the best free tool for that?


Most efficient grep method

Currently I am grepping data from a file containing any of the following:               342163477\|405760044\|149007683\|322391022\|77409125\|195978682\|358463993\|397650460\|171780277\|336063797\|397650502\|357636118\|168490006...............      This list is longer and contaings ~700 different values. What is the most efficient way of extracting it? I can chop it in parts of 10/20/50/100... Or are there other unix methods? This grep is piped to python for further analysis which goes fast enough.


What does exit do in an if block in a shell script?

I have a question regarding unix shell script. Say if you do `exit 1` in inner `if`: will it exit or will it still execute the outer `if`? The following is a dummy example.               if [ "$PASSWORD" == "$VALID_PASSWORD" ]; then         if [ "$PASSWORD" -gt 10]; then             echo "password is too large!"             exit 1         fi         echo "You have access!"         exit 1     fi


Full Linux distro under 50 MB for a business card CD

I need a full Linux distribution for a non-profit activist organisation that can fit on a business card CD. If that's not possible, there is a business card DVD option too with up to 400 MB capacity. But I would really prefer CD over DVD if such spartan Linux distribution under 50 MB exist.


Cannot install rsync (unable to create...Input/output error)

How do I resolve the following error to get `rsync` installed? `unable to create '/usr/bin/rsync.dpkg-new' (while processing './usr/bin/rsync'): Input/output error` Full log follows:               ubuntu@explorer:~$ uname -a     Linux explorer 3.8.2-g659a590 #1 SMP PREEMPT Tue Sep 24 02:38:40 PDT 2013 armv7l armv7l armv7l GNU/Linux          ubuntu@explorer:~$ sudo apt-get install rsync     sudo: unable to resolve host explorer     Reading package lists... Done     Building dependency tree     Reading state information... Done     The following NEW packages will be installed:       rsync     0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.     Need to get 0 B/282 kB of archives.     After this operation, 516 kB of additional disk space will be used.     (Reading database ... 27315 files and directories currently installed.)     Unpacking rsync (from .../rsync_3.0.9-4_armhf.deb) ...     dpkg: error processing /var/cache/apt/archives/rsync_3.0.9-4_armhf.deb (--unpack):      **unable to create `/usr/bin/rsync.dpkg-new' (while processing `./usr/bin/rsync'): Input/output error**     dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)     Processing triggers for ureadahead ...     Errors were encountered while processing:      /var/cache/apt/archives/rsync_3.0.9-4_armhf.deb     E: Sub-process /usr/bin/dpkg returned an error code (1)      Running Linux for Tegra.


Can I read and write to the same file in Linux without overwriting it?

> **Possible Duplicate:**   >  How can I make iconv replace the input file with the converted output? I frequently connect to amazon ec2 using their public DNS names   (`ec2-12-34-56-78.compute-1.amazonaws.com`) and because of this my `known_hosts` file gets overwhelmed with a lot of `ec2` entries I will never use again. I know I could probably use `sed -i` to edit in place but I wanted to use `grep` and so I did this:               grep -v ec2 ~/.ssh/known_hosts > ~/.ssh/known_hosts      That leaves `known_hosts` as an empty file. If I do:               grep -v ec2 ~/.ssh/known_hosts > ~/.ssh/tmp     mv ~/.ssh/tmp ~/.ssh/known_hosts      then things are fine, but I am confused why reading and writing to the same file leaves it blank, and if there is any way around this when using `grep`, `cat`, etc.


Redirecting tr stdout to a file

> **Possible Duplicate:**   >  How can I make iconv replace the input file with the converted output?   >  Can I read and write to the same file in Linux without overwriting it?               $ cat test.txt      This is a test file.     $ tr 'a' 'z' < test.txt      This is z test file.     $ tr 'a' 'z' < test.txt > test.txt     $ cat test.txt     $       Why does tr seem to output nothing to test.txt? I found this thread, but I don't really understand what is going on, and how to fix the problem. (Also, the reason I'm not using sed is because I want to replace newlines with another character, and I don't think sed can operate on a non-line-by-line basis?)


Redirecting head output for update hosts file

> **Possible Duplicate:**   >  How can I make iconv replace the input file with the converted output? I'm writing a script to change the content of my `hosts` file but I got stuck on the `head` output redirection. If I do `head -n -1 hosts >hosts` my `hosts` file will result empty and yes, it has more than 1 line.


How can I make iconv replace the input file with the converted output?

I have a bash script which enumerates through every *.php file in a directory and applies `iconv` to it. This gets output in STDOUT. Since adding the `-o` parameter ( in my experience ) actually writes a blank file probably before the conversion takes place, how can I adjust my script so it does the conversion, then overwrites the input file?               for file in *.php     do         iconv -f cp1251 -t utf8 "$file"     done


Command line 'buffer'

I wanted to `tail` the last 100 lines of a file to the same file, but the command `tail -n 100 file > file` doesn't work, I assume because the stdout gets written to the file 'live', before everything was read from the original file. Is there some way to pipe the output to _something_ , that then keeps it until all 100 lines are there, and then outputs it to the file? Or just another way to shorten the file in this way?


regular expressions with grep

I have this command right here:               grep -B10 -A10 '14:14:50 {"channels":["/alerts/6979/new"],"data":"New alerts for unit 6979"}' mygateway.log      Rather than searching for 14:14:50 I would like the 50 to be replaced with any number. So I was thinking to use the "." to represent any character in a regular expression. However, in programming languages you usually signify a regex with something like \abc.xyz\ where "." could be any character and any number of characters. But when I use "." in that grep string above it doesn't give me anything back.


Detecting which font should be used

I am wondering how a system knows which font should be used for an output. E.g. recently I was setting up my Debian for Japanese support, so first: installed Japanese locale, then a package with fonts, rebooted - and whola! - the system is in Japanese now. But I would not get that without installing the specific fonts. How does the system know that a particular font should be used for particular language/locale? Thank you.


Personal health records software

Does anybody know personal health records software for Linux? I want to record blood pressure, pulse, temperature, feel to analyze later. I will write information manually, as my measuring instruments doesn't have connection to PC. Of course I can just write data to simple plain text file and then plot them with `gnuplot` or `matplotlib` as a true *nix user. But I think that this problem was solved and someone created more comprehensive tool, which for example can store blood analysis results, electrocardiograms, ..., can remind to measure blood pressure and pulse and so on. I've tried to google it, I've looked on this list but found only huge web- based systems for hospitals (like GNU Health, GNUmed, etc.).


Create iso image from folder via terminal commands

I think the title says it all. How to create a iso image from a folder or single files via terminal commands? Currently i am doing this via `Brasero`s GUI, but i want to do it with a shell script.


Alter path of find result

> **Possible Duplicate:**   >  Manipulate file name piped from find command How can I alter the path of a file found with `find` before I run an `exec` on it? I want to find files and then `mv` them to a mounted file system that has the same file structure as the system being searched. Say I found `./home/usr1/dir1/file`, I want to move it to `/mountedSystem/home/usr1/dir1/file`, so all I need is to remove the leading `.` and append `/mountedSystem` to the start of the file path before executing the `mv`. Is there any way to do this safely?


PHP compilation - link to library

I am compiling php 5.3.13 on my server. I want to create an autonome php5 folder. So prefix is:               /usr/local/php5      In this folder I have a lib folder, where I put all lib needed for php to be executed such as:               libk5crypto.so.3     libxml2.so.2     libjpeg.so.62 ....      Even if I compile with `\--with-jpeg-dir=/usr/local/php5/lib/`, php binary is still looking for the file in `/usr/lib64`. The only solution I found so far is to manually export `LD_LIBRARY_PATH=/usr/local/php5/lib` I would like the same automatically at compile time. Is that possible?


How to correctly configure Debian watchdog daemon for BIOS Watch Dog?

Supermicro main boards contain a BIOS feature named "Watch Dog Function". Having Debian 6.0.6 with kernel "Linux debian 2.6.32-5-amd64 #1 SMP" we did:   1. Change BIOS "Watch Dog Function" from Disabled to Enabled.   2. Install the package watchdog (`# apt-get install watchdog`) Expected: that would be all for the watchdog function to be correctly installed. Result: system reboots every (roughly) 5 minutes. Change **BIOS** " **Watch Dog Function** " from Enabled to Disabled fixes the undesired reboots. The boot process seems to correctly enable the watchdog daemon. At least console displays (when BIOS Watch Dog is disabled):               Starting watchdog keepalive daemon: wd_keepalive.     Stopping watchdog keepalive daemon....     Starting watchdog daemon....      And on reboot this output is generated:               INIT: SUsing makefile-style concurrent boot in runlevel 6.     Stopping watchdog daemon....     Starting watchdog keepalive daemon....      What else need to be done to configure the BIOS watch dog function and Linux OS watchdog daemon to work together correctly?


udev Unable to Rename Network Device: Device or Resource Busy

I'm trying to use udev rules in order to give my network interfaces static, consistent names. However, it seems like there is some race condition happening preventing these rules from consistently taking effect each boot. When I look at `journalctl` I see the following error message: `systemd-udevd[149]: error changing net interface name eth0 to net0: Device or resource busy` My rules are pretty straight forward, I took them straight from the arch wiki on Network Configuration               SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="xx:xx:xx:xx:xx:xx", NAME="wifi0"     SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="xx:xx:xx:xx:xx:xx", NAME="net0"      What could be using the interfaces so early in the boot, and what can I do to fix this?


Run a command before services are started

I have a Oracle Linux 6.3 system on which I would like to run a command when the machines starts up _before_ any other services are started. The reason for this is to try and work around a bug in RHEL 6. I know that `rc.local` exists, but that is run after all other services have been run and is therefore too late. Here is the order in which things are currently run:   * Oracle 11g (fails due to RHEL bug)   * One or more things that depend on Oracle (fail due to no Oracle)   * `rc.local` (too late to help) Ideally I would like to do it this way:   * Command which works around bug.   * Oracle   * One or more things that depend on Oracle. Is it possible to do such a thing? Here are some options I have thought of so far that I would like to avoid as they add complexity and/or are just a bit nasty:   * Creating a custom service that is run before everything else.   * Adding the command to `rc.local` followed by calls to `service <x> start` for all the things that didn't start up.


Not wake up after suspension

My OS is Ubuntu 12.04 on my laptop Lenovo T400. I had been using it quite well until this week. After suspending Ubuntu, whenever I lift the laptop lid (if the lid is closed), or press "Fn" key (if the lid is not closed), normally Ubuntu should wake up. But starting this week, I couldn't wake it up either way for twice after I carrie my lap in my backpack running to another place. When the problem happens, the laptop light for battery is on, which is normal for suspended status (if it is turned off, there should be no light on). the laptop light for reading/writing from/to HDD is only about 1/4 of full lightness on, which I guess suggests it meets some difficulty of reading data from HDD for waking up? Is this related to some recent update of Ubuntu 12.04? Or is it a signal of onset of failure of some hardware part? Or ...? Thanks! * * * Added: As terdon suggested, I upload   * the log files `/var/log/pm-*` before and after the problem happens here. (the files ending in `.1` in their file names are those when I suspended Ubuntu, the files without `.1` are those most recent log files. Note: after the problem happens, I restarted my Ubuntu, and successfully suspended and woke Ubuntu.   * The output of my hardware info output by `lshw` is here


Will grep go faster with line breaks?

I have some big files that I have changed into "standardized form", removing line breaks. I want to speed up greps on those files. I know that you can optimize grep by doing `grep 'partofpattern' | grep -E 'partofpattern [[:digit:]]+'` -- that is, have grep search for lines that contain a more simple part of a pattern and then have grep run a second time on the few lines that contain part of the pattern. That makes me think that grep somehow works line-by-line. So will adding line breaks to big files with no line breaks speed up grep?


Counting number of times each IP address appears in log file

I have a file in the format as follows:               $ cat file.txt          27.33.65.2     27.33.65.2     58.161.137.7     121.50.198.5     184.173.187.1     184.173.187.1     184.173.187.1      What's the best way to parse the file `file.txt` into a format like:               27.33.65.2: 2     58.161.137.7: 1     121.50.198.5: 1     184.173.187.1: 3      In other words, I want to loop through the file and count the number of times each IP address appears. I've already run it through `sort` so all the IP addresses are in order and directly after each other.


Forward a host's network traffic to another host with the exception of SSH traffic

I am trying to redirect all the network traffic received in a old host to a different host. For that I created two new rules with `iptables` on the old host:               echo 1 > /proc/sys/net/ipv4/ip_forward     iptables -t nat -A PREROUTING -d old_machine_ip -j DNAT --to-destination new_machine_IP     iptables -t nat -A POSTROUTING -s new_machine_ip -j SNAT --to-source old_machine_ip     /etc/init.d/iptables save     /etc/init.d/iptables restart      Everything worked perfectly however I cannot access the old host with `ssh` any more since it redirects it to the new host. I would like to know if it is possible to create a single rule that ignores the prerouting for the ssh service.


Download tool needed -- with custom headers, resume, retry, custom filename output, and dynamic redirection

Simple problem -- I need a download manager, console, GUI, does not matter. The catch is in the features:   * custom header -- I have to pass a cookie in order to download (authorization)   * resume -- so if download stops for any reason, I could continue from 50% (for example), not from start   * retry -- so the program could automatically try establish connection and downloading again   * custom filename output -- so I could give specific filename, where the data go   * and dynamic redirection -- so if I ask server for file `X`, and server answers "OK, here is `X?token=767`" downloader will accept this with original name -- `X` (i.e. it will think it is the same I asked for) Since I prefer console, so far I tried wget, curl, aria2c. All of them fail. wget does not handle custom filename output (it is just a dump to a file) and it is "fooled" by redirection -- i.e. as with above example it will store the data in file `X?token=767` which in effect ruins both resume and retry, because with each reconnection the token changes. aria2c and curl do not even start downloading. My guess is, they don't accept redirection at all, aria2c retries again and again with 0 bytes download and no success, curl downloads the response from server the file was moved to `X?token=767`. For the record, below my commands for downloading: **wget**               wget -rc --no-cookies --header "Cookie: COOKIEKEY=COOKIEVALUE" \          "https://www.foo.bar/file.gz"      **aria2c**               aria2c -o f.gz --check-certificate=false -c -m0 \            --header="Cookie: COOKIEKEY=COOKIEVALUE" \            "https://www.foo.bar/file.gz"      **curl**               curl -o f.gz -C - --retry 1000 \          -H "Cookie: COOKIEKEY=COOKIEVALUE" \          "https://www.foo.bar/file.gz"


Samsung CLP-31x printer not working

So, my Samsung CLP-31x series printer stopped printing from Debian 6 applications. Closed source applications such as Chrome work, as does Foxit under Wine. Currently using the foo2qpdl CUPS driver. Tried Splix 2.0 from the website, nothing works, not even Foxit. Any ideas?


Missing separate debuginfo for - GDB

I have mentioned `-g` option along with `-Wall` in the `Makefile`. When I run `gdb onlineSunday`, I get:               Missing separate debuginfo for /usr/lib64/kde4/plugins/imageformats/kimg_dds.so     Try: zypper install -C "debuginfo(build-id)=a84a1969b9a69361b10f26814c0958717c48d671"     Missing separate debuginfo for /usr/lib64/kde4/plugins/imageformats/kimg_eps.so     Try: zypper install -C "debuginfo(build-id)=81e00b39aa9b3f7af23bad9d5bcef9f7cfe6333e"     Missing separate debuginfo for /usr/lib64/kde4/plugins/imageformats/kimg_exr.so     Try: zypper install -C "debuginfo(build-id)=0101355f5aa48dca9cf2723c94d1a4b7eb21e2ec"     Missing separate debuginfo for /usr/lib64/libIlmImf.so.6     Try: zypper install -C "debuginfo(build-id)=f26997841c2902a0db04726d4018640cf367101e"     Missing separate debuginfo for /usr/lib64/libIex.so.6     Try: zypper install -C "debuginfo(build-id)=2af205c15500875184d2b8519dbe01404bdfb3ae"     Missing separate debuginfo for /usr/lib64/libHalf.so.6     Try: zypper install -C "debuginfo(build-id)=5134d1c2dc3c6ea90b5eeabd518eb746c853b87c"     Missing separate debuginfo for /usr/lib64/libIlmThread.so.6     Try: zypper install -C "debuginfo(build-id)=ebb1d12661df5bbf0dd39c7c717cd197ada35d98"     Missing separate debuginfo for /usr/lib64/kde4/plugins/imageformats/kimg_jp2.so     Try: zypper install -C "debuginfo(build-id)=c1c25e24a14a9ec9163d623c699b6b53b7a1aabc"     Missing separate debuginfo for /usr/lib64/libjasper.so.1     Try: zypper install -C "debuginfo(build-id)=d521bb2892ccef13f28afaa82c0ef48433e46ca5"     Missing separate debuginfo for /usr/lib64/libjpeg.so.62     Try: zypper install -C "debuginfo(build-id)=c3638afbf013f8e33beaa3dc12f4d2dbdb3f8602"     Missing separate debuginfo for /usr/lib64/kde4/plugins/imageformats/kimg_pcx.so     Try: zypper install -C "debuginfo(build-id)=d1b443e7a29dd71a2519d852057c814bcfc9c30b"     Missing separate debuginfo for /usr/lib64/kde4/plugins/imageformats/kimg_pic.so     Try: zypper install -C "debuginfo(build-id)=4d533a04cab4426beaf2ae3c89eb2e026e5e1f81"     Missing separate debuginfo for /usr/lib64/kde4/plugins/imageformats/kimg_psd.so     Try: zypper install -C "debuginfo(build-id)=39ff79c31ae413ebac40eb8baef54ac524886e57"     Missing separate debuginfo for /usr/lib64/kde4/plugins/imageformats/kimg_ras.so     Try: zypper install -C "debuginfo(build-id)=7ecf3f8738c8cfacb14b6e54b53526346513dc8b"     Missing separate debuginfo for /usr/lib64/kde4/plugins/imageformats/kimg_rgb.so     Try: zypper install -C "debuginfo(build-id)=fc5d771438bc73014a4d551eb3b996043729c625"     Missing separate debuginfo for /usr/lib64/kde4/plugins/imageformats/kimg_tga.so     Try: zypper install -C "debuginfo(build-id)=9dd675ab0b9906bb234a90f8f4e9e65b7b6fbf63"     Missing separate debuginfo for /usr/lib64/kde4/plugins/imageformats/kimg_xcf.so     Try: zypper install -C "debuginfo(build-id)=2bfe0932ffdf6473010f792e1bde388881fdaff0"     Missing separate debuginfo for /usr/lib64/kde4/plugins/imageformats/kimg_xview.so     Try: zypper install -C "debuginfo(build-id)=6ba5f69301b600fe14553d99ef495df1d08ba379"     "ReferenceError: Can't find variable: displayMapAndClick on line:1 Source:undefined"      Missing separate debuginfo for /lib64/libnss_files.so.2      **GDB version:**               anisha@linux-trra:~> gdb -version     GNU gdb (GDB) SUSE (7.2-3.3)          anisha@linux-trra:~>      **The package:**               linux-trra:~ # cnf debuginfo-install          Program 'debuginfo-install' is present in package 'yum-utils', which is installed on your system.          Absolute path to 'debuginfo-install' is '/usr/bin/debuginfo-install'. Please check your $PATH variable to see whether it contains the mentioned path.          linux-trra:~ #      **The system:**               linux-trra:~ # cat /etc/issue && uname -a     Welcome to openSUSE 11.4 "Celadon" - Kernel \r (\l).          Linux linux-trra 2.6.37.1-1.2-desktop #1 SMP PREEMPT 2011-02-21 10:34:10 +0100 x86_64 x86_64 x86_64 GNU/Linux          linux-trra:~ #      **This is what I did:**               linux-trra: # zypper install -C "debuginfo(build-id)=a84a1969b9a69361b10f26814c0958717c48d671"     Retrieving repository 'Updates for openSUSE 11.4 11.4-0' metadata [done]     Building repository 'Updates for openSUSE 11.4 11.4-0' cache [done]     Retrieving repository 'devel:languages:R:patched' metadata [done]     Building repository 'devel:languages:R:patched' cache [done]     Loading repository data...     Reading installed packages...     No provider of 'debuginfo(build-id) = a84a1969b9a69361b10f26814c0958717c48d671' found.     Resolving package dependencies...          Nothing to do.          linux-trra: #      **What to do now?** * * *               linux-trra: # zypper ar -f -n "openSUSE-11.4-Debug" http://download.opensuse.org/debug/distribution/11.4/repo/oss/ repo-debug     Adding repository 'openSUSE-11.4-Debug' [done]     Repository named 'repo-debug' already exists. Please use another alias.          linux-trra: # zypper ar -f -n "openSUSE-11.4-Debug" http://download.opensuse.org/debug/distribution/11.4/repo/oss/ repo-debug-update     Adding repository 'openSUSE-11.4-Debug' [done]     Repository named 'repo-debug-update' already exists. Please use another alias.          linux-trra: #


Can GRUB2 share the EFI system partition with Windows?

I have an existing Windows 7 GPT installation, which already has a EFI System partition. I am now trying to install a Linux on a separate harddisk, which is also GPT formatted. I did not find any working way to get grub booting without EFI system partition, so my question is: Is it possible for grub2 to use the same EFI System partition as windows? How do I tell grub2 to use it? To clarify my setup:               gpt /dev/sda:         1 EFI System partition created by windows (100MB)         2 "Microsoft reserved partition" (200MB)         3 Windows root (rest of disk)          gpt /dev/sdb:         # After answering my own question: this partition is not needed         1 boot partition containing grub, kernels etc.(32MB)         2 crypto LVM partition (rest of disk)      I want grub2 to use the existing `/dev/sda1` EFI partition. PS: My mainboard is EFI capable.


Power saving enables touchpad

I've installed power saving packages (bumblebee, laptop-mode-tools, and cpufreq) to my laptop with Debian Wheezy. Thanks to that I decrease power usage from 32W to 10W. But now I faced the issue that I can't disable touchpad. I wrote simple script that inverts state of touch-pad:               #!/bin/sh     synclient TouchpadOff=`synclient | grep TouchpadOff | awk '{print !$3}'`      When I launch this script, it inverts state of touch-pad as expected, but in 5 seconds TouchpadOff is rewritten with value "2", and touch-pad becomes active again. I suppose that it's laptop-mode-tools who modifies TouchpadOff variable. I tried to find related settings in laptop-mode-tools, but didn't find anything. Any ideas how to determine who modifies TouchpadOff variable and how to disable such a modification?


The command to upgrade to a new kernel from Ubuntu repositories

In the distro I'm most familiar with -- ALTLinux, a command like `apt-get install kernel-image-std-def#3.0....` would install another kernel, and update the initramfs and the bootloader config accordingly; an even better command would be the specific `update-kernel`, which would also install the accompanying kernel modules for the new version of the kernel (the ones that are installed in the running system, so that the support for the hardware of this system is not lost in the case of the new kernel). (A short manual on this topic for ALT (in Russian).) Now I want to upgrade the kernel in my Ubuntu 12.04 system on a Toshiba AC100 (ARM). What would be the command in Ubuntu to install the new kernel, so that all the required things are done: initramfs is generated, the bootloader is updated, and no required module is lost? I'm especially interested in a command that would ensure that everything is done correctly, because I don't understand the peculiar boot process on this computer very well.


Why does e2fsck fail during boot, but not later?

When booting my Debian server, I'm presented with the following error concerning my external hard drive:               /dev/disk/by-label/elements:     The superblock could not be read or does not describe a correct ext2 filesystem.     ....     ....     fsck died with exit status 8.     ...     ...          A maintenance shell will now be started. CONTROL-D will terminate this shell and     resume system boot.      The thing is that if I type `Ctrl-d` or enter the maintenance shell the disk is correctly mounted and calls to `e2fsck /dev/disk/by-label/elements` report no errors. This is very annoying since I need to type `ctrl-d` every time the server is rebooted and I would rather not have a keyboard attached to the server at all.


Opensolaris snmp broadcast

A network sensor I'm evaluating is showing that my Opensolaris server is broadcasting on the snmp port 161, and I'm getting alerts about every 2 minutes. How can I turn off the snmp broadcast (i.e. traps?) on the Opensolaris machine? We have snmp enabled on the Opensolaris machine for Cacti, so it should really just be acting like a client in regards to snmp. Is there a configuration setting somewhere? I'm not familiar with snmp, but somehow got it up and running for Cacti. I see that /usr/sbin/snmpd is running. Any thoughts? Thanks.


Configuration for either detecting already running xsession or only auto-logging in once

My goal is an Arch based HTPC which on one tty runs XBMC and on another runs a minimalistic desktop (mainly for web browsing). I haven't yet started on the XBMC slice of the pie, but at the moment it automatically logs in to the desktop user's account via               c1:2345:respawn:/sbin/agetty -a USERNAME -8 -s 38400 tty1 linux      then via ~/.bash_profile it does a `startx` which does a `startxfce4`. This is fine until you switch to another tty, then back to tty1. Upon switching back it seems to reexecute the ~/.bash_profile which then has a tantrum because an xsession is already running. My questions are:   1. Is this a sensible way of implementing a desktop & XBMC configuration? It was the easiest thing I could think of (not being particularly pro on linux) for me and the end user.   2. Is there a way I can check for a correctly operating XFCE session running on tty1 and switch to it if there is, and run a new one if not?   3. Or is there a better way of performing an auto-start of XFCE on login which wouldn't get called every time you switch to the console? (Better ways of implementing this which don't directly answer these questions would be useful too; I'm aiming for light-weight & simple).


How to archive POP3 mailbox?

What programs are available to archive a mailbox (to mbox or maildir format) that I can only access via POP3? I'd like to be able to browse the mailbox locally afterwards, probably using mutt or the like. I'm on Debian stable, no problem to compile from source if needed, commandline preferred.


how to scp to host connected on a wifi?

I have my MAC on a wifi and am connected via `ssh` to a linux host. I want to copy some files from the linux host over to my MAC. I know, I can simply run `scp` on the mac to fetch each file via               mac> scp me@host.some.where:remote/folder/file local/folder      but I cannot do that with one command for many files (I could `tar` them first into an archive using the `ssh` connection and then ship the archive in one go, but I want to avoid this). So instead, I want to send all the files from the remote host (to which I'm connected by ssh) via (note the usage of a wildcard)               host> scp remote/folder/files* me@mac.some.where:local/folder      but what is the appropriate `mac.some.where` here, i.e. how can I obtain that, when my MAC is connected to some wireless? I tried the (numerical) IP address (obtained by `ifconfig`), but to no avail.


Can't get Kernel image

I am trying to write the kernel image in my ARM, I am using an ARMStone a9 here is the information about this board: http://www.fs- net.de/en/products/armstone/armstonea9/ The problem is that I am trying to write the kernel image, but when I finish it and everything it seems that is ok, I type boot for reboot the board, and I get this error: ERROR: can't get the Kernel image I have been investigating and I find out that could be for the Kernel image format but I get it from the official site web, then I do not think so that this is the problem. Also I read that maybe is problem of my variables enviroment here is my enviroment:               bootdelay=3     baudrate=115200     loadaddr=0x10800000     rd_loadaddr=0x11000000     netdev=eth0     ethprime=FEC0     uboot=u-boot.bin     kernel=uImage     nfsroot=/nfsroot     bootargs_nfs=setenv bootargs ${bootargs} fec_mac=${ethaddr} root=/dev/nfs     ip=${ipaddr} nfsroot=${serverip}:${nfsroot},v3,tcp     bootargs_nand=setenv bootargs ${bootargs} fec_mac=${ethaddr} ${mtdparts}     gpmi_debug_init enable_wait_mode=off ubi.mtd=TargetFS root=ubi0:rootfs     rootfstype=ubifs rootwait rw     bootargs_mmc=setenv bootargs ${bootargs} fec_mac=${ethaddr}     root=/dev/mmcblk0p1 rootfstype=ext4 rootwait rw     bootcmd_net=run bootargs_nfs;tftpboot ${loadaddr} ${kernel}; bootm     bootcmd_net_mmc=run bootargs_mmc;tftpboot ${loadaddr} ${kernel}; bootm     bootcmd_mmc= for disk in 0 1 ; do mmc dev ${disk} ;for fs in fat ext2 ; do     ${fs}load mmc ${disk}:1 ${loadaddr} /6q_bootscript && source ${loadaddr} ;     done ; done     bootcmd_nand=run bootargs_nand;nand read ${loadaddr} Kernel 0x600000;bootm     bootcmd_nand_mmc=run bootargs_mmc;nand read ${loadaddr} Kernel     0x600000;     bootm loadcmd_nfs=nfs ${loadaddr} ${serverip}:/nfsroot/uImage     clearenv=sf probe 1 && sf erase 0xc0000 0x2000 && echo restored     environment to factory default     upgradeu=for disk in 0 1 ; do mmc dev ${disk} ;for fs in fat ext2 ; do     ${fs}load mmc ${disk}:1 ${loadaddr} /6q_upgrade && source ${loadaddr} ;     done ; done     ethact=FEC0     ethaddr=00:05:51:07:B3:B8     mtdids=nand0=gpmi-nand     mtdparts=mtdparts=gpmi-nand:512k(NBoot)ro,2m(UBoot)ro,256k(UBootEnv),256k(UserDef),6m(Kernel)ro,-(TargetFS)     filesize=5D7C000     fileaddr=10A00000     bootcmd=run bootcmd_nand     serverip=192.168.1.44     netmask=255.255.255.0     ipaddr=192.168.1.131     stdin=serial     stdout=serial     stderr=serial     bootargs=console=ttymaxc1,115200     video=mxcfb0:dev=hdmi,1024x768M@60,if=RGB24 fec_mac=00:05:51:07:B3:B8     mtdparts=gpmi-  nand:512k(NBoot)ro,2m(UBoot)ro,256k(UBootEnv),256k(UserDef),6m(Kernel)ro,-(TargetFS)     gpmi_debug_init enable_wait_mode=off ubi.mtd=TargetFS root=ubi0:rootfs     rootfstype=ubifs rootwait rw     partition=nand0,0     mtddevnum=0     mtddevname=NBoot      So please if someone knows how can I solved this please help me!


Console won't power off on PowerPC with Debian

I installed Debian 6.0 on a Power Mac G5. First it would boot to a blank screen but I fixed that by blacklisting nouveau as described here. Now the monitor will never turn off. It's a server so I'll mostly ssh into it and I want the monitor to power down after a very short time. I have no xserver installed and just use the console. I've tried modifying `/etc/kbd/config` but that didn't work. I also tried installing `console- tools` and modifying `/etc/console-tools/config` but that didn't work. Then I tried using `setterm` and that didn't work. I even tried using console codes to blank the screen, but that didn't work either. Does anyone know how I get control of the power saving modes for this console?


How can I know what is the cause of linux to crash at start-up?

I'm using gentoo. Sometimes (not always), when the system starts (from power up), its crash (before I'm getting the GUI login window). I know Linux saves into log files the problem of the crash, but I'm so confuse and don't know from where to start ?               Do I Need to check the dmsg file ? (or other log file ?)     Do I need to grep with "errors" ? or there string pattern to search in the dmsg or other logging file ?)


How to have find only search for files in changed directories?

Currently I'm repeatedly doing a 'find' that's too slow. I'm searching for non-hidden executable files within "$root", excluding "$root/bin":               find "$root" -type f -perm -o+x -not -path "$root/bin/*" \( ! -regex '.*/\..*' \)      I'd like to restrict find to only look in directories with mtimes older than a certain time. I still want it to recurse into old directories' subdirectories, but I don't want it to check the regular files inside unless the directory passes my mtime check. Is it possible to do this with GNU find or do I need two invocations, one to find the directories and another to check the files inside?


How to determine what filesystem a directory exists on?

I have an NFS share which is shared across about two other machines. I recently realized that one of the servers isn't sharing the directory and is keeping files all for itself. Is there a way to see if the NFS share is mounted in the directory I think it is in?


Access memory via a flat file in Linux

I understand everything is a flat file in Linux. How hard is it to dump the contents of the main memory into a flat file? Does it already exist in Linux? If yes, what's the path to the file? What are the default permissions?


static ip to a freebsd server

I have `Comcast cable <====> modem <===> router <===> freebsd server` My `freebsd server` is connected to wireless router via a network cable. What I want to do is, to have a static ip for the server. How can I do it?


Custom action to open an program instance for each selected folder?

In Thunar, I want to be able to open folders with Ex Falso. I created a custom action with the command `/usr/bin/exfalso %f`. This works when I select a single folder. When I select several folders, I want Thunar to open an Ex Falso instance for each selected folder. I tried the parameters `%F` and `%N`, but then Ex Falso gets opened for the first folder only.


How can there be a directory named `~`?

I was trying to test out this buggy/new tool to see how it works, and it prompted me to choose a directory to use for stuff I am doing. From the directory `~/Code/indep`, I typed in `~/Code/indep/tarbell`. (Stupid, I could have just typed 'tarbell', but whatever.) It prompted me to create it because it didn't exist, I said yes. When I inspected the contents of this directory, here is what I see:               brian@navis:~/Code/indep$ ls     ~ project1 project2 project3 ...      I thought "oh, weird, it created a symlink to ~". However:               brian@navis:~/Code/indep$ file ./~     ./~: directory      `file` thinks it's a directory.               brian@navis:~/Code/indep$ ls -l     drwxr-xr-x 3 brian brian 4096 Nov  8 16:50 ~     drwxr-xr-x 8 brian brian 4096 Oct 14 18:42 project1     drwxr-xr-x 3 brian brian 4096 Sep 10 21:15 project2     drwxr-xr-x 5 brian brian 4096 Oct 14 19:33 project3     ...      And so does `ls -l`. I thought, "oh, ... is it a hard link? I've never really used those." But I tried to reproduce, and it's impossible to create a hard link to a directory. So... I guess I've narrowed this down to things I don't understand. Did I mount my home directory in this other directory somehow? My main goal at this point is to remove the reference to my home directory in this folder (`rm` doesn't seem like the answer), but I'm also curious to know what's going on. EDIT: In retrospect, I understand exactly what happened. As was answered below, the program created a directory called "`~`" inside my current directory. The only really obfuscating fact about this is that I wasn't consistent with how I was actually viewing what the directory was. Sometimes I referred to it as "`~`" and sometimes as "`./~`". It's only if you do the latter that you can actually see what's going on, but until I understood this, I was conflating what I was seeing from using the absolute path of "`~`" to to what was in fact a local directory.


How do I print the process name next to the process ID number in a file?

I'm redirecting results for something into a file and I also need to find the process name and ID number and redirect it to the file as well. I'm guessing the process name is the command in which I'm directing the results to. As in if the command is `pgrep sshd` and I redirect the results to the file, `pgrep sshd` would be the process name. I'm just curious though how exactly I find the process ID number and what would be the simplest way to redirect it to a file if there is a command to find it. Here is the original objective I was given, I'm sorry if I seem really new at this, I am a student. > Man pages usually have a helpful section near the end called "SEE ALSO" that > you can use to find a list of commands and topics related to the command > that the current man page is about. Use this feature to locate a command > related to "ps" that will search for processes based on some criteria. Use > this command to locate all processes called sshd, directing the output to a > file named `processes.txt` in `~/sysadmin1`, making sure that the command > also prints out the process name next to the process ID number. You will > have to specify a flag with the command that you find in the man page for > the command in order to do this. When you have finished add the full command > used to the top of the `processes.txt` file.


RPMs and patching

I have 3 files (from here)that I have been given to install in an attempt to upgrade the compiler: > binutils-2.13.2.1-1.mipsel.rpm   >  binutils-2.13.2.1-1.src.rpm   >  binutils-2.13.2.1-r5900-7.diff.gz I'm kinda fumbling around with this. What I've done is:               rpm -i mipsel -vv     rpm -i src -vv      I have no idea what to do with the `.diff.gz` I understand its a patch but dont really know how to deal with it.


openSUSE not starting up after failed update

More than failed it was a partial update, when I was updating there was a power failure and my laptop shutdown (battery is broken). Now when I try switching my system on, it shows the chameleon and then it just shows a small cursor at the top left of the screen and stays there forever. Any help to recover?


How does the CentOS installation work from the inside?

I am trying to understand the content of a Linux distribution's ISO image file and how the installation process take place. Here I am specifically talking about CentOS 6.4 in its minimal version. So ISOLINUX is triggered, and I get the menu displayed. Then I hit install. It loads the kernel and the initrd filesystem. My questions are:   1. How does Anaconda get called?   2. What is the role of the images/install.img file ? (Who calls/mount it?)   3. Does Anaconda installs Packages/*.rpm? If I wanted to add one in there can I and would it be installed ? Any link / recommendation is welcome,


root password changed automatically

I have my system on dual boot (win7 and RHEL 6). I have 2 user account on RHEL 6. A normal user and a root user. I put passwords of both accounts same. It was working fine from 5 6 days. Yesterday I installed ntfs-3g to use NTFS drives in RHEL. It worked fine too. Now today's morning when I started my laptop, I login through the normal account, worked fine. Then I accessed NTFS drive, it asked for authentication, I gave root's password but it said that the password is wrong. I will change the root's password from single user mode. But I just want to know why did this happen? How it changed automatically? PS: No one else accessed my laptop.


Make BASH's Tab Completion Fill In First Match?

Is there any way to make BASH fill in the first match when I press TAB, kind of like the Windows command prompt? (It should still display the list of matches, but it should cycle through them when I keep on pressing tab.) i.e. the goal here is to be able to fill in **_any** match_ with **only** the TAB key, given enough presses -- like in Windows.


In awk, how to print a range of fields with the original $0 delimiters intact?

How to extract a substring of $0, in `awk`, when that substring's position and length is based on the positions of fields in the original $0? It effectively equates to removing the first _n.lead_ fields and the last _n.trail_ fields and all those fields' leading and trailing delimiters, from the original $0 Here is an example: It is only known that the range is $4 to $8 inclusive.   The delimiter is any number of spaces and/or a single comma, eg. `" , "` or just `","`... and the leading delimiter is to be ignored.                         Input: "   a  a  a   X marks   the   start,   Y   marks the  end  "     Expected Output: "X marks   the   start,     Y"


How to route specific adresses through a tunnel?

There are certain websites/services which I can only access from the subnet on which my server is located (think of the typical intranet scenario). Is there a way to transparently route traffic that go to these addresses through an SSH tunnel? Consider the following setup: My laptop is connected on the home network. It cannot access services on ips X and Y directly. I have an SSH tunnel to a server which is on a subnet that can actually access these services. Can I somehow automatically encapsulate all the traffic to the subnets of X and Y to go through this tunnel, without having to run the entire VPN solution that would send all my traffic through the server? In other words: all traffic that goes to any other subnet should still go directly from the laptop, without passing through the server (using the tunnel).


Command-line way to download youtube video in multi-threaded

On a fast internet connection, downloading Youtube videos is too slow compared to downloading files from other websites. Currently I'm using `get_flash_videos` to download the Youtube videos. How can I integrate `get_flash_videos` with multi-threaded download accelerators like `axel`, `MultiGet` or `Wxdownloadfast`?


Replace spaces and tabs at the end of the line in all files

I need to replace all unwanted spaces in all files from the current directory and from directories from the current directory (recursive search). I define the _unwanted spaces_ the spaces and tabs that are at the end of the line and are not followed by any other character than `\n` (the new line character). e.g.:               This is a line with unwanted spaces                 // this line is supposed to contain only spaces     Another line without unwanted spaces     Another line with unwanted spaces           This snippet will become:               This is a line with unwanted spaces          Another line without unwanted spaces     Another line with unwanted spaces      How can I remove all unwanted spaces from all files (recursive search) from the current directory?


parameter extraction from multiple parameter output in bash?

Here's the bash script I am working on: i/p: `ls *.py`   o/p: List of output files with `.py` extension 1.How do I know the number "n" of the `.py` files?   2.Then pump files one by one into the program to do further processing?


Input validation in a bash script

I've got the basics of bash scripting (I think anyways), and i'm trying to move on to more advanced stuff. I am trying to write a script that will perform input validation (the user must input either yes or no) and i'm trying to do this by combining a function and an if then else statement. This is what i'm working on so far.               #!/bin/bash     func ()     {          echo "Enter yes or no:"         read var1     }          if [ $var1 != yes ] || [ $var1 != no ]     then         func     else         echo "I'm glag you said $var1"     fi          exit 0      I know that i'm using the wrong if then else operator/syntax, but I can't find the correct syntax threw googling. I want it to run the function if var1 is either equal to yes or no, so the user can't input something else.


`hostname` - host name or FQDN?

What is the right thing to set a computer's hostname to? (`/bin/hostname`, `/etc/hostname`, `sethostname(2)`, etc.) I usually just use the "name" part, and it works perfectly (for me at least), but I've seen it implied in some places that I should use the entire "name.domain.tld" instead... which just doesn't feel "right" for me.


Batch File Rename Using Mapping File

I have a large collection of image files, for example:               a.png, b.png, c.png, etc      If I have a file with mappings of filenames to numbers, like so (ignore the format, it could be anything):               a=>1     b=>2     c=>3     ...      Is there any easy way to batch rename all the files using the mapping file to:               1.png, 2.png, 3.png, etc      I'm looking for unix/linux commands. I know I can write a very simple script, but just curious if there is any other technique. Thanks


Using Creative Sound Blaster on Ubuntu Server

I just got a Creative Sound Blaster for playing audio wirelessly. I connected it to a virtual version of Ubuntu desktop and just had to go into the sound settings and switch it to the USB and the device worked. Now I am trying to get it to work on Ubuntu Server 10.04. I plugged it in and restarted the computer, but when I go to /dev I don't see it listed (unless I'm missing it somehow). Does anyone know how to get the Sound Blaster to work on Ubuntu Server? (I haven't gotten any audio to play out of the server, so if you wanted to include that, I wouldn't mind. However, I feel confident that google will hold the answer to that question...the main question is the Sound Blaster).


How to kill a printing job on centOS

How does one kill a printing job on centOS?


Set GPIO permissions cleanly

Can the default permissions and ownership of /sys/class/gpio/ files be set, e.g. by configuring udev? The point would be to have a real gid for processes that can access GPIO pins on a board. Most "solutions" include suid wrappers, scripts with chown and trusted middleman binaries. Web searches turn up failed attempts to write udev rules. (related: Q1) (resources: avrfreaks, linux, udev)


Firewall config prevents hibernate connecting to postgres in CentOS6.3

I have an operating environment in CentOS 6.3 that has tomcat7 and postgres9.2 installed. There is just one web application deployed in tomcat that tries to establish a connection from localhost to postgres. The following is the contents of /etc/sysconfig/iptables               #Filter table     *filter     :INPUT DROP [9:2530]     :FORWARD DROP [0:0]     :OUTPUT ACCEPT [88:11968]     -A INPUT -i lo -j ACCEPT     -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT     -A INPUT -p tcp --dport 22 -j ACCEPT     -A INPUT -p tcp -m tcp --dport 8443 -j ACCEPT     -A OUTPUT -p icmp -j ACCEPT     COMMIT          #NAT TABLE          *nat     :PREROUTING ACCEPT [129:7557]     :POSTROUTING DROP [1:108]     :OUTPUT ACCEPT [1:108]     -A PREROUTING -i eth0 -p tcp -m tcp --dport 443 -j REDIRECT --to-ports 8443     COMMIT      Tomcat only allows https and listens for requests at port 8443. Currently I forward requests from port 443 to 8443 so that users don't have to specify port numbers in the URL. Web pages are happily accessible from a browser, but web application fails to work. From tomcat logs, hibernate fails to establish a connection with postgres even though netstat output says postgres is at stage LISTEN for requests at 127.0.0.1:5432. All this started happening when I came up with the new firewall config. I was of the idea that the following line               -A INPUT -i lo -j ACCEPT      should take care of local connections from tomcat webapp to postgres, but looks like it doesn't. I need to know what is it in the firewall config that I need to change to allow the connections back again.


Setup PPTP VPN connection with no GUI

I want to configure a remote linux (Ubuntu Precise) to use a PPTP VPN. I can only access to it using `ssh`, so I don't have a graphical interface (neither do I want it). Some hours googling:   * Guides on where to click in the graphical interface (useless);   * pptp-linux:      * `getaddrinfo(): Name or service not known`   * nmcli      * `** (process:5244): WARNING **: Could not initialize NMClient /org/freedesktop/NetworkManager: The name org.freedesktop.NetworkManager was not provided by any .service files`     * `** (process:5244): WARNING **: Error enabling/disabling networking: The name org.freedesktop.NetworkManager was not provided by any .service files` Can anyone point me a tutorial, a command that actually works, or any other way to setup all network traffic to go through the PPTP VPN on that machine? ## Update My VPN service has expired and I will not renew it. I no longer have access to a PPTP VPN, so I can not replicate the problem, nor do I have the need to verify if any given answer solves the problem I described.


How can I test for POSIX compliance for shell scripts?

Probably the main thing that this website has taught me so far is the importance of writing portable shell scripts. Considering that POSIX is the closest thing to a common standard between all unices, I'm interested in knowing if there's a shell that supports it exclusively. While most modern shells provide support for POSIX (and will run POSIX compliant scripts without any problem), they don't do a good job at pointing out non compliant features. Is there any shell that implements POSIX and POSIX only, in such a way that it'd throw an error for any non compliant feature? **EDIT** I want to clarify that I'm not asking for general tips for writing portable shell scripts. The related question mentionned in the comments already covered this. I thought of this question when I found out that `bash` has a `\--posix` option but only to discover that it only affects some intialization behaviors which is not exactly what I'm looking for.


Backing Up to a Compressed Archive on Linux

How would you go about backing up just some files and subdirectories of a given directory to a compressed archive so that the tree structure could then easily be recreated from that archive. Basically, rsync, with a little bit of scripting around (to select the files and folders I need) does the job, except I don't want to just copy. I need an additional layer that compresses the files being rsynced into some kind of compressed archive (which could then be restored with the paths being recreated). Rsync doesn't necessarily have to be part of the solution. E.g., can I mount an archive on so that everything that goes to that mount point gets compressed?


Why does reading from two connected pty's cause an infinite loop?

I want to fake a gsm modem for testing a program. I want the program to send AT-codes to me and that I can answer it back, kind of a VirtualSerialPort. But for some reason the data written from the program is written back to it directly. I would have expected that socat created two pipes; one that sends the output from the test program to whatever I've attached on the other side and another pipe that works in the other direction. But the data appears to "loop in one pipe", if you understand what I mean. Here's a picture from TTY demystified to illustrate my point: ![Pty handling in kernel](http://i.stack.imgur.com/2KLkn.png) A simplified reproduction script: I create the pty's with:               (xterm 1)$ socat -d -d -d PTY,link=foo PTY,link=bar     2012/01/18 14:45:01 starting loop with FDs [3,3] and [5,5]      And I listen to both sides:               (xterm 2)$ cat <bar     (xterm 3)$ cat <foo      If I write a few characters...               (xterm 4)$ echo "..." > foo      .. socat logs a _lot_ of traffic that goes forth and back infinitely.               (xterm 1)     2012/01/18 14:25:58 socat[7667] I transferred 4095 bytes from 5 to 3     2012/01/18 14:25:58 socat[7667] I transferred 4095 bytes from 3 to 5     2012/01/18 14:25:58 socat[7667] I transferred 4095 bytes from 5 to 3     2012/01/18 14:25:58 socat[7667] I transferred 4095 bytes from 3 to 5     2012/01/18 14:25:58 socat[7667] I transferred 4095 bytes from 5 to 3     2012/01/18 14:25:58 socat[7667] I transferred 4095 bytes from 5 to 3      There's nothing outputted from either of the cat commands. **EDIT:** @wnoise explained that socat creates two PTY masters. Here's an image to illustrate that: ![Two PTY masters connected by socat](http://i.stack.imgur.com/O2vkm.png)


Naming process in init scripts

I'm trying to write an init script that will start a service that needs to have started `postgresql` server before. Bellow is the `postgresql`'s init header:               #!/bin/sh     #     # postgresql    This is the init script for starting up the PostgreSQL     #               server.     #     # chkconfig: - 64 36     # description: PostgreSQL database server.     # processname: postmaster     # pidfile: /var/run/postmaster-9.1.pid      In the header from my init script, how should I refer to postgresql, through `postgresql-9.1` (the init script file name) or through `postmaster` (that's because of `processname` from `postgresql`'s init script)?


Pretty output in GHCI: no colours shown

Using this method to get a pretty GHCI colours, I am not getting any colours whatsoever. However, my terminal is a urxvt with 256 colours enabled and TERM is `xterm-256color`. Any idea what I could have missed? My ~/.ghci reads:               import qualified IPPrint     import qualified Language.Haskell.HsColour as HsColour     import qualified Language.Haskell.HsColour.Colourise as HsColour     import qualified Language.Haskell.HsColour.Output as HsColour          let myColourPrefs = HsColour.defaultColourPrefs { HsColour.conid = [HsColour.Foreground HsColour.Yellow, HsColour.Bold], HsColour.conop = [HsColour.Foreground HsColour.Yellow], HsColour.string = [HsColour.Foreground HsColour.Green], HsColour.char = [HsColour.Foreground HsColour.Cyan], HsColour.number = [HsColour.Foreground HsColour.Red, HsColour.Bold], HsColour.layout = [HsColour.Foreground HsColour.White], HsColour.keyglyph = [HsColour.Foreground HsColour.White] }          let myPrint = putStrLn . HsColour.hscolour (HsColour.TTYg HsColour.XTerm256Compatible) myColourPrefs False False "" False . IPPrint.pshow          :set -interactive-print=myPrint     :set -XNoMonomorphismRestriction     :set prompt "λ "      The prompt should look like this: ![haskell ghci colour prompt](http://i.stack.imgur.com/8ZAZu.png)


How to use Quicken Home Inventory on Linux (or Windows 7)

I have Quicken Home Inventory Manager and it seems that is no longer supported by Intuit, i.e. it does not run on newer Windows versions (like Windows 7 64-bit for example). Since I also use Linux, I'd like to try to use it on Linux if possible. Of course, I could install another inventory program, but there is no option to export data from QHIM and I have over 2 thousand items in the database, so I really have to keep using this proprietary software. I tried running it under Wine but it's very slow to the point when it's completely unusable. It was very slow on Windows as well when I got more than a couple of hundreds of items, but under Wine the screen flickers all the time and I really cannot use it. I'm looking for some way to either tweak Wine settings or find some way to export data from QHIM's database.


Set default Soundcard Centos

How do I set my default soundcard on Centos/Linux? I have two soundcards installed on my system and it always detects the wrong one, upon boot.


Copy files with deleting suffix in name

How can be done coping files that have some suffix at the end, into same dir with the smallest command possible: Example have directory containing files:   * cassandra.yml.example   * database.yml.example   * facebook.yml.example   * cache.yml.example   * system.yml.example need to copy them and have names like this:   * cassandra.yml   * database.yml   * facebook.yml   * cache.yml   * system.yml


tcpdump: "packets captured" vs "packets received by filter"

We have a script which calls               tcpdump -v src host <IP address> and port <port number> >>out.txt 2>>err.txt -w capture.cap      on multiple IP-s while the other parts of the script initiates some traffic in the background. We want check if packets are coming back to us, and examine manually only those cases when we receive packages. tcpdump's error output seemed fine for this at first, but. The question is, as the subject suggests, what's the difference between "packets captured" and "packets received by filter"? There are captures, which did not record any packets, but output "0 packets captured, 2 packets received by filter" which sounds like a contradiction, since if no packets were captures, how were 2 of them filtered? At first, we had been looking for "0 packets received by filter" but that isn't alway written to error output, when there were no packets received. So what do these numbers show? Please advise what to look for if we want to filter those cases when no reply packets were received.


Problems when using the framebuffer device directly

I am writing a program using the framebuffer device directly and I have three problems there. 1) The only way I can set the screen resolution correct is by passing the kernel option during boot: `video=800x600` when using others like: `video=vesafb:800x600-32,ywrap` , `video=uvesafb:800x600-32,ywrap` , `video=intelfb:800x600-32,ywrap` the framebuffer is 800x600 in the terminal, but as soon as i start the program the resolution goes back to its native resolution (1366x768). Is this an Intel (gma) issue or am I doing something wrong here? 2) With all four above variants I am not able to acquire offscreen buffers. In example doubling the y-resolution via `FBIOPUT_VSCREENINFO`. Is there another option to be set to be able to use offscreen framebuffer memory? May be related to the above issue? 3) Exiting the program I am stuck on the framebuffer, even though the program cleans up and resets the old configuration. I have to go to another terminal by `CTRL+ALT+F1` and back by `CTRL+ALT+F7` to get back into X. Why could this be, assuming the program does everything correct? I am on an Intel GMA 3150.


Meaning of the yum error "Package tuple (...) could not be found in rpmdb"

I just want to install two packages in my Fedora 15 but I am getting some weird error. **Command:**   `yum install @development-tools` **Error:** > Loaded plugins: langpacks, presto, refresh-packagekit Setting up Install > Process Package flex-2.5.35-13.fc15.x86_64 already installed and latest > version Error: Package tuple ('gcc', 'x86_64', '0', '4.6.0', '6.fc15') could > not be found in rpmdb **Command:**   `yum install fedora-packager` **Error:** > Loaded plugins: langpacks, presto, refresh-packagekit Setting up Install > Process Error: Package tuple ('fedora-packager', 'noarch', '0', '0.5.9.0', > '1.fc15') could not be found in rpmdb On first command it says package already installed and latest version but why I got that error line.How to fix this errors?


Gnome trouble on a DisplayLink device in a Linux virtual machine

I have a virtual machine running Ubuntu 10.04 32-bit. Using the tools provided with VirtualBox, I have added a DisplayLink device to the VM and created the following `xorg.conf` file:               Section "ServerLayout"             Identifier      "Server Layout"             Screen  0       "DisplayLinkScreen" 0 0             Option          "Xinerama" "off"     EndSection          Section "Files"             ModulePath      "/usr/lib/xorg/modules"             ModulePath      "/usr/local/lib/xorg/modules"             ModulePath      "/usr/local/lib/xorg/modules/drivers"     EndSection          ############### DisplayLink Stuff ###############          Section "Device"             Identifier      "DisplayLinkDevice"             driver          "displaylink"             Option  "fbdev" "/dev/fb1"     EndSection          Section "Monitor"             Identifier      "DisplayLinkMonitor"     EndSection          Section "Screen"             Identifier      "DisplayLinkScreen"             Device          "DisplayLinkDevice"             Monitor         "DisplayLinkMonitor"             SubSection "Display"                     Depth   16                     Modes   "800x480"             EndSubSection     EndSection      This works to a small degree - the DisplayLink device turns green, and eventually a purple desktop with my icons appear on it. The actual VBox window is blank. The problem is that:   * the Gnome panel does not load   * a right-click on the desktop has no effect I tried pressing `Alt+F1` and the console displays in the VBox window. Pressing `Alt+F7` after that does nothing. I have to press `Alt+F8` to get back to the GUI. This leads me to believe that there's an extra display in there somewhere. I _have_ installed Guest Additions if that helps. GDM is set to auto-login to a Gnome session. * * * **Edit:** It seems like the problem is with Gnome / GDM. Applications (e.g. gnome-terminal) display normally. `xev` is reporting that all input events are coming through okay. The panel seems to be partially running but invisible:               $ wmctrl -Gl | grep -i panel     0x01200003 -1 0      0     1     1   test-pc Top Expanded Edge Panel     0x01200042 -1 0      0     1     1   test-pc Top Expanded Edge Panel


What linux is best suited for people new to computers?

What would be the easiest linux for people who are new to computers? The computers here have 256Mb RAM with 40GB hard-disks. UPDATE: Most of them apparently have more than 265MB of RAM with some having 1GB. I've installed Linux Mint Debian Edition (LMDE), which the users could figure out after a bit of messing around and a little help from me. I picked it because it is a rolling distribution and all the great things I've read about Linux Mint. Also I had used Ubuntu before and Mint seemed like Ubuntu+ . I'm not sure if it is the easiest distro for them to use, since people who have tried to use the default Libre Office, found it confusing with all those menus. (The program they seem use the most is the web-browser and they found chromium to be fairly simple). As a side note, the installation wasn't very smooth and the printer (HP LaserJet 1020) took a bit of work to setup, but once it was done and the OS upgraded, it works very well.


I uninstalled vsftpd, but I can still connect with sftp

I installed vsftpd and was in the process of configuring it. When I sent the vsftpd server stop command:               sudo service vsftpd stop      I received:               stop: Unknown instance      So I went ahead and uninstalled it and rebooted the system               sudo apt-get remove --purge vsftpd      when I 'stop' vsftpd now it says:               vsftpd: unrecognized service      If I try 'uninstalling' vsftpd its says:               Package vsftpd is not installed, so not removed      _**Issue: But I can still connect to my server using FTP client_** I cannot somehow believe there is a zombie? process that is not getting killed even after reboot. Can someone please throw light on this? System Configuration: Ubuntu 12.04.1 Server LTS as Guest VM on Windows 7 Host VM TCP dump as requested: Command: `sudo tcpdump port 22 >tcpdump.log` Action taken: Used WinSCP to SFTP into the Guest OS Server tcpdumplog:               17:00:42.745423 IP Brown.home.54199 > ubuntu-12.home.ssh: Flags [P.], seq 4076673955:4076673991, ack 3552872727, win 17520, length 36     17:00:42.745442 IP Brown.home.54199 > ubuntu-12.home.ssh: Flags [F.], seq 36, ack 1, win 17520, length 0     17:00:42.746192 IP ubuntu-12.home.ssh > Brown.home.54199: Flags [F.], seq 1, ack 37, win 16616, length 0     17:00:42.746406 IP Brown.home.54199 > ubuntu-12.home.ssh: Flags [.], ack 2, win 17520, length 0     17:00:50.181085 IP Brown.home.54223 > ubuntu-12.home.ssh: Flags [S], seq 8389211, win 8192, options [mss 1460,nop,nop,sackOK], length 0     17:00:50.181112 IP ubuntu-12.home.ssh > Brown.home.54223: Flags [S.], seq 1127786298, ack 8389212, win 14600, options [mss 1460,nop,nop,sackOK], length 0     17:00:50.181262 IP Brown.home.54223 > ubuntu-12.home.ssh: Flags [.], ack 1, win 17520, length 0     17:00:50.186862 IP ubuntu-12.home.ssh > Brown.home.54223: Flags [P.], seq 1:40, ack 1, win 14600, length 39     17:00:50.187152 IP Brown.home.54223 > ubuntu-12.home.ssh: Flags [P.], seq 1:31, ack 40, win 17481, length 30     17:00:50.187282 IP ubuntu-12.home.ssh > Brown.home.54223: Flags [.], ack 31, win 14600, length 0     17:00:50.187476 IP Brown.home.54223 > ubuntu-12.home.ssh: Flags [P.], seq 31:639, ack 40, win 17481, length 608     17:00:50.187485 IP ubuntu-12.home.ssh > Brown.home.54223: Flags [.], ack 639, win 15808, length 0     17:00:50.188653 IP ubuntu-12.home.ssh > Brown.home.54223: Flags [P.], seq 40:1024, ack 639, win 15808, length 984     17:00:50.188900 IP Brown.home.54223 > ubuntu-12.home.ssh: Flags [P.], seq 639:655, ack 1024, win 16497, length 16     17:00:50.190537 IP ubuntu-12.home.ssh > Brown.home.54223: Flags [P.], seq 1024:1304, ack 655, win 15808, length 280     17:00:50.240004 IP Brown.home.54223 > ubuntu-12.home.ssh: Flags [P.], seq 655:927, ack 1304, win 16217, length 272     17:00:50.254190 IP ubuntu-12.home.ssh > Brown.home.54223: Flags [P.], seq 1304:2152, ack 927, win 17024, length 848     17:00:50.312380 IP Brown.home.54223 > ubuntu-12.home.ssh: Flags [P.], seq 927:943, ack 2152, win 17520, length 16     17:00:50.351847 IP ubuntu-12.home.ssh > Brown.home.54223: Flags [.], ack 943, win 17024, length 0     17:00:50.352298 IP Brown.home.54223 > ubuntu-12.home.ssh: Flags [P.], seq 943:995, ack 2152, win 17520, length 52     17:00:50.352316 IP ubuntu-12.home.ssh > Brown.home.54223: Flags [.], ack 995, win 17024, length 0     17:00:50.352579 IP ubuntu-12.home.ssh > Brown.home.54223: Flags [P.], seq 2152:2204, ack 995, win 17024, length 52     17:00:50.361499 IP Brown.home.54223 > ubuntu-12.home.ssh: Flags [P.], seq 995:1063, ack 2204, win 17468, length 68     17:00:50.388593 IP ubuntu-12.home.ssh > Brown.home.54223: Flags [P.], seq 2204:2272, ack 1063, win 17024, length 68     17:00:50.590761 IP Brown.home.54223 > ubuntu-12.home.ssh: Flags [.], ack 2272, win 17400, length 0     17:00:52.960712 IP Brown.home.54223 > ubuntu-12.home.ssh: Flags [P.], seq 1063:1147, ack 2272, win 17400, length 84     17:00:52.999659 IP ubuntu-12.home.ssh > Brown.home.54223: Flags [.], ack 1147, win 17024, length 0     17:00:53.037972 IP ubuntu-12.home.ssh > Brown.home.54223: Flags [P.], seq 2272:2308, ack 1147, win 17024, length 36     17:00:53.038482 IP Brown.home.54223 > ubuntu-12.home.ssh: Flags [P.], seq 1147:1215, ack 2308, win 17364, length 68     17:00:53.038510 IP ubuntu-12.home.ssh > Brown.home.54223: Flags [.], ack 1215, win 17024, length 0     17:00:53.271416 IP ubuntu-12.home.ssh > Brown.home.54223: Flags [P.], seq 2308:2360, ack 1215, win 17024, length 52     17:00:53.271628 IP Brown.home.54223 > ubuntu-12.home.ssh: Flags [P.], seq 1215:1299, ack 2360, win 17312, length 84     17:00:53.271661 IP ubuntu-12.home.ssh > Brown.home.54223: Flags [.], ack 1299, win 17024, length 0     17:00:53.271864 IP Brown.home.54223 > ubuntu-12.home.ssh: Flags [P.], seq 1299:1367, ack 2360, win 17312, length 68     17:00:53.271872 IP ubuntu-12.home.ssh > Brown.home.54223: Flags [.], ack 1367, win 17024, length 0     17:00:53.272369 IP ubuntu-12.home.ssh > Brown.home.54223: Flags [P.], seq 2360:2448, ack 1367, win 17024, length 88     17:00:53.275151 IP Brown.home.54223 > ubuntu-12.home.ssh: Flags [P.], seq 1367:1419, ack 2448, win 17224, length 52     17:00:53.275347 IP ubuntu-12.home.ssh > Brown.home.54223: Flags [P.], seq 2448:2628, ack 1419, win 17024, length 180     17:00:53.279576 IP Brown.home.54223 > ubuntu-12.home.ssh: Flags [P.], seq 1419:1471, ack 2628, win 17044, length 52     17:00:53.279717 IP ubuntu-12.home.ssh > Brown.home.54223: Flags [P.], seq 2628:2728, ack 1471, win 17024, length 100     17:00:53.280194 IP Brown.home.54223 > ubuntu-12.home.ssh: Flags [P.], seq 1471:1539, ack 2728, win 16944, length 68     17:00:53.280339 IP ubuntu-12.home.ssh > Brown.home.54223: Flags [P.], seq 2728:2796, ack 1539, win 17024, length 68     17:00:53.280546 IP Brown.home.54223 > ubuntu-12.home.ssh: Flags [P.], seq 1539:1607, ack 2796, win 16876, length 68     17:00:53.280869 IP ubuntu-12.home.ssh > Brown.home.54223: Flags [P.], seq 2796:3504, ack 1607, win 17024, length 708     17:00:53.281105 IP Brown.home.54223 > ubuntu-12.home.ssh: Flags [P.], seq 1607:1675, ack 3504, win 16168, length 68     17:00:53.281218 IP ubuntu-12.home.ssh > Brown.home.54223: Flags [P.], seq 3504:3588, ack 1675, win 17024, length 84     17:00:53.281416 IP Brown.home.54223 > ubuntu-12.home.ssh: Flags [P.], seq 1675:1743, ack 3588, win 16084, length 68     17:00:53.281543 IP ubuntu-12.home.ssh > Brown.home.54223: Flags [P.], seq 3588:3656, ack 1743, win 17024, length 68     17:00:53.480952 IP Brown.home.54223 > ubuntu-12.home.ssh: Flags [.], ack 3656, win 17520, length 0     17:00:56.881662 IP Brown.home.54223 > ubuntu-12.home.ssh: Flags [P.], seq 1743:1779, ack 3656, win 17520, length 36     17:00:56.881688 IP Brown.home.54223 > ubuntu-12.home.ssh: Flags [F.], seq 1779, ack 3656, win 17520, length 0     17:00:56.881908 IP ubuntu-12.home.ssh > Brown.home.54223: Flags [F.], seq 3656, ack 1780, win 17024, length 0     17:00:56.882061 IP Brown.home.54223 > ubuntu-12.home.ssh: Flags [.], ack 3657, win 17520, length 0      Please let me know in case you require any additional information


How to list prerequisites externally in GNU Make?

How can I query prerequisites of a target from a GNU Make makefile? E.g. if the targets specified like this:               fred: wilma barney betty      I want to print prerequisites of `fred` like this:               $ make some_action fred     wilma barney betty


Finding all storage devices attached to a Linux machine

I have a need to find all of the writable storage devices attached to a given machine, whether or not they are mounted. The dopey way to do this would be to try every entry in `/dev` that corresponds to a writable devices (hd* and sd*). Is there a better solution, or should I stick with this one?


How to check if apt proxy configuration is correct?

I have to use a proxy server which requires authentication. So, I need to update the **apt.conf** file to include my proxy settings. All fine. What I need is to check that the configuration is correct so that when I try _apt-get update_ , I'll connect to the relevant repositories, etc. Is there a way to check this without downloading anything to the PC (without _update_ , _install_ , _upgrade_ , etc.)? In short: I'm looking for a way to just **ping** the repositories without any actual download happening. Any other ways to validate the apt proxy settings is also welcome... **Edit:** I read the manual but I couldn't see the functionality to be available by a simple option/flag. Maybe there is a hack? **Update:** So, far the only solution I have is to **apt-get install** a tiny package and then remove it afterwards. But, I don't really like this approach. What if the package is already installed on the machine? Will apt-get still connect to the repositories (to check if the package is up-to-date)? **Update2:** Apparently there is no solution to all the requirements I put in the question. I'll pick the answer with the closest to what I want.


How to add multiple email adresses to an SSL certificate via the command line?

I know that by adding/modifying the `SubjectAltName` entry in `openssl.cnf` this can be achieved, but is there a way to do so without having to modify that file every time?


Audio stopped working in Xine in Debian

Recently sound stopped working in all the Xine-based applications. I get the error: `the audio device is unavailable`. I am using latest Debian Testing with KDE. I haven't been fiddling with the configuration recently, just doing the updates.


kgdb not returning control to gdb

I've compiled a kernel with kgdb support and I'm trying to debug it. I have two machines running, a debug machine (running the kgdb kernel) and the machine I'm using to debug it. They are connected via two serial cables. I can operate the debug machine's serial console through ttyS0 (on both machines) and I can connect to kgdb with gdb over ttyS1 (on both machines). This works fine up until a point: I boot the debug machine; it waits for gdb to connect; gdb connects; I can set breakpoints or whatever using gdb; I tell gdb to continue; and the kernel continues to boot. The problem is when I next hit a breakpoint gdb doesn't seem to realize that a breakpoint has been hit. The kernel stops when it's meant to, but gdb doesn't do anything. It just sits there as if nothing has happened. Does anyone know what might cause this?


Kernelpanic Fedora 18 with kernel 3.9.2-200

Since upgrading to kernel 3.9 I now get this error every time at start up:               BUG: unable to handle kernel NULL pointer dereferences at       (null)     IP[<ffff8800ca93bfcd>] 0xffff8800ca93bfcc     PGD 0     Oops: 0002 [#1] SMP     Modules linked in:     CPU 3     Pid: 1, comm:swapper/0 Not tainted 3.9.2-200.fc18.x86_64 #1 LENOVO 2191/INVALID      The 3.8 version of the kernel worked well for me. So my question is what can I do to start the 3.9 kernel?


How to associate device to sata port disk

I have 2 hard disks connected to 2 sata ports. The disks are associated to /dev/sda and /dev/sdb. These hard disks are in software raid so it happens that the system can go for some time with only one disk and then the second disk is added again to the array. I need to be able somehow to display the information:               /dev/sda -> is sata port 0 or 1     /dev/sdb -> is sata port 0 or 1      but I cannot understand how to do it, can anybody help me out? I'm running ubuntu server 12.04.2.


How to keep track of which files are currently growing in directory

I have a local filesystem which is exported rw with nfs (very big xfs partition). Somewhere (I cannot determine who or what remote process) files are being written, created new or updated appending more data; and the free disk space is quickly running low. To identify what files I could move somewhere else safely, I though about command like:               find . -type f -mtime +15 -size +100M     find . -type f -mmin -2       but is there a general way to call find or any other system utility to track which file is currently growing/being written (remotely)?


Installing from source - do I need to keep the extracted tarball directory

If I'm installing from source, do I need to keep the extracted tarball directory? So if I download the git tarball. I then do:               tar -xvzf git.tar.gz      This will create a `git.x.x`. directory, into which I `cd`, then run `./configure` etc. Once I'm done with this process, and `git`, or whatever is installed, do I need to keep the original `git.x.x` extracted directory, or is that just used for compiling the program? I'm somewhat confused by all the directories, and folders used for programs.


Cleaning after installation

Is it safe to remove the downloaded tar once the program is installed (once I run ./configure, make, make install)?


system lock up when storage go offline when using nfs mount options bg,hard,nointr

I had the following mount option defined on my system. In the event of any storage outage would these `(bg,hard,nointr)` causes to lock the console access?                       storage:/vol/myvol on /test type nfs (rw,bg,hard,nointr,rsize=65536,wsize=65536,tcp,nfsvers=3,timeo=600)      What combination of nfs options are consider right practice?


Join 2 files on 2 columns returning 0s

I have 2 files, that are sorted, with 3 columns each. I need to merge them based on the first 2 columsn and return 4 columns, being the 2 that are matching and then the 3rd column from each file. I have tried to do in awk using               awk 'NR==FNR{a[$1FS$2]=$3;NEXT}    {k=$1FS$2;print k,(a[k]?a[k]:a[k]*1),$3;delete a[k]}         END{for(k in a)print k,a[k],"0"}'       but it is not working how I hoped. my input files look like this: File 1:               Chr BPPos Chip_1     1 1234 1     1 1765 2     1 2043 3     2 1231 4      File 2:               Chr BPPos Chip_2     1 1765 1     1 2074 2     2 1231 3     2 2141 4      Desired Output:               Chr BPPos Chip_1 Chip_2     1 1234 1 0     1 1765 2 1     1 2043 3 0     1 2073 0 2     2 1231 4 3     2 2141 0 4


ssh public key copying

This question is repeating from Stack Overflow because i don't get answer from there. I'm trying to make a simple script that will import the public key to other servers. I have made 2 options you can choose. One is using ssh-copy-id, and the other is simple copy the pub key to the file on the other server. The second one works ok but I cant make this to work wiht ssh-copy-id. This is what I have for now:               ssh-copy-id -i $var1 $i      Where $var1 is "/path/to/the/public_key.pub" and $i is the servers where they are written in a txt file. The whole idea is I have my pub keys everywhere and I like to enter the pub key of a new admin guy everywhere. And it works ok but when I execute I have to enter my password. Any solution to do this with one time entering the password. And also I like to enter new line before adding the key. But I can't find solution how to do this with ssh-copy-id


How to decrease the time the processes would wait (blocked) for disk reads (only to discover an error)?

Waiting too long when encountering an unreadable sector on a disk is really very annoying. (Especially if you are trying to read as much data as can be read from a disk with bad sectors, and do it quickly, for backup and restoration.) The disk reports read errors (sense errors). Can the disk (ATA) be setup so that a failing read doesn't take too long, so that it can be dropped, and the reading process and the disk wouldn't be blocked, and the next read could be attempted? Or perhaps the linux disk driver can be set up to achieve this? Or the reading process in linux can do something to avoid long reading?


Recover files after moving directory names?

During the course of some testing, I ran the bast script               for file in *; do         mv -v "$file" "$file#_*"     done      or something along those lines. The plan was to remove a prefix from directory names but I accidentally ran it in my home directory rather than in the test directory I had created... My understanding is that all of the files inside directories should be "safe" (as in, not deleted), but that I now have no way to access them via a directory structure. Is there a way to recover these files? Thanks in advance. **UPDATE** It appears my memory was incorrect: the command in the `for` loop was actually `echo mv ...`. Somehow, all the directories and file in ~ were moved to my Videos directory, but appear to be intact.


How to catch optioned and non optioned arguments correctly?

I want to write a shell script which will take some arguments with some options and print that arguments. Suppose the name of that script is `abc.ksh`. Usage of that script is -   `./abc.ksh -[a <arg>|b <arg>|c|d] <some_string>`   Now I write a shell script which will take options and arguments               #!/bin/ksh          # Default Values     vara=","     varb=false     varbname=""     varc=false          # Scanning inputs     while getopts :a:b:cd option     do             case $option in                     a) vara=$OPTARG;;                        #shift $((OPTIND-1));;                     b) varb=true                        varbname=$OPTARG;;                        #shift $((OPTIND-1));;                     c) varc=true;;                        #shift $((OPTIND-1));;                     d) echo "Usage $0 \-[a|b|c|d] <filename>"                        exit 0;;                     \?) echo "Invalid option -$OPTARG. Please run '$0 -h' for help"                         exit 1;;                     :) echo "Option -$OPTARG requires an argument. Please run '$0 -d' for help"                        exit 1;;     esac     done          print "Args: $* \nvara: $vara \noptfile: $varb \nvarbname: $varbname \nvarc: $varc"      **Examples of Correct Inputs:**   * `./abc.ksh -a "sample text" "some_string"`   * `./abc.ksh "some_string" -a "sample text"`   * `./abc.ksh -asample\ text some_string`   * etc...  `some_string` input is not catch in my script. How can I catch that?