Problem with samba shares Ubuntu server 12.04

I'm having a problem with setting up samba share permissions on Ubuntu Server LTS. I've got two shares set up in the `smb.conf` file. The entries look like this:               [share]     comment = Ubuntu File Server Share     path = "insert real path name here"     browsable = yes     guest ok = no     read only = no     create mask = 0700     group = group1          [media]     comment = Ubuntu File Server Share     path = "insert real path name here"     hide unreadable = yes     browsable = yes     guest ok = no     read only = no     group = group2     create mask = 0700      In the file system I am the owner of all directories related to both of these shares. The `[media]` share is group-owned by `group2`, and the `[share]` is group-owned by `group1`. For both directories I have file permissions set at 771, where owner and group both have read, write, and execute, but guests have only execute. I have 3 users in the system: myself, my wife, and my mother. I belong to `group1` and `group2`, as does my wife. My mother belongs only to `group2`. When I log into the server from my Windows desktop, my credentials work as expected. But if I use my wife's or my mother's, nothing works. They can log into the server, but when they click on one of the shared folders another log in screen is displayed asking for another username / password. This always fails and they are not allowed access to the folders. I would like for my wife and I to have access to both of these folders while restricting access to other users. What am I missing here? I've tried fixing this for quite some time and I can't seem to get it figured out.


Output of 'watch' command as a list

I want to do some simple computation of the number of lines per minute added to a log file. I want also to store the count for each second. What I need is the output of the following command as a list which will be updated every second:               watch -n1 'wc -l my.log'      How to output the 'update' of the 'watch' command as a list?


How can I disable TCP/IP for an Ethernet adapter?

I have CentOS 6.3 running in a (virtual) machine with two Ethernet adapters. I have eth0 connected to a TCP/IP LAN and eth1 connected to a DSL modem. The system is intended as a dedicated router/firewall, and has iptables set up to do SNAT, DNAT, and the desired filtering. This was working great but I changed DSL modems and unfortunately the new (faster) one is idiotproofed and so automatically does NAT and will not allow me to pass my public IP along to eth1. I can't tolerate double NAT so I did some research and read that this modem can be 'tricked' into giving my computer a public IP by doing the PPPoE on the computer. I therefore set up pppd to use eth1, creating the ppp0 connection which I then substitute for eth1 in my custom iptables config script. This seems to work to a degree but I had to open up the firewall to get it to work, and it's flaky. Partly to help in troubleshooting, I want to totally rule out the possibility of any TCP/IP traffic being directly routed to eth1 where my 'friendly' modem will happily NAT it. To the best of my knowledge, PPPoE sits below, not above IP - on the physical interface it deals directly in Ethernet frames. Therefore I should not even have to have IP networking configured on eth1 at all in order for pppd to work, and IP networking running on eth1 therefore is just complicating matters needlessly. Here's where I discover, silly me, I don't know how to disable the TCP/IP stack on Linux! I know on a Windows box you can just uncheck the TCP/IP protocol in the adapter properties, but here I am running a text-only CentOS and I have no idea how to do it. Apparently it's not a very common desire, because I've been searching the Internet to no avail. It seems like a hard-wired assumption that an Ethernet adapter _is_ a TCP/IP connection. Well, usually... Thanks for any help! Kevin


Check a range of IP addresses to see if a host is active

I need to write a bash shell script that will check a range of IP addresses to see if a host is “alive” at that address.I also need to list the IP numbers of those that are “alive”, and provide a summary showing the number of “alive” and “not alive” IP addresses. The range of addresses will all be in a “Class C” network. I'm having problems figuring out how to pass through each arg and get it pinging each individual address within the range. Below is a sample run of the script I intend to create.               $ programName 192.168.42 18 22           Checking: 192.168.42.18 19 20 21 22           Live hosts:       192.168.42.21       192.168.42.22           There were:       2 alive hosts       3 not alive hosts       found through the use of 'ping'.


cinnamon-screensaver and lock settings not visible in settings panel

A rather peculiar problem: After updating a fresh installation of Linux Mint Debian Edition, I lost the ability to change the screensaver and lock settings, here's a screenshot of the relevant settings page, completely missing the actual setting options: ![Screensaver and Lock Settings](http://i.stack.imgur.com/OBPqC.png) According to the release notes of the Update Pack 7, the `cinnamon- screensaver` package replaces and removes `gnome-screensaver`, which sounds like the root of the problem. The problem persists even after removing and re- installing `cinnamon-screensaver`, though. Any suggestions?


can't connect to samba drive in centos 6.3

#smbclient //ballzdeep/torrents     Server not using user level security and no password supplied     tree connect failed: NT_STATUS_BAD_NETWORK_NAME      Does this mean i need to require username and password for my drive? Windows,Ubuntu connect to it with their GUI's but i can't get CentOS 6.3 to also.


If I open the same file twice in Okular, switch to the existing window

I have always been confused why the file manager in Linux cannot stop applications from opening a single file twice at the same time? Specifically, I want to stop the PDF file reader Okular from opening the file `A.pdf` again when I have already opened it. I need to get an warning or just show me the opened copy of the file `A.pdf`. More generally, I would like this to happen with any application, not just Okular. I want to make the document management behavior in Linux the same as in Windows.


Script is stuck saying 1 response with 2 available: Math related

I have a script that tells the user the square footage of 2 rooms based on user input. I think I have that part done right. The problem I have is that I need to have the script say which room is bigger and no matter how I try to rebuild the end of the script I get both responses, 1 of the responses which is wrong unless the user is lucky, or I get no response. How do I change this part of the script to get the correct output? I'll have the rest of the script as a reply to this for those that want to skip over the working part along with the question I've been given. Also this is a homework assignment from my Intro to Unix class that I've spent way to much time on trying to figure out so the correction has to be somewhat beginner-ish.                   if [ $R1z -ge $R2z]         then         echo Room 1 is bigger         else         echo Room 2 is bigger         fi      All of the code:                   echo Enter the length of room 1         read R1x         echo Enter the width of room 1         read R1y         echo Enter the length of room 1         read R2x         echo Enter the width of room 2         read R2y         expr $R1x \* $R1y         read R1z         expr $R2x \* $R2y         read R2z              if [ $R1z -ge $R2z]         then         echo Room 1 is bigger         else         echo Room 2 is bigger         fi


Are there any pitfalls to overriding ls?

Is there anything to watch out for if you wanted to override `ls`? Is there a more reliable way of getting pagination out of `ls`? For example:               function ls() { command ls -hp $@ | more; }


add members of wheel group, sudo access

On Fedora15, following this wiki, I added a user to wheel group, which is already in the sudoer config file. but still I get not-a-sudoer error prompt. Should I specifically name every member of a group in sudoer file to be able to sudo with that user?


Can I execute commands from a midnight commander ssh connection?

When I connect to a VPS via a Shell link in MC, the location of the command prompt remains at my local box. I would like to be able to execute commands (e.g. mkdir, tar/untar) directly from the location of the left or right panel. I could ssh into the VPS separately, but this is not as handy as how I can use SFTP in Total Commander under Windows: e.g. type a command on my local machine in the left panel, switch to the right panel (remote location) using tab and directly type a command that is executed at the remote location. Is this possible with Midnight Commander?


Can't get lm-sensors to ouput correctly or load ATI Radeon temp and fan

