title: Sort the 'last' output by month

text: I know that the command last | tac is enough, but I want to do it using the sort command. I cannot sort it by column, it always sorts the first one only. Using bash on Arch Linux.


title: Why does redirection in crontab result in a zero byte file?

text: **System: Xubuntu 13.10** When I have this crontab entry               */5 * * * * cat /home/dbk/.bash_aliases &> /home/dbk/Desktop/junk      `junk` has a byte size of `0`. Running               $ cat /home/dbk/.bash_aliases &> /home/dbk/Desktop/junk      gives a file with a proper size and content.


I have two Debian 7 machines and one of those reports "3.2.60-1+deb7u3" as its kernel release and other one reports "3.2.54-2" as its kernel release. Why does the same Debian release have different kernel versions?


title: Xen error on CentOS

text: During the creating of a new virtual server in xen using this command               xen-create-image --hostname=minecraft.koanhosting.com --ip 87.98.249.146 --install -method=debootstrap      But I keep getting this error:               Writing inode tables:  0/32^H^H^H^H^H 1/32^H^H^H^H^H 2/32^H^H^H^H^H 3/32^H^H^H^H^H 4/32^H^H^H^H^H 5/32^H^H^H^H^H 6/32^H^H^H^H^H 7/32^H^H^H^H^H 8/32^H^H^H^H^H 9/32^H^H^H^H^H10/32^H^$     Creating journal (32768 blocks): done     Writing superblocks and filesystem accounting information: done          This filesystem will be automatically checked every 28 mounts or     180 days, whichever comes first.  Use tune2fs -c or -i to override.     Done     Installation method: debootstrap          Copying files from host to image.     Copying files from /var/cache/apt/archives -> /tmp/LYC7oAQoxq/var/cache/apt/archives     Done     Done     I: Retrieving Release     E: Failed getting release file http://ftp.us.debian.org/debian/dists/etch/Release          Copying files from new installation to host.     Copying files from /tmp/LYC7oAQoxq/var/cache/apt/archives -> /var/cache/apt/archives     Done     Done     The installation of the new system has failed.          The system is missing the common file: /bin/ls     Done     System installation failed.  Aborting      Can't seem to find any resources on google at all for this error. I have a feeling it's to do with debootstrap, not sure though.


title: Can't compile XBMC 12 because of TAGLIB problem

text: I am trying to compile the latest version of XBMC on CentOS 6 x64 but on `./configure` I get:               checking for TAGLIB... no     configure: error: Could not find a required library. Please see the README for your platform.      I tried compiling the taglib coming with XBMC and also downloading the latest version from github. Both compile just fine but the error remains.               [root@xbmc xbmc]# find /usr -name libtag*     /usr/local/lib/libtag.a     /usr/local/lib/libtag.so     /usr/local/lib/libtag_c.so.0     /usr/local/lib/libtag.so.1.12.0     /usr/local/lib/libtag.so.1     /usr/local/lib/libtag_c.so     /usr/local/lib/libtag_c.a     /usr/local/lib/libtag_c.so.0.0.0     /usr/lib64/libtag.so     /usr/lib64/libtag_c.so.0     /usr/lib64/libtag.so.1     /usr/lib64/libtag.so.1.6.1     /usr/lib64/libtag_c.so     /usr/lib64/libtag_c.so.0.0.0     /usr/lib/libtag.so     /usr/lib/libtag_c.so.0     /usr/lib/libtag.so.1.12.0     /usr/lib/libtag.so.1     /usr/lib/libtag_c.so     /usr/lib/libtag_c.so.0.0.0      Any ideas how to fix that? **UPDATE**   @slm               Package taglib-devel-1.6.1-1.1.el6.x86_64 already installed and latest version      These are the only options configure help lists regarding taglib:                TAGLIB_CFLAGS  C compiler flags for TAGLIB, overriding pkg-config      TAGLIB_LIBS linker flags for TAGLIB, overriding pkg-config


title: Restarting a service from a script

text: I have a _init script_ - `/etc/init.d/myservice`, which starts some processes, including a **CLI process**. And from this CLI process, I am adding a _command_ which can be used to restart the service (restart _ourselves_ - kind of). What I tried - from a script (that is spawned from the CLI command), ran `sudo service myservice restart`, where `restart` is `stop;start`. But, this doesn't work! i.e, even though the `stop` happens, by the time `start` part is executing, the script terminates (not with any signals, but plain `EXIT`). I tried combinations of `nohup`, `disown` etc, but didn't seem to work! I am not sure how to complete the `restart` without getting terminated - any pointers, or workarounds to debug further ? To summarize:   * `myservice` -> spawns many processes, including **CLI**   * CLI -> has a `restart` command, which invokes a _script_   * _script_ does `sudo service myservice restart` --More info-- I'm on Ubuntu 12.04, i.e, `upstart`


title: Oracle Linux 6.5: Unable to install VLC 2.0.10 from rpmfusion-free-updates

text: I want to install VLC in my linux box. When I execute yum install vlc, it displays following message:-               Loaded plugins: refresh-packagekit, security     Setting up Install Process     Resolving Dependencies     --> Running transaction check     ---> Package vlc.i686 0:2.0.10-1.el6 will be installed     --> Processing Dependency: vlc-core(x86-32) = 2.0.10-1.el6 for package: vlc-2.0.10-1.el6.i686     --> Processing Dependency: libvlccore.so.5 for package: vlc-2.0.10-1.el6.i686     --> Processing Dependency: libcaca.so.0 for package: vlc-2.0.10-1.el6.i686     --> Processing Dependency: kde-filesystem for package: vlc-2.0.10-1.el6.i686     --> Processing Dependency: libaa.so.1 for package: vlc-2.0.10-1.el6.i686     --> Running transaction check     ---> Package aalib-libs.i686 0:1.4.0-0.18.rc5.el6.1 will be installed     ---> Package kde-filesystem.noarch 0:4-30.1.el6 will be installed     ---> Package libcaca.i686 0:0.99-0.9.beta16.el6 will be installed     --> Processing Dependency: libglut.so.3 for package: libcaca-0.99-0.9.beta16.el6.i686     ---> Package vlc-core.i686 0:2.0.10-1.el6 will be installed     --> Processing Dependency: live555date(x86-32) = 2012.04.27 for package: vlc-core-2.0.10-1.el6.i686     --> Processing Dependency: libx264.so.120 for package: vlc-core-2.0.10-1.el6.i686     Package x264-libs is obsoleted by x264, but obsoleting package does not provide for requirements     --> Processing Dependency: libavformat.so.53(LIBAVFORMAT_53) for package: vlc-core-2.0.10-1.el6.i686     Package ffmpeg-libs is obsoleted by ffmpeg, but obsoleting package does not provide for requirements     --> Processing Dependency: libtiger.so.5 for package: vlc-core-2.0.10-1.el6.i686     --> Processing Dependency: libzvbi.so.0 for package: vlc-core-2.0.10-1.el6.i686     --> Processing Dependency: libavcodec.so.53 for package: vlc-core-2.0.10-1.el6.i686     Package ffmpeg-libs is obsoleted by ffmpeg, but obsoleting package does not provide for requirements     --> Processing Dependency: libavutil.so.51 for package: vlc-core-2.0.10-1.el6.i686     --> Processing Dependency: libgme.so.0 for package: vlc-core-2.0.10-1.el6.i686     --> Processing Dependency: libavformat.so.53 for package: vlc-core-2.0.10-1.el6.i686     --> Processing Dependency: libavutil.so.51(LIBAVUTIL_51) for package: vlc-core-2.0.10-1.el6.i686     --> Processing Dependency: libavcodec.so.53(LIBAVCODEC_53) for package: vlc-core-2.0.10-1.el6.i686     --> Running transaction check     ---> Package freeglut.i686 0:2.6.0-1.el6 will be installed     ---> Package game-music-emu.i686 0:0.5.5-1.el6 will be installed     ---> Package libavcodec53.i686 0:0.10.9-58.el6 will be installed     --> Processing Dependency: libxavs.so.1 for package: libavcodec53-0.10.9-58.el6.i686     --> Processing Dependency: libx264.so.136 for package: libavcodec53-0.10.9-58.el6.i686     ---> Package libavformat53.i686 0:0.10.9-58.el6 will be installed     ---> Package libavutil51.i686 0:1.0.8-58.el6 will be installed     ---> Package libtiger.i686 0:0.3.4-1.el6 will be installed     ---> Package live555.i686 0:0-0.34.2012.01.25.el6 will be updated     ---> Package live555.i686 0:0-0.37.2012.04.27.el6 will be an update     ---> Package vlc-core.i686 0:2.0.10-1.el6 will be installed     --> Processing Dependency: libx264.so.120 for package: vlc-core-2.0.10-1.el6.i686     Package x264-libs is obsoleted by x264, but obsoleting package does not provide for requirements     ---> Package zvbi.i686 0:0.2.33-6.el6 will be installed     --> Running transaction check     ---> Package libx264_136.i686 0:0.136-19_20130917.2245.el6 will be installed     ---> Package libxavs1.i686 0:0.1.51-2.el6 will be installed     ---> Package vlc-core.i686 0:2.0.10-1.el6 will be installed     --> Processing Dependency: libx264.so.120 for package: vlc-core-2.0.10-1.el6.i686     Package x264-libs is obsoleted by x264, but obsoleting package does not provide for requirements     --> Finished Dependency Resolution     Error: Package: vlc-core-2.0.10-1.el6.i686 (rpmfusion-free-updates)                Requires: libavformat.so.53(LIBAVFORMAT_53)                Available: ffmpeg-libs-0.10.9-1.el6.i686 (rpmfusion-free-updates)                    libavformat.so.53(LIBAVFORMAT_53)                Available: ffmpeg-libs-0.10.11-1.el6.i686 (rpmfusion-free-updates)                    libavformat.so.53(LIBAVFORMAT_53)                Available: libavformat53-0.8.15-55.el6.i686 (atrpms)                    libavformat.so.53(LIBAVFORMAT_53)                Available: libavformat53-0.9.3-56.el6.i686 (atrpms)                    libavformat.so.53(LIBAVFORMAT_53)                Available: libavformat53-0.10.9-58.el6.i686 (atrpms)                    libavformat.so.53(LIBAVFORMAT_53)                Available: ffmpeg-libs-0.6.5-2.el6.i686 (linuxtech-release)                    Not found     Error: Package: vlc-core-2.0.10-1.el6.i686 (rpmfusion-free-updates)                Requires: libavcodec.so.53                Available: ffmpeg-libs-0.10.9-1.el6.i686 (rpmfusion-free-updates)                    libavcodec.so.53                Available: ffmpeg-libs-0.10.11-1.el6.i686 (rpmfusion-free-updates)                    libavcodec.so.53                Available: libavcodec53-0.8.15-55.el6.i686 (atrpms)                    libavcodec.so.53                Available: libavcodec53-0.9.3-56.el6.i686 (atrpms)                    libavcodec.so.53                Available: libavcodec53-0.10.9-58.el6.i686 (atrpms)                    libavcodec.so.53                Available: ffmpeg-libs-0.6.5-2.el6.i686 (linuxtech-release)                    Not found     Error: Package: vlc-core-2.0.10-1.el6.i686 (rpmfusion-free-updates)                Requires: libx264.so.120                Available: libx264_120-0.120-0.20120424.1.el6.i686 (linuxtech-release)                    libx264.so.120                Available: x264-libs-0.120-4.20120303.el6_bootstrap.i686 (rpmfusion-free-updates)                    libx264.so.120                Available: x264-libs-0.120-5.20120303.el6.i686 (rpmfusion-free-updates)                    libx264.so.120      You could try using --skip-broken to work around the problem      You could try running: rpm -Va --nofiles --nodigest      I don't know why I am getting this error. In my knowledge, if there are any dependencies, then package manager should find and install them too. Can anybody tell me whats wrong with yum? Please help!


