Why are filenames that start with a dot hidden? Can I hide files without using a dot as their first character?

Initially I thought it was a coincidence, but now I see there's even a tag for it: all hidden file names start with a dot. Is this a convention? Why was it chosen? Can it be changed? Or in other words (as a related question @evilsoup suggested that implies the answer to a bunch of others): can I hide files without renaming them (using `.` as the first character of their name)?


Why don't I see a file being copied right away with ls?

Is it due to the buffering in memory? I did `cp /network/large_file . &` and I kept doing `ls -lh` to monitor progress, but the file didn't appear until it was about 400MB. Linux 2.6 kernel, Bash 4, 4GB swap, 16GB RAM.


RasPi - USB microphone locks up

On my RasPi board, Debian Linux, the USB microphone occasionally gets locked up such that nothing can use it. The microphone has a LED which is usually flashing, when it's locked, it turns off. The utility `arecord` describes it as follows:               card 1: Device [DYNEX USB MIC Device], device 0:USB Audio [USB Audio]         Subdevices: 1/1         Subdevice #0: subdevice #0      When the microphone stops working, `arecord` gives diagnostics like this:               > arecord -D plughw:1,0 > recording.wav     Recording WAVE 'stdin' : Unsigned 8 bit, Rate 8000 Hz, Mono     arecord: set_params:1145: Unable to install hw_params:     ACCESS:  RW_INTERLEAVED     FORMAT:  U8     etc...      Unplugging and plugging the microphone fixes it, only because the current dip forces the RasPi to reboot! Not an ideal situation. Is there a way to fix this from the command line or a C executable? I also tried using `ioctl(fd, USBDEVFS_RESET, 0)` using the output from `lsusb` to provide the bus and device number. That turns the LED back on, but it's overkill. The device has to be re-setup using alsamixer.


Upgrading Red Hat 9 (Shrike) kernel manually

I am following the instructions here on how to manually perform a kernel upgrade in Red Hat. The current Kernel RPM's are:               kernel-2.4.20-8     kernel-headers is not installed     kernel-ibcs is not installed     kernel-pcmcia-cs-3.1.31-13     kernel-source is not installed          mkinitrd-3.4.42-1     SysVinit-2.84-13     initscripts-7.14-1      Under the "Getting the updates" section, all the links are dead, and there doesn't seem to be a `ftp://updates.redhat.com/9.0/en/os/i386/` Does anybody know where the packages can be downloaded from? **Edit** Realising now that RH9 support was dropped a few hundred years ago along with the legacy project, found a working mirror here http://ftp-stud.fht- esslingen.de/


Can't do SSH public key login under encrypted home

I can't do ssh public key login to my server and I think this issue is related to the fact my home is encrypted. I chose the option "encrypt my home folder" under the Ubuntu install setup. The permissions on `/home/MY-USER` are 700. I've tried another workstation and everything works fine. I would be glad if someone help me to get out this without removing the encryption.


TeXstudio: open file at line number n

I am creating a script to produce some `.tex` files with a lot of lines (a kind of automatic sample). The script finishes with `texstudio /home/$USER/foo.tex` where `foo.tex` is the file created before. My question is: is it possible to open the file with `texstudio` with the cursor at line N, that is, I would like to run the script to open the file and start typing right now, exactly at the right line. Thanks for a while. Below is the script. * * *               file=/home/$USER/fastex-temp.tex     exec 3>&1 # save file descriptor to stdout     exec > "$file" # redirect output to file     printf '\\documentclass[11pt,a4paper]{amsart}\n'     printf '\\usepackage{amsfonts,amsthm,amsmath}\n'     printf '\\usepackage[latin1]{inputenc}\n'     printf '\\usepackage[T1]{fontenc}\n'     printf ' ' >&3 # output to normal stdout instead of file     printf '\\begin{document}\n'     printf ' ' >&3     printf '\\end{document}\n'     exec >&3  # restore stdout     exec 3>&- # close / discard temporary fd          texstudio "$file"


Setting up Apache 2 Local Development Environment & Permissions

I frequently find myself encountering problems (usually permissions) when trying to setup a local development server. Or creating a new site (alias). Very common problem is I need to allow `www-data` (apache use on ubuntu) access to all directories leading to the working directory. Another problem is since I am logged in as my personal user `jiewmeng`, when I create new files, they are owned by me, and sometimes, apache cant read/write to it How is your local development setup like? I am using Ubuntu 11.10 btw ...


SFTP: give user access to folder outside home

I have a machine running Ubuntu 12.04 LTS with OpenSSH server installed. I have created a user with a jailed home account. When I log in with the user's account, I can only access his home (duh). In addition to the user's home folder, I would like to give the him read access to a particular partition (`/Volumes/Storage`). How can I do this?


CUPS can't print to printer on network

I am having problems printing to the printer connected to my (SBS2003) business's network. I know the IP of the printer and I can ping it and even print files from it by going to 192.168.0.50 in firefox and uploading a file. If I do an `nmap` on the IP of the printer I get this:               jamesmaddison@development:~$ nmap 192.168.0.50          Starting Nmap 5.21 ( http://nmap.org ) at 2013-07-11 16:12 BST     Nmap scan report for 192.168.0.50     Host is up (0.46s latency).     Not shown: 991 closed ports     PORT      STATE SERVICE     21/tcp    open  ftp     23/tcp    open  telnet     80/tcp    open  http     443/tcp   open  https     515/tcp   open  printer     631/tcp   open  ipp     5900/tcp  open  vnc     9100/tcp  open  jetdirect     50001/tcp open  unknown          Nmap done: 1 IP address (1 host up) scanned in 4.55 seconds      I can't get my local cups server to print to it no matter what protocol I use. I am in the business workgroup and the printer even lists my computer in the workgroup. I have tried:               smb://MASTERMAGNETS/SBSSRV/Sharp%20MX-M314N/     smb://jamesmaddison:password@MASTERMAGNETS/SBSSRV/Sharp%20MX-M314N/     socket://192.168.0.50:9100     ipp://192.168.0.50/ipp?version=1.0     lpd://192.168.0.50/lp      and all of the "Discovered Printers" that CUPS lists. (They're dnssd protocols) The Printer is a Sharp MX-M314N. All Windows computers on the network can print to it fine, just my ubuntu machine that won't. Here's what the CUPS error log says for the last job I tried. http://pastebin.com/YL7p1Zsp And I often get a notification saying "Printer Error: printer error Printer Name: `connecting-to-device`" Here's what `nmap` reports when I run it on the SBS               jamesmaddison@development:~$ nmap mastermagnets          Starting Nmap 5.21 ( http://nmap.org ) at 2013-07-11 16:35 BST     Nmap scan report for mastermagnets (192.168.0.2)     Host is up (0.00055s latency).     rDNS record for 192.168.0.2: mastermagnets.local     Not shown: 957 closed ports     PORT      STATE SERVICE     25/tcp    open  smtp     42/tcp    open  nameserver     53/tcp    open  domain     80/tcp    open  http     88/tcp    open  kerberos-sec     135/tcp   open  msrpc     139/tcp   open  netbios-ssn     389/tcp   open  ldap     443/tcp   open  https     444/tcp   open  snpp     445/tcp   open  microsoft-ds     464/tcp   open  kpasswd5     593/tcp   open  http-rpc-epmap     636/tcp   open  ldapssl     691/tcp   open  resvc     1025/tcp  open  NFS-or-IIS     1027/tcp  open  IIS     1042/tcp  open  unknown     1045/tcp  open  unknown     1046/tcp  open  unknown     1048/tcp  open  unknown     1049/tcp  open  unknown     1054/tcp  open  unknown     1081/tcp  open  unknown     1087/tcp  open  unknown     1094/tcp  open  unknown     1104/tcp  open  unknown     2301/tcp  open  compaqdiag     2381/tcp  open  unknown     3268/tcp  open  globalcatLDAP     3269/tcp  open  globalcatLDAPssl     3389/tcp  open  ms-term-serv     5633/tcp  open  unknown     6001/tcp  open  X11:1     6002/tcp  open  X11:2     6004/tcp  open  X11:4     6101/tcp  open  backupexec     6106/tcp  open  isdninfo     8080/tcp  open  http-proxy     8081/tcp  open  blackice-icecap     8082/tcp  open  blackice-alerts     8443/tcp  open  https-alt     10000/tcp open  snet-sensor-mgmt          Nmap done: 1 IP address (1 host up) scanned in 1.18 seconds[/CODE]      I just can't get it to work, the problem seems to be between Cups and the windows server as if I go to 192.168.0.50:9100 in firefox the printer prints the GET header it receives. I can also go to 192.168.0.50 and upload a file directly to the printer. Lastly I can ftp into the printer and upload files that way. Here's what smbclient gives me:               ~$ smbclient -U MASTERMAGNETS/JamesMaddison -L //SBSSRV               Sharename       Type      Comment     ---------       ----      -------     Line100         Disk           print$          Disk      Printer Drivers     C$              Disk      Default share     S$              Disk      Default share     Technical       Disk           IRS             Disk           Designjet 500-24 Printer   HP Designjet 500 24 by HP     Accounts        Disk           RICOH           Printer   RICOH Aficio 1027     clients         Disk      Windows Small Business Server Client Setup     tsclient        Disk           IPC$            IPC       Remote IPC     Resources$      Disk      "Event logging files"     FxsSrvCp$       Disk      Common Fax Cover Pages Folder     tsweb           Disk           SHARP MX-M314N  Printer   192.168.0.50     ADMIN$          Disk      Remote Admin     faxclient       Disk      Microsoft Shared Fax Clients     ClientApps      Disk      Windows Small Business Server Client Applications     DLOAgent        Disk      Symantec DLO Share     Magnets-database files Disk           Magnet-database files Disk           D$              Disk      Default share     Users           Disk      Users Shared Folders     Public          Disk           actsql          Disk           SYSVOL          Disk      Logon server share     Address         Disk      "Access to address objects"     Confidential    Disk           NETLOGON        Disk      Logon server share     SBSSRV.LOG      Disk      Exchange message tracking logs          Server               Comment     ---------            -------     ANDY                     DESIGN1                   DESIGN2                   DESIGN3                   DEVELOPMENT          development server (Samba, Linux)     FRANK                     JOE                       JONATHAN                 KIM                  Kim     ORDERPRINT           Purchase Order Printer     PHIL                     SBSSRV                   TERMSRV                        Workgroup            Master     ---------            -------     MASTERMAGNETS        SBSSRV


