I've just started configuring Nagios from scratch, and I'm new at this. I've been getting this error after adding `objects/printer.cfg`               Error: Could not find any hostgroup matching 'allhosts'     (config file '/etc/nagios3/objects/printer.cfg', starting on line 1)         Error processing object config files!      And this is the content of the `printer.cfg`               define host{             use             generic-host            ; Inherit default values from a template                 host_name       Printer_klen    ; The name we're giving to this printer                 alias           Printer_klen    ; A longer name associated with the printer                 address         10.1.0.45       ; IP address of the printer                 hostgroups      allhosts        ; Host groups this printer is associated with                 }          define service{                 use                     generic-service         ; Inherit values from a template                 host_name               Printer_klen            ; The name of the host the service is associated with                 service_description     Printer Status          ; The service description                 check_command           check_Printer_klen!-C public    ; The command used to monitor the service                 normal_check_interval   10      ; Check the service every 10 minutes under normal conditions                 retry_check_interval    1       ; Re-check the service every minute until its final/hard state is determined                 }          define service{                 use                     generic-service                 host_name               Printer_klen                 service_description     PING                 check_command           check_ping!3000.0,80%!5000.0,100%                 normal_check_interval   10                 retry_check_interval    1                 }


Fedora primary monitor selection

I have machine with Fedora Linux (Schroedinger's cat) 19 with AMD Radeon HD 6800 graphic card. Now, I have monitor plugged in using DVI port and I have TV connected using HDMI port. When machine is booting, the TV is automatically selected as primary screen, but I would like to have my Monitor (DVI port) selected as primary screen and TV (HMDI port) as secondary screen. How do I tell that to Fedora?


Installing Chrome on 64bit Gentoo without Superuser Access

For a bit of background, I am trying to install Chrome (or Chromium) on to a gentoo user account at my university. We are allowed to install software as we like, however we lack superuser access meaning I cannot just run `emerge google-chrome`. Attempting to unpack the 64-bit .rpm provided by google and run it out of my user directory provided me with this:               $ ./chrome/google/chrome/google-chrome     ./chrome/google/chrome/google-chrome: error while loading shared libraries: libcups.so.2: cannot open shared object file: No such file or directory      I don't have access to `rpm2cpio` (rendering the only other answer I could find less than helpful) but I do have access to `rpmunpack` and a whole host of `rpm2[insert archive type here]` commands.


Reading from a continuously changing logfile

There is `/location/of/thefile`, which is a continuously changing logfile. The average density of refreshes is 4 per minute, the possible maximal refresh rate could be 30-40 per minute. Every refresh adds 2-5 lines (average), but it could be hundreds in extreme cases. Every line begins with a `[YYYY-MM-DD HH:MM:SS]` timestamp followed by plaintext (100-200, max. a few hundred characters). My task is to construct a **simple command** which continuously watches this logfile, and sends to the stdout every lines that contain the `foo` _OR_ `bar` alphabetical strings. Before and after those (sub)strings there could be any characters (`\n` only after the (sub)string, of course), even `\0`. The capitalization of the words could be all of the possible variations. Well, my ideas for the solution always contain syscalls for the timing, but I shouldn't use them. Please construct me a **simple command**. Thanks a very lot!


How to copy between two remote hosts using tar piped into SSH from remote server when behind a firewall?

I'd like to transfer a directory between two servers, but compress the directory on the remote host before transfer, and then uncompress to another host. I'm sure it's possible to pipe everything all the way through and do it in a one liner. I realise it would be better of course if I could transfer between the hosts directly but that would involve transferring keys and what not, and I love Unix one line power tools. I'm sure people can come up with a few different ways to do this. I'm looking for the shortest syntax and most bandwidth conservative. To start off I have               ssh -n REMOTEHOST 'tar zcvf - DIRTOCOPY' | localZip.tar.gz


Timing out in a shell script

I have a **shell script** that's **reading from standard input**. In rare circumstances, there will be no one ready to provide input, and the script must **time out**. In case of timeout, the script must execute some cleanup code. What's the best way to do that? This script must be **very portable** , including to 20th century unix systems without a C compiler and to embedded devices running busybox, so Perl, bash, any compiled language, and even the full POSIX.2 can't be relied on. In particular, `$PPID`, `read -t` and perfectly POSIX-compliant traps are not available. Writing to a temporary file is also excluded; the script might run even if all filesystems are mounted read-only. Just to make things more difficult, I also want the script to be reasonably **fast** when it doesn't time out. In particular, I also use the script in Windows (mainly in Cygwin), where fork and exec are particularly low, so I want to keep their use to a minimum. In a nutshell, I have               trap cleanup 1 2 3 15     foo=`cat`      and I want to add a timeout. I can't replace `cat` with the `read` built-in. In case of timeout, I want to execute the `cleanup` function. * * * Background: this script is guessing the encoding of the terminal by printing some 8-bit characters and comparing the cursor position before and after. The beginning of the script tests that stdout is connected to a supported terminal, but sometimes the environment is lying (e.g. `plink` sets `TERM=xterm` even if it's called with `TERM=dumb`). The relevant part of the script looks like this:               text='Éé'  # UTF-8; shows up as ÃÃ© on a latin1 terminal     csi='␛['; dsr_cpr="${csi}6n"; dsr_ok="${csi}5n"  # ␛ is an escape character     stty_save=`stty -g`     cleanup () { stty "$stty_save"; }     trap 'cleanup; exit 120' 0 1 2 3 15     # cleanup code     stty eol 0 eof n -echo                # Input will end with `0n`     # echo-n is a function that outputs its argument without a newline     echo-n "$dsr_cpr$dsr_ok"              # Ask the terminal to report the cursor position     initial_report=`tr -dc \;0123456789`  # Expect ␛[42;10R␛[0n for y=42,x=10     echo-n "$text$dsr_cpr$dsr_ok"     final_report=`tr -dc \;0123456789`     cleanup     # Compute and return initial_x - final_x      How can I modify the script so that if `tr` hasn't read any input after 2 seconds, it is killed and the script executes the `cleanup` function?


Video Watermarking

I am looking for a solution in which I can add watermark to the given video at given frame. Is there any utility/tool to do so ?


Memory management principle used by Linux

Is memory management in the Linux Kernel done using paging or segmentation or both?


Escaping quotes in zsh alias

Following on from this question about stripping newlines out of text, I want to turn this into a zsh alias as follows:               alias striplines=' awk " /^$/ {print \"\n\"; } /./ {printf( \" %s \",$0);}"'      I've tried escaping the quotes inside the awk script, but I'm getting this error:               awk: (FILENAME=bspsrobustness FNR=1) fatal: division by zero attempted      (The file is called `bspsrobustness`) Is there a way to do what I want? I suppose I could turn this into an awk script rather than a zsh alias, is that my best option?


List optional dependencies with pacman on arch linux

I'm using arch linux. Is there a way to list optional dependencies of all installed packages? And if yes, can I filter this list to see only the missing (not installed) packages?


Avoid a prompt about change file mode in a Vim script

I'm trying to make every file that start with shebang to be executable by default, so I use the following line in my vimrc, `au BufWritePost * if getline(1) =~ "^#!" | silent !chmod a+x <afile>` VIM asks me if I want to reload everytime I write the file: ![enter image description here](http://i.stack.imgur.com/R8Xql.png) Any way to avoid that?


How to use `which` on an aliased command?

Like most users, I have a bunch of aliases set up to give a default set of flags for frequently used programs. For instance,               alias vim='vim -X'     alias grep='grep -E'     alias ls='ls -G'      The problem is that if I want to use `which` to see where my `vim`/`grep`/`ls`/etc is coming from, the alias gets in the way:               $ which vim     vim: aliased to vim -X      This is useful output, but not what I'm looking for in this case; I know `vim` is aliased to `vim -X` but I want to know where _that_ `vim` is coming from. Short of temporarily un-defining the alias just so I can use `which` on it, is there an easy way to have `which` 'unwrap' the alias and run itself on that? **Edit:** It seems that `which` is a shell-builtin with different behaviors across different shells. In Bash, SiegeX's suggestion of the `\--skip-alias` flag works; however, I'm on Zsh. Does something similar exist there?


Find where a bash command is defined or sourced from?

Sometimes I want to know what a command I type into `bash` actually evaluates to. Usually I can figure out the location of the executable very easily with `which`.               $ which vim     /usr/bin/vim      But what if I've created an alias for `vim`?               $ alias vim="echo mwahaha"     $ which vim     /usr/bin/vim      Hmm, not good. If I suspect something and want to check if `vim` has been aliased, I know I can type               alias vim      ... but if I had an `alias vim='vim -p'`, I would never actually think to check `vim` aliases because it would still work just fine. How can I know exactly what a specific command in `bash` is being evaluated to?


Print/Tee to console without passing output to pipe

Is there a way to print or tee one thing to the console and still pass something else through to the next pipe? Something like:               echo dog | printOrWhatnot "PUTTING MY THING DOWN" | sed 's/dog/cat/g' | printOrWhatnot "FLIP IT"|rev      that would result in:               PUTTING MY THING DOWN     FLIP IT     tac      **EDIT:** This should also work with multiline input:               printOrWhatNot() {...}          seq 10 30 |printOrWhatNot searching for 3s | grep 3      would output               searching for 3s     13     23     30      Lars' answer seemed to only pass along the first input (here it would be `10`) Also ideally the output would come inline during processing which wasn't what I was seeing with Glen's answer. So               seq 10 30 |tee /dev/tty |printOrWhatNot searching for 3s | grep 3      would make for:               10     11     12     13     14     15     16     17     18     19     20     21     22     23     24     25     26     27     28     29     30     searching for 3s     13     23     30


Boot linux bootloader from Mac OSX

Recently I was running Fedora 17 on my computer which was an HP windows based machine. Unfortunately my computer has a malfunctioning motherboard and will no longer turn on. I removed the hard drive and using a hard drive enclosure I plugged into my backup machine ( Macbook Pro ) hoping I could boot the hard drive from it. Unfortunately the Mac's EFI does not recognize the hard drive as bootable. I'm no linux sysadmin or mac expert. Basically my question is, is there a way I can boot my hard drive which contains a Fedora 17 partition with Grub 2 as the bootloader and a few other linux distros from my MacBook Pro ?. Any help is greatly appreciated. Thanks.


How do you increase MAXSYMLINKS

In a python script, I am creating a bunch of symbolic links chained together. example: link1->link2->link3->.......->somefile.txt I was wondering how you can change the max number of symlinks to be greater than 20?


Does SELinux provide enough extra security to be worth the hassle of learning/setting it up?

I recently installed Fedora 14 on my home pc and have been working on setting up different server related features such as apache, mysql, ftp, vpn, ssh, etc. I ran extremely quickly in to a barrier it felt like when I discovered SELinux which I had not priorly heard of. After doing some research it seemed as though most people were of the opinion that you should just disable it and not deal with the hassle. Personally if it really does add more security I'm not opposed to dealing with the headaches of learning how to appropriately set it up. Eventually I plan on opening my network up so that this pc can be access remotely but I don't want to do that until such time as I'm confident that its secure (more or less... lol). If you have set it up and gotten it functioning correctly do you feel that it was worth the time and hassle? Is it really more secure? If you have opted out of using it was that decision founded on any research worth considering in my situation as well?


How to make scp respect umask

