title: Xresources color settings

text: I'm using Gentoo with XMonad and set all the colors in `.Xresources` file. The problem is that for some apps setting `*.background` and `*.foreground` is not enough since they override the settings for some fields. Here's an example of what's wrong: ![enter image description here](http://i.stack.imgur.com/djDDE.png) The background should be similar to the dark window elements, but it's white and gray instead. What are some other xresources variables that set dialog window colors and what is the correct way to overcome this problem? My current `.Xresources` file:               ! Solarized colorscheme for Xresources     ! ====================================                         ! To choose between light/dark bakground:     ! - Define the choice in ``.Xresources`` by hardcoding     !   #define SOLARIZED_LIGHT     !   or     !   #define SOLARIZED_DARK     ! - Define the symbol when loading ``.Xresources`` with ``xrdb``:     !   $ xrdb -DSOLARIZED_LIGHT -merge ~/.Xresources                         #if !defined(SOLARIZED_LIGHT) && !defined(SOLARIZED_DARK)     #define SOLARIZED_DARK     #elif defined(SOLARIZED_LIGHT) && defined(SOLARIZED_DARK)     #undef SOLARIZED_LIGHT     #endif                         ! Define Solarized colors     ! -----------------------     #define S_base03    #002b36     #define S_base02    #073642     #define S_base01    #586e75     #define S_base00    #657b83     #define S_base0     #839496     #define S_base1     #93a1a1     #define S_base2     #eee8d5     #define S_base3     #fdf6e3                         #define S_yellow    #b58900     #define S_orange    #cb4b16     #define S_red       #dc322f     #define S_magenta   #d33682     #define S_violet    #6c71c4     #define S_blue      #268bd2     #define S_cyan      #2aa198     #define S_green     #859900                         #ifdef SOLARIZED_LIGHT     #define S_emph      S_base01     #define S_primary   S_base00     #define S_secondary S_base1     #define S_bgrnd_hi  S_base2     #define S_bgrnd     S_base3     #endif     #ifdef SOLARIZED_DARK     #define S_emph      S_base1     #define S_primary   S_base0     #define S_secondary S_base01     #define S_bgrnd_hi  S_base02     #define S_bgrnd     S_base03     #endif                         ! black dark/light     *color0:                S_base02     *color8:                S_base03     ! red dark/light     *color1:                S_red     *color9:                S_orange     ! green dark/light     *color2:                S_green     *color10:               S_base01     ! yellow dark/light     *color3:                S_yellow     *color11:               S_base00     ! blue dark/light     *color4:                S_blue     *color12:               S_base0     ! magenta dark/light     *color5:                S_magenta     *color13:               S_violet     ! cyan dark/light     *color6:                S_cyan     *color14:               S_base1     ! white dark/light     *color7:                S_base2     *color15:               S_base3                                             ! General Xresource settings     ! ==========================     !     #define FONT_REGULAR xft:Liberation Mono:style=Regular:pixelsize=14      #define FONT_BOLD xft:Liberation Mono:style=Bold:pixelsize=14      #define FONT_ITALIC xft:Liberation Mono:style=Italic:pixelsize=14      Xft*antialias: true                         *foreground:                S_primary     *background:                S_bgrnd     *Foreground:                S_primary     *Background:                S_bgrnd     *cursorColor:               S_emph     *pointerColorForeground:    S_emph     *pointerColorBackground:    S_secondary     *fading:                    40     *fadeColor:                 S_bgrnd                                             ! Xscreensaver     ! ============     xscreensaver.captureStderr: false     !font settings     xscreensaver.Dialog.headingFont: FONT_REGULAR     xscreensaver.Dialog.bodyFont:    FONT_REGULAR      xscreensaver.Dialog.labelFont:   FONT_REGULAR      xscreensaver.Dialog.unameFont:   FONT_REGULAR      xscreensaver.Dialog.buttonFont:  FONT_REGULAR      xscreensaver.Dialog.dateFont:    FONT_REGULAR      xscreensaver.passwd.passwdFont:  FONT_REGULAR      !general dialog box (affects main hostname, username, password text)     xscreensaver.Dialog.foreground: S_primary     xscreensaver.Dialog.background: S_bgrnd     xscreensaver.Dialog.topShadowColor: S_bgrnd     xscreensaver.Dialog.bottomShadowColor: S_bgrnd     xscreensaver.Dialog.Button.foreground: S_primary     xscreensaver.Dialog.Button.background: S_bgrnd_hi     !username/password input box and date text colour     xscreensaver.Dialog.text.foreground: S_primary     xscreensaver.Dialog.text.background: S_bgrnd_hi     xscreensaver.Dialog.internalBorderWidth: 24     xscreensaver.Dialog.borderWidth: 0     xscreensaver.Dialog.shadowThickness: 1     xscreensaver*logo.width: 1     xscreensaver*logo.height: 1     !timeout bar (background is actually determined by Dialog.text.background)     xscreensaver.passwd.thermometer.foreground: S_red     xscreensaver.passwd.thermometer.background: S_blue     xscreensaver.passwd.thermometer.width: 4                               ! rxvt-unicode terminal     ! =====================     !     URxvt*background: S_bgrnd     URxvt*foreground: S_primary     URxvt*font: FONT_REGULAR     URxvt*boldFont: FONT_BOLD     URxvt*italicFont: FONT_ITALIC     URxvt.colorIT: S_magenta     URxvt.colorBD: S_green     URxvt.colorUL: S_blue     URXVT.borderColor: S_bgrnd_hi     URxvt.highlightColor: S_bgrnd_hi     URxvt.scrollBar: false     URxvt.saveLines: 1000     URxvt.cursorBlink: true     URxvt.pointerBlank: true     URxvt.modifier: alt


title: How to edit grub2 to use kdump?

text: I was following http://fedoraproject.org/wiki/How_to_use_kdump_to_debug_kernel_crashes and in step 2 I need to add the line to grub.cfg, but grub.cfg is a shell I do not know how to edit it, most available resources tell you only the method to rearrange menu items, can anyone tell me what should be added to the file. I use 64-bit Fedora 18.


title: What is the default jobs argument for make?

text: How many jobs does `make` use by default when you don't pass it the `-j` flag?


title: Can't reach DNS through wireless router

text: I've got a Ubuntu 10.04 laptop, and recently it's had some odd networking problems. It's on the home wireless router, supplied by the phone company, and has no problem talking to anything on the wireless LAN, whether by IP number or /etc/hosts name. It's set to use the wireless connection with DHCP, and there really isn't much I can screw up after that for network entries. Right now, I can reach outside the LAN by IP number, but that doesn't do well for web surfing. When I do a nslookup, I'm getting non-authoritative answers, so I suspect I'm hitting a cache somewhere (probably the router). Any attempt to get outside the LAN with a domain name fails quietly, like a "can't find" using Firefox. The only things that might have changed since it did work right are 10.04 updates (and there's been quite a few of them) and a couple of lines added to /etc/hosts, to address fixed IPs on the LAN (in the 192.168.0.* range). The lines are in the same format as others, and it's nothing I haven't done before with no ill effects. Any ideas on what to try next?


title: Editing grub menu

text: I'd like to edit the Grub menu that comes up, to move one line and remove others. I have an Inspiron 1420 that came with Ubuntu 7.10. When it needed a new drive, I installed Windows 7, the original OS, and then it seemed that 10.04 wanted its own partition. I probably should have checked exactly what I was doing first (famous last words). What I'd like to do is remove the 7.10 lines entirely, so I can blow away everything in that partition and use it as /home for 10.04. I'd also like to move the Windows 7 line up to second from the top, so booting in Windows would be a quick two keystrokes rather than following the line all the way down. Hitting the Grub edit key came up with unclear instructions, and since this is the boot loader I'd kind of rather not screw it up too bad. So, what's the best way to do this?


title: org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed] while running eclipse on ubuntu

text: I was trying to open eclipse in my ubuntu VM with the below commmand.. And as soon as I do that, I always get the below exception -               ubuntu@username-dyn-vm1-48493:~$ eclipse     Eclipse:     An error has occurred. See the log file     /home/ubuntu/.eclipse/org.eclipse.platform_3.8_155965261/configuration/1381367113197.log.      so when I went to that particular log file, this is what I can see in the log -               ubuntu@username-dyn-vm1-48493:~$ more /home/ubuntu/.eclipse/org.eclipse.platform_3.8_155965261/configuration/1381367113197.log     !SESSION 2013-10-10 01:05:13.088 -----------------------------------------------     eclipse.buildId=debbuild     java.version=1.7.0_25     java.vendor=Oracle Corporation     BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US     Command-line arguments:  -os linux -ws gtk -arch x86_64          !ENTRY org.eclipse.osgi 4 0 2013-10-10 01:05:17.555     !MESSAGE Application error     !STACK 1     org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]             at org.eclipse.swt.SWT.error(SWT.java:4387)             at org.eclipse.swt.widgets.Display.createDisplay(Display.java:914)             at org.eclipse.swt.widgets.Display.create(Display.java:900)             at org.eclipse.swt.graphics.Device.<init>(Device.java:156)             at org.eclipse.swt.widgets.Display.<init>(Display.java:498)             at org.eclipse.swt.widgets.Display.<init>(Display.java:489)             at org.eclipse.ui.internal.Workbench.createDisplay(Workbench.java:716)             at org.eclipse.ui.PlatformUI.createDisplay(PlatformUI.java:161)             at org.eclipse.ui.internal.ide.application.IDEApplication.createDisplay(IDEApplication.java:154)             at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:96)             at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)             at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)             at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)             at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)             at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)             at java.lang.reflect.Method.invoke(Method.java:606)             at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)             at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)             at org.eclipse.equinox.launcher.Main.run(Main.java:1438)             at org.eclipse.equinox.launcher.Main.main(Main.java:1414)      Does anyone know what wrong has happened? Or what I am supposed to do to fix this issue? Thanks.. **Update:-** Version details below -               ubuntu@username-dyn-vm1-48493:~$ dpkg -l libgtk[0-9]* | grep ^i     ii  libgtk2.0-0:amd64                   2.24.17-0ubuntu2                    amd64        GTK+ graphical user interface library     ii  libgtk2.0-bin                       2.24.17-0ubuntu2                    amd64        programs for the GTK+ graphical user interface library     ii  libgtk2.0-common                    2.24.17-0ubuntu2                    all          common files for the GTK+ graphical user interface library


title: Any alternative of "man -a" on UNIX?

text: `man -a <xyz>` opens all the man pages one by one which contain `xyz`.   On my unix servers `man -a <xyz>` doesn't work.   Is there any alternative for this on unix? EDIT: I am on HP-UX. Following message :               hemantj [109]> man -a printf     Usage: man [-M path] [-T macro-package] [ section ] name ...     or: man -k keyword ...     or: man -f file ...


title: How to create initrd.img from initrd.lz

text: I need to create `initrd.img` file from `initrd.lz` file. How may I do this?


title: iptables and logs