Samba Shared Folder

I want to share a folder on my RHEL to all windows users. My requirements are:   1. users need to access from windows   2. users need read only access   3. no authentication required What I have tried:   1. Samba Server is up and running   2. Webmin module installed to use SambaUI   3. Webmin > Servers > Samba Windows File Sharing    4. Created a new file share with path as /home/guest/testfolder   5. Used myshare as share name   6. In security:     * -Writable :no     * -Guest access: Guest Only     * -Guest unix user: nobody     * -Hosts to allow: all     * -Hosts to deny: none I am able to see the folder testfolder but I am not able to browse its contents


How to limit P2P/torrent traffic on an OpenWrt 10.03 router?

We have a WRT160NL router with OpenWRT 10.03, and a 60-70 Mbit connection (from ISP, don't ask why). This router can do 30-35 Mbit on ethernet(i mean cable)..ok! There are ~7 PC's using this Wireless router, 6 through wifi (wep, because of the speed.. :\ ), 1 with cable. Question: How can we limit P2P/torrent traffic, to have very-very-very-very low priority? I mean if someone downloads from torrent, the speed is getting about e.g.: ~0,5 Mbit/sec etc. Without recompliing (i only want to use "stock" packages) are there any chances that i can do this? how? max connection limiting? how? topology: ISP -> WRT160NL -> 7 clients (NAT, 192.168.1.0/24).. I don't want to completely "disable" P2P/torrent traffic, I just want to slow them down, so the network would be usable even if several people use it, and e.g.: one of them is downloading st. over torrent. But if only e.g.: 1 person is using the network, then allow him to use all the bandwidth without limiting P2P.


Logwatch ignores self-defined service, but explicit setting --service $service works

I am using SSLH on my server to accept both SSL and SSH connections on Port 443. As the logs of sshd and apache2 show each incoming connection via SSLH originating from 127.0.0.1, I want to add the log of SSLH to Logwatch. To achieve this, I first filtered all entries regarding sslh into a seperate logfile with the following code in `/etc/rsyslog.d/sslh.conf`:               if $programname == 'sslh' then /var/log/sslh.log     if $programname == 'sslh' then ~      In the file `/etc/logwatch/conf/logfiles/sslh.conf` I added this to tell Logwatch about the logfile:               LogFile = /var/log/sslh.log     LogFile = /var/log/sslh.log.0     Archive = /var/log/sslh.log.*.gz          *ApplyStdDate =      The service definition in `/etc/logwatch/conf/services/sslh.conf` looks like this:               Title = "SSLH SSH / HTTPS Multiplexer"     LogFile = sslh      At last, I added the service script `/etc/logwatch/scripts/services/sslh` with this content:               #!/bin/bash          echo "Date Range: $LOGWATCH_DATE_RANGE"     echo "Detail Level: $LOGWATCH_DETAIL_LEVEL"     echo "Temp Dir: $LOGWATCH_TEMP_DIR"     echo "Debug Level: $LOGWATCH_DEBUG"          grep -v 'forwarded to SSL$'      When I run Logwatch with the service sslh explicitly specified, everything works like a charm and I get the filtered output for the desired timespan:               logwatch --service sslh --output stdout          ################### Logwatch 7.4.0 (05/02/12) ####################            Processing Initiated: Fri Jul 12 11:37:46 2013            […]     ##################################################################          --------------------- SSLH SSH / HTTPS Multiplexer Begin ------------------------          Jul 11 22:51:13 example sslh[2225]: connection from […].adsl.alicedsl.de:3643 to […].yourvserver.net:https forwarded from localhost:59788 to localhost:https     Jul 11 22:51:13 example sslh[2225]: connection from […].adsl.alicedsl.de:3644 to […].yourvserver.net:https forwarded from localhost:59789 to localhost:https     […]          ---------------------- SSLH SSH / HTTPS Multiplexer End -------------------------               ###################### Logwatch End #########################      The problem occurs in regular operation, when calling Logwatch like this:               logwatch --mailto webmaster@example.com      I redirected the output of Logwatch into a file and found some strange lines like this one for example, where sslh is listed as disabled:               Service List:     [0] = all     [1] = -zz-network     [2] = -zz-sys     [3] = -eximstats     [4] = -sslh      Grepping for `sslh` in the Logwatch output produced this:               root:~# grep -r -i -n sslh ~/logwatch_out          38:[4] = -sslh     75:[4] = -sslh     4747:ReadConfigFile: Opening /etc/logwatch/conf/services/sslh.conf     4748:ReadConfigFile: Read Line: Title = "SSLH SSH / HTTPS Multiplexer"     4749:ReadConfigFile: Name=Title, Value="SSLH SSH / HTTPS Multiplexer"     4750:ReadConfigFile: Read Line: LogFile = sslhReadConfigFile: Name=LogFile, Value=sslh     6431:ReadConfigFile: Opening /etc/logwatch/conf/logfiles/sslh.conf     6432:ReadConfigFile: Read Line: LogFile = /var/log/sslh.log     6433:ReadConfigFile: Name=LogFile, Value=/var/log/sslh.log     6434:ReadConfigFile: Read Line: LogFile = /var/log/sslh.log.0     6435:ReadConfigFile: Name=LogFile, Value=/var/log/sslh.log.0     6436:ReadConfigFile: Read Line: Archive = /var/log/sslh.log.*.gz     6437:ReadConfigFile: Name=Archive, Value=/var/log/sslh.log.*.gz     6527:[85] = sslh     6594:[47] = sslh     6867:Service Name: sslh     6868:   Logfile = sslh     7181:Logfile Name: sslh     7183:   Logfile = /var/log/sslh.log      After figuring out that my configuration for Logwatch regarding sslh works, when I specify the service sslh explicitly, I have absolutely no idea, why sslh is excluded when running Logwatch regulary. Even the category "SSLH" is not included in the E-Mail, with or without any content. Any help would be appreciated.


How to make nemo support compressing files by context menu?

I use Cinnamon on ArchLinux and Nemo is it's default file manager. I've tried 3 GUI file archivers (`p7zip` with WxGTK, `peazip` & `file-roller`), but none of them add a "compress option" in the context menu. How can I add a "compress option" to Nemo's right click context menu?


Privoxy redirect blacklist sites to whitelist site

For my application, I need a WiFi hotspot that has the entire internet blocked except for one website. I am thinking about using a Raspberry Pi configured as a WiFi hotspot and using Privoxy. Privoxy has the capability to whitelist and blacklist sites (in my case there would be just one whitelisted site, with everything else blocked). http://raspberrypi.stackexchange.com/questions/16957/whitelist-internet-filter What I now need is for any blocked site to be redirected to the the whitelisted site. An additional bonus is for the white listed site to appear immediately once users have connected to the WiFi, just like the captive portal on a WiFi hotspot. Does anyone know how to do this?


Wireless connection connecting and disconnecting all the time

I am running Ubuntu 11.04 on my laptop and I use a 3G USB modem for my Internet connection. I wanted to share this Internet connection with my girlfriend's laptop that is running Window XP. Basically, I created the the wireless connection on my laptop and now it just connects and disconnects all the time. Why is it doing this? I am connected to the Internet via the 3G USB modem while I am also trying to connect the wireless set up, could that be the reason? Is there anything I should do on the Windows computer during the wireless set up?


Connecting to Github from server

I am trying to connect to Github from a server running Jenkins. To do this, I'm copying my public key from another server, into the authorized_keys on the new server. All I'm getting is the following error:               git ls-remote -h git@github.com:Company/client.git HEAD     Warning: Permanently added the RSA host key for IP address 'xxx.xxx.xxx.xxx' to the list of known hosts.     Permission denied (publickey).     fatal: The remote end hung up unexpectedly      All I did was this:   1. Go into the .ssh directory on the user account I want, on the old server   2. Copy the public key, in id_rsa.pub.   3. Log into the new server, go into /root/.ssh, and put that key into "authorized_keys"   4. Attempt the above command. What am I doing wrong? My suspicion is that I'm not copying the key to the correct location, and that in actuality I want to have the entire id_rsa.pub as well as the private key up there, and I'm actually trying to copy a user setting - but I'm not quite sure. How do I access github from this new server?


Installing vim/emacs on solaris 8

At my new job, they want me to use a solaris 8 operating system, but all my coding experience has been on linux. Linux had a lot of tools built into the system, but it seems like the solaris I'm using is extremely stripped down. I was wondering if someone can tell me how to install vim or emacs (preferably emacs) on solaris 8. I tried google but I couldn't find any download links for solaris 8. I tried using vi, but it's a little annoying to use after using vim and emacs (I can't even get the editor to backspace correctly!). Also, there is no syntax highlighting in vi which is a little annoying. Can anyone here help me install a more modern text editor? (And also help me become a little more proficient in solaris 8 :) ). Thank you.


How to see package version without install?

I want to see the version of a package before I install it. How can I do this?


Chkconfig on Linux Mint 12 giving tons of errors

