How to Mirror one more disk on existing filesystem

in my test machine i can see the filesystem list using bdf commands.               $bdf       Filesystem          kbytes    used   avail %used Mounted on       /dev/vg00/lvol3    58916864 6242747 49386840   11% /       /dev/vg00/lvol1    2003481   47996 1755136    3% /stand       /dev/vg77/stds     5120000   18753 4782427    0% /var/opt/stdenv       /dev/vg77/scrap    3584000   18684 3342490    1% /tms/vts       /dev/vg77/cmdsscrap                    3584000  530986 2862264   16% /mnt        I have a scenario where i have to test the sar(1m) command to check the disk activity. for that i need a filesystem which is mirrored and configured with more then one disk. But unfortunately the above existing filesystems are having only one disk mirrored with it.               # lvdisplay -v /dev/vg00/lvol1     --- Logical volumes ---     LV Name                     /dev/vg00/lvol1     VG Name                     /dev/vg00     LV Permission               read/write                     LV Status                   available/syncd                Mirror copies               0                 Consistency Recovery        MWC                      Schedule                    parallel           LV Size (Mbytes)            2000                 Current LE                  125            Allocated PE                125              Stripes                     0            Stripe Size (Kbytes)        0                        Bad block                   off               Allocation                  strict/contiguous              IO Timeout (Seconds)        default                       --- Distribution of logical volume ---     PV Name                 LE on PV  PE on PV       /dev/disk/disk4         125       125  <-- Only one disk is mirrored.      Can anyone please let me know, How to add another disk into these existing filesystem? Please help me with the steps for mirroring the disk with filesystem. Thanks & Regards


Print mac address to file

With a bash script, can I read the mac address of my eth0 and print it to a file?


Cannot install PHP packages in CentOS

In CentOS 6.3 ( **Edit** : updated to 6.4) I can't install any PHP (MySQL, and many other) packages. For example output of `yum install php-devel` is:               Loaded plugins: fastestmirror     Loading mirror speeds from cached hostfile      * base: mirror.vit.com.tr      * extras: mirrors.prometeus.net      * rpmforge: mirror.nl.leaseweb.net      * updates: mirrors.prometeus.net     Setting up Install Process     No package php-devel available.     Error: Nothing to do      output of `ls /etc/yum.repos.d`:               CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo  CentOS-Vault.repo  mirrors-rpmforge  rpmforge.repo      `grep -E "name|enabled" /etc/yum.repos.d/*`:               /etc/yum.repos.d/CentOS-Base.repo:name=CentOS-$releasever - Base     /etc/yum.repos.d/CentOS-Base.repo:name=CentOS-$releasever - Updates     /etc/yum.repos.d/CentOS-Base.repo:name=CentOS-$releasever - Extras     /etc/yum.repos.d/CentOS-Base.repo:name=CentOS-$releasever - Plus     /etc/yum.repos.d/CentOS-Base.repo:enabled=0     /etc/yum.repos.d/CentOS-Base.repo:name=CentOS-$releasever - Contrib     /etc/yum.repos.d/CentOS-Base.repo:enabled=0     /etc/yum.repos.d/CentOS-Debuginfo.repo:name=CentOS-6 - Debuginfo     /etc/yum.repos.d/CentOS-Debuginfo.repo:enabled=0     /etc/yum.repos.d/CentOS-Media.repo:name=CentOS-$releasever - Media     /etc/yum.repos.d/CentOS-Media.repo:enabled=0     /etc/yum.repos.d/CentOS-Vault.repo:name=CentOS-6.0 - Base     /etc/yum.repos.d/CentOS-Vault.repo:enabled=0     /etc/yum.repos.d/CentOS-Vault.repo:name=CentOS-6.0 - Updates     /etc/yum.repos.d/CentOS-Vault.repo:enabled=0     /etc/yum.repos.d/CentOS-Vault.repo:name=CentOS-6.0 - Extras     /etc/yum.repos.d/CentOS-Vault.repo:enabled=0     /etc/yum.repos.d/CentOS-Vault.repo:name=CentOS-6.0 - Contrib     /etc/yum.repos.d/CentOS-Vault.repo:enabled=0     /etc/yum.repos.d/CentOS-Vault.repo:name=CentOS-6.0 - CentOSPlus     /etc/yum.repos.d/CentOS-Vault.repo:enabled=0     /etc/yum.repos.d/CentOS-Vault.repo:name=CentOS-6.1 - Base     /etc/yum.repos.d/CentOS-Vault.repo:enabled=0     /etc/yum.repos.d/CentOS-Vault.repo:name=CentOS-6.1 - Updates     /etc/yum.repos.d/CentOS-Vault.repo:enabled=0     /etc/yum.repos.d/CentOS-Vault.repo:name=CentOS-6.1 - Extras     /etc/yum.repos.d/CentOS-Vault.repo:enabled=0     /etc/yum.repos.d/CentOS-Vault.repo:name=CentOS-6.1 - Contrib     /etc/yum.repos.d/CentOS-Vault.repo:enabled=0     /etc/yum.repos.d/CentOS-Vault.repo:name=CentOS-6.1 - CentOSPlus     /etc/yum.repos.d/CentOS-Vault.repo:enabled=0     /etc/yum.repos.d/CentOS-Vault.repo:name=CentOS-6.2 - Base     /etc/yum.repos.d/CentOS-Vault.repo:enabled=0     /etc/yum.repos.d/CentOS-Vault.repo:name=CentOS-6.2 - Updates     /etc/yum.repos.d/CentOS-Vault.repo:enabled=0     /etc/yum.repos.d/CentOS-Vault.repo:name=CentOS-6.2 - Extras     /etc/yum.repos.d/CentOS-Vault.repo:enabled=0     /etc/yum.repos.d/CentOS-Vault.repo:name=CentOS-6.2 - Contrib     /etc/yum.repos.d/CentOS-Vault.repo:enabled=0     /etc/yum.repos.d/CentOS-Vault.repo:name=CentOS-6.2 - CentOSPlus     /etc/yum.repos.d/CentOS-Vault.repo:enabled=0     /etc/yum.repos.d/rpmforge.repo:name = Red Hat Enterprise $releasever - RPMforge.net - dag     /etc/yum.repos.d/rpmforge.repo:enabled = 1      `yum repolist`:               repo id                                           repo name                                                                          status     base                                              CentOS-6 - Base                                                                      6,296+85     extras                                            CentOS-6 - Extras                                                                          13     rpmforge                                          Red Hat Enterprise 6 - RPMforge.net - dag                                          11,131+144     updates                                           CentOS-6 - Updates                                                                     890+34      `yum list available 'php-*'`:               Loaded plugins: fastestmirror     Loading mirror speeds from cached hostfile      * base: mirror.vit.com.tr      * extras: mirrors.prometeus.net      * rpmforge: www.mirrorservice.org      * updates: mirrors.prometeus.net     Error: No matching Packages to list      This happens for all PHP packages. When I type `php-` and press tab key there is no auto completion. Any suggestions?


centos 6.3 apache local network not working

I have clean installed centos, apache, mysql, php and have my php pages running fine at 192.168.1.66. I type that ip in on another computer (macbook) on the same network and get nothing. Page time out. I also don't see the linux machine showing up in my network list in finder. I have tried adding port 80 to iptables but still no joy. Also, I tried running my xampp installation on the macbook and viewing that from my linux browser and get nothing. Basically the 2 computers are on the same network but don't want to see each other. I can't find any options in centos for sharing on the local network Any help is much appreciated.


Third cron field doesn't seem to work (job runs when I don't want it to)

I scheduled a job like this:               *   *    6-8  *  1-5  echo "test" >>/tmp/test.log 2>&1      I expect this job to run only on 6th,7th,8th, these 3 days. but today is 18th, it still runs. What is wrong with this job? What shall I do if I want it to run a some specific days?


svn: SSL is not supported

I am trying to check out code on a Unix box in the Z shell. When I run the following command svn checkout https://svn.example.net/svn/trunk/source build I get the following error message: svn: SSL is not supported The error message is in no way informative so I'd like to see if anyone has had a similar problem and even better if they have a solution. Thanks


Why are packets not moving forward?

I have a server with forwarding turned on. I placed an iptables LOG target in the PREROUTING, INPUT, and FORWARD chains of the mangle table. I can see the LOG messages from PREROUTING, but not INPUT or FORWARD. I have no iptables rules other than the logging. Why does the packet not get past the PREROUTING chain? From various netfilter charts, it seems that the only thing that can stop it is the routing decision. I have checked that forwarding is turned on, I don't have any special routing policies setup, and I do have a route to the packet's destination. Reverse path filtering is disabled. One netfilter chart suggests the packet goes through QOS ingress at that point. I'm not too familiar with QOS, but I've not done anything special with tc. My qdiscs are pfifo_fast (the default), and there are no filters. Additional details: This is an IPsec tunnel endpoint. The packets are coming in through IPsec, getting transformed successfully, and re-entering the networking stack. It is at this stage that I see the packet get stopped after PREROUTING before either INPUT or FORWARD.


How to provide a "guest LAN" on one ethernet device

I have an always-on machine running Debian/Squeeze with a couple of ethernet ports (it's doing various serverish jobs, including DHCP) and a LAN on each. eth0 is on 192.168.7.* and has access to the internet (and the rest of the "office LAN") via a gateway (NAT-translating DSL router) on that LAN at 192.168.7.1. eth1 is on 192.168.1.* . I'm looking for a quick, easy and Debian-friendly way of configuring the machine so that anyone on the 192.168.1.* LAN only has access to the external internet, DHCP, and can't access any of the other stuff on 192.168.7.*. I'm sure this is possible using an appropriate set of iptables rules. Suspect I'm looking for one of:   * A simple guide to how to set up iptables to achieve the above (I can't be the first person to want to do this).   * A pointer to some user-friendly firewall configuring software which can do this (although note that I don't want to lock down the eth0-side and the 192.168.7.* network at all).   * Suggestion of some software which is designed to do exactly this; I have an idea there are some packages intended to achieve similar to what I want for internet cafes etc, but I'm not sure where to start looking or whether these might be overkill. Any tools being in Debian Squeeze (or Wheezy) already is a big plus.


vim "caught deadly signal HUP", what files are it preserving?

I logged out, apparently forgetting to bring back a vim session to the foreground. As expected, vim spat out "Vim: caught deadly signal HUP" followed by "Vim: preserving files". My question is: What files are being preserved? I guess those are the edited- but-unsaved files; where are those kept? How to I find them?


Getting a date format with grep

I've looked at similar questions and tried most suggestions, but none of them got me anywhere, even though i have a fairly simple task I think :S. I'm fairly new to this whole thing, so I've run out of ideas as to what to try or what I'm doing wrong... So the task is to get the lines of a file listed (with grep) which contain the short month name and day (like Oct 22). The file has a long format listing in it (containing files created on the current date), so there should be some results. However, I'm getting results in which only the month has been examined and found, the day hasn't. Some of the more sensible things I've tried so far:               grep $(date +"%b %e") *filename*      Then I get a line saying "grep: 22: No such file or directory" and a listing with all the results for the month ("Oct"). Same results with `+%d %e` or `+'%d %e'` or `'+%d %e'` instead of `+"%d %e";` instead of `$()`. (I also had %d for the day for a while, which made no difference, and shouldn't matter anyway as far as I know, since the date in question was now 22.) Why is the day not taken into account here?


