title: gawk with gawkextlib

text: In my system (Slackware64-14.1) `gawk` is installed in version 4.1.0. I'd like to install gawkextlib to have access to some of its features, namely `xml`. From the `README` file of `gawkextlib-0.4.9`: > To use this library, you must first build the new version of gawk containing > shared extension library support. Please use gawk 4.1 or later, or use this > recipe to build from the git sources: > > git clone git://git.savannah.gnu.org/gawk.git cd gawk   >  ./bootstrap.sh ./configure --prefix=/tmp/newgawk make && make check && make > install > > After you build and install that in /tmp/newgawk, you can then build > gawkextlib like so: > > Using git: git clone git://git.code.sf.net/p/gawkextlib/code gawkextlib cd > gawkextlib ./update-autotools > > Or it may be easier from a tarball if you do not have current autotools > installed: tar xf gawkextlib-.tar.gz cd gawkextlib- > > Either way, the steps to build are the same: ./configure --with- > gawk=/tmp/newgawk --prefix=/tmp/newgawk make && make check && make install The process fails with: > /usr/bin/mkdir -p '/tmp/newgawk/lib/gawk' /bin/sh ../libtool   >  --mode=install ../build-aux/install-sh -c xml.la gd.la mpfr.la > '/tmp/newgawk/lib/gawk' libtool: install: error: cannot install `xml.la' to > a directory not ending in /usr/lib/gawk make[2]: _*_ [install- > pkgextensionLTLIBRARIES] Error 1 This is not a big problem, as I'd really like `gawkextlib` to integrate with existing `gawk` residing in `/usr`. So, when:               $ ./configure --prefix=/usr --with-gawk=/usr     $ make && make test      # make install      Everything installs fine.               # ls /usr/lib/libgawkextlib.*     /usr/lib/libgawkextlib.la  /usr/lib/libgawkextlib.so  /usr/lib/libgawkextlib.so.0  /usr/lib/libgawkextlib.so.0.0.0      but               $ awk -l xml     awk: fatal: can't open shared library `xml' for reading (No such file or directory)      From `gawk` man page: > -l > > --load lib Load a shared library lib. This searches for the library using > the AWKLIBPATH environment variable. If the initial search fails, another > attempt will be made after appending the default shared library suffix for > the platform. The library initialization routine is expected to be named > dl_load(). After setting up `AWKLIBPATH`:               $ export AWKLIBPATH=/usr/lib     $ echo $AWKLIBPATH               /usr/lib     $ awk -l xml     awk: fatal: can't open shared library `xml' for reading (No such file or directory)      `awk` aka `gawk` can't find the shared library. What am I missing here?


title: Bash parameter expansion - greedy versus non-greedy

text: It's a bit of a contrived example but here goes: Say I have a variable `1.2.3.4` containing version information and need to replace the `.4` at the end with `.5`               version=1.2.3.4     echo ${version%.*}.5     1.2.3.5    #no problem      But when I attempt to "in-line" the substitution with `/` and a `%` anchor               echo ${version/%.*/.5}     1.5      Bash does a greedy substitution. Is there a way to have bash take the substitution up "non-greedily" so I can use substitution as a replacement for the earlier delete+append approach?


title: Ubuntu plus whonix

text: I have a dual boot Ubuntu 12.04 and Windows 7 Professionl 32 bit. Is it possible to install Whonix OS inside of Ubuntu? Or.. LXDE OS inside Ubuntu? Any suggestions are welcome.


title: Time running a Ruby script is different locally than over SSH

text: Has anyone else seen this behavior? I created a simple Ruby script for giggles to see how fast it would count up on a couple machines I have. Here's the source:                   for n in 1...1000000 do             puts "#{n}"     end      I ran the script using "time ruby ./rubytest.rb" On my not-newest-generation MacBook, running this locally took about 15 seconds. If I SSH from work to my MacBook and run it over that SSH session (over the Internet), it takes nearly 55 seconds. If I use "ssh localhost" on my MacBook, from the local console, running the script takes about 10 seconds. Questions: Do Ruby scripts somehow get blocked when dumping output to a console, so it is slowed down when pumping data to a remote terminal? Does SSH compress a connection, so that when I SSH'd in locally the script was faster because it was compressing the display of data fast enough that even with the compression overhead the script could run faster because it was somehow acknowledging the output faster?


title: Linux splitting array into separate variables