I'm trying to disable some services from starting at boot time on my Linux Mint 12 laptop. So I installed `chkconfig`, which has worked great for me before on Fedora. However, on Linux Mint 12, it gives me tons of errors. Here is an example, trying to disable the `rsync` service:               $ sudo chkconfig rsync off     insserv: warning: script 'K01acpi-support' missing LSB tags and overrides     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'cryptdisks-udev' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `cryptdisks-udev'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `cryptdisks-udev'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'acpid' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `acpid'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `acpid'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'plymouth-upstart-bridge' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `plymouth-upstart-bridge'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `plymouth-upstart-bridge'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'rsyslog' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `rsyslog'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `rsyslog'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'friendly-recovery' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `friendly-recovery'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `friendly-recovery'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'udevtrigger' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `udevtrigger'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `udevtrigger'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'udev-finish' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `udev-finish'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `udev-finish'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'plymouth-stop' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `plymouth-stop'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `plymouth-stop'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'apport' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `apport'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `apport'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'dbus' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `dbus'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `dbus'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'cryptdisks-enable' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `cryptdisks-enable'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `cryptdisks-enable'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'hwclock' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `hwclock'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `hwclock'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'lightdm' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `lightdm'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `lightdm'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'udevmonitor' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `udevmonitor'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `udevmonitor'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'ufw' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `ufw'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `ufw'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'binfmt-support' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `binfmt-support'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `binfmt-support'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'udev' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `udev'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `udev'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'irqbalance' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `irqbalance'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `irqbalance'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'cron' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `cron'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `cron'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'nmbd' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `nmbd'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `nmbd'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'plymouth-splash' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `plymouth-splash'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `plymouth-splash'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'procps' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `procps'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `procps'     insserv: warning: script 'acpi-support' missing LSB tags and overrides     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'network-manager' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `network-manager'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `network-manager'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'smbd' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `smbd'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `smbd'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'dmesg' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `dmesg'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `dmesg'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'module-init-tools' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `module-init-tools'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `module-init-tools'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'network-interface' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `network-interface'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `network-interface'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'console-setup' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `console-setup'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `console-setup'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'anacron' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `anacron'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `anacron'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'modemmanager' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `modemmanager'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `modemmanager'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'udev-fallback-graphics' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `udev-fallback-graphics'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `udev-fallback-graphics'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'plymouth' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `plymouth'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `plymouth'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'network-interface-security' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `network-interface-security'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `network-interface-security'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'alsa-store' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `alsa-store'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `alsa-store'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'alsa-restore' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `alsa-restore'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `alsa-restore'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'avahi-daemon' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `avahi-daemon'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `avahi-daemon'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'plymouth-log' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `plymouth-log'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `plymouth-log'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'mysql' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `mysql'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `mysql'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'atd' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `atd'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `atd'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'hostname' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `hostname'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `hostname'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'cups' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `cups'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `cups'     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'hwclock-save' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `hwclock-save'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `hwclock-save'     insserv: script virtualbox: service vboxdrv already provided!     insserv: script virtualbox: service virtualbox already provided!     The script you are attempting to invoke has been converted to an Upstart     job, but lsb-header is not supported for Upstart jobs.     insserv: warning: script 'setvtrgb' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s) for script `setvtrgb'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `setvtrgb'      It seems to have worked when I run:               # chkconfig rsync       rsync  off      Is it bad to continue to use `chkconfig`? Can anyone suggest an alternate service-managing program, or a way to fix the errors when running `chkconfig`?


I am having some technical issue with awk code

This is related to one of my previous question: Comparing text files using Bash and AWK file1.txt               Name  Col1  Col2  Col3       -----------------------     row1  1     4     7             row2  2     5     8              row3  3     6     9       file2.txt               Name  Col1  Col2  Col3       -----------------------             row1  1     4     7     row2  2     5     999      I have somewhat figured out a way to compare two files. But for some reason it is not giving me the result that I want. Bare with me as I am a beginner. Here is the code I use to compare the files.               awk '     FNR < 2 { next }     FNR == NR {         for (i = 2; i <= NF; i++)          {             a[i,$1] = $i;          }             b[$1];         next;          }     ($1 in b) {        for (i = 2; i <= NF; i++)         {           if (a[i,$1] == $i)                printf("%s->Col%d: %d vs %d: Equal\n", $1, i-1, a[i,$1], $i);           else                printf("%s->Col%d: %d vs %d: Not Equal\n", $1, i-1, a[i,$1], $i);        }     } ' file1.txt file2.txt      Expected result:               row2->Col1: 1 vs 1: Equal     row2->Col2: 4 vs 4: Equal     row2->Col3: 7 vs 7: Equal     row1->Col1: 2 vs 2: Equal     row1->Col2: 5 vs 5: Equal     row1->Col3: 8 vs 999: Not Equal      Actual result:               row2->Col1: 1 vs 1: Equal     row2->Col2: 4 vs 4: Equal     row2->Col3: 0 vs 7: Not Equal     row1->Col1: 2 vs 2: Equal     row1->Col2: 5 vs 5: Equal     row1->Col3: 0 vs 999: Not Equal      I don't know why 0 is part of the output. Does anyone know why 0 is there? EDIT: Here is the problem. The first for loop only iterates once. Does anyone know why?


Fullscreen applications and dual monitor setup ( + cursor grab )

I have dual screen monitor setup. There are applications (like VLC), where everything works out of the box. If you fullscreen a video, you can use your other screen normally. This is the setup I would expect. Then there are mostly Linux games and ones you can run via Wine. If you run a fullscreen game, other screen just turns black, violet or flickers like crazy. Moreover, when you exit the game, the second screen is off, so I have to restart X. Does anyone know how I make this work better? Is this just a matter of those applications not using the appropriate library, or are there more fundamental issues with mutli-monitor support right now? Added later: Apparently there is no solution, Xorg is just fundamentally broken: http://www.maketecheasier.com/run-fullscreen-games-in-linux-with-dual- monitors/2010/03/01


What tool to execute a command on repeated syslog entries?

Occasionally, one VPS under my control gets bombarded with POP3 login attempts. They all fail, but the huge number of spawned processes and active connections pretty much amount to a DoS attack. When I see that going on, I usually go in and manually block the offending IP address in iptables. **What I would like** is to have a process running on the server monitoring the system log (or some other appropriate place) and, if there are repeat log entries matching a particular pattern, pass them to a command which would then extract the relevant part (the remote host IP address, in this case) and execute a command (to add a DROP rule to iptables). _For example_ , do so if log entries with the same message-part are logged five times within one minute. The VPS runs syslog-ng in case that helps. I have set up rate limiting in iptables which helps somewhat, but certainly isn't perfect as it blocks my own connection attempts just as much as those of an attacker (it becomes the luck of the draw who gets an established connection). Since the clients that are supposed to connect have IP addresses from dynamic blocks, it's difficult to just add an override rule without rate limiting. Since the VPS runs on Virtuozzo, while I do have root access to the guest, I cannot load custom kernel modules, or a custom kernel. So it has to be done in userspace. What software will help me?


What is the best way to implement hotkeys support in Linux?

What is the best way to implement hotkeys support in Linux (ie support for brightness, audio or keyboard backlight keys)? By "best way" I mean robust, without code duplication, with minimal work required to add support for new hardware.   1. Who should capture the hotkeys? Kernel module / daemon / X server / desktop environment / something else?   2. Who should do the actual work (e.g. setting brightness)?


How is my domainname determined?

If I look into `/etc/hostname/` I can see the hostname of my device. This is however not the name that shows up when I use nslookup on our network. How do I tell the DNS server which name it should use? To clarify I am on a small local network. Edit: I think I have to explain this a little further. I have a file `/etc/hostname` with only one line:               my_hostname      We have a LAN that has the name `our_network.local`. I was expecting if there isn't any kind of conflict, the nameserver would create the name `my_hostname.our_network.local`, but when I issue the command `nslookup` on my ip-address, the name is not found.


Vanishing permission on device file (RHEL 6.1)

I want to set world read/write permissions on a raw block device file (yeah, I know). I can set the permission to 666, but it goes back to 660 immediately after I touch it or write to it. Why?               [root@mysystem udev]# ll /dev/sdz6     brw-rw-rw-. 1 root disk 65, 150 Aug 30 12:09 /dev/sdz6     [root@mysystem udev]# touch /dev/sdz6     [root@mysystem udev]# ll /dev/sdz6     brw-rw----. 1 root disk 65, 150 Aug 30 13:58 /dev/sdz6     [root@mysystem udev]# chmod 666 /dev/sdz6     [root@mysystem udev]# ll /dev/sdz6     brw-rw-rw-. 1 root disk 65, 150 Aug 30 13:58 /dev/sdz6     [root@mysystem udev]#      I don't see anything in /var/log/messages, /var/log/dmesg or /var/log/secure. I turned off SELinux (`setenforce 0`). **edit** - here's the script I wrote to fix it:               [root@mysystem rules.d]# cat /etc/udev/rules.d/99-drives.rules     KERNEL=="sd*", SUBSYSTEM=="block", MODE="0666"          [root@mysystem rules.d]# udevadm info -q path -n /dev/sdz     /devices/pci0000:80/0000:80:03.0/0000:8b:00.0/0000:8c:01.0/0000:8e:00.0/host19/rport-19:0-2/target19:0:2/19:0:2:12/block/sdz          [root@mysystem rules.d]# udevadm test /devices/pci0000:80/0000:80:03.0/0000:8b:00.0/0000:8c:01.0/0000:8e:00.0/host19/rport-19:0-2/target19:0:2/19:0:2:12/block/sdz 2>&1 | grep '99-drives'     parse_file: reading '/etc/udev/rules.d/99-drives.rules' as rules file     udev_rules_apply_to_event: MODE 0666 /etc/udev/rules.d/99-drives.rules:1


Cron jobs and mail notification

I have (from one tutorial) cron job which make weekly backup on my website and is working fine.               #!/bin/bash     NOW=$(date +"%Y-%m-%d-%H%M")     FILE="mysite.com.$NOW.tar"     BACKUP_DIR="/home/user/backups/"     WWW_DIR="/home/user/public_html/"          DB_USER="my_site_db_username"     DB_PASS="password"     DB_NAME="mysite_dn_name"     DB_FILE="mysite.com.$NOW.sql"          WWW_TRANSFORM='s,^home/username/public_html,www,'     DB_TRANSFORM='s,^home/username/backups,database,'          tar -cvf $BACKUP_DIR/$FILE --transform $WWW_TRANSFORM $WWW_DIR     mysqldump -u$DB_USER -p$DB_PASS $DB_NAME > $BACKUP_DIR/$DB_FILE          tar --append --file=$BACKUP_DIR/$FILE --transform $DB_TRANSFORM $BACKUP_DIR/$DB_FILE     rm $BACKUP_DIR/$DB_FILE     gzip -9 $BACKUP_DIR/$FILE      Question is, can someone help me how can I made when backup is done to send me email? I'm using bash for first time and I'm not sure what I doing.


ZSH: Stripping path, filename and extension from a list of files for piping a command

The syntax for the command `convert` in ImageMagick is               convert source_filename.ext1  destination_filename.ext2      I would like to use zsh to feed it with files in a folder `path_to_source` and output the result (files with same name, but with a **different extension** ) under the folder `path_to_destination`. I believe I can use `find` and `xargs` for this, but I didn't come up with anything that worked. Also I presume that ZSH may have some builtins that are useful for this. Any pointers would be greatly appreciated. **NOTE:** As far as I know, `convert` does not have a native way of handling a batch of files, so I need to feed the files one by one. In either case, I'm interested in solving the problem of feeding a command file by file with these arguments.


Multiple 'Host *' in ssh_config?

My understanding of the way ~/.ssh/config works is that each 'Host ' line takes effect for any host matching after that point in the config file. I have a number of personal servers and work servers that I need to connect to. I'm trying to do something like the following:               # General Settings     ControlMaster auto     ControlPath   ~/.ssh/controlmaster/%r@%h:%p     ForwardAgent  yes     ForwardX11    yes     GSSAPIAuthentication no     PubkeyAuthentication yes          # Personal Servers     Host *     User harleypig     IdentityFile ~/.ssh/personal_id_rsa          Host host1     Hostname host1.com          Host host2     Hostname host2.com          # Work Servers     Host *     User alan.young     IdentityFile ~/.ssh/work_id_rsa          Host work1     Hostname work1.companyserver.com          Host work2     Hostname work2.companyserver.com          Host *     User devuser          Host dev1     Hostname dev1.companyserver.com          Host dev2     Hostname dev2.companyserver.com      The docs seem to indicate that host1 and host2 should use 'personal_id_rsa' and the user harleypig. work1, work2, dev1 and dev2 should use 'work_id_rsa' and the first two should be the user 'alan.young' and dev1 and dev2 should be the user 'devuser' However, this is not happening. Whatever 'Host *' I put first is what all of the following hosts try to connect with. Am I misunderstanding or missing something?


mixed raid types

I am about to reinitialise my (SW) raid array. Previously the array was raid5 with 4 disks. I've removed one disk in order to install a new additional (larger) drive. What I'd ideally like to do is mix types of raid across the 3 disks. Having 1 section of 3 way mirrored raid1, a section of raid5 and a section of raid0 offering various levels of protection for my more and less important files, while wasting as little space as possible. I can do this by creating 3 separate raid partitions on each disk and assembling 3 arrays from this, but this has a number of downsides:   1. The size of each section would be fixed from the outset and changing this would be rather tricky   2. I would be limiting my directory layout options and probably end up resorting to symlinks to retain a logical layout What I would really like is a single filesystem, where I can set a property on individual files/directories, indicating the level of protection required for those files, resulting in the file being mirrored as appropriate. Is there any way to achieve this on SUSE, perhaps with an esoteric filesystem format?


Ubuntu with Gnome and Openbox

I've in my laptop Ubuntu 12.04.03 which comes by default with Unity. I like Unity, and Gnome. It has a nice look, some nice apps, things frequently works nice. However I would prefer to use Openbox. It is very lightweight, the 'context menu' is fantastic, and so on. But some times Openbox sucks, for instance, the wallpaper does not appear no matter what I do, the backlight also isn't working, etc.. I read somewhere that it is possible to run openbox and gnome together. My question is: what are the pros and cons of doing this? In my laptop in GDM when I log using Gnome/Openbox seems that there is no difference between the conventional Gnome environment. If I use openbox+gnome would I be able to use the right-button mouse click context menu?


Variable value is not recognized after using gnu parallel?

I have a below shell script from which I am trying to copy 5 files in parallel. I am running my below shell script on `machineA` which tries to copy the file from machineB and machineC. If the file is not there in `machineB`, then it should be there in `machineC` for sure. I am using GNU Parallel here to download five files in parallel.               #!/bin/bash          readonly PRIMARY=/tech01/primary     readonly FILERS_LOCATION=(machineB machineC)     readonly MEMORY_MAPPED_LOCATION=/techbat/data/be_t1_snapshot     PRIMARY_PARTITION=(550 274 2 546 278 6 558 282 10 554 286 14) # this will have more file numbers          dir1=/techbat/data/be_t1_snapshot/20140501          find "$PRIMARY" -mindepth 1 -delete          do_copy() {       el=$1       scp -o ControlMaster=auto -o 'ControlPath=~/.ssh/control-%r@%h:%p' -o ControlPersist=900 david@${FILERS_LOCATION[0]}:$dir1/t1_weekly_1680_"$el"_200003_5.data $PRIMARY/. || scp -o ControlMaster=auto -o 'ControlPath=~/.ssh/control-%r@%h:%p' -o ControlPersist=900 david@${FILERS_LOCATION[1]}:$dir1/t1_weekly_1680_"$el"_200003_5.data $PRIMARY/.     }     export -f do_copy     parallel -j 5 do_copy ::: "${PRIMARY_PARTITION[@]}"      **Problem Statement:-** The problem I am facing with the above script is - It is not able to recognize `${FILERS_LOCATION[0]}`, `${FILERS_LOCATION[1]}`, `$dir1` and `$PRIMARY` inside `do_copy` method? And I am not sure why? If I try to print out like this inside `do_copy` method nothing is printed out?                 echo ${FILERS_LOCATION[0]}           echo ${FILERS_LOCATION[1]}      But if I print out same thing just above `do_copy` method, then it works fine? Anything I am missing here? **Update:-** Below is the code I am using -               #!/bin/bash          export PRIMARY=/tech01/primary     export FILERS_LOCATION=(machineB machineC)     export MEMORY_MAPPED_LOCATION=/techbat/data/be_t1_snapshot     PRIMARY_PARTITION=(0 548 272 4 544 276 8 556 280)          export dir1=/techbat/data/be_t1_snapshot/20140501          find "$PRIMARY" -mindepth 1 -delete          do_copy() {       el=$1       scp -o ControlMaster=auto -o 'ControlPath=~/.ssh/control-%r@%h:%p' -o ControlPersist=900 david@${FILERS_LOCATION[0]}:$dir1/t1_weekly_1680_"$el"_200003_5.data $PRIMARY/. || scp -o ControlMaster=auto -o 'ControlPath=~/.ssh/control-%r@%h:%p' -o ControlPersist=900 david@${FILERS_LOCATION[1]}:$dir1/t1_weekly_1680_"$el"_200003_5.data $PRIMARY/.     }     export -f do_copy     parallel -j 8 do_copy ::: "${PRIMARY_PARTITION[@]}"      **Another Update:-** This is what I got after running the below script -               #!/bin/bash          export PRIMARY=/tech01/primary     export FILERS_LOCATION=(slc4b03c-407d.stratus.slc.ebay.com chd1b02c-0db8.stratus.phx.ebay.com)     export MEMORY_MAPPED_LOCATION=/techbat/data/be_t1_snapshot     PRIMARY_PARTITION=(0 548 272 4 544)          export dir1=/techbat/data/be_t1_snapshot/20140501          find "$PRIMARY" -mindepth 1 -delete           echo ${FILERS_LOCATION[0]}          echo ${FILERS_LOCATION[1]}          do_copy() {       el=$1       echo "scp -o ControlMaster=auto -o 'ControlPath=~/.ssh/control-%r@%h:%p' -o ControlPersist=900 bullseye@${FILERS_LOCATION[0]}:$dir1/t1_weekly_1680_"$el"_200003_5.data $PRIMARY/. || scp -o ControlMaster=auto -o 'ControlPath=~/.ssh/control-%r@%h:%p' -o ControlPersist=900 bullseye@${FILERS_LOCATION[1]}:$dir1/t1_weekly_1680_"$el"_200003_5.data $PRIMARY/."     }     export -f do_copy     parallel -j 3 do_copy ::: "${PRIMARY_PARTITION[@]}"      Output I got -               david@tvxdbx1143:/home/david$ ./scp_files5.sh     machineB     machineC     When using programs that use GNU Parallel to process data for publication please cite:            O. Tange (2011): GNU Parallel - The Command-Line Power Tool,       ;login: The USENIX Magazine, February 2011:42-47.          This helps funding further development; and it won't cost you a cent.          To silence this citation notice run 'parallel --bibtex' once or use '--no-notice'.          scp -o ControlMaster=auto -o 'ControlPath=~/.ssh/control-%r@%h:%p' -o ControlPersist=900 david@:/techbat/data/be_t1_snapshot/20140501/t1_weekly_1680_0_200003_5.data /tech01/primary/. || scp -o ControlMaster=auto -o 'ControlPath=~/.ssh/control-%r@%h:%p' -o ControlPersist=900 david@:/techbat/data/be_t1_snapshot/20140501/t1_weekly_1680_0_200003_5.data /tech01/primary/.     scp -o ControlMaster=auto -o 'ControlPath=~/.ssh/control-%r@%h:%p' -o ControlPersist=900 david@:/techbat/data/be_t1_snapshot/20140501/t1_weekly_1680_548_200003_5.data /tech01/primary/. || scp -o ControlMaster=auto -o 'ControlPath=~/.ssh/control-%r@%h:%p' -o ControlPersist=900 david@:/techbat/data/be_t1_snapshot/20140501/t1_weekly_1680_548_200003_5.data /tech01/primary/.     scp -o ControlMaster=auto -o 'ControlPath=~/.ssh/control-%r@%h:%p' -o ControlPersist=900 david@:/techbat/data/be_t1_snapshot/20140501/t1_weekly_1680_272_200003_5.data /tech01/primary/. || scp -o ControlMaster=auto -o 'ControlPath=~/.ssh/control-%r@%h:%p' -o ControlPersist=900 david@:/techbat/data/be_t1_snapshot/20140501/t1_weekly_1680_272_200003_5.data /tech01/primary/.     scp -o ControlMaster=auto -o 'ControlPath=~/.ssh/control-%r@%h:%p' -o ControlPersist=900 david@:/techbat/data/be_t1_snapshot/20140501/t1_weekly_1680_4_200003_5.data /tech01/primary/. || scp -o ControlMaster=auto -o 'ControlPath=~/.ssh/control-%r@%h:%p' -o ControlPersist=900 david@:/techbat/data/be_t1_snapshot/20140501/t1_weekly_1680_4_200003_5.data /tech01/primary/.     scp -o ControlMaster=auto -o 'ControlPath=~/.ssh/control-%r@%h:%p' -o ControlPersist=900 david@:/techbat/data/be_t1_snapshot/20140501/t1_weekly_1680_544_200003_5.data /tech01/primary/. || scp -o ControlMaster=auto -o 'ControlPath=~/.ssh/control-%r@%h:%p' -o ControlPersist=900 david@:/techbat/data/be_t1_snapshot/20140501/t1_weekly_1680_544_200003_5.data /tech01/primary/.


Zsh - Disable Tab Insert

I'm trying to configure zsh to closely fit how bash behaves before I fully switch, and one behavior I'm trying to modify in zsh is when it inserts a Tab character. I see how it could be helpful for writing functions interactively, but I prefer bash's behavior of listing the directory contents. Ideally, I would like to cycle through the directories using a menu, but my main priority is to list directories like Bash after one or two Tab presses instead of inserting a Tab. I did try to look this up, but everything I found only pertained to disabling Tab Completion entirely. **EDIT:** I mistakenly thought bash's default completion on empty input was to list the directory when I posted this, I feel like it may have caused some confusion with what I was asking. My main objective is to prevent zsh from inserting a Tab when there is only whitespace.


creating patition in debian with more inodes on a beaglebone black

I have a beaglebone black that i've installed debian wheezy from http://www.armhf.com onto the eMMC While this was working great up until recently when I ran out of inodes on the patition even though I had 40% of space free on the device. Now I understand I cant increase inodes on a filesystem that has unix installed and I need to recreate the patition which I am happy to do after having backed up my work. Only issue is how do I go about doing this? This is what I have tried so far Create a microSD with bootable debian, boot into debian on the USB then format the emmc `mkfs.ext4 -i 4096 /dev/mmcblk1` my understanding is that using the -i argument I can specify for every 4096 bytes a inode should be created I have tried this twice now, once with 4096 a second time with 2048 get the debian image `wget http://s3.armhf.com/debian/wheezy/bone/debian- wheezy-7.2-armhf-3.8.13-bone30.img.xz` extract it to the new partition `xz -cd debian-wheezy-7.2-armhf-3.8.13-bone30.img.xz > /dev/mmcblk1` Which to me seems like the correct steps although each time I do this when I type df -i the result is always the same amount of inodes (11,7000~) or something like that Would really appreciate some guidance on how I can achieve increasing the inodes above the default. Cheers Tim