text: Suppose I add an IP to iptables blocking for exim, dovecot and FTP and this IP visits my server again. Is there any log of this visit so I can confirm the IP was trying to reach the server again but was blocked?


title: Why should /var /opt /tmp /home /boot directories be on different partitions?

text: As the title says, why should I split these directories across multiple partitions? Performance? Security maybe?


title: 'kill java' doesn't kill java

text: I am running debian right now and sometimes I need to kill java manually from the terminal, but when I try `kill #pid#` or `pkill java` nothing happens. No console output (ok, that's normal) and java is still running (not normal). The only way to kill it is to restart the PC. Any suggestions?


title: What causes this green background in ls output?

text: ![screencap of ls output on linux machine](http://i.stack.imgur.com/rQomR.png) There are two directories shown by 'ls'. Normally directories anywhere are blue on black background. But the first one is blue on green and impossible to read. Why is this? How to make it blue on black, or at least something light on something dark? This is on Ubuntu 12.04, using bash in Gnome Terminal. In Konsole, the blue is slightly darker, and possible to read, though could be way better.


title: vsftpd filezilla timout error

text: I have an vsftpd setup. When I try to upload a large number of files, a lot of files fail with a timeout error. After some analysis, I saw this pattern as follow before every error, but I don't know what is the cause. Can anyone throw some light on it?               Command:    TYPE A     Response:   200 Switching to ASCII mode.     Command:    PASV     Response:   227 Entering Passive Mode (50,16,204,201,4,7).     Command:    STOR ms-users.php     Command:    TYPE A     Response:   200 Switching to ASCII mode.     Command:    PASV     Response:   227 Entering Passive Mode (50,16,204,201,4,0).     Command:    STOR post.php      here is a more detailed process, i don't understand the format and the protocal details:                2012-03-18 13:02:52 5608 5 Status: Resolving address of majorchooser.info     2012-03-18 13:02:52 5608 5 Status: Connecting to 50.16.204.201:21...     2012-03-18 13:02:53 5608 5 Status: Connection established, waiting for welcome message...     2012-03-18 13:02:53 5608 5 Response: 220 (vsFTPd 2.2.2)     2012-03-18 13:02:53 5608 5 Command: USER majorchooser     2012-03-18 13:02:54 5608 5 Response: 331 Please specify the password.     2012-03-18 13:02:54 5608 5 Command: PASS ***********     2012-03-18 13:02:54 5608 5 Response: 230 Login successful.     2012-03-18 13:02:54 5608 5 Command: OPTS UTF8 ON     2012-03-18 13:02:55 5608 5 Response: 200 Always in UTF8 mode.     2012-03-18 13:02:55 5608 5 Status: Connected     2012-03-18 13:02:55 5608 5 Status: Retrieving directory listing...     2012-03-18 13:02:55 5608 5 Command: PWD     2012-03-18 13:02:55 5608 5 Response: 257 "/"     2012-03-18 13:02:55 5608 5 Status: Directory listing successful     2012-03-18 13:03:01 5608 1 Status: Resolving address of majorchooser.info     2012-03-18 13:03:01 5608 2 Status: Resolving address of majorchooser.info     2012-03-18 13:03:01 5608 1 Status: Connecting to 50.16.204.201:21...     2012-03-18 13:03:01 5608 2 Status: Connecting to 50.16.204.201:21...     2012-03-18 13:03:01 5608 1 Status: Connection established, waiting for welcome message...     2012-03-18 13:03:01 5608 2 Status: Connection established, waiting for welcome message...     2012-03-18 13:03:02 5608 1 Response: 220 (vsFTPd 2.2.2)     2012-03-18 13:03:02 5608 1 Command: USER majorchooser     2012-03-18 13:03:02 5608 1 Response: 331 Please specify the password.     2012-03-18 13:03:02 5608 1 Command: PASS ***********     2012-03-18 13:03:02 5608 1 Response: 230 Login successful.     2012-03-18 13:03:02 5608 1 Command: OPTS UTF8 ON     2012-03-18 13:03:03 5608 1 Response: 200 Always in UTF8 mode.     2012-03-18 13:03:03 5608 1 Status: Connected     2012-03-18 13:03:03 5608 1 Status: Starting upload of D:\websites\tedxnanjing-online\wp-admin\admin-ajax.php     2012-03-18 13:03:03 5608 1 Command: CWD /test-ftp/wp-admin     2012-03-18 13:03:03 5608 1 Response: 550 Failed to change directory.     2012-03-18 13:03:03 5608 1 Command: CWD /test-ftp     2012-03-18 13:03:04 5608 1 Response: 250 Directory successfully changed.     2012-03-18 13:03:04 5608 1 Command: MKD wp-admin     2012-03-18 13:03:04 5608 1 Response: 257 "/test-ftp/wp-admin" created     2012-03-18 13:03:04 5608 1 Command: CWD /test-ftp/wp-admin     2012-03-18 13:03:05 5608 1 Response: 250 Directory successfully changed.     2012-03-18 13:03:05 5608 1 Command: PWD     2012-03-18 13:03:05 5608 1 Response: 257 "/test-ftp/wp-admin"     2012-03-18 13:03:05 5608 1 Status: Retrieving directory listing...     2012-03-18 13:03:05 5608 1 Command: TYPE I     2012-03-18 13:03:06 5608 2 Response: 220 (vsFTPd 2.2.2)     2012-03-18 13:03:06 5608 2 Command: USER majorchooser     2012-03-18 13:03:06 5608 2 Response: 331 Please specify the password.     2012-03-18 13:03:06 5608 2 Command: PASS ***********     2012-03-18 13:03:07 5608 1 Response: 200 Switching to Binary mode.     2012-03-18 13:03:07 5608 1 Command: PASV     2012-03-18 13:03:07 5608 2 Response: 230 Login successful.     2012-03-18 13:03:07 5608 2 Command: OPTS UTF8 ON     2012-03-18 13:03:07 5608 1 Response: 227 Entering Passive Mode (50,16,204,201,4,186).     2012-03-18 13:03:07 5608 1 Command: LIST -a     2012-03-18 13:03:07 5608 2 Response: 200 Always in UTF8 mode.     2012-03-18 13:03:07 5608 2 Status: Connected     2012-03-18 13:03:07 5608 2 Status: Starting upload of D:\websites\tedxnanjing-online\wp-admin\admin-footer.php     2012-03-18 13:03:07 5608 2 Command: CWD /test-ftp/wp-admin     2012-03-18 13:03:07 5608 2 Response: 250 Directory successfully changed.     2012-03-18 13:03:07 5608 2 Status: Retrieving directory listing...     2012-03-18 13:03:08 5608 1 Response: 150 Here comes the directory listing.     2012-03-18 13:03:08 5608 1 Response: 226 Directory send OK.     2012-03-18 13:03:08 5608 1 Command: TYPE A     2012-03-18 13:03:08 5608 2 Command: TYPE A     2012-03-18 13:03:09 5608 1 Response: 200 Switching to ASCII mode.     2012-03-18 13:03:09 5608 1 Command: PASV     2012-03-18 13:03:09 5608 2 Response: 200 Switching to ASCII mode.     2012-03-18 13:03:09 5608 2 Command: PASV     2012-03-18 13:03:09 5608 1 Response: 227 Entering Passive Mode (50,16,204,201,5,251).     2012-03-18 13:03:09 5608 1 Command: STOR admin-ajax.php     2012-03-18 13:03:09 5608 2 Response: 227 Entering Passive Mode (50,16,204,201,4,185).     2012-03-18 13:03:09 5608 2 Command: STOR admin-footer.php     2012-03-18 13:03:13 5608 1 Response: 150 Ok to send data.     2012-03-18 13:03:19 5608 2 Response: 150 Ok to send data.     2012-03-18 13:03:22 5608 1 Response: 226 Transfer complete.     2012-03-18 13:03:22 5608 1 Status: File transfer successful, transferred 49,808 bytes in 13 seconds     2012-03-18 13:03:22 5608 1 Status: Starting upload of D:\websites\tedxnanjing-online\wp-admin\admin-functions.php     2012-03-18 13:03:22 5608 1 Command: PASV     2012-03-18 13:03:23 5608 1 Response: 227 Entering Passive Mode (50,16,204,201,7,142).     2012-03-18 13:03:23 5608 1 Command: STOR admin-functions.php     2012-03-18 13:03:24 5608 1 Response: 150 Ok to send data.     2012-03-18 13:03:39 5608 2 Error: Connection timed out     2012-03-18 13:03:39 5608 2 Error: File transfer failed     2012-03-18 13:03:39 5608 2 Status: Resolving address of majorchooser.info     2012-03-18 13:03:40 5608 2 Status: Connecting to 50.16.204.201:21...     2012-03-18 13:03:40 5608 2 Status: Connection established, waiting for welcome message...     2012-03-18 13:03:41 5608 2 Response: 220 (vsFTPd 2.2.2)     2012-03-18 13:03:41 5608 2 Command: USER majorchooser     2012-03-18 13:03:41 5608 2 Response: 331 Please specify the password.     2012-03-18 13:03:41 5608 2 Command: PASS ***********     2012-03-18 13:03:42 5608 2 Response: 230 Login successful.     2012-03-18 13:03:42 5608 2 Command: OPTS UTF8 ON     2012-03-18 13:03:42 5608 2 Response: 200 Always in UTF8 mode.     2012-03-18 13:03:42 5608 2 Status: Connected     2012-03-18 13:03:42 5608 2 Status: Starting upload of D:\websites\tedxnanjing-online\wp-admin\admin-footer.php     2012-03-18 13:03:42 5608 2 Command: CWD /test-ftp/wp-admin     2012-03-18 13:03:43 5608 2 Response: 250 Directory successfully changed.     2012-03-18 13:03:43 5608 2 Status: Retrieving directory listing...     2012-03-18 13:03:43 5608 2 Command: TYPE I     2012-03-18 13:03:43 5608 2 Response: 200 Switching to Binary mode.     2012-03-18 13:03:43 5608 2 Command: PASV     2012-03-18 13:03:44 5608 2 Response: 227 Entering Passive Mode (50,16,204,201,5,79).     2012-03-18 13:03:44 5608 2 Command: LIST -a     2012-03-18 13:03:45 5608 1 Error: Connection timed out     2012-03-18 13:03:45 5608 1 Error: File transfer failed


title: ~ is $HOME, but sometimes?

text: This is kind of a trivial and dumb question.               cd ~      does the same thing as               cd $HOME      which is also the same as               cd /home/tandu      However,               cd ~not-tandu      changes to `/home/not-tandu` Is this purely a syntactic choice? How is this handled by the kernel (or the `cd` execuable?) Is there a special case for `~` to add the slash if everything else is omitted? That is to say, `~/` and `~` change to the same directory, but `~a` is one directory up. The same cannot be said for any other directory you change to.


title: programming an Atmel Board with a USB to Serial converter, in Eclipse

text: I am actually trying to program an `Atmel Evk1100` board directly from Mac OSX. My MCU is `UC3A0512` I used to use Atmel32 Studio on Windows, but It looks like there no Mac Version. So, from what I've found on Internet, I've downloaded `PL2303` driver to works with my `Manhattan 205146 USB to Serial converter`. Once the driver is installed, I tried it directly in `ZTerm` and It works without any problem with my board. I would be able to Build project and to burn it on my board. I've installed `Avrdude` and`Avr Eclipse Plugin` and `AVR32 Studio plugin`, directly from my Eclipse Juno Marketplace. Avrdude is installed here:               $ which avrdude     /usr/local/CrossPack-AVR/bin/avrdude      So I changed the Eclipse Toolpath to works with avrdude. But, I have this error in Eclipse: ![eerror message](http://i.stack.imgur.com/4F33p.jpg) Also, directly from avrdude, I am not able to communicate with my board. I do:               $ avrdude -c usbtiny -p ucr2      where `ucr2` is the value I got from Avrdude corresponding to: ![avr dude](http://i.stack.imgur.com/uxy79.jpg) Bu I get this error, if I check my Environnement:               avrdude: Error: Could not find USBtiny device (0x1781/0xc9f)          avrdude done.  Thank you.      Guys, how can I program my board, directly with Eclipse and my USB to Serial cable, my board? Is it possible?


title: How does a unix or linux system work?

text: I would like to know how the OS works _in a nutshell_ :   * The basic components it's built upon   * How those components work together   * What makes unix UNIX   * What makes it so different from other OSs like Windows


title: Renew IP with dhclient on different interfaces

text: I have two interfaces on my computer, `eth0` and `eth1`. Both subnets have a DHCP server on them. How could I use `dhclient` to renew IP address for both interfaces? If I do:               dhclient -r && dhclient eth0      It renews the IP on `eth0`. Then, if I want to just do:               dhclient eth1      It fails with error:               dhclient(22421) is already running - exiting.      I can do:               dhclient -r && dhclient eth1      But the `dhclient -r` part releases the lease and I loose the IP address on `eth0` as well. For now, the only way I've managed to do what I want is to run `dhclient` for `eth0`, brutally kill it, and run it on `eth1`: I end up with a renewed IP on both interfaces. I also tested with `dhclient -x` instead of `dhclient -r`, no luck. Surely, this is not the way to go! EDIT: Two answers suggested doing `dhclient -r eth0 eth1 && dhclient eth0 eth1` This, indeed, limits the broadcast calls to these interfaces. But the first DHCP server to answer will be the only one used, hence resulting in a new IP on a single interface and not both. See here, we can see `DHCPDISCOVER` calls on both interfaces, but the `DHCPREQUEST` is only done on `eth0`, first interface through which a DHCP server was found:               Listening on LPF/eth0/0a:00:27:00:00:00     Sending on   LPF/eth0/0a:00:27:00:00:00     Listening on LPF/eth1/84:8f:69:d3:d4:a1     Sending on   LPF/eth1/84:8f:69:d3:d4:a1     Sending on   Socket/fallback     DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 5 (xid=0x170fcb67)     DHCPDISCOVER on eth1 to 255.255.255.255 port 67 interval 4 (xid=0x115a24c3)     DHCPREQUEST on eth0 to 255.255.255.255 port 67 (xid=0x170fcb67)     DHCPOFFER from 192.168.1.1     DHCPACK from 192.168.1.1 (xid=0x170fcb67)     bound to 192.168.1.4 -- renewal in 1710 seconds.


title: extract a file from jar file and get the diff

text: In real world I have a xsd in a jar file across various releases I am trying to check whether xsd has changed across releases 10.x.y.z to 11.a.b.c I have different release directories which are read only like below in some /m/n/i/10.x.y.z or 11.x.y.z. I want to search for abc.jar which can be buried in my release directory 10.x.y.z or 11.x.y.z in some p/q/r/abc.jar across all those releases and extract xyz.xsd from them and do a diff between them?Also i do not have write permission to the release directories. How can I achieve it in Unix or shell script? I'm new to Unix. Directory structure               .     |-- 10.1.2.2.0     |   `-- GENERIC     |       `-- RELEASE               --  x/y/z/abc.jar     |-- 10.1.2.3.0     |   `-- GENERIC     |       `-- RELEASE               -- x/y/z/abc.jar     |-- 10.1.3.1.0     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.3.0     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.3.0-HOTPLUG     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.3.0BPA     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.3.0WEBSPHERE     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.3.1     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.4.0     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.4.0MLR1     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.4.0MLR10     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.4.0MLR2     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.4.0MLR3     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.4.0MLR4     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.4.0MLR5     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.4.0MLR6     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.4.0MLR7     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.4.0MLR8     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.4.0MLR9     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.5.0     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.5.0.QA.06012009     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.5.1     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.5.2     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.5.3     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3QAMLR6     |   `-- GENERIC     |       `-- RELEASE     |-- 11.1.1.1.0     |   `-- GENERIC     |       `-- RELEASE     |-- 11.1.1.1.0.BPA     |   `-- GENERIC     |       `-- RELEASE     |-- 11.1.1.1.0.CEP     |   `-- GENERIC     |       `-- RELEASE     |-- 11.1.1.2.0     |   `-- GENERIC     |       `-- RELEASE     |-- 11.1.1.3.0     |   `-- GENERIC     |       `-- RELEASE     `-- 11.1.1.4.0         `-- GENERIC             `-- RELEASE          93 directories, 0 files


title: Fedora 18. Centering activities on one monitor

text: I've recently installed Fedora 18 and the only gripe I have so far is that everything is spread between two monitors. Example: The date is currently half on one monitor, half on the other. I get 'Thu Apr 2' on one and '5, 11:16' on the other. Along with that, the activities panel is spread between both as well.


title: Is it possible to find the path of a running program?

text: I have a `xmms2d` process running, but two possible executable files (in different directories, both in the executable path) that could have spawned it. I suspect that one of those is corrupted, because sometimes this program works and sometimes it doesn't. The process running now works, so I want to delete (or rename) the other one. `ps ax|grep "xmms"` returns `8505 ? SLl 2:38 xmms2d -v` without path information. Given the PID, could I find whether it was run from `/usr/bin/xmms2d` or `/usr/local/bin/xmms2d`? Thanks!


title: How enable watchdog?

text: I'm struggling with the watchdog timer (wdt) for a while. I can't get it working. My microcontroller is a AriaG25, based on the AT91SAM925. I have used this tutorial to compile the kernel. The kernel settings related to the wdt looks like this:               CONFIG_WATCHDOG=y            CONFIG_AT91SAM9X_WATCHDOG=y         The kernel has been compiled without problem and boots succesfully. I've installed the watchdog deamon software via `apt-get`. And now I'm stuck. How do I get the watchdog working? I read a lot about `/dev/watchdog`. I don't have that file. Do I have to put the driver for my hardware there? Is this a driver?


title: How to upload tcpdumps in realtime to FTP?

text: I can do tcpdumps with this command:               tcpdump -w `date +%F-%Hh-%Mm-%Ss-%N`.pcap src 10.10.10.10 or dst 10.10.10.10      **Q** : I have an FTP server with username: FTPUSER and password FTPPASSWORD. How can I upload the tcpdump in "real time" I mean I don't have a too big storage to store the dumps, so I need to upload it to a place what I can only reach via FTP. Can I " **pipe** " somehow the output of the tcpdump to an ftp client that uploads it? [I need to preserve the filenames too: "`date +%F-%Hh-%Mm-%Ss-%N`.pcap"] so I'm searching for a solution that doesn't store any tcpdumps locally, rather it uploads the dumps in "real-time". The OS is OpenWrt 10.03 - the router where the tcpdump runs. [4MB flash on the router, that's why I can't store them locally.] UPDATE2: there is no SSH connection to the FTP server, just FTP [and FTPES, but that doesn't matter now I think]


title: Stracing su and ssh shows the password. Is this a security flaw or am I missing something?

text: I'm currently fascinated by `strace` so, being new to it, I decided to play around a little. As suggested by the question title, I tried both `strace su` and `strace ssh`. Both commands displayed the password I typed in the strace output. `su` kept complaining of an incorrect password while `ssh` managed to log in normally.   My questions:   * Is this a security flaw or am I missing something?    * Is `su` reporting an incorrect password as a security measure because it detected it was being run through `strace`? If so how can it tell that it's being invoked through `strace`? Does it check `/proc/self/cmdline` maybe?   * How much damage can be caused by something like   `alias su="strace -o /tmp/output.log su"`


title: Run script on screen lock/unlock

text: I'd like to run a screen if the Gnome session is locked and unlocked. Is there a way that I can intercept this and perform certain actions when the desktop is locked or unlocked?


title: How does Linux deal with a separate /boot partition?

text: I am interested to learn about how Linux deals with a separate boot partitions. I am **not** interested in actually doing this, but I would like to know how this works under-the-hood. Consider a hard drive `sda`, which has two partitions `sda1` and `sda2`. Let's say that `sda2` is the `root` partition `/` which contains the Linux OS. My understanding is that the bootloader `GRUB2`, is mounted to `/boot`. When the directory `/boot` is on a separate partition `sda2`, however, how is it that this can happen before `/` is actually mounted? How does the interaction between the BIOS, the Master boot record and GRUB (or the files `/boot`) successfully happen in this case? Is it that the data in `/boot` is not actually mounted to the `/` filesystem at this early stage? Note: this question deals with mounting the root partition, but does not discuss a separate boot partition.


title: Other than a kill command or a system kill(pid, signal) command, what can cause a SIGKILL to occur for a process?

text: My process is mysteriously getting a SIGKILL on AIX. Running trace on the system indicated the process got a signal sent by itself via the kill(pid, SIGNAL) system call. I checked my code and I don't have any explicit call that does this. I'm beginning to think if it's possible that a system call I made or a call to Oracle could possibly result on a getting a SIGKILL back. Since the process made the call, if the SIGKILL occurs as the call is made, it would appear that the process issued the SIGKILL to itself. What can cause the SIGKILL in this case?


title: Installation instructions for HP 7 tablet (also called 'Mesquite')

text: I'm looking at the HP 7 at Walmart (http://www.walmart.com/ip/HP-7-Tablet- Intel-Atom-Processor-with-8GB-Memory-featuring-Android-4.1-Jelly- Bean/27618120), but I don't want to purchase it unless I can install linux on it (ie: not chroot). Has anyone successfully installed a linux distro on it? If so, how? I'm assuming it's EFI, but confirmation would help.


title: FreeBSD Ports Broken -- Python Issue? Portmaster -a

text: Upgraded FreeBSD from 8.2 >> 8.4 >> 10.0-RELEASE today. In the process, I believe I have mangled my ports tree quite badly and am having issues upgrading/reinstalling ports (as the upgrade asks me to do). As stands, I think it may have something to do with Python but I'm not sure where to go from here. Upgrading ports fails here.               #portname -a          ===>>> Port directory: /usr/ports/lang/python2          make: "/usr/ports/Mk/bsd.python.mk" line 558: Malformed conditional (${PYTHON_REL} >= 320 && defined(PYTHON_PY3K_PLIST_HACK))     make: Fatal errors encountered -- cannot continuemake: "/usr/ports/Mk/bsd.python.mk" line 558: Malformed conditional (${PYTHON_REL} >= 320 && defined(PYTHON_PY3K_PLIST_HACK))     make: Fatal errors encountered -- cannot continue===>>> Launching 'make checksum' for lang/python2 in background     make: "/usr/ports/Mk/bsd.python.mk" line 558: Malformed conditional (${PYTHON_REL} >= 320 && defined(PYTHON_PY3K_PLIST_HACK))     make: Fatal errors encountered -- cannot continue      More info:               # less /etc/make.conf     # added by use.perl 2014-01-27 15:35:31     PERL_VERSION=5.10.1     WITH_PKGNG=yes          # python -V     Python 2.6.6          # uname -a     FreeBSD herp.derp.herp l 10.0-RELEASE FreeBSD 10.0-RELEASE #0 r260789: Thu Jan 16 22:34:59 UTC 2014     root@snap.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64


title: How to make wget download recursive combining --accept with --exclude-directories?

text: I'm trying to download some directories from an Apache server, but I need to ignore some directories that have huge files I don't care about The dir structure in the server is somewhat like this (simplified):               somedir/     ├── atxt.txt     ├── big_file.pdf     ├── image.jpg     └── tmp         └── tempfile.txt      So, I want to get all the `.txt` and `.jpg` files, but I DON'T want the `.pdf` files nor anything that is in a `tmp` directory. I've tried using `\--exclude-directories` together with `\--accept` and then with `\--reject`, but in both attempts it keeps downloading the `tmp` dir and its contents. These are the commands I've tried:               # with --reject     wget -nH --cut-dirs=2 -r --reject=pdf --exclude-directories=tmp \              --no-parent  http://<host>/pub/somedir/          # with --accept     wget -nH --cut-dirs=2 -r --accept=txt,jpg --exclude-directories=tmp \              --no-parent  http://<host>/pub/somedir/      Is there a way to do this? How exactly is `\--exclude-directories` supposed to work?


title: How to add an audio file to a shell script

text: How can I add an audio file (OGG vorbis) into a shell script making the script as small as possible and at the same time being able to execute it on as most systems as possible? I want the audio file be played. I don’t want it to be `uuencode`d, because sharutils are not installed on many systems. base64 is nice, but makes the file/script bigger, which I don’t want. Should I use `mplayer` or the `play` command from the sox package? Is it more common on Linux/BSD systems? Or is there another media player mostly installed? Should I convert the audio file to another format/codec (if that doesn’t make the file much bigger) to have more possible players to play the file back or is OGG vorbis a good choice?


title: Installed Centos 7 after Windows and can't boot into Centos

text: I wanted to setup a dual boot for Windows 7 and Centos 7 I had a Windows 7 machine with 500GB disk. I shrank the Windows partition to provide space for Centos 7 (roughly 230GB). I created a USB Centos 7 netinstall stick and booted from that. I ran the install configured as best I knew to install Centos 7 into the free space (rather than over the whole disk). I did the net install and all seemed to go well but when it rebooted I was back into Windows and can't get into Centos. I've rebooted from the USB and tried to fix the situation (carefully) using cfdisk, e.g. selecting what I believe is the Centos boot partition but it reports "missing operating system." Also cfdisk says it can't reread the partition table when I write it with Centos boot but starting cfdisk again seems to show the flag has been set. Currently the USB Centos 7 netinstall shows me the following partitions on the disk: > DATA   >  /home 168GB centos-home   >  SYSTEM   >  /boot 500MB sda3   >  / 51GB centos-root   >  swap 3.85GB centos-swap The "other" Windows partitions are: > ntfs 100MB sda1   >  ntfs 253GB sda2 This looks ok BUT when I go into Centos 7 Installation again it is telling me I have to create mount points for the root partition. I didn't do this originally as I thought it would be done automatically when I clicked "Click here to create them automatically" for the disk setup the first time I installed. And the partition table accessed using cfdisk from "Rescue a Centos system..." looks like this: > Unusable 1MB   >  sda1 Primary ntfs 105MB   >  sda2 Primary ntfs 265GB   >  sda3 Boot Primary xfs 525MB   >  sda5 NC Logical LVM2_member 235GB   >  Logical Free space 0.03MB As mentioned, when I try to boot with this configuration I get "missing operating system." If I change the boot flag back to sda1 then it boots into Windows 7 fine. UPDATE: I (re)installed `grub2` using `grub2-install` from the netinstall on /dev/sda and now when I boot from the disk I get the `grub` prompt.   I can using it to chain load into Windows.   However, when I try to boot into CentOS 7 I get some sort of trace/dump. I use: `linux (hd0,msdos3)/vmlinuz-3... root=/dev/sda3` (which is I believe is the primary boot partition for CentOS) `initrd (hd0,msdos3/initrd-plymouth...` `boot` but it just crashes. UPDATE 2: I installed NTFS-3G and NTFSPROGS using Yum from the EPEL repository. I ran grub2-mkconfig -o /boot/grub2/grub.cfg and then rebooted to find Windows 7 (Loader) in the boot menu :-) But when I choose it I get: error: no such device 978778... error: hd1 cannot get C/H/S values.... which doesn't sound very good at all, but at least some progress. I should also say that I now have Centos 7 only on the internal drive and I am working on this drive as an external USB drive (hence /dev/sdb). Thanks to the commenters. Can someone please help me to get Windows to boot? I have a Unix background but mostly use Mac OS X. I always come unstuck on setting up Windows and Linux dual boot. PS I have Centos 6.5 system running fine on another machine, as well as my Mac.


