How can I have 400% CPU occupied on 2 cores

I understand that `Σ(%CPU) ≤ logicalcores*(1+ε)` (where ε is measure and rounding error). But, how can I have on a 2 core system 2 different processes, each taking 200% of CPU (as measured by htop)? **EDIT** Cores in above equation means logical cores i.e. taking into account all hyperthreading, number of CPUs etc. **EDIT 2** Despite htop displays the number of processors I attach cpuinfo               processor   : 0     vendor_id   : GenuineIntel     cpu family  : 6     model       : 23     model name  : Intel(R) Core(TM)2 Duo CPU     T9600  @ 2.80GHz     stepping    : 10     cpu MHz     : 800.000     cache size  : 6144 KB     physical id : 0     siblings    : 2     core id     : 0     cpu cores   : 2     apicid      : 0     initial apicid  : 0     fpu     : yes     fpu_exception   : yes     cpuid level : 13     wp      : yes     flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm ida dts tpr_shadow vnmi flexpriority     bogomips    : 5585.20     clflush size    : 64     cache_alignment : 64     address sizes   : 36 bits physical, 48 bits virtual     power management:          processor   : 1     vendor_id   : GenuineIntel     cpu family  : 6     model       : 23     model name  : Intel(R) Core(TM)2 Duo CPU     T9600  @ 2.80GHz     stepping    : 10     cpu MHz     : 800.000     cache size  : 6144 KB     physical id : 0     siblings    : 2     core id     : 1     cpu cores   : 2     apicid      : 1     initial apicid  : 1     fpu     : yes     fpu_exception   : yes     cpuid level : 13     wp      : yes     flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm ida dts tpr_shadow vnmi flexpriority     bogomips    : 5586.38     clflush size    : 64     cache_alignment : 64     address sizes   : 36 bits physical, 48 bits virtual     power management:


Is it possible to save a KDE desktop configuration?

Is it possible to save a desktop configuration while using KDE Plasma Desktop? I mean, I have customized my desktop with a set of plasmoids, each with its own custom settings, and I'd like to save the state of the whole Desktop in order to restore it when I want to. For what I've seen, some of these plasmoids can have their preferences saved and restored, but each of these work on its own. I can't find any option from the Plasma GUI, it's just me or this is simply not possible? Anyway, even without the GUI, these setting should be saved somewhere in my system, I.E. to restore the Desktop to its current state whenever I boot up the system. Where can I find them?


Ctrl-C is ignored by pppd when put in a shell script

I'm trying to connect to GPRS network through a serial port connected GSM modem. When I call `/usr/sbin/pppd call <peer_name>` from the command line, it correctly receives and handles `Ctrl`+`C` from keyboard. But when I put the exact same command in an empty shell script (with or without the shebang `#!` at the top), `chmod +x` it and run it from the shell prompt, then `pppd` starts to run - But it totally ignores `Ctrl`+`C` key combination. `Ctrl`+`Z` works normally though. This is the contents of the `pppd` peer file               nodetach     dump     connect "connect_script"     disconnect "disconnect_script"     /dev/ttyS0     noauth      I tested another peer file which I had created to connect to a PPTP VPN server - with the same result. PPTP does not need a chat script, so I'm ruling out problems with `chat` command or serial port link properties. OS is debian 7. Any ideas what is happening here?


Dnsmasq white list for specific clients on network

I'd like to use dnsmasq to set up a white list for certain clients on my network. For instance, I'd like to have these rules for clients in the range 192.168.1.10 - 192.168.1.20:               no-resolv     server=/pbskids.org/192.168.0.1     server=/disney.go.com/192.168.0.1      This way, the only websites accessible from these clients are the ones that are whitelisted. Clients on the network outside of that range should be able to use whatever DNS server they want. How can I do this? **EDIT:** This is what I have in dnsmasq.conf so far:               bogus-priv     domain-needed     no-resolv          server=/pbskids.org/192.168.0.1     server=/disney.go.com/192.168.0.1      This has the intended result of denying upstream DNS lookups to all clients on the network. Now what I need is a way to allow certain clients to use upstream DNS instead. I don't think an option like this exists but maybe it will help get my idea across:               use-resolv --source 192.168.1.150      i.e., if the client's IP address is 192.168.1.150 then use upstream DNS servers. Alternatively, what I was originally looking for was something like this:               no-resolv --source 192.168.1.100      i.e., if the client's IP address is 192.168.1.100 then don't use upstream servers at all. I hope this helps clarify my question. If I can't do something like this, then maybe what I need is two separate networks.


Hard disk drive disappeared

Yesterday I performed a hard-reset while Linux was booting. This led to a hard issue with the HDD (UNC while recovering journal). I had to use `ddrescue` instead of `dd` because `dd` crashed on I/O error. I did the following:               # ddrescue -f /dev/zero /dev/sda      It went through the whole 250 GB of `/dev/sda`. After rebooting, both BIOS and LiveCD didn't see the HDD. When I launch a LiveCD, there is no `/dev/sda`, and no HDD in `/dev/disk/*`. SATA controller is fine:               $ lspci | grep -i sata     00:1f.2 SATA controller: Intel Corporation NM10/ICH7 Family SATA Controller [AHCI mode] (rev 02)      Question is: did I dg too deep? Is my HDD gone forever or is it fixable?


Where can I find the source code of Gnome-Shell 3.10 Status Indicator/Bar?

In Gnome Shell 3.10 indicators (sound, network,..) were merged in single status bar. I read that applications need to make gnome shell extensions to show an icon there. So I searched for default indicators in `gnome-shell- extensions`, but negative results. Where can I find the code of default indicators in Gnome source git repository? and In which package it has been built in Debian or Ubuntu repository? ![enter image description here](http://i.stack.imgur.com/KJfBd.png)


How can I find and/or print sudo's lecture file?

I'm using Ubuntu and I would like to find and/or print the sudo lecture that is printed to the screen the first time a user executes a sudo command. How can I do this? I'm unable to find the lecture file.


Set scroll speed and have a show desktop keyboard command on Mint 16

How can I change the scroll speed and have a show desktop keyboard command? I cannot figure out these two things. I have looked around, but cannot find any definitive or working advice. edit_ ** ___ __ ___ __ ___ __ ___ __ ___ __ ___ _** my props for my mouse:               me@me-mint ~/ $ xinput --list-props "USB Optical Mouse"     Device 'USB Optical Mouse':         Device Enabled (128):   1         Coordinate Transformation Matrix (130): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000         Device Accel Profile (265): 0         Device Accel Constant Deceleration (266):   1.000000         Device Accel Adaptive Deceleration (267):   1.000000         Device Accel Velocity Scaling (268):    10.000000         Device Product ID (247):    1121, 19812         Device Node (248):  "/dev/input/event5"         Evdev Axis Inversion (269): 0, 0         Evdev Axes Swap (271):  0         Axis Labels (272):  "Rel X" (138), "Rel Y" (139), "Rel Horiz Wheel" (264), "Rel Vert Wheel" (274)         Button Labels (273):    "Button Left" (131), "Button Middle" (132), "Button Right" (133), "Button Wheel Up" (134), "Button Wheel Down" (135), "Button Horiz Wheel Left" (136), "Button Horiz Wheel Right" (137)         Evdev Middle Button Emulation (252):    0         Evdev Middle Button Timeout (253):  50         Evdev Third Button Emulation (254): 0         Evdev Third Button Emulation Timeout (255): 1000         Evdev Third Button Emulation Button (256):  3         Evdev Third Button Emulation Threshold (257):   20         Evdev Wheel Emulation (258):    0         Evdev Wheel Emulation Axes (259):   0, 0, 4, 5         Evdev Wheel Emulation Inertia (260):    10         Evdev Wheel Emulation Timeout (261):    200         Evdev Wheel Emulation Button (262): 4         Evdev Drag Lock Buttons (263):  0


Delete every users from a group

I search **a clean way** to delete every users from the 'sudo' group. On several distributions the user created during the installation process has sudo rights, I don't want this. I search for an automated method working for (nearly) every situations. Basically, I want to empty a group. To remove every users : `GROUP=my_group; for u in $(getent group $GROUP | sed -e 's/^.*:.*:.*://' -e 's/,/ /g'); do echo gpasswd --delete $u $GROUP; done`   This command line works :   1. if the group doesn't exist   2. if the group is empty   3. if the group contains one user   4. if the group contains several users   So everything is okay. But is their something simplier ? Another way is to delete the group, and recreate it. Ugly ?


Running parallel bash jobs on a HPC cluster using GNU parallel

On an HPC cluster I am trying to run multiple bash scripts (`permute2.sh`) from 1 bash script using GNU parallel, however it doesn't complete every job. It randomly completes one job, while it is stuck doing the other. **permute1.sh:**               PROCS=144      permuations=1000     seq 1 $permuations | parallel -j $PROCS sh permute2.sh {}      **permute2.sh** (taking 100 random lines from a file and performs some actions on it for permutation)               id=$1     randomlines=100     awk 'BEGIN{srand();} {a[NR]=$0}     END{for(I=1;I<='$randomlines';I++){x=int(rand()*NR);print a[x];}}'     FILE.txt > results/randomlines.$id.txt          # do stuff with randomlines.$id.txt..       When I run `permute1.sh` I can see it creates 144 files, for each cpu 1 (randomlines.1.txt - randomlines.144.txt), but most of them are empty and stopped working, and some are completed. What am I doing wrong?


How I can get keycode and make multimedia keys usable?

I've an Asus N73S which have non-functional multimedia keys. I have "direct access" keys but also "indirect access" keys (via Fn + ...). The "Windows" key doesn't work either. These keys don't respond with xev or showkey and nothing appears in /var/log/messages How to make the buttons usable ? Another strange trick, only the two buttons for adjusting the brightness (Fn + F5 and Fn + F6) are functional. Where this thing is set? I'm on Fedora 15 (Lovelock).


Preventing ChromeOS from blanking the screen when working on a different tty

I am running Archlinux in a chroot alongside Chrome OS on a chromebook. The original project is there, my fork of it is here (mostly similar). The issue is that the display power management of Chrome OS only takes touchpad and keyboard input made in Chrome OS's X on tty1 into account to reset the screen blanking countdown. So, if I am working in my chroot, on tty3 (console) or on tty4 (Arch's own X server), the backlight turns off after 5 minutes, whether I am idle or active. I have to then come back to tty1 to register some input there and get powerd to reactivate the backlight. I don't want to deactivate powerd in Chrome OS, neither do I want to lengthen the default timeouts (which is what the original author or the chroot setup scripts did). I just want the screen backlight to turn off after a few minutes of inactivity, and to remain on when I am active in the chroot environment or in Chrome OS. Moreover, I want to minimally modify Chrome OS, as it's updated quite often and I want to keep the chroot reinstall script simple. So, my idea is that I will program a couple of daemons. Daemon A runs in the chroot and detects whether I make keyboard or mouse inputs in Arch. Daemon C runs in chrome OS, checks the output of daemon A and does whatever is most appropriate to reset the screen blanking and power saving counters. However, if user activity in the chroot can be figured out reading some /dev node, daemon A would not be necessary. **Can the age of the last user activity in the chroot (on /dev/tty3 and /dev/tty4) be somehow deduced from reading some /dev file, or by any other way from _without_ the chroot?** Secondly, commands such as `setterm -blank poke` seem to work from within the chroot, so daemon C may not be necessary if daemon A can alone reset the screen blanking countdown. Hence, the second question: **Can the age of last user activity in the chroot (on /dev/tty3 and /dev/tty4) be somehow deduced from reading some /dev file, or by any other way from _within_ the chroot?** If you think that resetting the counters requires daemon A and C to both exist and communicate: **How is modern IPC done in GNU/Linux in practice? System V? POSIX? /proc files read and write? What would best work in my case?** Finally, **do you know something else than`setterm -blank poke`, that the watchdog program should use to keep the backlight alive?** Sorry for the long question, I hope you didn't have to read it all :)