Shifting GNOME 3 notification corner to bottom-left!

I like that GNOME 3's (v3.4 on Ubuntu 12.04) 'Hot Corner' and 'notification corner (?)' response really fast, but the latter, for me, would have been better off at the bottom-left corner; leaving the bottom-right for other status menus, chat menus, etc. While reaching for such menus of the full-sized windows, my cursor often touch the notification corner and the try is up instantly like you can see in the snapshots where I was meaning close the 'downloads' bar of my web browser. ![snap1](http://i.stack.imgur.com/3N0Di.png) ![snap2](http://i.stack.imgur.com/PryTs.png) Can I get the _Notification Corner_ shifted to the bottom-left?


How to move to a different drive or partition?

I'm relatively new to Unix... or at least doing anything beyond `ls`. I need to get to a partition that is larger than where I'm at to import a project that won't fit where I'm currently. Also I'm running Linux on a VM on Windows.               jack@ubuntu:~$ sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL     NAME   FSTYPE   SIZE MOUNTPOINT LABEL     sda              20G     ââsda1 ext4    15.7G /     ââsda2            1K     ââsda5 swap     4.3G [SWAP]     sdc              40G     ââsdc1 ext4      40G            work     sdb              20G     ââsdb1 ext4      20G /mnt/disk     jack@ubuntu:~$ sudo fdisk -l          Disk /dev/sda: 21.5 GB, 21474836480 bytes     255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x000750e0             Device Boot      Start         End      Blocks   Id  System     /dev/sda1   *        2048    32956415    16477184   83  Linux     /dev/sda2        32958462    41940991     4491265    5  Extended     /dev/sda5        32958464    41940991     4491264   82  Linux swap / Solaris


