title: Are unix[-like] programs capable of determing where their output is going?

text: Up until recently I was under the impression that Unix-y programs were unaware of where their output went, be it to standard out, redirected to a file, or into a pipe. However, an unrelated U&L question on this site brought to my attention the following example:               % echo "hello world" > file          % grep --color=auto lo file     hello world          % grep --color=auto lo file | cat     hello world      Obviously you can't see it here, but the first command shows 'lo' highlighted, as expected. However, the second call, which goes through a pipe, shows no colour. This suggests that `grep` was aware of its output being directed to a pipe and avoided outputting colour. How is this done?


title: How do I change the font size when using lp on Linux?

text: I used to send files in Unix to a printer with `lp`, and used `-ofp16.16` or `-ofp12` to change the size of the fonts. This does not work on Linux; what should I use instead?


title: Exploring RAM contents

text: I am using a redis Database and would like to explore the contents of the RAM the application is using. I feel the explanation of why I want to do this will make more sense then the question I would ask. Redis is a simple key value store that stores binary data. I think it would be a good place to explore things like encoding and it would be interesting to me to do things like skimming over the RAM looking for binary sets of data, doing things like looking for simple patterns; maybe explore the idea of writing a baby query language that searched in RAM. I had gotten this idea after reading the chapter in SICP about query languages. Any thoughts on where to start? Initially, I want to ask "Give me the address space this application is running in, please" to the system.


title: proc/sys/vm/flush_mmap_pages missing in 3.9 kernel, how to get it?

text: There was an option in redHat 5.2 called `flush_mmap_pages`, I could set this to zero and that would turn of writing dirty pages from a mapped memory file (so I can do it myself when I want to). However it is missing in newer kernels, I am using fedora 17 on Linux 3.9 kernel ATM and it is not there. Is there anyway to apply a kernel patch to get it back, does anybody know the last kernel version to support this kernel parameter?


title: chowning each home user to itself recursively

text: Okay so I have about 100 directories in my home folder each owned by the home user itself. Sometimes I have to manually replace some files as root so the permissions are disturbed and some files are no longer owned by that user. To fix this, I always have to use the following command within the home directory:               chown -R user:user user/      Now I'm looking at some shortcut because I can't do this for all the 100 users out there. I'm wondering what would be done by:               chown -R *:* *


title: SVN repository - user premissions issue