text: I've been programming on MVS for years and recently have been using Linux so my Linux skills are not that great yet but I understand development concepts well. What I'm trying to do is to read a directory of files and take the name of all files with an extension of .trg. Then, I need to take those names and store them in separate variables so I can use them later in my script to refer to components and use them for file naming. I have gotten the file names using the find command:               param=`find *${file_name}*.trg      This produced the $param variable loaded with the values (ABC1099R ABC1099C) as their are two files in the directory named ABC1099R.trg and ABC1099C.trg I now need to assign those values to individual variables so I can use them later in my script. I have searched high and low on the web, but every example I find is using echo to just display them or they are using a do while loop and using the individual values within the loop. I need to have them assigned to their own variables so they are available to me later in the script. Initially I tried a for do loop like this:               for trigger_files in $param; do         app1=(basename "{trigger_files}" .trg).dat     done      But that only gives the first occurrence app1=ABC1099R I need to have all occurrences saved to their own individual variable. There could be potentially 20 filenames, but I figured I just needed to get it working with two, therefore it would be able to handle many.


title: Installing Linux on UEFI ASUS Machine

text: I have been having troubles for weeks trying to get Linux Mint on my new computer. It is a ASUS F75V-NS1 with UEFI Bios and Windows 8 install. So far, I was able to get a Linux Mint 64-bit Bootable ISO from USB installed on a partition of my HD. However, when I installed, my wireless was not working. `rfkill list all` would always show my phy0 having a physical block on it. So I thought maybe it was because it was 64-bit and not 32-bit. But when I went to install 32-bit ISO on my USB it says the ISO is not UEFI compatible even tho it is exactly like the 64-bit version. So does UEFI only work with 64-bit images? If so then I don't know what else to try. Thanks


title: Cannot remove file on NTFS partition, event as root

text: I have a dual boot system, and use a NTFS partition as universal storage between Windows 7 and Ubuntu. Lately, that partition has been throwing CHKDSK prompts on Windows boot, so I thought it was a symptom of a failing drive. As a result, I cloned the drive to a larger 1TB drive and resized the partitions in Linux. Still, the CHKDSK prompt is showing up, but this time there were a few filenames printed out in the scan, which later froze at 50% completion. These files are a set of Perl scripts that I used to create an automated panorama generation script a few years back. Now, when I try to `rm -r *` in the folder where the files are held, I get               jason@asus:/media/Storage/Programming/Libraries/Linux$ rm -r *     rm: cannot remove `Image-Size-3.232/blib/man3/Image::Size.3pm': No such file or directory     rm: cannot remove `Panotools-Script-0.26/blib/man3/Panotools::Makefile.3pm': No such file or directory     rm: cannot remove `Panotools-Script-0.26/blib/man3/Panotools::Makefile::Comment.3pm': No such file or directory     rm: cannot remove `Panotools-Script-0.26/blib/man3/Panotools::Makefile::Rule.3pm': No such file or directory     rm: cannot remove `Panotools-Script-0.26/blib/man3/Panotools::Makefile::Utils.3pm': No such file or directory     ...     ...      Now, inside `Image-Size-3.232/blib/man3/`, I executed `ls -il` which printed out               3723 -rwxrwxrwx 0 root root 25473 Jun 19  2012 Image::Size.3pm      Now, `stat 3723` prints out               jason@asus:/media/Storage/Programming/Libraries/Linux/Image-Size-3.232/blib/man3$ stat 3723     stat: cannot stat `3723': No such file or directory      How can I remove these files that have so far proven fireproof to any convential removal function?


title: How exactly is tzdata database used?

text: Different operating systems seem to handle daylight-saving time(DST) differently. I really like the Cisco IOS approach which is very simple and allows one to change the date and time when DST starts and ends. For example:               clock summer-time EDT recurring 2 Sun Mar 2:00 1 Sun Nov 2:00 60      ..sets clock 60 minutes ahead on the Sunday of second week of March at 2:00 and shifts clock 60 minutes back on first Sunday on November at 2:00. How Linux handles DST? I know that there is a `tzdata` package which contains timezone data files and those files are installed to `/usr/share/zoneinfo/` directory. How and by which utilities are those files used? I can see the the shift from UTC(2) and time-zone names(EET and EEST) in file:               T60:~# strings /usr/share/zoneinfo/posix/Europe/Helsinki     TZif2         HMT     EEST     TZif2     EEST     EET-2EEST,M3.5.0/3,M10.5.0/4     T60:~#       In addition, `M3` is probably third month and `M10` is a tenth month? In addition, offset should be also specified somewhere. For example in IOS one can configure that once the DST happens, the clock shifts for example 90 or 120 minutes instead of 60.


title: Ubuntu 12.04 LTS doesn't auto-mount DVD drive

text: For some reason, my Ubuntu has ceased to auto-mount DVD media. I can do manually               sudo mount /dev/dvdrw /mnt/dvdrw      and mounting happens fine and I can access the media. But it doesn't do it automatically though. I have no idea when this started to happen because it's been quite long since I used that device last time.


title: Building example device driver error: insmod invalid module format

text: I am following the tutorial @ http://www.embeddedsystemonline.com/home/embedded- system/embedded_linux/lab3-linux-device-driver on step #7 of this tutorial,               $ cd /usr/src/kernels/linux-2.6.20.1/drivers/char/examples     $ /sbin/insmod hello1.ko      I then receive the following error (after `sudo /sbin/insmod hello1.ko`)               insmod: error inserting 'hello1.ko': -1 Invalid module format      Using the lsmod command, I do not see the module in the kernel


title: will tinycore work with S110 wireless adapter?

text: will tinycore work out of the box with S110 lenovo netbook? Wireless is obviously the first issue to be encountered? can anybody report that it will work out ofthe box? or i will have to spend some time on it?


title: On Red Hat Enterprise Linux 6.2 how can I use Python 2.7 as default not Python 2.6? I did but still showing 2.6?

text: RHEL 6.2 I have python 2.6 but I need default python 2.7 using `yum` packaging (so that nothing goes messed up, cause its a heavy duty working system, all I need the python 2.7 on it, without messing up). I did following but still I see `python` version as 2.6, any pointer to this please?               $ cat /etc/issue     Red Hat Enterprise Linux Server release 6.2 (Santiago)     Kernel \r on an \m          $ python --version     Python 2.6.6          $ sudo sh -c 'wget -qO- http://people.redhat.com/bkabrda/scl_python27.repo >> /etc/yum.repos.d/scl.repo'          $ yum search python27     Loaded plugins: amazon-id, rhui-lb, security     scl_python27                                                                                | 2.9 kB     00:00          scl_python27/primary_db                                                                                |  38 kB     00:00          ========================================================================= N/S Matched: python27 =========================================================================     python27.i686 : Package that installs python27     python27.x86_64 : Package that installs python27     python27-expat-debuginfo.i686 : Debug information for package python27-expat     python27-expat-debuginfo.x86_64 : Debug information for package python27-expat     python27-python-coverage-debuginfo.i686 : Debug information for package python27-python-coverage     python27-python-coverage-debuginfo.x86_64 : Debug information for package python27-python-coverage     python27-python-debuginfo.i686 : Debug information for package python27-python     python27-python-debuginfo.x86_64 : Debug information for package python27-python     python27-python-markupsafe-debuginfo.i686 : Debug information for package python27-python-markupsafe     python27-python-markupsafe-debuginfo.x86_64 : Debug information for package python27-python-markupsafe     python27-python-simplejson-debuginfo.i686 : Debug information for package python27-python-simplejson     python27-python-simplejson-debuginfo.x86_64 : Debug information for package python27-python-simplejson     python27-python-sqlalchemy-debuginfo.i686 : Debug information for package python27-python-sqlalchemy     python27-python-sqlalchemy-debuginfo.x86_64 : Debug information for package python27-python-sqlalchemy     python27-runtime.i686 : Package that handles python27 Software Collection.     python27-runtime.x86_64 : Package that handles python27 Software Collection.     python27-babel.noarch : Tools for internationalizing Python applications     python27-build.i686 : Package shipping basic build configuration     python27-build.x86_64 : Package shipping basic build configuration     python27-expat.i686 : An XML parser library     python27-expat.x86_64 : An XML parser library     python27-expat-devel.i686 : Libraries and header files to develop applications using expat     python27-expat-devel.x86_64 : Libraries and header files to develop applications using expat     python27-expat-static.i686 : expat XML parser static library     python27-expat-static.x86_64 : expat XML parser static library     python27-python.i686 : An interpreted, interactive, object-oriented programming language     python27-python.x86_64 : An interpreted, interactive, object-oriented programming language     python27-python-babel.noarch : Library for internationalizing Python applications     python27-python-coverage.i686 : Code coverage testing module for Python     python27-python-coverage.x86_64 : Code coverage testing module for Python     python27-python-debug.i686 : Debug version of the Python runtime     python27-python-debug.x86_64 : Debug version of the Python runtime     python27-python-devel.i686 : The libraries and header files needed for Python development     python27-python-devel.x86_64 : The libraries and header files needed for Python development     python27-python-docutils.noarch : System for processing plaintext documentation     python27-python-jinja2.noarch : General purpose template engine     python27-python-libs.i686 : Runtime libraries for Python     python27-python-libs.x86_64 : Runtime libraries for Python     python27-python-markupsafe.i686 : Implements a XML/HTML/XHTML Markup safe string for Python     python27-python-markupsafe.x86_64 : Implements a XML/HTML/XHTML Markup safe string for Python     python27-python-nose.noarch : Discovery-based unittest extension for Python     python27-python-nose-docs.noarch : Nose Documentation     python27-python-pygments.noarch : Syntax highlighting engine written in Python     python27-python-setuptools.noarch : Easily build and distribute Python packages     python27-python-simplejson.i686 : Simple, fast, extensible JSON encoder/decoder for Python     python27-python-simplejson.x86_64 : Simple, fast, extensible JSON encoder/decoder for Python     python27-python-sphinx.noarch : Python documentation generator     python27-python-sphinx-doc.noarch : Documentation for python-sphinx     python27-python-sqlalchemy.i686 : Modular and flexible ORM library for python     python27-python-sqlalchemy.x86_64 : Modular and flexible ORM library for python     python27-python-test.i686 : The test modules from the main python package     python27-python-test.x86_64 : The test modules from the main python package     python27-python-tools.i686 : A collection of development tools included with Python     python27-python-tools.x86_64 : A collection of development tools included with Python     python27-python-virtualenv.noarch : Tool to create isolated Python environments     python27-python-werkzeug.noarch : The Swiss Army knife of Python web development     python27-python-werkzeug-doc.noarch : Documentation for python-werkzeug     python27-tkinter.i686 : A graphical user interface for the Python scripting language     python27-tkinter.x86_64 : A graphical user interface for the Python scripting language      **EDIT:** (alternative option I also tried as following):               #!/bin/bash     # Install Python 2.7.3 alternatively     yum groupinstall "development tools" -y     yum install readline-devel openssl-devel gmp-devel ncurses-devel gdbm-devel zlib-devel expat-devel libGL-devel tk tix gcc-c++ libX11-devel glibc-devel bzip2 tar tcl-devel tk-devel pkgconfig tix-devel bzip2-devel sqlite-devel autoconf db4-devel libffi-devel valgrind-devel -y          mkdir tmp     cd tmp     wget http://python.org/ftp/python/2.7.3/Python-2.7.3.tgz     tar xvfz Python-2.7.3.tgz     cd Python-2.7.3     ./configure --prefix=/opt/python2.7 --enable-shared     make     make altinstall     echo "/opt/python2.7/lib" >> /etc/ld.so.conf.d/opt-python2.7.conf     ldconfig     cd ..     cd ..     rm -rf tmp               [root@ip-10-59-143-73 bin]# pwd     /opt/python2.7/bin     [root@ip-10-59-143-73 bin]# tree     .     ├── 2to3     ├── idle     ├── pydoc     ├── python2.7     ├── python2.7-config     └── smtpd.py          0 directories, 6 files     [root@ip-10-59-143-73 bin]# ./python2.7 --version     Python 2.7.3          [root@ip-10-59-143-73 bin]# python --version     Python 2.6.6


title: How do I keep my display output from toggling by itself?

text: It happens with a Vostro 3550, Debian, Gnome and Philips 1080p television. As soon as I connect the HDMI it starts doing it and goes from mirror to just the laptop display to just the TV to conjugated at intervals of 15 seconds to 5 minutes. The Fn F1 command and the display tab change it only for it to continue happenning. I should also mention that the TV shifts from 1080p and a more contrasted image with less quality throughout this toggling. xrandr               >Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 8192 x 8192     LVDS1 connected (normal left inverted right x axis y axis)        1366x768       60.0 +   40.1          1360x768       59.8     60.0          1024x768       60.0          800x600        60.3     56.2          640x480        59.9       VGA1 disconnected (normal left inverted right x axis y axis)     HDMI1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 640mm x 360mm        1920x1080      60.0*+   50.0     30.0     25.0     30.0     25.0     24.0          1280x1024      60.0          1360x768       59.8          1280x720       60.0     50.0          1440x576       25.0          1024x768       60.0          1440x480       30.0          800x600        60.3          720x576        50.0          720x480        59.9          640x480        60.0     59.9       DP1 disconnected (normal left inverted right x axis y axis)      after               xrandr --output LVDS1 --mode 1360x768 --output HDMI1 --same-as LVDS1          Screen 0: minimum 320 x 200, current 1360 x 768, maximum 8192 x 8192     LVDS1 connected 1360x768+0+0 (normal left inverted right x axis y axis) 344mm x 194mm        1366x768       60.0 +   40.1          1360x768       59.8*    60.0          1024x768       60.0          800x600        60.3     56.2          640x480        59.9       VGA1 disconnected (normal left inverted right x axis y axis)     HDMI1 connected 1360x768+0+0 (normal left inverted right x axis y axis) 640mm x 360mm        1920x1080      60.0 +   50.0     30.0     25.0     30.0     25.0     24.0          1280x1024      60.0          1360x768       59.8*         1280x720       60.0     50.0          1440x576       25.0          1024x768       60.0          1440x480       30.0          800x600        60.3          720x576        50.0          720x480        59.9          640x480        60.0     59.9       DP1 disconnected (normal left inverted right x axis y axis)      I tried stopping `udev` in case that was causing the toggling:               root@mach:/home/rt# sudo service udev stop     [ ok ] Stopping the hotplug events dispatcher: udevd.          root@mach:/home/rt# xrandr     Screen 0: minimum 320 x 200, current 3286 x 1080, maximum 8192 x 8192     LVDS1 connected 1366x768+0+0 (normal left inverted right x axis y axis) 344mm x 194mm        1366x768       60.0*+   40.1          1360x768       59.8     60.0          1024x768       60.0          800x600        60.3     56.2          640x480        59.9       VGA1 disconnected (normal left inverted right x axis y axis)     HDMI1 connected 1920x1080+1366+0 (normal left inverted right x axis y axis) 640mm x 360mm        1920x1080      60.0*+   50.0     30.0     25.0     30.0     25.0     24.0          1280x1024      60.0          1360x768       59.8          1280x720       60.0     50.0          1440x576       25.0          1024x768       60.0          1440x480       30.0          800x600        60.3          720x576        50.0          720x480        59.9          640x480        60.0     59.9       DP1 disconnected (normal left inverted right x axis y axis)


title: console-kit-daemon Hogging CPU and RAM

text: We have a system that's been a bit sluggish. `top` reports that console-kit- daemon takes anywhere from 18-30% CPU and about 50% memory. There are only two users logged in, one on X and one via ssh. Any ideas how to resolve this? Running Debian. `uname` reports: Linux bulls5 2.6.32-5-686 #1 SMP Sun Sep 23 09:49:36 UTC 2012 i686 GNU/Linux First few lines of `top`:                9456 root      20   0 2006m 1.8g 2020 S   19 50.2   1788:50 console-kit-dae        1501 messageb  20   0  425m 397m  796 S    0 10.6 230:20.64 dbus-daemon        3799 tomcat6   20   0  932m 450m 7208 S    0 12.0 106:36.35 java      24383 postgres  20   0 48312 7956 5640 S    0  0.2   0:00.44 postgres      27239 root      20   0  8672 3092 2544 S    0  0.1   0:00.01 sshd      27304 root      20   0  8672 3092 2544 S    0  0.1   0:00.01 sshd


title: Best way to handle lots of mail on server?

text: Due to some bad cron jobs I now have ~1600 mail messages, most of them containing the same error log. I would like to quickly group them by subject and delete them, while limiting the chances of missing some important message. I couldn't figure out a way to do anything using the `mail` command other than deleting each message individually. I tried installing `pine`, but it seems that even there I have to go over each message individually and hit the D key. Surely there's a way to script this. Right? I'm using ubuntu server 10.04.


title: Running a statically linked binary with a different glibc

text: I have a statically linked binary for a tool that I'm trying to run on RHLE4. The tool complains about glibc. It needs 2.4 and the one in the system is 2.3. Here is the message that it spits out:               ./wkhtmltoimage-i386: /lib/tls/libc.so.6: version `GLIBC_2.4' not found (required by ./wkhtmltoimage-i386)      Is there a way to build glibc2.4 and use it just for this tool, without replacing the glibc2.3 in the system ? While building glibc2.4 what prefix should I use for configure ?


title: Why are the fonts all screwy for remote X11 apps on one Mac client?