title: How to correctly add a path to PATH?

text: I'm wondering where a new path has to be added to `PATH` environment variable. I know this is accomplished editing `.bash_rc` (for example), but it's not clear how to do this. This way:               export PATH=~/opt/bin:$PATH      or this?               export PATH=$PATH:~/opt/bin      Question 2 (related). What's a workable way to append more paths on different lines? Initially I thought this could do the trick:               export PATH=$PATH:~/opt/bin     export PATH=$PATH:~/opt/node/bin      but it doesn't because the second assignment doesn't only append `~/opt/node/bin`, but also the whole `PATH` previously assigned. This is a possible workaround:               export PATH=$PATH:~/opt/bin:~/opt/node/bin      but for readability I'd prefer to have one assignment for one path.


title: Setting PATH vs. exporting PATH in ~/.bash_profile

text: What's the difference and which is better to use when customizing my bash profile? Documentation on the `export` command is scarce, as it's a builtin cmd. Excerpt from version 1 of my ~/.bash_profile:               #PATH     export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:$HOME/bin          #add Homebrew’s sbin to PATH     export PATH=/usr/local/sbin:$PATH      Output from: `echo $PATH` `/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/njboot/bin` Excerpt from version 2:               #PATH     PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:$HOME/bin          #add Homebrew’s sbin to PATH     export PATH=/usr/local/sbin:$PATH      Output from `echo $PATH` is the same as in version 1. `env` is the same as well. So:   * 1) What's the benefit of using `export` vs. setting PATH explicitly?   * 2) Is there any functional difference between version 1 and version 2 when applied?   * 3) Which should I use and why?


