title: Use dd to backup disk image within an OpenVZ container

text: I want to use `dd` to backup the disk of an OpenVZ VPS in addition to traditional cold tar backups. Because I may need to migrate to a different VPS provider. From end user point of view, OpenVZ containers are **folders** on the host (similar to LXC). If I am not wrong, OpenVZ uses common file system so containers (virtual environments) are just directories (isolated by chroot). Within the container, `/` uses a block device called `/dev/simfs`, I wonder if I can use dd to backup the whole disk image over SSH. Technically I don't see any problem, but I haven't done it myself, just not 100% sure and confident. I have done the same thing for Xen and VMware VMs, it worked fine. For Xen `ssh root@vps "dd if=/dev/xvda " | dd of=~/backup/xen.img` Does it work for OpenVZ, anyone has tried this before? `ssh root@vps "dd if=/dev/simfs" | dd of=~/backup/openvz.img`


title: file descriptor problem with looping bash script

text: I've inherited a script that does this in a function:               # IO redirection for logging.     #touch $LOGFILE     exec 6>&1           # Link file descriptor #6 with stdout.                     # Saves stdout.     exec > $LOGFILE     # stdout replaced with file $LOGFILE.          touch $LOGERR     exec 7>&2           # Link file descriptor #7 with stderr.                     # Saves stderr.     exec 2> $LOGERR     # stderr replaced with file $LOGERR.      Later on in the function it does this:               #Clean up IO redirection     exec 1>&6 6>&-      # Restore stdout and close file descriptor #6.     exec 1>&7 7>&-      # Restore stdout and close file descriptor #7.      The problem is if I call this function twice (i.e. in a loop) the second iteration stops at the first set of code above without showing an error. Why would it be doing that?


title: Terminal Root Command Warning

text: Is it possible to write a script (or change some file) in order to warn the user that they are using a command that is normally reserved for root? And if so, how? I'm currently the administrator of my machine, but I'd still like a warning that reminds me I'm using a root command.


title: How to replace m part of Lines with n part of Lines?

text: I have a file "test" like this:               RewiteEngine On     RewriteCond   %{REMOTE_ADDR}   !^192\.168\.1\.7$  [NC]     RewriteCond   %{REMOTE_ADDR}   !^192\.168\.1\.8$  [NC]     RewriteCond   %{REMOTE_ADDR}   !^192\.168\.1\.9$  [NC]     RewriteCond   %{REMOTE_ADDR}   ^192\.168\.1\.5$  [NC]     </Directory>      I want to replace `\.1\.7`,`\.1\.8` and `\.1\.9` by `\.1\.10` so it will be:               RewiteEngine On     RewriteCond   %{REMOTE_ADDR}   !^192\.168\.1\.10$  [NC]     RewriteCond   %{REMOTE_ADDR}   ^192\.168\.1\.5$  [NC]     </Directory>      it might be replacement of m "IPS" by n "IPS", How can I reach this?


title: how to java set the PATH of my Debian 7.3 system ?to link the java version I want

text: If I insert into the terminal:               aryan@localhost:~$ java -version     java version "1.6.0_27"     OpenJDK Runtime Environment (IcedTea6 1.12.5) (6b27-1.12.5-1)     OpenJDK Server VM (build 20.0-b12, mixed mode)


title: How can I extract/parse a complete URL from a semi random string?

text: I'd like to have bash parse/extract a full URL (and only the url) from a random short string. Examples:               bob, the address is http://www.google.com      or               https://foo.com/category/example.html is up      or               Error 123 occurred at http://bit.ly/~1223456677878      or               Stats are up: https://foo1234.net/report.jpg      I tried using `cat foo_output | egrep -o "https?://[\w'-\.]*\s"` but that didn't seem to work.


title: Whats wrong with this code?

text: #!bin/bash          if [ ! -e $1 ];     then             echo "error... no such file"             exit     else             END=$(wc -l $1 | cut -d" " -f1)             for (( i=1;i<=END;i++));             do             echo -e " $i \n"             echo "$(head -$i $1 |tail -1)"             temp=$(head -$i $1 |tail -1|)             echo "this is temp $temp"                   done          fi      The line that fails is me assigning a value to `temp`. I get a `syntax error near unexpected token `)'` error but I don't understand why


title: UEFI - Linux Mint Boot from USB Doesn't work

text: I'm running Linux Mint (only OS other than in VirtualBox) and wanting to remove it. I've created a Live USB of Windows 8 using Windows 7 USB/DVD Download Tool - Yes, I know it says Windows 7 but I've been doing research and I am hearing from everywhere that it also works for Windows 8.   * The ISO was loaded on just fine (AFAIK)   * Computer came with Windows 8 pre-installed   * I have Safe boot and Fast boot disabled in the BIOS Settings   * I have USB as my first boot option   * I have tried both the USB 2.0 and 3.0 ports Yet, Mint is all that will boot up. Anybody have a similar issue???? If it helps, the computer is a Toshiba Satellite S855D Laptop with an AMD APU quad-core processor (3 CPU, 1 GPU)


title: Match slash in bbe

text: How can I match a forward slash in `bbe`? If I have this text file called `test.txt`:               foo / bar      I can match it in `sed` like so:               sed -e 's/foo \/ bar/it worked!/' test.txt      However when doing the same thing in `bbe` it doesn't replace it:               bbe -e 's/foo \/ bar/it worked!/' test.txt      I have also tried double escaping and triple escaping the slash, however it doesn't seem to work anyway. What am I doing wrong?


title: RPM build errors

text: I am trying to build an RPM but when I use this command to build it: `[root@vmdb SPEC]# rpmbuild -v -bb SPEC/supportScripts.spec` I always get this error:               Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.gG9C7Y     + umask 022     + cd /root/rpmbuild/BUILD     + cd /root/rpmbuild/BUILD     + rm -rf supportScripts-1     + /usr/bin/gzip -dc /root/rpmbuild/SOURCES/supportScripts-1.tar.gz     + /bin/tar -xf -     + STATUS=0     + '[' 0 -ne 0 ']'     + cd supportScripts-1     /var/tmp/rpm-tmp.gG9C7Y: line 34: cd: supportScripts-1: No such file or directory     error: Bad exit status from /var/tmp/rpm-tmp.gG9C7Y (%prep)               RPM build errors:         Bad exit status from /var/tmp/rpm-tmp.gG9C7Y (%prep)      I have looked on the internet as to why this error might occur and it is due to a bad argument with the macro I am using in %prep/%setup. I am not sure what I need in replacement to fix it and it is getting frustrating. This is what my spec file looks like:               Name:           supportScripts     Version:        1     Release:        1     Summary:        All the support scripts bundled into an RPM.     BuildArch:      noarch          Group:          Development/Tools     License:        GPL     URL:            http://localhost     Source0:        supportScripts-1.tar.gz     BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)          %description     These are all the support tools we need for new Hardware Agent builds. This will package all the scripts support uses for new builds.          %prep     %setup -q          %install     mkdir -p "$RPM_BUILD_ROOT/opt"     cp -R * "$RPM_BUILD_ROOT/opt"          %files     /opt/          %clean     rm -rf $RPM_BUILD_ROOT          %post     chown -R support:support /opt/*     chmod -R 775 /opt/      UPDATE: What is weird is that I have found the rpm completely built in `/root/rpmbuild/RPMS/noarch`. I have ran command: `rpm -ivh supportScripts-1-1.noarch.rpm` to unpack all the scripts, and miraculously its there! My next question is: Should I be concerned of any mishaps with the rpmbuild command I have done?


title: Is there a way to communicate with someone at their desktop?