Copying specific subfolders with directory structure to a new folder

I am having a the following directory structure:                               Main_Dir                        |       -----------------------------------       Subdir1       Subdir2       Subdir3          |             |             |      ---------     ---------     ---------      |   |   |     |   |   |     |   |   |                 fo1 fo2 f03   fo1 fo2 f03   fo1 fo2 f03      I want to copy all the subdirectories (`Subdir1`, `Subdir2`, `Subdir3`) to a new folder. But I only want to copy `fo1` and `fo2` folders in the new place. Not sure how could it be done.


Auto indent / format code for Vim?

I'm trying to use Vim more and more when I can. One of my biggest grip between Vim and an IDE like Aptana is the ability to auto indent. Is there a means of auto formatting code (HTML, CSS, PHP) so it is properly indented? If so how do you install this into vim? I don't understand plugins very much. I tried reviewing this thread and it confused me more: How to change vim auto- indent behavior?


Setting regions in a Screen session

I'm trying to get a 'Screen' with 4 tabs to split the screen into 4 regions. I'm running 4 instances of bfgminer. One instance per USB Hardware miner. Unfortunately it has to be this way. So I'm trying to get all 4 outputs on 1 screen. I am starting up screen with the following config file, to give me 4 tabs that I can switch between.                   screen -t  USB0         select 0         stuff "command /home/pi/Mining/bfgminer --scrypt -c miner.conf         screen -t USB1         select 1         stuff "command /home/pi/Mining/bfgminer --scrypt -c miner.conf         screen -t USB2         select 2         stuff "command /home/pi/Mining/bfgminer --scrypt -c miner.conf         screen -t USB3         select 3         stuff "command /home/pi/Mining/bfgminer --scrypt -c miner.conf              altscreen on         term screen-256color                                                   bind ','         prev                                                                           bind '.' next          #                                                                                #change the hardstatus settings to give an window list at the bottom of the             #screen, with the time and date and with the current window highlighted                 hardstatus alwayslastline                                                               #hardstatus string '%{= kG}%-Lw%{= kW}%50> %n%f* %t%{= kG}%+Lw%< %{= kG}%-=%c:%         hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%      I found it in an old post on here somewhere. And tweaked it a bit for my needs. From reading the Screen man pages, I think that the 'Regions' function should allow me to get all 4 tabs split on 1 screen instead of having to use `Ctrl`+`A`, `CTRL`+`,` just to look at the next screen. How can I get Screen to show all 4 instances of bfgminer, on one single screen? I'm going to be using ssh to get onto my Pi and check the miners from time to time, and it'll be a lot easier with only 1 logon, and screen to run.


How does X11 forwarding work?

How does X11 forwarding work? I am interested in knowing whether the processing to render graphics is done at the end of the host running the application or the host displaying the graphical interface? Should I use a GPU intensive application (game) - where should I have the GPU installed (server end / client end)? Of course the server will need the GPU if it is running CUDA / openCL applications, but what about the display? * * * This question was closed on StackOverflow. This was a link pointed to me, but I am looking to understand more of the underlying protocol and performance tweaks.


Tuning a CentOS VM running on an MDRAID-based XenServer storage repository

I've run out of ideas for tuning disk write speeds on a handful of CentOS VMs running on a lab XenServer 6.2 host. Running under the free license (so vendor support not a concern), the lab host is a glorified desktop with 3 x WD3200AAKS disks I'm using for a bit of fun. Firstly, I installed XenServer on a USB stick and configured a software RAID5 array of the three disks to act as a storage repository. XenServer puts an LVM on this, which it then carves up into the virtual disks for the VMs. CentOS 6.4 is installed from the minimal CD, with either an ext3 or ext4 filesystem. i.e.:               /dev/sd[bcd] -> /dev/sd[bcd]1 -> /dev/md0 -> lvm -> vol1 -> xvda -> xvda1 -> ext3      The write speed in a freshly-installed VM was roughly 9.5MB/s (averaged across various `dd if=/dev/zero of=~/spool.tmp bs=<X>` and `dd if=/dev/zero bs=<X> | pv > ~/spool.tmp` runs). So I started from the top, looking at direct writes to the RAID device (`dd if=/dev/zero of=/dev/md0`), tweaking the `stripe_cache_size` of md0 (along with `blockdev --setra` for the md0 and underlying sd[bcd], and `max_sectors_kb` for good measure), until I got from approx 12MB/s to a more- reasonable 59MB/s. I recreated the storage repo and carved out a new VM, did the miminal install of CentOS 6.4 and tried my test again. I'm still only getting 9-12MB/s on average (peaking at about 19MB/s for a few seconds). With higher readahead settings, I can achieve an easy 200MB/s _read_ (`dd if=~/spool.tmp bs=4K | pv > /dev/null`), and my baseline /dev/zero read speed is approx 240MB/s, but I'm stuck with this lousy write speed and I don't know what else to try. What else can I look at? * * * Some detail below, of anything I thought might be pertinent, for reference:               [root@host ~]# parted     Model: ATA WDC WD3200AAKS-7 (scsi)     Disk /dev/sdb: 320072933375B     Sector size (logical/physical): 512B/512B     Partition Table: gpt          Number  Start          End            Size           File system  Name  Flags      1      1048576B       309237645823B  309236597248B               sdb1             2      309237645824B  310311388159B  1073742336B                 sdb2                 Model: ATA WDC WD3200AAKS-7 (scsi)     Disk /dev/sdb: 320072933375B     Sector size (logical/physical): 512B/512B     Partition Table: gpt          Number  Start          End            Size           File system  Name  Flags      1      1048576B       309237645823B  309236597248B               sdb1             2      309237645824B  310311388159B  1073742336B                 sdb2                 Model: ATA WDC WD3200AAKS-7 (scsi)     Disk /dev/sdd: 320072933375B     Sector size (logical/physical): 512B/512B     Partition Table: gpt          Number  Start          End            Size           File system  Name  Flags      1      1048576B       309237645823B  309236597248B               sdd1             2      309237645824B  310311388159B  1073742336B    ext3         sdd2                 [root@host ~]# cat /proc/mdstat     Personalities : [raid6] [raid5] [raid4]      md0 : active raid5 sdb1[0] sdd1[2] sdc1[1]           603977600 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU]           bitmap: 3/144 pages [12KB], 1024KB chunk          unused devices: <none>          [root@host ~]# cat /sys/block/md0/md/stripe_cache_size     4096     [root@host ~]# cat /sys/block/sd[bcd]/queue/max_sectors_kb     16384     16384     16384     [root@host ~]# blockdev --getra /dev/sd[bcd] /dev/md0     4096     4096     4096     512              [root@host~]# vgdisplay VG_XenStorage-c9e965db-ed0f-3fdb-7d40-abbf2bda20e4       --- Volume group ---       VG Name               VG_XenStorage-c9e965db-ed0f-3fdb-7d40-abbf2bda20e4       System ID                    Format                lvm2       Metadata Areas        1       Metadata Sequence No  24       VG Access             read/write       VG Status             resizable       MAX LV                0       Cur LV                6       Open LV               4       Max PV                0       Cur PV                1       Act PV                1       VG Size               575.98 GB       PE Size               4.00 MB       Total PE              147452       Alloc PE / Size       25663 / 100.25 GB       Free  PE / Size       121789 / 475.74 GB       VG UUID               jjdM19-L505-a0UW-tT4Z-ThbL-LK0A-Ml0bKr     [root@host~]# lvdisplay /dev/VG_XenStorage-c9e965db-ed0f-3fdb-7d40-abbf2bda20e4/VHD-ee6ae3d2-18ab-4b14-902c-4019b832ea59        --- Logical volume ---       LV Name                /dev/VG_XenStorage-c9e965db-ed0f-3fdb-7d40-abbf2bda20e4/VHD-ee6ae3d2-18ab-4b14-902c-4019b832ea59       VG Name                VG_XenStorage-c9e965db-ed0f-3fdb-7d40-abbf2bda20e4       LV UUID                euBFtP-e8Hf-EzoP-AVe1-4jZO-mb3x-SaiW2i       LV Write Access        read/write       LV Status              available       # open                 1       LV Size                16.04 GB       Current LE             4106       Segments               1       Allocation             inherit       Read ahead sectors     auto       - currently set to     1024       Block device           252:2          [root@vm ~]# parted     Model: Xen Virtual Block Device (xvd)     Disk /dev/xvdc: 17179869184B     Sector size (logical/physical): 512B/512B     Partition Table: msdos          Number  Start     End           Size          Type     File system  Flags      1      1048576B  17179869183B  17178820608B  primary  ext3          [root@vm ~]# blockdev --getra /dev/xvdc     4096     [root@centos02 xvdc1]# tune2fs -l /dev/xvdc1 | grep Block     Block count:              4194048     Block size:               4096     Blocks per group:         32768     [root@centos02 xvdc1]# tune2fs -l /dev/xvdc1 | grep RAID     RAID stride:              16     RAID stripe width:        32


file-roller doesn't use single-click anymore?

In the old days, I can navigate in file-roller with only single click, now I had to do a double click, anyone know if this is configurable?


Sourcing bashrc file fails with ssh -t

ssh -vvv -F /home/me/.ssh/config serva -t "source ~/.bashrc"      This is the output I get when I use `-vvv` flag:               debug1: Authentication succeeded (publickey).                         debug1: channel 0: new [client-session]                               debug3: ssh_session2_open: channel_new: 0                             debug2: channel 0: send open                                          debug1: Requesting no-more-sessions@openssh.com                       debug1: Entering interactive session.                                 debug3: Wrote 128 bytes for a total of 2413                           debug2: callback start                                                debug2: client_session2_setup: id 0                                   debug2: channel 0: request pty-req confirm 1                          debug1: Sending command: source ~/.bashrc                             debug2: channel 0: request exec confirm 1                             debug2: fd 3 setting TCP_NODELAY                                      debug2: callback done                                                 debug2: channel 0: open confirm rwindow 0 rmax 32768                  debug3: Wrote 400 bytes for a total of 2813                           debug2: channel_input_status_confirm: type 99 id 0                    debug2: PTY allocation request accepted on channel 0                  debug2: channel 0: rcvd adjust 2097152                                debug2: channel_input_status_confirm: type 99 id 0                    debug2: exec request accepted on channel 0                            debug1: client_input_channel_req: channel 0 rtype exit-status rep     ly 0                                                                  debug1: client_input_channel_req: channel 0 rtype eow@openssh.com      reply 0                                                              debug2: channel 0: rcvd eow                                           debug2: channel 0: close_read                                         debug2: channel 0: input open -> closed                               debug2: channel 0: rcvd eof                                           debug2: channel 0: output open -> drain                               debug2: channel 0: obuf empty                                         debug2: channel 0: close_write                                        debug2: channel 0: output drain -> closed                             debug2: channel 0: rcvd close                                         debug3: channel 0: will not send data after close                     debug2: channel 0: almost dead                                        debug2: channel 0: gc: notify user                                    debug2: channel 0: output drain -> closed                          debug2: channel 0: rcvd close                                      debug3: channel 0: will not send data after close                  debug2: channel 0: almost dead                                     debug2: channel 0: gc: notify user                                 debug2: channel 0: gc: user detached                               debug2: channel 0: send close                                      debug2: channel 0: is dead                                         debug2: channel 0: garbage collecting                              debug1: channel 0: free: client-session, nchannels 1               debug3: channel 0: status: The following connections are open:       #0 client-session (t4 r0 i3/0 o3/0 fd -1/-1 cfd -1)                   debug3: channel 0: close_fds r -1 w -1 e 6 c -1                    debug3: Wrote 32 bytes for a total of 2845                         debug3: Wrote 64 bytes for a total of 2909                               The server side log has the following message: `sshd[18763]: Received disconnect from` ... I am using CentOS 6.4 ### Edit My original question was flawed. Sorry about that. What I wanted to execute bash shell with the rc file I wanted (~/.bashrc_temp) and then execute something else. I think PROMPT_COMMAND is the recommended option it seems like, or having the command executed within ~/.bashrc_temp itself, which is less than ideal, but I can probably put some conditional statements.