I am new to Linux and having minor issues. I followed this guide initially, but did not receive the proper output, and it did not show my ATI Radeon HD 5000 temperature or fan speed. Then I used this guide, and the same problems were exhibited. I had no issues installing it and no errors. I think it's not reading `i2c` for some reason. The proprietary driver is installed and functioning correctly according to `fglrxinfo`. I can use `aticonfig` commands and view both the temperature and fan. Thoughts? Any ideas on how to get it working under `sensors`? When I run `sudo sensors-detect` this is my output               # sensors-detect revision 5984 (2011-07-10 21:22:53 +0200)     # System: LENOVO IdeaPad Y560 (laptop)     # Board: Lenovo KL3          This program will help you determine which kernel modules you need     to load to use lm_sensors most effectively. It is generally safe     and recommended to accept the default answers to all questions,     unless you know what you're doing.          Some south bridges, CPUs or memory controllers contain embedded sensors.     Do you want to scan for them? This is totally safe. (YES/no): y     Silicon Integrated Systems SIS5595...                       No     VIA VT82C686 Integrated Sensors...                          No     VIA VT8231 Integrated Sensors...                            No     AMD K8 thermal sensors...                                   No     AMD Family 10h thermal sensors...                           No     AMD Family 11h thermal sensors...                           No     AMD Family 12h and 14h thermal sensors...                   No     AMD Family 15h thermal sensors...                           No     AMD Family 15h power sensors...                             No     Intel digital thermal sensor...                             Success!         (driver `coretemp')     Intel AMB FB-DIMM thermal sensor...                         No     VIA C7 thermal sensor...                                    No     VIA Nano thermal sensor...                                  No          Some Super I/O chips contain embedded sensors. We have to write to     standard I/O ports to probe them. This is usually safe.     Do you want to scan for Super I/O sensors? (YES/no): y     Probing for Super-I/O at 0x2e/0x2f     Trying family `National Semiconductor/ITE'...               Yes     Found unknown chip with ID 0x8502     Probing for Super-I/O at 0x4e/0x4f     Trying family `National Semiconductor/ITE'...               No     Trying family `SMSC'...                                     No     Trying family `VIA/Winbond/Nuvoton/Fintek'...               No     Trying family `ITE'...                                      No          Some hardware monitoring chips are accessible through the ISA I/O ports.     We have to write to arbitrary I/O ports to probe them. This is usually     safe though. Yes, you do have ISA I/O ports even if you do not have any     ISA slots! Do you want to scan the ISA I/O ports? (YES/no): y     Probing for `National Semiconductor LM78' at 0x290...       No     Probing for `National Semiconductor LM79' at 0x290...       No     Probing for `Winbond W83781D' at 0x290...                   No     Probing for `Winbond W83782D' at 0x290...                   No          Lastly, we can probe the I2C/SMBus adapters for connected hardware     monitoring devices. This is the most risky part, and while it works     reasonably well on most systems, it has been reported to cause trouble     on some systems.     Do you want to probe the I2C/SMBus adapters now? (YES/no): y     Using driver `i2c-i801' for device 0000:00:1f.3: Intel 3400/5 Series (PCH)          Now follows a summary of the probes I have just done.     Just press ENTER to continue:           Driver `coretemp':       * Chip `Intel digital thermal sensor' (confidence: 9)          To load everything that is needed, add this to /etc/modules:     #----cut here----     # Chip drivers     coretemp     #----cut here----     If you have some drivers built into your kernel, the list above will     contain too many modules. Skip the appropriate ones!          Do you want to add these lines automatically to /etc/modules? (yes/NO) My output for `sensors` is:               acpitz-virtual-0     Adapter: Virtual device     temp1:        +58.0°C  (crit = +100.0°C)          coretemp-isa-0000     Adapter: ISA adapter     Core 0:       +56.0°C  (high = +84.0°C, crit = +100.0°C)     Core 1:       +57.0°C  (high = +84.0°C, crit = +100.0°C)     Core 2:       +58.0°C  (high = +84.0°C, crit = +100.0°C)     Core 3:       +57.0°C  (high = +84.0°C, crit = +100.0°C)      and my `/etc/modules` is:               # /etc/modules: kernel modules to load at boot time.     #     # This file contains the names of kernel modules that should be loaded     # at boot time, one per line. Lines beginning with "#" are ignored.          lp     rtc          # Generated by sensors-detect on Fri Nov 30 23:24:31 2012     # Chip drivers     coretemp


Downsampling a video with avconv / ffmpeg

I know really little about encoding and using avconv / ffmpeg. I am trying to downsample a video as follows:               avconv -i blah_in.avi -s 640x360 -pass 1 blah.avi     avconv -i blah_in.avi -s 640x360 -pass 2 blah.avi      I am aware that this is very simplistic, yet I can't figure out what the problem is. Here is the error message from pass 1:               avconv version 0.8.3-4:0.8.3-0ubuntu0.12.04.1, Copyright (c) 2000-2012 the Libav developers       built on Jun 12 2012 16:37:58 with gcc 4.6.3     [avi @ 0x9fdd240] non-interleaved AVI     Input #0, avi, from 'blah_in.avi':       Metadata:         encoder         : MEncoder svn r34540 (Ubuntu), built with gcc-4.6       Duration: 01:21:59.24, start: 0.000000, bitrate: 8996 kb/s         Stream #0.0: Video: mpeg4 (Advanced Simple Profile), yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 23.98 tbr, 23.98 tbn, 23.98 tbc         Stream #0.1: Audio: mp3, 44100 Hz, stereo, s16, 128 kb/s     File 'blah.avi' already exists. Overwrite ? [y/N] y     [buffer @ 0x9fe1e00] w:1920 h:1080 pixfmt:yuv420p     [scale @ 0x9fdcfa0] w:1920 h:1080 fmt:yuv420p -> w:640 h:360 fmt:yuv420p flags:0x4     Incompatible sample format 's16' for codec 'ac3', auto-selecting format 'flt'     [ac3 @ 0x9fdc740] invalid bit rate     Output #0, avi, to 'blah.avi':       Metadata:         encoder         : MEncoder svn r34540 (Ubuntu), built with gcc-4.6         Stream #0.0: Video: mpeg4, yuv420p, 640x360 [PAR 1:1 DAR 16:9], q=2-31, pass 1, 200 kb/s, 90k tbn, 23.98 tbc         Stream #0.1: Audio: ac3, 44100 Hz, stereo, flt, 200 kb/s     Stream mapping:       Stream #0:0 -> #0:0 (mpeg4 -> mpeg4)       Stream #0:1 -> #0:1 (mp3 -> ac3)     Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height      I have tried a number of things, but either they end up with a similar error message, or the quality is extremely poor; not so much due to low resolution, but full of compression artifacts. Now, what I would like to achieve is the same resolution / encoding as the following avi file, which plays fine on my kids video device:               Stream #0.0: Video: mpeg4 (Advanced Simple Profile), yuv420p, 624x352 [PAR 1:1 DAR 39:22], 25 fps, 25 tbr, 25 tbn, 25 tbc     Stream #0.1: Audio: mp3, 48000 Hz, stereo, s16, 128 kb/s


How to sed only that lines that contains given string?

INPUT:               Select ASDF 325 sdfg sdflk lk     Select TRG 46sdg rasdftz fsgs 45     Select ASDF 6ffg sdfg 4456 sdrg      OUTPUT:               Select ASDF 325 XXXX sdflk lk     Select TRG 46sdg rasdftz fsgs 45     Select ASDF 6ffg XXXX 4456 sdrg      So in short I need to "sed" "sdfg" to "XXXX".      BUT: only in lines that contains the "Select ASDF" string.. How can I do this? (sed, awk, etc. :\ )


Reusing pipe data for different commands

I would like to use the same pipe for different applications, like in:               cat my_file | {       cmd1       cmd2       cmd3     }      Cmd1 should consume part of the input. Cmd2 should consume another part and so on. However, each cmd eats more of the input then it read really needs due buffering. For example:               yes | nl | {        head -n 10 > /dev/null       cat      } | head -n 10      Outputs from line 912 instead of line 11. Tee is not a good option, because each command is supposed to consume part of the stdin. Is there a simple way to get this working?


Can I create a symlink that will ignore subdirectories?

I'm trying to get dropbox symlinked to the relevant folders in `/home`. I'd like to symlink them like this: `~/Dropbox/Pictures --> ~/Pictures` `~/Dropbox/Camera Uploads --> ~/Pictures/Camera Uploads` If I do that it will work but I'll have two copies of my pictures and videos stored on Dropbox. I don't want to waste space. Any ideas on how to solve this problem?


Gnome clock on UTC, not local

My OS is Gentoo. My Hardware Clock is set to UTC. The `date` command returns the correct time and timezone (EDT). However, my GNOME clock is set to UTC. I have 2 clocks, one at Internet Time, and one set (the format string) to "24-hour". I have NTP and NTPD installed and running. My timezone/location in the menu that shows up when I click is correct. Even the analog clock right next to it is correct. However, the time that shows up whenever I send emails, whenever I access the internet, is off by 4 hours. Any advice would be welcome.


How to download all html files from a URL's directory with wget?

I'd like to use `wget` to download a tutorial in a website, but this tutorial is in a specific directory. Suppose the URL is the tutorial main page `http://www.abc.com/aaa/bbb/ccc/index.html`. But the as it contain "continuations" there are other pages I'd like to be interconected that are in directories such as:               http://www.abc.com/aaa/bbb/ccc/ddd/index.html          http://www.abc.com/aaa/bbb/ccc/eee/index.html          http://www.abc.com/aaa/bbb/ccc/fff/ggg/index.html      So, basically I need to download recursively the directories after ccc, but not before, and then convert the links to be used offline. There is any argument to be used with `wget` that would perform such task?


AWK: wrap lines to 72 characters

$ awk 'length > 72' {HOW TO PRINT THE LINEs IN PCS?} msg      ie I want it to add `\n` after 72 chars and continue, so initially you may need to remove all single `\n`s and the add them. It may be easier be easier with other tool but let's give a try to awk. **[Update]** _Williamson provided the right answer but some help needed to read it. I break the problem into parts with simpler examples, below._   1. Why does the code below print `\t` in both cases, `gsub` should substitute things? x is a dummy-file, some odd 0 at the end.   2. Attacking the line `line = $0 \n more = getline \n gsub("\t"," ")` in Williamson's reply, `line` apparently gets whole stdout while `more` gets popped value of `$0`, right? **Code to part 1**               $ gawk '{ hallo="tjena\t tjena2"; gsub("\t"," "); }; END {print hallo; gsub("\t", ""); hallo=hallo gsub("\t",""); print hallo }' x     tjena  tjena2     tjena  tjena20


PF and types of NAT(Network Address Translation)

As you know, at least 3 types of `NAT` are used. Of course i need to two types of them.`DNAT` and `SNAT`. `DNAT` : hiding server behind `NAT`, `SNAT` : hiding your client behind `NAT`. **Question:** I read a quick tutorial of `PF filrewall`, but didn't   distinguish `DNAT` and `SNAT` in `PF Firewall`. How can i define ruleset as `DNAT` and `SNAT`?


Can I alter my Fedora LVM LV to install a new distro as a dual-boot?

My question is _almost_ a duplicate of this question, but not quite because that one is about `ext3` and I am already using LVM. I have an older HP Pavilion laptop running Fedora 11. I chose Fedora because it was semi- compatible with the hardware and it ran VMware well... but since I no longer need VMware I am looking to test out other distros and find one that's more compatible. (Specifically looking for software suspend support and maybe something more lightweight) I'd like to try out a few new distros without hosing the existing (working) Fedora setup. Since I am using LVM, is it possible to reduce the size of my LVM LV and then install new distros into the volgroup, without the new distros destroying the Fedora setup? Here's how my LVM is set up now:               [root@token ~]# /sbin/lvm lvdisplay       --- Logical volume ---       LV Name                /dev/vg_token/lv_root       VG Name                vg_token       LV UUID                JPCDlb-HHW7-fMDy-h8p2-Itbp-hwfK-3CwN97       LV Write Access        read/write       LV Status              available       # open                 1       LV Size                91.96 GB       Current LE             23542       Segments               1       Allocation             inherit       Read ahead sectors     auto       - currently set to     256       Block device           253:0            --- Logical volume ---       LV Name                /dev/vg_token/lv_swap       VG Name                vg_token       LV UUID                3JMF4u-3jXx-Xy6H-saNt-Aljh-6Idw-73O4IS       LV Write Access        read/write       LV Status              available       # open                 1       LV Size                1.00 GB       Current LE             256       Segments               1       Allocation             inherit       Read ahead sectors     auto       - currently set to     256       Block device           253:1          [root@token ~]# df -h /     Filesystem            Size  Used Avail Use% Mounted on     /dev/mapper/vg_token-lv_root                            91G   68G   24G  75% /      Are there distros which will allow me to install into a new logical volume without destroying the existing one? If so, which ones, and how would I go about making room for the new LV?


TightVNC not running gnome-session

I have a Debian Lenny box with Gnome desktop. I've installed Tightvnc server on it and would like to see a Gnome session when connecting from another computer using VNC viewer. But for some reason it opens the "X Desktop" with only a terminal window visible. What could be wrong? I used these instructions for editing the configuration (~/.vnc/xstartup). So looks like it's not recognizing _gnome-session &_ and is falling back to generic session instead. Why?


how to form a sed expression containing escaped characters

Given a sed expression (and GNU sed 4.2.2 on ArchLinux)               /match/i\tline1\n\tline2      which should insert two tab-indented lines above the match, I find that the escaping of the first character (in the example, `\t`) is ignored but all other escaped characters are treated correctly. Testing this like this:               echo match | sed -e '/match/i\tline1\n\tline2'      results in               tline1         line2     match      It doesn't matter what the initial escaped character is (e.g. tab or newline) the result is the same. What is the correct way to consrtuct the expression so that the first character is treated correctly?


Calculate md5sum of a CD/DVD

I have an ISO file, which I burned to a CD. Now how can I check if the CD is correctly created? I would like a command that calculate the hash sum that I can use to check with the hash sum I calculate on the ISO file. Ideally the command should:   * Work regardless of the ISO file: that is, I don't want to keep a list of hash sum for each file in the disc, or remember the number of blocks whatever   * Be relatively short: a one-line command is great, a chain of commands which is two line long is OK, a script that span one page is not   * Be fairly efficient: for example, `dd` the disc back to a file then run `md5sum` on the file is unacceptable If there is no answer that cannot satisfy all I will appreciate the nearest match too. Even better if you can tell me why it is not so straight-forward.


Wireless multi function scanner / printer

Can someone recommend me a wireless multi function scanner / printer that will work with Ubuntu? If something like this exists at all..


renaming a fat16 volume

What's the easiest way to rename (change the volume label of) a fat16 volume (e.g. on a USB drive) from linux? It seems like `mlabel` from the `mtools` package is meant to do this, but the documentation is not geared to rapid assimilation.


Configure routes to access WAN and LAN through diffrent interfaces

In my organization. Some useful technical websites are blocked by the firewall. In my machine i got three interfaces **eth0, wlan0, wwlan0**               eth0      Link encap:Ethernet  HWaddr 00:9c:02:93:b1:b4                 inet addr:10.0.69.63  Bcast:10.0.71.255  Mask:255.255.252.0             ...               RX bytes:551526655 (551.5 MB)  TX bytes:71851444 (71.8 MB)               Interrupt:20 Memory:d4700000-d4720000           wlan0     Link encap:Ethernet  HWaddr ac:81:12:d2:57:d4                 inet addr:192.168.1.13  Bcast:192.168.1.255 Mask:255.255.255.0             ...          wwan0     Link encap:Ethernet  HWaddr 32:ab:e4:44:7c:3d                 inet addr:105.152.231.158  Bcast:105.152.231.159  Mask:255.255.255.252             ...               RX bytes:288643752 (288.6 MB)  TX bytes:28286606 (28.2 MB)      When I disable eth0 i can access the WAN through wwan0 but of course i loose access to the organization LAN. How can i configure my routing table to : **1.** Access all LAN destinations (10. * . * . *) through **eth0**   **2.** Access all WAN destinations through **wwlan0**   **3.** Access all WAN destinations through **eth0** when **wwlan0** is disabled   **4.** disable **1.** , **2.** and **3.** rules whenever i activate **wlan0**


Is it possible to run KVM over a qemu emulated powerpc architecture

I understand that qemu uses binary translation to emulate machines, so irrespective of the underlying architecture, it can provide emulation.   And, KVM uses Hardware Virtualization technique to make this process faster. Thus, KVM requires VT support from underlying architectures (which x86 processor provides). I have emulated powerpc architecture with qemu over x86 architecture. My question is whether it is possible to run KVM over this powerpc architecture.


Diffing two big text files

I have two big files (6GB each). They are unsorted, with linefeeds (`\n`) as separators. How can I diff them? It should take under 24h.


Why does the local::lib shell code use eval and $()

using local::lib requires you to add a line to your `~/.shellrc`               eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)      I don't understand what the point of using `eval`, and encasing the statement in `$()` is. I also notices that `csh` doesn't require you to use those. So I'm wondering what the difference is, and whether or not I should use this for generic bourne shell, or `zsh`.