title: Pattern matching from the input arguments

text: we're trying to enhance the scripts. Users will pass some arguments and part of the arguments will have 5.0.3 For an example the input argument would be like Jboss5.0.3GA. Since it ( Jboss5.0.3GA ) has "5.0.3" we'll try to locate the installation binary file "Jboss5.0.3GA.tar". The current script we've now is a KSH script. I'm trying to use `if` condition with `ksh` script Sample usecases/test:               ./test.sh Jboss5.0.3GA     Match found... we'll try to locate the installation binary     ./test.sh Jboss5.0.3     Match found... we'll try to locate the installation binary     ./test.sh 5.0.3     Match found... we'll try to locate the installation binary     ./test.sh Jboss5.1.3     No Match found ... we'll be exiting teh script.


title: Ksh Script to ftp multiple directories simultaneously

text: I'm new to this site and i have this problem: I have a directory in unix with multiple directories in it. Each directory have around 5k files in it. So we are talking about 40k to 50k files. I need to send this over to a windows server, using FTP ( only because i only have FTP ). So, i have a script that,loops thru each directory and sent this files. However, this is painful slow, so i want to do it simultaneously. This is what i have right now, it start to send this files and then somehow never finishes. Log just show it was working with a 221 message in the end. However, this doesn't guarantee that all my files are sent. I do a manual count on them and can see that sometimes, when a folder have 5000 files sometimes just 800 are sent. Log doesn't shoow way. Also my script keep running long after the transfer stops. i can see it by using ps -ef. Can someone take a look and advise any improvement or why im getting this weird behavior ? Some info on my setup:   * HP-UX 9000/859 B.10.20 E   * Ksh version : How ? tried --version , echo $KSH_VERSION ,swlist, nothing worked My Script :               #! /usr/bin/ksh          if [[ $# -eq 0 ]]; then       print "No arguments, Please enter password for ftp process"       exit     fi          exec 4>~/ftpParallel.log          #Directory to send     CONVERTED_DIR=/data/history/     #FTP Variables     HOST=xxxxx.com     PORT=8009     USER=yyyyy     PASS=$1          ftpFiles(){         #   Do some processing and lets get the group and the dategroup, Format will be#    /DATA/BRCPCB/201101         GROUP=$1         DATEGROUP=$2         #now mount the destdir based on the curent dir         DESTDIR=/DATA/$GROUP         cd $CONVERTED_DIR/$GROUP/$DATEGROUP         i=0         ftp -nv >&4 2>&4 |&         print -p open $HOST $PORT         print -p user $USER $PASS         print -p mkdir $DESTDIR         print -p mkdir $DESTDIR/$DATEGROUP         print -p cd $DESTDIR/$DATEGROUP         ls | while read filename ; do           [[ -f $filename ]] && print -p put $filename           (( i += 1 ))         done         print -p close         print -p bye         print -p "$DATEGROUP send $i files"     }          #Get All Folders structure, we will need it to iterate and search for PeakPro Files Later     a=`find $CONVERTED_DIR -type d  2>/dev/null | awk 'BEGIN{FS="/"}{if($NF ~/^[0-9]{6}$/)print $(NF-1),$NF}'`      echo "$a" | while read item ; do        ftpFiles $item & #this will make the function be called in background     done     wait     exit 0      * * * **UPDATE** : I've changed the code as requested and found new interesting things. It appears that my FTP jobs keep running, even after they stopped: This are the FTP logs :               $ tail -5 ftpParallel200103.log     150 Opening ASCII mode data connection for C31905.CVFS.     226 Transfer complete.     15931 bytes sent in 0.01 seconds (2117.55 Kbytes/s)     200 PORT command successful.     150 Opening ASCII mode data connection for C31905.RVFS.     $ tail -5 ftpParallel200104.log     200 PORT command successful.     150 Opening ASCII mode data connection for WG4829.RVFS.     226 Transfer complete.     12110 bytes sent in 0.01 seconds (1011.91 Kbytes/s)     221       $ tail -5 ftpParallel200105.log     150 Opening ASCII mode data connection for C51047.CVFS.     226 Transfer complete.     159734 bytes sent in 0.15 seconds (1027.98 Kbytes/s)     200 PORT command successful.     150 Opening ASCII mode data connection for C51047.RVFS.     $      As you can see, only 1 of them finished ( Code 221 - FTP BYE ). Others never finished and job keep running ( i've started it using `nohup ftpParallel.sh &` ) :                rcsanto  8314  8299  5 10:15:27 ttyq6     0:00 ps -ef      rcsanto 25834 25833  0 05:35:00 ?         0:00 ls      rcsanto 25828 25826  0 05:35:00 ?         0:00 ls      rcsanto 25813 25808  0 05:35:00 ?         0:27 ftp -nv      rcsanto 25815 25808  0 05:35:00 ?         0:19 ftp -nv      rcsanto 25833 25816  0 05:35:00 ?         0:01 ftpParallel.sh ./ftpParallel.sh roJabSuP08WJjco      rcsanto  8299  8298  0 10:15:15 ttyq6     0:00 -sh      rcsanto  8315  8299  1 10:15:27 ttyq6     0:00 grep rcsanto      rcsanto 25808     1  0 05:34:46 ?         0:00 ftpParallel.sh ./ftpParallel.sh roJabSuP08WJjco      rcsanto 25826 25815  0 05:35:00 ?         0:02 ftpParallel.sh ./ftpParallel.sh roJabSuP08WJjco      rcsanto 25816 25808  0 05:35:00 ?         0:08 ftp -nv      rcsanto 25825 25813  0 05:35:00 ?         0:02 ftpParallel.sh ./ftpParallel.sh roJabSuP08WJjco      rcsanto 25827 25825  0 05:35:00 ?         0:00 ls      This is the nohup LOG :               FTP starting at: Tue Feb  5 04:51:48 CST 2013        rm: /homrm: /homrm: /homrm: /homrm: /homrm: /home/rcsante/rcsante/rcsante/rcsante/rcsante/rcsanto/ftpParo/ftpParo/ftpParo/ftpParo/ft         allel200allel200104.log non-existent         107.log non-exi106.log304.log non-existent          non-existent          stent          non-existent      I believe the variables are being messed up somehow. IT also appears that the FTP dies within an hour of running, maybe its timming out ??               -rw-rw-rw-   1 rcsanto    pp_user     249853 Feb  5 05:51 ftpParallel200103.log     -rw-rw-rw-   1 rcsanto    pp_user     937693 Feb  5 06:22 ftpParallel200104.log     -rw-rw-rw-   1 rcsanto    pp_user     172395 Feb  5 05:47 ftpParallel200105.log     -rw-rw-rw-   1 rcsanto    pp_user      88497 Feb  5 05:41 ftpParallel200106.log     -rw-rw-rw-   1 rcsanto    pp_user     981598 Feb  5 06:24 ftpParallel200107.log     -rw-rw-rw-   1 rcsanto    pp_user     819814 Feb  5 06:21 ftpParallel200304.log      Thanks for all your help.


title: How to display data in columns in two variables with the same format?

text: I coded the following to display data formatted in columns:               str1='hello i      am robert     and your ma frnd'          str2='thisisaverylongword thisistoohehehe andherefinishthe         string     hereis a other linefortheexample'          IFS=$'\n'     echo '----------------------'     echo 'STRING SHORT'     echo '----------------------'     echo "$str1" | column -t     echo     echo '----------------------'     echo 'STRING LONG'     echo '----------------------'     echo "$str2" | column -t      Which outputs:               ----------------------     STRING SHORT     ----------------------     hello  i     am  robert     and    your  ma  frnd          ----------------------     STRING LONG     ----------------------     thisisaverylongword  thisistoohehehe  andherefinishthe  string     hereis               a                other             linefortheexample      Ok, now I'm trying to format the string with the same pattern, but without merge them. This is the result I'm looking for:               ----------------------     STRING SHORT     ----------------------     hello                i                am                robert     and                  your             ma                frnd          ----------------------     STRING LONG     ----------------------     thisisaverylongword  thisistoohehehe  andherefinishthe  string     hereis               a                other             linefortheexample      Do you have any idea to do it? May be merging the strings and splitting it before the format? Note that this is only an example, I'm looking for a generic solution, not only for this specific case.


title: KVM: network partially lost for the host, guests are fine

text: I got KVM working fine on a Linux system, for quite some weeks. Then today something weird happened: suddenly the host (and the host only) lost some of its Internet access:   * it can still access the LAN (I can ssh to other machines)   * it can still access the guests (for example I can ssh from the host into a Linux guest)   * the forwarding still works (other physical machines on the LAN still have Internet access, yet their using the KVM host as the 'forwarder') But I didn't touch any configuration file. I was just browsing / using the guests. I tried to _ifconfig down br0_ and then _ifconfig up br0_ and reset the route, but to not avail. Does anyone have any idea as to what's going up? It's my main workstation and it has 2 months of uptime: I don't like rebooting so I'd rather not have to do it (moreover it would just show that the machine ain't stable enough). **EDIT** : I add here more details/answers hoping you guys can help me out a bit Meanwhile I decided to do a shutdown and bring the machine back up and now everything is working fine again but still... I'd like to know if I could solve this the next time it happens without needing to shutdown the host. > do your VMs us a 'public bridge' networking method? (ie: bridged to local > lan) Yes I think so: I use _br0_ and both the host and the VMs have IPs that are 10.0.0.x which is the same as other physical machines on my LAN > is your host interface wired or wireless? All wired, no WiFi at all at my home : ) > is your default gateway a commodity "router" such as you get from Verizon or > Comcast? It's a Zyxel that I setup myself (I didn't try rebooting it) > if you reboot one of the VMs, does it receive a full network configuration, > and is it still capable of reaching the internet, even when the host OS is > not? Yes. That was the "crazy" part. It's as if the host's IP had an issue but the "bridging" kept working fine: I did reboot both VMs and they did both get back network access. I didn't _netstat -rn_ because I had already rebooted the machine but I will next time there's an issue (and compare to a known ok _netstat -rn_ that I now took).


title: Resolving Debian wireless issue

text: I typically dual boot my laptop betwen a Win7 and Ubuntu partition, but keep a spare partition for playing around with new distros. Earlier this week, I decided to try out Debian Squeeze. For the most part, the install has gone smoothly. However, the wireless is not working, and this is apparently a well known issue for Debian. The thing is, my wireless card apparently requires the iwlagn firmware iwlwifi-5000-5.ucode. I downloaded the updated 0.33 package that supposedly includes this firmware and installed it using the package manager. It still isn't working, as `dmesg | grep firmware` returns 'looking for firmware v5, found v0' This laptop is over 2 years old and I have zero problems with networking in Ubuntu Maverick. Any solutions?


title: Reinstall Fedora, keep files?

text: Is it possible to reinstall Fedora (I have the DVD that I used to install it yesterday), and keep the files in my home directory? I seem to have messed up my system while trying to get my monitor resolution to work correctly: Installed Fedora in dual boot Windows desktop. Now I can't get full monitor resolution. The step that caused my problem was `yum --enablerepo=rawhide upgrade kernel xorg-x11-drv-ati xorg-x11-drv-ati-firmware`, so I'm looking to either figure out how to get fedora to boot, or just reinstall fedora, but keep the files I've set up so far.


title: Is there any chance that some of these processes are malicious?

text: My significant other and I are sometimes paranoid that a foreign government usually associated with last year's Gmail security breach may be attempting to gain access to our computers. There were a lot of strange processes running as root tonight, though I have not opened any root terminals. Can someone please look at these and tell me, yes or no, are they suspicious, and why or why not?               PID TTY          TIME CMD         1 ?        00:00:01 init         2 ?        00:00:00 kthreadd         3 ?        00:00:01 ksoftirqd/0         6 ?        00:00:00 migration/0         7 ?        00:00:00 watchdog/0        13 ?        00:00:00 cpuset        14 ?        00:00:00 khelper        15 ?        00:00:00 netns        16 ?        00:00:00 sync_supers        17 ?        00:00:00 bdi-default        18 ?        00:00:00 kintegrityd        19 ?        00:00:00 kblockd        20 ?        00:00:00 kacpid        21 ?        00:00:00 kacpi_notify        22 ?        00:00:00 kacpi_hotplug        23 ?        00:00:00 kseriod        25 ?        00:00:00 kondemand        26 ?        00:00:00 khungtaskd        27 ?        00:00:03 kswapd0        28 ?        00:00:00 ksmd        29 ?        00:00:00 fsnotify_mark        30 ?        00:00:00 aio        31 ?        00:00:00 crypto       163 ?        00:00:00 khubd       164 ?        00:00:00 ata_sff       165 ?        00:00:00 scsi_eh_0       166 ?        00:00:00 scsi_eh_1       199 ?        00:00:00 usbhid_resumer       222 ?        00:00:00 kjournald       271 ?        00:00:00 udevd       442 ?        00:00:00 kpsmoused       446 ?        00:00:36 net.agent       450 ?        00:00:00 cfg80211       471 ?        00:00:00 hd-audio0       532 ?        00:00:36 net.agent       751 ?        00:00:02 kjournald       755 ?        00:00:00 kjournald       756 ?        00:00:00 kjournald       757 ?        00:00:01 kjournald       801 ?        00:00:00 flush-8:0      1035 ?        00:00:00 rsyslogd      1089 ?        00:00:00 modem-manager      1094 ?        00:00:01 polkitd      1114 ?        00:00:02 wpa_supplicant      1126 ?        00:00:00 gdm3      1137 ?        00:00:00 gdm-simple-slav      1141 tty7     00:20:11 Xorg      1146 ?        00:00:07 acpid      1169 ?        00:00:00 atd      1195 ?        00:00:00 bluetoothd      1209 ?        00:00:00 l2cap      1212 ?        00:00:00 krfcommd      1273 ?        00:00:00 cron      1303 ?        00:00:00 cupsd      1597 ?        00:00:07 kerneloops      1627 ?        00:00:00 kconservative      1631 ?        00:00:00 console-kit-dae      1771 ?        00:00:00 sshd      1800 tty1     00:00:00 getty      1801 tty2     00:00:00 getty      1802 tty3     00:00:00 getty      1803 tty4     00:00:00 getty      1804 tty5     00:00:00 getty      1805 tty6     00:00:00 getty      1852 ?        00:00:00 gdm-session-wor      1857 ?        00:00:15 upowerd      2017 ?        00:00:00 kauditd      2172 ?        00:00:02 udisks-daemon      2176 ?        00:00:00 udisks-daemon      3038 ?        00:00:00 udevd      3039 ?        00:00:00 udevd      3251 ?        00:00:00 NetworkManager      3440 ?        00:00:00 dhclient      5322 ?        00:00:00 kworker/u:2      6717 ?        00:00:00 sleep      6720 ?        00:00:00 sleep     13386 ?        00:00:00 kworker/1:2     21237 ?        00:00:02 kworker/0:2     24297 ?        00:00:11 kworker/1:1     27326 ?        00:00:02 kworker/0:1     29045 ?        00:00:01 kworker/u:0     30132 ?        00:00:00 migration/1     30134 ?        00:00:00 ksoftirqd/1     30135 ?        00:00:00 watchdog/1     30238 ?        00:00:48 irq/19-0000:01:     31245 ?        00:00:00 kworker/u:1


title: How can I configure SELinux when the semanage command isn't found?

text: I'm having a very hard time configuring SELinux to allow Sending mail. Looking into selinux documentation I've found I can manage ports via the semanage command, but the command can't be found. Is there another way to manage ports using SELinux, or a way for me to find this command? Worst case: Is there a way to disable selinux, or switch to permissive mode without rebooting? I'm running Fedora. Thanks!


title: How to print to the left and right of already printed output

text: I have a command say `printf "%5s1"` and its output is:                   1      How can I print digit `2` to left and digit `3` to right of already printed `1`. So, the output looks like below:                  213      So, there is one condition here that `1` is already printed using command `printf "%5s1"`. I've tried using below command,                printf "%5s1";printf "\r%4s2%1s3\n"      but this overwrites the existing output `1` and I get below output.                  2 3      How can I print a digit right side of already printed digit `1` using `printf` without loosing it assuming that I have to use `printf "%5s1"` first? I'm looking for something like:               printf "%5s1";printf "\r%4s2???\n"


title: How do I limit the number of files printed by ls?

text: Is there a way to limit the quantity of listed files on a `ls` command? I've seen:               ls | head -4      but to get `head` to be executed I need to wait for `ls` to finish execution, and with directories with an enourmous quantity of files that can take considerable time. I wish to execute a `ls` command that limits without using that `head` command.


title: Concatenate two screen sessions

text: Because of some server issues I ended up with two _screen_ sessions, each with a few windows. I have long-running tasks in both sessions and don’t want to abort one of them just to get rid of one of the screen sessions. Is it possible to concatenate screen sessions so that I end up with a single screen session that contains all windows from both sessions? Or is is possible to manually transfer individual windows from one screen session to another one?


title: Is there a way to determine what's inhibiting the screensaver?

text: I have an issue where most often my screensaver will not activate and it's somewhat hard to determine what's preventing it. Is there a way that I can view whatever processes are asking the OS not to display the screensaver? I'm on Linux Mint 11.


title: How can I pass module parameters for bonding driver when compiled into kernel 2.4?

text: I have an old 2.4 kernel based linux device using NIC Bonding. Instead of having the NIC Bonding module build as a module and `modprobe`'ed into the system, its compiled directly into the kernel. I'd like to modify the module parameters to add `mode=1 miimon=100` in order to get it to not use round- robbin packet sending, but all of the examples I'm finding seem to assume the module is not compiled into the kernel, or just don't seem to work for me. So far I've tried modifying my `/etc/modules.conf` file to try adding               alias bond0 bonding     options bond0 mode=1 miimon=100     options bonding mode=1 miimon=100      Based on something else I found on line I've tried adding bond0.mode=1 and bonding.mode=1 to my kernel commandline in grub, but regardless, when I boot up and check 'cat /proc/net/bonding/bond0' I always see staring back at me this line:               Bonding Mode: load balancing (round-robin)      I've tried looking for a setting to change in `sysctl` or `/proc` but am coming up empty.


title: 'watch'-ing curl yields unexpected output

text: I'm trying to `watch curl` for live feedback on HTTP tweaks. However, when I execute the command, the output is garbled with some download stats. I've tried sending `curl`'s `stderr` to `/dev/null`, to no avail. When playing with `curl` on it's own, this output seems nowhere to be found. What am I missing? [edit] the full command line I'm running is actually `watch --color -d "curl -I sandbox.dev | ccze"`, because I want colorized output. It seems that if I remove the `ccze` pipe things are a little better, altough the download stats are still there.


title: Is Mandatory Access Control overkill for a desktop/lightweight server?

text: I have fiddled around with both SELinux and Apparmor recently and found these tools invaluable for preventing a spread of damage from a compromised context via one process, whereby and attacker could exploit a buffer overflow or underflow, eventually pushing a new return address on the local call stack, which if I am correct can lead to exec() calls or even a root shell via say, su - Learning Unix & Linux is very interesting to me, and I want some of the more seasonsed people here to please offer me some basic reflection on this topic. Are these tools really overkill for a desktop or non government secure/business context, whereby a serious say, rootkit intrusion can be detected by analyzing the integrity of the System.map file for any rogue entries, and checking of package integrity etc. Say, a remote intrustion on these systems isn't a massive deal following cleanup, so prevention via MAC is overkill? No system is perfect, but would I be correct in making the assumption that on a basic desktop system, passwordless key based logins/swipe card and disabling remote logins via ssh etc, not to mention patching the system and disabling root work on any console, virtual or similar, except for console tty1, which is physically isolated from rogue user programs like firefox, would this setup be "ok" for most intents and purposes, or should MAC reside on ALL systems? Keep in mind most Linux distributions out there DO NOT offer MAC as a default. Fedora and CentOS/RedHat appear to be the only two well known ones to offer out of the box MAC.Thanks:)


title: How can I use Skype with lxc?

text: Under Scientific-linux? https://en.wikipedia.org/wiki/LXC I just want to separate Skype, because I don't trust it. We are using it only to call/chat with people, no file transfers!


title: Communicate between Ubuntu VM and Windows host

text: I'm running an Ubuntu VM on a Windows 7 host. I have two questions:   1. I think that on Windows, `localhost` is a loopback address, and sending packets to it doesn't actually transmit any data on the wire. Is that correct? On the Ubuntu VM I have a `localhost` as well, pointing to `127.0.0.1`. Is it the same thing?   2. Is it possible to send data from the VM to the host? For example, when I install software on the Ubuntu VM, can I have it send a message to the Windows host? What IP should I use?


title: Abbreviated current directory in shell prompt?

text: `vim` has a really nice feature which it utilizes in its paths when they're a bit long: ![enter image description here](http://i.stack.imgur.com/ZCK6V.png) It abbreviates the path to the document in the tab at the top. Is there a way to do something similar to this so my bash prompt doesn't look like this:               rfkrocktk@work-laptop ~/Documents/Projects/Work/maventest/src/main/java/com/tkassembled/ $


title: Using cygwin and rsync -- "password file must not be other-accessible"

text: I've finally got an old computer of mine running as a backup server with Ubuntu 11.10. I'm planning on using it to backup my Windows 7 machine weekly using rsync. I've got cygwin installed, and rsync works perfectly. I'm following this guide, though, to create it as a scheduled task: http://justinsomnia.org/2007/02/how-to-regularly-backup-windows-xp-to-ubuntu- using-rsync/ I have an rsync.bat script in C:\, and I can get the script to run correctly if I run it directly from the command line in Cygwin. However, when I try to run the rsync.bat script, I get this:               ERROR: password file must not be other-accessible      So it must be permissions issues on the secret file...I followed that guide and set the permissions to 600, and chowned it to Nate[the administrator]:SYSTEM. Any ideas on what might be causing the problem? EDIT: The file in question is actually on the Windows 7 machine. I figured I should ask here, since I'm dealing specifically with Cygwin and Rsync. After some googling, I found that there is a "strict modes" option that tells rsync not to check the permissions on the secret files, and that was added to accomodate Windows systems. However, after adding it and restarting the rsyn daemon, I still seem to be getting the same error. Here's my rysncd.conf file:               [rsync]          path = /home/nate/backups     comment = My backups     uid = nate     gid = nate     read only = false     auth users = nate     secrets file = /etc/rsyncd.secrets     strict modes = false      And the permissions on the secrets file, according to cygwin:               -rw-------  1 Nate SYSTEM   11 Dec  9 18:48 secret      I feel like I must be missing something really obvious.


Mailman, mlmmj and probably other Mailinglist-Software support the feature 'no mail delivery subscription'. Meaning that you can subscribe and then disable mail delivery. This useful for times you are at vacation or when you want to read that list via gmane.org or a similar service. I can't find anything about majordomo, regarding this feature. Thus my question: Does majordomo support 'no mail delivery subscription'?


title: block device usage and several mount points

text: There is some weird thing I don't understand: I have 2G block.img file with an ext4 filesystem inside. There is a 2G test.txt file in block.img. test.txt consists of letters 'a'. Then I mount block.img to /mnt/first. And I can see this test.txt with letters 'a' inside. All is fine. Weird thing begins here: simultaneously I mount block.img on /mnt/second and change all 'a' to 'b' in this text file. And I can see two different 2G files. I have two files 2G (4G used space) on one 2G partition! Unbelievable (: Therefore, there is some mistake in my words, unfortunately I can't find it.


title: BackupPC can't finish backup

text: I'm trying to backup /etc/ directory on CentOS 5.2 using BackupPC. It takes several hours and then aborted by signal ALRM. There is a partial backup created with all data from /etc But BackupPC thinks the backup is failed and always starts doing full backup again. If I try to run rsync manually from the backup server it works flawlessly and finishes in about 5-10 seconds. I have additional server with several GB of data I'm backing up and it works without a problem.


title: Sharing Ubuntu drives with Windows

text: I'm new to the whole Linux thing. I have a Linux server up and running and have been using this guide as a help. I have an issue with shared drives. My Windows machines can see them but cant write to them says I don't have permission. I'm completely lost. Can anyone help? Let me know if I should post Samba configs. I'm running Windows XP, 7 and 8 and Ubuntu server.


title: OpenVPN static key ip meaning/order?

text: I'm following this tutorial. What do the IPs mean after the `ifconfig` here?               dev tun0     ifconfig 10.9.8.1 10.9.8.2     secret /etc/openvpn/static.key      Can I use external IPs (assuming I'm configuring this on a vps/dedicated server)?


