Fix or alternative for mktemp in OS X

I'm looking at a bash script someone else wrote that uses `mktemp`:               TEMP=`mktemp --directory`      However, this line does not work on my machine (OS X 10.6). How would I fix this line so that it is cross-un*x-like-platform compatible? **EDIT:** An alternative command would be sufficient as well.


Copy image from command-line to clipboard

Is there a way in a bash to copy a picture to the clipboard? For example if there is a picture `mypic.png` I want to have a command like `clipcopy mypic.png` such that I can go for example to inkscape and paste it afterwards.


Help me understand this echo/spawn/send/expect construct

Here is a line from a bash script I am trying to understand:               echo "spawn myscript.sh arg1 arg2; expect \"Please enter your value: \"; send \"myval\r\"; expect eof" | expect      I think I understand the first `expect` and the `send`. Q1: Does `expect` work only with `spawn`? Q2: What is the purpose of the last expect after the pipe? Q3: In general, can you guess what the original author of this line was attempting to accomplish?


How to change the primary display of dual screen Fedora 16?

I have a dual display Fedora 16. How can I change the primary screen (the one with the panel)?


How to execute udhcpc as non-root

On a Linux machine, I am trying to run the `udhcpc` command as non-root. I am getting the error `udhcpc: socket: Operation not permitted`. Is there any way to execute `udhcpc` as a simple user in Linux?


Obtain user and kernel time of a running process?

Is there way to determine using standard Linux/Unix tools how much a process has spent in User mode and how much waiting for kernel? In other words, exactly the "user" and "sys" values that you get when using `time`, but **during** process runtime? **NOTE:** one way is to use WBEM and enumerate Linux_UnixProcess, but I need to use _other_ tool than this; my aim is to verify what WBEM provider tells me, i.e. I need to use different tool.


I am trying to install ODBC driver for Debian according to those instructions: https://blog.afoolishmanifesto.com/posts/install-and-configure-the-ms-odbc- driver-on-debian/ However, when I type `sqlcmd -S localhost`, I get the error `libcrypto.so.10: cannot open shared object file: No such file or directory`. What to do? I tried 1.                $ cd /usr/lib       $ sudo ln -s libssl.so.0.9.8 libssl.so.10      $  sudo ln -slibcrypto.so.0.9.8 libcrypto.so.10      2.               Add /usr/local/lib64 to the /etc/ld.so.conf.d/doubango.conf file      3.               sudo apt-get update     sudo apt-get install libssl1.0.0 libssl-dev     cd /lib/x86_64-linux-gnu     sudo ln -s libssl.so.1.0.0 libssl.so.10     sudo ln -s libcrypto.so.1.0.0 libcrypto.so.10      4.               sudo apt-get install libssl0.9.8:i386      but none of those helped.


Measuring internet connection quality

I'm having WLAN trouble on my dualbooting win/linux laptop - the connection on linux side has occasional trouble, and seems somewhat slow and chunky. I would try to fix this issue by fiddling with all sorts of router settings, or WLAN kernel modules backports, or whatever - but problem is, it's hard to know if the settings have had any effect, since the problem appears in only subjective feeling about connection speed. So I'd like to have some way of executing a measurement that would tell me if the problem was affected or not. So far I've just used `iwconfig` which returns normal data, and `ping -c 100 -i 0.2` on the router and some stabile website ip addresses, but the summary doesn't give me all that good data, only the occasional packet loss. One information that's missing from the summary is the count of packets with clearly deviating roundtrip time, since that's one of the symptoms I've noticed - most packets come back with a regular time, but some of them take a lot longer. **So what tools can I use to get some _actual, numerical data_ on the quality of my internet connection?** (And just in case someone's wondering, yes, the problem _is_ real and not just confirmation bias, as it sometimes appears bad enough to throw me off the WLAN connection. It's probably somehow related to this Ubuntu bug and/or this Redhat bug)


Why does readelf show "System V" as my OS instead of Linux?

I compiled a small C program (2 lines of codes) with gcc to try to understand ELF file format. Doing a `readelf -h` on the object file, I have in the header :               OS/ABI:                            UNIX - System V       I am using Fedora, so why isn't it Linux instead ? **Edit** : I compiled               int main(){       int x = 0;       x++;     }      with `gcc -o main.o -c main.c`. My gcc version is               gcc (GCC) 4.5.1 20100924 (Red Hat 4.5.1-4)


Getting an existing Linux installation from one computer to boot on another

I have an existing Dell Precision 690 workstation setup to dual boot Windows XP and CentOS 5.5. These operating systems are installed on two separate drives. I have a grub menu on the Linux drive with it set as drive 1 and points to the windows boot info on drive 2. I tried taking the linux drive and installing it in a new HP Z800 workstation to see if I could be lucky enough to get it to boot, but it didn't. Immediately after it starts to boot I get a few errors. Here is what the system shows: Right after this message `Red Hat nash version 5.1.19.6 starting` I get the following lines:               Unable to access resume device (LABEL=SWAP-sda2)     mount: could not find filesystem '/dev/root'     setuproot: moving /dev failed: No such file or directory     setuproot: error mounting /proc: No such file or directory     setuproot: error mounting /sys: No such file or directory     switchroot: mount failed: No such file or directory     Kernel panic - not syncing: Attempted to kill init!      Is there something I can tweak to get this to possibly boot? I'd really like to not have to reload CentOS 5.5 and the specialized software on this machine. I do have a grub menu setup on this drive, could this by chance be my problem? The drives in the old machine are setup with Linux as drive 1, and Windows as Drive 2, and the Linux drive hosts the grub menu allowing me to boot to Linux or Windows. Could this some how be the problem? I do know of a way around this with Windows: install a secondary HDD controller card in the machine, install the drivers, hooked up drive to controller in old machine and make sure it boots, move the drive and controller to the new machine and boot off it, load the motherboard drivers (specifically the hdd controller drivers) and then you can take out the controller card, connect the hdd directly to the motherboard and you're set. This same thing is probably accomplish able in Linux, but I'm not sure. This might be a last ditch effort to try if nothing else works.


How to select an expandable folder when saving?

I have IMAP folders like this:               A     A/A     A/B     B     B/A     C      When I save (`s` in mutt) a mail and use `?`, I'm presented with a view like this:               A +     B +     C      It works perfectly until I want to move to `A` or `B`. If I click on `A`, it automatically expands `A` and presents me with its children (`A` and `B`). Is there a way to do that? Or is there a way to write it without using the `?` view?


What is the point of the `yes` command?

This question concerns the `yes` command found in UNIX and Linux machines: Basically, what is the point (if any) and history of this tool? Are there practical applications for it? Can an example be shown where it is useful in a script or chained (via pipe or redirect) with another tool? The manpage is below:               YES(1)                    BSD General Commands Manual                   YES(1)          NAME          yes -- be repetitively affirmative          SYNOPSIS          yes [expletive]          DESCRIPTION          yes outputs expletive, or, by default, ``y'', forever.          HISTORY          The yes command appeared in 4.0BSD.          4th Berkeley Distribution        June 6, 1993        4th Berkeley Distribution      Sample output:               $ yes why     why     why     why     why     ^Cwhy


Offline install wi-fi drivers on old PC using Linux Mint 15

I want to use wi-fi connection on my old notebook on which the Linux Mint 15 is installed, but I can't because it doesn't see any available installed drivers on it. I have searched many website and read different variations of setup, but no success. I have installed offline the b43-fwcutter perfectly, which is needed for wi-fi driver configuration, but have problems with activating driver. Some details about my settings on Linux Mint:               iwconfig      shows: 1). lo no wireless extensions eth0 2). no wireless extensions               sudo modprobe wl      shows: FATAL: Module wl not found               sudo lspci -vnn -d 14e4:      shows me , that I have 4311 version of the device               rfkill list      shows be , that neither software nor hardware is blocked if in the GUI mode (in my desktop environment) I click on the wireless icon, nothing appears in the application manager I haven't installed the STA broadcom drivers if to open Wireless Network drivers utillity in Mint , it doesn't show me any driver I also was trying to onstall `wl_apsta.o` with the next command               sudo b43-fwcutter -w /lib/firmware wl_apsta.o      all was extracting pretty fine but when I try to               sudo modprobe b43      nothing happens How to make work Wi-Fi with the Mint 15 perfectly in offline mode?


What does zsh's magic-space command do?

I found the following command in my `.zshrc`, probably copied from some website:               bindkey " " magic-space # do history expansion on space      The manpages are about as helpful as the very succinct comment:               magic-space         Perform history expansion and insert a space into the buffer. [...]      So what does `magic-space` actually do? Under which circumstances can I see this history expansion in action?


execute bit on directories, but not files

> **Possible Duplicate:**   >  How to apply recursively chmod directories without affecting files? What is the command to apply execute permission for directories (for traversal), but leave the execute bit off for files contained in the directory?


How do I know if software raid is running or setup correctly

This is what I pulled:               mdadm --monitor --scan -f --pid-file=/var/run/mdadm/mdadm.pid           cat /proc/mdstat     Personalities : [raid1]     md0 : active raid1 sda1[0] sdb1[1]           262080 blocks super 1.0 [2/2] [UU]          md1 : active raid1 sdb2[1] sda2[0]           8187840 blocks super 1.1 [2/2] [UU]          md2 : active raid1 sdb3[1] sda3[0]           479800128 blocks super 1.1 [2/2] [UU]           bitmap: 3/4 pages [12KB], 65536KB chunk          unused devices: <none>           fdisk -l          Disk /dev/sda: 500.1 GB, 500107862016 bytes     255 heads, 63 sectors/track, 60801 cylinders     Units = cylinders of 16065 * 512 = 8225280 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x00075973             Device Boot      Start         End      Blocks   Id  System     /dev/sda1   *           1          33      262144   fd  Linux raid autodetect     Partition 1 does not end on cylinder boundary.     /dev/sda2              33        1053     8192000   fd  Linux raid autodetect     /dev/sda3            1053       60802   479931392   fd  Linux raid autodetect          Disk /dev/sdb: 500.1 GB, 500107862016 bytes     255 heads, 63 sectors/track, 60801 cylinders     Units = cylinders of 16065 * 512 = 8225280 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Disk identifier: 0x00038574             Device Boot      Start         End      Blocks   Id  System     /dev/sdb1   *           1          33      262144   fd  Linux raid autodetect     Partition 1 does not end on cylinder boundary.     /dev/sdb2              33        1053     8192000   fd  Linux raid autodetect     /dev/sdb3            1053       60802   479931392   fd  Linux raid autodetect          Disk /dev/md2: 491.3 GB, 491315331072 bytes     2 heads, 4 sectors/track, 119950032 cylinders     Units = cylinders of 8 * 512 = 4096 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Disk identifier: 0x00000000               Disk /dev/md1: 8384 MB, 8384348160 bytes     2 heads, 4 sectors/track, 2046960 cylinders     Units = cylinders of 8 * 512 = 4096 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Disk identifier: 0x00000000               Disk /dev/md0: 268 MB, 268369920 bytes     2 heads, 4 sectors/track, 65520 cylinders     Units = cylinders of 8 * 512 = 4096 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Disk identifier: 0x00000000      I am correctly to believe that all the partitions are correctly being mirrored right? Is there a way to check each individual drive to ensure?


What does the Windows flag in the Linux logo of kernel 3.11 mean?