Is there a utility like dspcat on Linux?

I use the following `dspcat` command on _AIX_ and can dump message catalogs created with the `gencat` command:               dspcat –g  /u/is/bin/I18N/l/lib/libca/libcalifornia.117.cat >> /tmp/message.smc      I have spent a good solid hour looking for hints on how to dump one of these catalogs on Linux but this command does not seem to be available. Any help would be appreciated.


How do I test to see if an application exists in $PATH?

I'm trying to write all of my `sh` startup/env scripts to work with as much _DRY_ and as much: "works on every *nix I clone it to", as possible. This means making sure that if I try to run code that's not there, that the code fails gracefully. To that end I need to be able to test if programs exist. I know how to test if a file exists, but I'm not sure how to test to see if an application is executable within the path. I'd rather use the $PATH, as some of these need to work on arch, ubuntu, and centos. Some might be installed in my homedir, on systems where I don't have root, others might not be installed, and others yet my be installed in system paths.


Swap to RAM, or not

Having a 32-bit system with 4G RAM and 7G swap. Linux 3.5.0-49-generic i686. From time to time the memory bank is filled up and everything lags down. In 99% of the cases it is Chrome using vast amounts of RAM and swap. Some times it helps to close down some windows, but often not. As an example for last time:               Mem: 4G in use     Swp: 3G in use      Chrome: 4 windows, 17 tabs. Closing Chrome and after a while I sit with               Mem: 450M in use     Swp: 220M in use      This is a rather typical scenario. The pages are "normal" web-pages like Stack Exchange sites, some articles and perhaps a news-site or two. * * * One thing I notice is that it takes some time for the system to normalize after I shut Chrome down. This is long after last process has died according to `htop` / `top`. It keeps lagging etc. Guess this is due to the swap. My question is if it is advisable to use some technique to flush the swap (push it to RAM so to speak), and how. And, is there some other technique to help in this particular predicament? * * * Edit: As for extensions I only use   * _Vimium_ , which usually does not consume much.   * _Session Buddy_ , (so that I can save my tabs when I need to do a Chrome boot), but this one also use (relatively) little memory. Even so I usually have it disabled and only enables it before I do a shut down and when I want to restore some of the tabs from a previous session.   * _Flashcontrol_ I have also tried longer periods with no extensions, not that it helped. When it comes to extensions/plugins the worst culprit is flash. Using _Flashcontrol_ this helps somewhat, but all over the issue persist. I usually check this using Chrome's own _Task Manager_ , `Shift+Esc`


Replacement of using terminal

Is there a way I can use Putty and connect it to my machine in replacement of terminal on my laptop? I am currently using ubuntu but I like some of the features that putty has over using the terminal.


kdump doesn't produce core dump after buggy module is loaded

I am running kernel 3.14.4 on Fedora 18. I am experimenting with a kernel module I am making. The module has a bug (at least one) and crashes the kernel. Sometimes I see a stack trace on my frozen screen (if I am lucky) by tailing the kernel log (`tail -f /var/log/messages`). From what I see, it's a NULL pointer dereference. Since luck does not provide for productivity I configured kdump, enabled it on boot, and tested that in fact it does create a kernel dump upon a sample panic (`echo c > /proc/sysrq-trigger`), which I can see after it reboots through the crash utility. But when I test my module the kernel crashes and no dump is generated. What can I do better?


Give read-only access to specific folders?

I would like to give read-only access to a user but I want him/her to see only the exact folders I give access. for example he/she shouldn't travel around all the server and browse to all users folders etc. even if he/she only goes up, up, up I want him/her to go to only these specific folders I allow. So firstly how can I let a specific user have access to a specific folder and then would putting symbolic links to his/her home folder would help? So they can go directly to necessary folders but not up or down?


Read file and do below command

From the 2 different web page the output goes to a single file called "traffic" From one page it always has a string "sqr" and from the other page it does not have the sqr string but "attach" I need help with something below:- read file traffic if it contains "sqr" then do the below 3 piece of code or if it contains "attach" do the below 4 piece of code Thanks for your help


What makes a good network planner software on Linux?

I need to design a VoIP network topology for a customer and I need a software that can do as that famous Windows one, don't remember the name.


Internet access via server

We have proxy-server and I run Linux Mint 15 Mate. I've set up network connection and Firefox prompts for login/pass and then connects to Internet. When trying to look for updates/new software, system does not prompt for login/pass and cannot connect to Internet. What should be done to have system accessing Internet and getting updates/installing new software?


Numbering the output of grep

When we're filtering the output with grep, is there any way we can get line numbered output, like we get with `cat -n`? I'm not asking for the `grep -n` option which shows the line number of the match in the file. The scenario I want to use it in is that when I download multiple files using aria2, I usually filter the output with keyword NOTICE which gives me some output every time a file download is completed. But I have actually no way of knowing how many files have been downloaded.


Print a text file from a line number to another after searching for the lines

I want to print a text file from `X` line number to `Y` line number The value of `X` & `Y` is determined by searching for a specific line in the text file(in this case the page number) I search for the line by the following command               echo -n |grep -nr "Page # 2" FileName.txt |cut -f1 -d: ; echo -n |grep -nr "Page # 3" FileName.txt |cut -f1 -d:      for which I get an out put > 67 > > 128 I want to feed this output to the command below               sed -n 'X,Yp' FileName.txt      But I get them as two different lines how can i feed it to the `sed` command There after I want to feed the result of the above command to the `lp` command something like this...               sed -n 'X,Yp' FileName.txt | lp -dmyprinter      Can this be done without creating a file?


How does rpm resolve library dependencies?

I try to make a package of a program which is linked to such library (output from ldd): > libwx_baseu-2.8.so.0 => /usr/lib64/wx-2.8-wxcontainer/libwx_baseu-2.8.so.0 Pretty straightforward, right? But when I make a package of this program (with rpmbuild) and then try to install it, rpm complains about missing library (this one above): > error: Failed dependencies: >   >   >         libwx_baseu-2.8.so.0()(64bit) >         libwx_baseu-2.8.so.0(WXU_2.8)(64bit) >   My guess is, rpmbuild set the dependency for the main lib directory, i.e. /usr/lib64. **Question** -- how to fix this issue (ok, one would be forced install, but I would like to avoid it)? I.e. how to build rpm so the dependencies would set for the wx-2.8-wxcontainer subdirectory (for this library)? openSUSE 11.4, if this matters. ## Edit I can install such package with --nodeps which forces installation, and after that install program works perfectly. So clearly, rpm or rpmbuild has issues, not the system itself.


returning strings corresponding to shell glob matching

