How can I use SED or AWK to replace placeholders in a template file with variable content that contains special characters?

CentOS 6.3 I'm trying to get a small script to send an email containing a copy of email headers in the body (for the purpose of internal reporting). The template file contains the following:               Alert Report          Alert has triggered at TMPDATE          HEADERS     -------     TMPHEADERS          SOURCE IP     ---------     TMPSOURCEIP      I want my script to find and replace the "TMP" place holders with actual information relevant to the alert. The date and source IP variables seem to work fine but if/when I try to find/replace the TMPHEADERS, it causes strange symptoms including the entire output to be blank. I'm reasonably certain that it has to do with the headers containing lots of special characters (@ % & etc). Can someone please advise on how best to accomplish this via bash? My current code looks like this:               cat /test/emailtemplate | sed s/TMPHEADERS/"$HEADERS"/ > /test/output      ## UPDATE As per request, here's an example set of headers I'm trying to insert into the template file (IP addresses and email address have been changed to protect the innocent :-) ):               From foo@yahoo.com Thu Apr 25 20:18:19 2013     Return-Path: <foo@yahoo.com>     Received: from nm30-vm0.bullet.mail.ne1.yahoo.com (nm30-vm0.bullet.mail.ne1.yahoo.com [98.138.11.36])     by serv.example.com (8.14.4/8.14.4) with ESMTP id r3Q3IJVV009411     for <test@example.com>; Thu, 25 Apr 2013 20:18:19 -0700     Received: from [108.108.108.108] by nm30.bullet.mail.ne1.yahoo.com with NNFMP; 26 Apr 2013 03:18:19 -0000     Received: from [98.138.87.11] by tm15.bullet.mail.ne1.yahoo.com with NNFMP; 26 Apr 2013 03:18:17 -0000     Received: from [127.0.0.1] by omp1001.mail.ne1.yahoo.com with NNFMP; 26 Apr 2013 03:18:17 -0000     X-Yahoo-Newman-Property: ymail-3     X-Yahoo-Newman-Id: 92334348.43667.bm@omp10122422401.mail.ne1.yahoo.com     Received: (qmail 29701 invoked by uid 65501); 26 Apr 2013 03:18:17 -0000     DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1366946297; bh=yjMzVONHAyJxQob7tLNdIN2RpfGHWVw1Kb5Qr+enYF8=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=CQGilBx8NertE4j75dsfsdfs+IKRzIx5vlH5YdzqFLd4ThfEyMs11sdfsdfsdXsAH1yteACnwSER+QXJQ80BfLGbJnIWm+29I8A4geOPIHGKoOUCnPaD+/0bHfAps0JIcwEju8Tcvg4VDVWw=     DomainKey-Signature:a=rsa-sha1; q=dns; c=nofws;     s=s1024; d=yahoo.com;     h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type;     b=5TIRL55VM2J2lPLsX9iCE4sdlkfjlEM2245M6qzg1oGrnZd61ykL4xQSsc3cYNz95fwNy67aRRC89n6xcti28ee5rjmlK0MDIskSB5sKlv165mNjmzF1LNx6uFXalI8QGSwiQt2uWLYvI7RrTVeZFELDfFVZyqygEl5k=;     X-YMail-OSG: EDT4ym4VM1lVQMdtAQ5zqfE59jR1Mtip4vVL1fBzNxFdGvA     YjAJ3MXC1EusloknrsPx3drxzR1b4PFErK.UhdgWePhK7TTCHhhju4XP4i7x     76WASceqp77T5itvZmilv5UuICJw3BCEd0fdADctfBYhLNwoALxjp6cnJMmE     Z4dYVtlp5vUFqg1pHxqGOXqrtjeZffM4dMftnn.Q8LlVEkj3pZ6ZJV_kKFtj     vGEGS5PAW0tIHWPEqVERYzmDOfF5sVSQLayPi6EM_i1OE038434laijEWbH0     nZt1Vkg3syO0t1BaTLN4B1bXeS8cv3GlbLO4ot7zVwA3sH4UhsC5M6xiWNFU     3iroObJ5BObL99VO3ktvC4KzekAWJ_fE85TQJhQKj6Iolgb4xlWa2x414xuA     awO4pJI9grDjycUcmhmKwLZEt_.0OBLfSi5MSviaiCNMuU5qIdHm7VCGdORP     Mc68rDkpmJE9I9Z.QZfhH5cFxqqmpyIOMTs0iIBGYz5d9QHMWCuo-     Received: from [102.102.102.102] by web12341105.mail.ne1.yahoo.com via HTTP; Thu, 25 Apr 2013 20:18:17 PDT     X-Rocket-MIMEInfo: 002.001,VGVzdGluZyAxMjMgTGEgbGEgbGEBMAEBAQE-     X-Mailer: YahooMailWebService/0.8.141.536     Message-ID: <136634397.44849.YahooMailNeo@web126205.mail.ne1.yahoo.com>     Date: Thu, 25 Apr 2013 20:18:17 -0700 (PDT)     From: Test Account <foo@yahoo.com>     Reply-To: Test Account <foo@yahoo.com>     Subject: Test     To: "test@example.com" <test@example.com>     MIME-Version: 1.0     Content-Type: multipart/alternative; boundary="102743210-1541163991-1366946297=:49149"


My server processes die some time

Someone who could tell me what is happening? I count as a web server:   **Debian 7.4   1 TB HDD   2 GB RAM   Processor Intel 2399.998 MHz      ** This server is used for Web services, because every so often I have start the service MySQL, Apache etc ... by dying. And my problem is that I automatically kills processes. What can it be?


2.6.35 usb-serial kernel patch

I am working with an ARMV71 chip, with embedded Debian 2.6.35.9 - However, the entire source tree of linux-source-2.6.35-9/drivers/usb/serial seems to be buggy. Trying to make the module "usbserial.ko" and "qcserial.ko" - in order to access a wwan card - fails. I am following this tutorial and the make command produces this :               [snip]     drivers/usb/serial/usb-serial.c:959: error: 'struct usb_serial_port' has no member named 'write_urbs'     drivers/usb/serial/usb-serial.c:959: error: 'struct usb_serial_port' has no member named 'write_urbs'     drivers/usb/serial/usb-serial.c:959: warning: type defaults to 'int' in declaration of 'type name'     drivers/usb/serial/usb-serial.c:959: warning: type defaults to 'int' in declaration of 'type name'     drivers/usb/serial/usb-serial.c:959: error: negative width in bit-field '<anonymous>'     drivers/usb/serial/usb-serial.c:960: error: 'struct usb_serial_port' has no member named 'write_urbs_free'     drivers/usb/serial/usb-serial.c:960: error: 'struct usb_serial_port' has no member named 'write_urbs_free'     drivers/usb/serial/usb-serial.c:961: error: 'struct usb_serial_port' has no member named 'write_urbs'     drivers/usb/serial/usb-serial.c:962: error: 'struct usb_serial_port' has no member named 'write_urbs'     drivers/usb/serial/usb-serial.c:967: error: 'struct usb_serial_port' has no member named 'bulk_out_buffers'     drivers/usb/serial/usb-serial.c:969: error: 'struct usb_serial_port' has no member named 'bulk_out_buffers'     drivers/usb/serial/usb-serial.c:974: error: 'struct usb_serial_port' has no member named 'write_urbs'     drivers/usb/serial/usb-serial.c:977: error: 'struct usb_serial_port' has no member named 'bulk_out_buffers'     drivers/usb/serial/usb-serial.c: In function 'fixup_generic':     drivers/usb/serial/usb-serial.c:1334: error: 'struct usb_serial_driver' has no member named 'process_read_urb'     drivers/usb/serial/usb-serial.c:1334: error: 'struct usb_serial_driver' has no member named 'process_read_urb'     drivers/usb/serial/usb-serial.c:1334: error: 'usb_serial_generic_process_read_urb' undeclared (first use in this function)     drivers/usb/serial/usb-serial.c:1334: error: (Each undeclared identifier is reported only once     drivers/usb/serial/usb-serial.c:1334: error: for each function it appears in.)     drivers/usb/serial/usb-serial.c:1335: error: 'struct usb_serial_driver' has no member named 'prepare_write_buffer'     drivers/usb/serial/usb-serial.c:1335: error: 'struct usb_serial_driver' has no member named 'prepare_write_buffer'     drivers/usb/serial/usb-serial.c:1335: error: 'usb_serial_generic_prepare_write_buffer' undeclared (first use in this function)     make[1]: *** [drivers/usb/serial/usb-serial.o] Error 1     make: *** [_module_drivers/usb/serial] Error 2     [snap]      Turns out, these are know errors. I tried to update my system, but i have to go on with the supplied kernel image, as uboot is not detecting the new kernel (3.2.0), keepson booting the 2.6.35 one. Therefore, i think i am in need of patches - which i can not simply find in google. Please help me to find the patches.


How to allow access to a directory and don't allow access to a sub-directory in Apache?

I have asked this question on apache mailing-list but I didn't get the answer I want. I want to allow a directory " /var/www/html/ldap" to two users according to IPs (192.168.1.2 192.168.1.7):               <Directory /var/www/html/ldap>           Order allow,deny           Allow from 192.168.1.2 192.168.1.7           Satisfy any           AuthName "LDAP Authentication"           AuthType Basic                AuthBasicProvider ldap           AuthzLDAPauthoritative off           AuthLDAPURL ldap://192.168.1.3/dc=example,dc=com?uid?sub?(objectClass=*)           Require valid-user     </Directory>      but I don't want to allow a sub directory to 192.168.1.7 (I want it to be allowed only to 192.168.1.2): I have tried to add:               <Directory /var/www/html/ldap/manager>           Order allow,deny           Allow from 192.168.1.2           Satisfy any           AuthName "LDAP Authentication"           AuthType Basic                AuthBasicProvider ldap           AuthzLDAPauthoritative off           AuthLDAPURL ldap://192.168.1.3/dc=example,dc=com?uid?sub?(objectClass=*)           Require valid-user     </Directory>      but it seems that 192.168.1.7 can reach to manager directory because it is a part of ldap directory, how can I forbid this? UPDATE: as Raza suggest I have tried to something like that: for the main directory:                <Directory /var/www/html/ldap>               Order allow,deny               Allow from 192.168.1.2 192.168.1.7               Satisfy any               AuthName "LDAP Authentication"               AuthType Basic                    AuthBasicProvider ldap               AuthzLDAPauthoritative off               AuthLDAPURL ldap://192.168.1.3/dc=example,dc=com?uid?sub?(objectClass=*)               Require valid-user         </Directory>      for the sub-directory:                <Directory /var/www/html/ldap/manager>               Order Deny,Allow               Deny From All               Allow From 192.168.1.2               Satisfy any               AuthName "LDAP Authentication"               AuthType Basic                    AuthBasicProvider ldap               AuthzLDAPauthoritative off               AuthLDAPURL ldap://192.168.1.3/dc=example,dc=com?uid?sub?(objectClass=*)               Require valid-user         </Directory>      Note: I don't want to be asked for authentication(LDAP AUTH) for both 192.168.1.2 and 192.168.1.7 on both directories (main-directory and sub-directory).


phpstorm 7 permission error