title: Setting timezones

text: I want to set my timezone to America/New_York. date says that the current time is CEST. I'm using systemd, no desktop environment. Right now I have               /etc/localtime links to /usr/share/zoneinfo/America/New_York     /etc/timezone set to "America/New_York"     /etc/rc.conf set to "America/New_York" (arch linux should be ignored by systemd)     $TZ is unset      Hardware clock is set to utc time and works fine.               TZ=utc date      gives the right output. Unfortunately I'm still on CEST. Am I missing something?


title: How to install program locally without sudo privileges?

text: Assume I have ssh access to some Ubuntu server as user and I need some not system tools to be installed for convenience (mc, rtorrent, mcedit). I do not want to bother admins for these small programs. Is there a way to install them (make them run) without using something like `sudo apt-get install`?


title: Installing dependencies as a non root user

text: Can anyone please tell what are the steps to installing libxml2 on a server without root privileges? In a manner so it can be seen by other packages? I have installed it but do not know what is the correct location for it and what variable should be set to make it visible. Please help! I have to install a large number of dependencies and I am stuck at the first step!


title: How to compile programs on Linux systems when I don't have sudo privileges to install the dev dependencies

text: How should I go about compiling programs that depend on libraries whose development packages (headers and such) aren't pre-installed on the system when I don't have sudo access? In this particular case I have Ubuntu 12.04, but I'm hoping for a more general solution, because it seems bizarre to me that I would need administrator privileges just to install the dev packages so I can compile.


