title: How (if possible) can I terminate a specific blocker hanging a program?

text: I have a number of files open in my editor (geany). I managed to hang it doing a sort on a large list that I should have saved and just sent through a pipe to sort via command-line (I mapped one of the custom commands to sort, so `Ctrl`+`1` will sort the current selection). If I attach strace to this process as suggested in this answer, I see the following:               write(18, "000011317XYZ01\n000011317XYZ01\n00"..., 8325030      the stuff in the quotes is what I was sorting. I may or may not have left unsaved changes open in other files. I'm fairly certain anything left is unimportant, but on the off chance I forgot to save some work, I'd like to kill this write and free the program to resume functioning. Is this possible, and if so, how can I do it? EDIT: `lsof` output:               COMMAND   PID USER   FD   TYPE             DEVICE SIZE/OFF      NODE NAME     geany   17502   me  cwd    DIR               0,32     4096      2799 /mnt/aleph/edit/timothy/aleph_stats/acq_firm     geany   17502   me  rtd    DIR               8,10     4096         2 /     geany   17502   me  txt    REG                8,8  2354896   1049732 /usr/bin/geany     geany   17502   me  mem    REG                8,8 88585928    542673 /usr/share/icons/gnome/icon-theme.cache     geany   17502   me  mem    REG                8,8 38535164    557602 /usr/share/icons/hicolor/icon-theme.cache     geany   17502   me  mem    REG                8,8 23512808    834745 /usr/lib64/libicudata.so.52.1     geany   17502   me  DEL    REG                8,8             542688 /usr/share/icons/gnome/icon-theme.cache     geany   17502   me  DEL    REG                8,8             553973 /usr/share/icons/hicolor/icon-theme.cache     geany   17502   me  mem    REG                8,8   611556    568798 /usr/share/fonts/dejavu/DejaVuSans-Oblique.ttf     geany   17502   me  mem    REG                8,8   672300    568795 /usr/share/fonts/dejavu/DejaVuSans-Bold.ttf     geany   17502   me  DEL    REG                0,4          184483854 /SYSV00000000     geany   17502   me  DEL    REG                8,8            1188828 /usr/lib64/gconv/ISO8859-1.so     geany   17502   me  DEL    REG                0,4          184385538 /SYSV00000000     geany   17502   me  mem    REG                8,8  1522200    834750 /usr/lib64/libicuuc.so.52.1     geany   17502   me  mem    REG                8,8  1450760    788304 /usr/lib64/libxml2.so.2.9.1     geany   17502   me  mem    REG                8,8    26784   1188919 /usr/lib64/geany/pretty-printer.so     geany   17502   me  mem    REG                8,8    39344   1188915 /usr/lib64/geany/htmlchars.so     geany   17502   me  mem    REG                8,8    47624    802077 /usr/lib64/libenchant.so.1.6.0     geany   17502   me  mem    REG                8,8    27240    802366 /usr/lib64/libgtkspell.so.0.0.0     geany   17502   me  DEL    REG                8,8             624545 /usr/share/icons/hicolor/icon-theme.cache     geany   17502   me  mem    REG                8,8   313856    568804 /usr/share/fonts/dejavu/DejaVuSansMono-Bold.ttf     geany   17502   me  mem    REG                8,8    84984   1188912 /usr/lib64/geany/geanyvc.so     geany   17502   me  mem    REG                8,8    99632   1188896 /usr/lib64/geany/geanylatex.so     geany   17502   me  mem    REG               8,10   349816    672871 /lib64/libncurses.so.5.9     geany   17502   me  mem    REG                8,8   652992    803024 /usr/lib64/libvte.so.9.2800.2     geany   17502   me  mem    REG                8,8    23000   1184701 /usr/lib64/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.so     geany   17502   me  DEL    REG               8,10             653148 /lib64/libnss_files-2.16.so     geany   17502   me  DEL    REG               8,10             653144 /lib64/libnss_nis-2.16.so     geany   17502   me  DEL    REG               8,10             653150 /lib64/libnsl-2.16.so     geany   17502   me  DEL    REG               8,10             653135 /lib64/libnss_compat-2.16.so     geany   17502   me  mem    REG                8,8    48192   1189447 /usr/lib64/gio/modules/libdconfsettings.so     geany   17502   me  DEL    REG                8,8            1202522 /usr/lib64/gio/modules/libgioremote-volume-monitor.so#new     geany   17502   me  mem    REG                8,8   341088    801633 /usr/lib64/libibus-1.0.so.5.0.502     geany   17502   me  mem    REG                8,8   249424    796649 /usr/lib64/libdbus-1.so.3.7.6     geany   17502   me  mem    REG                8,8   241972    568806 /usr/share/fonts/dejavu/DejaVuSansMono-Oblique.ttf     geany   17502   me  mem    REG                8,8    31600   1185042 /usr/lib64/gtk-2.0/2.10.0/immodules/im-ibus.so     geany   17502   me  mem    REG                8,8   720012    568799 /usr/share/fonts/dejavu/DejaVuSans.ttf     geany   17502   me  mem    REG                8,8    14632    272931 /usr/lib64/pango/1.8.0/modules/pango-basic-fc.so     geany   17502   me  mem    REG                8,5   210920    528159 /var/cache/fontconfig/6b6a5d05491ac801f42cf67ebd0a6108-le64.cache-4     geany   17502   me  mem    REG                8,5    10264    529015 /var/cache/fontconfig/0b1bcc92b4d25cc154d77dafe3bceaa0-le64.cache-4     geany   17502   me  mem    REG                8,5    41640    529013 /var/cache/fontconfig/acc285bc1956c3c4bc7afb41d537a85a-le64.cache-4     geany   17502   me  mem    REG                8,5    23600    529011 /var/cache/fontconfig/4467b976098fb13588b23c76ba4750d8-le64.cache-4     geany   17502   me  mem    REG                8,5    98832    529010 /var/cache/fontconfig/8d4af663993b81a124ee82e610bb31f9-le64.cache-4     geany   17502   me  mem    REG                8,5    55328    529008 /var/cache/fontconfig/d722f191fc173fb8c13c8ea6f285de40-le64.cache-4     geany   17502   me  mem    REG                8,5    19328    529007 /var/cache/fontconfig/a595ca43be94766bbfe429f07fba82d0-le64.cache-4     geany   17502   me  mem    REG                8,5    17216    529005 /var/cache/fontconfig/580bda594161061e6ef4cc8a4db09662-le64.cache-4     geany   17502   me  mem    REG                8,5    35584    529003 /var/cache/fontconfig/1dce2cb908b447e938fc03acd9b47fcf-le64.cache-4     geany   17502   me  mem    REG                8,5   209704    528920 /var/cache/fontconfig/e93c8d63f9026ff45792033b853adafb-le64.cache-4     geany   17502   me  DEL    REG                8,8            1221002 /usr/lib64/locale/locale-archive     geany   17502   me  mem    REG                8,8   121040    802287 /usr/lib64/libgraphite2.so.3.0.1     geany   17502   me  mem    REG                8,8    22616    801464 /usr/lib64/libXxf86vm.so.1.0.0     geany   17502   me  DEL    REG                8,8             835089 /usr/lib64/libxcb-glx.so.0.0.0     geany   17502   me  mem    REG                8,8   149736    801100 /usr/lib64/libglapi.so.0.0.0     geany   17502   me  mem    REG                8,8    22504    801439 /usr/lib64/libXdmcp.so.6.0.0     geany   17502   me  mem    REG                8,8    14336    801434 /usr/lib64/libXau.so.6.0.0     geany   17502   me  mem    REG                8,8    47408    800472 /usr/lib64/libdrm.so.2.4.0     geany   17502   me  mem    REG               8,10    71536    664243 /lib64/libudev.so.1.3.7     geany   17502   me  mem    REG                8,8    22856    801102 /usr/lib64/libgbm.so.1.0.0     geany   17502   me  DEL    REG                8,8             803116 /usr/lib64/libxcb-xfixes.so.0.0.0     geany   17502   me  DEL    REG                8,8             835088 /usr/lib64/libxcb-dri2.so.0.0.0     geany   17502   me  mem    REG                8,8     5864    801431 /usr/lib64/libX11-xcb.so.1.0.0     geany   17502   me  DEL    REG               8,10             691928 /lib64/libbz2.so.1.0.6     geany   17502   me  mem    REG                8,8   174112    802103 /usr/lib64/libexpat.so.1.6.0     geany   17502   me  mem    REG                8,8   372120    802652 /usr/lib64/libharfbuzz.so.0.923.0     geany   17502   me  mem    REG                8,8    30904    802115 /usr/lib64/libffi.so.6.0.1     geany   17502   me  DEL    REG               8,10             653145 /lib64/libresolv-2.16.so     geany   17502   me  DEL    REG               8,10             653131 /lib64/librt-2.16.so     geany   17502   me  mem    REG                8,8   392984    274704 /usr/lib64/opengl/xorg-x11/lib/libGL.so.1.2.0     geany   17502   me  mem    REG               8,10    88472    660612 /lib64/libz.so.1.2.8     geany   17502   me  DEL    REG                8,8             835090 /usr/lib64/libxcb.so.1.1.0     geany   17502   me  DEL    REG                8,8             835084 /usr/lib64/libxcb-render.so.0.0.0     geany   17502   me  DEL    REG                8,8             803129 /usr/lib64/libxcb-shm.so.0.0.0     geany   17502   me  mem    REG                8,8   220184    801044 /usr/lib64/libpng16.so.16.8.0     geany   17502   me  DEL    REG               8,10             653143 /lib64/libdl-2.16.so     geany   17502   me  mem    REG                8,8   122528    265129 /usr/lib64/opengl/xorg-x11/lib/libEGL.so.1.0.0     geany   17502   me  mem    REG                8,8   617088    802753 /usr/lib64/libpixman-1.so.0.30.2     geany   17502   me  mem    REG                8,8   675336    802153 /usr/lib64/libfreetype.so.6.10.1     geany   17502   me  mem    REG                8,8    73544    801440 /usr/lib64/libXext.so.6.4.0     geany   17502   me  mem    REG                8,8    10120    801438 /usr/lib64/libXdamage.so.1.1.0     geany   17502   me  mem    REG                8,8    10096    801436 /usr/lib64/libXcomposite.so.1.0.0     geany   17502   me  mem    REG                8,8    43512    801437 /usr/lib64/libXcursor.so.1.0.2     geany   17502   me  mem    REG                8,8    39040    801450 /usr/lib64/libXrandr.so.2.2.0     geany   17502   me  mem    REG                8,8    63752    801444 /usr/lib64/libXi.so.6.1.0     geany   17502   me  mem    REG                8,8    10264    801445 /usr/lib64/libXinerama.so.1.0.0     geany   17502   me  mem    REG                8,8    39280    801451 /usr/lib64/libXrender.so.1.3.0     geany   17502   me  mem    REG                8,8   244520    802134 /usr/lib64/libfontconfig.so.1.7.0     geany   17502   me  mem    REG                8,8    85576    835142 /usr/lib64/libpangoft2-1.0.so.0.3400.1     geany   17502   me  mem    REG                8,8   146808    787175 /usr/lib64/libatk-1.0.so.0.20809.1     geany   17502   me  mem    REG                8,8    22432    801441 /usr/lib64/libXfixes.so.3.1.0     geany   17502   me  mem    REG                8,8  1285592    801432 /usr/lib64/libX11.so.6.3.0     geany   17502   me  DEL    REG               8,10             653151 /lib64/libc-2.16.so     geany   17502   me  DEL    REG               8,10             653130 /lib64/libpthread-2.16.so     geany   17502   me  mem    REG               8,10    88288    653223 /lib64/libgcc_s.so.1     geany   17502   me  DEL    REG               8,10             653136 /lib64/libm-2.16.so     geany   17502   me  mem    REG                8,8   995576   1188464 /usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.3/libstdc++.so.6.0.17     geany   17502   me  mem    REG                8,8  1201112    802221 /usr/lib64/libglib-2.0.so.0.3600.4     geany   17502   me  mem    REG                8,8    14440    802228 /usr/lib64/libgmodule-2.0.so.0.3600.4     geany   17502   me  mem    REG                8,8   326656    802262 /usr/lib64/libgobject-2.0.so.0.3600.4     geany   17502   me  mem    REG                8,8  1409968    802210 /usr/lib64/libgio-2.0.so.0.3600.4     geany   17502   me  mem    REG                8,8   310536    835144 /usr/lib64/libpango-1.0.so.0.3400.1     geany   17502   me  mem    REG                8,8   130184    835186 /usr/lib64/libgdk_pixbuf-2.0.so.0.2800.2     geany   17502   me  mem    REG                8,8  1137752    801936 /usr/lib64/libcairo.so.2.11200.14     geany   17502   me  mem    REG                8,8    52392    835143 /usr/lib64/libpangocairo-1.0.so.0.3400.1     geany   17502   me  mem    REG                8,8   736376    802180 /usr/lib64/libgdk-x11-2.0.so.0.2400.22     geany   17502   me  mem    REG                8,8  4378920    802354 /usr/lib64/libgtk-x11-2.0.so.0.2400.22     geany   17502   me  DEL    REG               8,10             653152 /lib64/ld-2.16.so     geany   17502   me  mem    REG                8,5     7992    528210 /var/cache/fontconfig/711dae798b6bff4224ea2776edcb5c93-le64.cache-4     geany   17502   me  mem    REG                8,5     5344    529012 /var/cache/fontconfig/f55bbeb01d684dc5b5f7b2c347cc42d9-le64.cache-4     geany   17502   me  mem    REG                8,5   121856    528921 /var/cache/fontconfig/4b5cf4386f1cde02a336ba961b4ac82d-le64.cache-4     geany   17502   me  mem    REG                8,5   467824    528913 /var/cache/fontconfig/17090aa38d5c6f09fb8c5c354938f1d7-le64.cache-4     geany   17502   me  mem    REG                8,5   468544    528912 /var/cache/fontconfig/df311e82a1a24c41a75c2c930223552e-le64.cache-4     geany   17502   me  mem    REG                8,8   333636    568807 /usr/share/fonts/dejavu/DejaVuSansMono.ttf     geany   17502   me  mem    REG                8,8   134644    542662 /usr/share/mime/mime.cache     geany   17502   me  mem    REG                8,3    17724   2887683 /home/me/.local/share/mime/mime.cache     geany   17502   me  mem    REG                8,8     1584    647916 /usr/share/vte/termcap-0.0/xterm     geany   17502   me  mem    REG                8,5    13800    528154 /var/cache/fontconfig/aecded52ccf112ce9ddb976f75eab3bb-le64.cache-4     geany   17502   me  mem    REG                8,5    43352    527867 /var/cache/fontconfig/12b26b760a24f8b4feb03ad48a333a72-le64.cache-4     geany   17502   me  mem    REG                8,5     3744    528919 /var/cache/fontconfig/6ba42ae0000f58711b5caaf10d690066-le64.cache-4     geany   17502   me  mem    REG                8,5     5568    528918 /var/cache/fontconfig/9ac117a19f6581c07dc6f3cd1c903930-le64.cache-4     geany   17502   me  mem    REG                8,5    63936    528917 /var/cache/fontconfig/f73c51d6200a78c2054c26a5b2398976-le64.cache-4     geany   17502   me  mem    REG                8,5    32968    528916 /var/cache/fontconfig/d62e99ef547d1d24cdb1bd22ec1a2976-le64.cache-4     geany   17502   me  mem    REG                8,5    16824    527827 /var/cache/fontconfig/f6b893a7224233d96cb72fd88691c0b4-le64.cache-4     geany   17502   me  mem    REG                8,5    34008    528914 /var/cache/fontconfig/f349e9996a5320f6dd491cedd2b1f964-le64.cache-4     geany   17502   me  mem    REG                8,3     4664   2925817 /home/me/.cache/fontconfig/e62d3f7bf4c215071e5515a94c2f2165-le64.cache-4     geany   17502   me  mem    REG                8,5    12192    528911 /var/cache/fontconfig/3830d5c3ddfd5cd38a049b759396e72e-le64.cache-4     geany   17502   me  DEL    REG                8,8            1220999 /usr/lib64/gconv/gconv-modules.cache     geany   17502   me    0u   CHR             136,13      0t0        16 /dev/pts/13     geany   17502   me    1u   CHR             136,13      0t0        16 /dev/pts/13     geany   17502   me    2u   CHR             136,13      0t0        16 /dev/pts/13     geany   17502   me    3u  unix 0xffff8801deefb400      0t0  54793415 socket     geany   17502   me    4u  0000                0,9        0      5383 anon_inode     geany   17502   me    5u  unix 0xffff8801deefa080      0t0  54793417 /tmp/geany_socket.539baec2     geany   17502   me    6r  0000                0,9        0      5383 anon_inode     geany   17502   me    7u  unix 0xffff8801fbe14440      0t0  54786886 socket     geany   17502   me    8u  0000                0,9        0      5383 anon_inode     geany   17502   me    9u  0000                0,9        0      5383 anon_inode     geany   17502   me   10u   CHR                5,2      0t0      1137 /dev/ptmx     geany   17502   me   11u   CHR             136,17      0t0        20 /dev/pts/17     geany   17502   me   12u  unix 0xffff8801fd275b00      0t0  54802777 socket     geany   17502   me   13u  0000                0,9        0      5383 anon_inode     geany   17502   me   14r   REG                0,3        0  54819383 /proc/17502/mounts     geany   17502   me   18w  FIFO                0,8      0t0 120077341 pipe     geany   17502   me   19r  FIFO                0,8      0t0 120077342 pipe     geany   17502   me   21r  FIFO                0,8      0t0 120076496 pipe     geany   17502   me   22r  FIFO                0,8      0t0 120077343 pipe


title: "Malformed patch" error while applying the diff to wget source with patch

text: I would like to apply this patch so I copied code beginning at "Index: src/options.h" and ending with "+@item" and put it into a new file created in `wget`'s source code folder. Then I did:               $ patch -p0 < name_of_patch     (Patch is indented 1 space.)     patching file src/options.h     patch: **** malformed patch at line 6: char **excludes; /* List of excluded FTP directories. */      How am I supposed to apply this? This is the content of the file I created:                Index: src/options.h      ===================================================================      --- src/options.h (revision 2276)      +++ src/options.h (working copy)      @@ -62,6 +62,8 @@      char **excludes; /* List of excluded FTP directories. */      char **includes; /* List of FTP directories to      follow. */      + int maxsize; /* Maximum file size (kB) */      + int minsize; /* Minimum file size (kB) */      bool ignore_case; /* Whether to ignore case when      matching dirs and files */           Index: src/init.c      ===================================================================      --- src/init.c (revision 2276)      +++ src/init.c (working copy)      @@ -182,6 +182,8 @@      { "loadcookies", &opt.cookies_input, cmd_file },      { "logfile", &opt.lfilename, cmd_file },      { "login", &opt.ftp_user, cmd_string },/* deprecated*/      + { "maxsize", &opt.maxsize, cmd_number },      + { "minsize", &opt.minsize, cmd_number },      { "mirror", NULL, cmd_spec_mirror },      { "netrc", &opt.netrc, cmd_boolean },      { "noclobber", &opt.noclobber, cmd_boolean },      Index: src/http.c      ===================================================================      --- src/http.c (revision 2276)      +++ src/http.c (working copy)      @@ -2252,7 +2252,7 @@      retried, and retried, and retried, and... */      uerr_t      http_loop (struct url *u, char **newloc, char **local_file, const char       *referer,      - int *dt, struct url *proxy)      + int *dt, struct url *proxy, bool can_ommit)      {      int count;      bool got_head = false; /* used for time-stamping and filename       detection */      @@ -2285,6 +2285,27 @@      if (opt.ftp_glob && has_wildcards_p (u->path))      logputs (LOG_VERBOSE, _("Warning: wildcards not supported in HTTP.\n"));           + /* Try fetching the document header and checking the document length */      + if (can_ommit && !opt.spider && !opt.ignore_length &&      + (opt.minsize > 0 || opt.maxsize > 0))      + {      + /* Setup hstat struct. */      + xzero (hstat);      + hstat.referer = referer;      +      + *dt = HEAD_ONLY;      + err = gethttp (u, &hstat, dt, proxy);      +       + if (err == RETRFINISHED && hstat.contlen > 0 &&      + (opt.minsize > 0 && hstat.contlen < opt.minsize * 1024 ||      + opt.maxsize > 0 && hstat.contlen > opt.maxsize * 1024))       + {      + logputs (LOG_VERBOSE, _("File too small or too big -- not       retrieving.\n"));      + ret = FILEBADFILE;      + goto exit;      + }      + }      +      /* Setup hstat struct. */      xzero (hstat);      hstat.referer = referer;      @@ -2300,7 +2321,7 @@           /* Reset the document type. */      *dt = 0;      -       +      /* THE loop */      do      {      Index: src/http.h      ===================================================================      --- src/http.h (revision 2276)      +++ src/http.h (working copy)      @@ -32,7 +32,7 @@      struct url;           uerr_t http_loop (struct url *, char **, char **, const char *, int *,      - struct url *);      + struct url *, bool);      void save_cookies (void);      void http_cleanup (void);      time_t http_atotm (const char *);      Index: src/res.c      ===================================================================      --- src/res.c (revision 2276)      +++ src/res.c (working copy)      @@ -545,7 +545,7 @@      *file = NULL;      opt.timestamping = false;      opt.spider = false;      - err = retrieve_url (robots_url, file, NULL, NULL, NULL, false);      + err = retrieve_url (robots_url, file, NULL, NULL, NULL, false, false);      opt.timestamping = saved_ts_val;      opt.spider = saved_sp_val;       xfree (robots_url);      Index: src/retr.c      ===================================================================      --- src/retr.c (revision 2276)      +++ src/retr.c (working copy)      @@ -601,7 +601,7 @@           uerr_t      retrieve_url (const char *origurl, char **file, char **newloc,      - const char *refurl, int *dt, bool recursive)      + const char *refurl, int *dt, bool recursive, bool can_ommit)      {      uerr_t result;      char *url;      @@ -676,7 +676,7 @@      #endif      || (proxy_url && proxy_url->scheme == SCHEME_HTTP))      {      - result = http_loop (u, &mynewloc, &local_file, refurl, dt, proxy_url);      + result = http_loop (u, &mynewloc, &local_file, refurl, dt, proxy_url,       can_ommit);      }      else if (u->scheme == SCHEME_FTP)      {      @@ -856,7 +856,7 @@      opt.follow_ftp = old_follow_ftp;      }      else      - status = retrieve_url (cur_url->url->url, &filename, &new_file, NULL,       &dt, opt.recursive);      + status = retrieve_url (cur_url->url->url, &filename, &new_file, NULL,       &dt, opt.recursive, false);           if (filename && opt.delete_after && file_exists_p (filename))      {      Index: src/retr.h      ===================================================================      --- src/retr.h (revision 2276)      +++ src/retr.h (working copy)      @@ -49,7 +49,7 @@      char *fd_read_hunk (int, hunk_terminator_t, long, long);      char *fd_read_line (int);           -uerr_t retrieve_url (const char *, char **, char **, const char *, int *,       bool);      +uerr_t retrieve_url (const char *, char **, char **, const char *, int *,       bool, bool);      uerr_t retrieve_from_file (const char *, bool, int *);           const char *retr_rate (wgint, double);      Index: src/recur.c      ===================================================================      --- src/recur.c (revision 2276)      +++ src/recur.c (working copy)      @@ -247,7 +247,7 @@      int dt = 0;      char *redirected = NULL;           - status = retrieve_url (url, &file, &redirected, referer, &dt, false);      + status = retrieve_url (url, &file, &redirected, referer, &dt, false,       !html_allowed);           if (html_allowed && file && status == RETROK      && (dt & RETROKF) && (dt & TEXTHTML))      Index: src/main.c      ===================================================================      --- src/main.c (revision 2276)      +++ src/main.c (working copy)      @@ -189,6 +189,8 @@      { "level", 'l', OPT_VALUE, "reclevel", -1 },      { "limit-rate", 0, OPT_VALUE, "limitrate", -1 },      { "load-cookies", 0, OPT_VALUE, "loadcookies", -1 },      + { "max-size", 'M', OPT_VALUE, "maxsize", -1 },      + { "min-size", 's', OPT_VALUE, "minsize", -1 },      { "mirror", 'm', OPT_BOOLEAN, "mirror", -1 },      { "no", 'n', OPT__NO, NULL, required_argument },      { "no-clobber", 0, OPT_BOOLEAN, "noclobber", -1 },      @@ -446,6 +448,10 @@      N_("\      --limit-rate=RATE limit download rate to RATE.\n"),      N_("\      + -M, --max-size=SIZE limit maximum file size to SIZE (kB).\n"),      + N_("\      + -s, --min-size=SIZE limit minimum file size to SIZE (kB).\n"),      + N_("\      --no-dns-cache disable caching DNS lookups.\n"),      N_("\      --restrict-file-names=OS restrict chars in file names to ones OS       allows.\n"),      @@ -675,7 +681,6 @@      stdout);      exit (0);      }      -       #ifndef TESTING      int      main (int argc, char *const *argv)      @@ -979,7 +984,7 @@      opt.follow_ftp = old_follow_ftp;      }      else      - status = retrieve_url (*t, &filename, &redirected_URL, NULL, &dt,       opt.recursive);      + status = retrieve_url (*t, &filename, &redirected_URL, NULL, &dt,       opt.recursive, false);           if (opt.delete_after && file_exists_p(filename))      {      Index: doc/wget.texi      ===================================================================      --- doc/wget.texi (revision 2276)      +++ doc/wget.texi (working copy)      @@ -1592,7 +1592,7 @@      @item -l @var{depth}      @itemx --level=@var{depth}      Specify recursion maximum depth level @var{depth} (@pxref{Recursive      -Download}). The default maximum depth is 5.      +Download}). The default maximum depth is 5. Zero means infinite recursion.           @cindex proxy filling      @cindex delete after retrieval      @@ -1803,6 +1803,15 @@      Specify the domains that are @emph{not} to be followed.      (@pxref{Spanning Hosts}).           +@cindex file size range      +@item -s @var{size}      +@itemx --min-size=@var{size}      +Limit the minimum size of non-HTML files to @var{size} kB. Smaller files will       not be retrieved.      +      +@item -M @var{size}      +@itemx --max-size=@var{size}      +Limit the maximum size of non-HTML files to @var{size} kB. Larger files will       not be retrieved.      +      @cindex follow FTP links      @item --follow-ftp      Follow @sc{ftp} links from @sc{html} documents. Without this option,      @@ -3064,6 +3073,14 @@      too.           @item      +Retrieve in directory 'pics' all jpeg images from a given site, excluding      +files smaller than 50k (to avoid thumbnails) or larger than 400k.      +      +@example      +wget -Ppics -nd -r -l0 -Ajpg,jpeg -s50 -M400 http://www.server.com      +@end example      +      +@item      Suppose you were in the middle of downloading, when Wget was      interrupted. Now you do not want to clobber the files already present.      It would be:      Index: src/utils.c      ===================================================================      --- src/utils.c (revision 2276)      +++ src/utils.c (working copy)      @@ -432,33 +432,52 @@      #endif      }           -/* stat file names named PREFIX.1, PREFIX.2, etc., until one that      - doesn't exist is found. Return a freshly allocated copy of the      - unused file name. */      +/*      + * Stat file names named PREFIX-1.SUFFIX, PREFIX-2.SUFFIX, etc., until      + * one that doesn't exist is found. Return a freshly allocated copy of      + * the unused file name.      + */           static char *      -unique_name_1 (const char *prefix)      +unique_name_1 (const char *s)      {      int count = 1;      - int plen = strlen (prefix);      - char *template = (char *)alloca (plen + 1 + 24);      - char *template_tail = template + plen;      + int p, l = strlen (s);      + char *prefix = (char *) alloca (l + 1);      + char *suffix = (char *) alloca (l + 1);      + char *filename = (char *) alloca (l + 26);      +       + /* Look for last '.' in filename */      +       + for(p = l; p >= 0 && s[p] != '.'; p--);           - memcpy (template, prefix, plen);      - *template_tail++ = '.';      + /* If none found, then prefix is the whole filename */      +       + if (p < 0)      + p = l;           + /* Extract prefix and (possibly empty) suffix from filename */      +       + memcpy (prefix, s, p);      + prefix[p] = '\0';      +      + memcpy (suffix, s+p, l-p);      + suffix[l-p] = '\0';      +      + /* Try indexed filenames until an unused one is found */      +       do      - number_to_string (template_tail, count++);      - while (file_exists_p (template));      + sprintf (filename, "%s-%d%s", prefix, count++, suffix);      + while (file_exists_p (filename));           - return xstrdup (template);      + return xstrdup (filename);      }           /* Return a unique file name, based on FILE.           - More precisely, if FILE doesn't exist, it is returned unmodified.      - If not, FILE.1 is tried, then FILE.2, etc. The first FILE.<number>      - file name that doesn't exist is returned.      + More precisely, if FILE.SUF doesn't exist, it is returned unmodified.      + If not, FILE-1.SUF is tried, then FILE-2.SUF etc. The first      + FILE-<number>.SUF file name that doesn't exist is returned.           The resulting file is not created, only verified that it didn't      exist at the point in time when the function was called.      Index: doc/wget.texi      ===================================================================      --- doc/wget.texi (revision 2276)      +++ doc/wget.texi (working copy)      @@ -561,16 +561,16 @@      cases, the local file will be @dfn{clobbered}, or overwritten, upon      repeated download. In other cases it will be preserved.           -When running Wget without @samp{-N}, @samp{-nc}, or @samp{-r},      -downloading the same file in the same directory will result in the      -original copy of @var{file} being preserved and the second copy being      -named @samp{@var{file}.1}. If that file is downloaded yet again, the      -third copy will be named @samp{@var{file}.2}, and so on. When      -@samp{-nc} is specified, this behavior is suppressed, and Wget will      -refuse to download newer copies of @samp{@var{file}}. Therefore,      -``@code{no-clobber}'' is actually a misnomer in this mode---it's not      -clobbering that's prevented (as the numeric suffixes were already      -preventing clobbering), but rather the multiple version saving that's      +When running Wget without @samp{-N}, @samp{-nc}, or @samp{-r}, downloading the      +same file in the same directory will result in the original copy of @var{file}      +being preserved and the second copy being named      +@samp{@var{prefix}-1.@var{suffix}}, assuming @var{file} = @var{prefix.suffix}.      +If that file is downloaded yet again, the third copy will be named      +@samp{@var{prefix}-2.@var{suffix}}, and so on. When @samp{-nc} is specified,      +this behavior is suppressed, and Wget will refuse to download newer copies of      +@samp{@var{file}}. Therefore, ``@code{no-clobber}'' is actually a misnomer in      +this mode---it's not clobbering that's prevented (as the numeric suffixes were      +already preventing clobbering), but rather the multiple version saving that's      prevented.           When running Wget with @samp{-r}, but without @samp{-N} or @samp{-nc},      @@ -1592,7 +1592,7 @@      @item -l @var{depth}      @itemx --level=@var{depth}      Specify recursion maximum depth level @var{depth} (@pxref{Recursive      -Download}). The default maximum depth is 5.      +Download}). The default maximum depth is 5. Zero means infinite recursion.           @cindex proxy filling      @cindex delete after retrieval      @@ -1803,6 +1803,15 @@      Specify the domains that are @emph{not} to be followed.      (@pxref{Spanning Hosts}).           +@cindex file size range      +@item -s @var{size}      +@itemx --min-size=@var{size}      +Limit the minimum size of non-HTML files to @var{size} kB. Smaller files will       not be retrieved.      +      +@item -M @var{size}      +@itemx --max-size=@var{size}      +Limit the maximum size of non-HTML files to @var{size} kB. Larger files will       not be retrieved.      +      @cindex follow FTP links      @item --follow-ftp      Follow @sc{ftp} links from @sc{html} documents. Without this option,      @@ -3064,6 +3073,14 @@      too.           @item      +Retrieve in directory 'pics' all jpeg images from a given site, excluding      +files smaller than 50k (to avoid thumbnails) or larger than 400k.      +      +@example      +wget -Ppics -nd -r -l0 -Ajpg,jpeg -s50 -M400 http://www.server.com      +@end example      +      +@item


title: Does Fedora play all movie formats out- of-the-box?

text: Because Ubuntu does not. With Ubuntu it is the greatest of hassles to get certain video formats to play, like mp4 and wmv. With Fedora, does the movie player just play all movie formats out-of-the-box?


title: Why does the following osd_cat script fail?

text: I'm writing a simple `osd_cat`-based utility to display messages received through libpurple (via Finch or Pidgin, for example). As of now, this is what I have managed to create:               dbus-monitor "interface=im.pidgin.purple.PurpleInterface, member=ReceivedImMsg" | awk '/string/ && (NR%2==1) {split($0, sender, "\"") }; /string/ && (NR%2==0) {print sender[2] ": " substr($0,11) }' | osd_cat --pos=top --align=right --indent=8 -O 4 -u white      Or split into multiple lines for enhanced reading pleasure:               dbus-monitor "interface=im.pidgin.purple.PurpleInterface, member=ReceivedImMsg"      | awk '/string/ && (NR%2==1) {split($0, sender, "\"") };             /string/ && (NR%2==0) {print sender[2] ": " substr($0,11) }'      | osd_cat --pos=top --align=right --indent=8 -O 4 -u white      I did some experimenting, and found following to work:               yes | osd_cat     echo "text" | osd_cat     dbus-monitor | osd_cat     dbus-monitor | awk '{print $0}' | osd_cat     dbus-monitor "interface=im.pidgin.purple.PurpleInterface, member=ReceivedImMsg" | osd_cat      But following do not work:               dbus-monitor | awk '{print $1 $2}' | osd_cat     dbus-monitor "interface=im.pidgin.purple.PurpleInterface, member=ReceivedImMsg" | awk '{print $0}' |osd_cat      I am completely lost.


title: Defining a TV on a laptop as a separate xorg screen

text: I'm currently using the OpenELEC embedded XBMC distro with my HP Pavilion dv6 laptop (which is based on AMD Vision, so I'm using fglrx for video). It's hooked up to my Sony 1080p telly via HDMI. Right now, the TV is showing images at 1366x768 (the same resolution as the laptop's built-in display). If I tell XBMC to up the resolution to 1920x1080, both displays go mad (picture goes out of bounds, etc), which I assume is X not being able to cope with one of the displays not being able to reach it. Here's the xorg.conf OpenELEC is using right now: http://pastebin.com/kvfY6w6L And here's the result of xrandr: http://pastebin.com/pznhrtbz If I fire aticonfig --initial=dual-head, I get this: http://pastebin.com/BVU6vKvN (which only displays on the laptop and not the TV) Does anyone have any ideas what I could do to get video out **only** to the TV? The laptop will be tucked away in a corner so I will have no use for the inbuilt monitor; I just need 1080p out on the TV, no more, no less. If I recall correctly, OpenELEC picks the first display only, which might be useful. Thanks in advance!


title: How to read environment variables of a process

text: Linux's `/proc/<pid>/environ` does not update (as I understand it, the file contain the initial environment of the process). How can I read a process's _current_ environment?


title: In bash, feed output of one command line-by-line into another command

text: I have the following bash command which fetches and block XML from a single column in mysql and feeds it into xmllint to prettify it.               mysql --format csv --skip-column-names -e "select xmldata from mytable limit 1;" | xmllint --format -      So far so good, but it only works for one row at a time. I would like to adapt this so each line in the SQL query output is fed in to a separate call to xmlint. I know this can be done with a loop in a bash script -- but I'd like to do it in a one-liner if possible. Supposedly this can be done with xargs but I can't figure it out.


title: How should I combine many compressed files into one archive?

text: I have a few hundred `.tar.xz` files which are almost identical (they are daily database dumps, and the database changes slowly). I believe that due to the similarities in the uncompressed files, they will compress very well, and small scale tests have shown that compressing any number of these uncompressed files creates an archive only slightly larger than one of them. My problem is that all the uncompressed files would be a few terabytes (compression ratio is about 25:1), and I don't have that much disk space to use as a working area. Is there a way I can process the individual compressed files one at a time, adding them to a single archive and retaining the benefits of compressing them together?


title: How can I run Yast with X and ssh?

text: I have an openSUSE machine which I log on to with ssh -X. I don't want to log in as root but I do want to run graphical Yast. Inside the ssh session sudo starts the console version of Yast. However, in Gnome or KDE it is possible to start Yast as a normal user and then give a root password in a window to run Yast as root. How can I do that from my ssh session?


title: "Operation not supported" for setfacl inside a python script

text: I've programmed a script using python which logs in as `root` on the host machine and executes some commands. Therefore it uses `ssh`. I want to setup `acl`. If I do following commands in the command line, everything works well.               s.execute("setfacl -m user:www-data:r-x,mask:r-x /srv/gitosis/.ssh")     s.execute("setfacl -m user:www-data:r--,mask:r-- /srv/gitosis/.ssh/id_dsa")      This is the python call and I always get:               setfacl: /srv/gitosis/.ssh: Operation not supported     setfacl: /srv/gitosis/.ssh/id_dsa: Operation not supported      What is the problem here? Doing that via ssh directly works well.


title: How do I get GrindEQ (Latex plugin for Word) to work with Word in Wine?

text: GrindEQ is a plugin for MS Word. It allows one to type LaTeX code into a Word document, then export that into Word's formatting (converts equations into Equation Editor equations, and takes care of labelling). I want to get GrindEQ working in Linux under Wine. I have MS Word 2007 running in Wine, and I have installed GrindEQ into MS 2007 in Wine. However, GrindEQ does not work. I get an error "Can't find DLL entry point # in oleaut32.dll" I don't really know what to do! Any suggestions? GrindEQ's website says people have gotten GrindEQ to work with Wine+Linux but they do not provide support to do this. Thanks.


title: "Grep breaks, causing the boot process to hang forever"

text: Question within a question (from the Debian wiki): > Should I use sid on my desktop? > > If you think you can handle a broken Debian system, sure. Do you know what > to do if libpam0g breaks, preventing all logins? Do you know what to do if > grep breaks, causing the boot process to hang forever? These things have > happened. They will happen again. My question is, how does a broken `grep` cause the boot process to hang forever?


title: Can connect from RPi to laptop, but not other way around

text: I'm developing a server-client application (command-line based) in Java. I want to run it on my Raspberry Pi (RPi), but it turns out I can't login to my server-part from my laptop. The problem is that when running the server-part of my application (sockets, port 4444), then I can connect with telnet from my RPi without any problems. When I run the server-part on my RPi, no connection can be established.. I'm not to familiar with Linux, but is it something I need to do in iptables? Other suggestions?


title: Reading lines from a file with bash: for vs. while

text: I'm trying to read a text file and do something with each line, using a bash script. So, I have a list that looks like this:               server1     server2     server3     server4      I thought I could loop over this using a while loop, like so:               while read server; do       ssh $server "uname -a"     done < /home/kenny/list_of_servers.txt      The while loop stops after 1 run, thus only running `uname -a` on server1 However, with a for loop using cat it works fine:               for server in $(cat /home/kenny/list_of_servers.txt) ; do       ssh $server "uname -a"     done      Even more baffling to me is that this also works:               while read server; do       echo $server     done < /home/kenny/list_of_servers.txt      Why does my first example stop after the first iteration?


title: Converting PDF to PDF/A?

text: Given a PDF of random origin, how do I, on Linux:   * confirm whether it is in PDF/A format already?   * if it is not in PDF/A format, convert it to PDF/A with a minimum loss of fidelity? I am aware that the conversion may cause loss of exotic elements of the document, but let's assume that the ability to open the document at all in a relatively far future is more important than such spiffy features (which might not be available/readable at such a time anyway). I would rather be able to visually confirm the accuracy of the conversion when I can trivially view the documents side by side than risk not being able to open the original file.


title: Configuring CUPS PDF writer for PDF/A output?

text: Can the PDF pseudo-printer in CUPS be configured to emit PDF/A files? If so, how to do it? I'm using CUPS 1.5.3-5 and CUPS-PDF 2.6.1-6 as provided by Debian Wheezy/7.0. Despite CUPS PDF Format - Documentation claiming that "CUPS PDF files (application/vnd.cups-pdf) are device-dependent PDF/A files that contain a job ticket information.", at least one online validator claims that a to-PDF print of itself from the web browser "does not conform to PDF/A".


title: Installing CentOs 6 with Direct Admin

text: I'm trying to install CentOS with a Direct Admin package. I have done it almost 10 already times but this time I can't get it to work. I've written down all of my steps here:   1. Give root password: `*************`   2. Which type of installation would you like: Use all space   3. CentOS version: minimal without checking other boxes   4. System proceeds with the installation  At this point, the following steps are done via an SSH connection Installing Direct admin:   1. Pre-install using the first line for Redhat, Fedora, and CentOS (can be seen here)   2. While installing, the system asked me to install the selected software. I said yes.   3. Donwloading DA: `wget http://www.directadmin.com/setup.sh`   4. Set permissions for the install file: `chmod 755 setup.sh`   5. Running the setup for DA: `./setup.sh` Settings for installing:   1. Client ID: empty, I have a lifetime license that's connected with my Hosting   2. License ID: empty, I have a lifetime license that's connected with my Hosting   3. Enter your hostname: juniorprogrammer.nl (This domain is not in use and is waiting until I can install the domain in direct admin. Domain is only pointed to the server)   4. Is eth0 your network adaptor with the license IP (`***.***.***.199`): I said Yes   5. Is `***.***.***.199` the IP in your license? (y,n) : y   6. DirectAdmin will now be installed on: Enterprise 6.5. Is this correct? (must match license) (y,n) : y Now I can select a package number: > You now have 4 options for your apache/php setup. > > 1: customapache: end-of-life software. Apache 1.3, php 4, frontpage. Do not > use. No support. > > 2: custombuild 1.1: end-of-life software. Apache 2.x, php 4, 5, or both in > cli and/or suphp. Defaults to php 5.2 > > 3: custombuild 1.2: Production version: Apache 2.x, php 5, 6, or both in cli > and/or suphp. Defaults to php 5.3 > > 4: custombuild 2.0 BETA: Apache 2.4, mod_ruid2, php 5.5. Can be set to use > php-FPM or fastcgi. > > Post any issues with custombuild to the forum: > http://forum.directadmin.com/forumdisplay.php?f=61 > > Enter your choice (1, 2, 3 or 4): I pressed 3. > Would you like the default settings of apache 2.2 and php 5.3 cli? (y/n): y > > Would you like to search for the fastest download mirror? (y/n): yes After installing all, this messages pops up: > You are not authorized to download the update package with that client id > and license id for this IP address. Please email sales@directadmin.com After that I go to `***.***.***.199:2222` and I get an error with page not found. What am I doing wrong?


title: allow user access via ssh to /var/www/

text: Context: I am creating a gitolite3 hook for a specific repo, which contains some logic and css foo of my website. so what essentailly happens is Content under `/var/www/nginx/` looks like:               drwxrwxr-x. nginx   git   system_u:object_r:httpd_sys_content_t:s0 foo      `.git` is special:               drwxrwxr-x. git     git   system_u:object_r:httpd_sys_content_t:s0 .git      To make sure all subdirs have the proper access rights I used:               chown nginx:git -Rf ./webfoo     chmod g+rw -Rf ./webfoo     chown git:git -Rf ./webfoo/.git      * * * [This is just bonus, you can skip this.] The gitolite3 hook               #!/bin/bash     cd /var/www/nginx/webfoo || exit     unset GIT_DIR     echo "where: $(pwd)"     git pull -f origin deploy-me-branch      * * *               remote: where: /var/www/nginx/webfoo     remote: From /home/gitolite/repositories/webfoo     remote:    c092ee2..07274a6  master     -> origin/master     remote: error: unable to unlink old '.gitignore' (Permission denied)     remote: error: unable to unlink old 'templates/fancypost.html' (Permission denied)     remote: error: unable to unlink old 'templates/layout.html' (Permission denied)      * * * `/var/log/audit/audit.log` does not contain any access denies. * * * **Update:** Even loging in `git` locally does not work either. So this is probably **unrelated to SELinux/file security context**. * * * **Why does this fail to work as I'd expect?**


title: Using hardware clock on linux

text: I using an old version of RHEL that I have recently upgraded from 5.4 to 5.8, with a customised 2.30.9 kernel. The system clock drifts wildly (> 5 seconds/day) unless it is controlled using an external time source such as NTP. The hardware clock on the BIOS appears to be much more accurate (< 1 second/week). I have several Linux boxes available, and if I inspect `/etc/adjtime` I find that the drift is measured as 0.000004, -0.000050, 10.000107 and -0.000234 seconds / day on different machines with identical Hardware, OS & Applications. We need to minimise the clock drift when the externel time source is not available. I have tried various kernel boot options with varying success to improve things: Initially kernel set up line in `/boot/grub/grub.conf`               kernel /vmlinuz-2.6.30.9 ro root=LABEL=/ pmtr=0x608 acpi_pm_good clocksource=acpi_pm noapic ide_core.noprobe=1.1 mem=512M ramdisk_size=262144      The clocksource files contain:               cat /sys/devices/system/clocksource/clocksource0/available_clocksource     tsc acpi_pm jiffies          cat /sys/devices/system/clocksource/clocksource0/current_clocksource     acpi_pm      This drifts at more than 5 seconds/day! First I tried to enable the HPET:               kernel /vmlinuz-2.6.30.9 ro root=LABEL=/ pmtr=0x608 acpi_pm_good hpet=enable clocksource=hpet noapic ide_core.noprobe=1.1 mem=512M ramdisk_size=262144      The clocksource files contain:               cat /sys/devices/system/clocksource/clocksource0/available_clocksource     tsc acpi_pm jiffies          cat /sys/devices/system/clocksource/clocksource0/current_clocksource     tsc      This still seems to drift but at only about 4 seconds/day. Next I tried turning off tsc: kernel /vmlinuz-2.6.30.9 ro root=LABEL=/ pmtr=0x608 acpi_pm_good notsc divider=10 acpi_pm_good clocksource=acpi_pm noapic ide_core.noprobe=1.1 mem=512M ramdisk_size=262144 The clocksource files contain:               cat /sys/devices/system/clocksource/clocksource0/available_clocksource     tsc acpi_pm jiffies          cat /sys/devices/system/clocksource/clocksource0/current_clocksource     acpi_pm      This has been running for about a day and there is no noticable drift. My questions are these: 1) According to this website http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1006427 the `divider=10 clocksource=acpi_pm` requirement was removed at RHEL 5.3, so why does it improve things for RHEL 5.8? 2) What are the effects of the kernel parameters that I have been changing? 3) How accurate is the drift in `/etc/adjtime`? 4) Is it possible to set up to update `hwclock` when ntp is working? 5) Is there a better way of achieving what I am trying to do? thanks


title: xdg-open ignores my application definitions

text: I am running **compiz-gnome** session with **xfdesktop** on **fc16** , don't ask why, but I have this weird problem. Some of the applications (e.g. tracker, or evolution )do not start the proper application for the appropriate filetype; instead nautilus is launched. I have checked under `./local/share/applications/` for the presence of the `.desktop` file, and `mimeapps.list` . I have debugged a bit and it seems that xdg-open does appropriate launch `gvfs-open`.


title: Use shared libraries in /usr/local/lib

text: I have build some libraries from sources, and the files after make install are in `/usr/local/lib` For example, in my case I have the file `libodb-2.2.so` which is in this directory. However when I launch the executable that has linked with `libodb`, I got the error: error while loading shared libraries: `libodb-2.2.so: cannont open shared object file: No such file or directory.` Does it mean that I have build my executable not correctly ? or should I indicate the system that there maybe some interesting libs in the folder `/usr/local/lib` also ? I'm using Ubuntu 12.04, Linux kernel 3.2.0-38-generic.


title: Access Windows File System From Linux OS

text: My sister's computer has stopped working. I am not entirely sure what the problem is, but I think it is a Windows/software issue. She really just wants to retrieve the pictures off it. I am wondering if I could install a Linux OS (CentOS is the only one with which I am little familiar) on the free space and access her Windows file system. I know there are several 'what ifs', but is this a possibility?


title: How to print keyboard shortcuts in human-readable form?

text: It would be very useful to have a user-friendly way to get an overview of the currently defined keyboard shortcuts. In other words, given the `/etc/inputrc` lines               "\e[A": history-search-backward     "\e[11~": backward-word      and `~/.inputrc` lines               "\e[A": kill-word     "\e\eOD": backward-word      it shouldn't be necessary to go through both files to figure out that `\e[A` has been overridden, that there are two alternative shortcuts for `backward- word`, that `\e\eOD` means ... whatever it means, and that `kill-word` actually means to delete to the end of the current (or next) word. The ideal solution would print something like               Delete until next word boundary: Meta-A     Go to the previous word boundary: F1; Ctrl-Left     Search history backwards: Meta-Up      (Hopefully someone with a better understanding of escape sequences can fix the shortcuts.) **Is there a Linux program to print this?** I'm guessing such a program might be OS, kernel, or even keyboard-dependent, so maybe it would need extensive configuration (a program which polls the user via `showkey` or `xev` to press miscellaneous keys to establish which escape sequences are really sent, for example), but that would be an acceptable price to finally understand how to use terminal shortcuts efficiently.


title: Get top-level directory from makefile variable

text: What is the simplest code to get the top-level directory part of a makefile variable? Example:               BUILD_DIR = dir/subdir/.../sub-a-dub-dir     distclean:             rm -rf <some code which evaluates to "dir" from $(BUILD_DIR)>      PS: I don't mean `$(dir $(dir $(BUILD_DIR)))`, but something which gets the first directory part of _any_ variable value.


title: Different shells for interactive and non-interactive work

text: Due to constraints at my workplace, the default shell for every user is `tcsh`, and I am required to use `tcsh` as my non-interactive shell (i.e. we do most of the environment configuration across projects in `tcsh` init files). However, I like using `zsh` as my interactive shell. In order to inherit the environment from `tcsh` when I switch to `zsh`, I usually first start an interactive shell in `tcsh` and later switch to zsh with `exec zsh`. This seems to be working well. However, sometimes we update our `tcsh` init files, and I need to refresh my environment accordingly **from a running`zsh`** shell. I believe the best way to approach this problem is to switch to `tcsh` to source its init filts and then switch back to `zsh`. In practice I resort to the following               > # Running from a zsh interactive shell.      > # Various tcsh and zsh init files have been updated     > exec tcsh     > exec zsh     > # I am back to zsh with the updated environment      But I am wondering several things:   1. Is there a way of collapsing  > >     > exec tcsh >     > exec zsh >   into one command? I have tried with: > >     > exec tcsh; zsh >     > exec tcsh; exec zsh >   but none of them seem to work. The only one that seems to work is > >     > exec tcsh & exec zsh >   but I am not sure that is doing what I need.   2. What other ways are there for fully restarting my interactive shell while re-sourcing my non-interactive environment (i.e. **as if I was logging in again** in `tcsh` and then switching to zsh)   3. More generally, what is the recommended practice for using different shells for interactive and non-interactive work and making sure that **the interactive shell starts with the environment from the non-interactive shell**? (with the possibility of modifying bits of this environment in the init files of the interactive shell )


title: Configuring multiple static IP addresses for a disk image

text: Using Ubuntu 10.04 I'm using Clonezilla to create and install a customized image. I'd like to be able to set up multiple static IP addresses. For example, I'd like the first interface to have the IP 10.0.0.1 and the second interface to have the IP 10.0.0.2 I have tried setting up two connections using NetworkManager, but can't associate a specific MAC address with them as these will be different for all target machines. Because of this, NetworkManager sets both adapters to the same IP address (10.0.0.1). I clear the udev network rules before imaging, so all machines are guaranteed to have an eth0 interface. However some targets are going to use a USB NIC adapter for the second interface, so they are not guaranteed to have an eth1. That is, it's possible that different USB NIC adapters will be used, and Linux will assign each a new interface name. Is there any way to assign the two IP addresses to the different adapters without the second having a fixed name using NetworkManager or /etc/network/interfaces?


title: Puppy frugal install Harddisk Grub Problem

text: I tried to install Puppy Linux 5.2 on a Harddisk (IDE), since the BIOS does not allow USB boot. As described here, I ran the universal installer and chose Harddisk, Then i create a small partition with gparted (ext3, 1GB) and Puppy copied all the needed files from the Live-CD to the directory. In my case this was `/tmp/boot/...` After that Puppy asks me to modify Grub `menu.lst`. Since I couldn't find it, I started installing by opening "grub config" program through the menu. All went smooth and I was asked to put the path where to install, and I used `/dev/sda1` since it's my hard drive. After restarting i come to the grub boot manager where chosing Linux (on dev/sda1) results in `Error 15: File not found`. Is this path "TMP/boot/..." somehow wrong (Puppy 5.2 did put it there automatically)? Why is this happening?


title: Creating multiple proxies on a single VPS

text: I am trying to create SOCKS Proxies on my Debian Linux VPS. I was just wondering what is the best way to go about doing this? I have tried things like Dante and it doesn't support multiple Proxies.


title: Faillog - unsuccessful login count in Motd

text: I wish to include a count of failed login attempts whenever a user logs in. I've created:               /usr/local/bin/dynmotd      which contains               #!/bin/bash          FAILLOG=`faillog -u`          echo -e "     $FAILLOG     "      and added `/usr/local/bin/dynmotd` to `/etc/profile` The issue is I get `/var/log/faillog: Permission denied` whenever I login as a regular user. Is there a way to either safely temporarily escalate privileges to run that command on the motd, or temporarily give that user access to faillog to get that response? I don't want to give all user access to faillog permanently. **UPDATE** Tried this:               #!/bin/bash          CURRENTUSER=`whoami`          sudo -u bob setfacl -m u:$CURRENTUSER:rx /var/log/faillog          FAILLOG=`sudo -u bob faillog -u $CURRENTUSER`          echo -e "     $FAILLOG     "      Add added 'bob' to the sudoers with `NOPASSWD:`, this works fine when I'm logging in as 'bob' but if I try and login as 'bob2' I get asked for the sudoers password.


title: How to read from two input files using while loop

text: I wanted to know if there is any way of reading from two input files in a nested while loop one line at a time. For example, lets say I have two files `FileA` and `FileB`. **FileA:**               [jaypal:~/Temp] cat filea     this is File A line1     this is File A line2     this is File A line3      **FileB:**               [jaypal:~/Temp] cat fileb     this is File B line1     this is File B line2     this is File B line3      **Current Sample Script:**               [jaypal:~/Temp] cat read.sh      #!/bin/bash     while read lineA         do echo $lineA          while read lineB             do echo $lineB              done < fileb     done < filea      **Execution:**               [jaypal:~/Temp] ./read.sh      this is File A line1     this is File B line1     this is File B line2     this is File B line3     this is File A line2     this is File B line1     this is File B line2     this is File B line3     this is File A line3     this is File B line1     this is File B line2     this is File B line3      ### Problem and desired output: This loops over FileB completely for each line in FileA. I tried using continue, break, exit but none of them are meant for achieving the output I am looking for. I would like the script to read just one line from File A and then one line from FileB and exit the loop and continue with second line of File A and second line of File B. Something similar to the following script -               [jaypal:~/Temp] cat read1.sh      #!/bin/bash     count=1     while read lineA         do echo $lineA              lineB=`sed -n "$count"p fileb`             echo $lineB             count=`expr $count + 1`     done < filea          [jaypal:~/Temp] ./read1.sh      this is File A line1     this is File B line1     this is File A line2     this is File B line2     this is File A line3     this is File B line3      Is this possible to achieve with while loop?


title: How do I set a user's default .bashrc file?

text: On Ubuntu 10.4 I have edited the `/etc/bash.bashrc` file to set some variables like the command history size (`HISTSIZE=5000`), however if I create a new users Ubuntu by default gives them a `.bashrc` file in their home directory with this set as `HISTSIZE=1000` which is overriding mine. How can I change the default `.bashrc` file that is created?


title: How can I regenerate the default '/etc/' config files?

text: I've removed `nagios3` with `apt-get remove nagios3` and then removed the files in by using the command `sudo rm -R /etc/nagios*` Now when I run `apt-get install nagios3` the config files (`/etc/nagios3/*`) are not present. How can I regenerate them? This box is on Ubuntu 10.04.


title: User mounted secondary drive as /var

text: I have a drive that someone else mounted using               mount /dev/sdc1 /var      At some point they complained that all the data was missing Now:               mount /dev/sdc1 /media/testdrive          df -h shows 130GB used     du -h shows 1.2MB used      In the `/media/testdrive` are the standard lib run spool directories. How should I proceed to recover the files?


title: Performance and limitations of using an X GUI remotely?

text: I don't really have any experience with X. It appears from what I read that X has always been built from the ground up to allow windows in the WM to be transmitting over the internet, without trasmitting a bitmap (or compressed bitmap) of the entire screen (which would require at least as much bandwidth as a youtube video).   1. Can any Linux app's GUI (whether it uses GTK or whatever) be run seamlessly over a remote connection?   2. Is the "lag" in using the GUI remotely significantly better than a VNC?


title: Salvaging a "broken" hard drive

text: My girlfriend's macbook's hard drive failed, so I gave her a new one and reinstalled OSX on it. Works fine. However, I wanted to see if I could use her old hard drive for backups/fun. I was able to wipe the partitions on the drive and make one single `ext4` partition on it. I was then able to mount it and check it's size (~230G, perfect). Then I tried backing up my home directory to the hardrive using `sudo cp -r ~/* /media/tmp` where `/media/tmp` is the mounted filesystem. My home directory is around 35G in size. I was able to get far into the copy, then I received this:               sudo cp -r ./* /media/tmp/     root's password:     cp: writing `/media/tmp/media/music/Neutral Milk Hotel/In the Airplane Over the Sea/09 Ghost.mp3': Read-only file system     cp: cannot create regular file `/media/tmp/media/music/Neutral Milk Hotel/In the Airplane Over the Sea/07 Communist Daughter.mp3': Read-only file system     cp: cannot create regular file `/media/tmp/media/music/Neutral Milk Hotel/In the Airplane Over the Sea/06 Holland, 1945.mp3': Read-only file system     cp: cannot create directory `/media/tmp/media/music/Neutral Milk Hotel/Everything Is': Read-only file system     cp: cannot create directory `/media/tmp/media/music/Neutral Milk Hotel/1996 - On Avery Island': Read-only file system     cp: cannot create directory `/media/tmp/media/music/Neutral Milk Hotel/Beauty': Read-only file system     cp: cannot create directory `/media/tmp/media/music/Neutral Milk Hotel/1998 - In the Aeroplane Over the Sea': Read-only file system     cp: cannot create directory `/media/tmp/media/music/Neutral Milk Hotel/Invent Yourself A Shortcake': Read-only file system     cp: cannot create directory `/media/tmp/media/music/Tim Minchin And The Heritage Orchestra': Read-only file system     cp: cannot create directory `/media/tmp/media/music/Dethklok': Read-only file system     cp: cannot create directory `/media/tmp/media/music/The Tossers - Discography [77era]': Read-only file system     cp: cannot create directory `/media/tmp/media/music/Porcupine Tree (All Studio Albums)': Read-only file system     cp: cannot create directory `/media/tmp/media/music/Protest The Hero': Read-only file system     cp: cannot create directory `/media/tmp/media/music/Dream Theater': Read-only file system     cp: cannot create directory `/media/tmp/media/pictures': Read-only file system     cp: cannot create directory `/media/tmp/media/videos': Read-only file system     cp: cannot create directory `/media/tmp/misc': Read-only file system     cp: cannot create directory `/media/tmp/Monster Complete Series (Eng.-Dub)': Read-only file system     cp: cannot create directory `/media/tmp/repo': Read-only file system     c    p: cannot create directory `/media/tmp/web': Read-only file system          Message from syslogd@linux-vwzy at Dec 11 21:48:16 ...      kernel:[950354.789962] journal commit I/O error      Pardon me for the personal files there, now you know what kind of music I listen to. I'm not quite sure exactly what's happening here. Are there bad sectors on the hard drive? What does the `kernel:[950354.789962] journal commit I/O error` message mean? Whatever the issue, is there a way I can fix this? What if I determine where the issue lies on the disk and never write up that sector, would that work? **Update** So supposedly the os ran into too many errors while writing to the disk, and put it into read-only mode as a response. _So I guess my only question is if there is a way around this? Is this problem directly related to the size of data I write on the disk (ie if I only write 1G will the data be safe as long as I don't touch those bad parts)?_


title: How do I get tcpsvd to drop its root privileges?

text: Assume a script runs on boot as root. From this script I want to start `tcpsvd -E 0 515 lpd`. I want `tcpsvd` to run as an unprivileged user. But it requires root privileges to bind to the port 515. How can I achieve this? Further I have to use `busybox tcpsvd`:               tcpsvd     tcpsvd [-hEv] [-c N] [-C N[:MSG]] [-b N] [-u USER] [-l NAME] IP PORT PROG          Create TCP socket, bind to IP:PORT and listen for incoming connection.     Run PROG for each connection.              IP              IP to listen on. '0' = all         PORT            Port to listen on         PROG [ARGS]     Program to run         -l NAME         Local hostname (else looks up local hostname in DNS)         -u USER[:GRP]   Change to user/group after bind         -c N            Handle up to N connections simultaneously         -b N            Allow a backlog of approximately N TCP SYNs         -C N[:MSG]      Allow only up to N connections from the same IP                         New connections from this IP address are closed                         immediately. MSG is written to the peer before close         -h              Look up peer's hostname         -E              Do not set up environment variables         -v              Verbose


title: How much RAM needed for preventing use swap?

text: At my system always available some "Free" and "Inactive" memory, but sometimes system move couple megabytes to swap. Per night it maybe around 100MB, but for a few days in swap could be more than 4000MB. How can I determine required memory for my system?


title: how to connect centos from windows remotely?

text: I am using Oracle virtualbox and I have installed centos 6.4. How can I connect remotely to centos with WinSCP from Windows? There are fields like "hostname" in WinSCP but I don't know what to write.


title: rsync to SFTP while moving completed uploads to another folder

text: I'm going to be moving a lot of data (30GB) to a server which is split up into multiple 200MB tar.gz files. This is going to take time, and I'm going to need to stop and start my computer again during this process, thus interrupting the transfer. What I'd like to do is the following:               find . -maxdepth 1 -type f -iname "*.tar.gz.*" | while read file ; do         scp "$file" username@host:/backup/         mv "$file" "already-done/"     done      Unfortunately, I can't copy a SSH key to this box because it's a non-standard setup which I don't have control over, so I need to manually input my password each time I create a connection, which makes the while loop above unproductive. Is there a way for me to use rsync to copy files to this server over a single persistent SSH connection, while moving completed backups to another directory so I don't end up copying them again on a fresh boot?


title: Missing Dependencies/Packages on yum install

text: I'm at my wit's end with this. After a lengthy series of events I've been trying to install libreoffice on Centos 6.3 using yum I've was successful in the past but after encountering some seg faults when using it with unoconv. I tried installing and uninstalling numerous other versions of both LibreOffice and OpenOffice. No I'm trying to go back to my initial set up I'm presented with a long list of errors of the nature:               Error: Package: 1:libreoffice-calc-3.4.5.2-16.1.el6_3.x86_64 (updates)                Requires: libuno_cppuhelpergcc3.so.3(UDK_3.6)(64bit)     Error: Package: 1:libreoffice-calc-3.4.5.2-16.1.el6_3.x86_64 (updates)                Requires: libreoffice-ure = 1:3.4.5.2-16.1.el6_3     Error: Package: 1:libreoffice-calc-3.4.5.2-16.1.el6_3.x86_64 (updates)                Requires: libuno_cppu.so.3(UDK_3.3)(64bit)     Error: Package: 1:libreoffice-core-3.4.5.2-16.1.el6_3.x86_64 (updates)                Requires: libuno_salhelpergcc3.so.3()(64bit)     Error: Package: 1:libreoffice-core-3.4.5.2-16.1.el6_3.x86_64 (updates)                Requires: libuno_sal.so.3(UDK_3_0_0)(64bit)     Error: Package: 1:libreoffice-base-3.4.5.2-16.1.el6_3.x86_64 (updates)                Requires: libjvmfwk.so.3()(64bit)     Error: Package: 1:libreoffice-calc-3.4.5.2-16.1.el6_3.x86_64 (updates)                Requires: libuno_sal.so.3(UDK_3.1)(64bit)     Error: Package: 1:libreoffice-core-3.4.5.2-16.1.el6_3.x86_64 (updates)                Requires: libuno_sal.so.3()(64bit)     Error: Package: 1:libreoffice-core-3.4.5.2-16.1.el6_3.x86_64 (updates)                Requires: libuno_cppu.so.3(UDK_3.1)(64bit)     Error: Package: 1:libreoffice-calc-3.4.5.2-16.1.el6_3.x86_64 (updates)      I believe I deleted something I shouldn't have but I have no idea where to start. Any help or advice on fixing this would be greatly appreciated.


title: Unix 11i v2 Script to detect new files within directory

text: I was hoping someone can point me in the right direction. I would like to create a script to check for new files (files with today's date) within a directory and then print the results to a text file. Could I use `cron` or `bash`? edit: Updated original thread. I tried the following on my Linux Mint VM and I got it to work. The only problem is: 1) when i create a new file (using "sudo vi newtextfile.txt" and then ":w") i receive the notification email _4 times_. 2) am i triggering multiple IN_CREATE events by creating a new file using the method i mentioned above?               /xyz/jon >>>     total 12     786436 drwxr-xr-x 2 root root 4096 Jul 13 20:43 .     786434 drwxr-xr-x 4 root root 4096 Jul 13 19:45 ..     786441 -rwxr-xr-x 1 root root 48 Jul 13 20:32 mylogger.sh     786437 -rw-r--r-- 1 root root 0 Jul 13 20:22 mylogtoday.txt               "incron.table-jonincron" >>>     /xyz/client IN_CREATE /xyz/jon/mylogger.sh               /xyz/jon/mylogger.sh >>>     sudo mail -s "testing script" emailaddress@domain.com


title: Cannot edit crontab

text: I'm running RHEL 5.6. I type               $ crontab -e      and all I see is               Killed      I am, however, able to edit a file (let's say I call it crontab.in) and then type               $ crontab crontab.in     $ crontab -l      and see that it works that way and the entry I placed in `crontab.in` will run when it should. So why is `crontab -e` not working for me?


title: Problem getting Fedora to run in VirtualBox

text: I'm using Ubuntu 12.04 64-bit, trying to get Fedora 18 64-bit to run in the Oracle VM VirtualBox. I've got VirtualBox installed (via the .deb package available from the official site,) and I got the Fedora 18 64-bit DVD image downloaded. I then created a new virtual machine, with appropriate settings. When I try to boot the image, it displays a few options: "Install Fedora", "Test this media & install Fedora", and a "Troubleshooting" option. I chose one of the installation options, and it went to a grey screen. I assumed it was just a loading screen, but it wouldn't stop. I let it stay on that screen for a few hours, then killed it. None of the other options yielded any different results.


title: Ubuntu with LAMP+Mediawiki suffering spikes

text: I'm sorry if this question is off topic, but I'll give it a shot: I have a VPS running Ubuntu 12.04, a LAMP stack, and Mediawiki. After installing Mediawiki I noticed that my wiki site was spiking, i.e. every couple of pages loads would take much longer than necessary. I connected to the server through SSH to find the same problem: I manage to type 4-5 characters perfectly well, but then it takes around 10 seconds to revive and continue reading my keyboard input. I ran the `top` command and I see `mysql` jumping to the top of the list every 5 seconds, taking up apx. 20-40% of CPU. The VPS has 20 GB of SSD, 512 Mb of main memory. Is there an obvious fix to this? p.s. If this is off topic here, would anyone point me to an appropriate site to ask this question?


title: How to use systemd hybrid-sleep instead of suspend under GNOME in Linux?

text: How can I make GNOME 3 use systemd hybrid-sleep instead of suspend, when closing the lid or using suspend from the menu?


title: Worrisome HD related messages after power outage

text: Had a power outage two weeks ago on my BSD server that my UPS decided then was a good time to fail. Just fired it up this evening only to have the following errors show during what I would assume is the rebuild process. ![enter image description here](http://i.stack.imgur.com/qRkAe.jpg) The port for the ECC error has shown up as either 2 or 1 in following errors, and while the rest of the data that you see on the image has not shown up since it stated the rebuild began, the Drive ECC error has popped once twice since that command was displayed. While I have another system to backup critical data too, my questions really are what is this saying, and should I be shopping for hardware. The Drives are WD 250GB on a hardware RAID5 with a 3Ware 9650SE-4LPML 4-Port 3Gb/s RAID card. The OS is FreeBSD 6.2 EDIT: Something different now. Came up with an error that retries were exhausted, and produced the following line               g_vfs_dome():da0s1d[READ(offset=1155956736, length=16384)]error = 5      It then reset the controller and started a rebuild on unit -


title: IBM AIX: How do I set up SSH X forwarding on an unprivileged user with no home?

text: Long story short: I have an AIX server where my user is unprivileged and has no home directory, and it is not easy to fix this because OS-level management of this server is outside of my jurisdiction. I need to be able to do X over SSH on that server in order to run an app's configuration, which is graphical only. I can't set my `XAUTHORITY` variable on my login profile because I don't have a profile and I'm not sure if I'm allowed to configure one. What can I do?


title: Looking for a picture describing Linux concept

text: I'm looking for a picture describing Linux and open-source concept. I remember I saw it once on the Internet. It depicts airplane which is being assembled by mascots of open-source world. They bring different spares of airplane to be able take a flight.


title: export script function

text: I am trying to implement the solution found here. However, a coworker suggested that instead of adding functions directly to a .bash_profile or .bashrc file that instead, the custom scripts be put in their own file and soft linked in /usr/bin. I've done this (and made the script executable), but it doesn't seem to work. I think the functions have to be exported, but I'm not sure how. How do I export the custom script functions so that they will be on the path? eg: So I can run them like any other command. **EDIT #1:** I've found this (and tried it), but it still doesn't seem to work, I'm not sure what I'm doing wrong now...


title: Letting NFS through a FreeBSD PF firewall

text: I'm trying to configure my firewall (PF) on FreeBSD to let NFS traffic through. I know that NFS uses both TCP and UDP to connect to the client along with a bunch of daemons that use random port numbers. Both the NFS server and client are Ubuntu 10.04. Instead of using port numbers for the filtering, I simply used the IP addresses of the client and server to allow the connection. The `pf.conf` rules pertaining to NFS are:               pass in log quick  from external to NFS     pass out log quick from NFS to external      As you can see, the external name is the client and NFS is the server. Both are resolved to their IP addresses. The problem is that some of the packets are being stopped by PF with the following error:               11:38:52.440123 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 60)     NFS-lan0.sunrpc > External-lan1.38390:  tcp 40 [bad hdr length 0 - too short, < 20]          What do I need to change to let these packets through?


title: Getting tree command to not display directories

text: I've read through the man pages for `tree` but I don't know if it is possible to have tree list only the filenames for all files that appear in any recursive search of a directory. The closest I have gotten is: `tree -i --noreport dir/` which might give me something like:               ./lib     order     crossCount.js     rank     acyclic.js      Where `order`, `lib`, and `rank` are directories that I do not want listed.


title: How can I protect my computer when the only way to access the internet is though a compromised internet connection?

text: I access the network through a connection which is most likely compromised by a MITM attack. I can't do much about it. What steps should I take to lessen the influence of this attack. I'm especially concerned about the attacker messing with repository links and compromising my system. I want suggestions for hardening my system to lessen the damage of the attack. Tips related to firewall, repository signatures, intrusion detection, honeypot etc. **P.S: A possibly compromised connection is the only way for me to access the internet. No suggestions regarding this**


title: Pipe output of jack_cpu_load through sed

text: In the shell, when I pipe `jack_cpu_load` through `sed`, or `cut`, no matter what options I use it stops printing just before the lines I want to see. `jack_cpu_load | sed -n 8p` will print:               Jack: JackClient::kActivateClient name = jack_cpu_load ref = 4      The very next line should read something like `jack DSP load 0.294772` which is what I'm looking for, but when I run `jack_cpu_load | sed -n 9p` which should print that line, there is nothing. Just a cursor, until I hit `Ctrl`+`C` and kill it. Unfortunately there is very little documentation on this command and I'm just a user, a musician no less, trying to hack together something that will let me see the dsp load at a glance in my status bar. Terminal Output:               tony@hydra ~ $ jack_cpu_load     Jack: JackClient::SetupDriverSync driver sem in flush mode     Jack: JackPosixSemaphore::Connect name = jack_sem.1000_default_jack_cpu_load     Jack: JackPosixSemaphore::Connect sem_getvalue 0     Jack: Clock source : system clock via clock_gettime     Jack: JackLibClient::Open name = jack_cpu_load refnum = 4     Jack: JackClient::Activate     Jack: JackClient::ClientNotify ref = 4 name = jack_cpu_load notify = 2     Jack: JackClient::kActivateClient name = jack_cpu_load ref = 4      jack DSP load 0.163633     jack DSP load 0.159914     jack DSP load 0.159449     jack DSP load 0.164087     jack DSP load 0.159971     ^CJack: jack_client_close        For this:               tony@hydra ~ $ jack_cpu_load 2>&1 | sed -n 8p     Jack: JackClient::kActivateClient name = jack_cpu_load ref = 4       And for this:               tony@hydra ~ $ jack_cpu_load 2>&1 | sed -n 9p        There's nothing. The output for strace -f jack_cpu_load http://justpaste.it/e7st


title: Force pubkey-auth user to set password at first login

text: When I create a new user account I ask users to send me a public key, and want to force users to set the password the first time they log in with keypair authentication. If I create an account with an impossible/disabled and expired password, but put a pubkey in their .ssh/authorized_keys file, **the user is required to change his password at first login, but cannot enter his current one!**               # adduser --disabled-password foo     …     # chage -d0 foo      What is a more appropriate way to go about this?


title: Fastest remote X from Windows

text: I have the following set up:               |-----------------|                          |---------------|     |   Windows       |     LAN (or VPN)         |    Linux box  |     | (local machine) | <-------------------->   |               |     |-----------------|                          |---------------|      and I would like to access my Emacs and Eclipse windows on the Linux box from my Windows machine with **minimal latency**. My options seem to be:   * VNC   * Virtualization of a Linux guest on my local Windows host using for example Virtualbox with Ubuntu, and then `ssh -X` to the Linux box from it (here is a thread that discusses configurations for fast ssh X tunneling)   * cygwin with an X server and `ssh -X` to the remote box. At the moment I use RealVNC, but I have noticed some notable **latency**. After doing some research I read on Wikipedia the following: > The VNC protocol is **pixel-based**. Although this leads to great > flexibility (i.e.- any type of desktop can be displayed), it is often less > efficient than solutions that have a better understanding of the underlying > graphic layout like X11 or Windows Remote Desktop Protocol This makes me wonder, what options do I have to get the **fastest access** to remote X windows from a local Windows machine?


title: How to know what is trashing my Linux mint system?

text: My linux system is trashing occassionally. I have 4 GB of ram which is good even for Windows 8. All in all I have good specs. But occasionally the HDD light in the CPU is on for a long time and at the same time the system is not responding. I can't even kill processes. The whole system is hanging. I want to know what is causing this. * * * As requested:               $ cat /proc/sys/vm/swappiness     60


title: Changing HISTTIMEFORMAT leaves entries with incorrect date

text: After exporting `HISTTIMEFORMAT='%F %T'` I tried to query history But the result shows all the commands are executed on same day. How can I check the actual date and time of actual command execution?


title: show gateway IP address when performing ifconfig command

text: Currently, when using the `ifconfig` command, the following IP addresses are shown: own IP, broadcast and mask. Is there a way to show the related gateway IP address as well (on the same screen with all the others, not by using 'route' command)?


title: How do I change the path used by the Gnome Command Line applet?

text: For my shell, I know that I have to modify `.bashrc` to add my `~/bin` directory to the command path, but how do I get the Gnome Command Line applet to use that as a program location too? I'm using v2.13.0.1 if that makes a difference


title: Where to find the error messages of Postfix

text: I cannot sent mail by using Postfix (SMTP) on Ubuntu Server 11.04. So, there must be some errors, But where to see the error message?


title: Korn shell timeout/kill script

text: I am trying to write a simple Korn shell script to execute a loading process. The process occasionally runs into connectivity issues, so I need to kill it if it runs too long. I have been trying the following code:               #!/usr/bin/ksh      . /home/dw/script/load.ksh &     LOADPID=$!     sleep 100     kill $LOADPID      Unfortunately, the `kill` command does not kill the process - am I missing something?


title: How can I set VIM's default encoding to UTF-8?

text: I'd like to contribute to an open source project providing translated strings. One of their requirements is that contributors must use UTF-8 as the encoding for the PO files. I'm using VIM 7.3 on Linux. How can I be sure that VIM's encoding is set to UTF-8, so that I can edit and save the .po file the right way?


title: Concatenate multiple strings with spaces in them?

text: I am trying to do the following in ksh shell:               JMX_ROOT=/bfs-build/build-info/mep_mainline-Linux.latest/core/mainline/automation          SMOKE_JMX_LOCATION="$JMX_ROOT/\"Smoke Set\"/*.txt $JMX_ROOT/\"Smoke Set\"/*.TXT      $JMX_ROOT/\"Smoke Set\"/SmokeSet.jmx"          cp $SMOKE_JMX_LOCATION /var/tmp      I.e. copy .txt, .TXT and .jmx files from one directory to another directory but am getting errors because of the spaces in "Smoke Set". Any help is much appreciated.


title: how to pass a value to a variable that in a other variable

text: I am new to scripting. I am getting a "bad substitution" error while running this code. I want to print the values in `h_1`, `h_2`, `h_3`with a `for` loop.               #/!/bin/bash     h_1=12     h_2=13     h_3=14     for ((i=1; i<=2; i++))      do       echo "${h_$i}"     done


title: Altering the default boot option on CentOS

text: I recently installed a copy of CentOS onto my main hard drive (I now have Windows 7 and CentOS). Whilst installing CentOS, I accidentally set it to be the main boot option, so when I start my PC I have three seconds to select Windows 7 or it automatically boots into CentOS. I would rather Windows 7 be the default option -- how can I change it?


title: Disable/modify middle-click-to-paste in X11/Xorg

text: I am using Slackware 13.1 (kernel 2.6) with FVWM as my desktop manager. I have frequently had issues when coding where my over-sensitive mouse registers a middle-button (mouse-wheel) click while scrolling with the mouse- wheel. Is there any way to modify the shortcut so that middle-click no longer pastes using the built-in clipboard with X11/Xorg/Xfree86? I would prefer if it were re-mapped to something like +MiddleClick, or something similar. I have searched through the forums already, and have found some suggestions using XMODMAP, but none have worked so far. Thank you all in advance for your time and assistance.


title: How can I debug a problem with my network connection?

text: On one of my computers with Xubuntu 10.04 there is a problem with the network connection. How can I debug it?   * I tried the cable on my laptop (running the same operating system) and it worked, so it's not the cable   * `sudo dhclient` and `sudo /etc/init.d/networking restart` don't help   * `sudo mii-tool -v` outputs: > no MII transceiver present What else could be the problem? Is the network card broken?


title: SMSC Ethernet PHY problems - blinking ~11.68Hz LED when it isn't working

text: I've got a custom ARM Linux 2.6.35-based platform I'm trying to get working. My problem is the Ethernet is not working consistently. I've got a SMSC LAN8720AI PHY, with a i.MX283 uP/MAC @ 454MHz. This should be using the FEC driver. When it fails, LED1 blinks at about 11.68Hz. This is not in the datasheets of either the PHY or the uP/MAC... so I'm thinking it's a Linux driver thing. I haven't found it yet... does this ring a bell to anyone? If I knew what the blinking meant, I might be able to isolate the problem. I've replaced chips, jacks, etc with little success. **EDIT** I've finally found a single reference to an "about 10Hz" blinking experienced by someone on a PIC trying the exact same PHY. So, I'm going to assume it's an undocumented PHY error now (which the PHY vendor engineer I'm talking to doesn't know about). If anyone knows otherwise, please post.


title: Warnings about read-only filesystems while installing a solaris package

text: I have a solaris machine that I am trying to install Perl 5.12 as well as gcc and make to get CPAN working. I downloaded the packages from sun freeware, and was able to install gcc. When I tried to install make however with `pkgadd -d make-3.82-sol10-sparc-local` it complains that `/usr/local` is a read only file system with these errors:               WARNING: /usr/local/bin/make not present on Read Only file system.      I then changed the install root path to `/opt` with:               pkgadd -R /opt -d make-3.82-sol10-sparc-local      This allowed it to install, but I am having problems with perl library path and would just be easier if I could install it in the default location. I am not sure why `/usr/local` would be read only and am not really a solaris expert. I think it may have something to do with solaris "zones" but I am not sure.


title: How to set SELinux samba policy to enable dirs deletion/renaming?

text: I`m lost in trouble with SELinux once more link to my previous solved Q on Samba SELinux When share's users try to delete a dir on share they fail with SELinux advertisement to solve problem do grep smbd /var/log/audit/audit.log | audit2allow -M mypol and then to make this policy package active, execute: semodule -i mypol.pp This always give me next error               semodule:  Failed on mypol.pp!          samba selinux config listed bellow         # /usr/sbin/getsebool -a | grep samba     samba_create_home_dirs --> on     samba_domain_controller --> off     samba_enable_home_dirs --> off     samba_export_all_ro --> off     samba_export_all_rw --> on     samba_portmapper --> off     samba_run_unconfined --> off     samba_share_fusefs --> off     samba_share_nfs --> off     sanlock_use_samba --> off     use_samba_home_dirs --> off     virt_use_samba --> off


title: Linux on a 286?

text: I don't own a 286 nor do I intend to run Linux on one. However since the 286 has protected mode, why is it frequently stated that Linux requires a 386 CPU or higher? From http://tuxmobil.org/286_mobile.html it seems that the ELKS version of Linux can run on a 286, is this correct? What (if any) modifications have been made to allow the kernel to run on the 286 CPU? Now obviously I understand that a kernel compiled for a 386 cannot execute on a 286 CPU, which is 16-bit. So my question is, why cannot the standard Linux kernel be compiled for a 286, and then executed on a 286? Does Linux require hardware VM86 support?


title: How to change LCD intensivity/brightness

text: How to change brightness of LCD want image look deemed and soft the               xrandr --output LVDS1 --gamma 0.8:0.8:1.1      change only gamma but not the brightness of image. I have no option --brightness for xrandr


title: How do I prevent a program from playing sound?

text: I have a program which does not have an option to disable sound. I could mute the computer globally, but there are other programs for which I do want sound. Is there any way to locally disable sound?


title: Perform test of aes-ni and aes module in linux kernel

text: Since both aes-ni and aes module are available in linux kernel , how can I give it a performance test , to decide which one's faster ?


title: What's stopping video cards from being utilized to their full capacity on Linux?

text: Why do video cards have better quality on Windows? Is there something about Linux that stops video cards from being utilized to their full capacity? What would it take to get the best possible graphics out of a video card on Linux?


title: How would I direct local(127.0.0.1) MySQL traffic to an external SQL server?

text: Basically, I have two EC2 instances on Amazon Web Services. They are both running Ubuntu 11.10 x64. They both have a private and a public (Elastic) IP addresses. I'm having trouble setting up iptables to forward SQL data properly. I would like it so that if I connect to "127.0.0.1:3306" on Server A (which does not have an SQL server installed), it will forward to `<private ip>:3306` (aka Server B -- which does have an SQL server installed). I'm able to access each server (from the other) using the associated private ip's. I'd like to keep the forwarding private as well without having to use a public IP. Is there an easy way to do this?


title: "tail -f | iconv -fsjis" does not output anything

text: I want to `tail -f` a file, but its content is in `sjis` encoding, so I need to have it converted to the native (utf-8) encoding of my terminal. When I do > tail -f x | iconv -fsjis there will be no output. As > tail x | iconv -fsjis does work, at first I thought it was a buffering issue, but trying `unbuffer` and `stdbuf` as described on Turn off buffering in pipe did not help. In fact, even after more than 10k of data were added to x, there would be no output, so I guess it is not a buffering issue (buffer is 4k, if I'm not mistaken), but iconv will only start outputting when it receives an EOF. So how can I tail-follow my sjis encoded file?


title: New Computer keeps crashing on fresh install

text: I have a brand new HP Envy dv7-7212nr, second one, because I thought there was something wrong with the SSD with the first one. After I install Debian Testing or Mint, I compile the wireless drivers. Everything works perfectly. Then after about a day it seems like the SSD crashes. When I don't install the wireless drivers, it does not crash. When I boot into a live CD to see what happened, the SSD partition is corrupt, it has to be formatted. I have no idea what's going on. Is there anything that I can do? Could it be that I am using the AMD64 bit version?


title: 360 degree scrolling with Apple Magic Mouse in Linux?

text: I read that there is out of the box support for the Apple Magic Mouse in recent Linux kernels, but does that include full functionality such as multiple mouse buttons and multitouch?? For me the two important things are middle button and 360 degree scrolling (or at least vertical and horizontal scrolling). Can anyone confirm?? Thanks!


title: RedHat / CentOS 5.5 background process has restricted memory

text: I run Fisheye that uses Java for Linux. Settings go like this: ### generate options               FISHEYE_OPTS=`$JAVACMD -Xms100m -Xmx200m -cp $FISHEYE_HOME/fisheyeboot.jar com.cenqua.fisheye.boot.OptsSetter`      ### build fisheye command               FISHEYE_CMD="$JAVACMD $FISHEYE_OPTS -Xms100m -Xmx200m -Dfisheye.library.path=$FISHEYE_LIBRARY_PATH -Dfisheye.inst=$FISHEYE_INST -Djava.awt.headless=true -Djava.endorsed.dirs=$FISHEYE_HOME/lib/endorsed -jar $FISHEYE_HOME/fisheyeboot.jar"      ### Then I run:               cd $FISHEYE_INST     mkdir -p $FISHEYE_INST/var/log     nohup sh -c "exec $FISHEYE_CMD $@ $FISHEYE_ARGS >> $FISHEYE_INST/var/log/fisheye.out 2>&1" &      So the **nohup** command runs the program in the background. It doesn't start, saying: "out of memory" or something about the heap file. However, when I just do `exec $FISHEYE_CMD $@ $FISHEYE_ARGS` it works fine, yet it's not in the background. So I'm wondering how I can allow it to use more memory when I run it in in the background?


title: What does the -c option of sg do?

text: What does the -c option of sg do? At least on my machine, the man page fails to explain this option.


title: Variable in sed

text: I have a file that contains filenames with absolute path. In the middle of that path, is a variable directory, whenever I hard code the variable part, it works fine, but when I replace it with the variable name, the `sed` part doesn't work. The `sed` part is to delete the pattern or for this matter, the path.               file=`echo $one_file | sed 's:/dir1/dir2/$VAR/last_dir/::'`


title: Which arch linux should I download?

text: I'm going to install Arch linux yet I have to choose between several architectures my computer has. I have an aluminium macbook pro, with a 2.3 GHz Intel Core i5 processor. . The intel webpage tells me this is a dual core processor. running `uname -a` in the shell returns:               Darwin Romeos-MacBook-Pro.local 11.3.0 Darwin Kernel Version 11.3.0:     Thu Jan 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64 x86_64      Which makes me believe I have an `x86_64` machine, yet when executing `arch` in the shell it returns `i386`. I'm a bit confused about what to pick:   * i686 CPU   * x86-64 CPU   * Dual Architecture What would you recommend?


title: merging files and getting column values based on id field

text: bash-3.2$ cat sample.log sample.log.1 sample.log.2     ID COL1 COL2 COL4     1  col1 col2 col4     2  c1   c2   c4     3  co1  co2  co4          ID COL3 COL1     1  col3 col1     2  c3   c1     3  co3  co1          ID COL1 COL2 COL3     1  col1 col2 col3     2  c1  c2   c3     3  co1  co2  co3      I need to write an awk script such that it gives me the values of the columns for a particular id like a select query on multiple tables in db. give me col1 col2 and col3 fields for id 1 and should not duplicate result. meaning the result should be like               The result should be     ID COL1 COL2 COL3     1  col1 col2 col3      but not               The result should be     ID COL1 COL2 COL3 COL3     1  col1 col2 col3 col3      Even a suggestion is also good.               awk ' BEGIN { while ( (getline line < "sample.log") > 0 ) {ids[substr(line,1,index(line," ")-1)];} } { // get the column values here based on the stored id's .. } ' sample.log sample.log.1 sample.log.2      I am trying to do something like that mentioned above. I am not sure if it is a good idea.


title: Run backup on HD plugged with systemd

text: When I plug a HD via USB, it should a) mount it b) run my backup script. What I currently have is `backintime.service`               [Unit]     Description="Runs backintime to backup."          [Service]     User=user     ExecStart=/usr/bin/systemd-inhibit --what=sleep --why="Backup" "backintime -b"      To start the backup script and `backup.mount`               [Unit]     Description=Backup Disk     Before=backintime.service          [Mount]     What=/dev/disk/by-uuid/931129c7-7f15-4042-9a69-796c9eb8ffc9     Where=/media/backup      But how do I execute it automatically?