title: Operation timeout (in /var/log/secure)

text: Sometimes when connecting via ssh to my RHEL server, I get the following message back from the client: > Operation Timeout Seems like a network problem, but when I look at /var/log/secure on the server I'm connecting to, it actually shows the same message: > Sep 5 10:47:53 servername sshd[3540]: Received disconnect from ::myip 11: > Operation timeout Some days cause more of these messages than others. Is this the fault of the client, the openssh server or something else, and how can I diagnose what the issue is?


title: Does Yum have an equivalent to apt / aptitude's DEBIAN_FRONTEND=noninteractive?

text: On Ubuntu you can use something like this:               export DEBIAN_FRONTEND=noninteractive     sudo -E apt-get update      Which will prevent things that require input (choosing grub versions or conflicts between configuration files, or even prompting for a `mysql` root password during install) I checked the `man` page for `yum` but didn't see anything related to non- interactive usage other than `check-update` which "Returns exit value of 100 if there are packages available for an update" Does Yum have an equivalent to apt / aptitude's `DEBIAN_FRONTEND=noninteractive` ?


title: On Arch, how can you set a WM to start on boot?

text: How would you go about getting X and a window manger to load on boot, and present a fancy-ish login screen like you would in other distros? I want to use something new to me like dwm or bspwm, but I have no experience configuring window managers from scratch.


title: Changing parent directory (../) with symlinks

text: I have a symlink               ~/link -> ~/a/really/long/path      When I do               cd ~/link     cd ..          it takes me to               ~      but I want to go to               ~/a/really/long      Is there a way to do this? I am using bash.


title: How to include files that are excluded in an rsync

text: I'm trying to set up an rsync that excludes all `.*` files except for `.htaccess` but unfortunately, this doesn't work:               rsync -avP --exclude=".*" --include="./.htaccess" ./. user@server:/dir      Is it possible to somehow exclude general exclude rules?


title: Is there a tool that I can use to create a diagram of my system's architecture?

text: I'm looking for a tool that can create both graphical files as well as text based ASCII representations of my system's CPU & motherboard architectures.


title: about UFS allocation on FreeBSD

text: I am wondering what allocation method does UFS use? I know there are several options: contiguous, linked allocation and indexed allocation. Which one is for UFS?


title: Samba local master browser cannot be found via broadcast

text: I have a Samba server (CentOS 6.5, Samba 3.6.9) that acts as a local master browser for a workgroup. I issued               $ setenforce 0     $ service iptables stop      to disable SELinux and get rid of the firewall. On that host, I can do a               $ smbtree -d3      and get (among other output)               name_resolve_bcast: Attempting broadcast lookup for name __MSBROWSE__<0x1>     Got a positive name query response from 192.168.1.10 ( 192.168.1.10 )      where 192.168.1.10 is the IP address of that host. I want to access this server from a Linux client (Fedora 20, Samba 4.1.6). When I execute               $ smbtree -d10      on the client, I get (among other output):               name_resolve_bcast: Attempting broadcast lookup for name __MSBROWSE__<0x1>     bind succeeded on port 0     ...     async_connect failed: No such file or directory     nmbd not around     samba_tevent: EPOLL_CTL_DEL EBADF for fde[0x7f6198c435c0] mpx_fde[(nil)] fd[7] - disabling     Unable to find master browser by broadcast      I have `name resolve order = bcast` on both hosts. Issuing the command               $ smbclient -L 192.168.1.10      on the client shows me all the servers and tells me that 192.168.1.10 is the local master browser. There is one other server involved, a Windows Server 2008 R2 that has NetBIOS over TCP disabled and can tell me about the shares that it offers, but not about any workgroups. Furthermore, the Windows Server as well as a Laptop running Ubuntu 12.04 do not have this problem and can browse the shares of the CentOS server. How can I configure my network such that the client finds the local master browser by broadcast?


title: fetch clipboard text and remove hyphens

text: I'm running Mac OS 10.9 and I use the `Text to Speech` feature which allows you to use a hotkey that reads selected text in any application. I use this feature for reading out-loud PDF documents in Preview (Apple's PDF viewer). The problem is that the selected text usually has word-break hyphens. The result is the `Text to Speech` feature doesn't read out the text properly. Example: ![enter image description here](http://i.stack.imgur.com/QCrQ8.png) Question: Can you write me a short bash shell script that removes hyphens from the text in the clipboard? I will use automator too, so I can assign a hotkey, and to send the script's output to the Speak Text feature. **Edit:** (in reply to goldilocks's comment) Automator allows me to copy selected text to the clipboard followed by a shell script followed by the Speak Text feature. See image below. ![enter image description here](http://i.stack.imgur.com/z7hgE.png) **2nd Edit:** in fact there might be a more concise way of accomplishing this: ![enter image description here](http://i.stack.imgur.com/pG7MW.png) under the 'Pass input' option there is a 'as argument' option. I'm not sure whether this means I can skip the 'copy to clipboard' action in the first image, but I thought I'd mention it just in case.


title: How to grep blocks? Or I should use awk/ack?

text: Say I have a file with information as follows:               ...     Entry '234238': some text       some text       some text       some text     Entry '899823': some text       some text       some text     Entry '234238': more text       more text       more text     Entry '645353': some text       some text       some text      I would like to extract a specific `Entry '<code>'`. For example, `grep_my_block 'Entry '234238'` should return:               Entry '234238': some text       some text       some text       some text     Entry '234238': more text       more text       more text      Note that:   1. The `<code>` that identifies a block may appear multiple times in the file. We want to extract all such blocks.    2. Blocks may consist of an unknown number of lines  How do I do this with `grep`, `awk` or `ack`?


title: Pinguy 11.04 wireless not working

text: I just installed Pinguy OS 11.04 (a derivative of Ubuntu) and I can't seem to get the wireless to work. I've tried everything on this question and a bunch of other stuff. I even reinstalled and that didn't solve anything. So could someone help me? It's my first real attempt with linux, so i'm a big noob when it comes to problem solving Linux problems (I don't have any experience with the command line, but I imagine that with time everything will seem clear). What do I have to do so that I can browse the web wirelessly?


title: coreutils that are utf aware?

text: When I used cut today, I found out it doesn't treat a utf-8 character as a character, but 3 characters because it's 3 bytes long. This seems to be generally true for many tools. Are there versions of the coreutils that are utf-8 aware? my locale output               LANG=en_US.UTF-8     LC_CTYPE="en_US.UTF-8"     LC_NUMERIC="en_US.UTF-8"     LC_TIME="en_US.UTF-8"     LC_COLLATE="en_US.UTF-8"     LC_MONETARY="en_US.UTF-8"     LC_MESSAGES="en_US.UTF-8"     LC_PAPER="en_US.UTF-8"     LC_NAME="en_US.UTF-8"     LC_ADDRESS="en_US.UTF-8"     LC_TELEPHONE="en_US.UTF-8"     LC_MEASUREMENT="en_US.UTF-8"     LC_IDENTIFICATION="en_US.UTF-8"     LC_ALL=      Here is when cut doesn't work               echo 哈哈 | cut -c 2-     ��哈      The right output should be               哈      if cut -c does work on multibyte characters.


title: What tools do I need to intercept and change an incoming packet on a WP2-Personal wifi hub

text: Which tools should I research into to intercept a plain text packet, edit it and then continue it on it's way. I am using Ubuntu 11.04 and Backtrack 5; my wifi is WPA2-person encrypted. I need to edit an item database of an ipod game :)


title: What are the different debian package repos?

text: I know about the ones at http://ftp.us.debian.org/debian/dists/README, but there are other ones such as:   * security.debian.org   * backports.debian.org   * archive.debian.org How many are there? Is there a list somewhere?


title: No installation candidate for compiz

text: I tried to install 3d effect on my Debian Wheezy using command               $ apt-get install compiz compizconfig-settings-manager compiz-fusion-plugins-main compiz-gnome compiz-gtk      But it gives the following               Reading package lists... Done     Building dependency tree            Reading state information... Done     Package compiz is not available, but is referred to by another package.     This may mean that the package is missing, has been obsoleted, or     is only available from another source     E: Package 'compiz' has no installation candidate     E: Unable to locate package compizconfig-settings-manager     E: Unable to locate package compiz-fusion-plugins-main     E: Unable to locate package compiz-gnome     E: Unable to locate package compiz-gtk      What should I do now?


title: No such process error with launch ctl start. Mac OSX 10.9

text: The goal is to set the machine's network name with the IP address of this machine. I have created a `plist` file and put it into `/library/launchagents/. For debugging reasons, I used the command`launctl start`. Here is my `plist` file:               <?xml version="1.0" encoding="UTF-8"?>     <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">     <plist version="1.0">     <dict>       <key>Label</key>       <string>com.myfile.hostname</string>            <key>ProgramArguments</key>       <array>         <string>/usr/sbin/ipconfig</string>         <string>getifaddr</string>         <string>en0</string>         <string>|</string>         <string>/usr/bin/tr</string>         <string>-d</string>         <string>'.'</string>         <string>|</string>         <string>sudo</string>         <string>/usr/sbin/scutil</string>         <string>--set</string>         <string>LocalHostName</string>       </array>            <key>RunAtLoad</key>       <true/>            <key>StandardErrorPath</key>       <string>/tmp/AlTest1.err</string>            <key>StandardOutPath</key>       <string>/tmp/AlTest1.out</string>     </dict>     </plist>      Then I used:               launchctl start /Library/LaunchAgents/com.myfile.hostname.plist      And got the error:               launchctl start error: No such process      As the error does not explain what exactly is wrong with that file, I'm struggling to find the reason. The command itself on the command worked fine. If this is the wrong section for this question please advise?


title: How do I hide/anonymise/defend a computer when on hostile networks?

text: I connect to a lot of open networks when I'm pootling around. I'm fairly careful to VPN home for anything important but that's not really my boggle. The laptop runs several services (nfs, dev http server, samba, avahi). Not only do I not want people on open networks connecting to these services, some of them (samba and avahi) are extremely slutty and advertise themselves all over the place to other computers. I also don't want my computer name available in public places. I already rotate random MAC addresses so hotspot owners can't track where I go on a day- to-day basis. Yeah, I'm pretty paranoid sometimes. Is there any way I can stop these services communicating (either way) on any network that isn't home?


title: Why are PATH variables different when running via sudo and su?

text: On my fedora VM, when running with my user account I have `/usr/local/bin` in my path:               [justin@justin-fedora12 ~]$ env | grep PATH      PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/justin/bin      And likewise when running `su`:               [justin@justin-fedora12 ~]$ su -     Password:      [root@justin-fedora12 justin]# env | grep PATH     PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/justin/bin      However, when running via `sudo`, this directory is not in the path:               [root@justin-fedora12 justin]# exit     [justin@justin-fedora12 ~]$ sudo bash     [root@justin-fedora12 ~]# env | grep PATH     PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/sbin:/bin:/usr/sbin:/usr/bin      Why would the path be different when running via `sudo`?


title: Quoting curly braces in the shell

text: I found examples of different quoting for curly braces for `find`, but I could not find an explanation. The possible choices are:   1. `{}`   2. `'{}'`   3. `"{}"`   And they all seem to work fine. Is there a difference between them?


