How to specify a daemon shutdown command with upstart?

In an upstart configuration how do I define what command should be used to shutdown a server. Lets say I have daemon that has two seperate processes.   * startup.sh - to start the server    * shutdown.sh - to shut down the server Suppose I have an upstart file that looks like this.               description "Some Example Service"     author "Me"          start on runlevel [2345]     stop on runlevel [016]     respawn          exec satrtup.sh       How do I tell upstart that it should called shutdown.sh when shutting down the server? How does upstart normally expect to shut down a daemon?


setting up yum in stripped down linux

I have a box that contains minimal binaries needed to run Scientific Linux. What I want to do is to install additional programs. I could get rpm installed and tried to install yum but resolving those dependencies is a pain. Is there any easy way to do this?. What I want is to have all these basic utilities installed without much effort.At least if I could get yum to work without manually resolving each dependencies that would be great. I don't have physical access to the box.


Not able to run vnstat unless as root in debian 7

So, I need to run this command:               vnstat -tr 2      But as a user I just created, not as root, as root it works fine, but as a regular user I get this:               Error: Unable to get interface "eth0" statistics.     Error: Interface "eth0" not available, exiting.      On Debian 6 there wasn't this restriction, how do I remove it? Sounds like a permissions problem.


Difference between virtual interfaces with ifconfig and iproute2

I am wondering what is the difference between:               # ifconfig eth0:0 1.1.1.1/24      and just               # ip addr add 1.1.1.1/24 dev eth0      Btw I cannot do               # ip addr add 1.1.1.1/24 dev eth0:0     RTNETLINK answers: File exists      In `ip addr show` it appears differently :               eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000      link/ether 8c:ae:4c:fe:1f:75 brd ff:ff:ff:ff:ff:ff     inet 1.1.1.1/24 brd 1.1.1.255 scope global eth0:0 ---> with ifconfig     inet 2.2.2.2/24 scope global eth0 ----> with ip      When should I prefer the first way and when should I prefer the second way? It seems more cool to


How to format USB drive in Linux Mint 14 with GUI?

I'm new to Linux Mint and I've just installed Linux Mint 14. Now I need to format my USB drive, but I'm not getting any option to do that. Please suggest me anyone, how can I do that with a GUI?


Proper file system for an External Hard Drive to work well on Linux

I have a External Hard Drive (EHD) I want to use to backup the data on my Linux laptop. I want to know how I should format my EHD for it to work correctly with Linux. Thanks.


How can I run a specific command for each find result?

How would one run a specific command for each file that was found by using the `find` command? For the purpose of the question lets say that I would simply like to delete each file found by `find`. I am unix/linux noob so be gentle with me.


tinyproxy with user authentification

Does anybody have a solution that'll make tinyproxy work with user authentification like `pam_auth` at the squid proxy? I don't want to create a SSH-Tunnel and allow only localhost.


Can I fix bad blocks on my hard disk with a single command?

I'm working on fixing the errors in my Hard Disk, It's possible to do that manually but it might take hours. After typing this command `sudo badblocks -b 512 /dev/sda`, I got hundreds of results and I want to avoid fixing them manually. More details about my error can be found here So is there any tool I can use to fix the errors? Or maybe you could help me write a shell script?


Creating temp file vs process substituion vs variable expansion?

If I am doing something like   1. creating temporary file              some process generating output > temp_file     cat  temp_file        2. process substitution:              cat <(some process generating output)        3. another way :              cat <<<(some process generating output)      I have some doubts regarding these:   1. Is there any limit on data output size of process substitution`<()` `>()` or variable expansion `<<<()`   2. Which among these is the fastest or is there a way to do it faster? My ulimit command output is :               bash-3.00$ ulimit -a     core file size        (blocks, -c) unlimited     data seg size         (kbytes, -d) unlimited     file size             (blocks, -f) unlimited     open files                    (-n) 256     pipe size          (512 bytes, -p) 10     stack size            (kbytes, -s) 8480     cpu time             (seconds, -t) unlimited     max user processes            (-u) 8053     virtual memory        (kbytes, -v) unlimited


bash_history: comment out dangerous commands: `#`

To prevent logging "dangerous" commands in bash history, I have added following line to my `.bashrc` file:               HISTIGNORE='rm *:mv *:cp *:cat*>*:pv*>*'      this works well, but it has a side effect: I cannot see the complete history of commands executed on a machine. Let's say I have several machines for experiments, and I want to be able to see all commands executed. I would use the bash internal `history` to display executed commands, and perhaps grep for today's date:               history | grep Sep-28      What I would like do have is to log "dangerous" commands as well, but put a `#` at the beginning of the line, so that if I happen to execute the command from history by mistake, no damage would be done. I have no idea if this is possible. Any comment would be greatly appreciated. ## Update and clarification: The main reason why this is a problem for me is that I am usually connected to my machine from several terminals, and any command executed on one terminal is immediately read into history of other terminals. This is achieved by               PROMPT_COMMAND="history -a; history -c; history -r"      Lets imagine I have two terminals open. In one I have some `cat /dev/foo > file.out` process running. In the second, I check the progress with `ls -lAhF`. I keep repeating `ls` by pressing `Up` and `ENTER` (that is, last command from history). As soon as the first command finishes, the last command from history is no longer `ls`, but `cat /dev/foo > file.out`. If I am not careful, I will start cat again and overwrite file.out. What I would like to achieve is that the cat command would be preceded with a `#`, so that it would not be executed. I would however still see it in history and can reuse it (if it is a long command) by un-commenting it.


How to do calculation on eval variables in shell script

I want to do mathematical operations on eval variables in shell script, but it is not working.               query=first     eval avgOverall$query[1]=28.5          avgOverall=$(("`eval echo '${avgOverall'$query'[1]}'`+1")) | bc      But I am getting below error               bash: "28.5+1": syntax error: operand expected (error token is ""28.5+1"")      What am I doing wrong?


grep caret appears to have no effect

I was under the impression that a caret symbol means "beginning of the line" with Extended POSIX regular expressions. However, when I use it with grep it behaves unexpectedly.               #grep --version     GNU grep 2.5.4     ...      I am using GNU grep 2.5.4 on Ubuntu 10.04 Lucid Lynx. I echo out a line ' hello', then pipe it to a grep that searches for "zero-or- more white-space characters followed by the letter h":               #echo ' hello' | grep -E '[:space:]*h'      hello      grep finds it ok. If I add a caret to indicate that I only want the pattern to match "zero-or- more white-space characters followed by the letter h" "at the beginning of the string":               #echo ' hello' | grep -E '^[:space:]*h'     #      No matches are found. I would expect the string to have matched because it begins with `white-space` followed by `h`. Why does this caret symbol prevent a match?


Will GNOME and GTK libs bloat up my KDE?

I want to use Shutter. I installed it previously under Kubuntu and it needed a lot of libs. What bothered me most was that Kubuntu wanted me to restart, that is rare for OS's nowadays and in general means that something was added to startup procedures. So will these libs bloat my KDE up and get loaded even if I don't start Shutter? To be clear, as long as it's only disk space that not what I mean by bloat. Please take this more as a general question about installing GNOME apps on KDE and not so much about Shutter and the libs it needs. Maybe you can help me understand the technical background a bit better.


How to grant non-root user access to device files

I have device file that appears in `/dev` when a specific board is plugged in. The read and write operations to it work just fine, but in order to open the device file the program needs to be executed with root priveledges. Is there any way I can all a non-root user to open this one specific device file without having to use sudo?


Normal looking text file, detected by file as ASCII Pascal program text

I have a "normal" looking text file (contains english sentences) which is getting detected by `file` command as `ASCII Pascal program text`. How does Pascal program text differentiate itself from normal ASCII English text? I did `head -10 file > tmp` `file tmp` still shows `Pascal`. `tmp` when opened in VI and `:set list`               HELEN'S BABIES$     $     With some account of their ways, innocent, crafty, angelic, impish,$     witching and impulsive; also a partial record of their actions during$     ten days of their existence$     $     By JOHN HABBERTON$     $     $     $      Output of `head file | od -c`               0000000   H   E   L   E   N   '   S       B   A   B   I   E   S  \n  \n     0000020   W   i   t   h       s   o   m   e       a   c   c   o   u   n     0000040   t       o   f       t   h   e   i   r       w   a   y   s   ,     0000060       i   n   n   o   c   e   n   t   ,       c   r   a   f   t     0000100   y   ,       a   n   g   e   l   i   c   ,       i   m   p   i     0000120   s   h   ,  \n   w   i   t   c   h   i   n   g       a   n   d     0000140       i   m   p   u   l   s   i   v   e   ;       a   l   s   o     0000160       a       p   a   r   t   i   a   l       r   e   c   o   r     0000200   d       o   f       t   h   e   i   r       a   c   t   i   o     0000220   n   s       d   u   r   i   n   g  \n   t   e   n       d   a     0000240   y   s       o   f       t   h   e   i   r       e   x   i   s     0000260   t   e   n   c   e  \n  \n   B   y       J   O   H   N       H     0000300   A   B   B   E   R   T   O   N  \n  \n  \n  \n     0000314      File uploaded here: http://www.fileswap.com/dl/L0eCWJTvy/ I'm on `CentOS release 6.5`, `file` version `5.04` **There is something in the 4th line. Removing from 4th line onwards detects it as only text file**


Rebuilt kmod package not updating via `YUM` but is via `rpm`

I have built a package with the following version:               kmod-dahdi-linux 10:2.9.1.1-75_shmz65.1.11.2.6.32_431.el6.i686      Which should be an upgrade of the one installed on the system:               kmod-dahdi-linux 0:2.9.0.1-72_centos6.2.6.32_431.el6.i686      when I do a `yum localupdate` I get the following:               Resolving Dependencies     --> Running transaction check     ---> Package kmod-dahdi-linux.i686 0:2.9.0.1-72_centos6.2.6.32_431.el6.i686 will be updated     ---> Package kmod-dahdi-linux.i686 10:2.9.1.1-75_shmz65.1.11.2.6.32_431.el6.i686 will be an update     --> Finished Dependency Resolution      But when it hits the transaction check, I get file conflicts like it's not updating the package, but installing it side-by-side, as seen here:               file /lib/modules/2.6.32-431.el6.i686/dahdi/dahdi.ko from install of kmod-dahdi-linux-10:2.9.1.1-75_shmz65.1.11.2.6.32_431.el6.i686.i686     conflicts with file from package kmod-dahdi-linux-2.9.0.1-72_centos6.2.6.32_431.el6.i686.i686      I've tried obsoletes for older versions, I've tried upping the Epoch (as you can see mine has an epoch of 10 now) When I do:               rpm -Uvh kmod-dahdi-linux-2.9.1.1-75_shmz65.1.11.2.6.32_431.el6.i686.i686.rpm      it upgrades properly. I've double checked the rpmversion shows as newer:               # rpmdev-vercmp 0:2.9.0.1-72_centos6.2.6.32_431.el6.i686 10:2.9.1.1-75_shmz65.1.11.2.6.32_431.el6.i686     10:2.9.1.1-75_shmz65.1.11.2.6.32_431.el6.i686 is newer      Any ideas? Additional information: I've re-tooled my RPM to have the exact same dist tag and it still fails.               # yum localupdate kmod-dahdi-linux-2.9.1.1-11_centos6.2.6.32_431.el6.i686.i686.rpm     Resolving Dependencies     --> Running transaction check     ---> Package kmod-dahdi-linux.i686 0:2.9.0.1-72_centos6.2.6.32_431.el6.i686 will be updated     ---> Package kmod-dahdi-linux.i686 0:2.9.1.1-11_centos6.2.6.32_431.el6.i686 will be an update     --> Finished Dependency Resolution          Transaction Check Error:       file /lib/modules/2.6.32-431.el6.i686/dahdi/dahdi.ko from install of kmod-dahdi-linux-2.9.1.1-11_centos6.2.6.32_431.el6.i686.i686 conflicts with file from package kmod-dahdi-linux-2.9.0.1-72_centos6.2.6.32_431.el6.i686.i686