text: I have two Mac OS X clients, both running XQuartz 2.1.6 (xorg-server 1.4.2-apple33). When I SSH into a remote linux system enabling X11 forwarding and launch gnome-terminal, on one Mac the terminal looks correct while on the other, the fonts are all screwy! `[jnet@Stan ~]$ ssh -X jnet@kyle.local gnome-terminal` produces: ![Lookin good!](http://i.stack.imgur.com/VLxc5.png) `powerbook:~ hp$ ssh -X jnet@kyle.local gnome-terminal` produces: ![OH MY GOD, MY EYES!!!!!](http://i.stack.imgur.com/0EosJ.png) The problem goes away on the powerbook if I zoom in twice: ![Looks OK only because the image is scaled down to fit](http://i.stack.imgur.com/ppQkx.png) **Edit:** This affects a number of apps, not just gnome-terminal. It also affects Thunderbird, for example.


title: Sort data in descending order of first column, for equal values, use second column in ascending order

text: Allow me to clarify: Assume I have some keywords with frequency of their usage:               12 Hi     7  Hash     7  C++       9  Superuser     17 Stackoverflow     9  LaTeX       42 Life     9  Ubuntu      What I want, is to sort this data based on frequency in descending order and if there are some equal values, it should use the second column in ascending order.               sort -n -r foo.txt      Does the first part but then second column are also `reversed`:               42 Life     17 Stackoverflow     12 Hi     9  Ubuntu     9  Superuser     9  LaTeX       7  Hash     7  C++      How can I achieve the following results?               42 Life     17 Stackoverflow     12 Hi     9  LaTeX       9  Superuser     9  Ubuntu     7  C++      7  Hash      I think I have to use `-k` argument but I can't figure out how! I want to know how this can be done using solely `sort` command of `bash`. However if it's not possible to achieve this only by `sort`, other commands should be Bourne shell compatible.


title: How does Ubuntu lock my Live USB?

text: I notice that, after booting from my Live USB (with Ubuntu inside) and shutdown, I won't be able to boot it again, unless I unplug the USB and plug it in again. Is this a side-effect of something, or is it intentional? I wonder what mechanism is used to do this?


title: I need to swap displays in Gnome 3 login screen

text: I use two monitors with Debian Jessie and Gnome 3. Everything works fine, but there is one cosmetic bug. However a bit annoying. I cannot figure out, how to swap the displays on Gnome login screen. I have the left side on right and the right one on left. I'm googling whole day, but nothing found...


title: Can't apply brightness to terminal's background color

text: I have a problem with colors in my terminal emulator. I am using `LXTerminal` as my terminal emulator and `LXDE` as my desktop environment. The following command is supposed to print red text on grey background:               printf "\n\033[1;31;40m"hello"\033[00m\n\n"      but that does not work. The grey background is missing (red text is OK). On my older machine (`Gnome/Gnome Terminal`) everything works fine I have tried installing several other terminal emulators, but the problem persists. I am not even sure whether this issue is related to terminal emulator, or something else. In Console (CTRL+ALT+F1) the background grey color does not work on either machine) This problem is limited to grey background only. All other colors work OK, for instance the following prints red text on green background.               printf "\n\033[1;31;42m"hello"\033[00m\n\n"      I would appreciate any help. I don't even know where to start troubleshooting.


title: Why is bluetooth-agent getting stuck on authorizing?

text: I am trying to manually connect between my laptop and phone. I have `bluez- utils` version `4.98-2ubuntu7` installed. When I run the agent on the terminal, I get:               asheesh@U32U:~$ sudo bluetooth-agent 4835     Pincode request for device /org/bluez/980/hci0/dev<id>     Authorizing request for /org/bluez/980/hci0/dev<id>      The pincode request line gets printed when I try to pair from my phone. After I enter the passkey on being prompted, the device gets authorized. I can now send files to the laptop from my phone. However, the application gets stuck after authorizing request and control is not passed back to the terminal. Why is this happening? How do I get back control? _This seems to be contrary to examples I have seen across the internet, where the terminal becomes available after authorization to run further commands._ ~~I realise that running it in the background is a possible solution, but since I need to run certain other tasks once pairing is completed, I would prefer to have it run in the foreground.~~ I tried using this:               bluetooth-agent "$PIN" 1> ./bluelog #Background run tested also      However, the process does not write its output to file till it completes (or is killed), so I cannot test the output in `bluelog`. Is there a way to force the process to write output before completion?


title: Appending text to end of a textfile

text: How can I append a new line to a text file followed by current date and time?


title: How to set up ssh server with VPN tunnel? (Policy routing for sshd service)

text: It's difficult to me to explain in words, so I made diagrams. In short, I want this to work: ![The Goal](http://i.stack.imgur.com/etGkh.png)   Basically I want to be able to connect from my laptop [A] to my desktop [B] via ssh, and run terminal program over OpenVPN connection, let's say IRC client for example. So far I have working sshd, OpenVPN tunnel, and port forwarding on my router, but seems like port is closed (or not being forwarded), I get connection timeout. ~~I also tried without VPN and that failed as well~~. > Edit:   >  When [B] runs without OpenVPN it accepts connections to External IP, when > it runs with OpenVPN it doesn't. I have no idea what is wrong. * * * Strangely (for me) this is working ok: ![enter image description here](http://i.stack.imgur.com/eRl4H.png) I can connect from [A] to [B] `[A]$ ssh [B].local_IP`,   and connect from [B](over VPN) to [B](WAN IP) `[B]$ ssh [B].WAN_IP`.   I hope this makes sense. In this configuration port forwarding seems to work, also sshd working locally; in previous configuration port forwarding is not working(?). * * * I thought it should be easy, but it's not. Searching google is futile. ~~My router is Belkin F5D8636-4 v1 (01), potential candidate for causing trouble, but I would rather exclude every other possibility before buying new one.~~ > Edit 2):   >  I stumbled upon this post, but the answer doesn't work for me. After > fiddling with policy routing I had some success, however it created some > other problems, and I learned I have no comprehension of routing tables :(   > I believe however, the solution is in policy routing. **Any advice appreciated.**


title: Why does my CMS run extremely slow in my workstation (Ubuntu)

text: For over a year I have been struggling with the response speed on my Drupal v7.2x CMS install. Let me explain. I'm running Drupal 7.2x on an Ubuntu 12.10 (upgrade to 13.xx pending) for the purpose of webdev projects for pure Drupal CMS (though Symfony may follow also later). I have never installed Xammp or any similar web services preferring to run on localhost with the LAMP (Apache etc) included with the Ubuntu install. It is becoming impossible to make even the smallest changes as the whole process seems to take the best part of 1-3 mins to write to the CMS and though I have persevered, it's become a serious pain! I have asked similar on other stack exchanges I'm on with no real answer given (other than get a faster machine! It's the second one and it's a good spec machine..running PURELY Ubuntu and is not shared with any other OS). I have done all the normal things, cache clearings, reduction on logs and turned on/off every possible option 'button' in the backend of Drupal config. I want to stay with the Drupal framework. The machine is my primary home workstation which I use for the normal 'everyday' things; browsing web, WebDev, Office etc and I installed the Ubuntu desktop. To this some have said I should really go for a 'server' box, others has said that it could be I need something like Nginx; some have said it could be a DNS issue, which I have not implemented for fear of 'ballsing' up my current projects LOL, but the speed of re-writes takes ages and I really need some quality advice on what is happening behind the Linux scenes and how I can overcome these problems. I would prefer to stay with one single desktop workstation box as this helps my everyday working and simplifies my uploads to any future live sites to my webspace provider. MAY I ALSO ADD: that whilst the page load/write is taking place during this slow period there is a significant amount of HD activity* as if data is being accessed, unlike a normal write (*of course this happens as part of data access, but not as massive as it happens here!) :-) Edit (amend from my Comments): The computer is an AMD X2 (3.2Ghz) 260; 16G Ram, Gigabyte (GA-MA68MT-D3P) Mobo, 3*500Gig HDs. 2*20" LCDs. I'll see if I can view System output. I'm using mySQL (see below) but whilst I'm open to learning, I'm a bit wet across all areas (-: Server:Localhost via UNIX socket Server version: 5.5.32-0ubuntu0.12.10.1 Protocol version: 10 User: paulb@localhost MySQL charset: UTF-8 Unicode (utf8) Web server Apache/2.2.22 (Ubuntu) MySQL client version: 5.5.32 PHP extension: mysqli Documentation May I add, that there are periods where it seems to post what I would say is acceptable in speed response, if I do a 'refresh' page (whether in Chrome or Firefox) it will take a perceived 200-300ms, then maybe some time later a mind boggling 1.5 mins. You can imagine trying to make multiple edits to a View setup, or Config change, I'm sitting here wondering if I should go make (another!) brew LOL Just realised what I thought 'TOP' would be so I opened TERM and entered 'TOP'! If If put TERM in one LCD, and Firefox in other and 'reload' Firefox Drupal page I see activity in TERM, not sure to output it at the moment mind.


title: How to move files between servers with PubKey authentication?

text: I have two servers and for both I'm using PubKey authentication only. Can I somehow scp files between them (with private key being only on my local machine?) ? Can I somehow use my private key for authenticating login from another machine?


title: Configure Centos 6.3 to direct all traffic through a proxy server

text: Is there a way to configure CentOS 6.3 to direct all internet traffic through a proxy server? Forgive me if this is a really dumb question, I know very little about how proxy servers work and how traffic is directed through them. I am basing this question off using the HideMyAss on my windows desktop. After downloading their program, they were able to direct all of my web traffic through their proxy servers no matter which web browser I was using.


title: "no such file or directory" message when deleting a file that exists on NTFS

text: I have a directory with images. Suddenly I found out that there's a new image with a new name. The image content is similar to another image in another directory but with a different name. I didn't copy this image to this directory. Also a directory with the same name as the image suddenly appeared there. I didn't create any of them. When I tried to delete them I got this message "No such file or directory" even though it already existed there. I used the command `sudo rm -rf imagename.jpg` to delete it but it didn't work. Can anyone explain why this is happening and how to solve it? The output of `ls -l "large (2).jpg"`:               -rw------- 1 alaa alaa 2859942 Jun  8 04:01 large (2).jpg      The output of `rm "large (2).jpg"`:               rm: cannot remove ‘large (2).jpg’: No such file or directory      The output of `printf %s\\\0\\\n ./large* | sed -n l`               ./large (20).jpg\000$     ./large (26).jpg\000$     ./large (2).jpg\000$     ./large (5).jpg\000$      The filesystem is NTFS.


title: cannot 'ls' /mnt directory

