title: cannot find libarchive when compiling YAP prolog in OSX

text: I am trying to compile the last development version of Yap Prolog in OSX (Mountain Lion). The first time I tried I saw this message:               ##################################################################     # ERROR: Could not find library archive (-larchive).  Dropped     # library(archive). Library archive is available from     # http://code.google.com/p/libarchive/     #     # Most Unix/Linux distributions are shipped with binaries.  Make     # sure to have the development library installed.  E.g.     #     #   Debian/Ubuntu/Mint: aptitude install libarchive-dev     #   Fedora/...      yum install libarchive-devel     #   MacOS (Macports):   port install libarchive     ##################################################################      So I installed libarchive using mac ports as suggested with `sudo port install libarchive`. The installation was successful. However, after compiling again it keeps saying that libarchive is missing. I tried to find a libarchive file in my system and I found an alias `/opt/local/lib/libarchive.dylib` pointing to `/opt/local/lib/libarchive.2.dylib`. Just in case I set the environment variable `DYLD_LIBRARY_PATH` to `/opt/local/lib` but the problem is still there. Does someone have a clue how I can solve this ?


title: Reversing the direction of a trackball

text: For some reason, I want to use a trackball Logitech (aka Logicool) Marble Mouse (aka Trackman Marble) upside down. Is there a way to reverse the left and right rolling and up and bottom rolling respectively software-wise, without modifying the hardware? I tried this by writing a configuration file in `/etc/X11/xorg.conf.g/` such as               Section "InputClass"         Identifier "Marble Mouse"         MatchProduct "Logitech USB Trackball"         Option "EmulateWheel" "true"         Option "EmulateWheelButton" "8"         Option "XAxisMapping" "6 7"         Option "Emulate3Buttons" "true"         Option "ButtonMapping" "1 2 3 5 4 7 6 2 2"     EndSection      The crucial part is that I switched the keys 4 and 5 and 6 and 7 so that instead of:                   Option "ButtonMapping" "1 2 3 4 5 6 7 2 2"      I have:                   Option "ButtonMapping" "1 2 3 5 4 7 6 2 2"      But this is not working, and this maybe only valid for scroll wheel emulation mode. How can I reverse the rolling?


title: Unix User Level Keylogger

text: I need to record my own keystroke data for some academic research. I wrote a regular keylogger for Windows, but now I need to write one for a Unix environment, with the constraint that I have only user-level access. Furthermore, I'm only in the terminal, so this problem is more narrow in one sense. What would be the best way to do this? Is there some easy way to sort of fork my input so that it goes to a special program as well as to Bash? I'm using Python or Ruby if there's a lot of code involved, or Bash would work. The system is Red Hat Enterprise Linux 6.3 if it matters. **Update** : I should have listed out more detailed requirements:   * Need to record timing somehow (script -t seems to be fine)   * Need to handle special keystrokes (it matters if a Ctrl or a shift was hit in-between keystrokes); so far as possible, every key event should be handled   * Optional: Might also be good to differentiate key down and key up events for more fine-grained data.


title: Should 'LC_ALL=fr_FR.UTF-8 date +%x' give consistent results across machines?

text: The `%x` format specifier to the `date` utility should, according to the man page, use the locale specific date format. However, when I specify the same installed locale and try this on two different machines, I get different formats on each: On machine 'A':               $ locale -a | grep fr_FR     fr_FR     fr_FR.ISO8859-1     fr_FR.ISO8859-15     fr_FR.UTF-8     $ LC_ALL=fr_FR.UTF-8 date +%x     31.05.2012      On machine 'B':               $ locale -a | grep fr_FR     fr_FR.utf8     $ LC_ALL=fr_FR.UTF-8 date +%x     31/05/2012      I had a look at http://demo.icu-project.org/icu-bin/locexp?d_=en&_=fr_FR, and the section for 'short date' makes it look as if machine 'B' has it right here. Or have I misunderstood something, and in fact the locale settings do not absolutely specify the date format and this sort of variation is to be expected across implementations? Edit: Hmm.. no takers... Would it be more interesting if I said that machine 'A' is OS X Lion and machine 'B' is Ubuntu 12.04, both of which it would seem reasonable to expect to have correct internationalization/localization settings?


title: Setup DSL Network Connection in KDE