title: find -exec {} vs. find -exec '{}'

text: I noticed in the man pages for find, that the {} always have single quotes around them. `find -exec '{}' \;` The description states: > Notice that the braces are enclosed in single quote marks to protect them > from interpretation as shell script punctuation. The semicolon is simi- > larly protected by the use of a backslash I have never had an issue using just `find -exec {} \;`   What is an example where the single quotes are required.


title: How to tweak Linux to run reliably on flash memory?

text: Since flash memory only has a limited number of writes, what tweaks are necessary for installing a Linux system onto flash media so that the OS can run reliably for a long period of time? Some examples of flash memory installations include burning a Linux image onto a wireless router's flash memory, or installing a linux distro onto a box that uses an SD card for it's hard drive. Also, besides wireless router firmware (OpenWRT, DD-WRT, etc) which presumably already implements such tweaks, are there any general-purpose distributions that either make these tweaks or allow you to use them as an option?


title: Can't find vgaswitcheroo directory in CentOS6

text: I've installed CentOS6 on my laptop, which has a built in VGA and a discrete (AMD) VGA. I used to switch AMD video off in other distro's (e.g. Fedora, Arch) using:               $ echo OFF > /sys/kernel/debug/vgaswitcheroo/switch      Because when both are running my battery drains quickly and the temperature rises. However in CentOS I can't find the `vgaswitcheroo` folder under `/sys/kernel`. How can I disable my AMD video device like I did before? Here's my `lsmod | grep radeon` :               radeon                917108  0      ttm                    80957  1 radeon     drm_kms_helper         40087  2 i915,radeon     drm                   265638  5 i915,radeon,ttm,drm_kms_helper     i2c_algo_bit            5935  2 i915,radeon     i2c_core               31084  7 videodev,i2c_i801,i915,radeon,drm_kms_helper,drm,i2c_algo_bit      And `lsmod | grep -i intel`:               snd_hda_intel          27823  4      snd_hda_codec         121518  3 snd_hda_codec_hdmi,snd_hda_codec_idt,snd_hda_intel     snd_pcm                86635  4 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec     snd                    69907  16 snd_hda_codec_hdmi,snd_hda_codec_idt,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_seq,snd_seq_device,snd_pcm,snd_timer     snd_page_alloc          8470  2 snd_hda_intel,snd_pcm      I have AMD Radeon 7670M VGA card so i have no idea whether if these are the right modules or not. Here's `dmesg | grep -i switcheroo`:               VGA switcheroo: detected switching method \_SB_.PCI0.GFX0.ATPX handle     vga_switcheroo: enabled      Any help would be appreciated.


title: Where to handle packets between clients?

text: "Server": 192.168.1.1 I want to "theoretically" disable that the clients can "ping" each other. Can i use an iptables rule for it? e.g.:               iptables -A FORWARD -m iprange --src-range 192.168.1.2-192.168.1.255 --dst-range 192.168.1.2-192.168.1.255 -j DROP      Is it true that i cannot filter traffic between the clients?? [or at least redirect these packets to e.g.: the router?] If i run tcpdump on the router ["server"] i can see that a client [192.168.1.201] is pinging another [192.168.1.162]               # tcpdump     tcpdump: WARNING: eth0: no IPv4 address assigned     tcpdump: verbose output suppressed, use -v or -vv for full protocol decode     listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes     12:22:26.931343 IP 192.168.1.201 > 192.168.1.162: ICMP echo request, id 12547, seq 141, length 64     12:22:27.819373 IP 192.168.1.201 > 192.168.1.162: ICMP echo request, id 12547, seq 142, length 64     12:22:28.819640 IP 192.168.1.201 > 192.168.1.162: ICMP echo request, id 12547, seq 143, length 64


title: How to remove files except a list with names files

text: I need delete some `.desktop` files in various directories and a text file with a list of file names. I want to delete all these `.desktop` files except for those listed in my text file). Example               $ ls /home/makerpm/appdata/usr/share/app-install-data/applications/Education/ | tee /tmp/Education      Assuming that `/tmp/Education` is the file which includes the list of file names, I want to delete all the `.desktop` files in a set of directories except those listed in `/tmp/Education`. **Updated!** I can resolve it, with my script, but I don't like:               cd /home/makerpm/appdata/usr/share/app-data/applications/Education/     mkdir -p $HOME/newsapp/Education          file="/tmp/Education"     while IFS= read -r line; do         cp -f /home/makerpm/appdata/usr/share/app-data/applications/Education/$line.desktop $HOME/newsapp/Education/     done <"$file"


title: In linux, how to delete all files EXCEPT the pattern *.txt?

text: I know how to delete all `txt` file under current directory by `rm *.txt`. Does anyone know how to delete all files in current directory EXCEPT `txt` file?


title: tripwire report - inode number

text: Hi I am investigating tripwire and have stumbled upon something which i am unsure about. in a tripwire report generated after i modified hosts.deny to include an extra # I noticed the inode number changed from 6969 to 6915. I would like to know why this happened. I know inodes are records which store data about where data is stored on the file system, but would like to know why this number changed for a simple # being inserted.


title: ETL testing - Unix Commands

text: As part of etl testing I need to find record count for each different record. Currently we are having some 8 different record types in the flat file. Is there any unix command to find the record count of each record types.


title: Getting OpenGL to work under Ubuntu

text: I have an Intel graphics card, of which I can't tell whether or not it's being recognized. When I go through GUI to the System Info section, it states that my graphics card is unknown. Despite this, my `lspci` displays the graphics card perfectly fine. **Question** Is there any way to get OpenGL working correctly on Ubuntu 11.10, or, if this isn't possible (due to my graphics card), would there be any other distros recommended as far as getting this work? **lspci**               00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)     00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)     00:16.0 Communication controller: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1 (rev 04)     00:1a.0 USB Controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)     00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 04)     00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 (rev b4)     00:1c.1 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 2 (rev b4)     00:1d.0 USB Controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 (rev 04)     00:1f.0 ISA bridge: Intel Corporation HM65 Express Chipset Family LPC Controller (rev 04)     00:1f.2 SATA controller: Intel Corporation 6 Series/C200 Series Chipset Family 6 port SATA AHCI Controller (rev 04)     00:1f.3 SMBus: Intel Corporation 6 Series/C200 Series Chipset Family SMBus Controller (rev 04)     02:00.0 Ethernet controller: Broadcom Corporation NetLink BCM57785 Gigabit Ethernet PCIe (rev 10)     02:00.1 SD Host controller: Broadcom Corporation NetXtreme BCM57765 Memory Card Reader (rev 10)     02:00.2 System peripheral: Broadcom Corporation Device 16be (rev 10)     02:00.3 System peripheral: Broadcom Corporation Device 16bf (rev 10)     03:00.0 Network controller: Intel Corporation Centrino Advanced-N 6205 (rev 34)


title: wpa_supplicant and signal strength

text: I use `wpa_supplicant` to handle a connection to specific `SSID`. I added the `wpa_supplicant` to `default` `runlevel` in order to start it at the boot time. I have this question however; Is it any program, script or even ncurses GUI to show me exact and live signal strength.   This is useful as it shows me if my location has poor reception or my ISP has low speed at each given time.   PS: I checked `iw` and its family like `iwlist` but they are not really what i want.


title: dpkg-reconfigure: not found when running in cron

text: I have a virtual server (debian) and the clock fails to sync from time to time (probably because i save/restore state with vboxheadlesstray). To fix this issue I run `dpkg-reconfigure ntp && ntpq -p`, it works when I run it as root, but doesn't work with cron. I have added it in `crontab -e` (as root user) and is using this line:               1 * * * * dpkg-reconfigure ntp && ntpq -p > /dev/null 2>&1      My ordinary user user get mail about it saying `/bin/sh: 1: dpkg-reconfigure: not found`, why is my ordinary user getting the mail and not root and what do I need to change to make it work?


title: How can I start Apache on Arch Linux w/systemd using passphrase protected SSL keys?

text: I'm relatively new to using Arch Linux and think I must be missing the obvious way to do this correctly, but –short of starting the daemon on my own– I can't figure out how to get passphrase protected SSL keys unlocked when starting the service normally. With unprotected keys or without the SSL configuration Apache starts normally using the systemd service. As soon as I try to use protected keys, I get something like this:               $ sudo systemctl start httpd     Job for httpd.service failed.          $ sudo systemctl status httpd     httpd.service - Apache Web Server        Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled)        Active: failed (Result: exit-code) since Mon 2014-02-10 11:47:07 UTC; 13ms ago       Process: 26035 ExecStop=/usr/bin/apachectl graceful-stop (code=exited, status=0/SUCCESS)       Process: 26042 ExecStart=/usr/bin/apachectl start (code=exited, status=1/FAILURE)      Main PID: 25500 (code=exited, status=0/SUCCESS)          systemd[1]: Starting Apache Web Server...     apachectl[26042]: Apache/2.2.26 mod_ssl/2.2.26 (Pass Phrase Dialog)     apachectl[26042]: Some of your private key files are encrypted for security reasons.     apachectl[26042]: In order to read them you have to provide the pass phrases.     apachectl[26042]: Server {name redacted}:443 (RSA)     apachectl[26042]: Enter pass phrase:Apache:mod_ssl:Error: Private key not found.     apachectl[26042]: **Stopped     systemd[1]: httpd.service: control process exited, code=exited status=1     systemd[1]: Failed to start Apache Web Server.     systemd[1]: Unit httpd.service entered failed state.      Is far as I can tell, Apache knows it needs to unlock my keys, but if systemd knows the passphrase prompt needs to be shown, any attempt to do so is not reaching my shell and silently failing. What is the best practice way (or Arch Way™) to start Apache and unlock protected SSL keys using systemd?


title: tmux disable automatic-rename on break pane

text: If I `setw automatic-rename off` on two windows, then join them, when I detach either one `tmux` automatically renames it! And "show-window-options" now has no record of the "automatic-rename off". How can I fix this? How to make `tmux` NOT rename a window after breaking a pane?


title: I have a 24 Gb disk and a 1Tb Hard Disk How do I get Ubuntu to install on my 24 GB and my home dir on the 1TB