text: I have a CentOS-6 machine that I'm working on that is running a live database. It's having a problem with the `/mnt` directory. I cannot `ls` the directory for some reason. `stat` is working and shows this output:                 File: `/mnt/'       Size: 4096        Blocks: 8          IO Block: 4096   directory     Device: ca02h/51714d    Inode: 16321       Links: 9     Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)     Access: 2011-09-23 06:50:20.000000000 -0500     Modify: 2012-10-29 11:46:33.000000000 -0500     Change: 2012-10-29 11:46:33.000000000 -0500      I can also `cd` into the directory and issue both the `touch` and `mkdir` commands successfully (or at least without errors. However, if I try to run `ls` in the directory it just hangs. At that point neither `Ctrl`+`C` nor `Ctrl`+`Z` have any effect and my system locks up. I have to close my ssh window and reconnect to do anything else. I'm at a bit of a loss here, does anyone have any ideas what might be causing this? Or, does anyone know how I can try to fix it, without rebooting the machine (I've encountered this once before on the same directory on a different machine and it was corrected by rebooting) since this is a live machine, I can't actually reboot. These are the filesystems which are mounted in that directory:               blob.XXXXX.com:/blend on /mnt/blend type fuse.glusterfs (rw,allow_other,default_permissions,max_read=131072)     blob.XXXXX.com:/new_log on /mnt/new_log type fuse.glusterfs (rw,allow_other,default_permissions,max_read=131072)     blob.XXXXX.com:/new_backup on /mnt/new_backup type fuse.glusterfs (rw,allow_other,default_permissions,max_read=131072)     blob.XXXXX.com:/vz on /mnt/vz type fuse.glusterfs (rw,allow_other,default_permissions,max_read=131072)     blob.XXXXX.com:/git on /mnt/git type fuse.glusterfs (rw,allow_other,default_permissions,max_read=131072)      Interestingly enough, the output of `strace ls /mnt` shows the mount directories in there.


title: Running rsync as a daemon for a local transfer

text: My coworker is trying to talk me into running rsync as a daemon on my EM server. I'm currently using rsync to copy a NFS share on my storage cluster to USB external drives so the data can be reviewed else where. The NFS share can get up to 200GBs+ in size. My coworker thinks that running rsync as a daemon on the system would improve performance, but it's my understanding that you run rsync as a daemon when you are doing remote transfers(a client/server relationship). Would running rysnc as a daemon improve performance when its a local transfer?


title: Why am I getting so many hits searching for "git" in the aptitude cache?

text: When I give the following command:                apt-cache search git | wc -l      I get the answer 756. How can I list just the half-dozen or so apps associated with git?


title: sfdisk failing to write partition to disk

text: I am trying make my microSD card bootable to Ubuntu. I am trying to use `sfdisk` to create the partitions. When I do that this is the error I am getting:               Using sfdisk to create partition layout     -----------------------------     Checking that no-one is using this disk right now ...     OK          Disk /dev/sdb: 30436 cylinders, 64 heads, 32 sectors/track     Old situation:     Warning: The partition table looks like it was made       for C/H/S=*/255/63 (instead of 30436/64/32).     For this listing I'll assume that geometry.     Units = mebibytes of 1048576 bytes, blocks of 1024 bytes, counting from 0             Device Boot Start   End    MiB    #blocks   Id  System     /dev/sdb1         4  30436- 30433-  31162880    c  W95 FAT32 (LBA)     /dev/sdb2         0      -      0          0    0  Empty     /dev/sdb3         0      -      0          0    0  Empty     /dev/sdb4         0      -      0          0    0  Empty     New situation:     Units = mebibytes of 1048576 bytes, blocks of 1024 bytes, counting from 0             Device Boot Start   End    MiB    #blocks   Id  System     /dev/sdb1   *     1     96     96      98304    e  W95 FAT16 (LBA)     /dev/sdb2         0      -      0          0    0  Empty     /dev/sdb3         0      -      0          0    0  Empty     /dev/sdb4         0      -      0          0    0  Empty     /dev/sdb: Input/output error          sfdisk: Failed writing the partition on /dev/sdb     Re-reading the partition table ...     /dev/sdb: Input/output error     Error closing /dev/sdb     If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)     to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1     (See fdisk(8).)      Any ideas what would be the issue? The disk is writable.


title: make grep output without trailing newline

text: Please consider this snippet: `X=$(grep -m1 'some-pattern' some-file | sed -n 's/.* //p')` I want to put last word in a variable if some pattern condition is matched for lines in arbitrary text file My problem is that variable `X` has CR or LF or CRLF at the end, depending on source file, which I want to get rid of, as it interferes with later operation I intend to do.   I even tried something like: `X=$(grep -m1 'some-pattern' some-file | sed -n 's/.* \\([A-Za-z]\\+\\)/\1/p')` thus expecting `sed` output to be limited on `[A-Za-z]+` but there are still this nuisance bytes inside X variable. How can I get rid of it, without using too much code like see what bytes are at the end with `xxd` then `cut` it and similar complications?


title: About sector and blocks, and a little confusion in /proc/diskstats

text: I've been studying about diskstats lately, and I get that the amount of hdd read comes in sectors. But in most places I've noticed that there exists a slight misunderstanding about sectors and blocks. So, what type is this sector which is read by the diskstats? Can I figure it out with:               dumpe2fs /dev/sda7 | grep 'Block size'


title: code review: automatic completion for bash aliases

text: I was reading How do I get bash completion for command aliases? and I thought, that the answer Shawn J. Goff needed a little something: less user setup so I wrote a little script that is intended to be sourced from your `.bashrc`, but it doesn't quite work, so hopefully someone can spot my error.               function make-completion-wrapper-1 () {         local function_name="$2"         local arg_count=$(($#-3))         local comp_function_name="$(complete -pr $1|sed -e 's/^\(.* -F \)\([^ ]*\) [^ ]*$/\2/')"         shift 2         local function="             function $function_name {                 ((COMP_CWORD+=$arg_count))                 COMP_WORDS=( "$@" \${COMP_WORDS[@]:1} )                 "$comp_function_name"                 return 0             }"         echo "$function"         eval "$function"     }          function make-completion-wrapper-2 () {         local function_name="$1"         local alias_name="$2"         local comp_function_base="$(complete -pr $3|sed -e 's/^\(.* -F\)\( [^ ]*\) [^ ]*$/\1/')"         echo "$comp_function_base $function_name $alias_name"         eval "$comp_function_base $function_name $alias_name"     }          [ -e ~/.cache/bash_alias_complete ] && rm ~/.cache/bash_alias_complete          alias | \         sed \             -e 's/^alias //' \             -e '/^\([^=]\+\)='\''\1 /d' \             -e "/'.*=/d" -e '/\$/d' \             -e h \             -e "s/.*='\([^ ]*\)\( .*\)'$/\1! \1\2/" \             -e 'y/ -!/__ /' -eG -e 's!\n[^=]*='\''\(.*\)'\''! \1!' \             -e 's/^/make-completion-wrapper-1 /p' \             -e 's/^[^ ]* [^ ]* \([^ ]*\) .*$/\1/' \             -e x \             -e 's!='\''\([^ ]*\) .*$! \1!' \             -e x \             -e 's!^!make-completion-wrapper-2 !' \             -e G \             -e 'y/\n/ /' \         > ~/.cache/bash_alias_complete          . ~/.cache/bash_alias_complete      I'm getting the following error when I pres the `Tab` key:               bash: COMP_POINT - : syntax error: operand expected (error token is "- ")      **NOTE:** The above code can be placed in a file, such as `myfuncs.bash`, which can then either be sourced directly in the shell or from `$HOME/.bashrc`. For full change history on this code see https://github.com/hildred/scripts.git


title: How to detect if tmux is attached?

text: I have a Irssi running within a tmux session, and am working on writing a Irssi script (extension) to send me an email when someone PMs or mentions me when I'm not attached to the tmux session. Everything about this is quite easy, less one thing: how do you detect if the tmux session is attached? I've gotten so far with this, and am reaching out here mainly to see if this is the correct/best way to do it, or if I should be doing it differently. Any advice is appreciated!               # Get the current session_name value from tmux     $ tmux display -p '#{session_name}'     2          # Running list-clients while I'm attached yields the following,     # from both the same window as well as another window:     $ tmux list-clients -t 2     (null): 2 [180x42 (null)]           # As well, running list-clients while detached yields no output:     $ tmux list-clients -t 2     $       All told, I _think_ this is the right way to go about this, but I'm certainly open to any better ways to or suggestions on how to check this.


title: How can I get Apache2 in OpenSUSE to map /srv/www/htdocs/index.php to localhost?

text: If the document root for Apache in OpenSUSE is `/srv/www/htdocs` and that folder only contains my website with its own `index.php` file, entering "localhost" in a browser should take you to the homepage. **It doesn't!** It takes you to the It works! page instead. Since there is no index.html file in that folder, what is changing the document root to point somewhere else and where is it pointing to? This is the output of httpd.conf minus a huge block of comments at the top:               ### Global Environment ######################################################     #     # The directives in this section affect the overall operation of Apache,     # such as the number of concurrent requests.          # run under this user/group id     Include /etc/apache2/uid.conf          # - how many server processes to start (server pool regulation)     # - usage of KeepAlive     Include /etc/apache2/server-tuning.conf          # ErrorLog: The location of the error log file.     # If you do not specify an ErrorLog directive within a <VirtualHost>     # container, error messages relating to that virtual host will be     # logged here.  If you *do* define an error logfile for a <VirtualHost>     # container, that host's errors will be logged there and not here.     ErrorLog /var/log/apache2/error_log          # generated from APACHE_MODULES in /etc/sysconfig/apache2     Include /etc/apache2/sysconfig.d/loadmodule.conf          # IP addresses / ports to listen on     Include /etc/apache2/listen.conf          # predefined logging formats     Include /etc/apache2/mod_log_config.conf          # generated from global settings in /etc/sysconfig/apache2     Include /etc/apache2/sysconfig.d/global.conf          # optional mod_status, mod_info     Include /etc/apache2/mod_status.conf     Include /etc/apache2/mod_info.conf          # optional cookie-based user tracking     # read the documentation before using it!!     Include /etc/apache2/mod_usertrack.conf          # configuration of server-generated directory listings     Include /etc/apache2/mod_autoindex-defaults.conf          # associate MIME types with filename extensions     TypesConfig /etc/apache2/mime.types     DefaultType text/plain     Include /etc/apache2/mod_mime-defaults.conf          # set up (customizable) error responses     Include /etc/apache2/errors.conf          # global (server-wide) SSL configuration, that is not specific to      # any virtual host     Include /etc/apache2/ssl-global.conf          # forbid access to the entire filesystem by default     <Directory />         Options None         AllowOverride None         Order deny,allow         Deny from all     </Directory>          # use .htaccess files for overriding,     AccessFileName .htaccess     # and never show them     <Files ~ "^\.ht">         Order allow,deny         Deny from all     </Files>          # List of resources to look for when the client requests a directory     DirectoryIndex index.html index.html.var          ### 'Main' server configuration #############################################     #     # The directives in this section set up the values used by the 'main'     # server, which responds to any requests that aren't handled by a     # <VirtualHost> definition.  These values also provide defaults for     # any <VirtualHost> containers you may define later in the file.     #     # All of these directives may appear inside <VirtualHost> containers,     # in which case these default settings will be overridden for the     # virtual host being defined.     #     Include /etc/apache2/default-server.conf               # Another way to include your own files     #     # The file below is generated from /etc/sysconfig/apache2,     # include arbitrary files as named in APACHE_CONF_INCLUDE_FILES and     # APACHE_CONF_INCLUDE_DIRS     Include /etc/apache2/sysconfig.d/include.conf               ### Virtual server configuration ############################################     #     # VirtualHost: If you want to maintain multiple domains/hostnames on your     # machine you can setup VirtualHost containers for them. Most configurations     # use only name-based virtual hosts so the server doesn't need to worry about     # IP addresses. This is indicated by the asterisks in the directives below.     #     # Please see the documentation at     # <URL:http://httpd.apache.org/docs-2.2/vhosts/>     # for further details before you try to setup virtual hosts.     #     # You may use the command line option '-S' to verify your virtual host     # configuration.     #     Include /etc/apache2/vhosts.d/*.conf               # Note: instead of adding your own configuration here, consider      #       adding it in your own file (/etc/apache2/httpd.conf.local)     #       putting its name into APACHE_CONF_INCLUDE_FILES in      #       /etc/sysconfig/apache2 -- this will make system updates      #       easier :)


title: How to repartition disk to use non-allocated space?

text: This is how my hard drive (where I have Xubuntu 12.10) is formatted currently, based on a recent GParted screenshot: ![GParted Screenshot](http://i.imgur.com/RzbBIOS.png) I want to expand sda6 (4) to take up the free 11.72 GiB unallocated space. But I can't do it. This is what I did and gathered so far:   * I can't add another primary partition as I have 4 already. I didn't know that prior to starting up GParted and right-clicking the unallocated 11.72 GiB space. :/   * /dev/sda5 is swap.   * /dev/sda2 and /dev/sda3 are Windows partitions and need to remain as they are. I am a bit clueless on how to enhance /sda6 now, I have definitely not enough basic knowledge on how to proceed. :( I don't even know if I have to keep the swap partition but that thought is moot anyway as I can't create another primary partition. Help! I'd appreciate it a lot. :) I'd even be willing a tutorial which could help me get forward via the terminal.


title: Slow ikiwiki after first run

text: I have local ikiwiki on my notebook (with apache as local webserver). When I save an edit the first time after booting and logging in, saving is very slow (but the second time saving is at normal speed). Any idea how to fix this? **Edit:** Click edit the first time:~ 30 Sek. (it says "waiting for localhost")   Click save the fisrt time:~1 min 30 Sek (it says "waiting for localhost") Click edit the second time: <3 Sek.   Click save the second time: ~4 Sek. The problem is independent of beeing online or not. I am using git as backend.


title: Kali Linux: On install, designated root password cannot login - incorrect password

text: I found an old laptop lying around and I figured I would install Kali Linux on it to learn more about penetration testing and to try to break into my servers for practice and learning more about creating a secure network. I used unetbootin to install the Kali Linux ISO I downloaded via the torrent from their site, and the install to my flash drive went successfully. On the laptop I was wanting to put Kali on, I went into the BIOS and ordered the USB to be the priority to boot from. After that, I booted live into Kali and installed the operating system from there. It loaded up the graphical install page from Kali and the install seemed to go successfully. However, once the installation was successful, it would take me to the login page and prompt me for the root password. I would type in the root password I had used during the initial setup, yet it gives me the `Incorrect password` prompt, even though I am 100% sure I was using the password I had installed at the start. To confirm this, I tried reinstalling from the live boot multiple times, using the same password from the first attempt and even just doing "password" for testing purposes. Neither one worked. As a final measure, I opened up the GParted Partition Editor from the Kali live boot and deleted all of the partitions on my laptop's hard drive. From there, I went through the Kali installation process again successfully, only to encounter the EXACT same issue as before when trying to log in after installation. Does anyone know what is going on? I am clueless as to what I could do to be able to log into my Kali installation... thanks.


title: How to truely install a tar.gz file on Linux - how to manage manually-installed (or standalone) applications?

text: I see all these links explaining packages and .debs... I know that... and there are many kludges to get tar.gz files working (eg: update-alternatives for Java or manually dropping the file in /usr/local/bin (or somewhere else, which I had deduced from hours of searching)). If packages are so smart, how are so few Linux applications available in packages or .debs/rpms? I'm speaking as a new user; I know experts probably know it better (I think I can download a compilable version of Eclipse?). Like netbeans and chrome are .sh, eclipse is a plain, launchable directory, java requires this update- alternatives business but I don't think it registers itself into Ubuntu/Debian's "programs list" (just registers as a command), etc. (I know these are sometimes available in repositories, but I'm just confused why download pages don't have proper explanations). **Long story short: If a download or compile a tar.gz file, how do I register it to the system?`update-alternatives` seems to register it as a command, in Ubuntu, it doesn't show up in the search bar. In Debian, I can manually add a shortcut to the GNOME 2 launcher. But what should I really be doing?** * * * **Edit:** So after playing around a bit more with the new solutions, I can sorta refine my "problem": How should I manage my manually installed programs? Firefox and Eclipse are my only examples so far (I don't download a lot of stuff). They can both run out the box, which I like. Except, where should I be installing them? I see Eclipse has it's own instructions, but I'd rather do all my "manual packages" the same way.   1. After some research, I decided to put these programs into `/user/local/bin`.   2. From how to install eclipse, I figured to get something to show up in the launcher, I need to put a `xxx.desktop` file in `~/.local/share/applications/`. Does the name of this .desktop file matter?   3. Stuff with autotools (I look for a `configure` or `unix/configure` file) will work out fine. Some research points that I should use `CheckInstall` to keep track of all these.   4. I should use `update-alternatives` to register paths. From this java thread, it looks like I create a link from `/usr/bin/java` to `/usr/lib/jvm/jdk...`. When I install these "standalone" applications like Eclipse or Firefox, should I always link to `/usr/bin/[app]`? And if assertion 1 is true, I would be doing stuff like `sudo update-alternatives --install "/usr/bin/[app]" "[app]" "/usr/local/bin/[app]" 1` **Are these instructions correct/a good way to manage manual installations? Are there any other steps I should follow? Other suggestions?**


title: What distribution do you suggest for daily use?

text: I use my computer everyday for various reasons:   1. programming in c++, android(java), java(in general)   2. listening to music(spotify), watching movies   3. browsing internet, watching youtube clips   4. writing various documents   5. studying in general (I am a student)   6. flashing custom roms to my android phone (now and then) Currently I am using ubuntu 13.04, but it is not really well polished (I think...). I would like to ask for your tips and suggestions, what would fit my needs the most? I really like global menu in ubuntu. To be honest, I really like the whole shell of macs osx. I would buy mac for sure, if I had money for it. For obvious reasons, I have to stick with searching for perfect linux distro which has features similar to osx :) So, your tips and suggestions are more then welcome. Thank you!


title: Can new glibc versions be used with an old kernel?

text: Apparently glibc can be compiled with `\--enable-kernel` to support older kernel versions. However, I haven't been able to find information on _what kernel versions are supported on a particular glibc version_. Ideally, I want to see a compatibility matrix for every glibc (2.x) and kernel (2.6.x) releases. Does it exist? If it doesn't exist, perhaps it's because every glibc versions (in the last 5 years or so) supports all kernels since 2.6.0? (Arch = x86-64, if that matters)


title: Is it possible to source a file in bash, but skipping specific functions?

text: Suppose I have `bash_functions.sh`:               function test(){     }          function test2(){     }      And in my `~/.bashrc` I do:               source ~/bash_functions.sh      Is it possible to, when sourcing it, avoid sourcing a specific function? I mean, source everything in `bash_functions.sh`, except for `test`?


title: Different sleep binaries on Mac (Darwin) and in Linux. How to properly handle the differences?

text: In my Linux box, `sleep` accepts seconds, minutes and hours. So:               sleep 10m      Sleeps for 10 minutes (or 600s). `sleep` on Mac only accepts seconds as argument. `sleep 10m` doesn't work, only `sleep 600s`. What can I do? Create a function named `sleep` that converts when 10m or 10h is passed as a parameter to seconds, and calls the builtin sleep?


title: How to list all running X applications?

text: I'd like to get a list of all of the apps (across all users) on my machine that are talking to the X server. What's the most reliable way to do that? Find the socket X runs on and lsof for connections to it? I'm running both Linux and Solaris boxes, so I'd be interested in answers for both OS's.


title: cd two levels down from root

text: I'm a web developer (Drupal mainly). When I develop websites I do so within a /workspace folder. So I have folders like this.               /workspace/project/     /workspace/project/sites/default/files/     /workspace/project1/     /workspace/project1/sites/all/modules/contrib/date      I would like to have a command which takes me to my project root, which is always               /workspace/something/      So that when I am in:               /workspace/project/sites/default/files/      [specialcdcommand] will take me to:               /workspace/project/      But when I am in:               /workspace/project1/sites/default/files/      [specialcdcommand] will take me to:               /workspace/project1/      At the moment I tend to do this:               cd /workspace/p[tab]      ... which is not good because I sometimes land in a different project version without noticing. If it helps, I use zsh.


title: How to search for Debian packages by tags?

text: At Debian's Packages page, one can search amongst the software available on Debian. In the package descriptions, they are categorized by tags, described here. For instance, the package `[xterm][3]` has the following tags: > Tags: Implemented in: C, User Interface: X Window System, Role: Program, > Scope: scope::utility, uitoolkit::athena, Purpose: Need an extra tag, X > Window System: Application, Terminal Emulator Is there a way to search or browser for packages according to these tags?


title: Create clickable links in terminal

text: It's possible to create grep-command results file names like a link - for open editor? I want click to filenames in grep result and open my editor with selected line               $ grep "mServiceIntent" -R ./src/     ./src/com/example/android/threadsample/PhotoThumbnailFragment.java:67    private Intent mServiceIntent;     ./src/com/example/android/threadsample/PhotoThumbnailFragment.java:194        mServiceIntent =     ./src/com/example/android/threadsample/PhotoThumbnailFragment.java:203                getActivity().startService(mServiceIntent);      Actualy I know how register protocol in system for open editor. For example all urls like sblm://* in my system open by SublimeText. My question is: how create custom links in guake terminal (or may be it's not dependes on quake and work for default terminal program)?


title: Linux security vulnerabilities?

text: A while back I started an embedded project using the 3.2.10 kernel. Now the project should go into production and the stable kernel is 3.2.16. I would prefer not to upgrade anything to avoid incompatibilities etc. but if serious security vulnerabilities has been plugged from 3.2.10 to 3.2.16 I have to do so. Where can I find out if security vulnerabilities has been plugged between the two versions? I have not been able to find the answer in obvious places like kernel.org.


title: Flash drive won't boot or mount after trying to create installation medium

text: I have a 1GB USB flash drive which I wanted to use as an installation medium for Linux distros. My first experiment was to be installing Arch on an old laptop (old enough that if I really messed it up, it wouldn't matter). I downloaded the ISO image, and put the USB into the port; it mounted automatically. Following the instructions on Arch's installation how-to page, I ran `dd if archlinux-XXXX.iso of /dev/sdg1`. I then could not see any files on the USB (whether using `ls` or nautilus). I umounted it, then plugged it back in, and it had some files on it. I'm afraid I can't remember exactly what they were, but I'm pretty sure I saw a directory named `/boot`. I then plugged it into the laptop, which would not boot from the flash drive. I plugged the USB back into my main computer, only to be told:               Unable to mount 168 MB Filesystem     Error mounting: mount: wrong fs type, bad option, bad superblock on /dev/sdg1,     missing codepage or helper program, or other error     In some cases useful info is found in syslog - try dmesg | tail or so      That command, `dmesg | tail`, gives the following: [338915.672127] UDF-fs: No anchor found [338915.672133] UDF-fs: No partition found (1) [338955.452708] UDF-fs: No anchor found [338955.452714] UDF-fs: Rescanning with blocksize 2048 [338955.479829] UDF-fs: No anchor found [338955.479834] UDF-fs: No partition found (1) [338955.527366] UDF-fs: No anchor found [338955.527373] UDF-fs: Rescanning with blocksize 2048 [338955.555208] UDF-fs: No anchor found [338955.555213] UDF-fs: No partition found (1) So I'm curious about what has happened here. Did I do something wrong somewhere? Why is the error message referring to a 168 MB device, when it's supposed to be 1 GB? Also, is there any way to salvage the flash drive, or is it toast? Edit: Information from `fdisk /dev/sdg` Command (m for help): p [print the partition table]               Disk /dev/sdg: 1021 MB, 1021125120 bytes     64 heads, 32 sectors/track, 973 cylinders, total 1994385 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0xe797d5bb             Device Boot      Start         End      Blocks   Id  System     /dev/sdg1   *           0      327679      163840   17  Hidden HPFS/NTFS


title: How do I transfer multiple files with a common suffix and prefix using an offset?

text: I have thousands of files whose names are of the form:               sequence_1_0001.hmf       sequence_1_0002.hmf       sequence_1_0003.hmf     ...            sequence_1_0001.jpg       sequence_1_0002.jpg     sequence_1_0003.jpg     ...            sequence_2_0001.hmf       sequence_2_0002.hmf       sequence_2_0003.hmf     ...        etc.. I'm using sftp to transfer only the files whose suffix and prefix are 'sequence_1' and '.hmf', respectively. However, I don't want to transfer all the files that match this format. Instead, I want to transfer every hundreth file. That is:               sequence_2_0001.hmf       sequence_2_0101.hmf       sequence_2_0201.hmf     ...        Is there a way to do this?


title: Recursively rename subdirectories that match a regex

text: I have a media server with a folder called `Series`. (`/media/Expansion2/Series/`) In it, I have (surprise!) TV series. These are just the show names, e.g., `/media/Expansion2/Series/The Big Bang Theory/` Inside each show's folder (and this is where the problem lies) I have season folders. I currently have a mixture of the following 2 conventions (along with a few more, probably):   1. `/media/Expansion2/Series/The Big Bang Theory/The Big Bang Theory Season 1`   2. `/media/Expansion2/Series/The Big Bang Theory/Season 2` In the end, I want to rename all folders to just `Season #`. As a regex, I would probably say something like `s/.*(Season \d)/$1` Only applicable to folders, not files. I should probably also mention that this is for about 50+ show sub folders, so it needs to start at the `/media/Expansion2/Series/` level and look into each series :)


