title: Prevent dom0 IGP from being VGA-passed-through to HVM host with Xen4.4

text: Usually people want to VGA-passthrough their IGP, and there are a lot of documentation out there. However I _don't_ want my IGP passed-through to the domU as it serves my dom0, only my secondary card (Multi-OS NVidia). Currently everything is working fine with `gfx_passthrough=1`, except that when the domU takes control of the IGP it messes dom0's X server up (I cannot/don't know how to relaunch it, save for rebooting). It does not happen with `gfx_passthrough=0` (but then the secondary card does not work). Would someone please be so kind as to point where I can find information regarding such matters? Need I somehow explicitly forbid the IGP device with VGA passthrough, contrary to PCI passthrough? My running configuration:   * Dell PET620 server   * Xen4.4 with Ubuntu Server 14.04 as dom0 (stock kernels and all)   * domU (HVM) : Win7 / Mint17   * IGP : Matrox something, 16M RAM   * PCI card : NVidia Quadro K4000


title: ath9k 802.11n 300Mbps at low speed

text: I'm testing my new home 802.11n network. router - slax 7, kernel 3.8.2, AR9382 mini pci-e (sparklan WPEA-121N)               wlan0     IEEE 802.11abgn  ESSID:"xyz"               Mode:Ad-Hoc  Frequency:2.412 GHz  Cell: 96:77:38:F7:80:C8               Tx-Power=16 dBm               Retry  long limit:7   RTS thr:off   Fragment thr:off               Encryption key:off               Power Management:on      desktop - slackware 14.1, kernel 3.10.17, AR9287 pci-e x1 (tp-link TL-WN881ND)               wlan0     IEEE 802.11bgn  ESSID:"xyz"               Mode:Ad-Hoc  Frequency:2.412 GHz  Cell: 96:77:38:F7:80:C8               Tx-Power=20 dBm               Retry  long limit:7   RTS thr:off   Fragment thr:off               Encryption key:off               Power Management:off      laptop - windows 7, intel centrino advanced-n 6205 All computers are in the same place, standing next to each other, InSSIDer shows no interference with other networks, very good signal quality. All wireless adapters can theoretically work in 802.11n 300Mbps speed. I set up ad-hoc network with `iw wlan0 ibss join xyz 2412 HT40+` I'm testing speed with iperf. I can't get more than 3-4Mbps between any of my devices. When using 802.11g (NOHT option) I get 17-19Mbps between my desktop and server. Laptop still at 4Mbps. Whats going on? Why I can't reach even 50% of 802.11g? When doing `iwlist wlan0 scan` I never see available bitrates > 54Mb/s for my network.


title: How to reduce disc access?

text: This is a follow up question to: How to reduce temperature on a Dell XPS (L502X)? After reading the answer I noticed that my harddrive is spinning constantly, even when running TLP in bat-mode (mostly default settings, laptop-mode=5). **What I already do**   * `/tmp` is mounted as a `tmpfs`. AFAIK this is not recommended for `/var/tmp`, is it?   * `TLP` is running with this configuration   * `/` and `/boot` are `ext4` mounted with `commit=15,noatime`   * `/` is mounted from a `LUKS` partition, is this a problem? **What I am searching for** I guess that constant disc access is the major cause of my disc spinning all the time. **Are there any other ways to reduce disc access and/or ways to allow the disc to spin down?**


title: Mirror a single X application on a dual-monitor setup with Openbox

text: In a dual monitor system is it possible to mirror a single window and not the entire screen? Put it another way, can I ask an X application to open simultaneously on DISPLAY `:0.0` and `:0.1`? Basically this can be useful for presentations, where one needs to send to the projector just a copy of the PDF (or the like) window. My window manager is Openbox.


title: ssh out of port 80 to port 22?

text: The isp I am currently connected to only has port 80 open, but I need to ssh to my server which listens on port 22 of my router there. Is there a way to go out through port 80 here, then in through 22 there?


title: Can I use partitions made by Windows 7 in Linux?

text: I am planning to leave Windows and get to Linux (yet do not know which one, but it is not the question). I was using Windows 7, I have 2 partitions (C:198 GB, D:488 GB). And I have a lot of documents and projects in D:, which I do not want to lose. Now I wonder, can I install Linux distribution without losing data from disk D:?


title: find words with all vowels in order from a file

text: I have a large dictionary file with 300,000+ words in it and I'm trying to find all words with the vowels aeiou in that order and have only exactly 5 vowels. My current attempt does not seem to be working and for the life of me I don't understand why.               less mywords | grep -iE [^aeiou]*a[^aeiou]*e[^aeiou]*i[^aeiou]*o[^aeiou]*u[^aeiou]*      I think it get's all the words I'm looking for but there are a few words that pop up which I can not get rid of.               abstemiousnesses     ultraserious      There are a few other but they are in the same vein. Curiously, even if I add something like `[^u]*` to the front `ultraserious` keeping popping back up! Any solution would be fine however I would like it restricted to grep as we've been told it can be done using only grep.


title: Execute all files in a list

text: I have a source tree which, when `make` is run, produces several executables named "001", "002", and etc. I'm trying to write a script which will find all of these executables in my source tree, and then execute them. I have this so far: `find build/ -type f -executable | ack --nocolor "\d{3}$"` Which lists the executables that I want to execute correctly. My question is, how do I then run all of them? I thought perhaps some combination of `xargs` and `exec` would do it, but `exec` seems to try replacing the current shell with the command, which isn't what I want.


title: How does Linux handle 2 identical destinations in its routing table?

text: I have this is my routing table (in that order):               10.3.68.0/22 via 172.16.100.9 dev vlan4     10.3.68.0/22 dev eth3  proto kernel  scope link  src 10.3.69.254      `eth3` has ip `10.3.69.254/22`. Why does Linux choose to go through the `172.16.100.9` gateway to access the `10.3.68.0/22` subnet (thus not trying direct link)? I tested with `ip route get 10.3.68.123` for example. It says it will go through `172.16.100.9`, and in practice, it does. It only says that it will try the link local routing when I ask for `10.3.68.0` ("network" address), `10.3.71.254` (broadcast), or `10.3.69.254` (itself). I think this is because these 3 cases are specifically handled by the higher priority `local` table (`ip route show table local`). Anyway, **why does Linux consider the first route as the higher priority route?**


title: How do you run CPU at turbo speed continuously

text: processor       : 7     vendor_id       : GenuineIntel     cpu family      : 6     model           : 60     model name      : Intel(R) Xeon(R) CPU E3-1230 v3 @ 3.30GHz     stepping        : 3     cpu MHz         : 3299.670     cache size      : 8192 KB     physical id     : 0     siblings        : 8     core id         : 3     cpu cores       : 4     apicid          : 7     initial apicid  : 7     fpu             : yes     fpu_exception   : yes     cpuid level     : 13     wp              : yes     flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase bmi1 hle avx2 smep bmi2 erms invpcid rtm     bogomips        : 6599.34     clflush size    : 64     cache_alignment : 64     address sizes   : 39 bits physical, 48 bits virtual     power management:      I've set the following:               title OpenVZ (2.6.32-042stab092.3)             root (hd0,0)             kernel /vmlinuz-2.6.32-042stab092.3 ro root=/dev/mapper/vg_vpsny23-lv_root intel_pstate=disable nomodeset rd_NO_LUKS LANG=en_US.UTF-8 rd_LVM_LV=vg_vpsny23/lv_root rd_LVM_LV=vg_vpsny23/lv_swap nodmraid rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet              initrd /initramfs-2.6.32-042stab092.3.img      But it still only shows/runs at 3.30GHz.


title: linux permission, group member cannot write even with write permission

text: The logged in user is a member of a group that has a write permission on a folder. But when this user is trying to write something, "permission is denied". The log below summarizes the question:               subv:/www/tracer/ whoami     frank     subv:/www/tracer/     subv:/www/tracer/ ls -ltr      total 4     drwxrwxr-x 2 root tracer 4096 Jan 20 12:25 convert.tracer.com     subv:/www/tracer/ groups frank     frank : frank tracer     subv:/www/tracer/ > convert.tracer.com/test     -bash: convert.tracer.com/test: Permission denied     subv:/www/tracer/      Output of "ls -bail /www/tracer/convert.tracer.com/":               subv:~/ ls -bail /www/tracer/convert.tracer.com/     total 8     38010883 drwxrwxr-x 2 root tracer 4096 Jan 20 12:25 .     38010882 drwxr-xr-x 3 root root    4096 Jan 20 12:25 ..     subv:~/


title: Keep a Zenity dialog box always-on-top in foreground

text: Is there a way to detect that a `zenty` dialog is loosing focus? I would like to hold it in the foreground, unless the user presses ESC. This is the script where I want to add this:   https://github.com/rubo77/mouse-speed/blob/master/usr/bin/typebreak#L20


title: Can't su root after editing PAM confiugration on Rackspace Linux box

text: I've just hosed a system. Working on pam-ldap on an Ubuntu box, I've run `pam- auth-update` and told it to override local modifications (which had previously allowed for `sudo su`, but I was having issues with `sudo <arbitrary command>`. After applying the settings I can no longer `su root`. Now I'm pretty much locked out of the box and since it's on the cloud the concept of 'boot access is root access' doesn't really apply. Any ideas how I can rescue the box?


title: Gnuplot and process-substitution

text: I have a log file where I need to cut out two values at different positions. these are: time and dQ in my file. The main problem is the paste I think. cause the other utilities work pretty well on their own. If I type in the shell it all works fine, and I get 2 columns:                 paste        <(cat log.fireFoam | grep  '^Time'           | cut -d' ' -f3 | tr -d ',')       <(cat log.fireFoam | grep  'dQ'              | cut -d' ' -f9 | tr -d ',')      Now is my problem how I can get this command work in gnuplot?                 plot\        "< exec bash -c\        "paste\        <(cat log.fireFoam | grep  '^Time'           | cut -d' ' -f3 | tr -d ',')\       <(cat log.fireFoam | grep  'dQ'              | cut -d' ' -f9 | tr -d ',')\       "\       "\       u 1:2      Hopefully someone could me


title: cannot start PostgreSQL on OpenBSD 5.4 through rc.d

text: I've installed the `postgresql-server` package on OpenBSD 5.4 amd64, and I try starting it through its `rc.d` script, however, it doesn't look like it's running after that.               opti# /etc/rc.d/postgresql start     postgresql(ok)     opti# ps auxw | fgrep -i sql     root      8892  0.0  0.0  1652   276 p1  R/1    5:04PM    0:00.00 fgrep -i sql (tcsh)     opti#        * Why does the script report that it starts successfully?   * Why does it not actually start?


title: Match a single character in a string bash script

text: My issues is that I want to read a character from the stdin and compare it with a string value. If that character exists then I want to display a message. Eg, saving `%` into the variable `$a`:               $ read a     %     $echo $a     %      There is variable defined say `v='~`!@#$%^&*()_-+=:;{[}]|\/<>,."'` all possible special character including single tick `'` I need to check if the character input exists in the string value. How can I do this.


title: Why do I need dbus?

text: I recently removed dbus from my system (along with consolekit and polkit). I didn't notice any change (I was running it as system daemon and per-user from .xinitrc). However, many people claim that one just need dbus, most of linux applications are using it etc etc. My question is, why do I need it? I don't think I understand what does it exactly do. I know that is a "message bus system", that processes communicate through it etc. And? I still don't know what do I gain from using it. Could someone explain it to me, preferably with examples "from real life"?


title: Append files with bash one-liner?

text: Currently I use multiple lines to append content into a combined file, e.g.               ./myprogram 1.txt > Out.txt # Overwrite for the 1st file     ./myprogram 2.txt >> Out.txt     ./myprogram 3.txt >> Out.txt     ./myprogram 4.txt >> Out.txt      Is it possible to replace by one-liner?


title: Clearing GNU Screen after full-screen application

text: When working at a normal xterm (not sure about a "real" terminal), when a full-screen program such as man or vim is closed, it disappears, leaving your screen so you can see your prompt, and previous prompts including where you launched the program that closed. When I am running within GNU Screen, however, when the program is closed it does not clear but is simply shifted up so a prompt can be displayed. To me this is ugly, and I'd like to know if "normal" behaviour can be resumed. I realise I could manually clear the screen myself but a) I don't want to and b) that would result in a totally clear screen, not what I'm after (though perhaps better, if this is as good as it gets).


title: Why is echo a shell built in command?

text: $ which echo     echo: shell built-in command.     $ which ls     /bin/ls     $ which cat     /bin/cat      Why is echo not an independent utility like `ls`, `ps`, `cat` etc? Why is it shell specific? Any good reasons?


How can I write an OpenSuse script that will change my boot menu.lst file and add "nomodeset" automatically both to failsafe and normal boot option? (This script is for suseStudio I'm going to write it under the "Run script whenever the appliance boots" for the first boot).


title: What does "spanning files" mean in the help of Manpage?

text: I open a manpage of some command, and then hit `h`.   * In the help, for the search part, what does "spanning files" mean?   * What are "files" refereed to? I search a pattern, and hit `n` to repeat the previous search. I found there is no difference between `n` and `ESC`-`n`.                                         SEARCHING            /pattern          *  Search forward for (N-th) matching line.       ?pattern          *  Search backward for (N-th) matching line.       n                 *  Repeat previous search (for N-th occurrence).       N                 *  Repeat previous search in reverse direction.       ESC-n             *  Repeat previous search, **spanning files**.       ESC-N             *  Repeat previous search, reverse dir. & **spanning files**.       ESC-u                Undo (toggle) search highlighting.       &pattern          *  Display only matching lines


title: Using notify-send with cron

text: I am using Arch Linux with KDE/Awesome WM. I am trying to get `notify-send` to work with `cron`. I have tried setting `DISPLAY`/`XAUTHORITY` variables, and running `notify-send` with "sudo -u", all without result. I am able to call notify-send interactively from the session and get notifications. FWIW, the cron job is running fine which I verified by echoing stuff to a temporary file. It is just the "notify-send" that fails to work. Code:               [matrix@morpheus ~]$ crontab -l     * * * * *  /home/matrix/scripts/notify.sh     [matrix@morpheus ~]$ cat /home/matrix/scripts/notify.sh     #!/bin/bash     export DISPLAY=127.0.0.1:0.0     export XAUTHORITY=/home/matrix/.Xauthority     echo "testing cron" >/tmp/crontest     sudo -u matrix /usr/bin/notify-send "hello"     echo "now tested notify-send" >>/tmp/crontest     [matrix@morpheus ~]$ cat /tmp/crontest     testing cron     now tested notify-send     [matrix@morpheus ~]$       As you can see the echo before & after notify-send worked. Also I have tried setting `DISPLAY=:0.0` UPDATE: I searched a bit more and found that DBUS_SESSION_BUS_ADDRESS needs to be set. And after hardcoding this using the value I got from my interactive session, the tiny little "hello" message started popping up on the screen every minute! But the catch is this variable is not permanent per that post, so I'll have try the the named pipe solution suggested there.               [matrix@morpheus ~]$ cat scripts/notify.sh     #!/bin/bash     export DISPLAY=127.0.0.1:0.0     export XAUTHORITY=/home/matrix/.Xauthority     export DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-BouFPQKgqg,guid=64b483d7678f2196e780849752e67d3c     echo "testing cron" >/tmp/crontest     /usr/bin/notify-send "hello"     echo "now tested notify-send" >>/tmp/crontest     [matrix@morpheus ~]$       Since `cron` doesn't seem to support notify-send (at least not directly) is there some other notification system that is more `cron` friendly that I can use?


title: Replacing LXDE with XFCE, startx issues

text: Apologies if this seems straight forward but I've recently downloaded XFCE to replace LXDE environment on my raspberry pi running raspbian. I did this by using               sudo apt-get install xfce4      and following all the instructions. Then to remove LXDE I carried out:               sudo apt-get --purge remove lxde     sudo apt-get clean      My problem lies that whenever I run                startx      it still opens and runs LXDE? I know that I should be running startxfce4 if I simply want to use XFCE, but I want to know how to completely remove LXDE? Edit: Also how do I modify the startx file so that I can choose (if both are installed) which desktop environment I want startx to run (either lxde or xfce)? Thanks!


title: Quoting text with > in mutt

text: Currently when I reply to a message, my mutt is quoting using > as following               On Sunday ... Mojo Jojo wrote     >Hey Powerpuff girls       I want a space just after `>`, e.g.               On Sunday ... Mojo Jojo wrote     > Hey Powerpuff girls       This package has `stuff_quoted` option which does it. How to do this in mutt?


title: How to find out what's wrong on all of my Qt programs?

text: I'm using Arch Linux (Linux 3.13), when I run `qtcreator`, it crashes, and the same happens for other Qt based software:               $ qtcreator     "Qt Warning - invalid keysym: dead_actute"      Segmentation fault (core dumped)          $ qtalarm      "Qt Warning - invalid keysym: dead_actute"       Segmentation fault (core dumped)      all my "qt" installed packages are:               gambas3-gb-qt4 3.5.2-1     gambas3-gb-qt4-ext 3.5.2-1     gambas3-gb-qt4-opengl 3.5.2-1     gambas3-gb-qt4-webkit 3.5.2-1     kdebindings-qtruby 4.12.1-1     kdebindings-smokeqt 4.12.1-1     libdbusmenu-qt 0.9.2-2     phonon-qt4 4.7.1-1     polkit-qt 0.103.0-2     poppler-qt4 0.24.5-1     pyqt4-common 4.10.3-1     python2-pyqt4 4.10.3-1     qt4 4.8.5-7     qt5-base 5.2.0-3     qt5-declarative 5.2.0-3     qt5-graphicaleffects 5.2.0-3     qt5-imageformats 5.2.0-3     qt5-jsbackend 5.1.1-5     qt5-location 5.2.0-3     qt5-multimedia 5.2.0-3     qt5-qtsystems-git 20130509-1     qt5-quick1 5.2.0-3     qt5-quickcontrols 5.2.0-3     qt5-script 5.2.0-3     qt5-sensors 5.2.0-3     qt5-serialport 5.2.0-3     qt5-svg 5.2.0-3     qt5-tools 5.2.0-3     qt5-translations 5.2.0-3     qt5-webkit 5.2.0-3     qt5-x11extras 5.2.0-3     qt5-xmlpatterns 5.2.0-3     qtalarm 4700237.6-1     qtchooser 39-1     qtcreator 3.0.0-2     qtwebkit 2.3.3-1     telepathy-qt 0.9.3-7      How can I find out what's wrong (what the cause of the problem is) on my system?


title: Setuid directory permission implies execute permission?

text: Does setting `u+s` on a directory imply `u+x`?


title: Scp doesn't work in cron

text: Yeah, I know it's classic. I've googled it all around, but still it doesn't work. I have the following script:                #First go to SVN repo folder     cd $svnrepos               # Just make sure we have write access to backup-folder     if [ -d "$bakdest" ] && [ -w "$bakdest" ] ; then       # Now $repo has folder names = project names       for repo in *; do         # do svn dump for each project         echo "Taking backup/svndump for: $repo"         echo "Executing : svnadmin dump $repo > $bakdest/$repo-$bakdate.svn.dump \n"         # Now finally execute the backup         svnadmin dump $repo > $bakdest/$repo-$bakdate.svn.dump         # You can go an extra mile by applying tar-gz compression to svn-dumps              # We also would like to save the dump to remote place/usb           # USB/other directory exists, copy the dump there           echo "Going to copy $repo dump to $baktousb directory...\n"           /usr/bin/scp -v $bakdest/$repo-$bakdate.svn.dump $baktousb/$repo-$bakdate.svn.dump       done     else       echo "Unable to continue SVN backup process."       echo "$bakdest is *NOT* a directory or you do not have write permission."     fi               # End of backup script     echo "\n\n================================="     echo " - Backup Complete, THANK YOU :-]"      everything works fine in shell, but when It's executed as cron job it simply doesn't scp (but does create a backup). Yes, I have an empty paraphrase. Can't get why it doesn't work.


title: Why is Apache not respecting aliased directories?

text: In `ssl_default.conf` where Apache serves as an SSL-adding proxy for Django Gunicorn, I have:                   ...         Alias /admin/static/ "/usr/lib/python2.7/dist-packages/django/contrib/admin/static/"              ProxyPass /media/ !         ProxyPass /admin/static/ !         ProxyPass / http://localhost:8080/         ProxyPassReverse / http://localhost:8080/      What should I be doing differently to have `/admin/static/*` serving up the contents of the URL above? At present it appears to be handing requests, including `/admin/static/*`, to the Django Gunicorn process. **UPDATE** Now I'm getting a 403 after expanding:                   Alias /admin/static/ "/usr/lib/python2.7/dist-packages/django/contrib/admin/static/"         <Directory "/usr/lib/python2.7/dist-packages/django/controb/admin/static/">             Options Indexes MultiViews FollowSymLinks             AllowOverride None             Order deny,allow             Deny from all             Allow from 127.0.0.0/255.0.0.0 ::1/128         </Directory>      This is on attempting to access `/admin/static/css/base.css`. Suggestions?


title: Is there a readme reader like man?

text: `man` is the quick interface to online reference manuals. These are usually stored in `/usr/share/man/manN/blah.gz`, or similar. Most debian packages also come with a `README.debian`, which is stored in `/usr/share/doc/blah/README.debian`. Is there an automated reader for these files, that finds the appropriate `README.debian`, and opens it?


title: How do I know that my rpm installation of a package was succesful?

text: I downloaded the rpm for dos2unix and installed (on RHEL 6, 64 bit) like this               [root@xilinx Downloads]# rpm -ivh dos2unix-5.3.3-5.ram0.98.src.rpm         1:dos2unix               warning: user mockbuild does not exist - using root     warning: group mockbuild does not exist - using root     warning: user mockbuild does not exist - using root     warning: group mockbuild does not exist - using root     ########################################### [100%]     [root@xilinx Downloads]#       But as can be seen I am getting these warnings. Why? How do I know that my installation of dos2unix was succesful ? **Update**               [root@xilinx Downloads]# rpm -ivh dos2unix-5.3.3-5.ram0.98.src.rpm        1:dos2unix               warning: user mockbuild does not exist - using root     warning: group mockbuild does not exist - using root     warning: user mockbuild does not exist - using root     warning: group mockbuild does not exist - using root     ########################################### [100%]     [root@xilinx Downloads]#      [root@xilinx Downloads]#      [root@xilinx Downloads]#      [root@xilinx Downloads]#      [root@xilinx Downloads]# rpm -ql dos2unix     package dos2unix is not installed     [root@xilinx Downloads]#       I then tried               [root@xilinx acme]# yum install mock     Loaded plugins: refresh-packagekit, rhnplugin     There was an error parsing the RHN proxy settings.     RHN support will be disabled.     Error: Cannot retrieve repository metadata (repomd.xml) for repository: InstallMedia. Please verify its path and try again     [root@xilinx acme]#


title: (Ill)Logical statement

text: I am attempting to make a simple script to flip my computer screen. My first if statement executes perfectly, but after that, thought $istouch is "on", the elif statement block will not execute! I have tried running bash with the -u option with no failure and have tried switching the checks, nothing works.               #!/bin/bash     xsetwacom --set 16 touch False     istouch='xsetwacom --get 15 touch'     $istouch     if [ "$istouch"=="off" ]     then         xrandr -o inverted         xinput set-prop 13 'Coordinate Transformation Matrix' -1 0 1 0 -1 1 0 0 1         xinput set-prop 15 'Coordinate Transformation Matrix' -1 0 1 0 -1 1 0 0 1         xinput set-prop 16 'Coordinate Transformation Matrix' -1 0 1 0 -1 1 0 0 1         xsetwacom --set 15 touch True          elif [ "$istouch"=="on" ]     then         xrandr -o 0         xinput set-prop 13 'Coordinate Transformation Matrix' 1 0 0 0 1 0 0 0 1         xinput set-prop 15 'Coordinate Transformation Matrix' 1 0 0 0 1 0 0 0 1         xinput set-prop 16 'Coordinate Transformation Matrix' 1 0 0 0 1 0 0 0 1         xsetwacom --set 15 touch False     fi


title: unable to search and install dos2unix pakage

text: I have RHEL 6 , 64 bit OS. I need to istall dos2unix for this version. I could not find rpm file for RHEL 6 86_64 bit , so I tried like this:               [root@xilinx acme]# yum search dos2unix     Loaded plugins: refresh-packagekit, rhnplugin     There was an error parsing the RHN proxy settings.     RHN support will be disabled.     Warning: No matches found for: dos2unix     No Matches found      Why no maches found? Also how do I remove the warning               There was an error parsing the RHN proxy settings.             RHN support will be disabled      Also this the content of my yum.conf file:               [main]     cachedir=/var/cache/yum/$basearch/$releasever     keepcache=0     debuglevel=2     logfile=/var/log/yum.log     exactarch=1     obsoletes=1     gpgcheck=0     plugins=1     installonly_limit=3          #  This is the default, if you make this bigger yum won't see if the metadata     # is newer on the remote and so you'll "gain" the bandwidth of not having to     # download the new metadata and "pay" for it by yum not having correct     # information.     #  It is esp. important, to have correct metadata, for distributions like     # Fedora which don't keep old packages around. If you don't like this checking     # interupting your command line usage, it's much better to have something     # manually check the metadata once an hour (yum-updatesd will do this).     # metadata_expire=90m          # PUT YOUR REPOS HERE OR IN separate files named file.repo     # in /etc/yum.repos.d      **Update** It looks like I have to add the repo which contains `dos2unix`. My question is what is that repo. Also I treid finding rpm file for this , but all avallable rpms are for RHEL 5 or 7 ..but not for 6, which is what I am using. I searched rpm here: but could not find for rhel 6 **Update 2** I found the rpm here and installed!!


title: Need a loop to sleep for a fraction of second

text: On my machine I need to execute a cycle that iterates 1 simple command that must have a delay expressed in fractions of second. Let's say that I need:   * to save a file with an increasing enumaration ( file-0, file-1, file-2, ... ) generate by something trivial for this example like `time > file-$x`   * I need to do this every 1/70 of second (as an example) because I would like to express my time with fractions of second. How can I be really precise and have everything expressed with a bash script? The fraction can generate an indeterminable quantity, I need to be precise and so I need at least 4-5 decimals.


title: How can I configure ethernet?

text: I just started using linux (installed Debian) and the one thing I'm trying to do right now is have my internet working. I connected my ethernet port but still no internet works. I googled for awhile and figured I had edit the network interfaces config file but I couldn't because it said it was read-only. I'm not sure how to access that file as a root because I couldn't find an option for that. Any help in regards with this would be awesome.


title: How to get gnome to run /etc/gdm/PostSession/Default when using XRDP w/ VNC

text: I use Microsoft's Remote Desktop Client (`mstsc.exe`) to connect to a linux server with GNOME as my desktop. I've set up `/etc/gdm/PostSession/Default` to execute some steps on cleanup - which works when I'm logged in physically. However, `/etc/gdm/PostSession/Default` is not getting executed when I exit my RDP session. What triggers `/etc/gdm/PostSession/Default` to execute? **NOTE"** I'm using CentOS 6.5 with Gnome 2.28.2


title: iptables one IP through another network interface

text: This question is very similar to what I am trying to do: iptables --set-mark - Route diferent ports through different interfaces However I attempted to follow the answer but I was unable to make it work. I have one device that I would like to route through a PPTP VPN connection. If I do it on my router it will put all users through the VPN I decided to try and use the same server I am using as a proxy server to connect to the VPN. I currently have my router (DD-WRT) routing packets to my proxy server using this script:               iptables -t mangle -A PREROUTING -p tcp --dport 80 -j MARK --set-mark 10     ip rule add fwmark 10 table 10     ip route add default via 192.168.0.10 table 10      That is working fine. On my server end I am trying to route 192.168.0.48 through my VPN and all of the others through my proxy server. I am using the following script on my server:               #Redirect all traffic on 80 to proxy except 192.168.0.48 (WORKING)     iptables -t nat -A PREROUTING -p tcp -m tcp ! -s 192.168.0.48 --dport 80 -j REDIRECT --to-ports 3127     #Mark packets from 192.168.0.48 with 20     iptables -t mangle -A PREROUTING -p tcp -s 192.168.0.48 --dport 80 -j MARK --set-mark 20      I then tried to forward traffic marked with `20` to `ppp0` using the following:               ip rule add fwmark 20 table 20     ip route add default via 192.168.1.2 dev ppp0 table 20      All computers can load webpages successfully except for `192.168.0.48` which sits at loading forever. I have confirmed I am getting traffic on `ppp0` from `192.168.0.48` using `tcpdump -i ppp0`


title: Upgrading Python 2.6. libpython2.6.so.1.0 missing

text: I am upgrading python on an offline 64bit RHEL 6.4 box and am having to do it via RPM's rather than yum. I am trying to upgrade python from 2.4.3 to 2.6 so I can build nodejs from source. I am running into trouble when I run               rpm -Uvh python26-2.6.8-2.el5.x86_64.rpm      I get a failed dependencies error:               libpython2.6.so.1.0() (64bit) is needed by python26-2.6.8-2.el5.x86_64      I can't find anyway to install libpython2.6 though...


title: xorg: lost screen resolution after Debian/Jessie upgrade

text: After update/upgrade within Debian/Jessie (affecting some 50 packages) and a reboot (after an uptime of about a month), the full resolution 2560x1440 of my Dell U2713HM has gone. xrandr is listing at most 1920x1200. Given the long history of my installation, I tried a radical cure, purging all xorg related packages, and reinstalling them. No effect, still limited to 1920x1200. Then I tried               ~$ cvt 2560 1440     # 2560x1440 59.96 Hz (CVT 3.69M9) hsync: 89.52 kHz; pclk: 312.25 MHz     Modeline "2560x1440_60.00"  312.25  2560 2752 3024 3488  1440 1443 1448 1493 -hsync +vsync     ~$ xrandr --newmode "2560x1440"  312.25  2560 2752 3024 3488  1440 1443 1448 1493 -hsync +vsync     ~$ xrandr --addmode HDMI1 2560x1440     ~$ xrandr  --output  HDMI1 --mode 2560x1440     xrandr: Configure crtc 0 failed      The only trace of this in `Xorg.0.log` is the following:               [  3263.882] (II) intel(0): Allocated new frame buffer 2560x1440 stride 10240, tiled     [  3264.048] (EE) intel(0): failed to set mode: Invalid argument     [  3264.080] (II) intel(0): Allocated new frame buffer 1920x1200 stride 7680, tiled      According to `lspci -v`, my video device is the following:               00:02.0 VGA compatible controller: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller (rev 06) (prog-if 00 [VGA controller])         Subsystem: Fujitsu Technology Solutions Device 11e7         Flags: bus master, fast devsel, latency 0, IRQ 46         Memory at f7800000 (64-bit, non-prefetchable) [size=4M]         Memory at e0000000 (64-bit, prefetchable) [size=256M]         I/O ports at f000 [size=64]         Expansion ROM at <unassigned> [disabled]         Capabilities: [90] MSI: Enable+ Count=1/1 Maskable- 64bit-         Capabilities: [d0] Power Management version 2         Capabilities: [a4] PCI Advanced Features         Kernel driver in use: i915      Since I installed the full `xorg` dependency package, missing drivers is not a likely explanation. How to proceed?


title: How to correct fs size for logical volume

text: I decreased logical volume `lv_postgres` size for a 5G. then redistributed free space to other lv `lv_home`, but didn't do resize2fs for the decreased volume `lv_postgres'`. At the next boot i fall into emergence mode and `resize2fs lv_postgres` dont't do the task saying "Please run `e2fsck -f`" and the last one say "Either the superblock or pt is likely to be corrupt" if i continue then on pass 5 get "error reading block while reading inode and block bitmaps" the fs size according to superblock is 2564096 blocks the physical size of device is 1253376 blocks i want to reduce volume from 9.78G to 4.78G to match required size Which is a right way to correct size for volume?


title: remove a host from the completion list for ssh in zsh

text: I once had some hosts named 'myhost', 'myhost1', etc. And now all those except 'myhost3' become invalid. I removed those from `/etc/hosts` and `~/.ssh/known_hosts`, but zsh still completes them for me. Is there any other file I should edit to make zsh forget about those hosts? I haven't changed anything related to hosts in my zsh configuration; they come out by default. UPDATE: Some time later (after a hibernation but no reboot), those hosts disappear. Maybe zsh cleared some kind of cache? (But not `~/.zcompdump` as I checked that. I also tried start new instances of zsh but that doesn't make difference.) I'll try and test later. UPDATE #2: I tried again and successfully removed a newly-added host from the completion list. Maybe I did something wrong previously, sorry.


title: Physical layer header is not present in the data read from raw sockets?

text: i have read about RAW sockets that they are UNIX domain sockets and don't generally go over the wire unlike TCP or UDP. They are used for interprocess communication. Also they are used in the implementation of new transport layer protocols and are also used in ICMP(for ping).


title: How to install RPM based Packages on OpenFiler

text: We bought One SuperMicro Server that will be used for Storage purposes and then we install the openfiler on it. The thing is that we need to install RAID controller and Im not familiar with OpenFiler and there are packages in that are .rpm or .deb when i pass the command **rpm -ivh StorMan-7.30.i386.rpm** it say **-bash: rpm: command not found** So how to install .rpm packages on this Openfiler. So that I can remotely access the RAID controller using my machine.


title: mutt: color mesages with attachments differently

text: I tried this:               folder-hook . 'color index green black "~B \"Content-disposition: attachment;\""'      but got nothing except exceptionally slow rendering of the inbox. Is there any way to do this, or generally anything that will allow me to see messages with attachments in the index (flags etc..) that can be solved by configuration and not patching.


title: Restarting process via cron every 12 hours

text: I'm not familiar with cron at all, and I've looked it up and am still confused as to how specifically it works. I'm on CentOS 6.5, and I need to end a process and then start it again every 12 hours. It will have a different pid every time though, so I'm not sure how I would kill the process. Then I need to restart the process. I would like for this to happen at 7am and 7pm every day. How would I go about accomplishing this? **EDIT:** I need to do this because we're running crtmpserver and it seems to quit after 15 hours or so. If it's restarted it bypasses this problem. Instead of figuring out the root problem I'd rather implement this since it should be a quick fix.


title: What are the purposes of the different types of XWindows fonts?

text: In my `/usr/share/fonts/` I have four sub-directories categorizing types of fonts:   1. `cmap`   2. `truetype`   3. `type1`   4. `X11` The command `fc-list` produces a list of them. Are these different categories for specific purposes, or simply a result of the evolution of differing trends for designing fonts?


title: replacing backtick with $() not working

text: I have some old scripts that I try to update. Some of the code condenses to:                export X=`(echo "abc"; echo "def")`      echo $X      which gives the expected output:                abc def      Now the internet tells me backticks are out `$()` is what I need to use, but when I try:               export X=$((echo "abc"; echo "def"))      `X` is not set and I get the error:               bash: echo "abc"; echo "def": syntax error: invalid arithmetic operator (error token is ""abc"; echo "def"")      What am I doing wrong?


title: Filesystem content inspection GUI (like gconf-/dconf-editor)?

text: Within, for instance, `/sys/kernel/debug/tracing`, the kernel makes many settings available as files, whose contents should be read in order to see what that setting is. Of course, typing `cat /sys/kernel/debug/tracing/...` each time to see the setting is kind of tedious; so right now I'm using this function to traverse and inspect that part of the filesystem (needs to be called under `sudo`):               #!/usr/bin/env bash          function recourse_print() {       local LVL=$2       local IND="$(printf ' %.0s' $(seq 1 $LVL) )-"       for ix in $(ls --group-directories-first --reverse "$1" | tac); do         local FP="$1/$ix"         if [ -f "$FP" ]; then           echo "$IND $ix: $(timeout -s SIGALRM 1 cat $FP 2>&1 | awk 1 ORS=' ; ' | head -c 50) ... "         elif [ -d "$FP" ]; then           echo "$IND $ix [d]"           local NL=$((LVL+1))           if [ $((LVL < 3)) = 1 ] ; then             recourse_print "$FP" $NL           fi         fi       done     }          recourse_print /sys/kernel/debug/tracing 1      This is sort of OK, in the first run:                - available_events: i915:i915_gem_object_create ; i915:i915_gem_object ...       - available_filter_functions: cpumask_weight ; run_init_process ; init_post ; in ...       - available_tracers: blk function_graph mmiotrace wakeup_rt wakeup func ...       - buffer_size_kb: 8192 ;  ...       - current_tracer: function ;  ...      ...      - per_cpu [d]       - cpu0 [d]        - stats: entries: 0 ; overrun: 0 ; commit overrun: 0 ;  ...         - trace: # tracer: function ; # ; #           TASK-PID    C ...         - trace_pipe:  ...         - trace_pipe_raw:  ...        - cpu1 [d]        - stats: entries: 0 ; overrun: 0 ; commit overrun: 0 ;  ...         - trace: # tracer: function ; # ; #           TASK-PID    C ...         - trace_pipe:  ...         - trace_pipe_raw:  ...      ...      The problem is - there are so many entries, it becomes difficult to keep track and focus within this list in a terminal. One thing I wish for this, was that there was a filesystem GUI, that would do the same - that is, recursively traverse a directory, and open any files and display a one-line summary of the contents (timing out in case of pipes) - such that the directory hierarchy is displayed as GUI tree nodes, that can be expanded/compacted; examples for this are `dconf-editor`: ![dconf-editor](http://i.stack.imgur.com/V6JqJ.png) ... or `gconf-editor`: ![gconf-editor](http://i.stack.imgur.com/2NOAN.png) In this case, I imagine the left pane would show subfolders tree, and the "Name" in "Name/Value" would be the filename, and the "Value" would be one- line summary (truncated start) of the file's contents (where I'd expect the typical characters like `.�.�j�,�,{...` rendered in case the file has binary contents). I wouldn't expect such an app to render, say, checkboxes (even if a particular file has contents that can be set to either 0 or 1); but it would be awesome if it could open the entire file contents (for text-only files) in a new window upon doubleclick. Is there a standalone app that can do something like this - and if not, is there a plugin for, say, Nautilus, that could add an extra column in List View, that could be scripted to extract a one-line summary from the file contents?


title: get rid, Oh no ! Somethings Has Gone wrong window, Mint

text: I have updated my Mint using apt-get upgrade, after login I got Oh no! something Has gone wrong window but When I check all the log, it is fine, nothing gone wrong, after hit logout on the Oh no! window I can see the desktop, and it's all fine. I just want to get rid the Oh no window, what hot keys could I use, or what command ? anyway I'm using Mint 14


title: How does battery life on a laptop compare between GNOME 2 and GNOME 3 (GNOME Shell)?

text: Since GNOME 3 uses hardware acceleration by default, I assume that it will be worse for battery life on my laptop, but I can't actually find anything to back this up, and by how much. Has anyone done benchmarks of this yet? I really like the interface but I don't want to kill my battery life by upgrading (and I'm on a distro where it would be difficult to go back).


title: grep only subdirectories matching pattern

text: I have a directory tree consisting of several thousand subdirectories, but I frequently need to grep only a small subset of those directories. How can I `grep` only those subdirectories matching a pattern? For example, suppose I have these subdirectories which I want to grep in:               ...     ...     ...     /foo     /fooLib     /fooHandler     /fooGizmo     ...     ...     ...      The `...` entries above represent the thousands of other directories I _don't_ want to grep in. Supposing I'm looking for all instances of `bar`, if I do this:               grep -n --recursive bar *      I would find what I'm looking for, but in all of the directories. How can I search in only those subdirectories matching the pattern `foo*`?


title: Input freeze when X starts on other terminal

text: I have a Packard Bell F2011HC-125GE running a Debian Squeeze-based Linux. After a few days of usage i found the system freezes from time to time. It's obvious the freezes happen, when X starts while another terminal is active(e.g. tty1). Some scenarios are: -Suspending while in text-terminal (e.g. ctrl+alt+f2). This includes freezing when closing the lid. On resume the screensaver from tty7 is showing, but doesn't react to input. Sometimes it is still possible to switch to another terminal and do something like 'echo 1 > /dev/tty7' and switch back with ctrl+alt+f7. Then input is possible. Though, most of the time it's completely frozen. -Choosing to logout from KDE-session and switching instantly to ttyX < 7\. Then input works for a few seconds before it switches to the KDE-login-screen but doesn't react to input anymore. In that case the power-button does still work and i am able to shut down. When i logout and wait for the login-screen to be ready i am able to switch tty without problems. -X crashes while ttyX<7 is active. No switch-back. Can only hold power button and reset. I'm able to see crashes in log-file. Reasons are unimportant for this matter. Freezes occur whatever the reason is. This does not happen when tty7,8 is active while X crashes. Also, i can startx from terminal, wait and everything works fine. My chipset is HM77-7 Series (Intel) and some of my hardware is not supported by ACPI/ALSA from the debian-repo. I've backported 3.2 with the same issue, customized 3.6.6, which works better than both debian-repo kernels, but still with the issues mentioned above. I'm currently trying to use 3.7.1, but i have with problems with ath9k (wireless-module) being present in both kernel in userspace, same with ntfs. (I dont want to use FUSE). The X-problems seem to be the same with whatever kernel. How do i find what the source of the problem is? Where do i look? udev? X? I can't image it being the kernel, because somebody else must have noticed; Though, i'm sure it's some kind of problem with input-redirection. I am sorry for the long text, hope not to bother you too much with a rather specific problem and would really appreciate any kind of hint or help. Greetings


title: Grep of many keywords over many files: speeding it up

text: I am currently facing a "performance problem" while using grep. I am trying to locate the occurrences of many (10,000+) keywords in many (think Linux kernel repository size) files. The objective is to generate a kind of index for each keyword:               keyword: my_keyword     filepath 1     filepath 2     ------     keyword: my_keyword2     ...      Being fairly new to shell scripting, I have tried a few naive approaches:               while read LINE; do         echo "keyword: "$LINE >> $OUTPUT_FILE         grep -E -r --include='Makefile*' "($LINE)" . >> "$OUTPUT_FILE"         echo "-----"     done < $KEYWORD_FILE      This takes about 45 minutes to complete, with the expected results. Note: all they keywords I search for are located in a file ("KEYWORD_FILE", so fixed before anything starts), and the files in which to search can be determined before the search starts. I tried to stored the list of files to search in before the search like that:               file_set=( $(find . -name "Kbuild*" -o -name "Makefile*") )      and then replace the grep call by               echo {$file_set[*]} | parallel -k -j+0 -n 1000 -m grep -H -l -w "\($LINE\)" >> "$OUTPUT_FILE"      It takes about an hour to complete… Question: considering I can use whatever technique I want, provided it's sh compliant, how can this be done "faster" and/or more efficiently ? Perhaps `grep` is not the tool to use, and my use of `parallel` is wrong… any ideas are welcome!


title: Can I Install packages on live linux os?

text: I want to install some more software on sabayon live and they should be remained in USB for later use. Can I install packages on live Linux OS?


title: Copy file if no error was encountered, else delete copied portion

text: I am copying a folder in Linux with plenty of files. Some of the files give me error like this:               Error splicing file: Input/output error      The problem is that it keeps the file in new location though it doesn't open. I would like to write a Unix command that would simply skip the file if these type of error occur and don'delete it from the new location. My final directory should have only those files in which the error doesn't occur.


title: What type of Linux would need fewer updates?

text: I know how to put different Linuxes on a live persistent usb, but I have noticed that updating/upgrading a such system increases the risk of breaking it. From my experience it looks like the persistence feature is just an enhancement that provides some space for supplementary changes like installing an office suite, some multimedia players, internet browsers, and for the settings made inside applications. But persistence space is not meant for changes in the system files or in the important drivers. Attempting such changes seems useless (they are not remembered) or dangerous (the drive would not boot after a while). I have asked a specific question on this - here. I know I can disable updates but what type of distro would need them the least - that is - would be meant to update rarely and not need a lot of update- upgrade considering the purpose of being used on an usb flash drive?


title: A shell script to write selected fields to a single line

text: I have a log file `trace.log` which prints the time stamp, thread name and Transaction method and transaction ID as below.               2014-01-23 15:50:41,724 [catalina-exec-35] INFO  TRANSACTION getConnection REQUEST, ID=1308::     2014-01-23 15:50:41,725 [catalina-exec-33] INFO  TRANSACTION getConnection REQUEST, ID=1304::     2014-01-23 15:50:41,727 [catalina-exec-10] INFO  TRANSACTION getConnection REQUEST, ID=1298::     2014-01-23 15:50:41,727 [catalina-exec-24] INFO  TRANSACTION getConnection REQUEST, ID=1307::     2014-01-23 15:50:41,727 [catalina-exec-12] INFO  TRANSACTION getConnection DONE, ID=1305::     2014-01-23 15:50:41,733 [catalina-exec-10] INFO  TRANSACTION getConnection DONE, ID=1298::     2014-01-23 15:50:41,734 [catalina-exec-26] INFO  TRANSACTION getConnection REQUEST, ID=1313::     2014-01-23 15:50:41,734 [catalina-exec-26] INFO  TRANSACTION getConnection DONE, ID=1313::     2014-01-23 15:50:41,738 [catalina-exec-39] INFO  TRANSACTION getConnection REQUEST, ID=1311::     2014-01-23 15:50:41,733 [catalina-exec-35] INFO  TRANSACTION getConnection DONE, ID=1308::     2014-01-23 15:50:41,738 [catalina-exec-27] INFO  TRANSACTION getConnection REQUEST, ID=1309::     2014-01-23 15:50:41,737 [catalina-exec-22] INFO  TRANSACTION getConnection REQUEST, ID=1310::     2014-01-23 15:50:41,743 [catalina-exec-30] INFO  TRANSACTION getConnection REQUEST, ID=1315::     2014-01-23 15:50:41,744 [catalina-exec-39] INFO  TRANSACTION getConnection DONE, ID=1311::     2014-01-23 15:50:41,747 [catalina-exec-2] INFO  TRANSACTION getConnection REQUEST, ID=1318::      I want to `grep` and print the time stamp of the `getConnection REQUEST` and `getConnection DONE` for a particular ID in a single line into a file. I have a written a shell script that printing the time stamp in multiple lines as below. Here is my shell script               for i in {1..800}     do          echo "Welcome $i times"          echo "ID=$i, getConnection " >> time.log          grep ID=$i: trace.log | grep getConnection | cut -d'[' -s -f1 >> time.log     echo "      " >> time.log     done      The output is as shown below               ID=791, getConnection     2014-01-23 15:50:16,703     2014-01-23 15:50:16,706          ID=792, getConnection     2014-01-23 15:50:16,704     2014-01-23 15:50:16,704          ID=793, getConnection     2014-01-23 15:50:16,704     2014-01-23 15:50:16,709          ID=794, getConnection     2014-01-23 15:50:16,708     2014-01-23 15:50:16,712      How I can change that? I need output as shown below:               ID=792, getConnection 2014-01-23 15:50:16,703 2014-01-23 15:50:16,706          ID=792, getConnection 2014-01-23 15:50:16,704 2014-01-23 15:50:16,704          ID=793, getConnection 2014-01-23 15:50:16,704 2014-01-23 15:50:16,709          ID=794, getConnection 2014-01-23 15:50:16,708 2014-01-23 15:50:16,712


title: How to assign space-containing values to variables in bash using eval

text: I want to dynamically assign values to variables using `eval`. The following dummy example works:               var_name="fruit"     var_value="orange"     eval $(echo $var_name=$var_value)     echo $fruit     orange      However, when the variable value contains spaces, `eval` returns an error, even if `$var_value` is put between double quotes:               var_name="fruit"     var_value="blue orange"     eval $(echo $var_name="$var_value")     bash: orange : command not found      Any way to circumvent this ?


title: Check if $REPLY is in a range of numbers

text: I'm writing a shell script for Linux, using Bash, to translate any video-file into a MP4. For that, I'm using `avconv` with `libvorbis` for audio. Inside my script, I have a question for the user :               read -p "- Audio Quality [scale from -2 to 10] ? "         if [ -n "$REPLY" ] ; then         ABITRATE="-aq $REPLY"         fi      My "ABITRATE" string goes into the final `avconv` command-line. But I would like to give the user the opportunity to answer that question with a value in Kb (Kilobit), and translate it into the scale that `libvorbis` uses. The "scale from -2 to 10" is this :               Quality Kbit/s  Normalization     -----------------------------      -2      ~32        y      -1      ~48        y       0      ~64        y       1      ~80        y       2      ~96        y       3     ~112        y       4     ~128        n       5     ~160        n       6     ~192        n       7     ~224        n       8     ~256        n       9     ~320        n      10     ~500        n      I would like to know how to check if my $REPLY is in a range of number. For example, I would like my script to do something like this :               if [ $REPLY is a number between 1 and 32 ] ; then       REPLY="-2"     elif [ $REPLY is a number between 33 and 48 ] ; then       REPLY="-1"     fi      Is this possible (I'm willing to say 'yes of course, shouldn't be hard' but I don't know the syntax to use) ?


title: Restoring backup files

text: I have a directory in which are listed some `.py` files and some `.py.bak` files. I want to delete the `.py` files and restore the backup file renaming them `*.py`. Is there a shell script that can do this? Thank you,   rubik


title: Sublime Text 2 not detecting python library if installed in /opt

text: I am attempting to install Sublime Text 2 in /opt/sublime_text. Once all the files are in there, I believe the executable not detecting the python libraries and throwing the following error: ![enter image description here](http://i.stack.imgur.com/PC5xV.png)   * I have python installed on my system already (2.7.3).   * I am able to run Sublime Text 2 from my home directory. I've tried copying just the `__future__.pyo` file into the /opt/sublime_text folder but I get the same error message. Is there a solution which doesn't require me to extract all of the python libraries in the application folder?


title: Break write permission for non root user?

text: Can non root user edit files he/she doesn't have access to or create new a file in a directory he/she doesn't own? Is there a way to do that? **P.S :** I know if root user or file owner gives him write permission he would be able to. I'm asking if he can't be granted permission. In other words, can Linux permissions be hacked?


title: How to know which public key was used when someone used passwordless ssh login?

text: Say for some reason, there is only a "user" account on a `shhd` server. Everyone has his own private key to `ssh` to the server, as "user". Then, is there a way to see who is he (during or after his session)?


title: Installing a unix application?

text: I am trying to install depot_tools here are the instructions. I downloaded the file from this:               svn co http://src.chromium.org/svn/trunk/tools/depot_tools      I wanted to install it in `/usr/local` so I moved the download there via gui. The next part is:               export PATH="$PATH":`pwd`/depot_tools      So I went into `.bash_login` and changed this:               export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"      to this:               export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH:/usr/local/depot_tools"      Terminal wont recognize any of the commands `gclient, gcl, git-cl, repo`. What am I doing wrong?


title: How can I print the longest number in a string?

text: I am looking for a method to print the longest number in a string. E.g.: If I have the string               212334123434test233      how can I print               212334123434      ? Note: I am looking for the longest continuous sequence of numbers, not for the numerically higher value. * * * **Edit:** Thanks for the answers, everyone. The response to this question has been quite overwhelming. I marked @HaukeLaging's post as the accepted answer because it suited my specific case very well but I'd like to point out that all answers are equally valid. It's always great to have several different options to solve a problem.


title: What is the proper way to automate SSH/local command?

text: I have gitolite on a Centos 5.5 box - when a repository is updated, I need to send a command to my bug tracking appliance to get the new commands. Right now, I have the following command working: `ssh bugserver -f 'cd /etc/repos/gitrepo && git pull origin prod && exit'` This seems a little dirty, though. Is there a better way to execute this sync?


title: Does fork() immediately copy the entire process heap in Linux?

text: A `fork()` system call clones a child process from the running process. The two processes are identical except for their PID. Naturally, if the processes are just reading from their heaps rather than writing to it, copying the heap would be a huge waste of memory. Is the entire process heap copied? Is it optimized in a way that only writing triggers a heap copy?


title: Is there an easy way to list the number of unique values in a column in LibreOffice calc?

text: In LibreOffice calc I have a column with thousands of values. Is there an easy way to list the number of UNIQUE values? e.g. a column which had               red     red     red     green     green     blue     blue     blue      would return 3 because there are three unique entries. Thanks


title: Login to Skype from terminal or any other way

text: Please let me know if anybody knows how to login to Skype on Linux Mint from terminal or any other way? I have tried a lot but nothing found.               Desktop # ./skype.desktop     ./skype.desktop: line 1: [Desktop: command not found     ./skype.desktop: line 3: Internet: command not found     ./skype.desktop: line 4: fg: no job control     ./skype.desktop: line 9: Application: command not found     ./skype.desktop: line 11: X-KDE-Protocols=skype: command not found


title: traceroute gives only stars + how to fix

text: Please advise about the following problem. When I do:                 $ traceroute 8.8.8.8      I get in the output showing only stars, even though pinging to google.com ( 8.8.8.8) appears to be working.   1. Please advise what I need to fix in my files/conf in order to solve this issue?   2. what I need to check?  ### Ping command output                   $ ping 8.8.8.8         PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.         64 bytes from 8.8.8.8: icmp_seq=1 ttl=46 time=73.4 ms         64 bytes from 8.8.8.8: icmp_seq=2 ttl=46 time=69.6 ms      ### traceroute command output                $ traceroute 8.8.8.8      traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets      1  * * *      2  * * *      3  * * *      4  * * *      5  * * *      6  * * *      7  * * *      8  * * *      9  * * *      10  * * *      11  * * *      12  * * *      13  * * *       14  * * *      15  * * *      16  * * *      17  * * *      18  * * *      19  * * *      20  * * *      21  * * *      22  * * *      23  * * *      24  * * *      25  * * *      26  * * *      27  * * *      28  * * *      29  * * *      30  * * *


title: Remap Up and Down arrows to gj-gk in vim input mode without using <c-o>?

text: I have mapped my arrows keys to move in a visual-line mode, leaving the `hjkl` keys for normal, logic line movement:               " Visual movement with the arrows and End-Home      nnoremap <Down> gj     nnoremap <Up> gk     vnoremap <Down> gj     vnoremap <Up> gk     inoremap <Down> <C-o>gj     inoremap <Up> <C-o>gk     inoremap <Home> <C-o>g<Home>     inoremap <End>  <C-o>g<End>      This works, but for a minor problem. I have a bit of code in my status line to change color between input mode and normal mode, like this:               if version >= 700       highlight statusLine cterm=bold ctermfg=black ctermbg=red       au InsertLeave * highlight StatusLine cterm=bold ctermfg=black ctermbg=red gui=bold guifg=black guibg=red       au InsertEnter * highlight StatusLine cterm=bold ctermfg=black ctermbg=green   gui=bold guifg=black guibg=green     endif      ...and I noticed now (on a machine slower than the one I have at home) that every time I press one of the arrows, the temporary mode switch of `<ctrl>o` (at least, I think) make the status line flash rapidly red then green again. It is possible to redefine the keys to avoid the temporary jump to normal mode?


title: What are appropriate execution permissions for ~/bin?

text: I am putting some scripts in ~/bin and am wondering what appropriate file permissions are. To extend my question somewhat, what permissions make sense for */bin folders all over my system, and why?


title: How does init determine which devices to modprobe?

text: I'm building a totally custom initramfs for a netbooting project and in the process learning a lot about it, but I'm a little puzzled by the loading of modules. I know `modprobe` can be used to load modules, but how does it decide which modules to load? What I have right now is the initramfs booting up and running a shell in virtual box. But `lsmod` shows no modules loaded. What I need `init` to do is load the right modules for the networking so that I can get the networking up. If I `modprobe e1000` I actually get the correct module loaded. In looking through the Ubuntu boot process I can't see how Ubuntu decides it should load up `e1000`. I would've thought it'd just `modprobe` every available network card driver, but it doesn't appear to be doing that. I'm guessing that UDEV has something to do with it?


title: How can I use one network port for VPN and the other for everything else?

text: My Linux machine has two network ports with two IP addresses. I want to use one port for my VPN and accounting, and the other port for other usages. How can I tell Linux not to allow any requests from port 2 for Apache, MySQL, mailserver, ssh, etc. so it will use the VPN port, and likewise not allow port 1 to handle VPN traffic but allow everything else?


title: On Debian in fluxbox, GtkPod has no write permission, but does in GNOME

text: In fluxbox I manually mount my iPod, then run GtkPod as a normal user, unfortunately this doesn't give me write permissions as a normal user. (I can paste the error message in later when I am home if needs be, but it's a generic "Unable to write to /drive, permission denied") In GNOME however the iPod is automatically mounted and the normal user has write permissions. Please can someone explain how GNOME is mounting it so that write permission is enabled for normal user?


title: Can't access mail server through SMTP

text: I'm trying to send email from a server. Testing on my local machine works fine but on my production Ubuntu server, the webserver fails when trying to send email. I'm using GMail as my SMTP provider and it appears that the problem is that the production server does not allow access to the Google SMTP server. The following command established a successful connection on my own machine but fails on the server:               $ openssl s_client -crlf -connect smtp.gmail.com:465     connect: Connection refused     connect:errno=111      I've tried various combinations of `iptables` in case the ports where closed. I've also tried disabling the firewall with `ufw disable`. Neither has yielded any success for me. Update: `telnet smtp.gmail.com 465` outputs:               Trying 74.125.143.108...     Trying 74.125.143.109...     Trying 2a00:1450:4010:c04::6c...     telnet: Unable to connect to remote host: Network is unreachable      `openssl s_client -starttls smtp -crlf -connect smtp.gmail.com:465` gives me:               connect: Connection refused     connect:errno=111      Furthermore `iptables-save` outputs:               # Generated by iptables-save v1.4.12 on Thu Aug 21 13:06:19 2014     *mangle     :PREROUTING ACCEPT [16698:11267219]     :INPUT ACCEPT [16698:11267219]     :FORWARD ACCEPT [0:0]     :OUTPUT ACCEPT [13015:16282858]     :POSTROUTING ACCEPT [13015:16282858]     COMMIT     # Completed on Thu Aug 21 13:06:19 2014     # Generated by iptables-save v1.4.12 on Thu Aug 21 13:06:19 2014     *nat     :PREROUTING ACCEPT [1421:163021]     :INPUT ACCEPT [678:92411]     :OUTPUT ACCEPT [1339:83461]     :POSTROUTING ACCEPT [1339:83461]     COMMIT     # Completed on Thu Aug 21 13:06:19 2014     # Generated by iptables-save v1.4.12 on Thu Aug 21 13:06:19 2014     *filter     :INPUT ACCEPT [9933:3116585]     :FORWARD ACCEPT [0:0]     :OUTPUT ACCEPT [12536:16243622]     -A INPUT -i lo -j ACCEPT     COMMIT     # Completed on Thu Aug 21 13:06:19 2014


title: How to see free disk space on SunOS?

text: It really makes me mad. SunOS 5.9               #format      Searching for disks...done     No disks found!     # mount     / on /dev/md/dsk/d0...(skip)     /var on /dev/md/dsk/d4 ...     /opt on /dev/md/dsk/d5 ...     /home on /dev/md/dsk/d9 ...     /usr/local on /dev/md/dsk/d10 ...     # fdisk -G /dev/md/dsk/d0     fdisk: /dev/md/dsk/d0 must be a raw device.     # fdisk -G /dev/md/dsk     fdisk: /dev/md/dsk must be a raw device.     # fdisk -G  /dev/rdsk/c0t0d0s0      fdisk: Cannot open device /dev/rdsk/c0t0d0s0.     # ls /dev/rdsk     c0t0d0s0   c0t0d0s6  ...(72 items total)     # ls /dev/md/     admin   dsk     rdsk    shared     # ls /dev/md/dsk     d0......d127      prtvtoc works, but I can see total space only and have to use calculator to get Mb/Gb :(               # prtvtoc /dev/md/dsk/d10     * /dev/md/dsk/d10 partition map     *     * Dimensions:     *     512 bytes/sector     *     424 sectors/track     *      24 tracks/cylinder     *   10176 sectors/cylinder     *   14087 cylinders     *   14087 accessible cylinders     *     * Flags:     *   1: unmountable     *  10: read-only     *     *                          First     Sector    Last     * Partition  Tag  Flags    Sector     Count    Sector  Mount Directory            0      0    00          0 143349312 143349311     # prtvtoc -f /dev/md/dsk/d0     FREE_START=0 FREE_SIZE=0 FREE_COUNT=0 FREE_PART=      Regardless FREE_SIZE=0 system is up and running quite well. moreover:               # df     df: cannot execute     # bdf     bdf: not found     # pkgadd     pkgadd: not found      Please help. P.S. this server is really in bad condition:               # ls /     (here some folders, including usr)     # ls /usr     (here some folders again, including apache)     #ls /usr/apache     /usr/apache: I/O error      Thanks @Nikhil and @MaxMackie. I think the trouble is out of this question.


title: Lose network connectivity when bringing up second NIC

text: I currently have a CentOS 6.5 box with 4 NICs. `eth0`, `eth2` and `eth3` all come up fine, however when I bring `eth1` up with an IP address, even on it's own, it causes complete network loss. If I remove the IP and bring `eth1` up with the other NICs it works fine. Then adding an IP and restarting network services causes the network to lose connection again and requires a console connection to bring the interface down. Is there anything that can be causing this on this particular NIC? Configs for each NIC as below: eth0               DEVICE=eth0     TYPE=Ethernet     ONBOOT=yes     NM_CONTROLLED=no     BOOTPROTO=none     HWADDR=3C:4A:92:11:11:11     IPADDR=192.168.228.225     PREFIX=24     GATEWAY=192.168.228.254     DNS1=192.168.224.201     IPV4_FAILURE_FATAL=yes     IPV6INIT=no     IPV6_AUTOCONF=no     NAME="Management"      eth1               DEVICE=eth1     TYPE=Ethernet     ONBOOT=no     NM_CONTROLLED=no     BOOTPROTO=none     HWADDR=3C:4A:92:00:00:00     IPADDR=192.168.223.225     PREFIX=24     GATEWAY=192.168.223.254     DNS1=192.168.223.201     IPV4_FAILURE_FATAL=yes     IPV6INIT=no     IPV6_AUTOCONF=no     NAME="Production"      eth2               DEVICE=eth2     TYPE=Ethernet     ONBOOT=yes     NM_CONTROLLED=no     BOOTPROTO=none     HWADDR=00:13:3B:00:00:00     NAME="Mirror Port Switch 1"      eth3               DEVICE=eth3     TYPE=Ethernet     ONBOOT=yes     NM_CONTROLLED=no     BOOTPROTO=none     HWADDR=00:13:3B:11:11:11     NAME="Mirror Port Switch 2"


title: Passing arguments from one command into the next

text: I'm trying to write a script to unify two separate commands I run by hand into a single bash script I can then cron. The first command is a simple find on files with a certain name and size               find /some/path -type f -name file.pl -size +10M      This will produce several matching files and their full path. I then copy these paths by hand into a for loop as arguments to the next script.               for path in /some/path/1/file.pl /some/path/2/file.pl /some/path/3/file.pl ; do perl /my/script.pl $path ; done      Seems like it should be easy to get this into a single shell script but finding it a struggle.


title: How to check disk usage in ftp?

text: Is there a way to sum up the disk usage of a certain directory while in **ftp**? I was trying to create a script that will check what is the disk usage of the current directory and prints out the free space for the home directory. Example:               ftp> cd /home/directory/     drw-rw-rw-   1 user     group           0 Nov 16 /directory     drw-rw-rw-   1 user     group           0 Nov 16 next/directory     drw-rw-rw-   1 user     group           0 Nov 16 next/next/directory      For some reason, I cant see any size for directories. But inside them were files that I need to check the usage, so I have to get something like this:               total disk usage for /home/directory = "some count"     total disk usage for /next/directory = "some count"     total disk usage for /../directory = "some count"


title: Making the transition to multiple hard drives with dual boot

text: Hi I'm looking for tip or things to watch out for, while I make the following changes to my system: I currently have a dual boot setup on one hard drive (win7 and ubuntu), I am going to change to a 60gb ssd, and 2 hard drives. -SSD will have ubuntu / -"Hard drive 1" will have ubuntu /home (although some bits will go back to ssd) -"Hard drive 2" will have win7 Here is my initial thoughts on how to do it: (Assuming I currently have "hard drive 2" only) 1- Move important files from ubuntu partition onto windows partition. 2- log into windows and expand the windows partition to fill hard drive 2, wiping my ubuntu install. 3- Install SSD and "hard drive 1" into computer, turn on computer and hope the computer recognises them... or whatever is supposed to happen 4 - Insert Ubuntu live cd, and install ubuntu / on ssd and ubuntu /home on "hard drive 1" Does this sound like a good plan? My major concern is what is going to happen to grub and bootloading during this process, is it all going to go wrong (I have minimal experience with grub and bootloader) e.g. during step 2.


title: How to calculate in linux number of file inside nested directories?

text: I need to extract information how much files are in some directory tree:                 /.../testRoot/test1/test11/..../file1       /.../testRoot/test1/test11/file2       /.../testRoot/test1/test11/..../file3       /.../testRoot/test1/test11/file4     .....................................       /.../testRoot/test1/test1n/fileq       /.../testRoot/test1/test1n/..../filew       /.../testRoot/test1/test1n/filee       /.../testRoot/test1/test1n/.../.../ .../filer      How to calculate how many files are inside of testRoot? Thanks.


title: Move /tmp to RAM

text: I am trying to move `/tmp` to RAM and obey good practice:   * `/var/tmp` should NOT be placed in `tmpfs`, as it must survive reboots   * not mount `/tmp` as a stand-alone `tmpfs`, but rely on `/dev/shm` or `/run/shm` However, things have changed between 2.6 and 3.2 kernels : Changes to the configuration and defaults of tmpfs filesystems On 3.2 kernel, use `RAMTMP=yes` in `/etc/default/tmpfs`. My question is: how can I achieve this goal with older kernels ? My choice is nor to modify /etc/fstab neither this :               mkdir /dev/shm/tmp     chmod 1777 /dev/shm/tmp     mount --bind /dev/shm/tmp /tmp      Is there something like `RAMTMP` for 2.6 kernels ?


title: Fedora 19 livecd - doesn't work with any tools on VirtualBox

text: I want to create a custom live distribution of Fedora. I am using Fedora 19 live CD on VirtualBox on Windows (64bit Macbook Pro) to do this. I have tried following on Fedora 19 32 bit, Fedora 19 64 bit and Fedora 18 64 bit with same result: **Revisor** (Create Your Own Fedora Distribution with Revisor) - this freezes on "Loading Repositories". I have also tried using the following command and it got stuck in loading repositories at 18%:               revisor --cli --config=/etc/revisor/revisor.conf --model=f19-x86_64 \     --kickstart=/livecd/fedora-live-base.ks --respin \     --live-usb-thumb --live-shell         **livecd-creator** \- I used the following command and it just froze (I kept it running for half an hour but nothing happened)               livecd-creator --config=/root/fedora-live-base.ks --fslabel=Fedora-LiveCD --cache=/var/cache/live         **mock** (How to create a Fedora install ISO for testing) also freezes on "Start: yum update"    I have checked my internet connection and that is working fine. Can anyone please suggest any solutions or alternatives to this? * * * Update: I tried the command livecd-creator on Fedora 19 32-bit as follows:               livecd-creator --verbose --config =/livecd/fedora-live-desktop.ks --fslabel=Fedora-LiveCD --cache=/var/cache/live      I can see it is retrieving many packages but randomly (I tried 5 times) gets stuck at one of the packages like gnome-* (like gnome-calculator, gnome- keyring, etc.) Any idea what is happening???


title: CentOS 6 - nameserver entry in resolve.conf resetting after restarting network services?

text: In `/etc/resolv.conf`, I've changed the nameserver line to a new IP address. After saving and exiting, I run `service network restart`. I then go open `/etc/resolve.conf` again and see that the IP address I changed is now back to what it was prior to changing. Why is this happening?


title: In CentOS, what is the difference between yum update and yum upgrade?

text: What is the difference between `yum update` and `yum upgrade`, and when should I use one over the other?


title: FreeBSD 9.0 with GNOME 3

text: Is this possible , to install GNOME 3 on FreeBSD , at the moment ? I did not find a clear answer about this.


title: Is there a faster interface for info from /proc/net/tcp?

text: Given a linux TCP socket's inode (obtained via `/proc/<pid>/fd`), is there a faster way to look up the information that I can get from `/proc/net/tcp` about this socket? I have written a troubleshooting tool which monitors processes and prints realtime information about IO operations (`strace`-type info collected into higher level abstractions and presented in a less raw way), but on a heavily loaded network server, I am finding that the time it takes to look up socket info (e.g. the foreign address/port) is prohibitive simply due to the very large size of `/proc/net/tcp` (about 2MB on the server I'm currently looking at). I can manage this somewhat with caching, but this necessarily introduces latency and makes me wonder about the absurdity of an "API" that requires reading and parsing 2MB worth of ASCII text in order to find info on a socket.


title: GRUB error 17 booting USB disk

text: I have a USB disk with Grub 1 installed. I have 6 different Linux versions, all on different partitions, and one boot partition to hold the kernel images and grub. On some systems this works great, I get the boot menu and I can pick the linux distro. But on 2 systems I keep getting error 17 (and nothing else onscreen). I've confirmed the partition table ordering is correct, the partition table is valid, no errors on boot partition, etc. I've also reinstalled GRUB onto the MBR several times. Can someone explain why this is happening, and what I can do to fix?


title: Brace expression does not work in find regex

text: I have two folders, `CA01` and `CA02` under current folder, `foo`:               foo -+          |          +-CA01          |          +-CA02      When I type               find . -regex ".*CA[0-9]+" -exec echo {} +      Or               find . -regex ".*CA[0-9][0-9]" -exec echo {} +      I have the following output, which is expected:               ./CA01 ./CA02      But when I type in               find . -regex ".*CA[0-9]\{2\}" -exec echo {} +      **Nothing shows up, which is quite unexpected.** Because, by default, `find` uses emacs regex. I could use all the above to match the two folders. Am I missing something here?


title: Launch application as root user in GNOME

text: I've got CentOS 6 installed on my server. A few users want to have access to it via VNC, so I installed GNOME separately. Everything works okay, but I want to have possibility to run applications as the root user without providing the root password (just like `sudo` in the terminal). Where can I set this up in GNOME? I know that if I would install GNOME during the CentOS installation, I could just `visudo` and add certain users and that would be it. But when I installed GNOME separately it can't be done like this.


title: make google talk use the correct alsa sound device for input

text: I'm trying to make the Google Talk plugin accept sound. In other programs (e.g. Skype, Audacity) I did this by selecting the device for my sound input, hw:0.2 (see screenshots). Google Talk does not give me that option, shows instead only output devices and a default device. I tried to further configure the default capture device, but that did not help. Perhaps I did it the wrong way? Or maybe there is a way to create a device that Google Talk will pick up and allow me to select it? ![selected input in audacity](http://i.stack.imgur.com/pqUiP.png) ![selected input in skype](http://i.stack.imgur.com/ZVjQn.png) ![devices in Google Talk are very different](http://i.stack.imgur.com/sklbT.png) `.asoundrc`               pcm.!default {     type hw     card 0     }          ctl.!default {     type hw     card 0     }          # try to help Google Talk     pcm.!default {              type asym              capture.pcm {                      type plug                      slave.pcm "hw:0,2"              }      }      # end test for Google Talk          pcm.!default {         type plug         slave.pcm {             type asym             playback.pcm "dmix:SB"             capture.pcm "dsnoop:SB"         }     }          # Make OSS apps default to using dmix plugin too     pcm.dsp0 {         type plug         slave.pcm "dmix"     }


title: KDE apps look ugly over ssh

text: I am on a Kubuntu machine and sometimes reach another Xubuntu machine over ssh, and launch some KDE apps from there, these apps look really weird while the GTK apps look normal. Here are some screenshots: ![enter image description here](http://i.stack.imgur.com/lNxNh.png) ![enter image description here](http://i.stack.imgur.com/WI0Cv.png) ![enter image description here](http://i.stack.imgur.com/pcoei.png) ![enter image description here](http://i.stack.imgur.com/jZQie.png) For comparison, the kate editor launched locally looks like this: ![enter image description here](http://i.stack.imgur.com/1MeiF.png) A gtk app (ristretto image viewer) over ssh: ![enter image description here](http://i.stack.imgur.com/rk3JN.png)


title: comm not working to find unique words to file1 from two files

text: I have two text files in which I have to use the comm command to extract all unique words from file 1. So just those that are not in file 2. I was asked to use the `comm` command (not `diff` nor `join`). I have tried a lot of things such as `comm -32 file1 file2`, but this returns all the words in file 1.


title: Trying to form group with two users

text: I am trying to form a group with two users so that only those two users have access to a directory using               chmod g+r dir      I form a new group, www-OtagoHarbour, and try to add an existing user, OtagoHarbour, like this.               OtagoHarbour@WebServer:/var/www/executables$ sudo groupadd www-OtagoHarbour     OtagoHarbour@WebServer:/var/www/executables$ sudo useradd -G www-OtagoHarbour OtagoHarbour     useradd: user 'OtagoHarbour' already exists     OtagoHarbour@WebServer:/var/www/executables$ sudo useradd -g www-OtagoHarbour OtagoHarbour     useradd: user 'OtagoHarbour' already exists      Of course the user 'OtagoHarbour' exists but I want to add it to a group with another user.


title: how to put color variables in bash $'...'

text: I have defined in one file which I source from `.bashrc`, color constants.. like these.. > txtgrn='\e[0;32m' # Green   >  txtylw='\e[0;33m' # Yellow   >  txtblu='\e[0;34m' # Blue   >  txtpur='\e[0;35m' # Purple When I try to use them in my $PS1 variable I am getting strange results, in that everything looks fine till I press `CTRL-R` for recursive history search when few characters on the begining scramble, so I am able for example to delete them pressing `CTRL-D` in shell behind that -> pointer : I am using `$'..'` notation, to be able to insert unicode chars..               PS1=$'\xE2\x99\x94 [\\t][\u]->'        so now, what is the proper way of inserting variable like `$txtblu` from above, into `PS1` line..? EDIT: so line like this one:               PS1=$'\n\W\xe2\x98\x85 '$txtpur'\n\n[\t]'$txtrst'[\u]->'      makes rendering of symbols and colors ok, but when I press `Ctrl`+`R`, type few chars, and then `Ctrl`+`B` few(2 of them I think) characters appear on the beginning of resulting command search which are not belonging to that history line, and I am able to delete them.


title: sliding window of JPGs from thousands of files

text: My machine has a camera attached that can take thousands of jpgs a day. I am looking for a way of remotely looking at the last 30 to 60 mins of footage via a cloud storage site such as `box.com`. I thought that copying the last 5 mins of files to a mounted remote drive (davfs2) every min and then deleting files each 10 mins that were older than an hour would be a good solution; but it has caused big problems! It caused my machine not to be able to connect via SSH; thus requiring me to power it off. Now, even if I try and delete the files, it is still re-copying them to the mounted drive. I've had to un-mount the drive, but don't seem to be able to clear the davfs2 cache. Is there a fundamental problem with my approach? I put this in my crontab:               */1 * * * * sudo find /mnt/ -type f -cmin -5 -exec cp -pn '{}' /home/pi/box/street_pictures/ \;     */10 * * * *  sudo find /home/pi/box/street_pictures -cmin +60 -type f -exec rm '{}' \;      `/nmt` is the folder with the thousands of pictures. `/home/pi/box/street_pictures` is my mounted drive.


title: Download multiple URLs at once

text: I'm aware of `wget -i` as a way to download a list of URLs. The only trouble is that I need to pass some different POST data to each one, which works for single urls using `wget --post-data=` but not for lists. I'm open to any CLI downloader, or even something in JS or Python. I would however like to get either a progress bar for each download or a log file updated each time a dl finishes, or some other way of knowing when a dl finishes.


title: Huge UI elements in Crunchbang

text: I have just installed Crunchbang on my Desktop, and windows and menus appear incredibly enlarged. When I right click the context menu fills the screen, for example. My graphics card is the Radeon HD 7790. I'm sure this has something to do with AMD's shitty Linux support. I have the OS installed on a partition on an external HDD, so I booted the same install up on my Intel HD 4000 laptop and did not get this problem. I installed `fglrx-driver` through `apt` while it was booted on my laptop, but when I loaded it on the desktop this problem persisted. I managed to open a terminal on the desktop, and—with great difficulty—ran `xrandr`, which said it was running at a 1280x720 resolution (My monitor is 1080p). when I ran `aticonfig --initial` on the desktop it said it could not find a supported connector. ![Picture of monitor](https://photos-6.dropbox.com/t/0/AAD9ap2r9kN9bSO45kibIbYqYFvTZkX1CRNDUBhjwH- RzQ/12/127476718/jpeg/1024x768/3/1409036400/0/2/2014-08-25%2023.55.37.jpg/FhnmjYon5Ol4R98oADu8p79_1IolKs2AkYqxvQV7O8Y)


title: difference between /var/www and /usr/local

text: I don't understand the difference between `/var/www` path and `/usr/local` path on linux command because for instance at the moment I can see my red5 server folder is in the latter path and within that folder is `/webapps/root/demos` path and has me wondering why it is there and why red5 directory is not in the first path. What is the difference between these two paths? I mean one is clearly to place all your publicly viewed html files and then I can understand the `/etc/httpd` path for apache but does `/usr/local` always refer to things such as media and server connections- is that why? Then what would the `root` in webapps refer to, how is that implemented when demos can be accessed essentially by anyone if you have your server running.


title: Does ionice work with the deadline scheduler?

text: My Debian Wheezy systems use the `deadline` scheduler. I'm accustomed to using `ionice` to reschedule the I/O priority of disk-intensive jobs at busy times, and anecdotally this seems to help (but I don't have any hard evidence). The `ionice` manpage, kernel documentation and this OpenSUSE document all suggest that only the `cfq` scheduler takes into account `ionice` interventions. They don't explicitly state that other schedulers ignore it, but the only one they mention is `cfq`. Do other schedulers, in particular `deadline`, work with `ionice`?


title: Writing own daemon. systemd error: Failed to read PID from file: Invalid argument

text: I'm trying to write own daemon a la very simple MPD (it's operating systems laboratory work). I made it work: it starts like a daemon (output of ps):               1 14877 14877 14877 ?           -1 Ss       0   0:00 lab1_daemon      it plays, it gets signals. The problem is that I can't run it with systemd. I wrote very simple .service file:               [Unit]     Description=Operating systems lab 1 daemon          [Service]     Type=forking     PIDFile=/run/lab1_daemon.pid     ExecStart=/path/lab1_daemon          [Install]     WantedBy=multi-user.target      But when I run daemon with `systemctl start` it hangs for 0.5 min and then in logs I see:               Failed to read PID from file /run/lab1_daemon.pid: Invalid argument     lab1_daemon.service never wrote its PID file. Failing.      But it did! I checked it:               -rw-r--r-- 1 root root 13 Mar  5 00:13 /run/lab1_daemon.pid      What have I done wrong? PS: I even tried `daemon` function to check, that I did daemonizing correctly. But I got same results. Minimal source code (58 LOC, moved from pastebin):               #define _BSD_SOURCE     #define _GNU_SOURCE     #define _POSIX_C_SOURCE 199506L     #define _D_XOPEN_SOURCE 700          #define NAME "lab1_daemon"     #define PID_FILE_NAME "/run/" NAME ".pid"          #include <errno.h>     #include <fcntl.h>     #include <stdbool.h>     #include <stdio.h>     #include <stdlib.h>     #include <string.h>     #include <syslog.h>     #include <sys/stat.h>     #include <sys/types.h>     #include <unistd.h>          int lockfile(int fd)     {             struct flock fl;             fl.l_type = F_WRLCK;             fl.l_start = 0;             fl.l_whence = SEEK_SET;             fl.l_len = 0;             return fcntl(fd, F_SETLK, &fl);     }          bool is_already_running(char const *lock_file_name)     {             int lock_file = open(lock_file_name, O_RDWR | O_CREAT,                                  S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);             if (lock_file < 0)                     exit(1);                  if (lockfile(lock_file) < 0) {                     if (errno == EACCES || errno == EAGAIN) {                             close(lock_file);                             return true;                     }                     exit(1);             }             ftruncate(lock_file, 0);             char buf[16];             sprintf(buf, "PPID: %ld\n", (long)getpid());             write(lock_file, buf, strlen(buf) + 1);             return false;     }          int main(void)     {             if (is_already_running(PID_FILE_NAME))                     exit(EXIT_FAILURE);             daemon(0, 0);             sleep(10);             exit(EXIT_SUCCESS);     }


title: specify PREFIX location when running make

text: I need to install redis 2.8.x into a specific directory so I can later use fpm to create an rpm. From my research, it seems that this should be possible by using `make PREFIX=`               mkdir /tmp/installdir     cd /tmp     wget http://download.redis.io/releases/redis-2.8.6.tar.gz     tar -xvf redis-*.tar.gz     cd redis-2.8.6     make PREFIX=/tmp/installdir     make install      I expect the binaries to be placed in /tmp/installdir, unfortunately that directory remains empty. It seems `PREFIX=/tmp/installdir` is being ignored. Normally I would run `./configure --prefix=/tmp/installdir` however because the download does not contain source code, there is no `configure` file. How can I install software to a non standard directory?


title: Two DNS servers, both incomplete

text: In my company we have 2 DNS servers: one for the internal hostnames and one for Internet. I tried to configure both in my Network Manager, who result in having the two DNS server IPs in my `/etc/resolv.conf`. If I put as primary DNS server the Internet one, when I try to resolve the name of one internal hostname, it fails, and the resolver doesn't try to found the IP using the secondary DNS server. In the other hand, if I put the internal DNS as primary, I cannot reach any Internet server from my computer. Is there a solution to make the resolver to query the seconday DNS when the first one answer with “no such name” or any other DNS lookup error?


title: What is "ALL ALL=!SUDOSUDO" for?

text: The last line of the /etc/sudoers file is:               grep -i sudosudo /etc/sudoers     Cmnd_Alias SUDOSUDO = /usr/bin/sudo     ALL ALL=!SUDOSUDO      why? What does it exactly do? UPDATE#1: Now I know that it prevents users to use the: "/usr/bin/sudo". UPDATE#2: not allowing "root ALL=(ALL) ALL" is not a solution. **Updated Question:** What is better besides this "SUDOSUDO"? (the problem with this that the sudo binary could be copied..)


title: Parameter expansion seems to be missing a piece

text: I'm currently learning how to write simple scripts and can't get my head around a very simple problem. I have the following command in my script...               touch ${DIRECTORY}/${FILE}      This command appears several times in my script and works fine in all instances except for one. For some reason, at one point only, it decides to include the slash in the filename that it's trying to create and I get the error...               cannot touch `/myfile.dat': Permission denied      At first I thought it was just probably down to my inexperience (which it probably is) but after doing a bit of research, I've seen this line used in countless examples working correctly. I can't understand - the same line is working fine in several other locations in my script! Anybody care to shed some light on this? It's the inconsistency that's really annoying me. Can the commands surrounding this particular command affect its outcome?


title: Substitute placeholders in template

text: Say I have a shell configuration file `config` like this:               HOST=localhost     PORT=8080      Now I have a template `template` like this:               The host is <%= @HOST %>     The port is <%= @PORT %>      How do I substitute placeholders in `template` with values in `config` file? I can certainly do it like this:               $ . config     $ sed -e "s/<%= @HOST %>/$HOST/" \     > -e "s/<%= @PORT %>/$PORT/" < template     The host is localhost     The port is 8080      But if there are many config values this becomes too cumbersome. How would I do this in more generic way? I would like to iterate over each placeholder and substitute it with a real value.


title: Memory usage caused by MySQL or Apache?

text: ![my vps memory usage](http://www.fileden.com/files/2012/9/14/3347302/my%20usage.png) Here is a screenshot of my usage today on an idle unfinished cms drupal site with a maximum of 14 added modules besides core and no activity or users. As you can see I am at my limit which is crazy so I need to limit memory usage of apache and mysql and php because my VPS is smallest one which should suit my current needs. My system file my.cnf does not have a list of parameters as I've seen posted elsewhere but this is the file which apparently will lessen usage of memory amongst other things I've read like memory leaks and apache MPM workers vs apache prefork which seems to be what I have. So how can I significantly reduce memory usage without removing apache or php5? I am using mysql version 5.1.66 and looks like innodb and show variable yabbit.net/mysql.txt


title: Mail server installation in Cent OS 6.2

text: I have a server with a dedicated IP. I didn't take any domain yet. CentOS 6.2 is installed on this server. I tried to install mail server in it and followed these links exactly.   * The Perfect Server - CentOS 6.3 x86_64 (Apache2, Courier, ISPConfig 3)   * Postfix HOWTO - centos.org Everything is installed perfectly but my questions are:   1. How do I create mail id’s and where?    2. Where is my main mail panel?    3. How does the mail system work and how to manage it?    4. How to make mail system secure and customized?    5. How to make my IP address swap with a name e.g. mail.something.com not IP?    6. Can I use only IP to send or receive mail with this mail server? I need to install mail server for my small group of 50 people and this may increase in time. I need the full installing guide of mail server from A to Z procedure.


title: Unable to telnet public ip on port 80

text: We are facing a communication problem between the public and our private network. We have a Linux based web server behind a firewall and an internet router. As part of some integration, our web portal team is trying to Telnet the public IP of an another web portal from these Linux web servers on port 80, but the connection is closed by remote host just in time it says connected.   But same is successful while we try it from a Windows based web server in our network. Everything seems fine, the firewall is passing the traffic. Does it matter if one end server is running Linux and other end is a Windows server. Because the public IP application server is running Windows server. what are the key points to meet the requirement to make the communication succeed. Refer the below error logs.               ]$ telnet 220.226.190.180 80     Trying 220.226.190.180...     Connected to 220.226.190.180 (220.226.190.180).     Escape character is '^]'.     Connection closed by foreign host.


title: Download https pages

text: I can download few files from https site through web browser. By using the proper credentials, is it possible to download the https pages through command line ( that too non-interactively ) ? e.g. To download This image non-interactively through command line with proper credentials, I will search for lines with "png" extension PLEASE VOTE TO CLOSE THE QUESTION ( I am bit confuse, what to ask exactly )


title: How does the kernel store the virtual memory area?

text: I am trying to understand `do_page_fault` in `fault.c` (x86 architecture). I came across the method `access_error` where we compare the error code to the vm flags. As per my understanding, we are checking an error code passed on a page fault, i.e., we are comparing the flags of a page to those of its `vm_area`. Does this imply that `vm_area` is a group of pages whose flags are the same? Specifically, does linux store or organize `vm_area` so that all pages with similar properties are together?


title: Login when root filesystem is full

text: Will I be able to login into the system if the root filesystem is 100% full? Configuration: `home` is not a partition but is also placed on the `root` (i.e. `/home` is a directory on the partition holding root `/`), `var` and `tmp` are separate partitions and in good state.


title: Can a file that was originally sparse and expanded be made re-sparse

text: I know that copying or transferring what was originally a sparse file without using a utility that understands sparse files will cause the 'holes' to be filled out. Is there a method or utility to turn what was once a sparse file back to sparse? For Example:   create sparse file:               % dd if=/dev/zero of=TEST bs=1 count=0 seek=1G     # do some op that pads out the holes     % scp TEST localhost:~/TEST2     % ls -lhs TEST*        0 -rw-rw-r--. 1 tony tony 1.0G Oct 16 13:35 TEST     1.1G -rw-rw-r--. 1 tony tony 1.0G Oct 16 13:37 TEST2      Is there some way to:               % resparse TEST2     to get:        0 -rw-rw-r--. 1 tony tony 1.0G Oct 16 13:35 TEST       0G -rw-rw-r--. 1 tony tony 1.0G Oct 16 13:37 TEST2


title: For an init.d startup script, what is the ideal user to use as the owner of that process

text: Everyone says that running processes as root is bad, since it defeats the security and privileges model. But what user should be used to run a startup process? Is it really necessary to create a new user, just to own a single startup process?


title: Fetching user input while running in the background

text: I am writing a script that prompts the user for input and does some processing afterwards. I was using `read` to get the data, but then I noticed that when the script is ran with a keyboard shortcut (I added an entry in Ubuntu's Keyboard Shortcut list) it ignores the `read` and continues with the rest of the code. How can I read user input with a script running in the background like this?