title: Path is there, but cannot call one program without specifying path

text: > **Possible Duplicate:**   >  How to correctly add a path to PATH? I installed "perf" on Linux. But I can only use it by specifying the path: `~/bin/perf` I checked path by using `echo` and I found `/bin` is there. What else should I do?


title: Program installed to `/home/username/bin` and added to path... not launching

text: I just installed newer versions of `grep` and `vim` to my local `~/bin` directory. I have the path added via `PATH=$PATH:$HOME/bin` in my `.bash_profile`. When I try to run either, the version installed in `/usr/local/bin` launches. How do I override this?


title: Cant get remote access to PostgreSQL

text: There is PostgreSQL 9.2 in Debian. My `/etc/postgresql/9.2/main/postgresql.conf` file contains:               listen_addresses = '127.0.0.0, 212.49.109.137'     password_encryption = on      '212.49.109.137' is the IP of the computer running PostgreSQL. `/etc/postgresql/9.2/main/pg_hba.conf` contains:               host    all         all        85.12.201.202         255.255.255.0  md5      85.12.201.202 is the IP address of the client that tries to connect. I try to connect using:               psql -h 212.49.109.137 -U postgres -d postgis_template      And get error:               psql: could not connect to server: Timeout     Is the server running on host "212.49.109.137" and accepting     TCP/IP connections on port 5432?      In `netstat -pln` i see:               tcp        0      0 127.0.0.0:5432          0.0.0.0:*               LISTEN      5127/postgres


title: Must pass urls in quotes

text: I'm trying pass a URL to `mpv` for it to play it as a network stream. This can be done in `bash` with the following syntax:               $ mpv http://myvideosite.com      However, `zsh` wants to evaluate the URL as (presumably) a file path. Running               % mpv http://myvideosite.com      gets the following response:               zsh: no matches found: http://myvideosite.com      and a return code of 1. Running               % mpv "http://myvideosite.com"      executes as expected. Does `zsh` not treat arguments as strings?


title: Hard disk drive spins up on laptop sleep/wake, can I stop it doing this?

text: I have in my Arch Linux-running laptop an SSD and an HDD; the latter I use seldom. It is mounted as /mnt/sdb5 and configured to spin down proactively when on battery (`/etc/default/tlp`, `DISK_APM_LEVEL_ON_BAT` has the value 1 for sdb). However, the disk spins up in two situations which I would rather it didn’t:   * When I suspend the machine, it spins up and them promptly down again. I can’t for the life of me imagine why it would do this when I haven’t even touched the drive since it was mounted.   * When I wake the machine, it spins up. Perhaps it is making sure it’s there or some such thing? (It also spins up at boot time, but that I understand. Of course it must read the partition table.) Can I avoid these spin-ups without removing the hard disk drive? I’m quite willing to only mount it when I want to use it or such things.


title: service red5 restart FAILED

text: Works to start and stop but not to restart: > >     -bash-4.1# service red5 restart >        Shutting down red5:                              [FAILED] >   It was all working before had to delete red5 and JDK and reinstall and now this is happening. Have no clue why. On Linux CentOS 6


title: grepping foo and bar

text: I am looking for a command options for `grep` to find files with the occurences of `foo` and `bar`. Grepping with               grep -r -e foo -e bar .      shows files which have only `foo` or only `bar` and files which have `foo` and `bar`. Is it possible with `grep` to find only files which have both `foo` and `bar` (and display the lines that match either `foo` or `bar` or both in those files _only_ )? Example:               echo foo > file1     echo bar > file2     (echo foo;echo;echo bar) >file3     echo barfoo > file4      the grep cmd:               grepcmd -r -e foo -e bar .     ./file3:foo     ./file3:bar     ./file4:barfoo


title: Fast Way to Randomize HD?