title: crontab "0/15" minutes + "11-15" hour field: when does that end?

text: Given a crontab expression like "0 0/15 11-15 ? * MON-FRI", how is that parsed? I am correct in assuming the 11-15 does not mean "between 11 and 15" but "when the hour is 11-15, inclusive" - i.e. the expression will trigger every 15 minutes starting at 11:00 and ending at 15:45? Or will it end at 14:45? Or maybe 15:00?


title: How do I remove multiple files with a common prefix and suffix?

text: I have many files named               sequence_1_0001.jpg       sequence_1_0002.jpg       sequence_1_0003.jpg       ...      and files named               sequence_1_0001.hmf       sequence_1_0002.hmf       sequence_1_0003.hmf       ...      and files named               sequence_2_0001.jpg       sequence_2_0002.jpg       sequence_2_0003.jpg       ...      and               sequence_2_0001.hmf       sequence_2_0002.hmf       sequence_2_0003.hmf       ...      I just want to remove the files that begin with 'sequence_1' and end in '.hmf', but I don't want to remove them one by one, since there are thousands of files. How can I specify to the rm command that I want to remove all that begin with the prefilx 'sequence_1' and end in '.hmf'? I'm currently working with a RedHat Linux system, but I'd like to know how to do it on other distributions as well.


title: Automatically update MPD database upon external storage insertion