Suppose I have a subdirectory called `sub`. Then I want to operate on all files in that directory with the extension "txt". I want something like               for f in sub/*.txt     do         enscript -b "" -o {$f basename excluding .txt}.ps sub/{$f basename excluding .txt}.txt                                                                                ps2pdf {$f basename excluding .txt}.ps {$f basename excluding .txt}.pdf     done      So if there was just one file in the `sub` directory of the form `*.txt`, say `sub/foo.txt`, the script should expand to               enscript -b "" -o foo.ps sub/foo.txt                                                                                ps2pdf foo.ps foo.pdf      I generally prefer portable solutions, but it is always interesting to learn about different ways of doing things. So non-portable is Ok, please just mention whether your solution is portable or non-portable. Also, the title is probably not the best possible, so feel free to modify. EDIT: I realized the example as written did not quite make sense, since `foo.txt` was in the `sub` directory, and therefore `sub/foo.txt` would need to be passed to `enscript`. I also changed the -p `enscript` option to the more standard `-o` option.


Questions on using command mount

When using command mount for a device, I was wondering about the following questions:   1. Since device file is a parameter to mount, how does one know what the device file for a device is in general?   2. Do I have to create in advance the directory to which the device is mounted to, if it does not exist yet? I saw this was said to be required, but my CD with name "mycd" is automatically mounted to /media/mycd, which doesn't exist beforehand.   3. can a device be mounted to several places, without unmounting? Thanks and regards!


Extract multiple lines with secondary keyword search

I have a text file with multiple log data, I would like to search for 'Keyword-1' in a line, and when it finds the line, to search within that line for another keyword such as 'engine-1'. Then extract the section from the start of 'engine-1' until it reaches a different engine such as 'engine-2'. I would like all 'engine-1' section extracted, that includes all lines between the start and end of 'engine-1'. The end of 'engine-1' is defined by reaching any other number such as 'engine-2' or 'engine-xx'. Note, not all lines contain the word engine, but I still want to extract the 'Data' between 'engine-1' start and 'engine-1' end. Then moved on to the next section in the file and repeat the process by searching for keyword-1 first and finding out engine it uses, and extracted the start/end section of the new different engine. The link between all sections would be 'keyword-1' The text file looks like this:                Data engine-1      Data engine-1      Data      Data      Data engine-1 **keyword-1**      Data engine-1                Data engine-2      Data engine-2      Data      Data      Data engine-2      Data engine-2           Data engine-3      Data engine-3       Data      Data      Data engine-3 **keyword-1**      Data engine-3           Data engine-1      Data engine-1       Data      Data      Data engine-1      Result should look like this after extraction:                Data engine-1      Data engine-1      Data      Data      Data engine-1 **keyword-1**      Data engine-1           Data engine-3      Data engine-3       Data      Data      Data engine-3 **keyword-1**      Data engine-3


How to run SSD trim fstrim on btrfs when mounted multiple subvolumes?

I am using btrfs and have mounted several subvolumes (but not btrfs root). It resides on SSD partition, so I would like to use `fstrim`. Should I call `fstrim` on each mountpoint (corresponding with different subvolume each) ? Or do I need to have btrfs root mounted and run `fstrim` on this mountpoint?


Confused about the purpose of MESA with proprietary nVidia drivers

Since a MESA upgrade today (10.2.5-1 -> 10.2.6-1 in Debian Sid, which is _unbearable_ lately, keep away), I noticed 3D-dependant applications complaining about missing the software rasterizer `swraster` - `compiz` (standalone) won't even start any any more, glxgears is extremely choppy etc. Aside from the usual "fun" fixing this that I'm already in the middle of (pointers welcome, downgrading didn't work), this demonstrated me once again that I don't understand how 3D rendering works on Linux. So, my question is: Why is MESA even interacting with this - and why do I even need it installed? Isn't it a free implementation of the same things the proprietary nVidia drivers provide as well? Shouldn't any 3D use by X11 go directly to the proprietary drivers' APIs? On the project's site itself, they specify that they either interact with open source drivers (`nouveau` in this case, which doesn't support my card), or do things in software, which I obviously do not want. My nVidia drivers were installed through sgfxi, i. e. not from Debian's packaging system, but I don't think this would make a difference - for instance, libcairo2 rigidly specifies it needs MESA, period. (And also, why do I need to ask these question to simply run a 3D application...) If this is what's happening, it would explain why my performance in 3D games is so absolutely frustrating, but I somehow can't believe that things are _this_ counterintuitive...


How do I make the CLI run on dedicated graphics?

I just finished my Gentoo minimal install and the first thing I wonder is why I get no picture. I did have signal on the live CD, so that was pretty odd. I plugged the monitor into the Intel HD Graphics HDMI output instead, and there was my picture. There's just this issue, I have 3 monitors. I need the AMD drivers, so I go ahead and install the proprietary ones, because I have the best experience with those. In order to do that, I had to recompile the kernel with some settings off and on to enable the AMD KMS. I have no idea what it is, but it worked fine following this guide (for my Sapphire Radeon HD 7970). I'm aiming to install XFCE 4, so I also had Xorg installed.               emerge xorg-server ati-drivers      I ran `startx` and got the picture I expected on the monitor plugged into the Intel HD port. Now I stopped the x-server again and ran `aticonfig --initial` and rebooted. I already know that aticonfig only updates xorg.conf and when I started x again it appeared on the correct monitor. The only thing bothering me now is that the CLI before starting x is STILL on the integrated graphics monitor. How do I get this sent to the dedicated graphics card as well?


How can I find the amount of memory consumed by a process?

How can I find the amount of main memory consumed by a process using `ps aux`? I have a process which runs for half an hour. Is it possible to find the maximum amount of main memory consumed by it using `ps aux`? I tried to run `ps aux` but it only gives me the amount of memory consumed at the time I ran it. I do not see how I can find the maximum amount of main memory consumed by the process. One option is to run `ps` again and again and to keep looking at the output. I do not find that option feasible enough. Is there any other way out in Linux?


unable to change window name openbox

I am using openbox and usually, I have a lot of windows on the screen. One window for the browser and a couple of windows to run a few terminals. The problem is that, when they are minimized, I am not able to figure out what I was doing in which terminal and having to open each terminal to check and see what I was doing is too cumbersome and time consuming. Not to mention, it also disrupts the flow of work. I mostly spend my time programming. So I thought, it would make sense to change the name of the window in the title bar so that I can see what I was doing in it even when it is minimized. But unfortunately, openbox does not provide an option to change the name in the title bar of the window or maybe it does and I don't know. I've googled and I couldn't find anything that could help me. I would like to know if there is a way to change the title of a window in its title bar so that I can see what I was doing in it, even when it is minimized. Thank you.


understanding "mount" as a concept in the OS

I want to understand what _mounting_ is. It is used in different contexts and situations and I can't find resources which:   1. Describe the **mount** concept   2. Explain the actions taken by the computer/OS/utility when a **mount** is performed   3. How and in which situations **mount** is used   4. Which features in the Linux **mount** command are of frequent use and some examples ( I hear **mount** applied to diverse entities directories, flash drives, network card, etc )


What is the preferred way to install new versions of software?

I have installed Ubuntu Server 10.10 and now I want to install some software like PostgreSQL, Nginx and PHP. But what is the preferred way to get the latest stable version of the software? E.g I tried with `sudo apt-get install postgresql` but that installed version 8.4 of PostgreSQL but 9.0.1 is the latest version. I have had this issue before with NginX. The solution was then to download the sourcefiles and compile the latest version which took some time. Later a friend told me that wasn't a preferred way to install software. Any recommendations?


Why some gnome-terminal tabs look depressed

On my Ubuntu 12.04 Linux 3.2.0-43-generic system with AMD Athlon 64 X2 5000+ cpu, with Unity desktop, ubuntu-2d desktop-session, and Metacity window manager, some of the tabs on a GNOME Terminal 3.4.1.1 display look like depressed buttons, while others don't. The appearances when I click a tab and then click in the pane are illustrated below (in five pictures, for five tabs left to right). ![tab 1021](http://i.stack.imgur.com/bmcVq.jpg) ![tab sp](http://i.stack.imgur.com/zFgdw.jpg) ![tab bc](http://i.stack.imgur.com/oW5sf.jpg) ![tab py](http://i.stack.imgur.com/x6Zq0.jpg) ![tab ipy --pylab](http://i.stack.imgur.com/utG6N.jpg) When the pane for tab 1021 is in use (first picture), the sp tab looks like a depressed (or perhaps selected) button. When the pane for tab sp is in use (second picture), other tabs properly look unselected. When the pane for tab py is in use(fourth picture), the ipy --pylab tab looks selected, and vice versa. Question: Why are some tabs displaying differently than the others? Note, for reference the picture below shows the appearance after the sequence of clicking the ip --pylab tab and then the 1021 tab (without clicks in panes). ![enter image description here](http://i.stack.imgur.com/lWVN9.jpg)


the use for echo without argument in shell scripting

I have a following bash script I encountered on the web that prints the power set of a given lines of elements.               p() { [ $# -eq 0 ] && echo || (shift; p "$@") |             while read r ; do echo -e "$1 $r\n$r"; done }      after the first `&&` there is `echo` that does not have any argument. Here is the code to test it:               p $(echo -e "1\n2\n3")


How to echo output of multiple commands into md5sum?

Okay so I have a somewhat large file (~200 meg) that I need to regularly hash to see if it has changed. The catch is that there are two small fields in this file which must be ignored as they may change. Each of these fields has a known and fixed offset and size. I have got this working using three cmp commands, however because this needs to be done regularly I'd like to do it in the most efficient way possible. Also it is problematic to have to store a backup copy of the file, and would be much better to just store a hash to compare against. So far the closest I've got is something like this: dd read from start of file up to offset of first field | md5sum dd read from end of first field up to start of second field | md5sum dd read from end of second field to end of file | md5sum Is there any way I can redirect the output of all three of those dd commands into one md5sum instance so I can get a single hash out? I'd rather not have the three dd commands write into a temp file and then hash that as it would be a lot of I/O. I'd like to do it as efficiently as possible. Any suggestions would be greatly appreciated!!


When should I use input redirection?

I used the following two commands to produce the same results:-               [root@localhost ~]# grep line comments     The line should start with a single quote to comment in VB scripting.     Double slashes in the beginning of the line for single line comment in C.     [root@localhost ~]#          [root@localhost ~]# grep line <comments     The line should start with a single quote to comment in VB scripting.     Double slashes in the beginning of the line for single line comment in C.     [root@localhost ~]#      Could any please explain to me any pros/cons if any of these 2 approaches over each other.


Drivers for GMA 4500MHD

~$ lsmod | grep ^i915 ## i915 296139 3 2:2.15.0~maverick~ppa1 **(xserver-xorg-video-intel)** ## from https://launchpad.net/~glasen/+archive/intel- driver?field.series_filter=maverick ~$ vainfo libva: libva version 0.31.0 libva: va_getDriverName() returns 0 libva: Trying to open /usr/lib/dri/i965_drv_video.so libva: va_openDriver() returns -1 ## vaInitialize failed with error code -1 (unknown libva error),exit libva1 1.0.1-3 ~$ glxinfo | grep OpenGL OpenGL vendor string: Tungsten Graphics, Inc OpenGL renderer string: Mesa DRI Mobile Intel® GM45 Express Chipset GEM 20100330 DEVELOPMENT x86/MMX/SSE2 OpenGL version string: 2.1 Mesa 7.9-devel OpenGL shading language version string: 1.20 OpenGL extensions: ## ~$ lspci -ks `lspci|grep VGA|awk '{print $1}'` 00:02.0 VGA compatible controller: Intel Corporation Mobile 4 Series Chipset Integrated Graphics Controller (rev 07) Subsystem: Dell Device 02aa Kernel driver in use: i915 Kernel modules: i915 grep Matched /var/log/Xorg.0.log [ 21.151] (==) Matched intel as autoconfigured driver 0 [ 21.151] (==) Matched vesa as autoconfigured driver 1 [ 21.151] (==) Matched fbdev as autoconfigured driver * * * i965-va-driver 1.0.1-3 (libva-driver-i965) - IS NO INSTALLED is driver with support for hardware acceleration YES ? Can I install this driver, if it is for i965? I use _lsmod | grep ^i915 i915_ If I want to install the driver with support for hardware acceleration, should I remove xserver-xorg-video-intel driver ? libva1 - is not driver ?


Why does TZ=UTC-8 produce dates that are UTC+8?

The current time in Los Angeles is 18:05. But when I run `TZ=UTC-8 date --iso=ns`, I get:               2013-12-07T10:05:37,788173835+0800      The date utility tells me that the time is 10:05, and even says that it's reporting it as UTC+8. Why?


Generating server and client certificates with multiple hostnames

When starting up my Puppet Master for the first time, it automatically generates its own server certificate, which is awesome. My server's hostname is `kungfumaster` and the Puppet Master generates a certificate with the common name being:               kungfumaster.mynetwork.com      It also adds the following as subject alternative DNS names:               X509v3 Subject Alternative Name:         DNS:kungfumaster.mynetwork.com, DNS:puppet, DNS:puppet.mynetwork.com      I don't exactly know how it found out that this domain lives in `mynetwork.com`, though it does, as `hostname` doesn't reveal the FQDN with any parameter configuration. However, the one name it seems to have missed is the unqualified host name `kungfumaster`. Interestingly enough, it did append a domain for `puppet` and `puppet.mynetwork.com`, but it conveniently skipped `kungfumaster`. In my startup script for Puppet Master, how do I generate the server's certificate properly, ie: with all of the required DNS names?


Looking for a simple X Window panel/dock with icon "pinning" feature from Windows 7

I am using OpenBox WM and I am looking for some simple dock application (that could be used along with OpenBox) that has this icon "pinning" feature. It can also be a panel. So far I have found this:   * Docky - it's fine but it needs compositing manager   * wbar - compiles but isn't working for me (does not appear), and I am not sure if it has the "pin" feature Any other tools that can do this?


Why can't my Debian received much wifi-signal

My wireless connection is always broken, and it can't receive good signal. I am not sure if the wireless driver caused it.   Is my wireless driver too old? Or there are some other reasons?   My mobile can receive great signal, and my hardware is good too.   Can anyone help me? ## System version   * Distributor ID: Debian   * Description: Debian GNU/Linux 7.4 (wheezy)   * Release: 7.4   * Codename: wheezy   * 64bit ## ifconfig               eth0             Link encap:Ethernet HWaddr a0:b3:cc:17:3a:26 inet6 addr: fe80::a2b3:ccff:fe17:3a26/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500      Metric:1 RX packets:754884 errors:0 dropped:1 overruns:0 frame:0 TX packets:653093 errors:0 dropped:0 overruns:0 carrier:0 collisions:0      txqueuelen:1000 RX bytes:1076885286 (1.0 GiB) TX bytes:69749589 (66.5 MiB) Interrupt:41 Base address:0x2000          lo             Link encap:Local Loopback     inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436      Metric:1 RX packets:30743 errors:0 dropped:0 overruns:0 frame:0 TX packets:30743 errors:0 dropped:0 overruns:0 carrier:0 collisions:0      txqueuelen:0 RX bytes:19489860 (18.5 MiB) TX bytes:19489860 (18.5 MiB)          ppp0             Link encap:Point-to-Point Protocol inet addr:39.64.129.250 P-t-P:39.64.128.1 Mask:255.255.255.255 UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492      Metric:1 RX packets:754106 errors:0 dropped:0 overruns:0 frame:0 TX packets:652283 errors:0 dropped:0 overruns:0 carrier:0 collisions:0      txqueuelen:3 RX bytes:1060248214 (1011.1 MiB) TX bytes:55370661 (52.8 MiB)          wlan0              Link encap:Ethernet HWaddr 08:ed:b9:5b:a2:fc     inet addr:10.201.139.226 Bcast:10.201.159.255 Mask:255.255.224.0 inet6 addr: fe80::aed:b9ff:fe5b:a2fc/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500      Metric:1 RX packets:28 errors:0 dropped:0 overruns:0 frame:0 TX packets:155 errors:0 dropped:0 overruns:0 carrier:0 collisions:0      txqueuelen:1000 RX bytes:2269 (2.2 KiB) TX bytes:29331 (28.6 KiB)      ## iwconfig               wlan0        IEEE 802.11bgn ESSID:"CMCC"     Mode:Managed Frequency:2.462 GHz Access Point: E4:68:A3:78:8C:30     Bit Rate=1 Mb/s Tx-Power=19 dBm     Retry long limit:7 RTS thr:off Fragment thr:off Encryption key:off Power Management:off Link Quality=21/70 Signal level=-89 dBm     Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:9 Invalid misc:1 Missed beacon:0          eth0             no wireless extensions.      ## Device dirver check & report               PCI ID             14e44727     works?             Yes     vendor             Broadcom Corporation     device             BCM4313 802.11b/g/n Wireless LAN Controller     driver             brcmsmac     Kernel     v2.6.38-


Single CD install of a RHEL-like distribution?

Can someone suggest a RHEL-like distribution that can install from a single CD? I am looking for a distribution where services are started from `/etc/init.d`, environment variables are set from scripts in `/etc/profile.d` and so-on (meaning that Ubuntu doesn't do the job). A network installer isn't an option... I think in terms of the OS's behaviour, CentOS would do the trick, except I can't find a single CD installation. Any suggestions?


What is a sure fire way to find all files and/or path that contains 2 keywords?

I was doing a               find . -iname '*sitesearch*' | grep demo      because I know the file should be `some/path/SiteSearch/demo/SiteSearch.html`, but it turned out a person put the file in as `some/path/SiteSearch/demo/index.html`, so the file cannot be found. Is there a better way to do the search? Such as for this case, if I do               find . -iname '*demo*' | grep -i sitesearch      it would have found it. But I don't want to always THINK what possibility it is and figure out what pattern to use. I just want a way that whenever the file and path have both of these 2 keywords, then print it out. For example, if there is a way to `ls` all files will the full path on each line, then we can do               ls --some-flags | grep -i demo | grep -i sitesearch      or maybe another way / better way.


Use HERE file and redirect output of command

I have the following code in a batch script:               mpirun -np 6 ./laplace <<END     100     100     100     0.01     100     3     2     1     END     | tail -n 1 > output      But it isn't working. What I want it to do is to use the HERE file as input to the mpirun command, and then pipe the output to the tail command. However, I think the HERE file and tail output things are getting confused. How should I write this so that it does what I want?


Why doesn't my new cygwin .bashrc interactive check work?

I just updated Cygwin and the new `.bashrc` contains this line right at the top:               echo "BEFORE TEST"     # If not running interactively, don't do anything     [[ "$-" != *i* ]] && return     echo "AFTER TEST"      I understand if not running interactive, you don't need to do anything, but my problem is that if I `ssh` with a command:               ssh localhost pwd      I see this:               BEFORE TEST      So, obviously, it fails the `[[ "$-" != *i* ]]` test and returns. Obviously `ssh localhost pwd` is a trivial example, but I expect `.bashrc` to be run all the way through if running a command through `ssh`. My actual automation runs commands remotely against this cygwin instance and is failing because the path (which is set by my `.bashrc`) is not getting set correctly. Furthermore, can anyone explain what that test is actually doing? What is `i`? What is `$-` supposed to represent?


Arch Linux: "error: failed to commit transaction (conflicting files)"

I'm trying to install an Arch system, and every time I run `pacstrap /mnt base base-devel` I get               error: failed to commit transaction (conflicting files)     filesystem: /mnt/lib exists in filesystem     ==> ERROR: Failed to install packages to new root      I checked the beginner's guide on the ArchWiki and as far as I'm concerned I'm not doing anything wrong, but I do have 7 GPT partitions, one of them mounted to `/mnt/lib`


How frequently are updates sent to a VNC client?

I am trying to understand how the VNC mechanism works. The RFB protocol 3.8 specifications say : > The update protocol is demand-driven by the client. That is, an update is > only sent from the server to the client in response to an explicit request > from the client. This gives the protocol an adaptive quality. The slower the > client and the network are, the lower the rate of updates becomes. With > typical applications, changes to the same area of the framebuffer tend to > happen soon after one another. With a slow client and/or network, transient > states of the framebuffer can be ignored, resulting in less network trafﬁc > and less drawing for the client. It seems that this implies that the server will only ever send a `FramebufferUpdate` if the client sends a `FramebufferUpdateRequest`. Then the client must be sending these packets at a regular interval. However, when I analyzed through wireshark, I observed that this was not the case. When there was no screen or pointer activity, I did not see any packets from the client to the server. When I created some screen activity on the screen without involving the client, (I ran `xclock` by setting display to that value) the first message was from the server to the client and not a request from the client. So my question is: **Is it indeed true that the server will only send updates if the client requests them and not every time there is screen activity?** What is the frequency of updates in either case?


DD-WRT: dhcp6c not fetching new address for ppp0

I'm currently trying to configure my DD-WRT-based router to do IPv6. Now I'm at a point where it works fine - until the line is disconnected and reconnects (which happens at least every 24h... for a country renowned for its engineering, Germany is still surprisingly backwater when it comes to internet). Not giving out static IP addresses, my provider requires me to fetch the configuration using DHCPv6, which I then propagate into to my localnet. But when `ppp0` is disconnected and reconnected, `dhcp6c` does not fetch a new address and subsequently `radvd` does not advertise the change. I created a script `/jffs/etc/config/ipv6.ipup` which restarts all the associated services and it works when I invoke it manually. So even though the documentation says that all `*.ipup` scripts in that directory should be automatically invoked when the configuration state of the WAN interface changes, it's apparently not happening. Preferably I'd have `dhcp6c` and `radvd` notice the change automatically without completely restarting them, but if you know how any way to solve this configuration, I'd be grateful for any tips.


Where to find acpi mailing list?

Was this mailing list dead: Acpi-devel -- Defunct ACPI Development Discussion List What other source can I utilize , just want to find the developers of `acpid`


vmlinuz and initrd not found after building the kernel?

After configuring and building the kernel using make, why don't I have `vmlinuz-<version>-default.img` and `initrd-<version>.img`, but only got a huge `vmlinux` binary (~150MB)?


change boot order

I have 2 partitions `sda1` XP and `sda2` CENTOS. I have reinstalled `grub` on `/dev/sda` but on rebooting, I experienced: `error : 22 no such parition` for Centos; while Windows boots charmingly on the other. `fdisk -l` gives `sda1` as boot, is there a possibility that I can change it to `sda2` on `shell`, since I am on rescue mode.


How can I setup a wifi access point to only allow users if they accept an EULA?

I need to setup an access point to only allow users through if they first accept an EULA. To make things slightly simpler, I'm looking into doing this with a unix machine that shares the connection from ethernet to people on wifi. What would be the best way to approach this ? I was thinking at   * redirecting all new http connections to the EULA page and once the user clicks ACCEPT, adding ip+mac in a table and filtering everything else   * Redirecting with dnsmasq (though I have no idea how to make it stop redirecting once the user clicks accept) Any advices ?


Maximum password length

Is there a maximum password length on unix systems? If so, what is that limit and is it distribution dependent?


24 hour crash course in ZFS... some final questions

Due to various circumstances I've given myself a crash course on the ZFS file sytem. I need some help getting comfortable with the unknowns. Whatever those are. Data:   * Running www.zfsonlinux.org on CentOS 6.2    * I have an array with 12x2TB sata disks.    * I created a raidz2 pool and a couple zfs file systems inside that.    * Performance is better than I expected. (How often do you get to say that?) Some questions:   * What type of maintenance should I schedule? I have read that doing a "zpool scrub" is advised. At what interval would you run this? Is there anything else to do?   * Is there any performance monitoring other than "zpool iostat" - snmp?    * I need to be alerted by email or similar about disk failures, etc.... What are my options?


Autodetect modem in Linux?

Is there a way to autodetect modem devices in Linux and then symlink them to `/dev/modem` using a udev rule? Currently, I wrote a program that probes each serial port, sending `AT` and waiting for `OK`. I have a udev script that runs this for every ttyS and ttyUSB device. However, I've now been informed that there's other devices, such as OBD-II diagnostic bridges, that also speak with AT commands.


How to recover NTFS drive formatted in ext4?

I just installed Linux Mint 17 and when it asked me where to install it I selected the option to overwrite the old Mint 14. Previously I had also windows with NTFS partition of 900GB. Not it is all formatted into ext4 and all the information of almost 800GB is lost. Please advise what I can do in this situation. It was light format so there should be a way to recover some of the info I have lost. Is it a good idea to format back to NTFS and try some recovery programes or something like HIREN CD?


How to check and block processes connecting to internet directly?

Is there a way to find which processes in my system are getting connected to net automatically. Is there a way to select and block net access of some processes permanently? I use mint 11. I use a USB datacard.


pulse-audio does not recognise my Logitech mic and my Webcam mic

I use the (great) AK5370 microphone for Skype, but it is not recognized by my archlinux i86_64. It also fails to recognize the mic on my Logitech Webcam (PTZ, which I do not use). Both are connected through the monitor's built-in hub, and both work through hubs an another system. Both work on the same hardware with Ubuntu and Windows. Here they are on lsusb…                ~]# lsusb     Bus 001 Device 002: ID 03f0:2524 Hewlett-Packard LP3065 30" Monitor Hub     Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 001 Device 003: ID 1532:001c Razer USA, Ltd RZ01-0036 Optical Gaming Mouse [Abyssus]     Bus 001 Device 004: ID 04ca:002a Lite-On Technology Corp.      Bus 001 Device 005: ID 0556:0001 Asahi Kasei Microsystems Co., Ltd AK5370 I/F A/D Converter     Bus 001 Device 006: ID 046d:08cc Logitech, Inc. Mic (PTZ)      But not on aplay's list-devices...               ]$ aplay --list-devices     **** List of PLAYBACK Hardware Devices ****     card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]       Subdevices: 0/1       Subdevice #0: subdevice #0     card 0: NVidia [HDA NVidia], device 3: ALC1200 Digital [ALC1200 Digital]       Subdevices: 1/1       Subdevice #0: subdevice #0     card 1: NVidia_1 [HDA NVidia], device 3: HDMI 0 [HDMI 0]       Subdevices: 1/1       Subdevice #0: subdevice #0     card 1: NVidia_1 [HDA NVidia], device 7: HDMI 0 [HDMI 0]       Subdevices: 1/1       Subdevice #0: subdevice #0     card 1: NVidia_1 [HDA NVidia], device 8: HDMI 0 [HDMI 0]       Subdevices: 1/1       Subdevice #0: subdevice #0     card 1: NVidia_1 [HDA NVidia], device 9: HDMI 0 [HDMI 0]       Subdevices: 1/1       Subdevice #0: subdevice #0     card 2: NVidia_2 [HDA NVidia], device 3: HDMI 0 [HDMI 0]       Subdevices: 1/1       Subdevice #0: subdevice #0     card 2: NVidia_2 [HDA NVidia], device 7: HDMI 0 [HDMI 0]       Subdevices: 1/1       Subdevice #0: subdevice #0     card 2: NVidia_2 [HDA NVidia], device 8: HDMI 0 [HDMI 0]       Subdevices: 1/1       Subdevice #0: subdevice #0     card 2: NVidia_2 [HDA NVidia], device 9: HDMI 0 [HDMI 0]       Subdevices: 1/1      note: card0 mobo card1&2 nvidia graphics (not used) PulseAudio Volume Control reports "No input device available". No problem with these devices on other systems Alas... pulseaudio 3.0-3 pavucontrol 2.0-1 skype 4.2.0.11-1 alsa-lib 1.0.27.1-1 * * * Note: the webcam (UVC) with the min (PTZ) is recognized and works. * * * Per _Ignacio Vazquez-Abrams_... (thanks)               ~]$ lsmod | grep '^snd' | column -t     snd_usb_audio          112569  0     snd_usbmidi_lib        18931   1   snd_usb_audio     snd_rawmidi            18742   1   snd_usbmidi_lib     snd_seq_device         5180    1   snd_rawmidi     snd_hda_codec_hdmi     29298   8     snd_hda_codec_realtek  30893   1     snd_hda_intel          35816   4     snd_hda_codec          145704  3   snd_hda_codec_realtek,snd_hda_codec_hdmi,snd_hda_intel     snd_hwdep              6364    2   snd_usb_audio,snd_hda_codec     snd_pcm                76860   4   snd_usb_audio,snd_hda_codec_hdmi,snd_hda_codec,snd_hda_intel     snd_page_alloc         7330    2   snd_pcm,snd_hda_intel     snd_timer              18687   1   snd_pcm     snd                    58893   19  snd_hda_codec_realtek,snd_usb_audio,snd_hwdep,snd_timer,snd_hda_codec_hdmi,snd_pcm,snd_rawmidi,snd_usbmidi_lib,snd_hda_codec,snd_hda_intel,snd_seq_device      And in addition...               ]# ls -l /dev/snd     total 0     drwxr-xr-x  2 root root      100 May 24 10:07 by-path     crw-rw----+ 1 root audio 116,  8 May 24 10:07 controlC0     crw-rw----+ 1 root audio 116, 17 May 24 10:07 controlC1     crw-rw----+ 1 root audio 116, 26 May 24 10:07 controlC2     crw-rw----+ 1 root audio 116,  7 May 24 10:07 hwC0D0     crw-rw----+ 1 root audio 116, 16 May 24 10:07 hwC1D0     crw-rw----+ 1 root audio 116, 15 May 24 10:07 hwC1D1     crw-rw----+ 1 root audio 116, 14 May 24 10:07 hwC1D2     crw-rw----+ 1 root audio 116, 13 May 24 10:07 hwC1D3     crw-rw----+ 1 root audio 116, 25 May 24 10:07 hwC2D0     crw-rw----+ 1 root audio 116, 24 May 24 10:07 hwC2D1     crw-rw----+ 1 root audio 116, 23 May 24 10:07 hwC2D2     crw-rw----+ 1 root audio 116, 22 May 24 10:07 hwC2D3     crw-rw----+ 1 root audio 116,  6 May 24 10:07 pcmC0D0c     crw-rw----+ 1 root audio 116,  5 May 24 14:51 pcmC0D0p     crw-rw----+ 1 root audio 116,  2 May 24 10:07 pcmC0D2c     crw-rw----+ 1 root audio 116,  4 May 24 10:07 pcmC0D3c     crw-rw----+ 1 root audio 116,  3 May 24 10:07 pcmC0D3p     crw-rw----+ 1 root audio 116, 12 May 24 10:07 pcmC1D3p     crw-rw----+ 1 root audio 116, 11 May 24 10:07 pcmC1D7p     crw-rw----+ 1 root audio 116, 10 May 24 10:07 pcmC1D8p     crw-rw----+ 1 root audio 116,  9 May 24 10:07 pcmC1D9p     crw-rw----+ 1 root audio 116, 21 May 24 10:07 pcmC2D3p     crw-rw----+ 1 root audio 116, 20 May 24 10:07 pcmC2D7p     crw-rw----+ 1 root audio 116, 19 May 24 10:07 pcmC2D8p     crw-rw----+ 1 root audio 116, 18 May 24 10:07 pcmC2D9p     crw-rw----  1 root audio 116,  1 May 24 10:06 seq     crw-rw----+ 1 root audio 116, 33 May 24 10:07 timer


How to fix Mint 16 Desktop crash/freeze after adding second toolbar and enabling/disabling monitor?

My operating system is Mint 16, forgot what flavor, probably KDE. My desktop crashed after I connected a second monitor, added a second toolbar to the second monitor and then disable the monitor, and then rebooted. After I rebooted, my desktop is now frozen, with a fuzzy blank toolbar. I forgot what the command is to open up the terminal outside of the desktop environment. The last time this happened to me, my friend explained to me that two desktops were running at the same time and a "watcher" program was disabling the second desktop environment while a "checker" was re-enabling the second desktop environment at the speed of the computer clock. My conky reports a 100% CPU usage, though I forgot to check the name of the top running programs. The power block was reporting 95 watts continuous. How do I fix my Mint 16 Desktop crash/freeze after adding a second toolbar and enabling/disabling monitor?


openSUSE Linux Kiosk Setup

Working on setting up a kiosk with openSUSE, where users can only view a single webpage. Obviously open to any Linux distro. Also would prefer to use Gnome. I'm wanting only Firefox to be available (which will be displaying a local webpage), a link on the desktop and the home page to open full screen when booted up and logged in automatically. Just interested in some guidance, or if there are any tools that could be used to 'lock down' the system. Thanks!


How to use the "source" command to do parallel computing?

For example, I have an executable called `ex01` (C++ program). And I have a text file that contains a set of invocations of this program with different arguments. The text file looks like this:               ./ex01 command1 > ex.dat  &     ./ex01 command2 >> ex.dat &     ./ex01 command3 >> ex.dat &     ...      I can use the `source` command to do this task automatically. But I was hoping to do this in parallel. How can I do that?


Installing a gedit plugin on Fedora

I have been trying to install a gedit plugin called RunC to compile C programs using the text editor. Although the instructions tell me to use ubuntu 9 or 10 for this, I'm currently running Fedora 16. I thought that I would not have much problems, but after running the shell script using the sh command to install the plugin, gedit showed no signs of the plugin being installed. I've made sure that gedit is updated to the current release. Is there something I'm missing from this installation? Additionally, does the file structure of various distributions differ greatly from each other? Will scripts that work for one distro be incompatible with another? Thanks for indulging me with my silly questions. Attached below is the RunC plugin for gedit: http://plg1.uwaterloo.ca/~gvcormac/RunC/


How to determine which sd* is usb?

> **Possible Duplicate:**   >  How to know if /dev/sdX is a connected USB or HDD? The output of `ls /dev/sd*` on my system is -               sda  sda1  sda2  sda3  sda4  sda5  sda6  sda7  sdb  sdc  sdc1  sdc2      How should I determine which drive is which?


Initramfs post-update hook

I need an initramfs hook to call a script after an initramfs has been generated. The Debian Linux Kernel Handbook mentions `/etc/initramfs/post-update.d/`: > Packages for boot loaders that need to be updated whenever the files they > load are modified must also install hook scripts in `/etc/initramfs/post- > update.d`. […] The arguments given to these hook scripts are the kernel ABI > version and the absolute path to the initramfs image. This is exactly what I need, but this directory doesn't exist on my system. Though the directory `/etc/initramfs-tools/` exists, but it doesn't contain a `post-update.d`. Where is the correct place to hook in such a script? OS: Debian sid


Installing a .deb package on Arch - Is it possible?

The problem is simple - I have a .deb package and I want to install it on my Arch Linux. Is this possible? If yes, how?


How to assign tasks to GPU

I have found a benchmark from computerbase.de (http://www.computerbase.de/artikel/grafikkarten/2013/intel-haswell-grafik- fuer-desktop-pcs-im-test/3/ in german) where in one case a task (here video transcoding) is done by the CPU and in the other case by the (integrated) GPU: ![enter image description here](http://i.stack.imgur.com/NlRjz.png) How can I assign a task (for example video transcoding) explicitly to the GPU in linux?


Debian Wheezy live - gparted, dmsg, fdisk etc. do not detect local hard drive but it is shown during installation

Yesterday I finished backing up my data and it was time to wipe that HDD of mine for good and freshly install Debian Wheezy stable with **Xfce** as a WM. I've booted into a live session to see if things like sound, wireless etc. work and they did without a problem. However I was surprised that after I installed gparted (again: live session) I was facing a single partition with approx 7.5GB (the size of my USB key). Okay, it automatically shows the device where the OS is booted from. However when I looked at the drop-down menu (top right) for selecting a device I saw that only **/dev/sda1 (7.48GB)** was available. No local hard drive at all. I opened the terminal and did               dmsg | less      after that               df -h      and finally               sudo  fdisk -l      but all was in vain. The only thing that I'm looking at was my USB key and that's all. Then I decided to see how the installation goes and if the same issue occurs. For my (delightful) surprise when I got to the _Detecting hardware_ and then to the _Partition hard disks_ part there it was - almost 500GB of space. The only thing that's bothering me is the amount of time the formatting takes. Is it normal for a 3 hours of formatting to do only 13% of the 500GB? I remember clearly when I installed Ubuntu 12.04 LTS years ago that it took much less even though back then I also had a dual boot with Win7 and multiple other partitions so the formated space was like 200GB. That's the reason why I wanted to use gparted in a live session in the first place because gparted is usually pretty fast when wiping stuff and at least that I could do in order to boost the installation process of my Debian. Any ideas why gparted, fdisk etc. are not showing my hard disk? I also clearly remember that back then when I installed Ubuntu I also checked the situation with gparted. Even though it was again a live session, everything showed as expected - both USB key and HDD.