How to print from remote over SSH to local LAN printer?

OK, so it is fairly straight forward to to run apps from a remote server on my local X screen as though they were local apps. The question is, when trying to print, the remote app only sees printers on the remote side. Is it possible (surely it is) to port forward the local CUPS server to the remote session? If so, how? I have tried using the -L option and the printer (515) service, but to no avail.


Best way to use a shell with Cygwin in Windows 7

I installed Cygwin, to be disappointed that bash by default runs within "cmd.exe". I googled around and found Console2. It's not a particularly well- designed application, as doing adjustments is slightly painful, although most of the time it works well. I am still looking for a better way to survive in a Windows environment as even Console 2 occasionally crashes e.g. when trying to resize my terminal when editing in vim and there are plenty of other annoyances that I'm really not satisfied with. Any ideas? I tried using Cygwin via PuTTY and that was an equally bad user experience.


Delete a block of lines with a condition on the last line

I have a log-file where at the end of a series of lines you can see if this block is relevant. Now I'm looking for a command like sed to delete de blocks ending with "Content-Length: 0" and beginning with the last "--" before this line. I tried `sed -n "/--/,/Content-Length: 0/d"` but this takes the first "--" and the first "Content-Length: 0" and deletes it. ex :               line 1 "--"       line 2        line 3 "Content-Length: 20"       line 4 "--"       line 5       line 6 "Content-Length: 0"       i want to delete line 4,5 and 6 not line 1 to 6 how can i do this? The answer to work with `tac` instead of `cat` does the job! but ultimately i would like to use this in a `tail -f` construction


Whats the history behind the fork bomb?

I read other question about its work and other things that **Fork bombs** operate both by consuming CPU time in the process of forking, and by saturating the operating system's process table. A basic implementation of a fork bomb is an infinite loop that repeatedly launches the same process. but really i want to know whats the story of this command ? why this ? `:(){ :|:& };:` .


Linux process scheduling - Cap/Weight based?

I am just trying to understand the basics of Linux scheduler.   * Is Linux scheduler a Cap based or weight based scheduler? I was previously using Xen. Now I am moving from Xen to KVM. I read VMs are normal process and thus will follow the scheduling policies of the linux scheduler. I was previously using Xen's credit scheduler which had the capability to set cap/weight for vms. I am searching for equivalent capability and also basic understanding of the linux scheduler. I am using Centos 5.6 . Which still uses 2.6.18. I dont think CFS is present in the kernel I am using.


Restrict local website to selected users

Suppose I have two local websites under `/var/www/mysite1` and `/var/www/mysite2` via apache I can access them via `localhost/mysite1` and `localhost/mysite2`. The pages are for local use only and I have multiple users on my machine, say `user`, `user1` and `user2`. Is it possible, that `user` can view both sites, but `user1` only `mysite1` and `user2` only `mysite2`?


emacs: recognising the shebang line

How can I configure Emacs to recognise certain she-bang lines? it recognises the shebang line:               #!/usr/bin/env ruby      but not the shebang line of               #!/usr/bin/env ruby1.9      I figure there must be an alist somewhere with the list of scripting languages called by /usr/bin/env and the mode, but I can't find it.


What is the difference between these two SSHD configs?

# 1               Match Group GROUPNAME, User *,!root      # 2               Match Group GROUPNAME User !root      **My question:** What is the difference between #1 and #2 in the SSHD_CONFIG?


scp hardlocking my server (both ways)

I have this strange issue. `scp` is hard locking my server. I have tried `memcheck`, tried downloading big files using `wget`, tried `speed` test in `openssl` and everything works just fine, yet every time I try to copy something (from or to the machine) using `scp`, it hard locks the machine. Not even sysrq magic key combos work. What could be the cause of this? I have no idea where to look. Edit: I just managed to crash the system using nfs server.


How to remove duplicate lines inside a text file?

A huge (up to 2 GiB) text file of mine contains about 100 exact duplicates of every line in it (useless in my case, as the file is a CSV-like data table). What I need is to remove all the repetitions while (preferably, but this can be sacrificed for a significant performance boost) maintaining the original sequence order. In the result each line is to be unique. If there were 100 equal lines (usually the duplicates are spread across the file and won't be neighbours) there is to be only one of the kind left. I have written a program in Scala (consider it Java if you don't know about Scala) to implement this. But maybe there are faster C-written native tools able to do this faster?


How to "get" a HTTPS website running?

I have a website serving several pages that can be reachable via HTTP. How can I make these sites available via standard HTTPS? (not self-signed). What are the steps? (go to a CA, and then?) Can someone please describe the full process in steps?


What are the difficulties in importing features of Android, like Unity3D Player, to Linux in general?

We know that Android is an open source Linux-based distro. And we know some features developed for Android are required for the Linux community for many years, and are denied (like Unity3D Player). What are the difficulties in importing Android features to other Linux distributions, like Ubuntu, Fedora and others?


dhcpd on two network interface how to?

I have an embedded system that has Ethernet and wifi. I want to setit up in a way that it provides IP to both interfaces. The system uses BusyBox. and I an new in this area. can you provide a sample configuration that I can run to setup dhcpd for both of these interfaces? Should I run two instance of dhcpd to do this? The Linux is based on TI EZSDK ( for arm processors)


Running cron jobs under php ver. 5.4

My hosting company switched me to php version 5.4. I run a Drupal site (D7.) They say: _You'll want to make sure your crons use "/usr/php/54/usr/bin/php" instead, as otherwise it will use PHP 5.2._ How do I do that? Change the php.ini file? Create a new file? What is the exact syntax for it?


Does [[:space:]] work for sed patterns on all Linux distros?

Using `[[:space:]]` looks a little non-elegant and, quite frankly, Microsoft- ish for `sed` match patters. I was trying to extract "Last" out of "First Last" and either of the following worked:               echo "First Last" | sed s/First //     echo "First Last" | sed s/First\s//      What did work is               echo "First Last" | sed s/First[[:space:]]//      I was wondering:   1. Is there is a more minimalistic notation to match a whitespace in `sed`?    2. Does `[[:space:]]` work on all Linux distros?


Rolling back a file

I have a situation, a colleage of mine overwrote PHP files that I've made changes to , is it possible to roll back a file to a previous working version using the command line. No svn repositories are available and also not any backups.


How to merge two files with different number of rows in shell?

I have file1 like this:               CHR                     SNP     TEST   A1   A2                 GENO   O(HET)   E(HET)            P         0         AFFX-SNP-000541      ALL    0    0                0/0/0      nan      nan            1        0         AFFX-SNP-000541      AFF    0    0                0/0/0      nan      nan           NA        0         AFFX-SNP-000541    UNAFF    0    0                0/0/0      nan      nan           NA        0         AFFX-SNP-002255      ALL    0    0                0/0/0      nan      nan            1        0         AFFX-SNP-002255      AFF    0    0                0/0/0      nan      nan           NA        0         AFFX-SNP-002255    UNAFF    0    0                0/0/0      nan      nan           NA        1                 rs12103      ALL    C    T           55/250/317   0.4019   0.4113       0.5596        1                 rs12103      AFF    C    T                0/0/0      nan      nan           NA        1                 rs12103    UNAFF    C    T                0/0/0      nan      nan           NA        1         rs12103_1247494      ALL    C    T           55/250/321   0.3994   0.4097       0.5581        1         rs12103_1247494      AFF    C    T                0/0/0      nan      nan           NA        1         rs12103_1247494    UNAFF    C    T                0/0/0      nan      nan           NA      And file2 like:               CHR                     SNP   A1   A2          MAF  NCHROBS        0         AFFX-SNP-000541    0    0           NA        0        0         AFFX-SNP-002255    0    0           NA        0        1                 rs12103    C    T       0.2894     1244        1         rs12103_1247494    C    T       0.2875     1252      I would like to merge file2 with file1 based on the SNP name and the TEST==ALL and keep the CHR, SNP, P, and MAF in the output file3. Does anybody know the best way for that in terminal (Unix) shell? A desired output would be:                 CHR                     SNP  MAF        P        0         AFFX-SNP-000541   NA         1        0         AFFX-SNP-002255   NA         1        1                 rs12103   0.2894     0.5596        1         rs12103_1247494   0.2875     0.5581


Mailing out a customised content based on specific search in a logfile

