How to read a text file line by line which is not constant in shell scripting

I need to read a text file line by line and the lines are not constant it may vary.For example               $ cat file1.txt     syntax error at or near "?" at character 1     syntax error at or near "[" at character 1     syntax error at or near "," at character 1     syntax error at or near "desc" at character 1     syntax error at or near "describtion" at character 1 `      After reading that line it must get automatically passed to the grep command and give me the result set. Since the number of lines & errors captured in the text file is not predictable. Everything needs to be done automatically               $ find file1.txt | xargs grep 'syntax error at or near "?" at character 1' | tail -1      How can I put the 2nd line,3rd line...nth line & automate it in the shell script.


The processing order and printing of files with find

This simple BASH script collects msgstrs in a PHP project:               #!/bin/sh     TARGET=/path/to/project     LPATH=locale/cy_GB/LC_MESSAGES     POFILE=messages.po     mkdir -p $LPATH     touch $TARGET/$LPATH/$POFILE     cd $TARGET     find . -name '*.php' -print | xargs xgettext -j --from-code=UTF-8 -o $TARGET/$LPATH/$POFILE      I have 2 questions:   1. Why doesn't -print list the files it has found - all the docs say it should?   2. Is there any way to specify the order in which find deals with the files? If I run an equivalent PHP script, it deals with the files in the order they are listed by ls, and then goes into the dirs. But find seems to do its own thing, with the files jumbled up in no apparent order, and the dirs interspersed with them?


Inappropriate ioctl for device

I can write to the tape drive (tar -cf /dev/st0 file) and retrieve files from the tape drive (tar xvf /dev/st0 file). But the problem is when I attempt to use the 'mt' command to check the status of the tape drive, **command.**               mt -f /dev/st status      the following error is shown               /dev/st0: Inappropriate ioctl for device      The tape drive is being recognized by the server since I can retrieve and write to the tape drive. How can I get the status of the tape drive using the `mt` command or any other command?


How to do svn update without password on crontab

I'm new to svn and ssh. I'm trying to do svn update of 5 repositories in my local system every 3 hours on crontab. So, to achieve this I have setup `ssh passwordless login` using the below steps:   1. `ssh-keygen`   2. `ssh-copy-id -i ~/.ssh/id_rsa.pub test@repo.test.in`   3. I did `ssh test@repo.test.in` Until here it works fine for me. I'm able to login without password. But, when I try to do `sudo svn update` on the 5 repositories, it is prompting for password. How to make svn update without password. Is there any way that I can do update of the repositories every 3 hours on cron. I referred to this, but could not get it.   I'm using               Ubuntu version : Ubuntu 13.04`              OpenSSH_6.1p1 Debian-4, OpenSSL 1.0.1c 10 May 2012


Does "mount -o remount,ro" flush filesystem buffers?

On Linux, does `mount -o remount,ro` flush filesystem buffers/cache, or should I also run `sync` to achieve that?


Can swap be shared safely while hibernating?

Suppose I have two different Linux installations _A_ and _B_ , both using the same swap partition. As I understand, running _A_ or _B_ will cause no problems with swap as only one of them is using it at a given time. However, if I boot _A_ , hibernate, then boot _B_ , swap is being used by _both_ ( _A_ in a passive form, but data is there). The question is: Will the hibernated system survive after this? If not, will the memory be corrupted or will _A_ just be unable to resume, causing a regular boot? Note: My main concert are live systems that detect and use available swap partitions on the hard drive. Will they destroy hibernated systems?


What does mean ` AWK=@AWK@` in shell scripting

I found `AWK=@AWK@` while reading `sh` script, it's something like `AWK=$(which awk)`, but it's not working. So can anyone explain this ? Script :               #!/bin/sh -     # makelist.sh: Automatically generate header files...          AWK=@AWK@     USAGE="Usage: $0 -n|-h|-e|-fc|-fh|-bc|-bh|-m <filenames>"          if [ "x$1" = "x" ]     then         echo $USAGE 1>&2         exit 1     fi          .....     .....     .....     -h)         set - `echo $FILES | sed -e 's/\\./_/g'`         hdr="_h_`basename $1`"         cat $FILES | $AWK '             BEGIN {                 printf("/* Automatically generated file, do not edit */\n");                 printf("#ifndef %s\n#define %s\n", "'$hdr'", "'$hdr'");             }             /\(\):/ {                 pr = substr($2, 1, 2);                 if (pr == "vi" || pr == "em" || pr == "ed") {                     # XXXMYSQL: support CRLF                     name = substr($2, 1, index($2,"(") - 1);     ...


Unable to install Atheros AR8161 Ethernet controller driver for centOS 6

I've installed CentOS 6.3. However, **eth0 does not show up on ifconfig**. So I figured out that I need to install alx Ethernet driver from here. Since my internet is not working, as ethernet drivers are not installed, I've installed Development Tools from the DVD. **Steps performed:**   1. ./scripts/driver-select alx   2. On 'make' I get this error. http://paste.ubuntu.com/5669506/ How do I solve this issue? Would be grateful for any kind of help. Thanks.


How to make Linux application (all in one fille) installer?

I am working on some Linux application. It is the right moment to start thinking about deployment. So my question is: How to create a one file installer like for example *.run or *.sh files that sometimes can be found in internet (for example nVidia drivers or Wolfram Mathematica CDF).


unionfs filesystem

I recently learned about unionfs and aufs and would like to put it to some real use. The scenario I have in mind is the following. Boot a machine with ubuntu on it which will serve as our base. Make sure the root partition for the base is ro. Overlay an empty rw partition over the root partition using unionfs or aufs magic. Go to town on the system and maybe break some things. Now instead of wiping and re-installing everything from scratch I can just wipe the rw partition and reboot the system to restore it to a working state. So I want to know what I need to learn to accomplish the above task. Googling for aufs/unionfs has already brought up things like initramfs and I would like to know what other keywords I should look up if I want to do this right.


Writing a bash script for apache conf files

I'm trying to automate creating vhosts on my computer. This is merely a learning experience for bash scripting. I'm currently novice. I'm trying to learn more about awk, sed. No, this isn't homework. I work full-time. Anyways, this is my conf file. What would be the most efficient way to find and replace from command line? I'll eventually replace some forms with tokens, like {DOMAIN} and {PATH}               NameVirtualHost commerce.l:*          <Directory "/home/chris/workspace/dev.commerce/html">             Options Indexes Includes execCGI             AllowOverride All             Order Allow,Deny             Allow From All     </Directory>          <VirtualHost commerce.l>         DocumentRoot /home/chris/workspace/dev.commerce/html         ServerName commerce.l         ErrorLog logs/commerce.error         <IfModule mod_rewrite.c>             <Directory "/home/chris/workspace/dev.commerce/html">                 RewriteEngine on                 # needed by Drupal 7 for "clean URLs"                 RewriteCond %{REQUEST_FILENAME} !-f                 RewriteCond %{REQUEST_FILENAME} !-d                 RewriteCond %{REQUEST_URI} !=/favicon.ico                 RewriteRule ^ index.php [L]             </Directory>         </IfModule>     </VirtualHost>      P.S. I'm on Ubuntu 11.04 natty


Configuring ProFTPd securely in a shared environment

We currently have a LAMP stack for shared webhosting, and are using ProFTP with that. Currently the ProFTP config is fairly stock - users are chrooted to `~`. Currently running as the default user/group. We only use system users - no virtual users. We use SuPHP to run each PHP process as the appropriate user/group. **What I'd really like is to have ProFTP automatically set the`user:group` of uploaded files to whomever is logged in. So if I login to FTP as "customer-a", I'd like any uploaded files be owned by "customer-a".** The main reason for this is, it seems, if I login as someone right now, they don't have permission to write to their home directory. Instead of loosening permissions, I'd like ProFTP to switch the user context appropriately. ## Possible Solutions One thing I've considered is perhaps declaring a virtual-host for each customer domain, which would then allow me to configure the User and Group directives individually. 1) This is a pain to do, I'd rather avoid having to append config for each user created. 2) ProFTP doesn't seem to support name-based virtual hosts. Alternatively, I could make use of the UserOwner and GroupOwner directives, and create a new `<Directory>` block for each customer in the config. I imagine something like this might work:               <Directory /home/customer-a/>         UserOwner customer-a         UserGroup customer-a     </Directory>      But it would be nice to be able to do this in a more general fashion, similar to the `%u` variable, documented here. But I don't think that will work with UserOwner. ## Some details   * Using Ubuntu   * ProFTP 1.3.4a   * Apache 2.2   * Using SuPHP with PHP-CGI.


Software (SciTe) runs differently when opened from Terminal Vs GUI

When I open SciTe from the terminal everything works fine. When I open it via Ubuntu 10.04 GUI drop down boxes I get this error every time I try to run a ruby program: `sh: ruby: not found` At this point I'm satisfied with knowing I can just open it from the terminal, but I'm curious why this difference might be occurring.


which and find not working to locate ruby.exe path

From the home directory   `which ruby.exe` & `find ruby.exe` return "no such file or directory" However, I'm able to execute .rb programs in rubymine.


What signal does X send to its clients when it receives SIGINT?

If I terminate the Xorg server with a SIGINT signal (eg. when I press `Ctrl`+`C`), what signal does it send to its clients?


bash if statement behaviour question

I wrote this following piece of bash script.               if [ $(tmux has -t junk) ]     then     echo zero     else     echo one     fi      It always returns one, no matter if the session exists or not. I checked in the command line by executing the tmux statement and then running $? . It behaves as expected, zero if session exists and one if session does not exists Why isn't if statement is not behaving the same way. I tried changing the if statement like below               tmux has -t junk     if [ $? -eq 0 ]     then     echo zero     else     echo one     fi      The above thing works. So whats wrong with the first statement block ?


how to skip install libphp5.so when buidling php?

I'm trying configure and install older php 5.3 version on my archlinux, and I don't want it to copy `libphp5.so` to `/usr/lib/httpd/modules/` because there's an existing version (newer) there.               /usr/share/apr-1/build/libtool --mode=install install libphp5.la /usr/lib/httpd/modules/     libtool: install: install .libs/libphp5.so /usr/lib/httpd/modules/libphp5.so     install: cannot remove '/usr/lib/httpd/modules/libphp5.so': Permission denied      I think there should be a configure flag to control that, can anyone help me?


Allow su without password for users in a particular Active Directory group when using pam_winbind

I know on my Gentoo system, the /etc/pam.d/su file comes with the following commented out:               auth       sufficient   pam_wheel.so use_uid trust      Which allows a user to su to root without a password as long as he or she is in the wheel group. It also has an example using a list:               auth       sufficient   pam_listfile.so item=ruser sense=allow onerr=fail file=/etc/security/suauth.nopass      I'm currently working with openSuse 11.4 and I successfully joined it to a domain using Yast (which automatically does all the winbind/kerberos/ad stuff) and was wondering if there was a way to modify the /etc/pam.d/su in openSuse to do the same thing if a user is in a specific AD group. I tried the following for my /etc/pam.d/su config:               #%PAM-1.0     auth     sufficient     pam_rootok.so     auth     include        common-auth     auth     sufficient     pam_winbind.so require_membership_of=MYDOMAIN\\LinuxAdmins     account  sufficient     pam_rootok.so     account  include        common-account     password include        common-password     session  include        common-session     session  optional       pam_xauth.so      But obviously that doesn't work. Is this possible using the pam_winbind.so module and if so, how?