text: I have created the repository long time ago when I was the only user. Now I need to add another user, so I created a usergroup where I added the both users and did the following:               chmod -R user1:usergroup svnrepo/*     chown -R 0770 svnrepo/*      Now we all have the ability to update and commit but the problem is that when one of us commits, it aparently changes the owner of `svnrepo/db/current` (to the user who committed) and the other person loses access to the repo, until I manually set the proper owner again. Do you have an idea how to fix that? It is extremely annoying...


title: Replace $ with £ using sed command

text: I have text file `DollarToPound.txt` with some Dollar signs (`$`). Please provide a shell script to replace dollar symbol with Pound (`£`) with sed command. I am getting:               batch@BATCH:[~/output]$ ./del.sh     sed: command garbled: s/\$/£/g      Content of DollarToPound.txt:               $$$$$$$$$$$      Contents of del.sh:               #!/bin/sh      #!/bin/expect     #!/bin/bash          sed 's/[$]/£/g' DollarToPound.txt     #sed 's/\$/£/g' DollarToPound.txt      Executing command `:LC_ALL=C sed -n l < del.sh`               batch@BATCH:[~/output]$ LC_ALL=C sed -n l < del.sh     #!/bin/sh     #!/bin/expect     #!/bin/bash               sed 's/[$]/\243/g' Dollar.txt               #sed 's/\$/\243/g' Dollar.svd > Dollar.txt     #sed 's/\\243/\$/g' Dollar.svd >     #sed 's/\$/\243/g' Dollar.txt      Operating system used: Solaris 10


title: How to specify where files are transferred to using ssh

text: I know how I can send files to a specific directory on a remote server using ssh, but I don't know how to specify it.


title: How to find information about the RAM using the Terminal?

text: > **Possible Duplicate:**   >  Can I identify my RAM without shutting down linux? I need to know it to check the compatibility... **I wanna know the type/size/model, etc.** Can someone help? Thanks.


title: Reccommendations for a wireless print server supported on Linux?

text: I have found it difficult to research a **wireless print server** which will be supported on Linux. I use Debian 6 and Ubuntu 10.04 (also Windows 7 64 bit, Vista, and MACOS Snow Leopard). Everyone in my household using uses a different OS, so it is all the more difficult to ensure interoperability across so many OSs. Where can I find a definitive, authoritative and complete list of supported print servers? Also, I want to keep things simple as possible. This is an important criterion for my choice of wireless print server. GUI mediated setup/install is much preferred over complex configuration files and command line. I know of CUPs, but I don't know if CUPs will regulate the wireless print server and what's involved. The print server is to enable sharing of Brother HL-4050CDN printer. Edit: I'm seriously considering the Belkin F5L049au. But the customer support people tell me it does not support Linux. But this is true of the majority of the print server market... Anybody, help? Edit2: Must support N network standard, the printer above, be wireless, and be Linux compatible.


title: Comparing files in unix columnwise

text: I want to compare two files with same number of rows and columns with records in same order. Just want to highlight the differences in the column values if any. `file A`:               1,kolkata,19,ab          2,delhi,89,cd          3,bangalore,56,ef      `file B`:               1,kolkata,21,ab          2,mumbai,89,gh          3,bangalore,11,kl      Considering column `1` as primary key, we have differences in other columns. I want to highlight those differences. Output format may be (not sure):               record_number,  columns_with_diff     1               3          2               2,4          3               3,4      Can `diff` or `comm` solve my problem? If yes then what would be the exact command?


title: How to specify -? option with GNU getopt

text: When parsing command line arguments with GNU `getopt` command, how do I (if possible) do recognize `-?` as another option? Is there a way to escape it in the opstring?


title: browsers don't work(chrome err 137:name resolution failed), but everything is ok in gnome terminal

text: My system is debian 6.0. Both debian default brower and chrome don't work. The error is `name resolution failed(code:137)`. I can ping and update software in gnome terminal. Yesterday I installed pptp-linux, and pptp did work, I also could surf internet by chrome. Today I can't surf internet by browsers. after I remove pptp-linux, it still exist. Have you encountered it?


title: Best way to remove bytes from the start of a file?

text: Today I had to remove the first 1131 bytes from an 800MB mixed text / binary file, a filtered subversion dump I'm hacking for a new repository. What's the best way to do this? To start with I tried               dd bs=1 skip=1131 if=filtered.dump of=trimmed.dump      but after the skip this copies the remainder of the file a byte at a time, i.e. very slowly. In the end I worked out I needed 405 bytes to round this up to three blocks of 512 which I could skip               dd if=/dev/zero of=405zeros bs=1 count=405     cat 405zeros filtered.dump | dd bs=512 skip=3 of=trimmed.dump      which completed fairly quickly but there must have been a simpler / better way? Is there another tool I've forgotten about? Thanks!


title: A page documenting usage of various package managers

text: I'm looking for a reasonably up-to-date and comprehensive web page that documents differences in how to use different package managers.


title: FVWM 's Windows buttons (Maximize Minimize ...), Themes

text: I'm using the F Virtual Window Manager (FVWM). I'm wondering how to customize the window appearance (the theme) to   1. Add a minimize, maximize, and close button, so I have four buttons, arranged like this: > >      --------------------------------------- >     |=         (Window Titlebar)       N M X| >     |---------------------------------------| >     |                                       | >     |                                       | >     |                                       | >     |                                       | >      --------------------------------------- > > = is an `-` button; when clicked on it shows a menu containing `move` > `resize` `raise` `lower` `(De)Iconify` `Delete` `Close` `Destroy` `Identify`   >  N is minimize   >  M is maximize   >  X is close   2. How could I set the height of the window title bar?  > >       Answer: The height is govern by the `(Window Titlebar)` **Font size**.   >               Or; >               TitleStyle Centered Height 24  #for example >


title: The zip format's external file attribute

text: This is a slightly exotic question, but there doesn't seem to be much information on the net about this. I just added an answer to a question about the zip format's external file attribute. As you can see from my answer, I conclude that only the second byte (of 4 bytes) is actually used for Unix. Apparently this contains enough information when unzipping to deduce whether the object is a file or a directory, and also has space for other permission and attribute information. My question is, how does this map to the usual Unix permissions? Do the usual Unix permissions (e.g. below) that `ls` gives fit into exactly one byte, and if so, can someone describe the layout or give a reference, please?               $ ls -la     total 36     drwxr-xr-x   3 faheem faheem  4096 Jun 10 01:11 .     drwxrwxrwt 136 root   root   28672 Jun 10 01:07 ..     -rw-r--r--   1 faheem faheem     0 Jun 10 01:07 a     drwxr-xr-x   2 faheem faheem  4096 Jun 10 01:07 b     lrwxrwxrwx   1 faheem faheem     1 Jun 10 01:11 c -> b      Let me make this more concrete by asking a specific question. Per the Trac patch quoted in my answer above, you can create a zip file with the snippet of Python below. The `040755 << 16L` value corresponds to the creation of an empty directory with the permissions `drwxr-xr-x`. (I tested it). I recognize `0755` corresponds to the `rwxr-xr-x` pattern, but what about the `04`, and how does the whole value correspond to a byte? I also recognize `<< 16L` corresponds to a bitwise left shift of 16 places, which would make it end up as the second from top byte.               def makezip1():         import zipfile         z = zipfile.ZipFile("foo.zip", mode = 'w')         zfi = zipfile.ZipInfo("foo/empty/")         zfi.external_attr = 040755 << 16L # permissions drwxr-xr-x         z.writestr(zfi, "")         print z.namelist()         z.close()      EDIT: On rereading this, I think that my conclusion that the Unix permissions only correspond to one byte may be incorrect, but I'll let the above stand for the present, since I'm not sure what the correct answer is. EDIT2: I was indeed incorrect about the Unix values only corresponding to 1 byte. As @Random832 explained, it uses both of the top two bytes. Per @Random832's answer, we can construct the desired `040755` value from the tables he gives below. Namely:               __S_IFDIR + S_IRUSR + S_IWUSR + S_IXUSR + S_IRGRP + S_IXGRP + S_IROTH + S_IXOTH     0040000   + 0400    + 0200    + 0100    + 0040    + 0010    + 0004    + 0001     = 40755       The addition here is in base 8.


title: need assistanse with dhcpd.conf understanding

text: How can i interpret following:               class "blade-1-01-1" {                 match if substring (option dhcp-client-identifier, 9, 1) = 01 and                          substring (option dhcp-client-identifier, 5, 1) = 01 and                          substring (option dhcp-client-identifier, 6, 1) = 00;             }      BR


title: How can I add an x509 certificates bundle (ca-bundle.crt) to NSS database (~./pki/nssdb)

text: I'm currently using RedHat Enterprise 6. Git had issues cloning Github repos using HTTPS. After some investigation (e.g. enabling GIT_CURL_VERBOSE and GIT_TRACE) the problem was narrowed to a certificate validation issue, which was solved updating the certificate DB, i.e.:               curl http://curl.haxx.se/ca/cacert.pem -o /etc/pki/tls/certs/ca-bundle.crt      Things worked fine for a while. However, after a system upgrade now I'm getting a different error:               Couldn't find host github.com in the .netrc file; using defaults     * About to connect() to github.com port 443 (#0)     *   Trying 192.30.252.128... * Connected to github.com (192.30.252.128) port 443 (#0)     * Initializing NSS with certpath: sql:/etc/pki/nssdb     * NSS error -5978     * Expire cleared      Unfortunately I can't find that error code description on the documentation. It seems that the updated CURL system lib defaults to NSS and relies exclusively on the certificates on /etc/pki/nssdb I've been trying to solve this issue trying different commands to add the certificates to NSS, but failed. **Can you recommend a solution? Is it possible to force Git and/or CURL to use the ca-bundle DB, or even disable certificate validation?** _Any solution that could allow Git commands to be run using Github's repos wil be welcome._ **Notes:** _Curl version_ curl 7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2


title: Why does the Skype incoming call window disappear in Awesome WM?

text: Skype used to work OK on Awesome WM for some months, but recently incoming call windows do not show up at all. I've checked all the tabs and tried to minimise all the other windows, and there is no status bar entry, so it looks like it's not floated behind any of them. Removing the Awesome WM configuration file and restarting doesn't work.


title: How can I Allocate More Space to a Filesystem Mounted on /?

text: I am new to Linux so please forgive the incorrect use of vocabulary. My company has a private cloud that provisions VM's in a KVM. I received a RHEL 6.4. When I provisioned it, I asked for 50GB of additional storage. Here is the results of `df -h`: ![enter image description here](http://i.stack.imgur.com/4Qeap.png) The filesystem /dev/mapper/VolGroup-lv_root mounted on `/` is full. After consulting my companies FAQ, I found one called "Where is my extra storage that I ordered with my VM?" and was directed to a PDF that showed me how to create a new filesystem mounted on a new directory called `/data`. I was unable to determine how to simply extend the fileysystem mounted on `/`. I did that on a different VM as a test. On the VM which I wish to extend the filesystem mounted on `/`, here are the results of `fdisk -l`: ![enter image description here](http://i.stack.imgur.com/C9OD4.png) Here are the results for `pvdisplay`: ![enter image description here](http://i.stack.imgur.com/jGMOH.png) On a test VM I issued the following commands as specified by my companies FAQ:               pvcreate /dev/vdb     vgcreate DATAVG /dev/sdb     lvcreate -L 10G -n lvdata1 DATAVG     mkfs -t ext4 /dev/DATAVG/lvdata1     tune2fs -c0 -i0 /dev/DATAAVG/lvdata1      I appended the following to `/etc/fstab`               /dev/DATAVG/lvdata1    /data    ext4    defaults    1 2      and then mounted `/data`:               mount /data      After this, a `df -h` results in: ![enter image description here](http://i.stack.imgur.com/TPnz7.png) This shows that I can successfully add storage, but I wish to add the storage to the filesystem mounted on `/` instead.


title: How to measure an operation's duration in terminal, not in code

text: For example, I need to do "make " for some software. I want to measurement how long this is going take. Is there easy and accurate way to do so?


title: How do I install LXDE and the X Window System on Debian Squeeze

text: I recently did a netinstall of Debian Squeeze and during the install I unticked Desktop Environment because I didn't want to install Gnome as the default DE. So I end up with a command line during boot. Now I want to install LXDE and I was wondering which to install: xorg or xserver-xorg (or both) before installing LXDE? And yes, I realized later that I could have chosen LXDE as an alternative DE during install but I don't want to reinstall again.


title: Manually copying MBR from one drive to the other GPT drive and configuring GRUB results in booting failure

text: I run _CentOS 6.4_. I have **SSD** 300GB for system files and **RAID10 8TB** for storage + _backup_. **SSD system drive is partitioned as follows:** `fdisk -l /dev/sdb`               Disk /dev/sdb: 300.1 GB, 300069052416 bytes     255 heads, 63 sectors/track, 36481 cylinders     Units = cylinders of 16065 * 512 = 8225280 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0xc95ec64f             Device Boot      Start         End      Blocks   Id  System     /dev/sdb1   *           1          66      524288   83  Linux       (/boot)     /dev/sdb2              66        8421    67108864   83  Linux       (/)     /dev/sdb3            8421       12598    33554432   83  Linux       (/usr)     /dev/sdb4           12598       36482   191847576    5  Extended     /dev/sdb5           12598       16775    33554432   83  Linux       (/var)     /dev/sdb6           16775       18864    16777216   83  Linux       (/tmp)     /dev/sdb7           18864       35574   134217728   82  Linux swap / Solaris      **RAID10 8TB _(GPT)_ is partitioned as follows:** `parted /dev/sda print`               Model: ASR7805 RAID 10 (scsi)     Disk /dev/sda: 7999GB     Sector size (logical/physical): 512B/512B     Partition Table: gpt          Number  Start   End     Size    File system     Name     Flags      1      8389kB  7399GB  7399GB                  primary             (LUKS)      2      7399GB  7400GB  510MB   ext4            primary  boot       (/boot)      3      7400GB  7468GB  68.7GB  ext4            /                   (/)      4      7468GB  7503GB  34.4GB  ext4            /usr                (/usr)      5      7503GB  7537GB  34.4GB  ext4            /var                (/var)      6      7537GB  7554GB  17.2GB  ext3            /tmp                (/tmp)      7      7554GB  7692GB  137GB   linux-swap(v1)  primary             (swap)      8      7692GB  7992GB  300GB                   primary             (LUKS)         All I wanted is just to use _300GB_ of space on my _/dev/sda (RAID10)_ for creating an identical image (backup) of my _SSD_ in case of sudden failure. As you could see above, I have partitioned my _RAID10_ is just absolutely identical way as my current system _SSD_. Afterwards, I have created exact images of each partition that I have on my current _SSD_ and extracted them to my _RAID10_ using `dump/restore` commands. All is fully copied and set on my _RAID10_ just the same way as on my current _SSD_. I have obviously edited my backed up `fstab` (on _RAID10 /etc/fstab_ ) using proper UUID for mounting on load. **BUT** Whatever I do I cannot properly load the system, as I restart and choose to load from _RAID10_. The system just doesn't boot (underscore is continually blinking)!? I have tried to copy first `446` bite of boot sector `(dd if=/tmp/mbrsdb.bak of=/dev/sda bs=446 count=1)` from my _SSD's MBR_ to my _RAID10's MBR_ but it didn't work? Now, as I'm all out of any other options, I would like to ask for your help?


title: Console font - how to show accents?

text: Arch linux on VirtualBox. My problem is the console (not X) does not show accents like "á ã ç". The problem is showing, not typing. I have a text file with these accents and when I use "cat" the don't show correctly. I _was_ able to make it work with "setfont cp850-8x16", however, I do want to use Terminus (or some other font) and in any case, I want to understand why other fonts that should be capable of showing these characters (supposedly, Lat2-Terminus16 should handle them, but does not work) don't do that. I already spent some hours on research and testing, and tried a bunch of setfont/loadunimap, and none helped except the one mentioned above. My guess is I have to do something about UNICODE before using the other fonts, but I do not know what. It's surprising the low amount of resources on how to make stuff like this work. The end result is that I should be able to type accents (pt_BR) with a beautiful font on the Console (text-mode).


title: GRUB can't find an existing file?

text: I'm trying to install GRUB, but when I try to boot, I get this:               error: file '/boot/grub/i386-pc/normal.mod' not found.      But that file exists on the drive I'm booting to. Why is it saying "not found" if the file is very clearly there? I'm using BIOS, and installing everything to sdb1. Here's my GRUB output:               GRUB loading.     Welcome to GRUB!          error: file '/boot/grub/i386-pc/normal.mod' not found.     Entering rescue mode...     grub rescue> ls     (hd0) (hd0,msdos1) (hd1) (hd1,msdos3) (hd1,msdos2) (hd1,msdos1) (hd2) (hd2,msdo     s1)     grub rescue> set     prefix=(hd0,msdos1)/boot/grub     root=hd0,msdos1     grub rescue> ls (hd0,msdos1)/     ./ ../ lost+found/ var/ dev/ run/ etc/ tmp/ sys/ proc/ usr/ boot/ home/ lib lib     64 mnt/ opt/ root/ srv/ sbin/ bin/


title: cmake question on RedHat Linux 64

text: I am new with building software using cmake. I want to install VTK using cmake. I downloaded the .tar file and un-tared it. This leaves me with a directory that contains some cmake files and some other stuff. Suppose I have un-tared all files in the directory `/HOME/USER/SETUP_FILES/` and created a directory `/HOME/USER/SETUP_FILES/BUILD` When I cd into `/HOME/USER/SETUP_FILES/BUILD` and execute `cmake ../.` I am able to configure the build. In the configuration file, I can choose to define `CMAKE_INSTALL_PREFIX` My first question is: 1) What should I enter there? When I enter for example `/HOME/USER/VTK_PROGRAM` this folder is created (after `make` and `make install`) that contains a `bin/` folder (along with some other folders). However, in the `/HOME/USER/SETUP_FILES/BUILD` there is also a `bin/` folder created. My second question is: 2) I now have three folders with files. Which one(s) should I keep in order to have a working program: a) `/HOME/USER/SETUP_FILES` b) `/HOME/USER/SETUP_FILES/BUILD` c) `/HOME/USER/VTK_PROGRAM` Is it possible to merge the b) and c) folders?


title: No /proc in a Busybox-based embedded Linux distribution

text: I am making an embedded Linux distribution and my board is a Raspberry Pi. My kernel version is 3.2.27 without initramfs and my root file system as follows:               /lib                          /* contains kernel modules */     /bin /sbin /usr/bin /usr/sbin /* contains busybox utils binaries */     /usr/lib                      /* contains cross-compiler tool chain libs */     linuxrc                       /* generated by busybox, kept in / */     /dev                          /* I have created console and ttyAM0 manually but added mode devices by udev */     /etc/init.d/rcS               /* required by busybox init */      after kernel booted I am getting a console (I don't know whether it is busybox console or not). I have few problems below   * No process information available (no files/folder created under `/proc`).   * When I am using `ps -e` it shows nothing. Why this unexpected behavior happens?


title: Why is GNU screen / byobu leaving garbage text in the shell during a reverse search?

text: I recently starting using GNU screen via Byobu but I think the problem is related to screen. I first SSH into a server and then do a reverse search to run a commonly run command (dump a the database). I've redacted some of the text, but because usually outputs `(reverse-i-search)`':` before the search, it pushed the line across the width of the terminal. ![screenshot1](http://i.stack.imgur.com/Ggjj6.png) If I am happy with the search and accept the command, the rightmost text stays put. See below: ![screenshot2](http://i.stack.imgur.com/lCMus.png) So, why is this "garbage text" staying in the window? It only happens in screen and only seems to happen for certain hosts that use my custom .bashrc formatting and don't have their own.


title: What's the right way to execute a script before system shutdown (systemd)?

text: I wrote a script that suspends all my VirtualBox machines, and put a line in `/etc/rc.local.shutdown`, but it doesn't seem to work, `su - XX -c /XX` When I'm booting the next time, VirtualBox tells me the machine was `Aborted`, so the script wasn't executed. (Launching that script manually works for me) P.S I already enabled `shutdown.target` **EDIT** The problem seems more complicated than I thought, in my `.bashrc`, if it's running on `tty3`, it executes `startx`, so when systemd decide to shutdown/reboot, it whould kill `VBoxSVC` process and other stuff when X Session dies. I also tried to hack the source code of `xfsm-shutdown-helper`, make a fake `systemctl` that execute my script first, none of the above works.


title: Where is the setting that disallows duplicate command history?

text: Let's say I type the following sequence of commands:               $ cd     $ ls     $ ls      When I go back in history by pressing `up` twice, I end up with `cd`, instead of `ls`. I've noticed this isn't always the case, so it likely is some bash setting somewhere. Which is it?


title: How do I port-forward 169.254.169.254-bound packets from libvirt/KVM guests to localhost?

text: This is a followup to What's the best way to have a 169.254.169.254 address local to my laptop?. Short story: 169.254.169.254 is the "well known" address of cloud metadata services for EC2 and for OpenStack, and I want to emulate it on my laptop for devel work. Having given up on the `lo:0` approach, I decided to just set up NAT/port forwarding. My guests are configured by libvirt, using a default libvirt network which NATs through my wireless nic, which libvirt has configured like so:               Chain POSTROUTING (policy ACCEPT)     target     prot opt source               destination              MASQUERADE  tcp  --  192.168.77.0/24     !192.168.77.0/24      masq ports: 1024-65535     MASQUERADE  udp  --  192.168.77.0/24     !192.168.77.0/24      masq ports: 1024-65535     MASQUERADE  all  --  192.168.77.0/24     !192.168.77.0/24          This rule:               sudo iptables -t nat -I OUTPUT -p tcp -d 169.254.169.254 --dport 80 -j DNAT --to-destination 127.0.0.1:80      does a lovely job of forwarding from Firefox running on the laptop (host OS) itself. But from within the guest, I get `No route to host`. Clearly I need something else to make this work. What? * * * As requested, some more networking information. I removed the down interfaces from `ip addr` for brevity.               $ ip addr     1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN         link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00         inet 127.0.0.1/8 scope host lo            valid_lft forever preferred_lft forever         inet6 ::1/128 scope host            valid_lft forever preferred_lft forever     2: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000         link/ether 60:67:20:44:8d:48 brd ff:ff:ff:ff:ff:ff         inet 192.168.1.5/24 brd 192.168.1.255 scope global wlp3s0            valid_lft forever preferred_lft forever         inet6 fe80::6267:20ff:fe44:8d48/64 scope link            valid_lft forever preferred_lft forever     4: virbr1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP         link/ether 52:54:00:84:3d:aa brd ff:ff:ff:ff:ff:ff         inet 192.168.77.1/24 brd 192.168.77.255 scope global virbr1            valid_lft forever preferred_lft forever      * * *               $ ip route     default via 192.168.1.1 dev wlp3s0  proto static     192.168.1.0/24 dev wlp3s0  proto kernel  scope link  src 192.168.1.5     192.168.77.0/24 dev virbr1  proto kernel  scope link  src 192.168.77.1      * * *               $ ip rule     0:      from all lookup local     32766:  from all lookup main     32767:  from all lookup default      * * *               $ iptables -t nat -L -n     Chain PREROUTING (policy ACCEPT)     target     prot opt source               destination                  Chain INPUT (policy ACCEPT)     target     prot opt source               destination                  Chain OUTPUT (policy ACCEPT)     target     prot opt source               destination                  Chain POSTROUTING (policy ACCEPT)     target     prot opt source               destination             MASQUERADE  tcp  --  192.168.77.0/24     !192.168.77.0/24      masq ports: 1024-65535     MASQUERADE  udp  --  192.168.77.0/24     !192.168.77.0/24      masq ports: 1024-65535     MASQUERADE  all  --  192.168.77.0/24     !192.168.77.0/24          * * *               $ iptables -L -n     Chain INPUT (policy ACCEPT)     target     prot opt source               destination                  Chain FORWARD (policy ACCEPT)     target     prot opt source               destination             ACCEPT     all  --  0.0.0.0/0            192.168.77.0/24      ctstate RELATED,ESTABLISHED     ACCEPT     all  --  192.168.77.0/24      0.0.0.0/0                    Chain OUTPUT (policy ACCEPT)     target     prot opt source               destination


title: building/compiling kernel headers

text: I am compiling kernel 3.4 and 3.8 for different target devices. I would like to install compat wireless driver which requires kernel header. Could anyone tell me how I can compile/build the kernel header from the kernel source? I would appreciate if someone could suggest me a clear document to read or explain clearly how I can accomplish it. Secondly, the target devices run Debian. would it work if I install the kernel header by `apt-get install linux-headers-$(uname -r)` for the device that would have `3.4` kernel? Or there might be conflict or problem?


title: ssh will sporadically hang temporarily on fast connection

text: I am using Ubuntu 13.04 on my laptop, connected to my router at home. When working from home, I will ssh into the servers on campus, through a vpn, with X11 forwarding.               ssh -X server.address.on.campus      I have a connection that is usually about 40 Mb/s and I only live a few miles away so the terminal is just as responsive as if I was using ssh on the campus network. However, the difference is that the connection from home has a tendency to "hang" for about 10-15 seconds every few minutes before resuming (all keystrokes I made during the hang are clearly sent because my screen is updated with them after the hang). There is no discernible pattern to the hangs. It usually happens (or is most noticeable) when I am typing something out. Does anyone have any ideas how I could mitigate this issue or what might be causing it? Reading around the internet, there are various issues with ssh hanging (usually permanently) but no solutions for my specific issue. UPDATE: I still have this issue. As suggested by @Anthon, I left `ping` running until ssh hung again. I've plotted the results below, and it is quite clear where the temporary hang happens. No packets are received for serval seconds and then ~6 are sent back in quick succession. ![enter image description here](http://i.stack.imgur.com/6iSaA.png) Also: I have never noticed the issue occurring when I use PuTTY on a windows partition on the same machine.


title: GDM hangs when home directory is inaccessible

text: I have setup a OpenSUSE 12.3 workstation with SSO through KRB5 and LDAP. This works pretty smoothly up to the point where GDM isn't very happy about that fact that it cannot access user's home directories that are actually nfs mounts with krb5p. If no home directory is mounted GDM works fine. If at least one home directory is mounted then GDM will crash when attempting to open the greeter / login screen. If I remove LDAP (sss) from `/etc/nsswitch.conf` then GDM will work fine even if the home directories are mounted. At first I used to have the nfs mount in fstab for `/home/users`. There GDM would crash every time. Then I have tried to switch to autofs to mount `/home/users/*` individually. There GDM would work at first but crash thereafter (when the user logs out). Now I have configured it to use pam_mount so that the home directories would get unmounted after a user logs out. Now GDM works as long as there is no other user logged on to the system. So the problem must be somehow related to the fact that if the user `gdm` that the GDM greeter uses tries to access any of the mounted home directories, its permission will be denied by the nfs server due to a missing kerberos ticket. Even root cannot access these directories. Any attempt to give GDM access to these directories before the respective user logs in, would be a security issue. Interestingly though if the home directory doesn't exist then GDM has absolutely no problem with it. So GDM does tolerate `file does not exist`, but doesn't tolerate `permission denied`. So this makes me conclude that whatever GDM is trying to access from the home directories is not required at all. So what is it that GDM is trying to get from the home directories? And more importantly, how can I disable it from trying to do so? How can I prevent it from hanging? Any ideas for some extra troubleshooting? Or how can I make the mounted home directories invisible to GDM so that it won't trip over them?


title: Problems setting up own Cloud Lab

text: I'm trying to set up an own Cloud Lab on a self-built server. Server details:   * Board: Gigabyte Z77MX-D3H TH   * CPU: Xeon E3-1245 v2   * 16GB Crucial Ballistix CL8 1600Mhz   * NETWORK: ALFA AWUS036H   * additional crap (like crap-hdd, cooler, etc). I can only use (at this moment) a wireless connection because the box is far away from the router. I tried with Cloudstack and wanted to try with Openstack but I have read a lot of about (people who work with in production) that it is not a good solution and it will be more useful for me to try out with ProxMox. Now I have ProxMox up, but I can not establish any wireless-connections. At the PVE-Forum I got that they don't support or have not provided any wireless- network setup because PVE has some problems because of bridging. **My question is now:** I have my metal here (see hardware description above).   I have almost no experience with virtualization on Unix/Linux.   (I'm using VMware WS on my Ubuntu and I worked some weeks with OpenNebula (setting up and s.o.).   -> What should I use for my Cloud Lab / virtualisation environment, and if ProxMox is a good point to go on, how to solve the wireless problem? **EDIT:** I will definitely need kvm as hypervisor.


title: Half screen appears to have film on it. Acer C7 Chromebook running 13.04

text: Right side of the screen is not processing colors properly. Does not show up in white space but when colors deep colors occur the right side is lighter and it seems to be a bit blurry as well. I toggled back to chrome but it doesn't seem to be an issue there. I from 12.04 to 12.10 to 13.04 and all of them have the exact problem. I tried re- installing the intel drivers in all three but nothing changed. I also hooked it up to a HDTV which worked fine. I looked into calibrating the colors of the monitor but couldn't quite figure it out. Does anyone know of a good color profile online with good instructions? I believe the C7 runs the Intel HD graphics 4000, which I have seen some problems occurring. Any help would be great.


title: ufw in laptop running Ubuntu

text: I installed ufw and enabled it. The status is:                Status: active      Logging: on (low)      Default: deny (incoming), deny (outgoing)      New profiles: skip      But, I am able to navigate the web, get emails and even download and upload torrents. What does it mean the "deny (incoming), deny (outgoing)" part then? I expected a firewall to block traffic. What rules could I add so it blocks traffic?


title: tmux new pane has home directory as default instead of previous directory

text: When I press `Ctrl`+`"` (create a new pane) while in a pane, which has the `PWD` `/tmp` for example, the new pane starts as my home folder `~`. I looked at http://unix.stackexchange.com/a/109255/72471 and it helped me with the same issue concerning windows. However, I couldn't fix the `split-window` issue by inserting               bind " split-window -c "#{pane_current_path}"      into my `~/.tmux.conf`. I am using tmux 1.9a and therefor don't want a rather messy solution for older versions stated here (it doesn't work in my case, anyway):               bind '"' set default-path "" \; split-window -v \; set -u default-path      How can I tell `tmux` to set the default directory as the current path of a pane, when creating a new pane?


title: What is the difference between "find" and "till" in vim?

text: I see I can use `t` `c` or `T``c` to move to the next / previous character `c` I can also use `f``c` or `F``c` to move to the next / previous character `c` Is the only difference between them that `t``c` places the cursor before the character, `T``c` (going backwards) places the cursor _after_ the character and `f``c` / `F``c` both place it on the character itself?


title: What are the positions in `free` called?

text: I am trying to compare the output of `free` with the output of `sar -r`:               # sar -r     12:00:01 AM kbmemfree kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit     12:10:01 AM    629756  65293976     99.04    586536  60321636   5094176      7.49          # free                  total       used       free     shared    buffers     cached     Mem:      65923732    9120348   56803384          0     403628    5789524     -/+ buffers/cache:    2927196   62996536     Swap:      2097144          0    2097144      On the `free` line that begins `Mem:` it is obvious that we have what would be called in `sar`: _kbmemtotal_ , _kbmemused_ , _kbmemfree_ , **???** , _kbbuffers_ , _kbcached_.   On the line that begins `-/+`: **???** , **???** **What are the names of the values that I've marked as _???_?** Is this the `kbcommit` value? I have read Linux ate my ram which does explain what the numbers mean, but not their names. Also, the free manpage does not give the names either.


title: Why does debian and ubuntu default to runlevel 2?

text: I never thought about this before, but I was wondering why they chose runlevel 2. Every other distro and OS I've used default to runlevel 3 (with the exception of AIX which also defaults to runlevel 2).


title: How to disable floppy seek at linux startup?

text: It is annoying enough that my BIOS has no switch that allows me to disable the floppy-seek at boot. But when I boot CentOS 5 the floppy seeks again - I suspect `hald` to do this. How can I disable that seek (/dev/fd0)?


title: Can renaming a network device cause race conditions?

text: Arch uses predictable network interface names. MATLAB licenses are linked to the MAC address of eth0, so I need to rename one of my devices eth0. In a machines with only one NIC I can just turn off consistent naming, but in machines with multiple NICs it seems like it is desirable to keep consistent naming and just rename the device I care about to eth0 (it is still consistent after all). The Arch Wiki suggests creating a file `/etc/udev/rules.d/10-network.rules` with               SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="aa:bb:cc:dd:ee:ff", NAME="net1"      but the wiki includes the disclaimer: > When choosing the static names it should be avoided to use names in the > format of "ethX" and "wlanX", because this may lead to race conditions > between the kernel and udev during boot. For ethX with X greater than 0, I can see how this might be a problem, but for eth0 it seems like the kernel would have already used eth0 by the time the rename happens. So on a system with multiple NICs, do I have to worry about renaming a device to eth0? Alternatively, can I rename the device once I am fully booted and the network is online?


title: How can I install M4 on Linux, avoiding the dependency loop with Automake and Autoconf?

text: I am trying to install GNU M4 on my Chromebook using the 1.4.17 tarball, but when I run `./configure` and then`make` I get an error related to `aclocal`, which is apparently part of the GNU Automake package. The exact error I get is               WARNING: 'aclocal-1.14' is missing on your system.              You should only need it if you modified 'acinclude.m4' or              'configure.ac' or m4 files included by 'configure.ac'.              The 'aclocal' program is part of the GNU Automake package:              <http://www.gnu.org/software/automake>              It also requires GNU Autoconf, GNU m4 and Perl in order to run:              <http://www.gnu.org/software/autoconf>              <http://www.gnu.org/software/m4/>              <http://www.perl.org/>     make: *** [aclocal.m4] Error 127      I know the first part is only a warning, but the name indicates that the error is related. I also tried to create an empty file for `aclocal.m4`, and I get a different message: a warning about `automake-1.14` missing and `make: *** [Makefile.in] Error 1` Unfortunately, according to the official page, Automake requires Autoconf, which in turn requires M4. What can I do to install M4 and avoid this problem?


title: Bash $PROMPT_COMMAND messing up scroll history display

text: I set up a `PROMPT_COMMAND` to display the current branch while I'm in a git repo. The relevant part of my .bashrc is:               export PS1=" \[\033[34m\]\$\[\033[0m\] "     export PROMPT_COMMAND="$HOME/bin/myprompt"      where ~/bin/myprompt is:               #!/usr/bin/env ruby     green = "\033[32m"     bold = "\033[1m"     underline = "\033[4m"     reset = "\033[0m"          home_regex = Regexp.new "^#{ENV["HOME"]}"     Dir.chdir ENV["PWD"]          out =        underline + bold + green +       `pwd`.gsub(home_regex, "~").chomp +       reset          if `git log 2>&1 | grep ^fatal`.chomp == ""       out += "#{underline}#{green} (#{`git branch | grep ^\* | sed s/^..//g`.chomp})#{reset}"     end          print out      It works fine for the most part, the only problem is that when I use the arrow keys to scroll through command history, sometimes the command gets written over my prompt. Suppose the following session:               ~ $ pwd     /Users/Adrian     ~ $ cd sibilant     ~/sibilant (master) $ pwd     /Users/Adrian/sibilant     ~/sibilant (master) $      Then I press the up arrow to scroll through command history. each line shows the result of one press of the arrow:               ~/sibilant (master) $ pwd     ~/sibilant (master) $ cd sibilant     ~/spwd      as you can see, the last time I pressed the arrow the command was written over my prompt. Has anyone experienced this and/or know how to fix it?


title: Matterhorn dead but PID file exists

text: Installed opencast-matterhorn14 in a Centos 6.5 Machine and after Installation steps while I try to run the Matterhorn using `service matterhorn start` I keep on getting the same error:               [root@matterhorn log]# /etc/init.d/matterhorn status     matterhorn dead but pid file exists      While looking in `/var/run` I saw there is a PIDFILE:               -rw-r--r--  1 root  root     5 Jun 13 12:11 matterhorn.pid      So I removed the pidfile and tried to restart matterhorn, and I get the same error. Whith Google search I found an `init` script for Matterhorn from Github, so I have replaced my `init` script and still get the same error:               Matterhorn dead but pid file exists      If anyone have faced this issue please suggest a solution.


title: Command to change Konsole title

text: I would like to have the Konsole's title to change every time I run a loop, like this:               while read line; do       echo $line $i/$numline       echo -ne "\033]0;$line $i/$numline\007"       commands       let i=i+1     done<text      I've found that the `echo -ne "\033]0;text\007"`command doesn't work.


title: How to login from remote server to my own PC?

text: For the experiment purpose I need to login to my own PC from the remote PCs which are under the same domain, i.e: university network. How can I do remote login in this case using SSH? As an example, I have accounts in two machines in University X which are `me@machine_a.cs.x.ca` and `me@machine_b.cs.x.ca`, my personal laptop account is `nawshad@ubuntu`. What extra info do I need to provide?


title: command line method or programtically add ssh key to github.com user account

text: Is there a way to identify with a username and password to github.com servers for the purpose of adding an ssh key to the github user account? So far everything I've read suggests that a users ssh key must be added via the web GUI. I'm looking for the method or process of adding a key via a command line interface or bash/ansible/something script.


title: NTP with networks isolated

text: I have a computer (CentOS) with 2 network cards. I want to use one network card (A) to retrieve time from NTP server (internet). This would then set [this] local computer's time. I then want to point all other clients, (computers, and other devices) to the second network (B) card, using it as a LOCAL NTP. The B network must remain unto itself. This is all this computer will be used for. No other programs or functions. Can this be achieved? nutshell:   * network A gets time via NTP Ethernet.   * network B then provides time for incoming queries from local clients.   * No cross network communication can occur.  I'm obviously new to networking, and any help is appreciated.


title: Timeout `idql` command in ksh

text: I probably read all the threads in almost all the forums for a solution to my need. I am a beginner in shell scripting and I dont have a perfect solution yet. Below is my code snippet.               idql -n $REPOSITORY_NAME.$cs -Udmadmin -P"" -R$DM_SCRIPTS/test.api > /dev/null 2>&1         if [ $? != 0 ]; then           echo "   \c"           echo "ERROR: Cannot connect to: $REPOSITORY_NAME.$cs on $HOST"         else           echo "   Successfully connected to: $REPOSITORY_NAME.$cs"         fi      This is from the main logic that we use for monitoring our service. But we often see our service getting hung and so the first line of the above snippet gets hung and it doesnt proceed after that. Due to this we are not able to catch this 'service hung' condition. Most importantly we have to retain the checks for the existing conditions (specified in the if-else conditional statements) and additionally we have to be checking for the 'hung' state. If the `idql` command takes more than 5 seconds, we can assume that it is hung.


title: How to script a database migration using SSH?

text: I am trying to create a `sync.sh` script that coordinates with our less-than- ideal version control for our website. This script will migrate a copy of the live database to our local development environment and a couple other things. I'm having trouble with the mysql migration portion. This script is run on a development machine. `remote` is the live host.               # --------------     # database          # ssh tunnel     ssh -L 3307:remote:3306 user@remote          # mysql dump     mysqldump -u someuser -h remote -P 3307 -p"p4ssw0rd" db > localfile.sql          # somehow close ssh tunnel ???          # populate local db with sql dump file     mysql -ulocal db < localfile.sql          # -----------------     # other sync stuff     # ...      When I just run the mysql portion of the script, I'm getting this output:               Pseudo-terminal will not be allocated because stdin is not a terminal.     Enter password:       We have ssh keys setup and I can ssh to the remote properly. However, when run in the script context, things are going wrong. I think I'm just a total bash noob. I'm guessing that if I simply change the structure of my approach, I should have no problem. I'm just not sure how to do that...


title: Browse Bash files for a distribution

text: With my current OS, my `LANG` value is set by               /etc/profile.d/lang.sh      I am curious of the code for another distribution, Linux Mint for example. How could I browse this code online, or perhaps download the code without actually installing that OS? I would prefer not to download an ISO if possible.


title: Compress a directory using tar/gz over SSH to local computer?

text: I'd like to essentially tar/gz a directory on a remote machine and save the file to my local computer without having to connect back into my local machine from the remote one. Is there a way to do this over SSH? The tar file doesn't need to be stored on the remote machine, only on the local machine. Is this possible?


title: Adding XFCE to Linux Mint 15 Cinnamon?

text: I installed _mint-meta-xfce_ package on an existing Cinnamon installation but it doesn't look anything like a standalone installation of Linux Mint 15 Xfce. It appears to be using the default Xfce settings. Is there a better procedure to install xfce to get the Mint eye-candy? * * * Linux Mint 15 Xfce installation: ![Linux Mint 15 Xfce](http://i.stack.imgur.com/vqDkd.png) Linux Mint 15 Cinnamon installation after adding mint-meta-xfce: ![Linux Mint 15 Cinnamon plus mint-meta- xfce](http://i.stack.imgur.com/o09Ug.png) * * *               $ cat /etc/apt/sources.list     # deb http://archive.getdeb.net/ubuntu raring-getdeb apps games                    $ ls /etc/apt/sources.list.d     local-repository.list official-package-repositories.list                    $ cat /etc/apt/sources.list.d/local-repository.list     #deb file:///usr/share/local-repository binary/                    $ cat /etc/apt/sources.list.d/official-package-repositories.list     # Do not edit this file manually, use Software Sources instead.          deb http://packages.linuxmint.com olivia main upstream import  #id:linuxmint_main          deb http://archive.ubuntu.com/ubuntu raring main restricted universe multiverse     deb http://archive.ubuntu.com/ubuntu raring-updates main restricted universe multiverse          deb http://security.ubuntu.com/ubuntu/ raring-security main restricted universe multiverse     deb http://archive.canonical.com/ubuntu/ raring partner


What is the difference between system-call, vm-call and hypervisor-call in a virtualized environment?


title: How can I investigate what other users are currently logged in?

text: Since the last few days I get an error message when I try to shut my laptop down: > System policy prevents stopping the system when other users are logged in This error message includes a prompt for administrator password. I don't think that there should be other users logged in. How can I find out what the problem is? ## What I've tried               $ w      08:00:47 up  1:50,  2 users,  load average: 0,74, 0,95, 0,70     USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT     moose    tty8     :0               07:57    1:49m  4.88s  0.11s x-session-manager     moose    pts/0    :0.0             08:00    2.00s  0.11s  0.00s w               $ loginctl        SESSION        UID USER             SEAT                         c1        117 couchdb                                       c2       1000 moose            seat0                 2 sessions listed. I'm not sure: is that already the problem? `$ sudo shutdown -h now` worked as expected. ## How I shut the computer down By clicking on `System > Shut Down... > Shut Down`: ![enter image description here](http://i.stack.imgur.com/47knu.png) ## System information I have Linux Mint MATE:               $ uname -a     Linux pc08 3.11.0-12-generic #19-Ubuntu SMP Wed Oct 9 16:20:46 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux     $ cat /etc/issue     Linux Mint 16 Petra \n \l


title: Bash syntax error when "else" follows an empty "then" clause

text: Why would following script not execute, but give a syntax error of `else`:               LOGS3_DIR=~/logs     if [ -d "$LOGS3_DIR" ]; then      cd      cd "$LOGS3_DIR"      echo "$LOGS3_DIR"      for filename in `find "." -mtime 1 -type f`       do       if lsof "$filename" > /dev/null       then         # file is open       else         echo "deleting $filename"         rm "$filename"       fi      done     fi


title: Why do I have to disconnect and connect for internet all the time?

text: Currently, I have to disconnect and connect again to use the internet for my Linux computer. It works fine for my tablet. Do you know what could be the reason for that? When I use the internet for more than a minute or so it simply doesn't work any more. I am connected without a wire.               $ cat /etc/issue     Linux Mint 16 Petra \n \l     $ uname -a     Linux pc08 3.11.0-12-generic #19-Ubuntu SMP Wed Oct 9 16:20:46 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux     $ ifconfig     eth0      Link encap:Ethernet  HWaddr e8:40:f2:93:ff:ab                 UP BROADCAST MULTICAST  MTU:1500  Metric:1               RX packets:0 errors:0 dropped:0 overruns:0 frame:0               TX packets:0 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)               Interrupt:17           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:65536  Metric:1               RX packets:6760 errors:0 dropped:0 overruns:0 frame:0               TX packets:6760 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:534518 (534.5 KB)  TX bytes:534518 (534.5 KB)          wlan0     Link encap:Ethernet  HWaddr 9c:b7:0d:f1:35:65                 inet addr:192.168.1.4  Bcast:192.168.1.255  Mask:255.255.255.0               inet6 addr: fe80::9eb7:dff:fef1:3565/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:58102 errors:0 dropped:0 overruns:0 frame:0               TX packets:40615 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:63722853 (63.7 MB)  TX bytes:6852895 (6.8 MB)     $ traceroute 4.2.2.2     traceroute to 4.2.2.2 (4.2.2.2), 30 hops max, 60 byte packets      1  192.168.1.1 (192.168.1.1)  13.115 ms  13.090 ms  13.069 ms      2  * * *      3  te-0-1-0-5-sur01.pittsburgh.pa.pitt.comcast.net (68.85.234.9)  180.382 ms  180.372 ms  180.356 ms      4  162-151-21-129-static.hfc.comcastbusiness.net (162.151.21.129)  179.660 ms te-0-10-0-13-ar03.pittsburgh.pa.pitt.comcast.net (69.139.168.57)  174.513 ms te-0-8-0-12-ar03.pittsburgh.pa.pitt.comcast.net (68.85.75.189)  179.609 ms      5  he-4-14-0-0-cr01.newyork.ny.ibone.comcast.net (68.86.94.185)  186.009 ms  186.002 ms  185.987 ms      6  ae12.edge1.NewYork2.level3.net (4.68.127.1)  185.288 ms  54.871 ms  81.634 ms      7  vlan51.ebr1.NewYork2.Level3.net (4.69.138.222)  103.096 ms  173.070 ms vlan52.ebr2.NewYork2.Level3.net (4.69.138.254)  173.044 ms      8  ae-48-48.ebr2.NewYork1.Level3.net (4.69.201.37)  173.010 ms ae-47-47.ebr1.NewYork1.Level3.net (4.69.201.45)  172.915 ms  172.908 ms      9  ae-62-62.csw1.NewYork1.Level3.net (4.69.148.34)  172.821 ms ae-92-92.csw4.NewYork1.Level3.net (4.69.148.46)  172.947 ms ae-91-91.csw4.NewYork1.Level3.net (4.69.134.78)  171.584 ms     10  ae-2-70.edge2.NewYork1.Level3.net (4.69.155.80)  172.802 ms  172.808 ms ae-1-60.edge2.NewYork1.Level3.net (4.69.155.16)  172.732 ms     11  b.resolvers.Level3.net (4.2.2.2)  172.808 ms  172.760 ms  47.988 ms     $ lspci | grep -i ethernet     03:00.0 Ethernet controller: Broadcom Corporation NetLink BCM57780 Gigabit Ethernet PCIe (rev 01)


title: Sourcing scripts with a for loop for different variables

text: I have several shell scripts that I summarised within a global script. I am using some variables that are the same across all scripts, and I wrote a separate script for this, which I am sourcing in each sub-script. This is what my variables script looks like:               variables.sh     NUMBER="6"     TYPE="${NUMBER}_xyz"     STATE="S05"     DIR="path/file_${NUMBER}_blabla"     FILE="file.txt"      My global script, global.sh, looks like this:               source variables.sh     bash script1.sh     bash script2.sh     ...      Now, I need to change the NUMBER variable in my variables script, run the global script, change the number, run the global script again etc. for each number from 6-15. At the moment I am doing this manually every time the global script has finished, but it's taking up a lot of time. Has someone got an easy to implement tip for a newbie? Thanks in advance!


title: Is there a way to find out the number of lines from a command output?

text: I am trying to compare command outputs between two servers. I want to find out the number of lines from the output of commands such as `ls -l`. Is there a way to do so? So far I have not found anything.


title: How to associate using aireplay-ng [Reaver]?

text: I'm a bit of a noob (complete noob) and linux and wifi hacking have always fascinated me. I just started last week. I came across Reaver but it always fails to associate with the AP, and guides online say to use aireplay-ng to associate first but none have been very specific with exactly how to associate.... I have been doing this sequence of commands:               sudo airmon-ng start wlan0     sudo airodump-ng mon0      sudo reaver -i mon0 -b [ap's mac] -vv      I have three routers at home. On one router, using the above commands, it associates, attempt to crack the pin, fails to associate several times in a row, then keeps trying to crack the pin in this cycle. It gets to a grand total of 0.00%. The other two routers always fail to associate altogether. So, if someone could please tell me _specifically_ how to associate with aireplay-ng so I can then use reaver I would greatly appreciate it and it would really make my day :)) -Yes, I made sure my network card is capable of doing monitor mode


title: Rebuilding a raid5 array from images

text: I have an 8 disk _possibly_ raid5 array that was part of a fried NAS, the whole thing uses pdc20265 promise chips and some kind of embedded system on a small ide board. No clue if the board is anything readable, possibly it is fried. dmraid doesn't seem to work with images and mdadm doesn't seem to let you build arrays w/out metadata. Anybody has a pointer on how to coerce the device mapper to assemble the array from the images so I can try to figure out what's inside? The company that created the nas doesn't seem to exist anymore and the array is 10 years old. (and the friend asking for help doesn't remember much about the setup).


title: Installing MINIX3 on vmware

text: I'm trying to install MINIX 3 (3.1.0 to be precise). The VMWare installation I have failed to recognize MINIX. I followed the steps shown here:   * http://wiki.minix3.org/UsersGuide/RunningOnVmware. How do I go about installing this now?


title: Is `who mom likes` a real linux command?

text: I stumbled across a blog that mentioned the following command.               who mom likes      It appears to be equivalent to               who am i       The author warns to never enter the following into the command line (I suspect he is being facetious)               who mom hates      There is nothing documented about the `mom` command. What does it do?


title: Debian sed: can't read

text: I'm trying to run a command to remove `require_once` from php files from here (code below), but I am getting the error: > sed: can't read -: No such file or directory I am in the correct folder; what's the problem?               find . -name '*.php' -not -wholename '*/Loader/Autoloader.php' \       -not -wholename '*/Application.php' -print0 | \       xargs -0 sed --regexp-extended --in-place 's/(require_once)/\/\/ \1/g'      **Update:** If I run:               find . -name '*.php' -not -wholename '*/Loader/Autoloader.php' \       -not -wholename '*/Application.php' -print0      I get: > find: invalid predicate `-wholename' I tried this and it returned a list of all the files:               find . -name '*.php' -not -name '*/Loader/Autoloader.php' \       -not -name '*/Application.php' -print0      But then changing the original to reflect this:               find . -name '*.php' -not -name '*/Loader/Autoloader.php' \       -not -name '*/Application.php' -print0 | \ xargs -0 sed --regexp-extended --in-place 's/(require_once)/\/\/ \1/g'      Gives the error: > -bash: xargs: command not found FYI, I'm running sed version 4.1.2 and I'm a bit a lost in the command line already, so please explain answers


title: What is the MIME equivalent of uuencode for sendmail?

text: e.g., I've got files I want to send by `sendmail` but the receiving mailbox (for posting pictures to my blog) will not accept `uuencode` files a la `$uuencode file | sendmail user@domain` I'm guessing it'll accept MIME though. So what command can I use instead?


title: Top and bottom panels disappeared in Ubuntu 10.10 (Gnome)

text: For some reason my top and bottom panels have disappeared. I can't right-click and add a new panel either. I tried executing gnome-panel from the terminal, rebooting, but no luck. Any idea how to recover these panels?


title: Centos 6.3 force password prompt on clicking nm-applet tray icon?

text: I'm using Network Manager to connect to a secure wireless network on a publicly accessible kiosk machine. The problem is, if the user manages to get to the desktop, the nm-applet is accessible by a non-root user. So a user can simply right click on a tray icon, edit connection settings and see the credentials for the wireless network in plain text. What I would like is for the applet to start on login (as a non-root user) and connect to the internet. But when a user clicks the tray icon it prompts for the root password. I haven't used Network Manager in a while but on previous RedHat systems I remember the password prompt showing up upon clicking the tray icon. I did check for gksu and beesu programs on the Centos repositories but I don't see them. However, there is some program that does the equivalent because when I click an administration program a password prompt shows up. So how can I force a password prompt upon clicking the nm-applet tray icon? If that is not possible, can I have Network Manager login to the wireless with out having nm-applet start up? **UPDATE:** Managed to lock some settings down using polkit `/usr/share/polkit-1/actions/`. Pretty much everything except the `Edit Connections` window seems to be listed in the relevant NetworkManager files. So I just need to find out what DBus message is linked to that window. I figured it would be `org.freedesktop.network-manager-settings.system.modify` which is in `/usr/share/polkit-1/actions/org.freedesktop.network-manager- settings.system.policy` but changing that seems to have no effect. Any ideas? As a workaround I just changed the permissions of the `nm-connection-editor` app to 700. So a normal user can't edit their own saved connections. **Further Update** The above workaround prevents the user from accessing the network credentials from right clicking the icon, but when the connection times out the window will pop up displaying network credentials. So still no proper solution. **Workaround Solution 2** As I was unable to prevent network manager from displaying the credentials. I ditched it entirely in favor of a mixture of dhclient and wpa_supplicant. The wireless network uses PEAP with no certificate so I had to list it as LEAP in wpa_supplicant.conf. wpa_supplicant.conf               network={       ssid="mynetworkname"       scan_ssid=1       key_mgmt=WPA-EAP       eap=LEAP       identity="XXXX"       password="XXXXX"     }      With wpa_supplicant configured, I simply:               #bring interface down     ifconfig wlan0 down      #start wpa_supplicant     wpa_supplicant -c /etc/wpa_supplicant/wpa_supplicant.conf -i wlan0 -Dwext -B     #associate network name with interface     iwconfig wlan0 essid "mynetworkname"     #bring interface back up     ifconfig wlan0 up     #request IP     dhclient -r      dhclient -timeout 1000 wlan0


title: Command-line-friendly full-text indexing?

text: Is there such a thing as a full-text indexing engine, that can be queried from the command line and ideally wouldn't require using a gui at all ? I'm especially interested in indexing my ebooks and papers, so that's a mixture of pdf, epub and a few djvu. (Open)Office docs would be nice, but much lower on my list.


title: control number of started programs in bash

text: As part of my research project I'm processing huge amount of data splitted up into many files. All files in folder `foo` have to be processed by the script `myScript` involving all elements of folder `bar`. This is `myScript`:               for f in bar/*     do         awk 'NR==FNR{a[$0]=$0;next}!a[$0]' $f $1 > tmp         cp tmp $1     done      The first idea to just process all files with a for loop is valid:               for f in foo/*     do         ./myScript $f     done      However, this simply takes forever. Simply starting every myScript in background by appending `&` would create thousands of parallely executed instances of `awk` and `cp` with huge input, which is obviously bad. I thought of limiting the number of "threads" created with the following               for f in foo/*     do         THREAD_COUNT=$(ps | wc -f)         while [ $THREAD_COUNT -ge 12 ]         do             sleep 1             THREAD_COUNT=$(ps | wc -f)         done         ./myScript $f &     done      As a side note: I'm comparing with 12, because I've got 8 cores on my nodes and apparently there's always `bash`, `ps` and `wc` running as well as the header line at the moment of the call of `ps | wc -l`. Unfortunately the call of `myScript` causes more than one additional entry in `ps`, so the behaviour of my script wasn't as intended. So here's my question: Is there a simpler way? A way which is more stable? I'm not doing anything else on the nodes, so everything happening is caused by the scripts only.


title: Is there a way to identify which process turns into Zombie process

text: One of the ubuntu server has 82 zombie processes. All processes shows '[sh] defunct' as process command. Is there a way to find out which process is becoming a zombie process? I tried checking the `/proc/PID/` directory to get some clue about zombie process but all files are empty. How to find who let this process as zombie.. . Is there any other way to find it out? Updated/Solved: Made the question clearer, and Answered my own question as suggested by andcoz.


title: Why won't my X Server won't start as a regular user?

text: X won't start on my main machine. I can start it as root, but then it only logs me in as root -- I can't use my regular user account. When I start up, it flashes a black screen, then hangs at "Stopping userspace bootsplash". What can I do to fix this? I'm running Ubuntu 11.04 x64. **Edit** : My `Xorg.0.log` is here


title: Running comprehensive speed tests on a drive

text: I'm wondering if anybody knows of any free packages, scripts or command line tools that can report a comprehensive speed test on a drive (e.g. generating random data, and testing how long it takes to transfer it). The drive can be internal, external or on the network.


title: What is the purpose of the hash command?

text: If you run `hash` it shows the path of all commands run since the hash was last reset (`hash -r`)               [root@c04c ~]# hash     hash: hash table empty          [root@c04c ~]# whoami     root          [root@c04c ~]# hash     hits    command        1    /usr/bin/whoami          [root@c04c ~]# whoami     root          [root@c04c ~]# hash     hits    command        2    /usr/bin/whoami      According to the man pages, the purpose of hash is: > The /usr/bin/hash utility affects the way the current shell environment > remembers the locations of utilities found. Depending on the arguments > specified, it adds utility loca- tions to its list of remembered locations > or it purges the contents of the list. When no arguments are specified, it > reports on the contents of the list. The -r option causes the shell to > forget all remembered locations.                Utilities  provided  as  built-ins  to  the  shell  are  not      reported by hash.      _Other than seeing how many times I've entered a command, I can't see the utility of`hash`._   It was even featured in thegeekstuff.com's top 15 useful commands **In what ways is`hash` useful?**


title: Draw a borderless webkit window on the desktop?

text: I have a browser page which I'd like to transparently burn over my desktop behind all other windows. I'd like the background of the page to be transparent so that my wallpaper shows through, but I'd like to be able to set the alphas of various items in CSS. Is there an application which runs WebKit which I could configure to do this? I'm running Gala in elementary Luna (Ubuntu 12.04).


title: How to install and use at job scheduling?

text: I am not clear on the following:   Is the process for `at` available to all linux installations? Or do would I need to do something to "install" it?


title: Is it possible to view a package information from terminal before installing it?

text: I was wondering if it was possible to check information about a package before installing it without needing to open a web browser to look for it there. For example, say I type in               ~$ asdf      Then I see recommended packages:               No command 'asdf' found, did you mean:      Command 'asdfg' from package 'aoeui' (universe)      Command 'sadf' from package 'sysstat' (main)      Command 'sdf' from package 'sdf' (universe)     asdf: command not found      Say I want to find out what the package 'sdf' does. Can I find this information in terminal, or will I have to do it the slow way and look it up online?


title: E1000 Hardware loopback mode for custom driver

text: The e1000 (82541) has an internal loopback feature. What's not clear from the Intel SDM is when this is enabled does it just test itself and then reset, or do all packets sent route back to the receive queue until disabled?


title: How to figure out what is performing scheduled server reboots?

text: I'm helping a friend with a server and it appears the server reboots every week on Sunday night. How can I figure out what is causing is the server to reboot? Aside from rebooting, the server appears to also be running maintenance scripts for their custom application. I am guessing there is something running both the maintenance and the reboot in one go.


title: Synchronize KDE4 Hotkeys

text: how can I synchronize my personally defined KDE4 Hotkeys between different computers? I would like to check in a file in git, as I do it with `.bashrc` and other configuration files. I found `.kde/share/config/khotkeysrc` on both machines (Debian Jessie and Ubuntu 14.04). When I compare both files with Kompare, I get about 200 differences, although I have defined a few hotkeys only. Can I still blindly synchronize these files? I expected something more compact as known from i.e. Fluxbox. I would appreciate an answer, which incorporates well in Git and avoids files, which I did not create.


title: shell script to control the number of processes of an user

text: I have to launch a total number, NUMTOT of a program (could be any, C, Mathematica, ns-2... mathematical environments). The problem is that the computer where these processes run only admits a maximum number of executions, e.g. MAX, (MAX < NUMTOT). I run these programs with the following line in a terminal               ./run.sh -d directory num      repeatedly, where run.sh is a script from which I invoke the math program; directory is the directory where my program is, and num indicates the number of new executions ( integer*num = NUM). The script 'run.sh' makes 'num' directories with a copy of 'directory' (the program) and launch 'num' number of instances of the program. In my case are Matlab instances. I would like an script that automatically keeps track of the number of processes running and when the maximum number is reduced to (MAX-num), because 'num' has already finished, then launch the next 'num' simulations of Matlab until the total NUM of simulations is completed. It would even better if the script could be able to maintain the MAX possible processes just invoking the next program when only one has just finished. Actually, to know the number of running processes I run the following script               ps axu |grep plopez|grep simulacion|grep MATLAB|awk '{ $2} END{print NR}'      which gives the total Matlabs running in this moment. How could I make the whole set of simulations just from a single script?


title: Error at starting mysql because lack of permission on /var/lib folder

text: **OS : Redhat** I try to launch the mysql database after a fresh installation. The problem is I am not root on this server and my user have not the permission to write in the /var/lib folder. When I try to launch the mysqld, I have passed lot of options to mysqld_safe command line but mysqld always need to write in the /var/lib folder :/ **Command line :**               bin/mysqld_safe --basedir=/tools/mysql/mysql --log-error=/tools/mysql/mysql/log \     --datadir=/tools/mysql/mysql/data --defaults-file=/tools/mysql/mysql/my.cnf \      --tmpdir=/tools/mysql/mysql/tmp      **error log :**               130918 16:43:23 mysqld_safe Logging to '/tools/mysql/mysql/log.err'.     mkdir: cannot create directory `/var/lib/mysql': Permission denied     chown: invalid user: `mysql'     chmod: cannot access `/var/lib/mysql': No such file or directory*     130918 16:43:23 mysqld_safe Starting mysqld daemon with databases from /tools/mysql/mysql/data     130918 16:43:25 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended      Anyone know how can I ask to mysqld to do not write in the /var/lib directory ?


title: chmod and chown not working in sudo called script

text: Based on this Serverfault question, my git user has permission in sudoers to run a wrapper script to move files into my webroot with git. Everything is working fine except for the chmod and chown lines. After the script has run, the files are still root:root instead of apache:apache.               #!/bin/sh          echo     echo "**** Pulling changes into Prime [Hub's post-update hook]"     echo     cd /usr/local/apache/htdocs || exit     unset GIT_DIR     git pull hub master     exec /usr/libexec/git-core/git-update-server-info     chmod -R 0644 /usr/local/apache/htdocs     chown -R apache:apache /usr/local/apache/htdocs      Since the script is running as root, why wouldn't the chmod and chown commands be working?


title: OfflineIMAP tells me SQLite isn't installed, even though it is

text: Whenever I run OfflineIMAP v6.5.3.1 I get an error for every folder (i.e. tag and folder in Gmail) which tells me there was a problem and then right after it tells me:               SQLite backend chosen, but no sqlite python bindings available. Please install.      This happens for every folder/tag so it's a long error list. What is causing this? I am on Mac OS X 10.7 and I have installed `sqlite` with `brew install sqlite`, I've also tried `pip install pysqlite`. Of course I have both Python 2.7 and Python 3 installed (`brew install python python3`). So Python 2.7 is accessed using `python` and Python 3 is accessed using `python3`. Think that's the problem maybe? Any help is appreciated. :) P.S.: It's the only error it gives me so it seems my config file is OK. **EDIT:** List of Python modules:               altgraph (0.7.1)     argparse (1.2.1)     bdist-mpkg (0.4.4)     bonjour-py (0.3)     eventlet (0.13.0)     greenlet (0.4.1)     include-server (3.1-toolwhip.1)     localtunnel (0.6.1)     macholib (1.3)     modulegraph (0.8.1)     numpy (1.5.1)     pip (1.4)     py2app (0.5.3)     pyobjc-core (2.3.2a0)     pyobjc-framework-AddressBook (2.3.2a0)     pyobjc-framework-AppleScriptKit (2.3.2a0)     pyobjc-framework-AppleScriptObjC (2.3.2a0)     pyobjc-framework-Automator (2.3.2a0)     pyobjc-framework-CalendarStore (2.3.2a0)     pyobjc-framework-CFNetwork (2.3.2a0)     pyobjc-framework-Cocoa (2.3.2a0)     pyobjc-framework-Collaboration (2.3.2a0)     pyobjc-framework-CoreData (2.3.2a0)     pyobjc-framework-CoreLocation (2.3.2a0)     pyobjc-framework-CoreText (2.3.2a0)     pyobjc-framework-DictionaryServices (2.3.2a0)     pyobjc-framework-ExceptionHandling (2.3.2a0)     pyobjc-framework-FSEvents (2.3.2a0)     pyobjc-framework-InputMethodKit (2.3.2a0)     pyobjc-framework-InstallerPlugins (2.3.2a0)     pyobjc-framework-InstantMessage (2.3.2a0)     pyobjc-framework-InterfaceBuilderKit (2.3.2a0)     pyobjc-framework-LatentSemanticMapping (2.3.2a0)     pyobjc-framework-LaunchServices (2.3.2a0)     pyobjc-framework-Message (2.3.2a0)     pyobjc-framework-OpenDirectory (2.3.2a0)     pyobjc-framework-PreferencePanes (2.3.2a0)     pyobjc-framework-PubSub (2.3.2a0)     pyobjc-framework-QTKit (2.3.2a0)     pyobjc-framework-Quartz (2.3.2a0)     pyobjc-framework-ScreenSaver (2.3.2a0)     pyobjc-framework-ScriptingBridge (2.3.2a0)     pyobjc-framework-SearchKit (2.3.2a0)     pyobjc-framework-ServerNotification (2.3.2a0)     pyobjc-framework-ServiceManagement (2.3.2a0)     pyobjc-framework-SyncServices (2.3.2a0)     pyobjc-framework-SystemConfiguration (2.3.2a0)     pyobjc-framework-WebKit (2.3.2a0)     pyobjc-framework-XgridFoundation (2.3.2a0)     pyOpenSSL (0.12)     PyRSS2Gen (1.0.0)     pysqlite (2.6.3)     python-dateutil (1.5)     requests (1.2.3)     Warning: cannot find svn location for setuptools==0.6c12dev-r85381     setuptools (0.6c12dev-r85381)     Twisted (11.0.0)     vboxapi (1.0)     wsgiref (0.1.2)     xattr (0.6.1)     zope.interface (3.5.1)


title: Simulation Real Time Network - Omnet++ and Xenomai

text: I'm a completely beginner. I'm studying Real Time Operating System and in particular Real Time networks. Does somebody know if Omnet++ is good to emulate Real Time Network? Does Omnet++ work on Xenomai?


title: Why the value of VSIZE in top is different from the value of VSZ (Virtual set size) in ps?

text: I know VSZ in `ps` is for the total address space allocated for the app and is sometimes aliased as vsize (mentioned in man page of `ps` on linux), but what's the definition of VSIZE in `top`? This top output from iPhone is different from the top on Linux:                PID COMMAND      %CPU   TIME   #TH #PRTS #MREGS  RPRVT  RSHRD  RSIZE  VSIZE      1875 emma         0.0%  0:30.83   7   139    932 17868K  5328K    29M   181M          root# ps -eo pid,rss,vsz|grep 1875      1875  29324   441324


title: issues booting Ubuntu [Firmware Bug ] : ACPI _BQC method, cannot determine initial brightness

text: I am running into an issue booting Linux on a new machine. I started with Ubuntu Server edition. I completed the initial setup via an ISO image, however when the machine restarted and went to load the fresh Ubuntu installation it stalled when trying to determine brightness. The last line in the boot process reads:               [Firmware Bug ] : ACPI: _BQC method, cannot determine initial brightness      Thinking that maybe this is a distro issue, I tried Fedora, same result. Any guidance would be most appreciated.


title: Installing OpenJDK 7 (JRE) but only policytools found in ./jre/bin

text: I'm trying to install Java 7 onto my Ubuntu machine through apt-get. I'm issuing the to install using apt-get:               sudo apt-get openjdk-7-jre      apt-get claims a successful install, but I cannot appear to make use of OpenJDK 7. Note: I have also tried headless version and gotten similar results. I'm a complete novice at Linux but comparing to OpenJDK 6 JRE which I have installed, there should be a java file at the ./jre/bin directory. I.e: A comparison of my OpenJDK 6 and 7 directories. OpenJDK 6:               root/bin/$ pwd     /usr/lib/jvm/java-6-openjdk-amd64/jre/bin     root/bin/$ ll     total 464     drwxr-xr-x 2 root root  4096 Dec 25 17:28 ./     drwxr-xr-x 5 root root  4096 Dec 19 22:01 ../     -rwxr-xr-x 1 root root   757 Jul  2 01:38 itweb-settings*     -rwxr-xr-x 1 root root 39480 Nov 16 17:28 java*     -rwxr-xr-x 1 root root  1260 Jul  2 01:38 javaws*     -rwxr-xr-x 1 root root 39472 Nov 16 17:28 keytool*     -rwxr-xr-x 1 root root 39552 Nov 16 17:28 orbd*     -rwxr-xr-x 1 root root 39552 Nov 16 17:28 pack200*     -rwxr-xr-x 1 root root 39480 Nov 16 17:28 policytool*     -rwxr-xr-x 1 root root 39472 Nov 16 17:28 rmid*     -rwxr-xr-x 1 root root 39480 Nov 16 17:28 rmiregistry*     -rwxr-xr-x 1 root root 39480 Nov 16 17:28 servertool*     -rwxr-xr-x 1 root root 39560 Nov 16 17:28 tnameserv*     -rwxr-xr-x 1 root root 87280 Nov 16 17:28 unpack200*      OpenJDK 7:               root/bin/$ pwd     /usr/lib/jvm/java-7-openjdk-amd64/jre/bin     root/bin/$ ll     total 16     drwxr-xr-x 2 root root 4096 Dec 25 17:33 ./     drwxr-xr-x 5 root root 4096 Dec 25 17:33 ../     -rwxr-xr-x 1 root root 6360 Jul 16 03:46 policytool*      If this is correct, I am unsure of how to proceed to set Java 7 to be my default Java. If this is incorrect, I am unsure of how to correct this. I have attempted uninstalling and reinstalling with similar results. EDIT: The output of following commands. The output of java -version after installation:               root/~/$ java -version     java version "1.6.0_27"     OpenJDK Runtime Environment (IcedTea6 1.12.6) (6b27-1.12.6-1ubuntu0.12.04.4)     OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)      The output of dpkg -S $(type java | awk '{print $3}') after installation:               root/bin/$ hash -r; dpkg -S $(type java | awk '{print $3}')     dpkg-query: no path found matching pattern /usr/bin/java.     root/bin/$ ll /usr/bin/java     lrwxrwxrwx 1 root root 22 Nov 19 13:40 /usr/bin/java -> /etc/alternatives/java*      The output for update-alternatives:               root/bin/$ update-alternatives --display java     java - auto mode       link currently points to /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java     /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java - priority 1061       slave java.1.gz: /usr/lib/jvm/java-6-openjdk-amd64/jre/man/man1/java.1.gz     Current 'best' version is '/usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java'.      * * * After uninstalling openjdk-6-jre               root/~/$ java -version     The program 'java' can be found in the following packages:      * default-jre      * gcj-4.6-jre-headless      * openjdk-6-jre-headless      * gcj-4.5-jre-headless      * openjdk-7-jre-headless     Try: apt-get install <selected package>     root/~/$      I then attempted to install Java 7 using `apt-get install openjdk-7-jre` but I am now back at the beginning; With Java 6 installed and Java 7 incorrectly installed.


title: .bashrc alias not working

text: I have set up a few aliases in my `.bashrc` file, like the following:               alias ras='rails server'     alias res='redis-server'     alias rc='rails console'     alias be='bundle exec'          # git alias's are as follows     alias gs='git status'     alias gc='git commit'     alias go='git checkout'     alias ga='git add -p'      But when I try them out, `gs` opens up ghostscript, and `go master` returns               :~/Work/boogle[master]$ go master     The program 'go' is currently not installed.  You can install it by typing:     sudo apt-get install golang-go      I am using Ubuntu 12.04 LTS. How can I make my aliases work?


title: List of killed processes HP-UX

text: Is there a file similar to the one in this answer http://unix.stackexchange.com/a/10078/5027 to determine the processes which were killed, in a certain time, for example, yesterday, in HP-UX?


title: How can I forcibly remove a package from Ubuntu by hand?

text: I posted this on ServerFault and got some helpful-looking questions, but no answer in terms of what can I do. **What, on a low level, can I do to completely exorcise a package that is jamming aptitude upgrades?** \-- I have a `libssl-dev` package installed, possibly because I am not sure if I bypassed the package manager, and it's visible from the package manager but won't go away.               root@li393-189:/home/jonathan/python-amazon-product-api-0.2.5# aptitude purge l     ibssl-dev     The following packages will be REMOVED:         libssl-dev{p}      The following partially installed packages will be configured:       apt      0 packages upgraded, 0 newly installed, 1 to remove and 84 not upgraded.     Need to get 0 B of archives. After unpacking 4,929 kB will be freed.     Do you want to continue? [Y/n/?] Y     Setting up apt (0.8.16~exp12ubuntu10.10) ...     gpg: Invalid option "--primary-keyring"     gpg: [don't know]: invalid packet (ctb=03)     gpg: read_keyblock: read error: invalid packet     gpg: enum_keyblocks(read) failed: invalid keyring     gpg: WARNING: nothing exported     dpkg: error processing apt (--configure):      subprocess installed post-installation script returned error exit status 2     No apport report written because MaxReports is reached already                                                                   Errors were encountered while processing:      apt     E: Sub-process /usr/bin/dpkg returned an error code (1)     A package failed to install.  Trying to recover:     Setting up apt (0.8.16~exp12ubuntu10.10) ...     gpg: Invalid option "--primary-keyring"     gpg: [don't know]: invalid packet (ctb=03)     gpg: read_keyblock: read error: invalid packet     gpg: enum_keyblocks(read) failed: invalid keyring     gpg: WARNING: nothing exported     dpkg: error processing apt (--configure):      subprocess installed post-installation script returned error exit status 2     Errors were encountered while processing:      apt      I want the presently installed libssl-dev to be replaced with a fresh package installation. No configuration of aptitude I've seen yet will remove it. How can I remove the existing package to be able to reinstall it from scratch? \--EDIT-- @Brigo, I had tried with aptitude rather than just apt-get, but apt-get gives what looks to me like an apparent equivalent:               root@li393-189:/home/jonathan/python-amazon-product-api-0.2.5# apt-get remove lI want the presently installed libssl-dev to be replaced with a fresh package installation. No configuration of aptitude I've seen yet will remove it.                              How can I remove the existing package to be able to reinstall it from scratch?                              --EDIT--                              @Brigo, I had tried with aptitude rather than just apt-get, but apt-get gives what looks to me like an apparent equivalent:                                   root@li393-189:/home/jonathan/python-amazon-product-api-0.2.5# apt-get remove l     ibssl-dev     Reading package lists... Done     Building dependency tree            Reading state information... Done     The following packages will be REMOVED:       libssl-dev     0 upgraded, 0 newly installed, 1 to remove and 84 not upgraded.     1 not fully installed or removed.     After this operation, 4,929 kB disk space will be freed.     Do you want to continue [Y/n]? Y     Setting up apt (0.8.16~exp12ubuntu10.10) ...     gpg: gpg: Invalid option "--primary-keyring"     [don't know]: invalid packet (ctb=03)     gpg: read_keyblock: read error: invalid packet     gpg: enum_keyblocks(read) failed: invalid keyring     gpg: WARNING: nothing exported     dpkg: error processing apt (--configure):      subprocess installed post-installation script returned error exit status 2     Errors were encountered while processing:      apt     E: Sub-process /usr/bin/dpkg returned an error code (1)     root@li393-189:/home/jonathan/python-amazon-product-api-0.2.5#       \--EDIT-- Here is the output to the suggested `sh -x /usr/bin/apt-key update`. root@li393-189:~# sh -x /usr/bin/apt-key update \+ set -e \+ unset GREP_OPTIONS \+ mktemp \+ SECRETKEYRING=/tmp/tmp.yKRn2OqlH3 \+ trap rm -f '/tmp/tmp.yKRn2OqlH3' 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM \+ GPG_CMD=gpg --ignore-time-conflict --no-options --no-default-keyring --secret- keyring /tmp/tmp.yKRn2OqlH3 \+ id -u \+ [ 0 -eq 0 ] \+ GPG_CMD=gpg --ignore- time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.yKRn2OqlH3 --trustdb-name /etc/apt/trustdb.gpg \+ GPG=gpg --ignore- time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.yKRn2OqlH3 --trustdb-name /etc/apt/trustdb.gpg \+ MASTER_KEYRING=/usr/share/keyrings/ubuntu-master-keyring.gpg \+ ARCHIVE_KEYRING=/usr/share/keyrings/ubuntu-archive-keyring.gpg \+ REMOVED_KEYS=/usr/share/keyrings/ubuntu-archive-removed-keys.gpg \+ ARCHIVE_KEYRING_URI=http://archive.ubuntu.com/ubuntu/project/ubuntu-archive- keyring.gpg \+ TMP_KEYRING=/var/lib/apt/keyrings/maybe-import-keyring.gpg \+ [ update = --keyring ] \+ TRUSTEDFILE=/etc/apt/trusted.gpg \+ apt-config shell TRUSTEDFILE Apt::GPGV::TrustedKeyring \+ eval \+ apt-config shell TRUSTEDFILE Dir::Etc::Trusted/f \+ eval TRUSTEDFILE='/etc/apt/trusted.gpg' \+ TRUSTEDFILE=/etc/apt/trusted.gpg \+ [ -r /etc/apt/trusted.gpg ] \+ GPG=gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.yKRn2OqlH3 --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg \+ GPG=gpg --ignore-time-conflict --no-options --no- default-keyring --secret-keyring /tmp/tmp.yKRn2OqlH3 --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg \+ TRUSTEDPARTS=/etc/apt/trusted.gpg.d \+ apt-config shell TRUSTEDPARTS Dir::Etc::TrustedParts/d \+ eval TRUSTEDPARTS='/etc/apt/trusted.gpg.d/' \+ TRUSTEDPARTS=/etc/apt/trusted.gpg.d/ \+ [ -d /etc/apt/trusted.gpg.d/ ] \+ run-parts --list /etc/apt/trusted.gpg.d/ --regex ^.*\\.gpg$ \+ command=update \+ [ -z update ] \+ shift \+ [ update != help ] \+ which gpg \+ update \+ [ ! -f /usr/share/keyrings/ubuntu-archive- keyring.gpg ] \+ requires_root \+ id -u \+ [ 0 -ne 0 ] \+ gpg --ignore-time- conflict --no-options+ --no-default-keyring --secret-keyring /tmp/tmp.yKRn2OqlH3gpg --trustdb-name /etc/apt/trustdb.gpg --ignore-time- conflict --no-options --no-default-keyring --quiet --batch --secret-keyring /tmp/tmp.yKRn2OqlH3 --keyring --trustdb-name /etc/apt/trustdb.gpg /usr/share/keyrings/ubuntu-archive-keyring.gpg --keyring /etc/apt/trusted.gpg --export --primary-keyring /etc/apt/trusted.gpg \--import gpg: Invalid option "--primary-keyring" gpg: [don't know]: invalid packet (ctb=03) gpg: read_keyblock: read error: invalid packet gpg: enum_keyblocks(read) failed: invalid keyring gpg: WARNING: nothing exported \+ rm -f /tmp/tmp.yKRn2OqlH3


title: Where can I check what was updated on the last update?

text: Once in a while, when updating my system after reboot I got a black screen. The problem seems to bee ATI drivers, but it's weird because even TTYs do not work. For fix it I reboot on recovery mode, uninstall ATI drivers and then install them again and everything it's fine. However, I'm trying to figure out which update is causing this. Is there any log where I can see which packages were updated the last time I updated the system?


title: How to map terminal shortcut from CTRL-M to another combination

text: I read in another post that you can type `Ctrl``J` or `Ctrl``M` instead of the `Return` key in the terminal, which is great. But what I want to be able to do, is change that to another combination, for example: `Ctrl``spacebar`. I've tried remapping the `F1` key, to no avail. Is this possible?


title: Problem with Fedora 14 after ATI Catalyst 10.11 Install

text: I followed the steps as given in this article. After following all of the steps, ATI Catalyst was installed but when i boot my system, I get these options at GRUB:               GNU GRUB version 0.97     --------------------------------------     fedora(2.6.35.10-74.fc14.i686)     fedora(2.6.35.6-45.fc14.i686)          other     --------------------------------------     fedora(2.6.35.10-74.fc14.i686) # This is for fedora 14,     fedora(2.6.35.6-45.fc14.i686)  # It now appears on GRUB. This was after the installation of ATI Catalyst.        1. By choosing the second one, a lot of commands appear on screen and after that the screen goes blank but the system keeps running   2. Whenever I start up my system, fedora boots a little late   3. The command line interface for fedora appears in very large font   4. Even the graphics appear poor System information:   * Fedora Release 14(laughlin)   * Kernel linux 2.6.35.10-74.fc14.i686   * Gnome 2.32.0   * ATI mobility radeon HD 4500   * Video Processor ATI Radeon Graphics Processor (0x9553)   * Driver Version 8.553.2.0 Is there any way to correct such behavior?   If not, please tell how to remove the ATI Catalyst.


title: How do I shutdown the system after a particular process exits

text: I am downloading some software; I can see the `pid` of the download process with `top`. Let's say it's `1001`. How can I make it so that my computer shuts down after process `1001` exits?


title: Extract given tarball and retar it exactly

text: My versioned project uses the contents of an upstream tarball. I would like to extract the contents in such a way as to be able to recreate the original tarball exactly. The reason is that I don't want to include big binary blobs in my versioned project. The retarring is unreliable, often producing slightly different tarballs. I suspect compression algorithm heuristics produce different results under different conditions. EDIT: A further problem making the solution difficult is that some versioning systems (git) do not track empty dirs, thus excluding solutions than do not involve the creation of an auxiliary metadata file. See my comment to Hauke. (Thanks Hauke for this edit).


title: Confusing my IP stack

text: At work, I have an Oracle GRID/RAC cluster of two hosts, including Oracle's SCAN functionality. Picking one host: `eth0` is the management port on `169.254.10.25`. `eth1`, `eth2`, and `eth3` comprise `bondeth0` (because that's not confusing o_O). It has its bond IP address `169.254.30.61`, and one or two of the SCAN IP addresses, `169.254.30.71`, `.72`, and/or `.73` as virtual IP addresses. Clear as mud? Now, I have this second host with a single interface, on `169.254.10.80`. If I ping `10.25` from there, I get responses. If I ping `30.61`, I get responses. If I ping any of the SCAN addresses, my sniffer sees the ping arrive, but I never get a response. If I repeat the test from another host on an entirely different subnet, I get responses from `10.25`, `10.80`, `30.61`, `30.71`, and `30.73`. (`30.72` was on the other host in the GRID/RAC cluster.) My inclination is that the host is getting a ping request to, say, `30.71`, on the bonded interface and tries to send its reply along `eth0`. Somewhere along the way, that fails. So far, I haven't figured out how to test and verify that. Any ideas?