My `scp` doesn't respect **umask** setting of the user it's sending files to. Is there a setting somewhere or should I use a different solution?


How to send a prompt to a remote machine like the "you have mail", ie not using wall

I am currently using wall to show a message on a remote machine when an activity is started and finished. But this is intrusive, as it will write across an editor they might have open etc. What I like is the "you have unread mail message" that shows up on the next line if the user presses return on the terminal. What is this, and how can I interact with it remotely?


Can the shell warn me if a program is waiting for standard input?

Let's say I want to search for a string in a big file: `grep foo bar.txt | less`, but I actually type `grep foobar.txt | less`. Now, `grep` is waiting for me to type something on the terminal. It appears that the command is taking forever, until I notice my mistake. Can the shell (any shell, or perhaps tmux) detect that a command is waiting for console input, and warn me? **Edit:** It seems like each process has a standard input, and the shell has no way of knowing if it's actually waiting for something to arrive there. However, shells like `zsh` know the command line arguments for common commands like `grep` and could therefore warn me for the programs it knows. (`grep f``Tab` does not try to complete anything, `grep foo b``Tab` will try to complete the filename.)


File permissions when transferring to another server

If I was to `chmod 777 blah.sh` on server A and then move it to server B, would it retain the permissions, or would it default to some other permissions once it hit server B?


Create a series of increasingly larger files

I need to test an sftp host for its cutoff of file size upload limitation. I wanted to make a series of files that were of increasingly larger sizes, to try to upload them all and see where they failed. I was doing `for i in {10000..100000} ; do dd if=/dev/zero of=testfile$i bs=$i count=1 ; done ;` but that was taking too long, and the files I was getting were starting at 10K, going to 11K, 12K, etc. I want the size to jump in larger increments. How can a make a series of files that won't have such a fine-grained size difference? I'm thinking the limit is between 0 and 1 MB.


How to get back sudo on Ubuntu?

I have done this:               sudo chown -R myname /usr/      and now I can't use the `sudo` command because of this error: > sudo: must be setuid root And as I read this means that the owner of this file `/usr/bin/sudo` is not the root. It's my user now because of the chown on the `/usr` folder. On many forums and blogs people suggest to do this as root:               # chown root:root /usr/bin/sudo     # chmod 4111 /usr/bin/sudo      ...but the problem with this is that I need to log in as a root, but I can't because If I write `su` in the terminal the password is wrong (actually I use the password what I added to my user):               $ su     Password:     su: Authentication failure      So can I get back the `sudo` command? Edit: My Ubuntu is under Paralells on my Mac OS X.


Reduce redundant logfile

I often have longer redundant log files, redundant in the sense that blocks of text repeat with minor changes. The length of the files makes it difficult to spot the actual information. I had the idea to write a script which identifies recurrences and reduces the file by replacing each recurrence by the output of diff for consecutive blocks. Before I start I would like to know if such a tool (or maybe option to diff) already exists.


How to check if IPv6 is enabled on a Debian Linux?

Can one disable the IPv6 stack on Debian Linux, especially Wheezy? If so how do I know if it's disabled on a system?


Writing /dev/random to file?

If you ran the following, what would happen?               cat /dev/random > ~/randomFile # don't run      Would it be written until the drive runs out of space, or would the system see a problem with this and stop it (like with an infinite symlink loop)?


How can I manage an oversensitive touchpad?

For the most part, I love my new Dell Latitude E6510. However, the touch pad is driving me mad. It's so sensitive that it will respond to my hands being _near_ it, without actually touching it, if they are warm as when I come in from outside or finish doing dishes. Typing is very difficult because I keep sending the mouse off on unintentional clicks and movements. I tried disabling the touchpad entirely, but I don't always have a surface to mouse on, and the eraser mouse isn't doing it for me. I'd like to find a better way to deal with the problem -- possibly by decreasing touchpad sensitivity, having it turn off while typing and back on while not typing, or turning it on/off with a key combination. I'm open to other ideas, too, if I've overlooked something. I'm running Funtoo stable. My WM is XFCE4.


MATLAB install fails: Error extracting tbx.signal.common!

I'm trying to run MATLAB R2008b student on my Fedora Linux machine, but get the following after I run `/.install`:               Error extracting tbx.signal.common!!!      How can I solve this issue?


CentOS5, RHEL5, Java dependent Packages, Alternate JVM/JDK

Specifically regarding Java dependent packages, such as ant. Is it possible to install them via rpm, when using an alternate JVM/JDK? For example, If I install the Oracle JDK, can I use an ant package without installing OpenJDK? Is there anyway this can be done from an RPM? I know I can specify which JDK to use, by executing `update-alternatives --config java`. Additionally I'm specifying a JAVA_HOME, which works as expected. The only available choices seem to be, keeping 3 different JDK's installed, or installing everything manually.


Installed CentOS, Now There is No Windows 8 Options on Restart

I bought a new PC with Windows 8 and wanted to dual-boot linux. I shrank the partition by 50GB in windows, then installed CentOS from a live CD. CentOS is working fine, but I can't boot into Windows 8 any more. My Grub options are CentOS and "other" -- when I select "other" it basically says windows cannot boot properly. I don't believe anything has been overwritten on the Windows 8 partition, but the boot sequence is out of whack. How should I go about troubleshooting this?               [root@localhost]# parted -l     Model: ATA ST500DM002-1BD14 (scsi)     Disk /dev/sda: 500GB     Sector size (logical/physical): 512B/4096B     Partition Table: gpt          Number  Start   End     Size    File system  Name                          Flags      1      1049kB  525MB   524MB   fat32        EFI system partition          boot      2      525MB   567MB   41.9MB  fat32        Basic data partition          hidden      3      567MB   701MB   134MB                Microsoft reserved partition  msftres      4      701MB   1215MB  514MB   ntfs         Basic data partition          hidden, diag      5      1215MB  436GB   435GB   ntfs         Basic data partition      7      436GB   437GB   524MB   ext4                                       boot      8      437GB   488GB   51.0GB                                             lvm      6      488GB   500GB   12.6GB  ntfs         Microsoft recovery partition  hidden, diag               Model: Linux device-mapper (linear) (dm)     Disk /dev/mapper/vg_centos6-lv_swap: 4027MB     Sector size (logical/physical): 512B/4096B     Partition Table: loop          Number  Start  End     Size    File system     Flags      1      0.00B  4027MB  4027MB  linux-swap(v1)               Model: Linux device-mapper (linear) (dm)     Disk /dev/mapper/vg_centos6-lv_root: 47.0GB     Sector size (logical/physical): 512B/4096B     Partition Table: loop          Number  Start  End     Size    File system  Flags      1      0.00B  47.0GB  47.0GB  ext4


In bash, how can I convert a Unicode Codepoint [0-9A-F] into a printable character?

I have a list of Unicode codepoints, but I don't know of a "simple" way to convert these hex values into the actual characters they represent... I've heard that _zsh_ has `echo -e '\u0965'`, but I use _bash_ Is there something as simple as the zsh method, for bash?


light weight disk based backup solution

Currently I am using Dirvish to backup a handful remote machines, both Linux and Windows to local disks. But Dirvish hasn't seen any updates for many years and it has a couple of small annoyances (e.g. deleting the last successful backup when it expires by age). Dirvish features I currently use include (and thus require):   * pre-client - to dump databases to flat files on remote system   * post-server - for basic analysis of changed files in backup set   * connect to remote clients using rsync over ssh Are there any alternatives for Dirvish available that are actively being maintained? Now I did a Google search myself and I did find one alternative, but I am looking for your _experience_ ; does the package work for you and why?


Linux hardware: Apple Magic Track Pad Alternatives

I'm using Linux as my main OS for few years. Before month or so, i tested apple magic track pad and i loved it since i am using laptop touch pad more than a mouse, it requires less movement of hand and it replaces the mouse perfectly up the point you need to draw something. So i tried to find alternatives to it (dell or some other companies since apple production is overpriced), no luck. Any suggestions? My problems:   * I'm not sure if that hardware will work under Linux (Ubuntu, SuSE, Fedora, Arch, etc.).   * Will Linux have full support to that device (multi-touch, gestures, etc.).   * I don't want to use unknown/low quality hardware.   * I will probably need to ship it. There fore local shop-lists won't help. Since my _main_ concern is related to working under Linux and not enough data under such devices i posted this question here.


Installing Linux on an external hard drive and multibooting with Windows 7/8

I want to multi boot Linux (Fedora 19) with my two machines which use Windows 7 and 8. The Windows7 is a desktop, and the laptop is a Windows 8 machine. I used my desktop to install Fedora 19 on the external drive. I can boot Fedora from the desktop but not the other machine. To be clear the portable machine can boot from USB hard disk, I've checked the BIOS. I found that an easy way to boot Linux or any other OS is using an OS independent boot manager. I downloaded Boot-US and tried it out. However when I load it up and it shows the disks it says my desktops primary internal HDD is bootable. The other one, the external disk does not. I checked the help section for the program (specifically Linux Tip (2)) and it required that I edit Lilo. The problem is I am just a newbie to Linux. I know Fedora 19 uses Grub 2 in place of Lilo and I wouldn't know how to safely edit either boot loader anyway. Could somebody help me install this OS to my external Hard Disk and still be able to boot from that when on my desktop OR laptop? [edit] I have a UEFI BIOS on both the desktop and the laptop. I installed Fedora 19 to the external hard disk by use of a LiveDVD. To the contrary of what the comment below says Boot-US should be able to boot from almost anything. It recommends that you try your first boot from a diskette (something nobody uses anymore) or a CD. It can also be installed to the MBR on the Hard Disk but that could make the system impossible to boot if done wrong if I am correct in remembering.


Running Tomcat MySQL and Apache under a group

I am trying to set up a web server at home using Ubuntu, but prefer my bash scripts to be platform agnostic hence why I am asking here. I also dislike apt-get everything. I am trying to create a single bash script to quickly rebuild my server or possibly use with VM's It is my understanding that any services with open ports can pose security risks if run as 'root' to avoid this I have created a `serviceadmin` group and for each service I create a user similar to:               useradd lamppadmin -g servicepadmin -s /sbin/nologin         useradd tomcatadmin -g servicepadmin -s /sbin/nologin      I then install the needed services and restrict their permissions and files accordingly. Given that I am most likely to add more services to this group, I would like to know how one launches multiple service to "run as" group or each individual service as the appropriate user. I always symbolically link launch commands to `/usr/bin`so that I am able to run them from anywhere. So I am just looking for an example to target `lampp start` as an example where it needs to interact with files that belong to user `lamppadmin` or `serviceadmin` group


What does %F mean and how can I stop it meaning it?