Spotty wireless with Fedora

I have this Toshiba laptop I started poking around trying to find out why it quits out so often and is just so bad. This guy seems to have the same problem with the fact that it works perfect in Windows and it cuts out so much. It's quite annoying. Anyone know of any solutions? Edit* I found that I have to constantly "forget" the network to then re connect to it. This kind of fixes the problem but then of course it derps out again.


Built the kernel with NFS support but not getting /dev/nfs

I'm trying to build kernel 3.13.9, fetched using `apt-get source`, and built in a clean `debootstrap` chroot (both host and chroot being installations of Ubuntu Trusty). My goal is to boot a diskless machine to a console over NFS. I ran `make menuconfig` and enabled 64-bit kernel, disabled debugging, and made sure I was doing a 64-bit build. In addition, I went to file systems->network file systems, and enabled the following:   * Network File Systems   * NFS Client Support  The host has `nfs-kernel-server` installed, and an export set up for the directory that I would like to use as the root of the network-booted system. PXE boot happens OK, kernel and initrd are loaded, but after a long pause, I'm dumped to a busybox prompt, due to a root filesystem being missing. What could be the cause? (or, is more info needed?) **Edit:** I'm already passing `nfsroot`:               LABEL linux     KERNEL vmlinuz-3.13.9     APPEND root=/dev/nfs initrd=initrd.img-3.13.9 nfsroot=192.168.1.39:/nfsroot,rw ip=dhcp rw


Some icons are broken in the application menu