text: My wife is sitting at her home desktop, `alpha`, which is running a recent version of Ubuntu. I am on a bus, using ConnectBot on my G1 phone, and can SSH into `alpha` from wherever I am. For complicated reasons, I cannot use IM, email, or the telephone in order to contact her. (E.g. I don't want to wake the baby, my IM client is broken, my email server is down.) My only option is to ssh into `alpha` remotely and try to somehow make something appear on the screen. She's using KDE; how can I make something pop up to get her attention and let her know I'm trying to communicate with her? I thought it was possible to remotely trigger something (like xmessage) to appear on her screen even though my SSH session doesn't have an X display. EDIT: To clarify, my phone is not running any flavor of X, so X-over-ssh is not possible. Would the following work?               $ export DISPLAY=:0     $ xmessage "test"


title: How can I set the time in Centos so that resetting the OS doesn't revert to its default value?

text: I have a VPS running on Cent Os 5.8 (x86). There are situations in which we are forced to reset the entire VPS (it hangs and the only way to get it back on is to reset it). When we do so, the time is reset too. We use the following command to set the time (the timezone is configured through kloxo admin panel and is not reset like the time does):               #date +%T%p -s "10:10:10" (as for hour 10 and minutes 10 and seconds 10 )


title: find: Why is the -a operator not commutative in combination with -print?

text: Supposing we're using find in current directory with audio files (e. g. MP3) and (important!) also non-mp3 files (e. g. JPEG) present in current directory or somewhere below it.   Additionally to that, we have a directory in there with some other audio files (called **exclude_me** in the example), which should live up to its name by being excluded from the file search:               find . \( -type d -name 'exclude_me' -prune \) -o \( -type f -a -iname '*.mp3' -a -print \)      _(Though not absolutely necessary in this case, I've deliberately set some redundant parentheses, as well as additional`-a` operators for the sake of clarity.)_ Because of the explicit `-print` option (cf. also http://mywiki.wooledge.org/UsingFind), this will indeed omit anything from "exclude_me" directory, and only list the *.mp3 files recursively from current directory. Sometimes (not always) the `alias` command may already be sufficient for a `find` one-liner, but this command will require the argument at the **end** of the line.   Taking notice that the '*.mp3' argument to -iname is _before_ the `-print` in this case, there appears to be no way to solve the problem with an `alias`. But why not pretend as if in mathematics by simply swapping the two options?   Like this:               find . \( -type d -name 'exclude_me' -prune \) -o \( -type f -a -print -a -iname '*.mp3' \)      Remember I set a precondition to have at least one non-mp3 file (e. g. image) in the . directory or its subdirectories. It has been set to give a clearer proof that this does _not_ work as expected under the hood. Without them, things will merely _look_ as working fine. _Having_ them present instead will cause the non-mp3 files to get listed as well despite the distinct `-iname '*.mp3'` specification in the one-liner. So why doesn't the `-a` operator work like in mathematics, where "A + B" is the same as "B + A"? Or, in `find` terms:               \( -type f -a -print -a -iname '*.mp3' \)      ought to be the same as               \( -type f -a -iname '*.mp3' -a -print \)      or not? Is there no way to get the desired result _and_ have the `-iname` argument at the end of the line, not anywhere in between? (except for ugly hackish solutions like `grep -v exclude_me` or the like)


title: How to move taskbar to different monitor on Linux Mint?

text: I am using dual monitors on Linux Mint and I can't figure out how to get the bottom taskbar to appear on my left side monitor. Right now it only appears on the right monitor. How can I move it to the left monitor or extend it so it goes across both monitors?


title: Command substitution grepping ls output causes error

text: I'm trying to make a tar.tgz file using command substitution There are backups of 17 Aug 2012               -rw-r----- 1 ossec  502 804M Aug 17  2012 BKPMDISINT_i6nir20j.F_bkp     -rw-r----- 1 ossec  502 2.7G Aug 17  2012 BKPSYFINT_i5nir20j.F_bkp     -rw-r----- 1 ossec  502 3.9G Aug 17  2012 BKPMSFFINT_i4nir20j.F_bkp     -rw-r----- 1 ossec  502  28M Aug 17  2012 c-651746692-20120817-00     -rw-r----- 1 ossec  502 2.0G Aug 17  2012 ALG_KLPFINT_ianir576.alg     -rw-r----- 1 ossec  502 1.5G Aug 17  2012 ALG_KLPFINT_i8nir576.alg     -rw-r----- 1 ossec  502  37M Aug 17  2012 ALG_KLPINT_ibnir64h.alg     -rw-r----- 1 ossec  502 2.2G Aug 17  2012 ALG_KLPFINT_i9nir576.alg     -rw-r----- 1 ossec  502  28M Aug 17  2012 c-651746692-20120817-01     -rw-r----- 1 ossec  502  27M Aug 17  2012 ctrl_170803      So i need to tar them. I used this command > tar -zcvf DB-Backup-17082012.tgz $(ls -lrth|grep "Aug 17") But it gave me this error               tar: You may not specify more than one `-Acdtrux' option     Try `tar --help' or `tar --usage' for more information.


title: expanding boot, moving LUKS root

text: GPT > Partition2 > LUKS > btrfs      I need some additional space for my boot volume, so far I did:   * Shrink my btrfs volume by 250MB. `btrfs resize -250M /`   * Shrink the LUKS root volume `cryptsetup resize --size sector_calc luks_mapper_desc_root` **How to actually move the whole LUKS container back by 250MB?** (without using a secondary disk, so I guess this excludes `dd`)   * Future steps: Delete GPT Partition 1 and 2 and create the first bigger and the second one with a higher start sector and less spanning sectors.


title: Unable to start locally-built ntpd from system service script

text: I built ntpd from source, which process put it in /usr/local/sbin. Of course, the ntp service points to /usr/sbin. So, I thought I could just change the path in the init.d configuration file like this:               ### BEGIN INIT INFO     # Provides:        ntp     # Required-Start:  $network $remote_fs $syslog     # Required-Stop:   $network $remote_fs $syslog     # Default-Start:   2 3 4 5     # Default-Stop:     # Short-Description: Start NTP daemon     ### END INIT INFO          PATH=/sbin:/bin:/usr/sbin:/usr/bin          . /lib/lsb/init-functions          DAEMON=/usr/local/sbin/ntpd     PIDFILE=/var/run/ntpd.pid     ...[etc]      I changed the line starting with "DAEMON" to point to the location of the new binary. However, when I try to restart the service I get the error:               [ ok ] Stopping NTP server: ntpd.     [....] Starting NTP server: ntpd/usr/local/sbin/ntpd: The 'user' option has been disabled. -- built without --enable-clockctl or --enable-linuxcaps or --enable-solarisprivs     ntpd - NTP daemon program - Ver. 4.2.7p475     Usage:  ntpd [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \                     [ <server1> ... <serverN> ]     Try 'ntpd --help' for more information.      failed!      How can I have the service run from /usr/local/sbin instead of /usr/sbin? **Solution (based on accepted answer):** Apparently when building on Linux you need to use the switch `--enable- linuxcaps` when building on Linux. Here are the steps necessary on Debian Wheezy:               cd ~/install/ntp-dev-4.2.7p475     # or wherever you have the source unpacked     make clean                         # clean out the previous build     sudo apt-get install libcap-dev    # this library is required by linuxcaps     ./configure --enable-linuxcaps     # this is the critical switch     make     sudo make install     sudo /etc/init.d/ntp restart       # restart ntp     ntpq -c "rv 0 version"             # make sure you are running the right version      The only line you have change in /etc/init.d/ntp is the DAEMON line, as said above.


title: Merge three file in to a single master file by excluding the header in 2nd and 3rd files

text: I have three file with n number of lines as given below sample1.txt               ------------------------------     Date        Time    Name         ------------------------------     2013/10/12  12:09:09    Krish     2013/10/12  13:12:01    Ramb     2013/10/12  15:28:39    Likha     2013/10/12  15:56:12    Mat     .     .     .      Sample2.txt               ------------------------------     Date        Time    Name         ------------------------------     2013/10/12  11:19:21    Jack     2013/10/12  12:11:09    Rob     2013/10/12  15:45:12    Rick     2013/10/12  22:11:10    Phil     .     .     .      Sample3.txt               ------------------------------     Date        Time    Name         ------------------------------     2013/10/12  12:09:09    Eric     2013/10/12  13:12:01    Bob     2013/10/12  15:28:39    Mike     2013/10/12  15:56:12    Nick     .     .     .      I need to merge these three files in a single file(Master.txt) by excluding the headers (First 3 lines) in Sample2.txt and Sample3.txt as given below Desired Output               $cat Master.txt          ------------------------------     Date        Time    Name         ------------------------------     2013/10/12  12:09:09    Krish     2013/10/12  13:12:01    Ramb     2013/10/12  15:28:39    Likha     2013/10/12  15:56:12    Mat     2013/10/12  11:19:21    Jack     2013/10/12  12:11:09    Rob     2013/10/12  15:45:12    Rick     2013/10/12  22:11:10    Phil     2013/10/12  12:09:09    Eric     2013/10/12  13:12:01    Bob     2013/10/12  15:28:39    Mike     2013/10/12  15:56:12    Nick      Note : In AIX machine with Ksh 88


title: What is the rationale behind using non-numeric package component for the version?

text: In ubuntu (and not only in ubuntu) default repository you could see a package version like `2.2.14-5ubuntu8.12`. Why do the maintainers give such a weird version in the _central package repository_? What tasks the `2.2.14-42` version wouldn't solve?


title: mplayer2 playing pictures from mp3

text: Recently i've switched from mplayer to mplayer2 and there's one pestering thing: when i play an .mp3 file, and there is a picture embedded (here's an excerpt from exiftool output)               Picture Mime Type               : image/jpeg     Picture Type                    : Front Cover     Picture Description             :      Picture                         : (Binary data 26267 bytes, use -b option to extract)      mplayer2 tries to play this picture:               Detected file format: MP2/3 (MPEG audio layer 2/3) (libavformat)     [mp3 @ 0x7f95709a9000]max_analyze_duration 5000000 reached at 5015510     [lavf] stream 0: audio (mp3), -aid 0     [lavf] stream 1: video (mjpeg), -vid 0,      Clip info:      album_artist: Divna Ljubojevic      genre: Contemporary Christian      album: Мелoди      artist: Дивна Љубоjевић и Мелоди      title: Аксион естин      track: 01      date: 2002     Load subtitles in /home/pooh/music/!CHRISTIAN/Дивна Љубоjевић и Мелоди/2002 - Мелoди/     [VO_XV] Could not grab port 63.     [VO_XV] Could not grab port 64.     [ass] auto-open     Selected video codec: MJPEG (Motion JPEG) [libavcodec]     Selected audio codec: MPEG 1.0/2.0/2.5 layers I, II, III [mpg123]     AUDIO: 44100 Hz, 2 ch, s16le, 80.0 kbit/5.67% (ratio: 10000->176400)     AO: [alsa] 48000Hz 2ch s16le (2 bytes per sample)     Starting playback...     VIDEO:  337x337  90000.000 fps    0.0 kbps ( 0.0 kB/s)     VO: [xv] 337x337 => 337x337 Planar YV12  [fs]     [ASPECT] Warning: No suitable new res found!     Colorspace details not fully supported by selected vo.     No pts value from demuxer to use for frame!     Video pts after filters MISSING      How to fight this nuisance? Upd. The problem is not how to mask this behaviour, but rather how to make the right thing. Why in the first place it has an idea of playing embedded album picture? mplayer didn't have this… feature.


title: Cannot Connect to Internet but can SSH into Solaris x86 (vs. 11)

text: I am able to connect remotely to the machine using SSH, but I cannot ping `www.google.com` through the machine. I did the following to make sure SSH was enabled (well I know it is, as I am using PuTTy):               # svcs ssh     STATE          STIME    FMRI     online          9:56:08 svc:/network/ssh:default      The machine name is:               # uname -a     SunOS solaris 5.11 11.1 i86pc i386 i86pc      And the precise version is:               # cat /etc/release     Oracle Solaris 11.1 X86     Copyright (c) 1983, 2012, Oracle and/or its affiliates.  All rights reserved.     Assembled 19 September 2012      I am trying to install gcc, but it cannot contact valid package repository:               # pkg install gcc-45     pkg: 0/1 catalogs successfully updated:          Unable to contact valid package repository     Encountered the following error(s):     Unable to contact any configured publishers.     This is likely a network configuration problem.     Framework error: code: 6 reason: Couldn't resolve host 'pkg.oracle.com'     URL: 'http://pkg.oracle.com/solaris/release' (happened 4 times)      I don't understand that SSH can work, but my internet is not open. This is what ifconfig -a returns:               # ifconfig -a     lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1         inet 127.0.0.1 netmask ff000000     net0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2         inet 10.0.11.17 netmask ff000000 broadcast 10.255.255.255         ether 8:0:27:7:ad:7     lo0: flags=2002000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv6,VIRTUAL> mtu 8252 index 1         inet6 ::1/128     net0: flags=20002004841<UP,RUNNING,MULTICAST,DHCP,IPv6> mtu 1500 index 2         inet6 fe80::a00:27ff:fe07:ad07/10         ether 8:0:27:7:ad:7      net0 IPv4 is the correct IP address that I am using for SSH. The only way I could (possibly) get round it, is if I could edit the gateway and the DNS IP addresses. Any help to get this machine to see the internet, would be greatly appreciated.


title: Why is uniq ignoring Unicode and lines with a single letter?

text: I'm trying to combine both the American and British dictionaries into one large dictionaries, and I'm trying to remove all the duplicates from the superset, but it seems that uniq is not outputting words like, "épée" or single letters. This is what I've tried using:               LC_COLLATE=en_US.UTF-8 cat american-english british-english |sort|uniq -u > unique_sorted_combined_dict      If I just do this:               LC_COLLATE=en_US.UTF-8 cat american-english british-english |sort > sorted_combined_dict      "épée" and other such words do show up, along with single letters. Is there something I'm missing here with `uniq`? I should note that I'm using uniq from the GNU coreutils on Ubuntu 12.10, if that makes any difference.


title: Write to a file without redirection?

text: I am writing a regular compiled application that needs to create a special file and write a magic cookie into it. I can’t write the file directly from the application, the system security model requires me to launch a helper tool with elevated privileges to do the trick. I can supply any number of arguments to the helper tool. Now I would like to pick some very simple system command that would serve as the helper tool and create the file for me. Something like this: `/bin/sh -c "/bin/echo -n 'magic' > /some/where/file"` Simple `touch` does not cut it as I need to write the cookie into the file, a simple `echo` without the shell wrapper does not work as it needs redirection to write the file. I don’t feel comfortable calling the shell with root privileges to do such a trivial task. Is there some really simple, constrained system command that I could call to write the file for me?


title: breaking from a program running in an interactive session in a screen window

text: I am launching `R` (an interactive program) in a `screen` window in a remote session:               ssh me@..     screen -S R_ProjectName     R       In the R session, I would like to `break` execution. Normally, this would be via `ctrl`+`c`. However, the command is getting submitted to `screen` instead of to `R`. What is the correct way to break in a program inside a screen window? To clarify, I am not looking to kill the `R` process. Rather, `ctrl`+`c` would be used to manually break out of (eg) a `for` loop. * * * I am working in iTerm2 on a Mac OS X connecting to Ubuntu 13.04


title: Linux GCC compiler options

text: I have recently started using Linux as a tool for programing. In my book, I have seen that the GCC is used with 2 options: `-g` and `-o`. Now, I know that `-o` is to set a filename, but what is the purpose of `-g`? I thought it might relate to debugging, but also programs compiled without the `-g` argument are debuggable. So what is it?


title: Extracting a string, according to a pattern, in a bash script

text: In bash, suppose that I have a string `strname`:               strname="ph7go04325r"      I would like to extract the characters between the _first_ `"3"` character and the _last_ `"r"` character in `strname`, saving the result in a string `strresult`. In the example above, the resulting `strresult` would be:               strresult="25"      The first `"3"` character is _not_ necessarily at string position 8 in `strname`; likewise, the last `"r"` is _not_ necessarily at string position 11. Thus, both of the following strings `strname` should yield `strresult="25"`:               strname="ph11go04325raa"     strname="325r"     strname="rgo04325raa"      Also, `strname=ph12go04330raa"` should yield `strresult="30"`. I am new to bash scripting, and I don't know where to begin to do string pattern matching like this. Do you have any suggestions?


title: Multiple Users on a Desktop Environment

text: This is probably a REALLY stupid question. But anyways, lets pretend we had a *nix rather powerful system... Now Obviously I know you can set up multiple users to login to a system.......but how exactly do you do that? Like....how would all the monitors connect and such, or would you need a smaller computer node that like....reroutes it or something? I know that probably sounds dumb...but how do System Admins and such set up multiple users for a *nix system? across a large building or something?


title: Make script executable from vi/vim

text: How can I run `chmod +x` on the script I'm creating in vi/vim so that it is executable? I tried `:r chmod +x %` but it didn't work.


title: How to wget Youtube horrible URL

text: I'm going to wget youtube search page where the URL is horrible. This is example when searching `searchkeyword` sorted by upload date:               wget http://www.youtube.com/results?search_type=videos&search_query=searchkeyword&search_sort=video_date_uploaded&suggested_categories=26%2C27%2C22%2C28%2C24      and this one is page 2 of the search result:               wget http://www.youtube.com/results?search_type=videos&search_query=searchkeyword&search_sort=video_date_uploaded&suggested_categories=26%2C27%2C22%2C28%2C24&page=2      The wget give me misleading page for both pages.


title: Hosts file on server with dynamic DNS?

text: I am setting up a RHEL-based server that is associated with dynamic DNS from DynDNS, with a domain of, say, "abc.dyndns.org" that is dynamically updated with the server's IP address. I have read that in order to ensure access to your server's services, you need to have at least the following in your /etc/hosts: > 127.0.0.1 localhost.localdomain localhost > > xxx.xxx.xxx.xxx redhatbox.yourcompany.com redhatbox Where "xxx.xxx.xxx.xxx" is whatever IP address your server has, and "redhatbox" would be the name of the computer. So here are my questions: (1) Because my server has an IP that is dynamically assigned by my ISP's DHCP, there is no one IP I can put in place of xxx.xxx.xxx.xxx, what should I do in this case? (2) Should I simply replace "redhatbox.yourcompany.com" with my DynDNS domain "abc.dyndns.org"? And replace the "redhatbox" alias with "abc"? If anyone can explain all this for a novice like me that would be great. Thank you very much for your detailed answers and patience.


title: Intel Z68 chipset raid5 disappeared

text: I have this motherboard, it's a gigabyte Intel Z68 chipset. I used the Intel chipset configuration (between BIOS and OS) to configure a 3 disk Raid5 array which I formatted as NTFS (Linux already has a 2 Disk Raid1 ext3 array). One of the nice things about using NTFS is that I had a large raid array that both operating systems could see. This changed today and I still cannot figure out why. I don't think I did any upgrades and all of the dev nodes for the individual drives are still there but my Linux system does not recognize the presence of the array. Does anyone have any suggestions? I'm stumped. System: Archlinux x64 Windows 7 x64 (Still sees raid array just fine) edit: I just rebooted (which I had done 3 or 4 times before already) and now it's back. I'll check dmesg if it happens again. Newbie mistake forgetting to check that.


title: Play RTMP stream from command-line

text: I've managed to get flvstreamer to read a radio station's RTMP stream with the options `--live -r [url]`, and it outputs what I guess is the raw audio data + stream info to stdout. Can I make it play the stream through my speakers, from the command-line? Possibly by sending sending the raw audio data to `mplayer` or something else. Thanks. * * * I got it to work with the command `./flvstreamer_x86 --live --quiet -r [url] --buffer 3000 | mplayer -vo null -`, **but it quits after a couple of seconds to a couple of minutes**. I added `--buffer 3000` to imitate what I saw when tracing the original Flash player with Wireshark. These are the last rows of output.               [pulse] working around probably broken pause functionality,             see http://www.pulseaudio.org/ticket/440     AO: [pulse] Init failed: Connection refused     Failed to initialize audio driver 'pulse'     AO: [alsa] 48000Hz 2ch s16le (2 bytes per sample)     Video: no video     Starting playback...     FAAD: Failed to decode frame: Maximum number of bitstream elements exceeded     A:16866.9 ( 4:41:06.9) of 0.0 (unknown)  8.1%          Exiting... (End of file)      This was with flvstreamer 1.81. I couldn't get it to work with any version above, they just output               FLVStreamer v2.1c1     (c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL     Connecting ...     ERROR: rtmp server sent error     Starting Live Stream     FLV☺♣               Metadata:       audiodatarate         48.00       audiosamplerate       44100.00       audiocodecid          10.00     [stripped]      How can I make it play continuously? Thanks.


title: append string where it belongs in sorted file

text: Suppose I have a sorted file, named sorted.txt, like this:               beautiful     easy     fast     functional     handy      Now, doing `echo fine-grained >> sorted.txt` will put "fine-grained" at the end of the file, after "handy". Is there a way to insert it in order, between "fast" and "functional", without needing to re-sort the file?


title: ext4 overrides my commit=100 mount option with commit=0

text: Here is the relevant line from my /etc/fstab file:               UUID=f51aa298-9ce4-4a19-a323-10df333f34f5 /               ext4    data=writeback,noatime,barrier=0,errors=remount-ro,commit=100,nobh,nouser_xattr       0       1      Here is what happens when I type the command "mount":               /dev/sda1 on / type ext4 (rw,noatime,data=writeback,barrier=0,errors=remount-ro,commit=100,nobh,nouser_xattr,commit=0)      Why does it specify "commit=0" at the end? Does it mean that my commit=100 option is not used? I am using Ubuntu 10.10, 32-bit with the latest updates.


title: Is there a way to control the delay before shutdown on low battery?

text: Is there any way to configure shutdown on critically low battery to give me a bit of time before actually shutting down? I've set GNOME Power Manager to shutdown on low battery (hibernating does not work on my netbook). Problem is, I don't get any notification about battery running low, and as soon as battery level reaches the critical threshold, the system quickly kills applications and shuts down without me having any chance to quickly complete some tasks and/or save some data. Of course, I'd increase battery level thresholds to gain some more time to accomplish such tasks. If some other window manager has a more advanced power management facility than GNOME, I'm also willing to switch.


title: How to change temporarily font size in text console in openSUSE?

text: I found several answers already but all of them are focused on changing size for good, i.e. at Lilo/Grub level. I don't want this though. So, key issues:   1. changing size on-fly, I would like to increase size, and 5 minutes later, decrease it back   2. it is question about text console, not terminal running in X11 openSUSE 11.4 if this matters. Thank you in advance. _I am only interested in size of the font, not in typeface of it._


title: can not sftp: returns 128 "is the sftp server running"

text: I can ssh to my EC2 instance (amazon linux) (same user, from same machine, same certificate) however I can no longer use sftp. Logging in via WinScp (via my windows7 box) for SFTP used to work, but now it gives me "exit code 128, is sftp running" , the error log just shows me 'subsystem request for sftp' How can I get it to work? debugging delivers this:                   debug1: session_open: channel 0     debug1: session_open: session 0: link with channel 0     debug1: server_input_channel_open: confirm session     debug1: server_input_channel_req: channel 0 request simple@putty.projects.tartarus.org reply 0     debug1: session_by_channel: session 0 channel 0     debug1: session_input_channel_req: session 0 req simple@putty.projects.tartarus.org     debug1: server_input_channel_req: channel 0 request auth-agent-req@openssh.com reply 1     debug1: session_by_channel: session 0 channel 0     debug1: session_input_channel_req: session 0 req auth-agent-req@openssh.com     debug1: temporarily_use_uid: 222/500 (e=222/500)     debug1: restore_uid: (unprivileged)     debug2: fd 8 setting O_NONBLOCK     debug1: channel 1: new [auth socket]     debug1: server_input_channel_req: channel 0 request subsystem reply 1     debug1: session_by_channel: session 0 channel 0     debug1: session_input_channel_req: session 0 req subsystem     subsystem request for sftp     debug1: subsystem: exec() /usr/libexec/openssh/sftp-server     debug2: fd 5 setting TCP_NODELAY     debug2: fd 11 setting O_NONBLOCK     debug2: fd 10 setting O_NONBLOCK     debug1: Received SIGCHLD.     debug1: session_by_pid: pid 10940     debug1: session_exit_message: session 0 channel 0 pid 10940     debug2: channel 0: request exit-signal confirm 0     debug1: session_exit_message: release channel 0     debug2: channel 0: write failed     debug2: channel 0: close_write     debug2: channel 0: send eow     debug2: channel 0: output open -> closed     debug2: channel 0: read<=0 rfd 11 len 0     debug2: channel 0: read failed     debug2: channel 0: close_read     debug2: channel 0: input open -> drain     debug2: channel 0: ibuf empty     debug2: channel 0: send eof     debug2: channel 0: input drain -> closed     debug2: channel 0: send close     debug2: notify_done: reading     debug2: channel 0: rcvd close     debug2: channel 0: is dead     debug2: channel 0: gc: notify user     debug1: session_by_channel: session 0 channel 0     debug1: session_close_by_channel: channel 0 child 0     debug1: session_close: session 0 pid 0     debug2: channel 0: gc: user detached     debug2: channel 0: is dead     debug2: channel 0: garbage collecting     debug1: channel 0: free: server-session, nchannels 2     Connection closed by 1.2.3.4     debug1: channel 1: free: auth socket, nchannels 1     debug1: do_cleanup     debug1: temporarily_use_uid: 222/500 (e=222/500)     debug1: restore_uid: (unprivileged)     Transferred: sent 2472, received 2224 bytes     Closing connection to 1.2.3.4 port 42647     debug1: PAM: cleanup     debug1: PAM: closing session     debug1: PAM: deleting credentials      update: problem was I edited my .bashrc which outputted something to stdout. Since sftp starts up a new shell for the user and does not like that.... it fails with a exit code 128.


title: No eth0 after HD transplant

text: After moving the hard drive of a makeshift server to another compatible hardware (64-bit, same processor "generation", laptop->desktop) configuration, networking fails to initiate. Specifically:   * `ifconfig` only shows `lo`   * `sudo service networking restart` shows: -               stop: unknown instance:     networking stop/waiting      quite obviously something in the system and/or kernel is misconfigured for the new hardware setup. **How to detect what exactly is wrong and enable`eth0`?** The system in question is an Ubuntu 14.04 Server distro, but I suspect the problem is general.


title: Unique hardware signatures in BSD?

text: What unique hardware signatures can you get from, for example, a FreeBSD system? I am right now using the ethernet mac address (getifaddrs(3)) but as we all know this can easily be changed with ifconfig. So what else is there? Anything in sysctl? I am using C to do this so if I can just find out where to look I will most likely find a way to get it.


title: Several versions of JAVA on one PC

text: I want to use jre-1_5_0_21 on my Fedora 14 box. Here's whats installed on my PC:               $ update-alternatives --config java          There are 2 programs which provide 'java'.            Selection    Command     -----------------------------------------------     *+ 1           /usr/lib/jvm/jre-1.6.0-openjdk/bin/java        2           /usr/lib/jvm/jre-1.5.0-gcj/bin/java          Enter to keep the current selection[+], or type selection number: 1     failed to create /var/lib/alternatives/java.new: Permission denied     $       rpm -qa               $ rpm -qa | grep -i java     java-1.6.0-openjdk-plugin-1.6.0.0-52.1.9.7.fc14.i686     java-1.6.0-openjdk-1.6.0.0-52.1.9.7.fc14.i686     java-1.5.0-gcj-1.5.0.0-34.fc14.i686     java_cup-0.11a-4.fc13.noarch     tzdata-java-2011d-3.fc14.noarch     $       How can I have several versions of java installed on my PC, and selecting it by: "update-alternatives --config java"?      UPDATE: so like when having several php versions on a webserver, I need to have several versions of JAVA, and it would be a practical thing to switch between the versions with "update-alternatives" then restart the webbrowser -> then the applet, that needs previous version of java [...] would start simply [...]      Thanks!


title: Why is LPD not enabled by default in Transmission?

text: Since version **2.00**, Transmission has Local Peer Discovery feature, which seems quite useful. I was surprised that it wasn't enabled by default though, so I became concerned about any potential issues it might have.


title: What preparations should I make before reinstalling windows?

text: Since Windows still does not offer means to skip rewriting the MBR, what can I do _before_ reinstalling Windows to get Grub2 back into the MBR as easy as possible? (I'll also appreciate it if the answer then describes _how_ to restore Grub)


title: How to whitelist an URL in Privoxy (with a little regexp)

text: how can i whitelist these URLs in Privoxy?                 http://foo.org/user/10000/track?page=1     http://foo.org/user/10000/track?page=2     http://foo.org/user/10000/track?page=3     http://foo.org/user/10000/track?page=4     ...      I don't want to whitelist "foo.org" i just need to whitelist these specific url's.   the "page=NUMBER" where NUMBER=1..99999999 [so it's a big number, i don't know exactly how much]   What do i need to write in the "user.action" file? :\


title: How to ensure that anonymous FTP has been disabled on a Solaris 10 system?

text: What line in which configuration files in the `/etc/ftpd` directory do I have to check to ensure that anonymous FTP has been disabled? From my understanding now, to ensure that anonymous FTP is disabled, all the users assigned to the `anonusers` group in `/etc/ftpd/ftpaccess` has to be added to `/etc/ftpd/ftpusers` to deny them access. Is there a simpler way?


title: Kernel Hacking Environment

text: I have been working in embedded OS like uCOS, ThreadX. While I have coded apps in Linux, now I’m planning to start learning Linux Kernel. I have few questions regarding the environment.   1. Which is best distro, which has easy to use tools for kernel development? (so far I had used RHEL and Fedora. While I am comfortable with these, it also looks like Ubuntu has in-built scripts for easy kernel compilation like `make_kpkg`, etc)   2. Can you describe the best setup for kernel debugging? While debugging other embedded OSes, I have used serial port to dump progress, JTAG, etc. Which kind of setup does the Linux kernel devs use? (Will my testbed PC with serial port is enough for my needs? If yes, how to configure the kernel to dump to serial port?) I'm planning to redirect kernel messages to serial console which will be read in my laptop.   3. What tool is best for debugging and tracing kernel code? As mentioned earlier, is serial console the only way? Or any IDE/JTAG kind of interface exists for PC?


title: Is there something like wine to run OSX apps on linux?

text: This question answers why Linux can't run OSX apps, but is there some application similar to Wine that allows one to do so?


title: Ctrl-Alt-F1 not working from X

text: I have a system running Debian 5.0 that doesn't respond to Ctrl-Alt-F# (1-6) Check if Ctrl, Alt, F1 and F2 are intercepted correctly...               $ DISPLAY=:0 xwininfo          xwininfo: Please select the window about which you               would like information by clicking the               mouse in that window.          xwininfo: Window id: 0xe00002 (has no name)     ...          $ xev -display :0 -id 0xe00002     KeyPress event, serial 16, synthetic NO, window 0xe00002,         state 0x10, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,          KeyPress event, serial 16, synthetic NO, window 0xe00002,         state 0x10, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,          KeyPress event, serial 16, synthetic NO, window 0xe00002,         state 0x10, keycode 67 (keysym 0xffbe, F1), same_screen YES,          KeyPress event, serial 16, synthetic NO, window 0xe00002,         state 0x10, keycode 68 (keysym 0xffbf, F2), same_screen YES,      ..They are. However, xev does not report Ctrl-Alt-F1 as one single event. Does that mean, X does not correctly interpret that sequence? Check if X is configured to ignore Ctrl-Alt-F#..               $ grep -i dontvtswitch /etc/X11/xorg.conf      ..It isn't But killing X with Ctrl-Alt-Backspace allows me to switch ttys. The Xorg.0.log at pastebin. How enable tty switching when running X? The root filesystem is mounted as read-only. Can that affect how x setups up keyboard mappings? Tried mounting as read-write but the problem persists. Haven't been able to make the system boot up in read-write (I've set the boot options in the bootloader but something happens during boot that remounts the rootfs as readonly).


title: How do I find out the device node corresponding to my device in SuSE 8?

text: I'm forced to work with a bunch of point-of-sale systems running SuSE 8. They are my client's computers. We are stuck dealing with these old systems until they get to upgrade their whole fleet to SLE 11. The problem: the system now has two devices that compete for the ttyUSB* character device nodes. They have different vendor ID and product ID. SuSE 8 doesn't have udev, it has devfs instead. Knowing the device's vendor ID and product ID, and the kernel module responsible for the device (it's the ipaq kernel module), how do I find out what character device node it has been assigned to, in a way that it can be stored in a string (e.g. $DeviceNode) in a POSIX shell script? Right now, I'm doing it in a really really dumb way in my shell script:               DeviceNode=$(dmesg | tac | grep "PocketPC PDA converter now attached to" | set -n 's/.*now attached to \([[:alnum:]]\{1,\}\).*/\1/p')      So I get, for instance               > echo $DeviceNode     ttyUSB1     >      Of course, one of the problems is that the device may have already been unplugged and I wouldn't be able to tell with this naïve method. Is there any better way? EDIT: So I found this article this morning. Can I assume that, in /proc/tty/driver/usbserial, from the 2nd line onward, the first number of each line is the minor number of one of the ttyUSBx? EDIT 2: An alternate (and perhaps better) solution would be to get persistent node association (e.g. always getting a device with a known vendor ID and a known product ID to be associated with ttyUSB1). Is that achievable in devfs?


title: rm -r * in unix

text: I am about to enter the command: `rm -r *` in a directory where I would like all files and directories (and their files) removed. My concern is that unix also has the `./` and the `../` directories. `rm -r` should follow all directories: does that mean it will follow `../` and delete stuff in higher up directories? I can't seem to find the answer to this by googling.


title: How to use `expect` with `zipcloak`?

text: I create a `zip` file using `zip` which includes several files and directories, named `test.upd`. Now I want to use `expect` to automatically handle the password encryption. Here are two bash scripts, both do not work:               !/bin/bash          MYPWD="mypassword"          expect -c '         spawn zipcloak test.upd         expect {            "*Enter password*" { send "'"$MYPWD"'\r"                                        exp_continue                                       }            "*Verify password*" { send "'"$MYPWD"'\r"                                           exp_continue                                         }         }'      and this file:               !/bin/bash     MYPWD="mypassword"          expect -c '         spawn zipcloak test.upd         expect "*Enter password*"          send "'"$MYPWD"'\r"         expect "*Verify password*"          send "'"$MYPWD"'\r"              }'      I also tried to create an `expect` script directly:               #!/usr/bin/expect -f          spawn zipcloak test.upd     expect "*Enter password*"      send "password\r"     expect "*Verify password*"      send "password\r"      All scripts seem to send correctly the first password request, but it looks like the text for the second password entry is never asked. How can I do it right? Constraints:   * I have to use `zipcloak` (NOT `zip`)   * I want to use `expect` to automatically set the password. Remarks:   * I have used the correct script   * Each time, when using the first script, an empty file starting with `zi` is created in the directory, like `ziSvbYhy` or `zi3gzEQ4`.


title: How to delete line with Privoxy?

text: I know how to swap something with something with privoxy, e.g:               s/class="node ad"/class="node ad" style="display:none"/g      But how can I delete a line with privoxy? E.g.: If a line contains:               RANDOM STRING BEFOREOfftopic	RANDOM STRING AFTER      then what should I write in the user.action file to delete the line? I'm searching for this kind of "sed" effect in Privoxy:               echo -e "asdf\nsomething2\nadf" | sed '/thing2/d;'      If I use "/Offtopic/d" in the user.filter file it doesn't works. (And yes, I have other rules in user.filter perfectly working.)


title: How to compile dcp2icc?

text: After trying for hours I am unable to compile dcp2icc-0.1 on Linux. With a simple Makefile added to the original code it fails as follows:               g++ -o build/XMP/source/XMPCore/ExpatAdapter.o -c -O2 -iquote- -DUNIX_ENV=1 -D_FILE_OFFSET_BITS=64 -Ifixes/XMP-Toolkit -IXMP-Toolkit-SDK-4.4.2/build -IXMP-Toolkit-SDK-4.4.2/source/common -IXMP-Toolkit-SDK-4.4.2/source/XMPCore -IXMP-Toolkit-SDK-4.4.2/source/XMPFiles -IXMP-Toolkit-SDK-4.4.2/source/XMPFiles/FileHandlers -IXMP-Toolkit-SDK-4.4.2/source/XMPFiles/FormatSupport -IXMP-Toolkit-SDK-4.4.2/third-party/MD5 -IXMP-Toolkit-SDK-4.4.2/public/include XMP-Toolkit-SDK-4.4.2/source/XMPCore/ExpatAdapter.cpp     In file included from XMP-Toolkit-SDK-4.4.2/source/XMPCore/ExpatAdapter.cpp:10:0:     XMP-Toolkit-SDK-4.4.2/source/XMPCore/XMPCore_Impl.hpp: In function 'bool IsPathPrefix(XMP_StringPtr, XMP_StringPtr)':     XMP-Toolkit-SDK-4.4.2/source/XMPCore/XMPCore_Impl.hpp:371:28: error: 'strlen' is not a member of 'std'       XMP_StringLen prefixLen = std::strlen(prefix);                                 ^      This I understand is because some default includes were removed. I tried including everything that the files were missing (`cstdlib`, `inttypes.h`, `limits.h`, `cstring`), but:               g++ -o build/XMP/source/XMPFiles/FileHandlers/ASF_Handler.o -c -O2 -iquote- -DUNIX_ENV=1 -D_FILE_OFFSET_BITS=64 -Ifixes/XMP-Toolkit -IXMP-Toolkit-SDK-4.4.2/build -IXMP-Toolkit-SDK-4.4.2/source/common -IXMP-Toolkit-SDK-4.4.2/source/XMPCore -IXMP-Toolkit-SDK-4.4.2/source/XMPFiles -IXMP-Toolkit-SDK-4.4.2/source/XMPFiles/FileHandlers -IXMP-Toolkit-SDK-4.4.2/source/XMPFiles/FormatSupport -IXMP-Toolkit-SDK-4.4.2/third-party/MD5 -IXMP-Toolkit-SDK-4.4.2/public/include XMP-Toolkit-SDK-4.4.2/source/XMPFiles/FileHandlers/ASF_Handler.cpp     In file included from XMP-Toolkit-SDK-4.4.2/source/XMPFiles/XMPFiles_Impl.hpp:24:0,                      from XMP-Toolkit-SDK-4.4.2/source/XMPFiles/FileHandlers/ASF_Handler.hpp:13,                      from XMP-Toolkit-SDK-4.4.2/source/XMPFiles/FileHandlers/ASF_Handler.cpp:10:     fixes/XMP-Toolkit/LargeFileAccess.hpp:21:13: error: conflicting declaration 'typedef int LFA_FileRef'      typedef int LFA_FileRef;                  ^      I tried forcing the type declaration to `void *` (thanks Howard!):               g++ -o build/XMP/source/common/LargeFileAccess.o -c -O2 -iquote- -DUNIX_ENV=1 -D_FILE_OFFSET_BITS=64 -Ifixes/XMP-Toolkit -IXMP-Toolkit-SDK-4.4.2/build -IXMP-Toolkit-SDK-4.4.2/source/common -IXMP-Toolkit-SDK-4.4.2/source/XMPCore -IXMP-Toolkit-SDK-4.4.2/source/XMPFiles -IXMP-Toolkit-SDK-4.4.2/source/XMPFiles/FileHandlers -IXMP-Toolkit-SDK-4.4.2/source/XMPFiles/FormatSupport -IXMP-Toolkit-SDK-4.4.2/third-party/MD5 -IXMP-Toolkit-SDK-4.4.2/public/include XMP-Toolkit-SDK-4.4.2/source/common/LargeFileAccess.cpp     XMP-Toolkit-SDK-4.4.2/source/common/LargeFileAccess.cpp: In function 'void LFA_Close(LFA_FileRef)':     XMP-Toolkit-SDK-4.4.2/source/common/LargeFileAccess.cpp:575:20: error: cast from 'LFA_FileRef {aka void*}' to 'int' loses precision [-fpermissive]        int descr = (int)file;                         ^      I tried compiling using 32-bit mode:               g++ -o build/XMP/source/XMPCore/XMPCore_Impl.o -c -m32 -O2 -iquote- -DUNIX_ENV=1 -D_FILE_OFFSET_BITS=64 -Ifixes/XMP-Toolkit -IXMP-Toolkit-SDK-4.4.2/build -IXMP-Toolkit-SDK-4.4.2/source/common -IXMP-Toolkit-SDK-4.4.2/source/XMPCore -IXMP-Toolkit-SDK-4.4.2/source/XMPFiles -IXMP-Toolkit-SDK-4.4.2/source/XMPFiles/FileHandlers -IXMP-Toolkit-SDK-4.4.2/source/XMPFiles/FormatSupport -IXMP-Toolkit-SDK-4.4.2/third-party/MD5 -IXMP-Toolkit-SDK-4.4.2/public/include XMP-Toolkit-SDK-4.4.2/source/XMPCore/XMPCore_Impl.cpp     In file included from /usr/include/c++/4.9.1/bits/stl_algo.h:59:0,                      from /usr/include/c++/4.9.1/algorithm:62,                      from XMP-Toolkit-SDK-4.4.2/source/XMPCore/XMPCore_Impl.cpp:16:     /usr/include/c++/4.9.1/cstdlib:178:10: error: expected unqualified-id before '__int128'        inline __int128               ^      What do I need to do to make this compile? Is this approach even sound?


title: Fedora doesn't boot after migration to new disk

text: I bought a new larger SSD and copied all data from the old SSD to the new one. On the SSD I have `Ubuntu` and `Fedora`, `Ubuntu` works normally after migration but `Fedora` boots into `Emergency Mode`. I have pasted the contents of my system output when I try to boot into `Fedora` here.


title: What's the difference between the Partition GUID Code and Partition unique GUID?

text: I'm just reading up on GUID partition tables, and messing around with `gdisk`, I see these two titles. What is the difference between them? I am referring to the following (emphasis mine) shown when running `gdisk`: > GPT fdisk (gdisk) version 0.8.7 > > Type device filename, or press to exit: /dev/sda   >  Partition table scan:   >  MBR: protective   >  BSD: not present   >  APM: not present   >  GPT: present > > Found valid GPT with protective MBR; using GPT. > > Command (? for help): i   >  Partition number (1-7): 4 > > **Partition GUID code: EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 (Microsoft basic > data)** > > **Partition unique GUID: 85E66D2F-3709-4060-938E-FFE836433CC9**   >  First sector: 2844672 (at 1.4 GiB)   >  Last sector: 651208703 (at 310.5 GiB) Partition size: 648364032 sectors > (309.2 GiB) Attribute flags: 0000000000000000 Partition name: 'Basic data > partition' > > Command (? for help):


title: Why did yum-builddep not provide the dependencies to install my rpm?

text: I am trying to rum my rpm package but getting this dependencies error.               [root@localhost ~]# rpm -ivh /root/x86_64/asterisk-1.8.12.2-1.fc15.x86_64.rpm      error: Failed dependencies:             libc.so.6(GLIBC_2.14)(64bit) is needed by asterisk-1.8.12.2-1.fc15.x86_64             libc.so.6(GLIBC_2.7)(64bit) is needed by asterisk-1.8.12.2-1.fc15.x86_64             libc.so.6(GLIBC_2.8)(64bit) is needed by asterisk-1.8.12.2-1.fc15.x86_64             libcap.so.2()(64bit) is needed by asterisk-1.8.12.2-1.fc15.x86_64             libcrypto.so.10()(64bit) is needed by asterisk-1.8.12.2-1.fc15.x86_64             libedit.so.0()(64bit) is needed by asterisk-1.8.12.2-1.fc15.x86_64             libgsm.so.1()(64bit) is needed by asterisk-1.8.12.2-1.fc15.x86_64             libpopt.so.0(LIBPOPT_0)(64bit) is needed by asterisk-1.8.12.2-1.fc15.x86_64             libresample.so.1()(64bit) is needed by asterisk-1.8.12.2-1.fc15.x86_64             libspeexdsp.so.1()(64bit) is needed by asterisk-1.8.12.2-1.fc15.x86_64             libsrtp.so.0()(64bit) is needed by asterisk-1.8.12.2-1.fc15.x86_64             libssl.so.10()(64bit) is needed by asterisk-1.8.12.2-1.fc15.x86_64             libtinfo.so.5()(64bit) is needed by asterisk-1.8.12.2-1.fc15.x86_64             libxml2.so.2(LIBXML2_2.4.30)(64bit) is needed by asterisk-1.8.12.2-1.fc15.x86_64             libxml2.so.2(LIBXML2_2.6.0)(64bit) is needed by asterisk-1.8.12.2-1.fc15.x86_64             rpmlib(FileDigests) <= 4.6.0-1 is needed by asterisk-1.8.12.2-1.fc15.x86_64             rpmlib(PayloadIsXz) <= 5.2-1 is needed by asterisk-1.8.12.2-1.fc15.x86_64      To resolve the dependency error i used following command.               [root@localhost ~]# yum-builddep asterisk-1.8.12.2-1.fc15.src.rpm      Loaded plugins: fastestmirror     Loading mirror speeds from cached hostfile      * base: mirrors.hns.net.in      * extras: mirrors.hns.net.in      * updates: mirrors.hns.net.in     Checking for new repos for mirrors     autoconf-2.59-12.noarch     automake-1.9.6-2.3.el5.noarch     openssl-devel-0.9.8e-22.el5_8.4.x86_64     newt-devel-0.52.2-15.el5.x86_64     ncurses-devel-5.5-24.20060715.x86_64     libcap-devel-1.10-26.x86_64     gtk2-devel-2.10.4-21.el5_7.7.x86_64     Error: No Package found for libsrtp-devel      I am using CentOS 5.6 which is installed in VirtualBox on Fedora-15.


title: Elantech Mouse Touchpad not working well

text: I have a dual-boot Ubuntu/Debian (GNOME) machine: My mouse touchpad does not work correctly (right-click not recognized, cannot do 2 finger drag and drop/highlight) on Debian, but it **does work properly in Ubuntu**. I have so far overwritten `.conf` files in Debian with `.conf` files from Ubuntu in `/usr/share/X11/xorg.conf.d/` and restarted X, and rebooted. However I still have this problem. I am unsure as to where to go without having a program configure everything for me. If possible I would like to know how to fix this, and where I am getting my configurations from. **Outputs:** * * * **ORIGINALLY** I did not have a `/etc/dev/X11/xorg.conf` file, or a `/etc/dev/X11/xorg.conf.d/` directory (neither Ubuntu or Debian). I then made this file by doing `X -configure` and copying the `xorg.config.new` file to etc/dev/X11/xorg.conf` Output of `cat /var/log/Xorg.0.log |grep Elantech`: Here # More steps taken: From Ubuntu:   * Opened tty,`Ctrl`+`Alt`+`F1`   * `sudo service lightdm stop` stop lightdm    * `sudo X -configure` grab X configuration   * `sudo start lightdm` re-start lightdm Next steps are to move to Debian, and see if mouse works.   * It does not.  * * * Compared `X -configure` from Debian, and Ubuntu: ## (Debian)               Section "ServerLayout"         Identifier     "X.org Configured"         Screen      0  "Screen0" 0 0         Screen      1  "Screen1" RightOf "Screen0"         Screen      2  "Screen2" RightOf "Screen1"         InputDevice    "Mouse0" "CorePointer"         InputDevice    "Keyboard0" "CoreKeyboard"     EndSection                              Section "Files"         ModulePath   "/usr/lib/xorg/modules"         FontPath     "/usr/share/fonts/X11/misc"         FontPath     "/usr/share/fonts/X11/cyrillic"         FontPath     "/usr/share/fonts/X11/100dpi/:unscaled"         FontPath     "/usr/share/fonts/X11/75dpi/:unscaled"         FontPath     "/usr/share/fonts/X11/Type1"         FontPath     "/usr/share/fonts/X11/100dpi"         FontPath     "/usr/share/fonts/X11/75dpi"         FontPath     "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"         FontPath     "built-ins"     EndSection                              Section "Module"         Load  "extmod"         Load  "dri"         Load  "dbe"         Load  "dri2"         Load  "glx"         Load  "record"     EndSection                              Section "InputDevice"         Identifier  "Keyboard0"         Driver      "kbd"     EndSection                              Section "InputDevice"         Identifier  "Mouse0"         Driver      "mouse"         Option      "Protocol" "auto"         Option      "Device" "/dev/input/mice"         Option      "ZAxisMapping" "4 5 6 7"     EndSection                              Section "Monitor"         Identifier   "Monitor0"         VendorName   "Monitor Vendor"         ModelName    "Monitor Model"     EndSection                              Section "Monitor"         Identifier   "Monitor1"         VendorName   "Monitor Vendor"         ModelName    "Monitor Model"     EndSection                              Section "Monitor"         Identifier   "Monitor2"         VendorName   "Monitor Vendor"         ModelName    "Monitor Model"     EndSection                              Section "Device"             ### Available Driver options are:-             ### Values: : integer, : float, : "True"/"False",             ### : "String", : " Hz/kHz/MHz",             ### : "%"             ### [arg]: arg optional             #Option     "AccelMethod"           #              #Option     "DRI"                   # []             #Option     "ColorKey"              #              #Option     "VideoKey"              #              #Option     "Tiling"                # []             #Option     "LinearFramebuffer"     # []             #Option     "Shadow"                # []             #Option     "SwapbuffersWait"       # []             #Option     "TripleBuffer"          # []             #Option     "XvPreferOverlay"       # []             #Option     "DebugFlushBatches"     # []             #Option     "DebugFlushCaches"      # []             #Option     "DebugWait"             # []             #Option     "HotPlug"               # []             #Option     "RelaxedFencing"        # []             #Option     "Throttle"              # []             #Option     "UseVmap"               # []             #Option     "ZaphodHeads"           #              #Option     "DelayedFlush"          # []             #Option     "FallbackDebug"         # []             #Option     "BufferCache"           # []         Identifier  "Card0"         Driver      "intel"         BusID       "PCI:0:2:0"     EndSection                              Section "Device"             ### Available Driver options are:-             ### Values: : integer, : float, : "True"/"False",             ### : "String", : " Hz/kHz/MHz",             ### : "%"             ### [arg]: arg optional             #Option     "ShadowFB"              # []             #Option     "Rotate"                #              #Option     "fbdev"                 #              #Option     "debug"                 # []         Identifier  "Card1"         Driver      "fbdev"         BusID       "PCI:0:2:0"     EndSection                              Section "Screen"         Identifier "Screen0"         Device     "Card0"         Monitor    "Monitor0"         SubSection "Display"             Viewport   0 0             Depth     1         EndSubSection         SubSection "Display"             Viewport   0 0             Depth     4         EndSubSection         SubSection "Display"             Viewport   0 0             Depth     8         EndSubSection         SubSection "Display"             Viewport   0 0             Depth     15         EndSubSection         SubSection "Display"             Viewport   0 0             Depth     16         EndSubSection         SubSection "Display"             Viewport   0 0             Depth     24         EndSubSection     EndSection                              Section "Screen"         Identifier "Screen1"         Device     "Card1"         Monitor    "Monitor1"         SubSection "Display"             Viewport   0 0             Depth     1         EndSubSection         SubSection "Display"             Viewport   0 0             Depth     4         EndSubSection         SubSection "Display"             Viewport   0 0             Depth     8         EndSubSection         SubSection "Display"             Viewport   0 0             Depth     15         EndSubSection         SubSection "Display"             Viewport   0 0             Depth     16         EndSubSection         SubSection "Display"             Viewport   0 0             Depth     24         EndSubSection     EndSection                              Section "Screen"         Identifier "Screen2"         Device     "Card2"         Monitor    "Monitor2"         SubSection "Display"             Viewport   0 0             Depth     1         EndSubSection         SubSection "Display"             Viewport   0 0             Depth     4         EndSubSection         SubSection "Display"             Viewport   0 0             Depth     8         EndSubSection         SubSection "Display"             Viewport   0 0             Depth     15         EndSubSection         SubSection "Display"             Viewport   0 0             Depth     16         EndSubSection         SubSection "Display"             Viewport   0 0             Depth     24         EndSubSection     EndSection      ` ## (Ubuntu)               Section "ServerLayout"         Identifier     "X.org Configured"         Screen      0  "Screen0" 0 0         InputDevice    "Mouse0" "CorePointer"         InputDevice    "Keyboard0" "CoreKeyboard"     EndSection                              Section "Files"         ModulePath   "/usr/lib/xorg/modules"         FontPath     "/usr/share/fonts/X11/misc"         FontPath     "/usr/share/fonts/X11/cyrillic"         FontPath     "/usr/share/fonts/X11/100dpi/:unscaled"         FontPath     "/usr/share/fonts/X11/75dpi/:unscaled"         FontPath     "/usr/share/fonts/X11/Type1"         FontPath     "/usr/share/fonts/X11/100dpi"         FontPath     "/usr/share/fonts/X11/75dpi"         FontPath     "built-ins"     EndSection                              Section "Module"         Load  "glx"     EndSection                              Section "InputDevice"         Identifier  "Keyboard0"         Driver      "kbd"     EndSection                              Section "InputDevice"         Identifier  "Mouse0"         Driver      "mouse"         Option      "Protocol" "auto"         Option      "Device" "/dev/input/mice"         Option      "ZAxisMapping" "4 5 6 7"     EndSection                              Section "Monitor"         Identifier   "Monitor0"         VendorName   "Monitor Vendor"         ModelName    "Monitor Model"     EndSection                              Section "Device"             ### Available Driver options are:-             ### Values: : integer, : float, : "True"/"False",             ### : "String", : " Hz/kHz/MHz",             ### : "%"             ### [arg]: arg optional             #Option     "NoAccel"               # []             #Option     "AccelMethod"           #              #Option     "Backlight"             #              #Option     "DRI"                   #              #Option     "ColorKey"              #              #Option     "VideoKey"              #              #Option     "Tiling"                # []             #Option     "LinearFramebuffer"     # []             #Option     "VSync"                 # []             #Option     "PageFlip"              # []             #Option     "SwapbuffersWait"       # []             #Option     "TripleBuffer"          # []             #Option     "XvPreferOverlay"       # []             #Option     "HotPlug"               # []             #Option     "ReprobeOutputs"        # []             #Option     "XvMC"                  # []             #Option     "ZaphodHeads"           #              #Option     "VirtualHeads"          #              #Option     "TearFree"              # []             #Option     "PerCrtcPixmaps"        # []             #Option     "FallbackDebug"         # []             #Option     "DebugFlushBatches"     # []             #Option     "DebugFlushCaches"      # []             #Option     "DebugWait"             # []             #Option     "BufferCache"           # []         Identifier  "Card0"         Driver      "intel"         BusID       "PCI:0:2:0"     EndSection                              Section "Screen"         Identifier "Screen0"         Device     "Card0"         Monitor    "Monitor0"         SubSection "Display"             Viewport   0 0             Depth     1         EndSubSection         SubSection "Display"             Viewport   0 0             Depth     4         EndSubSection         SubSection "Display"             Viewport   0 0             Depth     8         EndSubSection         SubSection "Display"             Viewport   0 0             Depth     15         EndSubSection         SubSection "Display"             Viewport   0 0             Depth     16         EndSubSection         SubSection "Display"             Viewport   0 0             Depth     24         EndSubSection     EndSection      ` I do not notice a difference between the pointing devices. Output of `synclient -l`:               Parameter settings:     LeftEdge                = 130     RightEdge               = 3130     TopEdge                 = 96     BottomEdge              = 1697     FingerLow               = 1     FingerHigh              = 1     FingerPress             = 256     MaxTapTime              = 180     MaxTapMove              = 163     MaxDoubleTapTime        = 180     SingleTapTimeout        = 180     ClickTime               = 100     FastTaps                = 0     EmulateMidButtonTime    = 75     EmulateTwoFingerMinZ    = 282     EmulateTwoFingerMinW    = 7     VertScrollDelta         = 74     HorizScrollDelta        = 74     VertEdgeScroll          = 0     HorizEdgeScroll         = 0     CornerCoasting          = 0     VertTwoFingerScroll     = 1     HorizTwoFingerScroll    = 1     MinSpeed                = 1     MaxSpeed                = 1.75     AccelFactor             = 0.0537634     TrackstickSpeed         = 40     EdgeMotionMinZ          = 30     EdgeMotionMaxZ          = 160     EdgeMotionMinSpeed      = 1     EdgeMotionMaxSpeed      = 297     EdgeMotionUseAlways     = 0     TouchpadOff             = 1     LockedDrags             = 0     LockedDragTimeout       = 5000     RTCornerButton          = 0     RBCornerButton          = 0     LTCornerButton          = 0     LBCornerButton          = 0     TapButton1              = 1     TapButton2              = 3     TapButton3              = 2     ClickFinger1            = 1     ClickFinger2            = 1     ClickFinger3            = 1     CircularScrolling       = 0     CircScrollDelta         = 0.1     CircScrollTrigger       = 0     CircularPad             = 0     PalmDetect              = 0     PalmMinWidth            = 10     PalmMinZ                = 200     CoastingSpeed           = 20     CoastingFriction        = 50     PressureMotionMinZ      = 30     PressureMotionMaxZ      = 160     PressureMotionMinFactor = 1     PressureMotionMaxFactor = 1     GrabEventDevice         = 1     TapAndDragGesture       = 1     AreaLeftEdge            = 0     AreaRightEdge           = 0     AreaTopEdge             = 0     AreaBottomEdge          = 0     HorizHysteresis         = 18     VertHysteresis          = 18     ClickPad                = 0


title: Why don't my arrow keys work in sh?

text: I recently installed Ubuntu and when I run sh on the Terminal my arrow keys don't work so I can't go through my call history or edit whatever I'm typing. It just comes out as weird characters like `^[[A`. The login shell is bash and it works fine but as soon as I switch to sh, they don't work. How can I fix this?


title: Dotdeb says PHP 5.3.18 is the latest

text: I'm using Debian 6 . Now I don't understand why it says PHP 5.3.18 is the latest when 5.3.2 has been around for 2 years? I need at least PHP 5.3.2 for my symfony project. Thanks.


title: KDE taskbar labels disappear

text: I'm using Linux Mint 13 KDE. If I open more than 9 windows at once, all the labels on all my taskbar buttons disappear. Each one is left with only the icon, centered in its taskbar button. I found an Ubuntu bug about it ( https://bugs.launchpad.net/ubuntu/+source/kde-workspace/+bug/951553 ), but it's 8 months old and has no comments, which makes it seem like no one has seen it. What I want is for the taskbar buttons to just continue to get smaller and smaller the more windows I open, with the labels more and more aggressively truncated as the buttons get smaller. The labels already _are_ truncated when I open up to 9 windows, but when I open the 10th one it seems to switch to this totally different icon-only display. I don't want that. I just want it to keep showing less and less of the label, gradually. How can I achieve this?


title: How Can Terminal Emulators Kill Their Children After Recieving a SIGKILL?

text: From what I understand, SIGKILL cannot be caught. This would imply that a process does not have time to kill it's children before the OS destroys it. This can be demonstrated with a shell script.               #! /bin/bash          trap : SIGTERM SIGINT SIGKILL # SIGKILL is pointless.          mplayer video.avi      Killing it with SIGKILL leaves mplayer running.               $ kill -9 $pid      But when using a terminal emulator (xterm, Terminal, ...) it's children get killed along with it. How is this possible?               $ mplayer      And kill it:               $ kill -9 $terminal_pid      And mplayer goes down with the ship. Are terminal emulators somehow catching SIGKILL or is there another force at work here?


title: Locking the screen via CLI?

text: Is there any way that I can lock the screen CLI-style? I'm trying to target as many desktop managers as possible (mostly LightDM, but GDM, KDM, SLiM, XScreensaver, etc. would be great too), but I can only dig things up for GDM and XScreensaver. For GDM, it would be:               gnome-screensaver-command -l      For XScreensaver:               xscreensaver-command -lock      Is there a similar command for KDM and LightDM?


title: What do you filter / exclude list when doing backup with rsync?

text: I'm trying to build a comprehensive filter / exclude file, to prevent backuping stuff that doesn't make sense do backup, such as temporary / cache data or easily recreatable files. I would appreciate if you could share (part of) your exclude list for rsync backups. Here is what I have so far:               ## Universal excludes          lost+found     ld.so.cache          # backup text files (e.g. from Emacs)     - *~     - \#*\#          # Commonly distributed Mac OS X cache     - .DS_Store          # Commonly distributed Windows cache     - Thumbs.db          ## Root file system     - /dev/     - /etc/modules.conf     - /media/     - /proc/     - /sys/     - /tmp/     - /usr/portage/     - /usr/src/     - /var/tmp/     - /var/log/          # Of the mounted stuff, whitelist only my two data partitions     - /mnt/     + /mnt/data1     + /mnt/data2          # Common package managers (apt, yum)     - /var/cache/apt/     - /var/cache/yum/          ## Filters for home dirs (assumes /home/<user> dir structure)          # Cache     - /home/*/.cache/          # Downloads     - /home/*/Downloads/     + /home/*/Downloads/src/          # Dropbox     - /home/*/Dropbox          # Temporary files / cache     - /home/*/.local/share/Trash     - /home/*/.cache     - /home/*/.Trash          # X Windows System     - /home/*/.xsession-errors*          # Gnome temp stuff     - /home/*/.compiz*/session     - /home/*/.gksu.lock     - /home/*/.gvfs          # Common Applications          # Adobe Reader     - /home/*/.adobe/**/AssetCache/     - /home/*/.adobe/**/Cache/     - /home/*/.adobe/**/Temp/     - /home/*/.adobe/**/UserCache.bin          # Dropbox temp stuff     - /home/*/.dropbox/     - /home/*/.dropbox-dist/          # Gimp     - /.gimp-*/tmp     - /.gimp-*/swap          # Mozilla Firefox     - /home/*/.mozilla/firefox/*/Cache/     - /home/*/.mozilla/firefox/*/lock     - /home/*/.mozilla/firefox/*/.parentlock          # Mozilla Thunderbird     - /home/*/.mozilla-thunderbird/*/lock     - /home/*/.mozilla-thunderbird/*/.parentlock          # Pidgin (accounts.xml contains passwords in clear text)     - /home/*/.purple/accounts.xml      What else do you think would be useful to add to this filter file, or what do you use and why?


title: Can I run Linux on N130 Network Terminal Thin Client?

text: I've found this small device, named **N130 Network Terminal Thin Client** on several webshops. The datasheet says that it is running _"Embedded Eglobal operating firmware"_. I think, there is a good chance on that it is a minimal Linux distribution. So if it is, can I use it as a weak Linux server? Has anyone experience with it? (P.S. I know what a thin client is, and I also know that a "firmware Linux" may have several restrictions.) EDIT: http://www.eglobaltech.cn/ViewDetails67.aspx EDIT2: Confirmed answer should describe that _how_ can I use it as a weak Linux server, or tell _why_ I can't do it. Also, I would be happy with a good datasheet, too.


title: iptables forwarding and routing

text: In fact, this question is about openwrt and CoovaAP, but I guess it's the same in other linux distributions. I've two interfaces, a "wan" and a "wlan" interface. Is there by default any filter, which restricts which packets are forwarded from the wlan interface to the wan? Especially if the wlan interface on the router is 192.168.1.1 and someone connected to this interface enters 172.16.1.1 as IP on his machine. Are his packets then forwarded anyway? Is the routing decision only made up by the destination IP or is it influenced by the source? I think the problem would be that answers to the 172.16.1.1 machine wouldn't make their way back. Could the iptables forward rules make the interfaces behave like a switch? If I wanted 172.16.x to be forwarded, I could setup an alias on this physical interface. Is there another way? The default Coova firewall script just says               iptables -A FORWARD -i $WIFI -o $WAN -j ACCEPT      I disabled masquerading. Is it possible to "separate" networks in this way and to rely on this? Is there a way someone could make his packets be forwarded with a not-192.168.1.x address? The reason for this question is, that behind the WAN-interface are machines which should not be reachable for WLAN users. Those machines rely on the source-IP address.


title: how to solve the problem of network DHCP when I install Debian?

text: I am trying to install Debian 6, but I have a problem every time I pass through the network part, it says cannot recognize the DHCP and couldnt connect to the network, so, I tried manually to configure, it is connected to a network with a router, so, I assigned the IP and the Gateway but still, doesnt work, cannot connect to internet, the weird part is that I tried in other occasion and it worked, now I want to install it again and does not work! :-s what could it be? Also when I try to install with a swap partition I get an error when formatting, if a create a partition for swap but without installing it it works... I set that as ext3 mount on / set as booteable. Any idea of what these errors could be? thanks.


title: Thin client that is only allowed to run certain applications

text: Im thinking about testing out LTSP on a PPC server for a handful of PPC macs. Before I go ahead with testing and building out everything, is it possible to limit what apps are ran on the thin client? Lets say I only want the thin client to be able to run a web browser and adobe reader, is that possible? Almost like an internet café. I'm also open to other suggestions, maybe thin provisioning isn't the right track to head down if I want a really 'locked' down OS.


title: UID/GID with sshfs of Linux FUSE

text: mkdir ~/mnt/2letter     echo PASSWORD | sshfs -o password_stdin www-data@localhost:/var/www/sites/2letter ~/mnt/2letter -o sshfs_sync,cache=no,password_stdin After this:               $ ls -ld ~/mnt/2letter/     drwxr-xr-x 1 www-data www-data 4096 Jan 28 21:29 /home/porton/mnt/2letter/ I need to access /home/porton/mnt/2letter/ under my UID (`porton`) not as `www-data`, because I am not allowed by file system permissions to modify `www-data` owner files, but need to edit them. Moreover it seems to have been working with the correct UID with older versions of Linux. Why doesn't it work now?


title: Creating deb file: hidden files specification by `install` file

text: I'm creating a deb-file and enumerating the files and paths I need to have in the package using the `install` file. It looks like               dir1/* path1     dir2/* path2     ...      But in a result `deb`-file there are no hidden files from `dir1` and `dir2`. It looks like `*` doesn't match hidden files. How could I match them apart from specifying each one explicitly?


title: Check whether network cable is plugged in without bringing interface up

text: I am trying to identify NICs on ~20 remote servers (2-6 NICs on every server). To begin with, I want to identify those ready for use and free ones. How can I check the state of the physical media? I know some ways, including `ifconfig|grep RUNNING`, `ethtool`, `cat /sys/class/net/eth0/carrier`, but all they require that the interface is up. I don't want to bring ALL interfaces up. Not sure why, but I don't like to have enabled, but not configured interfaces in the network. Is there a way I can avoid this? Or am I just wrong and there's nothing bad about all interfaces being up (and not configured)? Even if they are plugged in?


title: How to setup QoS on router (prioritize VOIP and web browsing over downloading)?

text: I've got Asus WL500GP-v2 router with renewed Oleg's firmware installed (http://code.google.com/p/wl500g/ , the stable version). I would like to setup some Quality of Service to ensure all users are able to browse web or use VOIP when one of them is mass downloading (torrent or http) or streaming online video or playing some online game. I also would like to prioritize local traffic from a NAS server that is in the same LAN and has a static IP address over VOIP communication (there is a backup service on NAS installed). I found that the router has WonderShaper installed (wshaper). How can I use this to achieve the policy? Or should I use something else? I have found a Prometheus QoS (http://gpl.arachne.cz/) that looks quite promising, but don't know how to use it (download vie wget, apt-get install package, and then what?).


title: evaluate multiple patterns from program output and write into pattern specific files

text: I have a script outputting some value/numbers and I want to split those into two files. I am looking at something like:               ./runme.sh | grep 'ook' >> ook.out | grep 'eek' >> eek.out      Where the second pipe should not, as is the case, take the output of the first grep but that of runme.sh. Is that possible?


title: How to create and edit a text file from the bash shell

text: I am logged into a linux server via ssh. From the bash shell, is there any standard way of bringing up some kind of text editing environment so I can create and edit a text file? I am aware that there exist apps like emacs and vi, but I don't know if they are appropriate for basic text file editing or if I should use something simpler, or if not, which one to use.


title: How parse a log file for a string, and when found search backwards for another string

text: I use the following command to parse a log file for a particular string. Then I search backwards in the log to find the data I really want. The problem as in the example below, I am only going back 50 lines. It is unknown if the text I am looking for will be 5 lines back, 200 lines back or more. Is there a way to search through a log file for a particular string, and when that string is found, to then search backwards through the log to find a 2nd string despite not knowing how far back the 2nd string is located. Also there could be multiple occurrence of the 1st string. So for for every instance of the 1st string, I want to be able to search backwards to collect the data from the second string.               grep -B50 "Server returned HTTP response code: 500 for URL:" LCSoap_8.log | \     tac | grep -P -o '(?<=qualified-src-dn=).*(?=src-dn)'


title: how to download a file using just bash and nothing else (no curl, wget, perl, etc.)

text: I have a minimal headless *nix which **does not have** any command line utilities for downloading files (e.g. no curl, wget, etc). I only have bash. How can I download a file? Ideally, I would like a solution that would work across a wide range of *nix.


title: Fedora 17 not booting

text: I just got GRUB to properly set the resolution, thanks to this wonderful answer. After selecting Fedora 17 and waiting a bit, this displays:               [   0.752888] [Firmware Bug]: powernow-k8: No compatible ACPI _PSS objects found.     [   0.752888] [Firmware Bug]: powernow-k8: Try again with latest BIOS.       (These two have dissappeared since enabling the Cool'n'Quiet BIOS setting)               Could not find platform independent libraries <prefix>     Could not find platform dependent libraries <exec_prefix>     Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]     ImportError: No module named site     [     0.758649] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000100     [     0.758649]     [     0.758980] Pid: 1, comm: init Not tainted 4.5.4-1.fc17.i686 #1     [     0.758306]  [<c093bb4b>] panic+0x81/0x17b     [     0.758455]  [<c043edfc>] do_exit+0x7fc/0x800     [     0.758612]  [<c043f094>] do_group_exit+0x34/0xa0     [     0.758649]  [<c043f118>] sys_exit_group+0x18/0x20     [     0.758649]  [<c094b2df>] sysenter_do_call+0x12/0x28      Knoppix and Fedora live boots work fine, though. Anything I short reinstalling Fedora I can to do to fix this? What other specs or information would be needed?


title: Why does vpnc not block the LAN interface?

text: VPNC allows local LAN access in spite of activating the vpnc on my RedHat Linux machine When we want to activate the Cisco VPN on win machine, once VPN is active then the LAN port isn’t accessible for `ping` or `ssh`. On our RedHat Linux machines (both real machine and on VMware), I installed VPNC version 6.3, and activated the vpnc, after configuring the `.pcf` file. VPN was activated, and I can ping to customer gateway. Until now everything is OK. But I notice that I still have access to my LAN on my Linux machine, meaning I can ping from my Linux machine to other external machines in the network. How can that be? Why doesn't vpnc block the LAN as it should? VPNC WIKI link - https://wiki.gentoo.org/wiki/Vpnc


title: find all symbolic links in a directory tree pointing outside that tree

text: I frequently move directory trees to other locations or copy their tarballs to other machines, and I would like to have a method to check whether any symlinks in a directory tree _A_ point to locations outside of _A_ since these will be broken in the moved / copied directory.


title: How to restore default group/user ownership of all files under /var?

text: I accidentally changed `/var` owner/group to my username and then changed it back to root, but not all the `/var` folders' owners are root, so is there anyway to change back owner/group of files/folders to default state? Or at least those files/folders that are created by packages?


title: Ubuntu How to re-install bootloader

text: I accidently altered my partition table. Somehow I wiped it out completely and changed the disk label. The system has not been rebooted yet and I managed to rebuild it the way it originally was using the original structure and label however I need to re-install a new bootloader for the new MBR. I have Ubuntu 14.04TLS running inside VirtualBox on a Windows 7 machine. Is there a way to do this without rebooting?


title: How do you get a count of all file extensions on a hard drive using the gnu+linux terminal?

text: On windows I have a program that can count all the files on a hard drive and the output shows a list of file extensions and a number (which showed how many files on the drive were for example are jpg). How do I do this in a terminal on gnu+linux?


title: Why is the exec option not listed in /proc/mounts?

text: My understanding is `/proc/mounts` should list all mount options for a filesystem, including kernel defaults, so I was surprised to see that exec (among others) is not listed here? For example, my root and home filesystems in fstab:               /dev/mapper/vg0-xen_root  /      ext4  noatime,errors=remount-ro  0  1     /dev/mapper/vg1-xen_home  /home  ext4  defaults                   0  2      and how they appear in /proc/mounts:               /dev/mapper/vg0-xen_root /     ext4 rw,noatime,errors=remount-ro,user_xattr,barrier=1,data=ordered 0 0     /dev/mapper/vg1-xen_home /home ext4 rw,relatime,user_xattr,barrier=1,data=ordered                  0 0         The filesystem independent defaults documented in `man mount`:               defaults         Use default options: rw, suid, dev, exec, auto, nouser, and async.         Why are some defaults (e.g. `rw`) listed but others (e.g. `exec`) are not? Is there a way to get the complete set of mount options associated with a filesystem?


title: MC (Midnight Commander) Full Path in Title Row of Internal Editor

text: On some systems (Midnight Commander 4.8.1.4, Midnight Commander 4.8.3) the MC shows the full path of the opened file in the internal editor and on other systems (Midnight Commander 4.7.0.2, Midnight Commander 4.6.2-pre1) not. For example if you open /home/user/examplefilename.log, you will see "File: examplef~ame.log" instead of "/home/user/examplefilename.log" in the title row. Is this just version dependend or is it a preference? I can't find any option or documention how to change it to show the full path.


title: SD Card interpreted as wrong size

text: I used `dd` to write a 2GB image to an 8GB SD card; `gparted` now sees it as a 2GB SD card and I can't figure out how to format it for 8GB again. `dd`also sees it as a 2GB SD card when trying to format it with `of=/dev/sdb if=/dev/zero bs=1M`. How can I get it to know its real size?


title: How to start a cron task?

text: It sounds really simple, but many times I was stuck at the beginning of learning a new command. The tutorial writer think it's natural to start, but it's not. This is the tutorial I've been reading: http://code.tutsplus.com/tutorials/scheduling-tasks-with-cron-jobs--net-8800 After reading that, I started something like:               * * * * * /usr/bin/sh t.sh      And I got this error:               bxg: command not found      bxg is an empty file I created on the directory to debug, the tree graph is like this:               .     ├── bxg     └── t.sh       Inside t.sh, the content is:               a=$(date)     mkdir "$a"      Obviously, bash didn't recognize this as a cron command. Then I searched the cron process to see if it is started alread:               ps aux | grep cron          root       942  0.0  0.0   3056   908 ?        Ss   10:34   0:00 cron     zen       4924  0.0  0.0   4652   568 pts/1    T    11:54   0:00 grep --color=auto cron     zen       9722  0.0  0.0   4656   568 pts/1    S+   12:05   0:00 grep --color=auto cron      Seems it's running there, but as another tutorial says that the process is called crond. I tried the followed:                service crond start      crond: unrecognized service      Maybe the process I greped out with "ps aux" isn't the authentic process:               service cron start     start: Job is already running: cron      OK, I totally got no ideas now, friends help me!


title: Enable remote printing options with cups-lpd

text: I am trying to print from SCO OpenServer remotely to a CUPS-LPD daemon running on a Red Hat Linux machine but it is dropping any print options from the print request. For example:               lp -d remote-print-queue -o landscape print-file      The options presented to the filter / backend only contains a job-uuid:               argv[5]="job-uuid=urn:uuid:96ba0666-ca3d-337b-69bf-81f70e9fa2a7"      Is it possible to enable the pass-through of options using lpd remote printing?


title: Cross Unix Command Reference

text: I am looking for a website that contains a reference between how to do things on the command line in different unix OSs. I have seen such site before, I am just unable to find it. I know such site would be beneficial for the community.


title: Unexplained Log Cruft and Possible Dropped Packets on WPA2-Personal LAN

text: I've been receiving a LOT of log cruft ever since I installed my Linksys Rangeplus USB WUSB100v2 (using the rt2870sta community driver from the Linux kernel) and was wondering what it all meant. Many times when these messages occur it is accompanied by slow network speeds and many DNS queries and outgoing SYNs being dropped. I have searched for documentation for these (error?) messages and have come up empty as far as what they mean or how I can stop them from occurring. I reside on the opposite side of the building from my WAP. I have taken steps to improve the signal strength, but the signal quality hovers between 50% and 70%, sometimes dropping to 40% for unknown reasons. I am using Slackware64-current (kernel 2.6.33.4) with dhcpcd-5.2.7, wpa_supplicant-0.6.10, wireless-tools-29. My `/var/log/messages`:               Sep 12 05:04:40 necronomicon -- MARK --     Sep 12 05:29:48 necronomicon kernel: 0:3 LTL=0 , TL=0 L:4284     Sep 12 05:29:53 necronomicon kernel: 0:3 LTL=0 , TL=0 L:4104     Sep 12 05:30:06 necronomicon kernel: 0:3 LTL=0 , TL=0 L:4156     Sep 12 05:31:02 necronomicon kernel: 0:3 LTL=0 , TL=0 L:12260     Sep 12 05:31:03 necronomicon kernel: 0:4 LTL=0 , TL=0 L:12260     Sep 12 05:31:21 necronomicon kernel: 0:3 LTL=0 , TL=0 L:4100     Sep 12 05:31:28 necronomicon kernel: 0:3 LTL=0 , TL=0 L:4160     Sep 12 05:32:41 necronomicon kernel: 0:3 LTL=0 , TL=0 L:5612     Sep 12 05:33:12 necronomicon kernel: 0:3 LTL=0 , TL=0 L:4208     Sep 12 05:33:16 necronomicon kernel: 0:3 LTL=0 , TL=0 L:4696     Sep 12 05:37:40 necronomicon kernel: 0:3 LTL=0 , TL=16896 L:24604     Sep 12 05:41:06 necronomicon kernel: 0:3 LTL=16896 , TL=0 L:4184     Sep 12 05:41:55 necronomicon kernel: 0:3 LTL=0 , TL=0 L:3456     Sep 12 05:42:20 necronomicon kernel: 0:3 LTL=0 , TL=0 L:24736     Sep 12 05:42:21 necronomicon kernel: 0:4 LTL=0 , TL=0 L:24736     Sep 12 05:42:22 necronomicon kernel: 0:5 LTL=0 , TL=0 L:24736     Sep 12 05:42:23 necronomicon kernel: 0:6 LTL=0 , TL=18944 L:24736     Sep 12 05:43:06 necronomicon kernel: 0:3 LTL=18944 , TL=0 L:2176     Sep 12 05:44:14 necronomicon kernel: 0:3 LTL=0 , TL=0 L:4996      My `dmesg`:               DeQueueRunning[0]= TRUE!     0:3 LTL=0 , TL=0 L:4996     0:3 LTL=0 , TL=0 L:4144     0:3 LTL=0 , TL=0 L:4100     DeQueueRunning[0]= TRUE!     0:3 LTL=0 , TL=0 L:4832     DeQueueRunning[0]= TRUE!     0:3 LTL=0 , TL=0 L:4184     0:3 LTL=0 , TL=0 L:5260     DeQueueRunning[0]= TRUE!     0:3 LTL=0 , TL=0 L:4200     0:3 LTL=0 , TL=0 L:4120     0:3 LTL=0 , TL=0 L:4140     0:3 LTL=0 , TL=0 L:5292     0:3 LTL=0 , TL=0 L:4188      My `/proc/net/wireless`:               Inter-| sta-|   Quality        |   Discarded packets               | Missed | WE      face | tus | link level noise |  nwid  crypt   frag  retry   misc | beacon | 22      wlan0: 0000   70.  -65   -83        0      0      0      0      0        0      My `iwconfig` settings:               wlan0     Ralink STA  ESSID:"Network Awesome"  Nickname:"necronomicon"               Mode:Managed  Frequency=2.457 GHz  Access Point: 00:16:B6:BA:FC:B0                  Bit Rate=12 Mb/s                  RTS thr:off   Fragment thr:off               Encryption key: [OMITTED]               Link Quality=67/100  Signal level:-63 dBm  Noise level:-83 dBm               Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0               Tx excessive retries:0  Invalid misc:0   Missed beacon:0      My `wpa_supplicant.conf`:               network={             ssid="Network Awesome"             psk="[OMITTED]"             proto=RSN             key_mgmt=WPA-PSK             pairwise=CCMP             priority=10             id_str="netawesome"     }


title: Create a GPT partition covering the free space

text: I have 480 GB SSD it currently has the following partitions 256MB EFI partition, 16GB SWAP, and 40GB CentOS 7 see details from `lshw` below. I want to use the remaining 400GB of unused space on the drive as an iSCSI target. The system only has /dev/sda1, /dev/sda2, /dev/sda3, there is no /dev/sda4 mapped to the 400GB of free disk space on the SSD. How do I add /dev/sda4 and map it to the unused 400DB on my disk so that it can be used as an iSCSI target? I am on CentOS 7.               *-scsi               physical id: 1               logical name: scsi3               capabilities: emulated             *-disk                  description: ATA Disk                  product: Crucial_CT480M50                  physical id: 0.0.0                  bus info: scsi@3:0.0.0                  logical name: /dev/sda                  version: MU03                  serial: 13440956E89D                  size: 447GiB (480GB)                  capabilities: gpt-1.00 partitioned partitioned:gpt                  configuration: ansiversion=5 guid=ab9704e2-9162-4c08-a759-956ad6a2f8f1 logicalsectorsize=512 sectorsize=4096                *-volume:0 UNCLAIMED                     description: Windows FAT volume                     vendor: mkfs.fat                     physical id: 1                     bus info: scsi@3:0.0.0,1                     version: FAT16                     serial: fa26-fbee                     size: 255MiB                     capacity: 255MiB                     capabilities: boot fat initialized                     configuration: FATs=2 filesystem=fat name=EFI System Partition                *-volume:1                     description: Linux swap volume                     vendor: Linux                     physical id: 2                     bus info: scsi@3:0.0.0,2                     logical name: /dev/sda2                     version: 1                     serial: c2b0907a-8337-4f32-b1e9-9affe6927264                     size: 15GiB                     capacity: 15GiB                     capabilities: nofs swap initialized                     configuration: filesystem=swap pagesize=4095                *-volume:2                     description: data partition                     vendor: Windows                     physical id: 3                     bus info: scsi@3:0.0.0,3                     logical name: /dev/sda3                     logical name: /                     serial: f7efca38-7631-4a20-ae0a-04942971d5ba                     capacity: 39GiB                     configuration: mount.fstype=xfs mount.options=rw,seclabel,relatime,attr2,inode64,noquota state=mounted      fdisk -l output below.               fdisk -l /dev/sda     WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.          Disk /dev/sda: 480.1 GB, 480103981056 bytes, 937703088 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Disk label type: gpt               #         Start          End    Size  Type            Name      1         2048       526335    256M  EFI System      EFI System Partition      2       526336     33294335   15.6G  Linux swap            3     33294336    115214335   39.1G  Microsoft basic


title: What is the `ucond` process state?

text: When debugging a program I saw that `top -U username` showed the following:               39769 eigenein       107  98    0   179M 38448K ucond  19   0:00  0.00% program      What does it mean that a process in the `ucond` state?


title: Installing a software on Linux- Centos

text: I am a complete amateur in Linux. There is a software that only runs on Linux. It came with a virtual machine package and every thing. When inside the virtual machine, I run a .py file in the terminal and it starts downloading the software. The software file is quite large. I noticed every time I let the software to download, the installation wants to start and asks me for the password. I am usually not there to enter and it fails. I wanted to see how I can get over this problem. Thanks


title: How to change locale environment variable?

text: I have generated _en_US.utf8_ , _et_EE.iso88591_ and _ru_RU.utf8_ localisation files. Now if I try to change any of the locale variables to a _ru_RU.utf8_ or _en_US.utf8_ , then this does not have any effect:               # locale -a     C     en_US.utf8     et_EE     et_EE.iso88591     POSIX     ru_RU.utf8     # LC_TIME=ru_RU.utf8     # locale | grep LC_TIME     LC_TIME="et_EE.iso88591"     # LC_TIME="ru_RU.utf8"     # locale | grep LC_TIME     LC_TIME="et_EE.iso88591"     #       However, if I change the _LANG=_ variable, then all other variables but _LANGUAGE=_ and _LC_ALL=_ take the value of the _LANG=_ variable. Is there a way to modify each locale variable separately? In addition, am I correct that locale variables aren't regular shell variables, but more like parameters to _locale_ utility?