Don't lose the current command when up is pressed in a terminal

How can I configure my Linux terminal so that the current command isn't lost when I press the up arrow key?


Concatenating thousands of files: > vs >>

I found two seemingly contradictory answers on StackOverflow to the following questions:   * Concatenating Thousands of Text Files Across Hundreds of Directories (while keeping some structure)   * How do I concatenate files in a subdirectory with Unix find execute and cat into a single file? The top answer to the first question suggests: `find . -name *.txt -print0 | xargs -0 cat >> out.txt` while the top answer to the second question suggests: `find . -name *.txt -print0 | xargs -0 cat > out.txt` As far as I know, the first one is correct since it uses the `>>` (append) operator, but not the second one since it uses the `>` operator which I thought simply redirects output to a file. However, the second answer has more votes (10) and was also accepted with no comments. Are both answers correct? Why? What is the purpose of having these two operators then?


Why does iptables still block my samba?

I'm currently fighting with iptables and samba. I read that samba needs ports 137-139 and 445 open on both tcp and udp. Here is the relevant part of my iptables config               ...     # forward valid incoming connections from lan to lan-services chain     -A INPUT -i eth1 -s 192.168.17.0/24 -p udp -m conntrack --ctstate NEW -j LANSERV     -A INPUT -i eth1 -s 192.168.17.0/24 -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -m conntrack --ctstate NEW -j LANSERV     ...     # samba     -A LANSERV -p tcp -m tcp --sport 137:139 --dport 137:139 -j ACCEPT     -A LANSERV -p udp -m udp --sport 137:139 --dport 137:139 -j ACCEPT     -A LANSERV -p tcp -m tcp --sport 445 --dport 445 -j ACCEPT     -A LANSERV -p udp -m udp --sport 445 --dport 445 -j ACCEPT      okay, 192.168.17.* is my local subnet which is connected to eth1. What is wrong with these rules? Does samba need even more ports? It is definetly the firewall since adding `-A INPUT -i eth1 -s 192.168.17.0/24 -j ACCEPT` on top makes samba work. edit: I'm trying to connect from a Windows 7 machine.


Select/extract columns based on the values on a certain row

Here is an example text file:               A B C D E F G     1 2 3 4 5 6 7     2 3 4 5 6 7 8     3 4 5 6 7 8 9      I would like to extract specific columns based on the values on the 3rd row, that is, 2 3 4 5 6 7 8. Let's say, I would like to extract all the columns with a value on the 3rd row larger than 5. That will be the final 3 columns. Hence, my goal is to select and generate the following:               E F G     5 6 7     6 7 8     7 8 9      Here is my code:               NR==3 {         for (i=1; i<=NF; i++) {             if ($i > 5)   x[j++] = i         }     }     NR>= 1 {       for (i=0 ;  i < j-1; i++ )          printf("%s ",$x[i])       printf("%s\n",$x[j-1])     }      However, this generates the following:               A B C D E F G     1 2 3 4 5 6 7     6 7 8     7 8 9      What did I miss?


Grant ssh access for single session

I wonder if there is a tool/modified ssh-server/ssh option which enables me to grant ssh access for a single session to a given user. What I want to avoid is creating a user account and password for the specific guest. It could instead use an existing user account with certain access rights to be set once. I do not want to share the same account information with everybody I grant access to. The access permission should either work only once/time out after a given interval or the tool should ask me if it detects an access whether I want to grant it. The idea is to share a line like               ssh tempuser001@host      where `tempuser001` is tells the server who tries to access but does not correspond to a real user. The user could use his temporary privileges to do all the fancy things you can with ssh connections, like `scp`, `rsync`, and whatever works through tunnels like`vnc`, ... The inspiration for this comes from teamviewer, a kind of vnc which permits a remote user to access my desktop once I shared an id with him.


Multimedia keys (Fn+[F1..F12]) don't work anymore after upgrade

I'm experiencing a strange issue with the multimedia keys on Archlinux with XFCE 4. I used to change the sound level with `Fn``F11`/`F12` keys but after a reboot, I'm not able to use it anymore. Moreover, I can't set new keyboard shortcut (in XFCE keyboard configuration utility) using a `Fn` key combination (where 3 days ago I've successfully set the `Fn``Space` shortcut (alias `XF86Launch6`). However, it seems that the `Fn``F2` shortcut works and properly disable/enable Wifi network AND everything works on Gnome (volume, keybinding)...


md5 String and File different

Why do I become a different hash when I try:   `md5 <<< "Hello"`   `md5 -s "Hello"`   Is it because of a possible line break in the first example?


Split parent pane instead of the active one

Let's say I've obtained this configuration by using `splitw -h` once, with `A` currently active:               +---+---+     | A | B |     |   |   |     |   |   |     +---+---+      How can I add a new split _below_ those 2 splits?               +---+---+     | A | B |     +---+---+     |   C   |     +---+---+      I'm not sure how to search for this... Everything I've found is about splitting _inside_ a pane with `splitw`, which is not what I want:               +---+---+     | A | B |     +---+   |     | C |   |     +---+---+      _For those familiar withi3, this would be the equivalent of sending `focus parent; split v` before opening the new window._ Is `tmux` able to do this? I'd rather stop searching now if that's not the case :)


Possibile sources of 5us-20us latency gap when sending long block of of serial data to tty device?

I have a trivial C program that just sends a large block of data out the serial port at a fast baud rate. When looking at the bits actually coming out of the port, I see that there is a almost always a gap in the serial bytes that comes near the beginning of the block (between 6ms and 20ms in) and lasts about the width of a couple of bytes (5us - 20us). Here is a picture... ![Scope view of data gap](http://i.stack.imgur.com/ZCQdg.png) The gap only comes at most 1 time per transmission, and once it happens the rest of the 100ms long transmission goes uninterrupted. The gaps happen about 9 out of 10 times I send a block. The gap always occurs between bytes, so would not show up on a receiving computer as corrupted bytes and would not be a problem for normal serial communication (except that you are loosing a tiny amount of throughput), but it is important in my application because I want to use the serial port in a non-conventional application where the signal needs to be continuous. At first I though it might be a scheduling issue, but nice-ing the process does not seem to have any effect on the gap. There are no other ready processes running on the machine.               pi@raspberrypi ~ $ ps all     F   UID   PID  PPID PRI  NI    VSZ   RSS WCHAN  STAT TTY        TIME COMMAND     4     0  2101     1  20   0   3744   804 n_tty_ Ss+  tty1       0:00 /sbin/getty     4     0  2102     1  20   0   3744   804 n_tty_ Ss+  tty2       0:00 /sbin/getty     4     0  2103     1  20   0   3744   804 n_tty_ Ss+  tty3       0:00 /sbin/getty     4     0  2104     1  20   0   3744   804 n_tty_ Ss+  tty4       0:00 /sbin/getty     4     0  2105     1  20   0   3744   804 n_tty_ Ss+  tty5       0:00 /sbin/getty     4     0  2106     1  20   0   3744   804 n_tty_ Ss+  tty6       0:00 /sbin/getty     0  1000 16370 27290  20   0   4136   956 -      R+   pts/1      0:00 ps all     0  1000 27290 27289  20   0   8252  5508 wait   Ss   pts/1      1:04 -bash     pi@raspberrypi ~ $ ./sendzeros /dev/ttyAMA0     Please start with ./sendzeros /dev/ttyS1 (for example)      I am trying to track down where this gap comes from in the hopes of eliminating it. Any ideas as to what might be the cause? Next step will be to write an interrupt triggered device driver that directly keeps the UART's buffers full, but I'd prefer to stay in userland if that is at all possible. I'd also just like to know at this point even just so I can better understand where sources of latency like this can come from in the kernel. The machine is a Raspberry Pi running Raspbian (wheezy). Here is the code in case it might be relevant...               #include <string.h>     #include <stdlib.h>     #include <stdio.h>     #include <unistd.h>     #include <fcntl.h>     #include <termios.h>               #define COUNT 24000             // Number of bytes to send...          int main(int argc,char** argv)     {             struct termios tio;             int tty_fd;                  printf("Please start with %s /dev/ttyS1 (for example)\n",argv[0]);                  tty_fd=open(argv[1], O_WRONLY );                  tcgetattr(tty_fd,&tio);                  tio.c_iflag=0;             tio.c_oflag=0;             tio.c_cflag=CS8|CREAD|CLOCAL;           // 8n1, see termios.h for more $             tio.c_lflag=0;                  cfmakeraw( &tio );                  int ssr = cfsetospeed(&tio,  B2500000 );                  tcsetattr(tty_fd,TCSANOW,&tio);                  // This bit pattern makes it possible to see disruptions on an attached$                  char buffer[ COUNT ];                  memset( buffer , 0 , sizeof(buffer ) );                  write(tty_fd,&buffer,sizeof(buffer));                     // if new dat$                  close(tty_fd);                  return EXIT_SUCCESS;     }


eCryptfs key in kernel image or initramfs

I have an embedded Linux system with unencrypted kernel image and initramfs in NAND flash. My RootFS is in SD card. I want to encrypted some files on SD Card as my SD card is easily accessible physically. For this I am planing to use eCryptfs. But I want to keep the keys inside NAND flash in kernel image or initramfs. What are my options, what is best way to secure some files on my SD card.


How can I get 1080p to work on my TV with HDMI using xrandr?

I'm using Arch Linux on a small HTPC called an Xtreamer, which has an Nvidia GT218/ION graphics card and HDMI out. My television is an Orion DL40-71BK (manual, note everything's in Japanese). HDMI video output works fine on some settings, for example 1440x900 and 1280x720, and xrandr shows many modes without any X11 configuration, including 1920x1080@60Hz (which it lists as the preferred mode). Full xrandr output follows:               Screen 0: minimum 8 x 8, current 1440 x 900, maximum 8192 x 8192                          DVI-I-0 disconnected primary (normal left inverted right x axis y axis)                   DVI-I-1 disconnected (normal left inverted right x axis y axis)                           HDMI-0 connected 1440x900+0+0 (normal left inverted right x axis y axis) 160mm x 90mm        1920x1080     60.05 +  60.00    59.94    60.00                                            1440x900      59.89*                                                                      1360x768      60.02                                                                       1280x1024     60.02                                                                       1280x768      59.87                                                                       1280x720      60.00    59.94                                                              1024x768      60.00                                                                       800x600       60.32                                                                       720x480       59.94    60.05                                                              640x480       59.94    59.93                                                            One thing I do not understand here: What are the columns to the right of 60.00 in the 1920x1080 line? Anyway, the problem is if I use xrandr to switch to the 1920x1080 mode (or let X11 do so by default on startup) my television shows a black screen and an error (非対応の入力信号, "unsupported input signal"). This also happens if I use the `nvidia-settings` tool to set the resolution (it also lists 1920x1080 as supported, but has the same error). I can find this error a few places online, but nothing to with Linux, just people having problems with game consoles and older versions of the TV. I know the TV works with 1920x1080; the manufacturer lists it and my PS3 uses 1080p just fine. **What can I do to use 1920x1080 on my TV?** Is there some configuration I've overlooked?