I've just installed kernel-3.11.0-1.fc20 for my Fedora 19 installation. During the rebooting progress, I saw the Linux logo with a Windows flag in it, what does it mean? ![a Windows flag in Linux logo of Linux kernel 3.11](http://i.stack.imgur.com/1BTi0.jpg) The Fedora 19 is installed in an ASUS TX300CA notebook, secure boot is off, CSM (BIOS Compatibility Support Module) mode is on.


Hard drive partitioning

I have Linux installed on my computer. I have `/dev/sda1` where the mount point is `/` and `/dev/sda2` which contains `/dev/sda5` which is my swap space. I want to partition /dev/sda1. How do I go about doing this?


Once sudo su'd to root, is there a command to see my username?

I have sudo rights on a redhat box; once I've "sudo su -" to become root in a shell, are there any commands I can run to see what username I su'd FROM?


What distribution-maintained cross-compile toolchain packages exist?

I have just learned of Gentoo's sys-devel/crossdev package. This is a package that is useful for creating a cross-compiling toolchain. Are there any other such packages out there on other distributions? I'm specifically interested in distro-maintained packages because I've tried a couple of others (buildroot, crosstool) and it seems that and any time the distribution touches gcc or binutils, it invariably breaks at least the building of the toolchain if not the building of the project itself.


unresolved dependencies of bz* files for rpm make from source

I am trying to do a build of rpm from source. I got through the `./configure` and ran through a good chunk of `make`. Unfortunately I keeping getting stopped up on undefined references to `bzerror`, `bzwrite`, `bzflush` and others. Looking around online I see these functions are part of the `bzip2` package. Ive installed the development libraries, but I am still getting this message. Can anyone assist me in resolving these dependencies? thanks...               make[2]: Entering directory `/mnt/fedRoot/rpm-4.6.1/lib'     make  all-am     make[3]: Entering directory `/mnt/fedRoot/rpm-4.6.1/lib'     /bin/sh ../libtool --tag=CC   --mode=link gcc -std=gnu99  -g -O2 -fPIC -DPIC -D_REENTRANT -Wall -Wpointer-arith -Wmissing-prototypes -Wno-char-subscripts  -fno-strict-aliasing -fstack-protector   -o rpmdb_archive  ../db3/db_archive.o ../db3/util_sig.o librpm.la -lrt -lpthread      gcc -std=gnu99 -g -O2 -fPIC -DPIC -D_REENTRANT -Wall -Wpointer-arith -Wmissing-prototypes -Wno-char-subscripts -fno-strict-aliasing -fstack-protector -o .libs/rpmdb_archive ../db3/db_archive.o ../db3/util_sig.o  ./.libs/librpm.so /mnt/fedRoot/rpm-4.6.1/rpmio/.libs/librpmio.so -lmagic -lelf -llua -lm -lnss3 -lpopt -lrt -lpthread  -Wl,--rpath -Wl,/usr/local/lib          /mnt/fedRoot/rpm-4.6.1/rpmio/.libs/librpmio.so: undefined reference to `bzerror'     /mnt/fedRoot/rpm-4.6.1/rpmio/.libs/librpmio.so: undefined reference to `bzwrite'     /mnt/fedRoot/rpm-4.6.1/rpmio/.libs/librpmio.so: undefined reference to `bzflush'     /mnt/fedRoot/rpm-4.6.1/rpmio/.libs/librpmio.so: undefined reference to `bzdopen'     /mnt/fedRoot/rpm-4.6.1/rpmio/.libs/librpmio.so: undefined reference to `bzread'     /mnt/fedRoot/rpm-4.6.1/rpmio/.libs/librpmio.so: undefined reference to `bzclose'     /mnt/fedRoot/rpm-4.6.1/rpmio/.libs/librpmio.so: undefined reference to `bzopen'     collect2: ld returned 1 exit status     make[3]: *** [rpmdb_archive] Error 1     make[3]: Leaving directory `/mnt/fedRoot/rpm-4.6.1/lib'     make[2]: *** [all] Error 2     make[2]: Leaving directory `/mnt/fedRoot/rpm-4.6.1/lib'     make[1]: *** [all-recursive] Error 1     make[1]: Leaving directory `/mnt/fedRoot/rpm-4.6.1'     make: *** [all] Error 2


How do you set the path in a non-shell environment (KDE)?

I'd like to override one of the applications set in `/usr/bin/`. I have created an alternative with the same name in `~/bin/` which in in my `PATH` (as set both in `.bashrc` and in `.profile`). When I start the application from the console, I get the expected result: my application is started instead of one from the distribution. However, within KDE, when I do alt+F2 and type in the application name, the one in `/usr/bin` starts instead of the one in `~/bin/`. How do I set KDE so that `~/bin` is recognized from everywhere in KDE. I'll probably also have to edit the K-menu, although I am not sure how to do it with KDE4.


Python Web interface for simple mysql database

We need a new web interface for our internal car booking system, which is implemented in mysql database. Could somebody please advise, what would be a suitable solution (which framework, if any). The main criteria is **simplicity** and future **maintainability**. We therefore would like some clean, minimalistic solution. Once completed, the interface will be expected to be running for many years (5-10). We would therefore like to use some technology, which is likely to be around in 5-10 years time. We would like to implement it in python.


Replacing Upstart with Sysvinit in Wheezy results in error

I have a Debian Wheezy server with upstart installed. I removed upstart and replaced it with sysvinit, which resulted in the following error:               apt-get install --reinstall sysvinit     Reading package lists... Done     Building dependency tree     Reading state information... Done     0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 2 not upgraded.     Need to get 0 B/133 kB of archives.     After this operation, 0 B of additional disk space will be used.     (Reading database ... 102927 files and directories currently installed.)     Preparing to replace sysvinit 2.88dsf-41+deb7u1 (using .../sysvinit_2.88dsf-41+deb7u1_amd64.deb) ...     Unpacking replacement sysvinit ...     Processing triggers for man-db ...     Setting up sysvinit (2.88dsf-41+deb7u1) ...     sysvinit: restarting...init: timeout opening/writing control channel /run/initctl     .init: timeout opening/writing control channel /run/initctl     .init: timeout opening/writing control channel /run/initctl     .init: timeout opening/writing control channel /run/initctl     .init: timeout opening/writing control channel /run/initctl     .init: timeout opening/writing control channel /run/initctl     .init: timeout opening/writing control channel /run/initctl     .init: timeout opening/writing control channel /run/initctl      failed.      I'm afraid if i restart the server won't boot anymore... what exactly is the problem here?


How to diagnose/troubleshoot bogus applets in Cinnamon?

I discovered that on Cinnamon 1.8, when there is a problem with the JavaScript code in Cinnamon applet, sometimes user don't get an error message, but the whole desktop freezes (i.e. applications keep running, but nothing gets displayed on screen). Unfortunately, I have experienced such freezing behavior on Cinnamon 2.0 (Linux Mint 16 64bit), and I have had a hard time tracking down this problem. This event occurs rarely (1 in 3-5 hours), so debugging it by means of bisection is very time consuming. And when it does, I am often forced to restart `mdm` and lose all unsaved data. Besides, applications don't like such brutal restarting and I expect to have problems with Firefox and Eclipse profiles if I continue restarting them in such a way.


Apache mail sending flowchart / workflow?

I am currently trying to get my head into learning how Linux systems send mail, starting from Apache, to Sendmail and finally out the door. Specifically I'm using CentOS 5 which is using Sendmail, I'm fairly sure it's the vanilla setup although I didn't set it up myself. I'm interested in things like, how mail is queued when a service like sendmail is disabled, how Apache and Sendmail talk to each other, what other options are there instead of Sendmail etc. My most immediate mission is to figure out how to create a whitelist for sending out, so that mail can only be sent to specific recipients, and if a mail is blocked then it's either rerouted to a specified address. I'm in no way partial to sendmail, and if performing such a task involved switching software then I'm all for it. The server itself is a staging server, however it recently managed to send out some production data to production email addresses which caused a bit of embarrassment and so I've been tasked with locking it down, however I'm pretty fresh to the entire mailing process on Linux. **Edit:** Additionally, the current state of the server I'm working on is that; sendmail is disabled and a bunch of emails are now stacked up in clientmqueue, however some of these don't appear to hold any recipient data. Is recipient data held elsewhere? What is likely to happen if I now enable sendmail, will these items send out?


What would it take for a *nix system to shutdown, then continue to grub?

Is this possible to shutdown to grub, not all the way so you don't have to load back up the BIOS and other things. Like to give you the ability to quickly boot for Linux to Windows?


sed replace only lines with matching groups

Currently, I have this command:               sed 's/\([^C]*\)/\1AB/'      It inserts "AB" before the first instance of "C" on a line. But it is also adding "AB" at the end of every line without a "C". How can I have it only edit when it finds "C"?


difference between omz "plugins" and "themes"?

What exactly is the difference, _operationally_ , between plugins and themes in oh-my-zsh? I.e. how would things break (if at all) if a plugin were instead put among the themes, or a theme among the plugins? Or is the distinction purely organizational?


Mouse BTC 5213RF (M) does not work under Ubuntu 13.10 Server

I have been given BTC wireless mouse/keyboard with RF transciever. This RF transciever plugs in into PS2 keyboard and mouse ports and turn on mouse and keyboard and both were working (mouse and keyboard) were working in Windows XP. I've moved this mouse/keyboard system to my Ubuntu 13.10 Server and now the keyboard works, but mouse does not. Does anyone have some ideas what might be wrong? The keyboard model is BTC 5213RF (TX). The mouse model is BTC 5213R (M).


Gentoo Linux portage USE flags: what is the difference between removing a default vs. not having a default, how do the defaults compare, no-multilib?

Gentoo Linux `portage` relies on USE flags to customize compiling options for software. Here's an example showing how to organize USE flags in a `make.conf` file:               # ************ USE **************     # ******** profile 'kde' ********     MYPROFILE="apache2 mysql"     HW="3dnow -bluetooth directfb fbcon hddtemp lm_sensors mmx nvidia smp svga xcomposite xvmc"     SYSTEM="caps -cups curl -fortran java nsplugin -oss syslog"     NET="-ipv6 -isdnlog -ldap ppp wifi"     CMDL="bash-completion gpm offensive vim-syntax"     KDE="htmlhandbook plasma semantic-desktop"     GNOME_DEPS="gstreamer -gtk"     DEV="tidy vhosts"     MMEDIA="aalib cdda cddb css dvb exif ffmpeg fontconfig gd gimp gphoto2 imagemagick libcaca lame matroska mplayer musicbrainz quicktime theora v4l v4l2 xine xpm xscreensaver"          USE="${MYPROFILE} ${HW} ${SYSTEM} ${NET} ${CMDL} ${GNOME_DEPS} ${KDE} ${DEV} ${MMEDIA}"      And this configuration is meant to upstage (because of precedence) the cumulative 13.0 profile containing the default flags for instance:               (This example is the sum of the settings in base, default/linux,      default/linux/x86 and default/linux/x86/13.0/)     USE="a52 aac acpi alsa branding cairo cdr dbus dts dvd dvdr emboss encode exif     fam firefox flac gif gpm gtk hal jpeg lcms ldap libnotify mad mikmod mng mp3     mp4 mpeg ogg opengl pango pdf png ppds qt3support qt4 sdl spell     startup-notification svg tiff truetype vorbis unicode usb X xcb x264 xml xv     xvid"        * What is the difference between removing support for a feature that appears in the defaults by using `-useflag` in the `make.conf` file vs. not having a feature in the cumulative defaults at all and having nothing related to it either in the make.conf file?   * Can an application sourced from the default profile be qualified in relation to a standard application compiled in one of the standard Linux distributions? (is the default profile close to some "standard" or is it already a pretty much customized subset?)   * Is it really an issue nowadays to select a no-multilib profile for the whole build?