text: I've read about how to make hard drives secure for encryption, and one of the steps is to write random bits to the drive, in order to make the encrypted data indistinguishable from the rest of the data on the hard drive. However, when I tried using `dd if=/dev/urandom of=/dev/sda` in the past, the ETA was looking to be on the order of days. I saw something about using `badblocks` in lieu of urandom, but that didn't seem to help a whole lot. I would just like to know if there are any ways that might help me speed this up, such as options for `dd` or something else I may be missing, or if the speed is just a limitation of the HD.


title: How to use regex as field separator in awk?

text: I'm trying to use regex as a field seperator in `awk`. From my reading this seems possible but I can't get the syntax right.               rpm -qa | awk '{ 'FS == [0-9]' ; print $1 }'     awk: cmd. line:1: { FS     awk: cmd. line:1:     ^ unexpected newline or end of string      Thoughts? The goal if not obviouse is to get a list of software without version number.


title: How to use the -t option of Unix command look

text: I'm learning the `look` utility and I don't understand the meaning of the `-t` option. Can someone show me some examples of it? I read the `man` page, but still don't know what it exactly means.


title: How to create an unprivileged user in CentOS?

text: I want to create an unprivileged user to run my RhodeCode server and Celery daemon on a CentOS instance. I think the accepted definition of this is no home directory, login disabled, and no shell access? Looking over the man page for adduser I just don't see an intuitive method for doing this. Any suggestions are appreciated. Thanks.


title: Rename Multiple files and add date before the files

text: I have a folder contains one or more tar.gz files. I want to add current date before each files when the script run. For example: Two file name(those files will be created each day, but the name will remain the same):               file1.tar.gz      file2.tar.gz      In first day(2011-10-07), those two files will be renamed to:               2011-10-07_file1.tar.gz     2011-10-07_file2.tar.gz      In next day(2011-10-08), they are changed to:               2011-10-08_file1.tar.gz     2011-10-08_file2.tar.gz      Finally, the folder contains the following files:               2011-10-07_file1.tar.gz     2011-10-07_file2.tar.gz     2011-10-08_file1.tar.gz     2011-10-08_file2.tar.gz      How to achieve this using one line? I tried to use "rename" command, but I can only add the date after the file, not before. ## My code               cdate=`date +"%Y-%m-%d"`; rename .gz .gz.$cdate *.gz


title: If ^a^b replaces "a" once in the last command, what do I use to replace all occurrences of "a"?

text: In bash, if I run this command:               echo aaaaaaa      I get `aaaaaaa` (duh) But then if I type in               ^a^b      I end up with `baaaaaa` What would I type to end up with `bbbbbbb` ?


title: Simulate keyboard input in bash OR stdin redirection where stdin remains visible

text: I was wondering if I could redirect a file to the stdin of a program so that I could actually see the lines of the file as they're being used. Suppose I have a CLI program with the following flow (in a loop): A) Computer asks question B) User answers it C) Computer responds Running this interactively yields output (which can be copied and pasted from the terminal) that intermixes user answers with computer generated text. I need to get the same result for a situation where the program is run non- interactively and where the answers are predefined in a file. Running program Is there a way to get the same kind of text that would appear on the terminal screen of such a program run interactively?


title: After researching, still confused about monitoring RAM usage

text: I went through this article, which explains various methods for checking your RAM usage. However, I can't reconcile the different methods and don't know which one is correct. When I first login, I'm greeted with a screen like this:                 System information as of Sun Apr 28 21:46:58 UTC 2013            System load:  0.0               Processes:           76       Usage of /:   15.6% of 7.87GB   Users logged in:     1       Memory usage: 41%               IP address for eth0:        Swap usage:   0%      This suggests to me that I am using 41% of my RAM, which seems quite high since the server isn't doing much. Or does that number refer to something besides RAM? Next I try the `free -m` method:               ubuntu@ip-:~$ free -m                  total       used       free     shared    buffers     cached     Mem:           590        513         76          0         67        315     -/+ buffers/cache:        130        459     Swap:            0          0          0      According to the explanatory graphic in the article, this implies I have 130MB of used RAM and 459MB of free RAM, which suggests I'm using about 22% of my RAM. Next I run `top`:               top - 22:14:48 up 195 days, 21:30,  2 users,  load average: 0.00, 0.01, 0.05     Tasks:  77 total,   1 running,  76 sleeping,   0 stopped,   0 zombie     Cpu(s):  1.3%us,  0.3%sy,  0.0%ni, 97.7%id,  0.7%wa,  0.0%hi,  0.0%si,  0.0%st     Mem:    604376k total,   525692k used,    78684k free,    69124k buffers     Swap:        0k total,        0k used,        0k free,   322740k cached            PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                     1 root      20   0 24332 1864  976 S  0.0  0.3   0:08.75 init                        2 root      20   0     0    0    0 S  0.0  0.0   0:00.00 kthreadd           This is the most confusing, as the summary shows me using 525MG of 604M total, and yet when is use the "m" interactive command to sort by top memory the top process is only using 0.3% of the memory??? Finally, the `ps` command seems to show very little memory usage as well:               root@ip-:/home/ubuntu# ps -o command,rss     COMMAND                       RSS     ps -o command,rss             788     sudo su root                 1764     su root                      1404     bash                         2132      I would love for someone to correct whatever misunderstandings I have that are creating these apparent conflicts. Thanks! ### EDIT for Rahul Ouput of `cat /proc/meminfo`:               MemTotal:         604376 kB     MemFree:          157564 kB     Buffers:           49640 kB     Cached:           231376 kB     SwapCached:            0 kB     Active:           290040 kB     Inactive:          97772 kB     Active(anon):     107672 kB     Inactive(anon):     4844 kB     Active(file):     182368 kB     Inactive(file):    92928 kB     Unevictable:           0 kB     Mlocked:               0 kB     SwapTotal:             0 kB     SwapFree:              0 kB     Dirty:                52 kB     Writeback:             0 kB     AnonPages:        106836 kB     Mapped:            22920 kB     Shmem:              5712 kB     Slab:              42032 kB     SReclaimable:      34016 kB     SUnreclaim:         8016 kB     KernelStack:         688 kB     PageTables:         3584 kB     NFS_Unstable:          0 kB     Bounce:                0 kB     WritebackTmp:          0 kB     CommitLimit:      302188 kB     Committed_AS:     242768 kB     VmallocTotal:   34359738367 kB     VmallocUsed:        7152 kB     VmallocChunk:   34359729008 kB     HardwareCorrupted:     0 kB     AnonHugePages:         0 kB     HugePages_Total:       0     HugePages_Free:        0     HugePages_Rsvd:        0     HugePages_Surp:        0     Hugepagesize:       2048 kB     DirectMap4k:      637952 kB     DirectMap2M:           0 kB


title: Why is the UNIX kernel so crucial?

text: More specifically, how is the UNIX kernel treated differently from other parts of the Operating System?


title: Scripting to domain allocation to server

text: I have two text files: **file #1:** domain.txt               cocacola.com     airtel.com     pepsi.com      **file #2:** servers.txt               192.0.53.42 , 4    # 4 domains already allocated on server 192.0.53.42     192.53.1.2 , 1     # 1 domains already allocated on server 192.53.1.2     192.36.155.21 , 2  # 2 domains already allocated on server  192.36.155.21      I need to write a script, which will allocate each domain (one by one from top to bottom from `domains.txt`) to the server (to `server.txt`) which has the minimum load at a given instant (if there is a tie in minimum load then the the server is allocated with FCFS). Finally I want to write a script to do as above then create a new file with modifications named: `allocation.txt`. In the above example `allocation.txt` as a output will have (after execution of script):               192.0.53.42 , 4     192.53.1.2 , 3 , cocacola.com , airtel.com     192.36.155.21 , 3 , pepsi.com      I am a newbie to scripting, and would appreciate any help/guidance! What would be your basic approach to solving this problem? Can all this be accomplished by one script?


title: File not found: Beautiful Soup

text: I am trying to run a program that I downloaded in Ubuntu latest version, but I continue getting an error everytime I try to run the program. It says:               File Not Found: BeautifulSoup      So in order to attempt to fix this, I've downloaded the bs4 beautiful soup package through the command line. I've tried running `python`, and then importing it by doing, `from bs4 import BeautifulSoup`. I have tried many different variations of this and downloading and redownloading it. I've tried running the `from bs4 import BeautifulSoup` directly from the terminal, but that did not work and returned an error. Does anyone know anyway to fix this issue or what I need to do?


title: Why is the following script not working?

text: I wrote the following script for finding the number of pdf and tex files from the current directory, including the subdirectories and hidden files. The following code is able to find the number of pdf files upto 2 levels of subdirectories below, but after that it tells that there are no sub directories....               #!/bin/bash          touch t.txt          k=`find -type d |wc -l`     k1=`expr $k - 1`          echo $k1          message1="*.pdf *.tex"     count=`ls -al $message1|wc -l`     find -type d > t.txt          i=2          while [ $i -le $k ]     do         kd=`head -$i t.txt|tail -1`         echo $kd         touch $kd/t.txt         cp t.txt $kd/t.txt         i=`expr $i + 1`     done          i=2     while [ $i -le $k ]     do         nd=`head -$i t.txt|tail -1`         set -x         echo $nd         set +x         cd $nd         j=`ls -al $message1|wc -l`         count=`expr $count + $j`         i=`expr $i + 1`     done     #set +x          echo $count


title: conditional expression and expansion

text: I don't seem to understand how to "test" the conditional operators [[ and [. I tried using various form such as               echo [[a=a]]          [[a=a]]     echo $?      and some other things I want to see what they return, to test some comparisons. How do you expand them, or execute them?


title: Truncating log from first line

text: I am making a simple IRC bot in bash and I want prevent its log from growing to infinity. For example it could be shortened always when reaching set number of lines. How can I do that easily? For example by cutting the file with removing first line(s)? If possible, I would like to avoid sed/awk this time :)


title: is setting a 0 permission on a directory an effective way to protect its contents?

text: Let's say that permissions for `user` and `group` are set up correctly on a directory. Would a 0 permission for `other` on that directory provide effective access control for the directory's files and subdirectories? Are there gotchas to consider? When you create files that are `rw` to other people (like with Unix Domain Sockets) people think of it as a security issue, since there's a race condition that a malicious user can exploit before proper permissions are applied to a file. That's why I'm looking for an "atomic" way of doing basic permissioning.


title: grep seems to ignore --include

text: `man grep` says               grep [OPTIONS] PATTERN [FILE...]          . . .             --include=GLOB               Search  only  files whose base name matches GLOB (using wildcard               matching as described under --exclude).      So I typed               grep --include="*.html" 'li' *      to search for instances of `li` in HTML files in the current directory. Instead I get a list of every use of `li` anywhere in the directory, even in the non-HTML files. What am I doing wrong? I tried all kinds of variants like               grep --include=\*.html 'li' *      but without any luck.


title: Invert results for "for in * do"-loops

