title: Rogue AP channel hopping problem

text: I am able to set AP but despite explicitly setting channel for monitor interface and AP, AP frequency changes regularly. My setup:   * OS: Kali Linux 1.0 (booted from a USB stick)    * External network adapter: Alfa AWUS036NH (chipset Ralink RT2870/3070, driver: rt2800usb)    * On-board network adapter: Atheros (chipset AR9485, driver: ath9k) What I want to achieve:   * to create an AP which runs on channel 6 on the Alfa adapter What I've done:               root@kali:~# ifconfig     eth0      Link encap:Ethernet  HWaddr dc:0e:a1:28:8f:fc                 UP BROADCAST MULTICAST  MTU:1500  Metric:1               RX packets:0 errors:0 dropped:0 overruns:0 frame:0               TX packets:0 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)               Interrupt:16           lo        Link encap:Local Loopback                 inet addr:127.0.0.1  Mask:255.0.0.0               inet6 addr: ::1/128 Scope:Host               UP LOOPBACK RUNNING  MTU:65536  Metric:1               RX packets:8 errors:0 dropped:0 overruns:0 frame:0               TX packets:8 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:480 (480.0 B)  TX bytes:480 (480.0 B)          wlan0     Link encap:Ethernet  HWaddr 9c:b7:0d:04:d2:f5                 inet addr:192.168.2.140  Bcast:192.168.2.255  Mask:255.255.255.0               inet6 addr: fe80::9eb7:dff:fe04:d2f5/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:105 errors:0 dropped:0 overruns:0 frame:0               TX packets:29 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:11692 (11.4 KiB)  TX bytes:2834 (2.7 KiB)          wlan3     Link encap:Ethernet  HWaddr 00:c0:ca:59:23:d0                 inet addr:192.168.2.223  Bcast:192.168.2.255  Mask:255.255.255.0               inet6 addr: fe80::2c0:caff:fe59:23d0/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:21 errors:0 dropped:0 overruns:0 frame:0               TX packets:10 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:1572 (1.5 KiB)  TX bytes:1300 (1.2 KiB)          root@kali:~# iwconfig     eth0      no wireless extensions.          lo        no wireless extensions.          wlan3     IEEE 802.11bgn  ESSID:"SomeNetwork"                 Mode:Managed  Frequency:2.437 GHz  Access Point: 0A:60:6E:EA:96:31                  Bit Rate=13 Mb/s   Tx-Power=20 dBm                  Retry  long limit:7   RTS thr:off   Fragment thr:off               Encryption key:off               Power Management:on               Link Quality=70/70  Signal level=-27 dBm                 Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0               Tx excessive retries:0  Invalid misc:2   Missed beacon:0          wlan0     IEEE 802.11bgn  ESSID:"SomeNetwork"                 Mode:Managed  Frequency:2.437 GHz  Access Point: 0A:60:6E:EA:96:31                  Bit Rate=1 Mb/s   Tx-Power=16 dBm                  Retry  long limit:7   RTS thr:off   Fragment thr:off               Encryption key:off               Power Management:off               Link Quality=70/70  Signal level=-39 dBm                 Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0               Tx excessive retries:2  Invalid misc:25   Missed beacon:0          root@kali:~# ifconfig wlan3 down     root@kali:~# ifconfig     eth0      Link encap:Ethernet  HWaddr dc:0e:a1:28:8f:fc                 UP BROADCAST MULTICAST  MTU:1500  Metric:1               RX packets:0 errors:0 dropped:0 overruns:0 frame:0               TX packets:0 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)               Interrupt:16           lo        Link encap:Local Loopback                 inet addr:127.0.0.1  Mask:255.0.0.0               inet6 addr: ::1/128 Scope:Host               UP LOOPBACK RUNNING  MTU:65536  Metric:1               RX packets:8 errors:0 dropped:0 overruns:0 frame:0               TX packets:8 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:480 (480.0 B)  TX bytes:480 (480.0 B)          wlan0     Link encap:Ethernet  HWaddr 9c:b7:0d:04:d2:f5                 inet addr:192.168.2.140  Bcast:192.168.2.255  Mask:255.255.255.0               inet6 addr: fe80::9eb7:dff:fe04:d2f5/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:125 errors:0 dropped:0 overruns:0 frame:0               TX packets:29 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:15214 (14.8 KiB)  TX bytes:2834 (2.7 KiB)          root@kali:~# iwconfig     eth0      no wireless extensions.          lo        no wireless extensions.          wlan3     IEEE 802.11bgn  ESSID:off/any                 Mode:Managed  Access Point: Not-Associated   Tx-Power=20 dBm                  Retry  long limit:7   RTS thr:off   Fragment thr:off               Encryption key:off               Power Management:on          wlan0     IEEE 802.11bgn  ESSID:"SomeNetwork"                 Mode:Managed  Frequency:2.437 GHz  Access Point: 0A:60:6E:EA:96:31                  Bit Rate=1 Mb/s   Tx-Power=16 dBm                  Retry  long limit:7   RTS thr:off   Fragment thr:off               Encryption key:off               Power Management:off               Link Quality=70/70  Signal level=-38 dBm                 Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0               Tx excessive retries:2  Invalid misc:25   Missed beacon:0          root@kali:~# airmon-ng check kill               Found 4 processes that could cause trouble.     If airodump-ng, aireplay-ng or airtun-ng stops working after     a short period of time, you may want to kill (some of) them!     -e      PID Name     3512    NetworkManager     3620    wpa_supplicant     3849    dhclient     4263    dhclient     Process with PID 4263 (dhclient) is running on interface wlan3     Process with PID 3849 (dhclient) is running on interface wlan0     Killing all those processes...     root@kali:~# airmon-ng check kill     root@kali:~# ifconfig     lo        Link encap:Local Loopback                 inet addr:127.0.0.1  Mask:255.0.0.0               inet6 addr: ::1/128 Scope:Host               UP LOOPBACK RUNNING  MTU:65536  Metric:1               RX packets:12 errors:0 dropped:0 overruns:0 frame:0               TX packets:12 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:720 (720.0 B)  TX bytes:720 (720.0 B)          root@kali:~# iwconfig     eth0      no wireless extensions.          lo        no wireless extensions.          wlan3     IEEE 802.11bgn  ESSID:off/any                 Mode:Managed  Access Point: Not-Associated   Tx-Power=20 dBm                  Retry  long limit:7   RTS thr:off   Fragment thr:off               Encryption key:off               Power Management:on          wlan0     IEEE 802.11bgn  ESSID:off/any                 Mode:Managed  Access Point: Not-Associated   Tx-Power=16 dBm                  Retry  long limit:7   RTS thr:off   Fragment thr:off               Encryption key:off               Power Management:off          root@kali:~# iwconfig wlan3 channel 6     root@kali:~# airmon-ng start wlan3 6               Interface   Chipset     Driver          wlan3       Ralink RT2870/3070  rt2800usb - [phy1]                     (monitor mode enabled on mon0)     wlan0       Atheros AR9485  ath9k - [phy0]          root@kali:~# airbase-ng -c 6 -e FreeWiFi mon0     15:04:22  Created tap interface at0     15:04:22  Trying to set MTU on at0 to 1500     15:04:22  Trying to set MTU on mon0 to 1800     15:04:22  Access Point with BSSID 00:C0:CA:59:23:D0 started.      In the other terminal window I was running airodum-ng on mon0 and could see that channel hopping would be occuring (CH value x would be changing constantly):               BSSID    PWR  Beacons    #Data, #/s  CH  MB   ENC  CIPHER AUTH  ESSID     00:C0:CA:59:23:D0    0     2969        0    0   x  54   OPN              FreeWiFi         I haven't put at0 interface up neither run dhcp service but I believe that is not important at this stage. On another Android device I've been running WiFi Analyzer app which confirms that my rogue AP "FreeWiFi" does channel hopping. Questions: 1) **Why does channel hopping occur despite I set channel to 6 for wlan3, mon0 and also for AP?** 2) How to make my AP working on a fixed channel? Please let me know if any additional info is needed in order to analyze this behaviour.


title: Automatically memtest and then boot

text: Is there some way to reboot server, so it runs memtest (say, 1 or 2 passes) and then reboots back to Linux and writes report to some log? This feature in Windows Server 2012 helped me to diagnose bad RAM on remote servers couple of times, but I was not able to google any way to do so for Linux server.


title: How to ensure a bash script is executable via web without being in /cgi-bin directory?

text: My document root is                /0/      i do not have any cgi-bin directories. this is my virtual host with apache:               Listen *:80     DirectoryIndex 1          <VirtualHost *:80>     DocumentRoot /0     ServerName domain.tld     ServerAlias www.domain.tld     </VirtualHost>      what i want to do is place a bash script in this directory. the document root that is.. in it i will have.. ( test.sh )               #!/bin/bash     echo "Content-type: text/html"     echo ""     echo "test"      that is all. i suppose i need to add this line to the               /etc/sudoers      file..                apache ALL=NOPASSWD:/0/test.sh      is this all sufficient to ensure i can actually make my web site run via bash scripts and python scripts ? if this works.. what would be to use of things such as               mod_wsgi and python for the web ?      i suppose i also have to make test.sh executable               chmod +x test.sh      if this works out and i set document root to               index.sh      what would be the point of wasting time with python for the web frameworks. or even python itself given that bash for the web would be more direct and thus faster. ?


title: Switch monitors on ThinkPad W520 while docked

text: I'm trying to make my (ThinkPad W520) laptop monitor turn on (by itself, with the other monitors turning off) using xrandr when docked and connected to external monitors. My end goal is to automatically reconfigure between docking and undocking and to let me switch one of the displayed monitors to a TV (HDMI) and back, but I'm trying to start small. I've read on some forums that I need to turn off the external monitors first before I can bring up the internal one, but I haven't had any luck. I'm using the Nouveau driver on Arch Linux. Below is what I have so far. However, executing this leaves me with no monitors and I have to restart.               xrandr --output DP-2 --off     xrandr --output DP-3 --off     xrandr --output LVDS-1 --primary      What am I missing?


title: Software center crashes immediately with KeyError: 'CODENAME' on elementaryOS Luna