Lost mouse pointer in XServer

Have tried many windows managers including TWM, xfce and Gnome, but my mouse pointer is gone. It is invisible, but it performs all the actions. If I do the right click the context menu opens and this is how I can tell what the current location of the pointer is. This is a newest stable built of Debian. How can I restore the mouse pointer? The output from lsmod is included below. Links to Xserver logs and dmesg output. Can anybody help? UPDATE: It does indeed work well with the 2.6.38 kernel. lsmod:               Module                  Size  Used by     nls_utf8                 908  1      nls_cp437               4489  1      vfat                    6570  1      fat                    34912  1 vfat     usbhid                 28008  0      hid                    50909  1 usbhid     cpufreq_conservative     4018  0      cpufreq_userspace       1480  0      cpufreq_powersave        602  0      cpufreq_stats           1940  0      ppdev                   4058  0      lp                      5570  0      sco                     5857  2      bridge                 33019  0      stp                      996  1 bridge     bnep                    7444  2      rfcomm                 25175  0      l2cap                  21709  4 bnep,rfcomm     bluetooth              36319  6 sco,bnep,rfcomm,l2cap     binfmt_misc             4907  1      fuse                   44256  1      ext4                  257803  1      jbd2                   56155  1 ext4     crc16                   1027  2 l2cap,ext4     loop                    9765  0      firewire_sbp2           9647  0      snd_intel8x0           19595  0      snd_ac97_codec         79148  1 snd_intel8x0     arc4                     974  4      ecb                     1405  4      ac97_bus                 710  1 snd_ac97_codec     rt2500pci              11303  0      snd_pcm_oss            28671  0      rt2x00pci               3773  1 rt2500pci     snd_mixer_oss          10461  1 snd_pcm_oss     ath5k                 104074  0      rt2x00lib              19101  2 rt2500pci,rt2x00pci     ath                     6014  1 ath5k     snd_pcm                47226  3 snd_intel8x0,snd_ac97_codec,snd_pcm_oss     i915                  223024  2      mac80211              123570  3 rt2x00pci,ath5k,rt2x00lib     snd_seq_midi            3576  0      cfg80211               87657  4 ath5k,rt2x00lib,ath,mac80211     snd_rawmidi            12513  1 snd_seq_midi     drm_kms_helper         18309  1 i915     snd_seq_midi_event      3684  1 snd_seq_midi     rfkill                 10264  3 bluetooth,cfg80211     eeprom_93cx6             963  1 rt2500pci     drm                   112088  3 i915,drm_kms_helper     snd_seq                35463  2 snd_seq_midi,snd_seq_midi_event     pcmcia                 16194  0      snd_timer              12258  2 snd_pcm,snd_seq     i2c_algo_bit            3497  1 i915     snd_seq_device          3673  3 snd_seq_midi,snd_rawmidi,snd_seq     yenta_socket           16403  3      rsrc_nonstatic          7057  1 yenta_socket     asus_laptop            11090  0      pcmcia_core            20450  3 pcmcia,yenta_socket,rsrc_nonstatic     i2c_i801                6462  0      parport_pc             15799  1      joydev                  6739  0      led_class               1757  3 ath5k,rt2x00lib,asus_laptop     parport                22554  3 ppdev,lp,parport_pc     i2c_core               12787  5 i915,drm_kms_helper,drm,i2c_algo_bit,i2c_i801     snd                    34375  9 snd_intel8x0,snd_ac97_codec,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_rawmidi,snd_seq,snd_timer,snd_seq_device     shpchp                 21220  0      evdev                   5609  13      video                  14605  1 i915     battery                 3782  0      processor              26327  1      button                  3598  1 i915     ac                      1640  0      rng_core                2178  0      output                  1204  1 video     pcspkr                  1207  0      soundcore               3450  1 snd     snd_page_alloc          5045  2 snd_intel8x0,snd_pcm     psmouse                44809  0      serio_raw               2916  0      pci_hotplug            18065  1 shpchp     ext3                   94204  1      jbd                    32169  1 ext3     mbcache                 3762  2 ext4,ext3     usb_storage            30833  1      sd_mod                 26005  6      crc_t10dif              1012  1 sd_mod     8139too                14949  0      ata_generic             2067  0      ata_piix               17736  3      uhci_hcd               16057  0      firewire_ohci          16725  0      thermal                 9206  0      8139cp                 13421  0      libata                115753  2 ata_generic,ata_piix     ehci_hcd               28681  0      firewire_core          31243  2 firewire_sbp2,firewire_ohci     crc_itu_t               1035  1 firewire_core     thermal_sys             9378  3 video,processor,thermal     mii                     2714  2 8139too,8139cp     usbcore                98733  5 usbhid,usb_storage,uhci_hcd,ehci_hcd     nls_base                4541  5 nls_utf8,nls_cp437,vfat,fat,usbcore     scsi_mod              101429  4 firewire_sbp2,usb_storage,sd_mod,libata


