ZSH takes two tabs to complete filenames

I love Zsh's tab completions, but it's frustrating when there is only one possible option and I have to tab twice to tab complete the filename. For example, if this is a list of files in a directory:               - a.txt     - b.txt     - x.txt      and I type `cat x<TAB>` in ZSH, I get this at the prompt:               $ cat x     x.txt      I have to TAB again to get the value. What can I do to get ZSH to complete the filename with only the first tab? Here's my setopt:               alwaystoend     autocd     autonamedirs     autopushd     cdablevars     completeinword     correctall     extendedhistory     noflowcontrol     histexpiredupsfirst     histignoredups     histignorespace     histverify     incappendhistory     interactive     longlistjobs     menucomplete     monitor     promptsubst     pushdignoredups     sharehistory     shinstdin     zle


Install from RPM, then files change. How can I see the differences?

This is a RedHat Enterprise 5.5 system. I ran a verification check against an RPM, and it looks like two files have changed:               # rpm --verify shadow-utils      S.5....T  c /etc/default/useradd     S.5....T  c /etc/login.defs      I have access to the RPM which originally installed these files. Can diff these changed files against the version which is stored in the RPM?


Contents of /proc

Is there a site someplace that lists the contents of `/proc` and what each entry means?


Easiest way to install a Linux Desktop installtion on VirtualBox

I need a Linux Virtual machine (running on Windows with Virtual Box), and I need it run a desktop such as Gnome. Because it is running on a Virtual machine on a not particulary powerful machine I require a version of Linux which is not too memory/cpu hungry. I readup a little on this and decided to try Arch Linux as it advertised itself as lightweight and easy, but unfortunately it was not easy enough for me. I setup a VirtualBox machine mounted the Installation ISO okay as described at https://wiki.archlinux.org/index.php/Installing_Arch_Linux_from_VirtualBox But then when it came to actually installing ArchLinux I was lost as https://wiki.archlinux.org/index.php/Official_Arch_Linux_Install_Guide concentrates or real(non-virtual) installations and had far too many steps. Is there a Linxu Distro which I can install with just a couple of commands that will be usuable in my virtual machine ?


Add echo command to /etc/profile to disable screen blanking

I am considering adding the following echo command to /etc/profile               echo -e ‘\033[9;0]\033[14;0]’      The system in question does not have setterm command available and is just running text console. Are there any problems with doing this the way I plan to?


Get current terminal name

How do I fetch the current terminal name? I mean to the name that `ps` shows in the TTY column, e.g.:               root@dor-desktop:/home/dor/Documents/LAMP_setup/webs_install/do/install# ps aux | egrep 'mysql|(^USER)'     USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND     dor       2238  0.2  1.9 448052 79796 ?        S    17:27   0:17 gedit /home/dor/Documents/LAMP_setup/webs_install/do/install/mysql.install /home/dor/Documents/LAMP_setup/webs_install/do/install/mysql.setup     root      4975  0.1  0.5 324984 22876 ?        S    18:12   0:04 gedit /usr/local/mysql/bin/mysqld_safe     root      8160  0.0  0.0   4108   664 pts/2    S    19:08   0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --skip-networking --skip-grant-tables --user=mysql --basedir=/usr/local/mysql --ledir=/usr/local/mysql/libexec     mysql     8279  0.0  0.4 146552 19032 pts/2    Sl   19:08   0:00 /usr/local/mysql/libexec/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var --user=mysql --skip-networking --skip-grant-tables --log-error=/usr/local/mysql/var/dor-desktop.err --pid-file=/usr/local/mysql/var/dor-desktop.pid --socket=/usr/local/mysql/mysql.sock --port=3306     root      8342  0.0  0.0   7632  1024 pts/2    R+   19:14   0:00 egrep --color=auto mysql|(^USER)      In the above example, I need to fetch `pts/2` which is probably the name for the current terminal that executed those commands.


Send email from external email id such as Gmail, Outlook to Unix user account

I am trying to see if there is any way I can send email from external email address to Unix user account. I don't know if this at all possible or not. For example, if my external email address is `abc@xyz.com` and unix user name is `test@localhost` on `testserver.test.com` then I would like send email from `abc@xyz.com` to `test@localhost`. With `mail` command I know I can send email from Unix to my account on Gmail/Outlook but I would to know if any way exists to do reverse. Ultimately I want to have it available in `/var/spool/mail/test` account.


Transfer all messages of thunderbird with windows 7 to thunderbird ubuntu 14.04?

How can I transfer all messages and contacts of thunderbird with windows 7 to thunderbird ubuntu 14.04? I know that have a free app called mozbackup. But it don't works with linux. There a way that can I make this moving? Thanks!


Making a real universal bootable Arch pen drive

I've followed this article, and been able to get a fully working 32-bit installation on a _Kingston DataTraveler_ 8GB pen drive, with a BIOS boot partition, and a home/root `ext4` file system without journaling partition, and no swap. I'm using GPT partitions. The problem is that pen in which I installed Arch only works on my computer. That is, if I insert it in other computer (the ones I tested had Windows with BIOS, not UEFI), I cannot change the boot order, because the pen does not appear as a bootable device. **How can I get it to run on any computer, the same way the usual Arch Linux installation pen does?** That is the whole point, to have a pen that is ensured to boot on any computer to which I have physical access, rendering its usual data protection measures, i.e. login passwords, useless! _(evil laugh)_ I see the normal installation pen has an EFI instead of a BIOS Boot partition. I don't mind reinstalling the system, but I'd surely prefer if I could copy the latest installation media ISO and tweak the necessary options (auto login, hostname, clearing of changes on reboot, etc.). **Can I do that? How exactly?** Is this supported? What exactly, besides what is referred in the article, and the EFI boot partition, do I need to watch out for? Must I use `fdisk` or is `gdisk` OK? What bootloader should I choose? I'd prefer GRUB, simply because I'm used to it, but I heard Syslinux is better (and easier) for this purpose.


Debian 7 - Kernel Panic after libc6 update

I installed and configured Debian 7.2 Wheezy AMD64 few days ago, I spent days configuring everything out and installing useful apps etc, so finally I tried to install Wine.   And what happened?   Dependency problem - libc6 is version 2.13 but it should be 2.17 to satisfy Wine. Unfortunately, there is no stable version available so I used sid to install libc6 2.17. It got installed, but, after finishing installation, all commands stopped working. I was unable to call any command, it just reports that command is NOT found. I thought that reboot may fix the problem, so I done hard-reboot and after GRUB menu it stucks:               switch_root can't execute '/sbin/init' no such file or directory     Kernel Panic - not syncing      And my Debian is now is in unusable state. I have Dual Boot with Windows 7 64-bit. I also have Debian 7.2 Wheezy AMD64 live on USB flash so I can use it for repair. I do not have enough experience with Debian based distros to solve this. Can someone give me step-by-step guide?


Why do the nfs4 tutorials recommend to bind mount sub directories

All NFS4 tutorials I have encountered so far recommend bind mounting real directories into the export root. Is this a technical necessity? If I had a directory that's only meant to be exported, is it sufficient to make it a subdirectory of the export root or does it really need to be bind mounted?


Write-only permission for a directory doesn't allow to rename (move) files inside?