text: > **Possible Duplicate:**   >  How do I reverse a for loop? Is there an easy way to invert a for in loop? For a script I want to process files in their reverse order. So instead of:               for file in *.jpg;       do echo $file;     done      with the result               001.jpg     002.jpg     003.jpg     ...     150.jpg      I want the result               150.jpg     149.jpg     148.jpg     ...     001.jpg


title: How to stop CACHE instance from Shell Script

text: I want to restart CACHE(database that I am using) Instance from shell script. What I did is created a function in the shell script named resatrt_cache.               restart_cache()     {      ccontrol stop instancename restart     }      This command is running but the control goes to cache and while stopping cache it get stuck to this question               **Do you want to broadcast a message to anyone? No =>**      How can I pass the value here through shell script


title: To find file received time using find command in ssh server

text: Below command gives syntax error               fname1=abc.txt          tim=`find /path/ -type f -name $fname1 -ls|awk '{print $8$9$10}'`          Syntax Error The source line is 1.      The error context is                      >>> {print <<<      awk: 0602-502 The statement cannot be correctly parsed. The source line is 1.      Also tried to find file time of below command it also gives `printf` is not valid:               tim=`find /path/ -type f -name $fname1 -printf "%t"`


title: How to match date in Perl --- assuming UNIX regex is the same as Perl's

text: I want to match dates of the form               Monday May 26      My attempt to do this is the following:               /(.*day Jan.*|Feb.*|Mar.*|Apr.*|May|Jun.*|Jul.*|Aug.*|Sep.*|Oct.*|Nov.*|Dec.* [1-31])/      The regex form in UNIX and Perl seem to be the same, so this is why I ask it here.


title: How to exit file reading mode in linux terminal?

text: I appologize if its something really stupid i am asking. But this is my first day on linux commands infact I dotn have linux right now I have just installed CYGWIN for my learning. SO my question is I have display file contents using **less** command and now I am unable to exit that and to type some other commands like ![enter image description here](http://i.stack.imgur.com/E2c2H.png) I want to exit this mode to type some other commands. How can I do that.


title: Can't edit sources.list as root

text: I cannot edit/move/delete the `sources.list` file, despite being root. When I do `ls -la /etc/apt` it reports this:               root@nibelung:~# ls -la /etc/apt/     total 356     drwxr-xr-x   6 root root   4096 Feb 28 21:30 .     drwxrwxr-x 100 root root   4096 Feb 28 01:29 ..     -rw-r--r--   1 root root     98 Aug 24  2013 apt.conf     drwxr-xr-x   2 root root   4096 Feb 27 14:04 apt.conf.d     -rw-r--r--   1 root root    123 Feb 28 01:52 preferences     drwxr-xr-x   2 root root   4096 Feb 27 21:01 preferences.d     -rw-------   1 root root      0 Aug 24  2013 secring.gpg     -rw-r--r--   1 root root    878 Jan 24 19:30 sources.list     -rw-r--r--   1 root root      0 Sep 27 02:00 sources.list~     -rw-r--r--   1 root root    878 Feb 28 21:30 sources.list.bk     drwxr-xr-x   2 root root   4096 Feb 27 21:01 sources.list.d     -rw-------   1 root root   1200 Jan 24 15:03 trustdb.gpg     -rw-------   1 root root 158664 Jan 24 15:03 trusted.gpg     -rw-------   1 root root 158664 Jan 24 15:03 trusted.gpg~     drwxr-xr-x   2 root root   4096 Apr 15  2011 trusted.gpg.d


title: solaris + fit egrep for solaris

text: On Linux machines I use this syntax, in order to match all VALID ip's. My question: what needs to change for egrep command in order to run the egrep on Solaris? According to egrep manual page "-o" isn't a legal option. What is the alternative for Solaris?                    regex="(1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.(1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.(1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.(1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])"               egrep  -o  `echo $regex` file      example of file               32)5.500.5.5*kjcdr     ##@$1.1.1.1+++jmjh     1.1.1.1333     33331.1.1.1     @5.5.5.??????     ~3de.ede5.5.5.5     1.1.1.13444r54     192.9.30.174     &&^#%5.5.5.5     :5.5.5.5@%%^^&*     :5.5.5.5:     **22.22.22.22     172.78.0.1()*5.4.3.277


title: dig @nameserver doesn't work

text: I have Ubuntu 12.04 with BIND9, working just as a caching server (forwarding to 8.8.8.8). When I use, for example, `dig +norecurse @l.root-servers.net www.uniroma1.it`, I obtain the following output > ; <<>> DiG 9.8.1-P1 <<>> +norecurse @l.root-servers.net www.uniroma1.it > > ; (1 server found) > > ;; global options: +cmd > > ;; connection timed out; no servers could be reached Using Wireshark I discovered that the outgoing queries are correct, but there aren't any incoming answers. Why? P.S. Using simply `dig www.uniroma1.it` I obtain the correct answers.


title: Mount an loop file without root permission?

text: Can i mount a loop file without root permission , normally i do: `mount -o loop DISK_IMAGE FOLDER` Without setting up sudo or suid mount program , is there any suitable way to do this ? I know i can use fusermount with some iso images , but that is pretty limited , even for ISO images , some of my images can't be mounted , but `mount` always works


title: Why arguments in braces do not expand in this case?

text: For example, I want to put some file names inside braces for expansion like this:               $ ls     blue_texture  blue_waves  green_light     $ ls -m | tr -d ' \n'     blue_texture,blue_waves,green_light      $ echo foo/bar/{`ls -m | tr -d ' \n'`}     foo/bar/{blue_texture,blue_waves,green_light}      My question why doesn't brace expansion work here? I expected it to work as following:               $ echo foo/bar/{blue_texture,blue_waves,green_light}     foo/bar/blue_texture foo/bar/blue_waves foo/bar/green_light


title: How do I easily update list of md5sums?

text: Sometimes I use an unreliable medium (flash) to store a good deal of data. To at least recognise bit flips I store a file with the md5sums alongside. This file is usually created by a variation of `find -type f -exec "{}" \; >MD5SUM`. Later I copy some more files on it and now I would like to add the checksums of the new files without having to recalculate the old ones. Sadly, the time of some the machines I use are screwed, so using `find -newer <file> -exec md5sum "{}"\; >>MD5SUM` is not an option. Basically I would like to get the difference between the file list created by `find -type f` and the list in the MD5SUM file. Any ideas how to do this in an easy and elegant manner? Thanks in advance!


title: Resume input from user after file is read

text: I have a program that reads user input—moves, it's a boardgame—from the user. Like so:               $ game     enter your move:      # etcetera      The first _N_ moves I need to repeat each time, so I put them in a text file, one line each. That works:               $ game < moves.txt      This works, but after these _N_ moves, how do I return to input from the command line? I realize this is probably a duplicate question, but I couldn't find it.


title: selective stdout , stderr and logging using the script command

text: > **Possible Duplicate:**   >  Show only stderr on screen but write both stdout and stderr to file   >  stdout , stderr and logging using the script command cat test.sh:               rm -v foo.tmp     date     pwd      cat test2.sh:               script bar.log -c './test.sh'      When executing test2.sh I would like to see the following for example on my terminal:               Fri Feb 17 18:04:30 PST 2012       /home/me/me      However in bar.log I would like to see:               removed 'foo.tmp'       Fri Feb 17 18:04:30 PST 2012       /home/me/me      or (in case foo.tmp does not exist)               rm: cannot remove 'foo.tmp'       Fri Feb 17 18:04:30 PST 2012       /home/me/me      Is this doable?


title: Show only stderr on screen but write both stdout and stderr to file

text: How can I use BASH magic to achieve this?   I want to only see stderr output on the screen,   but I want both stdout and stderr to be written to a file. Clarification: I want both stdout and stderr to end up in the same file. In the order they happen.   Unfortunately none of the answers below does this.


title: What is `^M` and how do I get rid of it?

text: When I open the file in vim I am seeing strange `^M` characters. Unfortunately, the world's favorite search engine does not do well with special characters in queries, so I'm asking here:   * What is this `^M`?   * How could it have got there?   * How do I get rid of it?


title: How can I get to a terminal or virtual console when Ctrl-Alt-F2 fails?

text: When X and GNOME are working normally, I can just hit `Ctrl`-`Alt`-`F2` to leave GNOME and use the terminal on the second virtual console. To switch back to GNOME, I can just hit `Alt`-`F1`. Today, X or GNOME stopped working normally for me and I was unable to get to a virtual console. I was still able to move my mouse cursor around but I wasn't able to click anything. As far as I could tell, my keyboard was unresponsive, but maybe the right keyboard shortcut would have helped. I ended up pressing the power button on the computer to gracefully shut it down, but what could I have done to avoid this? I'm using CentOS 6.0 and GNOME 2.28.


title: Why does System V traditionally symlink /bin to /usr/bin?

text: This systemd wiki page about the /usr merge, under Myth #6, states that `/bin` has traditionally been a symlink to `/usr/bin` on System V UNIX. What is the motivation for this? For backwards compatibility it makes sense, but I don't understand why it was like this in the early days. (Or, am I misunderstanding? Did early UNIX versions distinguish between `/bin` and `/usr/bin`, and System V changed that by merging them?)


title: Pasting the content of xclip onto gedit

text: > **Possible Duplicate:**   >  Copy file to xclip and paste to Firefox I would use the following command to copy the output of `uptime` to the clipboard:               uptime | xclip      Then I can paste the copied uptime to the console by clicking the middle button of mouse. But when I go to an application like "gedit", there is no _Paste_ option available there. How can I copy a text into clipboard so that it could be pasted onto something like "gedit"?


title: Insert text in specific lines of a file?

text: How can insert some text in specific lines of a file? What is most simplest method that I can use? (bash, sed, awk?) What I want to do, might be simple, but I don't know where I should start. It's takes too much time for me to try to do this manually (I have very a lot of files that I have to change for Excel/Calc later use). Here is my input file example:               4.06     4.05     5.04     4.06     34.50     56.06     45.33     36.44      And I want something like this (insert text before line 1 and 5):               Exp1         4.06     4.05     5.04     4.06     Exp2     34.50     56.06     45.33     36.44      How can I do this?


title: Open 2 instances of the same program

text: I have a SSH server running in my home computer, with `X11Forwarding` enabled. I would like to connect to my computer from another computer and run some graphical programs. The problem is, that if a particular program is already running in my home computer, then it won't run again in my remote computer. All it does is gain focus in the home computer. I believe this problem can be solved if I could find a way to open 2 instances of the same program. I know that if I connect to another user, or run the program from another user in my local computer than I would be able to run the same program twice, once in each user. So I believe a solution would be to simulate a run of the program as another user. Problem is, I have only 1 user account, and I do want to run the programs - remotely, and locally from that particular user (which has access to my files and settings). What is the simplest way to accomplish it? (I'm running Ubuntu)


title: Can I deactivate the broadcom driver if I have a Realtek wireless card?