Oldest binary working on Linux?

In a discussion on backwards-compatibility in Linux kernel and GUI ABIs, Alan Cox notes that " _my 3.6rc kernel will still run a Rogue binary built in 1992. X is back compatible to apps far older than Linux._ " So just how backwards-compatible are the Linux Application binary interfaces? _What is the oldest binary executable, actually written and compiled years ago, that will still run on a modern stock general-purpose Linux distribution?_ I'm sure all those words are subject to interpretation. My main notion is that it is not fair to run it via an emulator or specialized virtual machine or binary translator, but some such things are probably built into some modern distros, and learning about that is part of the fun here. Variations by hardware architecture, executable file format, language, and major library dynamic loading dependencies are also of interest. Note, when the rules are relaxed, here's one example of going further back. The 2002 web page Running a.out executables on modern Red Hat Linux talks about using _really_ old Linux pre-ELF a.out-format executables after doing `modprobe binfmt_aout` and obtaining `/lib/ld.so` and `libc.so.4` Again that's of peripheral interest for this question, but illustrates the sorts of things that can be involved when digging further back. **Update** for you BSD fans, it's great to see that iBCS2 was supporting old Xenix apps (like zork/dungeon-2.5.6 from 1990) and SCO OpenServer 5.0.x apps as recently as NetBSD 4.0.1 (from 2008): iBCS2 & NetBSD | Fun with virtualization. But the same thing seems broken in NetBSD 5.0.x. **Update 2** : One year later, after even getting an "Announcer" badge for this question, I'm still looking for an answer. And to clarify, since this is about APIs, it should be a "real" binary (non-zero length), that still at least mostly works in the original way.