On an rxvt-clone (I'm using `rxvt-unicode` but it seems to happen on plain, old `rxvt` as well), the sequence of characters `%F` seems to have some sort of special meaning (as do a few others, such as `%S`). In particular, I get the following:               % date +%F               38;5;0m2011-04-02     % date +%F--%H.%M.%S     38;5;0m--.Hostname.2011-04-02--22.25.59      with the text after the `m` being in some dark almost-black colour. Due to my colour scheme (mauve text on a dark blue polka dot background), this is almost unreadable. What is this, and more importantly, how do I get it to stop? To show why it is particularly annoying, my lecture documents have the date as part of their name. It is therefore quite convenient to be able to write:               xelatex lecture.beamer.$(date +%F).tex      since I can store that in my history and recall it with a few judicious TABs. However, the ensuing output is all the inverse of a whiter shade of pale, making it hard to see if there's an error. In case it makes a difference, my shell is `zsh`.


How to numerical sort by last column?

I have this input:               sdkxyosl 1     safkls 2     asdf--asdfasxy_asd 5     dkd8k  jasd 29     sdi44sw 43     asasd afsdfs 10     rklyasd 4      I need this output:               sdi44sw 43     dkd8k  jasd 29     asasd afsdfs 10     asdf--asdfasxy_asd 5     rklyasd 4     safkls 2     sdkxyosl 1      So i need to sort the lines by the last column. I don't know how many columns are in one line. I just can't figure it out, how to do it. I don't have "perl powers". I just have ~average scripting powers with sed, awk, cut, etc.. Does somebody know how to do it?


Mark occurrences of keyword with a different color

I have a program which spits out an output to `stdout` like:               [OK]      Something is ok     [OK]      Something else is also ok     [FAIL]    This does not look good     [FAIL]    Neither does this     [OK]      At least this is fine      To more easy spot the fails from the output I would like to mark the occurrences of the keyword `FAIL` with red _without_ discarding the other messages. It would be nice if I could also highlight the `OK` keywords with green :). Doing a pipe to `egrep --color FAIL` will only show the lines where the `FAIL` keyword is present.


Can't delete symbolic links, permission denied

I try to delete all symbolic links pointing to Python3.2 with               sudo ls -l . | grep '../Library/Frameworks/Python.framework/Versions/3.2' | awk '{print $9}' | xargs rm      This just gives               rm: 2to3: Permission denied     rm: 2to3-3.2: Permission denied     rm: idle3: Permission denied     rm: idle3.2: Permission denied     rm: pydoc3: Permission denied     rm: pydoc3.2: Permission denied     rm: python3: Permission denied     rm: python3-32: Permission denied     rm: python3-config: Permission denied     rm: python3.2: Permission denied     rm: python3.2-32: Permission denied     rm: python3.2-config: Permission denied     rm: python3.2m: Permission denied     rm: python3.2m-config: Permission denied     rm: pythonw3: Permission denied     rm: pythonw3-32: Permission denied     rm: pythonw3.2: Permission denied     rm: pythonw3.2-32: Permission denied      What gives? Ps. there are similar threads, but there the answer/solution is that the asker did not use sudo.


How to remove a USB drive without worry if its been unmounted?

Sometimes I unplug my usb drive only to find out files were not written to it. I suppose the only way to ensure files are written to it is to right click on the USB drive on the desktop and then select "un-mount", but sometimes I forget. What is the best way to ensure files are written to the USB drive instantly? This way I can remove the USB drive as soon as I notice the LED light on the USB drive stopped blinking. OS: CentOS 6


SNAT problem in iptables