text: I have an Alix board in my living room running Voyage MPD edition and acting as jukebox. In order to play "guest" music, I would like that MPD automatically updates its database with the content of the USB sticks one could connect to the box. Is there a straightforward way to do it (via udev or MPD) ? Thanks


title: Enable compiz window grid with visual effects set to none. Ubuntu 10.04

text: I have to disable "Visual Effects" (system -> preferences-> appearance -> visual effects -> none) because I get a terrible flicker/blinking when it is enabled, but I'd really like to use compiz window grid shortcuts. They only work w/ visual effects set to "extra". Is there any way to specifically enable compiz grid functionality without turning on everything else that seems to bog down the grapics? Thanks.


title: printing .cpp file from command line using emacs

text: The goal is to print a set of *.cpp files on a network printer, but... in a way that the (color) printer prints the files like they appear in the c++ editor including the colors and highlighting. And all of this from the command line. I succeeded in sending all the files to the network printer but they are (of course) all printed in black and white (text) format. I used : lp -d 'printername' *.cpp Is there a way to open the files in something like emacs and pass the print command to emacs from the command line? BTW: I'm on mac OS X.


title: How can I expand ext4 partition size on debian

text: I have a drive with this configuration:               fdisk -l          Disk /dev/sda: 500.1 GB, 500107862016 bytes     255 heads, 63 sectors/track, 60801 cylinders     Units = cylinders of 16065 * 512 = 8225280 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Disk identifier: 0x000f1b8b             Device Boot      Start         End      Blocks   Id  System     /dev/sda1   *           1        2612    20971520   83  Linux     /dev/sda3           60736       60801      525312   82  Linux swap / Solaris      There is 478GB unallocated space, how would I go about adding this space to /dev/sda1 without losing the data that is currently on /dev/sda1? (the filesystem is ext4) The OS is debian 6. Thank you in advance. :)   (it is a server with only SSH, no GUI for running stuff like gparted)


title: xterm warning: Tried to connect to session manager

text: I am writing a quick script to read user input and put into commands of a couple different programs. I'm using `xterm -e` to open a terminal for each separate program. The script is working fine, but each time `xterm -e` is executed, an error message is displayed: > Warning: Tried to connect to session manager, None of the authentication > protocols specified are supported Any ideas on how to stop this from displaying?


title: How to uninstall java on Linux Mint 12

text: Today, I downloaded the latest java `jre` which is a **.bin** file By mistake, I installed it on my desktop by running `./jre`. I want to remove this installation, move the **.bin** file to somewhere else and install it again I tried `sudo apt-get remove --purge jre` gives               Reading package lists... Done     Building dependency tree            Reading state information... Done     Virtual packages like 'jre' can't be removed     0 upgraded, 0 newly installed, 0 to remove and 19 not upgraded.      Note: I can't use synaptic package manager, here's why, so I have to do everything from the terminal until the problem gets fixed. The folder where the JRE is located is called **jre**. **Edit: @stew** just installed java jre               sudo echo 'deb http://www.duinsoft.nl/pkg debs all' >> /etc/apt/sources.list     sudo apt-key adv --keyserver keys.gnupg.net --recv-keys 5CB26B26     sudo apt-get update     sudo apt-get install update-sun-jre      it's the latest version. so i just have now to remove the **.bin** file and the extracted **jre** folder, would your method still works? and could you please tell me why to use open jdk over jre sir?


title: How can I tell which version of Varnish I'm running?

text: How can I get the installed Varnish cache version string from the command line?


title: Linux Mint Kde boots to Xsession fail