PPTP with dhcp only for clients

I have a local network at home with a router and a small server. The router manages the local network (DHCP, etc) but does not support PPTP. On the server (Ubuntu 12.04) I set up pptpd and this is working fine ... except that the dhcp3 server started by pptpd is now conflicting with the router. My other systems get answers from two DHCP servers - and not all of them are able to handle it properly (namely my Android tablet). I have no idea where to start fixing this (except using static IP addresses for my VPN). Any ideas would be appreciated.


Find FreeBSD ports that depend on another port

I have a headless FreeBSD server where some port has installed tons of X11-related packages. I would like to find out what these ports are so I can get rid of the unwanted X-related packages. Is there a way to figure this out?


What is the best way to find a list of several strings within a large text file

The short, general question is: In Unix/Linux, what is the best way to find a list of several (about 150) strings within a large text file? I am asking this to all Unix/Linux experts as a general question, in the hopes that I can find a solution that pertains to my particular case: I have a feeling this is going to take a little tinkering. I have a large text file (actually, an MVS dataset) on an IBM Unix System Services (USS) machine-- I believe it is somewhere around 6GB. I also have a list of about 150 5-character identifiers in the format AAAAA that I need to find within this file-- that is, I'd like to extract rows from the file that contain any one of the 150 the specific identifers that I am looking for. The format of each line in the large file is:               00000000000A00000000000000000AAAAA\n      where 0 represents a digit, and A represents an alphanumeric character. The string that I'm searching for is always at the end of the row. Working with datasets seems to be a little awkward in USS, and I am not able to copy it over into the Unix environment because it is too large. The standard Unix utilities don't all operate on datasets (dd for example); however sed, awk, and grep seem to work to some degree (although the command line switches seem to be a bit different). I can grep the dataset as follows:               cat  "//'MVS.DATASET'" | grep -e"LOOKFOR1" -e"LOOKFOR2" -e"LOOKFOR3" > output_to_file.txt      However, it won't allow me to grep for all 150 items on one line; I could split it up and run it several times, but I feel like there should a better way. I tried using a sed script as follows, but I don't know sed at all, and I got an error that said "garbage after command". I saved the following in a file sed-script.txt:               s/AAA01/&/p     s/AAA30/&/p     s/AAA10/&/p     ... etc ...      and then ran `sed -f sed-script.txt "//'MVS.DATASET'"` Again, this failed with "sed: FSUM7294 garbage after command". So, 1. How would one normally tackle this problem in the "average" Unix environment, and 2. Do you have any specific insights to this particular case?