In fact, I would like to ask more general question -- "what does write permission for a directory allow you to do exactly?" -- but let's approach it with a concrete example. It is a long question, if you are in a hurry **read the bold** -- it should cover the main part. Different sources (nice question, one more, grymoire's) say something similar to the following on the directory permissions: > r, read -- reading of the directory's content (filenames inside) > > w, write -- changing the directory's attributes (e.g. modification time) and > creating/renaming/removing entries inside > > x, search -- accessing files inside, you have access to the inode of the > file, hence you can reach it's actual content My problem is with the description of `w`. What directory's attributes does it give you access to? **I cannot create/rename/remove a file inside a directory with only write permission** : I make a directory (`tdir/`) and a file inside (`afile`), `chmod -x-r tdir/`, `mv tdir/afile tdir/af`, `rm tdir/afile`, `touch tdir/newfile` -- all fail with permission denial, unless I set `x` permission to the directory as well. And `x` alone doesn't give you the permission to create/rename/remove files inside the directory. **In order to do that you need both`x` and `w`**. But `touch tdir` does change the modification time of the directory with `w` only. I would rephrase the sources above this way for the compliance with the issue: a directory's `r` allows you to see the filenames inside, but no access to the actual file (to the inode); `x` gives you access to the inodes of the files (which means you can see their permissions and, according to it, have access to the contents), but you still cannot change anything in the directory; directory is actually some sort of a file and to change something in it you need the `w` permission. Thus, when you are changing something in the directory you need `w` permission. If your change requires inodes of the files in the directory -- you need `x` as well. It explains why you cannot remove a file inside a directory with `w` only: **when removing a file you need to reduce the link count of the inode by 1 -- you need to know the inode -- thus you need`x` for the directory**. **But why do you need`x` for creating (you could ask the system to create a file without exposing the inode?) and renaming/moving the file (when you move a file you don't change it in any way, you only change the records inside the directories and their inode counts?)?** Maybe it is just an implementation thing? I.e. indeed you don't need the inode for renaming/creating files -- you need only filenames and `w` permission; but inode and filename constitute one record in the directory; thus changing the filenames = changing the records = kind of accessing the inodes. And also what attributes do directories have besides modification time, permissions and files records? What else in the directory can you change with `w` only?


Fedora 19 eclipse issue

I have just installed Fedora 19 from the DVD ISO and I am having this irritating problem. Whenever I start eclipse it shows me:               "Eclipse Platform" is not responding.       You may choose to wait a short while for it to continue or force        the application to quit entirely.      and I have to select wait and then it works for me. I think I noticed, when installing Fedora, that it had no option to make a selection to install Java as I had for eclipse. How can I start Eclipse without getting this message? ![enter image description here](http://i.stack.imgur.com/795GA.jpg)


LVM: possible to recover full snapshot?

Accidentally, I have let a LV snapshot created by libvirt/virt-manager run to full. Is there any way I can at least recover (some) data written to the snapshot? Many thanks!               lvs       /dev/vm_storage/vm_win_01: read failed after 0 of 4096 at 268435390464: Input/output error       /dev/vm_storage/vm_win_01: read failed after 0 of 4096 at 268435447808: Input/output error       /dev/vm_storage/vm_win_01: read failed after 0 of 4096 at 0: Input/output error       /dev/vm_storage/vm_win_01: read failed after 0 of 4096 at 4096: Input/output error       LV          VG         Attr       LSize  Pool Origin                    Data%  Move Log Cpy%Sync Convert       vm_win_01   vm_storage swi-I-s--- 50.00g      [vm_win_01_vorigin]   100.00            lvdisplay     --- Logical volume ---       LV Path                /dev/vm_storage/vm_win_01       LV Name                vm_win_01       VG Name                vm_storage       LV UUID                wiONtF-6bXR-nleO-P2v7-e6mw-ezdg-tvBPbz       LV Write Access        read/write       LV Creation host, time cubist-vh001, 2014-07-22 18:38:55 +0800       LV snapshot status     INACTIVE destination for vm_win_01_vorigin       LV Status              available       # open                 0       LV Size                250.00 GiB       Current LE             64000       COW-table size         50.00 GiB       COW-table LE           12800       Snapshot chunk size    4.00 KiB       Segments               1       Allocation             inherit       Read ahead sectors     auto       - currently set to     256       Block device           254:7          dmsetup table | grep win     vm_storage-vm_win_01_vorigin: 0 524288000 snapshot-origin 254:4     vm_storage-vm_win_01: 0 524288000 snapshot 254:4 254:6 P 8     vm_storage-vm_win_01_vorigin-real: 0 524288000 zero      vm_storage-vm_win_01-cow: 0 104857600 linear 8:3 104859648


How can this init script start without its dependency?

I'm working on some lsb init scripts. Here's the init info from one of them:               ### BEGIN INIT INFO     # Provides:     myscript     # Required-Start:   networking myotherscript     # Required-Stop:    networking myotherscript     # Default-Start:    2 3 4 5     # Default-Stop:     0 1 6     # Short-Description:    Starts my daemon     ### END INIT INFO      And the init info from myotherscript               ### BEGIN INIT INFO     # Provides:     myotherscript     # Required-Start:   networking     # Required-Stop:    networking     # Default-Start:    2 3 4 5     # Default-Stop:     0 1 6     # Short-Description:    Starts my other daemon     ### END INIT INFO      If I understand correctly, running `service myscript start` should not work unless myotherscript is running. However, executing `service myscript start` does indeed work. Why don't I at least get an error about the unmet dependency?


Detecting extension files doesn't executed for a period

How can I detect the `.class` files in my workspace which haven't executed for a certain period, and remove them?


How to fetch logs from diffrent servers using one command? For example, suppose I want to fetch logs for same id in different servers. I have to go to each server and search for logs. Is there any way to do it one go?


Fedora 14 root missing capability

I am trying to run a process that performs a clone() operation using a set of flags (CLONE_NEWIPC, CLONE_NEWNET, ...) that require CAP_SYS_ADMIN capability. This should not be a problem since I am running the process as root, but for some reason, it works on a debian wheezy 3.2.0 but not on a fedora 14 2.6.32. It throws an EPERM error which according to the CLONE(2) man page, means it was run by "an unprivileged process (process without CAP_SYS_ADMIN)". Again, everything is running as root. Any ideas why this is happening and how to fix it?


Booting from command line

I have a desktop version of #! installed on my laptop. I am quite new to Linux, but learning more everyday. I would like to know if it is possible to choose on start-up to boot into the Desktop, as it is now by default, or start in a command line environment (with a graphical display enabled). That way if I need just to go through files quickly I could do so with the terminal commands, but I could also call a graphical program if needed (ie thunar). I'm thinking I can avoid loading the desktop when I don't need it. Of course, I would like to keep the possibility of logging into the desktop.


How can I install perldoc on Ubuntu?

Ubuntu 10.10 comes with Perl 5.10.1 pre-installed, but strangely enough `perldoc` isn't part of the package.               $ perldoc     You need to install the perl-doc package to use this program.      How can I make this feature available?


Samba 3.6.12 and NIS

We were able to use Samba and NIS on Samba 3.0.8 on Solaris 10 U5. When we update system to Solaris 10 U11, samba version became 3.6.12. And we are unable to authenticate like old style. I did not include some parameters on below(create directory mask,etc...) Old `smb.conf`                   [global]         workgroup = WORKGROUPNAME         server string =  Samba Server         security = SERVER         password server = dc6n, dc7n         username map = /etc/sfw/username.map         local master = No         dns proxy = No         wins server = dc6n, dc7n         kernel oplocks = No         host msdfs = No         map archive = No         oplocks = No         level2 oplocks = No      old `nsswitch.conf`                   passwd files nis         hosts  files nis       We try to set same configuration to Samba 3.6.12, but it did not work. So I decided to use security = ADS with Kerberos. This is worked but the way we did not want. Because, only windows domain users were able to login and NIS users not. New `/etc/smb.conf`                   workgroup = WORKGROUPNAME         realm = domain.com         security = ADS         password server = dc6n.domain.com         utmp = Yes         idmap config *:backend = tdb         idmap config *:range = 5000-9999         idmap config NETADM:backend = tdb         idmap config NETADM:range = 10000-90000         idmap uid = 100000-500000         idmap gid = 100000-500000         template homedir = /home/%U         template shell = /bin/tcsh         winbind cache time = 1800         winbind enum users = No         winbind enum groups = No         winbind use default domain = Yes         winbind separator = /         create krb5 conf = No         local master = yes         domain login = yes         domain master = yes         preferred master = yes      New `/etc/nsswitch.conf`                   passwd files winbind  nis         hosts  files winbind  nis       New `/etc/krb5.conf`                   [libdefaults]              domain.com = domain.com             dns_lookup_kdc = true               [realms]              symantec.local = {                  kdc = dc6n.domain.com                 admin_server = dc6n.domain.com             }               [domain_realm]          .domain.com = domain.com      I am able to get users info from AD and NIS with `wbinfo` and `genent` commands. How can we authenticate like old style again?


extracting certain info from output

I'm trying to extract certain info from ffmpeg output. Sample ffmpeg output:               configuration:  --enable-memalign-hack --enable-mp3lame --enable-gpl --disable-vhook --disable-ffplay --disable-ffserver --enable-a52 --enable-xvid --enable-faac --enable-faad --enable-amr_nb --enable-amr_wb --enable-pthreads --enable-x264      libavutil version: 49.0.0     libavcodec version: 51.9.0     libavformat version: 50.4.0     built on Apr 15 2006 04:58:19, gcc: 4.0.1 (Apple Computer, Inc. build 5250)     Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file.mov':     Duration: 00:01:32.0, start: 0.000000, bitrate: 63489 kb/s     Stream #0.0(eng): Audio: pcm_s16le, 48000 Hz, stereo, 1536 kb/s     Stream #0.1(eng), 29.97 fps(r): Video: Apple ProRes 422, 1280x720     Must supply at least one output file      I want to get back a string with just Duration, frame rate, codec, and size, e.g.:               [00:01:32_29.97_Apple ProRes 422_1280x720]      I tried starting with this (from another hint):               ffmpeg -i file.mov 2>&1 | sed -n 's/Duration: \(.*\), start/\1/gp'      to get the Duration, but that just 'removed' the `Duration` and `, start`, i.e.:               00:01:32.0: 0.000000, bitrate: 63489 kb/s      PS: I'd also like to remove the `Apple` from `Apple ProRes 422` :-) Thanks! Update: I was able to extract the codec with               sed -n "s/.*\Video: \(.*\),.*/\1/p"      but I don't know how to (a) get the size and framerate, and (b) combine the searches on one line...


Increment numbers inside strings by an offset

I want to search a text file for strings like these.               [task0]     [task1]     ...     [task1613]      and increment each by a given offset, in this case by 3640. So, with the example I gave above, I'd get the following.               [task3640]     [task3641]     ...     [task5253]      I want each of the incremented numbers in their original positions in the target file though, with `[task#]` wrapped around the number. Using `sed`:               sed "/^\[task/s/[0-9]*\]/3640+&/" ./test.file2      I can get something like:               [task3640+0]     [task3640+1]     ...     [task3640+1614]      but that isn't very useful because I don't know how to evaluate the expressions in place and I'm fairly sure that `sed` isn't suited for this. I'm thinking that `awk` or `perl` would work better for this, but I'm fairly inept at both of them. Can someone at least point me in the right direction, please? I've spent way longer than I want to admit on this already. For a more detailed view of what I want to do see this page on pastebin.


"usb 3-2: can't set config #1, error -110" - USB keyboard works in Windows 8 laptop but on PC only until Linux boots

I tried 2 new USB keyboards that work until Linux starts booting. When booting I saw:               [    8.365211] usb 3-2: New USB device found, idVendor=1a2c, idProduct=0b23     [    8.404863] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0     [    8.444623] usb 3-2: Product: USB Keyboard     [   10.641472] EXT4-fs (sda2): mounted filesystem with ordered data mode. Opts: (null)     [   13.481363] usb 3-2: can't set config #1, error -110     [   13.523672] usb 3-2: USB disconnect, device number 2     [   13.804028] usb 3-2: new low-speed USB device number 3 using uhci_hcd      `lsusb` shows no keyboard. _I can't try anything requiring SuperUser permissions because it requires my password._ > **I've found using google:**   * **110** is related to **power** , some say not enough others it's overcurrent protection   * Toggle `usb legacy mode` in BIOS.I toggled it and also `usb 1.1 emulation` (description mentions typing special keyboard keys) and `plug n play aware os`   * Unload ehci module (responsible for usb 2.0) **requires root** and all usb devices will work slower (To type, I would keep using Ultimate Control (requires Android) that I have installed earlier but it can't even type normally because it capitalizes letters randomly {it didn't do that before this problem, maybe this is a coincidence} and no android keyboard has all PC keyboard keys working as on a PC keyboard or have them at all.) > **This occurs with:**   * _Titanum TK101_ and _Tracer Patriot Black_ keyboard (these keyboards look identical except logo and key stickers, maybe hardware is same)   * K8T NEO-FSR Motherboard version 1.0 with **last BIOS**   * COLORSIT 330U-FPH PSU   * AMD Venice 3000+ CPU   * **Lubuntu 14.04/10 64-bit** OS (I've run `do-release-upgrade -d` and update it everyday)   * Linux 3.16-rc3   * BIOS always showing **CPU stepping as CG** and its temp as less than 30°C and motherboard temp always less than 40°C and voltages within ATX specification. I don't know how:     1. correct these values are     2. much they change during work. > UPDATE this problem is being avoided by using a keyboard which is exactly > the same model (tracer patriot black) but with a ps/2 connector.The seller > said me these keyboards work on Linux/Ubuntu machines (telling Me he > installs Linux sometimes for his clients), making Me believe the problem is > also caused by my old PC machine. **Any other info? I don't know what else, please tell Me**


how to assign values of the column for given conditional statements

I need help with a script to assign values of the column with a given conditional argument. To be specific, here is my data and my condition input `data.file`:               0.4     3.6     -2.4     0.1     -2.0     1.6     2.2     3.6      condition: assign R if data.file greater than 2(>2), assign S if data.file less than -2(<-2), and assign M if data.file greater than or equal to-2 and less than or equal to 2 [-2,2]. Desired output file `out.file`               0.4  M     3.6  R     -2.4 S     0.1  M     -2.0 M     1.6  M     2.2  R     3.6  R


Addition with 'sed'

I am trying to perform a mathematical operation with `sed`, but it continues to treat my variables as strings. The input is of this kind:               $ echo 12 | sed 's/[0-9]*/&+3/'     $ 12+3      I'd like to have 15 as output. I need to do the operation and replace its mathematical result in only one passage, because I am running the program as a Python daemon, and I want to avoid passages like redirecting `stdout` on files, open those files, perform operations, extract the result, do the replacement. To me, `sed` seems the best to perform all in one line. I've tried to cast both input and output in various ways like               $ echo 12 | sed 's/[0-9]*/int(&+3)/'     $ echo 12 | sed 's/[0-9]*/\int(&+3)/'     $ echo 12 | sed 's/[0-9]*/\int(&+3)/'      but the result was always a printing of the second field.


Convert absolute symlink to relative symlink with simple Linux command

I have a complete sub-filesystem inside a path `/home/user/system` containing the standard Linux structure with directories `/bin`, `/home`, `/root`, `/usr`, `/var`, `/etc`,... This sub-filesystem contain symbolic links, either relative or absolute. The relative symlinks are just fine, they stay within the sub-filesystem under `/home/user/system`. But absolute symlinks are problematic, as they point to a target outside of the sub-filesystem. As an example we assume an absolute symlink as follows (seen inside the sub- filesystem):               /usr/file1 -> /usr/lib/file1      In the overall filesystem we have a link at `/home/user/system/usr/file1` that now point to a file `/usr/lib/file1` outside the sub-filesystem, instead of a file `/home/user/system/usr/lib/file1` _inside_ the sub-filesystem. I would like to have a simple script, preferably a single command line (rsync, chroot, find, ...) that converts every absolute symlink to a relative one. In the given example, that relative link would become               /usr/file1 -> ../usr/lib/file1


How to configure mailx to support Gmail?

How can I set up `mailx` to send messages to my Gmail account? What I do now is run the command:               mail -s "hello kid" mymail@gmail.com      It freezes and does nothing. I tried some variations, but all of them just froze dead in my terminal. Is there anything I need to configure in `mailx` before actually using `mail`? There were different options found on the Internet, like making a `.mailrc` and other config files, but I got nowhere. Can someone provide me with more information on the subject?


Problem in Cross compiling TinyCC with CodeSourcery

I am trying to cross compiling homas Preud'homme's version of TinyCC by using following command               ./configure --cc=arm-none-linux-gnueabi-gcc --prefix=/home/shushant/tinycc/tc      and it shows following error message after running `make install`               make: Circular Makefile <- Makefile dependency dropped.     make -C lib native     make[1]: Entering directory `/home/shushant/tinycc/lib' arm-none-linux-gnueabi-gcc -c alloca86_64.S -o x86_64/alloca86_64.o -I..  -Wall -g -O2 -fno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare -Wno-unused-result -DTCC_TARGET_X86_64     alloca86_64.S: Assembler messages:     alloca86_64.S:7: Error: expression too complex -- `pop %rdx'     alloca86_64.S:11: Error: ARM register expected -- `mov %rdi,%rax'     alloca86_64.S:13: Error: ARM register expected -- `add $15,%rax'     alloca86_64.S:14: Error: ARM register expected -- `and $-16,%rax'     alloca86_64.S:15: Error: bad instruction `jz p3'     alloca86_64.S:28: Error: ARM register expected -- `sub %rax,%rsp'     alloca86_64.S:29: Error: ARM register expected -- `mov %rsp,%rax'     alloca86_64.S:35: Error: expression too complex -- `push %rdx'     alloca86_64.S:36: Error: bad instruction `ret'     alloca86_64.S:40: Error: junk at end of line, first unrecognized character is `,'     make[1]: *** [x86_64/alloca86_64.o] Error 1     make[1]: Leaving directory `/home/shushant/tinycc/lib'     make: *** [libtcc1.a] Error 2      some how binaries is successfully generated but in wrong directory (at the root of `/home/shushant/tinycc`) instead of `/home/shushant/tinycc/tc` and when I am trying to run on android emulator its show`file not found` of course generated binaries is not supported by device. How can I fix it?


Is there a web browser for Linux that implements the Trident engine (Internet Explorer)?

Internet Explorer uses the Trident engine for rendering. I have an app that was made for IE only. It is a big application I inherited, and it is JavaScript heavy. It's and older app, and it will not work correctly on newer browsers, even IE, later versions has quirks but it works. The app is not straight text, so I can't get rid of all the images or anything like that. I do not have the luxury of installing Linux and then using a VM like VirtualBox to run Windows. It must be native to Linux (or Linux can run the Windows program, maybe via Wine). It will not work on Windows non-IE browsers either, but that is another matter. It is not a trivial matter to change the code. Is there any browser I can use to emulate IE or that has the Trident engine?


resources for linux programming

what are the best books or best websites to learn the linux programming for absolute beginners and for professional programmers? To be more specific topics like, a) forking b) Shared memory c)exec commands d)signals e)scheduling algorithms (round robin,first come first serve,priority scheduling,short job first, multilevel queue scheduling, multilevel feedback queue scheduling)