text: I am trying to get my wireless working on ubuntu 12.04. If I run lshw I see this output, indicating a Realtek wireless card.                      *-network UNCLAIMED                 description: Network controller                 product: Realtek Semiconductor Co., Ltd.                 vendor: Realtek Semiconductor Co., Ltd.                 physical id: 0                 bus info: pci@0000:03:00.0                 version: 00                 width: 64 bits                 clock: 33MHz                 capabilities: bus_master cap_list                 configuration: latency=0                 resources: ioport:3000(size=256) memory:f0400000-f0403fff      If I run "Additional Drivers" I see that it has a Broadcom driver installed and activated. Will this driver interfere with a Realtek driver? The wireless is not working on my computer so I need to install an additional driver. is there any good reason to activate or deactivate the broadcom driver?


title: Using If statment

text: I'm trying to use an If/else statement in bash. I'm confused which is the correct syntax.                 if [ "$NUMBER_dcn" -gt $NO ]       then       dir_dcn='/mnt/md0/capture'       fi      or                  if [ "{$NUMBER_dcn}" -gt $NO ]       then       dir_dcn='/mnt/md0/capture'       fi      NUMBER_dcn is populated using               NUMBER_dcn=$(find /mnt/md0/capture/ -maxdepth 1 -name "*.pcap" |wc -l)      Are both of them correct because one of them is giving me an "integer expression expected" error.


title: How can I copy all users .bash_history files into my home directory?

text: I am running as root. I want to copy all the users on the system's .bash_history files into my home directory. I can do this to combine all of them into one, but then I can't tell who's commands are who's.               find /home/ -maxdepth 2 -iname ".bash_history" -type f -exec cat {} >> ~/combined.txt \;      I would like to either put the user names between each of the files in the `combined.txt` file, or I would like to copy the files in this type of structure:               ~/user-bash/john.txt     ~/user-bash/mary.txt     ~/user-bash/bob.txt     ~/user-bash/larry.txt     ~/user-bash/root.txt      How can I accomplish either one (or both) of these?


title: Automating web requests using curl?

text: I have some "corporative" systems I have to use at work. Some of them are terrible, with frames, pop-ups and such. I was thinking about automating some stuff using curl or something like that. I need login, click on hyperlinks, set some data, and them do some post. Is it possible to use curl? Or am I'm going to be better using something like Selenium?


title: What scripting language or platform to use for web page downloads and screen interaction?

text: > **Possible Duplicate:**   >  Does anybody here have experience in automating some tasks in web > applications using curl? Here is what I need to do? Wondering what platform is most suited - easy to understand and easy to code in. I may have to outsource it as this may be way above my skill level. **Some background:** I have access to some information databases and websites through my library. The way the databases and websites are accessed is by first loading a library webpage. Entering my library card number in the dialogbox and clicking on the Submit link. Then opens the authenticated (I presume by cookies or such) webpage for the service where I want to obtain data from. **What I want to achieve:** I want to create a compilation of suitably named Pdf files in a folder. Alternatively, and preferably, would like to create one PDF file, which contains all the pages saved, which pages are hyper linked from an index page in the One PDF file. These pages are to be sourced from multiple websites. Access to the sites is either free, or with a password or Library based access (which requires as far as I can tell screen based interaction). Also, on one of these websites which can be accessed via the library based access, the webpage address in the address bar does not change each time I go to a different page (terrible). So the many pages that I want downloaded for offline review, do not lend themselves to a simple Wget kind of command. As far as I can tell, it needs some way on clicking the right tabs on the website, so that the page loads, and once the page loads, it needs to be printed as a PDF file with a suitable name, and compiled into the One PDF file. **Wondering what platform to use to have this mini application / script developed?** Can somebody help me decide on what platform is ideally suited for this kind of application? Ideally, I would like the solution to be function calling oriented, so that if I have to add a webpage after a month of having this developed, I do not have to go running to the developer for such "configuration" changes. The platform does not have to be Unix, although I think using a Unix platform creates the maximum flexibility. I can run it off my Mac, or off a host online, or on my Raspberry Pi :) Thank you!! * * * Update: I just heard from an IT savvy friend that http://seleniumhq.org/ or http://scrapy.org/ may be good options. Will study them also.


title: What command line tools are available for testing Web Service?

text: > **Possible Duplicate:**   >  Does anybody here have experience in automating some tasks in web > applications using curl? There are a number of GUI based tools to test Web Service (e.g. soapUI) Is there any our command line driven tool that can be used to test a Webservice. Not just the connectivity, but also capture and compare the result returned by a web service


title: Accidental deletion of /lib directory in Fedora 15

text: I accidentally deleted the /lib directory on my Fedora 15 machine and I'm not sure how to go about fixing this. Any help in figuring out how to restore the directory along with symbolic links would be greatly appreciated.


title: Fedora 16 using systemd kernel boot parameters to change 'runlevel'

text: It says in the fedora documentation that you can append this line to the boot options to change the *.target that loads temporarily at boot.               systemd.unit=rescue.target      Nothing seems to happen it still boots into a graphical environment, is there any reason this might be happening? I don't want to find a substitute for this command, I would really like to know why this one is not working. Thanks in advance.


title: Dangers of shopt

text: In another question it was suggest that I use               shopt -s extglob      To fix a problem. I get the impression that these type commands are to be used sparingly, perhaps because they can have ill effects with other scripts. Can anyone speak to this?


title: Why is zsh (oh-my-zsh) completing directories that don't exist?

text: **UPDATE 3** I've worked out that these annoying autocomplete options are actually _usernames_. I.e. they exist in `/etc/passwd` I have users such as _kadmin_admin and _kadmin_changepw and many others starting with an underscore. This may be specific to OSX. Oh-my-zsh is autocompleting with these usernames when it can't find any other matches. I tried adding these usernames to the "Don't complete uninteresting users" list in `~/.oh-my-zsh/lib/completion.zsh`, but that didn't work. I'm not sure why? Is there anyway to stop oh-my-zsh from autocompleting usernames? * * * I'm getting frustrated by some weird behaviour in either ZSH or oh-my-zsh. I'm not sure which would be causing it. The autocomplete seems to be searching some weird directories that I don't want it to. They appear to be some SVN directories, that I know nothing about and have no idea why they would be in the path. (I don't even use SVN) This behaviour only seems to occur if there are no other matches in the current directory - it must then look in some other path that I have no idea about. **Example:** _NOTE: There is nothing in my home dir that matches`mi`_               →  ~  cd mi<tab>     →  ~  cd _kadmin      I.e. it turns `mi` into `_kadmin`. I have no idea why it is matching that directory. If I try to actually change into that directory, I get an error anyway (as it is not the full directory name):               →  ~  cd _kadmin     cd:cd:10: no such file or directory: _kadmin      If I keep pressing `<tab>` then it will match the full directory name:               →  ~  cd mi<tab><tab><tab>     →  ~  cd kadmin_admin     →  ~_svn     →  ~_svn pwd     /var/empty      I have no idea what is going on there. I have no idea what kadmin_admin is. And why when I change into it, why would I now get a directory name of `~_svn`, and then if I `PWD` it shows `/var/empty` This is my path:               /Users/asgeo1/.rvm/gems/ruby-1.9.3-p194/bin:/Users/asgeo1/.rvm/gems/ruby-1.9.3-p194@global/bin:/Users/asgeo1/.rvm/rubies/ruby-1.9.3-p194/bin:/Users/asgeo1/.rvm/bin:/usr/local/php54/bin:/Users/asgeo1/Projects/dotfiles/bin:/Applications/Postgres.app/Contents/MacOS/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin      Nothing obvious in there that I can see. Please someone shed some light on this. It's quite frustrating me! **EDIT:** Seems someone has had a similar issue before: Stop tab completion suggesting 'messagebus' There are no answers on there though :( **UPDATE:** This is the cd function which oh-my-zsh applies:               →  ~  which cd     cd () {         if [[ "x$*" = "x..." ]]         then                 cd ../..         elif [[ "x$*" = "x...." ]]         then                 cd ../../..         elif [[ "x$*" = "x....." ]]         then             cd ../../..         elif [[ "x$*" = "x......" ]]         then                 cd ../../../..         else                 builtin cd "$@"         fi     }


title: awk - streamline this script

text: I have a text file. On odd number lines, it gives new dimensions of key elements of a building that I'm constructing. On even number lines, the old dimensions are given. My aim is to process this file and output for each element the difference. Basically, it means subtracting old from new values. I'd like to do this with awk because I'm interested to do so. Here's a typical pair of lines from the text file which has 4 columns:               groundwall-rvsd 0.0     21.8    0.00     groundwall-orig 0.0     20.2    0.00      Here's the script I've put together. It's done the work I need to do but it feels like a clunker.               awk 'BEGIN{OFS=FS="\t"}     {if(NR%2==1){foo[NR]=$1 OFS $2 OFS $3 OFS $4}else{bar[NR]=$1 OFS $2 OFS $3 OFS $4}} END      {for(i=1;i<=NR;i++){if(i%2==1){split(foo[i], foosplit, OFS );split(bar[i+1], barsplit, OFS);split(foosplit[1], elemt, "-");      print elemt[1] OFS foosplit[2] - barsplit[2] OFS foosplit[3] - barsplit[3] OFS foosplit[4] - barsplit[4]}}}' file.txt      Any suggestions about a better solution? The output looks like this               groundwall  0   1.6 0


title: Are double "if" statements allowed in shell scripts

text: In C language we can use `if(a==b&&a==c)` we can make a double and statement is that possible in unix, to be specific in a shell script?


title: Add a path in $PATH globally for every user

text: Do we have anyway to add a path globally so that each user gets it in $PATH. I want to add path of ANT so that each user doesn't need to add it in his $PATH variable.


title: Gigabit network connection in Ubuntu issue with new hardware