title: Why do bash variables disappear when I use xargs?

text: I have a simple bash script and want to count how often a command gets called. Here is a minimal example, the counter is called c and should be 4 at the end:               #!/bin/bash          c=0;     for a in X Y; do       for b in 1 2; do         c="$(( ${c} + 1 ))"         echo "${a}${b}"       done #| xargs -L 1 -P 20 echo       echo "count $c"     done     echo "--"     echo "final $c"      Works great without xargs (final=4), but when I uncomment the pipe to xargs it counts nothing (final=0). Why?               Expected output: |  This happens with xargs:     X1               |  X1     X2               |  X2     count 2          |  count 0     Y1               |  Y1     Y2               |  Y2     count 4          |  count 0     --               |  --     final 4          |  final 0


title: sed: delete all occurrences of a string except  the first one

text: I have a logfile with timestamps in it. Occasionally there are multiple timestamps in one line. Now I would like to remove all of the timestamps from a line but keep the first one. I can do `s/pattern//2` but that only removes the second occurrence and `sed` doesn't allow something like `s/pattern//2-`. Any suggestions?


title: sudo mount from webserver (Apache) by mod_php, result not visible by root

text: Intial question: http://stackoverflow.com/questions/19598201/umounting- through-exec-with-sudo-the-user-is-a-sudoer-with-nopasswd Basically, I have a PHP script, that:               exec('sudo mount /dev/md/stone:supershare /mnt/supershare');      It completes with no error, exit code 0. From a separate `root` session, I `cat /proc/mounts` and it shows no signs of my `supsershare`. Attempt with `root` to `rm -r /mnt/supershare`:               [root@stone mnt]# rm -r supershare/     rm: cannot remove ‘supershare/’: Device or resource busy      Attempt with `root` to `umount /mnt/supershare`:               [root@stone mnt]# umount /mnt/supershare     umount: /mnt/supershare: not mounted      Attempt with `root` to `mdadm --stop /dev/md/stone:supershare`:               [root@stone mnt]# mdadm --stop /dev/md/stone\:supershare     mdadm: Cannot get exclusive access to /dev/md/stone:supershare:Perhaps a running process, mounted filesystem or active volume group?      Any attempts to perform the same commands with sudo from webserver are successful (they show signs of mountpoint, they unmount the devices, stop the raids etc.). And, yes, I am root:               [root@stone mnt]# id     uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),19(log)      How come `root` does not get notified about the mounts performed by webserver?   In what scenarios does `mount` become local to effective user?