text: I used the auto installer for Ubuntu on my 24GB drive my disk space looks like this.               kipke@ThePad:~$ df     Filesystem     1K-blocks    Used Available Use% Mounted on     /dev/sda2       16395648 3936132  11603608  26% /     none                   4       0         4   0% /sys/fs/cgroup     udev             2981788       4   2981784   1% /dev     tmpfs             598380    1100    597280   1% /run     none                5120       0      5120   0% /run/lock     none             2991888     236   2991652   1% /run/shm     none              102400      32    102368   1% /run/user     /dev/sda1         497696    3376    494320   1% /boot/efi         ![24gb drive picture](http://i.stack.imgur.com/tSWMV.png)    ![1tb drive picture](http://i.stack.imgur.com/yBnTZ.png)


title: Select lines from text file which have ids listed in another file

text: I use a lot of grep awk sort in my unix shell to work with medium-sized (around 10M-100M lines) tab-separated column text files. In this respect unix shell is my spreadsheet. But I have one huge problem, that is selecting records given a list of IDs. Having `table.csv` file with format `id\tfoo\tbar...` and `ids.csv` file with list of ids, only select records from `table.csv` with id present in `ids.csv`. kind of http://stackoverflow.com/questions/13732295/extract-all-lines-from- text-file-based-on-a-given-list-of-ids but with shell, not perl. `grep -F` obviously produces false positives if ids are variable width. `join` is an utility I could never figure out. First of all, it requires alphabetic sorting (my files are usually numerically sorted), but even then I can't get it to work without complaining about incorrect order and skipping some records. So I don't like it. grep -f against file with `^id\t`-s is very slow when number of ids is large. `awk` is cumbersome. Are there any good solutions for this? Any specific tools for tab-separated files? Extra functionality will be most welcome too. UPD: Corrected `sort` -> `join`


title: What does "link#1" mean?

text: netstat -rn     Routing tables     Internet:     Destination        Gateway            Flags    Refs      Use    Mtu  Interface     default            75.126.68.49       UGS         7     1203      -   pcn0     1.2.3.3/29    link#1             UC          1        0      -   pcn0     ...      **My question** : What does "link#1" mean? The OS is OpenBSD.


title: How to give rights to user on server to use programs

text: I installed a bunch of applications via SSH on a Debian Wheezy server. Now I want to give one extra developer rights to use one folder. I added her to a new group "myappdevs" and gave the group right to read and write the directory. When I login as the new user and check the programs for:               ruby -v      I see an old version returned. And for               rails -v      and               bundle      I get the errors `[program] : command not found`. For `Vim` it did work, but I had to copy my own Vim profile to the home directory of the new user for it to work. I am new to setting up permissions and access. How can I give the new user access to `ruby`, `bundle` and `rails`?


title: rename files in batch

text: During importing my music files from backup (thanks to default naming scheme of `rhythmbox`), I have messed up the file names. Now the looks like:               00 - American Pie.ogg.ogg.ogg.ogg     00 - American Pie.ogg.ogg.ogg.ogg.ogg     00 - another brick in the wall.ogg.ogg.ogg.ogg     00 - another brick in the wall.ogg.ogg.ogg.ogg.ogg     00 - candle_in_the_wind.ogg.ogg.ogg.ogg     00 - candle_in_the_wind.ogg.ogg.ogg.ogg.ogg      While the file should look like               American Pie.ogg     another brick in the wall.ogg     candle_in_the_wind.ogg      And I have (as from `wc -l`) 3096 such files. How can I restore it in batch mode? I have tried `rename` and `mmv` to work, as given in the ans of this question, but not working (problem with the `rename` syntax, and for `mmv`,there is collision). Any help please?


title: udev triggers rule but script fails to execute properly

text: I am trying to automate a quick and dirty backup of a headless system. (I feel it is relevant to note that I am running Busybox utilities so this is the mount tool I have at my disposal) I have made a udev rule to execute a script when my USB device is plugged in and it does trigger and execute the called script. Currently the script just mounts the device but it fails to do so. If I run the script manually, there is no error. I added the line `exec >/home/user/udev.out 2>&1` to try to figure out why it is failing. Script Contents:               #!/bin/sh     exec >/home/user/udev.out 2>&1     mount -t ntfs-3g /dev/sdb1 /mnt/backup     exit 0      I know I shouldn't use /dev/sdb1 in the script, and I do generate a symlink in the udev rule, but just for error checking I have hardcoded the device. I have also tried adding a 3 second sleep before the mount command to be sure the device could be detected by the system before executing the mount command, to no avail. Results of udev.out:               mount: mounting /dev/sdb1 on /mnt/backup failed: No such device      I know the device is there and it is listed by fdisk. If I call the script from shell, it runs successfully no problem. Has anyone encountered anything similar before? I am not sure how to proceed. edit: udev rule:               SUBSYSTEM=="block", ATTRS{serial}=="serialforusbdrive", SYMLINK+="kingston%n"     SUBSYSTEM=="usb", ATTRS{serial}=="serialforusbdrive", RUN+="/usr/local/bin/backup.sh"      edit: Clarification: udev rule triggers and runs my script. The script when run manually from shell (I type `/usr/local/bin/backup.sh` in shell and the drive is mounted) The script when run by udev rule (RUN+="/usr/local/bin/backup.sh") runs the script but fails to mount the drive.


title: Want to dual boot MBP with Linux

text: I just upgraded to a 1tb HDD in my MacBook Pro (non-retina) and would like to dual boot from OS X to a linux distro. I'd like to find out a few things so I can be better prepared and informed for this process. 1) Partitioning... Should I... a) Use BootCamp to create the second partition? b) Use Disk Utility to resizes and create the second partition? c) Create the partition from within the Linux live USB or DVD? 2) Which distro is recommended? I've used both Mint and Ubuntu in the past and definitely prefer distros based on Debian that use `apt-get` as opposed to the others like SUSE. 3) I've heard that it's a pain to get the wifi to work, is that true? If so, how to I enable the drivers? Is there an `apt-get` command I can use in order to do so? 4) Other than the wifi difficulties is there anything else I should be aware of and be prepared for?


title: FreeBSD: "Too many open files" but should be able to open another 160,000 files

text: I have a FreeBSD 8 system running ZFS, with a MySQL 5.5 server which is about 355GB and projected to grow to be a couple of Terabytes. MySQL is triggering errors about "Too many open files" on `/etc/hosts.allow`. We don't expressly use `/etc/hosts.allow`, but it is used by hosts_access(3) (`libwrap.a`), which is used by many things.               mysqld[1234]: warning: /etc/hosts.allow, line 15: cannot open /etc/hosts.allow: Too many open files      But when I check 't seem to be hitting any actual limits. The number of open files reported by `kern.openfiles stays` below 40,000 over a sustained period, and our limit is substantially higher:               # sysctl -a |grep files     kern.maxfiles: 204800     kern.maxfilesperproc: 184320     kern.openfiles: 38191          # ulimit -n     184320      Openfiles should be set to unlimited:               # grep openfiles /etc/login.conf         :openfiles=unlimited:\      MySQL says it should be able to open 184320 file handles:               # mysqladmin variables | grep open_files_limit     | open_files_limit                              |     184320                |      And some information from the perspective of the MySQL user. I stopped mysql and hacked `/usr/local/etc/rc.d/mysql-server` to print out these variables, so this should represent the MySQL environment. Note that the number 184320 is consistent with the above.               # /usr/local/etc/rc.d/mysql-server.stefantest start     Starting mysql.     cpu time               (seconds, -t)  unlimited     file size           (512-blocks, -f)  unlimited     data seg size           (kbytes, -d)  33554432     stack size              (kbytes, -s)  524288     core file size      (512-blocks, -c)  unlimited     max memory size         (kbytes, -m)  unlimited     locked memory           (kbytes, -l)  unlimited     max user processes              (-u)  5547     open files                      (-n)  184320     virtual mem size        (kbytes, -v)  unlimited     swap limit              (kbytes, -w)  unlimited     sbsize                   (bytes, -b)  unlimited     pseudo-terminals                (-p)  unlimited      And, for easy reference here are the descriptions for the sysctls:               kern.maxfiles: Maximum number of files     kern.openfiles: System-wide number of open files     kern.maxfilesperproc: Maximum files allowed open per process      **Related**   * This is possibly related to a ZFS on Nexenta question on ServerFault: Why is MySQL unable to open hosts.allow/hosts.deny?   * Also see this similar issue on the FreeBSD forums: [EMFILE] Too many open files


title: How to measure total disk I/O per hour

text: I have a cloud server were we get billed also for disk IO usage. Here is an example from the stats:               04/Sep/2013 07:24:19     04/Sep/2013 08:24:19     0,5 GB / 1 vCPU (0,08 Kr. per hour): Charge for 44.7578125GB disk I/O      So for one hour we get billed for around 45 GB disk I/O. To me that sounds like a lot of traffic and I would like to do some monitoring to check it myself. I know about tools like `dstat` and `sysstat` etc but I have not found any examples showing totals for one hour (or other timeframe). Most examples is averaging the results, like this command:               dstat -tdD total 60      Here, it shows disk I/O measuring for 60 seconds, but it is averaged. So if I copy a large file, I will see the number increase while copying, but as soon as it is finished, the number will decrease again. I other words, I don't end up with a true total for that period. **How can I log the total amount of disk I/O in a given timeframe?**