Tool to remove all non-package files on a system

If you want to keep for example a build or server system clean, it is very useful to be able to **check that all files are present and accounted for** by the package metadata. At work we have a very nice tool which, if run without any parameters, simply creates a file with `rm`/`rmdir` statements for any and all files/directories not mentioned by any package (excluding some trees like `/home`). This is _different_ from `rpm -V` and `debsums`, which only check the files already mentioned by a package. Is there a tool like this for DEB/RPM/Ports/other packaging systems? DEB would be the best, but porting from another system (or our own, if nothing else exists) would probably be feasible. PS: I am _not_ looking for alternative architectures. The issue here is to have absolutely every file on the system accounted for. VMs and such are not applicable.


BC - output normal form?

I have a big number:                 2923174917395723957      that would be:                 2,923*10^18      are there any parameters in bc that will give this OUTPUT?   e.g.:                 $ echo '2923174917395723956 + 1' | bc     2,923*10^18     $       Or something similar...the point is that it must have a short look   Thank you!


"Permission denied" when writing to /dev/stdout

Why cannot I write to `/dev/stdout`? I am logged in as the root user, what greater permission could I have?               root@ubuntu:/# tcpdump -i 2 -w /dev/stdout     tcpdump: /dev/stdout: Permission denied      The above command with `-w /dev/null` works. I am using stock Ubuntu Linux. Now, `stdout` redirects to `proc` which redirects to `/dev/pts`, which is a char dev and has `w` permission -- what else is there?               crw-rw-rw- 1 root root 1, 3 2013-08-26 00:29 /dev/null     lrwxrwxrwx 1 root root   15 2013-08-26 00:29 /dev/stdout -> /proc/self/fd/1     lrwx------ 1 root root   64 2013-08-26 10:10 /proc/self/fd/1 -> /dev/pts/0     crw--w---- 1 xxx  tty  136, 0 2013-08-26 10:11 /dev/pts/0     root@ubuntu:/# tcpdump -i 2 -w /dev/pts/0     tcpdump: /dev/pts/0: Permission denied


Define specific TTL for each interfaces

After some research, I was wondering if it was possible to define a TTL by interface as I can the Hop Limit definition in ipv6. To change the TTL in IPv4, I can change the file                /proc/sys/net/ipv4/ip_default_ttl       But this changes TTL for all interfaces. However in IPv6, you can put a different hop limit value for each interfaces               /proc/sys/net/ipv6/conf/eth*/hop_limit      So do I miss something? or there is no way to configure a different TTL for each interface ?


Which tool you use to mount a floppy usb with a tiling wm

I use a tiling wm without an desktop environment. So no notification when I plug in a usb stick for example. At the moment personally I use the mount and umount command line, but maybe you have most interesting usage. Do you use a file manager like pcmanfm or nautilus, but that trouble me to use it only for that. Or maybe you have a tool which automatically mounts the media when it is plugged. How do you usually manage this case.


New users cannot connect to server via SSH

An SSH server using RSA keys for authentication is running on Ubuntu 14.04. My original account can connect to the server using SSH (PuTTY). However, the following issue occurs:               Disconnected: No Supported authentication methods available (server sent: publickey)      if additional users are trying to authenticate, while these have been added to the `/etc/ssh/sshd_config` file as authorized users. Pageant runs on my machine so I am not sure what is going on. The private key is there. What am I missing?


How to use rsync to backup a directory without git subdirectory

I want to copy my `c` directory with all subdirectories excluding `./git` subdirectory. I do it using `rsync` :               echo "copy c and sh files "     rsync -a --include='*.c' --include='*.sh' --include='*/' --exclude='*' ~/c/ ~/Dropbox/Public/c     # remove .git directory = do not send it to dropbox. Thx to Tomasz Sowa     rm -rf ~/Dropbox/Public/c/.git      Can I do it better?


Is it possible to control xterm (or specifically a process that xterm has started) from another process?

If I start a process with xterm like this (where omxplayer is the process xterm is starting):               xterm -fullscreen -fg black -bg black -e omxplayer -o hdmi -r %f      Is it possible for me to write to xterm's standard input via a different process to control the omxplayer? If so, how? (I'm pretty unfamiliar with linux terminology so please excuse if I'm stating this incorrectly.) **Update** As per @strugee's comment, I'm not aiming to write to xterm's standard input, but rather I'm aiming to write to omxplayer's standard input.


Outputting sound from different monitors to different audio devices

I have got my computer set up in my living room on a desk with the TV 1 metre away. I want to be able to use my TV to watch videos from my computer. I am using Chakra Linux, I use the NVIDIA binary drivers and KDE 4.11.2. I'd like to have both screens attached to my computer at all times. I want to be able to drag windows to the corners of each screen to use the automatic resize option and I want to have applications on each screen output to different audio devices. I have attempted to use different X-server sessions for each screen, which has opened up a can of worms. Any suggestions how to proceed?


How to save brightness and Bluetooth configuration?

I am using the latest version of Elementary OS on my Lenovo u410, and every time I boot it, my Bluetooth is turned on, and my brightness is set to 100%. I know that elementary OS is a WIP, but is there any method/hack that I can use to keep my Bluetooth off, and my brightness not on 100%?


kvm killed by oomkiller