i have `phpstorm 7.1.4` `IDE` on `manjaro(arch base linux)`.   when i run `php` code with `phpstorm` on :               http://localhost:49193/ex.php      in page : `No input file specified.`   my code not run or execute. i check `phpstorm` output to find error and see this:               /usr/bin/php-cgi -e -b localhost:49193     PHP Warning:  Unknown: open_basedir restriction in      effect.File(/run/media/masoudjjgh/d2/kar/amlak/p.php5) is not within the allowed      path(s): (/srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/) in      Unknown on line 0     PHP Warning:  Unknown: failed to open stream: Operation not permitted in      Unknown on line 0      i think problem with permission and i run it with `root` but still get this error.   now i think problem with `php-cgi` permission and i don't know how fix it.


Why are Linux installs bigger than I've read? Some beginner questions

1. I've read in different textbooks that say Linux is light-weight(e.g. It could fit on a 1.4MB floppy). So why is the download from the Ubuntu or Fedora CD sized or larger?   2. Do the device drivers extend the kernel? For example: if I have new hardware and I have installed the device driver, will my kernel code get extended or is the driver installed as a service for the kernel to use?   3. When using a LiveCD such as Ubuntu, when system boots does all 700MB of the OS get loaded to RAM or just parts of it? I ask these questions because I feel they're common beginner questions and I think it would be good to have them all in one place.


What steps does the system go through when handling an SSH connection?   1. We try to log in via ssh   2. `sshd` starts pam and pam module to authenticate us   3. Depending on pam configuration, we need to provide username and password (pam checks `passwd` and `shadow` files)   4. pam checks for `hosts.allow/deny`, `/etc/shells`, and other things   5. If everything goes fine we are logged in   6. ???   7. Shell is started So my question is what mechanism is responsible for checking which shell is assigned to the user in their `passwd` file (in step 6)? Is it pam itself, some specific pam module, `sshd`, or something else? I know that I can replace the `passwd` file (for checking username and password) by writing a pam module, but how can I replace the `passwd` file for the shell entry?


Big tab spacings with Kate

Is there a way to configure Kate to use tab spaces of more than 16 spaces? I am using Kate to make up a tab separated file for import into a database and some of the data needs about 30 spaces between tab stops.


Why must loopback traffic be authorized using iptables to get web access?

I thought the following was necessary was necessary for outgoing HTTP on a desktop (non-server):               iptables -A INPUT  -p tcp -m multiport --sports 80,443 -m conntrack --ctstate ESTABLISHED -j ACCEPT     iptables -A OUTPUT -p tcp -m multiport --dports 80,443 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT      But, it turns out I need these two to make it work. I don't know why:               iptables -A INPUT -i lo -j ACCEPT     iptables -A OUTPUT -o lo -j ACCEPT      I know the last rule allows UDP to the `lo` interface. But, I thought all I needed was `outgoing TCP for NEW/ESTABLISHED connections` \+ `incoming TCP for ESTABLISHED connections`. It seemed counter-intuitive to me (because I'm still learning).


Start different applications on second, third and fourth monitor

I've read some questions about running an application on the second monitor but none of the suggested options has worked for me. Besides that, I'm trying to run different applications no only in the second but also in the third and fourth monitor. I've tried               export DISPLAY=:0.1     export DISPLAY=:0.2     export DISPLAY=:0.3     export DISPLAY=:0.4     export DISPLAY=:1.1     export DISPLAY=:1.2     export DISPLAY=:1.3     export DISPLAY=:1.4      But none of them worked. Only               export DISPLAY=:0      works for monitor 1 However I found out that 'export DISPLAY:0' is relative to the monitor the mouse is located in. So if the mouse is in monitor 4 and I run 'export DISPLAY=:0' followed by, let say, 'eog image.jpg' it runs on that same monitor. Here is my running xorg.conf file. Perhaps someone can get some usefull information from it. It was generated by                   # nvidia-settings: X configuration file generated by nvidia-settings     # nvidia-settings:  version 304.64  (pbuilder@cake)  Wed Nov  7 10:04:06 UTC 2012          # nvidia-xconfig: X configuration file generated by nvidia-xconfig     # nvidia-xconfig:  version 304.48  (buildd@murphy)  Wed Sep 12 11:32:28 UTC 2012          Section "ServerLayout"              #Screen      4  "Screen4" RightOf "Screen3"         #Screen      5  "Screen5" RightOf "Screen4"         #Screen      6  "Screen6" RightOf "Screen5"         #Screen      7  "Screen7" RightOf "Screen6"     # Removed Option "Xinerama" "1"     # Removed Option "Xinerama" "0"         Identifier     "X.org Configured"         Screen      0  "Screen0" 0 0         Screen      1  "Screen1" RightOf "Screen0"         Screen      2  "Screen2" RightOf "Screen1"         Screen      3  "Screen3" RightOf "Screen2"         InputDevice    "Mouse0" "CorePointer"         InputDevice    "Keyboard0" "CoreKeyboard"         Option         "Xinerama" "1"     EndSection          Section "Files"         ModulePath      "/usr/lib/xorg/modules"         FontPath        "/usr/share/fonts/X11/misc"         FontPath        "/usr/share/fonts/X11/cyrillic"         FontPath        "/usr/share/fonts/X11/100dpi/:unscaled"         FontPath        "/usr/share/fonts/X11/75dpi/:unscaled"         FontPath        "/usr/share/fonts/X11/Type1"         FontPath        "/usr/share/fonts/X11/100dpi"         FontPath        "/usr/share/fonts/X11/75dpi"         FontPath        "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"         FontPath        "built-ins"     EndSection          Section "Module"         Load           "record"         Load           "extmod"         Load           "dbe"         Load           "dri2"         Load           "glx"     EndSection          Section "InputDevice"         Identifier     "Keyboard0"         Driver         "kbd"     EndSection          Section "InputDevice"         Identifier     "Mouse0"         Driver         "mouse"         Option         "Protocol" "auto"         Option         "Device" "/dev/input/mice"         Option         "ZAxisMapping" "4 5 6 7"     EndSection          Section "Monitor"         Identifier     "Monitor0"         VendorName     "Unknown"         ModelName      "LG Electronics LG TV"         HorizSync       30.0 - 83.0         VertRefresh     58.0 - 62.0     EndSection          Section "Monitor"         Identifier     "Monitor1"         VendorName     "Unknown"         ModelName      "LG Electronics LG TV"         HorizSync       30.0 - 83.0         VertRefresh     58.0 - 62.0     EndSection          Section "Monitor"         Identifier     "Monitor2"         VendorName     "Unknown"         ModelName      "LG Electronics LG TV"         HorizSync       30.0 - 83.0         VertRefresh     58.0 - 62.0     EndSection          Section "Monitor"         Identifier     "Monitor3"         VendorName     "Unknown"         ModelName      "LG Electronics LG TV"         HorizSync       30.0 - 83.0         VertRefresh     58.0 - 62.0     EndSection          Section "Monitor"         Identifier     "Monitor4"         VendorName     "Unknown"         ModelName      "LG Electronics LG TV"         HorizSync       30.0 - 83.0         VertRefresh     58.0 - 62.0     EndSection          Section "Device"         Identifier     "Device0"         Driver         "nvidia"         VendorName     "NVIDIA Corporation"         BoardName      "GeForce GT 610"         BusID          "PCI:1:0:0"         Screen          0     EndSection          Section "Device"         Identifier     "Device1"         Driver         "nvidia"         VendorName     "NVIDIA Corporation"         BoardName      "GeForce GT 610"         BusID          "PCI:1:0:0"         Screen          1     EndSection                    Section "Device"         Identifier     "Device2"         Driver         "nvidia"         VendorName     "NVIDIA Corporation"         BoardName      "GeForce GT 610"         BusID          "PCI:2:0:0"         Screen          0     EndSection                    Section "Screen"         Identifier     "Screen0"         Device         "Device0"         Monitor        "Monitor0"         DefaultDepth    24         Option         "Stereo" "0"         Option         "nvidiaXineramaInfoOrder" "DFP-0"         Option         "metamodes" "DFP-0: 1920x1080 +0+0; DFP-0: nvidia-auto-select +0+0; DFP-0: nvidia-auto-select +0+0; DFP-0: nvidia-auto-select +0+0; DFP-0: 1920x1080_60 +0+0; DFP-0: 1920x1080_60_0 +0+0; DFP-0: 1920x1080_60_1 +0+0; DFP-0: 1920x1080_60_2 +0+0; DFP-0: 1920x1080_30 +0+0; DFP-0: 1920x1080_24 +0+0; DFP-0: 1920x1080_60i +0+0; DFP-0: 1920x1080_60i_0 +0+0; DFP-0: 1360x768 +0+0; DFP-0: 1360x768_60 +0+0; DFP-0: 1280x1024 +0+0; DFP-0: 1280x1024_60 +0+0; DFP-0: 1280x720 +0+0; DFP-0: 1280x720_60 +0+0; DFP-0: 1280x720_60_0 +0+0; DFP-0: 1152x864 +0+0; DFP-0: 1152x864_60 +0+0; DFP-0: 1024x768 +0+0; DFP-0: 1024x768_60 +0+0; DFP-0: 800x600 +0+0; DFP-0: 800x600_60 +0+0; DFP-0: 720x480 +0+0; DFP-0: 720x480_60 +0+0; DFP-0: 640x480 +0+0; DFP-0: 640x480_60 +0+0; DFP-0: 640x480_60_0 +0+0; DFP-0: 640x480_60_1 +0+0"         SubSection     "Display"             Depth       24         EndSubSection     EndSection          Section "Screen"         Identifier     "Screen1"         Device         "Device1"         Monitor        "Monitor1"         DefaultDepth    24         Option         "Stereo" "0"         Option         "metamodes" "DFP-1: 1920x1080 +0+0; DFP-1: nvidia-auto-select +0+0"         SubSection     "Display"             Depth       24         EndSubSection     EndSection          Section "Screen"         Identifier     "Screen2"         Device         "Device2"         Monitor        "Monitor2"         DefaultDepth    24         Option         "nvidiaXineramaInfoOrder" "CRT-1"         Option         "Stereo" "0"         Option         "metamodes" "DFP-1: 1920x1080 +0+0; DFP-1: nvidia-auto-select +0+0"         SubSection     "Display"             Depth       24         EndSubSection     EndSection          Section "Screen"         Identifier     "Screen3"         Device         "Device3"         Monitor        "Monitor3"         DefaultDepth    24         Option         "Stereo" "0"         Option         "metamodes" "DFP-0: 1920x1080 +0+0"         SubSection     "Display"             Depth       24         EndSubSection     EndSection               Section "Extensions"         Option         "Composite" "Disable"     EndSection


bash: Redirect IO , but not with suffixes

usually I use `XX 2>error.log` , but for debug purposes , I prefer the following syntax:               function XX()     {         redirect_io_to "error.log"     }      Is there such syntax available ? It's convenient because I setup my VIM to comment / uncomment a line with some shortcut key , I could easily comment this out / uncomment it.


kernel panic Hardware Error - what hardware is responsible?