title: Make polipo to log all urls

text: i'm using polipo (proxy server) for local caching. is there a way to log all access through polipo just like urlsnarf or other web server log file do?               logFile = "/tmp/access.log"     logLevel = ? # what should i fill to log all url?      and if possible, get cached file location also output for 0xFF is something like this, it does not always show the requested url:               Couldn't parse last-modified: Sat, 23 Feb 2013 16:25:16 +0100     Uncacheable object http://nekovm.org/_media/neko-2.0.0.tar.gz (2120)     Superseding object: http://nekovm.org/_media/neko-2.0.0.tar.gz (200 425539 -1 (none) -> 200 425539 -1 (none))     Unsupported Cache-Control directive post-check -- ignored.     Unsupported Cache-Control directive pre-check -- ignored.     Couldn't parse last-modified: Sat, 23 Feb 2013 16:25:16 +0100     Uncacheable object http://nekovm.org/_media/neko-2.0.0.tar.gz (2120)     Superseding object: http://nekovm.org/_media/neko-2.0.0.tar.gz (200 425539 -1 (none) -> 200 425539 -1 (none))     Vary header present (Accept-Encoding).     Vary header present (Accept-Encoding).     Vary header present (Accept-Encoding).     Superseding object: http://opalrb.org/opal-parser.js (206 709851 1363984598 (none) -> 206 709851 1363984598 (none))     Vary header present (Accept-Encoding).     Superseding object: http://opalrb.org/opal-parser.js (200 709851 1363984598 (none) -> 200 709851 1363984598 (none))     Vary header present (Accept-Encoding).     Superseding object: http://opalrb.org/opal-parser.js (200 709851 1363984598 (none) -> 200 709851 1363984598 (none))     Vary header present (Accept-Encoding).     Superseding object: http://opalrb.org/opal-parser.js (200 709851 1363984598 (none) -> 200 709851 1363984598 (none))     Vary header present (Accept-Encoding).     Superseding object: http://opalrb.org/opal-parser.js (200 709851 1363984598 (none) -> 200 709851 1363984598 (none))     Vary header present (Accept-Encoding).     Vary header present (Accept-Encoding).     Vary header present (Accept-Encoding).     Uncacheable object http://www.youtube.com/?hl=en&gl=US (2050)


title: Is it better to pass all files to mv or to run a bunch of mv processes in parallel?

text: I have three ways of running `mv`. First:               mv /db/dbfile1 /db/dbfile2 /db/dbfile3  /usb_storage/      and second:               mv /db/dbfile1  /usb_storage/ &     mv /db/dbfile2  /usb_storage/ &     mv /db/dbfile3  /usb_storage/ &      third (I think first and this is same ?)               mv /db/dbfile1  /usb_storage/      mv /db/dbfile2  /usb_storage/      mv /db/dbfile3  /usb_storage/       Which of these methods is better? Why?


title: How do I set up raid0 using extra two drives (not the install drive)?

text: I have been looking around online for a suitable tutorial to help me set up a raid0 across two (or more) drives, but not moving the actual installation of Mint onto that raid setup (I have that on a different single drive ). A coworker had pointed me to this tutorial, and I could not make heads nor tails of it. Can anyone give me a walkthrough (or pointer to one) for how to do this?


title: Intel Graphics Driver for Mint Linux

text: Though Mint 14 is based on Ubuntu 12.10 I get the following error when running the Intel Driver Manager under Mint:               diagnostics-view.c/diagnostics_view_start: Running diagnostic Checking distribution...     main-window.c/on_diagnostics_finished: Diagnostics finished with an error      Yes, I am using the correct 64 bit edition for my install By the way, I am using a **VIZIO CT15-A5 15.6-Inch Thin + Light Ultrabook with the Intel HD 4000 graphics processor** and at present my System information says the following for display:               Display     Display     Resolution  1920x1080 pixels     Vendor  The X.Org Foundation     Version 1.13.0     Monitors     Monitor 0   1920x1080 pixels     Extensions     BIG-REQUESTS         Composite        DAMAGE       DOUBLE-BUFFER        DPMS         DRI2         GLX      Generic Event Extension      MIT-SCREEN-SAVER         MIT-SHM      RANDR        RECORD       RENDER       SECURITY         SGI-GLX      SHAPE        SYNC         X-Resource       XC-MISC      XFIXES       XFree86-DGA      XFree86-VidModeExtension         XINERAMA         XInputExtension      XKEYBOARD        XTEST        XVideo       XVideo-MotionCompensation         OpenGL               Vendor  Intel Open Source Technology Center     Renderer    Mesa DRI Intel(R) Ivybridge Mobile     Version 3.0 Mesa 9.0.3     Direct Rendering    Yes      Here is the output of inxi -Gx               funkdified@vizio ~ $ inxi -Gx     Graphics:  Card: Intel 3rd Gen Core processor Graphics Controller bus-ID: 00:02.0                 X.Org: 1.13.0 drivers: intel (unloaded: fbdev,vesa) Resolution: 1920x1080@60.0hz                 GLX Renderer: Mesa DRI Intel Ivybridge Mobile GLX Version: 3.0 Mesa 9.0.3 Direct Rendering: Yes


title: Why is my unmounted USB disk still seen by `fdisk`?

text: I've mounted my USB disk to `/mnt/kingston/` dir, and umounted it from there by typing in `umount /mnt/kingston/`. But I can still see my USB disk after issuing the `fdisk -l` command. Why? If I type in `umount /mnt/kingston` again, it shows: `umount: /mnt/kingston; not mounted`.


title: Open VirtualBox GUI?

text: I've installed VirtualBox and I would like to create a VM now. I prefer to use the GUI rather than the command line interface, and I know that VirtualBox comes with such a GUI. However, I can't seem to figure out what the name of this application is.               $ dpkg -L virtualbox | grep "/usr/bin/"     /usr/bin/VBoxSDL     /usr/bin/VBoxBalloonCtrl     /usr/bin/VBoxManage     /usr/bin/vboxheadless     /usr/bin/VBoxHeadless     /usr/bin/vboxmanage     /usr/bin/vboxballoonctrl     /usr/bin/vboxsdl     /usr/bin/vboxwebsrv      None of these applications actually start a GUI. How do I start the virtualbox GUI?


title: How do I resolve the garbled sound in Debian?

text: I just recently installed Debian 7 Wheezy with KDE and once I turn on the computer, the start-up sound is garbled. The closest description I can think of is that the sound coming out is somehow overlapped with a "dial-up modem"-like sound (here's a sample of what a dial-up modem sounds like, in case you don't know or have forgotten). What's curious is that once I change the volume two to three notches up using the global volume control (or even the VLC volume control), the sound somehow becomes fine. But when I pause a movie and resume play, the sound becomes garbled again and I need to re-adjust the volume just to make the sound fine again. I haven't encountered this issue with Ubuntu 12.04 LTS or Linux Mint 13 XFCE (I used these on this same computer before deciding to use Debian 7 Wheezy) as both these OSes handled sound just fine so it's really becoming frustrating. `lspci -k` gives the ff. results w.r.t. audio devices:               00:01.1 Audio device: Advanced Micro Devices [AMD] nee ATI Trinity HDMI Audio Controller         Subsystem: ASUSTeK Computer Inc. Device 8526     00:14.2 Audio device: Advanced Micro Devices [AMD] FCH Azalia Controller (rev 01)         Subsystem: ASUSTeK Computer Inc. Device 841b         Kernel driver in use: snd_hda_intel      I think I am using the second audio device because I don't have anything connected to the HDMI port. I'm also guessing that system uses **pulseaudio** server to handle the sound. Could the issue be caused by the kernel driver `snd_hda_intel` since I am using an AMD chipset? My computer has an AMD A10-5800K processor on an ASUS F2A85-V PRO motherboard, in case this info is useful in someway.


title: How to set an option for a serial device?

