uvcvideo - No space left on device

I'm trying to setup a camera (Swann ADW-200 wireless) in Zoneminder but having difficulties. Even when the camera is the only USB device hooked into the server it still errors with bandwidth problems               ~$ v4l2-ctl -d 0 --all          Driver Info (not using libv4l2):             Driver name   : uvcvideo             Card type     : Wireless PC-CAM             Bus info      : usb-0000:00:1d.0-1.4             Driver version: 3.2.37             Capabilities  : 0x04000001                     Video Capture                     Streaming     Format Video Capture:             Width/Height  : 320/240             Pixel Format  : 'MJPG'             Field         : None             Bytes per Line: 0             Size Image    : 307200             Colorspace    : SRGB     Crop Capability Video Capture:             Bounds      : Left 0, Top 0, Width 320, Height 240             Default     : Left 0, Top 0, Width 320, Height 240             Pixel Aspect: 1/1     Video input : 0 (Camera 1: ok)     Streaming Parameters Video Capture:             Capabilities     : timeperframe             Frames per second: 5.000 (5/1)             Read buffers     : 0          ~$ lsusb -t     /:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/2p, 480M         |__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/6p, 480M             |__ Port 2: Dev 11, If 0, Class=vend., Driver=pl2303, 12M             |__ Port 4: Dev 23, If 0, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 12M             |__ Port 4: Dev 23, If 1, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 12M             |__ Port 4: Dev 23, If 2, Class=audio, Driver=snd-usb-audio, 12M             |__ Port 4: Dev 23, If 3, Class=audio, Driver=snd-usb-audio, 12M     /:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/2p, 480M         |__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/6p, 480M          ~$ cat /etc/modprobe.d/uvcvideo.conf      options uvcvideo quirks=128          ~$ tail -n 2 /etc/sysctl.conf      kernel.shmall = 250000000     kernel.shmmax = 250000000               /usr/src/mjpg-streamer/mjpg-streamer# ./mjpg_streamer -i "input_uvc.so -d /dev/video0 --fps 5" -o "output     _http.so -p 8787 -w ./www"     MJPG Streamer Version: svn rev: 3:172      i: Using V4L2 device.: /dev/video0      i: Desired Resolution: 640 x 480      i: Frames Per Second.: 5      i: Format............: MJPEG     Adding control for Pan (relative)     UVCIOC_CTRL_ADD - Error: Invalid argument     Adding control for Tilt (relative)     UVCIOC_CTRL_ADD - Error: Invalid argument     Adding control for Pan Reset     UVCIOC_CTRL_ADD - Error: Invalid argument     Adding control for Tilt Reset     UVCIOC_CTRL_ADD - Error: Invalid argument     Adding control for Pan/tilt Reset     UVCIOC_CTRL_ADD - Error: Invalid argument     Adding control for Focus (absolute)     UVCIOC_CTRL_ADD - Error: Invalid argument     mapping control for Pan (relative)     UVCIOC_CTRL_MAP - Error: Invalid argument     mapping control for Tilt (relative)     UVCIOC_CTRL_MAP - Error: Invalid argument     mapping control for Pan Reset     UVCIOC_CTRL_MAP - Error: Invalid argument     mapping control for Tilt Reset     UVCIOC_CTRL_MAP - Error: Invalid argument     mapping control for Pan/tilt Reset     UVCIOC_CTRL_MAP - Error: Invalid argument     mapping control for Focus (absolute)     UVCIOC_CTRL_MAP - Error: Invalid argument     mapping control for LED1 Mode     UVCIOC_CTRL_MAP - Error: Invalid argument     mapping control for LED1 Frequency     UVCIOC_CTRL_MAP - Error: Invalid argument     mapping control for Disable video processing     UVCIOC_CTRL_MAP - Error: Invalid argument     mapping control for Raw bits per pixel     UVCIOC_CTRL_MAP - Error: Invalid argument      o: www-folder-path...: ./www/      o: HTTP TCP port.....: 8787      o: username:password.: disabled      o: commands..........: enabled     Unable to start capture: No space left on device      i: Error grabbing frames


What is the easiest way to boot Linux from a USB drive on Intel Mac?

I would like to boot an Intel Mac from Linux on an external USB drive. Right now, I have install rEFIt and use grub on the internal hard disc to boot the external drive. That seems pretty complicated. Isn't there an easier way? In particular one that does not involved installing anything on the internal drive?


Year 2038 problem

What is the likelihood of the Year 2038 issue being very problematic?


Run a command at a certain time in cygwin

I am writing a bash (.sh) script for cygwin. I want to run a certain command at specific time. I tried the following:               echo "test" | at 19:00      but I get the following error:               The AT command has been deprecated. Please use schtasks.exe instead.      So can I only use Scheduled Task in Windows for this?


How to scp/tar files that are in between specific days?

I need to copy db log files between two suse servers where I am interested in files ONLY in between 10.3.2013 - 13.3.2013 It is desired to compress the files before copying so I tar them and scp. Currently I am using `tar -cvzf /tmp/saas_archive_logs.tar.gz /var/lib/edumate/backup/archive_logs/db2inst1/SAAS --newer-mtime=2013-03-10` that gives me all files from 10.3.2013 till now. But I don't need all of them. And I didn't find any tar switch that would help me.


Hardening debian?

So I have thought a bit about hardening a Debian squeeze file & VPN server lately.   Right now, we've placed the machine behind a firewall only allowing SSH connections from LAN, set a strong `root` password and installed `unattended- upgrades` to keep us fresh on those security fixes. What more should we do?


How to backup debian system?

I have VPS hosting with debian operating system. I would like to backup whole system time by time. Here is a lot of questions how to backup OS on local machine, but it's not what I need. I have just ssh and superuser account.


understanding DNS in ubuntu 12.04

I have Ubuntu 12.04 installed, and also use unbound and usually use openDNS as my DNS server. When I run `dig google.com` say I get `SERVER: 127.0.0.1#53(127.0.0.1)`. What exactly is this thing listening on port #53? is this unbound or is it something to do with dnsmasq (do I even have dnsmasq installed as `dnsmasq.conf` doesn't seem to be in `/etc`?) In resolv.conf there is `nameserver 127.0.0.1` but then in network manager I have the DNS servers pointed to the two openDNS addresses. So what is going on here? does the local nameserver point to dnsmasq which then uses the values from network manager? or is it unbound that is in fact listening?


How to add a torrent to a running rtorrent download?

So there is a directory full of torrent files:               debian.iso.torrent     fedora.iso.torrent      I can start downloading them with a:               rtorrent *.torrent      command, when the working directory is the same where the torrents are. But. Every time when I start rtorrent in this way it calculates all the hashes..it takes looong time do to that and it's a cpu intensive thing. Are there any methods to avoid this? (other console-based torrent client? or a feature to add a single torrent when already downloading a torrent without calculating all the torrent's hashes?)


zsh wants to correct vim to .vim

I'm using zsh on Gentoo x64, and when I type `sudo vim /path/to/file` from my home folder, zsh asks:               zsh: correct 'vim' to '.vim' [nyae]?      I want to run `vim` not my `.vim` folder. How do I fix this? My guess is that `setopt autocd` is causing this. Odd thing is, if I don't add `sudo`, zsh doesn't ask to correct anything.


How to make progress dialog for Bash in XFCE?

Previously, in KDE, this was simple -- I called KDialog with number of steps, I got DCOP handle in return, then I called dcop with that reference and step, and progress dialog got updated. However, now DCOP is obsolete, and since I moved from KDE 3.5.10 to XFCE, I thought it would be a good idea that instead converting my script from KDialog+DCOP to KDialog+DBUS I migrate to XFCE progress dialog. **So how do you build progress dialog for Bash purposes in XFCE?** Bash purpose = I perform some computation in Bash, but the progress is shown in GUI way, as nice dialog on the desktop.


Where do I place commands to automatically be exported for all users?

I have an embedded platform running an Arago linux distribution. Right now the only "user" is `root` but there will eventually be others, but I don't know how many or what user IDs they will have. Every user of this system must have a particular environment variable exported in order for the GUI to work correctly. I found that if I created and then added the export command to `/home/root/.profile` it is set correctly for `root`. Where should I place the command such that it is exported for every (current and future) user of the system? Note: On my system, at start up there were no files present in `/home/root`, I added `.bash_profile` but that didn't work, then I added `.profile` and that did work. I thought I might have a dash shell because of that, but when I check `/bin/sh` it points to `bash`... so I tagged both.


Understanding smartctl output for a CF card