text: I have recently migrated to KDE from unity (ubuntu 12.04). I have a PPPoE network where I live. Under unity, gnome, xfce I am able to set up a DSL connection and everything works fine. I tested a live cd opensuse (kde) and when I try to set up a DSL connection it fails in a weird way. Under kde (ubuntu) happens the same thing. I tested also an ZevenOS KDE and fails. This is what I get when I try to set it up: ![screenshot](http://i.stack.imgur.com/U6GyZ.png) I am sure my username and password are correct. I set it to connect automatically and to be a system connection. Ethernet tab, IPv4 Address and IPv6 tabs are default. Under PPP tab only "Allow BSD compression", "Use TCP header compression" and "Send PPP echo packets" are checked. I also tried other combinations. The weird thing is that if I log on with unity and make the connection it works. If I log back in with KDE I see the DSL connection created on unity and it works.


title: How to disable live shell session command history under AIX 5-6?

text: It's okay that there are history files logging the commands that has been used. That't not the problem. The problem is that when 2 admins are logged in to an AIX server then it could be bad: If admin #A uses               rm FILENAME      then if admin #B hits the up arrow he gets the               rm FILENAME      command which is not a very good thing. So how can the termial be forced to only write the command history if the ssh session ended? (UPDATE#2: or solution could be that that each session has it's uniq command history, and thus we can't see each others command, only when they sign out for ex.) UPDATE#1               4:root@SERVER:/root # echo $SHELL     /usr/bin/ksh     4:root@SERVER:/root # oslevel -s     6100-05-01-1016     4:root@SERVER:/root #


title: In a script, check if standard input comes from a file or pipe

text: I know this has been _poorly_ covered previously, but those answers either lack explanation or don't apply. Basically at some point my scripts needs check if a file is specified, if it was it will be used later as input.               [ -f "$1" ] && TINPUT="$1"      simple enough... Now if a file was not found, or not specified, I would have `TINPUT="-"` which would tell the later command to read stdin. Here is my question... How do i get the script to die with error, if it was run without a pipe or without a file specified? I'm using dash, the Debian POSIX complient shell, so I can't use Bashisms. I also prefer to use lists, over `ifs` but most `ifs` could be written in lists anyway.


title: Can strace/ptrace cause a program to crash?

text: So recently, I was discussing strace with somebody, and they were asking what would happen if you straced a running process just as it was creating a network socket or something similar. Could this cause the program to crash in unexpected ways? From what I've read about ptrace, the syscall used by strace, it shouldn't be able to cause anything like that if you're just debugging a thread. The process gets stopped, every time a syscall is called, but it should later resume and be none the wiser. Signals get queued while it's not running, so I assume something similar happens with syscalls/sockets/listen. Can ptrace used in the context of strace cause any weird process crashes?


title: How can I determine the connection method used by a MySQL client?

text: When using a MySQL client (e.g. `mysql`) how can I determine whether it connected to the server using a Unix socket file or by using TCP/IP?


title: Calling a script in ~/.profile stops my logging in

text: I placed a call to a bash script in my `~/.profile`. The script executes a CLI program to dim my screen at login. However, Gnome doesn't continue to log me in to my standard desktop after running the script. Is there a way to make the `~/.profile` script call non-blocking? I'm happy to provide more details that might help you answer this. My distro is Linux Mint. **Edit** Contents of `.profile.`               # ~/.profile: executed by the command interpreter for login shells.     # This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login     # exists.     # see /usr/share/doc/bash/examples/startup-files for examples.     # the files are located in the bash-doc package.          # the default umask is set in /etc/profile; for setting the umask     # for ssh logins, install and configure the libpam-umask package.     #umask 022          # Me     bash /home/eoin/repos/scripts/autostart.sh          # if running bash     if [ -n "$BASH_VERSION" ]; then         # include .bashrc if it exists         if [ -f "$HOME/.bashrc" ]; then         . "$HOME/.bashrc"         fi     fi          # set PATH so it includes user's private bin if it exists     if [ -d "$HOME/bin" ] ; then         PATH="$HOME/bin:$PATH"     fi      And my script `/home/eoin/repos/scripts/autostart.sh`:               #!/bin/bash     bash ~/repos/scripts/redshift/redshift.sh      Which in turn calls another script :-P               #!/bin/bash     redshift -v


title: How do I get pacman to use my custom PKGBUILDs when updating?

text: I customized a `PKGBUILD` for Apache, ran `makepkg` and installed it with `pacman -U httpd.tar.xz`, which worked fine. A few months later I upgraded my system with `pacman -Syu` which used the system-default configuration for Apache which broke my web server. How do I tell pacman to always use my custom compilation settings so I don’t have to manually upgrade every time a new version is released?


title: How to find bash in a portable way

text: When we write shell scripts we do this:               #!/bin/bash      But What if bash is in `/usr/bin/`? How can we find it in a portable way inside script? I did this, but it gives error:               #!which bash


title: Can't connect through ssh?

text: I'm running two OSes, one (Backtrack 5) as a guest in VirtualBox and the other (Ubuntu 13.04) as the host. Now when I connect to my host through ssh (host- only connection):               $ ssh 198.168.*.* -vvv      I'm prompted for a password and when I enter the password I get the following error occurs:               debug3: packet_send2: adding 64 (len 58 padlen 6 extra_pad 64)     debug2: we sent a password packet, wait for reply     debug3: Wrote 144 bytes for a total of 1271     debug1: Authentications that can continue: publickey,password     Permission denied, please try again.      I've tried it again and again so I know that my password isn't wrong. On my host machine when I type:               $ ssh localhost      it connects normally after typing the password, but when I issue this on guest it says:               Read from socket failed: Connection reset by peer     Connection closed by UNKNOWN      What is the problem? edit: the first of my problem was I was trying               ssh ip      but it should be               ssh username@ip      cant connect to host though. Its refusing the connection


title: how can I print the Nth and the Mth line above or below the matching line with grep?

text: Let's say I have a well-structured text file with following content(no leading line numbers):                1 Mon Jun 9 00:11:47 CST 2014      2 eth0      Link encap:Ethernet  HWaddr D4:BE:D9:F5:5C:0E      3           inet addr:10.179.113.125  Bcast:10.179.113.127  Mask:255.255.255.248      4           inet6 addr: fe80::d6be:d9ff:fef5:5c0e/64 Scope:Link      5           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1      6           RX packets:1169385 errors:0 dropped:0 overruns:0 frame:0      7           TX packets:250825 errors:0 dropped:0 overruns:0 carrier:0      8           collisions:0 txqueuelen:10000      9           RX bytes:365792552 (348.8 MiB)  TX bytes:20648578 (19.6 MiB)     10           Interrupt:24 Memory:d6000000-d6012100     11 Tue Jun 10 05:11:47 CST 2014     12 eth1      Link encap:Ethernet  HWaddr D4:BE:D9:F5:5C:10     13           inet addr:10.254.4.1  Bcast:10.254.4.255  Mask:255.255.255.0     14           inet6 addr: fe80::d6be:d9ff:fef5:5c10/64 Scope:Link     15           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1     16           RX packets:3806158038 errors:0 dropped:23193484 overruns:0 frame:0     17           TX packets:1206000723 errors:0 dropped:0 overruns:0 carrier:0     18           collisions:0 txqueuelen:10000     19           RX bytes:1596108082 (1.4 GiB)  TX bytes:2960952707 (2.7 GiB)     20           Interrupt:25 Memory:d8000000-d8012100      Now what I need is to filter out line#1, #3, #6 for the eth0 section and line #11, #13, #16 for the eth1 section with the grep keyword 'eth'.               Mon Jun 9 00:11:47 CST 2014         inet addr:10.179.113.125  Bcast:10.179.113.127  Mask:255.255.255.248     RX packets:1169385 errors:0 dropped:0 overruns:0 frame:0     Tue Jun 10 05:11:47 CST 2014     inet addr:10.254.4.1  Bcast:10.254.4.255  Mask:255.255.255.0     RX packets:3806158038 errors:0 dropped:23193484 overruns:0 frame:0      How can i make this?


title: unix oracle connectivity

text: ![enter image description here](http://i.stack.imgur.com/3QmdK.png)Operating system : Windows8.1               i use Linux ubuntu using vmware           Today i have installed oracle database 11g release 2 in particular drive           i want to access database via linux/ubuntu            i able to access via windows command prompt       using the query               set oracle_sid=datbase_name ;          Sqlplus;      username ;     password ;          SQL> select sysdate from dual ;                 SQL> cl scr ;          SQL>exit;      i need to know , is it possible to connect and access database via ubuntu/Linux/ once i type               sqlplus / as sysdba       i got the error sqlplus not found `i know i have to set the oracle environment ,` but i don't know how ?


title: How to rewrite all subdomains except one

text: Right now my rewrite rule forwards all subdomains except `chat.auricle.fm` to the root:               RewriteEngine on     RewriteCond %{HTTP_HOST} ^.*\.auricle\.fm [NC]     RewriteRule ^(.*)$ http://auricle.fm/$1 [L,R=301]      How can I change it so that it forwards all subdomains except for `chat.auricle.fm`?


title: Make Software raid of kernel use dedicated core of cpu

text: I am sure this is more of a question related to approach than a tech-how-to. I have 2 processors, each with 2 cores on my machine. I have Software RAID (md0) configured using Linux kernel. Is it possible that I dedicate one chip or any 2 of the 4 cores specific to the software raid management routines, the server has other services to perform for which 2 free cores at any given time would be sufficiently adequate to address. The reason I am asking to have 2 cores dedicated for software raid is probably obvious, for the reasons of dedicated cpu cycles, increased performance, minimum guaranteed levels of (non-blocking) io throughput. The other part to the question is, that I am sure different software raid level implementations require different cpu cycle times, and assuming that my choices are either RAID-4 or RAID-5 or RAID-1+0. Also, if I plan to increase the number of raid devices(like adding more arrays) the number of cores requirement would also increase. How many cores could be dedicated theoretically for each of the raid device(s) for each of the given RAID level?


title: How do I make sure grub is only installed once?

text: I currently have Windows on one partition, and Ubuntu on another. I'd like to install Quimo, and possibly Mint and/or Lubuntu as well. How do I make sure that only Ubuntu has Grub, and that the others don't install it too, or, if more appropriate, make sure that Ubuntu is the only one that is used?


title: How to start VNC server on start-up in Ubuntu 10.04

text: I've been struggling with this long enough to ask yet another startup script question. I've got a startup script that is relatively simple, ie:               ### BEGIN INIT INFO     # Provides:          startVNC     # Required-Start:    $remote_fs $syslog     # Required-Stop:     $remote_fs $syslog     # Default-Start:     2 3 4 5     # Default-Stop:           # Short-Description: Start VNC server at boot time     # Description:       Test     ### END INIT INFO          #!/bin/sh     echo "JOB RUN AT $(date)"     echo "============================"     echo ""     /usr/bin/vncserver -geometry 1280x1024 -depth 24      Obviously it's only the last line that's really important. The script is executable, ie.               ls -l startVNC      yields:               -rwxr-xr-x 1 root root 406 2011-12-07 15:45 startVNC      When I execute it when logged in over ssh as `my_user` vncserver starts and I am able to see the GUI from my desktop. So then I tried 5 things to make it run on start-up:   1. Copying my script to `/etc/init.d/`, calling `update-rc.d -f startVNC defaults` (also with `99` after `defaults` to make sure everything `vncserver` depended on is already running). I checked all the generated symbolic links were there in the `/etc/rcX.d/` folders. But it didn't work on reboot or start-up   2. Adding my script to `/etc/rc.local` before `exit 0`   3. Adding to `crontab -e` as `@reboot /home/my_user/scripts/startVNC`   4. Adding my script to `/etc/init.d/rcS`   5. Adding my script to System -> Preferences -> Startup Applications in Gnome but none of them worked. What more can I check. Is there an error in my script maybe? I guess the process'es owner has to be `my_user` for it to work, but I have no idea how to debug it. Any clues appreciated.


title: Loading speedstep_centrino kernel module

text: Because of a noisy fan in my laptop, I need to change CPU frequency and for this task I need to load the appropriate kernel module. The CPU in my laptop `Acer TravelMate 4002WLMi` is:               $ cat /proc/cpuinfo | grep "model name"     model name  : Intel(R) Pentium(R) M processor 1.60GHz      This article helped me to find the kernel module I need (my CPU differs only a little in frequency). After the `sudo modprobe speedstep_centrino` command nothing happened. `echo $?` returns `0`. Here is the output of `lsmod` and dmesg and other useful outputs. Could you help me solve this problem (explain what's wrong with kernel modules and use the appropriate module for changing CPU frequency)? OS: `Lubuntu 11.10` (GNU/Linux 3.0.0-14-generic i686)


title: How do I copy a symbolic link?

text: I have a symbolic link to a file in one directory. I would like to have that same link in another directory. How do I copy a symbolic link? I tried to cp the symbolic link but this copies the file it points to instead of the symbolic link itself.


title: Problems installing Chrome in SLED 11

text: I'm trying to install Google Chrome on my OS, but when I execute the `.rpm`, I got this error:               google-chrome-stable-35.0.1916.153-1.x86_64 requires libX11.so.6 (64bit), but this requirement cannot be provided.


title: Awesome wibox: remove tag label

text: Currently, I have both the gajim and skype windows visible as both icons (in systray) and window labels (in mytasklist). How can I remove that latter so that it is not shown since I do not need two instances of the same thing cluttering my wibox.


title: How to write a shell script that gets executed on login in?

text: I am trying to write bash shell script in Ubuntu 11.10 Linux distro, that will get executed automatically on logging into the system. But I am not able to figure out that what to write in script that by it will get automatically executed on logging in.


title: How to copy files from linux to windows using winscp from a folder which contains millions of files

text: I need to copy files from a linux machine to a windows machine where the only ports which can be open are for SSH (22).   I can connect to the linux machine using WinSCP but the problem is once I try to navigate to the desired folder WinSCP gets stuck since the folder contains millions of records.   Basically I don't really care which files I copy and I would be glad to find a solution which enables me to just copy the latest 200 files.   Any ideas?   I've tried using `ls -f | less` but that did not do the trick.


title: GNUPanel Install onto Debian GNOME with Apache2

text: I am a very very new linux user and I have somehow managed to install debian gnome onto a machine on our network and using apt-get i've installed apache2 with php5. I can access my website over the network via an IP (192.168.2.97). And I get the standard 'It Works!' page. Now I wanted to install some kind of configuration panel, and after looking through them I decided GNU Panel would be okay. It seemed to have a lot of features. So i've been through the install process, and now, My original page ('It Works') has been changed to a grey page with a table in the middle of it (no text, except for the tag - 'Stats') and when I try and access the address 192.168.2.97/admin/, it routes me to: `http://192.168.2.97/admin/gnupanel- admin.php` but that simply produces an internal server error. If I try and go to localhost/admin/ on the debian machine itself, It tries to take me to the above address (/admin/gnupanel-admin.php) but I just get a blank page instead of the internal 500 error. Can anyone please provide some insight as to why this is happening.


title: Understanding aptitude's behavior on a machine with multiple archives enabled

text: I'm having to deal with a Debian server, which initially was Squeeze, I believe, but where administrator enabled several distributions:               deb http://mirror.yandex.ru/debian/ stable main contrib non-free     deb http://mirror.yandex.ru/debian/ testing main contrib non-free     deb http://security.debian.org/ testing/updates main contrib non-free     deb http://mirror.yandex.ru/debian/ unstable main contrib non-free     deb http://mirror.yandex.ru/debian/ experimental main contrib non-free      and specified in `/etc/apt/apt.conf`: `APT::Default-Release "testing";`. As a result, when I'm asking aptitude or apt about state of a certain package it bears controversial testimony:               me@server: aptitude search emboss     i A emboss                                       - european molecular biology open software suite             me@server: aptitude show emboss     Package: emboss                               New: yes     State: not installed     Automatically installed: yes     ...      `apt-cache show emboss` shows information on 4 copies of the package of interest ("emboss"), out of which one copy contains line `Status: install ok installed`, which means that it is installed, I assume.               Package: emboss     Status: install ok installed     Priority: optional     Section: science     Installed-Size: 4020     Maintainer: Debian Med Packaging Team <debian-med-packaging@lists.alioth.debian.org>     Architecture: amd64     Version: 6.3.1-6     Depends: emboss-lib (= 6.3.1-6), libc6 (>= 2.7), libexpat1 (>= 1.95.8), libfontconfig1 (>= 2.8.0), libfreetype6 (>= 2.2.1), libgd2-noxpm (>= 2.0.36~rc1~dfsg) | libgd2-xpm (>= 2.0.36~rc1~dfsg), libhpdf-2.1.0 (>= 2.1.0+dfsg), libjpeg62 (>= 6b1), libmysqlclient16 (>= 5.1.21-1), libpng12-0 (>= 1.2.13-4), libpq5 (>= 8.4~0cvs20090328), libx11-6, libxpm4, zlib1g (>= 1:1.1.4), emboss-data (= 6.3.1-6)     Recommends: primer3, dialign     Suggests: emboss-doc, emboss-test, embassy, clustalw     Description: the european molecular biology open software suite      EMBOSS is a free Open Source software analysis package specially developed for      the needs of the molecular biology (e.g. EMBnet) user community. The software      automatically copes with data in a variety of formats and even allows      transparent retrieval of sequence data from the web. Also, as extensive      libraries are provided with the package, it is a platform to allow other      scientists to develop and release software in true open source spirit. EMBOSS      also integrates a range of currently available packages and tools for sequence      analysis into a seamless whole. EMBOSS breaks the historical trend towards      commercial software packages.     Homepage: http://emboss.sourceforge.net      My questions are: 1) How do I know, from which distribution (stable, testing, unstable, experimental) currently installed version of package was taken? How do I refer to it in commands (e.g. in `dpkg -L`)? 2) How aptitude commands (`show` and `search`) choose, which version of the package they should report? Why algorithms of `show` and `search` differ? P.S. Please, don't reply that creating a mix of distributions is a bad practice. I totally agree, but still have to deal with that machine.


title: Displaying the last N modified files?

text: How can I list the 10 most recently modified files of a certain extension, not all files, or the files modified during the last 2 days for example?


title: Best practice to backup a LUKS encrypted device

text: What's the **fastest method** to **backup and restore aluks encrypted device** (e.g. a full encrypted usb-device to a image-file). The usb-device can be _decrypted/accessed_. I'm looking for a solution to mount the backup image as a file (encryped). Can it be possible? Keep it simple, stupid.


title: Possible to get SMS/text message notification when process ends/is killed?

text: There are scripts that will send an e-mail when a server process is finished. However, I do not want to check my email every so often just to see whether a job has finished. Therefore I'd like to get an SMS message. My question is similar to this one, just exchange SMS with all occurrences of "e-mail": Is there a program that can send me a notification e-mail when a process finishes? Can you think of any workaround / app / script / whatever that would enable an SMS to be sent when a job is finished (or prematurely ended?)


title: Determine if a package is provided by an installed packagein Arch Linux

text: I am trying to script the installation of optional "dependencies" depending on what other packages are installed in an Arch Linux system. I can use `pacman -Q` to tell me if a package has been installed either directly or as a dependency, but this fails if the package is "installed" via provides in the PKGBUILD. How can I determine if a package that provides a package has been installed? The specific issue I have is I want to install `kile` if both `kdebase-workspace` and `texlive-core` are installed. The issue is that I cannot pick up that the AUR `texlive-dummy` package is providing `texlive- core`.


title: Remove all files except for last file of each month

text: Consider a directory with MySQL backup files with timestamps as part of the filename:               -rw-rw-r-- 1 ubuntu ubuntu 35856184 Nov 16 16:00 db_2013-11-16_1600.sql     -rw-rw-r-- 1 ubuntu ubuntu 35856915 Nov 16 17:00 db_2013-11-16_1700.sql     -rw-rw-r-- 1 ubuntu ubuntu 35857565 Nov 16 18:00 db_2013-11-16_1800.sql     -rw-rw-r-- 1 ubuntu ubuntu 35858254 Nov 16 19:00 db_2013-11-16_1900.sql     -rw-rw-r-- 1 ubuntu ubuntu 35860276 Nov 16 20:00 db_2013-11-16_2000.sql     -rw-rw-r-- 1 ubuntu ubuntu 35861583 Nov 16 21:00 db_2013-11-16_2100.sql     -rw-rw-r-- 1 ubuntu ubuntu 35863630 Nov 16 22:00 db_2013-11-16_2200.sql     -rw-rw-r-- 1 ubuntu ubuntu 35864868 Nov 16 23:00 db_2013-11-16_2300.sql     -rw-rw-r-- 1 ubuntu ubuntu 35866095 Nov 17 00:00 db_2013-11-17_0000.sql     -rw-rw-r-- 1 ubuntu ubuntu 35887731 Nov 17 01:00 db_2013-11-17_0100.sql     -rw-rw-r-- 1 ubuntu ubuntu 35888871 Nov 17 02:00 db_2013-11-17_0200.sql     -rw-rw-r-- 1 ubuntu ubuntu 35888871 Nov 17 03:00 db_2013-11-17_0300.sql     -rw-rw-r-- 1 ubuntu ubuntu 35889319 Nov 17 04:00 db_2013-11-17_0400.sql      These actually go on since September 2012! I need to delete all backups except for the last backup of each month. That is, these files should be left:               db_2012-09-30_2300.sql     db_2012-10-31_2300.sql     db_2012-11-30_2300.sql     db_2012-12-31_2300.sql     db_2013-01-31_2300.sql     db_2013-02-28_2300.sql     db_2013-03-31_2300.sql     db_2013-04-30_2300.sql     db_2013-05-30_2300.sql     db_2013-06-30_2300.sql     db_2013-07-31_2300.sql     db_2013-08-31_2300.sql     db_2013-09-30_2300.sql     db_2013-10-31_2300.sql     db_2013-11-20_0700.sql # Because this month has not finished yet!      I could write a Bash/Python script to create lists of each month, remove the last item from the list and then delete one-by-one the remaining files. Alternatively, the script could move the last files from each month to a temp directory, remove everything, then put the files back. _However_ I wonder if there is some way to simply tell `rm` (or rm with `find` and `awk` and `sort`) to ignore the last file of the month. **Is there such a magic spell?** I do recognise that life would be easier if I could just save _the first file_ from each month (which would be only a 1 hour difference from saving the _last_ file from each month) but that is not acceptable to others in the organization who fail to see that this essentially provides the same protection.


title: How to create mandos server-client pair?

text: I needed something like this post and found a post by Mandos developer. I read all literature and also tried to post, but it seems they have negligible activity in their mailinglist. So I am asking here. What I am trying to do is to create a pair of Mandos server-client as their FAQ states that ".. you could have two computers be the Mandos server for each other." without any conflicts. However, when I tried with dm-crypt with LUKS, it did not work like it should even after I configured and tweaked as stated here Has anyone managed to achieve something like above scenario with Mandos? Appreciate if there is any documentation regarding successful implementation of Mandos server-clinet pair?


title: find usage - command line vs script

text: I am seeing different results from the find command between being run manually on the command line vs run in a script. If I run the following on the command line:               find . -name '*.txt' ! -name '*20120427.txt'       I get all the .txt files in a directory except for the ones with the date that I want to avoid. But when I have this same line in a script with a variable to identify the date:               FDATE=`date +%Y%m%d`     find . -name '*.txt' ! -name '*${FDATE}.txt'       The script finds all the .txt files including the ones with the date I want to avoid. The only difference between the 2 is that I am passing the FDATE variable in the script. Is there something obvious I am missing? I do not understand why the results are coming out different.


title: What does ":>" do here?

text: I saw some postinst script                   # setting wget options         :> wgetrc         echo "noclobber = off" >> wgetrc         echo "dir_prefix = ." >> wgetrc         echo "dirstruct = off" >> wgetrc         echo "verbose = on" >> wgetrc         echo "progress = dot:default" >> wgetrc         echo "tries = 2" >> wgetrc      What does the `:>` do here ?


title: Using ACL's over read only/remote filesystem

text: I would like to define local ACL's to be used over a remotely mounted filesystem. The filesystem is mounted via autofs and sshfs FUSE. The idea is that we could setup a jailed user on a jump server with access to read files on other servers in the environment and use standard commands without alot of exposure and certainly without granting ssh access.   Problem is sshfs will always run as the same user so files within the path on the remote system would be exposed regardless of the user that they were exposed for. I've explored coding the security check right into sshfs but before I go down that road I'd like to see if any other package can add ACL support to an otherwise read only filesystem. Edit: @peterph How would you set your ACL's for the NFS share when the remote filesystem is read only? sshfs was really easy to take apart, so I added the ACL check right into sshfs itself a few days after writing this. Users get jailed on login via OpenSSH and jailkit, and access the read only sshfs automount as a non-privileged user from there. Every dir/file stat or read generates a syslog event. Been working like a charm and the users have no rights off of the one jailed box.


title: How to build Chromium from source on OpenBSD?

text: If I check ex.:               curl -s http://ftp5.eu.openbsd.org/ftp/pub/OpenBSD/5.3/packages/amd64/ |grep -i chromium      Then I can see that for the most up-to-date Chrome for the latest stable OpenBSD is: chromium-24.0.1312.6. On the latest stable Fedora (19): chromium-27.0.1453.93-2.fc19.x86_64.rpm How can I make a fresh Chromium from source? (since there aren't any methods to get a more up-to-date Chromium)


title: In what order do piped commands run?

text: I've never really thought about how the shell actually executes piped commands. I've always been told that the "stdout of one program gets _piped_ into the stdin of another," as a way of thinking about pipes. So naturally, I thought that in the case of say, A | B, A would run first, then B gets the stdout of A, and uses the stdout of A as its input. But I've noticed that when people search for a particular process in ps, they'd include grep -v "grep" at the end of the command to make sure that grep doesn't appear in the final output. This means that in the command ps aux | grep "bash" | grep -v "grep", which means that ps knew that grep was running and therefore is in the output of ps. But if ps finishes running before its output gets piped to grep, how did it know that grep was running?               flamingtoast@FTOAST-UBUNTU: ~$ ps | grep ".*"     PID TTY          TIME CMD     3773 pts/0    00:00:00 bash     3784 pts/0    00:00:00 ps     3785 pts/0    00:00:00 grep


title: What is a solid iptables configuration for my desktop?

text: On my desktop, I want to configure iptables pretty strictly. I see no reason why I need to allow anything except for internet traffic that I initiated. And maybe even that could be limited to only a few ports. What are the basic rules that can close off my desktop? I only need:   * To browse the internet   * Download email Any recommended set of rules?


title: Assembly files in obj-m list when building kernel modules

text: I'm trying to build kexec as a module, but I'm running into a weird problem. My obj-m is:               obj-m += kexec.o machine_kexec.o relocate_kernel.o      When I run the makefile, it complains that there's "no rule to make target relocate_kernel.c, needed by relocate_kernel.o" How should I be telling it to include the assembly file? I've looked in the kernel Makefile, and while I'm not very good with them, it DOES appear that there's a rule for .S > .o. Am I wrong about this?


title: Making su ask for password multiple times

text: Is there some way to make `su` ask for the password again in case of a wrong password (just as `sudo` does)? Initially I thought of this:               while ! su -c foo; do       read -n 1 -p "Retry(y/n)?" ch       if [[ "$ch" != "y" ]]; then         break       fi     done      But `foo` returns 1 in some cases as well, making it impossible to detect whether a wrong password was entered or if `foo` failed.


title: Checking if line in file exist

text: I have a bash script which asks a user for the number of CPU cores and saves it to variable named `$cores`. Now I want to add this variable to `.bashrc`, so I ask user how much CPU cores he has and then if he wants to save this value to `.bashrc`. Now the question, how I can check if `$cores` already exist in `.bashrc` so the script won't ask the user again?


title: Question on understanding windows manager/desktop environment

text: Linux newbie here. I'm trying to understand the different desktop environments and how they work together on one machine. If I install a new desktop environment, this shouldn't change the underlying linux base core, but should only install new GUI software that I the user interact with. This is how you can have multiple desktop environments on one system. Is this correct? For instance, if I install Kubuntu (comes with KDE) and then install xfce, this should in principle be identical to installing Xubuntu (comes with xfce) then installing KDE, correct?   I guess the difference would be that Kubuntu and Xubuntu have different base packages and different "tweaks" so will look and act slightly differently, but you could in principle make the two systems identical, right?


title: Why do we need two file descriptors when creating an unnamed pipe?

text: I've been reading about unnamed pipes and as I understood them they're implemented as a buffer in memory. When creating the pipe I need to pass an array of size two and it returns two pointers (file descriptors) to the buffer. The index 0 is used for reading from the pipe and index 1 for writing to it. My question is, if the buffer is just one and both indexes point to the same memory location and two processes can't read and write at the same time, then why do I need two file descriptors? I hope my question makes sense.


title: rhosts changes and re-initializing

text: I'm having trouble using the r-commands between my servers to do a tape backup. I've been making changes in the .rhosts file, but I'm not sure if the OS reads that file everytime it's called, or just when it's booted, or some other time. After I modify the .rhosts file, do I need to do anything to then have it be used with the next r-command? Note: _No tags for it, but I'm using Tru64._


title: Couting all characters by BASH character class

text: I need to efficiently count every character of an arbitrary file by its character CLASS (as defined by the BASH man page); i.e. > [[:alnum:]], [[:alpha:]], [[:ascii:]], [[:blank:]], [[:cntrl:]], > [[:digit:]], [[:graph:]], [[:lower:]], [[:print:]], [[:punct:]], > [[:space:]], [[:upper:]], [[:word:]] and [[:xdigit:]] Once the file is processed, display on a single line the resulting counts for each, even when zero. Web searches have not been fruitful in finding something along these lines. The arbitrary file (`/tmp/f1.txt`) will contain a variety of diverse text/data. I am not looking to process ELF binaries nor UniCode (or any form of multi- byte) content. I am not concerned about line count (`CR` and/or `LF`), only fixated on accumulating a count of each 'character' in the target file by the above classes. I intend for this to end up as a standard `function()` in a larger bash script. Bash/sed/awk and the like are desired; while perl/python/ruby not so much. Sample data files could be:   * Zero bytes, i.e. no content at all.   * A single character   * A single word   * Multiple words separated by whitespace   * Multiple lines interspersed with whitespace and/or CarriageReturns and/or LineFeeds.   * For multiline files there might not be a `CR` or `LF` to signify the end of the last line (yet all characters should still be counted).


title: Run command after nice command has finished

text: I have 3 `nice` commands that are dumping some databases, and compress assets for a backup. After that, the files should be copied to another server. I'm using this command:               nice mysqldump -u user1 -p'XXX' database1 | gzip > database1.sql.gz     nice mysqldump -u user2 -p'XXX' database2 | gzip > database2.sql.gz     nice zip -r assets.zip /var/www/site1/assets/          cd ..          scp -R backups user@backupserver.com:/home/user/backups      My problem is, that the `scp` commands seems to get executed, BEFORE the nice commands are finished. This leads to partial SQL dumps, and sometimes broken zip files. So how can I be sure, that all 3 nice commands are finished, before copying the files to another server?


title: Search in evolution does not find umlaut in different encoding

text: I use Evolution 3.6.4 on Fedora 18 x86_64, my main language is German. I got a mail (on my imapx account) encoded in iso-8859-15 with the word "hügelig" in it. The mail is displayed correctly in evolution. When I click on the search bar, search for "hügelig" in the message contents, I do not get a hit. If I change the search to "hgelig" (note the missing umlaut character), the mail is found. If I force the display encoding of the mail to utf-8, the word is shown as "hgelig" in the message body. So my guess is, that evolution only searches in utf-8 encoding and it does not respect the actual encoding of the message, at least not when searching. Any idea on how to change that?


title: Forcibly create directory hard link(s)?

text: I understand the reasoning why nearly every unix version doesn't allow hard- linking of directories (in fact HFS+ on OS X is the only one I know, but even that isn't made easy to do yourself). However, all file-systems in theory support hard-linked directories, as all directories contain at least one extra hard-link to itself, plus extra hard-links in sub-directories pointing back to their parent. Now, I realise that hard-linking can be dangerous if misused, as it can create cyclical structures that few programs will check for, and thus become stuck in an infinite loop. However, I was hoping to use hard-links to create a Time Machine style backup that can work for any unix. I don't believe that this kind of structure would be dangerous, as the links simply point to previous backups; there should be no risk of cyclical linking. In my case I'm currently just using rsync to create hard-links to existing files, but this slow and wasteful, particularly with very large backups and especially if I already know which directories are unchanged. With this in mind, is there any way to force the creation of directory hard- links on unix variants? `ln` is presumably no good as this is the place that many unix flavours put their restricts upon in order to prevent hard-linking directories, and `ln` versions that support hard-linked directories specifically state that the operation is likely to fail. But for someone who knows the risks, and knows that their use-case is safe, is there any way to actually create the link anyway? Ideally for a shell script, but if I need to compile a small program to do it then I suppose I could.


title: how to attach to a detached mosh sessions?

text: When I connect using mosh I get the following error:               Mosh: You have 2 detached Mosh sessions on this server, with PIDs:         - mosh [3700]         - mosh [31091]      How can I resume one of these sessions?


title: What are processes "[123.45.78.901-ma]" on linux, where the number is an NFS server's IP address?

text: I am seeing processes on Linux with the name "[123.45.78.901-ma]", where the number is the IP address of our NFS server. Does anyone know what these processes are, where I can find out information about them, or a good keyword to search the web with? Background: I see the processes on a machine where something funky is going on with NFS - something seems to be stuck in a loop making a huge number of NFS requests (read, renew, and authrefrsh), but all obvious candidates (like user programs) that might be doing so have been killed. A large number of `[123.45.78.901-ma]` processes exist (for brief periods of time) on the machine in question, but not (at least not for long enough that I have detected them) on machines that are acting normally. So it would appear that these processes are involved somehow in the problem, but I don't know how. I found them while looking for processes in "uninterruptible sleep", via               while [ 1 ] ; do ps -w -w -e -o pid,state,tname,time,args| grep ' D ' | grep -v grep; sleep 0.1; done      Details about the system:   * Red Hat Enterprise Linux Workstation release 6.3 (Santiago)   * Linux [...] 2.6.32-279.5.1.el6.x86_64 #1 SMP Tue Jul 24 13:57:35 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux Thanks in advance!


title: Linux Programmable Controller

text: I'm looking for a programmable Linux controller for home automation and general fun projects. Requirements:   * Controlling electric appliances - On/Off switches and dimmers (perhaps using relays)   * Receive analogue and digital data from sensors (switches, temperatures, etc.)   * USB connection   * Running Linux Advantages:   * Network connection / Web interface   * Python support   * Small display screen   * Keyboard and VGA support I used to have a lot of fun with a Handy Board, but it broke down a few months ago, and it lacks many vital features. ![alt text](http://i.imgur.com/k0UJh.jpg)


title: Stereo "tone-generator" for linux?

text: Is there something like a stereo (separate left-and right-channel) tone- generator for Linux? Where you can set volume and tone/pitch for each channel, and preferably also set the wave-form (sine, square, sawtooth, ...) and invert one channel (as opposed to the other). If not, any ideas for a good places to start to make one? I guess the simplest would be to adapt existing programs like synths... But if that work poorly, are there any libraries (like SDL?) that can be used as bases for such a program?


title: Which cell phones run Linux?

text: I know of the FreeRunner, but are there any other Linux cell phones out there? Are they any good?


title: Can I share a device from under /dev across hosts?

text: Here's the situation. I have a video device `/dev/video0` on a VMware Server and I want to access this device from within a virtual machine. However for whatever reason I can't connect the device directly to the VM, it must be connected to the host. Since under unix philosophy everything really is just a file, can I share a device under `/dev` using NFS, Samba, sshfs or some other protocol between two hosts, so that a linux on one server can access devices on a different server?


title: l, ls & la -- what are the differences, and are there more of these commands?

text: So, through typing several commands I've found that there's not only `ls`, but `l` and `la` too. There doesn't appear to be any `man` entries on Ubuntu 12.14. They all appear to do similar things with minor differences:               $ ls     app        config     CONTRIBUTING.md  doc       Gemfile       Guardfile  LICENSE  MAINTENANCE.md  Procfile  Rakefile   script  tmp     VERSION     CHANGELOG  config.ru  db               features  Gemfile.lock  lib        log      PROCESS.md      public    README.md  spec    vendor     $ la     app      CHANGELOG  config.ru        db   features  Gemfile       .git        Guardfile  LICENSE  MAINTENANCE.md  Procfile  Rakefile   .rspec  .secret     spec  .travis.yml  VERSION     .bundle  config     CONTRIBUTING.md  doc  .foreman  Gemfile.lock  .gitignore  lib        log      PROCESS.md      public    README.md  script  .simplecov  tmp   vendor     $ l     app/       config/    CONTRIBUTING.md  doc/       Gemfile       Guardfile  LICENSE  MAINTENANCE.md  Procfile  Rakefile   script/  tmp/     VERSION     CHANGELOG  config.ru  db/              features/  Gemfile.lock  lib/       log/     PROCESS.md      public/   README.md  spec/    vendor/      Just as a bit of trivia, are there more of these and what do they do? Is here any place to find this out? Unfortunately, google searching these commands gets ignored because they're so short.


title: Mapping between logical and physical block device names

text: I cannot figure out the mapping between different logical and physical block device names. The output of "cat /proc/diskstats" is :                104    0 cciss/c0d0 ...      104    1 cciss/c0d0p1 ...      104    2 cciss/c0d0p2 ...      104    16 cciss/c0d1 ...      253    0 dm-0 ...      253    1 dm-1 ...      253    2 dm-2 ...      253    3 dm-3 ...      The output of "df -h" is :               /dev/cciss/c0d0p1                 99M   39M   56M  42% /boot     /dev/mapper/VolGroup01-LogVol02   908G  760G  103G  89% /home     /dev/mapper/VolGroup01-LogVol03   193G  181G  2.6G  99% /opt     /dev/mapper/VolGroup00-LogVol00   54G   11G   41G  21%  /      Where do I find the mapping between "cciss" , "dm-#", and "VolGroup##" ? Thanks


title: In SciTe (Scintilla), how can I create Syntax-Highlighting for my own custom language?

text: I want to create a custom Language, with its own custom Syntax Highlighting. Notepad++ (a Windows SciTe/Scintilla based Text-editor), allowed me to create a custom "Language", and now, in Linux, I want to reproduce the same thing. I need(?) to use **SkiTe/Scintilla** because unless someone knows otherwise, it is the only plain text editor which can display **_different size_** fonts in the **_same_** text-file (eg. default-font= 12pt, comment-font=24pt). I used the **comments** font to display a complex script(alphabet) in a larger font.   Please let me know if there is any other **plain** text editor which does this. I assume this is a feature of SciTe/Scintilla (and not of Notepad++).   Some of the magic is possible/probably(?) done in files such ase:   /usr/share/scite/.properties Notepad++ has a GUI interface to set up a new language/syntax,   ...but I could use some direction on exactly how to go about it in SciTe. Thanks...


title: How can I use imagemagick's identify command in a script to tell if a JPEG file is invalid or corrupt?

text: I have a somewhat-kludgey script in which I want to copy valid, complete JPEG files to a photo album directory. I thought I could use ImageMagick's `identify` command to do this. The web documentation for that command says > The identify program describes the format and characteristics of one or more > image files. It also reports if an image is incomplete or corrupt. ... which sounds great. And if I run `identify jpeg:testfile.jpg`, I get an exit code of `0` if the test file is a JPEG, and `1` if it isn't. Good start — but the command also returns `0` if the file appears to be a JPEG but is incomplete. I looked through the extensive list of options, but nothing seems relevant. Can I use this command to do what I want? How?


title: Starting a service during startup

text: I've created a service for an application, and I want this application to be started on boot. In the service manifest, I realize that there's a property for this (enabled="true"), but I've been avoiding this for a particularly annoying aspect: The import is part of a script. Having the service as "enabled" means that it will be restarted on import. The problem is that I'm not sure how to wait until the process is enabled before continuing. So, what I do in the script is import with enabled set as "false", then run "svcadm enable -s `<service>`". So I was wondering if anyone had any answers for any one of these questions:   1. How do you make an existing service start on boot (hopefully avoiding manual additions to rc3.d)?   2. How do you make svccfg import wait until a service is completely enabled before continuing?   3. Is there an elegant way to wait until a service is started before continuing (avoiding manually grepping for enabled in a loop)? Thanks.


title: What is kernel ip forwarding?

text: I have seen on many blogs, using this command to enable IP forwarding while using many network security/sniffing tools on linux               echo 1 > /proc/sys/net/ipv4/ip_forward      Can anyone explain me in layman terms, what essentially does this command do? Does it turn your system into router?


title: renaming files without the **rename** command

text: I have a directory of files,               Measurements Panama 2009-03-22 Session1.xml     Measurements Panama 2009-03-22 Session2.xml     Measurements Panama 2009-03-22 Session3.xml     Measurements Panama 2009-03-22 Session4.xml     ...     Measurements Panama 2009-03-22 Session10.xml      and I want to remove the blank spaces and the `-` dash characters. I don't want to use the **rename** command because I don't know perl or regular expressions. From another post a recommendation for removing part of a file name was:               for f in *.png; do mv $f ${f#image}; done      this looks nice. I cant figure out what the `#` character does (I assume it removes the string "image" from the file names?), anyways... how do I remove the spaces and dashes? Best, I get an error that the files are not a directory when doing               [jings]s0128943: for f in *.xml; do mv $f ${f//[ -]/};done          mv: target `MeasurementsPanama20090322Session10.xml' is not a directory          mv: target `MeasurementsPanama20090322Session1.xml' is not a directory      etc for all the files


title: Fedora 15 - Audio Configuration

text: I have a Macbook Pro 6,1 that I have dual booting OSX and now Fedora 15. I'm working on getting the audio working. In System Settings > Sound > Output there are two options for audio devices:               High Definition Audio Control Digital Stereo (HDMI)     Internal Audio Analog Stereo      There is no sound when the first option (HD Audio Control Digital Stereo) is selected. However, if the second (Internal Audio Analog Stereo) is selected the headphone jack works, but the on board speakers do not work. I can't even tell what actual hardware on the laptop is. The Apple website (http://support.apple.com/kb/SP621) just says, > Stereo speakers with subwoofers, omnidirectional microphone, audio line in > minijack (digital/analog), audio line out/headphone minijack > (digital/analog) How do I get the speakers working?


title: Are there disadvantages in SSH tunneling?

text: I recently "bought" a VPS that I want to use as a Proxy to be able to use some sites and stuff that I can't reach from germany. Since I was yet too lazy to set up Squid and OpenVPN (which I currently think is needed) I use ssh-tunneling. Now after a couple of weeks I asked myself if ssh-tunneling wasn't just fine, or - and that is my question - if there are any caveats/contras/drawbacks that I need to have in mind?


title: Is there an ideal operating system for GNOME 3?

text: I'm absolutely new in Lunix. I love the UI of GNOME 3. I tried it in Fedora and Mint - but I'm not sure: Is there an IDEAL Linux version for GNOME 3?


title: Can I measure cold boot time using logs?

text: I want to measure the time it takes from loading grub until GNOME starts. Can I do this using existing logs? What alternatives do I have to measure the time it takes from grub until GNOME loads?


title: Why does Arch Linux keep Windows headphone mute

text: I have Windows 7 installed, and headphones work perfectly. Few days ago, I installed Arch Linux along with Win7. This issue appears with gnome/xfce4/openbox. Perhaps it is not related to desktop environment My headphones work fine under Arch Linux but:   1. When I turn to Win7 from Arch Linux, headphones stop working.   2. When I reboot Win7 twice, headphone works.   3. When I use `halt -p`, from Arch Linux and reboot to Win7, headphone works fine. I am using plain headphones(not usb headphone). Here is my device               00:1b.0 Audio device [0403]: Intel Corporation 5 Series/3400 Series Chipset High Definition Audio [8086:3b56] (rev 05)          01:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Redwood HDMI Audio [Radeon HD 5000 Series] [1002:aa60]


title: Get zsh to report directory to emacs

text: From the emacs manual > Unlike Shell mode, Term mode does not track the current directory by > examining your input. But some shells can tell Term what the current > directory is. This is done automatically by bash version 1.15 and later. It seems this is not done by zsh, at least not by default. Is there an option that I can enable or something?


title: ping timeout differences between OS X and Linux/other OSs

text: This function I wrote should exemplify the idiosyncrasy between OSX and Linux `ping` commands, in particular their `-W` timeout option:               # Checks if a host is up-and-running and responding to pings          function my_function_is_network_host_up() {            local -ri N_ARGUMENTS=1       if ! check_n_arguments "${FUNCNAME}" "${N_ARGUMENTS}" "${@}"; then return; fi            local -r NETWORK_HOST=$1            local -ri n_requests=1            local -i wait_for_reply=1 # Seconds       if [[ $my_global_os_type == 'OSX' ]]; then         ((wait_for_reply *= 1000)) # Milliseconds       fi            ping -c "$n_requests" \            -W "$wait_for_reply" \            -q \            "$NETWORK_HOST" \            &> /dev/null            return $?          }      Are real sysadmins (I am but a _beginner_ ) using a better Bash function to be able to check hosts independently from the machine they have just hopped onto? My typical usage:               hs=(...);     for h in "${hs[@]}"; do         if my_function_is_network_host_up $h; then             do_stuff         fi     done      or just:               my_function_is_network_host_up $h && do_stuff      * * * ### Background **OSX**               Time in milliseconds to wait for a reply for each packet sent.  If a reply arrives later, the packet is not printed as replied, but considered as replied when calculating statistics.      **Linux**               Time to wait for a response, in seconds. The option affects only timeout in absense of any responses, otherwise ping waits for two RTTs.


title: Problems in prompt with new users in debian 7 wheezy

text: I have debian 7 x64 wheezy machine on digital ocean. Every time I add a new user the user prompt is empty. I only have a dollar ( **$** ) and nothing like **shikhar@server:** on my prompt. I cannot access history as well, pressing up and down types **^[[A** and the tab key doesn't list anything as well. How do I fix this?


title: Specifying local install directory for ./configure for pango-1.32.6

text: I have built `cairo-1.7.6` for use in building `pango-1.32.6`, and I have installed it to a directory in my home directory: `/home/me/local/cairo-1.7.6`. Under this directory are the expected `include`, `lib` and `share` directories. However, I don't seem to be able to get the pango `./configure` to suck in the cairo dependency from that directory. I have tried setting the `CPPFLAGS` and `LDFLAGS` to the relevant directories, and I have looking in `./configure --help` but none of the options seem obviously related. Is there a general way to pass a locally installed library's paths to a `configure` script?


title: Building pango-1.32.6 for use in building gtk3 from git

text: I'm trying to build pango-1.32.6 to use when building gtk+3 from git, but I'm getting the following error:               checking for CAIRO... yes     checking which cairo font backends could be used... none     configure: Disabling cairo support     configure: error: *** Could not enable any backends.     *** Must have at least one backend to build Pango.      This sounds like an unmet cairo dependency to me. Does anyone know what version it is?


title: Can I move an existing Debian installation to a RAID5?

text: I put myself a small NAS together, to experiment a bit with raid. I have a working RAID 5 array using `mdadm` under Debian 6 ("squeeze"). I installed GRUB and Debian to an USB stick, since I was not aware one can actually boot from a raid, so this seemed like the best option. The stick has two partitions on it, an ext3 for `/` and swap. The raid uses GPT and only has one big ext4 partition on it. Unfortunately the USB stick is quite slow, at least slower than I expected. It would be awesome if I could get rid of it or only use it for booting purposes. Can I just copy my system folders (i.e. everything under `/`, except for the mount point of the raid) and reinstall GRUB somehow? I'd prefer to avoid rebuilding and -formatting the array, since there's already quite a bit of data on it. I found a related question, but the answers are quite mixed and I'm not sure whether I can go that route. My current plan is to just copy `/` to the array and reconfigure GRUB (using `dpkg-reconfigure grub-pc`) on the stick. Could that work? I'd update `fstab` too of course, but I'm not aware of any other needed changes.


title: acpi_listen returns different result in Ubuntu than Arch Linux

text: Ubuntu is able to detect my Lenovo "Mic Mute" button with `acpi_listen`, but when I try it on Arch Linux, there is no output available. Model: `Thinkpad X220 4290LY9` Tried to add `acpi_osi=Linux` in kernel cmdline, but mic mute still has no output from `acpi_listen`. After adding `acpi_osi` option, the led of my output mute button, no longer toggles, but it still functions.


title: Xorg: Screen 1 deleted because of no matching config section

text: Last week I received a new notebook in my work and everything is fine, except my dual-head setup(was flawless in the old model). My goal is to have **one screen in each monitor** , but instead I'm getting **one screen "stretched" between two monitors**. I'm using the _exact_ configuration of the old model, but the end result is totally different. Any ideas? Note that the Xorg log shows the following error:               [  3779.739] (EE) Screen 1 deleted because of no matching config section.      If I comment the _Screen_ line of both _Device_ sections, the error goes away, but nothing changes. **Relevant information on the links below:**   * Xorg log: http://pastebin.com/LQszqwke   * Xorg configuration: http://pastebin.com/rtgmBwz1   * LSPCI Output: http://pastebin.com/s32ZCRNh   * xrandr -q: http://pastebin.com/qp4y9iiN


title: How do I install mod_pagespeed using apt-get?

text: I remember seeing an article at one time on how to do this, but now I can't find it. I have seen other install directions. I want to make sure I can easily update it via apt.


title: Unable to delete directory

text: On my OS X host, I am having trouble deleting the directory "foo".               mymac:.Trashes joe$ ls     foo     mymac:.Trashes joe$ ls foo/     Ảnh011.jpg  Ảnh012.jpg  Ảnh013.jpg     mymac:.Trashes joe$ ls -l foo/     ls: Ảnh011.jpg: No such file or directory     ls: Ảnh012.jpg: No such file or directory     ls: Ảnh013.jpg: No such file or directory     mymac:.Trashes joe$ rm -rf foo/     rm: foo/: Directory not empty     mymac:.Trashes joe$ sudo rm -rf foo/     Password:     rm: foo/: Directory not empty      As you can see, there are some files under the directory "foo" which I can only run `ls` on; running `ls -l` returns an error. I cannot delete the individual files or the directory. Using "Empty Recycle Bin" did not work either. I have also tried 'Disk Utility' -> 'Verify Disk' and 'Repair Disk'. Edit: As requested, here are more info               mymac:.Trashes joe$ ls -del foo/     drwxrwxrwx  2 joe  staff  16384 13 May 11:19 foo/     mymac:.Trashes joe$ ls -del foo     drwxrwxrwx  2 joe  staff  16384 13 May 11:19 foo     mymac:.Trashes joe$ LC_ALL=C     mymac:.Trashes joe$ ls -ABeli foo/     total 1812     18972612676 -rwxrwxrwx  1 joe  staff  305951 13 May 11:19 Ảnh011.jpg     19123958587 -rwxrwxrwx  1 joe  staff  309745 13 May 11:19 Ảnh012.jpg     18511775654 -rwxrwxrwx  1 joe  staff  310907 13 May 11:19 Ảnh013.jpg     mymac:.Trashes joe$ find foo/     foo/     foo//Ảnh011.jpg     foo//Ảnh012.jpg     foo//Ảnh013.jpg


title: Preload movie on RAM

text: My current computer is unable to run FullHD movies smoothly and I was already resigned to the idea, because it seemed a graphics card issue, mine not being powerful enought to do the work (which is still very probable). But recently a friend of mine bought a SSD and put it in a similar specs laptop and he is now able to run FullHD movies. Now I have the doubt about it being a r/w speed problem and not a GPU problem. The question now, since I'm curious, I dont have a SSD and I have time to waste to run experiments. Is it possible to load the file on RAM and read it from there hoping the RAM reading speed will be similar to that of the SSD?


title: How do I install the cs_CZ.ISO8859-2 locale on Ubuntu 12.04

text: I need the cs_CZ.ISO8859-2 locale to exist on Ubuntu 12.04 so a specific unit test can pass. The test makes the following call:               std::locale("cs_CZ.ISO8859-2")      On my OS X Lion install, this locale does exist, so the call to std::locale should work:               $ locale -a | grep cs     cs_CZ     cs_CZ.ISO8859-2     cs_CZ.UTF-8     $      However, on my Ubuntu 12.04 install, there is only a UTF8 variant, and no ISO8859-2 version of the cs_CZ locale, despite having installed `language- pack-cs`:               $ dpkg -l | grep language-pack-cs     ii  language-pack-cs                       1:12.04+20120417                        translation updates for language Czech     ii  language-pack-cs-base                  1:12.04+20120417                        translations for language Czech     $ locale -a | grep cs_     cs_CZ.utf8     $      The unit test fails on this machine. Running the unit test under strace shows that it really is looking for the ISO8859-2 variant and not finding it anywhere:               open("/usr/lib/locale/cs_CZ.ISO8859-2/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)     open("/usr/lib/locale/cs_CZ.iso88592/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)     open("/usr/lib/locale/cs_CZ/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)     open("/usr/lib/locale/cs.ISO8859-2/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)     open("/usr/lib/locale/cs.iso88592/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)     open("/usr/lib/locale/cs/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)     open("/usr/share/locale-langpack/cs_CZ.ISO8859-2/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)     open("/usr/share/locale-langpack/cs_CZ.iso88592/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)     open("/usr/share/locale-langpack/cs_CZ/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)     open("/usr/share/locale-langpack/cs.ISO8859-2/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)     open("/usr/share/locale-langpack/cs.iso88592/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)     open("/usr/share/locale-langpack/cs/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)      I know absolutely nothing about locales, i18n, etc. However, I would like to get this test passing, and changing the test is not an option. If anyone can offer any insight into how to make this locale exist on Ubuntu 12.04 I would appreciate it greatly.


title: changing default shell to /bin/bash of at job scheduler like in CRON

text: I recently switched from `2>&1 >>` to `&>>` Is there a way to have **at** use /bin/bash as the shell? By default it uses /bin/sh and the man page gives no indication how anything else can be used. Even in a `crontab` one can use `SHELL=/bin/bash` The main problem this has been causing me is that in:               echo "do-smth.sh &>> logfile" | at now + 8 hours      instead of appending both stdout and stderr to my logfile, they have been getting lost altogether, not even getting emailed. This workaround didn't work, citing unexpected redirection:               echo "bash <<< \"do-smth.sh &>> logfile\"" | at now + 8 hours      I use Linux, Ubuntu 11.10 flavor, which shouldn't matter.


title: How do I add a local user to a box that uses LDAP authenticaiton?

text: I'm working with a box that uses LDAP for user authentication. However, I need to add a local user to run some services and I don't want non-person users junking up the LDAP directory. Does anyone know the command/options I would use to accomplish this?


title: What is the concept of Drives in Unix Systems?

text: In windows, we have C drives where all the softwares are installed and other partitions e.g; D, E etc to store our data. Now once we reinstall the windows for some reason, we install everything again on C and our data is kept safe and can access it without any problem. Now in Unix type OS, each user is given a home directory (I believe Windows also has something like that) and we can only put our data in that part of the system (this is what I think). Now how can someone can get the effect of windows, where at a certain part of hard drive, a user can put his/her data and when reinstalling the Unix/Linux system, reclaim that data?


title: Per Socket network Buffer queues utilization

text: Is there a way to get a per-socket send and receive Queues utilization on Solaris similar to the way that Linux' `netstat` displays it? Example on Linux:               Proto Recv-Q Send-Q Local Address               Foreign Address             State     tcp        0      0 0.0.0.0:19072               0.0.0.0:*                   LISTEN     tcp        0      0 0.0.0.0:19008               0.0.0.0:*                   LISTEN


title: Trying to set JAVA_HOME in ~/.bashrc

text: I have added this line at the end of ~/.bashrc               export JAVA_HOME=/usr/java/jdk1.5.0_07/bin/java      But when I execute `echo $JAVA_HOME`, I don't get anything as output, I expected "/usr/java/jdk1.5.0_07/bin/java". Any idea? OS: Ubuntu 11.10


title: Terminal Character Encoding Issue BitchX

text: I ran BitchX on three different Linux OS-es because I got this weird � (question mark) on two of them (Linux OpenSUSE 11.4 and BackTrack 5 R1) using yakuake/konsole (OpenSUSE) and terminator/tilda (BT 5 R1). However, on PuppyLinux Lucid 528 with RoxTerm the character is displayed as it should be (it is the Greek character "fi"). Now, on both SUSE and BT I have checked to see the value of $LC_CTYPE, and it's the same as in Puppy Linux (namely en_US, so no utf-8 encoding). I've experimented on both SUSE and BT with different character encodings (from terminal's settings), I've noticed the changes, but the text was still sometimes garbled, instead of the question mark I got some weird unintelligible "u"-s (in Puppy it is always displayed correctly). What could cause this annoying problem?   What could be different and how can I check the difference?


title: Is there a QT4 equivalent of gksu, not dependent on KDE libraries?

text: Is there a QT4 application with the same functionality as `sudo` to `gksu` that does not require an entire KDE desktop to be installed?


title: perl one liners + match word and delete string after separator

text: I work with linux/solaris machines and I need to add some rule in my ksh script: Please advise how to match the password word in file, and delete the value password after the separator "=" with perl liner command second it will delete only the first password! For example                 more file  ( before delete the password )            Password fkwf324ei23       Password=fkwf324ei23       Pass_word=fevme       Secret_Password=vrev873662j       Password=fkwf324ei23      .                  more file ( after delete the password )             Password fkwf324ei23        Password=        Pass_word=fevme        Secret_Password=vrev873662j        Password=fkwf324ei23


title: How to know whether the Linux driver for the real-time network device was built into the kernel?

text: From here: http://www.xenomai.org/index.php/RTnet:Installation_%26_Testing#Debugging_RTnet > The Linux driver for the real-time network device was built into the kernel > and blocks the hardware. When I execute `rmmod 8139too` it says the module does not exist in `/proc/modules`. Kernel is `2.6.38.8 (64 bit)`. What other information should I provide for the question? * * *               linux-y3pi:~ # uname -a     Linux linux-y3pi 2.6.38.8-12-desktop #2 SMP PREEMPT Fri Jun 1 17:27:16 IST 2012 x86_64 x86_64 x86_64 GNU/Linux          linux-y3pi:~ # ifconfig     eth0      Link encap:Ethernet  HWaddr 00:24:8C:D9:D6:2E                 inet addr:192.168.16.86  Bcast:192.168.16.255  Mask:255.255.255.0               inet6 addr: fe80::224:8cff:fed9:d62e/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:414 errors:0 dropped:0 overruns:0 frame:0               TX packets:261 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:118971 (116.1 Kb)  TX bytes:35156 (34.3 Kb)               Interrupt:17 Base address:0x4000           lo        Link encap:Local Loopback                 inet addr:127.0.0.1  Mask:255.0.0.0               inet6 addr: ::1/128 Scope:Host               UP LOOPBACK RUNNING  MTU:16436  Metric:1               RX packets:68 errors:0 dropped:0 overruns:0 frame:0               TX packets:68 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:4720 (4.6 Kb)  TX bytes:4720 (4.6 Kb)          linux-y3pi:~ # ethtool -i eth0     driver: r8169     version: 2.3LK-NAPI     firmware-version:      bus-info: 0000:01:00.0          linux-y3pi:~ # rmmod r8169          linux-y3pi:~ # ethtool eth0     Settings for eth0:     Cannot get device settings: No such device     Cannot get wake-on-lan settings: No such device     Cannot get message level: No such device     Cannot get link status: No such device     No data available          linux-y3pi:~ #  lsmod|grep 8169          linux-y3pi:~ #  lsmod|grep 8139          linux-y3pi:~ #                                                    **.config from /usr/src/linux-2.6.38.8**               CONFIG_R8169=m     CONFIG_R8169_VLAN=y               CONFIG_8139CP=m     CONFIG_8139TOO=m     #CONFIG_8139TOO_PIO is not set                                                                                #CONFIG_8139TOO_TUNE_TWISTER is not set                                                                                CONFIG_8139TOO_8129=y     #CONFIG_8139_OLD_RX_RESET is not set


title: Ubuntu LTS : best practice for installing gems

text: Ubuntu 12.04 LTS Server I'm relatively new to Unix/Ubuntu. I need to install the ruby gem `libopenssl- ruby`. I know that Ubuntu LTS versions maintain lists of authorized package versions. `apt-get update` will sync-up the local copy of these lists , and `apt-get upgrade` will upgrade all installed packages to the latest authorized versions. `apt-get install libopenssl-ruby` will install the `libopenssl-ruby` gem, but will this potentially pull-down a version of `libopenssl-ruby` ( and its dependencies ) that are not authorized for Ubuntu 12.04 LTS? What is best practice for installing a gem on an Ubuntu LTS release?


title: how to list all instances of an application?

text: How do I list all instances of an application. ie I am running 12 instances of application called "tcpA" I would like to list all of them. Below is top, I don't know if there is a way to look at a certain "command"? ![enter image description here](http://i.stack.imgur.com/N1tWb.jpg)


title: Use apt get install without inserting the DVD?

text: I installed Debian 7 using a DVD version, so every time I'm trying to install something using apt-get, the system ask me to mount the DVD. Is there a way to avoid that (inserting every time the dvd).


title: Mounting by block address

text: Is it possible to do a partial mount in Linux? Lets say that you have 1 partition or one device file that contains 50 blocks. You want to write one file system to blocks 0-24, and something else in 25-49. Is there away to mount based on the block locations?


title: Should I file bugs upstream, to my distribution maintainers, or both?

text: I've recently filed a bug with gnome-shell to the GNOME maintainers, on their website (upstream). However, I'm not sure whether I was maybe supposed to file it to the package maintainers of my distribution (Fedora). In the future, which should I prefer for similar programs? Or should I file the bug both upstream and to my distribution maintainers (which doesn't make a lot of sense honestly)?


title: atftpd listens on wrong UDP port

text: When I start an `atftpd` daemon with `/usr/sbin/atftpd --port 69 --bind- address 10.10.10.2 --daemon /srv/tftp/` command, the TFTP server listens on ephimeral port(58418) instead of port 69:               # atftpd --version     atftp-0.7 (server)     # /usr/sbin/atftpd --port 69 --bind-address 10.10.10.2 --daemon /srv/tftp/     # ss -a -u -p | grep -i tftpd     UNCONN     0      0              10.10.10.2:58418                    *:*        users:(("atftpd",30612,0))     # lsof -n | grep UDP | grep tftp     atftpd    30612     nobody    0u     IPv4   17845338       0t0        UDP 10.10.10.2:58418      #       Why is that so? Am I doing something wrong? Or is this a bug?


title: How to update ghostscript

text: First: what's the difference between `gs` and `ghostscript`?               thiago@vaio:~$ gs -v     GPL Ghostscript 9.06 (2012-08-08)     Copyright (C) 2012 Artifex Software, Inc.  All rights reserved.          thiago@vaio:~$ ghostscript -v     GPL Ghostscript 9.04 (2011-08-05)     Copyright (C) 2011 Artifex Software, Inc.  All rights reserved.      I've just compiled and installed `ghostscript-9.06.tar`. But I still have some errors when I try to open my `.dvi` files with `xdvi`, for example: `xdvik: read_from_gs: Connection reset by peer.` Well, I'd like to remove everything about old `gs/ghostscript` and install the newest version. Thanks for helping. **edit:** the result of these 2 commands:               thiago@vaio:/usr/bin$ gs     GPL Ghostscript 9.06 (2012-08-08)     Copyright (C) 2012 Artifex Software, Inc.  All rights reserved.     This software comes with NO WARRANTY: see the file PUBLIC for details.     GS>^C     thiago@vaio:/usr/bin$ ghostscript      GPL Ghostscript 9.04 (2011-08-05)     Copyright (C) 2011 Artifex Software, Inc.  All rights reserved.     This software comes with NO WARRANTY: see the file PUBLIC for details.     GS>^C     thiago@vaio:/usr/bin$       The second one opens a window also.


title: Automatically start named pipe reader on startup?

text: I'm trying to run a script with root access from PHP. I can't do that because Apache's user, `www-data`, don't have root access because of security reasons. To fix that, I was advised to use a named pipe. I first tried to add sudo permission to `www-data`, but was told that was definitely not good due to security risks (plus, I tried to add it but it didn't work). This is where my problem is. If I understand this correctly, I will need a script that automatically starts on system boot, and constantly waits in the background trying to read from a named pipe. The script, a.k.a. pipe reader, has to be run as root so it gets root access. Then, from PHP, I just send some data through the pipe to the pipe reader, which then is passed on to the main script I'm trying to execute from PHP. This way, since the reader is run as root, the main script will be run with root access. What I refer to as "main script" is a bash script that creates a user, and it needs root to work. It's the script I'm trying to run from PHP with root access. Is this the best approach to my issue? Have I understood it correctly? Update: I'm running Ubuntu 12.04.1.


title: What is ionice `none: prio 0` equivalent to?

text: The ionice manual states that: > Note that before kernel 2.6.26 a process that has not asked for an io > priority formally uses "none" as scheduling class, but the io scheduler will > treat such processes as if it were in the best effort class. The priority > within the best effort class will be dynamically derived from the cpu nice > level of the process: io_priority = (cpu_nice + 20) / 5. > > For kernels after 2.6.26 with CFQ io scheduler a process that has not asked > for an io priority inherits CPU scheduling class. The io priority is derived > from the cpu nice level of the process (same as before kernel 2.6.26). I am post 2.6.26, but that still leaves some open questions (I'm assuming CFQ):   1. What is the inheritance mapping for the scheduled class? Does TS SCHED_OTHER = Best Effort (io class 2)?   2. When using the ionice -p command to get the value, it returns `none: prio 0`. However, the formula mentioned in the ionice man would suggest that the same process (cpu nice of zero) would be `best-effort: prio 4` since (0 + 20) / 5 = 4. So my assumption at this point is that `none: prio 0` = `best-effort: prio 4`, but I'm hoping someone can cite some kernel source in order to prove that this is authoritatively true.


title: Debian Kde Iceweasel/Firefox: setting custom protocols handlers

text: I recently switched from Ubuntu 10.04 gnome to Debian wheezy Kde. Everythings work fine, except to the Iceweasel/firefox custom protocols! I added komodo.protocol in my `~/.kde/share/services` with:               [Protocol]     exec=python /path/to/my/script.py "%u"     protocol=komodo     input=none     output=none     helper=true     listing=     reading=false     writing=false     makedir=false     deleting=false      **This works for chrom(e|ium), but not for firefox.** I've read about firefox should use the gnome configs even under Kde, so i tryed:               gconftool-2 -s /desktop/gnome/url-handlers/komodo/enabled --type Boolean true     gconftool-2 -s /desktop/gnome/url-handlers/komodo/command 'python /path/to/my/script.py %s' --type String      that used to work when i was on ubuntu, but it doesnt on kde. Any idea? **EDIT** An example link: `komodo:/var/www/app/0/Modules/Controller/Node/Controller_Node.class.php:1202` And if I run the command `komodo /var/www/app/0/Modules/Controller/Node/Controller_Node.class.php:1202` from the terminal it works correctly; My python script simply check few things and then run this command - but with firefox/iceweasel it never get triggered.


title: Comment all lines in a text file?

text: In a text file I need to comment out all lines by adding a ";" as first character of each line. What is a good way to do this? I thought of Vim's visual block mode, but I couldn't find a "select all" option and marking several hundred lines manually also isn't great ;-) Any idea? I have nano, vi and vim at hand, I would prefer one of those for this task.


title: Unable to delete a file

text: An update has corrupted my system, I attempt a receipt and update of php5 error that you can not write `/usr/lib/php5/libexec`. When I try to read this file, which I find is this:               root@host:/usr/lib/php5 # ls-la      ls: can not access libexec: No such file or directory      Total 16      drwxr-xr-x 3 root root 4096 July 29 10:26.      drwxr-xr-x 59 root root 12288 July 29 11:11 ..      d????????? ? ? ? ? ? libexec       The libexec file apparently does not exist but if it exists, can not access it to delete or overwrite, the error is as follows:               root@host:/#rm libexec usr/lib/php5      rm: can not remove libexec: No such file or directory       Therefore when performing update php5 can not replace this file. It is the first time that happened to me, can anyone lend a hand?


title: My Laptop Fans drive me crazy on linux and much less battery

text: I have a Vaio VPCEA36FG laptop and both windows.8 and elementary OS (ubuntu 12.04 kernel) installed on it. when I am in windows everything is just fine, fans work perfectly efficient and my battery lasts at least two and a half hours. but in linux I have very loud fans working at high speed and very low battery life (something between 45 mins and 1 hour) which I believe most of it are wasted by unwarranted fan speed. I tried jupiter, flgrx drivers and a bunch of other packages that I can not even recall names of them. but nothing works and I still have loud fans and It drives me crazy. any suggestion?


title: How to make grub work again after drive reassignment?

text: My config: opensuse 11.4, boot partition at pendrive and hard drives with partitions sda1, sda2, sdb1. Today I changed chassis for my computer, and by mistake I attached second drive to SATA 3 instead of SATA 2. So second drive was not mounted correctly. I turned off computer, attached it correctly and then my problem started. Now, I cannot boot system at all. Previously I set booting from removable drive in BIOS (pendrive), but now it seems computer (BIOS) does not recognize pendrive as removable drive, but regular HDD. So it won't boot for "removable drive". When I change boot order, and select to boot from hard drive (and I set first hard drive as pendrive) or if I directly set from boot menu to boot from pendrive I get error in GRUB which goes into rescue mode. My guess is, since because of some reason, pendrive is no longer recognized as removable media, but hard disk, hard drives are mapped differently and I should fix the mappings. I can boot CD installer and mount pendrive to see the content of grub config, but when I am in grub rescue mode and I execute "ls" I get > (hd0) (hd0,msddos1) (hd1) (hd1,msddos2) (hd1,msdos1) (hd2) (hd2,msddos1) But I don't see the mapping, so I don't know what hd0 really means. I can only suspect hd1 here is sda, because it has 2 partitions (if suffix msdsos is indication of partitions). **How can I make grub work again?**


title: Can I do everything on Linux without keyboard?

text: Suppose that I have a desktop computer such that everything works except keyboard . Is it possible to install and run Linux to this computer? I guess the answer is no as super user password requires keyboard but I'm not completely sure about this fact.


title: Unable to mount NTFS partition from user account

text: I'm trying to mount a Windows **ntfs** partition on openSuse 11.4. When I mount it using the root account (either directly or via _sudo_ ) it mounts without problems. But when I try mounting it without any root privileges, it gives me the following error:               Error opening '/dev/sda2': Permission denied     Failed to mount '/dev/sda2': Permission denied     Please check '/dev/sda2' and the ntfs-3g binary permissions,     and the mounting user ID. More explanation is provided at     http://ntfs-3g.org/support.html#unprivileged      My fstab entry for the concerned device is:               /dev/sda2   /media/Windows      ntfs       defaults,noauto,user  1 2      I've searched Google for possible solutions, but I don't seem to be getting anywhere. **Edit 1:** As suggested, I tried to set the UID/GID bits on the ntfs-3g binary. All the files (/sbin/mount.ntfs, /sbin/mount.ntfs-3g) point to /usr/bin/ntfs-3g, so I changed the permissions on that. The permissions now are:               -rwsr-sr-x 1 root root 51512 Feb 18 22:18 ntfs-3g      But the result is still the same and I get the same _permission denied_ error. **Edit 2:** After setting the correct permissions on all the files:               -rwsr-xr-x 1 root root 51512 Feb 18 22:18 ntfs-3g     brw-rw-rw- 1 root disk 8, 2 Aug  6 21:53 sda2     drwxrwxrwx 1 asad users 8192 Jul 30 13:09 Windows      I was able to mount with out a privileged user account. However, now when I try to unmount using the same account, I get:               asad@jb-laptop:~> umount /dev/sda2     umount: only root can unmount /dev/sda2 from /media/Windows      **Edit 3:** I finally found the problem. I needed to add _users_ instead of _user_ in fstab for some reason, although I can't understand why. Now I have a new problem :) Whenever I unmount the device _/dev/sda2_ , somehow the file permission ends up going back to default (0660). I tried to create a rule in udev but it doesn't seem to be working.


title: VirtualBox under Archlinux can't connect to Internet after "pacman -Syu"

text: I have a windows 7 VM in virtualbox and I'm used to connect the Internet though **NAT**. But after the last system upgrade, the Internet can't be reached in the VM. I check the log at `/var/log/pacman.log` and find this:               [2013-04-16 16:03] [ALPM-SCRIPTLET] In order to use the new version, reload all virtualbox modules manually.     [2013-04-16 16:03] [PACMAN] upgraded virtualbox-host-modules (4.2.10-4 -> 4.2.12-1)     [2013-04-16 16:03] [PACMAN] upgraded virtualbox (4.2.10-2 -> 4.2.12-1)     [2013-04-16 16:04] [PACMAN] upgraded virtualbox-guest-iso (4.2.10-1 -> 4.2.12-1)      I don't know its exact meaning but after browsing some wiki I tried to edit `/etc/modules-load.d/virtualbox-modules.conf`:               vboxdrv     vboxsf     vboxvideo     vboxguest      I also tried `modprobe vboxdrv` in CLI. All turned out to be of no use.


title: concatenating multiple files with multiple headers

text: Im trying to concatenate multiple files with multiple headers to have one file with all the information in it for example. ### File 1:               Numbers     1     2     3          Letters     A     B     C      ### File 2:               Numbers     4     5     6          Letters     D     E     F      ### Will be merged to create File 3:               Numbers     1     2     3     4     5     6          Letters     A     B     C     D     E     F      So far I've tried cat and had file2 added to the end then attempted to grep all data under each header but long story short it failed. I've tried paste and if the amount of data in each file is the same then its not too bad as it has each files info tabbed next to the last but will create chaos if any file has more entries than another under a header. Any one got any ideas how to solve this sort of issue?


title: Desktop overlay program showing CPU, HDD, etc. stats

text: In different screenshots of people's Linux desktops, I've seen different apps that overlay the desktop with information about their computer. Often this gadget/app shows CPU and HDD information. Sometimes it has network and temperature information as well. I've seen these a lot but they often have different looks and different information. What program does this? Is it built-in to any Linux distribution?


title: How can I highlight matches using GNU grep?

text: I have seen on some Linux, that `grep` is configured to highlight the match, and print the matching file. How can I configure `grep` to highlight matches?


title: Capture colors with tmux buffer copy (hardcopy)

text: I am using the following line in `tmux` for getting a "hardcopy" feature like in GNU Screen:               bind H capture-pane \; save-buffer -b 0 ~/tmux.hardcopy \; delete-buffer -b 0      However, the ANSI colors are not captured to the file. How do I make `tmux` save the ANSI escape sequences so that the hardcopy will be colored too?


title: Can't seem to add `tint2` to the startup process in Arch Linux with Openbox

text: I've already tried adding it as an entry in the `~/.xinitrc` and even in the `~/.config/openbox/autostart` file. I tried adding it as the following variants:               tint2     tint2 &     tint2 -c ~/dotfiles/linux/tint2rc     tint2 -c ~/dotfiles/linux/tint2rc &      None of them work in both files. Of course none of these at the same time, or in both files at the same time. With the first two I get errors regarding not finding the configuration file, so I just tell it where it is, even though there's a perfectly working symlink where it should be. :) Am I doing something wrong? Am I missing something? Or is it just not working as it should? Just thought I would note. After Openbox starts up, I can open any terminal and run `tint2 -c ~/dotfiles/linux/tint2rc` and it'll run just fine, immediately. However if I close that Terminal the process is terminated... Any help is greatly appreciated. :)


title: Unix. pecl memprof

text: Im trying to install https://github.com/arnaud-lb/php-memory-profiler on FreeBSD 9.2 After pear install http://pecl.php.net/get/memprof-1.0.0.tgz got such error:                   In file included from /usr/local/include/php/Zend/zend_compile.h:690,                      from /usr/local/include/php/Zend/zend_modules.h:26,                      from /usr/local/include/php/Zend/zend_API.h:26,                      from /usr/local/include/php/main/php.h:38,                      from /tmp/pear/memprof/memprof.c:19:     /usr/local/include/php/Zend/zend_vm_opcodes.h:168:7: warning: no newline at end of file     /tmp/pear/memprof/memprof.c:37:3: error: #error "ZTS build not supported (yet)"     /tmp/pear/memprof/memprof.c:114:3: warning: #warning No support for malloc hooks, this build will not track persistent allocations     /tmp/pear/memprof/memprof.c: In function 'memprof_zend_execute_internal':     /tmp/pear/memprof/memprof.c:695: error: too few arguments to function 'execute_internal'     /tmp/pear/memprof/memprof.c:697: error: too few arguments to function 'old_zend_execute_internal'     /tmp/pear/memprof/memprof.c: In function 'OnChangeMemoryLimit':     /tmp/pear/memprof/memprof.c:724: error: too few arguments to function 'zend_mm_set_heap'     /tmp/pear/memprof/memprof.c:726: error: too few arguments to function 'zend_mm_set_heap'     /tmp/pear/memprof/memprof.c: In function 'memprof_enable':     /tmp/pear/memprof/memprof.c:744: error: too few arguments to function 'is_zend_mm'     /tmp/pear/memprof/memprof.c:751: error: too few arguments to function 'zend_mm_set_heap'     /tmp/pear/memprof/memprof.c: In function 'memprof_disable':     /tmp/pear/memprof/memprof.c:773: error: too few arguments to function 'zend_mm_set_heap'     /tmp/pear/memprof/memprof.c: In function 'zm_startup_memprof':     /tmp/pear/memprof/memprof.c:899: error: too few arguments to function 'zend_register_functions'     /tmp/pear/memprof/memprof.c: In function 'zif_memprof_memory_get_usage':     /tmp/pear/memprof/memprof.c:1297: error: too few arguments to function 'zend_mm_set_heap'     /tmp/pear/memprof/memprof.c:1298: error: too few arguments to function 'zend_memory_usage'     /tmp/pear/memprof/memprof.c:1299: error: too few arguments to function 'zend_mm_set_heap'     /tmp/pear/memprof/memprof.c:1301: error: too few arguments to function 'zend_memory_usage'     /tmp/pear/memprof/memprof.c: In function 'zif_memprof_memory_get_peak_usage':     /tmp/pear/memprof/memprof.c:1317: error: too few arguments to function 'zend_mm_set_heap'     /tmp/pear/memprof/memprof.c:1318: error: too few arguments to function 'zend_memory_peak_usage'     /tmp/pear/memprof/memprof.c:1319: error: too few arguments to function 'zend_mm_set_heap'     /tmp/pear/memprof/memprof.c:1321: error: too few arguments to function 'zend_memory_peak_usage'     *** [memprof.lo] Error code 1          Stop in /tmp/pear/pear-build-ranielrLVRCS/memprof-1.0.0.     ERROR: `make' failed      Other pecl, and php modules and extensions is ok. On Debian wheezy install ok too. Some problem with FreeBSD or?


title: How to get environmental variables of a very short process?

text: I have a very short process for which i want to check the environmental variables for debugging purposes. The process is instant from a human perspective. The example illustrates it better. **Example**               user:~$ ps aux | grep grep     user   2349  0.0  0.0   4384   840 pts/1    S+   14:47   0:00 grep --color=auto grep      The pid of the process was 2349. If I check the environmental variables (or other info):               #Pretty print of environmental variables#     user:~$ xargs --null --max-args=1 echo < /proc/2349/environ     bash: /proc/2349/environ: No such file or directory      The info has vanished with the process. What to do before running the process to be able to list the variables once the precess is finished?


title: How to know driver names?

text: Is there any general way to know the name of the driver of all the devices on a linux machine? For example, I want to know the name of my network interface driver and the name of my webcam driver. How can I do it?


title: How to get the id of a very short child process if the parent is known?

text: I'm looking for a way to get the PID of a short child process in Linux. The process is instant from a human perspective. I know the parent process which will spawn the child process. Is there a way to log information about all the processes that are created by a specific parent process? I'm not looking for a way to retroactively figure out the PID of the child but a way to log it once it happens.


title: disabling journal vs data=writeback in ext4 file system

text: What is the difference between disabling journal on ext4 file system using:               tune2fs -O ^has_journal /dev/sda1      and using `data=writeback` when mounting? I thought `ext4 - journal = ext2`. means when we remove journal from a ext4 file system, it is automatically converted to ext2(thus we can not benefit from other ext4 features)


title: Where do the .deb files go when I select "download only" in Synaptic Package Manager?

text: Here is the situation. In Synaptic Package Manager, suppose I want to download package files of package_name. I follow following steps: Select package_name> Mark for installation > Accept additional needed package installation dialogue (if any) > Apply. Then a prompt shows me which package will be installed, upgraded and removed. There is also a checkbox "Download Only". I tick it and click OK. Then it finishes downloading packages after a few minutes. My question is, where do the downloaded package goes?


title: Problem with keyboard and mouse in gdm3 and lightdm

text: Linux anarki 3.2.0-2-amd64 #1 SMP Fri Jun 1 17:49:08 UTC 2012 x86_64 GNU/Linux          Distributor ID: LinuxMint     Description:    Linux Mint Debian Edition     Release:        1     Codename:       debian      When my laptop boots I need to enter a harddrive password. I also have to manually skip the memory test during POST with the escape key so I know my keyboard works. After booting into Linux I get to GDM3 or LightDM (tried both) login screen but my keyboard and mouse won't work. This includes a mouse and keyboard that have been connected via USB. When I unplug the USB keyboard and mouse and plug them in again, they work, but not the internal keyboard and trackpad, because I can't unplug/plug those. The numlock and capslock keys don't even light up when I press them. CTRL-ALT-F1 does not work. I have found problem descriptions on the internet from 2011, with solutions like renaming /var/run/udev or /run/udev. There also was a proposed solution of removing the keyboard and mouse settings from xorg.conf because that is handled by evdev now, but all of these solutions didn't work. The problem does not occur when I start in recovery mode. The keyboard works fine in the terminal, but as soon as I start X by doing startx or starting gdm3 or lightdm the keyboard and mouse cease to work. In the scenario of going through the recovery boot option the screen also stays blank when I start X. I will be browsing through stackexchange looking for other possible solutions to try out.