How to delete the clipboard in the middle wheel

Right click on the text field the popup mouse menu shows that the clipboard is blank, but when press the wheel in the middle of the mouse the previous selected text is pasted. Why is this and how can I clear that text? Gnome 3.6.2 + opensuse 12.3


Linux empty buffer cache command permission denied

I'm using the following commands to flush cache:               # sync; echo 3 > /proc/sys/vm/drop_caches     # sync; echo 2 > /proc/sys/vm/drop_caches     # sync; echo 1 > /proc/sys/vm/drop_caches      When I use one of the above commands, I get the following:               -bash: /proc/sys/vm/drop_caches: Permission denied      My system running CentOS 6.5, I logged in as root via SSH. Any suggestions?


How can I get kqemu or even just qemu to show up in virsh capabilities on CentOS 6.4?

I have a CentOS 6.4 box that I'm trying to set up a VM on to run WinXP. This box doesn't have VT, which may not be ideal, but I'll settle for less than ideal. Apparently I should be able to install a kqemu kernel module and then use `\--virt-type kqemu` with `virt-install`, and it should at least run, albeit slowly.               $ sudo modprobe kvm     FATAL: Module kvm_intel not found.      Same with `kqemu`. Okay, so:               $ sudo yum install kvm     Loaded plugins: fastestmirror     Loading mirror speeds from cached hostfile      * base: less.cogeco.net      * extras: www.cubiculestudio.com      * updates: centos.mirror.rafal.ca     Setting up Install Process     No package kvm available.     Error: Nothing to do      And same with `kqemu` and `qemu` (despite the official docs). Meanwhile:               $ virsh capabilities     ...     <domain type='lxc'>     </domain>      The docs say that this last one should tell me which hypervisors are available, but I want to install WinXP on the VM, so LXC will not do the trick. How can I get `kqemu` or even just `qemu` to show up in `virsh capabilities`?


What is the tun network interface for?

I noticed when running ifconfig that there is a network interface called tun0 and it has an ipv4 address. A bit of research shows that it is a tunneling device, but I don't really know how it's used, what's using it, and why it has an IP address. I do have iptables enabled, and there seems to be some link between iptables and tun, if that helps.


fixing cpan by resetting it

So I ran into a simple little problem. This is a somewhat rookie mistake. I wasn't connected to the internet and started cpan. It started to configure for the first time and then when I realised a few seconds later that the internet wasn't connected I hit `Ctrl + C` When I connected to the internet and brought CPAN up again, it asked me to continue from where is left, but prompted me for a WHOLE lot of configuration options. I left them to default. It then asked me for a **mirror URL** , I think I typed it incorrectly. Now cpan doesn't work at all!! I would like to reset to the typical first start I'm used to where it will ask to configure everything for me. I looked at this perlmonks post which suggested deleting `/etc/perl/CPAN/Config.pm` but it doesn't exist for me. `/etc/perl` doesn't exist itself. **Question** : I'm on CentOS 6.4, how do I reset cpan?


Mount NTFS image file created using partimage

From an old disk which I don't have at hand, I have created a file named winxp.img using `partimage`. As the filename suggests, the partition contained Windows XP and was formatted with NTFS. (The file contains only a 4.6 GiB NTFS partition, not the whole disk.) How can I access the files inside this image without restoring it onto a physical disk?


Too many smtpd daemon forks?

I have many forks from `smtpd` in my process list on my webserver. What does this mean? Is my mailbox full?                  postfix   2662  0.0  0.9 106336  4856 ?        S    17:37   0:00 smtpd -n         smtp -t inet -u -c -o stress yes        postfix   2800  0.0  0.9 106336  4860 ?        S    15:59   0:00 smtpd -n         smtp -t inet -u -c -o stress yes        postfix   3644  0.0  0.9 106336  4864 ?        S    13:47   0:00 smtpd -n         smtp -t inet -u -c -o stress         postfix   3732  0.0  0.9 106336  4872 ?        S    14:36   0:00 smtpd -n         smtp -t inet -u -c -o stress yes        postfix   3835  0.0  0.9 106336  4868 ?        S    14:36   0:00 smtpd -n         smtp -t inet -u -c -o stress yes        postfix   4309  0.0  0.9 106336  4864 ?        S    13:48   0:00 smtpd         -n smtp -t inet -u -c -o stress         postfix   4603  0.0  0.9 106336  4860 ?        S    16:13   0:00 smtpd -n         smtp -t inet -u -c -o stress yes        postfix   4843  0.0  0.9 106336  4864 ?        S    13:49   0:00 smtpd -n         smtp -t inet -u -c -o stress       I have plenty more of these lines in my process list. Output of pstree gives me:                ├─master─┬─anvil      │        ├─cleanup      │        ├─pickup      │        ├─proxymap      │        ├─qmgr      │        └─100*[smtpd]      Edit: Recently I've changed the mysql to listen from localhost to my extern ip. Now I'm getting this error in the mail log:               warning: connect to mysql server 127.0.0.1: Can't connect to MySQL server on        '127.0.0.1' (111)     May 21 22:23:00 postfix/trivial-rewrite[15741]: fatal: mysql:/etc/postfix/mysql-        virtual_mailbox_domains.cf(0,lock|fold_fix): table lookup problem     May 21 22:23:01  postfix/smtpd[31036]: warning: problem talking to service rewrite:         Success     May 21 22:23:01  postfix/smtpd[30757]: warning: problem talking to service      rewrite:          Connection reset by peer      It's flooding my log and it's already >600MB. How can I change postfix to listen to my extern ip? I need to connect to mysql from my home location and not from localhost? Edit: Nevermind.


vim custom pop up menu

How do I create a custom completion pop up menu. I would like to be able to begin typing a part of a string then press a custom key combination to bring up a pop up completion of just a certain group of strings.   I already have omni complete set up and do not want to add to that list. For example I have the list:   spo   spe   spa      I would like to be able to type sp then press ctrl+> and have a completion box come up for just that specific list.


Permissions don't restrict access to NFS mount

We've got a RHEL 5.9 server with NFS mounted directories from a central NAS. There we've got a directory owned by `aird1(11055):app_dev(1101)` user/group with `rwxrwsr-x` permissions (i.e. _sgid_ to app_dev). And finally we've got a process running as `grid(1001)` user. The trouble is that the `grid` user can write into the directory although it shouldn't be able to. When I make a local test directory with the same ownership and permissions as the NFS mounted one I can't write to it, which is what I expect. For some reason the NFS mounts don't fully obey the permissions. Here's an example:               $ ls -ldn /nfs/aird1/tmp     drwxrwsr-x 5 aird1(11055) app_dev(1101) 24576 Oct 17 13:21 /nfs/aird1/tmp      The directory is owned by `aird1(11055):app_dev(1101)` and has no ACLs attached. When I attempt to create a file under my account it fails:               $ id     uid=20501(myuser) gid=1003(mygroup) groups=10(wheel),1003(mygroup)          $ ls -l /nfs/aird1/tmp/xyz     ls: /nfs/aird1/tmp/xyz: No such file or directory          $ touch /nfs/aird1/tmp/xyz     touch: cannot touch `/nfs/aird1/tmp/xyz': Permission denied      That's expected, but now the same as user `grid`...               $ id     uid=1001(grid) gid=1001(oinstall) groups=1001(oinstall),1002(dba)          $ touch /nfs/aird1/tmp/xyz          $ ls -l /nfs/aird1/tmp/xyz     -rw-r--r-- 1 grid(1001) app_dev(1101) 0 Oct 17 13:24 xyz      How come I was able to create the file?? There is no overlap between the UIDs and GIDs of directory ownership and either the `myuser` or `grid` yet with some UIDs/GIDs I can create the file and with some others I can't. This is the record from `/etc/fstab`:               nas:/vol/... /nfs  nfs   rw,bg,hard,nointr,rsize=32768,wsize=32768,tcp,vers=3,timeo=600,nosuid,actimeo=0 0 0      Any ideas what's going on here? Thanks!


File descriptor limits are lost after a system reboot

I'm trying to increase the default file descriptor limits for processes on my system. Specifically I'm trying to get the limits to apply to the Condor daemon and its sub-processes when the machine boots. But the limits are never applied on machine boot. I have the limits set in `/etc/sysctl.conf`:               [root@mybox ~]# cat /etc/sysctl.conf     # TUNED PARAMETERS FOR CONDOR PERFORMANCE     # See http://www.cs.wisc.edu/condor/condorg/linux_scalability.html for more information          # Allow for more PIDs (to reduce rollover problems); may break some programs     kernel.pid_max = 4194303          # increase system file descriptor limit     fs.file-max = 262144          # increase system IP port limits     net.ipv4.ip_local_port_range = 1024 65535      And in `/etc/security/limits.conf`:               [root@mybox ~]# cat /etc/security/limits.conf     # TUNED PARAMETERS FOR CONDOR PERFORMANCE     # See http://www.cs.wisc.edu/condor/condorg/linux_scalability.html for more information     # Increase the limit for a user continuously by editing etc/security/limits.conf.     *        soft  nofile        32768     *        hard  nofile      262144 #65536      The trouble I run in to is, on system reboot, the limits don't seem to apply to Condor and its processes. After a reboot, if I look at the file descriptor limit for a Condor process I see:               [root@mybox proc]# cat /proc/`/sbin/pidof condor_schedd`/limits | grep 'Max open files'     Max open files            1024                1024      But if I restart the `condor_schedd` process after a reboot the limits are increased as expected:               [root@mybox proc]# cat /proc/`/sbin/pidof condor_schedd`/limits | grep 'Max open files'     Max open files            32768                262144      The `boot.log` indicates these limits are being set before my Condor daemon and its processes are being started:               May 18 07:51:52 mybox sysctl: net.ipv4.ip_forward = 0     May 18 07:51:52 mybox sysctl: net.ipv4.conf.default.rp_filter = 1     May 18 07:51:52 mybox sysctl: net.ipv4.conf.default.accept_source_route = 0     May 18 07:51:52 mybox sysctl: kernel.sysrq = 0     May 18 07:51:52 mybox sysctl: kernel.core_uses_pid = 1     May 18 07:51:52 mybox sysctl: kernel.pid_max = 4194303     May 18 07:51:52 mybox sysctl: fs.file-max = 262144     May 18 07:51:52 mybox sysctl: net.ipv4.ip_local_port_range = 1024 65535     May 18 07:51:52 mybox network: Setting network parameters: succeeded     May 18 07:51:52 mybox network: Bringing up loopback interface: succeeded     May 18 07:51:57 mybox ifup: Enslaving eth0 to bond0     May 18 07:51:57 mybox ifup: Enslaving eth1 to bond0     May 18 07:51:57 mybox network: Bringing up interface bond0: succeeded     May 18 07:52:17 mybox hpsmhd: smhstart startup succeeded     May 18 07:52:17 mybox condor: Starting up Condor     May 18 07:52:17 mybox rc: Starting condor:  succeeded     May 18 07:52:17 mybox crond: crond startup succeeded      Obviously I'd like to avoid having to boot a machine and then restart process that I need these increased limits to apply to -- what have I done wrong that's preventing these limits from applying to the processes when the machine boots?