Problem creating a group in a repo : " yum-groups-manager: error: no such option: --default "

When you run:                yum groupinfo "Desktop"      you get 3 categories..   * Mandatory Packages   * Default Packages   * Optional Packages This is the command I ran:               yum-groups-manager -n "Desktop" --id=desktop --save=Desktop.xml \     --mandatory  \     NetworkManager \     NetworkManager-gnome  \     alsa-plugins-pulseaudio  \     at-spi  \     control-center  \     dbus  \     gdm  \     gdm-user-switch-applet  \     gnome-panel  \     gnome-power-manager  \     gnome-screensaver  \     gnome-session  \     gnome-terminal  \     gvfs-archive  \     gvfs-fuse  \     gvfs-smb \     metacity \     nautilus  \     notification-daemon  \     polkit-gnome  \     xdg-user-dirs-gtk  \     yelp \     --default  \     control-center-extra  \     eog  \     gdm-plugin-fingerprint  \     gnome-applets  \     gnome-media  \     gnome-packagekit  \     gnome-vfs2-smb  \     gok  \     openssh-askpass  \     orca  \     pulseaudio-module-gconf  \     pulseaudio-module-x11  \     rhn-setup-gnome  \     vino      This is the error message:               yum-groups-manager: error: no such option: --default      Why would this option not be available? Because if we are to run:                yum groupinfo "Desktop"      Here is the result:               Group: Desktop      Description: A minimal desktop that can also be used as a thin client.      Mandatory Packages:        NetworkManager        NetworkManager-gnome        alsa-plugins-pulseaudio        at-spi        control-center        dbus        gdm        gdm-user-switch-applet        gnome-panel        gnome-power-manager        gnome-screensaver        gnome-session        gnome-terminal        gvfs-archive        gvfs-fuse        gvfs-smb        metacity        nautilus        notification-daemon        polkit-gnome        xdg-user-dirs-gtk        yelp      Default Packages:        control-center-extra        eog        gdm-plugin-fingerprint        gnome-applets        gnome-media        gnome-packagekit        gnome-vfs2-smb        gok        openssh-askpass        orca        pulseaudio-module-gconf        pulseaudio-module-x11        rhn-setup-gnome        vino      Optional Packages:        sabayon-apply        tigervnc-server        xguest      As it can be seen, there is more than just the category called "mandatory". There is also "default" and "optional", and yet the attempt replicate this group fails above because it won't allow "default" category to be placed into the group that is being created. ### UPDATE I'm using CentOS Linux 6.4 desktop


NetworkManager connection sharing doesn't seem to NAT packets

After setting up network sharing the easy way on the Ubuntu machine, and getting an IP address via DHCP on the Arch Linux machine downstream, the Arch machine is able to `ssh` to the Ubuntu machine and resolve DNS, but not communicate with the Internet (`ping`, `pacman` time out). From the Arch Linux machine:               $ ip route show dev net0     default via 10.42.0.1 metric 202     10.42.0.0/24 proto kernel scope link src 10.42.0.15 metric 202     $ ip addr show dev net0     ...     inet 10.42.0.15/24 brd 10.42.0.255 scope global net0     ...      On the Ubuntu machine:               $ ip addr show dev eth0     2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000         link/ether e8:11:32:66:e3:4d brd ff:ff:ff:ff:ff:ff         inet 10.42.0.1/24 brd 10.42.0.255 scope global eth0         inet6 fe80::ea11:32ff:fe66:e34d/64 scope link             valid_lft forever preferred_lft forever     $ ip addr show dev wlan0     3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000         link/ether 88:53:2e:1b:4b:1c brd ff:ff:ff:ff:ff:ff         inet 192.168.1.64/24 brd 192.168.1.255 scope global wlan0         inet6 fe80::8a53:2eff:fe1b:4b1c/64 scope link             valid_lft forever preferred_lft forever      Could it be that the automatic NAT setup on Ubuntu failed? I'm not sure how that works, so how would I detect that?


If I have a netbook, is the output of xrandr relevant for buying a large external monitor?

I have a netbook I want to use in order to do some video editing. I am planning to buy a bigger, wider screen. Presumably even if the wider screen runs in a different resolution than my netbook screen, that should be OK. But I want to make sure that the screen I buy works well with the netbook.               linux-3g16:/home/me # lspci     00:00.0 Host bridge: Intel Corporation N10 Family DMI Bridge     00:02.0 VGA compatible controller: Intel Corporation N10 Family Integrated Graphics Controller     00:02.1 Display controller: Intel Corporation N10 Family Integrated Graphics Controller          linux-3g16:/home/me # xrandr     Screen 0: minimum 320 x 200, current 1024 x 600, maximum 4096 x 4096     LVDS1 connected 1024x600+0+0 (normal left inverted right x axis y axis) 223mm x 125mm        1024x600       60.0*+        800x600        60.3     56.2          640x480        59.9       VGA1 disconnected (normal left inverted right x axis y axis)      So that tells me that the maximum resolution I can expect to get is 4096x4096, right? But how do I list all available display modes. The screen I want may be wider than usual.


Select code block in vim