Executing a shell on remote unix server through jumphost from local machine

I would like to excute a shell script on a remote unix server. Now, I dont have direct connectivity to this server. I must go through jumphost which is also unix box. I want to make a batch file which execute the script on the remote server in one go. Below diagram may help to understand this better. Local Machine-->Jumphost (Unix box)-->Remote unix server-->execute shell script My batch job will connect to jumphost using telnet and then it should connect to remote server and execute the script. How to do this in "one" go ??


bash script that print cpu usage,diskusage,ram usage

As we know that for sysadmins uses commands `top` for cpu usage, `free -m` for memory, `df -lh` for hdd space. I want to cut just usage details of cpu, memory, and Hdd. I need to make three commands and put it in bash script that print used details of cpu usage (used % average all cores in multi core cou), disk usage (only / partition %) , Ram (only used MB in %) as shown below. Desired output:               CPU: 70     RAM: 45     HDD: 10


Can this find command be made more compact?

Please look at these two commands: `find ~/{Documents,Desktop,Downloads,Music,Videos} -mmin -120 -type f`   and   `find . ! -path "*opera*" ! -path "*mozilla*" ! -path "*google-chrome*" -mmin -120 -type f` While the first tells `find` to give results relating to specific folders, the second does the opposite. But is there a way to make the second command more compact or does `! path` have to precede each folder? The OS is Lubuntu 12.10.


Gentoo Kernel failing to boot

My machine has two hard drives -- `/dev/sda` and `/dev/sdb`. The first has Ubuntu installed. On the second, `sdb`, I want to install Gentoo. I did all the installation steps, `chrooted` and compiled the kernel, and installed `lilo`. In `lilo`'s configuration I have the following string:               append="root=/dev/sdb3"      /dev/sdb1 mounted as /boot. Lilo gives me a warning:               Warning: /dev/sdb is not on the first disk      When I try to boot I get:               unable to sync kernel panic. (Failed to find sdb3 on unknown device).      Is it any way related to the `lilo` warning? How do I fix it?


ElementaryOS / Specific layout

For switching layouts between three different languages I use `Ctrl`+`Shift` but this approach very slowly. I want to use specific combination for the specific layout. Like:   * English -> `Ctrl`+`Shift`+`1`   * France -> `Ctrl`+`Shift`+`2`   * Spain -> `Ctrl`+`Shift`+`3` How to do it on ElementaryOS ?


Installing Nvidia driver for GTX 760m under Linux

I tried installing Nvidia drivers using different ways: repository `nvidia- current`, `nvidia-331` and using downloaded file from Nvidia web site. Installations seems to be successful, although I got `pre-installation script failed` message from `.run` file. After installation I ran `sudo nvidia-xconfig` and reboot. In both cases the system doesn't seem to use installed driver. Going to nvidia-settings gives an error: > You do not appear to be using NVIDIA X driver. Please edit you X > configuration file (just run nvidia-xconfig as root), and restart the X > server. Running `nvidia-smi` give an error: > NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA > driver. Make sure that the latest NVIDIA driver is installed and running. `lsmod` command lists nvidia among other modules: > nvidia 10688804 0 So, I'm totally confused. How can I change that OS is using nvidia driver. How to get rid of error above? UPDATE: My `nvidia-settings` opens now, but it has not much settings inside: ![enter image description here](http://i.stack.imgur.com/cjczf.png) In the command line I see the following error: > ** (nvidia-settings:4334): WARNING **: PRIME: Failed to execute child > process "/usr/bin/prime-supported" (No such file or directory) > > ** Message: PRIME: is it supported? no The command `inxi -Gx` (whatever it does) gives me: > Graphics: Card: Intel 4th Gen Core Processor Integrated Graphics Controller > bus-ID: 00:02.0 X.Org: 1.14.3 **drivers: nouveau,intel (unloaded: > nvidia,fbdev,vesa)** Resolution: 1920x1080@60.0hz GLX Renderer: N/A GLX > Version: N/A Direct Rendering: N/A So I can conclude that nvidia driver is not used. How to fix it?


ERROR: could not find driver after changing from mysql to mariadb

mysql was working fine but I wanted to give mariadb a try on a new server I have going. However I am having an issue where all my php websites seem to have issues communicating with mariadb. Webmin works for me, but I get this warning for mysql. > Warning: The Perl module DBD::mysql is not installed on your system, so > Webmin will not be able to reliably access your MySQL database. Click here > to install it now. One possible solution I keep finding is to try to install php-mysql, but I get the following error               ~]# yum install php-mysql     Failed to set locale, defaulting to C     Loaded plugins: fastestmirror, security     Loading mirror speeds from cached hostfile      * base: ftp.sunet.se      * extras: ftp.sunet.se      * updates: ftp.sunet.se     Setting up Install Process     Resolving Dependencies     --> Running transaction check     ---> Package php-mysql.x86_64 0:5.3.3-23.el6_4 will be installed     --> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: php-mysql-5.3.3-23.el6_4.x86_64     Package mysql-libs-5.1.69-1.el6_4.x86_64 is obsoleted by MariaDB-shared-5.5.33a-1.i686 which is already installed     --> Processing Dependency: libmysqlclient.so.16()(64bit) for package: php-mysql-5.3.3-23.el6_4.x86_64     Package mysql-libs-5.1.69-1.el6_4.x86_64 is obsoleted by MariaDB-shared-5.5.33a-1.i686 which is already installed     --> Finished Dependency Resolution     Error: Package: php-mysql-5.3.3-23.el6_4.x86_64 (updates)                Requires: libmysqlclient.so.16(libmysqlclient_16)(64bit)                Available: mysql-libs-5.1.66-2.el6_3.x86_64 (base)                    libmysqlclient.so.16(libmysqlclient_16)(64bit)                Available: mysql-libs-5.1.67-1.el6_3.x86_64 (updates)                    libmysqlclient.so.16(libmysqlclient_16)(64bit)                Available: mysql-libs-5.1.69-1.el6_4.x86_64 (updates)                    libmysqlclient.so.16(libmysqlclient_16)(64bit)     Error: Package: php-mysql-5.3.3-23.el6_4.x86_64 (updates)                Requires: libmysqlclient.so.16()(64bit)                Available: mysql-libs-5.1.66-2.el6_3.x86_64 (base)                    libmysqlclient.so.16()(64bit)                Available: mysql-libs-5.1.67-1.el6_3.x86_64 (updates)                    libmysqlclient.so.16()(64bit)                Available: mysql-libs-5.1.69-1.el6_4.x86_64 (updates)                    libmysqlclient.so.16()(64bit)      You could try using --skip-broken to work around the problem      You could try running: rpm -Va --nofiles --nodigest      Here is the full error for my php script which works with mysql but not mariadb > ERROR: could not find driver Notice: Undefined offset: 0 in > /var/www/html/index.php on line 137 Fatal error: Call to a member function > prepare() on a non-object in /var/www/html/classes/DB.class.php on line 75 5.5.33a-MariaDB MariaDB Server Centos 6.4 The I can log in to mysql in terminal where it shows the mariadb version, I can also see and manage tables in webmin but none of my php scripts work, including wordpress.


Why does the "w" command report a wrong number of logged in users?

I have logged in from tty6, then logged out, now executing the "w" command from a terminal inside unity gives the following output               mark@mark-Latitude-D620:~$ w     19:27:19 up  2:40,  3 users,  load average: 0.41, 0.61, 0.46     USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT     mark     tty7                      16:47    2:39m  5:06   0.22s gnome-session -     mark     pts/2    :0.0             19:13    7.00s  0.30s  0.00s w      isn't the command suppose to list only the logged in users? I am using ubuntu 12.10 **Edit** Note that the `w` command reports that 3 users are logged in (in the header) but only shows 2 entries.


Parsing columnized data

I have some columnized data which I would like to format a little further. It looks like this:               $ getStats | grep ESTABLISHED | column -t     all  tcp  117.54.56.131:80       <-  10.42.100.211:63752   ESTABLISHED:ESTABLISHED     all  tcp  10.42.120.201:63752    ->  219.224.67.112:31180  ->                       137.51.59.141:80       ESTABLISHED:ESTABLISHED     all  tcp  77.221.237.24:443      <-  10.42.100.117:59999   ESTABLISHED:ESTABLISHED      Essentially before I call `column -t` I want to move the TCP state, 'ESTABLISHED:ESTABLISHED' further on the first and third line so that it is correctly placed with the second line. How would I go about this? Using awk and printf seem a bit messy here. Essentially I want to align all columns and right-align just the last column.


Where to obtain Broadcom DW1530 wireless-n wlan half-mini driver?

I am running Fedora 15 x86_64 on Dell Latitude E5420 which is using Broadcom DW1530 wlan card, have been looking around the web but couldn't find a driver, anyone can help?


How to auto-start my bash_profile?

When I open a new terminal, it doesn't execute auto-start my bash_profile. I need to do "source .bash_profile". When I use Screen, it happens again.


Set up a portable development environment

**My Goal** Have a USB drive (4GB) live boot to DSL (for size) with some extra software (git, hg, .vimrc + plugins, etc...) and also reserve a portion of the drive as writable (maybe symlink my home folder, etc...) Ultimately have a portable development environment. Ideas / Suggestions on how to accomplish this?


Export a m3u playlist to a directory in order they appear in the playlist

There is a way to rsync a m3u playlist into a destination directory. How can I process the list and number the output so it orders the files to match the playlist order? For example the m3u:               /music/song-yellow.mp3     /music/song-red.mp3     /music/song-blue.mp3      would copy/rsync the playlist contents, renaming the files to:               /dest-path/01-song-yellow.mp3     /dest-path/02-song-red.mp3     /dest-path/03-song-blue.mp3      _This is so I can build mixtape playlists and copy them for people._ Any advice appreciated.


How do I select all the hidden files in the console?

How do I select all hidden files in a directory? `ls .*` selects the current folder - `.`, as well as it's parent `..`. I just want the hidden files


Device node LVM

There is mention of a device node, when I was reading about LVM. I can't find anything useful as to what it is or functions as. Any help or suggestion of where to look would be appreciated.