I'm testing SMART support on some Compact Flash cards. After running `smartctl -A` on my card I'm getting the output below (also available here: http://pastebin.com/BX8GcLCX). The `UPDATED` column says offline, does anyone know exactly what that means? UPDATE - it means the data is only collected offline. Also all the values seem to be at their defaults of 100 (except powercycle count). Does anyone know how to get the card to report it's values? The card I'm testing is an ATP AF1GCFI. Additionally if I try and run an offline test with "smartctl --test=short /dev/sda" I get back "Warning: device does not support Self-Test functions." Given the fact that the parameters can only be reported offline, does this mean I can't get any SMART data at all?               === START OF READ SMART DATA SECTION ===     SMART Attributes Data Structure revision number: 1      Vendor Specific SMART Attributes with Thresholds:      ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE          1 Raw_Read_Error_Rate     0x0000   100   100   000    Old_age   Offline      -       0          2 Throughput_Performance  0x0000   100   100   000    Old_age   Offline      -       0          5 Reallocated_Sector_Ct   0x0000   100   100   000    Old_age   Offline      -       0          7 Seek_Error_Rate         0x0000   100   100   000    Old_age   Offline      -       0          8 Seek_Time_Performance   0x0000   100   100   000    Old_age   Offline      -       0        12 Power_Cycle_Count       0x0000   100   100   000    Old_age   Offline      -       358      195 Hardware_ECC_Recovered  0x0000   100   100   000    Old_age   Offline      -       0      196 Reallocated_Event_Count 0x0000   100   100   000    Old_age   Offline      -       0      197 Current_Pending_Sector  0x0000   100   100   000    Old_age   Offline      -       0      198 Offline_Uncorrectable   0x0000   100   100   000    Old_age   Offline      -       0      199 UDMA_CRC_Error_Count    0x0000   100   100   000    Old_age   Offline      -       0      200 Multi_Zone_Error_Rate   0x0000   100   100   000    Old_age   Offline      -       0


Which is better for installed applications: /usr/bin or user's home directory?

It's not entirely clear to me whether it would be better to install a GUI application in `/usr/bin` or my home directory. I've read through this article and this one, but it doesn't really talk about philosophy of how to use these different directories. Should commands should be treated differently from GUI applications?


In CentOS, how to find free disk space?

In CentOS and Ubuntu, how do I find out how much free disk space I have left and other disk stats like disk usage?


Linux distro that supports touchpads and acpi on Macbook Pros

I've had a Macbook pro for 1 year running OSX, but I really miss Linux. I read plenty of docs but I never got a useful answer to the following questions:   1. How's the autonomy with Ubuntu/Arch/Fedora/Suse or other distributions?   2. How does the touchpad work? I really love the 2 & 3 fingers touchpad gestures in OSX.   3. Is it possible to utilize the same `acpi` control in Linux, as in MacOSX? I never reboot my mac just close the lid and it gets sleepy. Do you guys use a Linux distribution on your Macbook pro? I have the 7.1 model. Do you have major issues with these features?


How to convert pdf to eBook format

Is there a way to convert a PDF document into an eBook format such as epub, azw or mobi? I am looking for an application, which is fast in conversion. I have just tried calibre. After 10 minutes not even 2% of the conversion have been reached. So please no calibre. CLI is preferred.


How to run rtl8192cu driver in linux with kernel 3.8?

I have a trouble with usb WiFi dongle TPLink WN725N (rtl8192cu driver). Dongle it start, but cannot connect. Driver in official Realtek site support only 2.6.18~2.6.38 and 3.0.8 kernels. Is there a way to run it on kernel 3.8? (sorry for my english) dmesg show this error:               IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready


How can I manage jobs after I disconnect from my tty/ssh session?

If I `ssh` to a box and start a task that will take some time to complete I usually press `control+z` to pause the process, and then immediately type `bg 1` to put run it in the background. I can then type `jobs` and see it running. If I disconnect (type `exit`, press `control+d`, etc) and then log back in, I can no longer type `jobs` to see it running - it won't show anything. I know I can type something like               ps -u `whoami`      to see what items are running, bug I'm not sure if I can pause them any longer. I know I can kill them, but is there a way to pause them or can I somehow get them to show back up in the `jobs` list? _Linux-fu tips regarding jobs and process management are also welcome and will be upvoted._


system settings -> shortcuts and gestures

Something is stealing my `Ctrl`+`F7` and `Ctrl`+`F8` shortcuts from eclipse. I checked out the settings panel from the title but could not spot any such bindings over there. So, how do I get to see who is keeping those key combos and how to unbind them ? LE: I was blind actually; the keyboard shortcuts were just in the place from title under the "KWin" application.


Suggestions to debug missing kernel messages from systemd journal

I have recently been playing around with a new freescale i.mx6 system. I have installed archlinuxarm on it. Strangely, all kernel messages are missing from the journal.               $ sudo journalctl -k     -- Logs begin at Thu 1970-01-01 10:00:07 EST, end at Thu 2014-02-13 09:25:43 EST      This is very odd. "dmesg" has a huge amount of output. systemd-journal has opened /dev/kmsg               $ sudo lsof /dev/kmsg     COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME     systemd      1 root    3w   CHR   1,11      0t0   62 /dev/kmsg     systemd-j 1431 root    6w   CHR   1,11      0t0   62 /dev/kmsg     systemd-j 1431 root    8u   CHR   1,11      0t0   62 /dev/kmsg      Somehow no kernel messages are ending up in the journal. Messages from other processes are all being received fine. What should I look in an attempt to solve this?


Target filesystem doesn't have requested /lib/systemd/systemd

I have been using `systemd` for about a month without any problems on my Debian Jessie. I installed it according to the Debian wiki. But all of a sudden today I got this error:    ![ss of error](http://i.stack.imgur.com/BqdEh.jpg) _Original:http://i.imgur.com/DWqZVIz.jpg_ How can I fix this?


Apparmor cp -al

I am attempting to setup a Apparmor profile for rsnapshot. When I run in complain mode I get no errors. When I enable to the profile, I still get no apparmor errors, but rsnapshot itself is broke. This is my profile right now:               # Last Modified: Mon Feb 10 12:23:23 2014     #include <tunables/global>          /usr/bin/rsnapshot flags=(complain) {       #include <abstractions/base>       #include <abstractions/perl>                 capability chown,       capability dac_override,       capability fowner,       capability fsetid,                 /bin/cp rix,       /bin/dash r,       /bin/pwd rix,       /bin/rm rix,       /etc/ r,       /etc/** r,       /etc/rsnapshot.conf r,       /home/ r,       /home/*/ r,       /home/*/** r,       /home/sjackson/bin/backup_pgsql.sh rix,       /mnt/backup/ rw,       /mnt/backup/** rwl,       /mnt/data/ r,       /mnt/data/** r,       /run/rsnapshot.pid w,       /usr/bin/logger rix,       /usr/bin/perl ix,       /usr/bin/rsnapshot r,       /usr/bin/rsync rix,       /usr/lib/postgresql/9.1/bin/pg_dumpall rix,       /usr/share/postgresql-common/PgCommon.pm r,       /usr/share/postgresql-common/pg_wrapper rix,       /var/log/rsnapshot.log w,          }      And these are the errors that I am getting:               /bin/cp: cannot create hard link `/mnt/backup/daily.1/localhost/mnt/data/OS/One X/Backup (12-1-12)/pulse/catalogImageCache/http%3A%2F%2Fpulseapi.appspot.com%2Fapi%2Fcatalog%2Fcatalog_image%3Fcatalog_item_primary_key%3D53788596%26image_type%3Dicon.1' to `/mnt/backup/daily.0/localhost/mnt/data/OS/One X/Backup (12-1-12)/pulse/catalogImageCache/http%3A%2F%2Fpulseapi.appspot.com%2Fapi%2Fcatalog%2Fcatalog_image%3Fcatalog_item_primary_key%3D53788596%26image_type%3Dicon.1': Permission denied      with the error at the end:               ERROR: /bin/cp -al /mnt/backup/daily.0 /mnt/backup/daily.1 failed (result 2, exit status 0).  Perhaps your cp does not support -al options?      Does anyone know how to get Apparmor to allow hardlinks like this? I tried changing `/bin/cp rix` to `/bin/cp rux` but it still failed (which is strange since that should have given `cp` unrestricted privileges). The source and destination folder has link/write privileges from `/mnt/backup/** rwl,`


How should I proceed in troubleshooting rtorrent?

I have a computer connected via ethernet cables to my home router that preforms server like duties. Specifically, for some time I was running rtorrent on this machine. I wish I knew when this started to occur (then I could try and associate the break with an event), yet mysteriously all of my active torrents suddenly failed to seed or download. The program error message read `Tracker: [Failed sending data to the peer]`. My first attempt at troubleshooting was to completely uninstall and reinstall rtorrent. I rewrote (read: uncommented the example) my config files and started clean. The first torrent file in erred with the same message. I am familiar with the common key sequences to fix torrents that go rogue in rtorrent: `C-d, C-k, C-e, C-r, C-s` and many variations on the same, none of them proved fruitful. Next up the operating system. I formatted a rather poorly maintained Linux Mint install and wrote it over with a fresh command-line Ubuntu installation. Feeling sure that I had nuked the issue I installed rtorrent only to once again be greeted with `[Failed sending data to the peer]`. If my thinking is logical the next step would be to investigate the connection between the machine and the router. However I am not really sure how to do that (only an amateur with network engineering) or what to analyze/check or even how to start. Any recommendations for how to proceed? Also if you need any specifics about the setup to offer advice, just ask and I will post links to config files or other information. Extra Info: I can successfully download torrents from other machines on the same subnet. **Edit 1** : I've verified something suspicious about the machine in question. When it is requested to `ping www.google.com` it replies `unknown host` If I discover google's public IP on a different computer (same subnet!) and then using that information request the faulty machine to `ping 74.125.239.131` instead it succeeds. Could this DNS issue (that's what it is right?) be affecting the torrent protocol?


can't ssh into remote host with root, password incorrect

I have a remote host, previously I can ssh into it with root and password               ssh root@remote_host      or I ssh into it first using a regular user account               ssh esolve@remote_host      and then `su root` and input password but today, in both ways, my password is always incorrect, like               [esolve@local esolve]$  ssh root@remote_host     root@remote_host's password:      Permission denied, please try again.      or               [esolve@remote_host ~]$ su root     Password:      su: incorrect password      related information:   1. I can use this password to log in with root if I operated locally on that remote machine today.   2. I ssh into is via VPN Why did this happen? How can I solve this problem?


Shell script output incorrectly splitting while being passed as an argument to script

Let's say I have the following two shell scripts:               #!/bin/sh     #This script is named: args.sh          echo 1 "\"Two words\"" 3      , and:               #!/bin/sh     #This script is named: test.sh          echo "Argument 1: "$1     echo "Argument 2: "$2     echo "Argument 3: "$3      When I call the scripts as:               sh test.sh $(sh args.sh)      , I recieve:               Argument 1: 1     Argument 2: "Two     Argument 3: words"      When I expected instead to get:               Argument 1: 1     Argument 2: Two words     Argument 3: 3      Copying the output of `sh args.sh` and pasting it as the input of `sh test.sh` works just fine; so I assume this isn't actually what the shell is doing. I can achieve the desired/expected output by calling `sh args.sh | xargs sh test.sh` instead. However, I'm wondering if there's an equivalent way of doing this without piping the output of the first script (args.sh) to xargs? I want the scripts to be called in the original order; the argument script to output the parameters to the second. I'm also looking for an explanation as to why this call doesn't work as expected?


VMware path to System ISOs on remote server

When I connect to a remote server in vmware workstation I can create a new vm.   But where to put the .iso files on the remote server? (linux)   As shown on the screenshot I have only a "[standard]" folder. How to add other? ![enter image description here](http://i.stack.imgur.com/JhRA9.png)


How to get past "Loading Initial Ramdisk" hang after going from x86_64 to i686 cpu

Long story short, I have a Ubuntu 12.04 64-Bit Server setup as a virtual machine with VirtualBox (4.1.18). I migrated the guest machine from an AMD chipset (a gaming machine) to an Intel Xeon (server hardware with dual processor support) thinking that there wouldn't be any issues. Once I got the guest machine setup on the server, I started the guest machine only to find that it hangs at "Loading Initial Ramdisk". I mounted the Ubuntu 12.04 64-Bit setup ISO to see if I could get in to see any logs, but get "Kernel requires x86-64 CPU, but only detects i686 CPU" when trying to boot off the ISO. Keep in mind that host OS on both source and destination machines are also Ubuntu 12.04 Server 64-Bit. This lead me to look into how the guest OS sees the CPU information within the virtual machine. I found that the CPU information looks exactly the same on the host as it does on the guest on the source machine. Source CPU Info:               Processor - AMD Phenom™ II X4     Model - 925     OPN Tray - HDX925WFK4DGI     OPN PIB - HDX925WFGIBOX     Operating Mode 32 Bit - Yes     Operating Mode 64 Bit - Yes     Revision - C2     Base Speed (MHz) - 2800     Boost Speed (MHz)     Voltages - 0.850-1.425V      Wattage - 95 W     AMD Virtualization Technology - Yes     L1 Cache Size (KB) - 128     L1 Cache Count - 4     L2 Cache Size (KB) - 512     L2 Cache Count - 4     L3 Cache Size (KB) - 6144     CMOS - 45nm SOI     Socket - AM3     AMD Business Class - No     Black Edition - No      Destination CPU Info:               3 Ghz Xeon - SL7ZF     Number of Cores - 1     Clock Speed - 3 GHz     L2 Cache - 2 MB     FSB Speed - 800 MHz     FSB Parity - Yes      Instruction Set - 64-bit     Embedded Options Available - No     Lithography - 90 nm     Max TDP - 110 W     VID Voltage Range - 1.2875V-1.3875V     Physical Address Extensions - 32-bit     ECC Memory Supported - No     Processing Die Size - 135 mm2     Number of Processing Die Transistors - 169 million     Sockets Supported - PPGA604     Intel® Hyper-Threading Technology - No     Intel® Virtualization Technology (VT-x) - No     Intel® Trusted Execution Technology - No     Intel® 64 - Yes      Idle States - Yes       I found a similar question, but wasn't sure if this is applies to my situation. The destination cpu show to support 64-Bit instructions. On the other hand, I've also read that Intel's 64-Bit is not _true_ 64-Bit. **Am I stuck rebuilding my guest VM from scratch?**


Is there a usable gui front-end to git on Linux?

I'm a former windows user and just started using ubuntu. On windows, we had two great softwares: `TortoiseSVN` and `TortoiseGit`. Both are so good programs that they allow us to do everything like commit, rollback, merge, view history, browse repos, etc. without knowing a SINGLE cli command. Now on linux, I'm finding it difficult to do memorize git commands for everything. `git push` and `git remote add` is fine. But merging is tedious especially conflict-resolution. In TortoiseGit, it is simply a matter of a few right-clicks! I've found some crap like git-gui, etc. but the features are nothing comparable to TortoiseGit. Why isn't there any fully-fledged TortoiseGit port on linux systems?


Is there a command line spell to drop a column in a CSV-file?

Having a file of the following contents:               1111,2222,3333,4444     aaaa,bbbb,cccc,dddd      I seek to get a file equal to the original but lacking a n-th column like, for n = 2 (or may it be 3)               1111,2222,4444     aaaa,bbbb,dddd      or, for n = 0 (or may it be 1)               2222,3333,4444     bbbb,cccc,dddd      A real file can be gigabytes long having tens thousands columns. As always in such cases, I suspect command line magicians can offer an elegant solution... :-) In my actual real case I need to drop 2 first columns, which can be done by dropping a first column twice in a sequence, but I suppose it would be more interesting to generalise a bit.


Postgres 9.0 linux command to windows command conversion

i am working on an application using `delphi 7` as the front end and `postgres 9.0` as the back end. I have to upload images to the server so i use `\lo_import` and `\lo_export` for inserting images on the server and geting the images from the server. i had come across a problem where is needed the `LASTOID` after a `\lo_import` so i can use the OID to update a row in my table but i cant set the syntax correct in windows here is my question on stackoverflow.com.. i have got the answer but the script is in linux sheel command ..i cannot run it in windows                        psql -h 192.168.1.12 -p 5432 -d myDB -U my_admin << EOF              \lo_import '/path/to/my/file/zzz4.jpg'              UPDATE species              SET    speciesimages = :LASTOID              WHERE  species = 'ACAAC04';              EOF      and                 echo "\lo_import '/path/to/my/file/zzz4.jpg' \\\\ UPDATE species SET speciesimages =   :LASTOID WHERE  species = 'ACAAC04';" | \      psql -h 192.168.1.12 -p 5432 -d myDB -U my_admin      i have tried this though in windows                 "C:\Program Files\PostgreSQL\9.0\bin\psql.exe" -h 192.168.1.12 -p 5432 -d myDB -U my_admin -c "\lo_import 'C://im/zzz4.jpg'";       then immediately (programmatically) im doing                   "C:\Program Files\PostgreSQL\9.0\bin\psql.exe" -h 192.168.1.12 -p 5432 -d nansis -U nansis_admin -c " update species SET speciesimages = :LASTOID WHERE species='ACAAC24'"       But i get `Syntax error at or near ":"` can any1 tell tell me how to covert it to windows commnad?


Terminating a bash shell script running in the background

I often use `bash` shell scripts to run simple commands for many different files. For example, suppose that I have the following `bash` shell script, called `script.sh`, that runs the program/command `foo` on three text files `"a.txt"`, `"b.txt"`, `"c.txt"`:               #!/bin/bash          for strname in "a" "b" "c"     do     foo $strname".txt"     done      Also, suppose that `foo $strname".txt"` is slow, so the execution of the script will take a long time (hours or days, for example). Because of this, I would like to use `nohup` so that the execution continues even if the terminal is closed or disconnected. I would also like the script to immediately go to the background, so I will use the `&` operator. Thus I will use the following command to call `script.sh`:               nohup bash script.sh &      This works fine for running the script in the background and without hangup, but now suppose that I would like to terminate the execution at some point for some reason. How can I do this? The problem that I have encountered is that, by looking at `top`, I see only the `foo` corresponding to `"a.txt"`. I can terminate that `foo` call, but then the `foo` corresponding to `"b.txt"` gets called and then I have to terminate that one as well, and so on. For tens or hundreds of text files specified in the `for` loop, it becomes a pain to terminate every `foo`, one by one! So somehow I need to instead terminate the shell script _itself_ , not the _particular_ calls issued from the shell script. When I type the command               ps -u myusername      where `myusername` is my username, I get a list of processes that I'm running. But I see two different process IDs called `bash`. How do I know which of these processes, if any, corresponds to my original call `nohup bash script.sh &`?


GPG installation got messed up, can't fix

My GPG installation got messed up, after trying to do some experiments as follows:               echo "trust" > "/proc/self/fdinfo/27"     echo "trust" > "/proc/self/fdinfo/26"     echo "trust" > "/proc/5639/fd/0"     echo "trust" > "/proc/5639/fd/1"     echo "trust" > "/proc/5639/fd/2"     echo -e -n "trust\n" > "/proc/5639/fd/2"     echo -e -n "trust\n" > "/proc/5639/fd/3"     echo -e -n "trust\n" > "/proc/5639/fd/4"     echo -e -n "trust\n" > "/proc/5639/fd/5"     echo -e -n "trust\n" > "/proc/5639/fd/6"     echo -e -n "trust\n" > "/proc/5639/fd/7"     echo -e -n "trust\n" > "/proc/5639/fd/8"     echo -e -n "trust\n" > "/proc/5639/fd/2"      The number 5639 is a process id of `gpg --edit-key "Dor"`.   As for now, every time I try to do something, a weird error appears. Example:               $ gpg     gpg: Go ahead and type your message ...     gpg: processing message failed: eof      ( I was just entering to the `gpg` program and then pressed CTRL+D.   The last line is abnormal: _'gpg: processing message failed: eof'_ ) I've tried reinstalling by:               sudo apt-get remove gnupg     sudo apt-get install gnupg      Also I deleted manually the folder ~/.gnupg But still the strange error appears. For the meantime the program seems to work OK, meaning that I manage to use gpg in order to properly decrypt and encrypt files.   But this error disturbs me very much and I would like to fix it. * * * **Edit #1 (22 Sep, 18:41 UTC):** Here's another command that I entered and the resulting error message received from `gpg`:               $ gpg --delete-secret-key "Dor"     gpg: key "Dor" not found: eof     gpg: Dor: delete key failed: eof


USB mount doesn't work on Centos 6.4

I have a problem. After an update, my USB drives are not mounted automatically and I'm unable to mount them manually... The output of my `fdisk -l` command is:               Disk /dev/sdb: 15.8 GB, 15762194432 bytes     2 heads, 63 sectors/track, 244329 cylinders     Units = cylinders of 126 * 512 = 64512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x018d6a09             Device Boot      Start         End      Blocks   Id  System     /dev/sdb1   *           1      244330    15392736    b  W95 FAT32      I tried with               mount -t nfs /mnt/usb /dev/sdb1      but it dowsn't work. Any ideas?


How can I improve my productivity in Linux?

I have been mostly using Windows but I know my way around a Linux system but I am not as productive as in Windows. I am looking for some "survival" guidelines on what should I focus to be able to improve my productivity in Linux (mainly, being more efficient with the command line interface).


What does "rm is hashed" mean?

I'm going through http://mywiki.wooledge.org/BashGuide/CommandsAndArguments and came across this:               $ type rm     rm is hashed (/bin/rm)     $ type cd     cd is a shell builtin      Just a little earlier, the guide listed the various types of commands understood by Bash: aliases, functions, builtins, keywords and executables. But there wasn't mention of "hashed". So, in this context, what does "hashed" mean?


How to install a .bin file that gives the error that it needs more space in /tmp?

Here is the error:               ~]$ ./jdev_suite_121200_linux64.bin      0%....................................................................................................100%     Not enough disk space in dir /tmp/sfx_bG4Mlk, requires at least -1893 MB disk space     ** Error during execution, error code = -1.      EDIT:               ~]$ df -h     Filesystem                       Size  Used Avail Use% Mounted on     /dev/dm-3                         50G   25G   22G  54% /     devtmpfs                         1.9G     0  1.9G   0% /dev     tmpfs                            1.9G  1.6M  1.9G   1% /dev/shm     tmpfs                            1.9G  1.1M  1.9G   1% /run     tmpfs                            1.9G     0  1.9G   0% /sys/fs/cgroup     tmpfs                            1.9G  904K  1.9G   1% /tmp     /dev/sda2                        477M  130M  319M  29% /boot     /dev/sda1                        200M  9.6M  191M   5% /boot/efi     /dev/mapper/fedora_hostName-home  405G  182G  203G  48% /home


Creating a variable to a directory that persists until deletion

I'm currently using bash on Ubuntu, and I work a lot with a directory saved at /home/me/path/to/project_dir. It is a nuisance to change to the directory every time I open bash. So I'd like to save the path to a variable, say `projdir`, so that I can just do `cd projdir`. If my working directory changes, I should be able to change the path by overwriting the variable. I want to be able to update the variable easily, preferably with one command, without messing with .bashrc. One important thing is that this variable should persist even if I restart bash. How do I do this? I'd still like to see my home directory when I start up bash, so changing the default starting directory to project_dir is not an option.


screen buffer and dialog

I was trying to use different screen buffer for my script using tput. Below is small script that I am running.               tput smcup     clear     dialog --yesno "Do you want to continue?" 0 0     rc=$?     clear     tput rmcup     if [ "${rc}" == "0" ]; then       echo Yes     else       echo No     fi      After the script is finished executing there is a blank part on the screen(as shown below in the image) which is equal to the rows occupied by the prompts before running the script.Ideally `tput` should have switched to second screen buffer and after executing it should have come back to the first screen buffer. **The script switches to the second screen but after coming back it leaves a blank space which shouldn't be there .** ![enter image description here](http://i.stack.imgur.com/yq271.jpg)


Allow application specific access in iptables using guid

I would like to get Skype working with `iptables` and don't want to allow a huge range of ports thus I thought a solution might be               iptables -A OUTPUT -m owner --gid-owner skypeGrp -j ACCEPT      iptables -A INPUT -m owner --gid-owner skypeGrp -j ACCEPT      where in advance I had created a group called `skypeGrp` and then put the skype application into it:               sudo addgroup skypeGrp     sudo usermod some_username -G skypeGrp     sudo chgrp skypeGrp /usr/bin/skype      Shouldn't this work? EDIT: I think another key insight here to make the method I originally outlined in my question work, is to realise that it `active group` that `iptables` takes notice of. Thus my user doesn't just have to belong to the `skypeGrp`, this also must be his `active group` at the time of running `Skype` (see here for more).


How to use variables in sed

I want to print out the lines of a file between two indices in a Bash script. I have the file name and indices as variables I tried doing this               sed -n "$2,$3p" $1          sed: -e expression #1, char 4: invalid usage of line address 0      but I got an error. How do I do this?


Openbox placing cursor on the window titlebar

I was able to use one really neat thing. In many DE or WM, when you **Maximize** the window and then try drag the window from the **Titlebar** , the window would be **Unmaximized**. I achieved this by the following config:               <context name="Titlebar">      <mousebind button="Left" action="Drag">       <action name="Unmaximize"/>       <action name="Move"/>      </mousebind>     </context>      The **Move** action is necessary to keep to be still moving window. BUT there is one thing...I hope you can help me.. This way, when window becomes, **Unmaximized**. The cursor will still be on top of the screen. How to move the cursor to still be on a **Titlebar**?


Google Compute Engine with multiple SSH users, Debian

I have managed to set up my server with a default user 'admin'. The sshKeys in the metadata is set with the following format, described in the google documentation.                key: sshKeys       value: admin:ssh-rsa XXXXXXXXXX      However, I am trying to add a new user to the system, hence I updated the metadata to the following                key: sshKeys       value: admin:ssh-rsa XXXXXXXXXX newuser:ssh-rsa YYYYYYYYY      This has worked perfectly for me on one instance of server that I have set up sometime back. However I was unable to set it up on the new one. Can someone help me out with this?


Help searching in files for regex patterns, recursively, with specialized output

My problem is that I need to:   1. Find all lines matching `regex_pattern` in all files (deep search) in a given root directory   2. For each line that matches, output:      * File name     * Line number containing the match     * Line contents     * The regex pattern   3. Import the above data into Excel (so a CSV, or delimited output format comes to mind) **What is the easiest way to do this task?** For the sake of proving I thought about this somewhat, I would write a Perl script that took as input a single fully qualified filename and a regex pattern, and process the lines using the approximate Perl below (I haven't tried yet, but this is what my first attempt would resemble):               while (<FILE>) {       $line_number++;            if ($_ =~ m/regex_pattern/) {         # output: file_name\tline_number\tregex_pattern\t$_         # ignore escaping issues for the time being       }     }      I'm still not sure how I'd pass in the contents of each directory with a recursive search into this Perl script. I can do the searching in Perl but I'm sure there's a nice Unix/Linux way to do this. I'm not married to Perl. If there's a way to do it chaining together standard Unix/Linux tools, that'd be awesome. If not, I prefer to use Perl as I'm somewhat familiar with it's syntax.


Android Emulator on Arch Linux

I would like to run Android Emulator on Arch Linux. Is there any way to run Android Emulator on Arch Linux?


How you stop 'wget' after it gets a 404?

If you use brace expansion with `wget`, you can fetch sequentially-numbered images with ease:               $ wget 'http://www.iqandreas.com/sample-images/100-100-color/'{90..110}'.jpg'      It fetches the first 10 files numbered `90.jpg` to `99.jpg` just fine, but `100.jpg` and onward return a _404: File not found_ error (I only have 100 images stored on the server). These non-existent files become more of "a problem" if you use a larger range, such as `{00..200}`, with 100 non-existent files, it increases the script's execution time, and might even become a slight burden (or at least annoyance) on the server. Is there any way for `wget` to stop after it has received its first 404 error? (or even better, two in a row, in case there was a missing file in the range for another reason) The answer does not need to use brace expansion; loops are fine too.


How do you hide a pane?

I have 3 panes in my tmux window:               --------------------------     |             |      2   |     |             |          |     |        1    |----------|     |             |      3   |     |             |          |     --------------------------      Panes 1 and 2 have `vim`. Pane 3 runs a cli I am developing. Sometimes I want to compare panes 1 and 2, so I want to hide pane 3:               --------------------------     |             |          |     |             |          |     |        1    |       2  |     |             |          |     |             |          |     --------------------------      and then bring back pane 3 again. I don't want to kill pane 3 as I have set up some things there and don't want to go though setting them up again.   * Is there something similar to `PREFIX + z` which can zoom pane 2 but without touching pane 1? Or    * Is there a way to hide pane 3 quickly and bring it up back when needed?


Virtual Host setup works for one server, not another

Having an issue with my virtual host set up. Used this tutorial as a reference on both: http://youtu.be/wXIJMtwmPCE Apache/2.2.15 (Unix) on both servers. Seemingly Identical httpd.conf file on both servers: http://pastebin.com/2LRzLZ8Z Working server's webmin shows vhosts as:               Handles the name-based server foo.com on address *.      While non-working server's webmin shows vhosts as:               Handles the name-based server urbanvacations.net on all addresses      Virtual files contains:               <VirtualHost *>         DocumentRoot "/srv/vhosts/foo.com/htdocs"         ServerName mysite.com         <Directory "/srv/vhosts/foo.com/htdocs">             allow from all             Options +Indexes         </Directory>     </VirtualHost>      I am not sure if I'm missing something in apache's configuration or on the CentOS server itself. Both conf files have "NameVirtualHost" commented out; however even with it uncommented, vhosts still won't work on the second server. The domain just shoots back over to the default apache welcome page. The second server is AWS EC2, and the first server is dedicated via another company.


Debian: change Gnome Classic Places menu for all users

I'm using debian 7 with Gnome Classic. I want to change the items in my Places menu for every users. I know that I can manage Applications menu items from _/usr/share/applications_ How can I manage,in a similar way, the Places menu? Thanks.


Why do *nix filesystems support file names with newlines?

According to this page: > File names in Linux can contain any characters other than (1) a forward > slash ( / ), which is reserved for use as the name of the root directory > (i.e., the directory that contains all other directories and files) and as a > directory separator, and (2) the null character (which is used to terminate > segments of text). Spaces are permitted, although they are best avoided > because they can be incompatible with legacy software in some cases. Great, both restrictions make a lot of sense. Since it is clearly possible to forbid the inclusion of certain characters in file names, why were newlines allowed? As far as I can tell their only use is to complicate our scripts. Is there ever a valid reason to have a new line in a file name?


How to run gVim in a single instance

I want it in such a way that on double clicking an already opened file, or a new file, gVim uses the same window. From this question asked previously on Stackoverflow I figured out how to do this by putting up an alias like:               alias gvim="gvim --remote-tab-silent" || gvim      This works great for the terminal without any problems. To enable this for the desktop too, I tried editing the `/usr/share/applications/gvim.desktop`. The default execution command in `gvim.desktop` is:               gvim -f %F      I changed this to:               gvim --remote-tab-silent %F      This gives me trouble when I'm trying to open an already opened file. It takes too long to open and doesn't open in the end. What may have caused the problem? I'm running Gnome 2.x and Vim 7.2.x if it matters.


How do I show all files in a directory except those that have a certain extension AND display them in multiple columns?

Since I write in Python a lot it's kind of annoying to see .pyc files all the time and I would like to just hide them at this point. I tried the following, but I can't seem to figure out how to get it to print in multiple columns.               ceasarbautista@hse140:~/Desktop/Statistics/statistics/probability$ ls     __init__.py     calculus.py     conditional.py      counting.pyc        distributions.pyc   event.pyc       objects.pyc     __init__.pyc        calculus.pyc        counting.py     distributions.py    event.py        objects.py      plots.py     ceasarbautista@hse140:~/Desktop/Statistics/statistics/probability$ ls | grep -v .pyc     __init__.py     calculus.py     conditional.py     counting.py     distributions.py     event.py     objects.py     plots.py     ceasarbautista@hse140:~/Desktop/Statistics/statistics/probability$ ls -C | grep -v .pyc     conditional.py      event.py


Manipulating X key and pointer grabs on the command line

What command line tools exist to list and manage X server grabs? (That's grab as in key and pointer grabs, i.e. restricting the use of a particular key or mouse button to a particular application, or constricting the mouse pointer to remain in a particular screen area.) I'm looking for a hypothetical `xgrab` utility that would show things like               Key     0x00f00ba5  0x123   0     Button  0x00f00ba5  2            Pointer 0x00abcdef        meaning that there has been a call to `XGrabKey(display, 0x123, 0, 0x00f00ba5, ...)` and so on with `XGrabButton`, `XGrabPointer`, `XGrabKeyboard`, `XGrabServer` (if possible). The display format doesn't matter, what I want is some way to see who's grabbing what, and possibly some way of revoking these grabs (if it's possible, I'm not sure if the X11 API allows that).


How can I prefer one wifi network over another?

From my home I have access to my home wifi network as well as a public network that is deployed throughout the city. The public network has a lower signal strength and is unprotected. However, my computer sometimes connects to that network instead of my home network. Other than "forgetting" the public network, is there a way to tell NetworkManager to prefer my home network over other networks?


How to remove any string from a file via shell scripts?

I try to remove string from `.bash_profile`. String is added when my shell script run: My string at bash_profile as follows:               # for Myapllication     export MYAPP_HOME=/opt/myapp      I want to remove the strings from `.bash_profile` when myapp is removed via `rpm`. How to remove any string from a file via shell script? (or possible alternative method)


What is GNU Info for?

I understand what GNU Info is and how to use it, but what is it _for_? Why does it exist in parallel to the man pages? Why not write detailed man pages rather than provide a separate utility?


Installing a platform driver

I have recently acquired a device driver for an integrated watchdog timer on a x86 board on which I am running a minimal Linux system. The kernel is 3.6.11 and it has been built using `buildroot`. My installation does not run `udev` so I am required to manually perform an `insmod` and `mknod` for any drivers that I require. I have managed to do this for a CAN driver, but for this watchdog driver, I am able to cross-compile the source code for the target and I am successfully able to `insmod` the resulting .ko file. After this there are no errors generated and a call to `lsmod` reports that the module is loaded. The problem I am having is that I need to created a device node in `/dev` for this driver and I am not sure how to proceed. I do not know how to obtain device major and minor numbers like I can for char devices. The source of this driver suggests it is a platform device driver but I am not sure what that even means. I have only heard of character and block devices and so – is the notion of major and minor numbers relevant to platform devices? If so, how can I obtain this information? There is no entry within `/proc` for this device driver name and I am unsure how to proceed.


Why not use pathless shebangs?

Is it possible to have a shebang that, instead of specifying a path to an interpreter, it has the name of the interpreter, and lets the shell find it through $PATH? If not, is there a reason why?


Choose at GRUB menu whether NVidia driver should be used

For some games, I need the `nvidia-current` driver, but when it's enabled, I can't get my work done as it messes up everything. So is there a way I can get two options in my GRUB menu? One wich will load my operating system **with** the `nvidia-current` drivers, and one which will use the default _non- proprietary_ one? It seems a bit stupid to me to have 2 Ubuntu installations (one for games, one for the rest). But I can't get my daily work done **with** the Nvidia drivers enabled as it messes up some applications, randomly freezes the system, etc. But I still want to be able to play some games. If there's a way to just load and unload the `nvidia-current` driver with a script or something, that would also be welcome.


find the single largest file

We host a share of size 4 TB. How efficient is it to find a file with highest size. Usually we use:               du -ak | sort -k1 -bn | tail -1      and it is not easy to scan through a share of such huge size and then again sort them. Any suggestions to know only the single largest file in the share. And also `du -ak` is returning the size of current directory like (". 123455"). How do i avoid that?


Gnome Activity Journal stalls

I installed gnome-activity-journal, restarted zeitgeist and launched gnome- activity-journal, and the app just loads without ever displaying anything. I tried the latest version from the PPA:               ii  zeitgeist                             0.8.2-0ubuntu1~ppa1~natty                  event logging framework     ii  zeitgeist-core                        0.8.2-0ubuntu1~ppa1~natty                  event logging framework - engine     ii  gnome-activity-journal                0.6.0-0ubuntu1~natty1~ppa                             graphical user interface for Zeitgeist      But the result is the same: ![stalled_activity_journal](http://i.stack.imgur.com/sZlC8.png) The daemon says:               [DEBUG - zeitgeist.engine] Found 0 events in 0.000194s     [DEBUG - zeitgeist.engine] Found 53 events in 0.000753s     [DEBUG - zeitgeist.engine] Got 0 raw events in 0.000776s     [DEBUG - zeitgeist.engine] Got 53 events in 0.000109s     [DEBUG - zeitgeist.engine]     Where time spent in _get_event_from_row in 0.000000s     [DEBUG - zeitgeist.engine]     Where time spent in _get_subject_from_row in 0.000000s     [DEBUG - zeitgeist.engine]     Where time spent in apply_get_hooks in 0.000000s     [DEBUG - zeitgeist.engine] Found 28 events in 0.000766s     [DEBUG - zeitgeist.engine] Got 0 raw events in 0.000444s     [DEBUG - zeitgeist.engine] Got 28 events in 0.000113s     [DEBUG - zeitgeist.engine]     Where time spent in _get_event_from_row in 0.000000s     [DEBUG - zeitgeist.engine]     Where time spent in _get_subject_from_row in 0.000000s     [DEBUG - zeitgeist.engine]     Where time spent in apply_get_hooks in 0.000000s     [DEBUG - zeitgeist.engine] Found 236 events in 0.001218s     [DEBUG - zeitgeist.engine] Got 0 raw events in 0.003643s     [DEBUG - zeitgeist.engine] Got 236 events in 0.000178s     [DEBUG - zeitgeist.engine]     Where time spent in _get_event_from_row in 0.000000s     [DEBUG - zeitgeist.engine]     Where time spent in _get_subject_from_row in 0.000000s     [DEBUG - zeitgeist.engine]     Where time spent in apply_get_hooks in 0.000000s     [DEBUG - zeitgeist.engine] Found 115 events in 0.000892s     [DEBUG - zeitgeist.engine] Got 0 raw events in 0.001598s     [DEBUG - zeitgeist.engine] Got 115 events in 0.000118s     [DEBUG - zeitgeist.engine]     Where time spent in _get_event_from_row in 0.000000s     [DEBUG - zeitgeist.engine]     Where time spent in _get_subject_from_row in 0.000000s     [DEBUG - zeitgeist.engine]     Where time spent in apply_get_hooks in 0.000000s     [DEBUG - zeitgeist.engine] Found 10 events in 0.000587s     [DEBUG - zeitgeist.engine] Got 0 raw events in 0.000191s     [DEBUG - zeitgeist.engine] Got 10 events in 0.000102s     [DEBUG - zeitgeist.engine]     Where time spent in _get_event_from_row in 0.000000s     [DEBUG - zeitgeist.engine]     Where time spent in _get_subject_from_row in 0.000000s     [DEBUG - zeitgeist.engine]     Where time spent in apply_get_hooks in 0.000000s     [DEBUG - zeitgeist.engine] Found 0 events in 0.000665s     [DEBUG - zeitgeist.fts] Indexing 'file:///home/raphink/Pictures/stalled_activity_journal.png'     [DEBUG - zeitgeist.fts] Indexing 'file:///home/raphink/Pictures/stalled_activity_journal.png'     [DEBUG - zeitgeist.fts] Indexing 'file:///home/raphink/Pictures/stalled_activity_journal.png'     [DEBUG - zeitgeist.engine] Inserted 3 events out of 3 in 0.207549s     [DEBUG - zeitgeist.notify] Checking monitor :1.146/org/gnome/zeitgeist/monitor/1     [DEBUG - zeitgeist.notify] Checking monitor :1.146/org/gnome/zeitgeist/monitor/3     [DEBUG - zeitgeist.notify] Checking monitor :1.146/org/gnome/zeitgeist/monitor/2     [DEBUG - zeitgeist.notify] Checking monitor :1.146/org/gnome/zeitgeist/monitor/5     [DEBUG - zeitgeist.notify] Checking monitor :1.146/org/gnome/zeitgeist/monitor/4     [DEBUG - zeitgeist.notify] Checking monitor :1.146/org/gnome/zeitgeist/monitor/6     [DEBUG - zeitgeist.notify] Notifying :1.146/org/gnome/zeitgeist/monitor/6 about 3 insertions     [DEBUG - zeitgeist.fts] Committing FTS index     [WARNING - zeitgeist.notify] Failed to deliver notification: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.      Any idea what's wrong?


Screenshots from multiple Xservers

I want to take screenshots simultaneously from multiple X servers on one desktop PC. I have multiple users logged in different terminals (`tty1`, `tty2`, `tty3`, `tty4`) who start multiple Xservers with `startx /usr/bin/openbox-session -- :1` (and `:2`, `:3`, `:4` respectively). So I can access each one of them with `Ctrl+Alt+F8`, `+F9`, `+F10`, `+F11`. There is only one monitor on that desktop. I want to take screenshots for each of these X servers, preferably with `scrot`, but I currently get a black/blank image whenever I try it. Only when I am active on that X server I get a proper screenshot. For example, if I am on `Ctrl+Alt+F8` and run `scrot test.png` I get a proper screenshot; if I understand correctly I do not have to set the `$DISPLAY`, since being on `Ctrl+Alt+F8` I get `echo $DISPLAY` > `:1`. But if I run `sleep 10; scrot test.png` and go to `Ctrl+Alt+F7`, then I get a black image. How can I get multiple screenshots from each one of those terminals simultaneously? What worked for me was `Xephyr`. The only problem with this solution seems to be that when I run extremely fast `xdotool` commands it is not as responsive as X. For future reference, what I did for every of the four users and terminals was: In `~/.profile`, I set each user to auto-login after my system boot, like:               if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then          sleep 30 # for some reason it crashes if I do not let                    # it sleep for a while, not necessarily so long.                    # I guess it has to do with my "normal" X at DISPLAY=:0 .                    # Thus for tty2 I let it sleep 40 seconds,                    # for tty3 50 seconds and so on.          startx     fi      In `~/.Xsession`, I start an Xserver/client (with blackbox) and Xephyr (with openbox) in it like:               Xephyr -fullscreen -screen 1920x1200 :11 &     exec blackbox &      sleep 3 # Perhaps sleeping is redundant.     DISPLAY=:11 /usr/bin/openbox-session      I want the "final" window manager do be `openbox-session`. I would like to use `openbox` for both the Xserver and `Xephyr`, but `exec openbox & DISPLAY=:11 /usr/bin/openbox-session` crashes, while `exec openbox & DISPLAY=:11 /usr/bin/openbox` does not. This way, the user in `:11` can take screenshot, while the monitor shows `:0`. (or `:13`, `:14`, etc.). I did not try `XVnc`, but I have the feeling that it might be slower than `Xephyr`; please correct me if I am wrong.


Can applications like VirtualBox run at startup without any users logging in ubuntu?

This question comes to mind because we are tinkering with the idea of going VM with some of our servers. KVM is a bit involved, VMWare acts like they want to be a free product, and Microsoft is just out of the question when it comes to virtualization. However, the machine is going to remote location with electrical issues long enough to surpass the capability of our UPS units. In short, **I want to be able to make phone call and tell somebody to push the power button back on and have services running again on the guest machine** without have to talk somebody through logging on (which ivolves giving user name and pw to the machine) and starting the virtual machine. **Is this possible**?


Moving to Solaris (from Linux)

I got curious about why not so many people have Solaris in their desktops and laptops. I wonder whether it's a good idea at all, or something just for the absolute geek. Could I maybe give it a try either in an open server online or through a live- cd? What difficulties would I expect to find and what version is good for beginners?


Can't get rEFIt to boot after install (Ubuntu + OSX on macbook pro)

I'm trying to dual boot Ubuntu and OSX on my macbook (`MacBookPro8,2`). As per the usual guide, I downloaded rEFIt (the .dmg) and installed it. Then I rebooted about 12 times and still always just get brought to the OSX login screen. I've never seen any rEFIt menu. Here's the output of rEFIt's partition map:               *** Report for internal hard disk ***          Current GPT partition table:      #      Start LBA      End LBA  Type      1             40       409639  EFI System (FAT)      2         409640    716757759  Unknown      3      716757760    718027295  Mac OS X Boot      4      718027296    976510983  Mac OS X HFS+          Current MBR partition table:      # A    Start LBA      End LBA  Type      1              1    976773167  ee  EFI Protective          MBR contents:      Boot Code: None          Partition at LBA 40:      Boot Code: None (Non-system disk message)      File System: FAT32      Listed in GPT as partition 1, type EFI System (FAT)          Partition at LBA 409640:      Boot Code: None      File System: Unknown      Listed in GPT as partition 2, type Unknown          Partition at LBA 716757760:      Boot Code: None      File System: HFS Extended (HFS+)      Listed in GPT as partition 3, type Mac OS X Boot          Partition at LBA 718027296:      Boot Code: None      File System: HFS Extended (HFS+)      Listed in GPT as partition 4, type Mac OS X HFS+


How can we measure that in a given period, what window was on the top? (active one) I already tried based on "wmctrl", but I can't show the currently active window.. in the second example I tried with ":ACTIVE:", it showed ALL again, but only the terminal was the active then..               $ wmctrl -l | awk '$2 != "-1"'     0x044006a3  8 notebook Mozilla Firefox     0x0456fb4c  0 notebook How to measure that how much time is the active window opened? - Unix & Linux Stack Exchange - Mozilla Firefox     0x03000004  0 notebook Terminal     $      $ wmctrl -l :ACTIVE: | awk '$2 != "-1"'     0x044006a3  8 notebook Mozilla Firefox     0x0456fb4c  0 notebook How to measure that how much time is the active window opened? - Unix & Linux Stack Exchange - Mozilla Firefox     0x03000004  0 notebook Terminal     $       Purpose: The output would be something like this (from an example 8 hour shift, so 480 minutes):               MINUTE  TASK     195 Mozilla Firefox     165 Terminal     74  Thunderbird     36  Idle (was away, machine locked, no app was on top..)     10  Unknown (the machine wasn't powered on)      With the `awk '$2 != "-1"'` I just excluded the "Bottom Expanded Edge Panel". **Question:** I only need the part that how can I show the currently active window. I can do the part where I run a script in ex.: every 10 seconds and gather the time information. p.s.: I'm using Ubuntu 12.04 or CentOS 6 both with GNOME.


Change Startx Default on Slackware?

I installed Slackware as a VM within Virtual Box. Host is Windows 7, if it matters. I have successfully installed guest additions and XFCE starts and runs cleanly with or without the guest additions. KDE however (which was set as the default for `startx`) starts well giving me the appropriate desktop at the appropriate resolution but crashes halfway during the splashscreen animation. I am not sure it is worth wrestling with it. How do I change the default for `startx` to xfce? I realize that I can always start it at the command line with `startxfce4` at the command line but I may like to change the inittab run level to 5 which would trigger KDE with it's crashes.


Can I resize the root partition without uninstalling and reinstalling Linux (or losing data)?

I have started using a machine that has both Debian and Windows 7 installed. However, after installing some programs I started getting a message that there is not enough space. I knew that the system had more than 1TB of hard disk space in total and did some research. It seems that the root partition is only 5GB. Is there any way to allocate more disk space to the specific partition without reinstalling Linux? Below you can find the results of a couple of commands that I executed:               fdisk -l          Disk /dev/sda: 640.1 GB, 640135028736 bytes     255 heads, 63 sectors/track, 77825 cylinders     Units = cylinders of 16065 * 512 = 8225280 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x4a47e2fd             Device Boot      Start         End      Blocks   Id  System     /dev/sda1   *           1          13      102400    7  HPFS/NTFS     Partition 1 does not end on cylinder boundary.     /dev/sda2              13       53507   429687500    7  HPFS/NTFS     Partition 2 does not end on cylinder boundary.     /dev/sda3           53507       77826   195340289    5  Extended     Partition 3 does not end on cylinder boundary.     /dev/sda5           53507       53537      243712   83  Linux     /dev/sda6           53538       77826   195095552   8e  Linux LVM          Disk /dev/sdb: 640.1 GB, 640135028736 bytes     255 heads, 63 sectors/track, 77825 cylinders     Units = cylinders of 16065 * 512 = 8225280 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x4a47e2fe             Device Boot      Start         End      Blocks   Id  System     /dev/sdb1               2       62261   500097657+   f  W95 Ext'd (LBA)     /dev/sdb5               2       62261   500097656+   7  HPFS/NTFS          Disk /dev/dm-0: 4999 MB, 4999610368 bytes     255 heads, 63 sectors/track, 607 cylinders     Units = cylinders of 16065 * 512 = 8225280 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x00000000          Disk /dev/dm-0 doesn't contain a valid partition table          Disk /dev/dm-1: 1996 MB, 1996488704 bytes     255 heads, 63 sectors/track, 242 cylinders     Units = cylinders of 16065 * 512 = 8225280 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x00000000          Disk /dev/dm-1 doesn't contain a valid partition table          Disk /dev/dm-2: 20.0 GB, 19998441472 bytes     255 heads, 63 sectors/track, 2431 cylinders     Units = cylinders of 16065 * 512 = 8225280 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x00000000          Disk /dev/dm-2 doesn't contain a valid partition table      * * *               df -h     Filesystem            Size  Used Avail Use% Mounted on     /dev/mapper/HU-root   4.6G  4.4G   32M 100% /     tmpfs                 2.0G     0  2.0G   0% /lib/init/rw     udev                  2.0G  220K  2.0G   1% /dev     tmpfs                 2.0G  356K  2.0G   1% /dev/shm     /dev/sda5             231M   22M  198M  10% /boot     /dev/mapper/HU-home    19G  751M   17G   5% /home      * * * Edit (extra info based on comment):               # mount     /dev/mapper/HU-root on / type ext3 (rw,errors=remount-ro)     tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)     proc on /proc type proc (rw,noexec,nosuid,nodev)     sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)     udev on /dev type tmpfs (rw,mode=0755)     tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)     devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)     /dev/sda5 on /boot type ext3 (rw)     /dev/mapper/HU-home on /home type ext3 (rw)     fusectl on /sys/fs/fuse/connections type fusectl (rw)     binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)      * * *               # pvdisplay       --- Physical volume ---       PV Name               /dev/sda6       VG Name               HU       PV Size               186.06 GiB / not usable 3.00 MiB       Allocatable           yes        PE Size               4.00 MiB       Total PE              47630       Free PE               41194       Allocated PE          6436       PV UUID               wmEFAc-eSb6-r3qo-jIjy-vuKH-v9JK-eQfJFZ      * * * As a sidenote, I would also appreciate any suggestions for good books that explain these subjects in depth (file systems, how the various operating systems understand the file systems etc).


issue with find -exec cp

Consider this example (newbie alert):               touch test0     touch timestamp     touch test1     sudo find /var/www/import -iname 'test*' -newer timestamp -exec cp {} new \;      It actually copies file test1, but it returns the message:               cp: `/var/www/import/new/test1' and `new/test1' are the same file      What am I doing wrong? 2nd question, can I use "+" with this command so that files are copied in a single "bundle"? There are thousands of files!


vsftpd virtual user read permissions

I have a `vsftp` server that services a read-only public space by anonymous login. It works fine. I need to add a few specific users that will authenticate by username/password and they will have different user-specific home directories that are also read-only. I have configured virtual guest users and they can log in (authenticating via PAM). The problem that I have is that these users can only access world- readable files. I don't want to make the files world-readable - they are all owned and accessible by the `nobody` user and they have no group or world permissions. I have configured `vsftp` so that it runs as `nobody` and so that the guest user name is `nobody` - I would have expected that this meant all guests were 'nobody' and should therefore be able to read files accessible to `nobody`. The configuration that I added for virtual users is below                # Specific users      local_enable=YES      guest_enable=YES      guest_username=nobody      user_sub_token=$USER      local_root=/srv/backup/$USER      pam_service_name=vsftpd      allow_writeable_chroot=YES      An example home directory (listed from the filesystem):               drwx------ 2 nobody nobody 4096 May 15 12:09 a_directory     drwx------ 5 nobody nobody 4096 May  7 12:07 another_directory     -rw------- 1 nobody nobody  95744 May  4 17:07 FILE.txt     -rw------- 1 nobody nobody 104502 Apr 22 17:14 another_file      How do I configure `vsftp` so that virtual users can see the files in their directories ?


Cannot get rc.local to automatically run at all

so I've been trying to get the `/etc/rc.local` script to run, and for the life of me, nothing seems to work. I can run it manually by using `service rc.local start`, and it just echos 'hi' to a file in my home directory, but on reboot it does not run. All the correct permissions seem to be set and links exist in the correct rc#.d directories. For reference, here is the relevant information:               # ls -l /etc/rc.local     -rwxr-xr-x 1 root root 45 Apr 12 21:10 /etc/rc.local               # ls -l /etc/init.d/rc.local                                       -rwxr-xr-x 1 root root 812 Apr 12 21:00 /etc/init.d/rc.local               # for i in {0..6}; do cd rc$i.d ; pwd; ls -l |grep rc.local; cd ..; done     /etc/rc0.d     lrwxrwxrwx 1 root root  18 Apr 12 20:53 K20rc.local -> ../init.d/rc.local     /etc/rc1.d     lrwxrwxrwx 1 root root  18 Apr 12 20:53 K20rc.local -> ../init.d/rc.local     /etc/rc2.d     lrwxrwxrwx 1 root root  18 Apr 12 20:53 S20rc.local -> ../init.d/rc.local     /etc/rc3.d     lrwxrwxrwx 1 root root  18 Apr 12 20:53 S20rc.local -> ../init.d/rc.local     /etc/rc4.d     lrwxrwxrwx 1 root root  18 Apr 12 20:53 S20rc.local -> ../init.d/rc.local     /etc/rc5.d     lrwxrwxrwx 1 root root  18 Apr 12 20:53 S20rc.local -> ../init.d/rc.local     /etc/rc6.d     lrwxrwxrwx 1 root root  18 Apr 12 20:53 K20rc.local -> ../init.d/rc.local               # cat /etc/rc.local     #! /bin/bash          echo hi > ~user/test          exit 0      I've tried deleting both `/etc/rc.local` and `/etc/init.d/rc.local`, running `update-rc.d rc.local remove`, then restoring them and running `update-rc.d rc.local defaults` like in this question: Rc.local does not execute. That did not work. It also does not work after reboot or entering any init level. It did not work when the shebang line read `#! /bin/sh -e` or `#! /bin/bash`. If I run it manually I can get both the `/etc/rc.local` and `/etc/init.d/rc.local` scripts to echo to different files, though. So my question is...what am I doing wrong and how can I get rc.local to run? Also, while I don't mind hearing about alternatives (like upstart), I will only accept an answer that shows me (or helps me find) how to get rc.local to run normally (and ideally tells me what went wrong). Here's some additional info for what it's worth:               # dmesg | grep "Linux version"     [    0.000000] Linux version 3.5.0-17-generic (buildd@allspice) (gcc version 4.7.2 (Ubuntu/Linaro 4.7.2-2ubuntu1) ) #28-Ubuntu SMP Tue Oct 9 19:31:23 UTC 2012 (Ubuntu 3.5.0-17.28-generic 3.5.5)               # cat /proc/version     Linux version 3.5.0-17-generic (buildd@allspice) (gcc version 4.7.2 (Ubuntu/Linaro 4.7.2-2ubuntu1) ) #28-Ubuntu SMP Tue Oct 9 19:31:23 UTC 2012          # lsb_release -a     No LSB modules are available.     Distributor ID: LinuxMint     Description:    Linux Mint 14 Nadia     Release:        14     Codename:       nadia


Needs help on setting up kernel keyboard mapping

I already got the keycode from kernel, but `acpi_listen` won't recognize it in Arch Linux:               # /usr/lib/udev/keymap -i /dev/input/by-path/platform-thinkpad_acpi-event     Press ESC to finish, or Control-C if this device is not your primary keyboard     scan code: 0x1A    key code: micmute      Now I try to map the key by:               # /usr/lib/udev/keymap /dev/input/by-path/platform-thinkpad_acpi-event 0x01a micmute     setting scanode 0x1A to key code 248      But `acpi_listen` still got no output here. How should I make `acpi_listen` recognize it? **UPDATE2** Well , evdev driver doesn't seem to recognize this , I heard someone saying that xorg won't route key event number that went beyond the limit.. It has to be solved as a acpi event , but don't know how **UPDATE** Seems to be complicated,               $ xmodmap -e 'keycode 248 = XF86MicMute NoSymbol XF86MicMute'     xmodmap:  commandline:1:  bad keysym name 'XF86MicMute' in keysym list     xmodmap:  commandline:1:  bad keysym name 'XF86MicMute' in keysym list     xmodmap:  2 errors encountered, aborting.


Run in root shell from within a user bash script

I have a script that , among other things, needs to do some stuff as root, like creating a mount folder. I tried:               echo "Linux user password is needed in order to ..."     sudo -s     # also tried:     # sudo su     ... code that requires root permission     exit     ... code that requires user permission      The problem is that the script stops after the "sudo -s" and continues only after I manually exit the automatically created root shell. **Is there a way to run root shell commands within a user script?** Thanks.


How do I check if a distribution is Fedora-based?

The Python M2Crypto library requires a slightly different installation command if the Linux distribution is Fedora-core based (e.g., Fedora, RHEL, CentOS, Scientific Linux). Is there a way to check if a distribution is Fedora-Core based, so I can write a script to execute the correct install command depending on the distribution?


Is Oracle Solaris UNIX?

Is Oracle Solaris officially declared UNIX? I want to know all the official UNIX presently available in the market (whether free or paid). Please correct me if I am wrong: To the best of my knowledge, an operating system must satisfy all the terms and conditions as laid by the owners of "UNIX", The Open Group, to be coined as UNIX. Linux is an UNIX-like kernel almost resembling UNIX but still open-source and free to distribute.


Why does CentOS not have an NTP drift file?

It seems that CentOS does not have a `ntp.drift` or similar file. In `/etc/ntp.conf`, it says that you can use `/var/lib/ntp/drift` as a drift file but this file does not exist. Does CentOS does not consider drifting? Or does it let the user adjust if necessary? Or does it use another mechanism?


How to set up a blacklist for insmod?

I want to block a certain driver module from loading in the linux kernel. So I created a file in /etc/modprobe.d/cdc_acm.conf. In this file I added the following line:               install cdc_acm /bin/false      This works as expected when issuing:               modprobe cdc-acm          libkmod: ERROR libkmod/libkmod-module.c:924     command_do: Error running install command for cdc_acm ERROR: could not     insert 'cdc_acm': Operation not permitted      The problem is that when I use the insmod utility the module is loaded:               insmod cdc-acm.ko          [ 1051.914578] cdc_acm 2-1.1:1.0:     usb_probe_interface [ 1051.919437] cdc_acm 2-1.1:1.0:     usb_probe_interface - got id [ 1051.926323] cdc_acm 2-1.1:1.0:     ttyACM0: USB ACM device [ 1051.934700] usbcore: registered new     interface driver cdc_acm [ 1051.941315] cdc_acm: USB Abstract Control     Model driver for USB modems and ISDN adapters      Why is this happening is there a way to create a blacklist file for insmod ?


Gimp core dumped

I'm on ArchLinux, Gimp is updated (already tried to uninstall and re-install) but when I run it I get (after 6 seconds):               Bus error (core dumped)      I don't understand what it could be... Googling it reveals almost nothing. Any suggestions?


What is the most portable method of launching a terminal emulator?

Say I need to write a script that will launch a terminal and execute a command and I need that to work on various systems. How can I do that in a safe and portable manner? Is `xterm` always installed? I assume that any *nix with a GUI must have some terminal emulator. How can I get to it? Debian systems have `x-terminal- emulator` but that, apparently, does not even work in Red Hat, let alone non- Linux *nixes.


Choose a terminal emulator from Java

I am writing a platform independent Java console tool and within which will have to execute some commands in separate independent terminal at runtime. However, I need to know which terminal should I be using gnome-terminal or xterm. i.e. the one available on that particular system. Since there are many different linux variants are available. I want to support at least the most obvious ones. Normally in Java `System.getProperty("os.name")` returns `Linux` but it doesn't tell you if its Ubuntu or any other Linux varient. So It is difficult to know which terminal to start at runtime. Whether gnome-terminal or xterm or if there is anything else as well that I don't know. Working sets: In Windows:               cmd /c start java -jar jarTool arguments      In Ubuntu:               gnome-terminal --execute java -jar jarTool arguments      or               xterm -e java -jar jarTool arguments      Also just for additional information,I am using `Runtime.getRuntime().exec(args or commands)` to start terminal from Java program at runtime.


How to recover a shell after a disconnection

Am doing some work on a remote centos 5.6 machine and my network keeps dropping. Is there a way i can recover my hung sessions after i reconnect? EDIT: am doing some updating and installing with yum and am worried this might be a problem is processes keep hanging in the middle of whatever theyre doing


Linux, printing specific parts of a text document

I want to print, for each line of a given document, the ﬁrst names and the ages of people (which are entries of the document). What linux command would I use? Hopefully based around grep using a regex pattern. Example of input document:               Linda:F:Las Vegas, USA:18:telnet       Steve:M:Leipzig, Germany:33:ftp     Henry:M:Milan, Italy:19:sftp      Alice:F:Izmir, Turkey:32:pop3s     Robert:M:Verona, Italy:21:scp     Olga:F:Gorontalo, Indonesia:19:pop3s     Kimberly:F:Lille, France:25:ping     Henry:M:Oslo, Norway:26:ftp     Carol:F:New Delhi, India:23:pop3s     Thomas:M:New Delhi, India:32:http


SD card corrupt and stuck at 32MB, any way to fix it?

Using the Linux area since I'm using Linux apps and utilities. My phone crashed (several times) and managed to corrupt my microSD card. It no longer appears to have partitions and shows as 32MB rather than 2GB. That's using testdisk. dd and ddrescue only pulled 30.6MB of null off of it. It isn't a fake, SanDisk branded, purchased from a reputable retailer, and the space has been working perfectly for a year. I expect it's had it, but I didn't see the harm in asking. Even if I forget about the few files I'd like off of it, formatting will probably leave me with a fairly useless 32MB card. If anyone has any method of at least repairing the card, it would be much appreciated.


pfsense long ping to google

I have a pfsense box set up. What happens is I set a rule so I can't hit the admin interface `192.168.3.1` from the box. With the rule enabled               --- www.l.google.com ping statistics ---          2 packets transmitted, 2 received, 0% packet loss, time 5080ms     rtt min/avg/max/mdev = 37.684/37.776/37.869/0.215 ms     root@bad-apple:/etc#      Rule disabled               --- www.l.google.com ping statistics ---     2 packets transmitted, 2 received, 0% packet loss, time 1001ms     rtt min/avg/max/mdev = 42.064/44.104/46.144/2.040 ms      disallow Rule that causes it.               ID  Proto   Source  Port    Destination     Port    Gateway     Queue   Schedule    Description                       *   APPLESERVER net     *   192.168.3.1     *           *        none           I don't want the server to be able to hit admin interface, but would like to hit internet for configuration of the machine. Has anybody had this problem before? I have below this disallow rule an allow all from APPLESERVER NET to * because if I set destination to WAN net dns dies. Well what happens is with the rule enabled I ping and it shows up about every 5-10 seconds for a line to appear in ssh. Without the rule it runs like a normal machine, very fast-like. This issue doesn't either of my LANS and they have the same respective dns servers and block [pfsense]admin. [one lAN is admin lan so no block rule on that] I run everything on LAN2 and plug in manually to LAN1 for administration. Update - added /tmp/debug.config * * *               #System aliases          loopback = "{ lo0 }"     WAN = "{ re0 }"     ADMIN = "{ re1 }"     LAN = "{ re2 }"     APPLESERVER = "{ re3 }"          #SSH Lockout Table     table <sshlockout> persist     table <webConfiguratorlockout> persist     #Snort tables     table <snort2c>          table <virusprot>          # User Aliases      table <EasyRuleBlockHostsWAN> {   10.35.0.1/32 }      EasyRuleBlockHostsWAN = "<EasyRuleBlockHostsWAN>"          # Gateways     GWOPT1GW = " route-to ( re2 192.168.1.1 ) "     GWWAN = " route-to ( re0 wan ip ) "               set loginterface re1     set optimization normal     set limit states 23000     set limit src-nodes 23000          set skip on pfsync0          scrub in on $WAN all    fragment reassemble     scrub in on $ADMIN all    fragment reassemble     scrub in on $LAN all    fragment reassemble     scrub in on $APPLESERVER all    fragment reassemble               no nat proto carp     no rdr proto carp     nat-anchor "natearly/*"     nat-anchor "natrules/*"               # Outbound NAT rules          # Subnets to NAT      tonatsubnets    = "{ 192.168.1.0/24 192.168.2.0/24 192.168.3.0/24 127.0.0.0/8  }"     nat on $WAN  from $tonatsubnets port 500 to any port 500 -> 24.220.153.106/32 port 500       nat on $WAN  from $tonatsubnets to any -> 24.220.153.106/32 port 1024:65535                 # Load balancing anchor     rdr-anchor "relayd/*"     # TFTP proxy     rdr-anchor "tftp-proxy/*"     rdr pass on re2 proto udp from any to any port tftp -> 127.0.0.1 port 6969     table <negate_networks> { 24.220.152.0/23 192.168.1.0/24 192.168.2.0/24 192.168.3.0/24 }     # NAT Inbound Redirects     rdr on re0 proto { tcp udp } from any to any port 21 -> 192.168.2.3     rdr on re0 proto { tcp udp } from any to any port 5000:5050 -> 192.168.2.3     rdr on re0 proto { tcp udp } from any to any port 80 -> 192.168.3.2     rdr on re0 proto { tcp udp } from any to any port 443 -> 192.168.3.2     # UPnPd rdr anchor     rdr-anchor "miniupnpd"          anchor "relayd/*"     #---------------------------------------------------------------------------     # default deny rules     #---------------------------------------------------------------------------     block in log all label "Default deny rule"     block out log all label "Default deny rule"          # We use the mighty pf, we cannot be fooled.     block quick proto { tcp, udp } from any port = 0 to any     block quick proto { tcp, udp } from any to any port = 0          # Block all IPv6     block in quick inet6 all     block out quick inet6 all          # Snort package     block quick from <snort2c> to any label "Block snort2c hosts"     block quick from any to <snort2c> label "Block snort2c hosts"          # SSH lockout     block in log quick proto tcp from <sshlockout> to any port 22 label "sshlockout"          # webConfigurator lockout     block in log quick proto tcp from <webConfiguratorlockout> to any port 443 label "webConfiguratorlockout"     block in quick from <virusprot> to any label "virusprot overload table"     table <bogons> persist file "/etc/bogons"     # block bogon networks     # http://www.cymru.com/Documents/bogon-bn-nonagg.txt     block in log quick on $WAN from <bogons> to any label "block bogon networks from WAN"     antispoof for re0     # block anything from private networks on interfaces with the option set     antispoof for $WAN     block in log quick on $WAN from 10.0.0.0/8 to any label "block private networks from wan block 10/8"     block in log quick on $WAN from 127.0.0.0/8 to any label "block private networks from wan block 127/8"     block in log quick on $WAN from 172.16.0.0/12 to any label "block private networks from wan block 172.16/12"     block in log quick on $WAN from 192.168.0.0/16 to any label "block private networks from wan block 192.168/16"     # allow our DHCP client out to the WAN     pass in on $WAN proto udp from any port = 67 to any port = 68 label "allow dhcp client out WAN"     pass out on $WAN proto udp from any port = 68 to any port = 67 label "allow dhcp client out WAN"     # Not installing DHCP server firewall rules for WAN which is configured for DHCP.     antispoof for re1     # allow access to DHCP server on ADMIN     pass in quick on $ADMIN proto udp from any port = 68 to 255.255.255.255 port = 67 label "allow access to DHCP server"     pass in quick on $ADMIN proto udp from any port = 68 to 192.168.1.1 port = 67 label "allow access to DHCP server"     pass out quick on $ADMIN proto udp from 192.168.1.1 port = 67 to any port = 68 label "allow access to DHCP server"     antispoof for re2     # allow access to DHCP server on LAN     pass in quick on $LAN proto udp from any port = 68 to 255.255.255.255 port = 67 label "allow access to DHCP server"     pass in quick on $LAN proto udp from any port = 68 to 192.168.2.1 port = 67 label "allow access to DHCP server"     pass out quick on $LAN proto udp from 192.168.2.1 port = 67 to any port = 68 label "allow access to DHCP server"     antispoof for re3     # allow access to DHCP server on APPLESERVER     pass in quick on $APPLESERVER proto udp from any port = 68 to 255.255.255.255 port = 67 label "allow access to DHCP server"     pass in quick on $APPLESERVER proto udp from any port = 68 to 192.168.3.1 port = 67 label "allow access to DHCP server"     pass out quick on $APPLESERVER proto udp from 192.168.3.1 port = 67 to any port = 68 label "allow access to DHCP server"          # loopback     pass in on $loopback all label "pass loopback"     pass out on $loopback all label "pass loopback"     # let out anything from the firewall host itself and decrypted IPsec traffic     pass out all keep state allow-opts label "let out anything from firewall host itself"     pass out route-to ( re0 wan ip ) from 24.220.153.106 to !24.220.152.0/23 keep state allow-opts label "let out anything from firewall host itself"     # make sure the user cannot lock himself out of the webConfigurator or SSH     pass in quick on re1 proto tcp from any to (re1) port { 80 443  22 } keep state label "anti-lockout rule"          # User-defined rules follow          anchor "userrules/*"     block  in  quick  on $WAN reply-to ( re0 wan ip )  from   $EasyRuleBlockHostsWAN to any  label "USER_RULE: Easy Rule: Blocked from Firewall Log View"     pass   in  quick  on $WAN reply-to ( re0 wan ip )  proto { tcp udp }  from any to   192.168.2.3 port 21   label "USER_RULE: NAT "     pass   in  quick  on $WAN reply-to ( re0 wan ip )  proto { tcp udp }  from any to   192.168.2.3 port 4999 >< 5051   label "USER_RULE: NAT "     pass   in  quick  on $WAN reply-to ( re0 wan ip )  proto { tcp udp }  from any to   192.168.3.2 port 80   label "USER_RULE: NAT Rule for web 80"     pass   in  quick  on $WAN reply-to ( re0 wan ip )  proto { tcp udp }  from any to   192.168.3.2 port 443   label "USER_RULE: NAT ssl web "     block  in  quick  on $WAN reply-to ( re0 wan ip )  from any to any  label "USER_RULE"     block  in  quick  on $ADMIN  from any to any  label "USER_RULE"     block  in  quick  on $LAN  from any to   192.168.2.1  label "USER_RULE"     block  in  quick  on $LAN  from any to   192.168.1.1  label "USER_RULE"     block  in  quick  on $LAN  from any to   192.168.3.1  label "USER_RULE"     pass  in  quick  on $LAN  from 192.168.2.1/24 to any keep state  label "USER_RULE: Default allow OPT1 to any rule"     pass  in  quick  on $LAN  proto tcp  from any to 192.168.3.1/24 port 22  flags S/SA keep state  label "USER_RULE"     pass  in  quick  on $LAN  proto tcp  from any to 192.168.3.1/24 port 80  flags S/SA keep state  label "USER_RULE"     pass  in  quick  on $LAN  proto tcp  from any to 192.168.3.1/24 port 81  flags S/SA keep state  label "USER_RULE"     pass  in  quick  on $LAN  proto { tcp udp }  from any to   192.168.3.2 port 10000  keep state  label "USER_RULE"     pass  in  quick  on $LAN  proto tcp  from 192.168.2.1/24 to 192.168.3.1/24 port 443  flags S/SA keep state  label "USER_RULE"     block  in  quick  on $LAN  from any to any  label "USER_RULE"     block  in  quick  on $APPLESERVER  from any to 192.168.2.1  label "USER_RULE"     block  in  quick  on $APPLESERVER  proto { tcp udp }  from any to   192.168.3.1 port 80   label "USER_RULE"     block  in  quick  on $APPLESERVER  proto { tcp udp }  from any to   192.168.3.1 port 443   label "USER_RULE"     block  in  quick  on $APPLESERVER  proto { tcp udp }  from any to   192.168.3.1 port 22   label "USER_RULE"     block  in  quick  on $APPLESERVER  from any to 192.168.1.0/24  label "USER_RULE"     pass  in  quick  on $APPLESERVER  from 192.168.3.1/24 to any keep state  label "USER_RULE"          # VPN Rules     anchor "tftp-proxy/*"      I've updated it with the debug.config file. So my workaround for the fix was to only block 22,80,443 from the 192.168.3.0/24 subnet [appleserver subnet]. This fixed my speed issue, but I'm not sure if this is a great way for a correct fix. Perhaps it could be a dns issue, but then entering in a wan ip on a remote machine takes about the same[long] amount of time with all block rule enabled as domain name route.


Map Caps Lock to Control in Linux Mint

I am running the latest version of Linux Mint with Cinnamon. I'm trying to map caps lock to control, but I cannot figure out how to do it. All web searches i've done has lead me to older versions of Linux Mint (there is no keyboard layout option in my settings). How can I do this?


Cannot enter a forward slash character when logging in via ssh

When I `ssh` into one of our servers, I cannot enter a forward slash character, which makes it difficult to do pretty much anything (like `ls /`). **How can I get the forward slash to work?** Some additional information:   * `/etc/issue` claims it's running "CentOS release 5.7 (Final)"   * The only way I know this is by running `ssh me@some-host cat /etc/issue`   * I'm using Mac OS X Terminal.app, and I've never had trouble with this, on Centos 5 systems or otherwise   * I don't know who or how the machine was built and set up   * `echo $TERM` reports `xterm-256color`   * i don't know if this makes sense to anyone (it doesn't make sense to me), but i `diff`'ed the `/etc/inputrc` of the malfunctioning server with one that works and got the following:              $ diff /tmp/{good,bad}_inputrc     1c1     < # do not bell on tab-completion     ---     > /# do not bell on tab-completion     37a38,49     >      > # Home Key     > "\e[7~":beginning-of-line     >      > # End Key     > "\e[8~":end-of-line     >      > # Delete Key     > "\e[3~":delete-char     >      > # Insert Key     > "\e[2~":paste-from-clipboard


what is $# used in a script for?

In many scripts in my organisation and even on online tutorials, this is a common `if` clause I come across :               if [ $# -eq "somethng" -o $# -eq "somethng" ]      what does this `$#` condition match--some user input by default?   Can this be used on command line directly too??


Debian: Screen stays black occasionally during boot with Asus P8Z68-V Pro/Gen3

I'm running Debian Wheezy on a Asus P8Z68-V Pro/Gen3 mainboard. My graphics card is a Radeon 6850, I'm using the Open Source radeon drivers (xserver-xorg- video-radeon). During boot, my screen occasionally stays black after boot menu selection. I cannot even switch to a terminal console. It freezes forever in that state. Its really strange cause it only happens around half of the time and I cannot see any cause for this behavior. The other half of the times Debian boots successfully.


How to direct bash network request through a socket5 proxy?

I know how to use `http_proxy` to redirect http request, but how to redirect the data with a socket5 proxy such as a SSH tunnel?


How do I prevent wget from loading Apache directory listings in different orders?

I’m trying to recursively download a directory using this command:               wget -r -l2 --no-parent -A "*.pdf" -nd -N -e robots=off http://…      The script gets executed every 15 minutes, so I want to reduce the requests as much as possible. I saw that there are a lot of requests like `?C=M;O=A` which originate from the directory order modifier buttons like _Name_ , _Date_ or _Size_ (example). How can I prevent these requests from happening?


Is uninterruptible sleep the only case?

French wikipedia say: > Un processus en sommeil ininterruptible ne peut s'arrêter (ni libérer ses > ressources) même lorsque SIGKILL apparaît. **Il s'agit d'un des rares cas > dans lequel un système UNIX doit être redémarré afin de régler un problème > logiciel temporaire.** In english (c/p from old revision of english wikipedia): > An uninterruptibly sleeping process may not terminate (and free its > resources) even when sent SIGKILL. > > **This is one of the few cases in which a UNIX system may have to be > rebooted to solve a temporary software problem.** It imply that there is other case than uninterruptible sleep than can need a reboot to solve temporary problem, I thought it was the only one. What are the other cases?


Where does Samba 4 store user passwords? How can I import my password hashes from Samba 3 in Samba 4? I am using my own LDAP server with samba 3, and the password hash is stored within the `userpassword` attribute of the user entry (passdb backend: ldapsam). However Samba 4 uses it own LDAP server and shema, and it does not seem to work when I copy this attribute in the Samba 4 user entry. How can I store Samba 4 passwords within an LDAP attribute?


Symlink with @ symbol?

I found that there is a symlink generated by ruby which has a `@` sign at the path: > default -> /Users/MyUserName/.rvm/rubies/ruby-2.0.0-p247@gemset The folder `/Users/MyUserName/.rvm/rubies/ruby-2.0.0-p247` exists, but what is the `@gemset` part ?


Weird SSH/SCP progress meter behavior

I've got a very weird SSH behavior and it's making me a bit nervous. Basically the progress meter is totally bogus: so bogus that it's nearly useless. And I fear that there may be something else going on (more on this below). Basically I only have a 60 KB/s upload link or so, yet every single scp I initiate starts saying it's doing 2 MB/s. Then it invariably tries to "fix" that number, slowly converging toward the real value. Then, for "big" files (a few MB or more), it invariably stalls at 100% for many seconds (and eventually it succeeds and I get back to the prompt). The output looks like this:               ...     test.tgz 16% 2112KB   2.1MB/s   00:04 ETA     test.tgz 17% 2208KB   1.7MB/s   00:06 ETA     test.tgz 18% 2320KB   1.2MB/s   00:08 ETA     test.tgz 19% 2448KB   1.1MB/s   00:08 ETA     test.tgz 20% 2576KB 942.2KB/s   00:10 ETA     test.tgz 21% 2704KB 697.3KB/s   00:14 ETA     test.tgz 22% 2832KB 576.3KB/s   00:16 ETA     test.tgz 23% 2960KB 478.3KB/s   00:20 ETA     test.tgz 24% 3088KB 399.0KB/s   00:23 ETA     test.tgz 25% 3216KB 334.7KB/s   00:27 ETA     test.tgz 26% 3344KB 282.6KB/s   00:32 ETA     test.tgz 27% 3472KB 240.4KB/s   00:37 ETA     test.tgz 28% 3600KB 185.6KB/s   00:48 ETA     test.tgz 29% 3728KB 161.9KB/s   00:54 ETA     test.tgz 30% 3856KB 142.7KB/s   01:01 ETA     ...      (it's on a single line: I did paste multiple lines here, which I got using `scp -vvv` to better explain my issue). At the end, when the output is invariably stuck at 100%, there's actually quite a lot of data missing: I've checked this on the other end and the file is definitely not there in its entirety yet. All the measurements in percentage are basically pointless: when it says that 80% of a 12 MB file are there, there are only about 65% on the server. What can explain this? I'm posting here because I was wondering how these numbers would look like if a man-in-the-middle attack was happening close to my system (maybe on a compromised router or something). I'm using Linux and SSH / SCP since many years and I don't remember that these numbers were _that_ off. **EDIT** Download works as expected: if I scp from the remote host to my computer, then the %, ETA and KB/s are all correct.


Robustly segmenting a csv file containing noisy data

Say I have a csv file with these columns:               timestamp,cpu,memory      An example of the shape of the actual data would be this chart: ![cpu/mem csv data as chart](http://i.stack.imgur.com/gdvrb.png) Having the data visualized in this way, it's easy for the human eye to make out where any of the 4 cpu intensive activities start and end. What would be an easy way, using standard unix cmd line tools, ideally not resorting to `R` or `octave` etc, to **"grep" only the 8 lines of the file that denote the onset and end of these 4 activities** , based on the "cpu" column? Obviously this is somewhat fuzzy, and there is noise in the data, but any solution that gives me 8 lines that are somewhere close to onset/end is appreciated. A short excerpt of the csv file, showing only the first of those 4 bursts of activity:               10:44:21.310,0,53567488     10:44:22.310,1.56257,53575680     10:44:23.326,0,53854208     10:44:24.325,34.3761,57405440     10:44:25.325,73.43985,61747200     10:44:26.325,3.1251,69459968     10:44:27.325,0,69459968     10:44:28.325,0,69459968     10:44:29.325,65.6271,74756096     10:44:30.325,53.1267,77783040     ...     10:50:56.450,35.93865,142700544     10:50:57.450,10.93785,142897152     10:50:58.450,1.56255,142897152     10:50:59.450,0,142897152     10:51:00.450,0,142897152     10:51:01.450,0,142897152      Ideally, this would result in the following 2 lines.               10:44:24.325,34.3761,57405440     10:50:58.450,1.56255,142897152      However, as there is no cpu activity for a couple of seconds between `10:44:26.325` and `10:44:28.325`, I don't expect the answer to be that smart and do something akin to 'smoothing' the data. So if a csv snippet like the above would e.g. yield the following 4 lines, that would suffice.               10:44:24.325,34.3761,57405440     10:44:26.325,3.1251,69459968     10:44:29.325,65.6271,74756096     10:50:58.450,1.56255,142897152