A command used in another command

For djvused command, there is an option: > -e command > > Cause djvused to execute the commands specified by the option argument > commands. It is advisable to surround the djvused commands by single quotes > in order to prevent unwanted shell expansion. For example, `djvused myfile.djvu -e 'print-pure-txt'`. It is quite unusual to me in that a command (here djvused) can run other commands (here by `-e` option). I was wondering how it is possible? Is this a frequent practice in command line interface? Is this similar to print command used in awk command? The only way I know for a command to be used in another command is:               echo `echo hello`      Thanks and regards!


How can I use my TV as a second display over HDMI on Linux at its native resolution?

My TV is a Philips 19PFL4322. It's native resolution is 1440x900 . My laptop's graphics card is a ATI Radeon HD 3650, using the open source `radeon` driver on X.org server 1.10. If I connect them via VGA in Linux, or via anything in Windows, it displays correctly at that resolution. If I connect it via HDMI in Linux, it defaults to a 1024x768 resolution, and GUI tools will only allow me to set it up to 1360x768, all of which look pretty bad on it. If I force the issue by generating a modeline using `cvt 1400 900` and then setting that as the mode using xrandr, I get no output on that monitor. When connnected via VGA, Linux correctly identifies it as a Philips 19" TV. When connected via HDMI, it misidentifies it as an 18" TV. How can I get the monitor to display correctly on Linux using HDMI? **EDIT: xrandr output**. `VGA-0` and `HDMI-0` are both my TV, `LVDS` is my laptop display, 1280x960 which is listed under HDMI-0 is not a valid output for my TV. 1440x900 which isn't listed is a valid output.               Screen 0: minimum 320 x 200, current 2880 x 900, maximum 8192 x 8192     VGA-0 connected 1440x900+1440+0 (normal left inverted right x axis y axis) 410mm x 257mm        1440x900       59.9*+        1360x768       59.8          1280x720       60.0          1024x768       75.1     70.1     60.0          832x624        74.6          800x600        72.2     75.0     60.3     56.2          640x480        72.8     75.0     66.7     60.0          720x400        70.1       LVDS connected 1440x900+0+0 (normal left inverted right x axis y axis) 367mm x 23000mm        1440x900       60.8*+        1280x854       59.9          1280x800       59.8          1280x720       59.9          1152x768       59.8          1024x768       59.9          800x600        59.9          848x480        59.7          720x480        59.7          640x480        59.4       HDMI-0 connected (normal left inverted right x axis y axis)        1920x1080i     25.0 +        1280x960       60.0          1360x768       59.8          1280x768       59.9          1280x720       60.0          1024x768       75.1     70.1     60.0          800x600        72.2     75.0     60.3     56.2          640x480        72.8     75.0     66.7     60.0          720x400        70.1


Can I run a command with specific privileges on certain directories?

I would like to be able to run a command, passing in parameters to bash or similar, such that this command is not allowed to write to a particular path, overriding the user's other privs. Eg:               root> /bin/bash -protect /folder/to/protect mycommand.sh      In this example, the root user can obviously do what it wants, but while I test a new script I'm writing, I would like to protect a folder, as if the folder was read only for that user. Is there a way to do this without adding a new user and adjusting that user's privs accordingly? It doesn't have to be in bash by the way, I don't mind the approach - as long as I can protect folders without adding a new user I don't mind! (I'm sorry about the title, I can't really think of how to explain my requirements in one line!)


How to format a USB storage no detected in Ubuntu?

I have a memory stick that is not mounted in Ubuntu and it doesnt works in Windows. I can check is connected using               Bus 003 Device 011: ID 05e3:0727 Genesys Logic, Inc. microSD Reader/Writer      But I cannot mount it. I want to try formating it to check if is detected again in Windows and Linux. How could I do without mount it?


safely killing a background process

I'm writing data to a pipe in a parent process. The parent process creates a background job that reads data from the pipe & write it to the screen & to a log file.   How can I know when to kill the background job? `wait` command simply waits forever. I prefer to not use a token to detect the "end of output". Code example:               function log()     {         if [ -z "$counter" ]; then             counter=1         else             (( ++counter ))         fi              if ! [[ -z "$teepid" ]]; then             # ***** How can I know if it's safe to kill here?             kill $teepid         fi         # Display text-to-be-logged on screen         #  & write text-to-be-logged to it's corresponding log file         tee <"$pipe" 1>&4 "${logs_dir}/${counter}_${1// /_}" &         teepid=$!     }          logs_dir="/path/to/log/dir"          pipe_dir=$(mktemp -d)     pipe="${pipe_dir}/cmds_output"     mkfifo "$pipe"     exec 3<>"$pipe" # link file descriptor (FD) #3 to $pipe for r/w     exec 4<&1   # save value of FD1 to FD4     exec 1>&3   # redirect all output to FD3          log # Logs the following code block     {         # ... Many bash commands ...     }          log # Logs the following code block     {         # ... Many bash commands ...     }          if ! [[ -z "$teepid" ]]; then         # ***** How can I know if it's safe to kill here? Maybe it's still logging         kill $teepid;     fi      * * * **Edit:** I tried:               exec 3>&-     #exec 1>&- # Have tried also uncommenting this row     wait $teepid     exec 3<>"$pipe"     exec 1>&3     kill $teepid      but the wait command still hangs... I found that `ps -o pid,ppid,s --pid $teepid` shows the state of the process. Should I count on that?


SSH Port Forward a local IRC server to my remote server