Why are the grsecurity patches not included in the Vanilla Kernel?

What are the reasons that `grsecurity` patches (or the security features it brings) are not included in the kernel by default. When looking at the benefits for security it seems the vanilla kernel is quite insecure as it is. If this is a trade-off (some applications where you want to avoid the security measures), it seems that `grsecurity` could be an option to enable in the vanilla kernel. With so many things in the mainstream vanilla kernel, I have a hard time understanding the reasons why the community does not want to include `grsecurity`.


Installing IPSEC on FreeBSD

how to install IPSEC on two FreeBSD 9.0 machines to can send an encrypted packets between them , and let them read the encrypted packets .


How does one indent code blocks in `ed`?

I like using `ed` for small edits. Currently I just press the spacebar manually to indent blocks of code in `ed`. Is this how the authors of UNIX indented their code in `ed`? Or is there some shortcut they used I don't know about?


USB Ports stopped working

After I locked my screen with `Ctrl``Alt``L` (KDE keyboard shortcut that locks the screen) and went away for 5 minutes all the USB devices stopped working (mouse, keyboard & headset). The devices are still disabled after reboot and I now get a load of error messages in my syslog:               Jun 13 09:30:04 robin-debian kernel: [  338.288104] hub 7-0:1.0: unable to enumerate USB device on port 1     Jun 13 09:30:04 robin-debian kernel: [  338.560074] hub 8-0:1.0: unable to enumerate USB device on port 4     Jun 13 09:30:05 robin-debian kernel: [  383.832047] usb 7-1: new full-speed USB device number 100 using uhci_hcd     Jun 13 09:30:05 robin-debian kernel: [  383.956034] usb 7-1: device descriptor read/64, error -71      These error messages keep popping up when my system is running. I've googled and searched on here and there weren't any working solutions in the results. I'm running Debian Wheezy and using KDE.


gVim opening a tab pushes status line out of window

When opening a new tab in gVim (with `:tabe`), the status line at the bottom of the screen disappears. If I press `:` and start typing a command I can no longer see the command on the status line. When the gVim window is maximized, opening a tab pushes the status line below the screen. When the gVim window is not maximized, the window will increase in height. This problem happens in Gnome and in Xmonad. I'm looking for a way to get around this issue. Is there a way to force the window to redraw such that the status line fits inside the window?


How to find out the content of a XML file using Unix Sed/Awk?

I have a XML file(MyXML.xml) like this :               <?xml version="1.0" encoding="UTF-8"?>     <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">         <S:Body>             <ns3:GetAllInfoFromRest xmlns:ns2="http://com.lanuk.cfe/b2_7/service/objects" xmlns:ns3="http://com.lanuk.cfe/b2_7/service/operations">                 1111,GH43567,Hamburger,GET,278598655,\n000001,                    ,Kunal,Bhyuo,Ramond,856 K. 98 Rd,                                        ,                                        ,Tripura,AGT,INDIA,856987,                    ,S,S,S,8956,\666666             </ns3:GetAllInfoFromRest>         </S:Body>     </S:Envelope>      Now i need to strip out the SOAP content and all the tag attributes from this xml and get only the string response `1111,GH43567,Hamburger,GET,278598655,\n000001, ,Kunal,Bhyuo,Ramond,856 K. 98 Rd, , ,Tripura,AGT,INDIA,856987, ,S,S,S,8956,\666666`. How can i do it with `awk` or `sed` ? I tried it in this way :               $ xgawk -lxml 'XMLATTR["xmlns:ns3"]=="http://com.lanuk.cfe/b2_7/service/operations"{print $2}' MyXML.xml      But obviously I am making some mistake due to which it is not working. Can some one suggest any other way around this ?


What are the differences between the major Linux distributions?

Newbies to Linux like me often find it puzzling when there are so many different distributions like Debian, Fedora or Ubuntu. I've tried to Google some documents describing the differences between these distributions but failed to grasp the key ideas. So I'd like to know:   1. What are the major differences between these distributions?   2. Are there a specific target for each distribution? For example, which distribution would you recommend to a novice for learning the basics of Linux? Which one would you recommend to someone who really wants to learn the essences of Linux? I'm not sure whether there are duplicates of my question but I haven't found one based on a cursory Google search.


XFCE hangs with hand cursor

I am using Xubuntu 12.04 in a remote environment. Off late, I am observing that sometimes the cursor turns into a hand and stops responding. I cannot do anything to fix it. The only solution seems to be to terminate the XFCE session and re-login. I am observing this when using a remote connection. Anyone seen this or know a solution or workaround ? I am just frustrated with this problem coming up every so often. ------------- EDIT ---------------- The LD_PRELOAD method doesnt seem to work for me. Is there a command line way to generate `AllowDeactivateHold` ? ------------- EDIT ---------------- Can we use `xinput` to create the effect of `AllowDeactivateHold` ?


How do you hide "Generic USB SD Reader" in nemo file manager when a card is not present?

I'm running Linux Mint 16. I have a external card reader that has CF, MS, SD, and SM readers in it as well as 3 USB ports. Is there a way to hide the card reader ports from nemo's my computer when there's no cards inserted? I know it's easy to do in windows but i don't know if it's possible in mint.


Find largest files recursively

There seem to be a lot of entries about how to use `du` to recursively find the largest dir and files at the same time, but none on how to only recursively find the largest files in a set of directories. Basically, I am looking for a command to find the largest .mp3 files in my music library, not the directory containing the most amount of data. I'm using bash on an OSX 10.8 system.


Run ssh login command without modifying remote .bashrc

We have a bunch of servers set up with `set -o vi` in their `~/.bashrc`. It would be nice to be able to ssh into these boxes and automagically run `set -o emacs` as a timesave. I've seen a solution indicating that such additions should be made on the remote host `~/.bashrc` but we cannot modify these for various reasons. Another solution suggests using: `spawn ssh -t user@host "set -o emacs; /bin/bash -i"` ..but I understand this requires running the `expect` shell instead of plain `bash`. Is there a simple way to achieve this goal? Any suggestions would be very much appreciated.


UDEV assign ATTRS{variable} to ENV{variable}

I am writing my first udev rule. I read many how tos but can't find a way to assign `ATTRS{variable}` to `ENV{variable}` in order to have access to that variable from RUN like `RUN+="/bin/mkdir/%E{variable}"` because with `RUN+="/bin/mkdir/ATTRS{variable}"` it doesn't work. I tried to use `$ATTRS{variable}`, `%ATTRS{variable}`, `ATTR{serial}`, `$ATTR{serial}`, `%ATTR{serial}` with no success. The variable itself exists 100% thank you...


Find common elements in a given column from two files and output the column values from each file

I have two files with tab-seperated values that look like this: file1:               A    1     B    3     C    1     D    4      file2:               E    1     B    3     C    2     A    9      I would like to find rows between files 1 and 2 where the string in column 1 is the same, then get the corresponding values. The desired ouput is a single file that looks like this:               B    3    3     C    1    2     A    1    9      Can this be done with a Unix one-liner?


Route HTTP traffic thorugh different interface

I have my normal `eth0` interface and an setup `ppp0` interface, the problem I have is that I want to exclusively route all HTTP/HTTPS traffic through the `ppp0` interface and everything else through the default `eth0`. I tried adding a route rule `route add default dev ppp0` but of course this will route everything through the `ppp0` interface, I might need iptables but I have no idea how.


Getting Samba on suse to work with NTFS drives

For a server with samba. I've just added (to the server, just shoved it in) an ntfs drive with some stuff and I want to access it through win7 (home edition). After a small struggle I've managed to access the server files from win7 but not the aforementioned ntfs drive. It works with but I can't log with any of the samba users. When I try to change from `%S` to a specific user or force one it just doesn't connect. Any ideas?                [NTFS drive]     comment = Samba server's NTFS disk     path = /media/sdc1     valid users = %S     read only = No     create mask = 0775     directory mask = 0775     guest ok = No


How to copy two files in expect script?

please advice why               spawn  scp  $FILE1   $FILE2  $LOGIN@$IP:/tmp      in my expect script copy only FILE1 and not copy FILE2 ? I try to to transfer both files by scp as                scp file1.csv file2.crt 192.8.200.1:/tmp       without expect and they transferred successfully to /tmp so why VIA expect the only file that copied is **FILE1** ?? what wrong in my syntax ? example of my expect script:                #!/usr/bin/expect -f      set FILE1  file1.csv      set FILE2  file2.crt      set multiPrompt {[#>$]}      spawn  scp  $FILE1   $FILE2  $LOGIN@$IP:/tmp                expect {                          ")?"   { send "yes\r"  ; exp_continue  }                              word:  {send $PASS\r}                        }      I also try this:               spawn  scp  "$FILE1   $FILE2"   $LOGIN@$IP:/tmp      OR               spawn  scp  '$FILE1   $FILE2'   $LOGIN@$IP:/tmp      but I get the same problem


How do I share stdout between multiple processes?

I want to receive live TCP stream, and make it readable by another processes at the same time, without saving it. For example, 111.222.233.244:1234 streams actual time. Server supports only one connection. TTY1:               $ nc 111.222.233.244 1234 | (do something here) /tmp/tcpstream &     $ sleep 5 # stream is received even if there is no process that reads it     $ cat /tmp/tcpstream # it can also be like `(some command) | cat -`     17:00:06     17:00:07     17:00:08     17:00:09     17:00:10     17:00:11      TTY2 (second `cat` executed 9 seconds after executing `nc`):               $ cat /tmp/tcpstream     17:00:09     17:00:10     17:00:11


SSH to machines in new subnet - connection timeout

I'm using RHEL4 and RHEL5. A new group of Linux machines are setup recently using 172.16.32.0/24. The existing RHEL machines are running on 172.16.1.0/22 and 172.16.4.0/22. When I try to ssh from 172.16.4.39 to 172.16.1.1, there's no problem.               > traceroute 172.16.1.156     traceroute to 172.16.1.156 (172.16.1.156), 30 hops max, 46 byte packets      1  swt0 (172.16.4.240)  1.396 ms  1.380 ms  1.758 ms      2  172.16.1.156 (172.16.1.156)  579.076 ms  573.315 ms  574.878 ms      If I ssh to any one of the new machine, I get ssh timeout, although I can traceroute to it.               > traceroute 172.16.32.11     traceroute to 172.16.32.11 (172.16.32.11), 30 hops max, 46 byte packets      1  swt0 (172.16.4.240)  5.968 ms  1.641 ms  1.476 ms      2  * * *     <----- could be misconfiguration, not sure how to troubleshoot this.      3  172.16.32.11 (172.16.32.11)  273.330 ms  271.820 ms  274.223 ms          > ssh -v -v -v 172.16.32.11     OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003     debug1: Reading configuration data /etc/ssh/ssh_config     debug1: Applying options for *     debug2: ssh_connect: needpriv 0     debug1: Connecting to 172.16.32.11 [172.16.32.11] port 22.     debug1: connect to address 172.16.32.11 port 22: Connection timed out     ssh: connect to host 172.16.32.11 port 22: Connection timed out      I added a similar route on both the switch (swt0) and firewall to point 172.16.32.0/24 to the same gateway 172.16.5.253. Also added a new line in hosts.allow file on 172.16.4.39 (the machine where I try to ssh from).               > cat /etc/hosts.allow     ALL: 127.0.     ALL: 172.16.0.0/255.255.252.0     ALL: 172.16.4.0/255.255.252.0     ALL: 172.16.24.0/255.255.252.0     ALL: 172.16.32.0/255.255.255.0      Any advice what other files I should check/change to make ssh work between 172.16.4.0/22 172.16.32.0/24? Output of ping and `route -n`:               > route -n     Kernel IP routing table     Destination     Gateway         Genmask         Flags Metric Ref    Use Iface     172.16.4.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0     0.0.0.0         172.16.4.240    0.0.0.0         UG    0      0        0 eth0          > ping 172.16.32.11     PING 172.16.32.11 (172.16.32.11) 56(84) bytes of data.     64 bytes from 172.16.32.11: icmp_seq=0 ttl=62 time=269 ms     64 bytes from 172.16.32.11: icmp_seq=1 ttl=62 time=259 ms     64 bytes from 172.16.32.11: icmp_seq=2 ttl=62 time=269 ms     64 bytes from 172.16.32.11: icmp_seq=3 ttl=62 time=268 ms          --- 172.16.32.11 ping statistics ---     4 packets transmitted, 4 received, 0% packet loss, time 3005ms     rtt min/avg/max/mdev = 259.331/266.884/269.777/4.408 ms, pipe 2