kvm version: `QEMU emulator version 1.1.2 (qemu-kvm-1.1.2+dfsg-6+deb7u3, Debian), Copyright (c) 2003-2008 Fabrice Bellard`   libvirtd version: `libvirtd (libvirt) 0.9.12.3`   debian version: `7.5` I'm running multiple VMs on a 16GB RAM machine, all together they use ~9GB RAM. Every now and then the linux oom killer comes over and kills a process. I guess it chooses the process using most of the memory - in this case a 6GB Windows VM:   `[431215.778365] Out of memory: Kill process 25086 (kvm) score 192 or sacrifice child` IMHO the machine shouldn't be in an OOM Situation as there are ~6.6GB cached memory available. You can see the memory distribution and the resulting oom kill here: ![memory distribution](http://i.stack.imgur.com/mvqJk.png) I now have set the `oom_adj` for the pid of the kvms to `-17`, so the oom- killer won't kill this process. But I'm still failing to understand why the kernel thinks it has to kill a process and won't go ahead and free some cached memory.   * Can anyone explain why this happens?   * Can you tell me how I can prevent the oom killer from killing my kvm processes without knowing the PID?


find greatest last-modified files of /dirA/file, /dirB/file

Suppose we have two directories, dirA, dirB, which the exact same PDF files, just different last modified. What is a bash script (no awk) that can search through each file name (assume always in both dirA, dirB) and for each filename, outputs which of the files (dirA/file or dirB/file) has the greater last-modified; file-modified-last? e.g.               if dirA/file.lastmodified > dirB/file.lastmodified      ##take action


If Statement with 2 Variables - Bash

I am trying to write a single IF statement which can check two variables at once. I have two variables, for example: $VARA $VARB Both with either contain a 0 or a non 0 value. I need an if statement which can check both and if either are not equal to 0, if will perform an action, if both are 0 if will perform a different action. With a single variable, I can do this:               if [ $VARA -ne 0 ]     then echo 'The operation failed! VARA is not equal to 0'     else echo 'The operation suceeded! VARA is equal to 0'     fi      However, I am not sure how to check both VARA and VARB at the same time. Thank you.


vmstat on virtual machine and large values

Hi I'm using `vmstat` to track machine performance during some tests (`jmeter`). This is virtual machine running on a big machine where lots of other virtual machines are installed (about 20 virtual machines). I'm using the following software versions:               $ vmstat -V     procps version 3.2.7            $ uname -a      Linux cmbpm 2.6.32-042stab044.11 #1 SMP Wed Dec 14 16:02:00 MSK 2011 x86_64 x86_64 x86_64 GNU/Linux      The problem is with results I get, here is a sample (I've converted spaces to single tabs for easier data processing):               procs   -----------memory---------- ---swap-- -----io---- --system-- -----cpu------      r  b   swpd    free    buff    cache   si  so  bi  bo  in  cs  us  sy  id  wa  st      0  0   1506720 6152768 0   824836  1   0   3   2   0   0   0   0   94  6   0      0  0   1506720 6170744 0   804392  60  64  14  16  0   122651  0   0   98  2   0      0  1   1506720 6168328 0   801744  145 8   300 52  0   117308  0   0   0   100 0      0  0   1505688 6173360 0   806852  233 13  1135    478 0   109158  1   0   387 1171860851  0      0  0   1505172 6168988 0   810140  380 0   0   513 0   117875  0   0   97  3   0      Problem is that some values are much bigger then they should be. Percentage values of CPU time (`\-----cpu------` section) sometimes greatly exceed 100%. Especially column `wa` (waiting for data) is problematic (value 1171860851 is extremely strange). Replacing those huge values with zero give reasonable results. My question is why does it give incorrect values and can it be fixed somehow?   I suspect that virtualization of the machine is a problem here.


Good method to compare time?

I need to check for the current time and abort the script if it is not proper time of day I am supposed to run it. Also, if anyone else runs it, it should abort. For example: I need my script to only run if it is started between 10 PM and and 2 AM (a 4 hour window). Currently I am doing the following. Taking the time with `date +%k%M` and comparing with hard coded numbers               #!/bin/sh     currTime=`date +%k%M`     check_time_to_run()     {         tempTime=$1         if [ $tempTime -gt 200 -a $tempTime -lt 2200 ]; then              echo "Time is between 2 AM and 10 PM. Aborting."             exit 1         else             echo "Time is after 10 PM and before 2 AM. Running normally."         fi     }          check_time_to_run $currentTime      I would like to know if there is any other efficient method with respect to time comparision in `sh` or `bash` ?


Execute John the Ripper on multiple processors using mpirun

I am a linux noob trying to optimize John the Ripper for a security class. I am trying to use both processors to run John by using the `mpirun` program as suggested in this tutorial. I installed `mpirun`, but when I run this command, I get the following error:               # sudo mpirun -np2 /usr/share/john --test=10      /usr/bin/mpirun: 1: eval: usr/share/john: Permission denied.      Why am I getting this error and how can I run John with two processors using `mpirun`? I am running Ubuntu 12.10 on a VMware Fusion machine on a Mac with an Intel Core i5


How to forget/remove Mobile Broadband connection settings from Mint 14

I've been using Ubuntu for a while now and wanted to switch to Mint. I connected my mobile broadband dongle (Vodafone) for the first time like in Ubuntu it all went fine but subsequent connections were denied. I tried connecting with other network dongles and they could connect me to the Internet. My main dongle with the most stable internet connection is Vodafone. How can I remove or forget the setting and do it as fresh again? If anyone has better options as well, I am willing to try it.


bzip2 -c versus -z

Wanted to check for understanding; while revisiting the topic of using dd over netcat I experimented with compressing the data with bzip2. In the man page, there's `-c` (compress or decompress to standard output) and there's `-z` (complement to `-d`: forces compression, regardless of the invocation name) Is `-c` simply a way to force the output to standard output, and using bzip2 at invocation implying you want to compress data if you don't use `-d`?


Security with Kernel IP Forwarding Enabled

I recently enabled IP Forwarding on a production web server that also acts as a VPN server. What, if any, security issues did I just set myself up for? And are there any iptables rules I should set up to limit forwarding to my VPN tunnel?


How to run my own program without specifying its path

Let's suppose I have compiled something and I run it like so:               $ /path/to/my/executable/mycmd     Hello World      What do I need to do to run it like               $ mycmd     Hello World       from everywhere in my computer?


Prevent unwanted buffers from opening

I'm using emacs for my daily javascript editing, to switch between buffers I use C-x LEFT and C-x RIGHT and I'm fine with this (even if I find it difficult to know the path of the file I'm modifying). My problems:   1. at the startup I always have `*scratch*` and `*Messages*` opened, I thought that putting `(kill-buffer "*scratch*")` in my .emacs would solve the issue, but it's not, do you have a suggestion?    2. when I open files I always do TAB autocomplete, so each time I'm creating a new `*Messages*` buffer containing the options for the completion, how do I prevent this from creating, or better, how do I make emacs kill it, after I've made my choice? Do say your opinion if you think I'm doing something that's not "the way it should be" with me navigating as I said at the top.


Cleanly swap all occurences of two strings using sed

Suppose I have a file that contains multiple occurrences of both StringA and StringB. I want to replace all occurrences of StringA with StringB, and (simultaneously) all occurrences of StringB with StringA. Right now, I'm doing something like               cat file.txt | sed 's/StringB/StringC/g' | sed 's/StringA/StringB/g' | sed 's/StringC/StringA/g'      The problem with this approach is that it assumes StringC doesn't occur in the file. While this isn't an issue in practice, this solution still feels dirty -- that is, it feels like an opportunity to learn more unix magic. :)


BEGIN and END with the awk command

According to the awk manual, BEGIN and END are not used to match input, but rather to provide start-up and clean-up information to the awk script. Here is the example given:               ls -l | \     awk 'BEGIN { print "Files found:\n" } /\<[a|x].*\.conf$/ { print $9 }'     Files found:     amd.conf     antivir.conf     xcdroast.conf     xinetd.conf      First this prints a string to output. Then it checks input for a pattern match, where the input starts with a or x followed by any character one or many times followed by the .conf. For any matches, the 9th column is printed. The fact that we are forced to use begin here, does that mean awk can only use at most one print function that does contain a BEGIN or END? If not, then why can't we just use the print function at the beginning without the keyword BEGIN? It seems the BEGIN is superfluous.


vcenter server on Linux?

I am working with VMware and preparing a vcenter server on a Windows server. I would like to know, how good is vcenter in linux - has anyone tried it? I would like to work with Ubuntu server, unless what someone suggests a better option.


Installing from source. How to resolve dependencies without destroying the package manager

I don't consider myself a total noob, but compiling and installing software is a pain and problem I cannot overcome. I just want to run down through my understanding of this process with someone more knowledgeable to clear my mind to get to the next level. Many scientific software I need are not distributed as packages. I understand "./configure" sets up the compilation variables and checking for dependencies "make" does the compilation "sudo make install" puts all the libraries and bins in their places. However it never works. I rarely get out of the a) "./configure" stage without entering dependency hell, and if I do, b) "sudo make install" will probably nuke my box. a) The dependency hell is very frustrating. Sometimes I have the library, but it doesn't like it. Or the library doesn't want to install. Or "configure" can't find it. Or my distro placed it somewhere it shouldn't be. Or there are two versions in my system. Problem is, I can't understand how to diagnose and therefore fix these problems. What are some good references to learn for someone who doesn't need to become a programmer? b) My understanding is "make install" will replace some libraries and change settings without my package manager being aware of this. Therefore, some programs won't run, others can't be updated. So, if I don't use "make install", and just keep the compiled binary in my user directory with a symbolic link added to the PATH, will I be in the clear? Finally, some philosophical positions. I love free (as in beer and freedom) software, but in my line of work I can't afford to be dogmatic about it - I need the program to install. Also, my box is single user, has tons of free HD so I don't really care about having multiple (dozens) of copies of libraries if that will solve my problems. Space is cheap. I appreciate your help and patience. G


Opendns setup failed. How to fix it?

I have problems trying to configure OpenDNS. I have contacted OpenDNS support but they did not answer. I cannot access websites like Twitter and Facebook. ![another example](http://i.stack.imgur.com/5NbBf.png) ![Twitter cannot be accessed.](http://i.stack.imgur.com/dbu37.png) I tried welcome.opendns.com (did not work, shows not using OpenDNS. ![OpenDNS not using.](http://i.stack.imgur.com/h7ggx.png) Using nslookup:                $ nslookup -type=txt which.opendns.com. 208.67.222.222     Server:     208.67.222.222     Address:    208.67.222.222#53          Non-authoritative answer:     which.opendns.com   text = "7.sin"          Authoritative answers can be found from:          $ nslookup -type=txt debug.opendns.com.     Server:     127.0.1.1     Address:    127.0.1.1#53          Non-authoritative answer:     debug.opendns.com   text = "server 3.sin"     debug.opendns.com   text = "flags 20 0 2f6 0"     debug.opendns.com   text = "id 13521181"     debug.opendns.com   text = "source 222.164.129.44:62574"          Authoritative answers can be found from:          $ nslookup www.exampleadultsite.com.     Server:     127.0.1.1     Address:    127.0.1.1#53          Non-authoritative answer:     Name:   www.exampleadultsite.com     Address: 67.215.92.210


scp current folder to destination folder name as ddmmyy

I want to add a cron job that scp a folder to a server with on the server the folder name is in another folder whose folder name is a timestamp like ddmmyy something like               scp -r <foldername> user@server:path/to/destination/ddmmyyhhmmss      ddmmyyhhmmss: date month year hour min sec


Debian Wheezy : problem installing .deb package that uses update-rc.d with dependancy numbers

I'm trying to install a .deb file, written by us, on a new Debian Wheezy system. The .deb file was originally written for Lenny so is fairly old. I've tracked down one point where the installation if failing by trying to install the package with dpkg -debug=3773 : it's trying to add some services using update-rc.d:               update-rc.d r-initialize-config start 12 2 .      This gives the error:               update-rc.d: using dependency based boot sequencing     insserv: Service r-interfaces has to be enabled to start service first-boot     insserv: exiting now!     update-rc.d: error: insserv rejected the script header      The script contains this as the header comments (this is the LSB header?)               ### BEGIN INIT INFO     # Provides: first-boot     # Required-Start: $local_fs r-interfaces     # Required-Stop:     # Default-Start: 2     # Default-Stop:     # Short-Description:     ### END INIT INFO      and the r-interfaces script is present and seems to run correctly. What is the requirements of programs started by the "Required-Start:" attribute? E.g. I changed r-interfaces to "ls" and got the same problem. r-interfaces is a transient script and does not run as a daemon, so maybe that's the problem. What does Required-Start: need?


Should I use symlinks in /usr/bin or use the PATH variable instead?

I was looking to download some tool and it said to update your PATH variable, but I thought `/usr/bin` was the "standard".


How to log iptables as of kernel 3.9.0?

What is the right way to log iptables as of kernel 3.9.0? I can no longer append a logging rule such as:               # iptables --new-chain droplog     # iptables --append droplog --jump LOG --log-level info     iptables: No chain/target/match by that name.      I used to enable IP tables logging support by checking this out:               IP: Netfilter Configuration  --->      <*> IP tables support (required for filtering/masq/NAT)         <*> LOG target support      But this option is missing from kernel 3.9.0, and seems to have been replaced by `CONFIG_NETFILTER_NETLINK_LOG`.


Allow user to see how many iptables rules are loaded, but not actual contents?

I want to allow user to check how many rules are present in filter table, but not able to view actual rules, is that possible? literally I mean `iptables -L | wc -l` (I know it's faulty), but sudo doesn't seem to support pipe commands like that, I mean, currently If I wanted to allow that, I need to grant permission to run `iptables -L` instead of `iptables -L | wc -l` Any thoughts?


Does yum update uninstall and install the dependencies?

If the dependencies of the two different versions of RPM are same, would yum update remove and install dependencies too?


Why I can't ping anymore?

In my Ubuntu 14.04 I have two ethernet interface. Eth0 is connected to main internet using DHCP auto and eth1 is to share with other PC's.               $ cat /etc/network/interfaces     auto lo     iface lo inet loopback     auto eth0     iface eth0 inet dhcp          auto eth1     iface eth1 inet static       address 10.0.0.1       netmask 255.255.255.0       #network 192.168.0.0       gateway 10.0.0.1       #broadcast 192.168.1.1       #dns-nameservers 192          $ ip addr     1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default          link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00         inet 127.0.0.1/8 scope host lo            valid_lft forever preferred_lft forever         inet6 ::1/128 scope host             valid_lft forever preferred_lft forever     2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000         link/ether 74:d4:35:e5:fb:03 brd ff:ff:ff:ff:ff:ff         inet 192.168.1.13/24 brd 192.168.1.255 scope global eth0            valid_lft forever preferred_lft forever         inet6 fe80::76d4:35ff:fee5:fb03/64 scope link             valid_lft forever preferred_lft forever     3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000         link/ether 74:d4:35:e5:fb:01 brd ff:ff:ff:ff:ff:ff         inet 10.0.0.1/24 brd 10.0.0.255 scope global eth1            valid_lft forever preferred_lft forever         inet6 fe80::76d4:35ff:fee5:fb01/64 scope link             valid_lft forever preferred_lft forever     4: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000         link/ether 80:86:f2:5f:85:d4 brd ff:ff:ff:ff:ff:ff          $ echo 1 > /proc/sys/net/ipv4/ip_forward     $ ping 10.0.0.2     PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.     From 10.0.0.1 icmp_seq=1 Destination Host Unreachable     ^C     --- 10.0.0.2 ping statistics ---     5 packets transmitted, 0 received, +1 errors, 100% packet loss, time 3999ms     pipe 4               $ sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE     $ sudo iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT     $ sudo iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT     $ ping 10.0.0.2     PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.     From 10.0.0.1 icmp_seq=1 Destination Host Unreachable     From 10.0.0.1 icmp_seq=2 Destination Host Unreachable     From 10.0.0.1 icmp_seq=3 Destination Host Unreachable     ^C     --- 10.0.0.2 ping statistics ---     5 packets transmitted, 0 received, +3 errors, 100% packet loss, time 3999ms     pipe 4      Now eth0 is internet and eth1 is up. I have Windows 7 connected on eth1 with IP 10.0.0.2 but Windows 7 can't ping to 10.0.0.1 and Ubuntu also can't ping 10.0. 0.2 What is wrong, how can I fix it?


How to configure dhcpd to register ipv4 with bind while having static ipv6 addresses?

I have IPv6 configured on my local network via `radvd`; it advertises a routable IPv6 block, that all the machines auto-configure.s I have IPv4 assigned to a NAT'd block via dhcpd and that updates named. My problem is that when I set the AAAA record for a host for it's IPv6 address (which doesn't change), named will then start rejecting name updates from dhcpd for the A record. named reports the following error:               'name not in use' prerequisite not satisfied (YXDOMAIN)      dhcpd will report the following error:               Has an A record but no DHCID, not mine      How can I either convince dhcpd to ignore the `AAAA` record when doing the named update.


AWK - how to reduce the greed of a regular expression?

I have an example:               echo "@article{gjn2010jucs, Author =   {Grzegorz J. Nalepa}, " | awk '{ sub(/@.*,/,""); print }'      Is it possible to write a regular expression that selects the shorter pattern?               @article{gjn2010jucs,      Instead of a long pattern?:               @article{gjn2010jucs, Author =   {Grzegorz J. Nalepa},      I want to get this result:               Author =   {Grzegorz J. Nalepa},      **EDIT:** I have another example:               echo ",article{gjn2010jucs, Author =   {Grzegorz J. Nalepa}, " | awk '{ sub(/,[^,]*,/,""); print }'      Is it possible to write a regular expression that selects the shorter pattern?               , Author =   {Grzegorz J. Nalepa},      Instead of a long pattern?:               ,article{gjn2010jucs, Author =   {Grzegorz J. Nalepa},      I want to get this result:               ,article{gjn2010jucs


How to confirm/verify WiFi is WPA2?

How do I, from the command line, confirm _on the host_ that the wireless network connection uses WPA2? The wireless router is set to use `WPA2 Personal` (WPA2 with a pre-shared key) and AES on the network, and I have added `wpa-ssid`, `wpa-psk` and `wpa-proto RSN` to /etc/network/interfaces, but iwconfig prints `Encryption key:off`. I am running Debian Wheezy/7.0. I checked the system logs but saw nothing of relevance, and the only current wpa_supplicant.conf on my system is one for D-Bus.


Login fails from Windows on NTFS-3G Samba Share

I have a Raspberry Pi (though could be any Debian Linux box) connected to an external hard disk formatted as NTFS. My disk mount in `fstab` is:               /dev/sda1 /media/disk  ntfs-3g  defaults,uid=1000,gid-1000,dmask=007,fmask=007  0  0      where user 1000 is the 'pi' user /media/disk/shared is my Samba root folder. Must be accessible from Windows and Mac Now, I can see the share in Windows, but I get permission denied. If I try mapping a drive to it, and attempt login using \machinename\pi the login fails. Any ideas? Edit-- smb.conf below. I've removed all comment lines (I assume lines beginning # or ; are comments)               [global]             workgroup = WORKGROUP        server string = %h server        dns proxy = no        log file = /var/log/samba/log.%m        max log size = 1000        syslog = 0        panic action = /usr/share/samba/panic-action %d        encrypt passwords = true        passdb backend = tdbsam        obey pam restrictions = yes        unix password sync = yes        passwd program = /usr/bin/passwd %u        passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .        pam password change = yes        map to guest = bad user             usershare allow guests = yes          [shared]        comment = Ali and Greg Shared Folders        writeable = yes        public = yes        browseable = yes        path = /media/disk/shared        guest only = yes        guest ok = yes             read only = no             create mask = 0777        directory mask = 0777          [printers]        comment = All Printers        browseable = no        path = /var/spool/samba        printable = yes        guest ok = no        read only = yes        create mask = 0700          [print$]        comment = Printer Drivers        path = /var/lib/samba/printers        browseable = yes        read only = yes        guest ok = no          [hdd]        comment = Samba server's HDD        read only = no        locking = no        path = /media/disk/shared        guest ok = yes


Whoami: cannot find name for user id 0

When I run `whoami` it says: > whoami: cannot find name for user id 0 My `/etc/passwd` file looks like this:               root::0:0:root:/root:/bin/bash


Outputting last modification date to another file?

I'm trying to read the number of lines in a file, and the last modification date of that file (e.g. if it was last modified Jan 18, 2013, it should output `2013-01-18`), then append the data to the given input file in the form `theFile: 4 lines, modified on 2013-01-18`. I tried to store both pieces of data in their own variables before outputting with echo.               #!/bin/sh     totLines=$(wc -l < $1)     modDate=$(date -r $1)     echo $1: $totLines "lines, modified on" $modDate >> $1      Is my method of finding the last modification date correct? I was told that it is, but I can't figure out why, since I can't find any information on what `date -r` does and I can't get it working in any script I try out. There's also using stat, but I can't get that working either with `stat -c %y $1` where I get `stat: illegal option -- c`


Should scripts that require sudo fail if they don't have it, or use sudo and prompt?

I have a script which gives me fine-grained control over my backlight brightness and requires `sudo` to run. It's essentially this:               backlight="/sys/class/backlight/acpi_video0/brightness"     echo $1 | tee $backlight      and lives at `~/bin/backlight-adjust`. The script needs `sudo` privileges, because `tee $backlight` is writing to a privileged location. So it'll fail if it's not run with `sudo`. This approach has a problem, because I can't just run `sudo backlight-adjust`, because `~/bin` is not in the `$PATH` in the `sudo` environment, only in my environment. So I'd have to to run `sudo env "PATH=$PATH" backlight-adjust` or something similar. Alternatively, I could have written it like this:               backlight="/sys/class/backlight/acpi_video0/brightness"     echo $1 | sudo tee $backlight      and prompt me for the password. The second approach works better for me because I don't have to remember to type sudo; it'll prompt me. And I can keep my `$PATH` intact. This feels more convenient overall, but **are there any reasons why I shouldn't do it the second way?** (I'm running Xubuntu 14.04 and my shell is GNU bash 4.2.45, if that makes a difference.)


Pernicious USB-stick stall problem. Reverting workaround fix?

There's an issue with Ubuntu that hasn't been fixed yet, where the PC freezes or gets really slow whenever it is copying to an USB stick (see Why is my PC freezing while I'm copying a file to a pendrive?, http://lwn.net/Articles/572911/ and http://askubuntu.com/q/508108/234374). A workaround is to execute the following commands as root (see here for an explanation) as root:               echo $((16*1024*1024)) > /proc/sys/vm/dirty_background_bytes     echo $((48*1024*1024)) > /proc/sys/vm/dirty_bytes      How do I revert these changes? When I restart my PC, will it get rolled back to default values?


Bash variables and types

I'm making a script that validate an IP address. I do this:               read pool     checkIp()     {         local  ip=$1         local  stat=1              if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then             OIFS=$IFS             IFS='.'             ip=($ip)             IFS=$OIFS             [[ ${ip[0]} -le 255 && ${ip[1]} -le 255 && ${ip[2]} -le 255 && ${ip[3]} -le 255 ]]             stat=$?              fi         return $stat     }          checkIp $pool     if [ $? -eq 0 ]         then             echo "valid"         else             echo "invalid"     fi      The problem is that now the requirement is to valid that from the 2nd octet the input can contain the wildcard "*" (i think is better to use CIDR notation but is not the case), and now i can't use `-le` because if there is not a number, it fails. I'd tried some forms but all conversions fails.