Using below `test.sh`, I am getting result in `dump.txt` as below: **test.sh:**               #!/bin/bash          #"Maxl-script" zone starts.....     essmsh -l admin password -s localhost -i << EOF          spool on to 'dump.txt';     display session all;     spool off;          EOF     #"Maxl-script" zone ends.....      **dump.txt:**               user                session             login_time          application         database            db_connect_time     request             request_time        connection_source   connection_ip       request_state     +-------------------+-------------------+-------------------+-------------------+-------------------+-------------------+-------------------+-------------------+-------------------+-------------------+-------------------      admin                                 0                   9                                                           0 none                                  0 Not Requested*      a00:bf32::                          admin                         989855740                1335 DRRDEVMH            DRRPRODB                           1201 none                                  0 Not Requested       a00:8a45::                          admin                        1768947706                 932 test                test                                916 none                                  0 Not Requested       a00:94b6::                               WARNING - 1241024 - Possible string truncation in column 1.      WARNING - 1241028 - Output column defined with warnings.      WARNING - 1241024 - Possible string truncation in column 9.      WARNING - 1241028 - Output column defined with warnings.      WARNING - 1241024 - Possible string truncation in column 10.      WARNING - 1241028 - Output column defined with warnings.      OK/INFO - 1241044 - Records returned: [3].      As we can see in the last line of `dump.txt` there is a string `Records returned: [3]`. That digit 3 is my target, I want to send a email notification to users having following Lines as Email body:               Total Number of Sessions running = 3           NOTE: This is an automatically generated email, please don't reply to it.      After Googling, I have managed to get below method to get it done. Can anybody please help me out for how to use `sed` or any other method to meet my objective in above script?               $ var=Records returned :     echo "Total Number of Sessions running = $var | sed 's/.*://' " > file.tmp      echo -e "\n" >> file.tmp      echo "NOTE: This is an automatically generated email, please don't reply to it."  >>   file.tmp      fi          mailx -s "Subject" emailaddresses < file.tmp     rm file.tmp      **NOTE:** `Records Returned...` line will be always the last line in **dump.txt**.


Mount Google Drive in Linux?

Now that Google Drive is available, how do we mount it to a Linux filesystem? Similar solutions exist for Amazon S3 and Rackspace Cloud Files.


Is oops of kernel tainted by staging device less likely to be investigated?

I understand that kernels tainted by binary modules are less likely to be investigated by kernel maintainers. However what is the policy if kernel is tained by staging driver (if the staging driver is broken it is still problem in kernel hence some Linux developer might be interested). Does anyone knows the current policy (most resources I found simply states to "uninstall the binary ATI/NVidia drivers" - I guess it is the most popular way of tainting the kernel).


How to calculate values in a shell script?

I run this command in the terminal:               grep "bla bla blah" blah* | echo "Blah: $(wc -l) / $(ls | wc -l) * 100"      And I get this output:               Blah: 44 / 89 * 100      What I expect to see:               49.4      Is there a way to obtain the desired output using just the bash commands? I don't prefer scripts I am planning to pipe the output.


Faster alternative to ArchiveMount?

At the moment I am using `ArchiveMount` to mount a 123,000 kb archive that contains more then 3 million files inside. So far it has been mounting for 5+ hours and still isn't finished. Is there a better way to mount a `.tar.gz` file? I am trying to mount to a folder, and uncompressed it takes a few gigs. I don't even need write mode, just read-only is sufficient.


What is the most compatible Linux distribution for MacBook Pro?

Here's the minimal requirements:   1. two-fingers movement on touchpad for scroll   2. using the lower-powered GPU as default card   3. sleep on lid close   4. some key (control or command) + LMB for RMB Nice-to-have:   * "squeeze" gesture to zoom in   * working multimedia keys   * GPU switching on-the-fly If you know a distro that qualifies, can you also mention all extra features you know it supports.


Bash - test for newline?

In various places around the web I've found:               \015      \012     \x0a - hex     \n     \r      all as synonyms for various newlines / carriage returns... But in this small script I cannot recognise when I come across a newline - can someone tell me what I should be checking for in the if line ?               #!/bin/bash          test="this is a     test"          for a in "$test"; do                  if [[ "$a" == '\012' ]] ; then                     echo "FOUND NEWLINE"             fi          echo "$a"          done


string substitutions: all occurrences

A simple question, but I can't find the answer. the zsh documentation overwhelms me :-(               function z ()     {       echo ${1:s/the/THE}     }          $ z thethethe     THEthethe      ... How can I get _all_ 'the' to be replaced with 'THE', not just the first occurrence? With zsh it's the easiest things that seem to be the hardest to find examples for.


How can I access a remote Linux VM behind a firewall?

One of my customers runs a Linux VM on his PC and I need to access it remotely. This is a PC computer, not a server, so it is connected to the internet most of the time. It has a firewall too. I need to administer this Linux VM sometimes to install new software or access its database. What is the best way for me to get remote access? Note that this PC is on a normal at-home internet connection. Its IP address is not a server IP address, it's hidden behind the ISP provider. I am located at work in my office. If needed, I have a Linux PC server which has a fixed IP address at my disposal.


Which editor (or plugin) makes a version control workflow feel most first-class?

By "first class" I can just work by forking and merging my code willy-nilly, several times every minute, without ever thinking about the VCS.... I'm looking for an editor environment where the most common thing one does is fork!


How to reinstall grub to the EFI partition after initially installing it in Linux root. Do I have to start over?