CPU usage of KVM

I have a linux host with 4 KVM linux guests. All the guest are pretty much idle, having a load of <0.1 inside the guest. Now, if I do a `top` on the host, each KVM process is using something about 30% of the CPU. Is this a normal behavior? I would expect the host to need much less CPU just to host a idle guest. If it is normal, what is the reason for this? If it is not normal, what might be the problem?


apply bash function to parent scope

I can to define function in bash and use it:               foo() { echo $1; }     foo test      But if I want to collect my functions in one bash script all its unavailable: init.bash               #!/bin/bash     foo() { echo $1; }       export -f foo # This not helps      Using:               ./init.bash && foo test # error here      Is there any way to export script's functions to parent scope?   Without writing to `.bashrc`, it's too global   Same as `.bashrc` but for current bash instance only...


Gnome: Make system text copyable

Here I use "system text" to refer to the text displayed in the GTK widgets (labels, menus, dialogs etc.) I would like to be able to highlight and copy any system text. I am using a locale with a non-roman script that I am not fluent in, and I would like to be able to copy menu items, and paste them into a dictionary. Has anyone ever heard of something that can add that functionality to the GTK libs?


Reading amount of tracks from an audio CD?

I'm writing a little script to analyze audio CDs. I'm specifically looking for a way to grab the track count from the CD, either from a shell-script or from Python. Is there an easy way to do this? On an Ubuntu 12.04 derivative.


What is this construct in bash? mycommand(){dosomething;}

I actually found following one-liner on commandfu.com: `cmdfu(){ curl "http://www.commandlinefu.com/commands/matching/$@/$(echo -n $@ | openssl base64)/plaintext"; }` I have not come across a similar use of the `()` in bash before. It seems that it creates the command `cmdfu` temporarily within the bash environment. Am I correct here? Or is it actually stored somewhere? Is there a name for this construct so I can read up on it?


How to boot a system in a second HD but runing the system in another one?

I have two computers, but the old one is not working well. So I'd like to install the old hard disk on the new computer. I know how to do this and I know how to access the data from `sdb`. But I have some old programs installed on `sdb` which I'm not able to install them again on `sda`. So, I'd like to know if it is possible to use some virtual machine (I have installed VM on `sda`) to boot from `sdb` so that I'd be able to use my old programs whenever I need. I'm using Ubuntu 10.04 on both disks. Thanks.


Accessing other folder

I'm having difficulty with groups and permissions.   * I have user `A` part of group `A` that manages a folder `F`.    * A second user `B` part of group `B` must access folder `F` and its content.   * I added user `B` to group `A` but every time `B` tries to access folder `F` gets the message saying:              'Permission Denied'.       Is this the correct way to achieve that or do I need to do something more? I'm using CentOS 6.4.


Test what cd has done ksh

I'm facing a small issue here. I'm doing :               cd $(find . -type d | grep "${4:0:4}.*${4:4:2}.*${4:6:2}")      $4 is a data entered from the user. However, if the user doesn't respect the format to enter, it will do : `cd` Then, my `$?` will be 0 and not 1, and it will `cd` to my home. I'd like to introduce this in my error case to (by error case, I mean : `if $? = 1`). How can I do that ?


create pseudo shell for a command

I feel like this should be straighforward to some degree... Basically, for some command, I want to be able to invoke another command that will scope all params to that command. so...               git commit -am "test"      would become...               ./shell_comand git     >commit -am "test"     >status      so, obviously things like autocomplete and whatnot wouldn't work, but I would expect otherwise this should be doable to some degree? I'm just not quite clear on how...


SSH remote command execution: get output before execution ends

Consider the following simple C program `test.c`:               #include <stdio.h>          int main(void){             printf("foo\n");             sleep(5);             printf("bar\n");             return 0;     }      The program prints "foo" on stdout, waits for 5 seconds and outputs "bar" then. If I run it remotely using               $ ssh remotehost /path/to/test      I do see nothing for 5 seconds, and get both entries displayed altogether when the program quits. Is there any way to get ssh to redirect each output of stdout before command execution is finished?


Solaris 11 text mode after boot

I am running Solaris 11 on VMWare Workstation host machine Windows 7. Here is my OS and system details: SunOS solaris 5.11 11.0 i86pc i386 i86pc I want to boot Solaris 11 in text mode only i.e make it persistently boot in text mode and not boot into GUI. I tried editing menu.lst. My menu.lst is as follows:               default 0     timeout 30     splashimage /boot/grub/splash.xpm.gz     foreground 343434     background F7FBFF     title Oracle Solaris 11 11/11     bootfs rpool/ROOT/solaris     kernel$ /platform/i86pc/kernel/amd64/unix -B $ZFS-BOOTFS,console=text     module$ /platform/i86pc/amd64/boot_archive     title solaris-backup-1     bootfs rpool/ROOT/solaris-backup-1     kernel$ /platform/i86pc/kernel/amd64/unix -B $ZFS-BOOTFS,console=text     module$ /platform/i86pc/amd64/boot_archive      My problem is that when I reboot Solaris 11 it initially shows up with a command line login asking for username, but as I'm typing the username in, it just boots into GUI anyway showing up a GUI login screen. How can I make Solaris persistently boot into text mode. I have tried boot time grub parameter editing and that way doesn't work either.


Adding multiple gateways for separate physical interfaces with various metrics/priorities

My system has 3 interfaces. These are eth0, eth1 and usb0. eth0 is linked to my router and is the line I want to be used by default. eth1 is un used. usb0 is a 3G phone that's tethered. My issue is that I wan't to be able to access the internet via both eth0 and usb0 at the same time. Currently as soon as I change the gateway to match each interface, the other connection no longer responds. I have tried adding metric values on my interfaces file:               # This file describes the network interfaces available on your system     # and how to activate them. For more information, see interfaces(5).          # The loopback network interface     auto lo eth0 usb0     iface lo inet loopback             allow-hotplug eth0 usb0          # The primary network interface     iface eth0 inet static             address 192.168.1.67             netmask 255.255.255.0             broadcast 192.168.1.254             network 192.168.1.0             post-up route add default gw 192.168.1.254 metric 1             pre-down route del default gw 192.168.1.254               iface usb0 inet static             address 192.168.42.86             netmask 255.255.255.0             broadcast 192.168.42.254             network 192.168.42.0             post-up route add default gw 192.168.42.129 metric 2             pre-down route del default gw 192.168.42.129      Unfourtunately when it starts up, only the usb0 is actually accessible. When I check the routes, I can see that there is no gateway for the eth0.               ~# route -n     Kernel IP routing table     Destination     Gateway         Genmask         Flags Metric Ref    Use Iface     0.0.0.0         192.168.42.129  0.0.0.0         UG    0      0        0 usb0     0.0.0.0         192.168.42.129  0.0.0.0         UG    2      0        0 usb0     192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0     192.168.42.0    0.0.0.0         255.255.255.0   U     0      0        0 usb0      And when I try to access the internet via each of them. eth0 gives me the following:               ~# ping -I eth0 8.8.8.8     PING 8.8.8.8 (8.8.8.8) from 192.168.1.67 eth0: 56(84) bytes of data.     From 192.168.1.67 icmp_seq=1 Destination Host Unreachable     From 192.168.1.67 icmp_seq=2 Destination Host Unreachable     From 192.168.1.67 icmp_seq=3 Destination Host Unreachable     From 192.168.1.67 icmp_seq=4 Destination Host Unreachable     From 192.168.1.67 icmp_seq=5 Destination Host Unreachable     From 192.168.1.67 icmp_seq=6 Destination Host Unreachable     ^C     --- 8.8.8.8 ping statistics ---     7 packets transmitted, 0 received, +6 errors, 100% packet loss, time 6030ms      However, usb0 has internet access.               ~# ping -I usb0 8.8.8.8     PING 8.8.8.8 (8.8.8.8) from 192.168.42.86 usb0: 56(84) bytes of data.     64 bytes from 8.8.8.8: icmp_req=1 ttl=43 time=188 ms     64 bytes from 8.8.8.8: icmp_req=2 ttl=43 time=127 ms     64 bytes from 8.8.8.8: icmp_req=3 ttl=43 time=108 ms     64 bytes from 8.8.8.8: icmp_req=4 ttl=43 time=98.3 ms     64 bytes from 8.8.8.8: icmp_req=5 ttl=43 time=96.9 ms     64 bytes from 8.8.8.8: icmp_req=6 ttl=43 time=165 ms     64 bytes from 8.8.8.8: icmp_req=7 ttl=43 time=226 ms     ^C     --- 8.8.8.8 ping statistics ---     7 packets transmitted, 7 received, 0% packet loss, time 6002ms     rtt min/avg/max/mdev = 96.981/144.575/226.027/46.357 ms      I can't see where I'm going wrong, and on some occasions, though not often, I get the following appearing in my ping:               64 bytes from 8.8.8.8: icmp_req=3 ttl=43 time=132 ms     64 bytes from 8.8.8.8: icmp_req=3 ttl=43 time=672 ms (DUP!)     64 bytes from 8.8.8.8: icmp_req=3 ttl=43 time=1212 ms (DUP!)      Any assistance would be greatly appreciated.


Getting tmux to copy a buffer to the clipboard

I am trying to figure out a decent way to copy what I have in a tmux buffer into my clipboard. I have tried a couple of different things like               bind-key p select-pane -t 2 \; split-window 'xsel -i -b' \; paste-buffer      which gets me fairly close, all I have to do is hit control-d after I do prefix-p. I tried fixing that by doing               bind-key p select-pane -t 2 \; split-window 'xsel -i -b << HERE\; tmux paste-buffer\; echo HERE'      But that just doesn't work. In fact if I pair this down to just               bind-key p select-pane -t 2 \; split-window 'xsel -i -b << HERE'      it doesn't do anything so I am assuming that split-window doesn't like << in a shell command. Any ideas? Edit: You can skip the `select-pane -t 2` if you want, it inst really important. I just use a specific layout and pane 2 is the one i prefer to split when I doing something else so that goes into my bindings involving splits by default.