LVM: is this mirrored? is copy this slow?

Background: My Windows Home Server bit the dust - some kind of OS Hang. The drives and hardware were still good; after making sure I had all my data backed up, I decided to investigate Ubuntu and LVM, (along with btsync and samba, but that's another story) I had the following drives available to me: 1TB, 1.5TB, and 2TB. I was trying to figure out how to partition them and raid them together. I ran around in several circles. What I ended up doing was:   * 1 partition on each disk for the whole disk   * pvcreate /dev/sd[b,c,d]   * vgcreate all of the above together into a single vg "vg1"    * lvcreate -m1 on that vg1.  I played with the sizes. Sure enough it would let me lvcreate and extend up to 1.8tb, but not more. Question #1: Is it really mirrored? I think it is; however, I didn't follow any guidelines of "pair this drive with that drive because they are the same size" (which is pretty much every example I've found on LVM). Output of lsblk, excluding the O/S drive:               sdb                            8:16   0   1.4T  0 disk     └─sdb1                         8:17   0   1.4T  0 part       └─vg1-lv1_mimage_0 (dm-1)  252:1    0   1.8T  0 lvm         └─vg1-lv1 (dm-3)         252:3    0   1.8T  0 lvm  /srv/samba/share     sdc                            8:32   0   1.8T  0 disk     └─sdc1                         8:33   0   1.8T  0 part       └─vg1-lv1_mimage_1 (dm-2)  252:2    0   1.8T  0 lvm         └─vg1-lv1 (dm-3)         252:3    0   1.8T  0 lvm  /srv/samba/share     sdd                            8:48   0 931.5G  0 disk     └─sdd1                         8:49   0 931.5G  0 part       ├─vg1-lv1_mlog (dm-0)      252:0    0     4M  0 lvm       │ └─vg1-lv1 (dm-3)         252:3    0   1.8T  0 lvm  /srv/samba/share       └─vg1-lv1_mimage_0 (dm-1)  252:1    0   1.8T  0 lvm         └─vg1-lv1 (dm-3)         252:3    0   1.8T  0 lvm  /srv/samba/share      Question #2: When is the !#$!$% copy going to be done? Its been running for about 24 hours so far. Is it really this slow? Or is it falling behind because I'm also currently btsync'ing my data back to the array? Or is there something wrong that I can go tweak and fix? Output of lvs -a:                 LV             VG        Attr      LSize   Pool Origin Data%  Move Log      Copy%         root           ubuntu-vg -wi-ao--- 697.39g       swap_1         ubuntu-vg -wi-ao---   1.00g       lv1            vg1       mwi-aom--   1.80t                         lv1_mlog  43.83       [lv1_mimage_0] vg1       Iwi-aom--   1.80t       [lv1_mimage_1] vg1       Iwi-aom--   1.80t       [lv1_mlog]     vg1       lwi-aom--   4.00m      Thanks for any feedback and direction in advance. Other details if its at all relevant:   * EX485 former HP Media server   * Ubuntu Desktop 32bit 14.something as of 3 days ago (<2G of ram)    * Installed by mounting boot drive elsewhere, installing, adding sshd, and then moving it over, so maybe its a low level disk driver problem _update #1_ I caught some of the fine print here (my bold added): > When a mirror is created, the mirror regions are synchronized. For large > mirror components, the sync process **_may take a long time_**. When you are > creating a new mirror that does not need to be revived, you can specify the > nosync argument to indicate that an initial synchronization from the first > device is not required. This might indicate that the "long copy time" is correct.


How to get banshee music name through dbus?

qdbus org.bansheeproject.Banshee /org/bansheeproject/Banshee/PlayerEngine      how to get the value of this property?               property read QVariantMap org.bansheeproject.Banshee.PlayerEngine.CurrentTrack


Command in variable one are affecting output of other variable when displayed together in UNIX

I am having two file naming Extra_info and Class_info Class_info contains data :               stuId stuName stuClass      S01    jagdeep  First     S02    harsh    First     S03    Roop     Second     S04    Kali     Third      Extra_info contains extra information about student like               stuId stuCity stuEmail         stuPhone     S01    Sirsa  faltu@gmail.com  1234567890      I am getting result from both files using grep for stuId and displaying the result as:               res1=`grep $stuId $locDir/Class_info`     res2=`grep $stuId $locDir/Extra_info|cut -d" " -f2-`      ## also I tried res2=`grep $stuId $locDir/Extra_info|awk '{$1="" ; print $0}'`     echo $res1 $res2      Instead of displaying:                    S01 jagdeep First Sirsa  faltu@gmail.com  1234567890      It is displaying:                    Sirsa  faltu@gmail.com  1234567890      As I could think at the time of echo the variable res2 is nullifying result from res1. Please, suggest the possible reason for this and please provide solution for the same.


Unable to see eth0 after ifconfig

Yesterday, I have done some changes in `/etc/sysconfig/network-scripts/ifcfg- eht0` in centos 6. I have edited the value of `nm_controlled= "no"` after `"Yes"`.   Now, I am unable to see the "eth0" after doing `ifconfig` and lost internet and no ping .


How do I search for files from the gnome GUI in debian?

I sometimes spend time in the standard classic gnome GUI in `debian wheezy`, and today I wanted to search for files containing some text in a certain folder. I tried to do it the windows way by going to the folder I wanted to search in, clicking on "Search" and typing in the text. But when I press "Enter" all I see is a bar saying "Search Results", with the location I'm searching in and a little `+` icon to add criteria to my search. There's no results... To confirm it's not finding anything I created a folder called `abc` on the desktop and placed a file called `text` into it. I then double-clicked the folder, clicked on `search`, typed "text" and got a blank results page (with only the aforementioned "Search Results" bar and an option to add other criteria). Is this a bug, permission issue or a bad feature? And what's the workaround?


Configure Emacs to use Chrome as the web browser of choice?

Using Emacs on a Linux system I click:               Scala>Browser Scala API      which produces a terminal window with this message:               /usr/bin/xterm: Can't execvp lynx: No such file or directory      How do I inform Emacs that the correct web browser to use is Chrome?


getting a gui program to start on boot

I have a C program I wrote for debian on the raspberry pi that asks the user to enter a number, 1-4 which it then stores in a configuration file. This only happens if the configuration file is missing. I'd like to run this program on boot. Problem is, I can get it to run on boot, but haven't had any luck getting the terminal window to show up so I can see it. I've tried editing /etc/rc.local and adding commands there. I've tried editing crontab. I've tried all the tricks with "export display=:0 && command". Any suggestions? ### Edit: Here is the command I am actually running in /etc/rc.local:               x-terminal-emulator --command=/opt/vc/src/hello_pi/initialConfig/./initialConfig.bin --display=:0      The program uses scanf() to capture keyboard input and display feedback.


Redirecting all IP over USB traffic to a fixed address

I'ma bit of a network newbie, so apologies for the inaccurate vocabulary. Say I have a device connected by IP over USB to my computer (running Ubuntu), that connects to 10.0.0.1. I configured my Ubuntu's Wifi over USB so that my computer's IP on that connection is 10.0.0.1, but I would actually like to redirect all traffic (on all ports) to another server, and just use my computer as a proxy. I played around with some solutions, but my lack of familiarity with network concepts is slowing me down (I spend too much time looking stuff up, and the documentation is often a bit lacking). I'm not even sure if I want to set up a proxy, a firewall (I don't think so), or use the routing tables. What I want to do sounds pretty simple ("redirect anything coming from IP over USB to that server over there"). So is there a standard way of doing that? iptables? squid? ufw?


Auto login problems with slim

I have installed Arch and am having problems with the auto login options within `slim.conf`. I have installed the following X packages:               xorg-server     xorg-xinit     xorg-twm, xterm     and for the graphics: xf86-video-fbdev I have also added a user and password, and altered the `sudoers` file to suit. I have changed the following lines:               # default_user simone     # auto_login no to:               default_user jon     auto_login yes I have managed to get the slim login prompt to appear on boot by editing `/etc/inittab`, but the changes made for bypassing this have not been as successful. Anybody know what I have missed? Maybe something to do with adding a user to some group?


Vim gg=G (reindent whole file) without losing current position

Recently my main work was editing .xml files. Google told me that for re- indenting a file I need to press `gg=G` in normal. But moving to `gg` is something that I don't want. Is there any way to do the same without losing the current position?


openBSD static ip can't connect

I have set /etc/hostname.msk0 to               inet 192.168.1.102 255.255.255.0 NONE      and /etc/mygate to               192.168.1.1       but still can't ping the router (192.168.1.1) do I need to configure dns to ping ?               ifconfig msk0     msk0: flags=8843<UP, BROADCAST, RUNNING, SIMPLEX MULTICAST> mtu 1500     groups:egress     media: Ethernet autoselect     status active     inet6 xxxxxxxxxxxxx...........     inet 192.168.1.102 netmask 0xffffff00 broadcast 192.168.1.255          route -n show     destination    gateway     flags  mtu Iface      default        192.168.1.1 UGS    _   msk0


Split screen just like Windows or Unity do

I'm looking in Debian wheezy for a way to split screen in two windows just like you can do in Ubuntu or Windows7/8. I mean I'm used to select a window and push windowskey+left and select another one and windowskey+right, so I can take advantage of the 16:9 screen. Is there any package or external app to do this in Debian wheezy with GNOME 3.4?


Aliases for 'sudo /etc/init.d/'

Are there any standards for aliasing `sudo /etc/init.d/`? I'm sure many people have considered cutting down these 17 characters to just 2 or so.


install 2.6.32.59 on squeeze

I'm suffering from a kernel bug in a production environment. The problem isn't causing a complete outage, but it's degrading service. These are soft lockups. I'd like to try a newer kernel, however Squeeze only has 2.6.32.5, but kernel.org has 2.6.32.59. I've compiled from source in the past, but should this really be necessary? I'd really rather not put other admins through manual tracking of security bugs. Backports seems to no longer have 2.6 kernels, they're all 3.2. 3.2 is a PITA to install because it pulls in a mountain of dependencies. E.g., linux-base > 3 http://packages.debian.org/squeeze-backports/linux-image-3.2.0-0.bpo.2-686-pae Those dependencies could break my abilty to boot back in 2.6, cutting out my backout plan and potentially leading to a very long production outage. There are references online of backports having a newer 2.6.32 kernel. Where did they go? Thanks,


Remove specific file from directory if it's the only one

I have a lot of directories and sub-directories. I want to recursively remove one specific file from a directory if it's the only one there. Also assume that there are no sub-directories in that directory. So, to summarize, the assumptions are:   * The file name is README.TXT (case insensitive)   * There are no other files or directories in the directory where that file is found Structure:                mkdir usecase      cd usecase      mkdir destroy_this      touch destroy_this/readme.txt      mkdir do_not_destroy_this      touch do_not_destroy_this/readme.txt      touch do_not_destroy_this/something-else.txt      mkdir do_nothing      cd do_nothing      mkdir rm_this      touch rm_this/README.TXT      cd ..      mkdir do_nothing_here      cd do_nothing_here      mkdir has_sub_dir      touch README.TXT      cd ..      Running the above would results in this tree structure:               $ tree .     .     `-- usecase         |-- destroy_this         |   `-- readme.txt         |-- do_not_destroy_this         |   |-- readme.txt         |   `-- something-else.txt         |-- do_nothing         |   `-- rm_this         |       `-- README.TXT         `-- do_nothing_here             |-- has_sub_dir             `-- README.TXT      This is what I've got so far:               find . -type f -iname "readme.txt" -exec sh -c 'ls $(dirname "{}") | wc -l' \;      The idea is that I count the number of files and directories and if it's one then remove the file.


Shell script and crontab to capture file size, name and date in a CSV file and then send via email?

I have a number of zip files in a certain folder. I want to capture file name and the size of the files in a CSV format in day wise and put it in crontab so I can report on a daily basis, and then mail it in each report. Files are in `/somedirectory/archive/test`:               -rw-rw-r--+ 1 AAAA AAAA 9.3M May  30 17:09 XXXXX_20140530_0401_28.txt.gz     -rw-rw-r--+ 1 AAAA AAAA 9.3M May  30 17:09 XXXXX_20140530_0401_29.txt.gz     -rw-rw-r--+ 1 AAAA AAAA 9.3M May  31 17:09 XXXXX_20140531_0401_01.txt.gz      Now I want to crate a cronjob to run everyday and capture the same CSV which we prepared in day wise. ### example _test30052014.csv_ :               "XXXXX_20140530_0401_28.txt.gz", "9.3","May 30"     "XXXXX_20140530_0401_29.txt.gz", "9.3","May 30"      _test31052014.csv_ :               "XXXXX_20140531_0401_01.txt.gz", "9.3","May 31"      And after generated the CSV file I should be able to send mail as well via crontab.


How ignore PATH with `source` completion

I can't find any 'detailed enough' documentation about `zstyle`, and I'm surprised that no one faced this problem before: here is what I get with tab completion:               source l<TAB>     l2ping*                  lefty*                   libwmf-fontmap*          locate*                  lpq.cups      this is certainly/obviously the executable files of my `$PATH`. However, I would like to use `source` with a **local** file, but I can't understand how to change it. Basically, the command `file` is completed as I expect, so I'd like to tell `zstyle` to use the same rules. I _guess_ that I could adapt `:completion:*:killall:* 'ps -u $USER -o cmd h'`, to do the job, but this would be quite ugly and I'm looking for a zstyle- builtin option. I _thought_ that I could adapt something like `':completion:*:cd:*' ignore- parents parent pwd` to `source`, but the completion result never changes ... * * * for information:               $ zsh --version     zsh 4.3.17 (x86_64-redhat-linux-gnu)     $ zstyle     cache-path             :completion::complete:* /home/kevin/.oh-my-zsh/cache/     command             :completion:*:*:*:*:processes 'ps -u kevin -o pid,user,comm -w -w'             :completion:*:killall:* 'ps -u $USER -o cmd h'     hosts             :completion:*:hosts 192.168.0.101 git.bri.st.com crx672 bastion.inrialpes.fr 192.168.0.5 idrouille 129.88.69.73 idrouille.imag.fr koguis 192.168.1.4 127.0.0.1 koguis.imag.fr localhost crx672.cro.st.com 192.168.1.100 github.com 192.168.1.101 sourceware.org gnx2034.gnb.st.com gnx2528.gnb.st.com ctf.stri.pe 10.0.0.2 127.0.0.1 kevin localhost.localdomain localhost ::1 kevin localhost6.localdomain6 localhost6 kevin localhost     ignored-patterns             :completion:*:*:*:users adm amanda apache avahi beaglidx bin cacti canna clamav daemon dbus distcache dovecot fax ftp games gdm gkrellmd gopher hacluster haldaemon halt hsqldb ident junkbust ldap lp mail mailman mailnull mldonkey mysql nagios named netdump news nfsnobody nobody nscd ntp nut nx openvpn operator pcap postfix postgres privoxy pulse pvm quagga radvd rpc rpcuser rpm shutdown squid sshd sync uucp vcsa xfs             :completion:*:functions '_*'     list-colors             :completion:*:*:kill:*:processes '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'             :completion:* ''     menu             :completion:*:*:*:*:* select     single-ignored             * show     tag-order             :completion:*:cd:* local-directories directory-stack path-directories     url-globbers     (eval)  :url-quote-magic 'zmodload -i zsh/parameter;          reply=( noglob              ${(k)galiases[(R)(* |)(noglob|urlglobber|globurl) *]:-}              ${(k)aliases[(R)(* |)(noglob|urlglobber|globurl) *]:-} )'     url-local-schema             :urlglobber ftp file     url-metas             :url-quote-magic:* '*?[]^(|)~#{}='     url-other-schema             :urlglobber http https ftp     url-seps     (eval)  :url-quote-magic:* 'reply=(";&<>${histchars[1]}")'     use-cache             :completion::complete:* 1     user-commands             :completion:*:*:git:* 'flow:description for foo'


Why is the default umask value for useradd in openSuSE set to 022?

I recently built a very simple test environment with oepnSuSE. As I tried to configure a shared directory, **wihtout** using ACLs, but with SetGID on that directory instead for some reason, I noticed that the default umask for every user is set to 022 (i.e. 755 on directories & 644 on files). This is done in `/etc/login.defs`. I am used to a umask 002 (i.e. 775 directories / 664 files) for normal users and 022 for the root-user instead. Shall I change the umask value for useradd in the above mentioned file, if I want to set it as default for all future useradds and how can I change the umask for all existing users on my system (except the root account, of course)?


how to run shell on a remote server with root priviledge

I want to execute a shell script on a remote server, and the script should be run by root with no password required (or use `sudo` in the script). Can anyone give me some suggestions?


Using perl to modify a LaTeX document

I am trying to use `perl` in order to modify a `LaTeX` document. In fact, I am trying to change the citation format from for example:               . \cite{poelma20113d}      to               \cite{poelma20113d}.      In other words, I want to find those citations which are preceded by a period and a space and replace them with blank then put the citation and then place a period after it. Could someone help me how I can do that via `perl` one liner? The reason I want to do this is that I want to change the format of my manuscript that was prepared for the Journal of Physics of Fluids to the Journal of Physical Review E.


uXlib.h Which package have this lib file?

I am getting an error uXlib.h not found while compiling a program, written in c++ I think the lib file is related UIM/X from the following link motif.ics.com/sites/default/files/ReferenceManual.pdf


rename multiple files recursively and remove multiple characters such as ? : or newline from names

I have seen a few similar questions, but nothing that shows how to remove any of a set of special characters from all file names recursively. I want to keep uppercase and lowercase letters, numbers and underscores and get rid of all special characters in the filenames. I have seen colons and question mark chars and a couple file names with newlines.


reverse extending the LVM group volume

I accidentally extended the volume to utilized 100% free disk space on LVM group volume. I need it to utilized only `/dev/sdb` disk but it took free space from both disk, since they were on the same group. Is there a way to reverse this.               [root@server]# pvscan       PV /dev/sda3   VG myvg   lvm2 [13.84 GB / 13.84 GB free]       PV /dev/sdb3   VG myvg   lvm2 [22.06 GB / 8.22 GB free]       Total: 2 [35.91 GB] / in use: 2 [35.91 GB] / in no VG: 0 [0   ]          [root@server]# lvextend -l +100%FREE /dev/myvg/rootvol       Extending logical volume rootvol to 35.91 GB       Logical volume rootvol successfully resized          [root@server]# pvscan       PV /dev/sda3   VG myvg   lvm2 [13.84 GB / 0    free]       PV /dev/sdb3   VG myvg   lvm2 [22.06 GB / 0    free]       Total: 2 [35.91 GB] / in use: 2 [35.91 GB] / in no VG: 0 [0   ]      I actually need to remove `/dev/sda3`. This is on RHEL 5.9 system. Please note that I do not want to loss the data Updated: If I use temporary disk then I will need about the same size of the disk, if I pvmove only one volume then how can I make sure there there is nothing in other disk and the data will not get corrupted. Updated: I added a new larger disk and `pvmove` `/dev/sda3` and `/dev/sdb3` to `/dev/sdc3` (new disk). I am not sure why df still showing newly added free space on root volume.                [root@server]# pvscan        PV /dev/sdc3   VG myvg            lvm2 [47.06 GB / 11.16 GB free]        PV /dev/sda3                      lvm2 [13.85 GB]        PV /dev/sdb3                      lvm2 [22.07 GB]        Total: 3 [82.98 GB] / in use: 1 [47.06 GB] / in no VG: 2 [35.92 GB]           [root@server]# lvscan        ACTIVE            '/dev/myvg/rootvol' [35.91 GB] inherit           [root@server]# df -kh .      Filesystem            Size  Used Avail Use% Mounted on      /dev/mapper/myvg-rootvol                             14G   12G  1.3G  91% /


Protected environment variables?

Are there names of environment variables that cannot be overwritten by the user/a call to `setenv`? As I understand from POSIX1.2008, any process may edit the environment block, but must avoid overwriting such vars as LANG etc.


Public Key Auth + Kerberos

I've setup public key authentication for ssh'ing into my university machine. However, it only logs me in on the local machine and doesn't give me Kerberos credentials which I need for accessing my network folder. This causes problems with tools like git. Is there a way for me to automatically get Kerberos credentials when ssh'ing without having to enter my Kerberos password? My client machine is OSX 10.6 and my university machine is Ubuntu 12.04


Where to securely place files needed by PHP in Linux filesystem (according to FHS)

I have a PHP script running on my LAMP server that requires certain files in order to produce HTML content. The script is publicly accessible (i.e. `http://example.com/script.php`) but the files required by the script must secured. I could probably place the files in any directory other than `/var/www` and they would be relatively safe, but I'm trying to learn the Linux filesystem and I'd like to use the most _appropriate_ place (according to FHS). Any help would be great.


daemon function in /init.d does not run the program in the background in fedora13

I use Fedora 13 and am trying to create a service for `darkice`. I put the script in the `/etc/init.d` directory and if I use the command `service darkice start`, the `darkice` is running in the foreground and the command prompt is not returned. How do I make `darkice` run in the background? The following is the excerpt from the `darkice` script.               PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin     DAEMON=/usr/local/bin/darkice     NAME=darkice     DESC="Darkice live audio streamer"          test -x $DAEMON || exit 0     CONFIGFILE="/etc/darkice.cfg"          # Source function library.     . /etc/rc.d/init.d/functions               # See how we were called.     case "$1" in       start)         # Start daemon.         echo -n $"Starting darkice streaming daemon: "         daemon "$DAEMON -c $CONFIGFILE > /dev/null"         RETVAL=$?         echo         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/darkice         ;;       stop)


port forwarding to internal lan server

I've ppp0 --> eth1 and eth0 (internal lan). I need forwarding externel 10022 port to port 8999 of the server 192.168.1.254               iptables -t nat -A PREROUTING -p tcp -i ppp0 --dport 10022 -j DNAT --to 192.168.1.254:8999     iptables -A FORWARD -p tcp -d 192.168.1.254 --dport 10022 -j ACCEPT      I also have:               cat /proc/sys/net/ipv4/conf/ppp0/forwarding           1      connection time-out... any idea? iptables -L -nv               Chain INPUT (policy DROP 14 packets, 1609 bytes)      pkts bytes target     prot opt in     out     source               destination                  0     0 ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0                    0     0 DROP       all  -f  *      *       0.0.0.0/0            0.0.0.0/0                    0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0           state INVALID       2037  136K ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED          0     0 ACCEPT     icmp --  ppp0   *       0.0.0.0/0            0.0.0.0/0                    0     0 ACCEPT     icmp --  eth0   *       0.0.0.0/0            0.0.0.0/0                    0     0 ACCEPT     icmp --  tap0   *       0.0.0.0/0            0.0.0.0/0                   14  1609 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0           LOG flags 0 level 4           Chain FORWARD (policy DROP 0 packets, 0 bytes)      pkts bytes target     prot opt in     out     source               destination                  0     0 TCPMSS     tcp  --  *      ppp2    0.0.0.0/0            0.0.0.0/0           tcp flags:0x06/0x02 tcpmss match 1400:1536 TCPMSS clamp to PMTU          0     0 TCPMSS     tcp  --  *      eth1    0.0.0.0/0            0.0.0.0/0           tcp flags:0x06/0x02 tcpmss match 1400:1536 TCPMSS clamp to PMTU          0     0 TCPMSS     tcp  --  *      eth0    0.0.0.0/0            0.0.0.0/0           tcp flags:0x06/0x02 tcpmss match 1400:1536 TCPMSS clamp to PMTU          0     0 TCPMSS     tcp  --  *      ppp0    0.0.0.0/0            0.0.0.0/0           tcp flags:0x06/0x02 tcpmss match 1400:1536 TCPMSS clamp to PMTU         16  2368 ACCEPT     all  --  *      *       0.0.0.0/0            192.168.1.0/24      state RELATED,ESTABLISHED          0     0 ACCEPT     all  --  *      *       192.168.1.0/24       0.0.0.0/0                    0     0 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0           LOG flags 0 level 4           Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)      pkts bytes target     prot opt in     out     source               destination                  0     0 ACCEPT     all  --  *      lo      0.0.0.0/0            0.0.0.0/0                    0     0 DROP       all  -f  *      *       0.0.0.0/0            0.0.0.0/0                    0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0           state INVALID       3097 4268K ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW,RELATED,ESTABLISHED


How to change the output color of ls comman in terminal in OS X and iTerm2?

I know that a similar question has been as in: > How to colorize output of ls ? Though, I didn't really understand the answer and couldn't really make it work. However, I have tried something different. I decided to read the manual page for ls and it mentions different environments variables that can be set when dealing with the ls command. If one goes to the -G option it says to look at the CLICOLOR environment variables. So I did and that one links you to documentation for the LSCOLORS environment variable. So I went to it and it mentions: > "The value of this variable describes what color to use for which attribute > when colors are enabled with CLICOLOR. This string is a concatenation of > pairs of the format fb, where f is the foreground color and b is the > background color. " It also mentions that the default value of LSCOLORS is "exfxcxdxbxegedabagacad" and that each part specifies the color of some specific thing in the ls comand. For examle, the first pair ex in example specifies the color of directories. the second fx the color of symbolic links etc... e means blue and x means default "foreground". 1) First what does "when colors are enabled with CLICOLOR"? 2) What does foreground mean? What do the environment variables need to be for the ls command to color the output however I desire? * * * I also tried:               ls --color      But it threw me the following error:               ls: illegal option -- - usage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file ...]      the same error happened when I did `ls --color=auto` alone also throws an error. No idea why, not sure if it was due to iTerm2 or OS X or why that happened. It seems it works on other systems...