My machine was running Mint 15 KDE 64-bit (GPT partitioning, EFI bootloader without 'secure boot'), and I wanted to try Mint 16 before committing to it. So I installed it into another partition and told it to put GRUB into `/dev/sda6` instead of `/dev/sda`. I then ran the Ubuntu boot-repair tool on my Mint 15 setup, which detected and added Mint 16 to 15's GRUB menu. So far, so good. I can boot 16 by selecting 15's GRUB from my EFI boot menu (I'm using rEFInd for that), and having that boot 16 for me. But now I want to make 16 directly bootable from rEFInd - so it won't rely on keeping 15 around. Is boot-repair still the tool for the job? Mint 16 seems to know how to handle EFI booting directly, so I would expect it to have its own tools for managing the boot process. There's a KDE GRUB2 bootloader tool, but that just seems to manage the grub menu entries in my partition. It does have an option on its 'Advanced' tab to 'Install/Recover Bootloader', but that tool just lists out my partitions - and doesn't show my EFI partition. I guess, because I didn't set up EFI booting at install time, I also don't have `/boot/efi` mounted. Any advice on how to proceed?


Microphone - static background noise suppression on Linux

My soundcard is Realtek ALC 892. On Windows 7 I use official Realtek drivers, on Linux I use PulseAudio (on Ubuntu 13.10). On both Windows and Linux, when I enable microphone boost +30db (required because my microphone is quiet), I get very annoying and loud background noise (I also confirmed the background noise with Audacity on both systems). However, Windows Realtek drivers have noise suppression option which works (after enabling it, Audacity shows no background noise and my ears also confirm that there is no background noise). ![Image showing noise suppression option](http://i.imgur.com/btvyDTM.png)      My question is how can I enable background noise suppression in ALSA/PulseAudio? Is there any module I can install or maybe there is a setting for it that can be enabled in config file? I can't find solution for it and this is the only thing that prevents me from switching to Linux completely - as I talk using microphone a lot and on Windows the Realtek software removes the background noise completely and PulseAudio doesn't remove it, which means the recorded voice on Linux is very bad. I know I could buy better soundcard and microphone, but as I said, Windows Realtek drivers remove the noise on software level in real time (ie no noise when talking on TeamSpeak3/Steam/whatever voip programme) so I hope that there is such option on Linux as well. This is also crossposted on Ask Ubuntu


Why do upgrades to KDM/KDE not preserve changes to configuration files?

The `kdebase-workspace` package on Arch Linux only preservers changes made to `/usr/share/config/kdm/kdmrc` when the package is updated. I need to edit `/usr/share/config/kdm/Xsetup` to get my monitors to rotate correctly, but the changes get lost every time `kdebase-workspace` gets updated. The Arch Wiki recommends copying `/usr/share/config/kdm/Xsession` to `/usr/share/config/kdm/Xsession.custom`. I could do this with `/usr/share/config/kdm/Xsetup`, but I thought files in `/usr/share/` are supposed to be managed by the package manager. It seems like this might be a bug in the package (i.e., should it be saving all the configuration files) or should I be making a change in `/usr/share/config/kdm/kdmrc` to tell it to look some place else and if so where?


How can I block select in Konsole?

In terminal emulators like GNOME terminal, I can hold the control key and use my mouse to select a block of text. Doing the same in Konsole has no effect -- the mouse simply selects one character after another, to the end of each line, wrapping around, as if I were using GNOME terminal and selecting text without holding the control key. How can I block select text in Konsole?


Two users, full access to same folder

I have a laptop running Arch Linux, and an owncloud-client. I have an owncloud server on my local network. When outside of my local network, I must use a dyn dns URL to get to my server. When on the local network, any queries to that same URL (Or just the IP address of the network as it appears on the WAN) are terminated (this is a network thing, not my computers). So. I want to have 2 owncloud clients. One for when I'm away, and one when I'm at home. But I want them to sync to the same folder. And I don't want them to require a breach of data security (aka opening my home folder to anybody) to do it. Can I? How?


How can memtest check all memory while it is still loaded?

Inspired by this question. If you're testing your memory, you have to test _all_ memory - you shouldn't trust any of it to be good. How can memtest effectively do this when memtest itself will consume memory while loaded?


Use mount options from /etc/fstab for autofs?

I am using `autofs` to automount some partitions that I had mounted based on fstab entries before.   I expected that I can apply the mount options defined in `/etc/fstab` to be used as options for the automount. It seems like the mount options are usually defined in a format that slightly differs from `/etc/fstab` in the files included from `/etc/auto.master`. Using the same set of options makes the configuration easier - but more importantly, it avoids lots of potential inconsistencies, which would surely arrise from two redundant definitions of options. Is there at least some partial integration of `autofs` with `fstab` available?


How to split long sed expression into multiple lines?

sed 's/[long1][long2]/[long3][long4]/' file.txt      I would like to split this command onto multiple lines - f.x. something like this:               sed 's/         [long1]         [long2]       /         [long3]         [long4]       /' file.txt      Using `\` or separating strings didn't work.


Error handling with tar and keep-old-files option

I am unpacking tar files with the option --keep-old-files so that I don't clobber files that are already there. The annoying thing is that this causes tar to produce an error code #2 (fatal error) when a file is already there. The reason it's important to me that this should not be considered an error is because my script logs when a file is successfully unpacked and then uses this log in order to not re-unpack that tar file. I could just ignore this error completely, not log, and trust that no files will be overwritten but there are two problems with this: it generates a lot of error messages, and there are many files, so it's inefficient for me to open tar once for every file. Is there any way I can use --keep-old-files, ignore the errors generated by existing files, and not ignore other errors?


Cross driver communication through sysfs or /dev/

I have two drivers I'm developing. One needs information from the other. Is there anything wrong with one driver reading from the sys attribute `/` or read/write through `/dev/drivername` of the driver it needs data from. If this is not appropriate (or impossible from whatever reason) what is the correct way to do this?


System Halt on REBOOT, Shutdown & Restarts as expected

Recently went from `Centos 6.4` to `Centos 6.5`. System is `Dell T410 Tower`. Whenever I reboot, system runs through post, passes IPv4 Settings, then announces: `PCIe Training Error: Slot 1` `system halted` When I `ctrl+alt+del` from here - I've received same error (pretty sure every time). **_Dell ESM Log shows: General failure after video._** When I hit power button, then power back on, system boots as expected. Slot 1 has a has the nic card the system is using. (After initial Centos 6.4 install, onboard Broadcom nics were giving me speed & latency issues, tried to resolve with drivers, but had no luck, so I added this other nic card (uses Realtek), which worked fine, no issues, until 6.5 update) I'm still somewhat of a linux noobie, I wouldn't have thought this would kernel related, because I didn't think kernel started loading till next screen. At this point, it seems like it must be the `kernel`. I'm running `2.6.32-431.5.1.el6.x86_64` now because I had same issue with `2.6.32-431.11.2.el6.x86_64` PLUS additional CIFS mount issues, which have gone away with downgrade.               uname -r     2.6.32-431.5.1.el6.x86_64          rpm -qa kernel      kernel-2.6.32-358.23.2.el6.x86_64      kernel-2.6.32-431.5.1.el6.x86_64      kernel-2.6.32-358.el6.x86_64      kernel-2.6.32-431.11.2.el6.x86_64      kernel-2.6.32-358.14.1.el6.x86_64      I was thinking about trying to go 1 further back to 6.4 kernel to see if reboot yields same result. I'm not sure what additional issues may arise trying to revert just the kernel to previous release (6.5 -> 6.4) & if there are other reasons I shouldn't. I think there may be an option in BIOS (somewhere) to continue after halt messages...but if I do that, and there is an error, seems like chances are nic won't work correctly. This server acts as a proxy server to the majority of our desktops on the network, so I only have limited timeframes I can power down and test theories. System seems to be running well now, and as long as I don't manually reboot, seems like we'll be ok in current state, but would like to know what the heck is going on. `dmesg` snippet:               udev: starting version 147     EDAC MC: Ver: 2.1.0 Feb 12 2014     bnx2: Broadcom NetXtreme II Gigabit Ethernet Driver bnx2 v2.2.3 (June 27, 2012)       alloc irq_desc for 36 on node -1       alloc kstat_irqs on node -1     bnx2 0000:01:00.0: PCI INT A -> GSI 36 (level, low) -> IRQ 36     bnx2 0000:01:00.0: setting latency timer to 64     bnx2 0000:01:00.0: firmware: requesting bnx2/bnx2-mips-09-6.2.1b.fw     bnx2 0000:01:00.0: firmware: requesting bnx2/bnx2-rv2p-09-6.0.17.fw     bnx2 0000:01:00.0: eth0: Broadcom NetXtreme II BCM5716 1000Base-T (C0) PCI Express found at mem da000000, IRQ 36, node addr a4:ba:db:12:39:24       alloc irq_desc for 48 on node -1       alloc kstat_irqs on node -1     bnx2 0000:01:00.1: PCI INT B -> GSI 48 (level, low) -> IRQ 48     bnx2 0000:01:00.1: setting latency timer to 64     bnx2 0000:01:00.1: firmware: requesting bnx2/bnx2-mips-09-6.2.1b.fw     bnx2 0000:01:00.1: firmware: requesting bnx2/bnx2-rv2p-09-6.0.17.fw     bnx2 0000:01:00.1: eth1: Broadcom NetXtreme II BCM5716 1000Base-T (C0) PCI Express found at mem dc000000, IRQ 48, node addr a4:ba:db:12:39:25     r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded       alloc irq_desc for 41 on node -1       alloc kstat_irqs on node -1     r8169 0000:02:00.0: PCI INT A -> GSI 41 (level, low) -> IRQ 41     r8169 0000:02:00.0: setting latency timer to 64       alloc irq_desc for 62 on node -1       alloc kstat_irqs on node -1     r8169 0000:02:00.0: irq 62 for MSI/MSI-X     r8169 0000:02:00.0: eth2: RTL8168c/8111c at 0xffffc90000c76000, 00:e0:4d:1a:12:76, XID 1c2000c0 IRQ 62     r8169 0000:02:00.0: eth2: jumbo features [frames: 6128 bytes, tx checksumming: ko]     ACPI Error: No handler for Region [IPMI] (ffff8801ad4ec420) [IPMI] (20090903/evregion-319)     ACPI Error: Region IPMI(7) has no handler (20090903/exfldio-295)     ACPI Error (psparse-0537): Method parse/execution failed [\_SB_.PMI0._GHL] (Node ffff8801ad4eb4c0), AE_NOT_EXIST     ACPI Error (psparse-0537): Method parse/execution failed [\_SB_.PMI0._PMC] (Node ffff8801ad4eb560), AE_NOT_EXIST     ACPI Exception: AE_NOT_EXIST, Evaluating _PMC (20090903/power_meter-759)


Append columns in a text file to after the final row

A smaller version of many data files I have looks like this:               0 0 0     0.05 9.6877884e-06 0.0024898597     0.1 4.2838688e-05 0.0049595502     0.15 0.00016929444 0.0074092494     0.2 0.00036426881 0.009839138     0.25 0.00055234582 0.012249394     0.3 0.00077448576 0.014640196     0.35 0.00082546537 0.017011717     0.4 0.0012371619 0.019364133     0.45 0.0013286382 0.02169761      I would like to end up with something like the following where the first column is repeated and the entries for the 2nd column comprise columns 2 & above from my original file.               0 0     0.05 9.6877884e-06     0.1 4.2838688e-05     0.15 0.00016929444     0.2 0.00036426881     0.25 0.00055234582     0.3 0.00077448576     0.35 0.00082546537     0.4 0.0012371619     0.45 0.0013286382     0 0     0.05 0.0024898597     0.1 0.0049595502     0.15 0.0074092494     0.2 0.009839138     0.25 0.012249394     0.3 0.014640196     0.35 0.017011717     0.4 0.019364133     0.45 0.021697611      I can generate it using `awk '{print $1 " " $2}' data > tmp` followed by `awk '{print $1 " " $3}' data >> tmp` but this becomes very tedious for the number of columns I have. Is there a smarter way of achieving what I need? **EDIT** I would like a solution for an arbitrary number of columns, n. The correct order of columns to rows is essential for my needs. Thus column 3 of input should be "moved" to underneath column 2 of input, column 4 underneath 2 and 3 etc. with column 1 being stacked underneath repeatedly. The first column should be in ascending numerical order for however many rows each column has i.e. 0, 0.05, ..., 0.45, 0, 0.05,..., 0.45, 0,0.05,...,0.45,etc.


tr complains of “Illegal byte sequence”

I'm brand new to UNIX and I am using Kirk McElhearn's "The Mac OS X Command Line" to teach myself some commands. I am attempting to use `tr` and `grep` so that I can search for text strings in a regular MS-Office Word Document.               $ tr '\r' '\n' < target-file | grep search-string      But all it returns is:               Illegal byte sequence.                    robomechanoid:Position-Paper-Final-Draft robertjralph$ tr '\r' '\n' < Position-Paper-Final-Version.docx | grep DeCSS     tr: Illegal byte sequence     robomechanoid:Position-Paper-Final-Draft robertjralph$       I've actually run the same line on a script that I created in `vi` and it does the search correctly.


How do I resize a disk image device?

I'm trying to reduce the size of a backup drive image. Original disk had these partitions:               Model: ST916082 1A (scsi)     Disk /dev/sde: 160GB     Sector size (logical/physical): 512B/512B     Partition Table: msdos          Number  Start   End     Size    Type      File system  Flags      1      32.3kB  65.7GB  65.7GB  primary   ntfs         boot      2      65.7GB  160GB   94.4GB  extended               lba      5      65.7GB  160GB   94.4GB  logical   ntfs      Image was created from the logical partition using the command               > sudo ddrescue /dev/sde5 datapartition logfile          Press Ctrl-C to interrupt     Initial status (read from logfile)     rescued:         0 B,  errsize:       0 B,  errors:       0     Current status     rescued:    94368 MB,  errsize:       0 B,  current rate:   23068 kB/s        ipos:    94368 MB,   errors:       0,    average rate:   28839 kB/s        opos:    94368 MB,     time from last successful read:       0 s     Finished      `ntfsresize -i -f datapartition` says:               ntfsresize v2012.1.15AR.5 (libntfs-3g)     Device name        : datapartition     NTFS volume version: 3.1     Cluster size       : 4096 bytes     Current volume size: 26999992832 bytes (27000 MB)     Current device size: 94368605184 bytes (94369 MB)     Checking filesystem consistency ...     100.00 percent completed     Accounting clusters ...     Space in use       : 26107 MB (96.7%)     Collecting resizing constraints ...     You might resize at 26106810368 bytes or 26107 MB (freeing 893 MB).     Please make a test run using both the -n and -s options before real resizing!      So it looks like I already resized the filesystem to fit the data, but did not resize the device? (This was 2 years ago, I forget.) And I need to resize the device using fdisk, right? But fdisk doesn't recognize the partition:               > fdisk -lu datapartition           Disk datapartition: 94.4 GB, 94368605184 bytes     255 heads, 63 sectors/track, 11472 cylinders, total 184313682 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x69205244          This doesn't look like a partition table     Probably you selected the wrong device.                  Device Boot      Start         End      Blocks   Id  System     datapartition1   ?   218129509  1920119918   850995205   72  Unknown     datapartition2   ?   729050177  1273024900   271987362   74  Unknown     datapartition3   ?   168653938   168653938           0   65  Novell Netware 386     datapartition4      2692939776  2692991410       25817+   0  Empty          Partition table entries are not in disk order      nor does cfdisk:               > cfdisk datapartition           FATAL ERROR: Bad primary partition 1: Partition begins after end-of-disk                           Press any key to exit cfdisk      I can mount the partition and copy files off of it, though. How do I resize the device?


Can entropy consumption at program start be prevented?

I use Knoppix (or other Live CDs/DVDs) as a secure environment for creating valuable crypto keys. Unfortunately entropy is a limited resource in such environments. I just noticed that each program start consumes quite some entropy. This seems to be due to some stack protection feature that needs address randomization. Nice feature but completely useless and - worse - destructive in my scenario. Is there any possibility to disable this feature? I would prefer one that allows me to continue using the original Knoppix (or whatever) image and just need some configuration at runtime. I read that this was caused by glibc. I am surprised that an `strace -p $PID -f -e trace=open` against bash does not show any accesses to /dev/random when I start programs. But I am not familiar with the interaction of execve() and the linker.


How to mount samba rw because everything fails

I'm trying to mount windows share on my laptop and everything mounts ok but somehow I get permission denied when I try to create new file inside mounted folder. I tried `noperm`, `uid`, `gid`, `noacl` etc. and nothing seems to work. Everyone who use windows mounts share with same credentials have full r/w access. Here is how I mount:               piotrek@piotrek-Vostro-2520:~/tmp$ sudo mount -v -t cifs -o username=***,password=***,uid=1000,gid=1000,rw,noperm,noacl,file_mode=0777,dir_mode=0777 //10.36.253.222/dysk\ f/ samba/          mount.cifs kernel mount options: ip=10.36.253.222,unc=\\10.36.253.222\dysk f,noperm,noacl,file_mode=0777,dir_mode=0777,uid=1000,gid=1000,user=***,pass=********     piotrek@piotrek-Vostro-2520:~/tmp$ cd samba/     piotrek@piotrek-Vostro-2520:~/tmp/samba$ ls -la     total 4     drwxrwxrwx 2 piotrek piotrek    0 mar 27 13:19 .     drwxrwxr-x 3 piotrek piotrek 4096 kwi  9 12:41 ..     drwxrwxrwx 0 piotrek piotrek    0 mar 18 11:50 AS-SET     drwxrwxrwx 0 piotrek piotrek    0 mar 27 13:29 EDUKACJA     drwxrwxrwx 0 piotrek piotrek    0 mar 18 11:52 RECYCLER     drwxrwxrwx 0 piotrek piotrek    0 cze  5  2012 System Volume Information     piotrek@piotrek-Vostro-2520:~/tmp/samba$ touch abc     touch: cannot touch `abc': Permission denied      What am I doing wrong? I'm using Ubuntu 12.10. **//EDIT** I've tried options that were suggested in comments but still no luck:               piotrek@piotrek-Vostro-2520:~/tmp$ sudo mount -v -t cifs -o username=***,password=***,uid=1000,gid=1000,rw,noperm,noacl,file_mode=0777,dir_mode=0777,sec=ntlm //10.36.253.222/dysk\ f/ samba/                                                                              [sudo] password for piotrek:                                                                                Sorry, try again.                                                                                [sudo] password for piotrek:                                                                                Sorry, try again.                                                                                [sudo] password for piotrek:                                                                                mount.cifs kernel mount options: ip=10.36.253.222,unc=\\10.36.253.222\dysk f,noperm,noacl,file_mode=0777,dir_mode=0777,sec=ntlm,uid=1000,gid=1000,user=***,pass=********                                                                                piotrek@piotrek-Vostro-2520:~/tmp$ touch samba/dddd     touch: cannot touch `samba/dddd': Permission denied                                                                                piotrek@piotrek-Vostro-2520:~/tmp$ sudo umount samba/     piotrek@piotrek-Vostro-2520:~/tmp$ sudo mount -v -t cifs -o username=***,password=***,uid=1000,gid=1000,rw,noperm,noacl,file_mode=0777,dir_mode=0777,sec=ntlmi //10.36.253.222/dysk\ f/ samba/     mount.cifs kernel mount options: ip=10.36.253.222,unc=\\10.36.253.222\dysk f,noperm,noacl,file_mode=0777,dir_mode=0777,sec=ntlmi,uid=1000,gid=1000,user=***,pass=********     mount error(95): Operation not supported     Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)     piotrek@piotrek-Vostro-2520:~/tmp$ sudo mount -v -t cifs -o username=***,password=***,uid=1000,gid=1000,rw,noperm,noacl,file_mode=0777,dir_mode=0777,sec=ntlmv2 //10.36.253.222/dysk\ f/ samba/     mount.cifs kernel mount options: ip=10.36.253.222,unc=\\10.36.253.222\dysk f,noperm,noacl,file_mode=0777,dir_mode=0777,sec=ntlmv2,uid=1000,gid=1000,user=***,pass=********     piotrek@piotrek-Vostro-2520:~/tmp$ touch samba/dddd     touch: cannot touch `samba/dddd': Permission denied     piotrek@piotrek-Vostro-2520:~/tmp$ sudo umount samba/     piotrek@piotrek-Vostro-2520:~/tmp$ sudo mount -v -t cifs -o username=***,password=***,uid=1000,gid=1000,rw,noperm,noacl,file_mode=0777,dir_mode=0777,sec=ntlmv2i //10.36.253.222/dysk\ f/ samba/     mount.cifs kernel mount options: ip=10.36.253.222,unc=\\10.36.253.222\dysk f,noperm,noacl,file_mode=0777,dir_mode=0777,sec=ntlmv2i,uid=1000,gid=1000,user=***,pass=********     mount error(95): Operation not supported     Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)     piotrek@piotrek-Vostro-2520:~/tmp$ sudo mount -v -t cifs -o username=***,password=***,uid=1000,gid=1000,rw,noperm,noacl,file_mode=0777,dir_mode=0777,sec=ntlmssp //10.36.253.222/dysk\ f/ samba/     mount.cifs kernel mount options: ip=10.36.253.222,unc=\\10.36.253.222\dysk f,noperm,noacl,file_mode=0777,dir_mode=0777,sec=ntlmssp,uid=1000,gid=1000,user=***,pass=********     piotrek@piotrek-Vostro-2520:~/tmp$ touch samba/dddd     touch: cannot touch `samba/dddd': Permission denied     piotrek@piotrek-Vostro-2520:~/tmp$ sudo umount samba/     piotrek@piotrek-Vostro-2520:~/tmp$ sudo mount -v -t cifs -o username=***,password=***,uid=1000,gid=1000,rw,noperm,noacl,file_mode=0777,dir_mode=0777,sec=ntlmsspi //10.36.253.222/dysk\ f/ samba/     mount.cifs kernel mount options: ip=10.36.253.222,unc=\\10.36.253.222\dysk f,noperm,noacl,file_mode=0777,dir_mode=0777,sec=ntlmsspi,uid=1000,gid=1000,user=***,pass=********     mount error(95): Operation not supported     Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)     piotrek@piotrek-Vostro-2520:~/tmp$      **//EDIT 2** Don't know why but today it suddenly started working with my first mounting command. Probably server restart was required to make it working but you can never be sure with windows...


While setting up SFTP between *nix servers, is the intial handshake optional?

I setup SFTP between *nix servers as follows:   1. Generate the Public key on the sending server by running the below command: `[user1@server1] $ /usr/local/bin/ssh-keygen -t rsa -b 1024`   2. Then copy "id_dsa.pub" file into the `/home/remote_user1/.ssh/authorized_keys` file on the remote machine server2.    3. Connect to server2: `$ sftp remote_user1@server2` I am then prompted to enter the password once to complete the handshake and then for all following SFTP connections it directly connects.. But recently another team was able to directly connect to our server without the initial handshake, generally I need to provide the remote_user1's password for handshaking.. So what configuration changes (if any) may have allowed for the handshake to be done without the password..? Any links that could help me better understand the SFTP handshaking process would be very helpful too, as I couldn't find much on this subject.


Setting up traffic router (proxy ?) for production

I am running a production server and my web application is running at port 8099. so if front end wants to access any backend endpoint, they make a call to this url:               http://production.server.com:8099/mainserver/some/get?xxxxxxx      I need to setup production.server.com:8099 to something like api.production- server.com, which will point to production.server.com:8099. What's the best approach to this? This is for ubuntu platform.


How long should I wait between keystrokes when doing SysRq + REISUB?

I read this from here: > The most useful combination is the `Alt`+`SysRq/Prnt Scrn` + R-E-I-S-U-B. > > The above basically means that while you press and hold `Alt`+`SysRq/Prnt > Scrn` and press R, E, I, S, U, B giving sufficient time between each of > these keys to ensure they perform the required job. My question is: How long should I wait to ensure "sufficient time" between each of these keys?


How to use nVIDIA drivers on Ubuntu 12.04?

I am using Ubuntu 12.04 x64 on my ASUS G75-VW with nVIDIA GTX670M. I have installed nvidia drivers via terminal and additional drivers, terminal says nothing to upgrade, additional drivers shows that current version of drivers are activated. But, while checking system properties I see that in front of video adapter shows "NO". What to do?


Reinstall XOrg with Yum - Fedora 18

Some how I messed up Xorg and need to reinstall it, with Yum. I can not find any Xorg packages, but it has to be out there right?


Open-source computer algebra systems for linux

Some years ago I used MuPAD as a free computer algebra system. However since 2005 it's not free anymore. So, are there any good free or even better open- source computer algebra systems for linux coming close to commercial products like mathematica or maple?


Option "user" work for mount, not for umount

I am experimenting mounting options for a program I am writing. I am running Linux Mageia 2. I added the following line to `/etc/fstab`               /dev/sr0 /mem  auto user,noauto, 0 0      and I removed all other entries regarding `/dev/sr0` which is the device for my DVD drive. Then, acting as normal user, I can successfully               $ mount /dev/sr0      but I then get an error message ("Only root can ...") for               $ umount /dev/sr0      Of course, the device is not busy : I do nothing between mount and umount. **Added after solving** : _If you are interested only in solving that problem, you can skip the rest of the question, and go directly to the accepted answer. The rest of the question is about my work to find a solution or better document the problem. However, there is a_ post-mortem _section at the very end of the question that complements the answer with my own remarks._ Ownership of files :               $ ls -ld /mem /dev/sr0     brw-rw----+  1 root cdrom 11, 0 mai   14 01:01 /dev/sr0     drwxr-xr-x  12 root root   4096 janv. 21 22:34 /mem/      And I am a member of the group "cdrom" I have the very same problem when mounting a file system image with a loop device. However, everything works fine when I replace "user" with the option "users", which seems to indicate that the system is confused when remembering who mounted the file system. The first reply by Rahul Patil does not bring further insight since it is essentially equivalent to what I used, if my understanding of the umounting procedure is correct. However it lead me to think further about this process (hence one upvote) and to get more details. This was even more supported by the comment of Hauke Laging. As I understand it, summarily, the umount command takes its argument (a device or a mount point) and tries to identify applicable entries in `/etc/mtab` and then checks with `/etc/fstab` whether it can execute the request. According to the man page for mount(8), _the name of the mounting user_ [should be] _written to mtab so that he can unmount the filesystem again._ When I check `/etc/mtab` after mounting, there is no such information written that I can find. I do not know how it is supposed to be stored and what it should look like. Hence the probleme is really with `mount` rather than with `umount`. To be absolutely sure that the problem is not that another `/etc/fstab` entry is used for mounting (which would explain ignorance of the "user"option), I deleted all other entries in `/etc/fstab`, keeping only the single line at the beginning of my question. Then I repeated the mount-umount sequence, unfortunately with the same result.               $ grep sr0 /etc/mtab     /dev/sr0 /mem udf ro,nosuid,nodev,noexec,relatime,utf8 0 0          $ mount | grep sr0     /dev/sr0 on /mem type udf (ro,nosuid,nodev,noexec,relatime,utf8)      Hauke Laging asked for `ls -l /etc/mtab`, which I thought was an error and that he was really asking for `cat /etc/mtab`. But I did it anyway ...               $ ls -l /etc/mtab     lrwxrwxrwx 1 root root 12 juin  25  2012 /etc/mtab -> /proc/mounts     $ ls -l /proc/mounts     lrwxrwxrwx 1 root root 11 mai   19 13:21 /proc/mounts -> self/mounts     $ ls -l /proc/self/mounts     -r--r--r-- 1 myself mygroup 0 mai   19 13:22 /proc/self/mounts      This last information surprised me. Though I am essentially the only user on that computer, I see no reason why this file should belong to me, or to any other user than root itself. Many thanks Hauke, but why did you ask that question ? Actually the file does not belong to me. I guess it must be a virtual file. I repeated the request as user "friend", and then as "root":               $ ls -l /proc/self/mounts     -r--r--r-- 1 friend users 0 mai   19 14:10 /proc/self/mounts          # ls -l /proc/self/mounts     -r--r--r-- 1 root root 0 mai   19 14:10 /proc/self/mounts      I would welcome any suggestion as to what the problem might be, or for experiments to attempt. Thanks **Post-mortem** : here are some final remarks after the problem was solved by Hauke Laging. I followed on the web the lead of Hauke's explanation. Apparently this is an old issue. It is explained in an old document from october 2000, mentionning some problems with other options, but not `user`. Hopefully some of the kernel reliability issues are now corrected. The issue is briefly mentionned in the bug section of the `mount` man page but not in enough detail, especially regarding alternative setups and effect on options. However, lost in that very long man page is the following information:               When the proc filesystem is mounted (say at /proc), the files     /etc/mtab and /proc/mounts have very similar contents. **The     former has somewhat more information, such as the mount options     used**, but is not necessarily up-to-date (cf. the -n option     below). It is possible to replace /etc/mtab by a symbolic link to     /proc/mounts, and especially when you have very large numbers of     mounts things will be much faster with that symlink, but **some     information is lost that way, and in particular using the "user"     option will fail**.      It would certainly have been useful to have a hint about this where the option `user` is described, which is the first place I looked.


How to mount multiple partitions

Is there a way to mount multiple partitions, or even all partitions, of a disk with a single command in Linux? Is there, perhaps, an option that the `mount` command accepts that would facilitate this? I'm running Fedora 18; if I try `mount /dev/sda* /media/sda*` the operation fails. Alternatively, can you suggest a script that I could put together for all my future uses? I've come across some potentially useful posts that mention writing udev- rules; I'm not sure if that would be useful, though, since (as far as I know) the partitions on my main HDD already have those set up - which is evident by looking at the sidebar-list of accessible drives/partitions within my file manager. To clarify, I'm simply trying to do something like '/dev/{sda1,sda2,...}', where each one of those would be mounted to their own directory with the same name.


What does longterm mean on kernel.org?

It's fairly easy to understand EOL, mainline and stable kernel, but I'm not sure about `longterm` here, ![enter image description here](http://i.stack.imgur.com/BjWAh.png) What does it mean, or how does it differ from stable kernel?


Total amount of memory usage by a single process

I want to get a full added amount of memory usage for a particular process. Foe example, say I want to have the total amount of memory taken by **httpd**. So if I do a tail command as `tail -M`, I get:                 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                10036 mysql     20   0  417m  76m 3820 S  0.3 15.5   0:13.55 mysqld                                                                                10453 apache    20   0  229m  67m  42m S  0.0 13.7   0:10.81 httpd                                                                                10447 apache    20   0  230m  64m  38m S  0.0 13.0   0:11.54 httpd                                                                                10479 apache    20   0  226m  64m  42m S  0.0 13.0   0:09.75 httpd                                                                                10478 apache    20   0  230m  63m  38m S  0.0 12.9   0:11.02 httpd                                                                                10451 apache    20   0  230m  63m  37m S  0.0 12.8   0:10.37 httpd                                                                                9599 apache    20   0  227m  61m  38m S  0.0 12.4   0:10.80 httpd                                                                                10454 apache    20   0  226m  60m  38m S  0.0 12.2   0:09.56 httpd                                                                                10476 apache    20   0  225m  58m  38m S  0.0 11.9   0:09.87 httpd                                                                                10332 apache    20   0  228m  50m  24m S  0.0 10.2   0:13.73 httpd                                                                                10445 apache    20   0  220m  42m  24m S  0.0  8.5   0:10.17 httpd                                                                                637 root      10 -10 32816  25m 1712 S  0.0  5.2   0:00.01 iscsiuio                                                                                652 root      10 -10  5128 2972 1876 S  0.0  0.6   0:05.86 iscsid                                                                                9592 root      20   0  207m 2872  900 S  0.0  0.6   0:00.39 httpd                                                                                10196 nobody    20   0  136m 2408  500 S  0.0  0.5   0:00.79 memcached                    In this case I want to have the "VIRT", "RES", "SHR", "%CUP", & "%MEM" totally as added for each rows of the output. Is there anyway I can do that?


Array in unix Bourne Shell

I am trying to implement array in Bourne shell (/bin/sh). I found that way to initialize array elements is:               arr=(1 2 3)      But it is encountering an error:               syntax error at line 8: `arr=' unexpected      Now the post where I found this syntax says it is for bash shell, but I could not find any separate syntax for Bourne shell. Does the syntax stands the same for `/bin/sh` as well?


GLX extension not working properly with xvfb

I have an Ubuntu 14.04 system with the following packages installed:               libegl1-mesa:amd64     libegl1-mesa-drivers:amd64     libgl1-mesa-dri:amd64     libgl1-mesa-dri:i386     libgl1-mesa-glx:amd64     libgl1-mesa-glx:i386     libglapi-mesa:amd64     libglapi-mesa:i386     libgles2-mesa:amd64     libglu1-mesa:amd64     libopenvg1-mesa:amd64     libwayland-egl1-mesa:amd64     mesa-utils     xvfb      I want to start an application under xvfb. I first start xvfb with:               $ Xvfb :1 -screen 0 1024x768x24 +extension GLX +render -noreset >> xsession.log 2>&1 &      and then check the xvfb log file:               Initializing built-in extension Generic Event Extension     Initializing built-in extension SHAPE     Initializing built-in extension MIT-SHM     Initializing built-in extension XInputExtension     Initializing built-in extension XTEST     Initializing built-in extension BIG-REQUESTS     Initializing built-in extension SYNC     Initializing built-in extension XKEYBOARD     Initializing built-in extension XC-MISC     Initializing built-in extension SECURITY     Initializing built-in extension XINERAMA     Initializing built-in extension XFIXES     Initializing built-in extension RENDER     Initializing built-in extension RANDR     Initializing built-in extension COMPOSITE     Initializing built-in extension DAMAGE     Initializing built-in extension MIT-SCREEN-SAVER     Initializing built-in extension DOUBLE-BUFFER     Initializing built-in extension RECORD     Initializing built-in extension DPMS     Initializing built-in extension Present     Initializing built-in extension DRI3     Initializing built-in extension X-Resource     Initializing built-in extension XVideo     Initializing built-in extension XVideo-MotionCompensation     Initializing built-in extension SELinux     Initializing built-in extension GLX      which shows no errors. Also, it seems that GLX has been loaded properly. Now, if I check the server with               $ glxinfo -display :1      I get               name of display: :1     Xlib:  extension "GLX" missing on display ":1".     ...     Error: couldn't find RGB GLX visual or fbconfig     Xlib:  extension "GLX" missing on display ":1".     ...     Error: couldn't find RGB GLX visual or fbconfig          Xlib:  extension "GLX" missing on display ":1".     ...      In fact, the application that I want to start on this server and that needs GLX won't start. After checking several documentation pages and forums, I have no clue as to what is going wrong here. Why does the X server log file not show any errors if the GLX extension was not loaded correctly? Is there something I should check?


How to create an environment for libraries and binaries?

I have a tool that cannot be run under my Desktop Linux. So I'd like to make a folder that contains all its requirements, and run it in the folder. Virtual machine or container is not a solution here for some reason. I've bootstrapped an Ubuntu Trusty in `/data/LTS`, and have everything the tool needs installed by running a chroot jail in `/data/LTS`. Now I issue:               PATH=/data/LTS/usr/local/sbin:/data/LTS/usr/local/bin:/data/LTS/usr/sbin:/data/LTS/usr/bin:/data/LTS/sbin:/data/LTS/bin \     LD_LIBRARY_PATH=/data/LTS/usr/local/lib:/data/LTS/usr/lib/x86_64-linux-gnu:/data/LTS/usr/lib:/data/LTS/lib/x86_64-linux-gnu:/data/LTS/lib \     PYTHONHOME=/data/LTS/usr \     /data/LTS/usr/bin/python /tmp/test.py      I get: > Inconsistency detected by ld.so: dl-close.c: 759: _dl_close: Assertion > `map->l_init_called' failed! What should I do?


tail -f but suck in content of the file first (aka `cat -f`)

I need to display whole file before tracking it for a new changes, not only the last 10 lines (yep, I know it's not _tail_ conceptually). In other words, something like `cat -f` would do, if it would ever existed. Tail's man doesn't give me any ideas. The only option I see right now is to somehow combine _cat all but last 10 lines_ and _tail -f_ output. Any hints, please?


screenrc: find out the keys bound by bindkey

The bindkey keyword in .screenrc is preceded by some cryptic keys that correspond to some keybouard binding. How can I figure out what these are? Google and GNU Screen Documentation did not show the results I was looking for.   For example, how would you found the bindings below without someone specifically telling you what the binding is?   `bindkey "^[[1;5I" next`   `bindkey "^[[1;6I" prev`


Installing qemu-img on ubuntu 11.04

I am developing a linux kernel and I am trying to to debug it in QEMU. I want to be able to run it in QEMU but it stops because I do not have a virtual hard drive to boot it(using the -hda command). I read in another question that a virtual hard drive could be created with qemu-img but I could not download it by doing `sudo apt-get install qemu-img` or `sudo apt-get qemu-img` I also read that qemu-img could be accessed from qemu-utils but i was unable to download that also. How can I download qemu-img on my ubuntu laptop?


How to use a variable instead of a file to output this wc command

I want to read a file from a given offset until the end of that file. I need to retrieve the number of bytes that were read during the process and also to redirect the output of the file elsewhere. Here is my script:               ...some stuff here...     dd if=$file bs=1 skip=$skippedBytes | tee >(wc --bytes > $file.count) >(cat - >> $file.output) | $($exportCommandString $file)     byteCount=$(cat $file.count)     rm $file.count     echo "Number of read bytes: $byteCount"      I would like the "wc --bytes" part to put its returned value inside a variable so I can use it after, without using a file ($file.count). Something like:               dd if=$file bs=1 skip=$skippedBytes | tee >(byteCount=$(wc --bytes)) >(cat - >> $file.output) | $($exportCommandString $file)     echo "Number of read bytes: $byteCount"      Except that doing this, my script hangs and does not work. Is it possible to do this and how ?


disable YUM mirrorlist checking

I have a machine which is not connected to the internet. I still want to execute some `yum` commands from time to time. YUM does like to update the mirrorlist every so often, resulting in errors like: > Could not retrieve mirrorlist > http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was' from > yum-dump.py! Please check your yum configuration. Is there a parameter in `yum.conf` or elsewhere to make yum stop updating the mirrorlist?


Why ``gvfsd-metadata`` process is hogging 100% of a single core for a long time

Today `gvfsd-metadata` process was running for a whole day hogging 100% of a single core of my CPU. Is there any reason for it to do it?


How do I stop emacs from colouring the text of the file I am editing? I want everything just in plain white. I know that I can load themes, but it's not obvious which theme does what. Can I just disable all the colouring so that when I start emacs up, all the text is always white?


Print the string between two parentheses

I have file with these lines               G8 = P(G1,G3)     G9 = P(G3,G4)     G12 = P(G2,G9)     G15 = P(G9,G5)     G16 = P(G8,G12)     G17 = P(G12,G15)      I need the output as               G1,G3     G3,G4     .....      How can I do it with sed/grep command or using perl?


After fork(), where does the child begin its execution?

I'm trying to learn UNIX programming and came across a question regarding fork(). I understand that fork() creates an identical process of the currently running process, but where does it start? For example, if I have code               int main (int argc, char **argv)     {         int retval;         printf ("This is most definitely the parent process\n");         fflush (stdout);         retval = fork ();         printf ("Which process printed this?\n");              return (EXIT_SUCCESS);     }      The output is: > This is most definitely the parent process   >  Which process printed this?   >  Which process printed this? I thought that `fork()` creates a same process, so I initially that that in that program, the `fork()` call would be recursively called forever. I guess that new process created from `fork()` starts after the `fork()` call? If I add the following code, to differentiate between a parent and child process,               if (child_pid = fork ()) printf ("This is the parent, child pid is %d\n", child_pid);     else printf ("This is the child, pid is %d\n",getpid ());      after the fork() call, where does the child process begin its execution?


How to convert a PDF file to a DVD movie?

Each page would be navigable with the player's 'next' button. The result should have a directory called VIDEO_TS, to ensure it will play in old players.


X keyboard layout unable to toggle

I don't understand why `alt_shift_toggle` is not triggers keyboard layout switch This is what I have `localectl status`               System Locale: LANG=en_US.UTF-8         VC Keymap: us        X11 Layout: us,ru         X11 Model: grp:alt_shift_toggle      After pressing `Alt`+`Shift` nothing changes.


.bash_profile alias escape quotes?

On the rare occasion I use the command line, I usually forget syntax. This is one of those times. I want to add a simple alias to my .bash_profile but no matter what quote method I use, I get an error. I want to add this to my profile `alias htdoc=cd /Applications/MAMP/htdocs/`. Despite what quotes I use, I get this error               -bash: alias: /Applications/MAMP/htdocs/‘: not found          -bash: alias: ‘/Applications/MAMP/htdocs/‘“: not found          -bash: alias: ‘/Applications/MAMP/htdocs/‘: not found          -bash: alias: “/Applications/MAMP/htdocs/“: not found          -bash: alias: “/Applications/MAMP/htdocs/“‘: not found      I'm sure this is a total noob mistake and I did try many of the suggestions I found in other posts. Just haven't been able to nail this one down.


Output redirect complexities

I'm trying to have a script exit with an error in the event it can't reach an X server:               xset -q &> /dev/null || { echo "The Display Server is BROKEN.  Aborting."; exit 1; }      However, I'm getting the output of `xset -q` spat out to the console. I'm not quite sure why. My understanding of `&>` was that it redirected all output. Can somebody assist?


operation in /dev/shm causes overflow

I am repeating tens of thousands of similar operations in /dev/shm, each with a directory created, files written, and then removed. My assumption used to be that I was actually creating directories and removing them in place, so the memory consumption had to be quite low. However it turned out the usage was rather high, and finally caused memory overflow. So my questions is: with operations like               mkdir /dev/shm/foo     touch /dev/shm/foo/bar     [edit] /dev/shm/foo/bar     ....     rm -rf /dev/shm/foo      Will it finally cause memory overflow? and if it does, why is that, since it seems to be removing them in-place. **Note:** this is a tens of thousands similar operation.


What does exec $SHELL -l do?

I have seen this command in a few different shell scripts:               exec $SHELL -l      ...usually as an alternative to:               source ~/.profile      What exactly is `exec $SHELL -l` doing?


How to Install Oracle 11gR2 on Ubuntu Server 13.04

I want to install Oracle 11gR2 for Linux on Ubuntu Server 13.04. I have downloaded Oracle 11gR2 for Linux, and when I execute use runinstaller it require GUI supported files. While Google I got things related rpm packages. Help me to install it.


Noninteractive script running over ssh is interrupted as apt-get finishes

When I run the following non interactive script on Ubuntu Server 13.04 it's interrupted when **lxc-docker** package finishes installation. Script :               ssh -o StrictHostKeychecking=no -t -t -i $CERT $USER@$SERVER <<'ENDSSH'          sudo DEBIAN_FRONTEND=noninteractive apt-get -y install software-properties-common     sudo DEBIAN_FRONTEND=noninteractive add-apt-repository -y ppa:dotcloud/lxc-docker     sudo DEBIAN_FRONTEND=noninteractive apt-get -y update     sudo DEBIAN_FRONTEND=noninteractive apt-get -y install lxc-docker          echo "some other actions here..."          exit #SSH session          ENDSSH     exit      Everything seems to be fine but then the script is interrupted after this line in the output :               Processing triggers for ureadahead ...      **1) Why is this happenning? How can I prevent that?** **2) If not, how I can detect that ssh session has finished unsucessfully?** Last lines from installation (shortened) :               Reading package lists... Done     Building dependency tree            Reading state information... Done     The following extra packages will be installed:       bridge-utils bsdtar cgroup-lite debootstrap dnsmasq-base libapparmor1       libarchive13 libcap2-bin liblxc0 liblzo2-2 libnetfilter-conntrack3       libnettle4 libpam-cap libseccomp1 lxc lxc-templates python3-lxc     Suggested packages:       bsdcpio lrzip libcap-dev btrfs-tools lvm2 lxctl qemu-user-static     The following NEW packages will be installed:       bridge-utils bsdtar cgroup-lite debootstrap dnsmasq-base libapparmor1       libarchive13 libcap2-bin liblxc0 liblzo2-2 libnetfilter-conntrack3       libnettle4 libpam-cap libseccomp1 lxc lxc-docker lxc-templates python3-lxc     0 upgraded, 18 newly installed, 0 to remove and 29 not upgraded.     Need to get 2,495 kB of archives.     After this operation, 8,742 kB of additional disk space will be used.     Get:1 http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ raring/main liblzo2-2 amd64 2.06-1build1 [53.2 kB]     Get:2 http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ raring/main libnettle4 amd64 2.4-3 [94.7 kB]     .     .     .     .     .     .     Setting up libnetfilter-conntrack3:amd64 (1.0.1-1) ...     Setting up dnsmasq-base (2.65-1ubuntu1) ...     Setting up python3-lxc (0.9.0-0ubuntu3.2) ...     Setting up lxc (0.9.0-0ubuntu3.2) ...     lxc start/running     Setting up lxc dnsmasq configuration.     Setting up bsdtar (3.1.2-5ubuntu1) ...     Setting up libcap2-bin (1:2.22-1.2ubuntu2) ...     Setting up libpam-cap:amd64 (1:2.22-1.2ubuntu2) ...     Setting up cgroup-lite (1.8) ...     cgroup-lite start/running     Setting up debootstrap (1.0.46ubuntu1) ...     Processing triggers for ureadahead ...     Setting up lxc-docker (0.4.0-1) ...     docker start/running, process 2444     Setting up lxc-templates (0.9.0-0ubuntu3.2) ...     Processing triggers for libc-bin ...     ldconfig deferred processing now taking place     Processing triggers for ureadahead ...


variable declaration does not work

I have the below script in my system:               #!/bin/sh          LASTFILES=`find /var/log -mtime -1 -iname *.csv`          KEYWORDS="MD AG GA"          countMD="0"     countAG="0"     countGA="0"          for i in $LASTFILES ; do         for a in $KEYWORDS ; do             count_$a=`grep -a $date $i | grep -i "\"$a\"" | grep smsMoBilling | wc -l`             count$a=`expr $count$a + $count_$a`              done     done      It doesn't work when I run it.               ./test.sh: line 35: count_MD=37: command not found     expr: non-numeric argument     ./test.sh: line 36: countMD=: command not found      What is the matter with the variable declared? Could you help me?


Is there a way to condense ../.. parts of a path out programatically?

Say for example I have these types of paths to files in a script:               /path/to/some/file/../../file1.txt      Is there a command I can call such as `readlink` that will convert this path to its actual physical form:               /path/to/file1.txt


SELinux - allowing rsyslog open/read access to some files

So I've got three files I need rsyslog to open in order to forward the entries to another server. SELinux is preventing this with the following error:               type=AVC msg=audit(1371186588.768:1324460): avc:  denied  { open } for  pid=3714     comm="rsyslogd" name="named.debug.log" dev=dm-0 ino=1180551 scontext=unconfined_u:system_r:syslogd_t:s0 tcontext=unconfined_u:object_r:named_cache_t:s0 tclass=file     type=SYSCALL msg=audit(1371186588.768:1324460): arch=c000003e syscall=2 success=no exit=-13 a0=7fb254001b30 a1=80100 a2=180 a3=2e67756265642e64 items=0 ppid=1 pid=3714 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=7926 comm="rsyslogd" exe="/sbin/rsyslogd" subj=unconfined_u:system_r:syslogd_t:s0 key=(null)      Running this through audit2allow, I get the following:               module rsysloglocal 1.0;          require {             type named_cache_t;             type syslogd_t;             class file { read write };     }          #============= syslogd_t ==============     allow syslogd_t named_cache_t:file { read write };      Unfortunately, this doesn't work. I'm still getting the message above from SELinux. The files I need to watch with rsyslog are in /var/named/data/log/, which is why SELinux is referencing the named_cache_t thing (I think). Any thoughts? Edit: semodule -l output:               abrt    1.2.0     accountsd       1.0.0     ada     1.4.0     afs     1.5.3     aiccu   1.0.0     aide    1.5.0     aisexec 1.0.0     amanda  1.12.0     amavis  1.10.3     amtu    1.2.0     apache  2.1.2     apcupsd 1.6.1     arpwatch        1.8.1     asterisk        1.7.1     audioentropy    1.6.0     automount       1.12.1     avahi   1.11.2     awstats 1.2.0     bind    1.10.2     bitlbee 1.2.1     bluetooth       3.2.2     boinc   1.0.0     bugzilla        1.0     cachefilesd     1.0.17     calamaris       1.5.1     canna   1.10.0     ccs     1.4.1     cdrecord        2.2.1     certmaster      1.0.2     certmonger      1.0.0     certwatch       1.5.0     cfengine        1.0.0     cgroup  1.0.0     chrome  1.0.0     chronyd 1.0.1     cipe    1.5.0     clamav  1.7.1     clogd   1.0.0     cloudform       1.0     cmirrord        1.0.0     cobbler 1.1.0     comsat  1.7.0     condor  1.0.0     consolekit      1.5.1     corosync        1.0.0     courier 1.8.1     cpufreqselector 1.1.0     ctdbd   1.0.0     cups    1.13.0     cvs     1.8.0     cyphesis        1.2.0     cyrus   1.9.1     daemontools     1.2.0     dbskk   1.5.0     dcc     1.8.2     denyhosts       1.0.0     devicekit       1.0.0     dhcp    1.8.1     dictd   1.7.0     dirsrv-admin    1.0.0     dirsrv  1.0.0     dnsmasq 1.8.1     dovecot 1.11.1     drbd    1.0.0     ethereal        2.0.0     execmem 1.0.0     exim    1.4.2     fail2ban        1.3.2     fcoemon 1.0.0     fetchmail       1.9.2     finger  1.9.0     firewallgui     1.0.0     fprintd 1.0.1     ftp     1.11.0     games   2.1.0     git     1.0.3     gitosis 1.0.1     glance  1.0.0     gnome   2.0.0     gnomeclock      1.0.0     gpg     2.2.1     gpm     1.7.1     gpsd    1.0.2     guest   1.0.1     hal     1.12.1     hddtemp 1.0.0     howl    1.8.1     icecast 1.0.0     inn     1.9.0     ipsec   1.10.2     irc     2.1.0     iscsi   1.6.2     jabber  1.8.0     java    2.2.1     kdump   1.0.1     kdumpgui        1.0.0     kerberos        1.10.2     kerneloops      1.3.1     keystone        1.0.0     kismet  1.4.2     ksmtuned        1.0.0     ktalk   1.7.1     ldap    1.10.0     likewise        1.0.0     lircd   1.0.1     livecd  1.0.0     lldpad  1.0.0     lockdev 1.3.0     logadm  1.0.0     lpd     1.12.0     mailman 1.7.2     matahari        1.0.0     mediawiki       1.0.0     memcached       1.1.2     milter  1.1.1     modemmanager    1.0.1     mono    1.6.1     mozilla 2.1.1     mpd     1.0.0     mplayer 2.1.0     mrtg    1.8.0     munin   1.7.0     mysql   1.11.3     nagios  1.8.0     namespace       1.0.0     ncftool 1.0.0     netlabel        1.3.0     nis     1.10.0     nova    1.0.0     nslcd   1.0.1     nsplugin        1.0.0     ntop    1.8.1     ntp     1.9.1     nut     1.0.1     nx      1.4.0     oddjob  1.7.0     openct  1.4.0     openoffice      1.0.0     openvpn 1.9.1     pads    1.0.0     passenger       1.0.0     pcscd   1.5.2     pegasus 1.8.0     permissivedomains       1.0.0     pingd   1.0.0     piranha 1.0.0     plymouthd       1.0.0     podsleuth       1.2.1     policykit       1.1.0     portmap 1.9.0     portreserve     1.1.1     postfix 1.11.0     postgresql      1.12.1     postgrey        1.7.0     ppp     1.11.2     prelude 1.1.2     privoxy 1.9.1     procmail        1.11.0     psad    1.0.0     ptchown 1.0.1     publicfile      1.1.0     pulseaudio      1.1.2     puppet  1.0.0     pyzor   2.1.0     qemu    1.3.2     qmail   1.5.0     qpidd   1.0.0     quantum 1.0.0     radius  1.11.0     radvd   1.11.2     razor   2.1.0     rdisc   1.7.1     remotelogin     1.7.0     rgmanager       1.0.0     rhcs    1.1.0     rhev    1.0     rhgb    1.9.0     rhsmcertd       1.0.0     ricci   1.6.0     rlogin  1.9.0     roundup 1.7.0     rpcbind 1.4.1     rshd    1.7.0     rssh    2.0.0     rsync   1.9.1     rsysloglocal    1.0     rtkit   1.0.1     rwho    1.6.0     samba   1.12.0     sambagui        1.0.0     sandbox 1.0.0     sanlock 1.0.0     sasl    1.12.1     sblim   1.0.0     screen  2.2.2     sectoolm        1.0.0     seunshare       1.1.0     sge     1.0.0     shutdown        1.0.0     slocate 1.9.0     smartmon        1.9.1     smokeping       1.0.0     smoltclient     1.0.0     snmp    1.10.2     snort   1.8.1     sosreport       1.0.0     soundserver     1.8.0     spamassassin    2.2.0     squid   1.9.0     sssd    1.0.2     staff   2.0.1     stunnel 1.9.0     sysadm_secadm   1.0.0     sysstat 1.5.1     tcpd    1.4.0     telepathy       1.0.0     telnet  1.9.1     tftp    1.12.0     tgtd    1.0.1     tmpreaper       1.4.0     tor     1.6.1     tuned   1.0.1     tvtime  2.0.0     ulogd   1.1.0     uml     2.1.0     unconfined      3.1.1     unconfineduser  1.0.0     unlabelednet    1.0     unprivuser      2.0.1     usbmodules      1.2.0     usbmuxd 1.0.0     userhelper      1.5.0     usernetctl      1.5.0     uucp    1.10.2     uuidd   1.0.0     varnishd        1.1.0     vdagent 1.0.0     vhostmd 1.0.0     virt    1.4.0     vmware  2.2.0     vpn     1.12.0     w3c     1.0.0     wdmd    1.0.0     webadm  1.1.0     webalizer       1.10.0     wine    1.6.1     xen     1.9.2     xfs     1.6.0     xguest  1.0.1     zabbix  1.2.0     zarafa  1.0.0     zebra   1.10.1     zosremote       1.1.0      Edit 2: I've also tried this using only read permissions (allow syslogd_t named_cache_t:file read;) rather than read / write. No dice.


Cannot succesfully run apt-get -f install

I am working on a Ubuntu `Ubuntu 12.04.2 LTS (GNU/Linux 3.5.0-43-generic x86_64)` machine. There are some packages that I need to install, and in order to be able to that, first I have to run `apt-get -f install`. But this is what I get when I run `apt-get -f install`:               root@SERVERLINUX:/boot# apt-get -f install     Reading package lists... Done     Building dependency tree            Reading state information... Done     Correcting dependencies... Done     The following packages were automatically installed and are no longer required:       firefox-globalmenu python2.6-minimal linux-headers-3.5.0-39-generic linux-headers-3.5.0-34 linux-headers-3.5.0-37       linux-headers-3.5.0-39 thunderbird-globalmenu linux-headers-3.5.0-34-generic linux-headers-3.5.0-37-generic     Use 'apt-get autoremove' to remove them.     The following extra packages will be installed:       linux-image-generic-lts-quantal     The following packages will be upgraded:       linux-image-generic-lts-quantal     1 upgraded, 0 newly installed, 0 to remove and 440 not upgraded.     2 not fully installed or removed.     Need to get 0 B/2.442 B of archives.     After this operation, 0 B of additional disk space will be used.     Do you want to continue [Y/n]? Y     dpkg: dependency problems prevent configuration of linux-image-generic-lts-quantal:      linux-image-generic-lts-quantal depends on linux-image-3.5.0-44-generic; however:       Package linux-image-3.5.0-44-generic is not installed.     dpkg: error processing linux-image-generic-lts-quantal (--configure):      dependency problems - leaving unconfigured     dpkg: dependency problems prevent configuration of linux-generic-lts-quantal:      linux-generic-lts-quantal depends on linux-image-generic-lts-quantal; however:       Package linux-image-generic-lts-quantal is not configured yet.     No apport report written because the error message indicates its a followup error from a previous failure.                                                                                No apport report written because the error message indicates its a followup error from a previous failure.                                                                                dpkg: error processing linux-generic-lts-quantal (--configure):      dependency problems - leaving unconfigured     Errors were encountered while processing:      linux-image-generic-lts-quantal      linux-generic-lts-quantal     E: Sub-process /usr/bin/dpkg returned an error code (1)      What's going on? How can I manage to run `apt-get -f install` succesfully? How can I solve those dependency errors? EDIT: This is what I get when I run `dpkg --configure -a`, as suggested by Mohsen Pahlevanzadeh:               root@SERVERLINUX:/boot# dpkg --configure -a     dpkg: dependency problems prevent configuration of linux-image-generic-lts-quantal:      linux-image-generic-lts-quantal depends on linux-image-3.5.0-44-generic; however:       Package linux-image-3.5.0-44-generic is not installed.     dpkg: error processing linux-image-generic-lts-quantal (--configure):      dependency problems - leaving unconfigured     dpkg: dependency problems prevent configuration of linux-generic-lts-quantal:      linux-generic-lts-quantal depends on linux-image-generic-lts-quantal; however:       Package linux-image-generic-lts-quantal is not configured yet.     dpkg: error processing linux-generic-lts-quantal (--configure):      dependency problems - leaving unconfigured     Errors were encountered while processing:      linux-image-generic-lts-quantal      linux-generic-lts-quantal      **SOLUTION** : As suggested by Faheem Mitha, I run `apt-get install linux- image-3.5.0-44-generic` and it worked perfectly. Actually it has solved my problem


What is your favourite shell script GUI/CLI editor and why?

I'm using vim for editing bash scripts currently, but i really need to set it up and/or install plugins. Plugin suggestions welcome. Either way i'd like to see which editors/IDEs are there for this job.