I'm having kernel panics every other day. below is a transcript of a photo of the console. How do I determine what hardware is responsible for the problem? (or is it software) Ubuntu 12.04 LTS server               [Hardware Error]: CPU:2   MC0_STATUS[-|UE|-|-|AddrV|UECC]: 0xb400200055000145     [Hardware Error]: MC0_ADDR: 0x0000000164fe77b0     [Hardware Error]: Data Cache Error: Data/Tag DWR error.     [Hardware Error]: cache level: L1, tx: DATA, mem-tx: DWR     [Hardware Error]: CPU:3 MC0_STATUS[-|UE|-|PCC|AddrV|CECC]: 0xb66b400000000135     [Hardware Error]: MC0_ADDR: 0x0000000164fe77b0     [Hardware Error]: Data Cache Error: Data/Tag DWD error.     [Hardware Error]: cache level: L1, tx: DATA, mem-tx: DRD     [Hardware Error]: CPU 3: Machine Check Exception: 4 Bank 0: b66b400000000135     [Hardware Error]: TSC bc02bd350de4 ADDR 164fe7bb0     [Hardware Error]: PROCESSOR 2:100f42 TIME 1378965147 SOCKET 0 APIC 3 microcode 10000c6     [Hardware Error]: CPU:3 MC0_STATUS[-|UE|-|PCC|AddrV|CECC]: 0xb66b400000000135     [Hardware Error]: MC0_ADDR: 0x0000000164fe77b0     [Hardware Error]: Data Cache Error: Data/Tag DWD error.     [Hardware Error]: cache level: L1, tx: DATA, mem-tx: DRD     [Hardware Error]: Machine Check: Invalid     Kernel panic - not syncing: Fatal machine check on current CPU     Shutting down cpus with NMI      Here is some additional logging that I found:               kernel: [58495.948100] ------------[ cut here ]------------     kernel: [58495.948108] WARNING: at /build/buildd/linux-lts-quantal-3.5.0/net/sched/sch_generic.c:255 dev_watchdog+0x272/0x280()     kernel: [58495.948109] Hardware name: MS-7576     kernel: [58495.948110] NETDEV WATCHDOG: eth0 (r8169): transmit queue 0 timed out     kernel: [58495.948111] Modules linked in: nfsd nfs lockd fscache auth_rpcgss nfs_acl sunrpc xfs vesafb radeon ttm drm_kms_helper snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_intel drm snd_hda_codec wmi i2c_algo_bit snd_hwdep snd_pcm snd_timer snd soundcore snd_page_alloc lp shpchp r8169 sp5100_tco i2c_piix4 firewire_ohci parport firewire_core kvm_amd edac_core k10temp edac_mce_amd serio_raw kvm mac_hid microcode crc_itu_t raid10 raid456 async_pq async_xor xor async_memcpy async_raid6_recov raid6_pq async_tx raid1 raid0 multipath linear pata_atiixp     kernel: [58495.948136] Pid: 0, comm: swapper/3 Tainted: G   M         3.5.0-23-generic #35~precise1-Ubuntu     kernel: [58495.948137] Call Trace:     kernel: [58495.948138]  <IRQ>  [<ffffffff81052c9f>] warn_slowpath_common+0x7f/0xc0     kernel: [58495.948144]  [<ffffffff81052d96>] warn_slowpath_fmt+0x46/0x50     kernel: [58495.948146]  [<ffffffff815a05b2>] dev_watchdog+0x272/0x280     kernel: [58495.948149]  [<ffffffff8101be03>] ? native_sched_clock+0x13/0x80     kernel: [58495.948151]  [<ffffffff810702d0>] ? __queue_work+0x330/0x330     kernel: [58495.948153]  [<ffffffff815a0340>] ? pfifo_fast_dequeue+0xe0/0xe0     kernel: [58495.948154]  [<ffffffff815a0340>] ? pfifo_fast_dequeue+0xe0/0xe0     kernel: [58495.948156]  [<ffffffff81062ce6>] call_timer_fn+0x46/0x160     kernel: [58495.948158]  [<ffffffff815a0340>] ? pfifo_fast_dequeue+0xe0/0xe0     kernel: [58495.948159]  [<ffffffff81064632>] run_timer_softirq+0x132/0x2a0     kernel: [58495.948162]  [<ffffffff810a4105>] ? ktime_get+0x65/0xe0     kernel: [58495.948164]  [<ffffffff8105ba88>] __do_softirq+0xa8/0x210     kernel: [58495.948166]  [<ffffffff810ab264>] ? tick_program_event+0x24/0x30     kernel: [58495.948168]  [<ffffffff816a841c>] call_softirq+0x1c/0x30     kernel: [58495.948170]  [<ffffffff81016245>] do_softirq+0x65/0xa0     kernel: [58495.948172]  [<ffffffff8105be6e>] irq_exit+0x8e/0xb0     kernel: [58495.948174]  [<ffffffff816a8d5e>] smp_apic_timer_interrupt+0x6e/0x99     kernel: [58495.948176]  [<ffffffff816a7aca>] apic_timer_interrupt+0x6a/0x70     kernel: [58495.948177]  <EOI>  [<ffffffff8103ff56>] ? native_safe_halt+0x6/0x10     kernel: [58495.948180]  [<ffffffff8101c993>] default_idle+0x53/0x1f0     kernel: [58495.948182]  [<ffffffff8101d8a9>] cpu_idle+0xd9/0x120     kernel: [58495.948184]  [<ffffffff8167b237>] start_secondary+0xc3/0xc5     kernel: [58495.948185] ---[ end trace ef52dc6dad6ceea1 ]---              # dmidecode -t 1 -t 3 -t 4 | egrep '(Manufacturer|Product|Serial|Socket|Version)'     Manufacturer: MICRO-STAR INTERNATIONAL CO.,LTD     Product Name: MS-7576     Version: 1.0     Serial Number: To Be Filled By O.E.M.     Manufacturer: MICRO-STAR INTERNATIONAL CO.,LTD     Version: 1.0     Serial Number: To Be Filled By O.E.M.     Socket Designation: CPU1     Manufacturer: AMD     Version: AMD Phenom(tm) II X4 B50 Processor     Serial Number: To Be Filled By O.E.M.


linux with 3.2.x kernel

Is there a major Linux distribution that uses 3.2.x kernel?


using Set uid to run a root command from non-root user

Consider the following two files. `summarize`'s executable UID bit has been set, so that another user belonging to another group can execute the summarize executable that uses the customers.dat file.               -rw-------  steve  sales  customers.dat     -rwsr-xr-x  steve  sales  summarize      Now consider the following two files:               -rwxrwx--- 1 root   root   5974 May 17 13:53 1.out     -rwsrwsrwx 1 root   root   5970 May 17 14:03 a.out      Both are executables, and I want that some other user runs `a.out`, which calls `1.out` within itself using the `system("./1.out");` call. But I am always getting permission denied error               sh: ./1.out: Permission denied      To me, both scenarios look the same. Why do I get the permission denied error? Am I missing something?


Suggestions for a Linux distribution for a dedicated SFTP server

I have a desktop which has more than 16GB of memory that I want to dedicate as an SFTP server. Many people have suggested that I install Linux, so I have decided to go with Linux. I am puzzled and unable to judge which distribution to install. I have no ideas or exposure to Linux before. Are there any suggestions to help me meet my requirement?


Booting Operating System from bootable secondary Hard disk via VirtualBox

I have attached a new bootable Hard Disk to my computer. I can boot to an operating system from each one. When I boot into an Ubuntu system in one Hard Disk, is it possible to boot into the other Hard Disk from virtualbox so that I have both operating systems running at the same time?


SSH login to remote machine from another remote machine - How to manage connections?

Due to some security policy I had to ssh into a remote machine using another remote machine to which I ssh-ed. Here is the situation. I have access to BSD box at work and the access is only available on wired office network. Apart from this BSD box I have my own RHEL dev box which is wired network and I can access it even from home using VPN. So when am at home I remote ssh to my RHEL dev box and then ssh to my BSD box. There are times when my connection to this RHEL is dropped. What happens to my connection to BSD box when my connection to RHEL is dropped? How can I manage these connections?


Query USB current

How can I obtain information about the amount of current negotiated by a device attached to a USB port? I am looking for information similar to this presented by OS X in terms of current available and current required.


Nginx + PHP + FTP - user permission issue

I have a wordpress copy installed on /home/username/public_html/site, and now the problem is :   1. Nginx running PHP with "www-data" identity   2. The site folder owner and group are "username", not "www-data"   3. So wordpress had no permission to create folder   4. I changed owner and group of "site" to "www-data", wordpress is working ok   5. But ftp can't create a folder - ftp is login as username/pass Is it possible to have a /home/username/public_html/site, and both working on PHP side and ftp side. Any advice is appreciated!


Moving unallocated space from Extended partition to create a Primary partition