pwd resolving symbolic links

> **Possible Duplicate:**   >  pwd without symlinks Imagine I have a directory               /home/me/dir      and a symbolic link to it called               /home/me/dirlink      now if I enter `dirlink` and use `pwd`, it of course prints the 2nd one. Is there a flag to make it resolve the symlink and print the 1st one?


NetBSD 5.1 NDIS Kernel Compile Error

I have an old Toshiba Satellite 4015CDT, with Pentium II MMX, 32MB RAM, 4GB HDD. It also has one USB 1.0 port, parallel and serial ports, a 3.5" floppy drive and a CD-ROM drive (almost dead). I've installed NetBSD on this machine (full install) and now I want to connect it to the Internet. Although it has one PCMCIA modem card in it, it is obviously not an option. In order to do that I tried to connect my Realtek RTL8192U wireless adapter, but although the system gives me the device's name (through dmesg) it fails to recognize it as a network adapter. I followed the instructions here and here to recompile the kernel with NDIS support (I gave this configuration the name "NDIS"). At compile time I got the following error messages:               cc1: warnings being treated as errors     ../../../../dev/if_ndis/if_ndis.c: In function 'ndis_detach':     ../../../../dev/if_ndis/if_ndis.c:1187: warning: passing argument 1 of 'mutex_destroy' from incompatible pointer type     *** Error code 1     Stop.     make: stopped in /usr/src/sys/arch/i386/compile/NDIS      I would very much appreciate any help on this matter. Thanks in advance. P.S. If it is of any help, the system was installed by first booting off the installation floppies ("boot1.fs" and "boot2.fs" downloaded from the official ftp server), and then the packages were copied from a USB flash drive (packages also downloaded from the ftp server).


Is there a convenient general way to "grab" the echoed result of a command in Emacs (of M-: or M-!)?