I am trying to reroute traffic from specific devices in my house over openvpn. For this, I've created an OpenVPN tunnel between my house wifi router and my server. Here is my setup:               Wifi router's outgoing interface IP: 192.168.1.102     Wifi router's openvpn tun0: 10.8.0.2     Server's openvpn tun0: 10.8.0.1          My PC                   WiFi                                          Server                                   ,- 10.8.0.2(tun0)    10.8.0.1(tun0) --.                                  |                                      |  _      __  _                       '                 .-,(   ),-.          ' |-|     [__]|=|    wireless     ___|_      VPN      .-(           )-.   VPN   |=|     /::/|_|  <- - - - - >  [__...]  < - - - >  (    internet     ) < - >  |=|                               .                 '-(          ).-'         "^"                               |                    '-.(  ).-'                               `-- 192.168.1.102      Server's iptable configuration:               iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE     iptables -A FORWARD -i eth0 -o tun0 -m state --state RELATED, ESTABLISHED -j ACCEPT     iptables -A FORWARD -i tun0 -o eth2 -j ACCEPT      Wifi router's configuration (with a new routing table openvpn-route):               ip route add default via 10.8.0.1 dev tun0 table openvpn-route     ip rule add fwmark 0x1 table openvpn-route     iptables -t mangle -A PREROUTING -m mac --mac-source aa:aa:aa:aa:aa:aa -j MARK --set-mark 1     iptables -A POSTROUTING -t nat -o tun0 -p tcp --dport 80 -j SNAT --to 10.8.0.2      Now whenever I access sites from my laptop, I see traffic going to wifi router's tun device and from there to the server. However, the SRC IP address of the traffic is 192.168.1.102 (outgoing interface IP of the wifi router). Because of this, I think the server ignores this traffic. When I look at how many packets matched SNATing rule to change SRC IP to 10.8.0.2, I see that count as zero. So that rule is not getting matched for any packet. How can I fix this?


iptables change log

Somehow an iptables rule was added to one of my systems. Does (or can) iptables keep a log about when and (maybe) who made a rule change? If iptables itself can't, is there a wrapper that might do that? I know sudo logs commands, but once someone does "sudo su -", that is the end of that.


Gnome 3.6.1 doesn't work with startx anymore, only with gdm

I normally prefer my system to boot in text mode and manually start Gnome with startx but if I do that with Gnome 3.6.1, I get many errors and a basically unusable operating system. After installing gdm however, Gnome works perfectly fine again. Why is that and how can I return to my startx? Detailed explanation: I use archlinux and after a system update this morning (2012-11-1) with `pacman -Syu` which upgraded my Gnome to 3.6.1 I could not successfully boot Gnome 3 anymore. The graphical user interface was there but there was an error message like "There was an error, all extensions are deactivated" and I could not focus windows other then the first one created and the window title bars at the top were not there anymore. I changed my .xinitrc from `ck-launch- session gnome-session` to `exec gnome-session` because I've read somewhere that this is necessary now but I got exactly the same error. Only after installing gdm and I think enabling it with `systemctl enable gdm` does Gnome work correctly again.


Monitor history of USB flash drives

I have to setup a monitoring system for our internet server, to monitor which USB Flash Drives (Pen Drives) are mounted and unmounted and when.(This is to avoid misuse, and to capture which unauthorized device is/was connected.) Is there any method to monitor flash drive information such as : a) Serial Number, b) Make, c) Model, d) Capacity e) Label f) Time of mount/unmount etc., and store it, to view history about it? I know there are number of commands to monitor currently mounted USB devices. Like `lsusb`,`lshw`. But how do I store that information.


Sort the 'last' output by month

I know that the command last | tac is enough, but I want to do it using the sort command. I cannot sort it by column, it always sorts the first one only. Using bash on Arch Linux.


Why does redirection in crontab result in a zero byte file?

**System: Xubuntu 13.10** When I have this crontab entry               */5 * * * * cat /home/dbk/.bash_aliases &> /home/dbk/Desktop/junk      `junk` has a byte size of `0`. Running               $ cat /home/dbk/.bash_aliases &> /home/dbk/Desktop/junk      gives a file with a proper size and content.


I have two Debian 7 machines and one of those reports "3.2.60-1+deb7u3" as its kernel release and other one reports "3.2.54-2" as its kernel release. Why does the same Debian release have different kernel versions?


Xen error on CentOS

During the creating of a new virtual server in xen using this command               xen-create-image --hostname=minecraft.koanhosting.com --ip 87.98.249.146 --install -method=debootstrap      But I keep getting this error:               Writing inode tables:  0/32^H^H^H^H^H 1/32^H^H^H^H^H 2/32^H^H^H^H^H 3/32^H^H^H^H^H 4/32^H^H^H^H^H 5/32^H^H^H^H^H 6/32^H^H^H^H^H 7/32^H^H^H^H^H 8/32^H^H^H^H^H 9/32^H^H^H^H^H10/32^H^$     Creating journal (32768 blocks): done     Writing superblocks and filesystem accounting information: done          This filesystem will be automatically checked every 28 mounts or     180 days, whichever comes first.  Use tune2fs -c or -i to override.     Done     Installation method: debootstrap          Copying files from host to image.     Copying files from /var/cache/apt/archives -> /tmp/LYC7oAQoxq/var/cache/apt/archives     Done     Done     I: Retrieving Release     E: Failed getting release file http://ftp.us.debian.org/debian/dists/etch/Release          Copying files from new installation to host.     Copying files from /tmp/LYC7oAQoxq/var/cache/apt/archives -> /var/cache/apt/archives     Done     Done     The installation of the new system has failed.          The system is missing the common file: /bin/ls     Done     System installation failed.  Aborting      Can't seem to find any resources on google at all for this error. I have a feeling it's to do with debootstrap, not sure though.


Can't compile XBMC 12 because of TAGLIB problem

I am trying to compile the latest version of XBMC on CentOS 6 x64 but on `./configure` I get:               checking for TAGLIB... no     configure: error: Could not find a required library. Please see the README for your platform.      I tried compiling the taglib coming with XBMC and also downloading the latest version from github. Both compile just fine but the error remains.               [root@xbmc xbmc]# find /usr -name libtag*     /usr/local/lib/libtag.a     /usr/local/lib/libtag.so     /usr/local/lib/libtag_c.so.0     /usr/local/lib/libtag.so.1.12.0     /usr/local/lib/libtag.so.1     /usr/local/lib/libtag_c.so     /usr/local/lib/libtag_c.a     /usr/local/lib/libtag_c.so.0.0.0     /usr/lib64/libtag.so     /usr/lib64/libtag_c.so.0     /usr/lib64/libtag.so.1     /usr/lib64/libtag.so.1.6.1     /usr/lib64/libtag_c.so     /usr/lib64/libtag_c.so.0.0.0     /usr/lib/libtag.so     /usr/lib/libtag_c.so.0     /usr/lib/libtag.so.1.12.0     /usr/lib/libtag.so.1     /usr/lib/libtag_c.so     /usr/lib/libtag_c.so.0.0.0      Any ideas how to fix that? **UPDATE**   @slm               Package taglib-devel-1.6.1-1.1.el6.x86_64 already installed and latest version      These are the only options configure help lists regarding taglib:                TAGLIB_CFLAGS  C compiler flags for TAGLIB, overriding pkg-config      TAGLIB_LIBS linker flags for TAGLIB, overriding pkg-config


Restarting a service from a script

I have a _init script_ - `/etc/init.d/myservice`, which starts some processes, including a **CLI process**. And from this CLI process, I am adding a _command_ which can be used to restart the service (restart _ourselves_ - kind of). What I tried - from a script (that is spawned from the CLI command), ran `sudo service myservice restart`, where `restart` is `stop;start`. But, this doesn't work! i.e, even though the `stop` happens, by the time `start` part is executing, the script terminates (not with any signals, but plain `EXIT`). I tried combinations of `nohup`, `disown` etc, but didn't seem to work! I am not sure how to complete the `restart` without getting terminated - any pointers, or workarounds to debug further ? To summarize:   * `myservice` -> spawns many processes, including **CLI**   * CLI -> has a `restart` command, which invokes a _script_   * _script_ does `sudo service myservice restart` --More info-- I'm on Ubuntu 12.04, i.e, `upstart`


Oracle Linux 6.5: Unable to install VLC 2.0.10 from rpmfusion-free-updates

I want to install VLC in my linux box. When I execute yum install vlc, it displays following message:-               Loaded plugins: refresh-packagekit, security     Setting up Install Process     Resolving Dependencies     --> Running transaction check     ---> Package vlc.i686 0:2.0.10-1.el6 will be installed     --> Processing Dependency: vlc-core(x86-32) = 2.0.10-1.el6 for package: vlc-2.0.10-1.el6.i686     --> Processing Dependency: libvlccore.so.5 for package: vlc-2.0.10-1.el6.i686     --> Processing Dependency: libcaca.so.0 for package: vlc-2.0.10-1.el6.i686     --> Processing Dependency: kde-filesystem for package: vlc-2.0.10-1.el6.i686     --> Processing Dependency: libaa.so.1 for package: vlc-2.0.10-1.el6.i686     --> Running transaction check     ---> Package aalib-libs.i686 0:1.4.0-0.18.rc5.el6.1 will be installed     ---> Package kde-filesystem.noarch 0:4-30.1.el6 will be installed     ---> Package libcaca.i686 0:0.99-0.9.beta16.el6 will be installed     --> Processing Dependency: libglut.so.3 for package: libcaca-0.99-0.9.beta16.el6.i686     ---> Package vlc-core.i686 0:2.0.10-1.el6 will be installed     --> Processing Dependency: live555date(x86-32) = 2012.04.27 for package: vlc-core-2.0.10-1.el6.i686     --> Processing Dependency: libx264.so.120 for package: vlc-core-2.0.10-1.el6.i686     Package x264-libs is obsoleted by x264, but obsoleting package does not provide for requirements     --> Processing Dependency: libavformat.so.53(LIBAVFORMAT_53) for package: vlc-core-2.0.10-1.el6.i686     Package ffmpeg-libs is obsoleted by ffmpeg, but obsoleting package does not provide for requirements     --> Processing Dependency: libtiger.so.5 for package: vlc-core-2.0.10-1.el6.i686     --> Processing Dependency: libzvbi.so.0 for package: vlc-core-2.0.10-1.el6.i686     --> Processing Dependency: libavcodec.so.53 for package: vlc-core-2.0.10-1.el6.i686     Package ffmpeg-libs is obsoleted by ffmpeg, but obsoleting package does not provide for requirements     --> Processing Dependency: libavutil.so.51 for package: vlc-core-2.0.10-1.el6.i686     --> Processing Dependency: libgme.so.0 for package: vlc-core-2.0.10-1.el6.i686     --> Processing Dependency: libavformat.so.53 for package: vlc-core-2.0.10-1.el6.i686     --> Processing Dependency: libavutil.so.51(LIBAVUTIL_51) for package: vlc-core-2.0.10-1.el6.i686     --> Processing Dependency: libavcodec.so.53(LIBAVCODEC_53) for package: vlc-core-2.0.10-1.el6.i686     --> Running transaction check     ---> Package freeglut.i686 0:2.6.0-1.el6 will be installed     ---> Package game-music-emu.i686 0:0.5.5-1.el6 will be installed     ---> Package libavcodec53.i686 0:0.10.9-58.el6 will be installed     --> Processing Dependency: libxavs.so.1 for package: libavcodec53-0.10.9-58.el6.i686     --> Processing Dependency: libx264.so.136 for package: libavcodec53-0.10.9-58.el6.i686     ---> Package libavformat53.i686 0:0.10.9-58.el6 will be installed     ---> Package libavutil51.i686 0:1.0.8-58.el6 will be installed     ---> Package libtiger.i686 0:0.3.4-1.el6 will be installed     ---> Package live555.i686 0:0-0.34.2012.01.25.el6 will be updated     ---> Package live555.i686 0:0-0.37.2012.04.27.el6 will be an update     ---> Package vlc-core.i686 0:2.0.10-1.el6 will be installed     --> Processing Dependency: libx264.so.120 for package: vlc-core-2.0.10-1.el6.i686     Package x264-libs is obsoleted by x264, but obsoleting package does not provide for requirements     ---> Package zvbi.i686 0:0.2.33-6.el6 will be installed     --> Running transaction check     ---> Package libx264_136.i686 0:0.136-19_20130917.2245.el6 will be installed     ---> Package libxavs1.i686 0:0.1.51-2.el6 will be installed     ---> Package vlc-core.i686 0:2.0.10-1.el6 will be installed     --> Processing Dependency: libx264.so.120 for package: vlc-core-2.0.10-1.el6.i686     Package x264-libs is obsoleted by x264, but obsoleting package does not provide for requirements     --> Finished Dependency Resolution     Error: Package: vlc-core-2.0.10-1.el6.i686 (rpmfusion-free-updates)                Requires: libavformat.so.53(LIBAVFORMAT_53)                Available: ffmpeg-libs-0.10.9-1.el6.i686 (rpmfusion-free-updates)                    libavformat.so.53(LIBAVFORMAT_53)                Available: ffmpeg-libs-0.10.11-1.el6.i686 (rpmfusion-free-updates)                    libavformat.so.53(LIBAVFORMAT_53)                Available: libavformat53-0.8.15-55.el6.i686 (atrpms)                    libavformat.so.53(LIBAVFORMAT_53)                Available: libavformat53-0.9.3-56.el6.i686 (atrpms)                    libavformat.so.53(LIBAVFORMAT_53)                Available: libavformat53-0.10.9-58.el6.i686 (atrpms)                    libavformat.so.53(LIBAVFORMAT_53)                Available: ffmpeg-libs-0.6.5-2.el6.i686 (linuxtech-release)                    Not found     Error: Package: vlc-core-2.0.10-1.el6.i686 (rpmfusion-free-updates)                Requires: libavcodec.so.53                Available: ffmpeg-libs-0.10.9-1.el6.i686 (rpmfusion-free-updates)                    libavcodec.so.53                Available: ffmpeg-libs-0.10.11-1.el6.i686 (rpmfusion-free-updates)                    libavcodec.so.53                Available: libavcodec53-0.8.15-55.el6.i686 (atrpms)                    libavcodec.so.53                Available: libavcodec53-0.9.3-56.el6.i686 (atrpms)                    libavcodec.so.53                Available: libavcodec53-0.10.9-58.el6.i686 (atrpms)                    libavcodec.so.53                Available: ffmpeg-libs-0.6.5-2.el6.i686 (linuxtech-release)                    Not found     Error: Package: vlc-core-2.0.10-1.el6.i686 (rpmfusion-free-updates)                Requires: libx264.so.120                Available: libx264_120-0.120-0.20120424.1.el6.i686 (linuxtech-release)                    libx264.so.120                Available: x264-libs-0.120-4.20120303.el6_bootstrap.i686 (rpmfusion-free-updates)                    libx264.so.120                Available: x264-libs-0.120-5.20120303.el6.i686 (rpmfusion-free-updates)                    libx264.so.120      You could try using --skip-broken to work around the problem      You could try running: rpm -Va --nofiles --nodigest      I don't know why I am getting this error. In my knowledge, if there are any dependencies, then package manager should find and install them too. Can anybody tell me whats wrong with yum? Please help!


Pattern matching from the input arguments

we're trying to enhance the scripts. Users will pass some arguments and part of the arguments will have 5.0.3 For an example the input argument would be like Jboss5.0.3GA. Since it ( Jboss5.0.3GA ) has "5.0.3" we'll try to locate the installation binary file "Jboss5.0.3GA.tar". The current script we've now is a KSH script. I'm trying to use `if` condition with `ksh` script Sample usecases/test:               ./test.sh Jboss5.0.3GA     Match found... we'll try to locate the installation binary     ./test.sh Jboss5.0.3     Match found... we'll try to locate the installation binary     ./test.sh 5.0.3     Match found... we'll try to locate the installation binary     ./test.sh Jboss5.1.3     No Match found ... we'll be exiting teh script.


Ksh Script to ftp multiple directories simultaneously

I'm new to this site and i have this problem: I have a directory in unix with multiple directories in it. Each directory have around 5k files in it. So we are talking about 40k to 50k files. I need to send this over to a windows server, using FTP ( only because i only have FTP ). So, i have a script that,loops thru each directory and sent this files. However, this is painful slow, so i want to do it simultaneously. This is what i have right now, it start to send this files and then somehow never finishes. Log just show it was working with a 221 message in the end. However, this doesn't guarantee that all my files are sent. I do a manual count on them and can see that sometimes, when a folder have 5000 files sometimes just 800 are sent. Log doesn't shoow way. Also my script keep running long after the transfer stops. i can see it by using ps -ef. Can someone take a look and advise any improvement or why im getting this weird behavior ? Some info on my setup:   * HP-UX 9000/859 B.10.20 E   * Ksh version : How ? tried --version , echo $KSH_VERSION ,swlist, nothing worked My Script :               #! /usr/bin/ksh          if [[ $# -eq 0 ]]; then       print "No arguments, Please enter password for ftp process"       exit     fi          exec 4>~/ftpParallel.log          #Directory to send     CONVERTED_DIR=/data/history/     #FTP Variables     HOST=xxxxx.com     PORT=8009     USER=yyyyy     PASS=$1          ftpFiles(){         #   Do some processing and lets get the group and the dategroup, Format will be#    /DATA/BRCPCB/201101         GROUP=$1         DATEGROUP=$2         #now mount the destdir based on the curent dir         DESTDIR=/DATA/$GROUP         cd $CONVERTED_DIR/$GROUP/$DATEGROUP         i=0         ftp -nv >&4 2>&4 |&         print -p open $HOST $PORT         print -p user $USER $PASS         print -p mkdir $DESTDIR         print -p mkdir $DESTDIR/$DATEGROUP         print -p cd $DESTDIR/$DATEGROUP         ls | while read filename ; do           [[ -f $filename ]] && print -p put $filename           (( i += 1 ))         done         print -p close         print -p bye         print -p "$DATEGROUP send $i files"     }          #Get All Folders structure, we will need it to iterate and search for PeakPro Files Later     a=`find $CONVERTED_DIR -type d  2>/dev/null | awk 'BEGIN{FS="/"}{if($NF ~/^[0-9]{6}$/)print $(NF-1),$NF}'`      echo "$a" | while read item ; do        ftpFiles $item & #this will make the function be called in background     done     wait     exit 0      * * * **UPDATE** : I've changed the code as requested and found new interesting things. It appears that my FTP jobs keep running, even after they stopped: This are the FTP logs :               $ tail -5 ftpParallel200103.log     150 Opening ASCII mode data connection for C31905.CVFS.     226 Transfer complete.     15931 bytes sent in 0.01 seconds (2117.55 Kbytes/s)     200 PORT command successful.     150 Opening ASCII mode data connection for C31905.RVFS.     $ tail -5 ftpParallel200104.log     200 PORT command successful.     150 Opening ASCII mode data connection for WG4829.RVFS.     226 Transfer complete.     12110 bytes sent in 0.01 seconds (1011.91 Kbytes/s)     221       $ tail -5 ftpParallel200105.log     150 Opening ASCII mode data connection for C51047.CVFS.     226 Transfer complete.     159734 bytes sent in 0.15 seconds (1027.98 Kbytes/s)     200 PORT command successful.     150 Opening ASCII mode data connection for C51047.RVFS.     $      As you can see, only 1 of them finished ( Code 221 - FTP BYE ). Others never finished and job keep running ( i've started it using `nohup ftpParallel.sh &` ) :                rcsanto  8314  8299  5 10:15:27 ttyq6     0:00 ps -ef      rcsanto 25834 25833  0 05:35:00 ?         0:00 ls      rcsanto 25828 25826  0 05:35:00 ?         0:00 ls      rcsanto 25813 25808  0 05:35:00 ?         0:27 ftp -nv      rcsanto 25815 25808  0 05:35:00 ?         0:19 ftp -nv      rcsanto 25833 25816  0 05:35:00 ?         0:01 ftpParallel.sh ./ftpParallel.sh roJabSuP08WJjco      rcsanto  8299  8298  0 10:15:15 ttyq6     0:00 -sh      rcsanto  8315  8299  1 10:15:27 ttyq6     0:00 grep rcsanto      rcsanto 25808     1  0 05:34:46 ?         0:00 ftpParallel.sh ./ftpParallel.sh roJabSuP08WJjco      rcsanto 25826 25815  0 05:35:00 ?         0:02 ftpParallel.sh ./ftpParallel.sh roJabSuP08WJjco      rcsanto 25816 25808  0 05:35:00 ?         0:08 ftp -nv      rcsanto 25825 25813  0 05:35:00 ?         0:02 ftpParallel.sh ./ftpParallel.sh roJabSuP08WJjco      rcsanto 25827 25825  0 05:35:00 ?         0:00 ls      This is the nohup LOG :               FTP starting at: Tue Feb  5 04:51:48 CST 2013        rm: /homrm: /homrm: /homrm: /homrm: /homrm: /home/rcsante/rcsante/rcsante/rcsante/rcsante/rcsanto/ftpParo/ftpParo/ftpParo/ftpParo/ft         allel200allel200104.log non-existent         107.log non-exi106.log304.log non-existent          non-existent          stent          non-existent      I believe the variables are being messed up somehow. IT also appears that the FTP dies within an hour of running, maybe its timming out ??               -rw-rw-rw-   1 rcsanto    pp_user     249853 Feb  5 05:51 ftpParallel200103.log     -rw-rw-rw-   1 rcsanto    pp_user     937693 Feb  5 06:22 ftpParallel200104.log     -rw-rw-rw-   1 rcsanto    pp_user     172395 Feb  5 05:47 ftpParallel200105.log     -rw-rw-rw-   1 rcsanto    pp_user      88497 Feb  5 05:41 ftpParallel200106.log     -rw-rw-rw-   1 rcsanto    pp_user     981598 Feb  5 06:24 ftpParallel200107.log     -rw-rw-rw-   1 rcsanto    pp_user     819814 Feb  5 06:21 ftpParallel200304.log      Thanks for all your help.


How to display data in columns in two variables with the same format?

I coded the following to display data formatted in columns:               str1='hello i      am robert     and your ma frnd'          str2='thisisaverylongword thisistoohehehe andherefinishthe         string     hereis a other linefortheexample'          IFS=$'\n'     echo '----------------------'     echo 'STRING SHORT'     echo '----------------------'     echo "$str1" | column -t     echo     echo '----------------------'     echo 'STRING LONG'     echo '----------------------'     echo "$str2" | column -t      Which outputs:               ----------------------     STRING SHORT     ----------------------     hello  i     am  robert     and    your  ma  frnd          ----------------------     STRING LONG     ----------------------     thisisaverylongword  thisistoohehehe  andherefinishthe  string     hereis               a                other             linefortheexample      Ok, now I'm trying to format the string with the same pattern, but without merge them. This is the result I'm looking for:               ----------------------     STRING SHORT     ----------------------     hello                i                am                robert     and                  your             ma                frnd          ----------------------     STRING LONG     ----------------------     thisisaverylongword  thisistoohehehe  andherefinishthe  string     hereis               a                other             linefortheexample      Do you have any idea to do it? May be merging the strings and splitting it before the format? Note that this is only an example, I'm looking for a generic solution, not only for this specific case.


KVM: network partially lost for the host, guests are fine

I got KVM working fine on a Linux system, for quite some weeks. Then today something weird happened: suddenly the host (and the host only) lost some of its Internet access:   * it can still access the LAN (I can ssh to other machines)   * it can still access the guests (for example I can ssh from the host into a Linux guest)   * the forwarding still works (other physical machines on the LAN still have Internet access, yet their using the KVM host as the 'forwarder') But I didn't touch any configuration file. I was just browsing / using the guests. I tried to _ifconfig down br0_ and then _ifconfig up br0_ and reset the route, but to not avail. Does anyone have any idea as to what's going up? It's my main workstation and it has 2 months of uptime: I don't like rebooting so I'd rather not have to do it (moreover it would just show that the machine ain't stable enough). **EDIT** : I add here more details/answers hoping you guys can help me out a bit Meanwhile I decided to do a shutdown and bring the machine back up and now everything is working fine again but still... I'd like to know if I could solve this the next time it happens without needing to shutdown the host. > do your VMs us a 'public bridge' networking method? (ie: bridged to local > lan) Yes I think so: I use _br0_ and both the host and the VMs have IPs that are 10.0.0.x which is the same as other physical machines on my LAN > is your host interface wired or wireless? All wired, no WiFi at all at my home : ) > is your default gateway a commodity "router" such as you get from Verizon or > Comcast? It's a Zyxel that I setup myself (I didn't try rebooting it) > if you reboot one of the VMs, does it receive a full network configuration, > and is it still capable of reaching the internet, even when the host OS is > not? Yes. That was the "crazy" part. It's as if the host's IP had an issue but the "bridging" kept working fine: I did reboot both VMs and they did both get back network access. I didn't _netstat -rn_ because I had already rebooted the machine but I will next time there's an issue (and compare to a known ok _netstat -rn_ that I now took).


Resolving Debian wireless issue

I typically dual boot my laptop betwen a Win7 and Ubuntu partition, but keep a spare partition for playing around with new distros. Earlier this week, I decided to try out Debian Squeeze. For the most part, the install has gone smoothly. However, the wireless is not working, and this is apparently a well known issue for Debian. The thing is, my wireless card apparently requires the iwlagn firmware iwlwifi-5000-5.ucode. I downloaded the updated 0.33 package that supposedly includes this firmware and installed it using the package manager. It still isn't working, as `dmesg | grep firmware` returns 'looking for firmware v5, found v0' This laptop is over 2 years old and I have zero problems with networking in Ubuntu Maverick. Any solutions?


Reinstall Fedora, keep files?

Is it possible to reinstall Fedora (I have the DVD that I used to install it yesterday), and keep the files in my home directory? I seem to have messed up my system while trying to get my monitor resolution to work correctly: Installed Fedora in dual boot Windows desktop. Now I can't get full monitor resolution. The step that caused my problem was `yum --enablerepo=rawhide upgrade kernel xorg-x11-drv-ati xorg-x11-drv-ati-firmware`, so I'm looking to either figure out how to get fedora to boot, or just reinstall fedora, but keep the files I've set up so far.


Is there any chance that some of these processes are malicious?

My significant other and I are sometimes paranoid that a foreign government usually associated with last year's Gmail security breach may be attempting to gain access to our computers. There were a lot of strange processes running as root tonight, though I have not opened any root terminals. Can someone please look at these and tell me, yes or no, are they suspicious, and why or why not?               PID TTY          TIME CMD         1 ?        00:00:01 init         2 ?        00:00:00 kthreadd         3 ?        00:00:01 ksoftirqd/0         6 ?        00:00:00 migration/0         7 ?        00:00:00 watchdog/0        13 ?        00:00:00 cpuset        14 ?        00:00:00 khelper        15 ?        00:00:00 netns        16 ?        00:00:00 sync_supers        17 ?        00:00:00 bdi-default        18 ?        00:00:00 kintegrityd        19 ?        00:00:00 kblockd        20 ?        00:00:00 kacpid        21 ?        00:00:00 kacpi_notify        22 ?        00:00:00 kacpi_hotplug        23 ?        00:00:00 kseriod        25 ?        00:00:00 kondemand        26 ?        00:00:00 khungtaskd        27 ?        00:00:03 kswapd0        28 ?        00:00:00 ksmd        29 ?        00:00:00 fsnotify_mark        30 ?        00:00:00 aio        31 ?        00:00:00 crypto       163 ?        00:00:00 khubd       164 ?        00:00:00 ata_sff       165 ?        00:00:00 scsi_eh_0       166 ?        00:00:00 scsi_eh_1       199 ?        00:00:00 usbhid_resumer       222 ?        00:00:00 kjournald       271 ?        00:00:00 udevd       442 ?        00:00:00 kpsmoused       446 ?        00:00:36 net.agent       450 ?        00:00:00 cfg80211       471 ?        00:00:00 hd-audio0       532 ?        00:00:36 net.agent       751 ?        00:00:02 kjournald       755 ?        00:00:00 kjournald       756 ?        00:00:00 kjournald       757 ?        00:00:01 kjournald       801 ?        00:00:00 flush-8:0      1035 ?        00:00:00 rsyslogd      1089 ?        00:00:00 modem-manager      1094 ?        00:00:01 polkitd      1114 ?        00:00:02 wpa_supplicant      1126 ?        00:00:00 gdm3      1137 ?        00:00:00 gdm-simple-slav      1141 tty7     00:20:11 Xorg      1146 ?        00:00:07 acpid      1169 ?        00:00:00 atd      1195 ?        00:00:00 bluetoothd      1209 ?        00:00:00 l2cap      1212 ?        00:00:00 krfcommd      1273 ?        00:00:00 cron      1303 ?        00:00:00 cupsd      1597 ?        00:00:07 kerneloops      1627 ?        00:00:00 kconservative      1631 ?        00:00:00 console-kit-dae      1771 ?        00:00:00 sshd      1800 tty1     00:00:00 getty      1801 tty2     00:00:00 getty      1802 tty3     00:00:00 getty      1803 tty4     00:00:00 getty      1804 tty5     00:00:00 getty      1805 tty6     00:00:00 getty      1852 ?        00:00:00 gdm-session-wor      1857 ?        00:00:15 upowerd      2017 ?        00:00:00 kauditd      2172 ?        00:00:02 udisks-daemon      2176 ?        00:00:00 udisks-daemon      3038 ?        00:00:00 udevd      3039 ?        00:00:00 udevd      3251 ?        00:00:00 NetworkManager      3440 ?        00:00:00 dhclient      5322 ?        00:00:00 kworker/u:2      6717 ?        00:00:00 sleep      6720 ?        00:00:00 sleep     13386 ?        00:00:00 kworker/1:2     21237 ?        00:00:02 kworker/0:2     24297 ?        00:00:11 kworker/1:1     27326 ?        00:00:02 kworker/0:1     29045 ?        00:00:01 kworker/u:0     30132 ?        00:00:00 migration/1     30134 ?        00:00:00 ksoftirqd/1     30135 ?        00:00:00 watchdog/1     30238 ?        00:00:48 irq/19-0000:01:     31245 ?        00:00:00 kworker/u:1


How can I configure SELinux when the semanage command isn't found?

I'm having a very hard time configuring SELinux to allow Sending mail. Looking into selinux documentation I've found I can manage ports via the semanage command, but the command can't be found. Is there another way to manage ports using SELinux, or a way for me to find this command? Worst case: Is there a way to disable selinux, or switch to permissive mode without rebooting? I'm running Fedora. Thanks!


How to print to the left and right of already printed output

I have a command say `printf "%5s1"` and its output is:                   1      How can I print digit `2` to left and digit `3` to right of already printed `1`. So, the output looks like below:                  213      So, there is one condition here that `1` is already printed using command `printf "%5s1"`. I've tried using below command,                printf "%5s1";printf "\r%4s2%1s3\n"      but this overwrites the existing output `1` and I get below output.                  2 3      How can I print a digit right side of already printed digit `1` using `printf` without loosing it assuming that I have to use `printf "%5s1"` first? I'm looking for something like:               printf "%5s1";printf "\r%4s2???\n"


How do I limit the number of files printed by ls?

Is there a way to limit the quantity of listed files on a `ls` command? I've seen:               ls | head -4      but to get `head` to be executed I need to wait for `ls` to finish execution, and with directories with an enourmous quantity of files that can take considerable time. I wish to execute a `ls` command that limits without using that `head` command.


Concatenate two screen sessions

Because of some server issues I ended up with two _screen_ sessions, each with a few windows. I have long-running tasks in both sessions and don’t want to abort one of them just to get rid of one of the screen sessions. Is it possible to concatenate screen sessions so that I end up with a single screen session that contains all windows from both sessions? Or is is possible to manually transfer individual windows from one screen session to another one?


Is there a way to determine what's inhibiting the screensaver?

I have an issue where most often my screensaver will not activate and it's somewhat hard to determine what's preventing it. Is there a way that I can view whatever processes are asking the OS not to display the screensaver? I'm on Linux Mint 11.


How can I pass module parameters for bonding driver when compiled into kernel 2.4?

I have an old 2.4 kernel based linux device using NIC Bonding. Instead of having the NIC Bonding module build as a module and `modprobe`'ed into the system, its compiled directly into the kernel. I'd like to modify the module parameters to add `mode=1 miimon=100` in order to get it to not use round- robbin packet sending, but all of the examples I'm finding seem to assume the module is not compiled into the kernel, or just don't seem to work for me. So far I've tried modifying my `/etc/modules.conf` file to try adding               alias bond0 bonding     options bond0 mode=1 miimon=100     options bonding mode=1 miimon=100      Based on something else I found on line I've tried adding bond0.mode=1 and bonding.mode=1 to my kernel commandline in grub, but regardless, when I boot up and check 'cat /proc/net/bonding/bond0' I always see staring back at me this line:               Bonding Mode: load balancing (round-robin)      I've tried looking for a setting to change in `sysctl` or `/proc` but am coming up empty.


'watch'-ing curl yields unexpected output

I'm trying to `watch curl` for live feedback on HTTP tweaks. However, when I execute the command, the output is garbled with some download stats. I've tried sending `curl`'s `stderr` to `/dev/null`, to no avail. When playing with `curl` on it's own, this output seems nowhere to be found. What am I missing? [edit] the full command line I'm running is actually `watch --color -d "curl -I sandbox.dev | ccze"`, because I want colorized output. It seems that if I remove the `ccze` pipe things are a little better, altough the download stats are still there.


Is Mandatory Access Control overkill for a desktop/lightweight server?

I have fiddled around with both SELinux and Apparmor recently and found these tools invaluable for preventing a spread of damage from a compromised context via one process, whereby and attacker could exploit a buffer overflow or underflow, eventually pushing a new return address on the local call stack, which if I am correct can lead to exec() calls or even a root shell via say, su - Learning Unix & Linux is very interesting to me, and I want some of the more seasonsed people here to please offer me some basic reflection on this topic. Are these tools really overkill for a desktop or non government secure/business context, whereby a serious say, rootkit intrusion can be detected by analyzing the integrity of the System.map file for any rogue entries, and checking of package integrity etc. Say, a remote intrustion on these systems isn't a massive deal following cleanup, so prevention via MAC is overkill? No system is perfect, but would I be correct in making the assumption that on a basic desktop system, passwordless key based logins/swipe card and disabling remote logins via ssh etc, not to mention patching the system and disabling root work on any console, virtual or similar, except for console tty1, which is physically isolated from rogue user programs like firefox, would this setup be "ok" for most intents and purposes, or should MAC reside on ALL systems? Keep in mind most Linux distributions out there DO NOT offer MAC as a default. Fedora and CentOS/RedHat appear to be the only two well known ones to offer out of the box MAC.Thanks:)


How can I use Skype with lxc?

Under Scientific-linux? https://en.wikipedia.org/wiki/LXC I just want to separate Skype, because I don't trust it. We are using it only to call/chat with people, no file transfers!


Communicate between Ubuntu VM and Windows host

I'm running an Ubuntu VM on a Windows 7 host. I have two questions:   1. I think that on Windows, `localhost` is a loopback address, and sending packets to it doesn't actually transmit any data on the wire. Is that correct? On the Ubuntu VM I have a `localhost` as well, pointing to `127.0.0.1`. Is it the same thing?   2. Is it possible to send data from the VM to the host? For example, when I install software on the Ubuntu VM, can I have it send a message to the Windows host? What IP should I use?


Abbreviated current directory in shell prompt?

`vim` has a really nice feature which it utilizes in its paths when they're a bit long: ![enter image description here](http://i.stack.imgur.com/ZCK6V.png) It abbreviates the path to the document in the tab at the top. Is there a way to do something similar to this so my bash prompt doesn't look like this:               rfkrocktk@work-laptop ~/Documents/Projects/Work/maventest/src/main/java/com/tkassembled/ $


Using cygwin and rsync -- "password file must not be other-accessible"

I've finally got an old computer of mine running as a backup server with Ubuntu 11.10. I'm planning on using it to backup my Windows 7 machine weekly using rsync. I've got cygwin installed, and rsync works perfectly. I'm following this guide, though, to create it as a scheduled task: http://justinsomnia.org/2007/02/how-to-regularly-backup-windows-xp-to-ubuntu- using-rsync/ I have an rsync.bat script in C:\, and I can get the script to run correctly if I run it directly from the command line in Cygwin. However, when I try to run the rsync.bat script, I get this:               ERROR: password file must not be other-accessible      So it must be permissions issues on the secret file...I followed that guide and set the permissions to 600, and chowned it to Nate[the administrator]:SYSTEM. Any ideas on what might be causing the problem? EDIT: The file in question is actually on the Windows 7 machine. I figured I should ask here, since I'm dealing specifically with Cygwin and Rsync. After some googling, I found that there is a "strict modes" option that tells rsync not to check the permissions on the secret files, and that was added to accomodate Windows systems. However, after adding it and restarting the rsyn daemon, I still seem to be getting the same error. Here's my rysncd.conf file:               [rsync]          path = /home/nate/backups     comment = My backups     uid = nate     gid = nate     read only = false     auth users = nate     secrets file = /etc/rsyncd.secrets     strict modes = false      And the permissions on the secrets file, according to cygwin:               -rw-------  1 Nate SYSTEM   11 Dec  9 18:48 secret      I feel like I must be missing something really obvious.


Mailman, mlmmj and probably other Mailinglist-Software support the feature 'no mail delivery subscription'. Meaning that you can subscribe and then disable mail delivery. This useful for times you are at vacation or when you want to read that list via gmane.org or a similar service. I can't find anything about majordomo, regarding this feature. Thus my question: Does majordomo support 'no mail delivery subscription'?


block device usage and several mount points

There is some weird thing I don't understand: I have 2G block.img file with an ext4 filesystem inside. There is a 2G test.txt file in block.img. test.txt consists of letters 'a'. Then I mount block.img to /mnt/first. And I can see this test.txt with letters 'a' inside. All is fine. Weird thing begins here: simultaneously I mount block.img on /mnt/second and change all 'a' to 'b' in this text file. And I can see two different 2G files. I have two files 2G (4G used space) on one 2G partition! Unbelievable (: Therefore, there is some mistake in my words, unfortunately I can't find it.


BackupPC can't finish backup

I'm trying to backup /etc/ directory on CentOS 5.2 using BackupPC. It takes several hours and then aborted by signal ALRM. There is a partial backup created with all data from /etc But BackupPC thinks the backup is failed and always starts doing full backup again. If I try to run rsync manually from the backup server it works flawlessly and finishes in about 5-10 seconds. I have additional server with several GB of data I'm backing up and it works without a problem.


Sharing Ubuntu drives with Windows

I'm new to the whole Linux thing. I have a Linux server up and running and have been using this guide as a help. I have an issue with shared drives. My Windows machines can see them but cant write to them says I don't have permission. I'm completely lost. Can anyone help? Let me know if I should post Samba configs. I'm running Windows XP, 7 and 8 and Ubuntu server.


OpenVPN static key ip meaning/order?

I'm following this tutorial. What do the IPs mean after the `ifconfig` here?               dev tun0     ifconfig 10.9.8.1 10.9.8.2     secret /etc/openvpn/static.key      Can I use external IPs (assuming I'm configuring this on a vps/dedicated server)?


Setting timezones

I want to set my timezone to America/New_York. date says that the current time is CEST. I'm using systemd, no desktop environment. Right now I have               /etc/localtime links to /usr/share/zoneinfo/America/New_York     /etc/timezone set to "America/New_York"     /etc/rc.conf set to "America/New_York" (arch linux should be ignored by systemd)     $TZ is unset      Hardware clock is set to utc time and works fine.               TZ=utc date      gives the right output. Unfortunately I'm still on CEST. Am I missing something?


How to install program locally without sudo privileges?

Assume I have ssh access to some Ubuntu server as user and I need some not system tools to be installed for convenience (mc, rtorrent, mcedit). I do not want to bother admins for these small programs. Is there a way to install them (make them run) without using something like `sudo apt-get install`?


Installing dependencies as a non root user

Can anyone please tell what are the steps to installing libxml2 on a server without root privileges? In a manner so it can be seen by other packages? I have installed it but do not know what is the correct location for it and what variable should be set to make it visible. Please help! I have to install a large number of dependencies and I am stuck at the first step!


How to compile programs on Linux systems when I don't have sudo privileges to install the dev dependencies

How should I go about compiling programs that depend on libraries whose development packages (headers and such) aren't pre-installed on the system when I don't have sudo access? In this particular case I have Ubuntu 12.04, but I'm hoping for a more general solution, because it seems bizarre to me that I would need administrator privileges just to install the dev packages so I can compile.


Make polipo to log all urls

i'm using polipo (proxy server) for local caching. is there a way to log all access through polipo just like urlsnarf or other web server log file do?               logFile = "/tmp/access.log"     logLevel = ? # what should i fill to log all url?      and if possible, get cached file location also output for 0xFF is something like this, it does not always show the requested url:               Couldn't parse last-modified: Sat, 23 Feb 2013 16:25:16 +0100     Uncacheable object http://nekovm.org/_media/neko-2.0.0.tar.gz (2120)     Superseding object: http://nekovm.org/_media/neko-2.0.0.tar.gz (200 425539 -1 (none) -> 200 425539 -1 (none))     Unsupported Cache-Control directive post-check -- ignored.     Unsupported Cache-Control directive pre-check -- ignored.     Couldn't parse last-modified: Sat, 23 Feb 2013 16:25:16 +0100     Uncacheable object http://nekovm.org/_media/neko-2.0.0.tar.gz (2120)     Superseding object: http://nekovm.org/_media/neko-2.0.0.tar.gz (200 425539 -1 (none) -> 200 425539 -1 (none))     Vary header present (Accept-Encoding).     Vary header present (Accept-Encoding).     Vary header present (Accept-Encoding).     Superseding object: http://opalrb.org/opal-parser.js (206 709851 1363984598 (none) -> 206 709851 1363984598 (none))     Vary header present (Accept-Encoding).     Superseding object: http://opalrb.org/opal-parser.js (200 709851 1363984598 (none) -> 200 709851 1363984598 (none))     Vary header present (Accept-Encoding).     Superseding object: http://opalrb.org/opal-parser.js (200 709851 1363984598 (none) -> 200 709851 1363984598 (none))     Vary header present (Accept-Encoding).     Superseding object: http://opalrb.org/opal-parser.js (200 709851 1363984598 (none) -> 200 709851 1363984598 (none))     Vary header present (Accept-Encoding).     Superseding object: http://opalrb.org/opal-parser.js (200 709851 1363984598 (none) -> 200 709851 1363984598 (none))     Vary header present (Accept-Encoding).     Vary header present (Accept-Encoding).     Vary header present (Accept-Encoding).     Uncacheable object http://www.youtube.com/?hl=en&gl=US (2050)


Is it better to pass all files to mv or to run a bunch of mv processes in parallel?

I have three ways of running `mv`. First:               mv /db/dbfile1 /db/dbfile2 /db/dbfile3  /usb_storage/      and second:               mv /db/dbfile1  /usb_storage/ &     mv /db/dbfile2  /usb_storage/ &     mv /db/dbfile3  /usb_storage/ &      third (I think first and this is same ?)               mv /db/dbfile1  /usb_storage/      mv /db/dbfile2  /usb_storage/      mv /db/dbfile3  /usb_storage/       Which of these methods is better? Why?


How do I set up raid0 using extra two drives (not the install drive)?

I have been looking around online for a suitable tutorial to help me set up a raid0 across two (or more) drives, but not moving the actual installation of Mint onto that raid setup (I have that on a different single drive ). A coworker had pointed me to this tutorial, and I could not make heads nor tails of it. Can anyone give me a walkthrough (or pointer to one) for how to do this?


Intel Graphics Driver for Mint Linux

Though Mint 14 is based on Ubuntu 12.10 I get the following error when running the Intel Driver Manager under Mint:               diagnostics-view.c/diagnostics_view_start: Running diagnostic Checking distribution...     main-window.c/on_diagnostics_finished: Diagnostics finished with an error      Yes, I am using the correct 64 bit edition for my install By the way, I am using a **VIZIO CT15-A5 15.6-Inch Thin + Light Ultrabook with the Intel HD 4000 graphics processor** and at present my System information says the following for display:               Display     Display     Resolution  1920x1080 pixels     Vendor  The X.Org Foundation     Version 1.13.0     Monitors     Monitor 0   1920x1080 pixels     Extensions     BIG-REQUESTS         Composite        DAMAGE       DOUBLE-BUFFER        DPMS         DRI2         GLX      Generic Event Extension      MIT-SCREEN-SAVER         MIT-SHM      RANDR        RECORD       RENDER       SECURITY         SGI-GLX      SHAPE        SYNC         X-Resource       XC-MISC      XFIXES       XFree86-DGA      XFree86-VidModeExtension         XINERAMA         XInputExtension      XKEYBOARD        XTEST        XVideo       XVideo-MotionCompensation         OpenGL               Vendor  Intel Open Source Technology Center     Renderer    Mesa DRI Intel(R) Ivybridge Mobile     Version 3.0 Mesa 9.0.3     Direct Rendering    Yes      Here is the output of inxi -Gx               funkdified@vizio ~ $ inxi -Gx     Graphics:  Card: Intel 3rd Gen Core processor Graphics Controller bus-ID: 00:02.0                 X.Org: 1.13.0 drivers: intel (unloaded: fbdev,vesa) Resolution: 1920x1080@60.0hz                 GLX Renderer: Mesa DRI Intel Ivybridge Mobile GLX Version: 3.0 Mesa 9.0.3 Direct Rendering: Yes


Why is my unmounted USB disk still seen by `fdisk`?

I've mounted my USB disk to `/mnt/kingston/` dir, and umounted it from there by typing in `umount /mnt/kingston/`. But I can still see my USB disk after issuing the `fdisk -l` command. Why? If I type in `umount /mnt/kingston` again, it shows: `umount: /mnt/kingston; not mounted`.


Open VirtualBox GUI?

I've installed VirtualBox and I would like to create a VM now. I prefer to use the GUI rather than the command line interface, and I know that VirtualBox comes with such a GUI. However, I can't seem to figure out what the name of this application is.               $ dpkg -L virtualbox | grep "/usr/bin/"     /usr/bin/VBoxSDL     /usr/bin/VBoxBalloonCtrl     /usr/bin/VBoxManage     /usr/bin/vboxheadless     /usr/bin/VBoxHeadless     /usr/bin/vboxmanage     /usr/bin/vboxballoonctrl     /usr/bin/vboxsdl     /usr/bin/vboxwebsrv      None of these applications actually start a GUI. How do I start the virtualbox GUI?


How do I resolve the garbled sound in Debian?

I just recently installed Debian 7 Wheezy with KDE and once I turn on the computer, the start-up sound is garbled. The closest description I can think of is that the sound coming out is somehow overlapped with a "dial-up modem"-like sound (here's a sample of what a dial-up modem sounds like, in case you don't know or have forgotten). What's curious is that once I change the volume two to three notches up using the global volume control (or even the VLC volume control), the sound somehow becomes fine. But when I pause a movie and resume play, the sound becomes garbled again and I need to re-adjust the volume just to make the sound fine again. I haven't encountered this issue with Ubuntu 12.04 LTS or Linux Mint 13 XFCE (I used these on this same computer before deciding to use Debian 7 Wheezy) as both these OSes handled sound just fine so it's really becoming frustrating. `lspci -k` gives the ff. results w.r.t. audio devices:               00:01.1 Audio device: Advanced Micro Devices [AMD] nee ATI Trinity HDMI Audio Controller         Subsystem: ASUSTeK Computer Inc. Device 8526     00:14.2 Audio device: Advanced Micro Devices [AMD] FCH Azalia Controller (rev 01)         Subsystem: ASUSTeK Computer Inc. Device 841b         Kernel driver in use: snd_hda_intel      I think I am using the second audio device because I don't have anything connected to the HDMI port. I'm also guessing that system uses **pulseaudio** server to handle the sound. Could the issue be caused by the kernel driver `snd_hda_intel` since I am using an AMD chipset? My computer has an AMD A10-5800K processor on an ASUS F2A85-V PRO motherboard, in case this info is useful in someway.


How to set an option for a serial device?

On a Linux console I want to set the `onclr` option for a serial device. According to the manpage the command is               stty [-F DEVICE | --file=DEVICE] [SETTING]...      but none of the following commands were able to set the `onclr` flag for the device `/dev/ttyS0`:               stty -F /dev/ttyS0 -onclr     stty -F /dev/ttyS0  onclr     stty -F /dev/ttyS0 raw -onclr     stty -F /dev/ttyS0 raw  onclr      How to do it right?


How does KVM set its own netfilter rules?

I've been poking around with KVM VM's on Centos 6.4 and after some hair pulling and copious amounts of trying to break my desk with my head due to not having an internet connection on my VM's, I found something curious: Upon booting the machine, iptables has rules in the FORWARD chain to allow traffic through to the VM's and all is well. When I run `service iptables restart`, however, it looks like it pulls the config rules from `/etc/sysconfig/iptables` (default settings which reject all forwarding) and thus, i've been relegated to either dropping the firewall completely on the physical host or rebooting to get the FORWARD rules added so it works again. **Edit:**   Indeed, I could just modify the firewall rules myself to allow it, but isn't the focus of this question. I'm more focused on the following question #1: **My questions are:**   1) At what point (or by what mechanism) are these FORWARD rules added in?   2) How can I recover the FORWARD rules without rebooting the machine? Quite frankly, i'm not even sure where to start searching for this issue. I found this page that says to modify `/etc/sysctl.conf` with the following variables which allegedly make netfilter ignore traffic to bridged connections:               net.bridge.bridge-nf-call-ip6tables = 0     net.bridge.bridge-nf-call-iptables = 0     net.bridge.bridge-nf-call-arptables = 0      The problem with that is that my sysctl.conf is already set as such and netfilter still does its thing, happily blocking everything to the VM's.


Shutting down from X without a desktop environment

I have recently given up my Desktop Environment and am now only using a Window Manager (i3) and X. It all works very well and I do not miss much. Except for one thing: the shutdown button. I can now only shutdown by issuing: `sudo shutdown -Ph now` from a terminal. This works, but I want to create a keybinding in i3 to shutdown by clicking `Mod+x`. And I am not sure how this can be achieved. If I create a script in say `~/shutdown` and refer to this with: `bindsym $mod+x exec ~/shutdown` Then this does not work; I figure because I am running as a regular user and I am sudoing in this script. I would be fine with having a terminal appear and prompting me for the password (although I prefer this to not require a password, if possible), but am not sure how to do this. What is a way to get this done? Using Arch Linux.


Script that unpacks a initrd, allows editing of the preseed.cfg and the packs it to cpio and gzip again

I want to program a script that allows what is said in the title. So basically I gunzip the initrd, than unpack the cpio, open vi to allow editing, save, pack with cpio, and gzip again, so nothing fancy here (at least I hope that, I am not good at shell scripting). Now after gunzipping the archive the ending .gzip or .gz is left out so that I can't use $1 as the name. How should I delete the ending so that I can use a new variable foo, for further processing? This is probably not an very elegant way, but I hope it works :)               #/bin/bash     # This script should make it possible to edit the preseed file     # within a initrd gzipped cpio archive, without unpacking and packing it     # manually               mkdir temporarydirectory     # $1 will be the initrd (cpio archive which is compressed with gzip)     mv $1 temporarydirectory     cd temporarydirectory     gunzip $1     cpio -id < $1 # here is where i need to cut of the gzip ending     rm $1 # again without the gzip ending cutted of     vim preseed.cfg     find . | cpio -H newc -o > $1 # again without gzip ending     gzip $1 # here the same     mv $1 .. # here the gzip ending is used again     cd ..     rm -r temporarydirectory


Recover text files and directory structure from the database created by Recoll?

A while ago, I ran Recoll which created a database on a partition, so that I could quickly search among all the text information in the contents of all files (text file, pdf, djvu, html, etc) in that partition. Now the partition, for which the Recoll created a database, has been wiped out accidentally, but I can still search in Recoll among those deleted files, because the database of Recoll is stored in another partition that hasn't been affected.   1. When I search for a keyword among the text content of those deleted files, I can still see one or two lines surrounding that keyword as its context, It gives me some hope that it might be possible to recover the text content of each deleted file. But when I hit "Preview" or "Open" for a deleted file found by Recoll, Recoll will try to open the file that doesn't exist any longer, which of course fails. **So I wonder if I can recover the deleted text files from Recoll's database?**   2. When I search for a keyword among the text content of those deleted files, I can also see the full path to each file found, **So I wonder if I can recover the directory structure of my partition from Recoll's database?** Thanks and regards!


Installing rvm and a specific version of ruby using rvm on linux based systems

UI testing is done using ruby and selenium.   1. Installation of `rvm`   2. Installation of specific version of `ruby` and setting a default version of `ruby` **Note:** Using a linux based operating system.


Raspbian - Can't spoof a MAC address through HostAPD

I'm trying to let my Raspberry Pi function as an access point, but I keep running into some problems. Specifically when it comes to spoofing the MAC address. The purpose is to create a Nintendo 3DS streetpass hotspot at home. I'm following this guide mostly. First the things I'm using: Raspberry Pi Model B with a TP-Link TL-WN725N v2 wireless usb adapter with Realtek RTL8188EUS chipset. This one is recommended for AR purposes. Kernel running on Raspbian GNU/Linux 7 installed through NOOBS v1.3.9 (2014-07-08):               Linux raspberrypi 3.12.22+ #691 PREEMPT Wed Jun 18 18:29:58 BST 2014 armv6l GNU/Linux      `lsusb` on the wlan adapter:               Bus 001 Device 004: ID 0bda:8179 Realtek Semiconductor Corp.      I installed the driver through this guide. Running `iwlist wlan0 scan` succesfully returns a list of wireless networks. Then I moved on to installing the necessary packages. First I installed HostAPD through this guide, but running into some problems (got an the error `ioctl[RTL_IOCTL_HOSTAPD]: Invalid argument`) I tried what was suggested here. With success. After this I installed both the packages isc-dhcp-server and bridge-utils. I made a test config file for hostapd (/tmp/test.conf):               # Basic configuration          interface=wlan0     ssid=wifi     bssid=4E:53:50:4F:4F:46     channel=5     bridge=br0          # WPA and WPA2 configuration          macaddr_acl=0     auth_algs=1     ignore_broadcast_ssid=0          # Hardware configuration          driver=rtl871xdrv     ieee80211n=1     hw_mode=g     device_name=RTL8192CU     manufacturer=Realtek      After running hostapd /tmp/test.conf I'm getting the following error (part of the return):               +rtl871x_sta_deauth_ops, ff:ff:ff:ff:ff:ff is deauth, reason=2     Using interface wlan0 with hwaddr e8:94:f6:1c:4a:dd and ssid 'wifi'      It falls back to it's real MAC address. Running a debug returns the following:               root@raspberrypi:~# hostapd -dd /tmp/test.conf     random: Trying to read entropy from /dev/random     Configuration file: /tmp/test.conf     drv->ifindex=3     Configure bridge br0 for EAPOL traffic.     BSS count 1, BSSID mask a6:c7:a6:53:05:9b (0 bits)     Allowed channel: mode=1 chan=1 freq=2412 MHz max_tx_power=0 dBm     Allowed channel: mode=1 chan=2 freq=2417 MHz max_tx_power=0 dBm     Allowed channel: mode=1 chan=3 freq=2422 MHz max_tx_power=0 dBm     Allowed channel: mode=1 chan=4 freq=2427 MHz max_tx_power=0 dBm     Allowed channel: mode=1 chan=5 freq=2432 MHz max_tx_power=0 dBm     Allowed channel: mode=1 chan=6 freq=2437 MHz max_tx_power=0 dBm     Allowed channel: mode=1 chan=7 freq=2442 MHz max_tx_power=0 dBm     Allowed channel: mode=1 chan=8 freq=2447 MHz max_tx_power=0 dBm     Allowed channel: mode=1 chan=9 freq=2452 MHz max_tx_power=0 dBm     Allowed channel: mode=1 chan=10 freq=2457 MHz max_tx_power=0 dBm     Allowed channel: mode=1 chan=11 freq=2462 MHz max_tx_power=0 dBm     Allowed channel: mode=1 chan=12 freq=2467 MHz max_tx_power=0 dBm     Allowed channel: mode=1 chan=13 freq=2472 MHz max_tx_power=0 dBm     Allowed channel: mode=1 chan=14 freq=2484 MHz max_tx_power=0 dBm     Allowed channel: mode=0 chan=1 freq=2412 MHz max_tx_power=0 dBm     Allowed channel: mode=0 chan=2 freq=2417 MHz max_tx_power=0 dBm     Allowed channel: mode=0 chan=3 freq=2422 MHz max_tx_power=0 dBm     Allowed channel: mode=0 chan=4 freq=2427 MHz max_tx_power=0 dBm     Allowed channel: mode=0 chan=5 freq=2432 MHz max_tx_power=0 dBm     Allowed channel: mode=0 chan=6 freq=2437 MHz max_tx_power=0 dBm     Allowed channel: mode=0 chan=7 freq=2442 MHz max_tx_power=0 dBm     Allowed channel: mode=0 chan=8 freq=2447 MHz max_tx_power=0 dBm     Allowed channel: mode=0 chan=9 freq=2452 MHz max_tx_power=0 dBm     Allowed channel: mode=0 chan=10 freq=2457 MHz max_tx_power=0 dBm     Allowed channel: mode=0 chan=11 freq=2462 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=36 freq=5180 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=40 freq=5200 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=44 freq=5220 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=48 freq=5240 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=52 freq=5260 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=56 freq=5280 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=60 freq=5300 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=64 freq=5320 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=100 freq=5500 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=104 freq=5520 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=108 freq=5540 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=112 freq=5560 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=116 freq=5580 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=120 freq=5600 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=124 freq=5620 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=128 freq=5640 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=132 freq=5660 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=136 freq=5680 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=140 freq=5700 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=149 freq=5745 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=153 freq=5765 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=157 freq=5785 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=161 freq=5805 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=165 freq=5825 MHz max_tx_power=0 dBm     Completing interface initialization     Mode: IEEE 802.11g  Channel: 5  Frequency: 2432 MHz     RATE[0] rate=10 flags=0x1     RATE[1] rate=20 flags=0x1     RATE[2] rate=55 flags=0x1     RATE[3] rate=110 flags=0x1     RATE[4] rate=60 flags=0x0     RATE[5] rate=90 flags=0x0     RATE[6] rate=120 flags=0x0     RATE[7] rate=180 flags=0x0     RATE[8] rate=240 flags=0x0     RATE[9] rate=360 flags=0x0     RATE[10] rate=480 flags=0x0     RATE[11] rate=540 flags=0x0     Flushing old station entries     Deauthenticate all stations     +rtl871x_sta_deauth_ops, ff:ff:ff:ff:ff:ff is deauth, reason=2     rtl871x_set_key_ops     rtl871x_set_key_ops     rtl871x_set_key_ops     rtl871x_set_key_ops     Using interface wlan0 with hwaddr e8:94:f6:1c:4a:dd and ssid 'wifi'     rtl871x_set_wps_assoc_resp_ie     rtl871x_set_wps_beacon_ie     rtl871x_set_wps_probe_resp_ie     rtl871x_set_beacon_ops     rtl871x_set_hidden_ssid ignore_broadcast_ssid:0, wifi,4     rtl871x_set_acl     wlan0: Setup of interface done.     random: Got 20/20 bytes from /dev/random      I searched and searched but whatever I try, it keeps going back to the original bssid. What can I do to get this running the way I want it to? Just a heads-up: I'm new to linux.


Why is `--human-readable` needed and not default?

Several command line tools use the `-h` or `\--human-readable` option to print file size in a human readable format (i.e., `36G` vs `37550836`).   * Why is this option needed and not the default?    * Aren't these tools mainly for output to humans?


Search among the content of a large number of plain text files?

I have a directory with 1,242,276 plain text files on my external hard drive. They are totally unorganized with meaningless numbers as their file names. The reason for that is because they were recovered by some recovery software after accidentally emptying a partition a while ago. I am now under that directory and want to search for a word "polyhedron" among the content of all the files. I tried `grep`, but it fails:               $ grep polyhedron ./*      bash: /bin/grep: Argument list too long      Is it because there are too many files under that directory? Also I would like to search for many other different keywords. I wonder what I can do now?


Is there a faster alternative to cp for copying large files (~20 GB)?

I am a graduate student, and the group in which I work maintains a Linux cluster. Each node of the cluster has its own local disk, but these local disks are relatively small and are not equipped with automatic backup. So the group owns a fileserver with many TBs of storage space. I am a relative Linux novice, so I am not sure what are the specs of the fileserver in terms of speed, networking ability, etc. I do know from experience that the local disks are significantly faster than the fileserver in terms of I/O. About a dozen or so people use the fileserver. Using `cp` to copy a ~20 GB file from the fileserver to one of the local disks takes about 11.5 minutes in real time on average (according to `time`). I know that this `cp` operation is not very efficient because (1) `time` tells me that the system time for such a copy is only ~45 seconds; and because (2) when I examine `top` during the copy, **%CPU** is quite low (by inspection, roughly **0-10%** on average). Using `cp` to copy the same ~20 GB file from one folder on the local disk to another folder on the same local disk takes less time -- about 9 minutes in real time (~51 seconds in system time, according to `time`). So apparently the fileserver is somewhat slower than the local disk, as expected, but perhaps not significantly slower. I am surprised that copying from local to same local is not faster than 9 minutes. I need to copy ~200 large files -- each ~20 GB -- from the fileserver to one of the local disks. So, my question is: **Is there a faster alternative to`cp` for copying large files in Linux?** (Or are there any flags within `cp` that I could use which would speed up copying?) Even if I could somehow shave a minute off this copying time, that would help immensely. I am sure that buying new, faster hardware disks, but I don't have access to such resources. I am also not a system administrator -- I am only a (novice) user -- so I don't have access to more detailed information on the load that is on the disks. I do know that while about a dozen people use the fileserver daily, I am the only person using this particular node/local disk.


What is the default font for Grub in Ubuntu and Fedora?

I was wondering what the name of the font is for the grub set by default after installation in Ubuntu and Fedora (they are different ones). Any help would be great!


Font letter spacing issue with PhantomJS/wkhtmltopdf on Ubuntu

I'm using PhantomJS/wkhtmltopdf on Ubuntu 12.04 LTS to convert HTML to PDF and get very strange letter spacing errors. For instance, the internal distance between _es_ and _xa_ seems very random and incorrect. When I run the exact same code on OS X I don't get these problems which make me think the issue is related to Linux. Also, when I render to PNG it looks fine. I'm using Microsoft Core Fonts and **all fonts get the same kerning issue**. For instance _xa_ is always a problem, so I don't think it's a font problem either. I've tried modifying ~/.fonts.conf according to the advice at those links but it makes no difference.   * https://wiki.ubuntu.com/Fonts   * http://www.kilobitspersecond.com/2009/04/17/ubuntu-font-hinting-you-a-cautionary-tale/ I'm quite stuck on ideas on how to solve this. ![enter image description here](http://i.stack.imgur.com/gmBLf.png)


Wget with different filename, but same extension

I need wget to save to a different folder, different filename, and same extension, but I do not have the filename before downloading. * * * For example, let's say I have:               http://ge.tt/api/1/files/someFile/0/blob?download      and I need to download it to an id, _"fj39ejd"_ in the folder `downloads`. What is the best way to go about saving it to:               /path/to/downloads/fj39ejd.[extension it had before downloading]      Any advice on how I can achieve this?


Debian Wheezy update-grub: command not found

I'm trying to change my grub boot order, so I've changed `/etc/default/grub`, but I don't seem to have the `update-grub` command. I'm not sure if I'm using grub or grub2 because everything just says "grub". How would I determine which version of grub I have installed?