This is my partition structure : ![Partition List](http://i.stack.imgur.com/oH5TA.png) I want to create another primary partition from that unallocated space. If I shrink sda2 to a size less than what I needed for to create another primary partition, will it move entire extended partition to right or just slices off extended space from it as it is contiguous ?


Installing AMD Radeon HD 7400M series fedora 20

I just installed fedora 20 on my second pc and its running pretty hot, I found a driver on the site http://support.amd.com/en- us/download/desktop?os=Linux%20x86_64. And i unpack it and i try sh sudo sh amd-driver- installer-13.35.1005-x86.x86_64.run and I get this Supported adapter detected. Check if system has the tools required for installation. fglrx installation requires that the system have kernel headers for 3.7 release. /lib/modules/3.11.10-301.fc20.i686+PAE/build/include/generated/uapi/linux/version.h cannot be found on this system. One or more tools required for installation cannot be found on the system. Install the required tools before installing the fglrx driver. Optionally, run the installer with --force option to install without the tools. Forcing install will disable AMD hardware acceleration and may make your system unstable. Not recommended. and I dont know what to do to het this right i have already tried:               yum install kernel-devel kernel-headers gcc -y      http://www.amd.com/US/PRODUCTS/NOTEBOOK/GRAPHICS/7000M/7400M/Pages/radeon-7400m.aspx


Wireless bridged networking in KVM. Why is it so complicated?

I've been using VirtualBox (and sometimes VMWare) for years and I've never had any problem with the virtual network adapters, no matter if the physical ones were wired or not. I also played some time ago with KVM in a wired set-up and, although I had to edit some configuration files to get it working, I could also create a bridged adapter without any major problems. Today I decided (wrongly, it seems) to try to use KVM in a laptop running Ubuntu 13.10 and tried to create a virtual machine with bridged networking over a wireless interface. It was extremely painful to set this up. After following all the tutorials I found (for example) and having to reboot my laptop several times to get the connection back I just gave up and went back to my old well-known VirtualBox. And, actually, the first thing I noticed when I looked into the official KVM documentation was that they discourage from trying to bridge a wireless adapter since, according to them: > The here shown method, will not work with most(all?) wireless drivers, as > these do not support bridging. So, my question is:   * How come they say that most wireless adapters do not support bridging if it works in VirtualBox and VMWare just "out-of-the-box"?   * And what's the difference between these hypervisors that makes it so complicated in KVM, if it works at all?


Elementary OS only booting from USB, cannot boot to partitions on SSD (Windows and eOS)

I previously had Linux Mint Petra and Windows 7 installed on my Asus UX31a. This worked fine until I ran into some Wi-fi issues after messing around with NetworkManager. I decided since I didn't have too many files I should just re- install Mint, but then decided that eOS looked nicer so I'd try that. So, I used UUI to put eOS on my flash drive, tried the demo first, didn't really do much but everything seemed ok. I then used the full installation option and put it on /dev/sda3 where my old mint installation was (windows on sda1 and windows recovery on sda4 or something). The first time I didn't give it swap space but I tried that later on after trying a couple of other things. After the installation finished, the computer rebooted but would only boot into the USB through grub, and went to the grub rescue menu when I tried to boot without it in. I remember having a similar problem with Mint and resolved it with boot-repair. First I tried re-installing a couple of times, same thing, no luck. Then I got boot-repair again and tried that. However during `apt-get update` I get the warning `Failed to fetch cdrom://elementary OS 0.2 _Luna_ - Stable amd64 (20130810)/dists/precise/restricted/binary-amd64/Packages please use apt-cdrom to make this CD-ROM recognized by APT.` and similar warnings for /binary-i386 and the same two for /main/binary-XXX. I understand that Luna is based on Ubuntu and precise pangolin is a version of Ubuntu, is this the correct version? Also other postings online suggested using update manager to disable the "source" that was the cd I had installed. I didn't see that option in update manager. There weren't any issues adding the boot-repair repo or installing it so that seemed fine. Incidentally while typing this, I tried to install boot-repair again to verify that I had no errors but this type I got the error 'unable to locate package boot-repair' Edit: boot-repair installed after another apt-get update. (Is there no option for strike-through?) Boot-repair opens fine, I can run the standard fix and it gives me "grub-pc purge cancelled". Another thing I noticed about Boot-repair was that the "advanced settings" tabs displayed different things than the default that was listed here https://help.ubuntu.com/community/Boot-Repair in most cases, my options were grayed out or non-existent and sometimes grayed out options differed from what the wiki said. I'm sorry I don't have a screenshot, again I can't get grub- repair back Edit: Under the GRUB options tab the wiki has "Purge GRUB before reinstalling it" de-selected whereas mine is grayed out and selected. Under the MBR options tab, I have nothing. Finally under the Other Options tab, they have "Repair Windows boot files" checked, mine is grayed out and unchecked. I did run the boot-info thing, here is my paste; paste.ubuntu.com/7279707 Next I found a tutorial on re-installing grub from a liveCD. I can't find the tutorial now, but I'd seen it when fixing this with mint, I believe it was on the ubuntu community forums, I'm really sorry I can't locate it. The basic steps however were to mount the other partition, use chroot to uninstall grub and then re-install it. Everything worked fine up until the re-install grub step (the tutorial made me check I had internet so that wasn't it) where apt- get complained that the files/packages `grub-pc, grub-common` didn't exist. It told me that grub2-common did exist so I tried installing that and things seemed to work although I have no idea what it did. Nothing changed the next time I rebooted however and so now I'm back in a live session with no idea what to do. I have access to the school's lab computers so at worst I can give my USB some other distro and try to use that to fix it, but hopefully it won't come to that.


How to create a file with the name specified in ASCII encoding?

I want to create a file that is called ascii 007, which is the bell symbol, which is not printable. I tried `nano $'\007'`, but that just created a file called ?; `cat ?` print the test content, that I placed in the file. So how do I create a file, with a name set by the ascii encoding and not plainly spelled out?


Linux boot with broken partition

I have two ext partition on my linux   * One for `/`   * And one for `/home` I wanted to reduce (with this method) the home partition (which was only something like 10% filled) to create a new partition for Windows. Unfortunately it failed and when I wanted to reboot, linux went in rescue mode, which could have been helpfull unless this rescue mode was not working (It showed two password prompt, and then was working like there was two command prompt at the same time [I had to double every letter to make a command like : `ccwwdd //eettcc`], so not really doable). My question is : Can I boot to this linux anyway without going in rescue mode? Like for example disabling this partition (`/etc/fstab`?). Also is it possible to repair this partition ? (When I try to mount it with Ext2Fs it says `RAW` in partition type) Here is the parted info :               Model: ATA ST9640320AS (scsi)     Disk /dev/sda: 640GB     Sector size (logical/physical): 512B/512B     Partition Table: msdos          Number  Start   End    Size    Type      File system     Flags      1      1049kB  100GB  100GB   primary   ext4      2      100GB   420GB  320GB   extended      5      100GB   110GB  9999MB  logical   linux-swap(v1)      6      110GB   420GB  310GB   logical      3      420GB   420GB  367MB   primary   ntfs            boot      4      420GB   640GB  220GB   primary   ntfs      I think the `/home` partition is `/dev/sda6` Fsck output :               ubuntu@ubuntu:~$ sudo fsck.ext4 /dev/sda6     e2fsck 1.42.9 (4-Feb-2014)     ext2fs_open2: Bad magic number in super-block     fsck.ext4: Superblock invalid, trying backup blocks...     fsck.ext4: Bad magic number in super-block while trying to open /dev/sda6          The superblock could not be read or does not describe a valid ext2/ext3/ext4     filesystem.  If the device is valid and it really contains an ext2/ext3/ext4     filesystem (and not swap or ufs or something else), then the superblock     is corrupt, and you might try running e2fsck with an alternate superblock:         e2fsck -b 8193 <device>      or         e2fsck -b 32768 <device>      Command output :               ubuntu@ubuntu:~$ findmnt;lsblk -f;sudo partx -svb /dev/sda -oNR,START,END,SECTORS,NAME,FLAGS,SCHEMETARGET                           SOURCE     FSTYPE          OPTIONS     /                                /cow       overlayfs       rw,relatime,lowerdir=//filesystem.squashfs,upperdir=/cow     ├─/sys                           sysfs      sysfs           rw,nosuid,nodev,noexec,relatime     │ ├─/sys/fs/cgroup                          tmpfs           rw,relatime,size=4k,mode=755     │ │ └─/sys/fs/cgroup/systemd     systemd    cgroup          rw,nosuid,nodev,noexec,relatime,name=systemd     │ ├─/sys/fs/fuse/connections                fusectl         rw,relatime     │ ├─/sys/kernel/debug                       debugfs         rw,relatime     │ ├─/sys/kernel/security                    securityfs      rw,relatime     │ └─/sys/fs/pstore                          pstore          rw,relatime     ├─/proc                          proc       proc            rw,nosuid,nodev,noexec,relatime     ├─/dev                           udev       devtmpfs        rw,relatime,size=1977152k,nr_inodes=207544,mode=755     │ └─/dev/pts                     devpts     devpts          rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000     ├─/run                           tmpfs      tmpfs           rw,nosuid,noexec,relatime,size=397492k,mode=755     │ ├─/run/lock                               tmpfs           rw,nosuid,nodev,noexec,relatime,size=5120k     │ ├─/run/shm                                tmpfs           rw,nosuid,nodev,relatime     │ └─/run/user                               tmpfs           rw,nosuid,nodev,noexec,relatime,size=102400k,mode=755     │   └─/run/user/999/gvfs         gvfsd-fuse fuse.gvfsd-fuse rw,nosuid,nodev,relatime,user_id=999,group_id=999     ├─/cdrom                         /dev/sdb1  vfat            ro,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro     ├─/rofs                          /dev/loop0 squashfs        ro,noatime     ├─/tmp                           tmpfs      tmpfs           rw,nosuid,nodev,relatime     └─/media/ubuntu/04A874F6A874E796 /dev/sda4  fuseblk         rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096     NAME   FSTYPE LABEL MOUNTPOINT     sda                      ├─sda1                   ├─sda2                   ├─sda3                   ├─sda4              /media/ubuntu/04A874F6A874E796     ├─sda5              [SWAP]     └─sda6                   sdb                      └─sdb1              /cdrom     sr0                      loop0               /rofs     partition: none, disk: /dev/sda, lower: 0, upper: 0     /dev/sda: partition table type 'dos' detected     NR     START        END   SECTORS NAME FLAGS SCHEME      1      2048  195311615 195309568      0x0   dos      2 195313662  820317176 625003515      0x0   dos      3 820318208  821035007    716800      0x80  dos      4 821035008 1250260991 429225984      0x0   dos      5 195313664  214843391  19529728      0x0   dos      6 214843455  820317176 605473722      0x0   dos


Attempts to unify Linux and other free Unix?

It's such a pain when you don't know what distribution to choose. It's such a waste of time and effort for developers to port stuff from one distribution to another. It makes Linux/Unix more complicated (and scary) than it should be. While I know there are certain reasons why the situation became the way it is now, I wonder if anyone has ever thought of reunifying the worlds of Linux and other (free) Unix? **This is still a question** : Have there been any (failed) attempts to unify Linux/Unix?


How to stop GUI apps spam the terminal?

I start a gui app from a konsole window and it writes out totally useless information. I do not need that. Is there a way to stop this, once and for all? I tried disown, doesnt help. I guess 2>&1 >/dev/null might help but that's rather tedious :( Edit: OK, let's get creative. One half of the answer is to use preexec (I use zsh but the net is full of bash preexec tricks) and use `ldd` to detect libX11 (and what else?). Then http://stackoverflow.com/a/9188571/308851 shows how to create redirects to /dev/null. How can we expand this solution to work with programs having a shell script wrapper?


Missing menu on Mint host using RDP unless logged in on host console

Using Remote Desktop from a Windows 7 PC to connect to a Mint 17 VM with MATE, the Show Desktop icon displays, but the Menu button does not. However, if I go to the Linux machine and log in, leave the session logged in, RDP works and the menu displays correctly. It seems like logging in on the Mint machine starts something that X11RDP does not. Is there something that I need to configure or add to .xsession so I don't need to be logged into the physical machine to connect via RDP? Setup: PC 1: Windows 7 PC using Remote Desktop PC 2: Ubuntu 14.04 LTS running LXDE and VirtualBox as the VM host. Mint 17 VM guest running X11RDP (from X11RDP-o-Matic). .xsession contains only one line: mate-session


Can't use QWERTY layout after make IBus work with Dvorak layout after reboot

To keep my Input Method (Bogo or Unikey) of IBus working with Dvorak keyboard layout after reboot, I use `sudo dpkg-reconfigure keyboard-configuration` to set keyboard as Dvorak, and go to tab Advance in IBus Preferences to check Use system keyboard layout. The problem is, sometimes my friends want to borrow my laptop and I can not easily switch to Qwerty layout because any Input Method will use Dvorak. The English - English (US) is the same as English - English (Dvorak) one. Any idea? Info: I'm use IBus 1.5.3 and it says this is the newest version. So do Cinnamon.


how do I get the response ouput from the url .download it in file,not download the code

My file like this with some number or id                404000847307897      404000857827460      404001044194601      404000835511595      404000338418501      404000338654003      404000290144612      404000344175621      404000290144612      404000844713523      this my url                url= http://203.90.117.109/wds_cdma/wds.aspx?min=       now by using this url get the response from url and download output of the url. not the code. example take the url and add the `min = file id` number at end of the url.               (http://203.90.117.109/wds_cdma/wds.aspx?min=404000847307897)     (http://203.90.117.109/wds_cdma/wds.aspx?min=404000857827460)      this url hit the server get the response of the url ouput below                404000847307897|-101| Requested MIN not found.      404000857827460|9225534526|2|Prepaid|2       finally this output store in one file. can you do this `curl` with `awk` or `wget`?


How can I use ffmpeg to split MPEG video into 10 minute chunks for YouTube upload?

There is often a need in the open source or active developer community to publish large video segments online. (Meet-up videos, campouts, tech talks...) Being that I am a developer and not a videographer I have no desire to fork out the extra scratch on a premium Vimeo account. How then do I take a 12.5 GB (1:20:00) MPEG tech talk video and slice it into 00:10:00 segments for easy uploading to YouTube?


Mouse + network turned off after suspend

(After upgrade from Debian Wheezy to Jessie), my mouse is not turning on again, when I wake up my computer. I don't know if my computer hibernating or suspended to ram. Is there something that I can add to /etc/pm/... ? gnome-control-center and gnome-tweak-tool have no options. Also my network is turned off, but this is also so case when booting, so might be a different problem.


Setting up Kolab Mail Server on Cent OS. The port number '389' is not available for use error?

I use: `setup-kolab` and all goes well , except an error is returned:               The port number '389' is not avaialble for use.      This may be due to an invalid port number, or port already being in use by another program.      So I use:               netstat -lntp | grep :389      It returns:               tcp        0      0 :::389           :::*            LISTEN      15697.ns-slapd      What now? Should I exit the program, or specific a different port for Kolab (I tried this but there were no arguments to set it)


Linux / Windows 8.1 : Installation on raid0

I need to install a linux distribution on my laptop (an Asus UX302LA). I tried again and again but I couldn't even begin the installation. To explain you my problem, I know that Windows 8 is installed on UEFI mode. Furthermore, I have discovered that I have a raid0, probably a software one, in my laptop. I tried to install the latest version of Ubuntu and Mint, both 64bits. I find some tutorials on the internet but I'm so afraid about formating all my datas (and also the recovery partitions). Can someone help me by giving me a good tutorial or by explaining all I have to do ? Thank you for your help !


Kali tools on Ubuntu

Okay, So I am new to UBUNTU, and have little experience with Kali and Backtrack! so I wanted to install **ALL** the Kali Linux tools in UBUNTU, not one by one, or just transform the Kali Linux into Ubuntu does anyone have the answer, I couldn't find any related questions asked before :\ ## if u don't know about all the tools, so no problem But I need these tools :D : >   1. AirCrack > >   2. Burp Suite > >   3. Hydra > >   4. John the Ripper > >   5. Maltego > >   6. Metasploit Framework > >   7. Armitage > >   8. Zed Attack Proxy > >   9. Sqlmap > >   10. Wireshark > >   11. address6 > >   12. Deblaze > >   13. Tnscmd10g > >   14. BBQSQL > >   15. Blueranger > >   16. Lynis > >   17. DotDotPwn > >   18. Netgear-telnetable > >   19. Terminator > >   20. Htexploit > >   21. Jboss-autopwn > >   22. Websploit > >   23. Bluepot > >   24. Spooftooph > >   25. Smartphone-Pentest-Framework > >   26. Fern-Wifi-cracker > >   27. Wi-fihoney > >   28. Wifite > >   29. Creddump > >   30. Johnny > >   31. Manglefizz > >   32. Ophcrack > >   33. Phrasendresher > >   34. Rainbowcrack > > > > 35.Acccheck > > 36.Smbexec


Rsyslog Problem, Custom Template

I have a problem with `rsyslog`. bellow is my configuration ,partial. This is File Name Template:               $template DynFile,"/data/router-log/%HOSTNAME:::lowercase%/%timegenerated:1:10:date-rfc3339%_%$HOUR%"     $template SrxFile,"/data/router-log/fw-srx5800-msl-116-1/%timegenerated:1:10:date-rfc3339%_%$HOUR%"      This is File Content Template:               $template FileFormat,"%TIMESTAMP:::date-rfc3339% %HOSTNAME% [] %rawmsg:7:29:%%rawmsg:36:$%\n"     $template CGFormat,"%TIMESTAMP:::date-rfc3339% %HOSTNAME% %msg%\n"     #          #    Second Part     #     $FileOwner root     $FileGroup root     $umask 0000     $CreateDirs on     $DirCreateMode 0644     $FileCreateMode 0644     $RepeatedMsgReduction off     $EscapeControlCharactersOnReceive on     $DynaFileCacheSize 100          # Rules          :source , !isequal , "localhost" ?DynFile;FileFormat      This system was doing its job for 1 year without any problem. It was collecting log from a remote device. Log desity is arround 50k to 60k lines per second.I was using "RSYSLOG_TraditionalFileFormat". After that log was parsing with customer software. Once remote device software was upgraded, old template stopped working. That's why I build my own template. I had to use %rawmsg% instead of %msg% variable. But now I have problems. One of them is "last message repeated n times" start appearing at the end of lines. This broke the system. Second I start seeing uncompleted lines which also broke system. I got stuck and can not find what is the problem as some files are picked up fine but some are not. I want to open "$RepeatedMsgReduction on " which can help may be in reducing unwanted duplicate lines, but this time I receive "last message repeated .. " at the end and I can not parse the file Any suggestion to how can I fix this problem ? Could `rsyslog` struggle due to custom template and this cause duplication ? Using DiskQueues or MemoryQueues can fix my problem or not ?


Where to put wrapper scripts?

I created some scripts for administrative tasks etc, I made them to be independent from environment - every dependency is injected through arguments. However it is annoying to provide to script commonly used dependencies every time I run it, and I don't want to hardcode in it any local information, so I created wrappers. I put my general scripts in $HOME/bin but where should I put wrappers that contain local information and are only for speeding up invocation? **Example:** Think about script that makes and sends to given ftp server encrypted system backup. It was made as a generic script that can be used with any gpg public keys or ftp servers, however I'm using always only specific public key and uploading it only to specific ftp server, so I created a wrapper with this information. This generic script is actually in /root/bin as this is administrative tool, but where to put that wrapper?


Smarter log rotation

I want to reduce the amount of logs in my system, but reduce them smartly. The general idea is, each time you rotate, look for any warning/error/critical level logs, and keep 2 minutes of log context (before and after), regardless of its log level. The rest of logs would be simply discarded. The current alternatives seem to be, either log _everything_ and needlessly use copious amounts of disk, or just filter by specific log levels and forget any chances you had at actually trying to debug the problems. Is there any log rotating or syslog system for Debian that can work like that?


Is a restart of cron or crond necessary after each new schedule addition or modification?

When I schedule a job, some seem to be applied immediately, while others after a reboot. So is it recommended to restart `cron` (`crond`) after adding a new cron job? How to do that properly (esp. in a Debian system), and should that be done with `sudo` (like `sudo service cron restart`) even for that of normal users'? I tried:               /etc/init.d/cron restart      which doesn't seem to work (neither does `/etc/init.d/cron stop` or `service cron stop`) and completes with return code 1. Here's a part of the message output: > Since the script you are attempting to invoke has been converted to an > Upstart job, you may also use the stop(8) utility, e.g. stop cron stop: > Rejected send message, 1 matched rules; type="method_call", sender=":1.91" > (uid=1000 pid=3647 comm="stop cron ") interface="com.ubuntu.Upstart0_6.Job" > member="Stop" error name="(unset)" requested_reply="0" > destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init") _(what does that mean?)_


How to set Sublime Text as default text editor? The only option I see is Pluma. I'm using Mate Desktop on Fedora 19. ![enter image description here](http://i.stack.imgur.com/LpWqw.png) Edit: The Sublime Text executable (installed by hand, not a package) is at `/home/matt/sublime_text_3/sublime_text`.


How to edit context menu in Elementary OS' Files manager (pantheon-files)?

(I am new with Elementary OS and am not sure how to ask questions on their website. So this might be a cross-posting; I cannot find my question posted there.) I have seen here that the entries in the context menu of the file manager can be edited as `.contractor` files in `/usr/share/contractor/`. That case is about adding "open terminal here", and I was able , following that model, to add "open folder as root" - as presented here. A such `.contractor` file would look like this:               [Contractor Entry]     Name=Open folder as root     Icon=gksu-root-terminal     Description=Open folder as root     MimeType=inode;application/x-sh;application/x-executable;     Exec=gksudo pantheon-files -d %U     Gettext-Domain=pantheon-files      I would like to know if various (terminal) commands can be created in the same way, and what the different lines in a `.contractor` mean and how to change them for a certain purpose. I would like to add a command that would convert files, similarly to what is possible through Thunar custom actions - like here, here and here. I need to know how to restrict the context menu command to a certain type of selected files - I guess that could be done in the line`MimeType=`. Also the `Exec=` line is important. May I have a bit of advice in this sense and maybe a link to a tutorial on the matter? * * * UPDATE: A contractor file running a script that was created to open music file in foobar200 through Wine works for me in this form:               [Contractor Entry]     Name=Open in Foobar     Icon=foobar2000     Description=open in foobar     MimeType=inode;application/x-sh;application/x-executable;     Exec=/home/cipricus/scripts_var/foobar_open_in.sh %F     Gettext-Domain=pantheon-files      But this adds to foobar2000 playlist all music files in the folder (and its subfolders). How to restrict this to selected files/folders?


Help with the sort command (numeric)

I have this output I'd like to sort numerically by port (starting at the 35th column):               tcp        0      0 192.168.0.210:110       0.0.0.0:*  LISTEN  3385/dovecot     tcp        0      0 192.168.0.210:143       0.0.0.0:*  LISTEN  3385/dovecot     tcp        0      0 192.168.0.210:22        0.0.0.0:*  LISTEN  2223/sshd     tcp        0      0 192.168.0.210:25        0.0.0.0:*  LISTEN  3589/master     tcp        0      0 192.168.0.210:443       0.0.0.0:*  LISTEN  2037/apache     tcp        0      0 192.168.0.210:587       0.0.0.0:*  LISTEN  3589/master     tcp        0      0 192.168.0.210:80        0.0.0.0:*  LISTEN  2037/apache     #                                 ^     #                                 Sorted at this column (#35)      So that the new output looks like this (lowest port first):               tcp        0      0 192.168.0.210:22        0.0.0.0:*  LISTEN  2223/sshd     tcp        0      0 192.168.0.210:25        0.0.0.0:*  LISTEN  3589/master     tcp        0      0 192.168.0.210:80        0.0.0.0:*  LISTEN  2037/apache     tcp        0      0 192.168.0.210:110       0.0.0.0:*  LISTEN  3385/dovecot     tcp        0      0 192.168.0.210:143       0.0.0.0:*  LISTEN  3385/dovecot     tcp        0      0 192.168.0.210:443       0.0.0.0:*  LISTEN  2037/apache     tcp        0      0 192.168.0.210:587       0.0.0.0:*  LISTEN  3589/master     #                                 ^     #                                 Sorted at this column (#35)      I've played around with all different forms of `|sort`, including:               |sort -n         # <- I thought this would work     |sort -nk35     |sort -nk35,37      Etcetera, etcetera. Maybe I'm misunderstanding the purpose of the `-k` flag? Or maybe those colons are messing things up?


Is whois command safe for privacy?

I remember in the past that companies such as Network Solutions will steal your searched domain name when you perform a domain search at their website. I want to know, is the built-in command `whois` safe from this perspective? What the server the command pointed to, and do they collect information?


Whitelist virtual_alias_maps

I have one mailbox in postfix and several aliases to it. Is it possible to create whitelists for specific alias in order to allow only the addresses from the list to send messages. For example: virtual hash:               test@example.com user     priv@example.com user      I would like to permit only two users(ali@comp.com ola@test.org), to send a message to priv@example.com In the other hand when someone wants to send a message to test@example.com, No restrictions are applied. Is it possible to configure postfix server this way?


How to find out Hard disk first & last sector ID's?

Is that possible to find Hard disk sector's ID? If we can, how to find out Hard disk 1st & last sector ID's in windows & LINUX? As I tried to Google it, I found only hard disk sector size. If any one know about this please update.


Empty typescript file with the script command

In the command line, I typed:               script -a myfile      Then, I typed the some standard commands. When I opened the `myfile` using `vi`, the file was empty. Why is that? And, also, any tips on using the `ttyrec` and `ttyplay` commands?


Simple shell script needed to move database files

I am using **MySQL** on **Ubuntu** machine. I need to physically move around the database files under `/var/lib/mysql/` (this is where all the databases directories are located). Say I have two databases, **db_1** and **db_2** , so I can see two directories(`db_1/` and `db_2/`) under the path `/var/lib/mysql/` . Under each of these two database directory, there are many `.frm` `.MYD` `.MYI` files which holds all the tables' informations of the database. For example, under `db_1/` directory there are following files:               /var/lib/mysql/db_1# ls          cars.frm      cars.MYD      cars.MYI          customers.frm     customers.MYD     customers.MYI          departments.frm     departments.MYD     departments.MYI          ...       which holds _cars_ , _customers_ , _departments_ tables' info. I need a shell script to do the following simple task:   1. make a new direcotry named `db_1_temp` under `/var/lib/mysql/`   2. move files related with _cars_ and _customers_ tables in `db_1` directory to `db_1_temp` direcotry   3. move files in `db_2` directory to `db_1` direcotry **NOTE** , user need **root** privilege to access `/var/lib/mysql/` I need these things in a .sh file so I can run it in another application. Sorry that I do not know shell script, but need this thing. Appreciate if anyone can give a help, this shell script should not be hard I think. I try to extract some time to learn shell, as now I am quite busy with other software development. Thank you!


maximum number of files ls can list

Im using a script to delete old file in a directory, but the script kept showing               /usr/bin : Argument list too long      It turned out the number of files were 40000 and more, So I want to know what is the maximum limit of files that can be listed. Is there anyway to find it? Is it system specific?


Bash script to adjust brightness when battery unplugged

I am trying to set up my system and to get some practice with scripting and the like. I am running Linux Mint 16 on a Samsung RC520 laptop (`Linux 3.11.0-12-generic x86_64`). I want to implement a script that will lower my screen brightness to a pre-set value when I unplug the power (and raise it when I plug it back in). I can do some very basic scripting but not near this level. I have "xbacklight" which will set the brightness from the command line, so when I unplug the power the line I want to implement would be `xbacklight -set 20`. I also know that unplugging the power is registered by acpi (this may sound completely stupid but hopefully it is clear what I mean); when I plug out and then back in the power I get the following with `acpi_listen`:               $ acpi_listen     ac_adapter ADP1 00000080 00000000     processor CPU0 00000081 00000000     processor CPU1 00000081 00000000     processor CPU2 00000081 00000000     processor CPU3 00000081 00000000     ac_adapter ADP1 00000080 00000001     processor CPU0 00000081 00000000     processor CPU1 00000081 00000000     processor CPU2 00000081 00000000     processor CPU3 00000081 00000000     battery BAT1 00000080 00000001      So I know I have to use this but I have two main problems: I wouldn't know where to put the script so that it is automatically implemented, and I don't know how I would recognise the plug in/out in acpi because all I know how to do is `acpi_listen`.


Ubuntu 14.04 LTS - USB 3.0 Low Output or not working

I have a problem with my laptop. Since I've installed Ubuntu 14.04 LTS in dual boot, my two USB 3.0 don't work anymore. Maybe you need to know: My Laptop has 2*USB 2.0 and 2*USB 3.0. One of the USB 2.0 is defect, idk why, it doesn't work under Windows either. The two 3.0 Ports work under Windows (they charge my Phone and I can connect my mouse & USB stick to them). The 2.0 port works fine, too. In Ubuntu, the 2.0 port works excellent, too. But the 3.0 Ports don't. Whenever I plug in my Phone, it says that it's charging, but it doesn't detect that it's connect to a Laptop/PC (No USB Debugging icon and no option to enable mass storage). When i plug my mouse in one of the 3.0 ports, the laser (or whatever it is) on the bottom of the mouse flickers, but it doesn't work. When i plug in an USB, it doesn't connect. Before Ubuntu 14.04 i had 13.04 and everything worked as it should (except the USB 2.0 port, of course). This is the output of `lsusb` with plugged in my mouse and my phone to my 3.0 ports:               Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub     Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 001 Device 004: ID 8087:07da Intel Corp.       Bus 001 Device 003: ID 04f2:b2bb Chicony Electronics Co., Ltd      Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub     Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub`      This is 'lsusb' with **nothing** plugged in:               Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub     Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 001 Device 004: ID 8087:07da Intel Corp.      Bus 001 Device 003: ID 04f2:b2bb Chicony Electronics Co., Ltd      Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub     Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub      I only know that `04f2:b2bb` is my Webcam. Thanks in advance, I'm helpless.


How to mount a flash image in Linux?

In Linux, I created an image of a flash disk as follows:               sudo dd if=/dev/sdb of=test.img      which I now want to mount directly. I tried the following command               sudo mount -t ext3 -o loop test.img /mnt/flash      which resulted in the following error:               mount: wrong fs type, bad option, bad superblock on /dev/loop0,        missing codepage or helper program, or other error        In some cases useful info is found in syslog - try        dmesg | tail  or so      `dmesg` shows the entry               EXT3-fs (loop0): error: can't find ext3 filesystem on dev loop0.      which I am not able to interpret. I get the same message when I omit the option `-o loop`. Any ideas how I am able to mount the _file_ image to `/mnt/flash`? I am not talking about mounting the actual flash disk, I want to mount the `file`.


Run .sh file instead of opening it

I am using Zorin OS 7. I want to run a `.sh` file but I can't seem to be able to--it just opens in a text editor. Also under RMB>open with there is no other option.


understanding how to run script securely as limited user

I'm a long time dev but linux newbie. I've been building this (http://tryperl.com) to learn linux. So, my question is just about some *nix stuff I don't fully grok. One of the things I want to do is run the generated script (in my application) as a limited user. So I create a `limiteduser` . Then I can set say fork limits like this : `limiteduser hard nproc 300`. Is this then **the right way** of running a script as `limiteduser` :               sudo -u limiteduser perl myscript.pl      **Secondly** , what if I had concurrent requests that **forked and executed** and ran the above code simultaneously, with different scripts. Would that cause problems? I heard it would, if two processes ran on the same user or something? Specifically I'm running on ubuntu but I assume this applies to any *nix distro? * * * Update: Also, I plan to use Time::Out to timeout a script if it takes too long so ideally I should have a limited number of processes running.


What goes into a Linux distribution?

**My understanding of Linux distributions is that:** They are operating systems based on the Linux kernel, and most have default desktop environments, something that is not in the Linux kernel. Fedora uses Gnome, Ubuntu uses Unity, and so on. However, some, such as Arch Linux, do not have a default window manager. **Question:** What components go into a distribution, outside of the kernel (e.g. how is Arch Linux different from just the kernel itself)? Could a functional operating system be made with just the kernel alone?


How to copy a long textfile to clipboard on gnome-terminal?

> **Possible Duplicate:**   >  How do I send stdin to the clipboard? What's the best way to copy a long text file to keyboard? I'm imagining something like:               cat longTextFile | straightToClipboard


Colour problem when capturing a png of the top panel of the screen

I want to capture a window as a png from within a bash script, using the window's _ID_. In this case, the window is the top panel. Using `gnome- screenshot` the colours are true, as per this image... (this image is not the same size as the following image, so ignore the dark line at the bottom) ![enter image description here](http://i.stack.imgur.com/Zm954.png) However when I capture the panel via `import`, _or_ `xwd` \+ `convert`, I get the following image.. ![enter image description here](http://i.stack.imgur.com/cr9FI.png) Why would I be getting this colour aberration? `import` and `convert` both belong to the `imagemagick` package... I haven't found anything else in the Ubuntu repository which can capture a window by its _ID_... so I'm stuck. (`gnome-screenshot` doesn't have the feature)... It would be nice to know what is going on here (eg, is is something to do with _transparent_ images, which I know very little about)...but in any case, just a recommendation of a _workaround_ capture utility may do the trick ... it must be able to capture a window by it's _ID_. Here is an example of how I make and view the image capture.               import -window "$(wmctrl -l |grep "Top Expanded Edge Panel" |awk '{print $1}')" screen.png       display screen.png


what is the difference in ownership order?

What is the difference on CentOS Linux if you `chown` apache:root or root:apache? I am trying to set correct ownership for Drupal install but both Drupal Docs and all subsequent pages of discussions following have varying ideas on the subject and without a good base understanding of what it is all about you wouldn't have a clue. Until I find the right documentation on the subject I just want to know the difference of order between root:apache and apache:root if any?


Type URL and show HTTP status

I want to make a shell script where I type an url and it returns me the status code.So far I've tested `wget` is there any other cause it has the tendency to save whatever you run. Then I tried to some kind `awk` the output but it doesn't do you have any advices. * * * Edit for Zelda: I tried the first one ![enter image description here](http://i.stack.imgur.com/Yk6ny.png) but I always receive : ![enter image description here](http://i.stack.imgur.com/ibRLe.png) P.S. Also I tried HTTP without '',now I putted for curiosity


Create NTFS partition (in Linux) for dual-boot into Linux/Windows 7

I have installed Linux (Debian) onto my computer (which is not partitioned). Want I want to do is to create an NTFS partition so that I can install Windows 7 onto my computer, so I can dual-boot into Linux/Windows 7. So is it possible to create an NTFS partition in Linux, without losing any Linux files?


Unable to update linux-mint or install any software from the software manager

Returns error on update manager "Unable to download all repositories" which is followed by a long list of failed connections and ip addresses Also if I try to download any software from the software manager, it just doesn't install. Takes a while and returns not installed. Trying to use terminal is never successful either and the connection just fails It looks like apt fails to establish a connect with and of the servers and but I have no idea how to go about checking that out. Am still new to this


Count running processes using wc and ps

I tried using `ps r > log | wc log` but this returns `Ambiguous output redirect.`. Can someone explain why and provide another solution?


Customizing bash shell: Bold/color the command

There are a number of tutorials/posts online (e.g. http://www.cyberciti.biz/faq/bash-shell-change-the-color-of-my-shell-prompt- under-linux-or-unix/) about how to customize your prompt in bash by setting PS1. Is there a way to customize the color/bolding of the command I type? In other words, as an example lets say that I wanted a green prompt, a bold blue command, and then output in whatever colors would be default. In the example below, I already know how to make "joe>" show as green, blue, bold, whatever by setting PS1. But is there a way I can I make "git status' show as bold for example?               joe> git status     # On branch master     # Your branch is ahead of 'origin/master' by 2 commits.     #     ...


Split PDF into colour and black/white pages

I would like to automatically split a large PDF document into two files: one file should contain only the pages with black and white content, and the other should contain only the pages with any colour content. The colour and black/white pages do not run contiguously -- they are interspersed throughout the document. How can I do this automatically?


Web based voice chat application

I'm looking for a simple server-webclient voice chat software, but yet I only saw "voxli" and it's down. Is there any such software which could be run on a linux based server (raspberrypi actually)? I wanted a web based client because guys won't need to download another software, I hope this exists! Thanks for suggestions


Understanding -regex with GNU find

## Background I have what I think _should_ be a simple case. I want to find all files with "cisco" in the name and do something with those files (via xargs). ### Finding files with `ls` Before I use xargs, the first step is listing all relevant files. Listing files is easy with `ls | grep cisco`...               [mpenning@Bucksnort post]$ ls | grep cisco     cisco-asa-double-nat.rst     cisco-asa-packet-capture.rst     cisco-eem-tcl.rst     cisco-ip-sla-tracking.rst     cisco_autonomous_to_lwap.rst     [mpenning@Bucksnort post]$      ### Finding files with `find` Although it's probably not required in this specific case, find is generally considered safer when piping into xargs. However, all logic seems to go out the window when I use `find -regex`.               [mpenning@Bucksnort post]$ find -regextype grep -regex ".*/cisco*" -print     [mpenning@Bucksnort post]$      However, I know I can find those files...               [mpenning@Bucksnort post]$ find | grep cisco     ./cisco-eem-tcl.rst     ./parsing-cisco-output-w-textfsm.rst     ./cisco_autonomous_to_lwap.rst     ./cisco-ip-sla-tracking.rst     ./cisco-asa-double-nat.rst     ./cisco-asa-packet-capture.rst     [mpenning@Bucksnort post]$      ## Questions I realize that `find -regex` has to match the full path that is returned, but why isn't `find -regextype grep -regex ".*/cisco*" -print` working above? Shouldn't `.*/cisco*` match the path? * * * _NOTES_ I know I could just use `find -path "*cisco*"` to solve the problem, but the point of the question is to understand why my `-regex` usage is wrong.


Mouse scroll wheel issues

I'm been having issues with the scroll-wheel on my mouse for ages now. I've got a Silverstone Raven mouse, and the scrolling action is extremely jerky. If I scroll either up or down, at a natural speed, the scroll action will jerk in the wrong direction almost as much as it goes in the right direction. I have to scroll almost twice as much to get where I want in a page, and often I'll lose track of where I am because it's not behaving as expected. If I deliberately scroll really slowly, it will go in the correct direction, as expected, but it's really painful. So, to check that this isn't just a dodgy mouse, I rebooted into Windows - a rare occurrence for me these days - and tried it in there. Scrolling works beautifully; it's really smooth, no glitching, and is a pleasure to use. Back in Linux-land, the scroll wheel is 'orrible. In KDE System Settings, I have tried changing the number of lines the mouse wheel scrolls by, but this doesn't affect the glitchiness... The mouse section of my `/etc/X11/xorg.conf` is as configured by default and looks like:-               Section "InputDevice"         # generated from default         Identifier     "Mouse0"         Driver         "mouse"         Option         "Protocol" "auto"         Option         "Device" "/dev/psaux"         Option         "Emulate3Buttons" "no"         Option         "ZAxisMapping" "4 5"     EndSection      Anyone have any suggestions how to get my mouse working nicely? I'm on Linux 3.7.6 and this has been an issue for about two years now; I just haven't bothered to tell anyone 'til now..


zshell is tab-completing ambiguous options

I've been having an issue with zsh completion that's becoming a rather large annoyance. It's completing options beyond where there is ambiguity. For example, in a directory with these files: tilertest1x1-00_1408311424.log   tilertest1x1-00_1408311424.root   tilertest2x2-00_1408311501.log   tilertest2x2-00_1408311501.root   tilertest3x3-00_1408311527.log   tilertest3x3-00_1408311527.root If I type "less ti" and then hit tab, zsh completes to this "tilertest-00_1408311." as opposed to stopping where I want it to ("tilertest"). Strangely, if I provide any kind of path (i.e. "less ./ti") it seems to work just fine. How can I change it to stop at the very first ambiguity? If it helps I've included my .zshrc file. I should also note I'm using oh-my-zsh. I have a feeling the solution is trivial, but I can't find anything searching around. Any help would be appreciated.               # Path to your oh-my-zsh installation.     export ZSH=$HOME/.oh-my-zsh          # Set name of the theme to load.     # Look in ~/.oh-my-zsh/themes/     # Optionally, if you set this to "random", it'll load a random theme each     # time that oh-my-zsh is loaded.     ZSH_THEME="cmilke01"          # Example aliases     # alias zshconfig="mate ~/.zshrc"     # alias ohmyzsh="mate ~/.oh-my-zsh"          # Uncomment the following line to use case-sensitive completion.      CASE_SENSITIVE="true"          # Uncomment the following line to disable bi-weekly auto-update checks.     # DISABLE_AUTO_UPDATE="true"          # Uncomment the following line to change how often to auto-update (in days).     # export UPDATE_ZSH_DAYS=13           # Uncomment the following line to disable colors in ls.      # DISABLE_LS_COLORS="true"           # Uncomment the following line to disable auto-setting terminal title.      # DISABLE_AUTO_TITLE="true"           # Uncomment the following line to disable command auto-correction.       DISABLE_CORRECTION="true"           # Uncomment the following line to display red dots whilst waiting for     completion.      # COMPLETION_WAITING_DOTS="true"          # Uncomment the following line if you want to disable marking untracked files     # under VCS as dirty. This makes repository status check for large repositories     # much, much faster.     # DISABLE_UNTRACKED_FILES_DIRTY="true"          # Uncomment the following line if you want to change the command execution time     # stamp shown in the history command output.     # The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"     # HIST_STAMPS="mm/dd/yyyy"          # Would you like to use another custom folder than $ZSH/custom?     # ZSH_CUSTOM=/path/to/new-custom-folder          # Which plugins would you like to load? (plugins can be found in ~/.oh-my-  zsh/plugins/*)     # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/     # Example format: plugins=(rails git textmate ruby lighthouse)     plugins=(git)          source $ZSH/oh-my-zsh.sh          # User configuration          export PATH="/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/core_perl"     # export MANPATH="/usr/local/man:$MANPATH"          # You may need to manually set your language environment     # export LANG=en_US.UTF-8          # Preferred editor for local and remote sessions     # if [[ -n $SSH_CONNECTION ]]; then     #   export EDITOR='vim'     # else     #   export EDITOR='mvim'     # fi          # Compilation flags     # export ARCHFLAGS="-arch x86_64"          # ssh     # export SSH_KEY_PATH="~/.ssh/dsa_id"


Why do all applications go to the 'Others' App Folder in Gnome Shell 3.8?

I just upgraded my laptop to Fedora 19, which comes with Gnome Shell 3.8. Gnome shell 3.8 has got rid of the traditional Categories in favor of something called App Folders. I have been trying to learn how to create and use them. One thing I have not been able to understand is why the 'Others' menu/app folder has all my apps. In `/etc/xdg/menus/gnome-applications.menu` it is defined like:                   <Name>Other</Name>         <Directory>X-GNOME-Other.directory</Directory>         <OnlyUnallocated/>         <Include>           <And>             <Not><Category>Core</Category></Not>             <Not><Category>Screensaver</Category></Not>                  <!-- Really Fedora ??? -->             <Not><Filename>gnome-eog.desktop</Filename></Not>             <Not><Filename>gnome-file-roller.desktop</Filename></Not>             <Not><Filename>gnome-gucharmap.desktop</Filename></Not>           </And>         </Include>       </Menu> <!-- End Other -->      I read from some spec that `<OnlyUnallocated/>` tag should only match, and add to the menu, applications that have not been matched to any other menu. I also do not see where it decides to include the apps, as `<Include></Include>` just contains apps _not_ to include. I assume it is either defined somewhere else, or the name 'Other' is just somewhat special. Am I understanding something wrong about the definition of these menus, or is Gnome Shell 3.8 doing it's own thing, and not working 100% according to these files? (I suspect the former)


How to remove a newline character in a particular line through perl?

I want to remove a newline character in a particular line through perl one- liner command. **Input:**               1407233497,1407233514,bar     1407233498,1407233515,foo     mingstats&fmt=n     1407233499,1407233516,foobar      **Expected output:**               1407233497,1407233514,bar     1407233498,1407233515,foomingstats&fmt=n     1407233499,1407233516,foobar      **What i tried so far?** This regex `\n(?!\d+,\d+)` matches exactly the newline that i want to remove. But i don't know how to implement it through perl one-liner command. I tried,               perl -pe 's/\n(?!\d+,\d+)//g' file      But it removes all the newline characters in that file and finally print the below in a single line,               1407233497,1407233514,bar1407233498,1407233515,foomingstats&fmt=n1407233499,1407233516,foobar      I will be so happy if the perl one-liner command uses above regex...


sed/awk/perl - delete spaces between two strings/words + solaris 10

please advice how to delete the spaces between "=" to the value/string ( after the "=" character) , should be implemented by awk or sed or perl command and command must to fit for solaris OS , ( command should be in my bash script ) I have SOLARIS 10 OS example 1 ( before update ) more file                a=2      b= 45      c=   4      d= 98      e=09      f= gdtd      g=     @7h      parameter5=    87      example 2 ( after update ) more file               a=2     b=45     c=4     d=98     e=09     f=gdtd     g=@7h     parameter5=87


How can I search/browse in some process's memory?

I'm using MacOS X 10.7 and I'm not very familiar with unix. Is there a command for a search in some process's memory for a string?


How to trace a java-program?

As a sysadmin I sometimes face situations, where a program behaves abnormally, while not creating errors at all or creating nonsense error-messages. In the past - before java came in - there were two counter-measures:   1. If nothing else helps - RTFM ;-)   2. If even 1. does not help - trace the system-calls and see what is happening I usually use `strace -f` for this task with Linux (other OS have similar trace-tools). Now while this usually works well for any old-fashioned program, the trace gets very fuzzy when doing the same on a **java** -process. There are so many system-calls seemingly unrelated to any real action, that it is terrible to search through such a dump. Are there better ways to do that (if the source-code is not available)?


Why do I have to restart NetworkManager.service all the time?

After switching to systemd, I started to use NetworkManager.service, I got connected to WIFI automatically at boot, but I got the following message when I run `nmcli con`:               ** (process:4433): WARNING **: Could not initialize NMClient /org/freedesktop/NetworkManager: Method "GetAll" with signature "s" on interface "org.freedesktop.DBus.Properties" doesn't exist          Error: nmcli (0.9.6.4) and NetworkManager (unknown) versions don't match. Force execution using --nocheck, but the results are unpredictable.      And from systemctl:               NetworkManager.service                              loaded active running       Network Manager      Now if I restart `NetworkManager.service`, it works. Why is that?


hosts.allow: %u not working (log username)

I need to keep track of all `SSH` connections on my server. In my `/etc/hosts.allow` I have something like this:               sshd: ALL : spawn ( echo "`date` from %u %a " >> /var/log/ssh/%d.log ) &      where `%a` logs the client IP, and `%u` is supposed to log the username. But instead `%u` just logs `unknown`. Is there a way to fix this? I need to log both the IP and the username for each connection.


Does my hard-drive have bad sectors or not?

I got a new drive and I'm confused if `smartctl` detects bad sectors or not. Both short and extended self-tests `completed without error`. But the `Error Log` indicates `Uncorrectable error in data` for `96 sectors`. Here's the `smartctl` output:               smartctl 5.41 2011-06-09 r3365 [i686-linux-3.2.0-52-generic] (local build)     Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net          === START OF INFORMATION SECTION ===     Model Family:     Hitachi Deskstar T7K500     Device Model:     Hitachi HDT725025VLA380     Serial Number:    VFL104R73X993Z     LU WWN Device Id: 5 000cca 316f723ca     Firmware Version: V5DOA73A     User Capacity:    250,059,350,016 bytes [250 GB]     Sector Size:      512 bytes logical/physical     Device is:        In smartctl database [for details use: -P show]     ATA Version is:   7     ATA Standard is:  ATA/ATAPI-7 T13 1532D revision 1     Local Time is:    Wed Feb  5 19:19:29 2014 UTC     SMART support is: Available - device has SMART capability.     SMART support is: Enabled          === START OF READ SMART DATA SECTION ===     SMART overall-health self-assessment test result: PASSED          General SMART Values:     Offline data collection status:  (0x80) Offline data collection activity                         was never started.                         Auto Offline Data Collection: Enabled.     Self-test execution status:      (   0) The previous self-test routine completed                         without error or no self-test has ever                          been run.     Total time to complete Offline      data collection:        ( 4949) seconds.     Offline data collection     capabilities:            (0x5b) SMART execute Offline immediate.                         Auto Offline data collection on/off support.                         Suspend Offline collection upon new                         command.                         Offline surface scan supported.                         Self-test supported.                         No Conveyance Self-test supported.                         Selective Self-test supported.     SMART capabilities:            (0x0003) Saves SMART data before entering                         power-saving mode.                         Supports SMART auto save timer.     Error logging capability:        (0x01) Error logging supported.                         General Purpose Logging supported.     Short self-test routine      recommended polling time:    (   1) minutes.     Extended self-test routine     recommended polling time:    (  83) minutes.     SCT capabilities:          (0x003f) SCT Status supported.                         SCT Error Recovery Control supported.                         SCT Feature Control supported.                         SCT Data Table supported.          SMART Attributes Data Structure revision number: 16     Vendor Specific SMART Attributes with Thresholds:     ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE       1 Raw_Read_Error_Rate     0x000b   100   100   016    Pre-fail  Always       -       0       2 Throughput_Performance  0x0005   100   100   050    Pre-fail  Offline      -       0       3 Spin_Up_Time            0x0007   110   110   024    Pre-fail  Always       -       338 (Average 340)       4 Start_Stop_Count        0x0012   100   100   000    Old_age   Always       -       1838       5 Reallocated_Sector_Ct   0x0033   100   100   005    Pre-fail  Always       -       0       7 Seek_Error_Rate         0x000b   100   100   067    Pre-fail  Always       -       0       8 Seek_Time_Performance   0x0005   100   100   020    Pre-fail  Offline      -       0       9 Power_On_Hours          0x0012   099   099   000    Old_age   Always       -       11746      10 Spin_Retry_Count        0x0013   100   100   060    Pre-fail  Always       -       0      12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       1822     192 Power-Off_Retract_Count 0x0032   099   099   000    Old_age   Always       -       2103     193 Load_Cycle_Count        0x0012   099   099   000    Old_age   Always       -       2103     194 Temperature_Celsius     0x0002   162   162   000    Old_age   Always       -       37 (Min/Max 12/48)     196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       0     197 Current_Pending_Sector  0x0022   100   100   000    Old_age   Always       -       0     198 Offline_Uncorrectable   0x0008   100   100   000    Old_age   Offline      -       0     199 UDMA_CRC_Error_Count    0x000a   200   253   000    Old_age   Always       -       0          SMART Error Log Version: 1     ATA Error Count: 27 (device log contains only the most recent five errors)         CR = Command Register [HEX]         FR = Features Register [HEX]         SC = Sector Count Register [HEX]         SN = Sector Number Register [HEX]         CL = Cylinder Low Register [HEX]         CH = Cylinder High Register [HEX]         DH = Device/Head Register [HEX]         DC = Device Command Register [HEX]         ER = Error register [HEX]         ST = Status register [HEX]     Powered_Up_Time is measured from power on, and printed as     DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes,     SS=sec, and sss=millisec. It "wraps" after 49.710 days.          Error 27 occurred at disk power-on lifetime: 11706 hours (487 days + 18 hours)       When the command that caused the error occurred, the device was active or idle.            After command completion occurred, registers were:       ER ST SC SN CL CH DH       -- -- -- -- -- -- --       40 51 60 e4 33 e7 47  Error: UNC 96 sectors at LBA = 0x07e733e4 = 132592612            Commands leading to the command that caused the error were:       CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name       -- -- -- -- -- -- -- --  ----------------  --------------------       25 03 80 c4 33 e7 40 00      02:28:22.700  READ DMA EXT       25 03 01 00 00 00 40 00      02:28:22.200  READ DMA EXT       25 03 01 00 00 00 40 00      02:28:22.200  READ DMA EXT       25 03 01 00 00 00 40 00      02:28:22.200  READ DMA EXT       ef 03 46 c4 33 e7 00 00      02:28:22.200  SET FEATURES [Set transfer mode]          Error 26 occurred at disk power-on lifetime: 11706 hours (487 days + 18 hours)       When the command that caused the error occurred, the device was active or idle.            After command completion occurred, registers were:       ER ST SC SN CL CH DH       -- -- -- -- -- -- --       40 51 60 e4 33 e7 47  Error: UNC 96 sectors at LBA = 0x07e733e4 = 132592612            Commands leading to the command that caused the error were:       CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name       -- -- -- -- -- -- -- --  ----------------  --------------------       25 03 80 c4 33 e7 40 00      02:28:11.700  READ DMA EXT       25 03 01 00 00 00 40 00      02:28:11.200  READ DMA EXT       25 03 01 00 00 00 40 00      02:28:11.200  READ DMA EXT       25 03 01 00 00 00 40 00      02:28:11.200  READ DMA EXT       ef 03 46 c4 33 e7 00 00      02:28:11.200  SET FEATURES [Set transfer mode]          Error 25 occurred at disk power-on lifetime: 11706 hours (487 days + 18 hours)       When the command that caused the error occurred, the device was active or idle.            After command completion occurred, registers were:       ER ST SC SN CL CH DH       -- -- -- -- -- -- --       40 51 60 e4 33 e7 47  Error: UNC 96 sectors at LBA = 0x07e733e4 = 132592612            Commands leading to the command that caused the error were:       CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name       -- -- -- -- -- -- -- --  ----------------  --------------------       25 03 80 c4 33 e7 40 00      02:28:00.700  READ DMA EXT       25 03 01 00 00 00 40 00      02:28:00.200  READ DMA EXT       25 03 01 00 00 00 40 00      02:28:00.200  READ DMA EXT       25 03 01 00 00 00 40 00      02:28:00.200  READ DMA EXT       ef 03 46 c4 33 e7 00 00      02:28:00.200  SET FEATURES [Set transfer mode]          Error 24 occurred at disk power-on lifetime: 11706 hours (487 days + 18 hours)       When the command that caused the error occurred, the device was active or idle.            After command completion occurred, registers were:       ER ST SC SN CL CH DH       -- -- -- -- -- -- --       40 51 60 e4 33 e7 47  Error: UNC 96 sectors at LBA = 0x07e733e4 = 132592612            Commands leading to the command that caused the error were:       CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name       -- -- -- -- -- -- -- --  ----------------  --------------------       25 03 80 c4 33 e7 40 00      02:27:49.700  READ DMA EXT       25 03 01 00 00 00 40 00      02:27:49.200  READ DMA EXT       25 03 01 00 00 00 40 00      02:27:49.200  READ DMA EXT       25 03 01 00 00 00 40 00      02:27:49.200  READ DMA EXT       ef 03 46 c4 33 e7 00 00      02:27:49.200  SET FEATURES [Set transfer mode]          Error 23 occurred at disk power-on lifetime: 11706 hours (487 days + 18 hours)       When the command that caused the error occurred, the device was active or idle.            After command completion occurred, registers were:       ER ST SC SN CL CH DH       -- -- -- -- -- -- --       40 51 60 e4 33 e7 47  Error: UNC 96 sectors at LBA = 0x07e733e4 = 132592612            Commands leading to the command that caused the error were:       CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name       -- -- -- -- -- -- -- --  ----------------  --------------------       25 03 80 c4 33 e7 40 00      02:27:38.900  READ DMA EXT       25 03 08 7c a8 3a 40 00      02:27:38.900  READ DMA EXT       35 03 08 7c a8 3a 40 00      02:27:38.900  WRITE DMA EXT       25 03 08 7c a8 3a 40 00      02:27:38.900  READ DMA EXT       25 03 08 a4 eb 94 40 00      02:27:38.900  READ DMA EXT          SMART Self-test log structure revision number 1     Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error     # 1  Extended offline    Completed without error       00%     11746         -     # 2  Short offline       Completed without error       00%     11744         -          SMART Selective self-test log data structure revision number 1      SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS         1        0        0  Not_testing         2        0        0  Not_testing         3        0        0  Not_testing         4        0        0  Not_testing         5        0        0  Not_testing     Selective self-test flags (0x0):       After scanning selected spans, do NOT read-scan remainder of disk.     If Selective self-test is pending on power-up, resume after 0 minute delay.      And here's a screenshot with the `Error Log`: ![enter image description here](http://i.stack.imgur.com/aAmgQ.png) So what is going on? Does the drive have bad sectors or not? * * * **UPDATE1:**   Just to be sure I also used `badblocks` as suggested in How do you use badblocks?. First, the non-destructive, 1h-long read-only method:               root@xubuntu:/home/xubuntu# badblocks -sv /dev/sda     Checking blocks 0 to 244198583     Checking for bad blocks (read-only test): done                                                      Pass completed, 0 bad blocks found. (0/0/0 errors)      And then the destructive, 10h-long write method (use with care!):               root@xubuntu:/home/xubuntu# badblocks -wsv /dev/sda     Checking for bad blocks in read-write mode     From block 0 to 244198583     Testing with pattern 0xaa: done                                                      Reading and comparing: done                                                      Testing with pattern 0x55: done                                                      Reading and comparing: done                                                      Testing with pattern 0xff: done                                                      Reading and comparing: done                                                      Testing with pattern 0x00: done                                                      Reading and comparing: done                                                      Pass completed, 0 bad blocks found. (0/0/0 errors)      As suggested in the answers, it really doesn't look like there are bad sectors on this hard-drive. (Yay!)


Allow NonRoot User to Mount a Particular NTFS External Hard Drive

I have a 4TB external hard drive connected to an Linux server. The fstab permissions on this drive are set so that only one particular non- root user has access to it:               /dev/disk/by-uuid/CEE0476DE0388DA9/ /mnt/USBexternal ntfs-3g defaults,auto,uid=51343,gid=50432,umask=077 0 0      From a remote location, this user has been successful at doing rsync backups to this external hard drive. However, the external drive doesn't stay mounted as reliably as an internal hard drive does. Every couple of days I'm having to login as root do this command:               mount -a      I would like to give this user the ability to mount this drive, but when the non-root user does mount -a, it tells them they do not have permission to do this:               nonrootuser@server:~$ mount -a     mount: only root can do that      When the non-root user tries to mount this drive specifically, it tells them it is already mounted (even though it isn't):               nonrootuser@server:~$ mount /mnt/USBexternal/     mount: according to mtab, /dev/sdb1 is already mounted on /mnt/USBexternal      As mentioned, the drive is not actually mounted, but (because of the output above) if the non-root user tries to unmount the drive, it says their request disagrees with fstab:               nonrootuser@server:~$ umount /mnt/USBexternal/     umount: /mnt/USBexternal/ mount disagrees with the fstab      How can I permit this user the ability to mount this drive, without giving them any other administrative powers?


Trying to create a cron to Rsync then tar the folder

I'm stuck at the first hurdle! I want to run a couple of commands from a bash script. First something like this to rsync some directories:               rsync -e ssh -az user-whatever@website.com:/home /location/of/local/folder      Then something like this to tar and copy the files somewhere else:               cd /location/of/local/folder     tar zcf /var/backups/home-`date +%Y%m%d`.tar.gz home      I hope this is making sense. The problem is that obviously I wish for the rsync to finish before the directory is tar'd. So is there a bit of code I can use to make sure that rsync has finished before running the `tar` command? e.g. (pseudo code)               rsync     while(is syncing){         sleep 10     }     tar      Or will my `.sh` script only run the next line after the first line has finished and exited? Thanks for your help.