Sometimes, I want to insert the result of an Emacs command (that has been echoed in the echo area) to another buffer or another running X program. So, I'd like to put it to the kill-ring. What would be a convenient way to do this? For example: I could run a query with a shell command while in dired mode, say: `!``rpm -qf` (to find out which package owns the selected file in the directory listing), and then want to insert the result somewhere else. Or, another example: if I needed the filename of the current buffer (as in Is there a user interface in Emacs allowing one to "grab" the buffer's filename conveniently?), and there was not yet any predefined command for this, I could at least do `M-:``(buffer-file-name)` and then use this general-purpose way to copy the shown result to the kill-ring in order to paste it later. (Of course, I could eval `(kill-new (buffer-file-name))`, but this example here is to illustrate what kind of general-purpose way to do the grabbing of the echoed result I'm looking for.)


How to register Nginx as a service, after installing Passenger?

I need passenger/nginx to run many sites on port 80. I have installed it with its own installer (per the instructions on the nginx website. But nginx is not registered as a service. I can only run it through the binary. I need to be able to do this:               $ service nginx restart      Shouldn't passenger have registered nginx as a service?   How can I get Ubuntu's daemon scripts to start the service?


nginx + php5-fpm doesn't work properly. I see a white screen only

I've just installed nginx and php5-fpm and I wanna test it on port 82. So I call http://mysite.com:82/test555.php and I see nothing. Just a white screen. No errors, no warnings, I don't see nothing at all :) There are an error log of nginx and an error log of php5-fpm - but... There are no any errors. I don't undestand what's wrong. Please help me to find out it.               root@localhost:# echo "<?php phpinfo(); ?>" > /home/www/public_html/test555.php     root@localhost:# chmod 755 /home/www/public_html/test555.php     root@localhost:# cat /etc/nginx/sites-available/default     server {             listen 82;             root /home/www/public_html;             index index.php index.html;                  server_name mysite.com;             access_log /var/log/nginx/nginx-access.com.log;             error_log /var/log/nginx/nginx-errors.com.log;                  location ~ \.php$ {                     fastcgi_pass unix:/var/run/php5-fpm.sock;                     # fastcgi_pass 127.0.0.1:9000;                     fastcgi_index index.php;                     fastcgi_param SCRIPT_FILENAME   $document_root$fastcgi_script_name;                     fastcgi_param QUERY_STRING              $query_string;                     fastcgi_param REMOTE_ADDR               $remote_addr;             }     }          root@localhost:# /etc/init.d/nginx status      * nginx is running          root@localhost:# /etc/init.d/php5-fpm status      * php5-fpm is running          root@localhost:# ls -la /var/run/php5-fpm.sock     srw-rw-rw- 1 root root 0 Feb  3 01:14 /var/run/php5-fpm.sock          root@localhost:# cat /var/log/php5-fpm.log      ....     [03-Feb-2014 01:14:52] NOTICE: configuration file /etc/php5/fpm/php-fpm.conf test is successful     [03-Feb-2014 01:14:52] NOTICE: fpm is running, pid 19080     [03-Feb-2014 01:14:52] NOTICE: ready to handle connections          root@localhost:# cat /var/log/nginx/nginx-access.com.log     ...ip... - - [03/Feb/2014:01:29:44 +0000] "GET /test555.php HTTP/1.1" 200 5 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:26.0) Gecko/20100101 Firefox/26.0"          root@localhost:# cat /var/log/nginx/nginx-errors.com.log          root@localhost:#      What can I do next to find out what's going on? I see it should work fine. PHP script returns me code=200 but I doesn't see the output. It never been called, because I tried to add file_put_contents there and it really never been called by nginx. I use ubuntu 12.04 fully upgraded today.


Use grep with or

How do I search in a textfile with grep for the occurrence of a word or another word? I want to filter the apache log file for all lines including "bot" or "spider"               cat /var/log/apache2/access.log|grep -i spider      shows only the lines including "spider", but how do I add "bot"?


Where to supply authentication details to the Network Proxy (Central Proxy) on Fedora?

My system is running Fedora 16 and I live in a campus where we use LAN to connect to the Internet. And for this, we use an http proxy with authentication (username & password). I tried putting the `proxyaddress:port` in the Network Proxy settings after going to the Network Settings window. However, it never asked for an authentication and the programs that use the internet are unable connect, except for Firefox because it asks for authentication. Also, I could get Yum to work by manually editing `yum.conf`. I even tried using `http://username:password@proxy:port` like in the Yum configuration but it has not helped. Is there any solution to this problem? Thank you.


Trying to install Fedora using Unetbootin on a windows 8 laptop

The Unetbootin does whatever it says it needs to do, and then when I restart my computer and attempt to launch it says that it cannot find ubnldr.mbr and won't launch. How can I fix this, or is there an easier way to do the same thing?


How do I partition a USB drive so that it's bootable and has a Windows-compatible data storage partition?

**split from here** I have a 16gb flash drive, which I want a live ISO to boot from (via unetbootin or something similar). It'll be some 32bit distro that I can plug- in and boot on whatever computer I need to. Since it will be a live ISO, I'll need somewhere to save data. I want the USB drive to have about 1gb for the distro, and the other 15gb for data storage. I made two FAT partitions, the first called 'bootable' and the second 'storage'. The storage works fine in Linux, but Windows only sees the bootable partition. The storage isn't accessible. How can I make the data accessible on Windows, and still have a bootable distribution? If the answer is how to partition it, please include the order and type of each partition. Do I need swap space for this, or is this handled differently?


Apache server in raspberry PI not visible from outside( public IP)

I have made a fresh install of Arch Linux ARM into a Raspberry PI and I mounted there a LAMP, all fresh. I have another Arch(x86) in my laptop with Apache also there, and as far as I know, two web servers cannot run in the same network segment so, the problem is as follows. In my laptop, having Apache running, if I enter via the public ip of my network everything turns ok and I can see my website but, (obviously turning this server down) if I enter from the public IP with the Apache running in the raspberry pi( yes, only that Apache running) i cannot see my website in there. Also, if I access via local network it is a normal success, I can see my website. So, I can enter my raspberry website only via local but in my other web server i can enter it via local and public. I have the same conf files in both of them so what is the difference? I was planning in making the rpi as a development server.   Thanks in advance


Rsync adding a "?" at the beginning of directories

I currently have many of these commands running in a `.sh` file that looks like this:               rsync -avz -e ssh --rsh='ssh -p1337' --bwlimit=10000 root@DestinationIP:/home/backup /home/localbackup     rsync -avz -e ssh --rsh='ssh -p1337' --bwlimit=10000 root@DestinationIP:/home/backup2 /home/localbackup2      When I go to run this, it goes through to the destination correctly, but adds a "?" to the beginning of the directory locally, which prompty fills up the hard drive to the brim. Have I done a flag incorrectly? I thought `rsync` was supposed to sync the directories, not duplicate them.


how to determine how many times pid_max wrapped?

Is it even possible to know that? may be some kind of tests are required to be performed in order to find that information? My system, just after I login, seem to have already wrapped the max_pid, so a still alive pid got the same pid of an old process (what messes one of mine scripts...)! I am trying to understand what is happening and if there is some workaround to that... my `/proc/sys/kernel/pid_max` is 32768


Best way to remove lines from a file where matching text (not whole line) exists in another file

I have a file of email addresses (file 1) and another file (file 2) of lines of data that contain some of these email addresses I want to compare files and remove all lines in file 2 that have a matching email in file 1. I know I can do a loop and use `sed -i` or loop and grep each line to a new file then compare files with COMM But I was wondering if there is a comparison method that I can kind of grep all lines in file1 to file2 and just be left with the lines from file2 that do not contain any emails in file 1 file 1:               test@invalid.com     test2@invalid.com     test3@invalid.com      file 2:               23456|tom|jones|test@goodemailcom|10     12345|pete|best|pete@goodemail.com|10     87569|remove3|me3|test3@invalid.com|10     23098|mike|jones|mike@goodemailcom|10     10985|al|best|al@goodemail.com|10     09865|removve|me|test@invalid.com|10     13579|remove2|me2|test2@invalid.com|10      Appreciate any knowledge anyone has.


How can I know the max possible trasmit power of my wireless card?

Is there any way for me to tell the maximum possible power of my wireless card from within Linux? Or do I need to find the product number of the card, and search for specifications like that online?


Replacement to CUPS Browse Protocol

The CUPS "browsing" protocol was marked as deprecated being removed at v1.6 of CUPS, due to problems with broadcast and managed networks/WiFi. It's an UDP protocol to broadcast information about installed printers on a CUPS server and share them. In a simple way, the following diagram describes our network and printer propagation using this protocol:                            Browse Protocol                                                                                *Printers are shared as ipp pools on the printserver*      +-----------+                                                                |CUPS Client|  ipp://printserver/printer01, ipp://printserver/printer02      |1.3.7      +--------+                                                       |           |        |      +------------------+                             +-----------+        |      |                  |                                                  +------>   Printserver    |                             +-----------+        |      |   CUPS 1.5.3     |                             |CUPS Client|        |      |                  |                             |1.5.3      |        |      +------+---------+-+                             |           +--------+             |         |                               +-----------+                      |         | ipp://printer01                                       smb://printer02      |                                                                  |         |                                                        +---------v-+    +--v-------+                                                |           |    |          |                                                |Printer 02 |    |Printer 01|                                                |           |    |          |                                                ++----------+    +----------+                                        *Printserver connects to them using                                           all kinds of protocols*                                                                                * The servers have interfaces on the same VLAN to make the zeroconf propagation of printers;   * The clients (some of them) have legacy systems that prints through `lpr`. Their local `cups` have printers pointing to the printserver;   * The printserver announces (broadcast) new printers and changes each 60 seconds; We have about 10 clients that consumes those printserver polls, while the printserver itself connects to 250 printers. Since adding printers on each client would not be a pleasant task, and due to driver issues with newer printers, CUPS needs to be updated I ask: **Question:** Is there an alternative to the browse protocol to add printers in a distributed way? Reasons why this architecture needs to be kept:   * With this centralized printserver i can make job accounting through scripts and send them by email. Synchronizing printers but letting the clients print directly to them would be a "good enough" solution, but not the best;   * Easy to manage printers at one server;   * Security. Since it´s a virtualized environment i can decide which server will have an interface on the same vlan the printserver broadcast it´s pools/printers;   * Our support guys are trained to add and share printers using the default cups administration page(`http://printserver:631`) and they have no access to shell at all. This is why solutions like adding one avahi service to each printer are not good options.


Yum on CentOS 7 repositories may be broken

Just got CentOS 7 on a new server and I went `yum install httpd` and it went fine. Afterwards I went `yum install mysql-server` and I got `No package mysql-server available`. I haven't messed up with the configuration files. Any suggestion?


How to install nvidia driver (gt 755m) on Fedora 20?

I am trying to install nvidia drivers for my Geforce GT755M on Fedora 20. I tried installing kmod, akmod and compiled from source. None of them seem to work. I always end up at a black screen. After compiling from source, when I reboot the system, I can not get to the login screen. Here's the output of Xorg.0.log:                [   941.731]      X.Org X Server 1.14.4     Release Date: 2013-10-31     [   941.731] X Protocol Version 11, Revision 0     [   941.731] Build Operating System:  3.14.3-200.fc20.x86_64      [   941.731] Current Operating System: Linux abhay-mittal 3.14.5-200.fc20.x86_64 #1 SMP Mon Jun 2 14:26:34 UTC 2014 x86_64     [   941.731] Kernel command line: BOOT_IMAGE=/vmlinuz-3.14.5-200.fc20.x86_64 root=UUID=9508d200-f5fd-4a84-8ceb-549c1eb548d6 ro vconsole.font=latarcyrheb-sun16 rhgb quiet LANG=en_US.UTF-8     [   941.731] Build Date: 14 May 2014  12:35:26AM     [   941.731] Build ID: xorg-x11-server 1.14.4-9.fc20      [   941.731] Current version of pixman: 0.30.0     [   941.731]    Before reporting problems, check http://wiki.x.org         to make sure that you have the latest version.     [   941.731] Markers: (--) probed, (**) from config file, (==) default setting,         (++) from command line, (!!) notice, (II) informational,         (WW) warning, (EE) error, (NI) not implemented, (??) unknown.     [   941.731] (==) Log file: "/var/log/Xorg.0.log", Time: Wed Jun 11 18:57:29 2014     [   941.731] (==) Using config file: "/etc/X11/xorg.conf"     [   941.731] (==) Using config directory: "/etc/X11/xorg.conf.d"     [   941.731] (==) Using system config directory "/usr/share/X11/xorg.conf.d"     [   941.732] (==) ServerLayout "Layout0"     [   941.732] (**) |-->Screen "Screen0" (0)     [   941.732] (**) |   |-->Monitor "Monitor0"     [   941.732] (**) |   |-->Device "Device0"     [   941.732] (**) |-->Input Device "Keyboard0"     [   941.732] (**) |-->Input Device "Mouse0"     [   941.732] (==) Automatically adding devices     [   941.732] (==) Automatically enabling devices     [   941.732] (==) Automatically adding GPU devices     [   941.732] (**) FontPath set to:         /usr/share/fonts/default/Type1,         catalogue:/etc/X11/fontpath.d,         built-ins     [   941.732] (==) ModulePath set to "/usr/lib64/xorg/modules"     [   941.732] (WW) Hotplugging is on, devices using drivers 'kbd', 'mouse' or 'vmmouse' will be disabled.     [   941.732] (WW) Disabling Keyboard0     [   941.732] (WW) Disabling Mouse0     [   941.732] (II) Loader magic: 0x80dd00     [   941.732] (II) Module ABI versions:     [   941.732]    X.Org ANSI C Emulation: 0.4     [   941.732]    X.Org Video Driver: 14.1     [   941.732]    X.Org XInput driver : 19.2     [   941.732]    X.Org Server Extension : 7.0     [   941.732] (II) xfree86: Adding drm device (/dev/dri/card1)     [   941.935] (II) xfree86: Adding drm device (/dev/dri/card0)     [   941.936] (--) PCI:*(0:0:2:0) 8086:0416:17aa:3801 rev 6, Mem @ 0xc2000000/4194304, 0xb0000000/268435456, I/O @ 0x00005000/64, BIOS @ 0x????????/131072     [   941.936] (--) PCI: (0:1:0:0) 10de:0fcd:17aa:3801 rev 161, Mem @ 0xc0000000/16777216, 0x90000000/268435456, 0xa0000000/33554432, I/O @ 0x00004000/128, BIOS @ 0x????????/524288     [   941.936] Initializing built-in extension Generic Event Extension     [   941.936] Initializing built-in extension SHAPE     [   941.936] Initializing built-in extension MIT-SHM     [   941.936] Initializing built-in extension XInputExtension     [   941.936] Initializing built-in extension XTEST     [   941.936] Initializing built-in extension BIG-REQUESTS     [   941.936] Initializing built-in extension SYNC     [   941.936] Initializing built-in extension XKEYBOARD     [   941.936] Initializing built-in extension XC-MISC     [   941.936] Initializing built-in extension XINERAMA     [   941.936] Initializing built-in extension XFIXES     [   941.936] Initializing built-in extension RENDER     [   941.936] Initializing built-in extension RANDR     [   941.936] Initializing built-in extension COMPOSITE     [   941.936] Initializing built-in extension DAMAGE     [   941.936] Initializing built-in extension MIT-SCREEN-SAVER     [   941.936] Initializing built-in extension DOUBLE-BUFFER     [   941.936] Initializing built-in extension RECORD     [   941.936] Initializing built-in extension DPMS     [   941.936] Initializing built-in extension X-Resource     [   941.936] Initializing built-in extension XVideo     [   941.936] Initializing built-in extension XVideo-MotionCompensation     [   941.936] Initializing built-in extension SELinux     [   941.936] Initializing built-in extension XFree86-VidModeExtension     [   941.936] Initializing built-in extension XFree86-DGA     [   941.936] Initializing built-in extension XFree86-DRI     [   941.936] Initializing built-in extension DRI2     [   941.936] (II) "glx" will be loaded by default.     [   941.936] (WW) "xwayland" is not to be loaded by default. Skipping.     [   941.936] (II) LoadModule: "dri2"     [   941.936] (II) Module "dri2" already built-in     [   941.936] (II) LoadModule: "glamoregl"     [   941.936] (WW) Warning, couldn't open module glamoregl     [   941.936] (II) UnloadModule: "glamoregl"     [   941.936] (II) Unloading glamoregl     [   941.936] (EE) Failed to load module "glamoregl" (module does not exist, 0)     [   941.936] (II) LoadModule: "glx"     [   941.936] (II) Loading /usr/lib64/xorg/modules/extensions/libglx.so     [   941.944] (II) Module glx: vendor="NVIDIA Corporation"     [   941.944]    compiled for 4.0.2, module version = 1.0.0     [   941.944]    Module class: X.Org Server Extension     [   941.944] (II) NVIDIA GLX Module  331.79  Sat May 17 23:58:32 PDT 2014     [   941.944] Loading extension GLX     [   941.944] (II) LoadModule: "nvidia"     [   941.944] (II) Loading /usr/lib64/xorg/modules/drivers/nvidia_drv.so     [   941.944] (II) Module nvidia: vendor="NVIDIA Corporation"     [   941.944]    compiled for 4.0.2, module version = 1.0.0     [   941.944]    Module class: X.Org Video Driver     [   941.944] (II) NVIDIA dlloader X Driver  331.79  Sat May 17 23:37:42 PDT 2014     [   941.944] (II) NVIDIA Unified Driver for all Supported NVIDIA GPUs     [   941.944] (++) using VT number 1          [   941.944] (II) Loading sub module "fb"     [   941.944] (II) LoadModule: "fb"     [   941.944] (II) Loading /usr/lib64/xorg/modules/libfb.so     [   941.945] (II) Module fb: vendor="X.Org Foundation"     [   941.945]    compiled for 1.14.4, module version = 1.0.0     [   941.945]    ABI class: X.Org ANSI C Emulation, version 0.4     [   941.945] (WW) Unresolved symbol: fbGetGCPrivateKey     [   941.945] (II) Loading sub module "wfb"     [   941.945] (II) LoadModule: "wfb"     [   941.945] (II) Loading /usr/lib64/xorg/modules/libwfb.so     [   941.945] (II) Module wfb: vendor="X.Org Foundation"     [   941.945]    compiled for 1.14.4, module version = 1.0.0     [   941.945]    ABI class: X.Org ANSI C Emulation, version 0.4     [   941.945] (II) Loading sub module "ramdac"     [   941.945] (II) LoadModule: "ramdac"     [   941.945] (II) Module "ramdac" already built-in     [   941.969] (EE) NVIDIA: Failed to load the NVIDIA kernel module. Please check your     [   941.969] (EE) NVIDIA:     system's kernel log for additional error messages.     [   941.969] (EE) No devices detected.     [   941.969] (EE)      Fatal server error:     [   941.969] (EE) no screens found(EE)      [   941.969] (EE)      Please consult the Fedora Project support           at http://wiki.x.org      for help.      [   941.969] (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.     [   941.969] (EE)       I've looked at posts on various forums, and found no working solution. Can't figure out what am I doing wrong. Please help.


How are filesystem snapshots different from simply making a copy of the files?

by doing this,               # btrfs subvolume snapshot /mnt/1 /mnt/1/snapshot     # tree /mnt/1     /mnt/1     ├── a     ├── snapshot     │   ├── a     │   └── subv     └── subv         └── b          3 directories, 3 files      We can create snapshot from /mnt/1 on btrfs. My question is: what is advantage of using snapshot , than using rsync to simpaly backup filesystem?


how can I rename multiple files by removing a character or string?

As a follow-up to my previous question, if I have multiple files of the form               sw.ras.001     sw.ras.002     sw.ras.003     …      What command can I use to remove the `ras.` in the middle of all the files?


Remove whitespace and parentheses in filenames with sed

I'm an absolute newbie in the unix area so forgive me off the bat if I've gone about this the wrong way. I have a series of files I need to rename which all have the pattern " (*)" in them. Eg;               001 (1).txt     002 (1).txt     003 (2).txt      My desired output is to rename the files to 001.txt, 002.txt, 003.txt. Note the real files vary in length and extension type (this is my test batch). I have searched the net and SE and come up with the following which gives me the desired output in the terminal.               ls *\(*\)* | sed 's/\(.*\)\( (.*)\)\(.*\)/mv & \1\3/'          mv 001 (1).txt 001.txt     mv 002 (1).txt 002.txt     mv 003 (2).txt 003.txt      However once I pipe it to sh I get the error below.               sh: line 1: syntax error near unexpected token `('     sh: line 1: `mv 001 (1).txt 001.txt'      I know it has to do with the `\\( (.*)\\)` section. I've tried escaping the internal parentheses but then that doesn't give me the desired output. I've also searched for regex ways to say search for the whitespace followed by any 3 characters but have had no luck. I know there are easier ways to achieve what I want but I went with sed as thus far it was the only thing I could vaguely understand. Very much appreciate any input into getting the above line working and then considering easier approaches.


How to install easy_install using non-default Python Interpreter on CentOS?

I have downloaded, compiled and installed Python 2.7 on CentOS. I would like to download and install easy_install (and pip) for it but I am a little bit confused as to how to do that. How can I proceed to get setuptools and easy_install and pip using a non- default Python installation installed in `/usr/local/`?


How to disable Switch User option from Fedora 15

Is there a way to disable the **Switch User** option from a locked screen on Fedora 15? I've tried this way, but no luck, since `gconf-editor` has no effect.


SVN failing to create SASL context

Trying to execute the command               svn log svn://[my server address]/path/to/repository      nets me the following:               svn: E170001: Unable to connect to a repository at URL 'svn://[my server address]/path/to/repository'     svn: E170001: Could not create SASL context: generic failure      Some quick googling reveals a possible solution:               sudo port activate cyrus-sasl2 @2.1.23_3+kerberos      However, before I attempt this, I would like to know a couple things.   1. What exactly is going on?   2. What does this command do? How does it fix the problem? EDIT: I am not using SASL, nor do I wish to. I don't actually have Cyrus SASL installed.


Will incron's IN_CREATE event give me a blank file?

I want to monitor a directory for new files, which will be created by another process. I plan to use `incrod` to do this. I am not interested in reacting to changes in files, as the files should never be updated. Therefore the `IN_CREATE` event seems the sensible option to listen for. However, I am unsure, if I listen for that event, could I end up with an empty file (before the other process has written any information to it)? Should I use the `IN_WRITE_CLOSE` event instead?


Cannot connect to ssh server

I am having trouble connecting to my ssh server. It responds with a lengthy error message about no network etc. but it is the last message that concerns me: > Sometimes, such troubles can be caused by a misconfigured firewall. How can I check the firewall if I cannot connect to ssh? I am running plesk 11.5 control panel and CentOS 6. Is this something I can do from plesk? I can see that the firewall in plesk is set to allow all for ssh, but I cannot see way to disable the firewall to test ssh connection. Can this be done from plesk? It is driving me absolutely bananas and I would be grateful if someone could shed some light as to how I can proceed. Many thanks for your help.


lftp mirror permission denied?

I have mirrored a public html folder to my new openvz but it gives me permission denied error on some files. I have compared the size of the mirrored folder and it's less then the original. How can I syncronize the folder in the right way? I need to move my website to a new openvz.


Passing arguments from a file to a bash script

I' ve got this situation:               ./     ./myscript.sh     ./arguments.txt     ./test.sh      Inside myscript.sh, i have to run the file test.sh, passing to it the arguments contained inside arguments.txt. _myscript.sh_ is:               arguments=$(cat arguments.txt)     source test.sh $arguments      This works well if if _arguments.txt_ contains max one argument:               firstargument       The substitution is:               ++ source test.sh 'firstargument'      But, and here is the real problem, with two arguments it does this:               ++ source test.sh 'firstargument secondargument'      Also, i don't know in advice the number of arguments inside arguments.txt. There can be zero, one or more. Thanks a lot for help in advice!


How to print only defined variables (shell and/or environment variables) in bash

The bash builtin command `set`, if invoked without arguments, will print all shell and environment variables, but also all defined functions. This makes the output unusable for humans and difficult to `grep`. How can I make the bash builtin command `set` print only the variables and not the functions? Are there other commands which prints only the shell variables, without the functions? Note: bash differentiates between shell variables and environment variables. see here Difference between environment variables and exported environment variables in bash


Awesome WM loads personal rc.lua but then overwrites with system settings

I just started playing with awesome-wm. Sometimes, when I reload my config, the settings hold. Other times, I can see some settings take for a second, but then are overridden by the defaults. I copied the /etc/xdg/awesome directory to ~/.config/awesome as suggested on the wiki. I've also noticed some other issues with these steps, and I'm not sure if it's me, my system, or what. Other relevant issues include:   * Theme loads, and then loads the default   * Network Widget on the link above doesn't load (or I don't see it)   * Changing the tags results in 18 tags. The ones I changed, and 1-9 again. Any thoughts on what I'm doing wrong?


How can I find out the estimated power use of my desktop computer?

Is there a way to get the computer power usage instead of battery load tracking (what for instance seemingly `powertop` does), which is obviously not too useful on desktops?


How to get Oracle java 7 to work with setcap cap_net_bind_service+ep

I am trying to grant the java executable the right to open ports below 1024 on Linux. Here is the setup   * `/home/test/java` contains the Oracle Server JRE 7.0.25    * CentOS 6.4 Here is what getcap returns               [test@centos6 java]$ pwd     /home/test/java          [test@centos6 java]$ getcap bin/java     bin/java = cap_net_bind_service+ep          [test@centos6 java]$ getcap jre/bin/java     jre/bin/java = cap_net_bind_service+ep      Trying to execute java gives the following error.               [test@centos6 java]$ bin/java     bin/java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory     [test@centos6 java]$ jre/bin/java     jre/bin/java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory      Is it possible to run Java 7_u25 when the binary has been given elevated privileges with setcap, if so how? JDK-6919633 : Runtime does not support POSIX File Capabilities (A.K.A. Linux Capabilities) says that               Note: when using the setcap the libraries needed by the java launcher     should be present in /usr/lib or any other "trusted" location that the     runtime loader (rtld) uses to find shared libraries.      How do I make the shared libraries trusted?


How to get all my keys to send keycodes

I'm using Gentoo with XFCE. I have a logitech K350 keyboard, all but a few of the keys work as expected but there is one specific key that I want to use but when I run `showkey` no key codes are being sent. The key is the arrange windows button on the bottom left of the keyboard. ![enter image description here](http://i.stack.imgur.com/M99Zh.png). Is this a driver issue and is it possible to get that key to send a code so that I can map an action to it?


CPU frequency goes back after scaling down by indicator-cpufreq, suspension and waking up

I scale down the CPU frequency by indicator-cpufreq on Ubuntu 12.04. After I suspend Ubuntu and wake it up, the CPU goes back to"on demand" (the default). I wonder if there is a way to keep the CPU frequency after scaling it? **NOTE:** sometimes, my Ubuntu can't wake up completely, and my laptop can easily become overheated under CPU frequency on demand.


Why do some symbolic links affect program behavior?

One thing that has been puzzling me for some time is this:               % which halt     /sbin/halt     % file /sbin/halt     /sbin/halt: symbolic link to `reboot'      However, executing `sudo halt` does, of course, **not** reboot the system. Why is that? There are several other programs working that way, for example `pdflatex`.


Why EC2 instance spends all its time in "IRQ" and what to do about it?

I have an m1.small EC2 instance that is mostly just running Apache as a web server for several simple PHP web sites (that use RDS as a database). The server is constantly with a very high load average - around 8, and never below 5. This causes my web sites to be annoyingly slow, much more then I'd expect from a supposedly 2.6GHz CPU with 1.7GB RAM. `top` and friends shows that other then ~50% "steal" time (AFAIU, time stolen by the hypervisor for other VMs on the same CPU), the rest is almost entirely "IRQ" time. `mpstat` says that this time is spend on a very stable 191.59 interrupts/sec (i.e. that number almost doesn't change over time), and according to '/proc/interrupts' these are mostly spend on `xen-percpu-virq timer0` and `xen-dyn-event eth0`. What are these, and how can I get the EC2 instance to lower the load and spend some more time on my PHP sites?


Commands run when terminal is open do not appear in history

I have the simple following `terminal.sh` script:               #bin/bash --login     str=(--tab --title="Test" -e "bash --login -c 'echo history';bash")     gnome-terminal "${str[@]}"     exit 0      I basically use it to open a terminal with several tabs that I need to use daily. But the problem is that the `echo history` command is not added to the history of that tab. So, for example, one of my tabs is the application server. When I need to restart it, I usually type `Ctrl`+`C`, `Ctrl`+`L`, `Up` and `Enter`, but when I use this script to run it, it doesn't add the line executed to the bash, and then the last command executed is normally `exit`. So I end up closing the tab instead of restarting the server, which is incredbly annoying. I saw this, and I tried adding:               HISTFILE=~/.bash_history     set -o history      To the start of my `terminal.sh` script, and also tried adding to the script executed:               str=(--tab --title="Test" -e "bash --login -c 'HISTFILE=~/.bash_history;set -o history;echo a';bash")      But neither helped. I also tried adding `history -s echo history` before executing the script, but that didn't help either. How can I add all commands executed this way to the history? I aslo tried:               #bin/bash --login          cmd='echo test'     cmd_e="bash --login -c 'unset PROMPT_COMMAND;history -s '\''$cmd'\''; eval '\''$cmd'\''';bash"     str=(--tab --title="History Test" -e "$cmd_e")          gnome-terminal "${str[@]}"          exit 0


How to relate a kernel config setting to the source files?

Here is an example that will explain better: ![enter image description here](http://i.stack.imgur.com/0Yveq.png) I have a selected the audio driver from the picture and i would like to browse through its source. How do i get to the path of the source files from here? ![enter image description here](http://i.stack.imgur.com/FApCk.png)


Shell script wait for background command

I am writing a script, but there is something I need that I can't find a way to do it... I need to make a command in background "command1 &" and then somewhere in the script I need to wait for it to finish before I do command2. Basically, I need this: NOTE: each command runs in a specific directory! at the end of the while loop my command1 created 4 directory's, where in each one run the specific process so the total of process running are 4               a=1          while [$a -lt 4 ]               . command1        #Generates 1 Process                 a= `export $a +1`     done             #Wait until the 4 process end and then run the command2               . command2      I've looked a lot of pages, but I couldn't make this simple task to be done. I've seen something about a `wait` command with the pid process number, but that didn't work also (or I couldn't make it work). Can anybody help me?


starting multiple x-sessions with different DE/WMs with startx in Linux Mint

I'm using Linux mint, and I want two windows managers (MATE and xmonad) running on different pipes. I installed xmonad, and when I choose xmonad from the login screen it works perfectly. But, when I move to pipe tty1, login, and run `startx xmonad`, I get an error:               <home dir>/.xmonad/xmonad-i386-linux: executeFile: does not exist (No such file or directory)      The screen is white, and pressing Alt-Shift-Enter opens a window for a split second then returns to the white screen. Why? How can I fix this?