Installing cppman

I've tried to install cppman in Fedora 19 or Linux mint 15 and it installs successfully. But when I try to use it I get the error:               Python IOError: [Errno 13] Permission denied      I've installed it in Ubuntu 12.04 and had no problem. Can you help me? Update: I fixed this problem, but I have a new problem. when for example I enter `cppman cout` the output shown is not in right format:               1mNAME0m            std::cout - Standard output stream          1mTYPE0m            object            <iostream>     1mSYNOPSIS0m            extern ostream cout;          1mDESCRIPTION0m            Object of class ostream that represents the standard output stream oriented to narrow characters (of type              char                      ). It corresponds to the C stream stdout.      It seems that I need to install or configure something. Can you help me?


The other users: avahi, root, syslog, messagebus,, nobody, ntp, rtkit and whoopsie

What are all these other users (found them with top) when running Ubuntu: avahi, root, syslog, messagebus, nobody, ntp, rtkit and whoopsie. I am aware that whoopsie, for example, is for reporting errors to Canonical. When I run 'who' I only see me (terminal and graphical display). Why don't they all run as root or as my user name? (I suppose that they run because I as a user needs them).


How do you set an environment variable?

Please explain how to set environment variables. I need to point an environment variable to a xml file.


Force X to use second video card so I can pass through first card to XEN VM?