Linux lock down route to avoid changes to the default route

I have a problem that every time I connect my Android phone with USB tethering it hijacks my computer's internet connection. Even if the phone's WIFI is off. I try to manually remove the default route with               sudo route del default enp0s29u1u4      but it finds its way back after a few minutes. Is there a way to get this interface to permanently get the fuck off? Or alternatively, is there a way to set my desired interface to be permanent no matter what?


change regular user's password with root access

I have Ubuntu installed on a Raspberry pi. I have a normal user `pi`, but I forgot the password. However, I do have root access. How would I change pi's password using root?


configure web server in RHEL

I have installed Request tracker in my RHEL 5.6 system. The RT installation succeeded and I have also installed apache web server, mysql, phpmyadmin that is required for running the request tracker tool. However, in the final step, it is mentioned as, for opening RT we have to enter `http://serveripaddress/rt`. I have apache web server installed in my system. So, I am just typing `http://localhost/rt` in my system. However, it gives me a 404 page not found error. I believe it has something to do with the **rt_siteconfig.pm** file. The file's contents are as below.               # Any configuration directives you include  here will override     # RT's default configuration file, RT_Config.pm     #     # To include a directive here, just copy the equivalent statement     # from RT_Config.pm and change the value. We've included a single     # sample value below.     #     # This file is actually a perl module, so you can include valid     # perl code, as well.     #     # The converse is also true, if this file isn't valid perl, you're     # going to run into trouble. To check your SiteConfig file, use     # this comamnd:     #     #   perl -c /path/to/your/etc/RT_SiteConfig.pm          Set($rtname , 'test');          Set($Organization , "www.uta.edu");     Set($Timezone , 'US/Central');               Set($WebPath , "/rt");     Set($WebPort , 80);# + ($< * 7274) % 32766 + ($< && 1024));          Set($DatabaseUser , 'rtuser');     Set($DatabasePassword , 'rtuser');     Set($DatabaseName , 'rtdb');               1;      I believe the webPath parameter has to be modified. But am not sure what to edit in it. Can someone please guide me in the right direction? Update: There is a file as **rt.conf** which sets the RT script path as below in this file.               AddDefaultCharset UTF-8     Alias /rt/NoAuth/images /usr/local/rt/share/html/NoAuth/images/     ScriptAlias /rt /usr/local/rt/sbin/rt-server.fcgi/          DocumentRoot /usr/local/rt/share/html     <location /rt>            Order allow,deny            Allow from all            Options +ExecCGI            AddHandler fcgid-script fcgi     </Location>      When I just run `localhost` I am getting the test page successfully and it specifies the **welcome.conf** file needs to be disabled, in case I do not want the test page. The **welcome.conf** file is present in the same path as the above **rt.conf** file. The path is `/etc/httpd/conf.d/` **Update 2:** The **error_log** file inside `/var/log/httpd` has the below line.               [error] [client 127.0.0.1] File does not exist: /usr/local/rt/sbin/rt-server.fcgi/      However, I do have the file rt-server.fcgi inside the above path. **Update 3:** The rt.conf file which is a configuration file for starting the RT is as below.               AddDefaultCharset UTF-8     #Alias /rt/NoAuth/images /usr/local/rt/share/html/NoAuth/images/     ScriptAlias /rt /usr/local/rt/sbin/rt-server.fcgi/          DocumentRoot "/usr/local/rt/share/html"     <Location /rt>            Order allow,deny            Allow from all            Options +ExecCGI            AddHandler fcgid-script fcgi     </Location>


How to uninstall omniORB 4.1.7 after installing from make?

I'd like to uninstall a copy of omniORB which I installed by running               make install      Any tips on how to do this operation? I tried               make uninstall      but the project does not have such a target. I googled for an answer and searched through the omniORB user's mailing list. The closest search results are               [omniORB] make clean     http://www.omniorb-support.com/pipermail/omniorb-list/2001-July/018714.html      in which David Byron (dbyron at coactive.com) in 2001 asked if anyone would be interested in a 'make uninstall' target.               [omniORB] omniORBpy-2.7 AttributeError     http://www.omniorb-support.com/pipermail/omniorb-list/2006-November/028191.html      in which the omniORB project maintainer Duncan Grisby (duncan at grisby.org) in 2006 had this interaction               > Would it be a good idea to add an 'uninstall' option to the Makefile?     Yes, but the makefiles are hairy and complex, and it's not trivial to     add an uninstall. If you want to produce a patch, I'll happily accept     it.


GNU Stow: How to stow only selected files/folders?

Let's assume the following structure of a folder called `scripts`.               ├── scripts     │   └── .scripts     │       ├── script1     │       ├── script2     │       └── script3     │   └── .config     │       ├── script4     │       ├── script5     │       └── script6      When using `stow scripts`, both folders within `scripts` will be symlinked to `~/.scripts` and `~/.config`. Can I use stow to only symlink `.scripts` without having to remove `.config` from the folder but just basically ignoring it?


rsync on a very large directory

I'm trying to rsync a partial clone of mavencentral using rsync. The problem is, due to ridiculous network policies, I can only have the copy running during business hours. The process will be cut off before it has a chance to finish. When I run the same rsync command again, it will start from the top, looking for diff'd files, and never get to the end and actually start transferring files.               rsync -avP -e ssh user@server:/directory/for/maven .      It will start going through the tree no problem, but not transfer any files past the first attempt. It's just very slow to catch up to where it was. Any suggestions for resuming an rsync after it has closed?


How to create a "Turn Off Screen" Action?