So, I have this slight dilemma: I am not allowed to host an IRC server on my VPS, but I am allowed to use tunneling of some sort to let users connect to an IRC server I have set up locally on my Mac Mini. Basically - how would I go about tunneling connections to port 6667 of my VPS to my Mac Mini without opening a port in my router (that's what I get for having a technically inclined dad)? I've read up a little on SSH port forwarding, but after about 3 hours of constant googling and trying things out, I just can't seem to get it to work. I've also been considering things like Himmachi(or whatever it's actually called now) and then somehow route the Himmachi IP of my Mac Mini to be public. I know that my writing probably sounds hopelessly confused, but that's because I'm hopelessly confused as to where I could go from here. I'd appreciate any help in this subject.


Is it possible to "hide" an account from /etc/passwd?

A typical Linux system has not only accounts for the actual user(s) of the system, but also various system accounts. Is there any file like `/etc/passwd` for daemons, or other means resources where an account might be defined? I heard that it is possible to camouflage a account as a service account, I'm trying to find accounts like these in a computer.


writing a command transcript to file

Here is a script from Mercurial issue 2743. Call it `mq.sh`. I'm trying to get it to do the following things, on Debian squeeze.   1. Echo commands + standard output + standard error to a file.   2. Prefix with working directory. Sticking in $PWD doesn't work, as it presumably just keeps using the value from when it was first   sourced.   3. Reset redirection back to normal standard output/error at the end. I'm not sure how to do this, but I imagine I'd have to use `exec` again.   4. I'm calling this with `sh mq.sh`. I'd like to do everything portably (if possible), and it seems exec is bash-specific, so I'm puzzled why this is working. Also `set -x xtrace` is probably bash specific as well. I got it from the Bash reference manual. Doesn't calling with `sh` run everything through `dash` on Debian? 1 currently works, I think. How do I do 2 and 3? And can I have a clarification on 4?               export PS4="$PWD$ "     exec > mq.log 2>&1     export HG="hg-crew"     rm -r main clone          set -o xtrace     $HG init main     cd main     $HG init --mq     $HG qnew foo     echo a > a     $HG add     $HG qref     $HG ci --mq -Am.     cd ..     $HG qclone main clone     cd clone     $HG paths --mq     mv .hg/patches/.hg/hgrc{,.foo}     $HG paths --mq     $HG push --mq     echo b >> a     $HG qref     $HG ci --mq -m.     mv .hg/patches/.hg/hgrc.foo .hg/patches/.hg/hgrc     $HG push --mq


Forwarding X11 over SSH if the server configuration doesn't allow it

Consider a situation where I'm logging in over SSH from machine A to machine B, I have an X session on machine A, and I want to run an X program on B. `ssh -X B` makes this work transparently. But what if the server configuration lacks `X11Forwarding yes`, I don't have root permissions on the server, and the server administrator is indifferent? It's obviously possible to forward the X11 connection, since I can transfer whatever I want over the SSH channel. In fact, if the local X server allows TCP connections, it's as easy as `ssh -R 6010:localhost:6000` (to be adjusted for the display numbers). What about the common case where the local X server only allows socket connections? How do I do X forwarding conveniently and securely, with a minimum of installation requirements (especially on B)?


Permission issues while setting up cakephp

I am pretty new to linux and trying to setup cakephp on opensuse 12.1. I did as told on the cakephp website(blog tutorial) and most probably encountering some permission issues. I slapped the cakephp folder in /srv/www/htdocs and then tried to access it using localhost/cakephp where it says               Access forbidden!     You don't have permission to access the requested object. It is either read-protected or not readable by the server.     If you think this is a server error, please contact the webmaster.     Error 403      But as i check for permissions I get               Suse:/srv # ls -lR shows sankalp as owner for all the files down the tree.          sankalp@Suse:/srv/www/htdocs> whoami     sankalp     sankalp@Suse:/srv/www/htdocs> ls -l     total 108     drwxrwxrwx  6 sankalp users  4096 Jun 27 12:44 cakephp     -rw-r--r--  1 sankalp users 73728 Jul  6 10:41 das     -rwxrwxrwx  1 sankalp  root    302 Mar 13  2006 favicon.ico     -rwxrwxrwx  1 sankalp  root     26 Jun 28 19:04 whoami.php      Neither can I access whoami.php while favicon.ico gets displayed in the browser.What am I doing wrong here when I have given 777 to the user.


Debian Squeeze as a router

I'm trying to setup Debian Squeeze (ala Dreamplug) as a router. I can't seem to get the pieces to fit together. ETH0: Upstream/internet - DHCP-Client   ETH1: Downstream/Lan - 192.168.0.1 DHCP-Server sudo vim /etc/network/interfaces               auto lo br0     iface lo inet loopback          auto eth0     iface eth0 inet dhcp          auto eth1             iface eth1 inet static             address 192.168.0.1             network 192.168.0.0             netmask 255.255.255.0             broadcast 192.168.0.255          iface br0 inet dhcp             bridge_ports eth0 eth1      sudo vim /etc/dhcp/dhcpd.conf               option domain-name "MyPlug.MyServer.com";     option domain-name-servers 8.8.8.8, 192.168.0.1;          default-lease-time 600000000;     max-lease-time 720000000;          subnet 192.168.0.0 netmask 255.255.255.0 {         range 192.168.0.100 192.168.0.200;         option routers 192.168.0.1;         option broadcast-address 192.168.0.255;     }      sudo vim /etc/default/isc-dhcp-server               INTERFACES="eth1"      service networking restart   service isc-dhcp-server restart My windows 7 machine picks up an IP... AFTER I force release/renew. I was able to get it to connect to the server via putty once. Anything noticeably wrong with my settings? or anything else I can look for?


How to create a fake device file that accepts input from a C program?

I want to create a C program that accepts input from a joypad (`/dev/input/js0`), processes it, and then sends it to a fake device file (character _or_ block) labeled as a keyboard (oh, and what _is_ the device file for a keyboard?. I would like to know if it is possible to do this, and if so, how.


Disallow switching to other windows

I'm working on a python project where I'm displaying a graphical window with a login screen. I've disabled the close, re-size and minimize buttons. The OS is Ubuntu. I have to disable all the interrupts, including disabling system shortcuts like `Alt`+`Tab`, `Alt`+`F4`, etc. so that a user can log in only after entering the username and passwords on the screen.


Vim colorscheme background not filling terminal

I am using vim with lxterminal, and the colorscheme kolor, and I am experiencing an issue where vim's background color does not fill the entire terminal. ![vim background](http://i.stack.imgur.com/iWd37.png) It can be seen clearly at the bottom of this screenshot, as you can see the color of my terminal. My .vimrc is as follows;               syntax on          " Enable syntax highlighting          set number         " Enable line numbers     set smartindent    " Automatically indent text     set tabstop=4      " Set tab width to 4 spaces     set shiftwidth=4   " Indent text when using '>'     set expandtab     set nocompatible   " Disable compatibility mode (prevent ABCD key bugs)     set viminfo=          filetype plugin on " Enable filetype plugins          au BufNewFile,BufRead *.ino set filetype=cpp " Alias arduino (ino) files      I have tried changing my `TERM` environment variable to `screen-256color`, but to no avail. `TERM` is currently set to `xterm-256color`.


delete files matching pattern

I need to recursively remove all files in all subdirs where the filename contains a number followed by an 'x' followed by a number, at least two times. Example: I'd want to remove these files:               'aaa-12x123-123x12.jpg'     'aaa-12x12-123x12-12x123.jpg'      But I do NOT want to remove these files:               'aaa.jpg'     'aaa-12x12.jpg'     'aaaxaaa-123x123.jpg'     'aaaxaaa-aaaxaaa.jpg'      How can I do that (from the bash shell)


Removing unwanted lines in text file

All I need is the `sed` or `awk` code to remove the even numbered lines in a text file. Nothing fancy I just need to remove irrelevant data on the even lines of a text file.


How to use netstat command

My question is what does it mean to LISTEN or ACCEPT on a port as it relates to my example? Example: I have a tomcat server, and It will use port 8080. I want to make sure that port is available for me to use. What commands should I perform on my unix server and why? what information would a command like this give me: `netstat -an | grep LISTEN`


Create multiple databases in one command line?

Can this command be scripted?               $ mysqladmin -u username -p create databasename      I'd like to do it for multiple names all at once? Also I'd like to then set permissions for all of them at once as well. I'm not sure how to do this?


Recovering files using extundelete

I've accidentally deleted some files in my package managers's cache after an update (so I've deleted all packages that were downloade and unforunately they weren't even installed). Here's what I've done:   1. Booted to a Ubuntu System that's on the same HDD as the Arch system.   2. Now that I booted into Ubuntu the root partition of the Arch System is unmounted so, extundelete gave me this output:              $ sudo extundelete /dev/sda1 --restore-directory /var/cache/pacman/pkg/          WARNING: Extended attributes are not restored.          Loading filesystem metadata ... 232 groups loaded.          Loading journal descriptors ... 30722 descriptors loaded.          Searching for recoverable inodes in directory /var/cache/pacman/pkg/ ...           9385 recoverable inodes found.          Looking through the directory structure for deleted files ...           9385 recoverable inodes still lost.          No files were undeleted.      Is there anything I can do about it? Or am I completely screwed?


systemd - Timer units that mimic anacron behaviour

I need to write a timer unit for a machine which is turned of frequently (e.g. classical desktop setup). This timer unit needs to be activated regularly but not very often (e.g. weekly, monthly). I did find some approaches but they all don't really fit:   * According to the man pages only the `OnBootSec` and the `OnStartupSec` directives will be activated if the configured point of time is in the past. I found as well some examples using a combination of these with `OnActiveSec` to define a regular event. The problem is: Every time the machine is booted the timer will activate the configured unit. If you got a timer which should run ONCE a week/month that is far too often. For example: I don't want to get my logs rotated three times a day...   * Solutions with the `OnCalendar` directive. If the machine is powered off at the configured point in time (mostly midnight because if you omit the hour in the time specification it defaults to 00:00:00) the timer won't be activated after the next boot. That's at least how I got it. Is that right ? So here comes the question:   **Are timer with calendar events activated right after the next startup if the configured time is in the past ?   If not: Is there a workaround to get such a behaviour ?**


Batch file move to directory structure based on filename

I am writing a script to move files into directories based on the filename. Files have `yyyyddmm-xxxxxxx.jpg` name format. The desired directory structure is in the format `2013/01 Jan/31`. I am unable to get `date` to format correctly with a space between month number and month name. When I try to use `+%Y/%m %b` format, I get this error message: > date: extra operand `%b"' I tried double and single quotation marks, but to no avail. However, `date +"%Y/%m %b/%d"` works fine in `sh`: > 2013/10/27 Oct Also, is there a better way to generate the directory name than using `MOVEDIRSTR` and `MOVEDIR` variables (see script)? Here's my current script:               FLIST=`ls "$IMGDIR" | grep -E '^.*\.jpg$'`          # If there are files to move     if [ -n "${FLIST}" ]; then         # For each file         while read -r line; do             # Parse filename to YYYY/mm Mmm/Dd             echo $line             MOVEDIRSTR=`sed -r -e 's:([0-9]{4})([0-9]{2})([0-9]{2}).*:date -d \1-\2-\3 +%Y/%m_%b/%d:' <<< "$line"`             MOVEDIR=`$MOVEDIRSTR`                  # If a directory does not exist, create it             [ -d "$ARCHIVEDIR/$MOVEDIR" ] || (mkdir -p "$ARCHIVEDIR/$MOVEDIR")                  # Move file into YYYY/mm Mmm directory             # mv -f "$IMGDIR/$line" "$ARCHIVEDIR/$MOVEDIR"         done <<< "$FLIST"     fi


Is there a command to move a file, and symlink it back to where it was?

I often find myself wanting to move a file, then create a symlink where it was. In doing this by hand I tend to twist my mind. (Esp after doing half a dozen files) Use cases:   * Moving all my "dot files" to a folder so i can version control them   * Moving a file onto a faster disk (scratch) for High Performance Computing If there is not a single command,   I would appreciate a fish script.   (fish is not a POSIX shell, does not s pport the sh language)


Which media to use for backing up data of my laptop?

I work at home on my laptop installed with Windows 7 & Ubuntu 13.04. I have stopped working on Windows since much time & would continue to work on Linux only. I have all my important data in the laptop. I haven't yet used any external media for backup but now I feel the need for the same. Now, what media should I use? I have the below considerations:   1. I have my own data like webpages, text docs, videos, audios etc.   2. I have videos & photos of my child which will obviously go on increasing with time. I was thinking to save these in DVDs but since a few months the DVDs I had been purchasing aren't getting burned. I yesterday got Verbatim DVDs from eBay.in but they also didn't work. Also how much trustworthy are DVDs !! I burned gparted on a Amkette DVD 4 months back & now it isn't working properly. I think DVDs aren't good options as the number of DVDs will go on increasing to keep backup of my baby's videos & much care needs to be taken to keep it safely. In contrast external hdd is more safe & in 1 hdd only I can keep all these data along with my own. Also external hdd is more reliable than DVDs. HDDs will last for many many years but not DVDs.   3. DVDs are getting extinct; future devices may not have DVD drivers. So DVDs don't seem to be a good choice.   4. I think external HDDs can be used with any laptop or computer like flash drive (no external power required). It can be used irrespective of the OS whether Windows or Linux. I should be able to format it, create partitions of any filesystem type... In a nutshell, I can treat it in the same way as internal HDD & flash drive; i.e. external HDDs are only an extension of my laptops internal memory space. I'm looking for this 'general' external device & not one that works with any specific s/w or h/w. Please throw some light on these. I feel external HDDs are the best choice of backup media.


How to stream audio from /dev/dsp?

What is the best way to stream audio from `/dev/dsp` (I'm using OSS on Debian). I would prefer HTTP streaming, but if there is a way on another protocol, I can deal with that.


What Linux kernel features does os-prober require to find a Windows 8 installation?

I built a new custom Linux kernel using `make localmodconfig` and after booting the new kernel, `update-grub` doesn't detect my Windows 8 installation. My distro kernel (with tons of modules I don't need) found the Windows 8 installation and added it to the grub2 menu without any problems, so I must be missing some kernel features/modules. What kernel features are required for the Windows 8 boot loader to be detected & added to the grub boot menu?


Unable to preserve ownership in a copy but able with a move?

I have noticed that I am unable to preserve ownership if I `rsync -o` files. However, I am when I move them. This is all without admin privileges. What is the rationale of this? Several threads e.g. (1) seem to echo the need for admin privileges


Ignore all matches to negated extglob pattern in recursive ls

I would like to recursively list all files in a directory which match a given input pattern **using ls**. (Oh, and this is in Bash). The only way I can think of to do this using ls is to `shopt -s extglob` and then use the `ls --ignore=pattern` option with the extended glob negate pattern `!( pattern-list )`. Seems kind of roundabout to negate in an ignore but otherwise wildcards don't recurse. Assuming I already have the directory to look in as `dir` and the pattern to match against as `file`, this is my current attempt: `ls -AR --ignore='!('"${file}"')' ${dir}` However, this does not seem to have the desired effect, for example in a test case where the directory structure gives this output for `ls -AR`:                   .:         a  a.c  b  b.c  c  c.h  s              ./s:         a  a.c  b  b.c  c  c.h      My command with `file = *.c` and `dir = s` (full command: `ls -AR --ignore=!(*.c) s`) gives this output:                   ./s:         a  a.c  b  b.c  c  c.h      I know I could pipe it into grep quite easily, and do something like `ls -AR s | grep -v '.*.c'` and get output like:                   s:         a         b         c         c.h      but I am looking for a way to do this just through `ls`. Sorry if I was unclear at all, this is my first time on a StackExchange site. Thanks in advance!


Editors Nano/VIM not using resources

Does anyone here know the resources it takes for editors to search and replace in a large file? The reason I am asking, is I have a 32 core server that `HTOP` is only showing **one** core at 100% when search/replace on a 3GB file with an editor. I am wondering if my editor search/replace is a single threaded, and if so is there a way to delegate more resources so that these tasks don't take so long? I have to say, it is frustrating to see 31 idle cores and 1 at 100% when a task is taking 25 to 30 minutes. Oh and if it makes a difference, the RAM is 32GB sitting at 19GB used including cache.


How to get past grub rescue?

So this weekend when my Windows install crashed I decided to create a partition for Ubuntu for my application development instead of running Ubuntu on a VM. But I didn't install Ubuntu with the right file system I wanted, so I formatted that partition while I was in my install of Windows. Now I am getting this when I am trying to boot into Windows.               error: unknown filesystem     grub rescue >      What do I need to do to get past this so I can boot into Windows? And where would Ubuntu install the extra files for something to run like this? I know basic Unix/Linux commands, but not enough to figure out how to get past this.


sftp script to get a file from remote machine

I use a script, which contains the line:               sftp    $FTP_USER@phcsftp.pearsoned.com:/dir/file.txt      When I run the script, it asks for my password:               user@phcsftp.pearsoned.com's password:      However, I don't want to be prompted to type my password. I want my script automate the password entry and download the files Guys, I don't want to do it. All I want to catch that prompt inside the script and put password. Is it possible? sshpass belong to bash? this is not working at all


Fail to log in HPC nodes (Permission denied)

We have four login nodes in our HPC system, namely al1, al2, c1 and c2. I could log in all the four nodes previously. But recently I suddenly cannot log in al1 and al2 while I still can log in c1 and c2. I didn't change any settings on my Mac and desktop PC (I tried on these two computers and encountered the same situation). The interactive login process was as follows: > username@login.node's password: > > Permission denied, please try again. > > username@login.node's password: > > Permission denied, please try again. > > username@login.node's password: > > Permission denied (publickey,gssapi-with-mic,password). It seems to me that someone changed something on al1 and al2 that led to my failure to pass the verification. I have reported to the HPC administrators but received no reply yet. The error message complained about permission (permission denied). What could be the reason for my failure to log in al1 and al2 nodes? What can be done to help me get the access permission? Any ideas? Thanks!


Killed `rm` and `cp` on nfs share

I am just testing an `rsnapshot` installation on my laptop which should backup to a NAS mounted via `nfs` on my laptop. On one test `rsnapshot` died with a `cp -al` problem (i.e. a problem with hard links) when moving `daily.0` to `daily.1`, I think the problem was when it tried to copy the `../etc/alternatives/` part... During debugging I tried to remove the directory `daily.0` on the `nfs` manually on command line, however `rm` exited with the message `killed`. A similar problem occured with `cp` a few days ago though I cannot reproduce it (`cp` between two `nfs` subdirectories exited also with the message `killed`). So is there any way to get more informative error messages from `rm` and `cp` to find out what's the actual problem is? **Edit** After reading kyle-jones anwer I watched my RAM usage during several operations and confirmed that when I do something on my `nfs` mount on large directories, my memory fills up very fast up to 4GB (that's my physical memory on my laptop) and then the process is killed. This happend for: `cp`, `rm`, `du` and even for `ls`. As mount options for my `nfs` mount I used: `-o rw,hard,intr,tcp,actimeo=3` (and specified `nfs` via `-t nfs`).


Is there a difference between ./script and bash script?

Given a shell script file that begins as               #!/bin/bash          # (bash script here),      and has been `chmod +x`ed, is there any difference in running `./script` and `bash script` from the command-line?


Tab auto completion doesn't work with apt-get install (kubuntu)

I've noticed a strange behavior of my shell on Kubuntu. Auto completion doesn't work well when I try to install new software. It works only for default commands (when I type "apt-get inst" and I press tab, "install" is autocompleted) but doesn't work when I type a portion of name of software I want to install. I've tried to uncomment `/etc/bash.bashrc` lines for auto completion, but nothing changed. What's wrong?


DEC ANSI command sequence questions; cursor movement

So I'm writing a terminal emulation (I know, I should just compile putty, etc.) and am at the stage of plodding through vttest to make sure it's right. I'm basing it on the VT102 for now but will add later terminal features such as color when the basics are working right. The command set is mostly ANSI. DEC had their own command set but supported the ANSI commands from about 1973. Those ANSI standards are apparently not available now but the ECMA equivalents are, I have them (ECMA-48 seems most relevant) but does not answer this question as far as I can see. Most ANSI command sequences start with ESC. Many commands start with the command sequence identifier shown here as CSI and represented in the data as 0x1c 0x5b (ESC `[`), or 0xdb if 8-bit communication was possible. Then followed a sequence identifying the command. Some commands affect cursor position, some the screen, some provoke a response to the host and so on. Some terminal commands include a numeric argument. Example `CSI 10 ; 5 H` means make the cursor position row 10, column 5. When the numeric argument is missing there is a default value to use: `CSI 10 ; H` means make the cursor position row 10, column 1 because 1 is the default value when an argument is not given. I have the vt102 manual from vt100.net (great resource) and about a dozen pages giving partial information on these command sequences. Apparently the complete gospel DEC terminal spec never made it out of DEC. What is clear is that `CSI C` is move cursor right and that the default value is 1. What isn't clear is what is the meaning of `CSI 0 C`. Why have a zero there, it would seem to make the command do nothing? If it means "use default value" then it could have been sent as 1 instead, but the shorter string would have no argument and rely on the default value being interpreted as 1 anyway. These actual physical VT terminals were often used at 300 baud and below so the one character did matter! I'm not so advanced with vttest that I can just try it both ways and see which makes everything perfect but I'm far enough that little questions like this are starting to matter.


How to prevent cron emailing on termination

Whenever one of my cron scripts finishes, I get an email saying `/bin/bash: line 1: 19653 Terminated <command>`. How do I prevent this email being sent? I suspect it might only happen when the script is interrupted by a signal rather than finishing normally, but I haven't been able to confirm this. Either way, I don't need to be receiving those emails, although I do still want to receive emails from other scripts, or if this one produces any output. So, how do I make cron send an email only if the script produces output, rather than whenever a script finishes?


change column with awk scriting

I am trying to make a script B that uses another script A to change a specific column in a specific line. The problem is that when I run the script A alone it runs perfectly but when I try to use the script B (allowing me to run script A in other directories) it changes the entire line and not the specific column. What is the problem? script A (`0.MOF.run`):               #!bin/sh     echo $pot     mkdir u$pot       cp u6000/towhee_input u$pot      cd u$pot     mv towhee_input 1     awk < 1 -v k="-$pot.0" 'NR==12 {$2=k}{print}' > towhee_input        cd ..      script B:               #!bin/sh     echo -n "Please Incert the Number of Potencials: "     read c     declare -i b     b=$c+1     rm pot_pid     a=1          while [ $a -lt $b ]     do        pot=$(awk < data -v k="$a" 'NR==k ')             . 0.MOF.mkdir        . 1.MOF.run             a=`expr $a + 1`        done


A VNC server is already running - howcome?

[root@localhost ~]# service vncserver restart     Shutting down VNC server: 11:SXYZ 12:DXYZ 13:FXYZ  [FAILED]     Starting VNC server: 11:SXYZ A VNC server is already running as :11                                                            [FAILED]     [root@localhost ~]# vncserver -list          TigerVNC server sessions:          X DISPLAY #     PROCESS ID     [root@localhost ~]# vncserver :11     A VNC server is already running as :11     [root@localhost ~]# vncserver -kill :11          Can't find file /root/.vnc/localhost.localdomain:11.pid     You'll have to kill the Xvnc process manually      I have Centos 6.4, I'm accessing it through its xrdp (Version 0.5.0) and Xvnc TigerVNC 1.1.0 services. I can connect without any problem with user SXYZ, only that I don't understand why is this, and it isn't nice looking... The :11 is not used that is for sure, as I just modified vncserver file to go for displays 11,12,13 instead of 1,2,3. Any ideas?


Sed: Replace N first occurrences of a character

I am looking to replace the 5 first occurences of the whitespace character per line inside a sed script. Here's what I have so far `sed -e "s/ /;/" -e "s/ /;/" -e "s/ /;/" -e "s/ /;/" -e "s/ /;/" myfile` Is there any nicer way of doing it? For the record, I am using the Solaris sed. I don't know if it makes any difference.


Interrupt sequence CTRL+C does not work for user

In any terminal operating under GNOME, if I press `Ctrl`+`C`, I only see a question mark. Same goes for `Ctrl`+`Z`. The output of `stty -a | grep intr` is:               intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?;      I can use the sequence under all other tty's (outside X), and can also use it for another user; only one user is affected. How can I fix this?


Errors at startup on my Wheezy system

I noticed that I got some error when my Debian Wheezy was starting today, but then I couldn't find anywhere to look into it in more detail. There was nothing interesting in `dmesg` or `syslog`. Where can I find these messages?


Reverse yrange without shifting histogram in the downward direction

i want to draw the given image in gnuplot. ![real graph](http://i.stack.imgur.com/LSqGr.png) I tried it in gnuplot, but i am stucked with reversing of y axis (below the graph which i currently obtained). ![currently obtained image](http://i.stack.imgur.com/4OAvb.png) i want to represent yrange from 2300 to 0. But the histogram should plot from x axis in the upward direction as show in the first graph. also need to give labels on each histogram as in the first graph. please tell gnuplot script for doing this...... Thanks in advance.....


mkfifo - Does disk I/O actually occur?

I have 2 applications:   * Producer (N instances)   * Consumer (1 instance) I currently write out **_intermediate_** results from the producers, and then the consumer reads these files from disk and produces a **_final_** result. I would like to minimize this I/O by "streaming" the outputs from the producers directly to the consumer. I came across named pipes (mkfifo) and a subsequent example here. This looks great, but what I can't determine is how this is actually implemented? Is the FIFO queue just being buffered through a file? If so, that probably wouldn't help me. I would like for the contents to stream "through memory" entirely without utilizing the disk. Maybe this isn't possible across processes?


Hex codes for input key combinations

In `iTerm2` one can setup keyboard shortcuts so that for a given input sequence, iTerm2 sends a specific hex code to the terminal. **What** exactly are these **hex codes**? And how can I identify a hex code for a given input key sequence? In my case I am specifically interested in looking up the `hex code` associated with `Control + Alt + <char>` with char being `u`,`i`,`j`,`k` and `l`. I found this article that shows some examples of these conversions, but it doesn't list any `Control + Alt + <char>` combinations. The hope is that ultimately this will help me solve this other question in AskDifferent.


the n key does't work anymore but N does

I've been playig around xmodmap to create a custom keyboard (see Get the keycode of a key, from a custom made keyboard) But now, I can't use the n key anymore, but the Shift+n still work. I think I messed up something, so I reseted to defaults my keyboard (in the Ubuntu system settings), everything seems to work ok, execpt that damn `n` key! Do you have any idea??


How can I schedule a python program to run from another python program?

I'm running a Python program on my Linux server, and depending on some external data it has to run again at `xx` minutes or hours from now. So let's say it runs at 6 AM, and then it has to run again at 7 AM. Then, at 7AM, it checks some things and it has to run again at 15:45, and then the next day at 2.05AM, and then the next day at 4.05AM etc. As you can see there is no predefined logic in the times it has to run, it has to be defined at the time it runs. The only task schedule mechanism I know is `crontab`, bu I'm not sure how to add tasks to it without running `crontab -e` and besides that `crontab` seems more for recurring tasks and in my case I would add a `crontab` job and after running it once remove it again and add a new one. The only thing I could come up with was to set the next rundate in a textfile, and let a `crontab` job check it every minute to see if it is time to run the program.


C Preprocessor (cpp) and cc1 issue

I've been trying to fix a problem related with cross (kernel) compilation which as given the following message: `gcc: error trying to exec 'cc1': execvp: No such file or directory` I found that this was an issue as discussed here. Also, when defining `GCC_EXEC_PREFIX` variable with `/usr/lib/gcc/i486-linux- gnu/4.7/` I noticed that `whereis cc1` only shows `cc1:`. Could this be the problem since cc1 has not a path associated to it? Also, how can I define the path to cc1? **PS:** Sorry for the (almost) duplicated post. But I just think that this might really be the issue.


Bash-completion and grep

I installed a program (`iftop`) on Debian Squeeze but some days ago I forgot it's name. I had only this information about the program: 1) It was called `*top` 2) I could find it using `bash-completions`. I wanted to `grep` all the options of `bash-completion`. Do you have any idea on how can I do it?


How do I debug Alsa configuration file errors?

I've got an embedded device with ALSA support, and I'm trying to figure out how to get dsnoop working. The reason is that I want two applications to share the microphone input. But the problem is that ALSA seems to ignore `/etc/asound.conf` entirely. E.g. `arecord --list-pcms` does not list the pcm's defined there. How can I check the results of `/etc/asound.conf` parsing? There is a mysterious line in `/usr/share/alsa/alsa.conf`, "errors false". Does this do anything?


Do LVM snapshots ultimately cause fragmentation?

I'm planning on using LVM in order to be able to take atomic snapshots of large files and rsync them to a remote site. What I'd like to know is whether there is any long-term impact on the main (non-snapshot) volume: if I typically keep the snapshots for 24h before dropping and creating a new snapshot, does the main volume get progressively more fragmented?


Running scp when .bashrc of remote machine includes source command

I cannot copy a file over scp when the remote machine .bashrc file includes **source** command to update paths and some variables. Why does it happen?


Where is using @ before a date string for seconds since the epoch documented?

GNU `date` and `touch` commands (and presumably others) use `@date` to define a date string as seconds since the epoch. For example:               $ TZ=UTC date -d@10     Thu Jan  1 00:00:10 UTC 1970      I was answering a question and wanted to point the OP to where this particular feature was documented but I can't find it. Neither `man date` not `man touch` explain it. The closest is this from the "Examples" section of the `date` man page:                  Convert seconds since the epoch (1970-01-01 UTC) to a date                    $ date --date='@2147483647'      The `info` page for `date` states that this was introduced in `coreutils` 5.3.0, but does not really explain it further either:                Or if you do not mind depending on the `@' feature present since      coreutils 5.3.0, you could shorten this to:                date -d @946684800 +"%F %T %z"           1999-12-31 19:00:00 -0500      So, where is `@seconds` documented? Where am I supposed to learn about it and where can I point someone who does not? Is that off-hand mention in `man date` really the best we have?


CLFS: Building GCC cross compiler

Currently I try to build a embedded Linux from scratch with the instructions from Cross Linux from Scratch. Everything worked fine until I tried to compile the GCC Cross-Compiler. I want to build the Linux for the Beagleboard-xM... So I choosed the following settings:               export CLFS_ABI="aapcs-linux"     export CLFS_HOST="x86_64-cross-linux-gnu"     export CLFS_TARGET="armv7a-unknown-linux-uclibceabi"     export CLFS_ARCH="arm"     export CLFS_ENDIAN="little"     export CLFS_ARM_ARCH="armv7"     export CLFS_ARM_MODE="arm"     export CLFS_FLOAT="hard"     export CLFS_FPU="neon"      No as soon as I try to run the instructions on this page the command `make all-gcc all-target-libgcc` runs into an error.               checking for armv7a-unknown-linux-uclibceabi-gcc...  /mnt/clfs/sources/gcc-build/./gcc/xgcc -B/mnt/clfs/sources/gcc-build/./gcc/ -B/mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/bin/ -B/mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/lib/ -isystem /mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/include -isystem /mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/sys-include        checking for suffix of object files... configure: error: in `/mnt/clfs/sources/gcc-build/armv7a-unknown-linux-uclibceabi/libgcc':     configure: error: cannot compute suffix of object files: cannot compile     See `config.log' for more details.     make: *** [configure-target-libgcc] Error 1      and the `/mnt/clfs/sources/gcc-build/armv7a-unknown-linux- uclibceabi/libgcc/config.log` looks like this:               This file contains any messages produced by compilers while     running configure, to aid debugging if configure makes a mistake.          It was created by GNU C Runtime Library configure 1.0, which was     generated by GNU Autoconf 2.64.  Invocation command line was            $ /mnt/clfs/sources/gcc-4.6.0/libgcc/configure --cache-file=./config.cache --with-cross-host=x86_64-cross-linux-gnu --prefix=/mnt/clfs/cross-tools --with-sysroot=/mnt/clfs --disable-nls --disable-shared --without-headers --with-newlib --disable-decimal-float --disable-libgomp --disable-libmudflap --disable-libssp --disable-threads --disable-multilib --with-abi=aapcs-linux --with-arch=armv7 --with-mode=arm --with-float=hard --with-fpu=neon --enable-languages=c,lto --program-transform-name=s&^&armv7a-unknown-linux-uclibceabi-& --disable-option-checking --with-target-subdir=armv7a-unknown-linux-uclibceabi --build=x86_64-cross-linux-gnu --host=armv7a-unknown-linux-uclibceabi --target=armv7a-unknown-linux-uclibceabi --srcdir=../../../gcc-4.6.0/libgcc          ## --------- ##     ## Platform. ##     ## --------- ##          hostname = virtualUbuntu     uname -m = x86_64     uname -r = 3.2.0-31-generic     uname -s = Linux     uname -v = #50-Ubuntu SMP Fri Sep 7 16:16:45 UTC 2012          /usr/bin/uname -p = unknown     /bin/uname -X     = unknown          /bin/arch              = unknown     /usr/bin/arch -k       = unknown     /usr/convex/getsysinfo = unknown     /usr/bin/hostinfo      = unknown     /bin/machine           = unknown     /usr/bin/oslevel       = unknown     /bin/universe          = unknown          PATH: /mnt/clfs/cross-tools/bin     PATH: /bin     PATH: /usr/bin               ## ----------- ##     ## Core tests. ##     ## ----------- ##          configure:1742: creating cache ./config.cache     configure:1903: checking for --enable-version-specific-runtime-libs     configure:1916: result: no     configure:1964: checking for a BSD-compatible install     configure:2032: result: /usr/bin/install -c     configure:2048: checking for gawk     configure:2075: result: gawk     configure:2095: checking build system type     configure:2109: result: x86_64-cross-linux-gnu     configure:2129: checking host system type     configure:2142: result: armv7a-unknown-linux-uclibceabi     configure:2245: checking for armv7a-unknown-linux-uclibceabi-ar     configure:2272: result: /mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/bin/ar     configure:2337: checking for armv7a-unknown-linux-uclibceabi-lipo     configure:2364: result: armv7a-unknown-linux-uclibceabi-lipo     configure:2429: checking for armv7a-unknown-linux-uclibceabi-nm     configure:2456: result: /mnt/clfs/sources/gcc-build/./gcc/nm     configure:2521: checking for armv7a-unknown-linux-uclibceabi-ranlib     configure:2548: result: /mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/bin/ranlib     configure:2613: checking for armv7a-unknown-linux-uclibceabi-strip     configure:2640: result: /mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/bin/strip     configure:2702: checking whether ln -s works     configure:2706: result: yes     configure:2723: checking for armv7a-unknown-linux-uclibceabi-gcc     configure:2750: result:  /mnt/clfs/sources/gcc-build/./gcc/xgcc -B/mnt/clfs/sources/gcc-build/./gcc/ -B/mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/bin/ -B/mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/lib/ -isystem /mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/include -isystem /mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/sys-include        configure:3019: checking for C compiler version     configure:3028:  /mnt/clfs/sources/gcc-build/./gcc/xgcc -B/mnt/clfs/sources/gcc-build/./gcc/ -B/mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/bin/ -B/mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/lib/ -isystem /mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/include -isystem /mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/sys-include    --version >&5     xgcc (GCC) 4.6.0     Copyright (C) 2011 Free Software Foundation, Inc.     This is free software; see the source for copying conditions.  There is NO     warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.          configure:3039: $? = 0     configure:3028:  /mnt/clfs/sources/gcc-build/./gcc/xgcc -B/mnt/clfs/sources/gcc-build/./gcc/ -B/mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/bin/ -B/mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/lib/ -isystem /mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/include -isystem /mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/sys-include    -v >&5     Reading specs from /mnt/clfs/sources/gcc-build/./gcc/specs     COLLECT_GCC=/mnt/clfs/sources/gcc-build/./gcc/xgcc     COLLECT_LTO_WRAPPER=/mnt/clfs/sources/gcc-build/./gcc/lto-wrapper     Target: armv7a-unknown-linux-uclibceabi     Configured with: ../gcc-4.6.0/configure --prefix=/mnt/clfs/cross-tools --build=x86_64-cross-linux-gnu --host=x86_64-cross-linux-gnu --target=armv7a-unknown-linux-uclibceabi --with-sysroot=/mnt/clfs --disable-nls --disable-shared --with-mpfr=/mnt/clfs/cross-tools --with-gmp=/mnt/clfs/cross-tools --with-mpc=/mnt/clfs/cross-tools --without-headers --with-newlib --disable-decimal-float --disable-libgomp --disable-libmudflap --disable-libssp --disable-threads --enable-languages=c --disable-multilib --with-abi=aapcs-linux --with-arch=armv7 --with-mode=arm --with-float=hard --with-fpu=neon     Thread model: single     gcc version 4.6.0 (GCC)      configure:3039: $? = 0     configure:3028:  /mnt/clfs/sources/gcc-build/./gcc/xgcc -B/mnt/clfs/sources/gcc-build/./gcc/ -B/mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/bin/ -B/mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/lib/ -isystem /mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/include -isystem /mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/sys-include    -V >&5     xgcc: error: unrecognized option '-V'     xgcc: fatal error: no input files     compilation terminated.     configure:3039: $? = 1     configure:3028:  /mnt/clfs/sources/gcc-build/./gcc/xgcc -B/mnt/clfs/sources/gcc-build/./gcc/ -B/mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/bin/ -B/mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/lib/ -isystem /mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/include -isystem /mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/sys-include    -qversion >&5     xgcc: error: unrecognized option '-qversion'     xgcc: fatal error: no input files     compilation terminated.     configure:3039: $? = 1     configure:3055:  /mnt/clfs/sources/gcc-build/./gcc/xgcc -B/mnt/clfs/sources/gcc-build/./gcc/ -B/mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/bin/ -B/mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/lib/ -isystem /mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/include -isystem /mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/sys-include    -o conftest -g -O2   conftest.c  >&5     conftest.c:1:0: error: target CPU does not support ARM mode     configure:3058: $? = 1     configure:3246: checking for suffix of object files     configure:3268:  /mnt/clfs/sources/gcc-build/./gcc/xgcc -B/mnt/clfs/sources/gcc-build/./gcc/ -B/mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/bin/ -B/mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/lib/ -isystem /mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/include -isystem /mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/sys-include    -c -g -O2  conftest.c >&5     conftest.c:1:0: error: target CPU does not support ARM mode     configure:3272: $? = 1     configure: failed program was:     | /* confdefs.h */     | #define PACKAGE_NAME "GNU C Runtime Library"     | #define PACKAGE_TARNAME "libgcc"     | #define PACKAGE_VERSION "1.0"     | #define PACKAGE_STRING "GNU C Runtime Library 1.0"     | #define PACKAGE_BUGREPORT ""     | #define PACKAGE_URL "http://www.gnu.org/software/libgcc/"     | /* end confdefs.h.  */     |      | int     | main ()     | {     |      |   ;     |   return 0;     | }     configure:3286: error: in `/mnt/clfs/sources/gcc-build/armv7a-unknown-linux-uclibceabi/libgcc':     configure:3289: error: cannot compute suffix of object files: cannot compile     See `config.log' for more details.          ## ---------------- ##     ## Cache variables. ##     ## ---------------- ##          ac_cv_build=x86_64-cross-linux-gnu     ac_cv_env_CC_set=set     ac_cv_env_CC_value=' /mnt/clfs/sources/gcc-build/./gcc/xgcc -B/mnt/clfs/sources/gcc-build/./gcc/ -B/mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/bin/ -B/mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/lib/ -isystem /mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/include -isystem /mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/sys-include   '     ac_cv_env_CFLAGS_set=set     ac_cv_env_CFLAGS_value='-g -O2'     ac_cv_env_CPPFLAGS_set=set     ac_cv_env_CPPFLAGS_value=     ac_cv_env_CPP_set=     ac_cv_env_CPP_value=     ac_cv_env_LDFLAGS_set=set     ac_cv_env_LDFLAGS_value=     ac_cv_env_LIBS_set=     ac_cv_env_LIBS_value=     ac_cv_env_build_alias_set=set     ac_cv_env_build_alias_value=x86_64-cross-linux-gnu     ac_cv_env_host_alias_set=set     ac_cv_env_host_alias_value=armv7a-unknown-linux-uclibceabi     ac_cv_env_target_alias_set=set     ac_cv_env_target_alias_value=armv7a-unknown-linux-uclibceabi     ac_cv_host=armv7a-unknown-linux-uclibceabi     ac_cv_path_install='/usr/bin/install -c'     ac_cv_prog_AR=/mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/bin/ar     ac_cv_prog_AWK=gawk     ac_cv_prog_CC=' /mnt/clfs/sources/gcc-build/./gcc/xgcc -B/mnt/clfs/sources/gcc-build/./gcc/ -B/mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/bin/ -B/mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/lib/ -isystem /mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/include -isystem /mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/sys-include   '     ac_cv_prog_LIPO=armv7a-unknown-linux-uclibceabi-lipo     ac_cv_prog_NM=/mnt/clfs/sources/gcc-build/./gcc/nm     ac_cv_prog_RANLIB=/mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/bin/ranlib     ac_cv_prog_STRIP=/mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/bin/strip          ## ----------------- ##     ## Output variables. ##     ## ----------------- ##          AR='/mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/bin/ar'     AWK='gawk'     CC=' /mnt/clfs/sources/gcc-build/./gcc/xgcc -B/mnt/clfs/sources/gcc-build/./gcc/ -B/mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/bin/ -B/mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/lib/ -isystem /mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/include -isystem /mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/sys-include   '     CFLAGS='-g -O2'     CPP=''     CPPFLAGS=''     DEFS=''     ECHO_C=''     ECHO_N='-n'     ECHO_T=''     EXEEXT=''     INSTALL_DATA='${INSTALL} -m 644'     INSTALL_PROGRAM='${INSTALL}'     INSTALL_SCRIPT='${INSTALL}'     LDFLAGS=''     LIBOBJS=''     LIBS=''     LIPO='armv7a-unknown-linux-uclibceabi-lipo'     LN_S='ln -s'     LTLIBOBJS=''     MAINT='#'     NM='/mnt/clfs/sources/gcc-build/./gcc/nm'     OBJEXT=''     PACKAGE_BUGREPORT=''     PACKAGE_NAME='GNU C Runtime Library'     PACKAGE_STRING='GNU C Runtime Library 1.0'     PACKAGE_TARNAME='libgcc'     PACKAGE_URL='http://www.gnu.org/software/libgcc/'     PACKAGE_VERSION='1.0'     PATH_SEPARATOR=':'     RANLIB='/mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/bin/ranlib'     SHELL='/bin/bash'     STRIP='/mnt/clfs/cross-tools/armv7a-unknown-linux-uclibceabi/bin/strip'     ac_ct_CC=''     asm_hidden_op=''     bindir='${exec_prefix}/bin'     build='x86_64-cross-linux-gnu'     build_alias='x86_64-cross-linux-gnu'     build_cpu='x86_64'     build_libsubdir='build-x86_64-cross-linux-gnu'     build_os='linux-gnu'     build_subdir='build-x86_64-cross-linux-gnu'     build_vendor='cross'     datadir='${datarootdir}'     datarootdir='${prefix}/share'     decimal_float=''     docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'     dvidir='${docdir}'     enable_decimal_float='no'     enable_shared='no'     exec_prefix='NONE'     extra_parts=''     fixed_point=''     host='armv7a-unknown-linux-uclibceabi'     host_alias='armv7a-unknown-linux-uclibceabi'     host_cpu='armv7a'     host_noncanonical='armv7a-unknown-linux-uclibceabi'     host_os='linux-uclibceabi'     host_subdir='.'     host_vendor='unknown'     htmldir='${docdir}'     includedir='${prefix}/include'     infodir='${datarootdir}/info'     libdir='${exec_prefix}/lib'     libexecdir='${exec_prefix}/libexec'     libgcc_topdir='../../../gcc-4.6.0/libgcc/..'     localedir='${datarootdir}/locale'     localstatedir='${prefix}/var'     mandir='${datarootdir}/man'     oldincludedir='/usr/include'     pdfdir='${docdir}'     prefix='/mnt/clfs/cross-tools'     program_transform_name='s&^&armv7a-unknown-linux-uclibceabi-&'     psdir='${docdir}'     sbindir='${exec_prefix}/sbin'     set_have_cc_tls=''     set_use_emutls=''     sharedstatedir='${prefix}/com'     slibdir='$(exec_prefix)/$(host_noncanonical)/lib'     sysconfdir='${prefix}/etc'     target_alias='armv7a-unknown-linux-uclibceabi'     target_noncanonical='armv7a-unknown-linux-uclibceabi'     target_subdir='armv7a-unknown-linux-uclibceabi'     tmake_file=''     toolexecdir='$(exec_prefix)/$(target_noncanonical)'     toolexeclibdir='$(toolexecdir)/lib'     vis_hide=''          ## ----------- ##     ## confdefs.h. ##     ## ----------- ##          /* confdefs.h */     #define PACKAGE_NAME "GNU C Runtime Library"     #define PACKAGE_TARNAME "libgcc"     #define PACKAGE_VERSION "1.0"     #define PACKAGE_STRING "GNU C Runtime Library 1.0"     #define PACKAGE_BUGREPORT ""     #define PACKAGE_URL "http://www.gnu.org/software/libgcc/"          configure: exit 1      What am I missing?


Adding badblocks on mounted partition

I tried to move some files to my NAS (ShareCenter DNS-320), but something shows up, when using file managers:               Input/Output error      or when using rsync on mounted cifs/smb share               rsync: close failed on "/mnt/nas1/_am-unordered/.long-file-name.mkv.PI2rPM": Input/output error (5)     rsync error: error in file IO (code 11) at receiver.c(856) [receiver=3.1.0]          # mount | grep mnt/nas1          //192.168.x.y/backup on /mnt/nas1 type cifs (rw,relatime,vers=1.0,cache=strict,username=admin,domain=BACKUP,uid=1000,forceuid,gid=0,noforcegid,addr=192.168.x.y,file_mode=0755,dir_mode=0755,nounix,serverino,rsize=61440,wsize=65536,actimeo=1)      I assume that there are bad sectors inside the NAS, I need to run `fsck` to check if there are broken disk inside my RAID-0 NAS. I have installed `fun_plug` using this tutorial, now I could ssh into the NAS successfully. Normally I would use `fsck -yvckfC -E fragcheck /dev/sdX` to check bad sectors on single unmounted disk. The question is, how to run badblocks and insert it to the bad block list on mounted RAID0 partition? since the ssh service are running on mounted partition on the NAS:               # umount /mnt/HD/HD_a2/       umount: /mnt/HD/HD_a2: device is busy.         (In some cases useful info about processes that use          the device is found by lsof(8) or fuser(1))          # lsof /mnt/HD/HD_a2/     COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF      NODE NAME     sh        1963 root    1w   REG    9,1     5191        12 /mnt/HD/HD_a2/ffp.log     sh        1963 root    2w   REG    9,1     5191        12 /mnt/HD/HD_a2/ffp.log     sh        1963 root   10r   REG    9,1     1942 246939802 /mnt/HD/HD_a2/fun_plug     rc        1986 root  txt    REG    9,1   587316 141426950 /mnt/HD/HD_a2/ffp/bin/bash     rc        1986 root  mem    REG    9,1    28892 139854377 /mnt/HD/HD_a2/ffp/lib/ld-uClibc-0.9.33-git.so     rc        1986 root  mem    REG    9,1   260898 139853932 /mnt/HD/HD_a2/ffp/lib/libreadline.so.6.2      **snip**     sshd      5519 root  mem    REG    9,1    60546 139854375 /mnt/HD/HD_a2/ffp/lib/libgcc_s.so.1     sshd      5519 root  mem    REG    9,1   359940 139854378 /mnt/HD/HD_a2/ffp/lib/libuClibc-0.9.33-git.so      Current NAS' RAID configuration are:               # cat /proc/mdstat     Personalities : [linear] [raid0] [raid1]      md1 : active raid0 sda2[0] sdb2[1]           7808789888 blocks 64k chunks          md0 : active raid1 sdb1[1] sda1[0]           524224 blocks [2/2] [UU]          unused devices: <none>


How to adjust brightness in Fedora 17 on Sony Vaio

I have a Sony E Series laptop with Fedora 17 and Windows 8 in dual boot. The brightness adjusts just fine on my Windows8 but not in Fedora. If I change it with the brightness slider in the power settings nothing happens. The brightness stays maximum even if I adjust the slider to minimum. Blinded by my screen and frustrated by the draining battery I tried everything on the net. I tried things like -   1. Reinstall bash. `yum reinstall bash`   2. Add this to kernel parameters in grub2.cfg - `acpi_backlight=vendor`   3. Add this line to xorg.conf - `Option "RegistryDwords" "EnableBrightnessControl=1"`   4. Add this line to grub.cfg - `"video.brightness_switch_enabled=1"`   5. Update the drivers for your video card.   6. Install some utility. Example - `xbacklight utility` from freedesktop.org None of these suggestions worked for me. I finally found the solution that worked and am sharing it in Q/A format for the benefit of others.


How to rename files using sed?

This is an sed expression that was created by a contributor here. More specifically by @craig-sanders. $FileToMove is set to "2012-09-01 Home insurance quote_zz20.pdf"               # use sed to extract folder number from filename.     FolderNo=$(echo "$FileToMove" | sed -r -e 's/.*zz([0-9]+)\.pdf/\1/')     # On my Mac, I figured that this command needs to be FolderNo=$(echo "$FileToMove" | sed -E -e 's/.*zz([0-9]+)\.pdf/\1/')      The above command is used to extract "20" from the name of the file. Now I want to replace zz20 with null. Been trying to do it. Will learn sed and before that need to learn regular expressions. In the meantime, I am sure it is super easy to replace it with null. Any tips?


Fluxbox time is wrong?

I'm using fluxbox on Arch, and the time is displayed incorrectly in the panel. The time works in XFCE, so I'm not sure why it isn't working in fluxbox. Is there a way to set the time in fluxbox from the internet?


Unable to connect to serial device; no /dev/ttySx

I wrote a Java application that connects to the serial port of the GSM modem. On Windows the serial ports have names like COM3, but in Linux Redhat 6.0 I had to switch to something like ttySx (X is number that came after S in `/dev/` directory). When I plug my modem in to Linux there are no serial entries in `/dev` (just ttyUSBx), but on Windows it works fine. What am I doing wrong?