title: Spam don`t get rejected from Amavisd?

text: I see the following in my maillog:               (20448-09) Passed SPAMMY {RelayedTaggedInbound}, [12.21.30.50]:63138 [12.21.30.50] <advertisebz079guqn@gmail.com> -> <sales@censored.com>, Message-ID: <DA134EA6.72A01797@gmail.com>, mail_id: HHUQ8IsrTDBj, Hits: 17.262, size: 1950, queued_as: 8A0CE10564585, 9634 ms      So it hits: Hits: "17.262" My configuration (`/etc/amavisd/amavisd.conf`):               $sa_tag_level_deflt  = 3.0;  # add spam info headers if at, or above that level     $sa_tag2_level_deflt = 10;  # add 'spam detected' headers at that level     $sa_kill_level_deflt = 12;  # triggers spam evasive actions (e.g. blocks mail)     $sa_dsn_cutoff_level = 999;   # spam level beyond which a DSN is not sent     # $sa_quarantine_cutoff_level = 25; # spam level beyond which quarantine is off     $penpals_bonus_score = 8;    # (no effect without a @storage_sql_dsn database)     $penpals_threshold_high = $sa_kill_level_deflt;  # don't waste time on hi spam          $sa_mail_body_size_limit = 400*1024; # don't waste time on SA if mail is larger     $sa_local_tests_only = 0;    # only tests which do not require internet access?      and               #     # Quarantine settings     #          $final_virus_destiny = D_REJECT;     $final_spam_destiny = D_REJECT;     $final_banned_destiny = D_REJECT;     $final_bad_header_destiny = D_PASS;      So why the mail will be delivered and tagged as SPAMMY but not rejected? It is really strange but it looks like that the settings are not used or overwritten. * * * Fullconfig: http://pastebin.com/P0iYTaz4


title: Why and how to track /var/log/dmesg with version control

text: On this wiki they recommend tracking `/var/log/dmesg` using Mercurial. I wanted to set up a cron job on CentOS 6.4 like on this page to remind myself to make commit messages for such a repo. However, the output of `hg diff` on `/var/log/dmesg` is pretty long, and I don't really understand what it is I'd be looking for. If you track this file yourself, why? What problems do you watch out for with it? How frequently does yours change?


title: What file type categories do colors in the terminal represent in various distros (by default)?

text: I'm discovering new file type categories (if one can call different colors in the terminal in such a manner) almost on a daily basis. Still, I haven't found an exhaustive list of all recognized file types (compressed, pipe, directory, music, etc.) and the respective colors on the terminal, and that's a resource I'd appreciate to have. Is there a complete list for any Unix-based system? I'd like a full table for many distros, options, etc.; but if you'd give me a few really useful informative links, perhaps someone can add it up into a table (maybe this should be a community-wiki question, however, I can't mark it as such).


title: Oidentd problem with centos 6.5

text: I have installed oidentd and it is not working with ipv6s only, it works with ipv4 just fine. I have done some search on google and applied a patch on oidentd to work with ipv6 but i still cant make it to work. Here is the copy/paste.               root@mustang [~]# lsof -i -n -P | grep oidentd     oidentd 6065 nobody 6u IPv4 5906 0t0 TCP *:113 (LISTEN)     oidentd 6065 nobody 7u IPv6 5907 0t0 TCP *:113 (LISTEN)          telnet ::1 113     Trying ::1...     Connected to ::1.     Escape character is '^]'.      I also tried changing the value 0 to 1 in `/proc/sys/net/ipv6/bindv6only` still doesn't help. I even tried editing the setting in `/etc/init.d/oidentd` to execute oidentd with -a :: still nothing. All of my users are getting ~ symbol ifront of their ident. Here is one example               Nick is ~d34m0n@2607:5300:60:5177::21e3:4232 * ...      what am I missing? it's been a week and i am still scratching my head.


title: How to check for a folder inside a particular folder in shell script?

text: I am working on a shell script and python script as well. Python script is passing certain parameters to my shell script and then I am using those parameters in my shell script. Below is my shell script -               #!/bin/bash          readonly MACHINES=(machineB machineC)     readonly MAPPED_LOCATION=/bat/peta/t1_snapshot     readonly FILE_TIMESTAMP=$file_timestamp          // old code which I am using to get the full path of the latest folder in each machine     dir1=$(ssh -o "StrictHostKeyChecking no" david@${MACHINES[0]} ls -dt1 "$MAPPED_LOCATION"/[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] | head -n1)     dir2=$(ssh -o "StrictHostKeyChecking no" david@${MACHINES[1]} ls -dt1 "$MAPPED_LOCATION"/[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] | head -n1)          echo $dir1     echo $dir2          // not sure what should I do here?     dir3=$MAPPED_LOCATION/$FILE_TIMESTAMP      In each machine `(machineB and machineC)`, there will be a folder in this format `YYYYMMDD` inside this folder `MAPPED_LOCATION`. Now what I am trying to do is - I am passing `file_timestamp` from the python script which will be in this form `YYYYMMDD` so now I need to check whether this folder is there inside `MAPPED_LOCATION` folder or not in each machine. If it is there then print out the full path of that folder for each machine, otherwise exit out of the shell script with non-zero status. If it is not there in any one of the machine, I will exit out of the shell script with a message that this folder is not present in this machine with non zero status. I am not sure how can I do this check in the shell script?


title: How to exclude directories from `ls -R` output?

text: If `ls -aR | grep ":$"` returns               ./.hiddendir2:     ./dir1:     ./dir3:     ./dir3/.hiddendir4:      then how can you update the pattern given to grep so that you only get               ./dir1:     ./dir3:      (note that the last line containing .hiddendir4 was omitted even though it's parent was not hidden) * * * Here is a wordy version of the same question with some context: I found a great script at http://www.centerkey.com/tree/ for printing a directory tree, but the output is cluttered sometimes by the descendants of the .git directory for repos I'm working on. If I read the source correctly I need to change the pattern given to grep at this line: `ls -aR | grep ":$"` So far I came up with `^\\./(?!\\.)\w+:$` which seemed to work in testing at http://regexpal.com/, but then broke when I tried running in bash. I suspect the combination of (1) differences between regex testing tools i'm using to how grep parses a pattern, (2) bash escape character requirements, and (3) pattern design all need to be addressed to solve this. Help appreciated before I end up spending too long on this.


title: Printing fields using awk

text: < pool.sam awk '       /./ {printf $1}       {printf $7+1,"\t"}       {printf $3,"\t"}       {         if($2 !=16) {print "\t", "+";} else {print "\t","-";}         {printf $4,"\t" ,length($10)+$4, "\t", "1"}       }'      I am getting all the values, but in a weird manner. I am printing 7 values, value1 value2 value3 value7 I want all these 7 values, separated by a TAB, in each Line. I tried my best to figure out if to use `print` or to use `printf` Seems, I lost in that. Kindly guide me.


title: iw fails to configure interface

text: I have two PCs:   * Ubuntu 12.04.4, 3.5.0-45-generic (let's call it "myGoodPC")   * Ubuntu 12.04.3, 3.8.0-35-generic (let's call it "myBadPC") `myBadPC` operates in a virtual machine of ESXi 5.0.0. In `myGoodPC` I manage to configure the wireless interface properly:               root@myGoodPC:~# sudo iw --debug dev wlan0 set channel 10 HT40-     -- Debug: Sent Message:     --------------------------   BEGIN NETLINK MESSAGE ---------------------------       [HEADER] 16 octets         .nlmsg_len = 44         .nlmsg_type = 24 <0x18>         .nlmsg_flags = 5 <REQUEST,ACK>         .nlmsg_seq = 1398703424         .nlmsg_pid = 14796       [PAYLOAD] 28 octets         02 00 00 00 08 00 03 00 08 00 00 00 08 00 26 00 99 09 ..............&...         00 00 08 00 27 00 02 00 00 00                         ....'.....     ---------------------------  END NETLINK MESSAGE   ---------------------------     -- Debug: Received Message:     --------------------------   BEGIN NETLINK MESSAGE ---------------------------       [HEADER] 16 octets         .nlmsg_len = 36         .nlmsg_type = 2 <ERROR>         .nlmsg_flags = 0 <>         .nlmsg_seq = 1398703424         .nlmsg_pid = 14796       [ERRORMSG] 20 octets         .error = 0 "Success"       [ORIGINAL MESSAGE] 16 octets         .nlmsg_len = 16         .nlmsg_type = 24 <0x18>         .nlmsg_flags = 5 <REQUEST,ACK>         .nlmsg_seq = 1398703424         .nlmsg_pid = 14796     ---------------------------  END NETLINK MESSAGE   ---------------------------      Also I successfully sniff WiFi data packets (ICMP / ping packets). In `myBadPC` an error appears when trying to configure:               root@myBadPC:~# sudo iw --debug dev wlan0 set channel 10 HT40-     -- Debug: Sent Message:     --------------------------   BEGIN NETLINK MESSAGE ---------------------------       [HEADER] 16 octets         .nlmsg_len = 44         .nlmsg_type = 25 <0x19>         .nlmsg_flags = 5 <REQUEST,ACK>         .nlmsg_seq = 1398698982         .nlmsg_pid = 14533       [PAYLOAD] 28 octets         02 00 00 00 08 00 03 00 03 00 00 00 08 00 26 00 99 09 ..............&...         00 00 08 00 27 00 02 00 00 00                         ....'.....     ---------------------------  END NETLINK MESSAGE   ---------------------------     -- Debug: Received Message:     --------------------------   BEGIN NETLINK MESSAGE ---------------------------       [HEADER] 16 octets         .nlmsg_len = 64         .nlmsg_type = 2 <ERROR>         .nlmsg_flags = 0 <>         .nlmsg_seq = 1398698982         .nlmsg_pid = 14533       [ERRORMSG] 20 octets         .error = -16 "Device or resource busy"       [ORIGINAL MESSAGE] 16 octets         .nlmsg_len = 16         .nlmsg_type = 25 <0x19>         .nlmsg_flags = 5 <REQUEST,ACK>         .nlmsg_seq = 1398698982         .nlmsg_pid = 14533     ---------------------------  END NETLINK MESSAGE   ---------------------------     command failed: Device or resource busy (-16)      Obviously I fail to sniff data packets (ICMP/ping) after this command (but broadcast are visible). Note: I removed other commands from the above code for clarity (like `ifconfig wlan0 down` that comes before `iw` or `iwconfig wlan0 mode monitor` and `ifconfig wlan0 up` that come after). What could make wlan0 to have errors in `myBadPC`?


title: Change network values from sysctl.conf

text: Can I change the value of those parameters (`spoofprotect`, `syncookies`, `dynaddr_hack`, `notimestamps`, `nobroadcasticmpecho`, `ip_forward`) from `sysctl.conf` file in `systemd`?


title: Why I can't send mail to remote mailbox?

text: I have installed Postfix on my CentOS machine. I can nicely send mails to local accounts with `mutt`, but when I try to send one to a remote mail like myactualmail@gmail.com, I cannot understand why I can't receive anything. Here my `main.cf`:               queue_directory = /var/spool/postfix     command_directory = /usr/sbin     daemon_directory = /usr/libexec/postfix     data_directory = /var/lib/postfix     mail_owner = postfix     myhostname = server.example.com     mydomain = example.com     myorigin = $mydomain     inet_interfaces = all     inet_protocols = all     mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain     unknown_local_recipient_reject_code = 550     mynetworks = 192.168.200.0/24, 127.0.0.0/8     alias_maps = hash:/etc/aliases     alias_database = hash:/etc/aliases     debug_peer_level = 2     debugger_command =          PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin          ddd $daemon_directory/$process_name $process_id & sleep 5               sendmail_path = /usr/sbin/sendmail.postfix     newaliases_path = /usr/bin/newaliases.postfix     mailq_path = /usr/bin/mailq.postfix     setgid_group = postdrop     html_directory = no     manpage_directory = /usr/share/man     sample_directory = /usr/share/doc/postfix-2.6.6/samples     readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES      In the maillog I find these:               Jan 22 14:33:15 server postfix/qmgr[5025]: 316FEBF65E: from=<diego@example.com>, size=430, nrcpt=1 (queue active)     Jan 22 14:33:15 server postfix/smtp[5276]: connect to gmail-smtp-in.l.google.com[2a00:1450:400c:c05::1b]:25: Network is unreachable     Jan 22 14:33:15 server postfix/smtp[5276]: connect to gmail-smtp-in.l.google.com[173.194.66.26]:25: Connection refused     Jan 22 14:33:15 server postfix/smtp[5276]: connect to alt1.gmail-smtp-in.l.google.com[2a00:1450:400c:c05::1a]:25: Network is unreachable     Jan 22 14:33:15 server postfix/smtp[5276]: connect to alt1.gmail-smtp-in.l.google.com[173.194.70.26]:25: Connection refused     Jan 22 14:33:15 server postfix/smtp[5276]: connect to alt2.gmail-smtp-in.l.google.com[2a00:1450:400c:c05::1b]:25: Network is unreachable     Jan 22 14:33:15 server postfix/smtp[5276]: 316FEBF65E: to=<myactualmail@gmail.com>, relay=none, delay=2662, delays=2661/0.04/0.08/0, dsn=4.4.1, status=deferred (connect to alt2.gmail-smtp-in.l.google.com[2a00:1450:400c:c05::1b]:25: Network is unreachable)      But I can ping nicely the host:               ping gmail-smtp-in.l.google.com     PING gmail-smtp-in.l.google.com (173.194.66.26) 56(84) bytes of data.     64 bytes from we-in-f26.1e100.net (173.194.66.26): icmp_seq=1 ttl=128 time=29.2 ms     64 bytes from we-in-f26.1e100.net (173.194.66.26): icmp_seq=2 ttl=128 time=29.6 ms     64 bytes from we-in-f26.1e100.net (173.194.66.26): icmp_seq=3 ttl=128 time=31.0 ms


I have a couple of questions, and am a complete newbie, so please be kind.   1. How do you change the desktop theme in CentOS?    2. How does one download CentOS themes from the internet?   3. How do you install them?


title: ssldump: PCAP: syntax error

text: I'm using:               # uname -ro     FreeBSD 9.0-RELEASE-p3      And the latest `ssldump`:               # pkg_info | grep ssldump     ssldump-0.9b3_4     SSLv3/TLS network protocol analyzer      When I try starting it with decryption - I got the following error:               # ssldump -Xnd -i em0 port 8443 -k name.pem -p password     PCAP: syntax error      I've installed `libpcap`:               # pkg_info | grep libpcap     dnstop-20121017     Captures and analyzes DNS traffic (or analyzes libpcap dump     libpcap-1.4.0       Ubiquitous network traffic capture library      Found one reference about possible problems with some network interfaces: > Support is provided for only for Ethernet and loopback interfaces So I tried to eun `ssldump` with `lo0`:               # ssldump -Xnd -i lo0 port 8443 -k name.pem -p password     PCAP: syntax error      So - how I can run`ssldump` with packets decryption? Where is my mistake?


title: Compiling and installing a kernel.org kernel to a custom volume on disk

text: I want to compile and install a kernel.org kernel on a custom HDD volume, say `/dev/sda5`, instead of being merged with my current Ubuntu's directories. I can find information about configuration and compilation process all over the web, but there's no track of how to put the kernel on a custom volume (different than the booted distro you're using at the moment of compile). What I'm asking for is like how we can install 2 different distros on 2 different volumes on 1 HDD, now think of my custom kernel as another distro.


title: awk command for parsing a file

text: I have a following text file. I am showing you the first 3 lines.               chrom   st  end gene    strand  c1  c2  c3  c4  c5  c6  c7  c8  c9  c10 c11 c12 c13 c14     chr6    3345    3543    geneA   +   36  -23 -1  3   1250    946 416 458 475 417 58  80  2   14     chr9    1302    1389    geneB   -   8   -10 -18 -8  2896    2128    635 955 372 385 -20 31  -7  -7      I want to print out first line as it is since it's the header line. Then for subsequent lines(i.e. from lines 2 and onwards), I want to print the first 5 fields as it is(till the strand info) and after that if the field(from 6th field onwards) has value >= 100 print that value as it is and if the field has value < 100 just replace it with NA. So my output file should look something like this (ideally, tab-delimited)               chrom   st  end gene    strand  c1  c2  c3  c4  c5  c6  c7  c8  c9  c10 c11 c12 c13 c14     chr6    3345    3543    geneA   +   NA  NA  NA  NA  1250    946 416 458 475 417 NA  NA  NA  NA     chr9    1302    1389    geneB   -   NA  NA  NA  NA  2896    2128    635 955 372 385 NA  NA  NA  NA


title: Issue with WINCH signal - what am I overlooking?

text: I am having an issue with the WINCH signal in the following code which is from a tutorial located at developerWorks®:               #!/bin/bash     trap 'get_window_size' WINCH                    # trap when a user has resized the window          _UNDERLINE_ON=`tput smul`                       # turn on underline     _UNDERLINE_OFF=`tput rmul`                      # turn off underline          get_window_size() {       _WINDOW_X=`tput lines`       _WINDOW_Y=`tput cols`            _FULL_SPACES=`echo ""|awk '       {         _SPACES = '${_WINDOW_Y}'         while (_SPACES-- > 0) printf (" ")       }'`       _FULL_UNDERLINE=`echo "${_UNDERLINE_ON}${_FULL_SPACES}${_UNDERLINE_OFF}"`            unset _FULL_SPACES       show_menu            return 0     }          set_color() {       tput clear       PS3="Enter Selection[1-9]:"       select _COLOR in "Black" "Blue" "Green" "Cyan" "Red" "Magenta" "Yellow" "White" "Exit"       do         case ${REPLY} in            [1-8])  _X=`expr ${REPLY} - 1`;;                9)  break;;                *)  echo "Invalid Color"; continue;;         esac              if [[ ${1} = "b" ]]         then           tput setb ${_X}             else           tput setf ${_X}         fi       done     }          show_menu() {       while [[ -z ${_ANS} ]]       do         tput civis         tput clear              cat <<- EOF     Window Size: ${_WINDOW_X} / ${_WINDOW_Y}               Select => ${_UNDERLINE_ON}     ${_UNDERLINE_OFF}          ${_FULL_UNDERLINE}     B) Background Text Color     F) Foreground Text Color          X) Exit     EOF              tput rc         tput smul         tput cnorm              read _ANS         tput rmul              case ${_ANS} in           [Bb])  set_color "b";;           [Ff])  set_color "f";;           [Xx])  tput clear; exit;;              *)                  echo -e "Invalid Selection: ${_ANS}\c"                  sleep 2                  ;;         esac         unset _ANS       done     }          tput sgr0     tput civis     tput clear     tput cup 3 10     tput sc     tput cup 0 0          [[ -n ${_ANS} ]] && unset _ANS     get_window_size          exit 0      Since I am trapping the WINCH (window change) signal, I expect that (each time I adjust the window which contains this running script) the get_window_size function will be invoked. However, on my machine, it only traps the WINCH signal once (under specific conditions). The trap happens only if I use the xterm (in this case, gnome- terminal) `Terminal` menu to choose one of the default sizes (80x24, 80x43, 132x24, 132x43); further, it happens only the first such time. If I subsequently change the window size (using the `Terminal` menu item), no trapping occurs. Also, if I don't use the `Terminal` menu item, but re-size using a pointing device, even the first trap does not happen. Can someone help me to understand what is wrong (either with the code or with my expectation)?


title: 'find'  across directories named .../dirnameXX/... with XX variable

text: I am executing this command to find certain files in specific directory:               find ./rgs/test/maesXX/master/stdlist -name \*.extract \          -mtime +30 \! -size 0 -exec ls -lrt {} \;      where XX could be any number between 1-100. Can I use a regex for this purpose? How would I do that? Are there other ways?


title: closing socket after forcing terminal close

text: I'm running Bluetooth socket server, this server is listening to incoming connection. but I forced the terminal close ctrl + Z . after that the server is not listeing any more and show me the output `accepted connection from 00:00:00:00:00:00` to make it run again I should restart my computer. how can I close properly the socket to I can run the server again without reboot               int main(int argc, char **argv)     {         struct sockaddr_rc loc_addr = { 0 }, rem_addr = { 0 };         char buf[1024] = { 0 };         int s, client, bytes_read;         socklen_t opt = sizeof(rem_addr);         s = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);         loc_addr.rc_family = AF_BLUETOOTH;         loc_addr.rc_bdaddr = *BDADDR_ANY;         loc_addr.rc_channel = (uint8_t) 1;         bind(s, (struct sockaddr *)&loc_addr, sizeof(loc_addr));         listen(s, 1);         client = accept(s, (struct sockaddr *)&rem_addr, &opt);         ba2str( &rem_addr.rc_bdaddr, buf );         fprintf(stderr, "accepted connection from %s\n", buf);         memset(buf, 0, sizeof(buf));         bytes_read = read(client, buf, sizeof(buf));         if( bytes_read > 0 ) {             printf("received [%s]\n", buf);         }         close(client);         close(s);         return 0;     }


title: A combination of uniq and agrep?

text: I have a file full of long SQL queries, one per line. I need to create a list of unique queries, but most of the queries include parameter values that make using an exact matching tool like `uniq` impossible. Is there a way to find unique lines "fuzzily", like `agrep`?


title: How to copy text from vim to an external program?

text: I'm trying to copy-paste some text from vim. I'm doing **v** to enter visual mode, then **y** once I selected my block. It appears to copy the text into vim's clipboard, because p will paste it. But in another program (e.g. Chrome), right-click->paste doesn't paste the correct text. How do I copy text to the correct clipboard?


title: dd vs cat -- is dd still relevant these days?

text: I recently realized we can use `cat` as much as `dd`, and it's actually faster than `dd` I know that `dd` was useful in dealing with tapes where block size actually mattered in correctness, not just performance. In these days, though, are there situations where `dd` can do something `cat` can't? (Here I would regard a less than 20% performance difference irrelevant.) Concrete examples would be nice!


title: gnome-music 3.12 playlist duplicated

text: ![enter image description here](http://i.stack.imgur.com/V3ISN.png) I am pretty sure the file is not duplicated in `Music` folder


title: Get latest Rekonq developmental source code

text: I see that I can get the latest stable Rekonq through http://sourceforge.net/projects/rekonq/, but I want to get the latest developmental-version/daily-build. Where can I obtain the developmental source code?


title: How to find which package provides a file?

text: For example, I can't install package `qcad` because of error: "can't find qdict.h".   How can I find the package which provides the file `qdict.h` so I can install the package `qcad`?


title: Error installing gnome-shell-extension-common from AUR on Arch

text: I'm new to Arch Linux and just wanted to theme my Gnome Shell by installing gnome-shell-extension-user-theme for the Gnome Tweak Tool. However I keep getting an error when trying to build gnome-shell-extension-common-git from AUR. The version number contains a hypen but if I edit the PKGBUILD it just gets written over again. I run:               yaourt gnome-shell-extension-common-git      View contents of PKGBUILD:               # Maintainer: Alucryd <alucryd at gmail dot com>     # Contributor: Sebastian Lenz <sebastian@archusers.de>          pkgname=gnome-shell-extension-common-git     pkgver=3.8.1.7     pkgrel=1     pkgdesc="Common files for the GNOME Shell Extensions"     arch=('any')     url="http://live.gnome.org/GnomeShell/Extensions"     license=('GPL' 'LGPL')     depends=('gnome-shell')     makedepends=('git' 'gnome-common' 'intltool')     provides=('gnome-shell-extension-common')     conflicts=('gnome-shell-extension-git' 'gnome-shell-extension-common')     source=('git+http://git.gnome.org/browse/gnome-shell-extensions#branch=gnome-3-8')     sha256sums=('SKIP')          pkgver() {       cd "${srcdir}"/gnome-shell-extensions            git describe | sed 's|\(.*-.*\)-.*|\1|;s|-|.|'     }          build() {       cd "${srcdir}"/gnome-shell-extensions            ./autogen.sh --prefix=/usr --disable-schemas-compile --enable-extensions=""       make     }          package() {       cd "${srcdir}"/gnome-shell-extensions            make DESTDIR="${pkgdir}" install     }          # vim: ts=2 sw=2 et:      Get an error when building:               ==> Starting pkgver()...     ==> Updated version: gnome-shell-extension-common-git 3.8.3.1.real-2-1     ==> ERROR: pkgver is not allowed to contain colons, hyphens or whitespace.     ==> ERROR: Makepkg was unable to build gnome-shell-extension-common-git.     ==> Restart building gnome-shell-extension-common-git ? [y/N]      New Contents of PKGBUILD:               # Maintainer: Alucryd <alucryd at gmail dot com>     # Contributor: Sebastian Lenz <sebastian@archusers.de>          pkgname=gnome-shell-extension-common-git     pkgver=3.8.3.1.real-2     pkgrel=1     pkgdesc="Common files for the GNOME Shell Extensions"     arch=('any')     url="http://live.gnome.org/GnomeShell/Extensions"     license=('GPL' 'LGPL')     depends=('gnome-shell')     makedepends=('git' 'gnome-common' 'intltool')     provides=('gnome-shell-extension-common')     conflicts=('gnome-shell-extension-git' 'gnome-shell-extension-common')     source=('git+http://git.gnome.org/browse/gnome-shell-extensions#branch=gnome-3-8')     sha256sums=('SKIP')          pkgver() {       cd "${srcdir}"/gnome-shell-extensions            git describe | sed 's|\(.*-.*\)-.*|\1|;s|-|.|'     }          build() {       cd "${srcdir}"/gnome-shell-extensions            ./autogen.sh --prefix=/usr --disable-schemas-compile --enable-extensions=""       make     }          package() {       cd "${srcdir}"/gnome-shell-extensions            make DESTDIR="${pkgdir}" install     }          # vim: ts=2 sw=2 et:      If I edit the file to remove the hypthen it makes no difference as it is added again when I try to build again.


title: Volume too quiet at maximum

text: I recently replaced my broken Sennheiser PC350 to a Beyerdynamic DT770 Pro 80 Ohm headphones and I've encountered a really annoying issue. Everything is too low. I can listen to it, but it's almost as if I'm on 10% of max volume. On Windows this issue isn't present at all, and is almost a little too loud on 100%. Pulseaudio settings are set to 100%, and every slider in the alsamixer are set to 100% too. If I set the volume to 150%, the sound gets too saturated and distorted. My sound chip is the Realtek ALC1150. I'm running Arch. Edit After thinking it was solved, the issue came back but I believe I have more of an understanding of the issue now. Using the line out port, green one, works from time to time, but more often than not, using any of the other ports will output the what you'd expect from line out. In a way, the issue is resolved since if I use any other ports than the line out, the sound is working like it should. I'd rather not though as Windows doesn't output anything at all when not using line out, and there are times where linux too won't output to anything but line out. How come linux gets so confused? It's almost as if it believes the line out port is all of the other ports except for line out.


title: How to create a patch ignoring indentation differences in the code?

text: I'm trying to create patch a file using diff tool.But facing an issues.The way I am doing is below. I've created one Directory named a and put original file in to it.               a/original_file.c      Now I have created other Directory named b and put same file with modified content in to it.               b/original_file.c      Now content of `b/original_file.c` file I have copied from internet and put it into some text editor. After giving command: `diff -Naur a b > patch_file.patch`, the file `patch_file.patch` is generated and it has some unwanted changes (its related to indentation). For example:               return mg_nw (MG_READY_NOY, &rmsg, seqnr,     -                 sizeof (struct mg_rdy_notify));     +                  sizeof (struct mg_rdy_notify));       Now you can see there are changed related to indentation where `sizeof (struct mg_rdy_notify))` is replaced by same `sizeof (struct mg_rdy_notify))` but one basis of indentation which is what we don't want.


title: For downloading, youtube file format changes depending on OS?

text: Oh! its sad to see what I saw. I am downloading a file from youtube (the video is of 1 hr) using command line from Ubuntu13.04 as below:               ravbholua@ravbholua-Aspire-5315:~$ youtube-dl "http://www.youtube.com/watch?v=d4Z8VI3myBw"     [youtube] Setting language     [youtube] d4Z8VI3myBw: Downloading video webpage     [youtube] d4Z8VI3myBw: Downloading video info webpage     [youtube] d4Z8VI3myBw: Extracting video information     [download] Destination: d4Z8VI3myBw.mp4     [download]   0.1% of 718.62M at   13.70k/s ETA --:--      See the size is 718 MB and type is mp4. The same file I downloaded earlier from Windows 7 OS using youtube downloader. Then the type and size of the file was flv and 130 MB only. Similarly, yesterday and today I downloaded files from youtube via my Ubuntu13.04 and all were downloaded as mp4 and very very big size. But when I downloaded many videos via Windows earlier all the files had flv type and very less size as compared to mp4. I can't download youtube videos if they are downloaded like this (mp4 with big sizes). One thing is clear: the difference lies with the OS and/or the youtube downloader for Windows7. What setting needs to be changed please here in Ubuntu13.04?


title: Configure syslog.conf file

text: How can I configure `/etc/syslog.conf` file in order to save log information about `iptables` in a specific file. I want to save these information separately, so I can extract what I want easily and rapidly.


title: dmesg email digest

text: I have a remote server which has some issues (Seem hardware related) which means that it logs `KVM` errors and then sometime later it becomes unresponsive and locked up. There is an often an early indication of it failing, in the `dmesg` log output, so I would like to know, is there a Debian utility which can send me (daily?) digests of the `dmesg` (`/var/log/kern.log`) output?


title: With grep, how can I match a pattern and invert match another pattern?

text: With `grep`, I want to select all lines that match a pattern, and that don't match another pattern. I want to be able to use a single invocation of `grep` so that I can use the `\--after-context` option (or `\--before-context`, or `\--context`). `-v` is not viable here, as it negates all patterns I pass to `grep` using the `-e` option. ### Example I want to look for lines matching `needle`, ignoring lines matching `ignore me`, with one line of following context. Here's my input file:               one needle ignore me     two     three     four needle     five      The output I want is:               four needle     five      As you can see, this naive solution doesn't work:               $ cat file | grep --after-context=1 needle | grep -v 'ignore me'     two     ---     four needle     five


title: description of linux kernel boot parameters 'real_root' and 'cdroot'

text: I am looking for a formal description of the following boot parameters in the linux kernel:   * real_root    * cdroot  I have problems tuning them to create my own bootable LiveUSB system. Are they specific to my distribution (Gentoo)? They do not appear in the gitweb kernel documentation.


title: in which directory should Firefox be compiled?

text: I want to compile Firefox browser in RHEL.   I found two directories one is `/root/.mozilla/firefox` and other one is `/usr/lib64/firefox`.   Which directory is the one where Firefox should be compiled?


title: Restoring the old 'lenny' Debian desktop

text: In _lenny_ , the Debian desktop's default image was the red Debian logo, and it looked like this: ![enter image description here](http://i.stack.imgur.com/893gv.jpg) However, in _squeeze_ , the desktop has been replaced by this: ![enter image description here](http://i.stack.imgur.com/jsOU4.png) How can one restory the _lenny_ look-and-feel; at least the background image? Are those graphics still bundled with _squeeze_ , and if not, how do I get at them?


title: How can I tell cron to run a command every other day (odd/even)

text: When configuring cron to run a command every other day using the "Day of Month" field, like so:               1 22 */2 * * COMMAND      it runs every time the day of month is odd: 1,3,5,7,9 and so on. How can I configure cron to run on days of month that are even like 2,6,8,10 and so on (without specifying it literally, which is problematic as every month has a different number of days in the month)?


title: doing OpenLDAP config changes in RHEL 6

text: I've been configuring OpenLDAP on RHEL 6 and its seems you have run the following to rebuild the config dirs. I'm ok with that, but my issues is, say I want to change the server passwd, do I have to go through the whole process every time I change the config? Is there a way of changing the slapd config after its been built using the RHEL6 method? Below is the advice I've found on the net here. > This example assumes that the file to convert from the old slapd > configuration is located at /etc/openldap/slapd.conf and the new directory > for OpenLDAP configuration is located at /etc/openldap/slapd.d/. Remove the > contents of the new /etc/openldap/slapd.d/ directory: > > `rm -rf /etc/openldap/slapd.d/*` > > Run slaptest to check the validity of the configuration file and specify the > new configuration directory: slaptest -f /etc/openldap/slapd.conf -F > /etc/openldap/slapd.d > > Configure permissions on the new directory: chown -R ldap:ldap > /etc/openldap/slapd.d > > `chmod -R 000 /etc/openldap/slapd.d` > > `chmod -R u+rwX /etc/openldap/slapd.d` To clarify: I'm after help on how to edit the slapd configuration using the newer versions of openldap where the config is held in a schema rather than the original `slapd.conf`.


title: Reverse a chmod command on a directory

text: Is there a way to undo a `chmod` command on a directory in **CentOS** ?


title: Connecting multiple USB RNDIS devices to PC in the same network

text: Running an Ubuntu 12.04.4 I have the following issue: I want to connect multiple USB RNDIS devices to one PC. Additionaly, every device should be in the same network. **The problem** is that only one device is reachable via the PC. My following example is for two USB RNDIS devices. One with the IP `192.168.0.15` and the other with `192.168.0.16` The two USB devices are detected correctly with the following `/etc/network/interfaces` file:               # The device for 192.168.0.15     auto usb0     iface usb0 inet static     address 192.168.0.200     netmask 255.255.255.0          # The device for 192.168.0.16     auto usb1     iface usb1 inet static     address 192.168.0.201     netmask 255.255.255.0      If I connect the devices and run `ifconfig` it looks as follows:               usb0      Link encap:Ethernet  Hardware Adresse 22:d0:9c:4f:65:77                 inet Adresse:192.168.0.200  Bcast:192.168.0.255  Maske:255.255.255.0               inet6-Adresse: fe80::20d0:9cff:fe4f:6577/64 Gültigkeitsbereich:Verbindung               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metrik:1               RX-Pakete:5 Fehler:0 Verloren:0 Überläufe:0 Fenster:0               TX-Pakete:50 Fehler:0 Verloren:0 Überläufe:0 Träger:0               Kollisionen:0 Sendewarteschlangenlänge:1000                RX-Bytes:308 (308.0 B)  TX-Bytes:8803 (8.8 KB)          usb1      Link encap:Ethernet  Hardware Adresse 8e:f4:be:bf:6d:1c                 inet Adresse:192.168.0.201  Bcast:192.168.0.255  Maske:255.255.255.0               inet6-Adresse: fe80::8cf4:beff:febf:6d1c/64 Gültigkeitsbereich:Verbindung               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metrik:1               RX-Pakete:0 Fehler:0 Verloren:0 Überläufe:0 Fenster:0               TX-Pakete:29 Fehler:0 Verloren:0 Überläufe:0 Träger:0               Kollisionen:0 Sendewarteschlangenlänge:1000                RX-Bytes:0 (0.0 B)  TX-Bytes:5929 (5.9 KB)      But here comes the drawback. Unfortunately only the `usb0` device is reachable. So if I type in `ping 192.168.0.15` everything works fine. But if I try `ping 192.168.0.16` nothing happens, even with `ping 192.168.0.16 -I usb1` literally nothing happens:               $ ping 192.168.0.16 -I usb1     PING 192.168.0.16 (192.168.0.16) from 192.168.0.201 usb1: 56(84) bytes of data.     ^C     --- 192.168.0.16 ping statistics ---     45 packets transmitted, 0 received, 100% packet loss, time 44351ms      `ping` does even not say, that the host is unreachable (note the `time 44351`). The next strange thing is, that packages have been send (not the TX in ifconfig regarding usb1) but never recieved (not the RX in ifconfig regarding usb1).


title: Where might the dbus development (.h) files be for RHEL5?

text: A quick search from yum for dbus fails to turn up the devel related package that should provide dbus.h et al. Anybody have experience locating the relevant package? Should I just resort to getting the dbus source itself?


title: Detecting that a device is mounted to a particular folder?

text: As part of revamping my backup scheme, I'm now adding rotating external hard drives, keeping one safely off-site at all times while the other is receiving backup data. Naturally, to ensure that my backups actually get done, the backups will be scripted and cron'd. My plan is to manually plug in and mount the hard drive, and then leave it there until it's time to unmount it (again manually), take it away, bring in the next one, and (manually) mount that one. Both drives would be mounted to e.g. /mnt/backup. Now, here comes the question: I don't want the backup script to run if I forget to plug in or mount the hard drive. So I need to be able to detect if there is a device mounted to /mnt/backup before the script is allowed to run. My first thought is to put a file named e.g. 'NO_DRIVE_MOUNTED' in the (unmounted) /mnt/backup directory, and then make sure that that does _not_ exist before running the backup routine, but that just feels hackish. (Likewise, the inverse of putting a file named e.g. 'BACKUP_DEVICE_READY' in each external hard drive and checking that that file _does_ exist feels just as hackish.) Is there a better way to detect whether or not a device is mounted to a given directory? I'd rather avoid checking for the device itself, as my experience is that plugging in a drive in Linux just assigns it to the next available /dev/sdX, so while the backup drive might be /dev/sdf one day, if I have a different drive plugged in when connecting the backup drive the next time it would be /dev/sdg, which means testing for /dev/sdf would fail! I'd also prefer to avoid device-specific identification (e.g. by UUID) so that I can more easily and more transparently replace/upgrade the drives. This will be on Ubuntu 10.10 (or possibly 11.04 if I drag my feet long enough, as I'm in the process of rebuilding the whole server anyway), and ideally I'd like a simple one-line test that I can prefix to my backup command directly in my crontab (but I'm not afraid of Bash scripts, either, if that's what's necessary).


title: what is the difference between qsub and ./

text: Can anyone tell me the difference between the following ways of submitting a script:               $ qsub script_name.sh      and               ./script_name.sh      What are the differences between the above two ways of submitting a job to a cluster? Also how come sometimes I need to type:               $ chmod +x script_name.sh       ...before I can type `./script_name.sh` to submit a job? How come sometimes I just need to type `qsub script_name.sh`? Sorry I'm not very familiar with Unix.


title: Getting better resolution using X on OpenBSD w/VMWare Fusion

text: Just setup an OpenBSD 4.8 VM for VMWare Fusion. Can't seem to force X to any decent resolution. I attempted to try and use the VMWare tools for FreeBSD, but no dice. Any suggestions to try and get at least 1280x1024?


title: NIS+ Solaris 10, Master Server Setup

text: this is my first time with NIS+ Naming Service. I want to configure my host to be a master root server using this script > /usr/lib/nis/nisserver -r -d doc.com. And I got this error:               > ********        ********    WARNING    ********        ******** NIS+ might not be supported in a future release. Tools to aid the migration     > from NIS+ to LDAP are available in the Solaris 9 operating     > environment. For more information, visit     > http://www.sun.com/directory/nisplus/transition.html     > ********        ********    *******    ********        ********     >      > This script sets up this machine "master" as an NIS+ root master     > server for domain doc.com..     >      > Domain name             : doc.com. NIS+ group              :     > admin.doc.com. NIS (YP) compatibility  : OFF Security level          :     > 2=DES     >      > Is this information correct? (type 'y' to accept, 'n' to change) y     >      > This script will set up your machine as a root master server for     > domain doc.com. without NIS compatibility at security level 2.     >      > WARNING: this script removes directories and files related to NIS+     > under /var/nis directory with the exception of the client_info     > NIS_COLD_START file which will be renamed to <file>.no_nisplus.  If     > you want to save these files, you should abort from this script now to     > save these files first.     >      > WARNING: once this script is executed, you will not be able to restore     > the existing NIS+ server environment.  However, you can restore your     > NIS+ client environment using "nisclient -r" with the proper domain     > name and server information.     >      > Do you want to continue? (type 'y' to continue, 'n' to exit this     > script) y     >      > setting up domain information "doc.com." ...     >      > setting up switch information ... switch configuration file already     > set to use NIS+.     >      > killing NIS and NIS+ processes ... stopping nscd ...     >      > setup NIS_GROUP environment variable ...     >      > rm /var/nis files ...     >      > running nisinit ... This machine is in the "doc.com." NIS+ domain.     > Setting up root server ... All done.     >      > starting root server at security level 0 to create credentials...     >      > running nissetup to create standard directories and tables ...     > doc.com.: NIS+ servers unreachable. couldn't create org_dir.doc.com.     > **ERROR: it failed to create the tables.      I looked for this error, and didn't find any solution.


title: Disabling (or removing) X from CrunchBang home server

text: I've just installed crunchbang linux (based on Debian) on some really old hardware (we're talking single cores and DDR memory here) for a simple home server. However, seeing as the hardware sucks (or for some other reason) X cannot start gdm. This really doesn't bother me because the server won't have a display, I will be ssh'ing in via my workstation. However it's a problem because when I reboot the machine it gets stuck on an X error message (something like "Cannot start X blah blah") and needs direct input to continue. Is there a way I can disable (or even remove) X and the X server from my machine so that I only ever boot into a command line? Is it safe?


title: Using SAR to monitor free disk space data

text: Is there a way to make `sar` (from `sysstat`) collect free disk space data?


title: How can I modify variables

text: I have the following variable:               col=1,3,4,      Is there anyway to select the numbers within the variable: (i.e. 1 3 4 and work with them? Such as choosing the "1", "3", or "4" column from a `.txt` file?


title: calling functions within a function

text: I need to fetch the results of different time ranges and email the results, but i am having trouble with the email part of the script, how can i send an email with both results? (15min range and cumulative results) here's the line :                echo -e "Enter Start hour : xx:00:00"#ask user to input base time         read tI              echo "Select minute range, Enter 1 to 4"#ask user to select minute range         echo -e "\t1) XX:15:00 \n\t2) XX:15-30 | XX:30  \n\t3) XX:30-45 | xx:45 \n\t4) XX:45-00 | 1hour"         read NUM                if [ "$NUM" == "1" ] ; then             for Time in "$tI:(0[0-9]|1[0-4]:[0-5][0-9]|$tI:15" ; do #time grep c/o of Caleb, thanks!             mail             done                elif [ "$NUM" -eq "2" ] ; then             for Time in "$tI:(1[5-9]|2[0-9]:[0-5][0-9]|$tI:30)" "$tI:([0-2][0-9]:[0-5][0-9]|$tI:30)" ; do # 2nd time was commulative              mail             done                elif [ $NUM -eq 3 ] ; then             for Time in "$tI:(3[0-9]|4[0-4]:[0-5][0-9]|$tI:45)" "$tI:([0-3][0-9]||4[0-4]:[0-5][0-9]|$tI:45)" ; do             mail             done                elif [ $NUM -eq 4 ] ; then              tI=${tI#${tI%%[!0]*}}              newTime=$((tI + 1))              sTime=`printf '%02d\n' "$tI"`              fTime=`printf '%02d\n' "$newTime"` # thanks to Gilles and Mark and geekosaur              for Time in "$sTime:(4[5-9]|5[0-9]:[0-5][0-9]|$fTime:00)" "$sTime:([0-5][0-9]|[0-5][0-9]|$fTime:00)" ; do              mail             done      else        exit 1       fi          exit 1              function Count()         {         textfile="/some/path/to/text.txt"         time="$1"         C=0         echo " " > $textfile         for ((d=0; d<12; d++))          do          dec110=`egrep "$GivenDate $time" * | grep -c "$var ..  ${DECLINE[$d]}" | awk '{SUM += $1} END { print SUM }'`          COUNT[$C]="$SUMdec"               ((C++))         .... so on and so fort         echo -e "tons of to be echoed above /n end of the results to be emailed" >> $emessage         }      **NOW HERE'S MY PROBLEM:** ive tried several atempts but non of them seems to be working as they should.               function mail()     {        echo "declarations above of this | start of message" > $emessage        for ((t=0; t<2; t++)) do        Count "$Time"        done          /bin/mail -s "$SUBJECT" "$EMAIL" < $emessage       echo -e "Email Sent!\n\n"       cat $emessage     }      -- this will send out 1 email but only shows the result of the first grep,               function mail()     {        echo "Hi Team," > $emessage        Count "$Time"          /bin/mail -s "$SUBJECT" "$EMAIL" < $emessage       echo -e "Email Sent! \n\n"       cat $emessage     }      -- would send out 2 separate email if i choose option 2-4. **Note :** _without the email part this script is working fine._


title: Why can I append to a file but not overwrite it?

text: If I do this:               iptables -nvL > output.txt      `output.txt` ends up empty. If I do:               iptables -nvL >> output.txt      It works fine. Appending is working, but overwriting is not. Why?


title: Entered wrong installation path in Ubuntu

text: I was trying to install Huwaie 3G modem on Ubuntu. The install.txt said: >   1. Run `./install` in TERMINAL to install MobilePartner eg: # bash > //install > >   2. If you had installed this software in your system before, you will get > a prompt: "The software is exist, do you want overwrites? ([Y]/[N])", enter > "y" to overwrites or "n" to exit. > >   3. If you do not had installed this software in your system before, you > will get a prompt: "Please input the install > path[/usr/local/Mobile_Partner]:". Then you can input install > path(fullpath), or you may using the default path(/usr/local/Mobile_Partner) > by press ENTER direct > >   4. Finish installing > > > > --How to run-------------------------- > >   * From shortcut in desktop >   * Run MobilePartner in your install path eg: # `/<install > path>/MobilePartner` > But accidentally I gave it   1. Run `./install` in TERMINAL to install MobilePartner eg: # bash //install   2. If you had installed this software in your system before, you will get a prompt: "The software is exist, do you want overwrites? ([Y]/[N])", enter "y" to overwrites or "n" to exit.   3. If you do not had installed this software in your system before, you will get a prompt: "Please input the install path[/usr/local/Mobile_Partner]:". Then you can input install path(fullpath), or you may using the default path(/usr/local/Mobile_Partner) by press ENTER direct The path `/usr.local.bsnl3g`. Now the software is not getting installed. I was trying to make fresh install (by `./install`) but it prompted me to rewrite in the same {wrong} path where I have installed already. How to proceed to make it work.


title: Why is Wingpanel-Slim not working in Elementary Luna after installing and activating it?

text: ~via a question that says: _I am using wingpanel-slim, but it reverts back to wingpanel after each logout, even though wingpanel-slim is still shown as activated in Tweaks. Any ideas how I can stop this happening?_


title: copy consumed output to stdout when stdout is redirected to a file

text: Given a command the output of which is being processed by, for example, grep I also want the actual output to be included in the log file for debugging purposes. For example if I have the following               useful=$(curl -s http://example.com/some/data | grep 'useful line')     echo "useful=$useful"      I want to see               This page has a number of lines in it, but'     useful lines are the only ones I care about     except when something goes wrong and then     I'd really like to see what the heck was in     the output that grep consumed.     useful=useful lines are the only ones I care about      This _can_ be done with tee like so               useful=$(curl -s http://example.com/some/data | tee /proc/$$/fd/1 | grep 'useful line')     echo "useful=$useful"      _but_ if stdout is being redirected to a file `tee` clobbers the rest of your log file. `tee -a` fails in largely the same way.


title: Firmware for wireless card on Ubuntu/Debian?

text: This is a follow up to my previous question about Debian support for Linksys Wusb600n. I have tried running the Ubunut/Xubuntu LiveCDs and the WiFi does not come up. The Gnome Network Manager menu informs me that my wireless network "device is not ready (firmware missing)" as shown here: ![Network connections on Xubuntu](http://i.imgur.com/JFpm0.jpg) Where can I find Ubuntu packages with the firmware and drivers needed to support the Linksys Wusb600n USB WiFi stick?


title: How to use OSLEC with Alsa as default, not with Pulseaudio or other thirdparty package involved?

text: Oslec Echo canceller I have seen some packages used OSLEC and there echo cancle was very well. So for a test simulation, how could i install the OSLEC only with Alsa (i do not use PulseAudio at all, cause it has many broken packages cause unstable). How can you install OSLEC and Alsa configuration on Ubuntu 12.04 64/bit kernel 3.x


title: Avoid infinite loops in file operations

text: In many programs, such as in this example filezilla, when I go to use certain directories they get stuck in an infinite loop. So I might be uploading a folder to an FTP server, but this folder links back to itself in some way, so the program gets stuck in: folder1 > someotherfolder > aliasforfolder1 > folder1 > someotherfolder... How can I avoid this without manually copying all of the different possibilities besides that redirect? Note: The only similar question I found was Infinitely Nested Directories, however that was solved by a command option where this cannot be (that I know of).


title: netcat to capture ethernet

text: How can I make sure the result of the following command:               nc eth0 &> capture.txt      would capture the data + errors transmitted via eth0?


title: How does mdraid resync work?

text: I have two drives in a mirror (linux sw raid/mdadm); one drive somehow left the mirror in the past and its content is now several days old. At this moment, I'm using degraded mirror (with one drive missing) and considering:   * clone uptodate drive to the second one with `dd`   * add second drive and resync, but I don't know how resync process works and which data will be overwritten (there are LVM volumes on that mirror) I think `dd` is safe way, anyway I'm interested in how resychronization works.


title: Solaris 10, pkgtrans command

text: What is the difference between these two commands? `1\. pkgtrans /cdrom/cdrom0/Solaris_10/Product /var/spool/pkg/stream.pkg all` `2\. pkgtrans -s /cdrom/cdrom0/Solaris_10/Product /var/spool/pkg/stream.pkg all` The two commands make the same action. **The second question is:** If I have file stream format package in `/export/home/memam/` which called `SUNWipc.pkg` and I want to translate it to file system format, does this command `pkgtrans /export/home/memam/SUNWipc.pkg /var/spool/pkg` translate make this operation


title: Single-user binary installation location?

text: I'd like to install a binary for only my user, because I don't have root, and therefore don't have access to `/usr/bin`. I've tried `~/bin`, and it can't find the binary. I'm on Mac OS 10.6.7. Is there any other binary folder that can usually be user-modified, or any way to get it to recognize `~/bin`? My `.profile`:               # Setting PATH for Python 2.7     # The orginal version is saved in .profile.pysave     PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"     export PATH


title: Command/scripts to check the Reverse DNS Lookup time

text: I am working on a project in which one master communicates with numbers of slaves. For that it has to make connection with hosts in network. But sometimes it hangs. I think that the reason behind is extra time consumption during **Reverse DNS Lookup**. So please tell me any command or script which checks or makes the list for the **Reverse DNS Lookup** time. **EDIT no. 1** Tell also that where can I add that command in rsh source code so that I got a list of time consumed by every request, whenever it connects to other hosts. So that I can find the reason behind the hanging of server.


title: Installing a D-LINK dwa-131 wireless adaptor on Linux

text: I am new to Linux and a complete novice, I have just installed Linux Ubuntu on a desktop, I want to use a wireless adapter for my internet connection. The model is a D-Link DWA-131 Nano wireless adapter. It came with a CD but this will only run on Windows. If someone could help me out it would much appreciated.


title: Change icons of application in Linux Mint

text: I installed a new icon set (numix), however not all icons were changed (e.g. the software manager). How can I manually change icons? ![screenshot](http://i.stack.imgur.com/lE43i.png)


title: Can not mount NFS from server on local network

text: I set up my NFS server without doing any bigger changes in configuration files. After that I added these entries to `/etc/exports`(both paths are valid) on server(192.168.1.11):               /export         192.168.1.0/192.168.255.255(rw,fsid=0,insecure,no_subtree_check,async)     /export/users   192.168.1.0/192.168.255.255(rw,nohide,insecure,no_subtree_check,async)      Then I restarted the computer and I tried to get exports list:               $ showmount -e 192.168.1.11     /export        192.168.1.0/192.168.255.255     /export/users  192.168.1.0/192.168.255.255      According to this output there's not problem with connection. Now I want to mount `/export` to client filesystem(192.168.1.12):               sudo mount -t nfs4 192.168.1.11:/export /mnt      After typing this there's no output and I can't do anything. Another terminal line start is not being displayed. Command is stuck. Does anybody know am I doing wrong? Please help me.


title: How to create cross-platform keyboard bind commands?

text: I'd like to have the same keyboard shortcuts in all the terminals I use. Since they don't have the same *nix on them, and since terminals can be very different, I'm looking for a reasonably portable way to get keyboard shortcuts from one *nix terminal (at least supported by a standard Ubuntu 12.04 installation) to other terminals (Bash only). That is, I'm trying to _generate commands in one terminal to execute on another terminal_ , in order to use _the same keyboard shortcuts in the second terminal_. Especially things like `Alt`-`Del` (delete the word to the right of the cursor) and `Ctrl`-`Left` (move the cursor one word to the left), which on some hosts I work on simply prints the escape code instead of performing the expected actions. This is also meant as a precursor to possibly changing the `.inputrc` on the target host. The important points are to be able to   1. Figure out which keyboard shortcuts are defined on my local host.   2. Figure out whether any commonly used shortcuts are not defined from the remote host.   3. Copy the shortcut definitions to the remote host.   4. Verify that the shortcuts work as expected on the remote host.   5. **Be reasonably sure that the shortcuts would also work on a third host** , possibly with very old versions of Bash and standard tools like `grep` and `sed`.


title: Permanently change per-process stack size

text: When I use `ulimit -s` to change the per-process stack size, it only lasts for that login; if I restart the setting is lost. How can I permanently change the maximum stack size on my system?


title: Is mkdir atomic over sshfs?

text: I am using `mkdir` as a locking mechanism, and to my knowledge `mkdir` is atomic, but it is not atomic over `nfs`. So my question is simple, is `mkdir` atomic over `sshfs`?


title: Clear Xfce4 session

text: How to reset Xfce session? When I start Xfce4, it always opens 2 windows of Evince, Emacs and one terminal emulator. I remember I used this configuration once a week ago, but now it starts every time after logging in. How can I make Xfce4 start cleanly with no applications?


title: Log off user using terminal

text: I am having a situation where I logged in to a RHEL 5.6 system and started VirtualBox. After closing the VirtualBox, I am having a situation where the menu bar which has the option to _shutdown_ or _lock screen_ or _log off_ the system is not present. I believe the reason might be due to network load or something. I can _shutdown_ or _restart_ from the terminal, but again they take considerable amount of time. All I need is to just **Log off** from the system when the menu bar is not present. I need to get the **login** screen like how we have, when we initially boot the system. Is there any option to just **Log off** the user using the terminal? **EDIT:** ps -ax | grep dm output               Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ      2352 ?        S<     0:00 [rdma_cm]      2908 ?        Ss     0:00 rpc.idmapd      3287 ?        Ss     0:00 sendmail: accepting connections      3297 ?        Ss     0:00 sendmail: Queue runner@01:00:00 for /var/spool/clientmqueue      3504 ?        Ss     0:00 /usr/sbin/gdm-binary -nodaemon      3547 ?        S      0:01 /usr/sbin/gdm-binary -nodaemon      3549 ?        S      0:00 /usr/libexec/gdm-rh-security-token-helper      5080 tty7     Ss+    7:20 /usr/bin/Xorg :0 -br -audit 0 -auth /var/gdm/:0.Xauth -nolisten tcp vt7     18166 pts/1    S+     0:00 grep dm


title: How can I get sublime text to run from the command line?

text: I am trying to get sublime text to run from the command line using this tutorial. It says to run this command:               ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl      But when I try to run that command I get an error "no such file or directory." Sublime text 2 is in my applications folder -- but it looks like there is no bin folder in my home directory. Do I need to create one? Is this something that should be there? Am I doing something wrong?


title: Linux Distro specifically for benchmarking?

text: At my current position, we use some outdated proprietary software in order to benchmark new computers that the company is testing and evaluating for purchase. We would like to move on to something more current. It would seem to me that using a GNU/Linux distro with a completely automated installation process would be ideal for this task. Basically, what I want to have is a minimalist GNU/Linux distribution that will allow me to simply input a network location to store the benchmarking results, and will install the OS and run a suite of benchmarking software completely automated. This seems like a problem that others have likely come across, but I have been unable to find anything similar that fits my needs. Any suggestions on where to start with this? Does a distro like this exist out there somewhere? If not, I currently plan on just writing a script that will install a list of benchmarking software onto the machine and run them. Any suggestions on specific software choices for this?


title: Linux Mint Search launcher doesn't do anything

text: In Mint 17, using Cinnamon, if I go to `System Settings > Keyboard > Keyboard shortcuts > Launchers` there is an option to set a shortcut for something called `Search`. However, whatever key binding I set this to, it doesn't seem to do anything. What is this supposed to do, and how do I make it do it?


title: VNC - Arch - Gnome; I can't type in the password on the login screen because it is cleared every second

text: I have an Arch linux box that is almost running perfectly but when i connect to the vncserver and the sreensaver turns the screen black, i am forced to reenter the password on the loginscreen of gnome but! and here is the problem, this screen is constantly refreshed so i can't type more than two letters. I keep every package updated with pacman -Syu. I use tigervnc in version 1.3.1.1. The connection is running over SSH. Gdm in version 3.12.0-1. Can anyone help here? ~/.vnc/xstartup:               #!/bin/sh     export XKL_XMODMAP_DISABLE=1     exec gnome-session


title: How to display duplicates between 2 repositories

text: I got 2 repos locally. One is a copy of Squeeze and another is a custom one, and is managed by reprepro. Are there ready-made tools that would generate a list of duplicate packages between the two?


title: Delete key doesn't work properly in PHP interactive shell

text: In the interactive shell oh PHP `Delete` key is not working and produce `~` instead. Anyone know how to get this key to work? I am using Ubuntu 13.04 if this does matter.


title: How to set up an SSD as a cache for the big Hard Drive?

text: I want to order https://www.fdcservers.net/order-1-w.php?plan_id=538 According to http://arstechnica.com/information- technology/2013/04/linux-3-9-brings-ssd-caching-and-drivers-to-support-modern- pcs/ linux have built in capability to allow using SSD to cache hard drive. How to do so? Where is the tutorial? This feature is already in the standard kernel right? WOuld it work on centosh? Can I just upgrade existing kernel?


title: How to give permission of a folder to a specific user in LINUX/UNIX?

text: How can I give permission to a specific user for a particular folder? I don't want to give permission to the entire group but only to a particular user in the group. I don't have root permissions.