I recently moved to Elementary OS Luna. I especially use the Synapse Indicator launcher, because I like to work with my keyboard for everything. In Synapse and in the Synapse Indicator (and I believe, generally, in the Gnome dekstop and I'll dare saying in all Linux DEs) there are "actions". Among actions there is _Shut Down_ , _Restart_ , _Lock Screen_ etc. which can be run with Synapse and probably too from the command line. I would like to create an action for _Turn Off Screen_ (which is different from _Lock Screen_ ). How can I create this action and be able to launch it from Synapse?


How can I find out what options sudo is configured with?

Often when debugging issues with `sudo` I'll look at the options in the configuration file `/etc/sudoers`. However it can be difficult to know what options are enabled by default, since they're built into the executable, so they're typically absent from `sudo`'s config. How can I get a exhaustive list of all the options that `sudo` is going to use on a given system?


NAS OS that will sync to MS Sharepoint?

Right now I'm using FreeNAS for my NAS, but I want it to sync with Microsoft Sharepoint so that there are multiple points of access for my users. Is there an operating system I can put on my NAS that will sync nicely this way?


Which filter configuration in kernel rate limit the outgoing packets to 1packet/sec?

Which net filter in kernel configuration other than iptables enable rate limiting on the outgoing packets on ethernet port?


Fedora "disk full", df, du (gui) confirm but gparted shows the partition is big enough

I am running a fedora Virtual machine and after much pain I managed to extend my virtual machines .vdi, from 20gb to 40gb. However it appears my pain is not over. The machine still complains of low disk space, still has many errors and the gui disk usage analyzer shows I am full and so does df. However gparted tells me I have 40gb on that partition. is it Virtual box weirdness? do i need to kick fedora in some way to refresh its known capacity? Please find attached a screen grab of all the relevant applications, let me know if you need more info. Thank you ![Sceengrab of info](http://i.stack.imgur.com/rMv7g.png)


Studio 12.3: language optional software package not installed

I installed the Solaris Studio 12.3 on Solaris 10 OS but when I check the version but it is showing below result. It is installed under `/opt/SolarisStudio12.3/bin` so why wrong path is coming. I defined the path in `.profile` after that I can see now the correct path when I check `$PATH` `/opt/SolarisStudio12.3/bin` but still it is showing same path for which `cc` and `cc -V` as below. Can anyone please tell me?               which cc     /usr/ucb/cc          cc -V     /usr/ucb/cc: language optional software package not installed


Using kornshell or Perl to circumvent permissions needed by root

I have a problem where I need to change the ownership and permissions of one file that exists on more than 200 servers. I belong to 2 different groups and need to change the ownership from one group to another. I also need the permissions to be 644. This could be easily done if I had root access, but I don't. So instead I need to copy the file as one user and then remove the old file and then rename the recently copied file to the name of the old file. This becomes rather tedious, so I wanted to create a script to automate these tasks. I thought kornshell would do the trick but my script doesn't seem to be doing anything. Here is what I have so far: **lockhosts.sh**               #!/usr/bin/ksh     sudo su - oradba     cd config     chmod 644 hostenv.cfg     chown orainst hostenv.cfg     exit     sudo su - orainst     cd config     cp -p hostenv.cfg hostenv.cfgnew     rm hostenv.cfg     mv hostenv.cfgnew hostenv.cfg      I figured this would work because those are all the commands I need to run to successfully change the ownership/permissions of the file. All I need to do is change the hostenv.cfg file **from this** :               -rwxrw---- 1 oradba  dba  4433 May  1 21:43 hostenv.cfg      **To this** :               -rw-r--r-- 1 orainst dba  4433 May  1 21:43 hostenv.cfg      What can I do to fix my script? Also, if I need to build user prompts into my script to ask for passwords that is fine, but I thought the system would ask for me. Here is what happens when I try to run my script:               lockhost.sh      **My user is changed to oradba and nothing else happens...** Until I type exit...               exit          logout     chmod: changing permissions of `hostenv.cfg': Operation not permitted     chown: changing ownership of `hostenv.cfg': Operation not permitted


How do I create a RAM disk on Linux Mint?

I am running a package that adds data to the end of 140–300 files each time through the process. I'm thinking of moving the process to a RAM disk, and using `rsync` to copy it back when done. My goal is to reduce wear by eliminating disk head seeks. Will this work? If so, how do I go about creating the RAM disk?


avconv: converting raw mjpeg video to a viewable format

I'm using a Beaglebone Black (BBB) with a USB Webcam attached to it. The BBB is running the latest Angstrom release. At the moment, it is proving difficult for me to convert video that I capture to some playable video format (like mp4). My raw video is "output.raw", my command is:               avconv -f mjpeg -i output.raw -vcodec copy output.mp4      However I get an error:               output.raw: could not find codec parameters      I've tried other approaches, like using a raw YUV stream to convert but it fails on me as well.


Poweroff or Reboot as normal User

To run the command `poweroff` or `reboot` one needs to be super user. Is there anyway I can run this as a normal user? I just don't want to `sudo` and enter my password every time I reboot or power off.


Having Wirless adapter problems in BackTrack 5 R3

I am trying to get a wireless connection on BackTrack 5 R3, but as soon as I boot up the BackTrack VM, the light on the adapter turns off. Drivers are installed and the VM detects the USB device. I am using an Asus N-13 wireless adapter to connect. It works fine on Ubuntu 12.10 (my host), and Windows 7. However, when I boot the BackTrack VM the adapter light goes off. Here is proof of drivers and USB detection. lsusb               Bus 002 Device 002: ID 80ee:0021 VirtualBox USB Tablet     Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 001 Device 002: ID 0b05:17ab ASUSTek Computer, Inc.      Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root h      ifconfig               eth0      Link encap:Ethernet  HWaddr 08:00:27:9c:d5:dc                 inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0               inet6 addr: fe80::a00:27ff:fe9c:d5dc/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:758 errors:0 dropped:0 overruns:0 frame:0               TX packets:609 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:381917 (381.9 KB)  TX bytes:159317 (159.3 KB)               Interrupt:10 Base address:0xd020           lo        Link encap:Local Loopback                 inet addr:127.0.0.1  Mask:255.0.0.0               inet6 addr: ::1/128 Scope:Host               UP LOOPBACK RUNNING  MTU:16436  Metric:1               RX packets:853 errors:0 dropped:0 overruns:0 frame:0               TX packets:853 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:299027 (299.0 KB)  TX bytes:299027 (299.0 KB)          wlan0     Link encap:Ethernet  HWaddr 08:60:6e:cd:f8:2c                 UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:0 errors:0 dropped:0 overruns:0 frame:0               TX packets:0 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)      lsmod               Module                  Size  Used by     nls_utf8               12493  1      isofs                  39187  1      vboxvideo              12511  1      drm                   183453  2 vboxvideo     vboxsf                 38096  0      dm_crypt               22236  0      snd_intel8x0           33017  0      8192cu                503302  0      snd_ac97_codec        104623  1 snd_intel8x0     ac97_bus               12602  1 snd_ac97_codec     snd_pcm                72878  2 snd_intel8x0,snd_ac97_codec     snd_seq_midi           13132  0      i2c_piix4              12983  0      snd_rawmidi            24215  1 snd_seq_midi     snd_seq_midi_event     14076  1 snd_seq_midi     snd_seq                50403  2 snd_seq_midi,snd_seq_midi_event     snd_timer              23911  2 snd_pcm,snd_seq     snd_seq_device         13817  3 snd_seq_midi,snd_rawmidi,snd_seq     ppdev                  12840  0      snd                    52787  7 snd_intel8x0,snd_ac97_codec,snd_pcm,snd_rawmidi,snd_seq,snd_timer,snd_seq_device     psmouse                72465  0      serio_raw              13027  0      joydev                 17161  0      lp                     13321  0      parport_pc             31867  0      soundcore              12534  1 snd     snd_page_alloc         13709  2 snd_intel8x0,snd_pcm     vboxguest             190596  5 vboxsf     mac_hid                13037  0      parport                34960  3 ppdev,lp,parport_pc     dm_mirror              21585  0      dm_region_hash         15035  1 dm_mirror     dm_log                 17871  2 dm_mirror,dm_region_hash     aufs                  162169  0      usbhid                 41119  0      hid                    79842  1 usbhid     pcnet32                40553  0       iwconfig               lo        no wireless extensions.          wlan0     unassociated  Nickname:"<WIFI@REALTEK>"               Mode:Auto  Frequency=2.412 GHz  Access Point: Not-Associated                  Sensitivity:0/0                 Retry:off   RTS thr:off   Fragment thr:off               Encryption key:off               Power Management:off               Link Quality:0  Signal level:0  Noise level:0               Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0               Tx excessive retries:0  Invalid misc:0   Missed beacon:0          eth0      no wireless extensions.


extracting "tag" information from git with a shell script

The vc bundle is a neat little package that extracts information about a git repo for easy insertion into a LaTeX document. It doesn't currently extract information about whether the current commit is tagged and what the tag name is. How would I edit the `vc` script to do this? And then how would I edit the `vc-git.awk` script to add an extra line to the generated vc.tex file? Presumably I want a line that looks like:               print "\\gdef\\GITTag{" Tag "}%"      but I need an earlier line that tells awk what `" Tag "` means? This isn't a question about LaTeX, it is about git, awk and bash...


How to change file permissions for newly generated files in largefiles directory of Mercurial?

I got some Mercurial repositories which are served by Apache over HTTP. But there is a dedicated user performing some automated tests, which needs to check out the repositories locally. Recently this started to fail, seemingly due to lacking rights for files in the largefiles subdirectory in `.hg`:               -rw------- 2 www-data www-data 6.3M 2012-01-02 17:23 9358b828fb64feb37d3599a8735320687fa8a3b2      Default umask should be 022. And I used the setgid settings for the directories in `.hg` according to the multiple committers wiki page, which does not cover `.hg/largefiles` though. However, as far as I understand it, setting the gid for this directory wouldn't solve the problem, that `hg` sets such restrictive rights on those files. My other user trying to access this repositories via the filesystem is also in the `www-data` group, thus an additional read right for group would be sufficient to solve my problem. How can I convince Mercurial, or the system to grant this right properly for new files? I am using: Mercurial Distributed SCM (version 2.1)


Unicode characters in uxterm and dwm statusbar

I would like to display Chinese characters in dwm's status bar. More specifically I would like the symbols to represent the different tags in dwm. Using an online converter, I found that the unicode representation for the symbols I want is:               憤怒     unicode: 憤怒      Putting the unicode characters directly into my `config.h` doesn't work, they don't even show up in `vim`. My locale is set to `ISO-8859-1` and I'm using the Liberation Mono font for dwm. What can I do to get those symbols up there? **EDIT** Following Mat's instructions and patching dwm, the patch command hangs. Running `strace`:               [max@prometheus dwm-6.0]$ strace patch -Np1 ../dwm-pango/dwm-pango/dwm-6.0-pango.patch      execve("/usr/bin/patch", ["patch", "-Np1", "../dwm-pango/dwm-pango/dwm-6.0-p"...], [/* 30 vars */]) = 0     brk(0)                                  = 0x1d52000     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9dc4713000     access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)     open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3     fstat(3, {st_mode=S_IFREG|0644, st_size=92801, ...}) = 0     mmap(NULL, 92801, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f9dc46fc000     close(3)                                = 0     open("/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3     read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`\25\2\0\0\0\0\0"..., 832) = 832     fstat(3, {st_mode=S_IFREG|0755, st_size=1983446, ...}) = 0     mmap(NULL, 3804112, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f9dc4152000     mprotect(0x7f9dc42e9000, 2097152, PROT_NONE) = 0     mmap(0x7f9dc44e9000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x197000) = 0x7f9dc44e9000     mmap(0x7f9dc44ef000, 15312, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f9dc44ef000     close(3)                                = 0     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9dc46fb000     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9dc46fa000     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9dc46f9000     arch_prctl(ARCH_SET_FS, 0x7f9dc46fa700) = 0     mprotect(0x7f9dc44e9000, 16384, PROT_READ) = 0     mprotect(0x61a000, 4096, PROT_READ)     = 0     mprotect(0x7f9dc4714000, 4096, PROT_READ) = 0     munmap(0x7f9dc46fc000, 92801)           = 0     brk(0)                                  = 0x1d52000     brk(0x1d75000)                          = 0x1d75000     getpid()                                = 10412     lstat("/tmp/po8GP02f", 0x7fffdc075210)  = -1 ENOENT (No such file or directory)     lstat("/tmp/pikSWXEs", 0x7fffdc075210)  = -1 ENOENT (No such file or directory)     lstat("/tmp/prB1wVgF", 0x7fffdc075210)  = -1 ENOENT (No such file or directory)     lstat("/tmp/pp27ATSR", 0x7fffdc075210)  = -1 ENOENT (No such file or directory)     rt_sigaction(SIGCHLD, {SIG_DFL, [CHLD], SA_RESTORER|SA_RESTART, 0x7f9dc4186cb0}, {SIG_DFL, [], 0}, 8) = 0     rt_sigaction(SIGHUP, NULL, {SIG_DFL, [], 0}, 8) = 0     rt_sigaction(SIGHUP, {0x40cd90, [], SA_RESTORER, 0x7f9dc4186cb0}, NULL, 8) = 0     rt_sigaction(SIGPIPE, NULL, {SIG_DFL, [], 0}, 8) = 0     rt_sigaction(SIGPIPE, {0x40cd90, [], SA_RESTORER, 0x7f9dc4186cb0}, NULL, 8) = 0     rt_sigaction(SIGTERM, NULL, {SIG_DFL, [], 0}, 8) = 0     rt_sigaction(SIGTERM, {0x40cd90, [], SA_RESTORER, 0x7f9dc4186cb0}, NULL, 8) = 0     rt_sigaction(SIGXCPU, NULL, {SIG_DFL, [], 0}, 8) = 0     rt_sigaction(SIGXCPU, {0x40cd90, [], SA_RESTORER, 0x7f9dc4186cb0}, NULL, 8) = 0     rt_sigaction(SIGXFSZ, NULL, {SIG_DFL, [], 0}, 8) = 0     rt_sigaction(SIGXFSZ, {0x40cd90, [], SA_RESTORER, 0x7f9dc4186cb0}, NULL, 8) = 0     rt_sigaction(SIGINT, NULL, {SIG_DFL, [], 0}, 8) = 0     rt_sigaction(SIGINT, {0x40cd90, [], SA_RESTORER, 0x7f9dc4186cb0}, NULL, 8) = 0     fstat(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0     open("/tmp/pp27ATSR", O_RDWR|O_CREAT|O_EXCL|O_TRUNC, 0600) = 3     fcntl(3, F_GETFL)                       = 0x8002 (flags O_RDWR|O_LARGEFILE)     fstat(3, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9dc4712000     lseek(3, 0, SEEK_CUR)                   = 0     fstat(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9dc4711000     read(0,       Could I be missing something?


Software RAID 1 with dissimilar size and performance drives

_Background_ I was experimenting with a home server setup in a small box I had that was supposed to be a media centre but never found much use. I installed CentOS 6.5 in a software RAID1 configuration accross two similarly specced laptop hard drives I had salvaged from an old device. Both are 320GB and both run at 7200rpm with the same sized cache. The install went ahead perfectly and I was happy with everything however now one of the drives is reporting S.M.A.R.T errors. The only spare drive I have is a 5400rpm 1TB laptop drive. I dont need to rebuild the array and I will happily reinstall from scratch as the system hasnt been put to use yet but I dont wish to purchase a relatively expensive replacement 7200rpm 320GB drive. _Question_ Is there anything inherently wrong/dangerous/unreliable about setting up software RAID 1 across the non-faulty 320GB drive and a 320GB partition of the 1TB drive then using the remainder of the 1TB drive as an additional non- redundant storage partition, bearing in mind the different sizes and spindle speeds? Will the partioner let me do this? Note: I have browsed https://raid.wiki.kernel.org/index.php and it constantly refers to devices "of roughly the same size."


Check if a drive has been Zeroed with xxd and uniq?

I'm looking for a way to check if the entire binary contents of a USB device are purely 0s. I'm trying this command: `sudo xxd /dev/sdb | uniq` but it has no output and just runs forever. I've considered the Sort command, but my understanding is that it requires a file to read rather than just the standard terminal output. update: I realised I could check with `sudo xxd -a /dev/sdb`, but my question still stands: is there a way to uniquely sort output of the terminal without saving it to a file first?


Hamachi for Web Surfing

I recently installed Hamachi on my FreeBSD 9 and I want to know how can I browse web anonymously by this software?


Text file look-up by column

I have a file in this format:               [#]   OWNER_NAME     NAME                       SIZE     [6]   Robottinosino  Software                   200     [42]  Robottinosino  Ideas worth zero           188     [12]  Robottinosino  Ideas worth zero or more   111     [13]  I am Batman    Hardware                   180     [25]  Robottinosino  Profile Pictures           170      and I would like to be able to do the following using command line tools:               my_command "Ideas worth zero"      and get this result:               42      and not risk getting this result:               12      I have thought of using grep to identify the line, awk to get the 1st field but I am not sure how to reliably and efficiently match on the whole 'NAME' field short of counting at which column the text 'OWNER_NAME' and 'SIZE' appear in the header and get everything in-between with some whitespace trimming. Notice 'OWNER_NAME' could be more than one word: e.g. 'OWNER_NAME' = "I am Batman". Any ideas with accompanying implementation? What I have to go by here, is just the old family of cat, head, tail, awk, sed, grep, cut, etc.


Find the total size of certain files within a directory branch

Assume there's an image storage directory, say, `./photos/john_doe`, within which there are multiple subdirectories, where many certain files reside (say, `*.jpg`). How can I calculate a summary size of those files below the `john_doe` branch? I tried `du -hs ./photos/john_doe/*/*.jpg`, but this shows individual files only. Also, this tracks only the first nest level of the `john_doe` directory, like `john_doe/june/`, but skips `john_doe/june/outrageous/`. So, how could I traverse the entire branch, summing up the size of the certain files?


**The developer says:http://comments.gmane.org/gmane.linux.real- time.rtnet.user/2546** > > > Now how can I tell the Makefile to look for headers in > /usr/local/rtnet/include respectively how could I set my CFLAGS? > > EXTRA_CFLAGS := -I ... > >> Sorry for that not really RTnet dependent question, but I couldn't find a Makefile-howto covering this question. > > Maybe this helps, though it a bit more complicated due to serving 2.4 and > 2.6 kernels: **So, I took the makefile from here:http://svn.gna.org/viewcvs/xenomai/trunk/examples/rtdm/driver-api/ and added `-I /usr/local/rtnet/include` corresponding to **EXTRA_CFLAGS****               ###### CONFIGURATION ######     ### List of applications to be build     APPLICATIONS = hello          ### Note: to override the search path for the xeno-config script, use "make XENO=..."               ### List of modules to be build     MODULES = hello          ### Note: to override the kernel source path, use "make KSRC=..."                    ###### USER SPACE BUILD (no change required normally) ######     ifeq ($(KERNELRELEASE),)     ifneq ($(APPLICATIONS),)          ### Default Xenomai installation path     XENO ?= /usr/xenomai          XENOCONFIG=$(shell PATH=$(XENO):$(XENO)/bin:$(PATH) which xeno-config 2>/dev/null)          ### Sanity check     ifeq ($(XENOCONFIG),)     all::     @echo ">>> Invoke make like this: \"make XENO=/path/to/xeno-config\" <<<"     @echo     endif               CC=$(shell $(XENOCONFIG) --cc)          CFLAGS=$(shell $(XENOCONFIG) --skin=native --cflags) $(MY_CFLAGS)          LDFLAGS=$(shell $(XENOCONFIG) --xeno-ldflags) $(MY_LDFLAGS) -lnative -lrtdm          # This includes the library path of given Xenomai into the binary to make live     # easier for beginners if Xenomai's libs are not in any default search path.     LDFLAGS+=-Xlinker -rpath -Xlinker $(shell $(XENOCONFIG) --libdir)          all:: $(APPLICATIONS)          clean::         $(RM) $(APPLICATIONS) *.o          endif     endif                    ###### KERNEL MODULE BUILD (no change required normally) ######     ifneq ($(MODULES),)          ### Default to sources of currently running kernel     KSRC ?= /lib/modules/$(shell uname -r)/build          OBJS := ${patsubst %, %.o, $(MODULES)}     CLEANMOD := ${patsubst %, .%*, $(MODULES)}     PWD := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)          ### Kernel 2.6     ifeq ($(findstring 2.6,$(KSRC)),2.6)          obj-m := $(OBJS)     EXTRA_CFLAGS := -I$(KSRC)/include/xenomai -I$(KSRC)/include/xenomai/posix $(ADD_CFLAGS) \     -I /usr/local/rtnet/include           all::         $(MAKE) -C $(KSRC) SUBDIRS=$(PWD) modules          ### Kernel 2.4     else          ARCH ?= $(shell uname -i)     INCLUDE := -I$(KSRC)/include/xenomai -I$(KSRC)/include/xenomai/compat -I$(KSRC)/include/xenomai/posix     CFLAGS += $(shell $(MAKE) -s -C $(KSRC) CC=$(CC) ARCH=$(ARCH) SUBDIRS=$(PWD) modules) $(INCLUDE)          all:: $(OBJS)          endif          ## Target for capturing 2.4 module CFLAGS     modules:         @echo "$(CFLAGS)"          clean::         $(RM) $(CLEANMOD) *.o *.ko *.mod.c Module*.symvers Module.markers modules.order         $(RM) -R .tmp*          endif      **Now, when I do make, I get the error:`error: implicit declaration of function ‘rt_dev_socket’` for the following `hello.c`.**               #include <stdio.h>     #include <signal.h>     #include <unistd.h>     #include <sys/mman.h>          #include <native/task.h>     #include <native/timer.h>          #include  <rtdk.h>          RT_TASK demo_task;          void demo(void *arg)     {       RT_TASK *curtask;       RT_TASK_INFO curtaskinfo;            printf("Hello World!\n");            curtask=rt_task_self();       rt_task_inquire(curtask,&curtaskinfo);            printf("Task name : %s \n", curtaskinfo.name);            ********int sockfd = rt_dev_socket(AF_INET, SOCK_DGRAM, 0);********     }          int main(int argc, char* argv[])     {       char  str[10] ;            rt_print_auto_init(1);            mlockall(MCL_CURRENT|MCL_FUTURE);            printf("start task\n");            sprintf(str,"hello");            rt_task_create(&demo_task, str, 0, 50, 0);            rt_task_start(&demo_task, &demo, 0);          }


mount options shown in /proc/mounts

IIRC then the mount options shown in `/proc/mounts` have changed. Some time ago `acl` and `user_xattr` were shown, now it seems that only `noacl` and `nouser_xattr` are shown if these features are turned off. Where is this configured? Does that depend on the compiled-in defaults of the filesystem code? How can I check whether a volume supports e.g. ACL? Is there a better solution than testing with `setfacl`, `getfacl`?


Creating a private network for internal VMs

I am trying to configure a private network for use with my Xen VMs, in addition to the public network in use by another of the VMs (VM1, which has its own public IP). So far, I have the public side working perfectly with a bridged network... On the host machine:               eth0: 91.x.x.1, gateway: 91.x.x.254     xenbr0: bridged with eth0     VM1 connected to xenbr0, with a new IP address, 91.x.x.2, and gateway 91.x.x.254      On the host machine, I've also created a private dummy ethernet port:               dummy0: 192.168.1.1      and a bridge via XenServer, pdummy0 (using these instructions http://tipstricks.itmatrix.eu/?p=681) Everything's working there, as well - the two VMs connected to the bridge can ping each other, as well as the host machine via the private 192.168.1.1 IP.               VM2: 192.168.1.2     VM3: 192.168.1.3      The last step here, is to have each of those VMs (VM2 & VM3) to be able to see the internet... What routes / IP forwarding do I need to set up to make that happen? Sample route from VM2, /sbin/route:               Kernel IP routing table     Destination     Gateway         Genmask         Flags Metric Ref    Use Iface     192.168.1.0   *               255.255.255.0   U     0      0        0 eth0


How to get vodafone mobile connect (or equivalent) working reliably on debian squeeze

I got a Vodafone K3760 at some point in Debian/Lenny's lifetime, for use with a Lenovo S10e. I installed (from the Vodafone BetaVine site) usb-modeswitch 0.97 and vodafone-mobile-connect (VMC) 2.10.01-1 (or maybe it was actually vodafone-mobile-connect_svn20090615) and it all worked pretty well. After the squeeze update I have had less luck. Unlike lenny, squeeze includes usb_modeswitch 1.1.4-2, and I also grabbed vodafone-mobile-connect 2.25.01. It does actually work... for a few minutes, then the system locks up (or sometimes the gnome panel dies, but xterms on-screen continue to work). Anyone know what magic combinations of packages, if any, will work reliably with Squeeze ? (The obvious next thing for me to try is to revert the relevant packages to their older versions; VMC does have quite a lot of dependencies though so I'm not too sure how well this will work). There's another school of thought which says forget about vodafone's app and just use the new Gnome network manager's mobile broadband support. I haven't tried this yet, but I kind of like the vodafone app (for it's usage monitoring, and for it's access to SMS messages on the K3760; these are pretty important if you travel abroad and want to see what outrageous charges you'll be stung for if you dare connect). But if Gnome or other apps provide such functionality, I'd happily drop the Vodafone software. Thanks for any advice Just to be clear: the system is rock solid when using wired or built-in wifi connection. Inserting the dongle seems to be pretty safe; the problems start once connected. **Update 1:** I couldn't revert to the older vodafone mobile connect because of various python dependencies not in squeeze. Reverting to the older usb_modeswitch seems to be possible, but at least this once I got a spew of kernel bug notifications (alas, these don't seem to submit anything useful: example) and got about 30mins uptime before a lockup. I'm not too sure what to make of dmesg (have got some saved); there are clearly some call stacks into serio_interrupt in i8042_interrupt in ...a pile of handle IRQ functions ... but there are other ones too. **Update 2:** I managed to get a dmesg log of some kernel errors from the "all-squeeze" version (not using any modules from the older setup) before lockup. This can be found here; no idea how to interpret it myself.


What are the advantages of the Unix file system structure

If I install an application in Linux for example Debian/Gnu Linux, the files of the applications are copied to many different directories in the file system. Some scripts goes into _/usr/share_ .. _/usr/local_ some other files into _/var_ .. _/log_ .. _etc/_ and so on. For me this is o.k because I learned something about the file system and most of the directories are there to hold files for a specific purpose. This fits very nice in the Unix philosophy "do one thing and do it well" But my question is **what are the advantages of such a directory structure?** Or is it simply the heritage of the old unix days. (e.g in comparison with the one windows use, where all files for an application are in one specific "folder")


How to find the best monitor resolution and put it to work? Fedora

In this question I'm asking how to install a compatible driver to a Fedora machine, but, the main problem is a bad resolution. So, how can I find the best resolution to my monitor and put it to work? Please answer me with a complete solution or a successfully tutorial. Some system info is:               $ lspci | grep VGA     00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)          $ cat /etc/issue     Fedora release 17 (Beefy Miracle)     Kernel \r on an \m (\l)          $xandr      xrandr: Failed to get size of gamma for output default Screen 0: minimum 640 x 480, current 1280 x 1024, maximum 1280 x 1024 default connected 1280x1024+0+0 0mm x 0mm 1280x1024 76.0* 1024x768 76.0 800x600 73.0 640x480 73.0      **Edit** Looks like the main problema now is this output: **xrandr: Failed to get size of gamma for output default** Everything I try stops at this problem with the gamma. How can I solve this?


Shell: Break both if and for loop at once. My script: ip to name resolve code               IP=192.168.27.191     hostNameChecker()     {         if [ `getent hosts $1 | wc -l` -ne 0 ];then             HOST_NAME=`hostname`             DNS_IP=`getent hosts $1 | cut -d " " -f 1 | sed 's/^[ \t]*//;s/[ \t]*$//'`             DNS_NAMES=`getent hosts $1 | cut -d " " -f 2- | sed 's/^[ \t]*//;s/[ \t]*$//'`             for DNS_NAME in ${DNS_NAMES[@]}              do                 if [[ "$DNS_NAME" == "$HOST_NAME" ]];then                         echo "Host name:$HOST_NAME and DNS_NAME:$DNS_NAME matched"                         break 2;########Not working. only brakes inner for not outer if                      else                         continue;                     fi             done                 echo "ERROR: Mismatch between DNS:$DNS_NAMES and Hostname:$HOST_NAME"                 exit 0           fi     }     hostNameChecker $IP      In the above script **break 2** only breaks inner for not outer if. I can add another if to solve it but is there any other possible way ???


Is `UDIF read/write image` bootable on non-Apple hardware?

Some guides on the internet suggest that it is possible to convert ISO disc image files (`.iso`) into an non-.iso image format (`.img` or `.dmg`) with `hdiutil` on OS X. However, the manual page for `hdiutil` says that it basically only supports conversion into several `UDIF` formats. Are images in the `UDIF` format bootable on non-Apple hardware? Wikipedia claims that UDIF, Universal Disc Image Format, is an Apple proprietary format, giving you the impression that it's not compatible with third-party hardware.


google chrome tray icon broken in gnome 3.6

![enter image description here](http://i.stack.imgur.com/GRmw5.jpg) Google Chrome starts up with the correct tray icon but when restarted it has the broken tray icon. Has anyone filed a bug report about this? And is there any workaround at present?


How to sed two same value without affecting the other

I have an xml file and I want to change one value on that file:               param name=swam_license_ports_overdraft_thresh          99          param name="strike_license_ports_overdraft_thresh"          99      The outcome I want is to sed the value 99 to 90 under param name=swam_license_ports_overdraft_thresh and the other value 99 under param name="strike_license_ports_overdraft_thresh" should not be changed.


How to see process created by specific user in Unix/linux

I want to see list of process created by specific user or group of user in Linux Can I do it using `ps` command or is there any other command to achieve this?


Git pull in a linux environment changes the owner of the files

I am not sure if this is the proper forum to ask the question, but here it goes: Why will everytime I execute a `git pull` on my live server, the owner of the files be changed? I keep on manually doing a `chown john:john index.php`. What do I need to change so that, when I do a `git pull`, the owner of the files will be automatically be or stay `john`.


Why does the 'bin' user need a login shell?

During an audit of `/var/log/auth.log` on one of my public webservers, I found this:               Jan 10 03:38:11 Bucksnort sshd[3571]: pam_unix(sshd:auth): authentication failure;          logname= uid=0 euid=0 tty=ssh ruser= rhost=61.19.255.53  user=bin     Jan 10 03:38:13 Bucksnort sshd[3571]: Failed password for bin from 61.19.255.53          port 50647 ssh2      At first blush, this looks like typical `ssh` login spam from random hackers; however, as I looked closer I noticed something else. Most failed `/var/log/auth.log` entries say `invalid user` in them, like this one:               Jan  9 10:45:23 Bucksnort sshd[3006]: Failed password for invalid user sales          from 123.212.43.5 port 10552 ssh2      The disquieting thing about that failed login message for `bin` is that it is a _valid user_ in `/etc/passwd` that even has a login shell:               [mpenning@Bucksnort ~]$ grep ^bin /etc/passwd     bin:x:2:2:bin:/bin:/bin/sh      I thought I had covered the all the default usernames that could login remotely when I disabled `PermitRootLogin` in `/etc/ssh/sshd_config`; discovering this entry opened new possibilities in my paranoid mind. If somehow services ran under `bin`, then it is remotely possible that someone could somehow insert an ssh key into the `bin` user's directory from a running service on the box, so I would like to completely disable login for the `bin` user, if possible. ## Questions   * This server is remote, and expensive to fix (i.e. I will pay for remote hands to hook up a KVM, plus KVM rental). I am trying to figure out what I might break if I change the `/etc/passwd` entry for `bin` to look like this: `bin:x:2:2:bin:/bin:/bin/false`   * I ran the following commands trying to figure out what `bin` is needed for... However, these commands came up with no files and I could find no processes owned by `bin`. What does the `bin` user do anyway? `$ sudo find / -group bin` `$ sudo find / -user bin`   * Are there any other users that should get their login shells set to `/bin/false`? FYI, I have already have `/bin/false` on `www-data`.   * Am I being too paranoid? I am running Debian, if that matters.


CentOS test page and .htaccess

When I use the line below in the `.htaccess` file, I get the apache CentOS test page.               RewriteCond %{REQUEST_FILENAME} !-d      How can I fix this?


Mysql log confusion

I have installed a standard installation of mysql on Debian Wheezy and I am confused as to where the logs are supposed to be logged. In my `/var/log/` directory, there are files `mysql.log` which are empty. All logging goes to `daemon.log` and `syslog`. To add to the confusion, `show variables like '%log%';` shows other logs still (My datadir is `/srv/mysql`) :               | general_log                             | OFF                               |     | general_log_file                        | /srv/mysql/mysql-systems.log      |     | slow_query_log                          | OFF                               |     | slow_query_log_file                     | /srv/mysql/mysql-systems-slow.log |      I like to keep my logs clean and organized. What would be the best way to log mysql. Should I change it on the `mysql` level, or in `rsyslog`. BTW, is there any standard for logs similar to FHS ?


Is it possible to add more modifiers?

I'm using minimalistic WM controlled by a keyboard..   The main question is, is it possible? How?   For example, `Mod6`. I know how to remap existing modifiers, but not how to add a new ones. I'm using Arch Linux.


linux + cant run dialog utility + got errors

Problem is as follows: Linux kernel: 3.0.13-0.27-default #1 SMP I’ve installed “dialog” utility ( /usr/bin/dialog ) just copied bin file to /usr/bin When I have tried to run it, error message regarding missing libncursesw.so.5 lib appeared. to solve the problem I try to copied the file libncursesw.so.5 to /usr/lib/ but not help • Now, I got another error:                    “error while loading shared libraries: /usr/lib/libncursesw.so.5: file too short”…      Please advise


Can i update my commands( like awk,sed) to the latest release in solaris?

bash-3.00# awk '{print NR}' f1.txt      1      2      3      4      but FNR does not print anything.               awk '{print FNR}' f1.txt      the above line does not gives me any output,seems that the awk that i am having in my sun os does not have FNR variable. so can i do something about it to standardize it. also, can i get a library of all latest commands and install/update my current commands like sed,sort etc. **SunOS unknown 5.10 Generic_142910-17 i86pc i386 i86pc**


Tmux viewport caused by multiple concurrent sessions

When attaching to the same tmux sessions from multiple computers using ssh and `tmux attach`, my screen looks like:               -------------------------     $>              |........                     |........                     |........                     |........                     |........     -----------------........     .........................     .........................      I was wondering if there is a command to get rid of the viewport


Free way to get financial data as Bloomberg terminal

I was wondering if there are some free ways (applications or programming) to get financial data (either live data, historical data or both), achieving similar function as Bloomberg terminal? Thanks and regards!


Restoring a big partition to a smaller partition with Clonezilla

Some time ago I created a backup of an EXT4 partition with Clonezilla. Now the HDD crashed and I lost some important data. The size of the image of the partition is 50GB. I tried to restore this image to a 200GB HDD but it turned out that the size of the original partition was 500GB. Since I don't have a 500GB HDD for dumping available I figured out how to force Clonezilla to ignore it by passing `-C` to partclone. But while recovering it stopped with the error `target seek ERROR:Invalid argument`. I could imagine that the data on the partition is fragmented so that the actual bitmap doesn't fit. Is there a workaround for this? I have a HDD with about 600GB available but I don't like touching the partition table or such. Ideally would be a way to restore it to a mountable image. (ISO or such)


When does a shell get executed during the linux startup process

I do not understand when does a shell, lets say bash, get executed, which program runs bash initially first.


Oracle 11g database startup automation on Fedora 15

I successfully installed Oracle 11g on a Fedora 15 system using this guide. Unfortunately, unlike when I'm using Windows, it seems I need to restart the database every single time I reboot my machine (it's a development machine, not a server). I'm not sure this is the intended behavior or if I messed up something while installing the database. Anyway, every single I reboot the machine I need to:   * Use `su` to change the current user to the `oracle` user.   * Use `sqplus` to startup the database. Like this:               (oracle@machine)$ sqplus / as sysdba     SQL> startup     SQL> (Ctrl+D)        * Then I need to start the listener using `lsnrctl`. Once more:               (oracle@machine)$ lsnrctl start         * And now the Enterprise Manager should also be started. At least:               (oracle@machine)$ emctl start dbconsole      I've taken those instructions from here. I'm sorry if this quite noobish, I usually have a DBA or a sysadmin to setup an environment for me but I'm doing this at home, where I have no help (maybe I'm becoming quite spoiled as a developer :)). I wonder if it's possible to automate this on Fedora 15 using a shell script. After automating, I'd like to hook this on the init system, so it's performed every time I start the machine.


Changing file name from dbf to ods problem?

I was trying to change the file name from gdf to csv in the folder using `$for i in *.dbf; do mv $i ${i%.dbf}.ods; done` script. The code changed all the gdf to csv, but the content of the new files is diffenet from the orginal gdf file. Here are the sample files below. The file has two columns. 1_CopyRow.dbf               time,N,19,11    prec,N,13,11     19710101.00000000000    0.02072840000     19710102.00000000000    0.42218300000     19710103.00000000000    0.17756100000     19710104.00000000000    0.33698200000     19710105.00000000000    0.11057700000     19710106.00000000000    0.02841580000     19710107.00000000000    0.00000000000     19710108.00000000000    0.00000000000     19710109.00000000000    0.00000000000      the result from above code is 1_CopyRow.ods   * rma!WtimeFprecF  1.97101010000e+007 2.07284e-002 1.97101020000e+007 4.22183e-001 1.97101030000e+007 1.77561e-001 1.97101040000e+007 3.36982e-001 1.97101050000e+007 1.10577e-001 1.97101060000e+007 I want the output be file be the same as the input. I couldn't figure out how to fix the problem. Any suggestions?


Fedora primary monitor selection

I have machine with Fedora Linux (Schroedinger's cat) 19 with AMD Radeon HD 6800 graphic card. Now, I have monitor plugged in using DVI port and I have TV connected using HDMI port. When machine is booting, the TV is automatically selected as primary screen, but I would like to have my Monitor (DVI port) selected as primary screen and TV (HMDI port) as secondary screen. How do I tell that to Fedora?


Installing Chrome on 64bit Gentoo without Superuser Access

For a bit of background, I am trying to install Chrome (or Chromium) on to a gentoo user account at my university. We are allowed to install software as we like, however we lack superuser access meaning I cannot just run `emerge google-chrome`. Attempting to unpack the 64-bit .rpm provided by google and run it out of my user directory provided me with this:               $ ./chrome/google/chrome/google-chrome     ./chrome/google/chrome/google-chrome: error while loading shared libraries: libcups.so.2: cannot open shared object file: No such file or directory      I don't have access to `rpm2cpio` (rendering the only other answer I could find less than helpful) but I do have access to `rpmunpack` and a whole host of `rpm2[insert archive type here]` commands.


Memory management principle used by Linux

Is memory management in the Linux Kernel done using paging or segmentation or both?


How to use `which` on an aliased command?

Like most users, I have a bunch of aliases set up to give a default set of flags for frequently used programs. For instance,               alias vim='vim -X'     alias grep='grep -E'     alias ls='ls -G'      The problem is that if I want to use `which` to see where my `vim`/`grep`/`ls`/etc is coming from, the alias gets in the way:               $ which vim     vim: aliased to vim -X      This is useful output, but not what I'm looking for in this case; I know `vim` is aliased to `vim -X` but I want to know where _that_ `vim` is coming from. Short of temporarily un-defining the alias just so I can use `which` on it, is there an easy way to have `which` 'unwrap' the alias and run itself on that? **Edit:** It seems that `which` is a shell-builtin with different behaviors across different shells. In Bash, SiegeX's suggestion of the `\--skip-alias` flag works; however, I'm on Zsh. Does something similar exist there?


Find where a bash command is defined or sourced from?

Sometimes I want to know what a command I type into `bash` actually evaluates to. Usually I can figure out the location of the executable very easily with `which`.               $ which vim     /usr/bin/vim      But what if I've created an alias for `vim`?               $ alias vim="echo mwahaha"     $ which vim     /usr/bin/vim      Hmm, not good. If I suspect something and want to check if `vim` has been aliased, I know I can type               alias vim      ... but if I had an `alias vim='vim -p'`, I would never actually think to check `vim` aliases because it would still work just fine. How can I know exactly what a specific command in `bash` is being evaluated to?


Print/Tee to console without passing output to pipe

Is there a way to print or tee one thing to the console and still pass something else through to the next pipe? Something like:               echo dog | printOrWhatnot "PUTTING MY THING DOWN" | sed 's/dog/cat/g' | printOrWhatnot "FLIP IT"|rev      that would result in:               PUTTING MY THING DOWN     FLIP IT     tac      **EDIT:** This should also work with multiline input:               printOrWhatNot() {...}          seq 10 30 |printOrWhatNot searching for 3s | grep 3      would output               searching for 3s     13     23     30      Lars' answer seemed to only pass along the first input (here it would be `10`) Also ideally the output would come inline during processing which wasn't what I was seeing with Glen's answer. So               seq 10 30 |tee /dev/tty |printOrWhatNot searching for 3s | grep 3      would make for:               10     11     12     13     14     15     16     17     18     19     20     21     22     23     24     25     26     27     28     29     30     searching for 3s     13     23     30


Does SELinux provide enough extra security to be worth the hassle of learning/setting it up?

I recently installed Fedora 14 on my home pc and have been working on setting up different server related features such as apache, mysql, ftp, vpn, ssh, etc. I ran extremely quickly in to a barrier it felt like when I discovered SELinux which I had not priorly heard of. After doing some research it seemed as though most people were of the opinion that you should just disable it and not deal with the hassle. Personally if it really does add more security I'm not opposed to dealing with the headaches of learning how to appropriately set it up. Eventually I plan on opening my network up so that this pc can be access remotely but I don't want to do that until such time as I'm confident that its secure (more or less... lol). If you have set it up and gotten it functioning correctly do you feel that it was worth the time and hassle? Is it really more secure? If you have opted out of using it was that decision founded on any research worth considering in my situation as well?


Create a series of increasingly larger files

I need to test an sftp host for its cutoff of file size upload limitation. I wanted to make a series of files that were of increasingly larger sizes, to try to upload them all and see where they failed. I was doing `for i in {10000..100000} ; do dd if=/dev/zero of=testfile$i bs=$i count=1 ; done ;` but that was taking too long, and the files I was getting were starting at 10K, going to 11K, 12K, etc. I want the size to jump in larger increments. How can a make a series of files that won't have such a fine-grained size difference? I'm thinking the limit is between 0 and 1 MB.


How to get back sudo on Ubuntu?

I have done this:               sudo chown -R myname /usr/      and now I can't use the `sudo` command because of this error: > sudo: must be setuid root And as I read this means that the owner of this file `/usr/bin/sudo` is not the root. It's my user now because of the chown on the `/usr` folder. On many forums and blogs people suggest to do this as root:               # chown root:root /usr/bin/sudo     # chmod 4111 /usr/bin/sudo      ...but the problem with this is that I need to log in as a root, but I can't because If I write `su` in the terminal the password is wrong (actually I use the password what I added to my user):               $ su     Password:     su: Authentication failure      So can I get back the `sudo` command? Edit: My Ubuntu is under Paralells on my Mac OS X.


Writing /dev/random to file?

If you ran the following, what would happen?               cat /dev/random > ~/randomFile # don't run      Would it be written until the drive runs out of space, or would the system see a problem with this and stop it (like with an infinite symlink loop)?


MATLAB install fails: Error extracting tbx.signal.common!

I'm trying to run MATLAB R2008b student on my Fedora Linux machine, but get the following after I run `/.install`:               Error extracting tbx.signal.common!!!      How can I solve this issue?


light weight disk based backup solution

Currently I am using Dirvish to backup a handful remote machines, both Linux and Windows to local disks. But Dirvish hasn't seen any updates for many years and it has a couple of small annoyances (e.g. deleting the last successful backup when it expires by age). Dirvish features I currently use include (and thus require):   * pre-client - to dump databases to flat files on remote system   * post-server - for basic analysis of changed files in backup set   * connect to remote clients using rsync over ssh Are there any alternatives for Dirvish available that are actively being maintained? Now I did a Google search myself and I did find one alternative, but I am looking for your _experience_ ; does the package work for you and why?


What does %F mean and how can I stop it meaning it?

On an rxvt-clone (I'm using `rxvt-unicode` but it seems to happen on plain, old `rxvt` as well), the sequence of characters `%F` seems to have some sort of special meaning (as do a few others, such as `%S`). In particular, I get the following:               % date +%F               38;5;0m2011-04-02     % date +%F--%H.%M.%S     38;5;0m--.Hostname.2011-04-02--22.25.59      with the text after the `m` being in some dark almost-black colour. Due to my colour scheme (mauve text on a dark blue polka dot background), this is almost unreadable. What is this, and more importantly, how do I get it to stop? To show why it is particularly annoying, my lecture documents have the date as part of their name. It is therefore quite convenient to be able to write:               xelatex lecture.beamer.$(date +%F).tex      since I can store that in my history and recall it with a few judicious TABs. However, the ensuing output is all the inverse of a whiter shade of pale, making it hard to see if there's an error. In case it makes a difference, my shell is `zsh`.


I have two Debian 7 machines and one of those reports "3.2.60-1+deb7u3" as its kernel release and other one reports "3.2.54-2" as its kernel release. Why does the same Debian release have different kernel versions?


Can't compile XBMC 12 because of TAGLIB problem

I am trying to compile the latest version of XBMC on CentOS 6 x64 but on `./configure` I get:               checking for TAGLIB... no     configure: error: Could not find a required library. Please see the README for your platform.      I tried compiling the taglib coming with XBMC and also downloading the latest version from github. Both compile just fine but the error remains.               [root@xbmc xbmc]# find /usr -name libtag*     /usr/local/lib/libtag.a     /usr/local/lib/libtag.so     /usr/local/lib/libtag_c.so.0     /usr/local/lib/libtag.so.1.12.0     /usr/local/lib/libtag.so.1     /usr/local/lib/libtag_c.so     /usr/local/lib/libtag_c.a     /usr/local/lib/libtag_c.so.0.0.0     /usr/lib64/libtag.so     /usr/lib64/libtag_c.so.0     /usr/lib64/libtag.so.1     /usr/lib64/libtag.so.1.6.1     /usr/lib64/libtag_c.so     /usr/lib64/libtag_c.so.0.0.0     /usr/lib/libtag.so     /usr/lib/libtag_c.so.0     /usr/lib/libtag.so.1.12.0     /usr/lib/libtag.so.1     /usr/lib/libtag_c.so     /usr/lib/libtag_c.so.0.0.0      Any ideas how to fix that? **UPDATE**   @slm               Package taglib-devel-1.6.1-1.1.el6.x86_64 already installed and latest version      These are the only options configure help lists regarding taglib:                TAGLIB_CFLAGS  C compiler flags for TAGLIB, overriding pkg-config      TAGLIB_LIBS linker flags for TAGLIB, overriding pkg-config


Restarting a service from a script

I have a _init script_ - `/etc/init.d/myservice`, which starts some processes, including a **CLI process**. And from this CLI process, I am adding a _command_ which can be used to restart the service (restart _ourselves_ - kind of). What I tried - from a script (that is spawned from the CLI command), ran `sudo service myservice restart`, where `restart` is `stop;start`. But, this doesn't work! i.e, even though the `stop` happens, by the time `start` part is executing, the script terminates (not with any signals, but plain `EXIT`). I tried combinations of `nohup`, `disown` etc, but didn't seem to work! I am not sure how to complete the `restart` without getting terminated - any pointers, or workarounds to debug further ? To summarize:   * `myservice` -> spawns many processes, including **CLI**   * CLI -> has a `restart` command, which invokes a _script_   * _script_ does `sudo service myservice restart` --More info-- I'm on Ubuntu 12.04, i.e, `upstart`


Pattern matching from the input arguments

we're trying to enhance the scripts. Users will pass some arguments and part of the arguments will have 5.0.3 For an example the input argument would be like Jboss5.0.3GA. Since it ( Jboss5.0.3GA ) has "5.0.3" we'll try to locate the installation binary file "Jboss5.0.3GA.tar". The current script we've now is a KSH script. I'm trying to use `if` condition with `ksh` script Sample usecases/test:               ./test.sh Jboss5.0.3GA     Match found... we'll try to locate the installation binary     ./test.sh Jboss5.0.3     Match found... we'll try to locate the installation binary     ./test.sh 5.0.3     Match found... we'll try to locate the installation binary     ./test.sh Jboss5.1.3     No Match found ... we'll be exiting teh script.


Is Mandatory Access Control overkill for a desktop/lightweight server?

I have fiddled around with both SELinux and Apparmor recently and found these tools invaluable for preventing a spread of damage from a compromised context via one process, whereby and attacker could exploit a buffer overflow or underflow, eventually pushing a new return address on the local call stack, which if I am correct can lead to exec() calls or even a root shell via say, su - Learning Unix & Linux is very interesting to me, and I want some of the more seasonsed people here to please offer me some basic reflection on this topic. Are these tools really overkill for a desktop or non government secure/business context, whereby a serious say, rootkit intrusion can be detected by analyzing the integrity of the System.map file for any rogue entries, and checking of package integrity etc. Say, a remote intrustion on these systems isn't a massive deal following cleanup, so prevention via MAC is overkill? No system is perfect, but would I be correct in making the assumption that on a basic desktop system, passwordless key based logins/swipe card and disabling remote logins via ssh etc, not to mention patching the system and disabling root work on any console, virtual or similar, except for console tty1, which is physically isolated from rogue user programs like firefox, would this setup be "ok" for most intents and purposes, or should MAC reside on ALL systems? Keep in mind most Linux distributions out there DO NOT offer MAC as a default. Fedora and CentOS/RedHat appear to be the only two well known ones to offer out of the box MAC.Thanks:)


Communicate between Ubuntu VM and Windows host

I'm running an Ubuntu VM on a Windows 7 host. I have two questions:   1. I think that on Windows, `localhost` is a loopback address, and sending packets to it doesn't actually transmit any data on the wire. Is that correct? On the Ubuntu VM I have a `localhost` as well, pointing to `127.0.0.1`. Is it the same thing?   2. Is it possible to send data from the VM to the host? For example, when I install software on the Ubuntu VM, can I have it send a message to the Windows host? What IP should I use?


Abbreviated current directory in shell prompt?

`vim` has a really nice feature which it utilizes in its paths when they're a bit long: ![enter image description here](http://i.stack.imgur.com/ZCK6V.png) It abbreviates the path to the document in the tab at the top. Is there a way to do something similar to this so my bash prompt doesn't look like this:               rfkrocktk@work-laptop ~/Documents/Projects/Work/maventest/src/main/java/com/tkassembled/ $


Mailman, mlmmj and probably other Mailinglist-Software support the feature 'no mail delivery subscription'. Meaning that you can subscribe and then disable mail delivery. This useful for times you are at vacation or when you want to read that list via gmane.org or a similar service. I can't find anything about majordomo, regarding this feature. Thus my question: Does majordomo support 'no mail delivery subscription'?


block device usage and several mount points

There is some weird thing I don't understand: I have 2G block.img file with an ext4 filesystem inside. There is a 2G test.txt file in block.img. test.txt consists of letters 'a'. Then I mount block.img to /mnt/first. And I can see this test.txt with letters 'a' inside. All is fine. Weird thing begins here: simultaneously I mount block.img on /mnt/second and change all 'a' to 'b' in this text file. And I can see two different 2G files. I have two files 2G (4G used space) on one 2G partition! Unbelievable (: Therefore, there is some mistake in my words, unfortunately I can't find it.


BackupPC can't finish backup

I'm trying to backup /etc/ directory on CentOS 5.2 using BackupPC. It takes several hours and then aborted by signal ALRM. There is a partial backup created with all data from /etc But BackupPC thinks the backup is failed and always starts doing full backup again. If I try to run rsync manually from the backup server it works flawlessly and finishes in about 5-10 seconds. I have additional server with several GB of data I'm backing up and it works without a problem.


Why is my unmounted USB disk still seen by `fdisk`?

I've mounted my USB disk to `/mnt/kingston/` dir, and umounted it from there by typing in `umount /mnt/kingston/`. But I can still see my USB disk after issuing the `fdisk -l` command. Why? If I type in `umount /mnt/kingston` again, it shows: `umount: /mnt/kingston; not mounted`.


Open VirtualBox GUI?

I've installed VirtualBox and I would like to create a VM now. I prefer to use the GUI rather than the command line interface, and I know that VirtualBox comes with such a GUI. However, I can't seem to figure out what the name of this application is.               $ dpkg -L virtualbox | grep "/usr/bin/"     /usr/bin/VBoxSDL     /usr/bin/VBoxBalloonCtrl     /usr/bin/VBoxManage     /usr/bin/vboxheadless     /usr/bin/VBoxHeadless     /usr/bin/vboxmanage     /usr/bin/vboxballoonctrl     /usr/bin/vboxsdl     /usr/bin/vboxwebsrv      None of these applications actually start a GUI. How do I start the virtualbox GUI?


Shutting down from X without a desktop environment

I have recently given up my Desktop Environment and am now only using a Window Manager (i3) and X. It all works very well and I do not miss much. Except for one thing: the shutdown button. I can now only shutdown by issuing: `sudo shutdown -Ph now` from a terminal. This works, but I want to create a keybinding in i3 to shutdown by clicking `Mod+x`. And I am not sure how this can be achieved. If I create a script in say `~/shutdown` and refer to this with: `bindsym $mod+x exec ~/shutdown` Then this does not work; I figure because I am running as a regular user and I am sudoing in this script. I would be fine with having a terminal appear and prompting me for the password (although I prefer this to not require a password, if possible), but am not sure how to do this. What is a way to get this done? Using Arch Linux.


Recover text files and directory structure from the database created by Recoll?

A while ago, I ran Recoll which created a database on a partition, so that I could quickly search among all the text information in the contents of all files (text file, pdf, djvu, html, etc) in that partition. Now the partition, for which the Recoll created a database, has been wiped out accidentally, but I can still search in Recoll among those deleted files, because the database of Recoll is stored in another partition that hasn't been affected.   1. When I search for a keyword among the text content of those deleted files, I can still see one or two lines surrounding that keyword as its context, It gives me some hope that it might be possible to recover the text content of each deleted file. But when I hit "Preview" or "Open" for a deleted file found by Recoll, Recoll will try to open the file that doesn't exist any longer, which of course fails. **So I wonder if I can recover the deleted text files from Recoll's database?**   2. When I search for a keyword among the text content of those deleted files, I can also see the full path to each file found, **So I wonder if I can recover the directory structure of my partition from Recoll's database?** Thanks and regards!