text: I've been trying to figure out this error I have. Its a fresh install of linux mint 15 kde. During the process of installing graphics drivers, steam, and a few other things I get this error at some point after I log off (at this point during the install I've usually done a full reboot a couple of times, it is the logoff thats causing the problem). Instead of logging off the computer goes through almost a boot loop, just rebooting linux not showing BIOS, and then boots me into a command line login screen. After logging in I install `mdm` and reboot (I'm set to auto login if that makes a difference). When it boots straight into KDE I get two windows on a screen of black. One is a terminal and one is an `xsession` that has failed and produced this error sheet message.               /etc/mdm/Xsession: Beginning session setup...     localuser:b being added to access control list     Script for cjkv started at run_im.     Script for default started at run_im.     Failed to connect to the VirtualBox kernel service     Failed to connect to the VirtualBox kernel service     Failed to connect to the VirtualBox kernel service     Failed to connect to the VirtualBox kernel service     Failed to connect to the VirtualBox kernel service     Script for cjkv started at run_im.     Script for default started at run_im.     QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.     QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.      So that's the error sheet that I've got I've tried searching up stuff from it but I haven't found any answers yet. For things I've done to attempt a fix; None of the session options from the login screen seem to help. Trying to `startx` doesn't help. I did a completely clean install and the problem has happened again, which makes me think its related to something I installed. When this had happened I had only installed 4 things; AMD Catalyst control beta drivers, Steam, burg and burg manager, and transferred my Firefox profile over from a backup. So yeah does anybody have any idea whats going on? I don't want to do a fresh install again since it seems fruitless. oh also if it makes any difference my `/home` is on a separate partition which I've kept between fresh installs. I suppose there could be something in there thats causing the `xsession` error but I don't know what.


title: Adblock rule to block g+ / twitter / etc.

text: Looks like this rule works to blocking facebook domain, when not visiting the facebook domain (ex.: "like/share" etc. buttons on other pages then facebook):               ! don't allow facebook outside facebook..     ||facebook.com$domain=~www.facebook.com     ||facebook.net$domain=~www.facebook.com     ||fbcdn.net$domain=~www.facebook.com     facebook.com###appsNav     facebook.com###pagesNav     facebook.com###groupsNav     facebook.com###pagelet_friends_online     facebook.com###pagelet_bookmark_nav     facebook.com###pagelet_rhc_footer      But how can I block completely twitter / g+ / etc sites with adblock rules? (Is this really effective, or it only makes me not to see the fcb buttons/etc.)?


title: Preventing zsh from using aliases in CWD (prompt)

text: I have the following personalized theme activated with `oh-my-zsh` (latest version of `zsh` and `oh-my-zsh`):               local return_code="%(?..%{$fg[red]%}%? %{$reset_color%})"          local user_host='%{$terminfo[bold]$fg[green]%}%n @ %m%{$reset_color%}'     local current_dir='%{$terminfo[bold]$fg[cyan]%} %~%{$reset_color%}'     local rvm_ruby=''     local git_branch='$(git_prompt_info)%{$reset_color%}'          PROMPT="${user_host} %D{[%a, %b %d %I:%M:%S]} ${current_dir} ${rvm_ruby} ${git_branch}     %B$%b "     RPS1="${return_code}"          ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"     ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}"      I have noticed that in the prompt, whenever I have an alias to a directory, it displays the name of the alias as my current directory as opposed to the actual path. While this is an interesting feature, I would like to disable that. I am relatively new to `oh-my-zsh`, and I am not sure if this is an `oh-my- zsh` or `zsh` feature, but how can I disable it?


title: pureftpd - login authentication failed

text: I am on openSUSE 10.2, using pure-ftpd v1.0.21 I've added new virtual user, but I cannot connect (password is ok) Output of verbose log:               Apr 10 17:10:35 hostzzz pure-ftpd: (?@xxx.yyy.zzz.uuu) [INFO] New connection from xxx.yyy.zzz.uuu     Apr 10 17:10:35 hostzzz pure-ftpd: (?@xxx.yyy.zzz.uuu) [DEBUG] 220-Welcome to Pure-FTPd.     Apr 10 17:10:35 hostzzz pure-ftpd: (?@xxx.yyy.zzz.uuu) [DEBUG] 220-You are user number 1 of 10 allowed.     Apr 10 17:10:35 hostzzz pure-ftpd: (?@xxx.yyy.zzz.uuu) [DEBUG] 220-This is a private system - No anonymous login     Apr 10 17:10:35 hostzzz pure-ftpd: (?@xxx.yyy.zzz.uuu) [DEBUG] 220-IPv6 connections are also welcome on this server.     Apr 10 17:10:35 hostzzz pure-ftpd: (?@xxx.yyy.zzz.uuu) [DEBUG] 220 You will be disconnected after 15 minutes of inactivity.     Apr 10 17:10:35 hostzzz pure-ftpd: (?@xxx.yyy.zzz.uuu) [DEBUG] Command [user] [someuser]     Apr 10 17:10:35 hostzzz pure-ftpd: (?@xxx.yyy.zzz.uuu) [DEBUG] 331 User someuser OK. Password required     Apr 10 17:10:35 hostzzz pure-ftpd: (?@xxx.yyy.zzz.uuu) [DEBUG] Command [pass] [<*>]     Apr 10 17:10:35 hostzzz pure-ftpd: (?@xxx.yyy.zzz.uuu) [DEBUG] 530 Login authentication failed     Apr 10 17:10:35 hostzzz pure-ftpd: (?@xxx.yyy.zzz.uuu) [WARNING] Authentication failed for user [someuser]     Apr 10 17:10:41 hostzzz pure-ftpd: (?@xxx.yyy.zzz.uuu) [INFO] Logout.     Apr 10 17:10:41 hostzzz pure-ftpd: (?@xxx.yyy.zzz.uuu) [DEBUG] 530 Logout.      It's an old production server, and apparently there are some ftp users who can connect, so it seems that's a new user problem only Any ideas for further debugging? Some others logs to check? Some configuration to verify?


title: How to delete lines where the given part of the line is more than 100 chars?

text:
I know I can delete lines that are longer than 100 chars with this:               sed '/^.\{100\}..*/d'      But I have the following example line:               YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
      So I need to only delete the lines where "YYY":               ">Y...Y...Y
      is longer than 100 chars. How can I do this? I'm using OpenBSD.


title: How does ACL calculate the effective permissions on a file?

text: I ran the following command to give the `wheel` group `rwx` permissions on new files and subdirectories created:               [belmin@server1]$ ls -la     total 24     drwxr-sr-x+   2 guards guards  4096 Aug 27 15:30 .     drwxr-xr-x  104 root   root   12288 Aug 27 15:19 ..          [belmin@server1]$ sudo setfacl -m d:g:wheel:rwX .          [belmin@server1]$ getfacl .     # file: .     # owner: guards     # group: guards     # flags: -s-     user::rwx     group::r-x     group:wheel:rwx     other::r-x     default:user::rwx     default:group::r-x     default:group:wheel:rwx     default:mask::rwx     default:other::r-x      However, when I create a file as root, I am not completely clear how the `effective` permissions are calculated:               [belmin@server1]$ sudo touch foo          [belmin@server1]$ getfacl foo     # file: foo     # owner: root     # group: guards     user::rw-     group::r-x                      #effective:r--     group:wheel:rwx                 #effective:rw-     group:guards:rwx                #effective:rw-     mask::rw-     other::r--      Can someone elaborate on what this means?


title: Replacing pattern after nth match is found on each line?

text: I have a file containing lines:               india;austria;japan;chile     china;US;nigeria;mexico;russia      I want to replace all the occurences of semicolon on each line with e.g. `;NEW;`, but starting from the 2nd occurence only. The result should look like this:               india;austria;NEW;japan;NEW;chile     china;US;NEW;nigeria;NEW;mexico;NEW;russia      I tried this with gsub, but it replaces all the occurences: `awk '/;/{gsub(/;/,";NEW;") }{print}'`


title: How to get cinnamon window styling

text: I think I may have chosen `Mint-with no codecs` from the downloads section. What should I do to get the nicer `cinnamon` window styling as in this page?. I have attached a file to show how my window title bar looks like.               2026:rag@rag-work-laptop:~/Documents$  findp muffin     rag       8195  2757  0 17:56 pts/0    00:00:00 grep --color=auto -i muffin          2027:rag@rag-work-laptop:~/Documents$  findp cinnamon     rag       1771  1214  0 14:05 ?        00:00:00 gnome-session --session cinnamon     rag       1848  1771  0 14:05 ?        00:00:00 /usr/bin/ssh-agent /usr/bin/dbus-     launch --exit-with-session gnome-session-cinnamon     rag       1851     1  0 14:05 ?        00:00:00 /usr/bin/dbus-launch --exit-with-session gnome-session-cinnamon     rag       2101  1771  2 14:05 ?        00:04:42 /usr/bin/cinnamon      display managers:               2028:rag@rag-work-laptop:~/Documents$  findp gdm     rag       8199  2757  0 17:56 pts/0    00:00:00 grep --color=auto -i gdm          2029:rag@rag-work-laptop:~/Documents$  findp mdm     root      1213     1  0 14:05 ?        00:00:00 /usr/sbin/mdm     root      1214  1213  0 14:05 ?        00:00:00 /usr/sbin/mdm     root      1244  1214  1 14:05 tty8     00:04:16 /usr/bin/X :0 -audit 0 -auth /var/lib/mdm/:0.Xauth -nolisten tcp vt8     rag       8201  2757  0 17:56 pts/0    00:00:00 grep --color=auto -i mdm      window managers: before i tried installing `muffin`               2041:rag@rag-work-laptop:~/Documents$  dpkg -l | g muffin     ii  gir1.2-muffin-3.0                           1.1.2+nadia                               amd64        GObject introspection data for Muffin     ii  libmuffin0                                  1.1.2+nadia                               amd64        window manager library from the Muffin window manager     ii  muffin-common                               1.1.2+nadia                               all          shared files for the Muffin window manager      I have now installed `muffin` but muffin does not start on X start up and I still have the same old style.               2056:rag@rag-work-laptop:~/Documents$  dpkg -l | g -i muffin     ii  gir1.2-muffin-3.0                           1.1.2+nadia                               amd64        GObject introspection data for Muffin     ii  libmuffin0                                  1.1.2+nadia                               amd64        window manager library from the Muffin window manager     ii  muffin                                      1.1.2+nadia                               amd64        lightweight GTK+ window manager     ii  muffin-common                               1.1.2+nadia                               all          shared files for the Muffin window manager


title: Why does it take up to several minutes to clean a listening TCP port after a program dies?

text: If I kill a program that is listening on a TCP port, it takes up to several minutes until the port is reclaimed by the system and usable again. I've seen several Q/A mentioning this phenomenon, but without an explanation. Why does that happen, why doesn't the system reclaim the port right away? Does it also happen on another systems, such as Windows or Mac?


title: rsh shows "poll: protocol failure in circuit setup", why?

text: In the starting rsh worked properly, but after making some changes it shows some error [changes are shown in the end of this question, see that], I am sharing the same. **Command** $ /usr/bin/rsh localhost ulimit -n **Output**               poll: protocol failure in circuit setup      After facing this problem, I followed this link, but didn't get any help. It works properly, but when I made some changes, from this link, then after that it shows the output as above. Now I revert all changes, but it shows the same output. Why? These are the lines that I added in files, showing in left hand side, by seeing the above link.               /etc/pam.d/login:       session    required     pam_limits.so     /etc/pam.d/sshd:        session    required     pam_limits.so     /etc/pam.d/su:          session    required     pam_limits.so     /etc/pam.d/system-auth: session    required     pam_limits.so      Here is the link of what I am trying to do. **Edit No. 1** `strace -o log.txt rsh localhost pwd`, some lines of output are as,               connect(3, {sa_family=AF_INET, sin_port=htons(514), sin_addr=inet_addr("127.0.0.1")}, 16) = 0     socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 4     bind(4, {sa_family=AF_INET, sin_port=htons(1022), sin_addr=inet_addr("0.0.0.0")}, 16) = 0     listen(4, 1)                            = 0     write(3, "1022\0", 5)                   = 5     poll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}], 2, -1) = 1 ([{fd=3, revents=POLLIN|POLLERR|POLLHUP}])     write(2, "poll: protocol failure in circui"..., 40) = 40     close(4)                                = 0     close(3)                                = 0     rt_sigprocmask(SIG_SETMASK, [], [URG], 8) = 0     exit_group(1)       **Edit no. 2** **Command** - `strace ~/rshd.trace in.rshd` **Output**               execve("/usr/sbin/in.rshd", ["in.rshd"], [/* 22 vars */]) = 0     brk(0)                                  = 0x2b3054ec2000     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b303671d000     uname({sys="Linux", node="jhamb.XXX.XXX", ...}) = 0     access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b303671e000     arch_prctl(ARCH_SET_FS, 0x2b303671e6d0) = 0     --- SIGSEGV (Segmentation fault) @ 0 (0) ---     +++ killed by SIGSEGV +++


title: Cron job to delete files older than 3 days

text: I need to remove files older than 3 days with a cron job in 3 different directories. (these 3 directories are children of a parent directory `/a/b/c/1` & `/a/b/c/2` & `/a/b/c/3`) Can this be done with one line in the crontab?


title: How to give All privilege rights to user ubuntu 12.04

text: I am working with my first VPS.I created a new user                   adduser username      and then I added this line                  username ALL=(ALL:ALL) ALL      under root in                  visudo      I saved the changes and exit the editor but my new user don't work as root. (i.e. when i want to restart apache it asks me to login as root) Is anything else I have to do? Thanks in advance!


title: Rsync large dir, bigger than destination, need to stop and start

text: I have an Ubuntu server with 4TB storage. Most of it is taken up by one dir. I was told the dir was about 1.5TB, so I attached a 2TB drive on USB, and started a rsync -arW inn tmux to copy it over. Now I have figured out it is about 3.6TB. I have the USB drive on /dev/sdb1. If CTRL Z that rsync, swap out the 2TB drive for another, will it start back up? Or do I have to copy the data already there to, say a 4TB drive, swap that into the enclosure on sdb1, and restart.


title: brasero.toc.bin is very big -- why?

text: I have a file in my home directory: brasero.toc.bin, which ls gives as:               -rw-rw-r--. 1 Harry Harry 633M 2013-09-26 15:53 brasero.toc.bin      in fact it is the second largest file listed, only sdc at 1.9G is bigger. My question is, please, what is it, why is it so big, does it matter, and should I do anything abut it?


title: How do I install TazPkg in SliTaz Linux

text: How do I install TazPkg in SliTaz Linux? Usually to install tazpkg packages you need TazPkg but I unsintalled TazPkg because it was broken now how do I install it again?


title: Livesearch with first 10 matches as preview for zsh-history?

text: I have seen a history-livesearch with a preview, that shows the 10 first matches in the history in a list below the BUFFER-line, which is updated on every keystroke, and acts like the standard ctrl+r search the rest of the time. (But the user who has that feature is gone for 3 weeks and unreachable) **tl;dr: Does anyone know this plugin/script and can link it to me** or help me programm it with updating the list properly? my current code looks like that, but has no updating (just the static list from the start and the search does not look totally naturally)               zle -N search          bindkey "^R" search          search () {     echo "";     fc -ln -30 | grep $(printf "%q\n" "$BUFFER");     <standard-history-backwards-search-widget>; #not on linux atm     }


title: Wget fails to download PNG files from Blogger

text: I am trying to mirror a blogger site so that I can have an exact copy of it on my filesystem to view. I have tried issuing the following command on Linux:               wget -r -k -x -e robots=off --wait 1 http://your.site.here.blogspot.com/      I have even tried using the -D flag to list a comma-separated list of domanins to follow (would prefer to just follow any domain though without having to specify all of them). I have even tried changing the .com part of the URL to the top-level domain for my country (.it) (without which for some reason I don't understand and would like to know, wget retrieves only index.html and no other page, perhaps someone here can explain why). So, even when I do a               wget -r -k -x -e robots=off --wait 1 http://your.site.here.blogspot.it/      several HTML and also the favicon.ico are downloaded but none of the .png images from blogger are downloaded. Why is this so and how can I get wget to work properly. I've read the wget man page but had no luck. Thanks.


title: mount changes directory permissions to admin:admin?

text: I'm mounting a samba share from one CentOS server to another using:               mount -t cifs -o blarg,password //10.151.170.170/events /var/blarg/copy-to      When I do this the permissions of `/var/blarg/copy-to` change to admin:admin. When I unmount using `umount //10.151.170.170/events` the permissions change back. I don't want this to happen as this affects some other functions. **How can I prevent the permissions changing to admin?**


title: How do I run the same linux command in more than one tab/shell simultaneously?

text: Is there any tool/command in Linux that I can use to run a command in more than one tab simultaneously? I want to run the same command: _./myprog argument1 argument2_ simultaneously in more than one shells (I want to increase this so as to put my code under stress later on) to check if the mutexes are working fine in a threaded program. I am kind of looking for something like what wall does. I can think of using tty's, but that just seems like a lot of pain if I have to scale this to many more shells.


title: What is the size of the TaskList?

text: While reading through the Linux Kernel Development by Robert Love, I went through the following line : > The kernel stores the list of processes in a circular doubly linked list > called the task list. I would like to know what is the size of this Task list.


title: Changing the bash prompt

text: Where is the setting that determines what the bash prompt looks like? Specifically on Arch, but I'm sure others would like to know for other distros too if it's different. Speficially I'd like to use (K)Ubuntu's prompt


title: for loop with multiline data

text: I need to create a script with a loop through a list of items. I want to insert a string in the script. I tried:               for i in "     a     b     c";     do      echo "test "$i     done      But that only outputs one string:               test a b c      How would I get this?               testa     testb     testc      (`a`, `b` and `c` are just examples for some longer words, which I got from an OpenOffice Calc file)


title: Is there a back-"button" in w3m?

text: Does w3m offer a keyboard shortcut to go back one page? I couldn't find anything in the man pages.


title: Am I installing CentOS 5.5 right?

text: I'll probably be in here a bit over the next few months. The only exposure I've had to Linux is just some basic dabbling with Ubuntu and using Knoppix as a recovery DVD for when things go wrong. I need to setup a VM with CentOS 5.5 64bit. I downloaded the iso from the main site. Have mounted it with VMWare workstation. This link seems to be the best one I can find on getting things setup. However it differs to some of the YouTube videos I have seen installing 5.4 Should I be doing a Network Installation? Theres a step in the above guide that points to a mirror to pull the image from a webserver. Surely the image is on the ISO I downloaded? However, I do not see any other option to install other than network install. Can anyone tell me where I am going wrong? I am sure it is something silly.


title: How to calculate (weighted) majority over columns?

text: I have two files: the first one contains lines where the first column is an ID, and the remaining columns are votes, e.g. > 3242 -1 1 -1 1 1 1 In a first step I want to calculate the majority for the IDs. For the example above, the vote is 1 (since there are more positive votes then negative ones). I would like to store the results in an output file with lines such as > 3242 1 I also have a file that contains the 'weights' of the respective votes, e.g. > 3242 0.9 0.1 0.9 0.2 0.1 0.2 In a second step, I also want to calculate the weighted votes for the different lines. In this case this would be > (0.9 * -1) + (0.1 * 1) + (0.9 * -1) + (0.2 * 1) + (0.1 * 1) + (0.2 * 1) = > -1.2 The result is negative, so the vote should be -1. Again, I would like to store this in an output file, where each line contains the ID and the resulting vote. Would this be possible with awk, perl,...?


title: getopts - how to avoid read next $OPTARG as argument?

text: Just started use getopts and found one problem... For example - have a script with:               while getopts "h:loav" opt; do     case $opt in     h)       h=$OPTARG       echo $h       ;;      But whet I run it:               $ ./ftpclean.sh -h -l     -l      I got second option as argument for first option... So - if user forgot set argument:               $ ./ftpclean.sh -h argument     argument      `getopts` will set `echo *second option*`... Is there any "legal" way to avoid it? Best solution wich I found - is to add function:               function checkargs () {     if [[ $OPTARG =~ ^-[a/l/o/a/v]$ ]]       then       echo "OPTERR"       exit 1     fi     }      And run it before set variable:                while getopts "h:loav" opt; do       case $opt in     h)       checkargs       h=$OPTARG       echo $h       ;;      So now:               $ ./ftpclean.sh -h -l     OPTERR