text: On a Linux console I want to set the `onclr` option for a serial device. According to the manpage the command is               stty [-F DEVICE | --file=DEVICE] [SETTING]...      but none of the following commands were able to set the `onclr` flag for the device `/dev/ttyS0`:               stty -F /dev/ttyS0 -onclr     stty -F /dev/ttyS0  onclr     stty -F /dev/ttyS0 raw -onclr     stty -F /dev/ttyS0 raw  onclr      How to do it right?


title: How does KVM set its own netfilter rules?

text: I've been poking around with KVM VM's on Centos 6.4 and after some hair pulling and copious amounts of trying to break my desk with my head due to not having an internet connection on my VM's, I found something curious: Upon booting the machine, iptables has rules in the FORWARD chain to allow traffic through to the VM's and all is well. When I run `service iptables restart`, however, it looks like it pulls the config rules from `/etc/sysconfig/iptables` (default settings which reject all forwarding) and thus, i've been relegated to either dropping the firewall completely on the physical host or rebooting to get the FORWARD rules added so it works again. **Edit:**   Indeed, I could just modify the firewall rules myself to allow it, but isn't the focus of this question. I'm more focused on the following question #1: **My questions are:**   1) At what point (or by what mechanism) are these FORWARD rules added in?   2) How can I recover the FORWARD rules without rebooting the machine? Quite frankly, i'm not even sure where to start searching for this issue. I found this page that says to modify `/etc/sysctl.conf` with the following variables which allegedly make netfilter ignore traffic to bridged connections:               net.bridge.bridge-nf-call-ip6tables = 0     net.bridge.bridge-nf-call-iptables = 0     net.bridge.bridge-nf-call-arptables = 0      The problem with that is that my sysctl.conf is already set as such and netfilter still does its thing, happily blocking everything to the VM's.


title: Shutting down from X without a desktop environment

text: I have recently given up my Desktop Environment and am now only using a Window Manager (i3) and X. It all works very well and I do not miss much. Except for one thing: the shutdown button. I can now only shutdown by issuing: `sudo shutdown -Ph now` from a terminal. This works, but I want to create a keybinding in i3 to shutdown by clicking `Mod+x`. And I am not sure how this can be achieved. If I create a script in say `~/shutdown` and refer to this with: `bindsym $mod+x exec ~/shutdown` Then this does not work; I figure because I am running as a regular user and I am sudoing in this script. I would be fine with having a terminal appear and prompting me for the password (although I prefer this to not require a password, if possible), but am not sure how to do this. What is a way to get this done? Using Arch Linux.


title: Script that unpacks a initrd, allows editing of the preseed.cfg and the packs it to cpio and gzip again

text: I want to program a script that allows what is said in the title. So basically I gunzip the initrd, than unpack the cpio, open vi to allow editing, save, pack with cpio, and gzip again, so nothing fancy here (at least I hope that, I am not good at shell scripting). Now after gunzipping the archive the ending .gzip or .gz is left out so that I can't use $1 as the name. How should I delete the ending so that I can use a new variable foo, for further processing? This is probably not an very elegant way, but I hope it works :)               #/bin/bash     # This script should make it possible to edit the preseed file     # within a initrd gzipped cpio archive, without unpacking and packing it     # manually               mkdir temporarydirectory     # $1 will be the initrd (cpio archive which is compressed with gzip)     mv $1 temporarydirectory     cd temporarydirectory     gunzip $1     cpio -id < $1 # here is where i need to cut of the gzip ending     rm $1 # again without the gzip ending cutted of     vim preseed.cfg     find . | cpio -H newc -o > $1 # again without gzip ending     gzip $1 # here the same     mv $1 .. # here the gzip ending is used again     cd ..     rm -r temporarydirectory


title: Recover text files and directory structure from the database created by Recoll?

text: A while ago, I ran Recoll which created a database on a partition, so that I could quickly search among all the text information in the contents of all files (text file, pdf, djvu, html, etc) in that partition. Now the partition, for which the Recoll created a database, has been wiped out accidentally, but I can still search in Recoll among those deleted files, because the database of Recoll is stored in another partition that hasn't been affected.   1. When I search for a keyword among the text content of those deleted files, I can still see one or two lines surrounding that keyword as its context, It gives me some hope that it might be possible to recover the text content of each deleted file. But when I hit "Preview" or "Open" for a deleted file found by Recoll, Recoll will try to open the file that doesn't exist any longer, which of course fails. **So I wonder if I can recover the deleted text files from Recoll's database?**   2. When I search for a keyword among the text content of those deleted files, I can also see the full path to each file found, **So I wonder if I can recover the directory structure of my partition from Recoll's database?** Thanks and regards!


title: Installing rvm and a specific version of ruby using rvm on linux based systems

text: UI testing is done using ruby and selenium.   1. Installation of `rvm`   2. Installation of specific version of `ruby` and setting a default version of `ruby` **Note:** Using a linux based operating system.


title: Raspbian - Can't spoof a MAC address through HostAPD

text: I'm trying to let my Raspberry Pi function as an access point, but I keep running into some problems. Specifically when it comes to spoofing the MAC address. The purpose is to create a Nintendo 3DS streetpass hotspot at home. I'm following this guide mostly. First the things I'm using: Raspberry Pi Model B with a TP-Link TL-WN725N v2 wireless usb adapter with Realtek RTL8188EUS chipset. This one is recommended for AR purposes. Kernel running on Raspbian GNU/Linux 7 installed through NOOBS v1.3.9 (2014-07-08):               Linux raspberrypi 3.12.22+ #691 PREEMPT Wed Jun 18 18:29:58 BST 2014 armv6l GNU/Linux      `lsusb` on the wlan adapter:               Bus 001 Device 004: ID 0bda:8179 Realtek Semiconductor Corp.      I installed the driver through this guide. Running `iwlist wlan0 scan` succesfully returns a list of wireless networks. Then I moved on to installing the necessary packages. First I installed HostAPD through this guide, but running into some problems (got an the error `ioctl[RTL_IOCTL_HOSTAPD]: Invalid argument`) I tried what was suggested here. With success. After this I installed both the packages isc-dhcp-server and bridge-utils. I made a test config file for hostapd (/tmp/test.conf):               # Basic configuration          interface=wlan0     ssid=wifi     bssid=4E:53:50:4F:4F:46     channel=5     bridge=br0          # WPA and WPA2 configuration          macaddr_acl=0     auth_algs=1     ignore_broadcast_ssid=0          # Hardware configuration          driver=rtl871xdrv     ieee80211n=1     hw_mode=g     device_name=RTL8192CU     manufacturer=Realtek      After running hostapd /tmp/test.conf I'm getting the following error (part of the return):               +rtl871x_sta_deauth_ops, ff:ff:ff:ff:ff:ff is deauth, reason=2     Using interface wlan0 with hwaddr e8:94:f6:1c:4a:dd and ssid 'wifi'      It falls back to it's real MAC address. Running a debug returns the following:               root@raspberrypi:~# hostapd -dd /tmp/test.conf     random: Trying to read entropy from /dev/random     Configuration file: /tmp/test.conf     drv->ifindex=3     Configure bridge br0 for EAPOL traffic.     BSS count 1, BSSID mask a6:c7:a6:53:05:9b (0 bits)     Allowed channel: mode=1 chan=1 freq=2412 MHz max_tx_power=0 dBm     Allowed channel: mode=1 chan=2 freq=2417 MHz max_tx_power=0 dBm     Allowed channel: mode=1 chan=3 freq=2422 MHz max_tx_power=0 dBm     Allowed channel: mode=1 chan=4 freq=2427 MHz max_tx_power=0 dBm     Allowed channel: mode=1 chan=5 freq=2432 MHz max_tx_power=0 dBm     Allowed channel: mode=1 chan=6 freq=2437 MHz max_tx_power=0 dBm     Allowed channel: mode=1 chan=7 freq=2442 MHz max_tx_power=0 dBm     Allowed channel: mode=1 chan=8 freq=2447 MHz max_tx_power=0 dBm     Allowed channel: mode=1 chan=9 freq=2452 MHz max_tx_power=0 dBm     Allowed channel: mode=1 chan=10 freq=2457 MHz max_tx_power=0 dBm     Allowed channel: mode=1 chan=11 freq=2462 MHz max_tx_power=0 dBm     Allowed channel: mode=1 chan=12 freq=2467 MHz max_tx_power=0 dBm     Allowed channel: mode=1 chan=13 freq=2472 MHz max_tx_power=0 dBm     Allowed channel: mode=1 chan=14 freq=2484 MHz max_tx_power=0 dBm     Allowed channel: mode=0 chan=1 freq=2412 MHz max_tx_power=0 dBm     Allowed channel: mode=0 chan=2 freq=2417 MHz max_tx_power=0 dBm     Allowed channel: mode=0 chan=3 freq=2422 MHz max_tx_power=0 dBm     Allowed channel: mode=0 chan=4 freq=2427 MHz max_tx_power=0 dBm     Allowed channel: mode=0 chan=5 freq=2432 MHz max_tx_power=0 dBm     Allowed channel: mode=0 chan=6 freq=2437 MHz max_tx_power=0 dBm     Allowed channel: mode=0 chan=7 freq=2442 MHz max_tx_power=0 dBm     Allowed channel: mode=0 chan=8 freq=2447 MHz max_tx_power=0 dBm     Allowed channel: mode=0 chan=9 freq=2452 MHz max_tx_power=0 dBm     Allowed channel: mode=0 chan=10 freq=2457 MHz max_tx_power=0 dBm     Allowed channel: mode=0 chan=11 freq=2462 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=36 freq=5180 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=40 freq=5200 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=44 freq=5220 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=48 freq=5240 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=52 freq=5260 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=56 freq=5280 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=60 freq=5300 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=64 freq=5320 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=100 freq=5500 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=104 freq=5520 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=108 freq=5540 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=112 freq=5560 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=116 freq=5580 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=120 freq=5600 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=124 freq=5620 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=128 freq=5640 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=132 freq=5660 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=136 freq=5680 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=140 freq=5700 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=149 freq=5745 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=153 freq=5765 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=157 freq=5785 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=161 freq=5805 MHz max_tx_power=0 dBm     Allowed channel: mode=2 chan=165 freq=5825 MHz max_tx_power=0 dBm     Completing interface initialization     Mode: IEEE 802.11g  Channel: 5  Frequency: 2432 MHz     RATE[0] rate=10 flags=0x1     RATE[1] rate=20 flags=0x1     RATE[2] rate=55 flags=0x1     RATE[3] rate=110 flags=0x1     RATE[4] rate=60 flags=0x0     RATE[5] rate=90 flags=0x0     RATE[6] rate=120 flags=0x0     RATE[7] rate=180 flags=0x0     RATE[8] rate=240 flags=0x0     RATE[9] rate=360 flags=0x0     RATE[10] rate=480 flags=0x0     RATE[11] rate=540 flags=0x0     Flushing old station entries     Deauthenticate all stations     +rtl871x_sta_deauth_ops, ff:ff:ff:ff:ff:ff is deauth, reason=2     rtl871x_set_key_ops     rtl871x_set_key_ops     rtl871x_set_key_ops     rtl871x_set_key_ops     Using interface wlan0 with hwaddr e8:94:f6:1c:4a:dd and ssid 'wifi'     rtl871x_set_wps_assoc_resp_ie     rtl871x_set_wps_beacon_ie     rtl871x_set_wps_probe_resp_ie     rtl871x_set_beacon_ops     rtl871x_set_hidden_ssid ignore_broadcast_ssid:0, wifi,4     rtl871x_set_acl     wlan0: Setup of interface done.     random: Got 20/20 bytes from /dev/random      I searched and searched but whatever I try, it keeps going back to the original bssid. What can I do to get this running the way I want it to? Just a heads-up: I'm new to linux.