text: My software center crashes immediately when I try to open it. In the terminal it looks like this:               software-center     2014-08-29 17:44:29,262 - softwarecenter.fixme - WARNING - logs to the root logger: '('/usr/lib/python2.7/dist-packages/gi/importer.py', 51, 'find_module')'     2014-08-29 17:44:29,262 - root - ERROR - Could not find any typelib for Gst     2014-08-29 17:44:29,324 - softwarecenter.ui.gtk3.app - INFO - setting up proxy 'None'     2014-08-29 17:44:29,329 - softwarecenter.db.database - INFO - open() database: path=None use_axi=True use_agent=True     2014-08-29 17:44:29,489 - softwarecenter.backend.reviews - WARNING - Could not get usefulness from server, no username in config file     2014-08-29 17:44:29,559 - softwarecenter.ui.gtk3.app - INFO - show_available_packages: search_text is '', app is None.     2014-08-29 17:44:29,561 - softwarecenter.db.pkginfo_impl.aptcache - INFO - aptcache.open()     Traceback (most recent call last):       File "/usr/bin/software-center", line 176, in <module>         app.run(args)       File "/usr/share/software-center/softwarecenter/ui/gtk3/app.py", line 1422, in run         self.show_available_packages(args)       File "/usr/share/software-center/softwarecenter/ui/gtk3/app.py", line 1352, in show_available_packages         self.view_manager.set_active_view(ViewPages.AVAILABLE)       File "/usr/share/software-center/softwarecenter/ui/gtk3/session/viewmanager.py", line 154, in set_active_view         view_widget.init_view()       File "/usr/share/software-center/softwarecenter/ui/gtk3/panes/availablepane.py", line 171, in init_view         self.apps_filter)       File "/usr/share/software-center/softwarecenter/ui/gtk3/views/catview_gtk.py", line 238, in __init__         self.build(desktopdir)       File "/usr/share/software-center/softwarecenter/ui/gtk3/views/catview_gtk.py", line 511, in build         self._build_homepage_view()       File "/usr/share/software-center/softwarecenter/ui/gtk3/views/catview_gtk.py", line 257, in _build_homepage_view         self._append_banner_ads()       File "/usr/share/software-center/softwarecenter/ui/gtk3/views/catview_gtk.py", line 372, in _append_banner_ads         scagent.query_exhibits()       File "/usr/share/software-center/softwarecenter/backend/scagent.py", line 119, in query_exhibits         lang=get_language(), series=self.distro.get_codename())       File "/usr/share/software-center/softwarecenter/distro/__init__.py", line 92, in get_codename         self._distro_code_name = distro_info['CODENAME']     KeyError: 'CODENAME'      I tried several suggestions from other forum posts such as reinstalling the software center, but so far nothing has helped. I hope someone can help me with this. Thank you in advance. Remark: A while before this happened, I had a problem where some updates failed, as discussed here. There and elsewhere, people suggested to change 'luna' to 'precise' for some ppas. I did that, not by editing files but via the software center. I suspect that the issue with the software center is due to that. However, changing back 'precise' to 'luna' in /etc/apt/sources.list.d/elementary.list and /etc/apt/sources.list.d/patches.list does not make the software-center work again but brings back the updating problem.


title: What does this `cat` statement do?

text: I'm new to Linux and trying to figure out what this statement in a Bash file does. I think it combines `stdout`, `stderr` and output it to the file `$log` is pointing to and append the multiline string to it. Is it right?               cat << EOF >> $log 2>&1        the quick brown       fox jumps       EOF


title: Change library location

text: I've got different versions of the Libnet library installed in different locations on the same system:               whereis libnet     libnet: /usr/lib/libnet.la /usr/lib/libnet.a /usr/lib/libnet.so /usr/local/lib/libnet.la /usr/local/lib/libnet.a /usr/local/lib/libnet.so /usr/include/libnet.h /usr/include/libnet /usr/man/man3/libnet.3      I have some problems with compiling a program that depends on these libnet libraries so I want to remove the "usr/local/...."-ones. Can you tell me how to do that, i.e, when I whereis libnet on the command line I want to not see the "/usr/local/..." references ?! Thank you!


title: mv with rsync functionality

text: I'm trying to merge two directory trees that have many common elements but also each have elements that are only present in one of the two trees. The main issue I am having is that when `mv` encounters two sub-directories with the same relative paths it either keeps the source (with `-f`) or the destination (with `-n`) but I can't make it take the union of both sub- directories. I could of course use `rsync` with `\--remove-source-files` but this will actually copy the data and then delete the old files as opposed to a true move. The two directory trees contain several hundred GB of data and are both on same partition so I would love to do a true move if possible for the sake of time. Right now I have `find * -type file -exec mv -n {} /destination/{}` but this only moves files from the source to the destination when the target directory already exists. I can preface this command with something like `mv -n * /destination/` but this only brings over the top level directories. Is there any way to do this in a single line? I could always write a script to check if the directory exists before copying the file but this seems like such a basic task, it seems like there should be an easier way.


title: Adjust sensitivity of trackball in Linux Mint 13

text: I am using Logitech Trackball Marble and I have difficulty adjusting the sensitivity of it in Linux Mint 13. Apparently the sensitivity and acceleration setting in Linux Mint only work for the mouse. ( I have both mouse and trackball plugged) How can I adjust it? I searched about it in google but find no useful result. I've seen people digging in something called xorf.conf but I have no idea what it is. I check my /etc/X11 directory and found no xorf.conf but only some file looks like xorf.conf.fail


title: Fedora Firewall no option as of yet

text: I need a firewall because I was decade long user of internet security suites on windows. I am not a professional of networks or anything but a student who just needs to block unblock running applications... GUFW a simple firewall was a good option but isnt available on Fedora nor any gui firewall & am frustrated over searching it for 2days... I checked Vuurmuur its powerful but for noobs & if configured wrongly its a great mess (even their documentation forewarns that). Similarly SeLinux is not a firewall > A firewall controls the flow of traffic to and from a computer to the > network. SELinux can confine access of programs within a computer and hence > can be conceptually thought of a internal firewall between programs I think its just a way to protect **core filesystem** nothing more than that ... So what are my options, please suggest me something some resource that is understandable to a starter & if somehow bugged willn't have **irreversible** consequences. Further just tell me if I want to reject in/out traffic for the address(s) containing keyword _wolfram_ e.g pk.server.wolfram or wolfram-mathematica.com how would I do that in iptables or somehow...& if I want to block intenet for application /opt/telepath-gabble how would I achieve that


title: Linux Mint 14 Hangs on Install

text: When installing LM14 Cinnamon or Mate 64bit or 32bit via DVD or USB stick, on an HP nc6400 notebook, the install hangs during the listing (package loading?) at a line that states:               [1.854885] [drm] Driver supports precise vblank timestamp query.      I have tried multiple times with the different versions listed above and the install always stops at the above line. An older HP laptop (nc6230) will install LM14 with no problems. Both laptops have have ATI graphics cards. LM13 installs with no problems whatsoever on the nc6400.


title: Why do only some terminals get a pts

text: When I try to use `write` to talk to users logged into an X session results vary depending on which terminal they are using. Gnome terminal can pick up `write`s, but neither lxterminal nor terminator can. The reason is that lxterminal and terminator don't have associated pts devices: With lxterminal(s) running:               $ who     tshaw    tty7         2013-01-27 21:34      With Gnome terminal running:               $ who     tshaw    tty7         2013-01-27 21:34     tshaw    pts/1        2013-01-27 22:25 (:0)      (the tty7 entry in the above is the X session) Is there a way to configure other terminals to take pts devices or would that have to be done in source code?


title: Move a linux instalation using btrfs on the default subvolume (subvolid=0) to another subvolume

text: When doing a installation to a root btrfs filesystem, many linux distributions install to the default subvolume. If left unmodified, this layout will force any snapshots or subvolumes to be created inside the root filesystem, which may be undesirable. Another possible layout would be to have the default subvolume contain a `snapshots` directory, and a `rootfs` subvolume, which is the root filesystem. How can I change the distro-default btrfs installation to use this subvolume layout without booting from a livecd?


title: How to edit the main menu?