text: Probably its typical issue, but I couldn’t found the answer. Sometime ago I had mini-ITX server worked on ZOTAC IONITX-G-E. It was managed by Ubuntu 10.10. I setuped Gigabit network with this server. I installed one additional network card (Planet ENW-9700. It's PCI-E x1 card) because it did some routing, that's why I need two network cards. I used DGS-1005D as Gigabit switch. It worked fine, Planet network card had Gigabit network connection. When I used it, network speed was ~40-50Mb\s. After that a month ago I decided to do upgrade, because that system wasn't enough for me. I bought new Asus P8H77-I motherboard with Intel i3-3225. I installed it in the same box instead of Zotac motherboard and installed Ubuntu Desktop 12.10. But somehow network card doesn't work as Gigabit connection. Distance between server and switch is 6-7 meters. I googled for it, and found some similar topics for Realtek NIC(this motherboard uses Realtek 8111F). So, based on some manuals I download latest Realtek drivers from this page, compiled them and installed. I disabled previous one RTL8169 driver that used before. But after that there is no Gigabit connection. I tried to force it by               sudo ethtool -s eth0 speed 1000 duplex full autoneg on      but it didn't do anything. Connection speed remained 100Mb\s. Here is ethtool eth0 output                Settings for eth0:         Supported ports: [ TP ]         Supported link modes:   10baseT/Half 10baseT/Full                                 100baseT/Half 100baseT/Full                                 1000baseT/Full         Supported pause frame use: No         Supports auto-negotiation: Yes         Advertised link modes:  10baseT/Half 10baseT/Full                                 100baseT/Half 100baseT/Full                                 1000baseT/Full         Advertised pause frame use: Symmetric Receive-only         Advertised auto-negotiation: Yes         Speed: 100Mb/s         Duplex: Full         Port: Twisted Pair         PHYAD: 0         Transceiver: internal         Auto-negotiation: on         MDI-X: Unknown         Supports Wake-on: pumbg         Wake-on: g         Current message level: 0x00000033 (51)                                drv probe ifdown ifup         Link detected: yes      Could you please suggest anything? I have the last option to install Planet NIC PCI-E x1 into PCI-E x16 slot and use it as before, but I don't want to occupy the only one PCI-E slot


title: Why does this pipeline get SIGTTIN?

text: When I run the command `for i in *.log; do cat "$i" | sort; done | more`, the pipeline gets a `SIGTTIN` signal and is stopped.               bash$ for i in *.log; do cat "$i" | sort; done | more     ### (one screenful of output...)     --More--     ### (press Space)     [1]+  Stopped                 for i in *.log;     do         cat "$i" | sort;     done | more     bash$ echo $?     149     # indicates SIGTTIN(21)      (I substituted a simple `cat` for a more elaborate and complex `awk` script.) I don't see why a `SIGTTIN` is generated, as no process reads from tty, except `more`, which is not in the background. Can someone explain what's going on here?


title: Perform commands on selected items in Midnight Commander

text: How can I perform a command on the selected items ? for example calling vim, or gimp for the 5 text or image files selected. I tried to make use of the inlined command line at the bottom, but it doesn't take my selection into account


title: Trouble sending command to detached Screen session

text: I would like to send a command to a screen session and if possible get the output. My attempt at sending a command to a screen session is as I found on this website and lots of others, but it doesn't seem to work:               root@server [~]# screen -X "script -a -c 'ls -l' /tmp/command.log" && cat /tmp/command.log     cat: /tmp/command.log: No such file or directory     root@server [~]#       Note there is only 1 Screen session running, so I have omitted -S and -p (tried it with those too and no effect). For example:               root@server [~]# screen -p 0 -X stuff "script -a -c 'ls -l' /tmp/command.log" && cat /tmp/command.log     cat: /tmp/command.log: No such file or directory


title: Replacing identical NIC cards creates eth1 instead of using eth0 in Ubuntu

text: I changed out a NIC card that was the exact same make and model. The setup process for Ubuntu 11.04 was very seemless and easy so I figured it would be smart enough to setup up the replacement card. However, it gave the replacement card a new name of `eth1` where all my scripts make reference to `eth0`, not to mention everywhere else in the OS `eth0` may exist. Am I forced to track down every `eth0` reference and change it to `eth1` or is there a way to rename the replacement card back to `eth0`?


title: Where do background jobs go?

text: From gnome-terminal I know the ability to suspend a job with C-z, and then send it to the background. When I close the terminal the process does not end. Where is the job being managed from, or is it lost?


title: How to download all images whose size>100kb in a webpage?

text: I want to download images contained in some web pages, but only those that are larger than 100 KB. So far I've been downloading all the images and then deleting the small ones, but it's not very efficient. Is there some way to ignore the small ones when downloading?


title: How to use localhost in browser instead of localhost:10088?

text: Installed zend-server CE. I would like to use this port (10088). But anytime I enter localhost I should enter localhost:10088, because localhost doesn't work. In the hosts file I tried to enter 127.0.0.1 localhost. In this case localhost:10088 works, localhost - doesn't. If I do 127.0.0.1:10088 localhost both ways don't work.


title: How do I echo a command and include line returns?

text: I am writing a bash script, and on a condition I'd like to output `ps aux --sort -rss` However, when I write :               echo `ps aux --sort -rss`      everything is on one huge line. How do I run it so it outputs like it normally does in a terminal?


title: Make sense of this strace output

text: Can anyone make sense of this `strace` output?               [pid 25302] read(34, "}B\311\204\n\250\347$\220\266kRb\304a^^\2504\303k\235\227T\223\16\231\306\277\254\256\306", 32) = 32      It's from a Linux system running a Java application via Tomcat. It's trying to read something, but instead of a filename, it has this odd string. This is where I believe the application fails, and it is the one part I don't understand.


title: Consistent network interface name ubuntu using pci slot

text: One can set consistent interface naming via mac address by modifying `/etc/udev/rules.d/70-persistent-net.rules`.   * Can you establish consistent interface naming by PCI slot number? (I tried but failed)   * Is there any other method to define consistent interface naming rather than MAC address? I am using Ubuntu 14.04. * * * Modifying `70-persistent-net.rules` per pci slot did not work in the case I had a 4 port NIC plugged into the top most pci slot: > $ lspci -D | grep -i ether               0000:04:00.0 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)     0000:04:00.1 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)     0000:05:00.0 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)     0000:05:00.1 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)     0000:0b:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection     0000:0c:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection      This is the file I used: `/etc/udev/rules.d/70-persistent-net.rules`               # This file was automatically generated by the /lib/udev/write_net_rules     # program, run by the persistent-net-generator.rules rules file.     #     # You can modify it, as long as you keep each rule on a single     # line, and change only the value of the NAME= key.               # PCI device 0x8086:0x10d3 (e1000e)     SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="aa:bb:cc:dd:ee:ff", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"          # PCI device 0x8086:0x10d3 (e1000e)     SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:aa:bb:cc:dd:ee", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"          SUBSYSTEM=="net", ACTION=="add", KERNELS="0000:04:00.0", NAME="eth2"     SUBSYSTEM=="net", ACTION=="add", KERNELS="0000:04:00.1", NAME="eth3"     SUBSYSTEM=="net", ACTION=="add", KERNELS="0000:05:00.0", NAME="eth4"     SUBSYSTEM=="net", ACTION=="add", KERNELS="0000:05:00.1", NAME="eth5"      Now if I plug in a two port NIC in the same slot:               0000:02:00.0 Ethernet controller: Intel Corporation 82580 Gigabit Fiber Network Connection (rev 01)     0000:02:00.1 Ethernet controller: Intel Corporation 82580 Gigabit Fiber Network Connection (rev 01)     0000:06:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection     0000:07:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection      You can see the PCI slot numbers changed.


title: Korganizer can't store new items

text: I have a Kubuntu recent installation (13.04, raring) and all was well until three days ago, when out of the blue, Korganizer stopped storing new items that I was entering in it. When I try to enter a new task, it acts appropriately and shows it and I can edit it, etc. However, when I close Korganizer and re-open it, everything newly entered has disappeared. Things that were entered four days ago or before that are all visible with no problems. Help!


title: did a " sudo go-wrx" on / ... oops, broken

text: OK, I was trying to set up ssh to work properly, and a website said it was really picky about permissions, and to use `go-wrx` on `~/.ssh`, and that `/` and `/home` need to have at least go-w permissions. on them. I saw that `/` did not have any write permissions, so i ran `go-wrx` on `/`. I should've read about what that command does first, because now my install is broken. the gui is slowly breaking the more things I click on (basically any time it tries to load anything from the filesystem). from terminal, a `cd` to anywhere gives a permission denied error, and a `sudo` anything gives `bash: /usr/bin/sudo: Permission denied`. If I have to do a reinstall, I will, but I have a few files on there in `/var/www` that I _have_ to save. Is there anyone out there who know how to fix this, or at least get to the files?


title: Solaris11: Alternative to xVM Hypervisor?

text: AFAIK, support for the xVM Hypervisor - basically Xen - has been dropped in Solaris 11. Is there an alternative/replacement for it? How does it compare to Xen? Obviously there is zones if you want to run Solaris, and there is VirtualBox if you want a virtual computer in a separate program. But is there anything similar to Hypervisor/Xen?


title: red-green color blindness compatible vim theme

text: I am looking for a vim theme accessible to users with red green color blindness. In particular, the red text on a dark terminal background all but disappears. Do any of you know of a good theme? Or have resources useful for designing one?


title: GRUB on USB Drive -- adding OSes

text: **Some Background:**   * Coming from a largely Windows background (though I'm familiar with Ubuntu, etc.) and using a Windows 7 machine to complete this task   * Have gotten GRUB installed successfully to the MBR of the USB drive (8 GB FAT32 drive):   * Have created a basic structure on the drive: /boot/grub, /boot/img, /boot/kernel **Question:** I have some basic, beginner questions, but ones that I've had trouble finding answers to through Google / StackExchange, etc.   * I understand that the /boot/img/[SystemName] folder will store the image for a specific system, which may use various (or the same) versions of linux kernels stored in the /boot/kernel directory (at least, that's how I'd like to set it up)   * However, most of these systems just have a kernel in their directories called "linux" (not stating the version). I can search out which kernel these all use, but what's the bst place to get the kernels themselves to copy to /boot/kernel?   * After I get the kernels, I imagine the rest is mostly copying the device to /boot/img/ and creating the proper entry in menu.lst, correct? I can do that on a system by system basis once I can get the kernels to refer to. **Overall Goal:** I'm attempting to create an 8GB usb flash drive that will allow me to boot multiple OSes from a GRUB boot menu. To add or subtract OSes, I would like only to have to copy the appropriate files to a /boot/img/[SystemName] and a /boot/kernel folder as appropriate and then edit the menu.lst file. So, this first step is about finding the kernels that many of these OSes share, as I'm hoping to reduce duplication. I might be confused as to how the process works or terminology, but I promise I've worked in IT generally for 7+ years. Appreciate any help that you can give!


title: How does google still know my real IP address with Squid?

text: I'm using Squid proxy with the configs setup so that it would not be detected as proxy. It work with http://www.whatismyip.com/, but when searching for what is my ip on google. Google still show my true IP, how is this possible? How can I configure Squid to truly mask my ip? Thanks in advance.


title: How to separate numerical values from identifiers

text: I'm currently writing a shell script that seperate values from their identifiers (retrieved from grep). For example, if I grep a certain file I will retrieve the following information:               value1 = 1     value2 = 74     value3 = 27      I'm wondering what UNIX command I can use to take in the information and convert it to this format:               1 74 27      Appreciate any help


title: Test if telnet port is active within a shell script

text: I am trying to create a script to test whether it is possible to login via telnet. I do not want to really log in; therefore, expect is not needed. I just want to see if I am able to get a login prompt. This is being done from a Linux system so I have been trying to use `nc`:               nc 192.168.10.5 23 -w 1 | grep -q login      if [ $? -eq 1 ]     then         echo "console is down"     fi      The problem is that this is causing my console to lock up. It seems like the `-w` is not really dropping the connection. I also tried using telnet but I am not able to break the connection from within the script. Trying               \echo "\035" | telnet 192.168.10.5      breaks before I get a login prompt.