title: Why is `--human-readable` needed and not default?

text: Several command line tools use the `-h` or `\--human-readable` option to print file size in a human readable format (i.e., `36G` vs `37550836`).   * Why is this option needed and not the default?    * Aren't these tools mainly for output to humans?


title: Search among the content of a large number of plain text files?

text: I have a directory with 1,242,276 plain text files on my external hard drive. They are totally unorganized with meaningless numbers as their file names. The reason for that is because they were recovered by some recovery software after accidentally emptying a partition a while ago. I am now under that directory and want to search for a word "polyhedron" among the content of all the files. I tried `grep`, but it fails:               $ grep polyhedron ./*      bash: /bin/grep: Argument list too long      Is it because there are too many files under that directory? Also I would like to search for many other different keywords. I wonder what I can do now?


title: Is there a faster alternative to cp for copying large files (~20 GB)?

text: I am a graduate student, and the group in which I work maintains a Linux cluster. Each node of the cluster has its own local disk, but these local disks are relatively small and are not equipped with automatic backup. So the group owns a fileserver with many TBs of storage space. I am a relative Linux novice, so I am not sure what are the specs of the fileserver in terms of speed, networking ability, etc. I do know from experience that the local disks are significantly faster than the fileserver in terms of I/O. About a dozen or so people use the fileserver. Using `cp` to copy a ~20 GB file from the fileserver to one of the local disks takes about 11.5 minutes in real time on average (according to `time`). I know that this `cp` operation is not very efficient because (1) `time` tells me that the system time for such a copy is only ~45 seconds; and because (2) when I examine `top` during the copy, **%CPU** is quite low (by inspection, roughly **0-10%** on average). Using `cp` to copy the same ~20 GB file from one folder on the local disk to another folder on the same local disk takes less time -- about 9 minutes in real time (~51 seconds in system time, according to `time`). So apparently the fileserver is somewhat slower than the local disk, as expected, but perhaps not significantly slower. I am surprised that copying from local to same local is not faster than 9 minutes. I need to copy ~200 large files -- each ~20 GB -- from the fileserver to one of the local disks. So, my question is: **Is there a faster alternative to`cp` for copying large files in Linux?** (Or are there any flags within `cp` that I could use which would speed up copying?) Even if I could somehow shave a minute off this copying time, that would help immensely. I am sure that buying new, faster hardware disks, but I don't have access to such resources. I am also not a system administrator -- I am only a (novice) user -- so I don't have access to more detailed information on the load that is on the disks. I do know that while about a dozen people use the fileserver daily, I am the only person using this particular node/local disk.


title: What is the default font for Grub in Ubuntu and Fedora?

text: I was wondering what the name of the font is for the grub set by default after installation in Ubuntu and Fedora (they are different ones). Any help would be great!


title: Font letter spacing issue with PhantomJS/wkhtmltopdf on Ubuntu

text: I'm using PhantomJS/wkhtmltopdf on Ubuntu 12.04 LTS to convert HTML to PDF and get very strange letter spacing errors. For instance, the internal distance between _es_ and _xa_ seems very random and incorrect. When I run the exact same code on OS X I don't get these problems which make me think the issue is related to Linux. Also, when I render to PNG it looks fine. I'm using Microsoft Core Fonts and **all fonts get the same kerning issue**. For instance _xa_ is always a problem, so I don't think it's a font problem either. I've tried modifying ~/.fonts.conf according to the advice at those links but it makes no difference.   * https://wiki.ubuntu.com/Fonts   * http://www.kilobitspersecond.com/2009/04/17/ubuntu-font-hinting-you-a-cautionary-tale/ I'm quite stuck on ideas on how to solve this. ![enter image description here](http://i.stack.imgur.com/gmBLf.png)


title: Wget with different filename, but same extension

text: I need wget to save to a different folder, different filename, and same extension, but I do not have the filename before downloading. * * * For example, let's say I have:               http://ge.tt/api/1/files/someFile/0/blob?download      and I need to download it to an id, _"fj39ejd"_ in the folder `downloads`. What is the best way to go about saving it to:               /path/to/downloads/fj39ejd.[extension it had before downloading]      Any advice on how I can achieve this?


title: Debian Wheezy update-grub: command not found

text: I'm trying to change my grub boot order, so I've changed `/etc/default/grub`, but I don't seem to have the `update-grub` command. I'm not sure if I'm using grub or grub2 because everything just says "grub". How would I determine which version of grub I have installed?


title: CentOS 6 KVM host with CentOS 6 guests kvm-clock enabled major time drift

text: I have a CentOS 6 KVM host with CentOS 6 guests, all 64bit. The host syncs time from NTP and has remained bang on. All the guests have `kvm-clock` listed as `current_clocksource` but over the last 3 weeks they have drifted by about 4 hours from the host. I was under the impression that `kvm-clock` would prevent this from happening. Even the RHEL docs seem to suggest this... > Red Hat Enterprise Linux 5.5 and newer, and Red Hat Enterprise Linux 6.0 and > newer, use kvm-clock as their default clock source. Running without kvm- > clock requires special configuration, and is not recommended. Normally I would always run `ntpd` in guests as well as on the host to make sure the time stays in sync. Has anyone seen this happen before, know of any reasons this might have happened, and a way to prevent this from happening in the future?   Ideally without having `ntpd` syncing from within the guests.


title: Why are my two virtual machines getting the same IP address? (Oracle virtual box)

text: I have following set up on my machine.   1. Windows 8 operating system   2. first Ubuntu as virtual machine. I configured two network adapters for Ubuntu 1) NAT 2) Host only. after that I was able to ping Ubuntu machine from my windows machine (IP for Ubuntu box is 192.168.56.101) 3) I have cloned the Ubuntu box and created one more VM. After lots of effort I am not able to change the IP of second Ubuntu machine which is coming same as first Ubuntu machine. Since I have 0 knowledge on networking any help will be appreciated.


title: Is it OK to copy /etc/sysconfig/iptables to another machine?

text: This is my original server with very loose security given that it does not block all ports via iptables.                /etc/sysconfig/iptables       contents:               # Generated by iptables-save v1.4.7 on Mon Jun 16 20:04:05 2014     *filter     :INPUT ACCEPT [8:607]     :FORWARD ACCEPT [0:0]     :OUTPUT ACCEPT [6:1089]     COMMIT     # Completed on Mon Jun 16 20:04:05 2014      this (below) is a server with a different company but it looks like it came with good security settings in.. ( allows only port 22 )                /etc/sysconfig/iptables       contents:               # Firewall configuration written by system-config-firewall     # Manual customization of this file is not recommended.     *filter     :INPUT ACCEPT [0:0]     :FORWARD ACCEPT [0:0]     :OUTPUT ACCEPT [0:0]     -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT     -A INPUT -p icmp -j ACCEPT     -A INPUT -i lo -j ACCEPT     -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT     -A INPUT -j REJECT --reject-with icmp-host-prohibited     -A FORWARD -j REJECT --reject-with icmp-host-prohibited     COMMIT      this one looks alot better. Can I simply copy these to my original server's `/etc/sysconfig/iptables` and then reboot the whole system and expect everything to work ?


title: Linux ls wrong date format

text: I try to find why when I do the command `ls` or whatever `ls -la` the column format is wrong with date. It should be like that:               -rw-r--r--  1 johndoe johndoe   55 janv. 26  2011      not like that :                drwxr-xr-x  6 neworldc neworldc 4096 ao0  2011 fr/      take a look to the date format ??? : `ao0 2011` or like that: `f 3 03:14`


title: How to configure SELinux to print date and time in each entry in audit log?

text: I'm using CentOS 5.5 and by default my `/var/log/audit/audit.log` looks like this:               type=USER_AUTH msg=audit(1331897657.359:8435): user pid=15610 uid=0 auid=4294967295 subj=system_u:system_r:unconfined_t:s0-s0:c0.c1023 msg='PAM: authentication acct="?" : exe="/usr/sbin/sshd" (hostname=c165-130.i02-2.onvol.net, addr=213.165.165.130, terminal=ssh res=failed)'     type=USER_LOGIN msg=audit(1331897657.360:8436): user pid=15610 uid=0 auid=4294967295 subj=system_u:system_r:unconfined_t:s0-s0:c0.c1023 msg='acct="oracle": exe="/usr/sbin/sshd" (hostname=?, addr=213.165.165.130, terminal=sshd res=failed)'      to be exact, log entries are written without timestamp It makes it more difficult to troubleshoot. There is a man page available                man auditd.conf       but all it says in this subject is:               log_format          The log format describes how the information should be stored on          disk.  There  are  2 options: raw and nolog.  If set to RAW, the          audit records will be stored in a format exactly as  the  kernel          sends it. If this option is set to NOLOG then all audit informa-          tion is discarded instead of writing to disk. This mode does not          affect data sent to the audit event dispatcher.      How do I configure it to print date/time on the beginning of every entry ?


title: no network on domU in network-bridge configuration for Xen-4.0

text: I created a very standard Xen-4.0 domU with network-bridge configuration. However, no packets get out from the virtual machine to the network which bridge (peth0) is attached to. From guest I can ping the hypervisor, but can't ping anything outside it. IP addresses:   * `x.x.x.121` -- hypervisor buddha   * `x.x.x.162` -- virutal machine, xen6 What is happening? It is a very standard network configuration. With another hypervisor exactly same configuration works (same OS, same versions, same config), but with other box it doesn't. Symptoms look similar to this, however, my network configuration seems to look fine. Any ideas?               xen6:~$ ping -c 1 x.x.x.121     PING x.x.x.121 (x.x.x.121) 56(84) bytes of data.     64 bytes from x.x.x.121: icmp_req=1 ttl=64 time=0.093 ms          --- x.x.x.121 ping statistics ---     1 packets transmitted, 1 received, 0% packet loss, time 0ms     rtt min/avg/max/mdev = 0.093/0.093/0.093/0.000 ms                    buddha$ sed -n '/^[^#].*\(\(network\)\|\(vif\)\)/p' xend-config.sxp     (network-script network-bridge)     (vif-script vif-bridge)                    buddha# ifconfig -a     eth0      Link encap:Ethernet  HWaddr 00:30:48:5a:05:fa                 inet addr:x.x.x.121  Bcast:x.x.x.255  Mask:255.255.255.0               inet6 addr: fe80::230:48ff:fe5a:5fa/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:6082 errors:0 dropped:0 overruns:0 frame:0               TX packets:1138 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:573467 (560.0 KiB)  TX bytes:230756 (225.3 KiB)          lo        Link encap:Local Loopback                 inet addr:127.0.0.1  Mask:255.0.0.0               inet6 addr: ::1/128 Scope:Host               UP LOOPBACK RUNNING  MTU:16436  Metric:1               RX packets:26 errors:0 dropped:0 overruns:0 frame:0               TX packets:26 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:2428 (2.3 KiB)  TX bytes:2428 (2.3 KiB)          peth0     Link encap:Ethernet  HWaddr 00:30:48:5a:05:fa                 inet6 addr: fe80::230:48ff:fe5a:5fa/64 Scope:Link               UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1               RX packets:6218 errors:0 dropped:0 overruns:0 frame:0               TX packets:1141 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:693978 (677.7 KiB)  TX bytes:235320 (229.8 KiB)               Interrupt:26           vif1.0    Link encap:Ethernet  HWaddr fe:ff:ff:ff:ff:ff                 inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link               UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1               RX packets:3 errors:0 dropped:0 overruns:0 frame:0               TX packets:4369 errors:0 dropped:43 overruns:0 carrier:0               collisions:0 txqueuelen:32                RX bytes:84 (84.0 B)  TX bytes:487332 (475.9 KiB)                    buddha# xm network-list xen6     Idx BE     MAC Addr.     handle state evt-ch tx-/rx-ring-ref BE-path     0   0  00:16:3E:F3:0F:D9    0     4      15    769  /768     /local/domain/0/backend/vif/1/0          buddha# brctl show     bridge name bridge id       STP enabled interfaces     eth0        8000.0030485a05fa   no      peth0                                             vif1.0                    xen6# ifconfig -a     eth0      Link encap:Ethernet  HWaddr 00:16:3e:f3:0f:d9                 inet addr:x.x.x.162  Bcast:x.x.x.255  Mask:255.255.255.0               inet6 addr: fe80::216:3eff:fef3:fd9/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:6870 errors:0 dropped:0 overruns:0 frame:0               TX packets:209 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:628821 (614.0 KiB)  TX bytes:31636 (30.8 KiB)               Interrupt:17           lo        Link encap:Local Loopback                 inet addr:127.0.0.1  Mask:255.0.0.0               inet6 addr: ::1/128 Scope:Host               UP LOOPBACK RUNNING  MTU:16436  Metric:1               RX packets:1 errors:0 dropped:0 overruns:0 frame:0               TX packets:1 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:80 (80.0 B)  TX bytes:80 (80.0 B)                    xen6:~$ ping -c 1 x.x.x.121     PING x.x.x.121 (x.x.x.121) 56(84) bytes of data.     64 bytes from x.x.x.121: icmp_req=1 ttl=64 time=0.081 ms          --- x.x.x.121 ping statistics ---     1 packets transmitted, 1 received, 0% packet loss, time 0ms     rtt min/avg/max/mdev = 0.081/0.081/0.081/0.000 ms      Here is the ethernet controller:               02:05.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5704 Gigabit Ethernet (rev 10)         Subsystem: Super Micro Computer Inc Device 1648         Flags: bus master, 66MHz, medium devsel, latency 64, IRQ 26         Memory at fc9f0000 (64-bit, non-prefetchable) [size=64K]         Expansion ROM at  [disabled]         Capabilities: [40] PCI-X non-bridge device         Capabilities: [48] Power Management version 2         Capabilities: [50] Vital Product Data         Capabilities: [58] MSI: Enable- Count=1/8 Maskable- 64bit+         Kernel driver in use: tg3      I read somewhere (can't recall where) that IPMI creates issues with networking. So I disabled IPMI.               motiejus@buddha> uname -a     Linux buddha 2.6.32-5-xen-amd64 #1 SMP Mon Jan 16 20:48:30 UTC 2012 x86_64 GNU/Linux     motiejus@buddha> lsb_release -a     Distributor ID: Debian     Description:    Debian GNU/Linux 6.0.4 (squeeze)     Release:    6.0.4     Codename:   squeeze      Update from pastebin-data (routing info and ping-results):               Xen6:     Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface       x.x.x.0    0.0.0.0         255.255.255.0   U         0 0          0 eth0        0.0.0.0         x.x.x.1    0.0.0.0         UG        0 0          0 eth0             Buddha:     Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface         x.x.x.0    0.0.0.0         255.255.255.0   U         0 0          0 eth0          0.0.0.0         x.x.x.1    0.0.0.0         UG        0 0          0 eth0               xen6:~$ ping -c1 x.x.x.1     PING x.x.x.1 (x.x.x.1) 56(84) bytes of data.          --- x.x.x.1 ping statistics ---     1 packets transmitted, 0 received, 100% packet loss, time 0ms          buddha# tcpdump -nni eth0 icmp     tcpdump: verbose output suppressed, use -v or -vv for full protocol decode                         listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes                           22:51:01.977068 IP x.x.x.162 > x.x.x.1: ICMP echo request, id 2632, seq 1, length 64          However, x.x.x.1 does not receive the ICMP request.          buddha# ping -c1 x.x.x.1     PING x.x.x.1 (x.x.x.1) 56(84) bytes of data.              64 bytes from x.x.x.1: icmp_req=1 ttl=255 time=0.403 ms             --- x.x.x.1 ping statistics ---                                1 packets transmitted, 1 received, 0% packet loss, time 0ms         rtt min/avg/max/mdev = 0.403/0.403/0.403/0.000 ms


title: Is it possible to transfer files in a date range via FTP

text: I need to transfer a large number of files from an FTP server to a new server. There could be thousands of files so I would like to limit it to files that were uploaded in the last three months - is that possible and if so how? Also is it possible to find out how big the download is likely to be before you start the actually download? Thanks


title: If I type "sudo" at the beginning of a one liner, does it apply to the rest of the commands?

text: If I type `sudo` at the beginning of a one liner in bash, does it apply to the rest of the commands? In other words, is this:               sudo foo | foo2 | foo3      equivalent to this:               sudo foo | sudo foo2 | sudo foo3


title: How can I pipe a path to pushd?

text: This seems like it should be easy enough to do, but I'm clearly not understanding something fundamental about piping output back and forth. I'm trying to do something like this:               bundle show some-gem-name | pushd      Where the result puts me in the path of the gem name with popd functionality supported to get back where I was.


title: simple script rotating table

text: I'm trying to write a simple script, that just rotates csv table. I mean I have some file:               head1;head2;head3     field11;field12;field13      and so on. All I want, just to make my file               head1;field11;field21     head2;fielad12;field22     head3;field13;field23      I even haven't any idea about how it may work. I don't ask you to write a script, I need idea about how I can maje it in standart shell (unfortunately I'm not able to use bashism or gnu extensions, POSIX only) ps. Actually I can do it, but only in ugly way with unbelievable enefficient multirereading file with table. I believe there is more beautiful way.


title: Partitioning Ubuntu and Windows 7 once and for all

text: I am dual-booting Windows 7 and Ubuntu (installed with wubi). So far there have been no problems, but now it says the disk is out of space all the time (I think that is because `/dev/loop0` is used 100% -- would that cause this?). So I wish to partition them properly, as I think that is the problem. I want to move all my Windows stuff and files to one partition (`sda1`) and move all my Ubuntu files to another partition (`sda2`). I used `gparted` to configure disk space on `sda1` and `sda2`, making `sda1` 200G with 10% free space, and `sda2` 50G with 80% free space. However, I don't understand how to determine which partition Ubuntu is installed on, and how to move files from one partition to the other. Here are some terminal commands that describe my system.               $ sudo blkid          /dev/loop0 (ext3)     /dev/sda1 (ntfs; boot)     /dev/sda2 (ntfs)          $ sudo fdisk -l          /dev/sda1      /dev/sda2          $ sudo df -l          /dev/loop0 *(using 100% of 5.5G; mount point: /)*     udev *(using 1% of 1.5G; mount point: /dev)*     tmpfs *(using 1% of 500M; mount point: /run)*     none *(using 0% of 5M; mount point: /run/lock)*     none *(using 1% of 1.5G; mount point: /run/shm)*     dev/sda1 *(using 96% of 200G; mount point: /host; boot)*      Also, when I check my `/etc/fstab` file, it only has:               # UNCONFIGURED FSTAB FOR BASE SYSTEM     /host/ubuntu/disks/swap.disk    none    swap    sw  0   0


title: Kernel bisect: when a patch is failing for a reason other than original bisect purpose, what do you do?

text: Let's say you're trying to find the cause of a bug between 3.11.0 and 3.12.0. The bug is really difficult to catch, because it may or may not manifest itself over several days of regular workload uptime. You mark 3.11.0 good. You mark 3.12.0 bad. Start bisect. Then, running on the bisect patch, the kernel fails in some other significant way that makes catching the original bug maybe impossible. For example with some constant drm graphics corruption it may be impossible to replicate the several days of uptime needed to try to catch the original bug. So what do you do? Can't really mark this patch "good" right, so the logical option would only be "bad". But it's bad for another reason.. confused, need help!


title: How to install a Desktop Environment on Ubuntu after basic server installation

text: I downloaded Ubuntu-Server 12.04.3 LTS and cut a CD. Installed it, logged in as user, `sudo -i` as root. The basic installation has no desktop environment or so it appears. I did some reading and for good or bad, opted to go with KDE. I also read on options between installing Kubuntu vs. installing Ubuntu and then KDE. I do not have an internet connection now to the machine because I am not able to have the dongle installed and I think that it expects some DTE or X-Window to be present to get it up. That's another problem but the fact relevant to this question is that I don't have net connectivity for now. I do have other machines with Internet connection. So, I can get any software downloaded, copied and installed to this machine or have some Samba shares to get the downloaded files across. I read somewhere that KDE can be about 1 GB and I find that rather unbelievable for a Desktop Environment. My question though is what do I need to do now to get KDE installed? I tried `apt-get install`, but I think that expects net connection. I wonder if some DTE is on the CD that I can install? The CD is mounted and I can browse through it using basic shell commands.


title: Copy files from source machine to LiveCD

text: I'm working on distributing a version of Fedora to our internal development team using Live CD. There are certain files I would like to copy to the live cd that are not:   1. part of an RPM or   2. going to live in the user's home directory. Based on samples I've seen I'm trying something like the following in the post section of my kickstart file, to no avail.               %post --nochroot     cp -ar /tmp/files2copy $LIVE_ROOT/files     %end      Where is `$LIVE_ROOT`? Does it need to be exported earlier in the `*.ks` file? Do I need to create the `files` directory using `mkdir`?


title: Which udev rule triggered?

text: a. Is it possible to find out, which udev rule triggered as soon as some USB/serial device plug-in or plug-out ? b. Is it possible to reload one specific rule out of many rules, without device replug ?


title: QEMU package not available for RHEL 64 bit

text: I am installing QEMU in RHEL. In 32 bit OS (i686 architecture), if I run the command, **yum install qemu** , the installation of QEMU takes place. However, in 64 bit architecture (x86_64), if I run the same command, I am getting the error as " **QEMU package not available** ". Is the yum installation dependent on the architecture of the OS version? EDIT: This is the output of yum list |grep qemu qemu.i386 2:0.10.5-1.el5.2 installed   qemu-common.i386 2:0.10.5-1.el5.2 installed   qemu-img.i386 2:0.10.5-1.el5.2 installed   qemu-system-arm.i386 2:0.10.5-1.el5.2 installed   qemu-system-cris.i386 2:0.10.5-1.el5.2 installed   qemu-system-m68k.i386 2:0.10.5-1.el5.2 installed   qemu-system-mips.i386 2:0.10.5-1.el5.2 installed   qemu-system-ppc.i386 2:0.10.5-1.el5.2 installed   qemu-system-sh4.i386 2:0.10.5-1.el5.2 installed   qemu-system-sparc.i386 2:0.10.5-1.el5.2 installed   qemu-system-x86.i386 2:0.10.5-1.el5.2 installed   qemu-user.i386 2:0.10.5-1.el5.2 installed


title: Ubuntu 10.04 on 64bit

text: I need to download the 64bit version of Ubuntu 10.04, I found this link http://releases.ubuntu.com/lucid/ and select this option: > PC (Intel x86) desktop CD But it is x86? And the other 64bit option just for AMD processor


title: Disk quota exceeded problem

text: I am using Debian Squeeze. Suddenly I have started facing a problem that my user is not able to make directories and other such tasks. Running `mkdir abc` gives me `mkdir: cannot create directory 'abc': Disk quota exceeded` My hard disk is not full `df -h` results are               Filesystem            Size  Used Avail Use% Mounted on     /dev/md1              1.8T   39G  1.8T   3% /     tmpfs                 7.8G     0  7.8G   0% /lib/init/rw     udev                  7.8G  148K  7.8G   1% /dev     tmpfs                 7.8G     0  7.8G   0% /dev/shm     /dev/md0              243M   31M  200M  14% /boot      `uname -a` output that might be needed is               Linux server 2.6.32-5-686-bigmem #1 SMP Sun Sep 23 10:27:25 UTC 2012 i686 GNU/Linux      **Note:** If I login as root then everything is fine. This problem is only with a particular user **Edit** : output of `quota`               Disk quotas for user user (uid 1000): none      output of `quota -g`               Disk quotas for group user (gid 1000):           Filesystem  blocks   quota   limit   grace   files   quota   limit   grace     /dev/disk/by-uuid/26fa7362-fbbf-4a9e-af4d-da6c2744263c     8971324* 1048576 1048576    none   43784       0       0


title: Dedicated-purpose, single application linux boxes

text: I'm designing an app that will be deployed/installed to a linux machine (perhaps Archlinux, but could be any distro and in fact I would actually prefer something lightweight and inside the Debian family if at all possible). This machine will not be a "general purpose" or multiple application machine: it's sole purpose is to run my app at startup and close my app at shutdown. No other end-user apps would be installed on this machine. I'm looking for a way to:   * When the user powers on the machine, instead of the normal Ubuntu/OS startup --> BIOS --> splash screen --> login process, they just see a splash screen for my app (while the system and app boots up) and then my app loads with its own look and feel   * While using the machine, they cannot access any other apps, shells or other part of the operating system; all they have access to is my app   * When running, the app takes up the entire screen and its window cannot be minimized or resized   * The app (as software) cannot be turned off or killed while running, except...   * Turning off the machine (physically powering it down) shuts down the app gracefully and shuts down the underlying OS as well Hence, the end user never knows that the machine is running on top of linux; to them, the app is the only thing "living" on the machine. This _has_ to be possible seeing that Android is just a wrapper around Linux, and there are _thousands_ of other devices that just run a single app and nothing more. This will likely be a C binary that launches a Java desktop application as the actual app. Any ideas as to how I can accomplish the items mentioned above?


title: Backtrace of "git clone" running inside qemu-user-emulation based arm-chroot

text: I'm running a wheezy:armhf chroot using qemu user emulation on my jessie:x86_64 system. Somehow, a `git clone` on a particular private repository will hang inside the chroot, while succeed natively. This might be a bug, who knows? To improve my karma, I wanna find out whats going on! As a side-note: the hang I'm experiencing is occurring with git-2.0 inside jessie:armel chroot as well... The hang does not occur inside a full-system- emulation. So I went on digging in the _wheezy:armhf_ rabbithole, just because I had to choose one... I cannot test on a native machine... So. There is no `git-dbg` packet, I roll my own. Inside the wheezy:armhf chroot:               sudo apt-get install build-essential fakeroot     sudo apt-get build-dep git     apt-get source git && cd git-1.7.10.4     DEB_CFLAGS_APPEND="-fno-stack-protector" DEB_CXXFLAGS_APPEND="-fno-stack-protector" DEB_BUILD_MAINT_OPTIONS=hardening=-stackprotector,-fortify DEB_BUILD_OPTIONS="noopt nostrip nocheck" fakeroot dpkg-buildpackage -j´getconf _NPROCESSORS_ONLN`     sudo dpkg -i ../git_1.7.10.4-1+wheezy1_armhf.deb      As far as I read the gcc-documentation, setting `DEB_CFLAGS_APPEND` and `DEB_CXXFLAGS_APPEND` additionally with `-fno-stack-protector` is not needed, but anyhow, wanna be sure ,-) Then, using qemu's builtin gdb_stub inside the chroot I'm doing:               QEMU_GDB=1234 git clone /path/to/breaking/repo /tmp/bla      Debugging inside the qemu throws an _unsupported syscal 26_ error... Firing up `gdb-multiarch` outside the chroot, to connect:               gdb-multiarch -q     (gdb) set architecture arm                    # prevents "warning: Architecture rejected target-supplied description"     (gdb) target remote localhost:1234     (gdb) set sysroot /opt/chroots/wheezy:armhf     (gdb) file /opt/chroots/wheezy:armhf/usr/bin/git     Reading symbols from /opt/chroots/wheezy:armhf/usr/bin/git...done. # good! has debug symbols!     (gdb) list                                    # works! code is not stripped     (gdb) step     Cannot find bounds of current function        # meh...     (gdb) backtracke     #0  0xf67e0c90 in ?? ()     #1  0x00000000 in ?? ()                       # wtf?      Giving a `continue` to let the clone happen will result in a hang, sending a `ctrl-c` is ignored. Generating a core-file and loading it into gdb (inside the chroot) will give me a corrupt stack:               gdb -q /usr/bin/git qemu_git_20140514-160951_22373.core     Reading symbols from /usr/bin/git...done.     [New LWP 22373]     Cannot access memory at address 0xf67fe948     Cannot access memory at address 0xf67fe944     (gdb) bt     #0  0xf678b3e4 in ?? ()     #1  0xf678b3d4 in ?? ()     #2  0xf678b3d4 in ?? ()     Backtrace stopped: previous frame identical to this frame (corrupt stack?)      Now I'm lost. Where is the problem? Did I miss some detail in the qemu-user-emulation? Do I have to use a completely emulated arm-machine? A misunderstanding in cross- debugging? gdb-multiarch limitations? The creation of debug-packages? Thanks for any suggestions, pointers, hints, tips, comments and what-not... My best guess in the moment is based on the fact that `git` does a clone (I can see two processes/threads), but the `QEMU_GDB` environment variable is unset by qemu after using... Hence only the initial process is going to gdb. See here for example. But still: I should be able to properly debug the parent process? I can easily cross-debug a hello-world MWE...


title: How do I search files without certain extensions in their names?

text: I would like to search recursively in all the files and directories under a directory for some strings e.g. `library`. I also would like to exclude files and directories which store downloaded webpages but are not `.html` or `.htm` files (which are still of my interest), such as:   * files whose filenames have certain extensions, such as `.js`, `.css`, `.png`, `.gif`,`.jpeg`, and    * directories whose names are ended with `_files`.  so how shall I do that? I am thinking about using `locate` before `find`, because `locate` is faster, but I don't know `locate` can do it or not. Thanks.


title: Using the not equal operator for string comparison

text: if [ "$PHONE_TYPE" != "NORTEL" ] || [ "$PHONE_TYPE" != "NEC" ] || [ "$PHONE_TYPE" != "CISCO" ]     then     echo "Phone type must be nortel,cisco or nec"     exit     fi      The above code did not work for me, so I tried this instead:               if [ "$PHONE_TYPE" == "NORTEL" ] || [ "$PHONE_TYPE" == "NEC" ] || [ "$PHONE_TYPE" == "CISCO" ]     then     :     else     echo "Phone type must be nortel,cisco or nec"     exit     fi      Are there cleaner ways for this type of task?


title: Will there be always a pair of same UID and GID?

text: I have to change file/directory's ownership using `chmod` .I know only owners's username but want to change default group name simultaneosly . At this stage group name is not decided so I am putting same as username               chown -R username:username path_to_dir      Command may run for various sytems/users , So my concern is , will linux always has a pair username(user):username(group) OR at some point this default group_name may give error. Although I have started to find GID from the user belongs               id username | tr '(=)' ':' | awk -F: '{print $3}      But for knowledge I want to know . Till now analysys of `/etc/passwd` `/etc/groups` except few users like "shutdown,halt,sync,opeartor" all users have listed in groups as well. > EDIT 1: id -gn username is also good option


title: remotely connecting to Unix from Mac to use Gerris simulation

text: I am trying to run a simple file on Gerris software (is like gnu) on a remote Unix machine. I moved the simulation file written in nano into remote machine say dps11.               samires-mbp:~ samirebalta$ nano     ........     [sbalta@dps6 Desktop]$ scp vorticity.gfs sbalta@dps11:/home/sbalta/Desktop/     ......     [sbalta@dps11 ~]$ cd Desktop     ....     [sbalta@dps11 Desktop]$ gerris2D vorticity.gfs      It gave me nothing no error and it does not run nn Is it because of `/` sing which I used to move the file into Desktop/ but I did not put `/` then typing cd Desktop??


title: What does `du - hb` do?

text: With `du -bh` I think I get the apparent size in human readable format:               # du -bh     295K    ./test      However, I would expect the same from `du -hb`, but I get something else:               # du -hb     301926  ./test      I believe this is the same output as just `du -b` would give me.               # du --version     du (GNU coreutils) 7.4


title: temporarily disabling one's own filesystem write permission

text: I can't believe there is no simple solution to this (because it seems potentially a very useful feature to me), but so far I couldn't find any. I'd like to be able to (temporarily) turn off my own write permission to the filesystem I'm using. Let's say, I'm logged in on a sensitive system where all I want is to view files but I want to avoid doing any changes by mistake. A lighter version: If all the write permissions I have are due to the groups to which I belong (I disregard now my home directory), can I turn off these permissions by somehow temporarily removing myself from these groups (newgrp only changes my default group but not the whole group list). Of course, in either version I'm asking about doing this without the root privileges.


title: Run Linux "motion" app as user

text: I'm trying to run Motion app on a Linux box. For various security reasons, I'd rather run it as regular user than sudo. However, when I run "service motion start" without the sudo in front, it says:               chown: changing ownership of `/var/run/motion': Operation not permitted       Googling doesn't seem to yield any results relevant to this situation.


title: How to regenerate /etc/apt/trustdb.gpg on Debian?

text: Suppose one deleted (or damaged) the following file.               /etc/apt/trustdb.gpg      How to regenerate it?


title: Boot loop after upgrade from FreeBSD 7.3-RELEASE to 8.3 using freebsd-update

text: I upgraded my 7.3 FreeBSD box using the following instructions from the FreeBSD website: > 2.2 Upgrading Using “FreeBSD Update” > > The freebsd-update(8) utility supports binary upgrades of i386 and amd64 > systems running earlier FreeBSD releases. Systems running 7.[01234]-RELEASE, > 8.[012]-RELEASE, 8.3-BETA1, or 8.3-RC[12] can upgrade as follows: > > "# freebsd-update upgrade -r 8.3-RELEASE > > During this process, FreeBSD Update may ask the user to help by merging some > configuration files or by confirming that the automatically performed > merging was done correctly. > > "# freebsd-update install > > The system must be rebooted with the newly installed kernel before > continuing. > > "# shutdown -r now > > After rebooting, freebsd-update(8) needs to be run again to install the new > userland components: Following the reboot the box just keeps on looping. I am not sure if the kernel is fine and I am not sure what the above instructions mean when they say "The system must be rebooted with the newly installed kernel before continuing. I have looked in the /boot directory and the kernel directory is there and seems fine. I tried booting with the default kernel and it reboots, I also tried with ACPI disabled (option 2) and Safe mode (option 3) with the same results. I can boot successfully into Single user mode (option 4). Do I need to change any files etc to boot with the newly installed kernel?