text: I am trying to edit the main menu. ![enter image description here](http://i.stack.imgur.com/ZpZfZ.png) There is no menu editor anywhere. I have installed `alacarte` which doesn't seem to work. Also, someone suggested to me "right clicking on the menu and clicking edit", but there is no option. How are you supposed to edit the menu? I'm using Linux-mint 13 with XFCE. Thank you.


title: How would you create a user with the HOME_DIR field in /etc/passwd completely blank?

text: Closest I can come is:               useradd --home / -r --shell /sbin/nologin someuser      But this creates an entry into /etc/htpasswd that looks something like this:               someuser:x:100:100::/:/sbin/nologin      I want that '/' gone, so that it looks like this:               someuser:x:100:100:::/sbin/nologin      Which is achievable through usermod:               usermod -d '' someuser      But I think this is a bit backwards. Any ideas?


title: Graphics fuzzy in Ubuntu 12.10

text: I am new to Linux and Ubuntu. Having just installed 12.10 I notice that I get fuzzy text and icons that change when I move my mouse over them. See picture below as an example. What could be wrong and what can I do to fix it? I have a NVIDIA Quadro 600 graphics card. ![enter image description here](http://i.stack.imgur.com/D62DC.png)


title: How to put an argument vector with an argument containing spaces in a bash variable

text: How can I store an argument vector with an argument containing spaces in a `bash` variable? For example, I want `2.sh` to print `b c` ### 1.sh               #!/bin/bash          ARGV='a "b c"'     ./2.sh $ARGV      ### 2.sh               #!/bin/bash          echo $2


title: How to find a position of a character using grep?

text: I need to identify the postion of a character in string using grep command. Example, the string is `RAMSITALSKHMAN|1223333`.               grep -n '[^a-zA-Z0-9\$\~\%\#\^]'      How do I find the position of `|` in the given string?


title: Why do I see update-like marks in Synaptic Manager (Mint/Xfce) although there is no update available?

text: I'm in Linux Mint 14, Xfce. In Synaptic Manager I see these marks that seem to indicate an available upgrade, but there isn't any. ![enter image description here](http://i.stack.imgur.com/3JAG7.png) Update manager finds nothing to upgrade. For other programs these marks are absent: ![enter image description here](http://i.stack.imgur.com/iJmlz.png) Is there something amiss here? (Maybe related to the fact that I have upgraded Thunar as shown here which I guess upgraded Xfce too.) What are these marks?


title: What does /bin/rm -f <file> do in Unix?

text: I came across a line and had no idea what it does. I have also checked Google, but still no luck.               $ /bin/rm -f fslvbm2a      There is no output on the screen.


title: rsyslog ENABLE "last message repeated"?

text: I just built a new linux 3.7.6 kernel and have a built-in module (which is not in use) throwing errors as fast as it probably can, ie, reporting a busy loop. Obviously this is not good and I have to deal with it, etc, but I would really -- really -- really -- really -- really -- really -- really appreciate it if rsyslog would not repeat the message on disk to the tune of 10MB/hour, etc. I had thought syslog daemons prevented this by using "last message repeated" but that seems not to be the case. I have no idea what this option would even be called, since _compression_ is a hot bed of references.


title: tmux: ncurses apps are displayed wrong (with garbage and so on)

text: I have ncurses apps (say, aptitude) working nice in plain xterm (or gnome- terminal, or any other terminal I've tried), but if I run it inside tmux session, screen isn't properly refreshed while I do some navigation through the menu. Example screenshot: ![aptitude qinside tmux](http://i.stack.imgur.com/AFVLX.png) (full resolution: http://i.imgur.com/jKLCX3A.png) The same happens with other ncurses apps inside tmux: say, cgdb. And again, without tmux they work nice. How to make it work correctly in tmux too? (OS is Linux Mint 13, if that does matter)


title: How to securely export a device (HDD)?

text: So I have a Scientific Linux 6.3 (RHEL clone so basically the question is Redhat related) machine called "B" (with an extra "A" HDD besides the system HDD) and a notebook with SL 6.3. They are in a /24 IPv4 subnet, and can fully reach each other. **Q** : How can I export the "A" HDD device to the notebook, so that on the notebook I could see the "A" HDD as a device /HDD/? (, and locally encrypt it using LUKS - I know this last encrypting part) The important thing is that I need the connection to be secured (SSL?) so that no one can intercept the data that I encrypt on the notebook. **OR** : is it already encrypted via LUKS? (and an SSL connection between the notebook and the "B" machine would be just an overhead?) - extra: I also need that the "exporting of the device" must be routable over network. **ps.: so the main question is: does encrypted communication needed between the notebook and the "B" machine or are ALL the datas on the HDD already encrypted when leaving the notebook (even LUKS pwd too??)**


title: How is this sed command working?

text: I want to understand, how following `sed` command is working:               sed -nre "/jar$/ { x; d; }; /class$/ { x; p; }      Actually it is part of another command to find a particular class file from the given list of jar files:               find . -name "*jar" -print -exec jar -tf '{}' \; | grep -E "jar$|CLASS_NAME" | sed -nre "/jar$/ { x; d; }; /class$/ { x; p; } "


title: How to permanently connect to WPA2AES wifi with OpenBSD (through cli)

text: I have an OpenBSD 5.1 i386 installed. I have no GUI/X. I googled for the answer but I can't find authentic one. How can I connect to a WPA2 PSK/AES wifi network using only the terminal? (so I don't have a "network manager" to simply select the given SSID, then enter passphare :D) **UPDATE:** wifi card: Atheros AR5424, I can see it as "ath0" **UPDATE#2:**               DHCP NWID SSID wpakey SSIDPWD      doesn't worked in /etc/hostname.ath0 (then the sh /etc/netstart ath0) **UPDATE#3:**               ifconfig ath0 nwid SSID wpa wpapsk $(wpa-psk SSID SSIDPWD)      gived:               ksh: wpa-psk not found     ifconfig: wpapsk: bad value      **UPDATE#4:** The router is an OpenWrt 10.03.1 box:               cat /etc/config/wireless     config 'wifi-iface'         option 'device' 'radio0'         option 'network' 'lan'         option 'mode' 'ap'         option 'ssid' 'SSID'         option 'encryption' 'psk2+ccmp'         option 'key' 'SSIDPWD'         option 'isolate' '1'         option 'maxassoc' '1'      I didn't seen anything in the logs associated to the openbsd eee pc 701 :D **UPDATE#5:** I tested the SSID with the SSIDPWD, and it worked on a Scientific Linux 6.3 notebook. **UPDATE#6:**               ifconfig ath0 nwid SSID wpakey SSIDPWD      I tried this one too, it didn't gived back any error messages, but I still can't see anything on the openwrt router, that it tries to connect, I can only see change in "ifconfig ath0" - I can see the "ieee8011" line is filled up. **UPDATE#7:** whoops :) I maybe have an idea what is the problem. :D I only have the motherboard of the eee pc 701 and the wifi card in it.. :D with NO ANTENNAS :D - so I will try to find an antenna :)


title: Is there any performance penalty to having multiple segments for one volume in LVM?

text: We have a big drive that we've split up using LVM. We allocated one segment to the root filesystem and several other segments to other filesystems. Then we wanted to add more space to the root filesystem, so we carved out another segment at the unallocated end and added it (meaning that the root filesystem is composed of two disjoint segments). Lately we've been having some I/O performance issues and the thought is that the non-contiguous root volume could be to blame. We're considering moving things around to make the root volume one (contiguous) segment, in hopes of improving performance (the thought being that this will make it easier to access things). Another school of thought is that LVM has this all sorted out and it's not going to make any difference (other than to make the graphic of the drive layout a bit more compact). What's the likely penalty we're paying for the two-segment volume?


title: Who was James Farber and why was he important to Unix?

text: I've been reading papers on Plan 9 from Bell Labs. In the paper on why Plan 9's not dead yet, around page 18, the author mentions "Farber". Googling reveals this to be a James Farber, but all I can find is that he coauthored UNIX: The Complete Reference. Who was he, and why is he important to UNIX?


title: How to search folder with only x set (execution) permission

text: I have read that if folder has only x set permission to execute it actually means that you are permitted to search this directory. So how to search it?


title: How to compare attributes of two files on Linux ext4

text: cmp(1) will of course tell me if the contents of two files are identical, but in order to test restoring from backups I also wanted to compare the relevant (!) file attributes. So if I did something simple like               mv foo.bar foo.bar.save     deja-dup --restore foo.bar # or some other backup tool      how do I compare the attributes of foo.bar and foo.bar.save and test for sufficient equality in a shell script (or similar). I can do               stat foo.bar{,.save}      and manually inspect the output remembering to ignore inode, atime, and ctime (as well as link count, for some reason?), but this is error prone. Is there a cmp-with-attributes tool somewhere which include SELinux and other attributes? Must work on Fedora and ext4 file systems; ideally on "all" systems. Do I need to hack something up in perl? (No point having backups if you don't test that they work right.)


title: How to permanently change the file/directory permission

text: How do I change the permission of file/directories such that I am able to create, edit, delete files/directories anywhere in my system? Currently I am using Ubuntu 12.04. I tried               sudo chmod 777 -r /opt/lampp/htdocs      after installing `xampp` but it does not even seems to work for the htdocs folder. Thanks


title: Error establishing a database connection; how can I determine whether or not these connections are real?

text: I've just run into a problem today with MySQL reaching its database connection capacity. The error I'm receiving is, `Error establishing a database connection`. When I try to access `/phpma`, I get this error instead: `phpMyAdmin - Error #1040 - Too many connections`. I've looked up how to change `my.cnf` to increase the number of connections, but I think I've already done this a while back and had no issues since. I'm therefore a little worried that these connections are some kind of vulnerability. I'm running CentOS, but I'm a linux noob. Is there any easy way of checking these connections? Is there anything I should be looking out for, or maybe just a way of culling connections that have been active too long (does MySQL even work this way?). Thanks in advance,


title: How I can know the IP address of other users logged at the same remote machine?

text: I can see the names of other users on the remote machine with the `who` command... **I'd also like know the IP address of those users...** I was trying with the commands `/sbin/ifconfing` and `netstat` but I could not get positive results... I need this solution compatible both with Linux and Unix... Is there a command with that utility? Do I need to write a script or use a kind of pipes?


title: Pgrep returns mutiple PIDs

text: My script accepts a process name as an input and kills it, I tried using pgrep but its returning two PIDs , one for the process which is running and one for the script which accepts the process name as input so am stuck! I tried using the `pgrep` `-fo` option too but that did not help either. Any suggestions would be helpful this is my script               #!/bin/bash     ProcessName=$1          pID= pgrep -fl $ProcessName          echo $pID      so when i invoke the script its returning two PIDs               bash-3.00$ ./dynamic_values.sh test-Process          10534 /xxx/xxo/xxx/xxe --run --propFile /application/test/test-Process_Archive.tra --innerProcess     23401 /bin/bash ./dynamic_values.sh test-Process      I was expecting just 10534 but it picked up the script too . Version of OS just incase               bash-3.00$ uname -a     Linux xxxxxx 2.6.9-67.0.1.


title: How to parse many variables to bash?

text: A program outputs its data in this format:               n=4607356     null_cells=5668556     cells=10275912     min=0.0433306089835241     max=0.53108499199152     range=0.487754383007996     mean=0.40320252333736     mean_of_abs=0.40320252333736     stddev=0.0456556814489487     variance=0.00208444124856788     coeff_var=11.3232628285782     sum=1857697.565113524     first_quartile=0.378443     median=0.410276     third_quartile=0.435232     percentile_90=0.457641      And I want parse some of those variables into bash so I can use them into my script eg:               $n = 4607356     $median = 0.410276      and so on, in one go. How can I do that?


title: How to get dual graphic cards working under Linux?

text: My laptop is **Dell Inspiron 5420** , with two graphic cards:   * Intel HD Graphics 4000   * Nvidia GeForce GT 630M I took the Thinkpad T400 configuration guide as an example to configure my Linux, but I only get the integrated card to work, and the card is not using the **Intel** driver Currently, the behavior of my system is:   * using the **intel** driver in the Xorg.config, X cannot starts, reports cannot find the device   * using the **vesa** driver, the X could work, but no advanced graphic features, which means _Gnome 3_ is not available   * using the **nvidia** / **nouveau** driver, according to the log, the X seems to be started, but I got a black screen with nothing If you know a better guide/example to configure the system, please let me know. If you need my Xorg.config, I will post it.


title: How to cut file name not actual file

text: I have a list of file names like > ./run_results/rat/coding_exons/0.01_100_best.txt > ./run_results/mouse/introns/0.01_100_best.txt I want to create new files with names like `rat_coding_exons_0.01_100_best.txt` or `mouse_introns_0.01_100_best.txt` Problem is, when I try to cut these file names, cut instead starts cutting each line in said files (sensible, but not what I want).


title: Is there a way to scan all configured maven repos for a a package?

text: Lets say I am writing code and I decided I want a certain package, but I don't know rather the repos I have setup have that package, or which version of the package they may have. Is there a quick way to scan every repo in my settings.xml code for a package I want via some command line tool?


title: convert to epoch and back

text: I've used the following two perl command lines successfully:               perl -e 'use Time::Local; print timelocal(7,51,10,22,3,2014), "\n";'      which returns `1398163867`, and               perl -e 'print scalar(localtime(1398163867)), "\n"'      which returns `Tue Apr 22 10:51:07 2014` What I would like to do is replace `7,51,10,22,3,2014`, and `1398163867` with a variable containing those values. How can I do this?


title: bash find xargs grep only single occurence

text: Maybe it's a bit strange - and maybe there are other tools to do this but, well.. I am using the following classic bash command to find all files which contain some string:               find . -type f | xargs grep "something"      I have a great number of files, on multiple depths. first occurence of "something" is enough for me, but find continues searching, and takes a long time to complete the rest of the files. what i would like to do is something like a "feedback" from grep back to find so that find could stop searching for more files. is such a thing possible?


title: Configuring default resolution and color depth for RealVNC's vncserver-x11-serviced?

text: When searching the web for information about how to configure the default resolution and color depth for RealVNC sessions, I always come across stuff that talks about passing commandline parameters to `vncserver`, such as `vncserver -geometry 1024x768` or something. However, I have my system configured to start the RealVNC server on boot (for runlevels 2-5; I'm using Debian) via the `/etc/init.d/vncserver-x11-serviced` script that RealVNC installs; I'm not using the `vncserver` command. How do I configure this to have a particular default resolution and color depth? Is there a config file somewhere I can use?


title: Start new application instance instead of continuing a suspended one

text: If i for example start `top`. suspend it with `Ctrl+Z`, then enter `top` again the previously started instance will be continued in the foreground. How can i avoid this behaviour and just start a new instance?


title: Differences between Windows registry and UNIX/Linux approach

text: What are the main differences between the Windows registry and the approach used in UNIX/Linux, and what are the advantages and disadvantages of each approach?


title: gajim blinking trayicon notification

text: Gajim has a (nasty) trayicon notification option that blinks the Gajim icon when you have new messages. You can cancel this behaviour via the ACE's `trayicon_notification_on_events` option. But what I would like to do is to change the icon to something else but **not** blink. Is that possible? **Edit** : Version 0.15.1 _should_ have fixed it but has not.               ; pwd                /home/****/src/gajim-0.15.1     ; grep -ri trayicon_blink *     ;       The patch appears not to be included in the source tar ball.


title: Finding/Mounting USB Device in Mac OS X 10.8

text: I've looked all over and found similar questions and answers and none seem to work for me or match what I see. I should add I'm new to UNIX and the OS X command line but have got a basic overview to get this far from reading the forums in the last few days. I have a UPS device which comes with monitoring software but it appears to not find the connected device. I can hard code the `/dev` location into the config file but the problem is I can't find or establish how to link the device itself to this type of assignment. System Profiler provides the following which I am sure is the correct device:               USB Bus:            Host Controller Location: Built-in USB       Host Controller Driver: AppleUSBOHCI       PCI Device ID: 0x7ff200000aa5        PCI Revision ID: 0x7ff2000000b1        PCI Vendor ID: 0x7ff2000010de        Bus Number: 0x04               Composite Device:                Vendor ID: 0x0001  (Kavi-EVAL)           Version: 1.00           Speed: Up to 1.5 Mb/sec           Location ID: 0x04300000 / 3           Current Available (mA): 500           Current Required (mA): 100      But I simply have no idea (mount?) how to establish the existing, or create the correct mount point for inclusion into the application's cfg file. This is the line extracted from the cfg file:               UPS Comport           ( /dev/xxttyxx    )  : [HID/MEC0002]      When I look in the `/dev` folder there is no HID/anything or anything that looks to come close to the device info returned by the profiler. Can anyone be kind enough to explain in newbie terms how I bind the USB device in the system profiler to an assignment I can use in the configuration?


What is the command to find a jar file in a particular folder? Say I want to find `log4j.jar` in the /dev directory, what command should I use?


title: Pivot in text mode (no X) (Pivot = rotated 90 degrees)

text: How to get rotated video in text mode (no X), even during booting sequence ? OS: Linux Graphics card: mostly ATI, but curious about NVida and Intel solutions.


title: Why my partitions don't show the right capacity on a 4096 byte physical block hard drive?

text: After reading a lot about why newer 4096 byte physical block hard drives should be partitioned taking care of alignment (Linux on 4KB-sector disks: Practical advice, What is partition alignment and why whould I need it?, Why do I have to “align” the partitions on my new Western Digital hard drive?, I was convinced to make sure my new disk was properly partitioned and formatted with 4096 byte blocks. So I did partition it using `fdisk -b 4096 /dev/sdb` and specified a 50GB size for `sdb1`, 412GB for `sdb2` and the remaining space to `sdb3` (3.8GB for sdb3), leading to the following partition table:                   Disk /dev/sdb: 500.1 GB, 500107862016 bytes     255 heads, 63 sectors/track, 7600 cylinders, total 122096646 sectors     Units = sectors of 1 * 4096 = 4096 bytes     Sector size (logical/physical): 4096 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Disk identifier: 0x1c7f9c20                 Device Boot      Start         End      Blocks   Id  System         /dev/sdb1   *         256    13107455    52428800   83  Linux         /dev/sdb2        13107456   121110783   432013312   83  Linux         /dev/sdb3       121110784   122096645     3943448   82  Linux swap      Then I formatted both `sdb1` and `sdb2` with ext4:               # mkfs.ext4 /dev/sdb1      mke2fs 1.42.4 (12-June-2012)     Filesystem label=     OS type: Linux     Block size=4096 (log=2)     Fragment size=4096 (log=2)     Stride=0 blocks, Stripe width=0 blocks     409600 inodes, 1638400 blocks     81920 blocks (5.00%) reserved for the super user     First data block=0     Maximum filesystem blocks=1677721600     50 block groups     32768 blocks per group, 32768 fragments per group     8192 inodes per group     Superblock backups stored on blocks:              32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632          Allocating group tables: done                                 Writing inode tables: done                                 Creating journal (32768 blocks): done     Writing superblocks and filesystem accounting information: done          # mkfs.ext4 /dev/sdb2      mke2fs 1.42.4 (12-June-2012)     Filesystem label=     OS type: Linux     Block size=4096 (log=2)     Fragment size=4096 (log=2)     Stride=0 blocks, Stripe width=0 blocks     3375104 inodes, 13500416 blocks     675020 blocks (5.00%) reserved for the super user     First data block=0     Maximum filesystem blocks=0     412 block groups     32768 blocks per group, 32768 fragments per group     8192 inodes per group     Superblock backups stored on blocks:              32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,              4096000, 7962624, 11239424          Allocating group tables: done                                 Writing inode tables: done                                 Creating journal (32768 blocks): done     Writing superblocks and filesystem accounting information: done      and setup the swap area:               # mkswap /dev/sdb3     Setting up swapspace version 1, size = 492924 KiB     no label, UUID=2d18a027-6c03-4b29-b03e-c0c7f61413c5      The first strange thing I noticed was the reported swap size of just 492924 KiB. Then, after mouting the newly formatted partitions, I found them to appear much smaller than they should be:               Filesystem                        Size  Used Avail Use% Mounted on     /dev/sdb1                         6.3G  222M  5.8G   4% /mnt/zip     /dev/sdb2                          52G  907M   48G   2% /mnt/memory      Why is that happening? Is there any way to correct this? **EDIT:** After @Alexios suggestion I tried rebooting but /proc/partitions didn't change. Both /dev/sda and /dev/sdb are identical 500GB drives, but /dev/sda I formatted unaligned (using default 512 byte sector size starting after sector 63) and /dev/sdb aligned (using 4096 sector size starting after sector 255). As we can see, the system considers /dev/sdb just has less blocks than /dev/sda, although both were partitioned with the same sizes:               # cat /proc/partitions      major minor  #blocks  name            11        0    4590208 sr0        8        0  488386584 sda        8        1   48829536 sda1        8        2  437498145 sda2        8        3    2058871 sda3        8       16  488386584 sdb        8       17    6553600 sdb1        8       18   54001664 sdb2        8       19     492931 sdb3


title: Scripting error after bc command

text: I am trying to execute script contains the following:               #!/bin/bash     USED=`free -m | more | grep -v total | head -1 | cut -d':' -f2 | cut -d' ' -f18`     CACHE=`free -m | more | grep -v Swap | tail -1 | cut -d':' -f2 | cut -d' ' -f9`     TOTAL=`free -m | more | grep -v total | head -1 | cut -d':' -f2 | cut -d' ' -f11`     echo "scale=2 ; ((($USED - $CACHE) /$TOTAL) *100)" | bc      But I always get the following error:               (standard_in) 1: parse error


title: chown removes sticky bit: bug or feature?

text: Steps to reproduce:               germar@host:~$ cd /tmp/     germar@host:/tmp$ touch test && chmod u+s test && ls -la test     -rwSr--r-- 1 germar germar 0 Nov  2 20:11 test     germar@host:/tmp$ chown germar:germar test && ls -la test     -rw-r--r-- 1 germar germar 0 Nov  2 20:11 test      Tested with Debian squeeze and Ubuntu 12.04


title: Syntax highlighting of latex code blocks in ikiwiki

text: Is it possible to get syntax highlighting for LaTeX code blocks in ikiwiki (just something like it is automatically done in tex.sx)? To avoid misunderstandings: I don't mean math output produced for example by mathjax. I want to document latex-tricks in my wiki, so I have to put some snippets of latex source code in it to show how something is done in latex. For example: "Here is an example how to use tikz:               \begin{document}{article}          \usepackage{amsmath}     \usepackage{tikz}          \begin{document}        \begin{tikzpicture}        \draw (0,0) --node[sloped,above]{$x$} (1,1);        \end{tikzpicture}     \end{document}      " Here the code block above just appears with a grey background but without syntax highlighting of the source code. If I would put the same snipped on tex.sx there would be a syntax highlighting of the code.


title: What could cause network latency on a fresh Ubuntu Server 10.10 install?

text: I have recently purchased a machine to run an online game server. I put the machine together and have installed a fresh copy of Ubuntu Server 10.10. I have noticed that the game server produces a massive amount of lag despite being more than capable of running the server application. I have been trying to track down the problem all day and now believe it might be something to do with the network connection as when I connect to the server using SSH, on the **local network** , I get a large dollop of lag before the password field appears. Connecting to the old server on the same network displays the prompt instantly. My hardware is as follows:               Core i5 2500 3.3GHz Socket 1155     Asus P8P67 R3 Socket 1155     4GB DDR3 1333MHz     500GB 3.5" SAT-III Hard Drive      I use Windows primarily and would ordinarily look for updated drivers if this happened there but I don't really know where to start to solve this problem on Linux. Any help would be most appreciated.


title: Split and print

text: I have tab-demlimted text file with 50,000lines. I want to split the first column and print as shown in output.txt Input.txt               rt|371443144|mb|MN556661.1|  2200443     A     rt|371443344|mb|MN556645.1|  2594155     A     rt|371467899|mb|MN555666.1|  2594175     A      output.txt               MN556661.1   2200443     A     MN556645.1   2594155     A     MN555666.1   2594175     A


title: How to set up MouseButton4 on TeamSpeak

text: Is there a way to set up Button4/5 to push-to-talk in TeamSpeak? For Example: In Firefox I can undoing and forwarding but TeamSpeak doesn't recognize clicks. I'm using Arch Linux and my mouse is SteelSeries Rival. EDIT:               [malloc@arch ~]$ xinput     ⎡ Virtual core pointer                      id=2    [master pointer  (3)]     ⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]     ⎜   ↳ SteelSeries Rival Gaming Mouse            id=11   [slave  pointer  (2)]     ⎜   ↳ SteelSeries Rival Gaming Mouse            id=13   [slave  pointer  (2)]     ⎜   ↳ AlpsPS/2 ALPS DualPoint TouchPad          id=15   [slave  pointer  (2)]     ⎜   ↳ DualPoint Stick                           id=16   [slave  pointer  (2)]     ⎣ Virtual core keyboard                     id=3    [master keyboard (2)]         ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]         ↳ Power Button                              id=6    [slave  keyboard (3)]         ↳ Video Bus                                 id=7    [slave  keyboard (3)]         ↳ Power Button                              id=8    [slave  keyboard (3)]         ↳ Sleep Button                              id=9    [slave  keyboard (3)]         ↳ Laptop_Integrated_Webcam_HD               id=10   [slave  keyboard (3)]         ↳ SteelSeries Rival Gaming Mouse            id=12   [slave  keyboard (3)]         ↳ AT Translated Set 2 keyboard              id=14   [slave  keyboard (3)]         ↳ Dell WMI hotkeys                          id=17   [slave  keyboard (3)]     [malloc@arch ~]$ xinput get-button-map 11     1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16      [malloc@arch ~]$ xinput get-button-map 13     1 2 3 4 5 6 7


title: Booting grub-2.00 with 2 initrds, crashes with RAMDISK: incomplete write

text: So, I'm trying to split my initrd into two initrd's. There's some pretty significant scripts that run in the initrd, and we wanted to split the initrd so we could rev the just the logic or just the kernel portion. As a single initrd, it boots fine. But, when I split it into two, I get an error:               RAMDISK: incomplete write (-28 != 8388608)      The grub menu entry's initrd looks like:               initrd /initramfs-scripts.img /initramfs-kernel.img      I can't find any documentation on using two initrd's. All I have found so far are this: stackexchange question, and this: grub bug. But, it doesn't give me an idea about what I'm doing wrong.


title: "[sdc] Assuming drive cache: write through" Need to hide this message!

text: When you plug an external drive into my Ubuntu server this message pops up "[sdc] Assuming drive cache: write through"... I would really like it so it stops sending it to the screen. Any ideas on how I can shut it up? :)


title: Move files and delete directories with rsync?

text: Recently I needed to delete a large number of files (over 1 million) and I read that doing:               rsync -av --delete `mktemp -d`/ ~/source && rmdir ~/source      Was one of the most optimized ways to do that, and I can vouch that it's faster than `rm -rf`. I'm not an expert on the matter, but from my understanding the reason for rsync performance has something to do the way it lists files (LIFO instead of FIFO I suppose). Now, the problem is, I also need to to move a large number of files in a efficient way. After searching a bit, I found this:               rsync -av --ignore-existing --remove-source-files ~/source ~/destination      While this deletes all the moved **files** in `~/source`, the directories remain there. Since I have a "round-robin"-like directory structure the number of `files/directories` is very close to 1, so I am forced to run the first command again to get rid of the directory entirely:               rsync -av --ignore-existing --remove-source-files ~/source ~/destination && \     rsync -av --delete `mktemp -d`/ ~/source && rmdir ~/source      A straight `mv` would finish virtually instantly, but my `~/destination` directory has files that should be kept, so `mv` is not an option. I found the `\--prune-empty-dirs` and `\--force` rsync options, but neither seem to work as I would expect:               --force                 force deletion of directories even if not empty     --prune-empty-dirs      prune empty directory chains from the file-list     --remove-source-files   sender removes synchronized files (non-dirs)      Is there a way to mimic a _move_ with rsync in one go?


title: Get list of installed printers

text: Inside of a script I send a certain file to print using the `lpr` command on an user-selected printer. The list of the printers, from which the user selects the one to use, I get using the `lpstat -a` command and then considering everything before the first space as the name of the printer. This works but relies heavily on the specific output format of the `lpstat -a` command. I'm afraid that in the future (or now on different distributions) if the output format changes it will break the script. So, is there a way to get the names of all the installed printers in a way that is safer than the one I'm using?


title: Print files with file size less than 100 bytes

text: Basically this script is just supposed to print out the file size and the name of all files in a directory that are under 100 bytes. This script I wrote works perfectly on my Ubuntu, but wont work on my mac os lion. Can anyone tell me why?               #!/bin/bash          for i in $(ls)     do       if [[ $(wc -c $i | cut -d" " -f1) -le 100 ]]; then         echo $(wc -c $i)       fi     done


title: Does Windows recognize Linux's symbolic links?

text: I was just wondering how a Windows system handles symbolic links. My best guess is that it will not recognize them, but I'm not entirely sure. Also, what do Macs do when confronted by one?


title: man path and 'man foo' vs. 'man -k foo'

text: I have a set of man pages in a non-standard location; however, the location is on my MANPATH (and I verified this with `man --path`). When I do               man fst-infl      (where fst-infl has a man page in this non-standard location), it works: it brings up the man page for fst-infl. But when I do               man -k fst-infl      I get               fst-infl: nothing appropriate      Same for `man -f` or `/usr/bin/apropos`. All of these work fine for programs that are on the default MANPATH, e.g. `man -k fstab-decode`. Why doesn't `man -k` look in the same place that plain `man` does? More specifically, why doesn't it use MANPATH?


title: Restore default completion

text: I use `compgen` when `$COMP_WORD` equals 1, now I want to restore default completion when otherwise, Right now I have,               _rr()     {         case $COMP_CWORD in             1)                 COMPREPLY=($(compgen -W "A B" "${COMP_WORDS[$COMP_CWORD]}"))                 ;;         esac     }          complete -F _rr rr      Now when `$COMP_CWORD` is not 1, I got no completion for files / directories, that's the default completion I needed. Also I need to enable completion only when `${COMP_WORDS[$COMP_CWORD - 1]}` is `A` in this minimal case.


title: Delete the matching line and several more from a file

text: I have a text file called file_a.txt. My first command is               grep -A 12 ".production =" file_a.txt      The output is a few block. Each block of string contains 13 rows I specifically want to delete all the block of strings I got with the `grep` command from the original file file_a.txt. I do not want to send the grep output to a new file. Also I do not want to to use `grep -v` because it will not work in my case. I have tried something like things like this, but nothing is working:               cut < grep -A 12 ".production =" file_a.txt          sed -i '/`grep -A 12 ".production ="`/d' file_a.txt


title: auto create groups directories on user logging in

text: Below is my real and effective UIDs and GIDs. My task is to implement a bash script (Ubuntu 10.10 desktop) which should auto create 3 directories `rtkit`, `admin`, `pr007drdl` (group names) in `/home directory`. Once I have the bash script, I will create an init start/stop script, so should create directories when user logs in. I am totally new to bash scripting. Please help. Thanks in advance. I have no idea where gids' and uids' stored.               uid=10002(sandy)      gid=119(rtkit) groups=119(rtkit),10001(admin),10003(pr007drdl)


title: Unable to follow steps for building application in Linux Os?

text: I was using these steps to build an application from Csipsimple but the problem is, they have mentioned it's for Linux and I tried, as a first step:               subversion git quilt unzip wget swig2.0 python make      I get a `command not found` error. First thing is, that I'm using fedora 13. I searched for the swig, python, quilt, subversion packages in package management system in fedora already but I didn't get to install it. Can anyone help me, solving this error?


title: Booting Ubuntu from usb on a Mac

text: I have a Macbook pro (late 2009) running OSX 10.6.8. I want to partition a flash drive and install my Ubuntu iso image onto it. Then I want to boot up from it by (restarting my computer and) holding down the option key. How could I:   1. Install Ubuntu on the flash drive?   2. Get OSX to see the drive when booting up? P.S. I tried following This link but it is for Mountain Lion, not Snow Leopard (which is what I have)


title: Where does the "export" command come from?

text: Why doesn't the `whereis` command give any information about the `export` command? How does the `export` command work even if the shell path variable is set to null?


title: How to check the Passive and Active FTP

text: How do I check which FTP (Passive or Active) is running? By default, passive FTP is running in linux, but how do I check?


title: Installing Chrome on Linux without needing to be root

text: How can I install Chrome on Linux without needing to log in as root? Note that I want to use Chrome, not Chromium. If I go to the official download page, I get the choice between:               Please select your download package:     32 bit .deb (For Debian/Ubuntu)     64 bit .deb (For Debian/Ubuntu)     32 bit .rpm (For Fedora/openSUSE)     64 bit .rpm (For Fedora/openSUSE)       Can I somehow extract and install Chrome from the .deb or the .rpm without needing to be root? Or is there another link that I missed?


title: Where does GSettings store its files?

text: I would like to have a look at the files the dconf-editor uses to read/write settings, and I'm assuming that they are managed by gsettings. Where are these files stored on the system, and in what format?


title: How to view and change kernel memory size?

text: How can i view the kernel's share of memory on a machine? How can I increase it? What should I consider before doing it?


title: Accessing Windows7_OS partition from Linux on a dual-boot

text: Are there any limitations on accessing the Windows7_OS partition while I am booted on my Linux OS? Occasionally I like to browse files that are on my Windows partition or copy files to my Linux drive without having to reboot. This appears safe, but is there any risk with doing such operations? Sometimes I get Ubuntu internal errors, and I don't know if this may contribute to the cause. I am running Ubuntu 13.10 (Saucy Salamander) on a W520 ThinkPad 7200 RPM 500 GB HDD. I have a typical partition pattern: `SYSTEM_DRV` | `WINDOWS7_OS` | `UBUNTU_13.10` | `SWAP SPACE (7-8 GB)` | `LENOVO RECOVERY`


title: Bash command to delete a certain file in * folders

text: The situation isn't really as simple as the title may imply. I have a `.desktop` file that execs with `bash -c` to set an environment variable then load the program. Now I need to add another command before it goes to loading the program. Sometimes the program creates file called `SOFT_REPAIR` in `~/path to/*/`, and I need to delete it before running the program. `*` represents whatever version the program maybe, and as `/path to/` implies, there's spaces in the folder names within which the `SOFT_REPAIR` resides. So here's the thing:   * Do I need to do `/path\ to/`?   * Will `rm 'path to/*/SOFT_REPAIR/'` work?   * Can I just use the `rm` command whether `SOFT_REPAIR` exists or not, or do I need to use the `if` statement?


title: Preventing Nix from upgrading git to git-full

text: I'm using Nix on Ubuntu to have more modern versions of some packages, one of them being git. When I'm run `nix-env -u`, this is what happens:               % nix-env -u --dry-run '*'     (dry run; not doing anything)     upgrading `git-1.8.5.4' to `git-1.9.0-full'      This is not what I want - I prefer the plain version `git-1.9.0` over the `-full` version. I know I can manually upgrade to the plain version with `nix- env -i git-1.9.0`, but is there a way to make `nix-env -u` to do what I want?


title: targeted network speed over LAN

text: I have a Solaris 11 system which has several NFS exports which are accessed my other systems within my LAN. I use a Linux system as a client for testing. I wrote a quick script to test read speed and I average at around 110Mbps (or 13MB/s) on a Gigabit LAN. And I would have think it could get much faster. SSH (scp) only gives me 3.8MB/s but that's with encryption. http gives me 11.5M/s, similar to NFS than. ain't this low? what could be the bottleneck from these numbers?


title: Difference between authpriv and auth?

text: What's the difference between authpriv and auth in syslog configuration? It wasn't mentioned in syslog.conf, only tells me that such facility exists.


title: Setting the bash SHELL for remote openSSH connections?

text: I am connected to a Freebsd 10 `-STABLE` server with `SSH` from my office box but when I trying to work inside the session I encounter these problems:   * although I did `chsh` for every user in said server to `/usr/local/bin/bash`; whenever I ssh to server I get:   `sh (the default Bourne shell in FreeBSD) supports command-line editing. Just ``set -o emacs'' or ``set -o vi'' to enable it.`   * in my ssh session I can't go to end of a line by `End` key or beginning of a line by `Home` key. instead I get `~` character. all and all the environment I feel in the `SSH session` is primitive and hard to navigate. the `echo $SHELL` returns `/usr/local/bin/bash`. the `ps -ef|grep $$` returns:   `2010 0 S 0:00.03 TERM=xterm PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/s` and `echo $0` returns `su`


title: Outgoing firewall application similar to Little Snitch for Mac

text: Is there a Linux application similar to Little Snitch? Little Snitch is an outgoing firewall that temporarily blocks outgoing network requests until the user decides whether to allow the connection or not. The most powerful feature of Little Snitch is that it is able to tell what host name each application wants to talk to and make permanent or temporary blocking rules based on host name or application. All of this in a really easy and convenient UI.


title: netstat — why are IPv4 daemons listening to ports listed only in -A inet6?

text: I have a computer with:               Linux superhost 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64 GNU/Linux      It runs Apache on port 80 on all interfaces, and it does not show up in `netstat -planA inet`, however it unexpectedly can be found in `netstat -planA inet6`:               Active Internet connections (servers and established)     Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name     tcp6       0      0 :::5672                 :::*                    LISTEN      2402/beam.smp        tcp6       0      0 :::111                  :::*                    LISTEN      1825/rpcbind         tcp6       0      0 :::9200                 :::*                    LISTEN      2235/java            tcp6       0      0 :::80                   :::*                    LISTEN      2533/apache2         tcp6       0      0 :::34611                :::*                    LISTEN      1856/rpc.statd       tcp6       0      0 :::9300                 :::*                    LISTEN      2235/java            ...     tcp6       0      0 10.0.176.93:80          10.0.76.98:53704        TIME_WAIT   -                    tcp6       0      0 10.0.176.93:80          10.0.76.98:53700        TIME_WAIT   -                     I can reach it by TCP4 just fine, as seen above. However, even these connections are listed under `tcp6`. Why?


title: Impossible pmap results

text: Nautilus is taking up 450 MiB according to System Monitor (Ubuntu 10.04).               $pmap <PID of Nautilus>     ...     total          1578276K      Is `pmap` reporting 1.5 GiB of memory here? I'm trying to find out what's taking up the 450 MiB so I can deduce what I'm doing wrong, or where the problem lies.


title: Run a cron job every minute, meaning of syntax

text: I read somewhere that you can add a cron job to run every minute like this:               #min hour day month weekday command     */1   *    *    *    *     <your command>      What does the `/1` part mean? Can I omit it?


title: How to check why sound over HDMI doesn't work

text: I installed Gentoo clean on my system, except my /home but I deleted all hidden folders that might have an impact on sound (.mplayer .pulse* .config .esd_auth and more) and with a fresh user `adduser mistertest -m -G audio,video,users` the result is the same, no sound when I play a file in mplayer. Its a Z68 Chipset and I am using the Intel IGP H2000 inside my CPU, so this should not be an issue of the spdif connector on my mainboard and I think i have installed all the correct modules in the kernel. I have no aditional hardware to check if my sound is working at all (no headset or external speakers), but I suppose the problem is either some bad config or the internal spdif (if there is such).               dronemother ~ # lsmod | grep snd     snd_hda_codec_hdmi     22705  1     snd_hda_codec_realtek   190506  1     snd_hda_intel          21727  3     snd_hda_codec          63422  3 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel     snd_hwdep               5726  1 snd_hda_codec     snd_pcm                69969  3 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec     snd_timer              17697  1 snd_pcm     snd                    53814  13 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_    timer     soundcore               5009  1 snd     snd_page_alloc          6641  2 snd_hda_intel,snd_pcm          dronemother ~ # lspci -v     # cut other stuff away here         00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 05)             Subsystem: ASRock Incorporation Device 1892             Flags: bus master, fast devsel, latency 0, IRQ 46             Memory at fe600000 (64-bit, non-prefetchable) [size=16K]             Capabilities: [50] Power Management version 2             Capabilities: [60] MSI: Enable+ Count=1/1 Maskable- 64bit+             Capabilities: [70] Express Root Complex Integrated Endpoint, MSI 00             Capabilities: [100] Virtual Channel             Capabilities: [130] Root Complex Link             Kernel driver in use: snd_hda_intel             Kernel modules: snd-hda-intel      I have pulseaudio, alsa-plugins, mplayer, mixer and pavucontrol installed. I get no errors when playing a file in mplayer just no sound. So how can I examine where exactly my problem is located? Edit: I just booted the PC from a Ubuntu Live USB stick, sound did not work, too. (took a bit longer, cannot restart the server every day, some people rely on its services.)


title: ZIP password finders for Linux?

text: I'm trying to extract ZIP files for an encrypted archive I've forgotten the password for. So far I've found the tool `fcrackzip` which does what I want, but its own manpage states that it has numerous problems, for example: "It's still early alpha."   "Stop/resume facility is missing."   "Could be faster." Whilst I appreciate this honesty, it does rather make me hope that there are some better, more mature ZIP cracking utilities for Linux (GUI or commandline, I don't mind), out there. Does anyone have recommendations? I'd really value speed, and a stop/resume facility would be nice.


title: Linux Mint Settings Changed Automatically

text: The settings for my linux mint OS have somehow changed automatically. The wallpaper has changed to default background, the mouse and touchpad settings are different, and I can't see the 'Computer' icon on my desktop either. I've tried restarting a couple times and in some restarts I've seen this message:               fsck from util-linux 2.19.1     /dev/sda4: clean, 270358/1144640 files, 2372070/4574707 blocks (check in 3 mounts)     * Starting mDNS/DNS-SD daemon[74G[ OK ]     * Starting configure network device[74G[ OK ]     * Starting configure network device security[74G[ OK ]     * Starting load fallback graphics devices[74G[ OK ]     * Starting Userspace bootsplash[74G[ OK ]     * Stopping load fallback graphics devices[74G[ OK ]     * Stopping cold plug devices[74G[ OK ]     * Stopping log initial device creation[74G[ OK ]     * Starting configure network device security[74G[ OK ]     * Starting save udev log and update rules[74G[ OK ]     * Starting configure virtual network devices[74G[ OK ]     * Stopping save udev log and update rules[74G[ OK ]     * Stopping configure virtual network devices[74G[ OK ]     speech-dispatcher disabled; edit /etc/default/speech-dispatcher     Checking for running unattended-upgrades:     * Stopping Failsafe Boot Delay[74G[ OK ]     * Stopping System V initialisation compatibility[74G[ OK ]     * Starting System V runlevel compatibility[74G[ OK ]     * Starting LightDM Display Manager[74G[ OK ]     * Starting ACPI daemon[74G[ OK ]     * Starting anac(h)ronistic cron[74G[ OK ]     * Starting CPU interrupts balancing daemon[74G[ OK ]     * Starting regular background program processing daemon[74G[ OK ]     * Starting deferred execution scheduler[74G[ OK ]     * Stopping Userspace bootsplash[74G[ OK ]     * Starting save kernel messages[74G[ OK ]      What seems to be the problem here?


title: Why doesn't GoogleTalk plugin recognize my camera, even with v4l?

text: The thing is that I have GoogleTalk plugin, also used for Google+ hangouts, and it works in my netbook, on Ubuntu. But on my laptop, using the same Ubuntu (Oneric) and having used the camera on Cheese so it works, Google+ shows a black screen while trying to use webcam in hangouts. This is weird, I have installed libv4l-0 and forced GoogleTalkPlugin to preload it. Starting from a console, it shows:               [009:591] Got cookie response, socket is authorized     [009:591] AUTHORIZED; socket handshake complete     [014:536] HandleOnlineCheck: Starting check     [014:536] HandleOnlineCheck: OK; current state: 3     [031:321] Error(scriptinterface.cc:288): Passed a non-object for onmessasge_callback     Check failed: g_shutdown_pipe_write_fd != -1     [113:230] Warning(clientchannel.cc:678): Connection to GoogleTalkPlugin lost, reason=0     [113:367] Error(scriptinterface.cc:288): Passed a non-object for onmessasge_callback      I just don't know why I cannot get it to work. My netbook (hp-mini) works fine with an integrated camera.


title: How to set the command(s) that get run before every single prompt?

text: I used to know this but I forgot: I want to execute a command or a couple of commands before every single prompt. When I am in our PROD box, I want a big fat reminder above every prompt that says *** YOU ARE IN PROD *** and maybe another thing or two. Currently, I think that is how mail is checked but I can't remember how that configuration is set. Using ksh and Solaris 5.10 Any idea? Thanks


title: groff to PS Conversion

text: I am very new to **`UNIX`** , learning **`groff`** with the help of **`cygwin`** on **`Windows XP SP3`**. I have downloaded **`groff-binaries`** from **_here_**, but using **`cygwin`**, I could not able to re-produce **`ps`** files. I have used following command in **`cygwin`** :               $ groff grnexmpl.me > grnexmpl.ps      But, in generated `grnexmpl.ps` file, all special formatting are gone. When I look inside the `grnexmpl.ps.gz` archive(comes with the binaries) and the `grnexmpl.ps` looks beautiful. It would be a great help if somebody assist me to understand what is going here? Am I missing something?


title: su and redirection

text: The following line shows the principle of a construct which I can use under Red hat 5.5:               $ echo "foo" | ssh myhost "echo \"cat <&1\" | su --login"     foo      Actually it was never clear to me why cat can read from FD #1, but it works. Now with Red Hat 6.3 that doesn't work anymore:               $ echo "foo" | ssh myhost "echo \"cat <&1\" | su --login"     cat: -: Bad file descriptor      First question: Why does this not work anymore? Second question: Does anybody has an idea for a solution that works under Red Hat 6.3? All ideas are appreciated. Armin


title: How do I ensure outbound TCP/IP traffic always uses a VPN, even when using Wifi?

text: I'd like to ensure that my VPN is started and running, before any TCP traffic from any of my background services send or receive data. How can I guarantee that this is the case? How do I handle the special case where I connect to a Wifi access point (in Starbucks) that requires me to press "I Agree" prior to continuing my session?


title: Countdown timer in panel

text: Is there some widget that I can put in the panel of my Xubuntu system that will show me a countdown of time? I've tried `pystopwatch`, but although it minimizes, it doesn't show me how long I have left. I've also tried xfce `timer-plugin`, but it doesn't really minimize. I just need something that will show how much time left I have for a certain task, as inconspicuously as possible. I'm running Xubuntu 12.04.


title: Counting files in leaves of directory tree

text: I came up with the following snippet for counting files in each subdirectory:               for x (**/*(/)); do print $x; find $x -maxdepth 1 -type f | wc -l; done      The command outputs consecutive pairs (one below the other) as follows:               directory_name     # of files      I would like to change the code above to:   * Print each match on the same line (i.e. `directory_name ':' # of files`)   * Only count files if the folders are leaves in the directory tree (i.e. they don't have any subfolders).  How can I do that?


title: rename a batch of files after reading from a source file

text: I have a directory full of over a thousand files and the names are bit long (and no pattern found in the naming style). I would like to simplify the filenames. E.g.:               Bioimage_23335989_Data_22317866_22317867_20140723_1002.pdb     Bioimage_22335990_Data_22318490_22318491_20140723_1009.pdb     Bioimage_23835970_Data_22317866_22317867_20140723_1005.pdb      .....and so on ! I have made a simple text file (`filelist.txt`) which reads like this:               1.pdb   Bioimage_23335989_Data_22317866_22317867_20140723_1002.pdb     2.pdb   Bioimage_22335990_Data_22318490_22318491_20140723_1009.pdb     3.pdb   Bioimage_23835970_Data_22317866_22317867_20140723_1005.pdb      .....and so on ! Can anybody provide me with a script (`awk`, `sed`, etc) which would read the source file and rename the files accordingly? I could get similar scripts else where but nothing seems to work for me.


title: How to escape text in awful.util.spawn_with_shell command?

text: Based on a suggestion, I've now got the following call in rc.lua:               awful.util.spawn_with_shell('vlc $(xclip -o)')      How do I ensure that the output of `xclip` is escaped so that _space characters_ are not taken as parameter separators? For example, if I select the string "foo bar" (without the quotes) and press `Mod4`+`v` VLC complains about being unable to open _both_ "foo" _and_ "bar". To illustrate, in a shell context I would validate the issue as follows:               $ params() {         for param         do             echo "$param"         done     }     $ params $(xclip -o)     params     $(xclip     -o)      And fix it like this:               $ params "$(xclip -o)"     params "$(xclip -o)"      However, if I change the Lua call to this, it does nothing:               awful.util.spawn_with_shell('vlc "$(xclip -o)"')


title: Execute root command after a user starts their session

text: I'm trying to find how is possible to execute a root command when a user starts their session. I found that adding commands to thes file `/etc/rc.local` should execute the commands after the boot, but my command is not being executed, or maybe the system is not ready yet to execute it. (the command works well) Maybe an example could clarify what I'm trying to do. In almost all desktop managers there is an option at settings called "Session and Start-up", in the section "Application AutoStart" it is possible to add commands that will be executed once you're logged-in. I want to do that but with a command that needs to be executed as root!


title: How do I repeat the last command without using the arrow keys?

text: I know I can use `Up` to iterate through previous commands. Running the _last_ command simply involves `Up` + `Enter`. However, I was thinking of buying the Happy Hacking Keyboard as I spend a lot of time in `vim`. This keyboard has no arrow keys, and the only way I know how to get this kind of behaviour is by pressing `Ctrl` + `R` and beginning to repeat my previous command. Is there an easy way to emulate `Up` + `Enter` in an UNIX terminal without the arrow keys?


title: Distinguish between Desktop session and desktop environment

text: I heard/observed following words and want to distinguish information.   * Desktop Environment   * Desktop Session   * GDM Session   * Shell   * Window Manager So **I can understand exact difference and working relation between them.**


title: In Emacs' org-mode, any way to hide the subtree with timestamp not set to today?

text: I just started to learn org-mode (and _Emacs_ ) and I plan to use it as a _calendar/timetable/todo-list_ hybrid. Is it possible to hide entries with timestamp not set to today? If so, how? For example, say if today is 2014-09-18:               * Lunch          * TODO Call boss       <2014-09-18 Thu 13:30pm>             ** Report :: Nothing happened          * TODO Call Bob                             ; This entry will not be shown       <2014-09-19 Fri 13:30pm>                  ; This entry will not be shown                                                 ; This entry will not be shown        ** Discuss :: Project Alice              ; This entry will not be shown        ** Discuss :: Upgrading to CentOS 5      ; This entry will not be shown          * TODO Fetch Claire from school      Incidentally, are there any more efficient way to deal with calendar/timetable/todo-lists in org-mode?


title: Puppet Master not serving out/reading manifests

text: I have a really strange issue with my Puppet Master. I can't seem to get it to serve my manifests properly. I have installed manifests in two locations:   * `/etc/puppet/manifests/kungfumaster.mydomain.com.pp`   * `/etc/puppet/environments/production/kungfumaster.mydomain.com.pp` Both of which contain something similar to this:               node "kungfumaster.mydomain.com" {          notify { "found the one in environments!": }     }      Neither of them run when I connect with my agent. The only one which is actually read appears to be `/etc/puppet/manifests/site.pp`, which does, in fact, run:               Notice: /Stage[main]/Main/Node[default]/Notify[thungs]/message: defined 'message' as 'thungs'      This node is defined like this:               node default {          notify { 'thungs': }     }      No matter how I've tried, I haven't been able to get these manifests to work properly, even when specifying a `node default` in the aforementioned files. I'm seeing some strange logs emitted from my Puppet Master, but I'm not quite clear as to what they mean or how to solve the problem mentioned in them:               Jul 31 01:50:28 kungfumaster puppet-master[443]: Could not retrieve fact fqdn     Jul 31 01:50:28 kungfumaster puppet-master[443]: Could not retrieve fact ipaddress     Jul 31 01:50:28 kungfumaster puppet-master[443]: TrustedInformation expected a certificate, but none was given.      Configuration files:   * /etc/puppet/puppet.conf   * /usr/share/puppet/rack/puppetmaster/config.ru (config file for running the Puppet Master rails app)   * /etc/nginx/nginx.conf   * /etc/nginx/sites-enabled/puppetmaster Log files:   * /var/log/syslog   * Output of `puppet apply --onetime --no-daemonize --debug --verbose`: here   * Output of `puppet apply --onetime --no-daemonize --debug --verbose --environment production`: here The Puppet Agent and Puppet Master are both on the exact same host. The strange message about expecting a certificate is generated here: https://j.mp/1zxG08Q


title: Distributing Updates to VirtualBox Images with (Bandwith) Efficency

text: I'm currently responsible for a lab of machines that all need to run the same virtual machines. I want to automate my current setup of distributing VirtualBox virtual machines via rsync (erasing any local changes and replacing the disks/snapshots that make up the virtual machine). I'm thinking of doing something along the lines of making a snapshot for each change, copying the snapshot to the user's machine, and deleting the snapshot on the target ("flattening" it back to the starting disk). This allows me to patch each Virtual Machine with a minimum amount of bandwidth requirements. The current environment consists of Fedora hosts, where rsync is used to copy the new disk images. The new solution needs to work on Linux/Windows/Mac as we are moving to a "bring your own device" environment. Are there any already existing scripts/projects that address this issue? What should I be aware of before I start developing my own system to handle update management?


title: Using regex in for loop

text: I'm looking to loop through a directory of files and match them with regex, then subsitute the appropriate character:               #somefile.txt     %somefile.txt     >somefile.txt          # arr=(\% \> \#) ;for f in *; do echo -- "$f" "${f//${arr[@]}/}"; done      should echo:               #somefile.txt -- somefile.txt     %somefile.txt -- somefile.txt     >somefile.txt -- somefile.txt      instead i get:               #somefile.txt -- #somefile.txt     %somefile.txt -- %somefile.txt     >somefile.txt -- >somefile.txt      which results in no change, nada, zilch. the array works if i use `arr(\%)` with a single character, which defeats the whole purpose.               #somefile.txt -- #somefile.txt     %somefile.txt -- somefile.txt     >somefile.txt -- >somefile.txt


title: Switching to edit mode in VIM rc?

text: Still related to the previous question, but switching mode with `exe "a"` doesn't seem to work, I still have to press the `a` button manually Here upon opening a newly created a file, a template is in use and the cursor will be moved to the right position, then erase the tag, and switch to the `appending (editing)` mode.               function LoadFile()       0r ~/.vim/skel/tmpl.%:e       exe "normal /<CURSOR>\<Cr>"       exe "s#<CURSOR>##"       exe "a"     endf          autocmd! BufNewFile * silent! call LoadFile()      Any ideas?


title: Change font in vesa menu for pxelinux

text: I am trying to change the font of the menu in my syslinux/pxelinux configuration. According to the documentation this is all it takes:               FONT myfont.psf      where in my case `myfont.psf` has been decompressed from `/usr/share/consolefonts/Uni3-TerminusBold32x16.psf.gz` on my Debian system. However, the font does not load in the menu. Are there any restrictions on the font that can be used that is not mentioned in the documentation?


title: Emacs - Changing show-paren-mode Areas

text: I like show-paren-mode in Emacs, but I would really like to change the highlighting behavior for closing brackets. That is, I want the opening bracket to be highlighted when the point is on the closing bracket. The default behavior highlights the opening bracket when the point is on the character following the closing bracket. Is this easy to change? Also, I would be interested in potential benefits of keeping the show-paren-mode behavior as it is.


title: How to add a new line for a missing entry between two fields

text: I have this file. As you can see in column1, entries TEST01N03, TEST01N06, and TEST01N18 are missing (total of 18 entries). Is there a way to check the fields of this column and fill in the missing entries ?               TEST01N01 40   2002    2697    2523       TEST01N02 40   4       4       5         TEST01N04 40   4       4       5       TEST01N05 40   4       4       5       TEST01N07 40   4       4       5       TEST01N08 40   1       4       5       TEST01N09 40   4       4       5       TEST01N10 40   4       4       5       TEST01N11 40   2002    2621    2617       TEST01N13 40   1       4       5       TEST01N14 40   1       4       5         TEST01N15 40   1       4       5       TEST01N16 40   1       4       5       TEST01N17 40   2002    2576    2515      The output should look like this:               TEST01N01 40   2002    2697    2523       TEST01N02 40   4       4       5         TEST01N03 empty       TEST01N04 40   4       4       5       TEST01N05 40   4       4       5       TEST01N06 empty       TEST01N07 40   4       4       5       TEST01N08 40   1       4       5       TEST01N09 40   4       4       5       TEST01N10 40   4       4       5       TEST01N11 40   2002    2621    2617       TEST01N12 empty       TEST01N13 40   1       4       5       TEST01N14 40   1       4       5         TEST01N15 40   1       4       5       TEST01N16 40   1       4       5       TEST01N17 40   2002    2576    2515       TEST01N18 empty        Really appreciated for any suggestion of a script to accomplish this.


title: How do I run a command on each input given a list of input

text: I have a bunch of folders, and I want to cd into each folder and run a command. I feel like it should be something like this: (The following is a contrived and simplified example of what I want to do).               ls | xargs echo 'Looking at {}' && cd {} && /bin/do_stuff      But that does not work. How do I do this?


title: svn: add all my new files and directories

text: I'm using Solaris 10. I need to add to SVN everything I've placed in the sub directories of my SVN checkout. I have added files and directories and sub directories - is there a command to take care of everything at once? If not, is there a command I can run to list all the items I have added that have not been added to SVN yet?


title: Get full path from within Bash script

text: I have a bash script that works with relative paths. It needs to have a working directory that is equal to the directory the script is stored in. This works fine as long as I start it from the prompt, because I can cd to the script's directory first. However, when I create a symlink to the script in /etc/cron.hourly, the script breaks. I need a way to make the bash script change directory to the directory the script is stored in. However, so far I am unsuccessful. Is there an easy way to do this, even if the script is called from cron via a symlink?


title: getent hosts prints IPv4, getent ahosts prints IPv6

text: Verbatim output from my terminal:               $ getent hosts example.org     2001:500:88:200::10 example.org     $ getent ahosts example.org     192.0.43.10     STREAM 43-10.any.icann.org     192.0.43.10     DGRAM       192.0.43.10     RAW          I thought they were both (at the very least ahosts) supposed to print both IPv4 and IPv6 addresses. Why are these printing different address types?               $ uname -srvmpio     Linux 3.2.0-31-generic #50-Ubuntu SMP Fri Sep 7 16:17:36 UTC 2012 i686 i686 i386 GNU/Linux      **Edit** : Looks like it might be related to this bug report.


title: OpenSUSE - Apple Wireless Keyboard - Switch "fn" and "ctrl" key?

text: I'm trying to configure the Apple Keyboard so that the "fn" key and the "ctrl" key are swapped. So far I swapped the "cmd" and "alt" key, the "°" and "<" key using xmodmap. Information for that can be found comparatively easy. Unfortunately xev does not give any output for the fn key, for all the other's it does. Does anybody have a solution for that, without me having to recompile my own kernel (this is a machine from work so I can't change the system, though I can do whatever I want in the user space). The solution with recompiling the kernel can be found here: Linux: Apple Wireless A1314 Fn key not registered, looks like software bug My kernel is the 2.6.37.6-0.20-desktop kernel from the OpenSUSE repository, under a OpenSUSE 11.04 32bit. Update: I found out here, that the fn-key has the keycode 464 (showkeys detects it). Unfortunately this is bigger than 255 which means it can appearently not be mapped with xmodmap.


title: /etc/php.ini not being read on fastcgi?

text: On my DV from MediaTemple running Centos 5.8 I installed APC. I then added `extension = "apc.so"` to `/etc/php.ini` so APC will be enabled for all existing and future sites on the server. When I checked `php.info` still no APC showing up. I removed the line and added it to `/var/www/vhosts/example.com/etc/php.ini` and then checked phpinfo which was running in example.com and APC showed up. However, I don't of course want to have to add this each time to every domain. Is there a reason why /etc/php.ini isn't picking it up? I restart httpd, do I need to restart it more? Or if for some reason with FastCGI it has to be in each domain php.ini is there a way to get it added to that template? Also the server uses the default plesk 11.


title: Graphical logviewer that auto reload when file changes?

text: I'm wondering if there's a graphical viewer, also it needs to support auto- reloading when log file has changed. ksystemlog doesn't reload automatically.


title: My Ubuntu doesn't hibernate

text: My Ubuntu 13.10 installation does not hibernate, no matter what I do. Although I have Tuxonice and enough swap space to cover the real RAM, it still doesn't work. Is the problem specific to Ubuntu or to the machine? If it's the former, I'd try to install a different Linux dist, otherwise I'd give up. **Update:** VGA compatible controller: Intel Corporation Core Processor Integrated Graphics Controller (rev 18) (prog-if 00 [VGA controller]) I have 50% of free RAM. There is no problem suspending the machine. I have tried all the tips on https://www.kernel.org/doc/Documentation/power/basic-pm-debugging.txt.


title: Get filesystem name and usage with `df -h`

text: df -h | grep test | sed -e 's/*%.^ //g;s/.*[ ^I]//'      Output:               /test     /test/drv0     /test/drv1                df -h  | grep test  | cut -d '%' -f1 | sed -e 's/*%.^ //g;s/.*[ ^I]//'      Output:               10     20     15 I want to know how can I join those outputs like this:               /test 10     /test/drv0 20     /test/drv1 15 Can someone help me?


title: How does Debian make use of lots of CPU cores?

text: I just got an account on a 24 core VPS (according to UnixBench there are 24 CPUs).   1. In general terms, how can I make good use of all these cores for general purpose shell computing in Debian?   2. Do I need to type something special when I issue long-running apps from the shell in order to make each process run on a separate core if one is available? Or does Debian just handle all of that, invisible to me?


title: Syncing multiple home folders with dropbox and symlinks

text: To keep multiple computers synced with dropbox I tried the following. Approach A. -Computer 1: Install dropbox, dropbox folder: /Dropbox/   -Computer 1: Create symbolic link in that folder to home folder                   $ln -s /home/ /Dropbox/      -Computer 2: Install dropbox, dropbox folder: /Dropbox/ (got populated with files from computer 1   -Computer 2: Try to overwrite the files with symbolic links to identical local files               $ln -sfn /home/ /Dropbox/       ln: `/Dropbox/home': cannot overwrite directory      So that approach fails, does anyone have a suggestion to fix the error? Or another approach? The approaches I have come up so far: Approach B. I could write a script to recursively symlink all the files but I would rather not go that direction since then I would have to run that script in order to pickup on new files. Approach C. Use rsync to sync between the home and dropbox folder. I would not like that since then it is not automatically updated, you would have to call rsync to do that. And putting rsync in a cronjob that runs each minute seems not like a ideal solution. Can someone help me with fixing approach A or coming up with approach D or convincing me of approach B or C ?


title: changing pattern by removing spaces?

text: file :               hi hello,new york,      ,  ,brazil site   ,brazil     january,month is feb   ,      , ,indiana jones      task:   * delete all horizontal space (spaces and tab) between any two comas (like , ,) if there is no character other than space. so it would look like :              hi hello,new york,,,brazil site   ,brazil     january,month is feb   ,,,indiana jones        * also, delete any trailing or leading horizontal space (space and tab) for each parameter so that it looks like this. final output:              hi hello,new york,,,brazil site,brazil     january,month is feb,,,indiana jones      NOTE: The parameters itself has spaces like `hi hello` and `indiana jones` etc. It should not be affected and become like `hihello` or `indianajones`. If possible a solution with awk, otherwise sed will also do. I am unable to achive the first task with sed like this:               sed -n 's/,[[:blank:]],/,,/gp' file      but i get this as output:               january,month is feb   ,      ,,indiana jones


title: IP_TRANSPARENT missing from glibc headers

text: I'm trying to use the `IP_TRANSPARENT` declaration. I am using debian 6.0.5. IP_TRANSPARENT is only defined in `linux/in.h` however it conflicts with `netinet/in.h`. In centos for example, `IP_TRANSPARENT` is defined in both `linux/in.h` and `bits/in.h`. When I look at the top of `bits/in.h` (which I get when I include `netinet/in.h`, the centos one has               /* Copyright (C) ... 2008, 2010 Free Software Foundation, Inc.      Whereas one in my debian install has               /* Copyright (C) ... 2004, 2008 Free Software Foundation, Inc.      I've tried               apt-get install linux-headers-2.6.32-5-686      But it says it is already the newest version. How do I update the debian linux headers to the latest versions? **Edit:** In centos, `IP_TRANSPARENT` is defined in `bits/in.h`, which I get if I include `netinet/in.h`. It compiles fine under centos. In debian, `IP_TRANSPARENT` is not in `bits/in.h`, so when I include `netinet/in.h` I get a `‘IP_TRANSPARENT’ undeclared` error when compiling.


title: Removal of lines with more than 'N' fields?

text: _I am working on mac with sed, perl, awk, bash.._ I have a large-ish (10GB) text file which has 13 fields (columns) of `TAB` delimited data. Unfortunately some of these lines have extraneous `TABs` , so I want to **delete the entire line where we have extra** `TABs` , and thus unequal fields. (I don't mind discarding the lines in their entirety) What I currently have writes the number of fields into another file.               awk -F'\t' '{print NF}' infile  > fieldCount          head fieldCount     13     13     10     13     13     13     14     13     13     13      I would like to construct a short script that removes any line with more (or less) than 13 proper fields (from the original file).   1. speed is helpful as I have to do this on multiple files   2. doing it in one sweep would be cool   3. I currently am porting the fieldCount file into Python, trying to load with line by line. EDIT: vaild (13 columns)               a       b       c       d       e       f       g       h       i       j       k       l       m      invalid (14 columns)               a       b       c       d       e       f       g       h       i       j       k       l       m       n


title: Enable previous command cycling at ftp prompt

text: Currently on pressing arrow keys or `Ctrl`+`P`/`N`, I see characters like               ftp> ^[[A     ftp> ^[[B     ftp> ^P     ftp> ^N      I would like to know, how to configure the ftp prompt so that I am able to view the previous commands just like we do on other shells (e.g. `Ctrl`+`P`/`N` in bash or arrow keys)