I am using Xfce-4.10 on Debian 7. But I found some icons are missing (and only "x"'s appear) in the application menu. Take `ipython3` as an example. Here's the `ipython3.desktop`:               # If you want ipython3 to appear in a linux app launcher ("start menu"), install this by doing:     # sudo desktop-file-install ipython3.desktop          [Desktop Entry]     Comment=Enhanced interactive Python shell     Exec=ipython3     GenericName[en_US]=IPython3     GenericName=IPython3     Icon=ipython3     Name[en_US]=ipython3     Name=ipython3     Categories=Development;Utility;     StartupNotify=false     Terminal=true     Type=Application      The theme is installed (currently `tango-icon-theme`, but other themes don't work either). The icon file is at `/usr/share/icons/hicolor/scalable/apps/ipython3.svg`. It can be displayed in an image viewer. Reinstalling `ipython3` doesn't help. I also tried to replace the `ipython3.svg` with some other normal icon files (`libreoffice-calc.svg`, for example). This doesn't help either. Any ideas to bring the icons back? Thank you.


Measuring CPU and Memory per user to distribute "cost" of a server

How should I implement approximately correct per-user monitoring on a server? I want a way to split the cost of a server between the users based on their usage. On newer machines (RHEL6) I would use `cgroups`; on older kernels process accounting and `ps` averages. Are these the best ways?


Burning a directory structure from a stdin pipe

I'm trying to do something tricky, I want to burn a directory structure onto a CD from a pipe stream. The reason is that it is coming from the network and I don't want it written on the hard drive of the cd-burning machine. I am unsure of how (or if possible) to pipe the output of tar (for example) into genisoimage or mkisofs. I noticed a stream option in genisoimage, but when I tried doing               tar -cvf - /home/myuser | genisoimage --stream-media-size 200 -o test.iso      I only got a test.iso which contained a stream.img (as specified in genisoimage(1)) which itself was the original tar-archive. This will not do, it needs to be a directory structure on the CD. I know that cdrskin (cli tool for burning) can take data from stdin and burn it. So how can I pipe data into genisoimage, have it create a directory structure of that data for the ISO and then have it pipe that data back out to cdrskin to burn? I know also that genisoimage pipes the iso data to stdout by default so my only issue appears to be getting a stream of a directory structure piped into genisoimage and having that directory structure maintained in the ISO data. The tags on this post are terrible because I couldn't find genisoimage, cdrskin, not even stdin. Edit: This is not about data security, it's about lack of disk space. I don't care if the data is buffered on the HDD but I can't write the full ISO. And of course genisoimage is just a suggestion, I'm open to any other method of creating the ISO data. For your information it's intended for blu ray discs.


Set a network range in the no_proxy environment variable

I'm in a network using a proxy. I've got machines using lots of scripts here and there accessing each other over HTTP.   * The network is 10.0.0.0/8.   * My proxy is 10.1.1.1:81, so I set it up accordingly:              export http_proxy=http://10.1.1.1:81/        * I want to exclude my own range to be accessed with the proxy. I tried any combination available.              export no_proxy='10.*'     export no_proxy='10.*.*.*'     export no_proxy='10.0.0.0/8'      None of the above work! I'm testing with `wget` and it always tries to query the proxy, whatever IP address I want to connect to.   * Since lots of scripts lie everywhere in all systems the `\--no-proxy` option is actually not an option. I want to set it system wide. Many thanks.


Postfix uses the interface alias instead of the primary interface

When sending e-mail with /usr/sbin/sendmail ( _e.g., using a script_ ), Postfix causes the mail to be sent using one of the host's interface aliases ( **eth0:0, 74.50.122.55** ) instead of using the primary interface ( **eth0, 66.232.99.54** )...               [root@www ~]# cat test.msg      To: epretorios@gmail.com     Subject: This is a bogus e-mail          This is a bogus e-mail.     [root@www ~]# sendmail -t -i < test.msg      Results in e-mail headers like this:               Return-Path: <root@www.rocket-powered.com>     Received: from www.rocket-powered.com ([74.50.122.55])             by mx.google.com with ESMTPS id c4si14411712yhe.53.2013.04.13.11.39.16             (version=TLSv1 cipher=RC4-SHA bits=128/128);             Sat, 13 Apr 2013 11:39:16 -0700 (PDT)     Received-SPF: fail (google.com: domain of root@www.rocket-powered.com does not designate 74.50.122.55 as permitted sender) client-ip=74.50.122.55;     Authentication-Results: mx.google.com;            spf=hardfail (google.com: domain of root@www.rocket-powered.com does not designate 74.50.122.55 as permitted sender) smtp.mail=root@www.rocket-powered.com     Received: by www.rocket-powered.com (Postfix, from userid 0)         id CA46D39412D; Sat, 13 Apr 2013 18:32:14 +0000 (UTC)     From: bogus@gmail.com     To: epretorios@gmail.com     Subject: This is a bogus e-mail      Why is Postfix using the interface alias ( **eth0:0, 74.50.122.55** ) _instead of using the primary interface ( **eth0, 66.232.99.54** )_? FWIW: e-mail submitted for delivery via SMTP is routinely delivered using the primary interface ( **eth0, 66.232.99.54** ). e.g.,               Return-Path: <administrative@rocket-powered.com>     Received: from www.rocket-powered.com (rocket-powered.com. [66.232.99.54])             by mx.google.com with ESMTPS id s61si9056793yhd.296.2013.04.13.17.28.36             (version=TLSv1 cipher=RC4-SHA bits=128/128);             Sat, 13 Apr 2013 17:28:36 -0700 (PDT)     Received-SPF: pass (google.com: domain of administrative@rocket-powered.com designates 66.232.99.54 as permitted sender) client-ip=66.232.99.54;     Authentication-Results: mx.google.com;            spf=pass (google.com: domain of administrative@rocket-powered.com designates 66.232.99.54 as permitted sender) smtp.mail=administrative@rocket-powered.com     Received: from www.rocket-powered.com (localhost [IPv6:::1])         by www.rocket-powered.com (Postfix) with ESMTPA id 979D23940F7         for <epretorios@gmail.com>; Sun, 14 Apr 2013 00:21:33 +0000 (UTC)     DomainKey-Signature: a=rsa-sha1;  q=dns; c=nofws;       s=default; d=rocket-powered.com;       b=Y5YVbjb5mXPJgyDkMjXdanWRCM4gdEjIdbgouOpDJ6hEAObGcaokpiidfhc29lvBezLyZL06++gL1oyd+bjrywd1I9sqlB0i5Tfjig2ufKLEizcSeyTkDWjm/jKP6TIy;       h=Date:To:From:Reply-To:Subject:Message-ID:X-Priority:X-Mailer:MIME-Version:Content-Type;     Date: Sun, 14 Apr 2013 00:21:33 +0000     To: Fred Flintstone <epretorios@gmail.com>     From: "Rocket-Powered.com" <administrative@rocket-powered.com>     Reply-To: "Rocket-Powered.com" <administrative@rocket-powered.com>     Subject: Welcome


What are the current differences between tuxonice and µswsusp?

I tried to find out what is the current comparation between TOI and µswsusp. Unfortunately I could not find any recent information about the state of hibernation in Linux and how TOI compares to µswsusp (the most recent information I found is from 2009 in talk of merge between Nigel, Machek and Wysocki). The features matrix seems to be partially out-of-date as µswsusp supports "Multithreaded I/O" since 1.0. Does anyone know some more up-to-date comparison?


How can I replace my keyboard and mouse udev rules with xorg.conf.d?

Since it is impossible to make udev rules that affect Xorg settings run on startup, I'd like to replace these with other alternatives. At the moment, I have two primary udev scripts that I've written. The first changes keyboard layout when the keyboard is plugged in or removed, as well as starting `xcape`. The second slows down the pointer when a specific mouse is plugged in, and also allow input from the mouse to wake the computer up. I'm using (K)ubuntu 13.04. The udev rules and scripts follow, as do the xmodmaps. `/etc/udev/rules.d/00-teck.rules`:               ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0e6a", ATTR{idProduct}=="030c", RUN+="/usr/local/bin/TECK_connect"     ACTION=="remove", SUBSYSTEM=="usb", RUN+="/usr/local/bin/TECK_disconnect"      `/usr/local/bin/TECK_connect`:               #!/usr/bin/env bash          export DISPLAY=:0.0     cp -f /home/sparhawk/HDD/Computer/Xmodmaps/Xmodmap_for_TECK /home/sparhawk/.Xmodmap     sudo -u sparhawk setxkbmap -layout us -variant altgr-intl     sudo -u sparhawk xmodmap /home/sparhawk/.Xmodmap     sudo -u sparhawk pkill xcape     sudo -u sparhawk xcape -e 'Alt_L=Return' && sudo -u sparhawk notify-send "xmodmap" "TECK connected." -i /usr/share/icons/oxygen/48x48/devices/input-keyboard.png --hint=int:transient:1      `/usr/local/bin/TECK_disconnect`:               #!/usr/bin/env bash     if [[ `lsusb | egrep -c 'Apple, Inc\. Aluminum Keyboard'` == 0 ]] && [[ `lsusb | egrep -c 'Megawin Technology Co\., Ltd'` == 0 ]]; then       export DISPLAY=:0.0       cp -f /home/sparhawk/HDD/Computer/Xmodmaps/Xmodmap_for_internal_Dell_keyboard /home/sparhawk/.Xmodmap       sudo -u sparhawk setxkbmap -layout us -variant altgr-intl       sudo -u sparhawk xmodmap /home/sparhawk/.Xmodmap       sudo -u sparhawk pkill xcape     fi      `/etc/udev/rules.d/90-razerwakeup-slowdown.rules`:               ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="1532", ATTRS{idProduct}=="0016" RUN+="/bin/sh -c 'echo $env{DEVPATH} | grep -q usb./[^/]*/[^/]*/[^/]*$ && echo enabled > /sys$env{DEVPATH}/../power/wakeup; razer_slowdown'"      `/usr/local/bin/razer_slowdown`:               #!/usr/bin/env bash     # slow down the tracking speed of a razer mouse.     # to check, $ xinput --list-props "Razer Razer DeathAdder"| grep 'Constant Deceleration'     # which was originally 1          scriptproper () {             sleep 0.5 # perhaps not necessary, but putting it in background is.             export DISPLAY=:0.0             sudo -u sparhawk xinput --set-prop "Razer Razer DeathAdder" "Device Accel Constant Deceleration" 3     }          scriptproper &      `~/HDD/Computer/Xmodmaps/Xmodmap_for_TECK`:               ! map right blank key to "menu" for KDE.     keycode 97 = Menu Menu     ! Swap left ctrl and shift     keycode 50 = Control_L Control_L     keycode 37 = Shift_L Shift_L     ! Replace right ctrl with shift     keycode 105 = Shift_R Shift_R     ! Replace right shift, '     keycode 62 = apostrophe quotedbl     keycode 48 = slash question     ! Enter to alt     keycode 36 = Alt_L Meta_L     ! AltGr to Compose     !keycode 108 = Multi_key     ! AltGr+key     keycode 20 = minus underscore minus underscore endash emdash     keycode 60 = period greater period greater ellipsis     ! Left blank key to AltGr     keycode 101 = ISO_Level3_Shift Multi_key ISO_Level3_Shift     ! key to the left of `     keycode 94 = Return NoSymbol Return     ! Fn+F5 and Fn+F6 control brightness     keycode 148 = XF86MonBrightnessDown NoSymbol XF86MonBrightnessDown     keycode 179 = XF86MonBrightnessUp NoSymbol XF86MonBrightnessUp          clear Shift     clear Lock     clear Control     clear Mod1     clear Mod2     clear Mod3     clear Mod4     clear Mod5     add    Shift   = Shift_L Shift_R     add    Lock    = Caps_Lock     add    Control = Control_L Control_R     add    Mod1    = Alt_L     add    Mod2    = Num_Lock     add    Mod4    = Super_L Super_R     add    Mod5    = Mode_switch ISO_Level3_Shift ISO_Level3_Shift ISO_Level3_Shift      `~/HDD/Computer/Xmodmaps/Xmodmap_for_internal_Dell_keyboard`:               ! map right alt to ISO_Level3_Shift (e.g. for compose)     keycode 108 =   ISO_Level3_Shift Multi_key     ! Swap left ctrl and caps lock     keycode 66 =    Control_L     keycode 37 =    Caps_Lock          ! AltGr+key     keycode 20 = minus underscore minus underscore endash emdash     keycode 60 = period greater period greater ellipsis          keycode 105 =   Control_R       Multi_key     clear Shift     clear Lock     clear Control     clear Mod1     clear Mod2     clear Mod3     clear Mod4     clear Mod5     add    Shift   = Shift_L Shift_R     add    Lock    = Caps_Lock     add    Control = Control_L Control_R     add    Mod1    = Alt_L     add    Mod2    = Num_Lock     add    Mod4    = Super_L Super_R     add    Mod5    = Mode_switch ISO_Level3_Shift ISO_Level3_Shift ISO_Level3_Shift


Iptable rule to ssh over the internet

I've a server `abc.example.com` and a remote desktop `zzz.example.com`. I'm using SSH over a custom port, say, 6789. Whenever my firewall is off, I'm able to connect to the server successfully. But, as soon as I start my firewall, in vain. Moreover, I want to allow ssh session only between `abc.example.com` and `zzz.example.com`, for security reasons. This is the rule that I have added to my iptables on the server,               iptables -A INPUT -s zzz.example.com -m state --state NEW,ESTABLISHED -p tcp --dport 6789 -j ACCEPT


memory consumption alert

My VPS has reported a memory consumption alert says reached 273% and I cannot access any of my sites. But I checked on the terminal today and it does not look like a memory problem. Am I correct in thinking memory is fine?                            total       used       free     shared    buffers     cached     Mem:          1004        110        893          0         56         20     -/+ buffers/cache:         33        970     Swap:         2047          1       2046      The VPS reports my using 2.73 GB of allotted 1024 so they are wanting me to move up a plan but clearly I'm not using anywhere near that amount. But it appears over the weekend something spiked the usage but none of my sites were active so what could it be? How can I test the problem? ### screenshot of graph     ![my usage report](http://i.stack.imgur.com/vgFl4.jpg) What are you supposed to do to get the sites all up again? I'm at a loss. update: I have looked in /var/log/messages and found this : `rsyslogd was HUPed ` but now I've found mysql has disappeared!


Automating tasks on a website on a headless server

I want to automate a task which can only be done on a website (with prior login) on my debian server. There is no public API available, so I can't use one. Is there a way to do so? I thought about a text-based browser or something similar.


What does this command actually cause?

Once while talking with my friend I was trying to joke that we might stand a better chance of completing our project if we just run loads of random programs and expect one of them to solve our problem. To demonstrate that, I wrote this "proof of concept":               while true; do          dd if=/dev/urandom of=pliczek count=1     chmod +x pliczek     ./pliczek          done      To my horror, when I ran this loop and called `ls`, I noticed a lot of files with random-looking filenames in my current directory (tested on Fedora Linux on 64-bit x86). Now I can't stop wondering - what could actually have happened?


Git commit from within a Makefile

I have a Makefile for a Latex project I'm working on. Makefiles aren't my forte, but is there a way to do something like:               make git "My comment"      And have the makefile execute:               git commit -m "My comment"     git push origin master      ?


Command substitution interpreting spaces within quotes as argument separators

I'd like an `alias` that additionally appends itself to `~/.bashrc`, _e.g._               function tailias     {         $(echo "alias $1='${*:2}'" | tee -a ~/.bashrc)     }      I'm using `tee` to split the command to `~/.bashrc` while leaving the stdout intact to be run by `$()`. This works fine for aliasing one-word commands, _e.g._               [/home/acheong87] tailias f g     [/home/acheong87] alias     alias f='g'      and I see it appended to my `~/.bashrc`. But for commands with spaces, I get               [/home/acheong87] tailias ll 'ls -al'     -bash: alias: -al: not found      It looks correct in `~/.bashrc`—               alias ll='ls -al'      —but in the alias list I get this crazy thing:               [/home/acheong87] alias     alias ll=''\''ls'      I've tried putting the quotes in different places, to no avail. I've reduced the function to just the `echo`, and like in the `~/.bashrc`, it _looks_ correct—so I can't figure out what hidden step is averting my attention.


Stop Git submodule foreach from opening less for each module

I occasionally need to grep through git submodules for which I use:               git submodule foreach 'git grep x'      However, since switching to zsh I find a less prompt is opened for each submodule, even when there are no options. What I'd much prefer is for all of the output to be printed out to the terminal. My current solution is to call:               git submodule foreach 'git grep x' > /tmp/a && cat /tmp/a      Which achieves what I want but I can't help but feel that I'm missing an option or a more elegant solution. Is there one?


retrieve the host interface name used by a VirtualBox interface in "bridged mode"

I need to retrieve the tuntap interface name used from my the VM interfaces in "bridged adapter" mode. I found that this information resides in the xml file of the VirtualBox VM under: val xml=(xmlfile \ "Machine" \ "Hardware" \ "Network" \ "Adapter" \ "BridgedInterface") Is there any way to get this info from terminal, ad example with VBoxManage? And if not, can i rely on the xml file for most up-to date informations or is this file updated only when the VM is shut down?


An easier way to print from a live CD than Puppy?

After several failed attempts to burn an Ubuntu CD to live boot from (they wouldn't boot, maybe because my CD burning software wouldn't burn slower than 4X speed?), I've managed to get a boot disc working with Puppy linux ("Slacko"). My next task is to figure out how to print. I have an HP PSC2410 printer. The documentation on puppylinux.org provides some links, and I tried following the instructions here. Unfortunately, it appears python isn't installed in Puppy by default, as I got the error:               ./hplip-install: line 2: python: command not found      when I ran the install with `sh hplip-3.13.4.run` There's quite a list of system requirements for installing the print drivers, so I wonder if I'm barking up the wrong tree by trying to use Puppy. Might I be better having another try at getting Ubuntu working, or is there an easier distribution to use that will enable me to print when booting from a live CD? The only functionality I need is print capability, a browser, and being able to read a flash drive, all offline from the web.


When you type "ls -a", what is the significance of "." and ".."?

Whenever you type `ls -a` into the command prompt, you usually get all of your folders, files, and then you see that the first two entries are `.` and `..` Just curious, but what is the significance of these two entries?


How to display Discordian date?

I am a strong believer in Discordianism. Yet most mostly I am confronted with the time measurement of pesky heathens. How do I know what date it really is?


Grub doesn't install - corrupted iso?

I wanted to install Arch Linux on my netbook. I hadn't important files on my hard drive so I've created new partition table (GPT) using GParted from Fedora LiveCD. When I'm running               grub-mkconfig -o /boot/grub/grub.cfg      I get errors and my new system will not run from GRUB. How can I fix it? Is it a corrupted iso file? I'll add it isn't a problem with hard drive - before Arch, there was Ubuntu and Fedora.


What is Binary package? How to build them?

I want to get detail about binary package and run them on linux. I am running Debian base (Ubuntu/Linux mint) Linux os.   1. How to build binary package from source? And can I directly download binary package for applications (like firefox, etc.) and games (like boswars, etc.) ?   2. I run some direct package which is in "xyz.linux.run" format What are these package? Are they independent of dependencies? or Is it pre-built binary packages?   3. How to build them which can be run on linux operating system by directly "xyz.linux.run" on linux.   4. What is diference between binary package and deb package?


Dual boot windows 8 and Ubuntu 13.04 & Broadcom Compatibility

I have windows 8 pre-installed and also want to use Ubuntu (13.04) as my secondary OS. I had problems regarding Broadcom STA wireless drivers in 12.10, but the drivers work fine on older versions. How to dual boot Ubuntu and install Broadcom drivers after it.


Can't install anything

I'm not able to install, update or do anything else with `apt-get`, `aptitude`, `dpkg` and so on. The lock-file `/var/lib/dpkg/lock` exists from boot-time on. When I delete it and run `apt-get update`, it prints out, that dpkg has been interrupted. I tried `dpkg --configure -a` as mentioned in the help text, but that runs into a problem with gconf2:               root@andre-ubuntu:/home/andre# dpkg --configure -a     Setting up libbonoboui2-0:amd64 (2.24.5-0ubuntu2) ...     Setting up libgnomeui-0:amd64 (2.24.5-2ubuntu3) ...     Processing triggers for libc-bin ...     ldconfig deferred processing now taking place     Setting up gconf2 (3.2.6-0ubuntu1) ...          (gconftool-2:16760):       GConf-WARNING **: Client failed to connect to the D-BUS daemon:      Did not receive a reply. Possible causes include: the remote application       did not send a reply, the message bus security policy blocked the reply,       the reply timeout expired, or the network connection was broken.      `dpkg` stops at this point and i can't even interrupt it with `Ctrl+C`. I have the following version of Ubuntu:               Linux andre-ubuntu 3.8.0-19-generic #30-Ubuntu      SMP Wed May 1 16:35:23 UTC 2013      x86_64 x86_64 x86_64 GNU/Linux      Do you have any ideas what to do?


sed pattern space and hold space

i was just going thorugh this and i was unable to understand.               sed -n '1h; 1!H; ${ g; s/foo\nbar/bla\nblub/ p }' file.      where cat file is :                foo      foo      bar      why there is `1!H` because to me `1h` overwrites the pattern space and `1!H` is of no use But the sed one liner seems to work fine.


Change sampling rate in ALSA

I'm a Computer Audiophile, I've used Windows (with ASIO4ALL)and OSX for Audio. Now I'm making Ubuntu 13 my HTPC/Stereo Audio. To begin with I disabled Pulse audio and using GooMusicplayer with ALSA. My DAC is capable of 24bit 96khz. I can't seem to find a configuration for ALSA to set output sampling rate. How can I configure it?


JAVA_HOME not set in script when run using sudo

I'm trying to run an install script that requires java to be installed and the JAVA_HOME environment variable to be set. I've set JAVA_HOME in `/etc/profile` and also in a file I've called java.sh in `/etc/profile.d`. I can `echo $JAVA_HOME` and get the correct response and I can even `sudo echo $JAVA_HOME` and get the correct response. In the install.sh I'm trying to run I inserted an `echo $JAVA_HOME`. When I run this script as myself I see the java directory, but when I run the script with sudo it is blank. Any ideas why this is happening? I'm running CentOS


Dtach and Vim over Ssh: Reattach Session

I connected to my server:               $ ssh me@example.com      While in the server, I open a `dtach` session with `vim`:               $ dtach -c \tmp\my-dtach-session-pipe vim      Then my ssh session dies. I attempt to go back to my session:               $ ssh me@example.com     $ dtach -a \tmp\my-dtach-session-pipe      I do not get vim, but instead just a blinking cursor. I cannot do anything from there, not even `ctrl+c`, I can only detach the `dtach` with `ctrl+\`. How can I get my dtach session back properly? Or am I missing the idea of how dtach is supposed to behave? N.B. I am well aware of the `tmux` and `screen` utilities.


testing services/open ports with telnet?

I often see that folks test ports this way:               //shell     telnet ip-address 80     telnet ip-address 25      AFAIK telnet was the old way of getting onto some remote box - right? or so I thought... Why exactly can you connect via telnet to smtp port for example?


Prevent init daemon echoing on TTY

Below is an `init` script which starts/stops a daemon. The daemon is unfortunately printing the parsed packet data (from `/home/nuthan/program/server`), a socket server written in perl, listening to a socket for tcp packets from a client. As soon as I start the service, the parsed data (print statements from `/home/nuthan/program/server`) is echoed on my TTY. And, if I try to kill the terminal, the daemon quits. How do I overcome this? **daemon and logging packet data command**                daemon -18 perl /home/nuthan/program/server -d -v -r -f -O=/var/log/vts.log --daemon      * * *               #!/bin/bash     #     # vts      Start/Stop Vts.     #     # description: VTS daemon for vehicle Tracking.     # Source function library     . /etc/init.d/functions          # Get network config     . /etc/sysconfig/network          RETVAL=0          start() {     echo -n $"Starting vts: "     # Start me up!     daemon -18 perl /home/nuthan/program/server -d -v -r -f -O=/var/log/vts.log --daemon     RETVAL=$?     echo     [ $RETVAL -eq 0 ] && touch /var/lock/subsys/vts         touch /var/lock/subsys/vts     return $RETVAL          }          stop() {     echo -n $"Stopping vts: "     killproc vts     RETVAL=$?     echo     [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/vtsdaemon     return $RETVAL     }          restart() {       stop     start     }          reload() {     stop     start     }          case "$1" in       start)       start     ;;       stop)       stop     ;;       status)     status vts     ;;       restart)       restart     ;;       condrestart)       [ -f /var/lock/subsys/vts ] && restart || :     ;;       reload)     reload     ;;       *)     echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"     exit 1     esac          exit 0


Creating multiple devices from one device?

Specifically taking a USB device, which normally allows only one process to open it for reading, and clone/duplicate/replicate it so that multiple processes can open and read the input. Something along these lines:               # Duplicate two streams from microphone     arecord -D [mic] | tee /dev/[#1] > /dev/[#2] &          # Set up process 1     apply-live-effects -filter lo-pass < /dev/[#1] > output1.raw &          # Set up process 2     apply-live-effects -filter hi-pass < /dev/[#2] > output2.raw &      With `/dev/[#1]` and `/dev/[#2]` being the devices to open for reading. I thought I might be able to use the `/dev/loop#` devices. I tried playing around with these but no luck.


source address chosen in case of multiple IPv4 addresses

I have following four IPv4 addresses configured to `eth0` interface:               # ip addr show dev eth0     2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9000 qdisc pfifo_fast state UP qlen 1000         link/ether 00:16:41:54:01:93 brd ff:ff:ff:ff:ff:ff         inet 10.10.10.1/24 scope global eth0         inet 192.168.2.2/30 scope global eth0         inet 10.10.10.128/24 scope global secondary eth0         inet 10.10.10.127/24 scope global secondary eth0     #       Now if I send traffic to any(10.10.10.1, 192.168.2.2, 10.10.10.128 or 10.10.10.127) of those addresses from IP address 10.10.11.1, then despite the fact that I have specified the source IP to be 10.10.10.127:               # ip route show match 10.10.11.1     default via 192.168.2.1 dev eth0  src 10.10.10.127      #       ..my machine sends out packets with the same source IP which was used as a destination IP, e.g. if I execute `ping 10.10.10.128 source 10.10.11.1` in a remote machine, then my machine sends out replies with source address 10.10.10.128:               16:11:02.478607 00:19:e2:9e:ec:00 > 00:16:41:54:01:93, ethertype IPv4 (0x0800), length 114: 10.10.11.1 > 10.10.10.128: ICMP echo request, id 34, seq 4, length 80     16:11:02.478616 00:16:41:54:01:93 > 00:19:e2:9e:ec:00, ethertype IPv4 (0x0800), length 114: 10.10.10.128 > 10.10.11.1: ICMP echo reply, id 34, seq 4, length 80      In which situation `src` address specified in routing table has affect?


how can I replace a record in my DB (mySql) by new record?

I have created a shell script to connect to a DB and INSERT IPs and MACs from dhcpd.log file:               #/!bin/bash     dhcpLogFile="/var/log/dhcpd.log"     NumberOfLines=$(awk '/DHCPACK/ { print $8} ' $dhcpLogFile | awk '!x[$0]++'|awk 'BEGIN{i=0}{i++;}END{print i}')     j=1     while [ $NumberOfLines -gt 0 ]     do     ip=$(awk '/DHCPACK/ { print $8} ' $dhcpLogFile | awk '!x[$0]++' |cut -f$j -d$'\n')     mac=$(awk '/DHCPACK/ { print $10} ' $dhcpLogFile | awk '!x[$0]++' |cut -f$j -d$'\n')        let "j +=1"     let "NumberOfLines -=1"     mysql -u root --password='pw' MatchingDB <<- _END_      INSERT INTO IP_MACTable (IP_Address, MAC) VALUES ('$ip','$mac');     _END_     done      my question is how to modify the insert query above to let it replace an existing record when the ip attribute is duplicated and to insert a new record normally when the ip attribute isn't duplicated ? I have tried something like this but it keeps return an error (syntax error):               INSERT INTO IP_MACTable (IP_Address, MAC) VALUES ('$ip','$mac')      ON DUPLICATE KEY UPDATE MAC = VALUES('$mac')      the error according to my server is `near '$mac')` Error code is #1064


Running a Transparent Proxy for LAN and Webserver for WAN

I am running a LAMP stack on an Arch Linux server in my home, and my router firewall port 80 is open to the world. Recently, I've decided to set up a dansguardian transparent proxy to do some web filtering for my children. Everything is working well inside my LAN. However, while checking the dansguardian logs, I noticed that my home had become a proxy for chinese IP addresses. Apparently, my iptables setup is allowing requests coming in on port 80 to be sent to my LAN dansguardian setup! I have now closed down port 80, but I would like to continue running my home website. Can someone please advise me on the correct iptables setup to transparently proxy LAN http requests through dansguardian but not proxy INCOMING requests on port 80? Here is the output of iptables-save:               # Generated by iptables-save v1.4.18 on Tue May 20 18:51:46 2014     *filter     :INPUT ACCEPT [99752358:83925475634]     :FORWARD ACCEPT [1137723:181159087]     :OUTPUT ACCEPT [57478321:118350587619]     COMMIT     # Completed on Tue May 20 18:51:46 2014     # Generated by iptables-save v1.4.18 on Tue May 20 18:51:46 2014     *nat     :PREROUTING ACCEPT [3362634:253695591]     :INPUT ACCEPT [3450241:258605740]     :OUTPUT ACCEPT [3451732:250709703]     :POSTROUTING ACCEPT [3492061:253533144]     -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 9809     -A POSTROUTING -o eth0 -j MASQUERADE     COMMIT     # Completed on Tue May 20 18:51:46 2014      * * * ## Update: Possible Solution Found This looks like it is working: From: https://help.ubuntu.com/community/DansGuardian               sudo iptables -t nat -A OUTPUT -p tcp --dport 80 -m owner --uid-owner proxy -j ACCEPT     sudo iptables -t nat -A OUTPUT -p tcp --dport 3128 -m owner --uid-owner proxy -j ACCEPT     sudo iptables -t nat -A OUTPUT -p tcp --dport 80 -j REDIRECT --to-ports 8080     sudo iptables -t nat -A OUTPUT -p tcp --dport 3128 -j REDIRECT --to-ports 8080      If anyone knows of a good tutorial of iptables for dummies, I'd really appreciate it!


Installing SASM Integrated Development Invironment for assemby, dependency problems

How do I resolve these dependency issues? I want to install a IDE for assembly in my Fedora 20, but it's not working. Here is the package I'm trying to install: package site Here is the output from yum:               home_Dman95                                                                    3/3     Resolving Dependencies     --> Running transaction check     ---> Package SASM.x86_64 0:2.3.1-2.3 will be installed     --> Processing Dependency: libxcb-icccm4 for package: SASM-2.3.1-2.3.x86_64     --> Processing Dependency: libxcb-render0 for package: SASM-2.3.1-2.3.x86_64     --> Processing Dependency: gcc-32bit for package: SASM-2.3.1-2.3.x86_64     --> Processing Dependency: libxcb-sync0 for package: SASM-2.3.1-2.3.x86_64     --> Processing Dependency: libxcb1 for package: SASM-2.3.1-2.3.x86_64     --> Processing Dependency: libqt4 for package: SASM-2.3.1-2.3.x86_64     --> Finished Dependency Resolution     Error: Package: SASM-2.3.1-2.3.x86_64 (home_Dman95)                Requires: libxcb-icccm4     Error: Package: SASM-2.3.1-2.3.x86_64 (home_Dman95)                Requires: libxcb-render0     Error: Package: SASM-2.3.1-2.3.x86_64 (home_Dman95)                Requires: libxcb-sync0     Error: Package: SASM-2.3.1-2.3.x86_64 (home_Dman95)                Requires: libxcb1     Error: Package: SASM-2.3.1-2.3.x86_64 (home_Dman95)                Requires: libqt4     Error: Package: SASM-2.3.1-2.3.x86_64 (home_Dman95)                Requires: gcc-32bit      You could try using --skip-broken to work around the problem      You could try running: rpm -Va --nofiles --nodigest      EDIT: I installed gcc*.i686 but still the "gcc-32bit" dependency is not resolved. Any idea's?


How to remove duplicate lines with awk whilst keeping empty lines?

Below `awk` command removes all duplicate lines as explained here:               awk '!seen[$0]++'      If the text contains empty lines, all but one empty line will be deleted. How can I keep all empty lines whilst deleting all non-empty duplicate lines, using only `awk`? Please, also include a brief explanation.


Send duplicate packets over two Internet connections

I need to duplicate an RTP stream over two different (non-reliable) Internet connections. On the receiver side, I will probably run a custom program that will use a buffer and rebuild the stream before using it. But I have some trouble in splitting the traffic over the two connections. I did some research and found that maybe `tc` (part of `iproute2`) could be what I need. Can anyone help me?


Logging in using voice commands with GDM

Is there a program capable of doing such thing? Something that would wait for me to either supply a username and a password, or select my username and a voice command that does the same thing.


How to install man command for chef

I want to see manual for `chef` with command `man knife-cookbook`. But it looks like manuals are not installed by default install `gem install chef`. I found the man page of `knife cookbook`. http://manned.org/knife- cookbook/061616e2 How can I install these manual pages to my local environments? Normally documents are automatically installed along with software itself. I never installed manual separately. I'm using `OS X 10.9.2`.


Configure the OOM to avoid having the system grind to a halt

I have an SSD and therefore no swap. However, when I open a lot of tabs in the browser, the system tends to grind to a halt. If I'm lucky, I can close one or two tabs before the system is completely unresponsive. Is it possible to use the OOM in this case to kill a few browser processes (chromium) to avoid the unresponsiveness? There is still a bit of memory available, but apparently there's still a resource conflict.


Restart a process when I get stderr from another process

I have this constantly running process which POSTs some data collected locally to an endpoint. Now there is some issue in the raspberryPi wifi module and it drops connection frequently. After restarting networking, it starts working again. So this is what I have right now based on the face that everytime internet disconnects, proc1 starts throwing stderr:               while true; do        ./proc1 2>&1 >/dev/null | sudo /etc/init.d/networking restart     done &      But this code restarts networking multiple times, not sure why. What I actually want is something like this:               while true:         if proc1 has stderr:            sudo /etc/init.d/networking restart;            sleep 10;      So my question are:   1. How can I convert that pseudocode to bash?   2. This is a hack to get around the actual problem of networking drops, how can I debug what’s wrong?


Easiest way to chown the contents of a directory?

I often use               ls -ld .     # remember current user and group     chown -R user.group .     chown remembered_user.remembered_group .      Isn't there an easier way to recursively chown all files and directories in a directory but not the directory itself? It should include hidden files and work no matter how many files there are.


How to convert, resize and center image with ImageMagick

I'm unable to center a converted *.png file with ImageMagick's gravity option. Gravity seems to have no effect in the following command. On the contrary it erases everything and the output becomes white page.               convert puma1.png -compress jpeg \                       -resize 1755x2475 \                       -units PixelsPerInch \                       -density 150x150 \                       -page A3 \                       -gravity center puma1.pdf      ImageMagick version is 6.8.6-9 2014-03-06 Q16.


Script or tool for maintenance (archive/remove old files, clean temporal files, etc…) on Unix/Linux

Everybody have the same problem: How to deal with old files, logs, temporal files to archive them (compress, store in alternate locations), delete unneeded, etc. them Specially if you have to deal with a lot of home-brew and third-party software and tools, that basically fill the disk do not care about their logs/temp files. Now I am using my own shell scripts using find, logrotate, tar, etc... But everything is too adhoc for my taste, and not efficient at all. I would love some kind of generic tool, based on patterns and rules/actions that will allow define actions on the files based on their name, age, etc. I wanna write it, but I am sure that somewhere wrote something: Do you know any?


Error creating ext4 file system

Recently I purchased a Cubietruck Cubieboard 3, and I'm trying to copy Lubuntu server from the builtin NAND memory to a hard disk. I can create a partition successfully, but when I go to format the partition with ext4, using `mkfs.ext4 /dev/sda1`, I get a bunch of errors, which all look the same:               Writing inode tables: done     Creating Journal (32768 blocks): done     Writing superblocks and filesystem accounting information:     [  815.XXXXXX] ata1.00: exception Emask 0x0 SAct 0x1 SErr 0x0 action 0x0     [  815.XXXXXX] ata1.00: irq_stat 0x40000000     [  815.XXXXXX] ata1.00: failed command: READ FPDMA QUEUED     [  815.XXXXXX] ata1.00: cmd 60/08:00:00:08:1c/00:00:00:00/40 tag 0 ncq 4096 in     [  815.XXXXXX]          res 41/40:00:02:08:1c/00:00:00:00/60 Emask 0x409 (media error) <F>     [  815.XXXXXX] ata1.00: status: { DRDY ERR }     [  815.XXXXXX] ata1.00: error: { UNC }     [...] above 7 lines repeated 5x, each with a 6 second time difference     [  845.XXXXXX] end_request: I/O error, dev sda, sector 1837058      I don't think it is the drive, because it is new, and I can also format it on Elementary (Ubuntu). If I format it from Elementary, I can then not mount it on my Cubieboard.


Find all files that have been last modified on a specific day - like Monday?

So I want to use `find` to return a list of all .html files in a given directory that have been last modified on a Monday. How can I do this?


Could it cause any problem if I not reboot after a kernel upgrade?

I know there are solution for not rebooting after kernel update: https://en.wikipedia.org/wiki/Ksplice But If Ksplice isn't installed, and the user doesn't reboots it's notebook after even several kernel updates (so notebook running for even months). Could there be a problem about it? (not counting that an update probably came because there was a bugfix or security fix)


What's the main difference between bash and zsh?

Someone told me that some commands in zsh shell may differ from the bash shell commands. So what's the main difference between zsh and bash shells?


Bash Ping to return 'alive' IP addresses

(Disclaimer- I know this can be done more easily with `nmap`, but its supposed to be practice for bash shell scripting).               $ scriptname 192.168.42 18 23           Checking: 192.168.42.18 19 20 21 22 23           Live hosts:       192.168.42.21       192.168.42.22           There were:       5 alive hosts       1 not alive hosts       found through the use of 'ping'.       Above is what I want the output to look like. 'Checking: ...' will list whatever IP is being checked. All of the Live ones will be listed under "Live Hosts" and then running totals for alive and not-alive. Here is what I have so far               for i in `seq ${2} ${3}`         do         ping -c 1 -t 1 ${1}.${i} > /dev/null 2>&1;         if [ $? -eq 0 ]; then             echo "Live hosts: \n ${1}.${i}"; LIVECOUNT=$( ???? )         fi     done      The `LIVECOUNT=$( ???? )` because I don't know what to put in it. I'm not sure how to keep a running total for living/non living ones. The 'Live Hosts' and 'There were' sections don't need to appear until the checking is complete.


virtmanager- Unable to locate libvirtd daemon

I tried starting Virt-manager but get this error               Unable to connect to libvirt.          internal error: Unable to locate libvirtd daemon in /usr/sbin (to override, set $LIBVIRTD_PATH to the name of the libvirtd binary)     Hi, I tried to start virtmanagerr (installed via mint software center)     but get this?              Libvirt URI is: qemu:///system              Traceback (most recent call last):           File "/usr/share/virt-manager/virtManager/connection.py", line 1027, in _open_thread             self.vmm = self._try_open()           File "/usr/share/virt-manager/virtManager/connection.py", line 1009, in _try_open             flags)           File "/usr/lib/python2.7/dist-packages/libvirt.py", line 102, in openAuth             if ret is None:raise libvirtError('virConnectOpenAuth() failed')         libvirtError: internal error: Unable to locate libvirtd daemon in /usr/sbin (to override, set $LIBVIRTD_PATH to the name of the libvirtd binary)


Display manager unrecognised service, trying to disable "x server" to install nvidia driver, debian wheezy

First time install of Debian wheezy. My nvidia 580gtx GPU is crashing GNOME and the computer. To get it to boot I had to use `nouveau.modeset=0` in GRUB. Now that I'm in, I want to install the newest NVidia driver so I can boot normally, but when I try and install it, it tells me to disable "x server". I've tried:               $ sudo service xdm stop     $ sudo service lightdm stop     $ sudo service gdm stop      but they all fail. What am I doing wrong?


Compare two files for matching lines and store positive results

I have two files. ### File 1:               A0001  C001     B0003  C896     A0024  C234     .     B1542  C231     .     upto 28412 such lines      ### File 2:               A0001     A0024     B1542     .     .     and 12000 such lines.      I want to compare File 2 against File 1 and store the matching lines from File 1. I tried Perl and Bash but none seems to be working. The latest thing I tried was something like this:               for (@q) # after storing contents of second file in an array     {             $line =`cat File1 | grep $_`; #directly calling File 1 from bash             print $line;     }      but it fails.


Compare first column in different files

I want to compare one file with other files in the same directory. `file1.txt` contains:               move 34#123#         get 11#278         put 33#29#567#23      `file1.txt` should compare with files `1.txt` and `2.txt`. `1.txt` contains:               move 11         put 34         run 13      `2.txt` contains:               get 14         move 66      I need the results to be like this:               move 2         get 1         put 1      How can I accomplish this?


Environment variable does not seem to work in sudo

I use apt behind a firewall, so I specify a proxy in the `http_proxy` environment variable. What I have done is added the following line to both `.profile` and `.bashrc` (for good measure) of the root user:               export http_proxy=http://proxyserver:8080      When I do the following, it prints the value of the proxy correctly:               sudo echo $http_proxy      However, when I call `sudo apt-get update`, it does not seem to see the `http_proxy` variable as the root user. Only when I su to root, `apt-get` works as expected, through the proxy, so it obviously sees the variable. So my question is, as above, why does `sudo apt-get` not see the variable? **UPDATE** I have just learned that when I call `sudo echo`, it echoes the value of the variable set in the current user's profile. But even so, why does `sudo apt-get` not use that variable value?


Change working directory

I'm trying to compress a directory at               /home/cyrus/sql      And I wanted to change the working directory when zipping the folder:               / $ zip -b /home/cyrus sql.zip /home/cyrus/sql      But when I check the zip file:               / $ unzip -l sql.zip          Archive:  sql.zip       Length      Date    Time    Name     ---------  ---------- -----   ----             0  2013-05-30 10:59   home/cyrus/sql/       1776642  2013-05-23 10:22   home/cyrus/sql/wordpress.sql     ---------                     -------       1776642                     2 files      The root folder should have been `sql`. What have I done wrong?


Crash analysis and 4 levels of page table

I am having xen 3.4.2 running with 15 vm (pv+hvm) on a host with 256 Gb RAM and 96 core CPU. But recently my host crashed on debug log its showing               translating ffff83183fcb0000 with CR3 100ae42000 and 4 levels of page table.      after so many similar lines its showing               cannot translate address 0 < ffff830000000000 without cr3      From my understanding of xen pv is that, hypervisor gives pv direct access to physical RAM but hypervisor cross checks all the call to physical memory rather than using shadow pages. So it has less overhead in virtual memory to physical conversion,as its aware about actual mapping. But in case of HVM hypervisor needs to translate guests memory to physical ram. So can anyone explain me from above translation that its for hvm ram translation hypervisor is doing or will it happen in pv also? and on crash.log its showing               (XEN) grant_table.c:1408:d0 dest domain 452 dying     (XEN) p2m_pod_cache_get: Breaking up superpage.     (XEN) mm.c:741:d421 Non-privileged (421) attempt to map I/O space 00000000     (XEN) mm.c:741:d421 Non-privileged (421) attempt to map I/O space 000000f0     (XEN) mm.c:741:d352 Non-privileged (352) attempt to map I/O space 00000000     (XEN) mm.c:741:d352 Non-privileged (352) attempt to map I/O space 000000f0     (XEN) mm.c:741:d249 Non-privileged (249) attempt to map I/O space 00000000     (XEN) mm.c:741:d249 Non-privileged (249) attempt to map I/O space 000000f0     (XEN) grant_table.c:1408:d0 dest domain 450 dying      This is the second crash in a month. I have seen many system programming related questions here thats why i posted it here.


Control + L not clearing screen

When I try to clear my terminal screen on OSX:               computer@ ~ () $ ^L      And when I hit `Enter` after that it just shows:               -bash:        : command not found      Any ideas on how this happens? My `.bash_profile`, `.profile`, and `.bashrc` are empty.


Connecting to Verizon Mifi (wirelss hotspot) breaks everything

This question is obviously network related, but I thought it would be more appropriately placed in this forum because it's really not so much a connectivity issue. I recently got my hands on one of those Verizon Wireless Hotspot Mifi devices: ![enter image description here](http://i.stack.imgur.com/ySwYr.png) I observed that everything on my install works great until I actually connect to the device. Once connection is established my computer is rendered virtually useless. Specifically, I cannot run any programs (chromium, terminal, anything). Interestingly, if I boot up and start an instance of chromium and a terminal then those specific instances will continue to (partially) work until I close them, but no new instances can be created. I say partially because I did notice that pages began to load incompletely after a while and eventually the open instance ceased to work as well. Upon reboot everything works just as it should - unless of course I connect to that wireless hotspot again. Any ideas?


How to enable "Predictable Network Interface Names"?

I decided to check out what name my ethernet device will end up with, but contrary to other distros, Debian doesn't seem to have activated this change (or is holding it back?),               * Keep the old persistent network interface naming scheme for now and make       the new one opt-in via net.ifnames=1 on the kernel command line.      The problem is that I have to edit the grub kernel lines, and that seems like overkill for something that can be disabled by modifying a file. Is there another way?


dot command in Vim, last change?

The dot command in Vim repeats the "last change", but I am not exactly sure what constitutes the "last change". For example, if I type the sequence: > A;{ESC}j. Then a semi-colon is appended to the current line, but I have to type "j" again. In other words, the dot macro only does "A;{ESC}", so apparently the ESC is defining the end of the "last change". Why doesn't it include the "j" as well?


How do I re-map the changing pane keys in tmux?

I want `Prefix` + `Up`,`Down`,`Left`,`Right` to be mapped to `Prefix` + `Ctrl``h`, `Ctrl``j`, `Ctrl``k`,`Ctrl``l`. I tried:               bind-key C-h Left     bind-key C-j Down     bind-key C-k Up     bind-key C-l Right      But it didn't really work: it said "Unknown Command: Right". How do I specify this correctly? I went to `man tmux` to see the command under KEY BINDINGS and it did say Up, Down, Left, Right were the correct command for it. I am confused why the official tmux manual would say those commands when they don't actually exist like that, or what am I doing wrong?


regexp which matches all tokens independent of order

I have a quick (and hopefully simple) question about regexps. I'm trying to think of a regexp which matches all of a set of tokens irrespective of order. So for example I have a file with the names of the US states thus               Abbreviation:State name:Capital:Became a state     AL:Alabama:Montgomery:December 14, 1819     AK:Alaska:Juneau:January 3, 1959     AZ:Arizona:Phoenix:February 14, 1912     ...     WI:Wisconsin:Madison:May 29, 1848     WY:Wyoming:Cheyenne:July 10, 1890      Say I wanted to find all states which had the letters "A", "R" and "N" in their names (case insensitive). I could do a               $ cut -d: -f2 states.txt | tail -n +2 | grep -i a | grep -i r | grep -i n      which sure enough produces               Arizona     Arkansas     California     Maryland     Nebraska     New Hampshire     North Carolina     North Dakota     Rhode Island     South Carolina     Virginia     West Virginia      Is there any way of matching all three letters if they occur in any order using a single regexp?


What is the symbol *.* called?

What's the name for the               *.*      symbol and what is its significance?


Changing systemd HandleLidSwitch setting during run-time?

The setting `HandleLidSwitch` is defined in `/etc/systemd/logind.conf` as follows: `HandleLidSwitch=<hibernate,ignore,...> ` The setting is applied successfully on boot. However, I would like to change the setting during run-time depending on the AC state: If my laptop is charging, use `HandleLidSwitch=ignore`. If my laptop is on battery, use `HandleLidSwitch=suspend`. Is this somehow possible to realise with current systemd?


How can I create my own spelling file for vim?

At the moment I'm writing a document where need to use a lot of acronyms, technical language, and non German words. Now I was thinking if I could create a spelling file (`tech_speak`) which checks for this technical language so I can use the following vim command               :set spelllang=de,tech_speak spell      How could this be done?


Messages from syslogd, what do they mean and what do I do?

Recently, these messages started popping up straight into my prompt when I'm connected to the OpenSUSE system in question via PuTTY:               Message from syslogd@host at Aug  5 11:04:03 ...      kernel:[ 6177.851012] EIP: [<75c0234e>] 0x75c0234e SS:ESP 0068:f324dde1          Message from syslogd@host at Aug  5 11:15:01 ...      kernel:[ 6836.654020] Process sh (pid: 6245, ti=f2bee000 task=f32fd2b0 task.ti=f2bee000)          Message from syslogd@host at Aug  5 11:15:01 ...      kernel:[ 6836.654020] Stack:          Message from syslogd@host at Aug  5 11:15:01 ...      kernel:[ 6836.654020] Call Trace:          Message from syslogd@host at Aug  5 11:15:01 ...      kernel:[ 6836.654020] Inexact backtrace:          Message from syslogd@host at Aug  5 11:15:01 ...      kernel:[ 6836.654020]          Message from syslogd@host at Aug  5 11:15:01 ...      kernel:[ 6836.654020] Code:  Bad EIP value.          Message from syslogd@host at Aug  5 11:15:01 ...      kernel:[ 6836.654020] EIP: [<75c0234e>] 0x75c0234e SS:ESP 0068:f2befead      I know some very basic stuff about Linux but this catches me off guard. What does this mean? How do I troubleshoot? **edit** Turns out the system is actually unreachable now, while it does reply to ping I cannot connect via SSH to it. Is there anything I can do physically on the machine?


How to change cursor shape, color, and blinkrate of Linux Console?

I know I can change some fundamental settings of the Linux console, things like fonts, for instance, with `dpkg-reconfigure console-setup`. But I'd like to change things like blinkrate, color, and shape (I want my cursor to be a block, at all times). I've seen people accomplishing this. I just never had a chance to ask those people how to do that. _I don't mean terminal emulator windows, I mean the Linux text console, you reach with` Ctrl`+`Alt`+`F-key`_ I'm using Linux Mint at the moment, which is a Debian derivate. I'd like to know how to do that in Fedora as well, though. * * * _**Edit:** I might be on to something_ I learned from this website, how to do the changes I need. But I'm not finished yet. I've settled on using `echo -e "\e[?16;0;200c"` for now, but I've got a problem: when running applications like `vim` or `irssi`, or attaching a screen session, the cursor reverts back to being a blinking gray underscore. And of course, it only works on this one `tty` all other text consoles are unaffected. So how can I make those changes permanent? How can I populate them to other consoles?


Update jails FreeBSD in silent mode

What if I want to add all process to the cron? Is there silent way to upgrade jail? After these steps:               # make buildworld            # make installworld DESTDIR=/jails/somejail      It comes time to:               # mergemaster -Ui -D /jails/somejail      How to automate this process as asking so many questions during this operation (mean mergemaster) ? I want all my config files to stay untouched.


Determining the path of an executable

When looking for the path to an executable or checking what would happen would you enter a command name in a Unix shell, there's a plethora of different utilities (`which`, `type`, `command`, `whence`, `where`, `whereis`, `whatis`, `hash`...). We often hear that `which` should be avoided. Why? What should we use instead?


`command` vs `type` - Locate program file in user's PATH

I need locate program file in user's PATH. I found few solution, the best are `command` and `type`. Which is better, faster, UNIX-like way and why?               command -v <application>     type -p <application>


'which' reports one thing, actual command is another

I am running Ubuntu 12.04, which came with Cmake v 2.8.7. I had need for a more current CMake, so I downloaded the source for 12.8.12.1, built, and installed it per directions. The last step, `make install` I ran `sudo`ed.               ./bootstrap     make     sudo make install      Now I want to run it, but I find that the old version is still invoked when I execute `cmake` from the command line:               jdibling@hurricane:/$ cd /; cmake --version; which cmake     cmake version 2.8.7     /usr/local/bin/cmake     jdibling@hurricane:/$       Odd, I think. So I `su` and try it from there:               root@hurricane:~# cd /; cmake --version; which cmake     cmake version 2.8.12.1     /usr/local/bin/cmake     root@hurricane:/#       Why does `which` report the same directory, but `cmake --version` reports different versions? How can I find where the new `cmake` was actually installed? As suggested, I ran `type`:               jdibling@hurricane:/tmp/cmake-2.8.12.1$ type cmake     cmake is hashed (/usr/bin/cmake)     jdibling@hurricane:/tmp/cmake-2.8.12.1$ sudo su -     root@hurricane:~# type cmake     cmake is /usr/local/bin/cmake     root@hurricane:~#


Is there an alternative to the `which` command?

If the `which` command is not available, is there another 'standard' method to find out where a command's executable can be found? If there is no other 'standard' method available, the actual system I face currently is a bare Android emulator with an `ash` Almquist shell, if that means anything.


Linux make 1 big from 3 smaller pictures

I need to automate a task where I have smaller jpg/png images what I would like to merge into 1 big picture by placing them in a square area. Obviously to do this I would need to open gimp every time. Create a new big image, like 1920x1200 and open the 4 smaller images, select them and copy paste them into the new one and save it. The solution I looking for don't have to be the pretties, it's enough if it "just works" tm. Thanks


How do I get rid of the small nub in the bottom right corner of my terminal?

I'm setting up XMonad within Linux Mint, and I've been able to remove the menubar and the scrollbar from my terminal windows, but I can't get rid of the small resizing nub in the bottom right corner. Here's a screenshot: ![terminal with offending nub](http://i.stack.imgur.com/KAJQE.png) I think it's feature of Linux Mint (maybe?), but it serves no purpose because of the nature of XMonad, so I'd love to get rid of it. It's gnome-terminal, by the way. I assume that's important. Edit: Ok, it's a feature of gnome-terminal, because xterm and rxvt don't have it. So I guess my question is: How can I remove the nub from gnome-terminal? One answer is just "use a different emulator", but I'm hoping there's a way to get rid of it.


How to change colors of all running urxvt instances?

I'm used to black background and light green text when working on my urxvt terminals. But sometimes, when I take my laptop outside, it becomes hard to read and I'd like to change the colors of all my urxvt instances to black on white, without having to shut them down and reopen again. Is it possible, and if yes, how?


How to hide someone else's directories from a user?

I have several folders:               /home/user1/ -u user1 -G user1     /home/user2/ -u user2 -G user2     /home/user3/ -u user3 -G user3      I created three users user1, user2, user3. Each user has own group. Any user can see other account folder for a while but cannot open it. After user2 logged in using ssh he shouldn't see any folders downto its folder `/home/user2/`. He should see only folders in `/home/user2/`. How to set these permissions?


Create a fake shell in Linux?

I am not talking about shell programming or making a whole new shell like Bourne or Korn Shell.... I just want a user accessing ftp through port 21 to be directed to this shell which can support some of the basic commands a shell uses! I Googled the very same...but didn't find any satisfactory results.


Strange issue with xml_split in Linux

I am using the code `xml_split` from https://metacpan.org/pod/distribution/XML-Twig/tools/xml_split/xml_split to split a huge XML file. I am facing a strange issue with this. First, I tried the `xml_split` for splitting a `12 MB` XML file to smaller pieces of `2 MB` each. I used the following command:               ./xml_split -s 2Mb small_file.xml      It worked perfectly and created around 6 small XML files. Next, I tried with a 100 MB file.               ./xml_split -s 2Mb big_file.xml      It completed without any error, but it created a single file which was of the same size as the source file. Again, I tried with my biggest file, of around `15 GB`.               ./xml_split -s 2Mb biggest_file.xml      It went on to create a single file, and I killed the process when the file size exceeded `500 MB`. I am not sure what to make of this behavior since the same code in the same environment is working for the small file, but not for any of the bigger ones. Also, I can't find any similar issue reported at the Metacpan website. I was wondering whether there could be some system limit on my machine which could be causing this. I am on `Ubuntu 12.04.4 LTS`. Thanks, TM **_Edit:_** Instead of using the source file from the link I provided, I installed using `sudo apt-get install xml-twig-tools`, but the issue remains. I also got a colleague to do this on his system and the `xml_split` on the `15 GB` file is working on his desktop (Ubuntu)


Tracing system call on Ubuntu 12.04

The main task I have to carry out, is to trace the system call of processes in ubuntu 12.04 LTS. Problem is, I am unable to trace them continuously, i.e. as soon as they are added to the system, they should get traced. Is there any kind of signal or interrupt which can inform the user about a newly added process in the system?


How do I send text to a USB device?

I'm trying to get the "Torobot" USB servo controller to work with Angstrom on a Beagle Board XM. The servo controller registers as a USB device. The device just takes simple text commands, but there is no TTY associated with it. So I'm not sure how to send commands to it. Can I just send data like this (assuming that 002/005 is the device):               $ cat file.txt >> /dev/bus/usb/002/005      Or do I need to associate it with the generic USB device? If so, how do I do that?


Problems with accessing files on a Sansa Clip mp3 player

I have problems with accessing my mp3 player (Sansa Clip) on my Linux Mint. When I plug in the player, it does mount, but seems to be empty - well ... there are built in directories and config files, here goes tree output:               .     ├── AUDIBLE     ├── AUDIOBOOKS     ├── DID.bin     ├── MTABLE.SYS     ├── MUSIC     ├── PODCASTS     ├── RECORD     │   ├── FM     │   └── VOICE     ├── RES_INFO.SYS     ├── SYS_CONF.SYS     └── version.sdk          7 directories, 5 files      I have no idea whats going on, I've changed the USB mode to MSC, but it didn't helped. P.S. When I tried to open it with banshee - it displayed on the bottom bar that there are no audio files, no video files, 2.3GB of "other files" and 5GB of free space.


Find and copy directories containing file type

I have a directory "Movies" containing subdirectories "Movie Name". Each subdirectory "Movie Name" contains a movie file and related image/nfo files etc. I'm trying to copy all directories containing movie file of type ".avi" to an external usb device. So if `Directory/subdirectory A` contains `movie.avi`, `poster.jpg` and `movie.nfo`, then I want to copy that directory and its contents to the external drive. I've tried this:               find . -name "*.avi" -printf "%h\n" -exec cp {} /share/USBDisk1/Movies/ \;      But it only copies the file, not the directory and file contents.


vim latex: disable quickfix

How can I disable latex's quickfix feature when editing tex files (having vimlatex installed). But I want to keep it for any other language… Pretty sure this is just a small flag, didn't find it 'though.


Bad blocks only with extension cord?

My external hard drive was acting strangely, so I ran badblocks, and it seemed that nearly every block was bad from the first minute I ran it. If I did `badblocks -v > file`, the file was over 100MB after only seconds of running it. Then, for the hell of it, I ran badlocks on the same drive without using the 10 foot USB3 extension cable I've been using, and it's at 5% with no errors. Also, if I interrupt badblocks with the cord, it will show up as a different drive name (/dev/sdb, run badblocks and quit, and the drive is now /dev/sdc), and I haven't been able to reproduce this without the cord. Is it possible for badblocks to be wrong and complain about a perfect drive?


How to convert grub config to use kernel device names instead of UUID

I've got a bunch of identical systems on which I want to clone the same openSUSE 12.3 installation. I've set up clonezilla on PXE server. After appling the disk-image of on another machine, it fails to boot. This is because all the partitions are referred to be their UUIDs instead of the kernel-assigned name (sda1, sda2, etc). How do I configure grub to be using the kernel names instead of the UUID so that the image can be truly ported to the other systems? I have tried setting `GRUB_DISABLE_LINUX_UUID=true` in `/etc/default/grub` and then run `grub2-mkconfig -o /boot/grub2/grub.cfg`. I have also changed the entry in `/etc/fstab`. After these changes, the system still boots fine on the source machine, but doesn't boot on all the others. Grub loads, but only shows the word "GRUB" and thats all. Nothing else happens. My current `grub.cfg` is the following:               #     # DO NOT EDIT THIS FILE     #     # It is automatically generated by grub2-mkconfig using templates     # from /etc/grub.d and settings from /etc/default/grub     #          ### BEGIN /etc/grub.d/00_header ###     if [ -s $prefix/grubenv ]; then       load_env     fi     set default="${saved_entry}"          if [ x"${feature_menuentry_id}" = xy ]; then       menuentry_id_option="--id"     else       menuentry_id_option=""     fi          export menuentry_id_option          if [ "${prev_saved_entry}" ]; then       set saved_entry="${prev_saved_entry}"       save_env saved_entry       set prev_saved_entry=       save_env prev_saved_entry       set boot_once=true     fi          function savedefault {       if [ -z "${boot_once}" ]; then         saved_entry="${chosen}"         save_env saved_entry       fi     }          function load_video {       if [ x$feature_all_video_module = xy ]; then         insmod all_video       else         insmod efi_gop         insmod efi_uga         insmod ieee1275_fb         insmod vbe         insmod vga         insmod video_bochs         insmod video_cirrus       fi     }          if [ x$feature_default_font_path = xy ] ; then        font=unicode     else     insmod part_msdos     insmod ext2     set root='hd0,msdos5'     if [ x$feature_platform_search_hint = xy ]; then       search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5 --hint='hd0,msdos5'  5613d48c-eedb-4389-91bc-e49de73a1cc4     else       search --no-floppy --fs-uuid --set=root 5613d48c-eedb-4389-91bc-e49de73a1cc4     fi         font="/usr/share/grub2/unicode.pf2"     fi          if loadfont $font ; then       set gfxmode=auto       load_video       insmod gfxterm       set locale_dir=$prefix/locale       set lang=en_US       insmod gettext     fi     terminal_output gfxterm     insmod part_msdos     insmod ext2     set root='hd0,msdos5'     if [ x$feature_platform_search_hint = xy ]; then       search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5 --hint='hd0,msdos5'  5613d48c-eedb-4389-91bc-e49de73a1cc4     else       search --no-floppy --fs-uuid --set=root 5613d48c-eedb-4389-91bc-e49de73a1cc4     fi     insmod gfxmenu     loadfont ($root)/boot/grub2/themes/openSUSE/ascii.pf2     loadfont ($root)/boot/grub2/themes/openSUSE/DejaVuSans10.pf2     loadfont ($root)/boot/grub2/themes/openSUSE/DejaVuSans12.pf2     loadfont ($root)/boot/grub2/themes/openSUSE/DejaVuSans-Bold14.pf2     insmod png     set theme=($root)/boot/grub2/themes/openSUSE/theme.txt     export theme     if [ x${boot_once} = xtrue ]; then       set timeout=0     elif sleep --interruptible 0 ; then       set timeout=5     fi     ### END /etc/grub.d/00_header ###          ### BEGIN /etc/grub.d/10_linux ###     menuentry 'openSUSE 12.3' --class 'opensuse-12-3' --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-5613d48c-eedb-4389-91bc-e49de73a1cc4' {         load_video         set gfxpayload=keep         insmod gzio         insmod part_msdos         insmod ext2         set root='hd0,msdos5'         if [ x$feature_platform_search_hint = xy ]; then           search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5 --hint='hd0,msdos5'  5613d48c-eedb-4389-91bc-e49de73a1cc4         else           search --no-floppy --fs-uuid --set=root 5613d48c-eedb-4389-91bc-e49de73a1cc4         fi         echo    'Loading Linux 3.7.10-1.4-default ...'         linux   /boot/vmlinuz-3.7.10-1.4-default root=/dev/sda5   splash=silent acpi=on barrier=off reboot=pci  init=linuxrc splash=silent quiet showopts         echo    'Loading initial ramdisk ...'         initrd  /boot/initrd-3.7.10-1.4-default     }     submenu 'Advanced options for openSUSE 12.3' $menuentry_id_option 'gnulinux-advanced-5613d48c-eedb-4389-91bc-e49de73a1cc4' {         menuentry 'openSUSE 12.3, with Linux 3.7.10-1.4-default' --class 'opensuse-12-3' --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.7.10-1.4-default-advanced-5613d48c-eedb-4389-91bc-e49de73a1cc4' {             load_video             set gfxpayload=keep             insmod gzio             insmod part_msdos             insmod ext2             set root='hd0,msdos5'             if [ x$feature_platform_search_hint = xy ]; then               search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5 --hint='hd0,msdos5'  5613d48c-eedb-4389-91bc-e49de73a1cc4             else               search --no-floppy --fs-uuid --set=root 5613d48c-eedb-4389-91bc-e49de73a1cc4             fi             echo    'Loading Linux 3.7.10-1.4-default ...'             linux   /boot/vmlinuz-3.7.10-1.4-default root=/dev/sda5   splash=silent acpi=on barrier=off reboot=pci  init=linuxrc splash=silent quiet showopts             echo    'Loading initial ramdisk ...'             initrd  /boot/initrd-3.7.10-1.4-default         }         menuentry 'openSUSE 12.3, with Linux 3.7.10-1.4-default (recovery mode)' --class 'opensuse-12-3' --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.7.10-1.4-default-recovery-5613d48c-eedb-4389-91bc-e49de73a1cc4' {             load_video             set gfxpayload=keep             insmod gzio             insmod part_msdos             insmod ext2             set root='hd0,msdos5'             if [ x$feature_platform_search_hint = xy ]; then               search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5 --hint='hd0,msdos5'  5613d48c-eedb-4389-91bc-e49de73a1cc4             else               search --no-floppy --fs-uuid --set=root 5613d48c-eedb-4389-91bc-e49de73a1cc4             fi             echo    'Loading Linux 3.7.10-1.4-default ...'             linux   /boot/vmlinuz-3.7.10-1.4-default root=/dev/sda5  showopts apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe             echo    'Loading initial ramdisk ...'             initrd  /boot/initrd-3.7.10-1.4-default         }     }          ### END /etc/grub.d/10_linux ###          ### BEGIN /etc/grub.d/20_linux_xen ###     ### END /etc/grub.d/20_linux_xen ###          ### BEGIN /etc/grub.d/20_memtest86+ ###     ### END /etc/grub.d/20_memtest86+ ###          ### BEGIN /etc/grub.d/20_ppc_terminfo ###     ### END /etc/grub.d/20_ppc_terminfo ###          ### BEGIN /etc/grub.d/30_os-prober ###     menuentry 'Windows 7 (loader) (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-52EA4C7AEA4C5C7B' {         insmod part_msdos         insmod ntfs         set root='hd0,msdos1'         if [ x$feature_platform_search_hint = xy ]; then           search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  52EA4C7AEA4C5C7B         else           search --no-floppy --fs-uuid --set=root 52EA4C7AEA4C5C7B         fi         chainloader +1     }     ### END /etc/grub.d/30_os-prober ###          ### BEGIN /etc/grub.d/40_custom ###     # This file provides an easy way to add custom menu entries.  Simply type the     # menu entries you want to add after this comment.  Be careful not to change     # the 'exec tail' line above.     ### END /etc/grub.d/40_custom ###          ### BEGIN /etc/grub.d/41_custom ###     if [ -f  ${config_directory}/custom.cfg ]; then       source ${config_directory}/custom.cfg     elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then       source $prefix/custom.cfg;     fi     ### END /etc/grub.d/41_custom ###          ### BEGIN /etc/grub.d/90_persistent ###     ### END /etc/grub.d/90_persistent ###


How to make Compiz start automatically?

I'm using Linux Debian Squeeze and I already have compiz installed. I want metacity stop automatically boot, and instead want compiz to start automatically.


Is it possible to install Gentoo by building on one machine and copying the files?

I have an older machine with a failing cdrom drive. Because of this I'm having a hard time installing Gentoo on the system. I wanted to run a proposed work around past you and see if it makes sense. Using another Linux machine (running Ubuntu) I was going to install Gentoo into a folder on that machine. By that I mean: create a folder and put stage 3 files in it along with the portage snapshot, chroot into the folder, build the kernel (with Genkernel), install system tools, and basically everything in a standard install short of writing to the MBR. Once I have that environment set up I would throw it into a tarball. Then I would boot up the target machine via a Linux boot disk (it can do this for short periods of time), setup the partitions, deploy that tarball, and write out to the MBR. In my head this all seems to make sense. What do you think? Would I run into problems with any of the compiles of the kernel or system tools? Thanks in advance! **Update 5/11:** The target machine is a laptop from 1997. While it does have a USB port it cannot boot from it. The cdrom drive is difficult to remove and does not have a standardized connector. While the hard drive is easily removable I do not have a way to connect a 2.5" IDE drive to any of my other computers. Some of these issues can be solved by throwing a little bit of money at the machine but I rather not put any money into a machine this old. And, before you ask, I plan on using this machine mostly as a typewriter--the keyboard has a great feel to it.


How to use cURL commandline to download a file, for which the link is hidden(activates on-click only)

I was referring to this question. However, I am wondering how to do the same with `curl`. So far, I have tried the following:               curl -O output.rar --referer http://subs.sab.bz/ 'http://subs.sab.bz/index.php?s=ece2929c25861a7244025e1628e7ee5a&act=download&attach_id=75766'      I also tried with `-e` switch, but it does not work for me. Can anyone help me out? Thanks in advance!!


I want to use openldap account to send or receive email from internet

I have DNS server + DHCP sever + openldap +samba with only IP: 192.168.100.114; and domain is samba+ldap with domain name abc.local. In this server, I created some group and users (Ex: user1, user2,.., user100 bussiness, technology, accounting) in domain Ldap Samba. Now, I build mailserver (Postfix, dovecot, squirrelmail) with IP:10.10.10.100. I want to use these users of LDAP+samba (user1->user100) to send and receive email from internet. I dont know how to use these account? I have register host company.com.vn to public outside and surely I want these account is named user1@company.com.vn user2@company.com.vn ... replace user1@abc.local, user2@abc.local ....in mailserver linux. I also don't know how to configure! I already set in domain ISP record MX.


Aliases and tmux

Aliases defined in `.bash_aliases` and `.bashrc` don't work in `tmux`. Can this be changed in some configuration, so the aliases work under `tmux`?


Accents not working on LibreOffice. How to report bug

When I try to write an accent (spanish in my case) in Libre Office, it just won't write it. I know everything else is fine since I can write accents on other programs (i.e my console). What is curious is that I can write accents (í ó ú) until I click somewhere else, lets say, I open firefox or I do something in KUbuntu. Then, if I start working in LibreOffice again, I can't write accents anymore. So, if this is a bug, where should I report it?


Windows 8 booting issue from GRUB

I dual booted Windows 8 and Kali Linux(1.0.7) with Kali installed in legacy mode(because my laptop doesn't allow me to boot from any external device in UEFI mode,it says system does not have DVD/CD or USB boot option). Now when I reach the GRUB menu it shows the Windows 8 loader but fails to boot from it. Now if I have to boot Windows I have to switch to UEFI mode or press `F12` to get into boot setup and boot from the Windows boot manager. If I have to use Kali GRUB boots it automatically. How do I fix the Windows boot issue? Windows is on dev/sda5 whereas Kali is in dev/sda10.


How to prevent xdotool from locking the current window after a script?

I have a simple BASH script with `xdotool`, that reads some data from a CSV, and enters it into a form in some other software:               #!/bin/bash          sleep 5          while read -r line     do         a="$(echo $line | awk '{ print $1 }')"         xdotool type $a         xdotool key "$Tab"     done < ./data.csv          aplay Beep.wav      The script works as intended, but after the beep tone, the screen becomes locked:   * The mouse moves, but no windows can see it (e.g. tool tips do not appear) and it cannot click on anything, even the current window.   * The keyboard words, but only within the current window.   * The window is locked in this manner for about 5 minutes, then suddenly is not locked anymore. CTRL+ALT+F1 allows me to change consoles, but `killall -9 xfce4-terminal` and `killall -9 xdotool` did not stop the lock. How can I prevent `xdotool` from locking the current window after running it in a script?


Looking for obsolete "libGLcore.so.1"

I've installed Steam on Debian using the Steam Wheezy Installer. On start up it says it's missing the 32-bit library `libGLcore.so.1`. Doing a package search I find it only exists in old nVidia drivers, whereas I'm currently running the 300 series driver. Why is Steam looking for an ancient library unrelated to the one I've been running for years and is there anything I can do to fix it?


How to enable/disable a serial port?

I need to disable and then enable a serial port for testing purposes on a Java program. Since the `man` page of `setserial` is stating: " _Using UART type none will disable the port._ ", I use `sudo setserial /dev/ttyS4 uart none` to disable the port. This successfully disables the serial port. To enable the serial port again, I use `sudo setserial /dev/ttyS4 -a autoconfig` and the port is up as expected. After I've disabled the port, I do try to open the port using the Java gnu.io.CommPortIdentifier function. When I try to enable the port after the executing the `gnu.io.CommPortIdentifier` function, I get this output:               $ sudo setserial /dev/ttyS4 -a autoconfig     Cannot autoconfigure port: Device or resource busy      How can I work around this problem? Is there a better way to enable/disable the serial port? Or can I clear the list of requests made to the port? I obviously can't just kill the process, since my test is running in it.


No network in slackware

I have just installed Slackware. I am not new to Linux but new to Slackware. I wonder how to install network in it. After the Slackware installation, audio and network were not working. ![screenshot](http://i.stack.imgur.com/E5TVc.png) This is how it looks like , no audio , network


Recursively rename e-mail files from .txt to .eml

Directory "$d" contains a few thousand e-mail files with the .txt extension. To open them in my e-mail client, I need to rename them to .eml Will this command rename them correctly:               find "${d}" -type f -name '*.txt' | while read f; do mv -vn "${f}" "${f%.*}".eml; done      or is there a better, more robust way to do this? I could not think of an elegant way of doing this using:               -exec ...{}... \;


stop processing in shell script but don't exit

I've got a script that I run continually to monitor vsftpd logs. Here is a small example:               #!/bin/sh     tail -n0 -F /var/log/vsftpd.log | while read line; do         if echo "$line" | grep -q 'OK UPLOAD:'; then             username=$(echo "$line" | cut -d" " -f9 | sed 's/\[\(.*\)\]/\1/')             if [ $? -ne 0 ]; then                 echo "ERROR: Failure to get parse username. Line it is trying to parse: $line" >>/var/log/ftpmonitor.log                 # We need to remove the file with any error so it doesn't linger                 rm -rf $home$filenamewithpath                 if [ $? -ne 0 ]; then                     echo "ERROR: Failed to delete video file" >>/var/log/ftpmonitor.log                     exit 1                 fi                 exit 1             fi          # lot of other stuff here...          fi     done      I want to catch any errors I can with any command failure and stop. Originally I thought I'd use exit to stop. Normally that makes sense but in this case this script needs to keeping running all the time monitoring the vsftpd logs. So I don't want to exit the script I want to just stop any other commands after that failure. How can I achieve this?


Linux distros wont boot

I haven't been able to find an answer to this problem anywhere so im posting it here. So I'm trying to put a couple Linux distros on a laptop, using xboot and a USB drive, and when the computer booted, it went to the xboot menu, let me pick which distro I wanted, started loading it, but freezes right after beginning to load. So far this happens with mint, Fedora, Fubuntu, and Ubuntu, while puppy, mageia, and dragora appear to work. Thing is, its not just with the laptop but the same thing happens when I try to run any of those ISO's using QEMU on a computer I know works. When I first tried loading Linux a couple months ago, I tried all of those same ISO's (as in the exact same file) and they all worked fine, but now only some do. Any ideas on why they wont load? It doesn't really freeze though, because the computer will reboot instantly with `Ctrl`+`Alt`+`Del`, it just wont move past the first loading screen. EDIT: After many more searches, it appears some Linux distros need "virtualization technology" and my laptop lacks hardware for this. If anyone knows a way to get around this, let me know. It looks like a dead end though.