title: !fmt for current line only

text: When I want to format part of text with `fmt` in `vim` I usually select parts of interesting lines in Visual Mode, with: `Ctrl`+`V` `Arrows`, and than type `!`+`f`+`m`+`t`. When there are couple of lines they are other ways of doing this:               :11,22!fmt      When text to be formatted is places between 11 and 22 line. For one line I could write :               :22!fmt      But this is not comfortable to type new number, each time I change line. Is there a way of doing this : `:22!fmt` without `22` but some mark, variable, that means _"current line"_ ?


title: FreeBSD zfs timeout errors

text: I have FreeBSD 8.2 with ZFS v28. 8 cpu core, 16Gb ram. Two disk drives (1.5Tb WD Green) on zfs mirror raid. My system strangely uses memory. With alot of free (wired) memory it start to use swap and then doesn't clean it! Swap usage keeps growing. munin-graph swap And then I see on my kvm this messages: ![kvm log](http://i.stack.imgur.com/Q57TO.png) All file reads or writes seems very slow. When I use ssh and for example do `nano /etc/rc.conf` it pauses for 3-5 seconds before it works. Will my disk drives die soon? Or is the problem elsewhere?


title: How can I retain the console input in mplayer when reading from stdin?

text: I'm playing around with the **command line interface** of `mplayer`. I'd like to script it in the following way               find /some/path/ -type f | grep -vif blacklist | mplayer -shuffle -playlist -      where `blacklist` is a text file with artist or song names I'd rather ignore when I have visitors or my son is around (lot's of swear words... :D) When `mplayer` encounters the `-` character, it disables the console input. From the man page:               -noconsolecontrols               Prevent MPlayer from reading key events from standard input.                 Useful when reading data from standard input.  This is automatically                 enabled when - is found on the command line. [snip]      This blocks me from seeking in the file and skipping individual songs. Funnily, this works for videos, because the video window still accepts the usual keyboard inputs. How can I have the regular console input back? I would like to avoid using a temporary file, although this is of course the easiest solution. `-slave` and `-input` don't seem suited and trying `-consolecontroles` does not work.


title: Linux open source tool for Request tracking, Inventory control and MRBS

text: I have installed the `Request tracker tool` in my RHEL machine. I have also a meeting room booking system (MRBS) in my RHEL machine. Also, I can see there are some open source `Inventory of items tools` available. I wanted to know if there is any open source tool which has all these 3 features combined together so that I can use a single login to all these tools.


title: No sound in USB headphones using fedora 16

text: The volume control buttons on the usb headphone work, they can increment or decrement the system sound.   However the **headphone have no sound**. How to make it work? kernel 3.2, pusleaudio is used by default.


title: Running an application with alternate/modified system time

text: I am looking for a way to start an application with an alternate system time than that which is set. Basically one of the beta programs I use has a bug (it really is a bug) that no longer lets it work past January 29th. Setting my system time to a few day prior fixed the issue and the app works fine now. However some of my other applications are not working properly anymore. As a general question (I could see my self using this for other things), is it possible to launch an application and make it think there is an alternate system time? Specifically though, I am running Mac OS 10.7.2 and I'm trying to launch MouseShare with an alternate system time than that which is set.


title: Debian install failed, grub

text: I have been trying to install debian wheezy on my desktop with no sucess. During the install when I get to the grub screen it says if I see my operating systems listed to go ahead with grub. During this screen it only lists windows vista(loader)(this is actually windows 7) but no debian. I succesfully installed debian on my laptop no problem with the same disk, my laptop only runs debian in comparison though. After the install and my computer loads past my BIOS I get a black screen with a blinking cursor in the top left corner. I believe that debian has installed properly but that grub did not.