So I am trying to get X to start on my second (PCI 02.00:00) video card and stop using the main card (PCI 1.00:00). I would like to do this because I want to pass through the PCI 1 card to a XEN HVM VM and use the second card as the main display for the dom0. I am led to believe that only the the first card on the PCI bus is compatible with XEM PCI VGA Pass thou. I'm using CentOS 6 with XEN 4.1; standard X with VESA drivers for now. Both cards are NVIDIA GeForce 8400 series. I have played around with custom `xorg.conf` by commenting out the references to the first device and screen, but that does not seem to work. I am also familiar with the PCIBACK module and can get the first video card to show up correctly in the `xm pci-list-assignable-devices` command.


What is the X desktop start up process / program hierarchy?

How do all the components that make up an "X desktop session" fit together? I've gone through http://en.wikipedia.org/wiki/X_Window_System , and I see that there are all sorts of components like X Servers, Login Managers, Session Managers, Window Managers, Desktop Environments, ... But, I'm not clear on how they all fit together. One reason I'm trying to figure this out so that I can insert my own logic into the boot process such that in certain cases, the system will directly boot to a particular user's desktop session, rather than a login greeter. But, I'm also just trying to understand the architectural design, so that I can extend this to Xvnc style setups as well. Thank you


Accidentally executed sudo rm /* on a remote server

I accidentally executed `rm /*` while logged in as root in a remote Ubuntu Server and deleted pretty much all binaries and currently I can neither log in via ssh or ftp to restore the files (and hope for the best). Is there a way to somehow fix this mess, or should I call the datacenter and ask for a format?


Efficiency of lots of inotify watches or stat calls

I am developing software that will utilize inotify to track changes on a large amount of files (tens to hundreds of thousands of files). I have come up with these ideas:   * one watch per file   * one watch per parent directory   * avoid inotify and periodically scan the fs for changes (not preferred) I will have a database of all of the files I am watching and some basic stat information (like mtime and size), however, I would have to stat each file in that directory until I found the one that changed. **Which would be faster, tons (100,000+) of inotify watches or tons of stat calls?** I'm thinking that reducing the number of stat calls would be better, but I don't know enough about inotify. Note: This will be running on a workstation, not a server. It's main purpose is to synchronize changes (potentially to an entire filesystem) between a client and a remote server.


Does LAMP Stack have a GUI?

I just bought a VPS server with LAMP. I have SSH access, however no clue how to use LAMP. I used to work with cPanel in the past. So far, when I type the server address I get the default "Apache 2 Test Page". I wonder if LAMP has some sort of GUI control panel? If so what would be the way to install and access it on CentOS 6?


understanding the output of "apt-cache policy"

I ran `apt-cache policy sudo` before and after installing `sudo`: _before install:_               # apt-cache policy sudo     sudo:       Installed: (none)       Candidate: 1.8.5p2-1+nmu1       Version table:          1.8.5p2-1+nmu1 0             500 http://ftp.se.debian.org/debian/ wheezy/main i386 Packages     #      _after install:_               # apt-cache policy sudo     sudo:       Installed: 1.8.5p2-1+nmu1       Candidate: 1.8.5p2-1+nmu1       Version table:      *** 1.8.5p2-1+nmu1 0             500 http://ftp.se.debian.org/debian/ wheezy/main i386 Packages             100 /var/lib/dpkg/status     #       How to understand numbers 500 and 100? Are those some sort of status codes? In addition, what is the meaning of _***_ in front of the package version once it is installed?


Bind conky to single worksapce

Is it possible to run different conky configuration on different workspaces? I've checked `man conky`, only to find the `desktop` directive, but that doesn't work. Conky still runs on all workspaces.


W2K3 DC:  Samba file sharing access permission problem

I want to access SAMBA shares from a Windows Server 2003 domain controller without a password. But, I am receiving a permission error each time. I'm using RedHat 5.5. `# ls -l`               total 96     -rw------- 1 root          root  1611 Mar 25 18:45 anaconda-ks.cfg     drwxr-xr-x 2 root          root  4096 Mar 25 16:57 Desktop     -rw-r--r-- 1 root          root 55367 Mar 25 18:45 install.log     -rw-r--r-- 1 root          root  4010 Mar 25 18:38 install.log.syslog     drwxrwxrwx 2 administrator root  4096 Jun  3 15:54 rpmler (shared folder)      `# vi /etc/samba/smb.conf // ***I edited as below*** [global] ve [share]`               [global]         workgroup = argela         // the name of DC         security = user               //           smb passwd file = /etc/samba/smbpasswd               load printers = no            //           [share]         comment = file server         path = /root/rpmler                   // those folders that is want to share         valid users = administrator        //          admin users = administrator            read only = no         public = yes         browseable = yes      `# rpm -qa | grep samba`                system-config-samba-1.2.41-5.el5      samba-common-3.0.33-3.28.el5      samba-client-3.0.33-3.28.el5      samba-3.0.33-3.28.el5


Fetching email automatically then reading it locally

My email is kept on a remote server and accessible from anywhere by IMAP. What I'd like is a mail client that will periodically sync that remote mail to my laptop in the backgroun, so that when I open my mail client, today's email is instantly there and does not need to be downloaded. The background sync process could be some separate daemon or a function of the mail client itself. What I have now is just Thunderbird accessing the remote mail server via IMAP. But it means that mail only syncs when I start Thunderbird, and it takes ages to do so before I can read it. It's a slow process. I have a feeling that fetchmail could form part of what I want, as it can download mail to a local maildir. But then what's the easiest way to access this mail locally? And would fetchmail be smart enough to handle two-way sync, so that when I delete, move or save a mail locally the change will make its way to my remote IMAP server? Or is there some other Thunderbird-like mail client that can sync in the background (I work in Gnome), solving my problem?


rxvt-unicode + mc - strange characters in root shell only

Using rxvt-unicode-9.11 and mc-4.7.5.2, and using zsh-4.3.11 as my login shell, I find that I get strange characters, eg â instead of lines being drawn. Interestingly however, launching urxvt from any root shell, and then running mc inside of that renders the lines correctly. In Xdefaults I am not setting a font. I thought that any child shells should inherit the same as the parent shell, but clearly here it is not. Exports in parent:               COLON_SEPARATED=MOZ_PLUGIN_PATH     COLORFGBG='7;default'     COLORTERM=rxvt     CONFIG_PROTECT_MASK='/lib64/udev/rules.d /etc/dconf/db /etc/ca-certificates.conf'     CVS_RSH=ssh     DESKTOP_STARTUP_ID=awesome/urxvtc/2194-57-alipc-desktop-ex_TIME28147172     DISPLAY=:0.0     GDK_USE_XFT=1     GPG_AGENT_INFO=/tmp/gpg-CeLaPY/S.gpg-agent:2191:1     HOME=/home/ali     INFOPATH=/usr/share/info     JAVAC=/usr/bin/javac     JAVACMD=/usr/bin/java     JAVA_HOME=/usr/lib64/jdk     LANG=en_GB.utf8     LDPATH=/usr/local/lib:/usr/lib64/nss:/usr/lib64/vdpau:/usr/lib64/qt4     LESS='-R -M --shift 5'     LOGNAME=ali     MAIL=/var/mail/ali     MANPATH=/usr/local/share/man:/usr/share/man     MOZ_PLUGIN_PATH=/usr/lib64/mozilla/plugins:/opt/netscape/plugins     PAGER=/usr/bin/less     PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/lib64/jdk/bin:/usr/lib64/jre/bin:/opt/bin:/usr/lib64/jdk/bin:/usr/lib64/jre/bin     PWD=/home/ali     SHELL=/bin/zsh     SHLVL=2     SSH_AGENT_PID=2193     SSH_AUTH_SOCK=/tmp/ssh-RhQcEipf2192/agent.2192     TERM=rxvt-256color     TERMINFO=/usr/share/terminfo     USER=ali     WINDOWID=20972128     XAUTHORITY=/home/ali/.Xauthority     _=export      Exports in child:               COLON_SEPARATED=MOZ_PLUGIN_PATH     COLORFGBG='7;default'     COLORTERM=rxvt     CONFIG_PROTECT_MASK='/lib64/udev/rules.d /etc/dconf/db /etc/ca-certificates.conf'     CVS_RSH=ssh     DESKTOP_STARTUP_ID=awesome/urxvtc/2194-57-alipc-desktop-ex_TIME28147172     DISPLAY=:0.0     GDK_USE_XFT=1     GPG_AGENT_INFO=/tmp/gpg-CeLaPY/S.gpg-agent:2191:1     HOME=/home/ali     INFOPATH=/usr/share/info     JAVAC=/usr/bin/javac     JAVACMD=/usr/bin/java     JAVA_HOME=/usr/lib64/jdk     LANG=en_GB.utf8     LDPATH=/usr/local/lib:/usr/lib64/nss:/usr/lib64/vdpau:/usr/lib64/qt4     LESS='-R -M --shift 5'     LOGNAME=ali     MAIL=/var/mail/ali     MANPATH=/usr/local/share/man:/usr/share/man     MOZ_PLUGIN_PATH=/usr/lib64/mozilla/plugins:/opt/netscape/plugins     OLDPWD=/home/ali     PAGER=/usr/bin/less     PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/lib64/jdk/bin:/usr/lib64/jre/bin:/opt/bin:/usr/lib64/jdk/bin:/usr/lib64/jre/bin     PWD=/home/ali     SHELL=/bin/zsh     SHLVL=4     SSH_AGENT_PID=2193     SSH_AUTH_SOCK=/tmp/ssh-RhQcEipf2192/agent.2192     STY=27048.pts-2.alipc-desktop-ex     TERM=rxvt-256color     TERMINFO=/usr/share/terminfo     USER=ali     WINDOW=0     WINDOWID=27262984     XAUTHORITY=/home/ali/.Xauthority     _=export      Thanks. Edit: more information + combinations: .zshrc:               # The following lines were added by compinstall          zstyle ':completion:*' completer _expand _complete _ignored     zstyle ':completion:*' group-name ''     zstyle ':completion:*' list-colors ''     zstyle ':completion:*' menu select=long     zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s     zstyle ':completion:*' use-compctl false     zstyle :compinstall filename '/home/ali/.zshrc'          autoload -U zutil     autoload -Uz compinit     autoload -U complist     compinit     autoload -U colors     colors     # End of lines added by compinstall     # Lines configured by zsh-newuser-install     HISTFILE=~/.histfile     HISTSIZE=1000     SAVEHIST=1000     setopt appendhistory autocd extendedglob notify     unsetopt beep     bindkey -v     # End of lines configured by zsh-newuser-install          #export PS1="%n#%d>"          PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%d %{$reset_color%}%#"     RPROMPT="[%{$fg[yellow]%}%T%{$reset_color%}]"      locale -a: C en_GB.utf8 en_US.utf8 POSIX exports from 'urxvt -e zsh -f': - A working set!               COLORFGBG='7;default'     COLORTERM=rxvt     DESKTOP_STARTUP_ID=awesome/urxvt/2199-28-alipc-desktop-ex_TIME11280170     DISPLAY=:0.0     GPG_AGENT_INFO=/tmp/gpg-d5ZFvz/S.gpg-agent:2196:1     HOME=/home/ali     LOGNAME=ali     MAIL=/var/mail/ali     PATH=/bin:/usr/bin:/usr/local/bin     PWD=/home/ali     SHELL=/bin/zsh     SHLVL=2     SSH_AGENT_PID=2198     SSH_AUTH_SOCK=/tmp/ssh-sPZhKOhV2197/agent.2197     TERM=rxvt-unicode-256color     TERMINFO=/usr/share/terminfo     USER=ali     WINDOWID=23068680     XAUTHORITY=/home/ali/.Xauthority     _=export      Note: I did try setting my TERM via .Xdefaults, to the one that worked in the 'clean' window:               urxvt*termName:  rxvt-unicode-256color      Though this had no effect, so it is not TERM that affects this.


Can't start mysqld

I've installed mysql through               $ sudo apt-get install mysql-server-core-5.1     $ sudo apt-get install mysql-client-core-5.1      This is my current conf file And the service won't start, at first the socket and var folders did not exist, I created the mysql user and mysql group as system accounts and gave ownership and full control to the directories specified in the conf file. the I tried running the `mysqld` as the mysql user:               $ sudo -u mysql mysqld       And I get I get the following error               120201 13:52:58 [Note] Plugin 'FEDERATED' is disabled.     mysqld: Table 'mysql.plugin' doesn't exist     120201 13:52:58 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade     to create it.     120201 13:52:58  InnoDB: Initializing buffer pool, size = 8.0M     120201 13:52:58  InnoDB: Completed initialization of buffer pool     120201 13:52:58  InnoDB: Started; log sequence number 0 44233     120201 13:52:58 [ERROR] Fatal error: Can't open and lock privilege tables: Table   'mysql.host' doesn't exist      Also I'tried running it like this:               $ sudo service mysql start      Yields `mysql: unrecognized service` Any suggestions are GREATLY appreciated.


Ubuntu Drivers on Chromium OS?

I recently managed to install Chromium OS to a flash drive. However, when I booted into Chromium OS, I found that neither wifi or ethernet worked, yet both wifi and ethernet work on my Ubuntu partition. I was wondering if it was possible to copy the wifi and ethernet drivers from Ubuntu to Chromium OS. Have any of you tried this? I'm running Ubuntu


Is there line numbering for nano?

Is there a way to turn on line numbering for nano?


VSFTPD link to a folder in root folder

I have just setup the basic stuff for `vsftpd`. I got that working fine with root use thats all. I have also stupidly installed something to the root user home directory which I would like another user to access can this be done and how? So for example I have the root folder "/root/installedapp/plugins" and I want to create a user called pluginmod to only have access to that folder. Can someone please and explain how this is possible?


What causes localhost 404 requests to go to http://origin.domain.com

I've been running Apache on my local computer for years. Suddenly, any request to a local page that is not found, is redirected to http://origin.domain.com/. What could cause this? Just to be clear, I open: http://localhost/this_page_does_not_exists.html And I am being forwarded to: http://origin.domain.com I tested this in Firefox, Chrome, and even in Lynx, and it happens all the same. Using Apache 2.2.22, on Arch Linux.


Overclocking software for Linux?

Is most overclocking done strictly at the BIOS level, or is there a way to do it from a running operating system? And if so, is there a way to do it from Linux? I'm running Ubuntu presently and am interested in overclocking to squeeze more speed out of my processor.


Do the parent directory's permissions matter when accessing a subdirectory?

If I have a root folder with some restrictive permission, let's say 600, and if the child folders/files have 777 permission will everybody be able to read/write/execute the child file even though the root folder has 600?


Is the `ed` editor useful for any purpose besides emergencies and batch editing?

I'm wondering if the `ed` editor is useful any longer for interactive editing. I know that the diff command can produce patches as ed scripts and that ed is a last resort when the baud rate is super slow. But are there any other reasons to learn and use `ed`?


retrieving names of all open pdf files (in evince or otherwise)

I constantly have many PDF files open. These are usually downloaded using chrome and immediately opened using evince. I sometimes want to persist the state of all my open PDF files, so I could re- open the same group of documents at a later time. This mostly happens when I need to reboot and what to have the same set of documents re-opened, but sometimes I just want to keep a list of open documents for later. Is there a way to get the names of all open pdf files, from evince or any other program? or at least, is there a way of asking evince to re-open the same set of documents after a reboot?


How to make VLC play an iso file directly?

Running `vlc /path/to/dvd-video.iso`, I'm getting:               [0x8787ccc] main decoder error: no suitable decoder module for fourcc `undf'. VLC probably does not support this sound or video format.      **notes** :   * The version of `vlc` is 1.1.3.   * The DVD plays well when not in iso format (when it's normal files on the filesystem).


/proc/sys vs /sys/modules/mod/parameter

I've been wondering for last few days how exactly does it work. We can set kernel runtimes parameters using sysctl or `echo boolen 1> /proc/sys/module/exactParameter` but in `/sys/modules/module/parameters/parameter` we can also set values. Are parameters for modules in `/proc/sys/` related only to hard complied into kernel? or there could be parameters for Loadable Kernel Modules also? LKM after being loaded into running Kernel reveal their parameters in `/sys/modules/module/paraeter/params`. Does it mean, that there aren't parameters for modules compiled into Kernel? What is difference between both directories.


Notifications and notification daemon not working on window manager

Notifications doesn't work on Linux standalone window managers (Openbox, Awesome WM and alike). I tried to install notification-daemon and dunst, but sending with `notify-send "something"` does not make any window to pop-up. I tried to run polkit-gnome-agent and run directly notification daemons, but it does not help (while ago I solved similar problem in this way, but now it does nothing). There is no any indications of errors unless I send trivial notification with python, then I get only vague error message: `File "/usr/lib/python3.3/site- packages/gi/types.py", line 113, in function return info.invoke(*args, **kwargs) gi._glib.GError: Could not connect: Connection refused ` Trivial C program outputs nothing (no error for example). I'm using Archlinux with systemd and d-bus, I suspect it's a problem with polkit or some kind daemon not runing on window manager start, but have no idea, what could I try or how could I get more meaningfull error messages. **EDIT:** I took sample code from there: https://wiki.archlinux.org/index.php/Libnotify#Python Dbus should be runing because systemd has it as dependency. I have `libnotify` installed - it is package which provides `notify-send`. Also notification daemon should start as needed (only when notification arives), by following desktop file `/usr/share/dbus-1/services/org.freedesktop.Notifications.service` :               [D-BUS Service]     Name=org.freedesktop.Notifications     Exec=/usr/bin/dunst      I had even tried to run daemons directly (just execute) and tried sending notifications. If somenone knows how I could get me more info, please do not hesitate to suggest. **EDIT 2:** I tried running notification daemon with sudo: `sudo notification- daemon_name &` (in my case `sudo dunst &`) and `sudo notify-send something`, then notification works. But when I try to do any of the previous actions as unprivileged user (which is important most programs send notification as unprivileged users), nothing shows. `notification-daemon` refuses to work at all without any error or warning. **EDIT 3:** Clearly it is permissions problem: I can't send notifications without root access. After clean reboot: `sudo notify-send "something"` works even without manually launching any daemons, however what I (and my launched programs) should do to be able send notifications without root privilegies as it is possible in Gnome or any other full desktop environments?


Convention for primary app deployment dir structure on a Unix-like app server

The client I'm working for deploys their application to a directory they created at the root level. While acknowledging it is a matter of local preference, I am unsure if this is in accordance with the generally accepted standard how to distribute an application's components across a Unix-like system. E.g. normally, I would put the binaries for my deployed app to `/opt`, conf files in `/etc`, logs under `/var` etc. But then again, this is the primary application the server is used for so it isn't exactly equivalent to untaring some 3rd party software into `/opt`. Still, personally, I would prefer not to add any dirs at the root level, i.e. would keep that level sort of sacred out of respect for the original Unix file hierarchy. I wanted to ask whether this is common and what are some ramifications of this approach.


How can I purge old kernel packages in Elementary OS?

On my Elementary OS system, dpkg reports a number of kernel packages that aren't installed. (I did an apt-get purge on them previously.) I'd like to have them forgotten about entirely, but I can't figure out how to get them that way. For example:               elementary:~$ dpkg -l linux-*-3.2.0-51*     Desired=Unknown/Install/Remove/Purge/Hold     | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend     |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)     ||/ Name                                 Version                              Description     +++-====================================-====================================-========================================================================================     un  linux-headers-3.2.0-51               <none>                               (no description available)     un  linux-headers-3.2.0-51-generic       <none>                               (no description available)     un  linux-image-3.2.0-51-generic         <none>                               (no description available)      apt-get purge doesn't work:               elementary:~$ sudo apt-get purge linux-headers-3.2.0-51     Reading package lists... Done     Building dependency tree            Reading state information... Done     Package linux-headers-3.2.0-51 is not installed, so not removed     0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.      dpkg doesn't work:               elementary:~$ sudo dpkg --purge linux-headers-3.2.0-51     dpkg: warning: there's no installed package matching linux-headers-3.2.0-51     elementary:~$ sudo dpkg --forget-old-unavail     dpkg: warning: obsolete '--forget-old-unavail' option, unavailable packages are automatically cleaned up.      apt-cache shows:               elementary:~$ apt-cache policy linux-headers-3.2.0-51     linux-headers-3.2.0-51:       Installed: (none)       Candidate: 3.2.0-51.77       Version table:          3.2.0-51.77 0             500 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages             500 http://security.ubuntu.com/ubuntu/ precise-security/main amd64 Packages      aptitude isn't installed. Obviously, there's something I'm not understanding. Why does dpkg -l show purged packages? How do I go about making dpkg forget about them?


Thunar: no templates in context menu

I already configured `XDG_TEMPLATES_DIR` field in `~/.config/user-dirs.dir` , The folder is absolute path, and accessible, with several files inside. But when I right click, the "Create Document" menu is still empty. Is there something I missed? **UPDATE**               %> grep TEMP ~/.config/user-dirs.dir     XDG_TEMPLATES_DIR="/YY/XX/Templates/"      And that path exists and have files inside.


What does XST in the date command output mean?

When executing the date command (on CentOS), it gives me something like this: > Thu May 10 20:15:07 XST 2012 My local time zone is CEST, which was at that moment 22:15:07, so the printed time seems to be GMT. But even with some time in Google and the man pages I was not able to see what XST means...I guess it's quite simple, so who can help? * * * Edit: When setting the timezone again, the output comes like that: > Fri May 11 10:02:33 XDT 2012 So, the printed time is fine - I am just curious about the meaning of `XST` and `XDT` in the output.


Any reason NOT to run Linux in a VM all the time?

I've switched to using Arch Linux for most of my day to day work and don't need Windows for anything but gaming and the couple of apps that aren't ported to Linux like OneNote. My Linux distro is hosted in VirtualBox with Windows as host, and I quite like it that way, snapshots are incredibly useful. Let's say I were to pretty much never care about the Windows host and spend 95% of the time in the guest, what would I be missing out on? Are there serious downsides? Is performance severely affected and will installing straight onto the machine make my life much more amazing?


Fedora 19 (Schrödinger's cat) gets stuck on boot

When I installed Fedora, it did not have the Schrödinger's cat boot option, but then I installed a bunch of updates and now it is there. What is even more annoying is that it is the default boot option. Here is the log I get on the screen during boot: ![Boot log](http://i.stack.imgur.com/OIher.jpg) Is there any way to fix this without reinstalling? If anyone wants boot log text file let me know and I will clear it and reboot and give you the output. * * * Edit: I added the line to the `/etc/yum.conf` file and here is the new stack: ![enter image description here](http://i.stack.imgur.com/icaSF.jpg)


Chaining && and || in the shell

Why does this not work as expected?               $ false &&   { echo ok;  echo ok; } && { echo notOK; }      and this not:               $ false &&   { echo ok;  echo ok; } || { echo notOK; }      I don't see it!


What's the real point of the -f option on rm?

By reading the GNU coreutils man page for `rm`, one of the options is `-f`, which according to the manual,               -f, --force               ignore nonexistent files and arguments, never prompt      Now, I made some tests and show that indeed if I use something like               rm -f /nonexisting/directory/      it won't complain. What can someone really gain from such an option? Plus the most common examples of "deleting directories" using `rm` is something like                rm -rf /delete/this/dir      The `-r` option makes sense, but `-f`?


Create a executable for a scheme program with arguments

I have a `scheme` program which is executed using the command `; (primes<= n)` to give me all the primes less than `n` For example, `; (primes<= 200)` gives me all the primes less than 200 How do I create an executable in Linux for the program below taking `n` as an argument ---------Scheme Program------------------------------------------------                   #lang racket          (define  (interval-list m n)       (if (> m n)           '()           (cons m (interval-list (+ 1 m) n))))     (define (sieve l)       (define (remove-multiples n l)         (if (null? l)              '()              (if  (= (modulo (car l) n) 0)      ; division test                   (remove-multiples n (cdr l))                   (cons (car l)                         (remove-multiples n (cdr l))))))       (if (null? l)           '()           (cons (car l)                  (sieve (remove-multiples (car l) (cdr l))))))     (define (primes<= n)       (sieve (interval-list 2 n)))      * * * The above program is executed as (primes<= 100)prints all the primes less than 100


How does a fork bomb work?

* _**WARNING DO NOT ATTEMPT TO RUN THIS ON A PRODUCTION MACHINE_** In reading the Wikipedia page on the topic I generally follow what's going on with the following code:               :(){ :|:& };:      _excerpt of description_ > The following fork bomb was presented as art in 2002;56 its exact origin is > unknown, but it existed on Usenet prior to 2002. The bomb is executed by > pasting the following 13 characters into a UNIX shell such as bash or zsh. > It operates by defining a function called ':', which calls itself twice, > once in the foreground and once in the background. However the last bit isn't entirely clear to me. I see the function definition:               :(){ ... }      But what else is going on? Also do other shells such as `ksh`, `csh`, and `tcsh` also suffer the same fate of being able to construct something similar?


Is it safe to only have root and swap partitions when dual-booting Linux and Windows?

I am trying to install Linux Mint alongside an existing Windows 7. I found a simple tutorial (I haven't tried it yet), but I wonder if it is healthy to partition `/` and `/swap` only. On the other hand, another tutorial simply doesn't work even it have four partitions: `/`, `/boot`, `/swap`, and `/home`. If the first tutorial works, it is healthy to allocate all space to `/`? And will I have a `/home` directory? Also, I tried the first installer option provided by Mint ("install Linux Mint alongside Windows 7"), but it simply didn't work. The boot menu didn't appear automatically.


Configuring sendmail as a relay to ISP

I need to setup sendmail daemon as a simple store-and-forward mechanism to forward mails to our ISP. I need to connect to the ISP SMTP server on port 465 using SSL/TLS and a username/password for authentication. This particular ISP (GoDaddy) does not - afaiu - support STARTTLS, only plain vanilla SSL/TLS. There's no proxy in order to connect to Internet. What I want to achieve is to have an internal always-on SMTP that can accept e-mail even when our connection to Internet is down, the ISP is malfunctioning or whatever. The internal SMTP server would then hang onto the e-mail until it can be delivered to the external SMTP server. Also the internal SMTP server can be setup old-fashioned way on incoming side so that it will accept unencrypted and unauthenticated connections from internal net. This allows old applications that are only able to send e-mails this way (my company has an old Perl app that does this) through the internal SMTP server. The sendmail I work with has the following abilities out-of-the-box:               Version 8.14.5+Sun      Compiled with: DNSMAP LDAPMAP LOG MAP_REGEX MATCHGECOS MILTER MIME7TO8                     MIME8TO7 NAMED_BIND NDBM NETINET NETINET6 NETUNIX NEWDB NIS                     PIPELINING SCANF STARTTLS TCPWRAPPERS USERDB USE_LDAP_INIT                     XDEBUG      I've been through a lot of blogs/mail lists but surprisingly haven't been able to find what I'm looking for. You would think that my use case is pretty common these days, but no. These are problems that I have with the instructions I can find on the Net:   * They are just plain old. Nothing wrong with that but many of them start out with "this is how you roll your own sendmail" or similar. I believe modern sendmail implementations (like the one I work with) are ok as installed.   * They tell you how to setup a smart host but assume you connect to that host unencrypted and unauthenticated on port 25. I believe it is many years since anyone has operated an externally exposed SMTP server like that. Perhaps such example is not void in modern days but it confuses me what part of it I can use.   * They do not adequately distinguish between the receiving side (incoming SMTP connection) and the sending side (outgoing SMTP connections) of the sendmail daemon. I don't care much about the receiving side. It is by default only open for incoming connections from localhost and that is fine with me. I do not need any form of authentication or encryption on the incoming side. (there are about a dozen methods I can protect the sendmail daemon so it only accepts connections from localhost, from a specific IP range or similar -- all that I know how to do, no worries). It is only the sendmail daemon's _outgoing_ connections where I need to use SSL/TLS and username/password. Anyone can point me in the right direction? I'll be happy to post a full example once finished.


encfs with expect access denied

If I execute script               #!/usr/bin/expect      set pass [lindex $argv 0]      spawn encfs -v  {CRIPT_DIR}  {MNT_DIR} -o nonempty      expect "*EncFS Password:*"     send "$pass\r"     expect eof      expect script output:               zz@zz-com:/media/truecrypt5/mmm$./e.sh 1     spawn encfs -v /media/truecrypt5/mmm/cr /media/truecrypt5/mmm/mn -o nonempty     10:25:11 (main.cpp:523) Root directory: /media/truecrypt5/mmm/cr/     10:25:11 (main.cpp:524) Fuse arguments: (daemon) (threaded) (keyCheck) encfs /media/truecrypt5/mmm/mn -o nonempty -s -o use_ino -o default_permissions      10:25:11 (FileUtils.cpp:177) version = 20     10:25:11 (FileUtils.cpp:181) found new serialization format     10:25:11 (FileUtils.cpp:199) subVersion = 20100713     10:25:11 (Interface.cpp:165) checking if ssl/aes(3:0:2) implements ssl/aes(3:0:0)     10:25:11 (SSL_Cipher.cpp:370) allocated cipher ssl/aes, keySize 24, ivlength 16     10:25:11 (Interface.cpp:165) checking if ssl/aes(3:0:2) implements ssl/aes(3:0:0)     10:25:11 (SSL_Cipher.cpp:370) allocated cipher ssl/aes, keySize 24, ivlength 16     10:25:11 (FileUtils.cpp:1620) useStdin: 0     EncFS Password:      10:25:11 (Interface.cpp:165) checking if ssl/aes(3:0:2) implements ssl/aes(3:0:0)     10:25:11 (SSL_Cipher.cpp:370) allocated cipher ssl/aes, keySize 24, ivlength 16     10:25:12 (FileUtils.cpp:1628) cipher key size = 44     10:25:12 (Interface.cpp:165) checking if nameio/block(3:0:1) implements nameio/block(3:0:0)      ls command:               zz@zz-com:/media/truecrypt5/mmm$sudo ls -la     [sudo] password for zz:      ls: cannot access mn: Permission denied     total 24     drwx------  4 zz zz 4096 2012-08-31 14:40 .     drwx------ 10 zz zz 4096 1970-01-01 03:00 ..     drwx------  2 zz zz 4096 2012-08-30 18:56 cr     -rwx------  1 zz zz   73 2012-08-30 18:54 e2.sh     -rwx------  1 zz zz  178 2012-08-30 19:10 e.sh     d?????????  ? ?  ?     ?                ? mn     -rwx------  1 zz zz   40 2012-08-30 18:52 u.sh      I don't have access to {MNT_DIR}. Sodo user don't have access to. But command or shell scipt               #!/bin/sh     encfs -v  {CRIPT_DIR}  {MNT_DIR} -o nonempty      work correct. OS: Ubuntu 11.10 What is wrong in my expect script?


Problem : how can I copy/paste this in vim?

I'm working with the vim editor and I found `y`,`yw` respectively to copy a line and a word but how can I do the following task in vim? www.p`ack.goo`gle.com From this line how can I copy and paste `ack.goo` using vim editor?


Which desktop indexer indexes xml file content?

My favorite indexer doesn't have this capability, and I'm looking for an alternative that does.


Creating a completely offline installer using simple-cdd

I'm trying to create a custom CD using my own minimal debian installed setup. I just simply typed `build-simple-cdd`. The process was successful, but when I tested it on my virtualbox and disabling the network, it looks for the kernel. Did I miss anything on my setup?


How to stop a daemon from starting up on boot-up in Debian

There's a few daemons I disable from starting on boot-up. As an example, I use the following:                sudo update-rc.d -f postgresql remove      I'm not even sure if that command is correct and I don't remember where I got it from. Anyways, whenever I upgrade **`postgresql`** , the setting is lost (i.e. the daemon starts up on reboot).


Run java classfile from terminal

I have a compiled java file `somefile.class`, and when i cd into the right folder and do: `java somefile` it works but when i call it from another folder: `java folder/somefile` it doesn't work, it gives me java exceptions, could you help me out? Edit: I am working on a Mac if that matters..


IM program to support yahoo video calls

I have been trying to migrate to Linux from Windows during the past one year. Until I completely deleted my windows and I have been using Linux mint 15 for the last 30 days. I am really satisfied. I have one huge problem. I have relatives in other countries that I must use Yahoo to chat and talk with. I have tried to find a replacement for Yahoo messenger in Linux that supports Yahoo video/voice calls protocol but I have not been successful. Since I must use Yahoo for my calls I would highly appreciate if you could suggest me a program that I could use. I have tried different distributions and Linux mint 15 seems to be the most stable on my laptop. So I would like to use a program that is supported by Linux mint.   * I have tried GYchE but unfortunately it does not support video/voice calls    * I have tried installing Yahoo messenger through Wine. I have installed Yahoo Messenger but when it tries to log me in I get this error. It seems to be a common problem for different programs in Wine. But I could not find a solution to solve the problem. Edit: I installed VirtualBox and used a Windows XP iso file to install Windows Xp on the virtual Machine. Everything was very easy and straightforward. As Anthon suggested, if you want to use the USB device you should be a member of _vboxuser_ group. VirtualBox has a very good Manual here. I followed the manual here, but in linux mint there is no GUI user/group management tool. So I followed this answer to install the tool.   I am so happy that everything (webcam - microphone) is working under the virtual machine Yahoo Messenger. So far it has been really fast and stable.


How to to login to my emailbox using shell or java code

I want to write a program/script that can send emails on my behalf using Unix Shell or Java. I think Unix Shell would be the best option as I need to do set specific time to send emails from my behalf. I know it can be done with `cron` settings in Unix. But I do not know even how to start with implementation, what parts of Shell/Java to look for. How do I login to my emailbox usuing Java or Shell/Unix?


Tacacs over IPv6

I have migrated my Redhat Enterprise linux server 5.5 to IPv6 . Now I want to run tacacs+ for IPv6. When testing from my client, it returns "unable to connect to server for IPv6 address", but for IPv4 it’s working fine. Snapshot of Linux listening port:               [root@ADA-Linux-Service-2 ~]# netstat -an | grep :49     tcp        0      0 0.0.0.0:49                  0.0.0.0:*                   LISTEN      Once the tacacs service is started, I tried using the bind option with IPv6 it returns the following error:               Reading config     Version F4.0.4.26 Initialized 1     get_socket: bind 49 Address already in use      I don’t know how to make tacacs+ listen on the IPv6 address. Do I need to create entries in `tac_plus.cfg` to listen for IPv6?


How to delete a video after it has been watched completely?

I watch most of my TV news on my computer. The videos are downloaded by my RSS reader and stored on disk until I decide to watch them. The files look like this:               130704_hjo_446k_p20v11.mp4     130706_hjo_446k_p20v11.mp4     130708_hjo_446k_p20v11.mp4      The thing is I don't watch them daily, but whenever I feel like it. So sometimes I watch one sometimes three in a row.I watch them normally with `mplayer2` by executing the following:               mplayer *hjo*.mp4      My problem is I always forget to delete the already watched files and then I have to remember when I last watched or I have to rewatch until I find the new files. Now I am looking for a script or program which marks the completely watched files. As far as I know `mplayer2` can't do this, since there is no hook to check if the video was watched to the end.


Solaris 10 on x86: local sockets (unix domain sockets) very very slow?

I'm writing an application both on Linux and Solaris 10. It uses local sockets for some internal communications. On Linux an open, exchange one short message & close cycle takes about 10us elapsed time. On Solaris 10 x86, it takes about 400us. This is such atrociously bad performance, that I think I might have done something fundamentally wrong. Yet what I'm using is the textbook-case, with the waiting for the other side in the command exchange implemented by `select()`. ### Questions   1. Are local sockets something that are known to have abysmal performance on Solaris 10, either for opening/closing or for data exchange?   2. Are there any known performance issues with `select()` on Solaris 10?   3. Are there any special tricks to speed this up?


Mount options with ecryptfs encrypted home

I'm using ecryptfs for an encrypted home directory. I would like to try out the mount option "ecryptfs_xattr" on my encrypted home directory, because it will probably improve performance. Can I specify this option somewhere, and still have it decrypt the home when I log in? (I assume I have to re-create the encrypted home directory, that's no problem)


Run tmux always when I open terminal

I usually open _lxterminal_ with bash shell where I usually type _tmux_ command first. I'd like to have launched tmux command automatically, so I tried to add this command to `~/.bash_profile` or to `~/.profile` files but none of them launched the tmux automatically. Can this be achieved?


Changing hostname without errors

I tried to change my hostname according to this guide for Debian based system:   1. I edited `/etc/hostname`   2. I ran `/etc/init.d/hostname start` Though there are errors. Always when I write a `sudo` command it tells me it can't recognize the hostname. After I restarted the system, the graphical environment wasn't working, the `startx` command wasn't successful. So, I changed the hostname back to the old name. Can I change the hostname without errors?


How to "zoom out" screen windows, everything looks too big?

I bought new laptop Dell Inspiron and first thing I installed Linux Mint and Eclipse for Java development. But I didn't like the look of Eclipse, everything just looks too big on the screen. Half of the space is taken by the tabs and menus, no room for editor, also the font is too big. I would like to shrink the whole screen if possible, to have smaller fonts and tabs etc., but the display is on the maximum resolution already (1366x768). How can I do this? I'm quite new to Linux and gnome, but I'm sure there is a simple solution to my problem.


getting pid of two last commands executed in background and do stuff

I wrote this bash:               #!/bin/bash              eval "(a command) &"         pid1=$!              eval "(while kill -0 $pid1; do .... ; done) &"  #It creates file.txt after few seconds         pid2=$!              if [ -s /tmp/file.txt ]; then                  for line in $(cat /tmp/file.txt)                      do                       sth                      done      With logic of bash scripting: Is the values of pid1 and pid2 correct? Is this script running correctly?


How can I run `hackxor` inside VirtualBox?

I've found hacking game **hackxor** , but it's made for vmware. I don't have any experience with vmware and I don't want to install it in my machine. So I'd like to run **hackxor** inside VirtualBox if it is possible.


How long has my Linux system been running?

Is there a command I can type in a terminal that will tell me the last time a machine was rebooted?