title: Audible DRM Removal for personal use

text: I have a bunch of Audiobooks from Audible. I've made a complete switch from Windows to Linux but Audible do not support Linux. While there are some annoying ways around this I would like to convert my Audible books into Mp3 or Mp4 format. Has anyone done this previously? Can anyone suggest a quick and easy way to make this conversion? Should i go down the copy directly from the soundcard route? or is there a way to remove DRM directly from the file itself? I have absoloutly no intention of sharing these files once they are converted. I like the service audible provide, and i dont mind paying for books that i want. I just want to be able to listen too them!


title: How to back-up files from nautilus retaining the time stamp?

text: I connected my android tablet (Asus fonepad7 me372cg) to laptop using usb cable. It showed up in nautilus in Ubuntu 13.04. I've to back-up the files in the tablet (specially the videos & photos) to my laptop. The issue I find here is that via nautilus when I copy-paste, the original time stamp gets lost & the current time gets linked with the copied files. This I don't want. Is there a way to achieve this via nautilus which will retain the time stamp? I know that via command line, I can achieve that using `tar` or `cpio`. But the reason I'm not using cli is that the file names in the terminal for the tablet aren't displayed rightly. (I've a thread regarding this issue here) Rather than the names of the files & folders, it's reflecting as numbers. I've come across this issue in google search engine which I will try to resolve later. But till then I need a solution to achieve it via nautilus! By nautilus, I mean the GUI as shown below: ![nautilus](http://i.stack.imgur.com/eOwf1.png)


title: Need to move complete unix disk from old HP to new box

text: I have an old HP 715/80 that is running some really old software that we need to continue using. The software is no longer available. I am wanting to somehow clone or move the data to a new Unix/Linux machine. The only thing the HP has is a tape drive so I am lost on how to proceed. Any insight would be great.


title: Use Linux without a GPU

text: Is it possible do have basic (even just console) graphics on Linux, but without using the GPU (which, in this case, is fried and not replaceable)? Or would such a computer be limited to non-graphical uses only? EDIT: The computer I'm talking about is an iMac with a broken graphics card/GPU, but everything else working (like the screen)


title: URL with hostname doesn't work but it works with IP Address

text: I have a very basic question here. This thing is puzzling me a little bit. I have one Ubuntu machine which is running 12.04 and I am connecting to that machine from putty in my desktop (which is running windows). I started Netflix Exhibitor like this in that Ubuntu machine -               cronusapp@phx5qa01c:/zook$ java -jar ./exhibitor-1.5.1/lib/exhibitor-1.5.1-jar-with-dependencies.jar -c file     v1.5.1     INFO  com.netflix.exhibitor.core.activity.ActivityLog  Exhibitor started [main]     INFO  org.mortbay.log  Logging to org.slf4j.impl.Log4jLoggerAdapter(org.mortbay.log) via org.mortbay.log.Slf4jLog [main]     INFO  org.mortbay.log  jetty-1.5.1 [main]     Dec 18, 2013 7:10:35 PM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate     INFO: Initiating Jersey application, version 'Jersey: 1.9.1 09/14/2011 02:36 PM'     INFO  org.mortbay.log  Started SocketConnector@0.0.0.0:8080 [main]      And then I went to chrome browser in my desktop and I opened the url like this with the machine hostname -               http://phx5qa01c.stratus.phx.qa.host.com:8080/exhibitor/v1/ui/index.html      And this url is showing me blank white page on the screen. But if I replace the hostname with IP Address of that machine, then it starts working and I can see the actual content on my browser.               http://10.108.24.132:8080/exhibitor/v1/ui/index.html      Now I am not sure why this is happening. Is there any file which I am supposed to modify in my Ubuntu box to recognize the hostname instead of ip address. I believe this is pretty basic question which I am not aware of? Any idea what I am supposed to do to fix this? **UPDATE:-** This is what I have done to figure out the IP Address, I am taking IP Address for etho -               root@phx5qa01c:/home/david# ifconfig     eth0      Link encap:Ethernet  HWaddr 00:50:56:ad:5b:a9               inet addr:10.108.24.132  Bcast:10.108.27.255  Mask:255.255.252.0               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:351211 errors:0 dropped:590 overruns:0 frame:0               TX packets:291409 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000               RX bytes:426570999 (426.5 MB)  TX bytes:39383233 (39.3 MB)          lo        Link encap:Local Loopback               inet addr:127.0.0.1  Mask:255.0.0.0               UP LOOPBACK RUNNING  MTU:16436  Metric:1               RX packets:15839 errors:0 dropped:0 overruns:0 frame:0               TX packets:15839 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0               RX bytes:1455090 (1.4 MB)  TX bytes:1455090 (1.4 MB)      And below is for the hostname -               root@phx5qa01c:/home/david# hostname -f     phx5qa01c.stratus.phx.qa.host.com      **UPDATE2:-** This is what I got after nslookup from my desktop -               david@desktop /cygdrive/c/ApacheExhibitor/Exhibitor-1.5.1/target     $ nslookup phx5qa01c.stratus.phx.qa.host.com     Non-authoritative answer:     Server:  sjd-entdc-001.corp.host.com     Address:  10.244.128.25          Name:    phx5qa01c.stratus.phx.qa.host.com     Address:  10.108.24.132


title: What is a windowing system?

text: Can someone provide me with a very clear and practical example of a "windowing system"? I was reading on Linux, and although I've always known that it's a kernel, I didn't really know what a kernel is because I haven't taken an OS class yet. My understanding of it is that it's basically the layer between hardware and software. Would that be correct? Now the Linux distros everyone uses is combination of GNU/Linux/X Window System. I think I got the Linux kernel part, but what is a windowing system and what is GNU? Wikipedia says GNU is an OS, but then that would mean Linux distros are composed of another OS. Can someone clear this up for me?


title: Utility for sending HTML mail with attachments to a long list of emails?

text: I'm in the middle of writing a Python program which simply sends the same HTML message with an attachment to a large list of email addresses (BCC). Is there a utility I could use to do this rather than writing something from scratch? The actual email message doesn't vary at all, I simply need to send the same HTML and same attachment to all emails. Does a Unix utility exist to provide this functionality?


title: How to install software in solaris?

text: How do I install NetBackUp software in solaris? I'm learning the software and I need to install and practice using it.


title: How to make new KVM with existing hard drive

text: I've been looking through the options of the QEMU binary, and I can't work this one out: Is it possible to make a new KVM machine with an existing hard drive image with an OS (XP Pro in this case) already installed? I have seen a guide online to turn my VirtualBox XP Pro hard drive (.vdi) into a qemu image (which I have done) but I can't seem to make a new KVM using this existing hard drive?


title: Substring only the first column in awk

text: I want to take first 500 characters of the first column and leave the rest of the columns as it is, using awk. This is what I am trying to do:               awk '{print ${$1:1:500} $2,$NF;}' doc.txt      But I get syntax error:               awk: {print ${$1:1:500} $2,$NF;}     awk:         ^ syntax error     awk: {print ${$1:1:500} $2,$NF;}     awk:                           ^ syntax error


title: Can separate unix accounts share a username but have separate passwords?

text: On unix systems, each separate user account has a unique username. Passwords, then, are not unique - every distinct user could have the same exact password. I want to do the converse. I want one username, but I want that login name to have multiple passwords. Depending on the password, you would either be logged into a different account (with a different UID) or you would simply have a different home directory. The goal is for two separate entities to share the same username but have their files be separate - in this case, file permissions between different UIDs are less important. Any thoughts on how to accomplish this, or something like it? Some abuse of /etc/shadow or PAM? Is this something that could be accomplished by writing a PAM module (I've never written one before. Is it very very hard?)


title: How to edit/delete a .dot_file on mac without using Terminal

text: When I start Terminal I can not control it. It starts executing an endless loop repeating that `some alias` does not exist. Because of this I am not able to edit this file using a program such as `vim`. Is there a way to update/delete `.bash_profile` and do not use Terminal at all, providing I have a replacement `.bash_profile`?.


title: Ubuntu 11.10 SFTP chroot jail problem

text: I am creating a SFTP server with Chroot Jail. The problem is user cannot log into the home directory. I need to keep `ChrootDirectory` value to one directory above the user's home directory (/home/jail/home in this case). I read that the directory needs to be owned by root. In that case user cannot do anything except logging into the server. Below is the sftp-specific part of my sshd_config file               Match User ftpuser         ChrootDirectory /home/jail/home/ftpuser         ForceCommand internal-sftp      Output of `$id ftpuser` is               uid=1001(ftpuser) gid=1002(ftpuser) groups=1002(ftpuser),0(root)      I have intentionally added it to the root group so that ftpuser can at least login. Output of `$grep ftpuser /etc/passwd` is               ftpuser:x:1001:1002::/home/jail/home/ftpuser:/bin/false      Permissions of /home/jail/home/ftpuser ared               rwx------+ 3 root root 4096 2011-12-12 12:49 /home/jail/home/ftpuser/      What should I do?


title: Why doesn't my iptables rule work?

text: I have two interfaces on my VPS: `eth0` and `eth0:0`. I want to block incoming packets on port 80 on `eth0:0` using iptables. I tried this, but it doesn't work:               iptables -A INPUT -i "eth0:0" -p tcp --destination-port 80 -j DROP      If I change `eth0:0` to `eth0` it works correctly. What is the problem?


title: How to delete 2 months back files in unix

text: Say I have below log files,               AA_XX_20130719185428.log     exec_xxx_cpb_20130712182453.log     13122013121327_AR_INC_DOBC_1.dprf.log     24122013_masterscript.LOG      Date part contains both date and time. I want to delete all the 2 months back files. I don't want to delete the file on the basis of last modified date but on the basis of the date included in the filename. The dates can be in any of these formats:   * YYYYmmddHHMMSS   * ddmmYYYYHHMMSS    * ddmmYYYY. How I can delete the files using shell script?


title: How can I know how long it takes to run updatedb daily job?

text: I'm using CentOS6.4 and `updatedb` is running as a daily job. What should I do if I want to know how long it takes for `updatedb` to run?


title: Vim delay when using Ctrl+C, but only in SQL files

text: I'm working on a side project with both JavaScript and SQL source files. When I'm editing the JavaScript, Vim behaves normally. However, when I'm editing the SQL files, there's about a one-second delay between when I press `Ctrl``C` and when Vim exits insert mode. When I use the Escape key, or `Shift``Enter` which I mapped in my `~/.vimrc` as a test, it shows no delay. I thought perhaps it was something to do with the syntax highlighting, but when I ran `:syntax off` to try and fix it, the delay still showed up. I also tried `:setf text`, which also did not work. I have only a couple of plugins installed (CtrlP, NerdTree, and highlighters for Jade, Less, and CoffeeScript) so I don't think that's what's interfering. Does anyone know what could be going on?


title: How to ensure SSH port is only open to a specific IP address?

text: This is my `/etc/sysconfig/iptables`: It has two ports open 80 apache and 22 for ssh.               # Firewall configuration written by system-config-firewall     # Manual customization of this file is not recommended.     *filter     :INPUT ACCEPT [0:0]     :FORWARD ACCEPT [0:0]     :OUTPUT ACCEPT [0:0]     -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT     -A INPUT -p icmp -j ACCEPT     -A INPUT -i lo -j ACCEPT     -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT     -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT     -A INPUT -j REJECT --reject-with icmp-host-prohibited     -A FORWARD -j REJECT --reject-with icmp-host-prohibited     COMMIT      For port 22 ( SSH ) I want to ensure no-one can connect to this port except for a specific ip address. example ip:               0.0.0.0      Please disregard any oversight/concerns regarding what if my ip changes and I can not SSH to my server any more.


title: How to change /var partition online?

text: I have a Linux server with `/var` in XFS and I want to change to EXT4. There is enough space in `/home`, so I can backup all files in `/var`. Is there a way to do it while the system in running ? I think `mount --bind` and `mount --move` can help, but I cannot find an example.


title: Weird authentication with Exchange server

text: I'm using Evolution with `evolution-mapi` to access an Exchange e-mail server.   It has worked flawlessly in the past, but recently it will fail to authenticate, asking my password endlessly. If I enter the correct password, it tells me that it is incorrect.   If I enter an incorrect password, it closes the prompt, but fails to obtain the mail from the inbox (due to the truly incorrect password). I fixed part of the issue by pointing my client to the server's IP address rather than its hostname, but it will still occasionally fail to send/receive e-mail. EDIT: What I can do: I am able to `ping` the server via its hostname and IP address with no packet loss. Since this is an internal server (or at least I'm accessing it via LAN), I have no reason to use a FQDN. I am able to use the server for its other functions, namely a network- mountable directory where we store shared files for work. The server appears to be fully operable. I'm under the impression that this issue is specific to Evolution or the MAPI plugin, or at least the versions thereof available in Ubuntu 14.04. EDIT 2: It seems to be on and off whether a certain session of Evolution will properly authenticate. Also, each time I enter my password, I am given the option to save the password to my keyring, but it never seems to actually save.


title: Fetching Remote Windows System Information From Linux Server

text: I need a script/command that would fetch Windows System Information (Host Name,User Name, Domain, OS Info, Hardware Info, Memory Info, processor Info, etc) by running it on a Linux Server (RHEL 6.5 preferably). I have already written a batch script using `wmic` that would record all above details and ran it on a Windows Server, but it won't work for Linux systems. A bash script with a series of `dmidecode` commands can fetch remote Linux systems' details, but all Windows systems will be skipped. In brief, the scope of using those scripts is limited to Windows-Windows or Linux-Linux environment. Is there any possible way with which we can fetch all the mentioned parameters of remote Windows systems by running a script on a Linux server or vice-versa?


title: Changing file permissions on an HFS+ filesystem

text: I ran the command `fdisk -l` to find out what my external drive is formatted to, I found out it's uses GPT partitions and the filesystem is HFS+. When I try and create a new folder on the external drive I receive the following message:               chmod: changing permissions of 'file_name/': Read-only file system      If I run `mount` this is the output:               /dev/sda1 on / type ext4 (rw,errors=remount-ro)     proc on /proc type proc (rw,noexec,nosuid,nodev)     sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)     none on /sys/fs/cgroup type tmpfs (rw)     none on /sys/fs/fuse/connections type fusectl (rw)     none on /sys/kernel/debug type debugfs (rw)     none on /sys/kernel/security type securityfs (rw)     udev on /dev type devtmpfs (rw,mode=0755)     devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)     tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)     none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)     none on /run/shm type tmpfs (rw,nosuid,nodev)     none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)     none on /sys/fs/pstore type pstore (rw)     systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd)     gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,user=dev)     /dev/sdc2 on /media/dev/andre backup type hfsplus (ro,nosuid,nodev,uhelper=udisks2)     /dev/sde2 on /media/dev/andre_clients type hfsplus (ro,nosuid,nodev,uhelper=udisks2)      So now I ran `umount /dev/sde2` and unplugged the device then reconnected the device and ran the command `dmesg | tail` and got this information back:               [429154.613747] sd 14:0:0:0: [sde] Assuming drive cache: write through     [429154.615995] sd 14:0:0:0: [sde] Test WP failed, assume Write Enabled     [429154.616993] sd 14:0:0:0: [sde] Asking for cache data failed     [429154.616997] sd 14:0:0:0: [sde] Assuming drive cache: write through     [429154.669277]  sde: sde1 sde2     [429154.671369] sd 14:0:0:0: [sde] Test WP failed, assume Write Enabled     [429154.672742] sd 14:0:0:0: [sde] Asking for cache data failed     [429154.672747] sd 14:0:0:0: [sde] Assuming drive cache: write through     [429154.672751] sd 14:0:0:0: [sde] Attached SCSI disk     [429157.047244] hfsplus: write access to a journaled filesystem is not supported, use the force option at your own risk, mounting read-only.      Would it now be safe to run `sudo mount -o remount,rw /dev/sde2 /media/dev/andre_clients` without loosing any infomation?


title: Debian doesn't detect disks from Live CD

text: I've loaded from the USB stick with Debian Live CD on it to fix the MBR after a Windows installation. Suddenly I've found that `fdisk -l` shows nothing but the live USB itself. What would it mean? I've used this image: http://cdimage.debian.org/debian-cd/current- live/i386/iso-hybrid/debian-live-6.0.5-i386-xfce-desktop.iso


title: How to safely replace a not-yet-failed disk in a Linux RAID5 array?

text: I have a software RAID5 array (Linux md) on 4 disks. **I would like to replace one of the disks with a new one, without putting the array in a degraded state** , and if possible, online. How would that be possible? It's important because I don't wan't to:   * take the risk of stressing the other disks so one may crash during rebuild,    * take the risk of being in a "no-parity state" so I don't have a safety net for some time.  I suppose doing so online is too much asking and I should just raw copy (`dd`) the data of the old disk to the new one _offline_ and then replace it, but I think it is theoretically possible... _Some context_ : Those disks have all been spinning almost continuously for more than 5.5 years. They still work perfectly for the moment and they all pass the (long) SMART self-test. However, I have reasons to think that one of those 4 disks will not last much longer (supposed predictive failure).


title: Linux Mint 13 Xfce window button disappeared & no mouse cursor in text mode

text: I am using Linux Mint 13 Xfce version on VBox. After one month without any problem suddenly today I noticed that the min-max-close buttons on all windows have disappeared. Secondly, I can write in gedit, but I cannot see the blinking mouse cursor while coding. It is somehow wierd. I tried:               sudo apt-get update     sudo apt-get upgrade but still it is the same problem.....


title: Send print job to printer immediately without queueing, aka increase print performance

text: I have a ruby/rails web application, one action of which sends PDF files that have been generated by the app to a Xerox 4127 printer on the network. This is accomplished via shelling out and running multiple lpr commands (to default print queue, using -s to prevent spooling copies and -o InputSlot to identify the tray). The PDF's cannot be combined into one single doc/printjob because they are sent to different trays depending on file specifics and the color of paper needed. A "cycle" might consist of 15k or more pages, sent to the printer in batches of 20 or 30 up to several hundred at a time. I set up the printer on the server as an lpd queue with the generic pcl 6 gutenprint driver. Xerox does not provide a Linux driver, but says it will work with lpd/lpr. And it does - I am able to send documents successfully, both manually from the command line and via the web application. This process was prototyped as a Windows program in Foxpro. The prototype generates a PDF for each page of the batch and sends it as an individual print job. Because the printer has a metric butt-ton of memory, the prototype just dumps job after job to the printer and allows the printer to manage them all, which it does very well. A batch of several hundred pages/print jobs queues into the printer almost immediately and the printer spits them out with little pause as if they were part of one giant document. My web application actually combines pages that are destined for the same tray one right after another into a single PDF, so I actually expected things to be faster, but they are not. By an order of magnitude, the process is much slower. A "cycle" that would take 8 hours to run in the prototype takes several days to get through in the web app. What appears to be happening is that the print jobs are not "dumping" to the printer like they do in the prototype. Monitoring the printer through it's onscreen utilities, we only see one print job showing up at a time. The print queue on the server seems to be waiting to send each print job until the printer signals back that the prior job is complete. As such, instead of everything spitting out constantly as if one document, we get a page, then a pause while the next file comes in, then a few pages, then a pause, then a page, then a pause, etc.... you get the idea. Is the print queue on the server actually waiting for the printer to say "done"? If so, is there anyway for me to configure it to just send, send, send and not wait for comms back from the printer? Two notes: the server is in another building, but we did some testing with a machine on the exact same sub-net as the printer and saw no measurable improvement, ie does not seem to be network related. Likewise, I'm aware that lpr is converting the PDF documents to postscript before sending, so I pre- converted them and tested the process without that. Some improvement in the queuing process at the server, not terribly significant, but no impact on the fact that only one job is going to the printer at a time, which I believe is the root problem.


title: find and globbing (and wildcards)

text: I tried finding some files (`*.e*`) that are in the same directory as another file (`md.tpr`). I needed to list them (for further processing) using the following:               find . -name md.tpr -execdir ls *.e* \;      I tried a few variants of this command and some others (including single quoting the command passed to `-execdir` or passing it as `sh -c 'ls *.e*'` or `eval 'ls *.e*'` to name a few). It appears that globbing is not working when passed to `-exec` or `-execdir`. The error I get when running the above command is:               ls: *.e*: No such file or directory      Just as a sanity check, I did `-execdir pwd` and it prints what it should, so it appears that it's a problem with globbing, as those `*.e*` files do exist in the directories listed with this test. Now, I was able to solve this problem in a much less elegant way but it just baffled me why globbing and wildcards wouldn't work here. Any ideas? Or am I completely off the track? I use bash 3.2.25 (old but I don't have admin rights on that system). Also, interestingly, if I do               find ~ -name .bashrc -maxdepth 2 -execdir ls -d .b* \;      it doesn't work unless it's done from `$HOME`.


title: locate java source code in jdk7

text: I have installed Jdk7 in Ubuntu 14.04 and it is successfully configured and I can use java libraries in code. The problem is that I am trying to locate java source code, but not able to find the jar file. The below part is updated -- I run the the following command in the location `/opt/sun/jdk7`               find . -name *.zip      It didn't find anything. Given that source code could be located in the location as Julien suggested.               $JAVA_HOME/src.zip      Here is what I did while installing jdk7               sudo apt-get install openjdk-7-jdk       and it downloaded the package `java-7-openjdk-amd64` which seems to not have something like src.zip. So now I got `jdk1.7.0_17` and I can find the source code in jdk1.7.0_17/src.zip


title: "database disk image is malformed"

text: Running `yum search something` I get:               Error: database disk image is malformed      How to fix?


title: Unresponsive desktop after resume from hibernation

text: After booting up my computer after hibernation (suspend to disk), my desktop is unresponsive for up to 15 minutes. I've found that the slowness is caused by the fact that all running applications seem to be swapped out to disk. For example, 3 GB of RAM may be in use when I suspend to disk. After resuming from hibernation, RAM usage is low (500 MB or so) and slowly everything will start to get swapped back into RAM. The problem does not occur with sleep (suspend to ram). Is there a problem with my setup (swap partition size, BIOS), or is this simply the way hibernation works in Linux? This answer seems to suggest that TuxOnIce may improve matters; is that possible? I'm running Arch Linux on a Toshiba Satellite L300-2CP with 4 GB of RAM and a 4 GB swap partition. **EDIT:** TuxOnIce (using the linux-pf kernel) indeed makes a huge difference, and basically solves the problem for me. I would find it hard to believe that what I was experiencing with the standard kernel (swsusp) hibernation is normal, however... **EDIT 2:** Of course TuxOnIce hangs now and then during hibernation.


title: How to force watch to run under bash

text: The problem is that when watch is executed it runs `sh` and I get this error:               sh: 1: func1: not found      here is the code:               #!/bin/bash          func1(){       echo $1     }          export -f func1          watch func1


title: Bash Script Permission denied & Bad Interpreter

text: I'm on a kali linux 64 bit. I have created a python script which takes 2 arguments to start. I don't want to type out every time the exact same paths or search in the history of the commands I used in terminal. So I decided to create a simple script which calls the python script with its arguments.               #! /bin bash          python CreateDB.py ./WtfPath ./NoWtfPath/NewSystem/      It is the exact same command I would use in terminal. However, I get an error message when I try to execute the script file.               bash: ./wtf.sh: /bin: bad interpreter: Permission denied      wtf.sh has executable rights. What is wrong?


title: Changing Locale

text: I am using Linux Mint 15 Currently I have my locale as (by using command `locale`):               LANG=en_US.UTF-8     LANGUAGE=     LC_CTYPE="en_US.UTF-8"     LC_NUMERIC=ar_SA.UTF-8     LC_TIME=ar_SA.UTF-8     LC_COLLATE="en_US.UTF-8"     LC_MONETARY=ar_SA.UTF-8     LC_MESSAGES="en_US.UTF-8"     LC_PAPER=ar_SA.UTF-8     LC_NAME=ar_SA.UTF-8     LC_ADDRESS=ar_SA.UTF-8     LC_TELEPHONE=ar_SA.UTF-8     LC_MEASUREMENT=ar_SA.UTF-8     LC_IDENTIFICATION=ar_SA.UTF-8     LC_ALL=      I want to change `ar_SA.UTF-8` to `en_IN.UTF-8`. How do i achieve this? Which file shold I be editing? Cant seem to find any locale file other than `/etc/locale.alias`


title: What to make of system scans reported by psad

text: My system logs show that `psad` detects scans like this every minute.               psad: scan detected: 192.168.1.10 -> 192.168.1.1 udp: [53] udp pkts: 2 DL: 2      If the first address is mine, and the second address is my router, then this would be a scan coming from my computer, correct? Is this anything to worry about?


title: sslserver using 100% cpu

text: I've a qmail setup with sslserver being used to secure the pop connections. Normally it runs very well, however some instances of sslserver start taking 100% cpu and its child process qmail-pop3d process is seen as zombie. The process has to be killed to solve the prb. The sslserver version is 0.70. OS is CentOs 6.0 64 bit with 2.6.32-220 kernel. Any clues how I can debug this ?


title: How to force Debian to wait for DHCP

text: I am running Debian squeeze in a virtual machine (VirtualBox). The machine has two interfaces:   * eth0 in "Host-only" mode so that the machine is accessible from the outside; and   * eth1 in "NAT" mode so that the machine can access the Internet. Furthermore, I am running dnsmasq on the host machine to assign static IP addresses to the virtual machines (VirtualBox provides IP addresses for NAT). The virtual machine runs sshd and mysql. At boot time, sometimes both services fail to start:               sshd[1145]: Set /proc/self/oom_adj from 0 to -17     sshd[1145]: Server listening on 0.0.0.0 port 22.     sshd[1145]: Server listening on :: port 22.     sshd[1145]: Received signal 15; terminating.     sshd[1299]: Set /proc/self/oom_adj from -17 to -17     sshd[1299]: Server listening on 0.0.0.0 port 22.     sshd[1299]: Server listening on :: port 22.     sshd[1301]: Set /proc/self/oom_adj from -17 to -17     sshd[1301]: error: Bind to port 22 on 0.0.0.0 failed: Address already in use.     sshd[1301]: error: Bind to port 22 on :: failed: Address already in use.     sshd[1301]: fatal: Cannot bind any address.      And:               mysqld: 121012 10:36:24 [ERROR] Can't start server: Bind on TCP/IP port: Cannot assign requested address     mysqld: 121012 10:36:24 [ERROR] Do you already have another mysqld server running on port: 3306 ?     mysqld: 121012 10:36:24 [ERROR] Aborting      I observed that each time the services fail, DHCPDISCOVER on eth0 comes _after_ the failure. When the services start successfully, DHCPDISCOVER comes _before_. I assume that Debian does not wait for both interfaces to have received an IP address. Is there any way to force Debian to wait for DHCP on both interfaces? **Update on request by user`warl0ck`** Contents of file `/etc/network/interfaces`                 # The loopback network interface       auto lo       iface lo inet loopback            # The primary network interface       allow-hotplug eth0       iface eth0 inet dhcp         # routing for VPN         post-up route add -net x.x.20.0 netmask 255.255.255.0 gw x.x.10.1         pre-down route del -net x.x.20.0 netmask 255.255.255.0 gw x.x.10.1                 # 2nd interface for NAT       allow-hotplug eth1       iface eth1 inet dhcp


title: Naming PPP interfaces

text: I have two PPP peers, dsl-line1 and dsl-line2 which are configured with pppd on Ubuntu (Server) Linux. They are brought up by the /etc/network/interfaces file with the auto thingy however each PPP connection chooses the name pppX where X varies depending on which comes up first. I would like to make it such that dsl-line1 comes up with a name such as "dsl0" and dsl-line2 with a name like "dsl1" so that I can create firewall rules more easily for each and set up routing (as well as having it easier to configure). My question is how can I get the pppd's interfaces to name themselves? /etc/ppp/peers/dsl-line1 (dsl-line2 is basically the same apart from the default route being removed and the ethernet interface being different)               noipdefault     defaultroute     replacedefaultroute     hide-password     #lcp-echo-interval 30     #lcp-echo-failure 4     lcp-echo-interval 10     lcp-echo-failure 3     noauth     persist     #mtu 1492     #persist     #maxfail 0     #holdoff 20     plugin rp-pppoe.so eth1     user "xxxx@xxxx.xxx"      /etc/network/interfaces (the line1 part, again, 2 is very similar)               auto dsl0     iface dsl0 inet ppp         pre-up /sbin/ifconfig eth1 up # line maintained by pppoeconf         post-up /bin/sh /home/callum/ppp0_up.sh # Route everything         post-up /bin/sh /etc/miniupnpd/ppp0_up.sh # Start miniupnpd (if not alr$         provider dsl-line1      Thanks in advance.


title: Can vim warn on a tabpagemax overflow?

text: If I open a collection of files in vim tabs using a glob pattern, I'd like to be warned if the number of files matching the pattern exceeds the value of `tabpagemax`. For example, if the following,               $ vi -p `find . -type f -name "*.tex"`      matches more files than `tabpagemax`, only `tabpagemax` tabbed documents are opened. I'd like a warning or error in this case. Can it be done?


title: Disconnect a disk correctly

text: I wanna disconnect a disk from an array which is the correct process   1. umount file system   2. remove from volume group   3. **i dont know this step**   4. disconnect physically the disk


title: How do I find out the pixel depth of my graphic card?

text: Is there a command that can tell me which my graphic card is and its pixel- depth? I am running vncserver and I would like to learn which is the best parameter for pixeldepth (-depth).


title: Open screen process in terminal from script

text: I have a minecraft server running in screen, and right now, it is just a script that starts java like so: `screen -dmS mc java -Xincgc -Xms1024M -jar craftbukkit-1.6.4-b2882.jar` Basically this just starts minecraft in a screen container in the background, and I can access it with `screen -r mc` through SSH. However, what I would like to do, is have the process always up on the server monitor, and also accessible through ssh with `screen -x mc`. Also, I have a restart.sh script that stuffs the stop command to the mc process every two hours, then it executes the start.sh script. The server is at runlevel 3, so I don't think `gnome-terminal -e "screen -x mc"` will work. Also, it seems like the restart script is starting mc outside of screen. When I SSH into the server, `screen -ls` turns up nothing, but the minecraft server process is running and I can connect to it. Here's the script:               #!/bin/sh          screen -x mc     screen -s mc stuff "say Server Restarting in 15 minutes."     screen -s mc -X eval "stuff \015"     sleep 600     screen -x mc     screen -x mc -X stuff "say Server restarting in 5 minutes."     screen -s mc -X eval "stuff \015"     sleep 240     screen -x mc     screen -s mc -X stuff "say Server restarting in 1 minute."     screen -s mc -X eval "stuff \015"     sleep 60     screen -S mc -X stuff "say Server restarting."     screen -S mc -X eval "stuff \015"     screen -S -X stuff "kickall Server Restarting, it should be back up in about a minute."     screen -S mc -X eval "stuff \015"     sleep 2     screen -S mc -X stuff "stop"     screen -S mc -X eval "stuff \015"     sleep 30     screen -wipe     sleep 3     cd /minecraft/server/craftbukkit     ./start.sh      Any ideas?


title: Command added to visudo still is failing on permissions?

text: My sudo file has two commands in it right now that are allowed to run without logging in as root. It looks like this:               user ALL=(root) NOPASSWD: /home/user/prog1.py     user ALL=(root) NOPASSWD: /home/user/prog2.py      The `prog1.py` file runs fine without password needed. The `prog2.py` file fails on permissions denied? The first program is only accessing a file to read that is root protected. The second program is creating a symlink and removing a root-protected file:               #!/usr/bin/env python     # -*- coding: utf-8 -*-          import os     from random import choice     from subprocess import Popen               def back_drop_change():         link = "/usr/share/slim/themes/default/background.jpg"         os.remove(link) # this is the line that returns permission denied         image_selection = list()         for di, _, fi in os.walk("/home/user/pictures/apod"):             for f in fi:                 image_selection.append(di + "/" + f)         bck_img = choice(image_selection)         Popen(["ln", "-s", bck_img, link])          if __name__ == "__main__":         back_drop_change()      I try adding `/usr/bin/rm /usr/share/slim/themes/default/background.jpg` to the visudo file but, it still fails? EDIT: Some extra information -- `sudo -l` returns:               Matching Defaults entries for user on this host:         env_reset, editor="/usr/bin/vim -p -X", !env_editor          User user may run the following commands on this host:         (ALL) ALL         (root) NOPASSWD: /home/user/Pidtrk/main.py         (root) NOPASSWD: /home/user/backdrop.py      and again, I am able to run `python2 Pidtrk/main.py` without errors but, not `python2 backdrop.py`. And both these files are owned by the same `User` and have the same `Permissions`. EDIT 2: I have both of `prog1.py` and `prog2.py` running in a `crontab` on `@reboot`. If I have this line in `crontab`:               `python2 /home/user/prog1.py >> err.log 2>&1`       without:               user ALL=(root) NOPASSWD: /home/user/prog1.py      Inside my sudoers file, the err.log shows `it failed with permissions denied`. Now when I add in this line to sudoers:               user ALL=(root) NOPASSWD: /home/user/prog1.py      The `prog1.py` runs fine on reboot, why is this any different for the `prog2.py` file?


title: Sort files by modification time

text: I've seen many questions and answers here using a construction along the lines of               list_dir=`ls -t /path/to/dir/`     for i in $list_dir; do      or               ls -t | while read i; do      Now, I know that you shouldn't use ls in scripts because it breaks easily; but I can't find a better way of operating on files in order from last-modified to most-recently-modified (or vice versa). I can use something like:               find . -type f -printf '%T@ %p\n' | sort -n | cut -d ' ' -f 2- | while read i; do...      ...but this will still break with any files that have newlines in their names, and is much uglier to boot. Is there a better way?


title: What are these commands for?

text: Yesterday I had to install a Windows with its Grub override. Well, it's not the first time I had to fix Grub, so I used LiveCD, mounted the root partition (I don't have boot, just `/` and `home`) and ran `grub-install --root-directory=/mnt/ /dev/sda`. However, it didn't work. After Googling a while I found a tutorial in which instead of just mounting the Linux partition, he also did `mount --bind /mnt/dev /dev` and `mount --bind /mnt/proc /proc/`. After that `chroot` to `/mnt` and then installed Grub, and using this method, it worked. What are the `mount --bind` commands for? I'm familiar with the usage of `\--bind used` (man page) but I do not know why it was used on this example.


title: How can I test whether the output from a command is null or empty string?

text: I'm trying to get a pre-commit hook script to work on our old SVN box. It's very old, running Ubuntu Server 8.04. This script: @echo off :: :: Stops commits that have empty log messages. ::               @echo off          setlocal          rem Subversion sends through the path to the repository and transaction id     set REPOS=%1     set TXN=%2          rem check for an empty log message     svnlook log %REPOS% -t %TXN% | findstr . > nul     if %errorlevel% gtr 0 (goto err) else exit 0          :err     echo. 1>&2     echo Your commit has been blocked because you didn't give any log message 1>&2     echo Please write a log message describing the purpose of your changes and 1>&2     echo then try committing again. -- Thank you 1>&2     exit 1      I think it's not working because the command findstr does not exist. What does work is this:               if [[ -n "" ]] ; then echo "yes"; else echo "no"; fi      So I changed the script to:               @echo off     ::     :: Stops commits that have empty log messages.     ::          @echo off          setlocal          rem Subversion sends through the path to the repository and transaction id     set REPOS=%1     set TXN=%2          rem check for an empty log message     ::svnlook log %REPOS% -t %TXN% | findstr . > nul     ::if %errorlevel% gtr 0 (goto err) else (goto exitgood)          ::svnlook log %REPOS% -t %TXN% | findstr . > ""     ::if %errorlevel% gtr 0 (goto err) else (goto exitgood)          SET LOG=`svnlook log %REPOS% -t %TXN%`          if [[ -n %LOG%  ]]; then             (goto exitgood)     else             (goto err)     fi          :err     echo. 1>&2     echo Your commit has been blocked because you didn't give any log message 1>&2     echo Please write a log message describing the purpose of your changes and 1>&2     echo then try committing again. -- Thank you 1>&2     exit 1          :exitgood     exit 0      But that doesn't work either, they both exit with code 255. Can somebody tell me what I'm doing wrong?


title: File to access for CPU load average on AIX

text: Is there a file with the load average in it on AIX? I'm looking for something like Linux's `/proc/loadavg`.


title: grep command. '^1' won't work

text: ttys000 -bash: cat n_modified.txt           1  calibre library          2  desktop          3  documents          4  downloads          5  library          6  movies          7  music          8  pictures          9  public         10  sites         11  myfirstdirectory         12  vasylgolub.conf         13  CALIBRE LIBRARY         14  DESKTOP         15  DOCUMENTS         16  DOWNLOADS         17  LIBRARY         18  MOVIES         19  MUSIC         20  PICTURES         21  PUBLIC         22  SITES         23  MYFIRSTDIRECTORY         24  VASYLGOLUB.CONF         25                          26                  27                    28                    29                  30                 31                32                   33                 34                35                           36            .             37  CALIBRE LIBRARY         38  DESKTOP         39  DOCUMENTS         40  DOWNLOADS         41  LIBRARY         42  MOVIES         43  MUSIC         44  PICTURES         45  PUBLIC         46  SITES         47  MYFIRSTDIRECTORY         48  VASYLGOLUB.CONF          ttys000 -bash: grep '^1' n_modified.txt           ttys000 -bash:      As above, `grep '^1' n_modified.txt` doesn't give me the sentences starting with 1. Why?


title: Cannot access elements of an array in zsh

text: I am trying to write a script in `zsh` and I need to make use of arrays in order to achieve my aim in an elegant way. After reading some information over the Net, I tried to implement and access the elements of array in the following way:               ### Script for running everything in screens ###     killall -15 screen ## We make sure that no screens are running for now     #bkgarr=(TopJets BosonJets DiBoson TTbar)     bkgarr=(1 2 3)          screen -dmS "MYSCREEN"     screen -S "MYSCREEN" -p 0 -X stuff 'echo "The array has ${#bkgarr[*]} of elements."^M'     screen -S "MYSCREEN" -p 0 -X stuff 'echo ${#bkgarr[0]}^M'      However, this did not work and the output I get is as follows:               ~/Summer_Students/nTupler_topness/tupleAnalyzer% echo "The array has ${#bkgarr[*]} of elements."     The array has 0 of elements.     ~/Summer_Students/nTupler_topness/tupleAnalyzer% echo ${#bkgarr[0]}     0      Furthermore, I need to have an array of strings like the one commented out in this minimal working example. I would be glad if someone can pinpoint my mistakes and why the array is apparently not stored in computers memory. Code edit:               ### Script for running everything in screens ###     killall -15 screen ## We make sure that no screens are running for now     #bkgarr=(TopJets BosonJets DiBoson TTbar)     bkgarr=(1 2 3)          screen -dmS "MYSCREEN"     screen -S "MYSCREEN" -p 0 -X stuff "$(typeset -p bkgarr)"$'\r'     #screen -S "MYSCREEN" -p 0 -X stuff 'bkgarr=(1 2 3)^M'     screen -S "MYSCREEN" -p 0 -X stuff 'echo "The array has ${#bkgarr[*]} of elements."^M'     screen -S "MYSCREEN" -p 0 -X stuff 'echo ${#bkgarr[0]}^M'      Output afterwards:               ~/Summer_Students/nTupler_topness/tupleAnalyzer% declare -a bkgarr='([0]="1" [1]="2" [2]="3")'     declare: bkgarr: can't assign initial value for array     ~/Summer_Students/nTupler_topness/tupleAnalyzer% echo "The array has ${#bkgarr[*]} of elements."     The array has 0 of elements.     ~/Summer_Students/nTupler_topness/tupleAnalyzer% echo ${#bkgarr[0]}     0     ~/Summer_Students/nTupler_topness/tupleAnalyzer%      Thanks in advance


title: Float operation with bc?

text: It looks like bc doesn't support float operations, when I do `echo 1/8 | bc` it get me a zero. I checked `bc (1)`, but it doesn't even mention `float`, so I wonder if it's supported?


When I try to mount an ISO image with `mount -o loop` I get > mount: could not find any free loop device Running `losetup -a` shows > /dev/loop0: [0005]:2464 (/dev/sda1)   >  /dev/loop1: [0005]:3439 (/dev/loop0)   >  /dev/loop2: [0005]:4482 (/dev/loop1)   >  /dev/loop3: [0005]:4486 (/dev/loop2)   >  /dev/loop4: [0005]:4490 (/dev/loop3)   >  /dev/loop5: [0005]:4494 (/dev/loop4)   >  /dev/loop6: [0005]:4498 (/dev/loop5)   >  /dev/loop7: [0005]:4502 (/dev/loop6) What is the purpose of a loop device which refers to `sda1`? And what is the purpose of all the other loop devices referring to the previous one? Is it safe for me to disconnect these loop devices so that I can use them? If so how do I do so? (Running `losetup -d /dev/loop[0-7]` gives `loop device is busy`.) If I cannot disconnect these, how do I create new loop devices that I can use for mounting ISO images? p.s. I am running Debian "wheezy" v 7.1.0.


title: How to generate Module.symvers?

text: I recently went through Unpacking kernel-source rpm off-system (OpenSuse)?; and as it took > 10 h on my machine, imagine my surprise that after doing the process described there, I find no `Module.symvers` anywhere! When I search for "generate Module.symvers", I get this: > NOTE: "modules_prepare" will not build Module.symvers even if   >  CONFIG_MODVERSIONS is set; therefore, a full kernel build needs to be   >  executed to make module versioning work.   >  (Linux Kernel Documentation :: kbuild : modules.txt) ... but I don't really get it - didn't the kernel get built in the previous step (described in the link given above? I sure know it took > 10 h for CC to generate a whole bunch of *.o files, and LD to link them, so something must have been built. But if so, where is then `Module.symvers`? In more explicit terms, exactly what command should I call to generate Module.symvers? I know that `make prepare` will not work - but what is the command that will?


title: Which applications use /usr/share/dict/words

text: I have changed the symlink `/usr/share/dict/words` to point to my own custom dictionary but it doesn't seem to affect anything. Chromium and Abiword neither seem to use this dictionary. Which appilications use `words`? Do I have to manually configure each application to use it? What is the point of having a system dictionary if applications are going to use their own anyway?


title: Is it possible to install a custom Linux on an Android phone?

text: I have an Xperia X8 phone, and I'd like to know if I can install a non-Android Linux OS on it? I would like to have a light Linux Distro, like Kolibri or something like that.


title: Choosing a filesystem for a shared disk (not a cluster filesystem like GFS)

text: I have a bunch of servers connected to a SAN. One server hosts the production database server, performing full database backups to a filesystem on a LUN that is exported to all servers. Only the "owner" (production server) has this filesystem mounted read-write. When the owner has performed a full backup, `sync` is called. The other hosts later mount this filesystem read-only, for quick access to the backup, for loading copies. This way I don't have the network as a bottleneck for transferring the backup. I have had this setup on Solaris for ages, with no glitches, on a plain UFS filesystem. Now I am going to set up the same on Linux (RHEL6), and want advice on what filesystem to pick. I'm thinking simpler is better, because I absolutely don't want any other host than the owner to make any changes whatsoever. No journal replay or other crazy stuff that can confuse the owners kernel if the on-disk structures stop matching what the kernel "knows" is there. I hope you understand my question. I've seen stuff happen (like journal replay) when mounting read-only filesystems on linux that worry me a bit. I'm looking for something simple. Not a cluster filesystem that requires handshaking and heartbeats. Only one node needs to write.


title: Centos directory server / 389 directory server - any differences?

text: I have very broad view that Redhat Directory Server, 389 Directory Server and Centos Directory Server are all the same. It's just the support you pay for on the RedHat version. Is this true? Are there any differences between Centos DS and 389 DS?


title: Xorg Configuration for Unregistered Resolution

text: I have a monitor with native resolution of `1600*900_60.00`, and the intel on board Gen3 Xeon video chipset `(i915)`.   when i do `$> xrandr` the `1600x900` resolution is not in the list. I tried to write an xorg configuration for monitor and I placed it on `/etc/X11/xorg.conf.d/10-monitor.conf`. but i must mess some value in there up; that it ha no effect and doesn't change the resolution.   I am sure the `/etc/X11/xorg.conf.d/10-monitor` is being read at `$> startx` because if i put anything wrong like `()*!` at that file **X** won't start and produce an error.   The `cvt 1600 900` returns:               1600x900 59.95 Hz (CVT 1.44M9) hsync: 55.99 kHz; pclk: 118.25 MHz      Modeline "1600x900_60.00"  118.25  1600 1696 1856 2112  900 903 908 934 -hsync +vsync      also the `xrandr` produce:               xrandr     Screen 0: minimum 320 x 200, current 1024 x 768, maximum 8192 x 8192     VGA1 connected 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm        1024x768       60.0*         800x600        60.3     56.2          848x480        60.0          640x480        59.9       HDMI1 disconnected (normal left inverted right x axis y axis)     DP1 disconnected (normal left inverted right x axis y axis)     HDMI2 disconnected (normal left inverted right x axis y axis)     HDMI3 disconnected (normal left inverted right x axis y axis)     DP2 disconnected (normal left inverted right x axis y axis)     DP3 disconnected (normal left inverted right x axis y axis)       1600x900_60.00�� (0xa5)  118.2MHz             h: width  1600 start 1696 end 1856 total 2112 skew    0 clock   56.0KHz             v: height  900 start  903 end  908 total  934        And this is my `10-monitor.config` file:               Section "Device"      Identifier  "Intel i915"        Option   "VGA1" #"VGA screen"        Driver      "intel"     EndSection      Section "Monitor"        Identifier  "Primary Monitor"        Modeline    "1600x900_60.00" 118.25 1600 1696 1856 2112  900 903 908 934 -Hsync +Vsync        Option      "PreferredMode" "1600x900"      EndSection      Section "Screen"           Identifier    "Screen0"           Device        "VGA1"           DefaultDepth  24           SubSection "Display"           Depth        24           Modes   "1600x900_60.00"      EndSubSection      EndSection


title: how to move (not copy) files from one server to another?

text: I want to move files from _server1_ to _server2_. A producer on _server1_ will keep generating the files, and a consumer on _server2_ will keep processing them. I can copy files using the following shell script:               rsync path/*.txt server2:/path      The extension of the files on the destination ( _server2_ ) will be changed from .txt to .done once they are processed, so if I run the command again, the files will once again copied (and processed) to the destination. Hence, I want to delete (or rename or move) the original files so that they won't be transferred again. I am using `rsync` version 2.6.3, which does not have --remove-source-files option. I am new to shell scripting, so please give an example.


title: Is it possible to log directly into chroot?

text: Lets say I boot up my computer and I see the login screen. When I log in as _myuser_ , I want to be restricted to a certain root directory via. `chroot`. Let's assume that the directory is `/chroots/myuser/`. Is this possible to do ? If so, how would it be accomplished ? **Note:**   Just to be clear, I want to change the root directory, not the home directory. The new root directory for the user will contain another OS like Debian.


title: Using ramfs on embedded system

text: I am required to write some software to run on Linux installed on an x86 based embedded setup that has a 8GB compact flash drive for data storage. The critical requirements are logging measurement data to file every 30 seconds, and robustness to power loss (my system **MUST** be able to reboot successfully every time and logging data must not get corrupted). I have used buildroot to generate my kernel, crosstools and file system. Currently I have tried 2 things   1. Booting up using only the `.cpio` file system provided by buildroot.   2. Copying the file system to an `ext3` partition and telling syslinux that the root file system is located there. If I use option 1. and have my root file system in RAM I will lose my data at power down. If I use option 2. then I run the risk of system files getting corrupted on power down. The answer to this question Is using a read only root file system a good idea for embedded setup? lead me to consider using a read only file system, but the only answer I have received is currently too advanced for my level of Linux expertise. This has lead me to consider using a RAM based file system. In the case of a RAM file system using the `.cpio` file to boot from, how could I possibly operate things so that I can ensure power down safety AND get persistent data storage for my data logging requirements ?


title: Why *not* parse `ls`?

text: I consistently see answers quoting this link stating definitively **_"Don't parse`ls`!"_** This bothers me for a couple of reasons:   1. It seems the information in that link has been accepted wholesale with little question, though I can pick out at least a few errors in casual reading.   2. It also seems as if the problems stated in that link have sparked no desire to find a solution. From the first paragraph: > ...when you ask `[ls]` for a list of files, there's a huge problem: Unix > allows almost any character in a filename, including whitespace, newlines, > commas, pipe symbols, and pretty much anything else you'd ever try to use as > a delimiter except NUL. ... `ls` separates filenames with newlines. This is > fine until you have a file with a newline in its name. And since I don't > know of any implementation of `ls` that allows you to terminate filenames > with NUL characters instead of newlines, this leaves us unable to get a list > of filenames safely with `ls`. Bummer, right? How _ever_ can we handle a newline terminated listed dataset for data that might contain newlines? Well, if the people answering questions on this websiite didn't do this kind of thing on a daily basis, I might think we were in some trouble. The truth is though, most `ls` implementations actually provide a very simple api for parsing their output and we've all been doing it all along without even realizing it. Not only can you end a filename with null, you can begin one with null as well or with any other arbitrary string you might desire. What's more, you can assign these arbitrary strings _per file-type_. Please consider:               LS_COLORS='lc=\0:rc=:ec=\0\0\0:fi=:di=:' ls -l --color=always | cat -A     total 4$     drwxr-xr-x 1 mikeserv mikeserv 0 Jul 10 01:05 ^@^@^@^@dir^@^@^@/$     -rw-r--r-- 1 mikeserv mikeserv 4 Jul 10 02:18 ^@file1^@^@^@$     -rw-r--r-- 1 mikeserv mikeserv 0 Jul 10 01:08 ^@file2^@^@^@$     -rw-r--r-- 1 mikeserv mikeserv 0 Jul 10 02:27 ^@new$     line$     file^@^@^@$     ^@      See this for more. Now it's the next part of this article that really gets me though:               $ ls -l     total 8     -rw-r-----  1 lhunath  lhunath  19 Mar 27 10:47 a     -rw-r-----  1 lhunath  lhunath   0 Mar 27 10:47 a?newline     -rw-r-----  1 lhunath  lhunath   0 Mar 27 10:47 a space      > The problem is that from the output of `ls`, neither you or the computer can > tell what parts of it constitute a filename. Is it each word? No. Is it each > line? No. There is no correct answer to this question other than: you can't > tell. > > Also notice how `ls` sometimes garbles your filename data (in our case, it > turned the `\n` character in between the words _"a"_ and _"newline"_ into a > _?question mark_... > > ... > > If you just want to iterate over all the files in the current directory, use > a `for` loop and a glob:               for f in *; do         [[ -e $f ]] || continue         ...     done      The author calls it _garbling filenames_ when `ls` returns a list of filenames containing shell globs **_and then_** recommends using a shell glob to retrieve a file list! Consider the following:               printf 'touch ./"%b"\n' "file\nname" "f i l e n a m e" |         . /dev/stdin     ls -1q          f i l e n a m e       file?name          IFS="     " ; printf "'%s'\n" $(ls -1q)          'f i l e n a m e'     'file     name'      POSIX defines the `-1` and `-q` `ls` operands so: > `-q` - Force each instance of non-printable filename characters and `<tab>`s > to be written as the question-mark ( `'?'` ) character. Implementations may > provide this option by default if the output is to a terminal device. > > `-1` - _(The numeric digit one.)_ Force output to be one entry per line. Globbing is not without its own problems - the `?` matches _any_ character so multiple matching `?` results in a list will match the same file multiple times. That's easily handled. Though how to do this thing is not the point - it doesn't take much to do after all and is demonstrated below - I was interested in _why not_. As I consider it, the best answer to that question has been accepted. I would suggest you try to focus more often on telling people what they _can_ do than on what they _can't._ You're a lot less likely, as I think, to be proven wrong at least. But why even try? Admittedly, my primary motivation was that others kept telling me I couldn't. I know very well that `ls` output is as regular and predictable as you could wish it so long as you know what to look for. Misinformation bothers me more than do most things. The truth is, though, with the notable exception of both Patrick's and Wumpus Q. Wumbley's answers _(despite the latter's awesome handle)_ , I regard most of the information in the answers here as mostly correct - a shell glob is both more simple to use and generally more effective when it comes to searching the current directory than is parsing `ls`. They are not, however, at least in my regard, reason enough to justify either propagating the misinformation quoted in the article above nor are they acceptable justification to " _never parse`ls`._" Please note that Patrick's answer's inconsistent results are mostly a result of him using `zsh` then `bash`. `zsh` - by default - does not word-split `$(`command substituted`)` results in a portable manner. So when he asks **_where did the rest of the files go?_** the answer to that question is **_your shell ate them._** This is why you need to set the `SH_WORD_SPLIT` variable when using `zsh` and dealing with portable shell code. I regard his failure to note this in his answer as awfully misleading. Wumpus's answer doesn't compute for me - in a list context the `?` character _is_ a shell glob. I don't know how else to say that. In order to handle a multiple results case you need to restrict the glob's greediness. The following will just create a test base of awful file names and display it for you:               { printf %b $(printf \\%04o `seq 0 127`) |     sed "/[^[-b]*/s///g             s/\(.\)\(.\)/touch '?\v\2' '\1\t\2' '\1\n\2'\n/g" |     . /dev/stdin          echo '`ls` ?QUOTED `-m` COMMA,SEP'     ls -qm     echo ; echo 'NOW LITERAL - COMMA,SEP'     ls -m | cat     ( set -- * ; printf "\nFILE COUNT: %s\n" $# )     }      ### OUTPUT               `ls` ?QUOTED `-m` COMMA,SEP     ??\, ??^, ??`, ??b, [?\, [?\, ]?^, ]?^, _?`, _?`, a?b, a?b          NOW LITERAL - COMMA,SEP     ?      \, ?          ^, ?              `, ?                  b, [       \, [     \, ]    ^, ]     ^, _    `, _     `, a    b, a     b          FILE COUNT: 12      Now I'll safe every character that isn't a `/slash`, `-dash`, `:colon`, or alpha-numeric character in a shell glob then `sort -u` the list for unique results. This is safe because `ls` has already safed-away any non printable characters for us. Watch:               for f in $(             ls -1q |             sed 's|[^-:/[:alnum:]]|[!-\\:[:alnum:]]|g' |             sort -u | {                     echo 'PRE-GLOB:' >&2                     tee /dev/fd/2                     printf '\nPOST-GLOB:\n' >&2             }     ) ; do             printf "FILE #$((i=i+1)): '%s'\n" "$f"     done      ### OUTPUT:               PRE-GLOB:     [!-\:[:alnum:]][!-\:[:alnum:]][!-\:[:alnum:]]     [!-\:[:alnum:]][!-\:[:alnum:]]b     a[!-\:[:alnum:]]b          POST-GLOB:     FILE #1: '?                \'     FILE #2: '?                ^'     FILE #3: '?                `'     FILE #4: '[     \'     FILE #5: '[     \'     FILE #6: ']     ^'     FILE #7: ']     ^'     FILE #8: '_     `'     FILE #9: '_     `'     FILE #10: '?                 b'     FILE #11: 'a    b'     FILE #12: 'a     b'      Below I approach the problem again but I use a different methodology. Remember that - besides `\0`null - the `/` ASCII character is the only byte forbidden in a pathname. I put globs aside here and instead combine the POSIX specified `-d` option for `ls` and the also POSIX specified `-exec $cmd {} +` construct for `find`. Because `find` will only ever naturally emit one `/` in sequence, the following easily procures a recursive and reliably delimited filelist including all dentry information for every entry. Just imagine what you might do with something like this:               #v#note: to do this fully portably substitute an actual newline \#v#     #v#for 'n' for the first sed invocation#v#     cd ..     find ././ -exec ls -1ldin {} + |     sed -e '\| *\./\./|{s||\n.///|;i///' -e \} |     sed 'N;s|\(\n\)///|///\1|;$s|$|///|;P;D'          ###OUTPUT          152398 drwxr-xr-x 1 1000 1000        72 Jun 24 14:49     .///testls///          152399 -rw-r--r-- 1 1000 1000         0 Jun 24 14:49     .///testls/?                 \///          152402 -rw-r--r-- 1 1000 1000         0 Jun 24 14:49     .///testls/?                 ^///          152405 -rw-r--r-- 1 1000 1000         0 Jun 24 14:49     .///testls/?             `///     ...      `ls -i` can be very useful - especially when result uniqueness is in question.               ls -1iq |      sed '/ .*/s///;s/^/-inum /;$!s/$/ -o /' |      tr -d '\n' |      xargs find      These are just the most portable means I can think of. With GNU `ls` you could do:               ls --quoting-style=WORD      And last, here's a much simpler method of _parsing`ls`_ that I happen to use quite often when in need of inode numbers:               ls -1iq | grep -o '^ *[0-9]*'      That just returns inode numbers - which is another handy POSIX specified option.


title: Public key not found for RPM

text: I am trying to install package on Redhat 5.5 using YUM but it always give me this error               [root@redhat64 Desktop]# yum install perl-Net-Server-0.97-1.el5.rf.noarch.rpm   Loaded plugins: rhnplugin, security     This system is not registered with RHN.     RHN support will be disabled.     Setting up Install Process     Examining perl-Net-Server-0.97-1.el5.rf.noarch.rpm: perl-Net-Server-0.97-1.el5.rf.noarch     Marking perl-Net-Server-0.97-1.el5.rf.noarch.rpm to be installed     Resolving Dependencies     --> Running transaction check     ---> Package perl-Net-Server.noarch 0:0.97-1.el5.rf set to be updated     --> Finished Dependency Resolution          Dependencies Resolved          ================================================================================      Package           Arch      Version          Repository                                Size     ================================================================================     Installing:      perl-Net-Server           noarch    0.97-1.el5.rf    /perl-Net-Server-0.97-1.el5.rf.noarch    357 k          Transaction Summary     ================================================================================     Install       1 Package(s)     Upgrade       0 Package(s)          Total size: 357 k     Is this ok [y/N]: y     Downloading Packages:     warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 6b8d79e6               Public key for perl-Net-Server-0.97-1.el5.rf.noarch.rpm is not installed      Note :: OS is 5.5 64bit running on virtual box and I have set GPGCHECK=0 in local YUM repository. # Output of Repository               [root@redhat64 ~]# cat /etc/yum.repos.d/* | grep -v "^#"     [rhel-debuginfo]     name=Red Hat Enterprise Linux $releasever - $basearch - Debug     baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/$basearch/Debuginfo/     enabled=0     gpgcheck=1     gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release          [rhel-debuginfo-beta]     name=Red Hat Enterprise Linux $releasever Beta - $basearch - Debug     baseurl=ftp://ftp.redhat.com/pub/redhat/linux/beta/$releasever/en/os/$basearch/Debuginfo/     enabled=0     gpgcheck=1     gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release     [rhel-local.repo]     name=Local Repo     Baseurl=file:///RPMS     enabled=1     gpgcheck=0      Im using the Local.repo as my main packages repository


title: How to change variable color in vim solarized theme?

text: I have just installed solarized theme for vim from https://github.com/altercation/vim-colors-solarized But the problem for me is that the background stays black and I have the variable names in really dark blue color. Like so : ![enter image description here](http://i.stack.imgur.com/b0oU5.png) Does anyone know how to change that to ? (namely: where it is stored in the theme ?)


title: Use Synaptic Package Installer by default

text: I'm running elementary 0.2 and whenever I open a .deb, it opens in Ubuntu Software Center. Is there any way to make it open in Synaptic instead? I just prefer Synaptic; quicker, easier to use.


title: Execute multiple bash commands on the output of find

text: I want to execute some commands using the find -exec option, but I'm not sure what' wrong with this code. Currently, it's only processing the first find result, then getting stuck. I'm using bash in OS X.               read -e DIRECTORY          find $DIRECTORY -type f -name '*.mov' -exec sh -c '       file="$0"       echo "Processing $file ..."       modmovie -notrack "Timecode Track" $file -save-in-place       read line </dev/tty     ' {} \;


title: How can I test whether a block device is read-only from /sys or /proc?

text: On a CentOS6 system I have `/dev/block/sr0` (read only) and `/dev/block/sda` (read/write). How can I find out programmatically which devices are read-only? There is a `ro` file in there, but it's '0' for both devices. There are some hacks I could use (compare names `^sr` vs `^sd`, look for `cdrom` ownership of device node), but I'd like to have a generic solution.


title: sshfs - device not found

text: After updating the server with `apt-get update && apt-get upgrade` this command return an error # OS               Debian 3.2.60-1+deb7u3 x86_64 (wheezy)      # command               echo "the-password" | sshfs root@domain.com:/var/www /remote_mount -o password_stdin      # error               fuse: device not found, try 'modprobe fuse' first      # modprobe fuse               root@dyntest-amd-3700-2gb ~ # modprobe fuse     modprobe: ERROR: could not insert 'fuse': Unknown symbol in module, or unknown parameter (see dmesg)          root@dyntest-amd-3700-2gb ~ # dmesg | grep fuse     [   20.126156] fuse: Unknown symbol nosteal_pipe_buf_ops (err 0)     [1607702.343086] fuse: Unknown symbol nosteal_pipe_buf_ops (err 0)     [1607745.824310] fuse: Unknown symbol nosteal_pipe_buf_ops (err 0)     [1607908.188559] fuse: Unknown symbol nosteal_pipe_buf_ops (err 0)     [1608724.690945] fuse: Unknown symbol nosteal_pipe_buf_ops (err 0)     [1608741.684927] fuse: Unknown symbol nosteal_pipe_buf_ops (err 0)     [2565283.964259] fuse: Unknown symbol nosteal_pipe_buf_ops (err 0)      # Kernel version               root@dyntest-amd-3700-2gb ~ # cat /proc/version     Linux version 3.2.0-4-amd64 (debian-kernel@lists.debian.org) (gcc version 4.6.3 (Debian 4.6.3-14) ) #1 SMP Debian 3.2.54-2          root@dyntest-amd-3700-2gb ~ # locate -i -r /fuse     /bin/fuser     /bin/fusermount     /etc/fuse.conf     /lib/modules/3.2.0-4-amd64/kernel/fs/fuse     /lib/modules/3.2.0-4-amd64/kernel/fs/fuse/cuse.ko     /lib/modules/3.2.0-4-amd64/kernel/fs/fuse/fuse.ko     /lib/modules-load.d/fuse.conf     /usr/include/boost/fusion/functional/adapter/fused.hpp     /usr/include/boost/fusion/functional/adapter/fused_function_object.hpp     /usr/include/boost/fusion/functional/adapter/fused_procedure.hpp     /usr/include/boost/fusion/include/fused.hpp     /usr/include/boost/fusion/include/fused_function_object.hpp     /usr/include/boost/fusion/include/fused_procedure.hpp     /usr/include/linux/fuse.h     /usr/share/bash-completion/completions/fusermount     /usr/share/doc/fuse     /usr/share/doc/fuse/changelog.Debian.gz     /usr/share/doc/fuse/changelog.gz     /usr/share/doc/fuse/copyright     /usr/share/initramfs-tools/hooks/fuse     /usr/share/lintian/overrides/fuse     /usr/share/man/man1/fuser.1.gz     /usr/share/man/man1/fusermount.1.gz     /var/cache/apt/archives/fuse_2.9.0-2+deb7u1_amd64.deb     /var/cache/apt/archives/fuse_2.9.3-14_amd64.deb     /var/cache/apt/archives/fuse_2.9.3-15_amd64.deb     /var/cache/apt/archives/fuse_2.9.3-9_amd64.deb     /var/lib/dpkg/info/fuse.conffiles     /var/lib/dpkg/info/fuse.list     /var/lib/dpkg/info/fuse.md5sums     /var/lib/dpkg/info/fuse.postinst     /var/lib/dpkg/info/fuse.postrm     /var/lib/dpkg/info/fuse.preinst      # update               root@dyntest-amd-3700-2gb ~ # apt-get install --reinstall linux-image-generic linux-image     Reading package lists... Done     Building dependency tree     Reading state information... Done     Package linux-image is a virtual package provided by:       linux-image-3.2.0-4-rt-amd64 3.2.60-1+deb7u3       linux-image-3.2.0-4-amd64 3.2.60-1+deb7u3     You should explicitly select one to install.          E: Unable to locate package linux-image-generic     E: Package 'linux-image' has no installation candidate


title: How to remap keycodes via setkeycodes?

text: I'm trying to change keycodes of some keys, but I don't get one thing. If I use `/lib/udev/keymap`, I get the following output:               # /lib/udev/keymap -i input/event1     scan code: 0xC022D   key code: zoomin     scan code: 0xC022E   key code: zoomout      The keys aren't visible in Xserver because they both have keycodes >255:               # evtest          Event: time 1396340441.362876, type 4 (EV_MSC), code 4 (MSC_SCAN), value c022d     Event: time 1396340441.362876, type 1 (EV_KEY), code 418 (KEY_ZOOMIN), value 1     Event: time 1396340441.362876, -------------- SYN_REPORT ------------     Event: time 1396340441.458872, type 4 (EV_MSC), code 4 (MSC_SCAN), value c022d     Event: time 1396340441.458872, type 1 (EV_KEY), code 418 (KEY_ZOOMIN), value 0     Event: time 1396340441.458872, -------------- SYN_REPORT ------------     Event: time 1396340443.442873, type 4 (EV_MSC), code 4 (MSC_SCAN), value c022e     Event: time 1396340443.442873, type 1 (EV_KEY), code 419 (KEY_ZOOMOUT), value 1     Event: time 1396340443.442873, -------------- SYN_REPORT ------------     Event: time 1396340443.602877, type 4 (EV_MSC), code 4 (MSC_SCAN), value c022e     Event: time 1396340443.602877, type 1 (EV_KEY), code 419 (KEY_ZOOMOUT), value 0     Event: time 1396340443.602877, -------------- SYN_REPORT ------------      I can add a `udev` rule:               KERNEL=="event*", ACTION=="add", SUBSYSTEM=="input", SUBSYSTEMS=="usb", ENV{ID_VENDOR_ID}=="046d", ENV{ID_MODEL_ID}=="c30f", RUN+="/lib/udev/keymap $name /lib/udev/keymaps/logitech-media-keyboard-elite"      and entries in the `logitech-media-keyboard-elite` file look like this:               0xC022D     PROG3   # zoom in     0xC022E PROG4   # zoom out      But there's also `setkeycodes`, and it has to be used in the following way: > setkeycodes scancode keycode I also aded the `atkbd.softraw=0` parameter to the kernel line in order to see real scancodes. But when I use the scancode provided by `/lib/udev/keymap`, it doesn't work:               # setkeycodes 0xC022D 200     KDSETKEYCODE: Invalid argument     failed to set scancode b22ad to keycode 200      According to `showkey -s`, there's no scancode, at least in the case of the two keys, but other keys have something like this:               # showkey -s     a0x1e     0x9e      and `/lib/udev/keymap` shows something different:               scan code: 0x70004   key code: a      Is `setkeycodes` somehow obsolete and shouldn't be used, or am I doing something wrong? Maybe is there a way to translate the codes?


title: Checking the Speed of Active Network Connections

text: In Ubuntu 12.04 LTS, there is a window called "Active Network Connections", and in there is a label called `Speed`. How can I get Ubuntu to do a speed check? I know of websites I can use to check the speed of my network, but that won't be logged in this window... or will it? As you can see in the attached screenshot, there is a label called `Speed` and it says it is `Unknown`. ![Active Network Connections](http://i.stack.imgur.com/hLzvK.gif)


title: How to access windows file server from linux

text: We have a windows file server with an address like this:               \\bioinf-filesrv2.mycompany.fr\cluster15      How can I access it from Linux? On a Ubuntu 14.04 I tried to access this through nautilus, but it crashed. Here is the crash report: http://pastebin.mozilla.org/5533388


title: Mail send to my domain ends up in local inbox instead of exchange server

text: I'm running a MediaWiki install under Ubuntu Server 10.10. I have configured it to use the standard php `mail()` function with my local mail delivery agent (postfix). The mail gets sent from the MediaWiki site, but the only problem is that whenever the address it's meant to be sent to is on the same domain as the server, those mails get delivered to local inboxes on the Ubuntu server. So basically, the server is `linuxbox.companydomain.com`, and our e-mails are `name@companydomain.com`. Any mail sent to an address like that simply ends up in the user's local inbox, e.g. a message to `anders@companydomain.com` ends up in `/home/anders/mbox`, while a message to `anders@gmail.com` would end up in the correct gmail inbox. How do I prevent this from happening?


title: Port multiplexer sslh: why is it so resource-intensive?

text: I've just discovered the existence of `sslh`. I tried to install it on my 512MB RAM VPS running Debian 7 wheezy. After having configured `sslh`, I tried to connect to one of my apache2 virtual hosts, and immediately the cpu usage went up to 50-60%, even ssh-ing the VPS was almost impossible due to the lack of resources.   * Is this normal?   * Is there any valid alternative? The problem I was trying to solve using `sslh` is that many free wifi hotspots block almost every port, except 80 and 443, and I often need to use OpenVPN to connect to my home server, which is natted by my ISP. Do you have any other solution to suggest?


title: Save password for Windows Samba server for printing in Gnome?

text: Unfortunately for us Linux users, our University printer works over the Samba protocoll. After configuring it in CUPS I can print, but I have to enter username and password everytime with no option to save. I also used the `username:password@adress` syntax, but to no avail. The gnome key manager also does not seem to be used there. Is there any way to save the credentials? I use Arch Linux 3.15.3-1-ARCH with GNOME Shell 3.12.2.


title: vi[m] read range of lines from another file

text: On Linux, editing `file_B` in vim I want to add line 10-25 from `file_A`. Example: One has a whole set of HTML-Documents with quite the same header and yes, one could create a template and start from there, but still: I am looking for **a simple [and elegant] way to insert a range of lines from one file and add it to the file I am currently editing. In vim.** The solutions I found so far but **are not exactly** what I'm looking for, are   * _inside_ `file_B` the command `:read file_A` will add *the whole file_A* into file_B. Too much   * there is copy&paste inside vim - but for this one must have opened `file_A`   * _inside_ file_A `:10,25w! file_B` will 'send' the given range of lines to `file_B`.   This seems quite close to copy&paste   * one can open multiple windows in vim   But as I work on an 8inch screen, multiple windows make orientation hard As I wasn't able to find a comfortable solution I wonder if I just misunderstood something or the ways I found so far are commonly used and taken as the standard way.


title: How to get notification from upower when UPS is on battery

text: I have a Fedora Core 19 system powered via a desk-side UPS. I've connected the UPS' USP port to the FC19 system, and it was apparently recognized, as upower -d now reports its presence:                ups          present:             yes          state:               fully-charged          time to empty:       1.3 hours          percentage:          100%      I'd like to have a script run for power state changes (on battery, on line power, etc.) The documentation for upower is pretty sketchy and I can't find any reference to hooks for running scripts for these events; is this possible?


title: Script to show number of files (by file type) in a directory?

text: I want to show this kind of statistics about a particular directory:               $ myscript.sh     .c 34265 files     .h 17866 files     .cbl 1804 files     .pco 389 files     [...]      Is there a tool that can do this? Here is my attempt:               find . -name "*.*" | sed -e "s/.*\.//g" | sort -u      And then I could type for each type `find . -name "*.pc" | wc -l` but it is bothersome so I wrote:               find . -name "*.*" | sed -e "s/.*\.//g" | sort -u |\         xargs find . -name "*.{}" | wc -l      Unfortunately I must be missing something because it says:               find: paths must precede expression: as      ("as" is the first extension)   Any idea what is going wrong?   Is there already a tool that does what I want (a tool counting file lines would be OK too).


title: Time synchronization in XFCE 4.8

text: Apparently there is no gui in XFCE (as there was in gnome) to synchronize time with NTP (if there is one, please let me know the name of the application). So, how can I synch with the time servers? (I'm using Debian wheezy)


title: Real Time Local File Sync

text: How can I set up an _instant_ file sync for two local directories? The catch is I need it in real time (15, 10 or even 5 seconds is too slow), and I don't want the target root directory created. For example, something similar to...               cp -fr sourcea/* /some/destdir     cp -fr sourceb/* /some/destdir     cp -fr sourcec/* /some/destdir      Catching deletions would be nice too, though it's not a deal breaker. I do not want the "sourcex" created within destdir. (hence the *). I've tried using rsync, which apparently wasn't close or even close to real-time, as well as several generic sync systems. However, most will want a 1 to 1 sync, rather than contents only. Any suggestions? I've been fighting this for a while now, so any help would be greatly appreciated!


title: smbclient alternative for large files

text: I'm using smbclient to transfer a set of large files (80GB) nightly from a Linux system to a Windows share. Lately, for whatever reason, I've been getting I/O timeouts:               cli_push returned NT_STATUS_IO_TIMEOUT      which causes the active file transfer to be aborted and deleted from the Windows share. This may be due to unresolved Samba bug 8498 (or maybe not). The Windows system is not under my control, so I can't install an ssh server (to use scp or sftp), and do not want to depend on Microsoft's implementation of NFS. Is there another simple, standard alternative that would let me move 80GB of data reliably from Linux to Windows over the network on a regular basis (the network is GB ethernet, so bandwidth isn't a problem)?


title: Problem with LD_LIBRARY_PATH, program can't find a libraray.

text: I have already asked this question on stackoverflow, but it's also a linux related question and somebody here might know a solution. Hope it's okay. Problem is that I can't run 3D visualisation in Paraprof program on ARM Linux. I am running a small cluster (8 nodes) using armhf Debian Wheezy 7.1 with OpenMPI. I am using Tau OpenMPI profiling tool and it's got a very nice visualising tool called Paraprof. I have a problem with 3D visualisation with paraprof. When I try to run it it says that:               /home/cluster/tool/tau-2.22.2/lib/libjogl_drihack.so :/home/cluster/tool/tau-2.22.2/lib/libjogl_drihack.so cannot open shared object: No such file or directory      I think it's a problem with libraries paths settings, because the path is doubled. Interestingly libjogl_drihack.so is in this directory. LD_LIBRARY_PATH is set correctly as:               /usr/local/lib/:/home/cluster/tools/tau-2.22.2/arm_linux/lib/      OpenGL is installed (I can run glxinfo) and all libjogl packages. Attaching screenshots. https://www.dropbox.com/s/x54xpo5c2kjzew8/tau1.png https://www.dropbox.com/s/mimze22pcl6vxkq/tau2.png Some more info:               root@master:~# ldd     /home/cluster/tools/tau-2.22.2/arm_linux/lib/libjogl_drihack.so         not a dynamic executable     root@master:~# ls /home/cluster/tools/tau-2.22.2/arm_linux/lib/lib*.so     /home/cluster/tools/tau-2.22.2/arm_linux/lib/libjogl_awt.so     /home/cluster/tools/tau-2.22.2/arm_linux/lib/libjogl_drihack.so     /home/cluster/tools/tau-2.22.2/arm_linux/lib/libjogl.so     /home/cluster/tools/tau-2.22.2/arm_linux/lib/libTauDisable.so     /home/cluster/tools/tau-2.22.2/arm_linux/lib/libTAUsh-depthlimit-mpi-pdt.so     /home/cluster/tools/tau-2.22.2/arm_linux/lib/libTAUsh-depthlimit-mpi-pdt-trace.so     /home/cluster/tools/tau-2.22.2/arm_linux/lib/libTAUsh-mpi-pdt.so     /home/cluster/tools/tau-2.22.2/arm_linux/lib/libTAUsh-mpi-pdt-trace.so     /home/cluster/tools/tau-2.22.2/arm_linux/lib/libTAUsh-param-mpi-pdt-profile-trace.so     /home/cluster/tools/tau-2.22.2/arm_linux/lib/libTAUsh-param-mpi-pdt.so     /home/cluster/tools/tau-2.22.2/arm_linux/lib/libTAUsh-pthread-pdt.so     /home/cluster/tools/tau-2.22.2/arm_linux/lib/libTAUsh-pthread.so     /home/cluster/tools/tau-2.22.2/arm_linux/lib/libTAUsh.so     /home/cluster/tools/tau-2.22.2/arm_linux/lib/libTAU.so     root@master:~# uname -a     Linux master 3.8.13-bone26 #1 SMP Fri Aug 16 20:56:24 UTC 2013 armv7l GNU/Linux     root@master:~#      OpenGL:               root@master:~$ glxinfo | grep OpenGL     OpenGL vendor string:Mesa Project     OpenGL renderer string: Software Rasterizer     OpenGL version string: 2.1 Mesa 8.0.5     OpenGL shading language version string: 1.20     OpenGL extensions      The configuration script for Tau, was looking for libGL.so in /usr/lib directory, on my system this file is in /usr/lib/arm-linux-gnueabihf so i copied it to the /usr/lib, but still no luck. The same error persits.


title: I've wiped my partition table using gparted, is there a way to recover my partition?

text: I've wiped my NTFS (windows) partition table using gparted by clicking on "Device->Create Partition Table... and then apply", is there a way to recover my NTFS partition? I tried using this command `gpart /dev/sda` I get the following out put:               Begin scan...     End scan.          Checking partitions...     Ok.          Guessed primary partition table:     Primary partition(1)     type: 000(0x00)(unused)     size: 0mb #s(0) s(0-0)     chs:  (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r          Primary partition(2)     type: 000(0x00)(unused)     size: 0mb #s(0) s(0-0)     chs:  (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r          Primary partition(3)     type: 000(0x00)(unused)     size: 0mb #s(0) s(0-0)     chs:  (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r          Primary partition(4)     type: 000(0x00)(unused)     size: 0mb #s(0) s(0-0)     chs:  (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r      What does this output mean? Is there a way I can recover?


title: One X Client Many X Servers

text: I have an X client and I would like to display it on many servers (with different IPs), is it possible with X Display? EDIT: Simple situation I have in network some hosts: 192.168.0.1 192.168.0.2 192.168.0.3 From host 192.168.0.1 I would like to run 'firefox' and display them (only display! no control from remote hosts) in 192.168.0.2 and in 192.168.0.3. One solutions that I've found is to use ffmpeg to screencast and broadcast it , but it is for sure less efficient then forwarding X, and also doesn't allow to broadcast more than one program.


title: -bash: /usr/sbin/useradd: Input/output error — What does this mean?

text: Today, on my Centos server I tried to add a user but got the following error:               -bash: /usr/sbin/useradd: Input/output error      How do I fix it?


title: Is my SSD broken?

text: /bin/ls: cannot access cache-zch-5666-cache.txt: Input/output error     /bin/ls: cannot access cache-zch-4970-cache.txt: Input/output error     /bin/ls: cannot access cache-zch-4782-cache.txt: Input/output error     ./   cache-zch-4782-cache.txt  cache-zch-5666-cache.txt     ../  cache-zch-4970-cache.txt     root@host [/home2/investgr1/public_html/hello/cache/zch]# rm *     rm: cannot remove `cache-zch-4782-cache.txt': Input/output error     rm: cannot remove `cache-zch-4970-cache.txt': Input/output error     rm: cannot remove `cache-zch-5666-cache.txt': Input/output error     root@host [/home2/investgr1/public_html/hello/cache/zch]#     **      What does input/output error mean>? How do I make sure that it's broken. So far only a few file. I am wondering if something more profound happen Is there a way to prove to my provider that it's indeed a problematic SSD? Also, can I try to just reformat the disk? I am concern that there is a bad sector on that disk. My host said: > We will only replace the drive if we can identify a problem with it. The > permissions error you encountered is not an indicator of a failed drive. > > If you require any further assistance feel free to update this ticket.


title: input/output error that come back just fine. How to make sure it doesn't happen again?

text: root@host [/backup/2013-08-15/accounts]# cd /home1     root@host [/home1]# ls     /bin/ls: reading directory .: Input/output error     root@host [/home1]#      Suddenly /home1 doesn't work. It used to work just fine. Yes I put one of my most demanding sites there. Then I started getting these errors. Is it possible that the disk can't handle the load? My provider insist that it's user's error though > Actually, I think this was a case of user error. Your hard drives are all > fine, and I've confirmed I am able to read and write files to all mounted > partitions (/home, /home1, /home2, /home3 and /home4). I did need to run an > fsck to fix several errors on your filesystem, and it also appears you have > a whole load of unresolved links leading all over your system (fsck tried to > clear some of these manually, all may not have been fixed). This system > appears to have been very poorly maintained, however as of right now all > disks and all filesystems are accessible. I will put this system back online > shortly and let you know when I've confirmed it is back online. So we have a system that's working just fine for now and then suddenly crash for no reason. After doing some check my host provider says that NOTHING is wrong with the server. I got my server back and yea everything is working. How can this happen? So after all those checks and reboot, the server is running fine, including the drive. However, I am afraid of moving stuff to the server again. If it broke again it can cost me hundreds of dollars. What should I do to make sure nothing else go wrong? How com input/output is in error but then it works again just fine now? What kind of error is this that works now and then fail latter? Call dmesg and got this: I run dmesg and this is what I see: EXT4-fs (sda1): warning: mounting fs with errors, running e2fsck is recommended EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: Here is the stuff in context               EXT3-fs (sdd1): using internal journal     EXT3-fs (sdd1): mounted filesystem with ordered data mode     EXT4-fs (sda1): warning: mounting fs with errors, running e2fsck is recommended     EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts:      EXT4-fs (sdb1): warning: maximal mount count reached, running e2fsck is recommended     EXT4-fs (sdb1): mounted filesystem with ordered data mode. Opts:      EXT4-fs (sdc1): warning: maximal mount count reached, running e2fsck is recommended     EXT4-fs (sdc1): mounted filesystem with ordered data mode. Opts:      Adding 4194296k swap on /dev/sdd2.  Priority:-1 extents:1 across:4194296k SSD     kjournald starting.  Commit interval 5 seconds     EXT3-fs (loop0): warning: maximal mount count reached, running e2fsck is recommended     EXT3-fs (loop0): using internal journal     EXT3-fs (loop0): mounted filesystem with ordered data mode      What should I do?


I get the error               /usr/bin/env: zsh -: No such file or directory      ...when I run an executable `zsh` script that starts with the following shebang line:               #!/usr/bin/env zsh -      Also, FWIW, replacing `-` with `\--` causes `/usr/bin/env` to print a similar complaint about `zsh --`. I have only seen this error under ubuntu, and only in the context of the shebang hack. Under darwin the same script runs fine. And under ubuntu, running               % /usr/bin/env zsh -      from the command line succeeds. (Actually, "under ubuntu" should be understood as short-hand for "under ubuntu 12.04 LTS and `env (GNU coreutils) 8.13`".) My question is: how can I modify the shebang above to avoid this error? Of course, I know that removing the trailing `-` will eliminate the error, but this is not an acceptable solution. The rest of this post explains why. The shebang line that is causing the error comes about as an attempt to comply with two entirely independent guidelines:   1. To make scripts portable, use `#!/usr/bin/env <cmd ...>` rather than `#!/path/to/cmd <...>`.   2. Putting `-` as the sole argument to `zsh` in the shebang line of zsh scripts thwarts certain types of attacks. So, I can restate my question more precisely as follows: Is it possible to satisfy both of these guidelines without triggering the error shown above under ubuntu?


title: Setting up samba,netatalk and avahi (bonjour) on raspberry pi

text: I'm trying to create a fileserver/timecapsule combo server out of my new raspberry pi (Raspbian), and it's not going as well as I'd like. _netatalk_ , _avahi_ and _samba_ are the packages that I'm using and they're not playing nice with each other. **I would like all shares, AFP and SMB to be accessible from a server icon in the finder navigation bar.** **This is what I know**   Netatalk has built-in bonjour support, so if you run netatalk, the `afp` shares show up nicely in Finder (great!).   Samba does _not_ have built-in bonjour support, but with the help of `avahi`, it's possible to advertise your `smb` shares through bonjour as well, and they show up in the Finder's navigation bar as well (awesome!). **The problem**   When netatalk and samba+avahi are both running, it seems like netatalk hides any other bonjour stuff on the same host. When I click on the server icon in the navigation bar, I only see the `afp` shares, no `smb` to be seen. I can still use Cmd+K to get to the `smb` shares, but I find this less preferable, because I want to make it easy to use for non technical people. Does anyone know how I can solve this?


title: Is there a postexec/predisplay hook for ZSH?

text: I know zsh has a preexec hook that fires before the command is executed, but is there one that fires after the command has been initiated but before the output is displayed to the screen? I ask because I want to display something based on if there was/will be actual output. For example:   `cd dir` does not output anything   `ls dir` outputs stuff In that example, I want to display: `Output:\n` before the ls directory display but not when `cd` is run since it doesn't have a display. I want it to look like:               ~ $: cd dir     ~/dir $: ls .     Output:     total 464     drwxr-xr-x+  55 eddie  staff   1.8K May  2 11:07 .     drwxr-xr-x    6 root   admin   204B Apr 22 13:48 ..     ~/dir $      I don't just want to wrap cd and ls. Those were examples. I want it to be for _every_ command.


title: Why Linux syslog file does not follow the RFC3339 protocol?

text: Why Linux syslog file: /var/log/syslog does not follow the timestamp format defined in the protocol http://tools.ietf.org/html/rfc5424#page-11?


title: network device name is changed by itself

text: I use a Ubuntu-arm, `uname -a`               Linux arm 3.7.8-x8 #1 SMP Sat Feb 16 04:15:13 UTC 2013 armv7l armv7l armv7l GNU/Linux      I have two USB WiFi interfaces that are named wlan0 and wlan1 on `/etc/udev/rules.d/70-persistent-net.rules` I run a script on each start-up that does:               ifdown wlan0      rm /var/run/wpa_supplicant/wlan0     ifup wlan0     wpa_supplicant -B -Dnl80211 -iwlan0 -c/etc/w.conf          ifdown wlan1     rm /var/run/wpa_supplicant/wlan1     ifup wlan1     wpa_supplicant -B -Dnl80211 -iwlan1 -c/etc/w2.conf      sometimes one of the interface is named as `rename5` whereas the other interface is named according to the `70-persistent-net.rules`. Could anyone explain why it is named rename5 instead of wlan0 or wlan1 and how can I prevent that thing to happen?


title: How to use `ls` to group and show only a first word of directory name?

text: I want to define a new `ls` command to do something like this The first when i use ordinary `ls` command:               $ls     undergrade.AI              undergrade.KDD     undergrade.AI2             undergrade.micro     undergrade.ANN             undergrade.OOT     undergrade.autoMata        undergrade.OS     undergrade.bulletin        undergrade.parallelAndDistributedProgramming     undergrade.CG              undergrade.pop     undergrade.CLP             undergrade.PPL     undergrade.comNet          undergrade.researchingMethod     undergrade.comOr           undergrade.SA     undergrade.comSec          undergrade.SE     undergrade.DBMS            undergrade.softwareTesting     undergrade.discrete        undergrade.webApps     code.ajax  code.cc  code.erl  code.html    code.js    code.pl     code.py        code.sage  code.x3d code.c    code.cl      code.go    code.jquery code.lisp       code.pro   code.roo code.sh   code.xml      And for a new ls that i want:               $ls_new     undergrade  code      I want it to show only the first word when i type `ls_new`. Why do i want this command? Because i named my folders in pattern of `category.subj` that so too much output when i use ordinary `ls`. then i need some command that can filter, group and show them but only the `category` name.


title: Correctly setting environment

text: I'm using zsh and gdm to run gnome. Some time ago I discovered that variables are not set correctly. For example LANG/LC_ALL are incorrect (`""` instead of `en_GB.UTF-8`). I split the `.zshrc` into `.zshrc` and `.profile`. In the latter I set the environment variables, but how can I set the variables before the session starts? I tried a few choices (`.xinitrc`, `.xsessionrc`) but none seemed to work. **Edit** To clarify - I used `.profile` and _manually_ sourced it in `.zshrc`. It does not change question anyway.


title: Centrino N-6300 OpenBSD 5.5 - No Link

text: I have a Lenovo X230 with a Centrino N-6300 wifi card. I cannot get wifi to work on it. I did `fw_upgrade` I can do a               ifconfig iwno scan      I have the list of Wifi networks around including mine. However if I try to setup `/etc/hostname.iwn0`               nwid Livebox-XXXX     wpakey XXXXXXXXX     dhcp      then               sh /etc/netstart iwn0      I got:               No link: .............. sleeping      Same if I try:               ifconfig iwn0 nwid Livebox-XXXX wpakey XXXXXXXX      What did I miss?


title: Replacing graphical sudo prompts with sudo command

text: I'm trying to replace `gksudo`, `pkexec` and its ilk with `sudo`. However, I'm told that using `sudo <graphical_program>` is a bad idea. Would the following work as a decent replacement?               sudo -H <graphical_program>      Or do I have to do other things as well?


title: joystick as a mouse with Fedora

text: I would like to use a joystick as a mouse with Fedora 12. I tried js2mouse but didn't work. Is there another solution? How should I configure the system?


title: How can I change my bash prompt to show my working directory?

text: I can print my current working dir like this               myPrompt$ pwd     /Users/me/myDir      I want my shell to look like this               /Users/me/myDir$ pwd     /Users/me/myDir      Is that possible? How can I do it?


title: "Enabling additional executable binary formats" fails

text: On ubuntu 14.04, after doing `do-release-upgrade -d` several systems failed like dbus, network-manager, sound card etc.. I am logged into terminal instead of X. Looking at the `/var/log/boot.log` I managed to fix all failed services except the line "enabling additional executable binary formats". What is the purpose of it and how do I debug it?