Given a code like this:               588          while ($linecounter > 0) {     589             $token = " ";     590             while ($token != PHP_EOL) {     591                 if (fseek($handle, $pos, SEEK_END) == -1) {     592                     $beginning = true;     593                     break;     594                 }     595                 $token = fgetc($handle);     596                 $pos--;     597             }     598             $linecounter--;     599             if ($beginning) {     600                 rewind($handle);     601             }     602         }      The cursor is at the character `=` in the line 590. Which is the most efficient way to select the code block:   1. lines 590-597   2. lines 591-596 (just the inner part)


Apache 70007 and 70014 errors

I have a service where mobile phones send a big hash of data to our server which are sitting on AWS behind the ELB. Once in a while we receive 70007 and 70014 errors in the apache error logs, the requests shows on apache access.log but not in rails logs. I'm trying to figure out what these errors are. Our Theory right now is the phone gets disconnected and it happens before the send us the requests so it never hit the rails server. Errors are the following:               Unexpected error in mod_passenger: An error occurred while receiving HTTP upload data: The timeout specified has expired (70007)     Unexpected error in mod_passenger: An error occurred while receiving HTTP upload data: End of file found (70014)      From all the googleing I've done, This is what I've got: 70014: end of file error, which makes total sense according to our theory. 70007: Time out. I put %D on apache log format and I get the time is between 10-90 seconds. Our Apache Timeout setting is 300 seconds. Also a lot of the requests takes longer than 10 seconds and they don't time out. I also thought it could be TCP timeout, but after investigating realized the TCP timeout is et to 7200 seconds; so that's not it either. Any idea what this could be? where else I should be looking?


Why can't I sed two [or more..] empty lines to one empty line? What is the trick?               echo -e "hello\n\n\nhello2" | sed 's/^$\n^$/\n/g'     hello               hello2


Regarding generating intersection and union of two csv files

I have two csv files, there are some overlap columns between these two files. Assume one file is called as A.csv and another is called as B.csv. The intersection of A and B is called as C. I would like to generate three new csv files: C; the subset of B after subtracting C from it, which is called as D; the union of A and D, which is called as E. Are there any ways to do that in Linux/Unix using command without applying heavy weight programming languages?


compare two files get identical list

file1.txt (50 lines)               TERYUFV00000010753     TERYUFV00000009526       file2.txt (500 lines)               TERYUFV00000009526 refids_739_known_8/10_target     TERYUFV00000018907 refids_12023_known_21/22_target     TERYUFV00000010753 refids_11775_known_1/1_target      Output.txt               TERYUFV00000010753 refids_11775_known_1/1_target     TERYUFV00000009526 refids_739_known_8/10_target      Compare file1.txt (has 50 lines) with file2.txt (has 500 lines), get the list from file2.txt which are identical to file1.txt. I tried both join & fgrep command and it outputs empty file


Why are some file changes not shown in tail -f?

I tried to follow the mysql history file with:               tail -f ~/.mysql_history      in another window I entered as the same user:               mysql -u someotheruser -p      and none of the following commands are shown in my tail. when I exit the mysql console there is still nothing shown in the `tail -f`, although, when I `cat` the history file, I see, that there are new entries at the end of the file


What is the :0 terminal in the who command's output?

When I type `who` in my console terminal, I get the following output:               hubert   :0           2014-05-16 21:40 (:0)     hubert   pts/0        2014-05-16 21:46 (:0)      From `info who` I know that both `:0` and `pts/0` should name instances of the terminal. It is clear to me what `pts/0` means but I have no idea how to interpret the first line of the output. What is even more confusing, when I type who `hubert :0`, I get:               hubert   pts/0        2014-05-16 21:46 (:0)


How can I hook functionality to the "go to line"-command in Vim?

I just got the idea that I wanted to make it so that Vim centered around a line when I jump to it. Is there a way to make `zz` be executed automatically after I have called the colon command followed by only digits (`:175` for example)?


pam ldap authentication an AWS EC2 ami (Amazon's ami)

I have some custom built instances running in AWS EC2 that are configured with ldap authentication. I have now brought up one of the AWS-provided EC2 AMIs, and am trying to configure it to work with pam authentication. This is a relatively straight forward configuration, but for some reason, pam / ldap is not working. Here's a quick summary of how I have configured the instance, anything obvious I am missing? Installed software (yum / rpm, over and above default, relevant to this setup): pam_ldap nss-pam-ldapd Configuration: /etc/ldap.conf - configured with a copy of an ldap.conf from my custom-built AMI - identical parameters. The following parameters are used (values omitted, only relevant config shown - excluding ssl / tls config stuff):               uri     timelimit     base     scope     suffix     ldap_version 3     binddn     bindpw     rootbinddn          pam_filter     pam_login_attribute     pam_member_attribute     pam_password     pam_check_host_attr          nss_base_passwd (x 2 of these)     nss_base_shadow     nss_base_group     nss_base_hosts          nss_initgroups_ignoreusers      /etc/nsswitch.conf               passwd:     files ldap     shadow:     files ldap     group:      files ldap      /etc/openldap/ldap.conf               URI ldap://my-ldap-server     BASE dc=organization,dc=com      /etc/pam_ldap.conf - this file is only on the AWS-provided AMI. I copied the config from /etc/ldap.conf to this file to try get things working /etc/pam.d/system-auth (showing context of +1 and -1 lines. Added lines indicated with a "+"):               auth        sufficient    pam_unix.so nullok try_first_pass     + auth        sufficient    pam_ldap.so use_first_pass     auth        requisite     pam_succeed_if.so uid >= 500 quiet          account     sufficient    pam_localuser.so     + account     [default=bad success=ok user_unknown=ignore] pam_ldap.so     account     sufficient    pam_succeed_if.so uid < 500 quiet          password    sufficient    pam_unix.so sha512 shadow nullok try_first_pass use_authtok     + password    sufficient    pam_ldap.so use_authtok     password    required      pam_deny.so          session     required      pam_limits.so     + session     optional      pam_mkhomedir.so skel=/etc/skel umask=0077     session     [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid     session     required      pam_unix.so     + session     optional      pam_ldap.so      To test, I try `getend passwd` or `getent group` and don't see any of my ldap- based entries. any ideas as to where I am going wrong? /var/log/messages and secure don't give any indication of errors.


Concatenate in a PDF the first page of several odt files alphabetically

I have, in the same directory, several odt files. I'd like to have in one PDF document the first page of these odt files, sorted alphabetically based on their filename. For example, if I have these files:   * `a.odt`   * `b.odt`   * `c.odt` I would have a resulting PDF that has 3 pages: the first one of `a.odt`, then the first one of `b.odt` and then the first one of `c.pdf`. Does any one of you think about a command to do that?


What do the fields in ls -al output mean?

The `ls -al` command shows the following output;               -rwxrw-r--    10    root   root 2048    Jan 13 07:11 afile.exe      What are all the fields in the preceding display?


how to mirror four monitors with 2 nvidia cards on debian?

I have 2 nvidia GeForce GT 610 video cards with 2 monitors plugged to each one of them. I can mirror the A and B and C to D but I want them all to show A. pleas help =)


Special character '#' in Perl SSH command

I try to send command using SSH in my perl script with # but it gets truncated right at # Example: Input text is :               $message = "Product ID # STK000134"      The SSH command is :               $execute=`ssh -q id@host /usr/message/send -pin $pager_num -message $message`;      What pass through is :               ssh -q id@host /usr/message/send -pin $pager_num -message Product ID       Instead of :               ssh -q id@host /usr/message/send -pin $pager_num -message Product ID # STK000134      How to I ensure that # and all text behind # will get through?


Why don't Linux terminal emulators support full colors?

I just upgraded my gnome-terminal to use 256 colors, yet I am a bit puzzled on the reason why a terminal emulator can't support the full palette any modern desktop environment provides. I guess there's a technical reason for this, but I am not aware of it.


Avoid reformatting bullet lists with formatoptions+=a

I am using Vim with `formatoptions +=a` as described in Vim: word wrap for documents to format lines automatically while I write documents, expecially Markdown documents. My problem is that Vim wants to reformat also bullet lists because there is blank line between each bullet point. What happes is that vim reformats               This is wath we will do:          * task 1,     * task 2,     * task 3.      into               This is wath we will do:          * task 1,   task 2,   task 3.      (I also do not understand why the asterisks disappear in this reformatting process.) How can I make Vim stop reformatting these lists?


Where to start to learn OpenGL

As OpenGL evolves, it seems that there are three camps:   * OpenGL legacy, packed with "deprecated APIs"   * OpenGL ES, for embedded systems   * OpenGL "new stuff" which comes out every couple of months. If I wanted to learn OpenGL for modern systems, where should I start? And most importantly, is there a reason to go beyond OpenGL ES for someone that has never done OpenGL before?


Accessing a remote OSX system from OSX, Linux, Windows

Is it possible to connect to a remote OSX machine using OSX, Linux or Windows in a way similar to Windows' remote desktop?


256 Colors in xterm and tmux [in FreeBSD 10]

So these past few days I am working to make Xterm and tmux show all the 256 colors available in them by default. I reach these conclusions:   * for tmux to show 256 colors you have to make xterm to show it.   * `export TERM=xterm-256color` in `~/.bashrc` make xterm to show all 256 color. but this is problematic; when you do that you set the whole terminal to xterm and even urxvt will report back its **$TERM** as Xterm not `rxvt-unicode-256color`. So I am looking for the way to just target the xterm. and leave other terminal emulators alone. PS: I had the same problem ith Urxvt but I solved it by tweaking its Makefile and removed `\--with-rxvt`


Dovecot: Corrupted index cache file

I received following error message in `/var/mail/mail.err`:               Jun 14 00:03:42 max dovecot: IMAP(bernhard):      Corrupted index cache file /home/bernhard/Mail/.indexes/.imap/INBOX/dovecot.index.cache:      Broken virtual size for mail UID 5618      What is the preferred way to restore the index?


debootstrap error in Ubuntu 13.04 raring

I'm trying to create a file system in Ubuntu with the command:               sudo debootstrap --foreign --no-check-gpg --include=ca-certificates --arch=armhf testing rootfs http://debian.raspbian.com/debian      but it got the following error:               /usr/sbin/debootstrap: 1294: /usr/sbin/debootstrap: cannot create /home/.../rootfs/test-dev-null: Permission denied     E: Cannot install into target '/home/.../rootfs' mounted with noexec or nodev      can anyone help me here?


vaio grub removal after default windows setup

After installing default factory windows xp from VAIO VGN-NR, and hence removing the Ubuntu on its hard drive, the grub does not allow the windows to boot up properly, giving the prompt: "no such partition" and grub rescue appears. The Windows can not be recovered by rescue mode, since the administrator password of newly installed default windows (from hidden drive on the laptop) is not known to me. Booting up with live-Ubuntu and trying to erase the MBR did not help a bit.               dd if=/dev/null of=/dev/sdX bs=446 count=1      I can simply install another windows on it, fixmbr and fixboot it and re- install the original factory windows. But I'm not like that. I want to find a way through, not around. Any suggestion?