Attachments are missing when multiple files are attached in mail

I have written one script to get multiple attachments through mail. My script is               for file in `find $dir -ctime -2 -type f -name "Sum*pdf*"`     do     echo "$file"     filename=`basename $file`     echo $filename -exec uuencode {} {}\;|mailx -s "North" abc@gmail.com     echo "$filename"     done      But I am getting mail without attachments. Please help me what is wrong in this.


command not found in shell script

Please tell me why I couldn't print variable value.               # chmod 777 chkscript.sh     # ./chkscript.sh      **chkscript.sh** file content               variable = "This is variable"          echo "$variable"          echo "Hello World "      **Output :**               # ./chkscript.sh     ./chkscript.sh: line 5: variable: command not found          Hello World     #      **P.S :** And sometimes                variable1 = "/home/files" --- which is location if I try to print nothing gets printed.      echo "$variable"


What are the readline word separators?

When I delete a "word" in Bash, it will stop at certain characters like `_` and `/`. For example, if I type               /foo/bar      and activate `backward-kill-word` (typically mapped to `Alt`-`Backspace` and/or `Ctrl`-`w`), the remaining text is               /foo/      . This does _not_ correspond to `$COMP_WORDBREAKS` or `readline`'s `rl_completer_word_break_characters`. How can I detect (preferably in a running system, rather than the defaults in the code, since they presumably can be overridden) which characters are used to determine word breaks?


ldconfig issue with non-standard lib directory in CentOS

I am working with a virtual machine (CentOS 5.3) that has very little storage space on the main drive (which includes `/usr`, `/usr/local`, etc). Most of the storage space is available on a separate drive that is mounted to `/mnt`. Consequently, on this drive I have created a basic installation directory (with subdirectories like `bin`, `include`, `lib`, etc) and installed a library there.               [standage@vm142-46 ~]$ ls -lhp /mnt/lib     total 33M     -rw-r--r-- 1 standage iplant-everyone 21M Dec 21 16:29 libgenometools.a     -rwxr-xr-x 1 standage iplant-everyone 13M Dec 21 16:29 libgenometools.so      I then tried to link to that library with code that I had written, but it gave me the following message.               /usr/bin/ld: cannot find -lgenometools      I realized I had not updated `ldconfig` with the new installation directory I had created, so I went ahead and added `/mnt/lib` to `/etc/ld.so.conf` and ran `/sbin/ldconfig`. However, when I tried to link my code again I got the same error. I was eventually able to get the libraries to link by creating symlinks to `/usr/local/lib64`...               [standage@vm142-46 ~]$ sudo ln -s /mnt/lib/libgenometools.a /usr/local/lib64     [standage@vm142-46 ~]$ sudo ln -s /mnt/lib/libgenometools.so /usr/local/lib64      ...but this doesn't really solve my original problem, it's just a duct-tape solution. What did I do wrong originally and how can I link to the library I've installed?


Supervisord runs ssserver but reports an error on CentOS?

I have the following Supervisord setup, `/etc/supervisord.conf`:               ...     [program:shadowsocks]     command=ssserver -c ~/config.json     autorestart=true     user=nobody     ...      `/etc/rc.d/init.d/supervisord`:               #!/bin/sh     #     # /etc/rc.d/init.d/supervisord     #     # Supervisor is a client/server system that     # allows its users to monitor and control a     # number of processes on UNIX-like operating     # systems.     #     # chkconfig: - 64 36     # description: Supervisor Server     # processname: supervisord          # Source init functions     . /etc/rc.d/init.d/functions          prog="supervisord"          prefix="/usr/"     exec_prefix="${prefix}"     prog_bin="${exec_prefix}/bin/supervisord"     PIDFILE="/var/run/$prog.pid"          start()     {            echo -n $"Starting $prog: "            daemon $prog_bin --pidfile $PIDFILE            [ -f $PIDFILE ] && success $"$prog startup" || failure $"$prog startup"            echo     }          stop()     {            echo -n $"Shutting down $prog: "            [ -f $PIDFILE ] && killproc $prog || success $"$prog shutdown"            echo     }          case "$1" in           start)        start      ;;           stop)        stop      ;;           status)            status $prog      ;;           restart)        stop        start      ;;           *)        echo "Usage: $0 {start|stop|restart|status}"      ;;          esac      I then do the following to set it up and start it:               $ sudo chmod +x /etc/rc.d/init.d/supervisord     $ sudo chkconfig --add supervisord     $ sudo chkconfig supervisord on     $ sudo service supervisord start      Afterwards everything is OK. Now when I start `shadowsocks`:               supervisorctl start shadowsocks      It reports an error:               shadowsocks: ERROR (abnormal termination)      However if I executes directly:               ssserver -c ~/config.json      it works well. Why won't this work with `supervisord`?


Debian Live 3.x with encrypted root filesystem

I'd like to build a Debian Live system based on `sid` with an encrypted root filesystem. It's quite easy to install a Debian system with a rootfs encrypted with dm-crypt/LUKS, so I suppose it's also doable on a live system. In Debian Live 2.x, `lh_config` used to support an `\--encryption` parameter which would do just that, but it's been removed in version 3.x, presumably because `loop-aes` has more-or-less been dropped from more recent version of Debian. I'm looking to do this because I'm booting the live system from PXE (with the help the `fetch` boot parameter) and would like to make sure it's used only by IT staff, as it contains sensitive information. As an alternative, I've looked into using an encrypted persistence image, which seems to be better supported in Debian Live, but couldn't figure out how I could load it remotely instead of being looked for on local media.


Tab completion doesn't work for arguments when command is an alias

I have an alias, ee, defined for my favorite editor, mg. When I do something like               mg fo      and then hit tab, if a file foo exists, I get tab completion to:               mg foo      On most systems I use (e.g., all versions of ubuntu for many years now, and some installs of debian),               ee fo      also completes properly to               ee foo      But on one system I use, which has Debian 6.0 and GNU bash 4.1.5(1)-release, tab completion fails for the version with the alias. Note that this is _not_ a problem with completing the alias itself -- it's a problem with completing the _arguments_ of the aliased command. Is there a way to fix this behavior on the Debian system? Upgrade to bash 4.2.x? Fiddle with config files?


How to only substitute lines that match several patterns in sed?

$ echo -e 'CH12\nCH23au' | sed '/^CH/s=^=<b>='     <b>CH12     <b>CH23au      I know I can match lines starting with `CH` by `^CH` but how can I match multiple patterns? Example: **Input:**               CH12     CH23au      **Output:**               CH12     <b>CH23au      How to only put `<b>` where there is `^CH` and `au` in the line?


Executing commands with PHP: using normal user, but its home directory is /root

I'm using a custom compiled installation of Apache + PHP, listening on port `80`. Apache is configured to run as a normal user, with the proper settings `User` and `Group` of the `httpd.conf` file. After running apache as a service, with `apachectl`, there's one process `httpd` running by root, and 4 others running by that normal user. The problem is this:   * When I run an external command by PHP (using `exec` or `passthru` for instance), it's run by the proper normal user, but `$HOME` environment variable points to `/root`. For example, with the following very simple code:               <?php     echo "Home: " . `echo \$HOME`;     echo "<br />";     echo "Id: " . `id`;      I get:               Home: /root     Id: uid=1000(normaluser) gid=100(users) groups=100(users),17(audio),33(video)      Any command run this way, is actually run by the normal user, so there's no security problem. The major problem is when an external command is run, and that command tries to write and/or read something from the home directory.


I have a similar question about default software configuration. For this question i would like to ask What directories/file permissions should i ensure are set? Aprrently Is it normal to get hundreds of break-in attempts per day. So i checked what files and folders are writable on a nonroot user. It was all good. Now i need to protect passwords and such so i checked read permissions. I am kind of horrified. By default my linux distro has /root to be read. Where i set my mysql root password. But then i looked on and saw /etc was readable. Any user could have got into /etc/ssmtp/ssmtp.conf and found the login/password i use for my mail (which cron uses to contact me) and potentially use it to spam everyone and or get my server or domain on blacklist. I set /etc to 750. Will there be any problems with that? I'm sure other vulnerabilities due to read access. What files/directories should i ensure are not read or writable? -edit- ok so i changed etc back to 755. But stil, i need to ensure certain folders are not readable. I changed apache and ssmtp. I would like to know others.


Why can't vim find syntax.vim on my fresh Ubuntu installation?

I'm trying to make some basic customizations to vim. All I want is some syntax highlighting, etc. Basically, not just plain text. My `.vimrc` file consists of 7 lines:               backspace=2     syntax on     filetype indent on     set autoindent     set number     colorscheme desert     set nobackup      Every time I launch vim, I get these errors and **see no syntax highlighting** :               E492: Not an editor command: backspace=2     E484: Can't open file /usr/share/vim/syntax/syntax.vim      The latter problem just might stem from the fact that I don't have a `/usr/share/vim` folder. I would have thought that this would have been created when I installed vim. So, what do I do now?


Writing to stdout except for output redirection C

I have to make a simple app for school. I have to write arguments one per line on the terminal, and return on stdout the user choices. For example, I write `cat my_app main.c main.h`, if the user choose `main.c`, then I return `main.c` to cat. The problem is that if I write the menu on the standard output (aka STDOUT_FILENO), I return it to `cat`. I could write my menu on STDERR, but it's a little ugly. I don't really know how to use devices/files like `/dev/tty*` or `/dev/pty*`, but I feel I could use them to write something on the terminal without having to write it on STDOUT or STDERR. Basically, I want to open a new output, which would be shown by the terminal (STDOUT, STDERR, MYOUT). I don't know if I explained it correctly.


How to feed linux new install drivers?

I'm trying to install a Linux distribution on my new setup, but after the first tries I failed without knowing why. > My configuration:   * Desktop PC HP   * Processor: Intel Core i3 2120 @3.30GHz   * Chipset: Intel Sandy Bridge   * Graphic Interface: NVIDIA GeForce GT 520 > My actions so far:   * 3 X installed Ubuntu 12.10 (64bit) - after boot I get an orange screen (some errors that convinced me to reinstall 3 times).   * tried to install Linux Mint, Mate 32bit but when the installer starts i can see nothing but a scrambled image.   * installed Linux Mint, Mate 64bit - after boot it hangs on some errors Update:I saw some flashing errors about drivers not found. After this tries i was thinking that i need to preload drivers for my configuration in installation files. How do i provide the linux boot disc with such information and where do I get those drivers? Please tell me if you need more info for the drivers. related to this: Hardware problem after fresh Linux Mint install Is there any chance that i can make nvidia drivers avaiable for ubuntu from my windows install? or to put them somewhere to be avaiable for the intaller in order to see them?


What's the meaning of the slash in crontab?

I have seen a crontab record in system.               0-55/5 * * * *   root  <command>      I read the `crontab -e` example files and I know the first position stands for minute. But I cannot figure out the meaning of `/` (slash) there. Could anyone explain the meaning to me?


How to restore data atomically on a remote server?

I want to be able to backup and restore my home directory of a remote account. The command I use are: **Backup**               ssh myuser@myuser.server.com "tar jcf - ." > backup.tar.bz2      **Restore**               cat backup.tar.bz2 | ssh myuser@myuser.server.com "tar jxf - ."      I'd like to be sure that all the files are restored or none, even if the server gets rebooted in the middle of a restore. Any way to achieve what I want? I'd like to maintain the commands shown above as a base, but other ideas are appreciated as well.


Getting KDE applications to recognize Forward/Back mouse buttons

I have a mouse with Forward/Back buttons which work correctly in Firefox, Chrome etc... i.e. they are recognized. They are also seen by `xev` which generates events, e.g.               ButtonRelease event, serial 35, synthetic NO, window 0x6200001,     root 0xaf, subw 0x6200002, time 29607818, (36,54), root:(38,108),     state 0x10, button 8, same_screen YES      I now want to use them to change virtual desktops when my cursor is pointing at the KDE (Plasma) desktop. However, the "Mouse Actions" parameter at the Plasma desktop settings does not recognize the clicks of those buttons. Also, Dolphin does not seem to recognize those buttons for forward/back. What am I missing there? I haven't found any related options in the KDE settings. I'm using x86-64 Arch Linux, if it's relevant.


Virtual unix command-line environment on the iPad

Is there a lightweight virtualized Linux or other unix environment that I can run on the iPad? Like VirtualBox for iPad. I only really need a minimal system — something along the lines of Microcore Linux, so no X server or anything like that. Just a console with a reasonable C compiler; if gcc is not available, tcc (Tiny C Compiler) or something like it would be fine. I'd really like it to be virtualized so that I don't inadvertently mess up my iPad by playing with the linuxbox inside.


archlinux cannot boot after replace module init with kmod

I install archlinux (latest iso from the repository), then I install broadcom- wl and connect to the network to run > pacman -Syu everything is OK, then I run > pacman -Syu again, it ask that shall I replace module-init with kmod I type yes, and archlinux says > rc.conf and profile.d/locale.sh conflicts. I found the -f option will force replace the configuration So I try > pacman -Syuf After i reboot It shows that > cannot find device /dev/sda7 then a recovery shell is displayed. I can never boot archlinux again! I check the menu.list from windows xp, found it OK,               # (0) Arch Linux     title  Arch Linux     root   (hd0,6)     kernel /boot/vmlinuz-linux root=/dev/sda7 ro     initrd /boot/initramfs-linux.img          # (1) Arch Linux     title  Arch Linux Fallback     root   (hd0,6)     kernel /boot/vmlinuz-linux root=/dev/sda7 ro     initrd /boot/initramfs-linux-fallback.img          # (2) Windows     title Windows     rootnoverify (hd0,0)     makeactive     chainloader +1


Scrambled Xen Console on dom0

I installed Xen using the recommended procedure on Ubuntu's site using motherboard Supermicro X7SBL-LN2 and Ubuntu 13.04 amd64. After the installing it and rebooting my console looks like this: https://www.youtube.com/watch?v=-UbZt7Gix2Q I've had this happen also with CentOS 6 as well. Everything on the server works fine but the console is unusable. If I switch back to the stock kernel it goes back to normal and I can use the console again but then I can't use Xen. This is a fresh install of Ubuntu 13.04. Any help troubleshooting this problem is appreciated.


OpenSMTPD Configuration Problem

I'm trying to configure a simple mail server on OpenBSD 5.2, running OpenSMTPD 5.3.1, however there is some problem with my configuration file, and I'm unsure how to fix it. I can send and receive local mail on the computer, but I cannot send external mail from the computer, nor receive it. The following is my `smtpd.conf` And yes, "mydomain.com" is a real domain, that's just a filler.               listen on lo0     listen on bce0          table aliases db:/etc/mail/aliases.db          # accept local mail     accept from local for local deliver to mbox          # accept remote mail     accept from any for domain "mydomain.com" deliver to mbox          # allow remote delivery of mail     accept from local for any relay      Perhaps it's not doing what I think it is, but any help would be much appreciated.


Comment multiple line using SED

Seeking help how can i comment multiple lines using SED, i like to comment ftp, telnet, shell, time, ntalk, daytime in inetd.conf file. Thanks in advance ![inedd.conf file in AIX OS](http://i.stack.imgur.com/SYXwW.jpg)


Other than /etc/rc.conf what other config files control system services at boot time?

I am still very new to FreeBSD, from what I have learned in manuals, `/etc/rc.conf` controls system services at boot time. There is no mention of sendmail and syslogd in `/etc/rc.conf`, so how come they are started automatically? Is there another configuration file for system services at boot time?


linux + g++: command not found

I want to install on my Linux red-hat machine `gettext-0.19.1.tar.xz`. First I do the following               cd gettext-0.19.1     ./configure     make      During `make` it fails on `g++: command not found`               libtool: compile:  g++ -DIN_LIBASPRINTF -DHAVE_CONFIG_H -I. -c autosprintf.cc  - o .libs/autosprintf.o     ./libtool: line 1128: g++: command not found     make[5]: *** [autosprintf.lo] Error 1     make[5]: Leaving directory `/var/tmp/gettext-0.19.1/gettext-runtime/libasprintf'     make[4]: *** [all] Error 2     make[4]: Leaving directory `/var/tmp/gettext-0.19.1/gettext-runtime/libasprintf'     make[3]: *** [all-recursive] Error 1     make[3]: Leaving directory `/var/tmp/gettext-0.19.1/gettext-runtime'     make[2]: *** [all] Error 2     make[2]: Leaving directory `/var/tmp/gettext-0.19.1/gettext-runtime'     make[1]: *** [all-recursive] Error 1     make[1]: Leaving directory `/var/tmp/gettext-0.19.1'     make: *** [all] Error 2      How do I fix this? Remark - I have GCC               which gcc     /usr/bin/gcc


Run Python Portio script as normal user without root access

I know there are risks running a root script as a normal user, but in this case I don't have a choice and what I am doing is machine related. I have an Small Board Computer that has GPIO ports and I need to use one of the outputs to reset a device by toggling a shutdown line. That part works fine and the device resets as it should. My problem is that I wrote a python script to reset the device and it works, but I have to run it as root or "sudo program name, enter password". But I need this to work as a normal user without root permissions. In other words I added a normal user and I cannot run the script no matter what I do. I have tried adding the user to the sudoer file, but that did not work and was completely ignored. I have changed the permissions, set SUID bit and everything else I can think of, but still it asks for a root password. The only thing that did work was when I opened up Users and Groups and added the user to the Sudo group, but then the user had access to programs I would rather it did not as it was just like my default admin user. That is not what I want. I would like to somehow limit what that user has access to, to a single script or program. I have had other people suggest that I need to write a driver, but I don't really know how to do that or exactly what they mean and usually they do not want to elaborate. Though I have used Linux some I would not consider myself and expert especially in this area. Anyone have any ideas how to do this?


What software(s) should I install on new system(with Linux as a OS) to prevent it from getting hacked?

I am switching to new system with a OS using Linux.I will be using another system which has windows ultimate which is hacked.I am being cyber bullied. I have given a reference to this as a question on stackexchange. Now I want to install some softwares on my system with linux that I havnt started it which can prevent from being hacked or being traced in any way. A fear that I have is -If I make a new email,it may be traced or hacked easily unless I contact old emails which I will not. http://security.stackexchange.com/questions/18849/what-do-i-need-to-worry- about-when-moving-from-a-compromised-system-to-a-clean-o


solaris awk problems with date and if statements

I have daily files that come in via FTP with incorrect dates in the first column of the file. I have figured out how to deduct one day to derive the correct date and print this to a new file. The main problem is that my script works in unix using gnu but not on solaris. data contained in file:               End Date,Name,Amount     02/07/2014,data1, data2     02/02/2014,data1, data2     02/06/2014,data1, data2     02/06/2014,data1, data2     02/06/2014,data1, data2     02/10/2014,data1, data2     02/12/2014,data1, data2     02/20/2014,data1, data2     02/20/2014,data1, data2     02/21/2014,data1, data2     02/28/2014,data1, data2     03/03/2014,data1, data2      Script:               awk 'BEGIN{FS=OFS=","}          NR==1 {print}          NR>1 {            ("date -d \""$1" -1 day\" +%m/%d/%Y")|getline newline            $1=newline            print          }' wrongdates.csv > correctdates.csv      I have managed to move some of the script over to nawk on the solaris box but it is now complaining that 'date -d' is not supported and when ever I try to change this I get 'date: bad conversion'. Furthermore the above does not take into account weekends when altering the dates with in the file as I only care about business days and I am trying to introduce if and else statements. as per the below                   nawk 'BEGIN{FS=OFS=","} NR==1 {print};NR>1 {if (date "$1" "+%u"==1) ("date -d \""$1" -1 day\" +%m/%d/%Y")| getline newline; $1=newline; {print}; else ("date \""$1" -3 day\" +%m/%d/%Y")| getline newline; $1=newline; print}' file20140228.csv > file2.csv      I seem to be getting no where with the syntax of my if and else statements and the last date in my sample 03/03/2014 should be converted to 02/28/2014 and 02/28/2014 should become 02/27/2014.


xargs : using same argument in multiple commands

Am trying to write a one-liner that can probe the output of `df -h` and alert when one of the partitions is out [or almost] of space. It's the part using xargs that kicking me in the ass now...               echo 95 | xargs -n1 -I{} [ {} -ge 95 ] && echo "No Space on disk {}% full -- remove old backups please"      How can i make the second {} show "95" too?


Usage of stunnel for configuring secure services as a default?

Ok, I am aware nothing will beat manual security configuration through your standard daemon config files, but is it bad practice to configure stunnel for all services on say, a production machine(ldap, nfs, nis) etc? Apart from a bug in the implementation of stunnel, does it really matter? I really like the fact stunnel binds ssl on any arbitrary port, even if the application in question is not natively compatible with openssl.


Apache fails to start after changing cert and key

The problem appeared after I changed https certificate and key. `sudo /etc/init.d/httpd restart` shows this:               Stopping httpd: [FAILED]     Starting httpd: [FAILED]      Apache's `error_log`:               [Tue Dec 03 08:06:54 2013] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)     [Tue Dec 03 08:07:31 2013] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)     [Tue Dec 03 08:09:25 2013] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)      `httpd -t`               Syntax OK      What's causing this problem?


When vfork is called is parent process really suspended?

As much as I know when `vfork` is called child process uses the same address space as that of the parent and any changes made by the child process in parents variables are reflected onto parents process. My questions are:   * When child process is spawned is parent process suspended?    * If yes why?   * They can run in parallel (like Threads)? After all both threads and process call the same `clone()` function. Also after bit of research and Goggling I found out that the parent process is not really suspended but the calling thread is suspended. Even if this is the case when child process does an `exit()` or `exec()`. How does parent process know that the child has exited? And what will happen if we return from a child process?`


How to stop g++ linking/including old system headers/libs from /usr/*?

The server I want to run some code on has older versions of gcc (gmp,mpc,mpfr too) installed in the standard locations like `/usr*` the admin is unwilling to update but has allowed me to install a newer version of gcc in my `/home/username` directory. I have done this an now have `g++d46` as gcc 4.6.3 installed in my home dir `/home/myusername/opt2/gcc-4.6.3`. I also have gmp,mpfr,mpc installed in `/home/myusername/tmp/gcc/{include,lib,share}`. I have exported `{LD_LIBRARY_PATH, LIBRARY_PATH,LD_RUN_PATH}=/home/myusername/tmp2/gcc/lib:/home/myusername/opt2/gcc-4.6.3/lib/gcc/x86_64-unknown- linux-gnu/4.6.3:/home/myusername/opt2/gcc-4.6.3/lib64:` and `PATH=/bin:/usr/bin:/home/myusername/opt2/gcc-4.6.3/bin:` also `{C_INCLUDE_PATH,CPLUS_INCLUDE_PATH}=/home/myusername/tmp2/gcc/include:/home/myusername/opt2/gcc-4.6.3/include/c++/4.6.3:` I then compile some test code with               g++d46 -g -O3 -I/home/myusername/tmp2/gcc/include -L/home/myusername     /tmp2/gcc/lib -Wall testMPFR3.cpp -o myBin -lgmp -lgmpxx -lmpfr      which compiles and executes OK, but upon doing `ldd myBin` I see that despite being mostly linked with the correct libs on my _home directory_ , we also have:               libm.so.6 => /lib64/libm.so.6 (0x0000003917e00000)     libc.so.6 => /lib64/libc.so.6 (0x0000003917a00000)     /lib64/ld-linux-x86-64.so.2 (0x0000003917600000)      which are not on my home dir, how does it even know to look elsewhere, given the env vars I have exported and my `-I` and `-L` flags? Also if I do `g++ -H` to see where the headers are coming from, again most (including the new gmp,mpfr thankfully) are coming from my home dir, but a few:               ..... /usr/include/sys/cdefs.h     ...... /usr/include/bits/wordsize.h     ..... /usr/include/gnu/stubs.h     ...... /usr/include/bits/wordsize.h     ...... /usr/include/gnu/stubs-64.h     ........ /usr/include/stdio.h     ........ /usr/include/bits/wchar.h     ........ /usr/include/xlocale.h     ....... /usr/include/locale.h      ..... /usr/include/ctype.h     ....... /usr/include/bits/types.h     ........ /usr/include/bits/wordsize.h     ........ /usr/include/bits/typesizes.h     ....... /usr/include/endian.h     ........ /usr/include/bits/endian.h     ........ /usr/include/pthread.h     ......... /usr/include/sched.h     .......... /usr/include/time.h     .......... /usr/include/bits/sched.h     ......... /usr/include/time.h     .......... /usr/include/bits/time.h     ......... /usr/include/signal.h     .......... /usr/include/bits/sigset.h     ......... /usr/include/bits/pthreadtypes.h     .......... /usr/include/bits/wordsize.h     ......... /usr/include/bits/setjmp.h     .......... /usr/include/bits/wordsize.h      I don't understand why my local gcc-4.6.3 is missing these? nor how the linker knows to revert to `/usr/*` if it doesn't find them on the home dir? I could use the flag `\--nostdinc` upon compilation perhaps, but this probably wont solve the problem that the above headers can't be found locally for some reason.


What's the mechanism that a process listening to localhost refuses to process a request to its LAN IP address?

The private IP address of my machine is 192.168.44.182. If I started a process using               nc -l localhost 20000      Then this process won't handle requests sent to 192.168.44.182. Since the process listening to localhost:20000 does run on the physical machine with LAN IP being 192.168.44.182, I'm trying to know how the process ignores the requests to 192.168.44.182. Is it true that these requests are ignored by the process, or such requests are not delivered to the network interface of 127.0.0.1 at all? Is this a network-layer mechanism, or link-layer mechanism?


Kensington orbital scroll wheel two consecutive button press 5 when scrolling

Using the scrolling function on my kensington orbital scroll wheel mouse in `xev` I see that two `ButtonPress` and `ButtonRelease` events of button 5 are triggered during a very small movement, followed by a long movement with no button pressing. During normal usage, the use of the scroll wheel is very "jumpy" compared to other non-smooth scrolling wheels. Here is the output from xinput:               Virtual core pointer                   id=2  [master pointer  (3)]       ↳ Virtual core XTEST pointer         id=4  [slave  pointer  (2)]       ↳ Primax Kensington Eagle Trackball  id=9  [slave  pointer  (2)]


how to identify IP address on eth0 when console isn’t available

I need help about the following I have very old Linux server with one IP address, unfortunately I can’t to access to Linux machine VIA console and I not remember the IP address So I now thinking about way that I could to verify this IP address I don’t sure not it works but maybe by sniffer I can check the server IP ? For example   * Download sniffer on my laptop    * Connect the laptop network to the linux machine VIA LAN cross cable ( END TO END )   * And try to run the sniffer in order to recognize the IP address from ETH0 ( Linux machines ) Please advice if that option could works ? Or if not please advice about the other options I thinking also about the option to build VB script that scan the IP's from 1.1.1.1 to 255.255.255.255 - but this option is very difficult ( I don’t know if somewhere already has this tool ? )


What does “quiet mode” mean for the mkfs command?

I was reading about the `mkfs` command and I came across something I don't quite understand: > # mkfs > > ## Syntax >   >   >           mkfs [-t fstype] [fs_options] device >   > > ## Options : > > ............ > > ### -q >   >   >     Uses mkfs in quiet mode, resulting in very little output. >   What is "quiet mode" in the context of filesystem creating ?


Accessing GUI of UNIX from LINUX /RHEL

Is there any free available tool or X Window System tool like Exceed for Accessing the GUI of UNIX from LINUX/RHEL.


SSH hangs forever?

I'm trying to SSH into a remote VM, and the command hangs forever. Before, when I was trying to get some stuff set up on it, I edited /etc/hosts and /etc/init.d, and I'm worried I might have messed something up. If it isn't obvious, I'm a bit new to networking/server admin stuff. Running with -v gives me this:               ssh USERNAME@IP -vvv     OpenSSH_5.9p1, OpenSSL 0.9.8x 10 May 2012     debug1: Reading configuration data /etc/ssh_config     debug1: /etc/ssh_config line 20: Applying options for *     debug2: ssh_connect: needpriv 0     debug1: Connecting to 10.150.42.39 [10.150.42.39] port 22.     debug1: Connection established.     debug1: identity file /Users/LOCALUSERNAME/.ssh/id_rsa type -1     debug1: identity file /Users/LOCALUSERNAME/.ssh/id_rsa-cert type -1     debug3: Incorrect RSA1 identifier     debug3: Could not load "/Users/LOCALUSERNAME/.ssh/id_dsa" as a RSA1 public key     debug1: identity file /Users/LOCALUSERNAME/.ssh/id_dsa type 2     debug1: identity file /Users/LOCALUSERNAME/.ssh/id_dsa-cert type -1      EDIT: I tried moving the id_dsa and id_dsa.pub files away and got these messages instead:               ssh USERNAME@IP -vvv     OpenSSH_5.9p1, OpenSSL 0.9.8x 10 May 2012     debug1: Reading configuration data /etc/ssh_config     debug1: /etc/ssh_config line 20: Applying options for *     debug2: ssh_connect: needpriv 0     debug1: Connecting to 10.150.42.39 [10.150.42.39] port 22.     debug1: Connection established.     debug1: identity file /Users/LOCALUSERNAME/.ssh/id_rsa type -1     debug1: identity file /Users/LOCALUSERNAME/.ssh/id_rsa-cert type -1     debug1: identity file /Users/LOCALUSERNAME/.ssh/id_dsa type 1     debug1: identity file /Users/LOCALUSERNAME/.ssh/id_dsa-cert type -1      EDIT2: If anyone else runs into this problem: Apparently my VM ran out of memory and hung. My sysadmin restarted it and that fixed it.


Press space to continue

How do I stop a bash script until a user has pressed `Space`? I would like to have the question in my script > Press space to continue or CTRL+C to exit and then the script should stop and wait until Space is pressed.


How to set system time from Unix timestamp

I know arbitrary timestamp and I want to set system time using it. I've tried following:               date +%s -s "1371729865"     date +%s -s '1371729865'     date +%s -s 1371729865      but without success. The idea is, that I launch system on remote device without internal RT clock (RaspberryPi), and I need to set system time for logging purposes. I don't need exact time. On RPi I have access to network, but not to internet and I will be sending the time as packet in my application.


Minimize PHP.CGI.Argument.Injection and further hardening of the Centos 6.4 web server

We have Centos 6.4 server with a physical firewall. We keep seeing quite an number of PHP.CGI.Argument.Injection is detected by the firewall. On the server itself we have done the basic apache hardening as below. We are using fail2ban and also mod_secure. What else can be done to further harden the server? Httpd.conf                  #         # This is the main Apache server configuration file.  It contains the         # configuration directives that give the server its instructions.         # See <URL:http://httpd.apache.org/docs/2.2/> for detailed information.         # In particular, see         # <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>         # for a discussion of each configuration directive.         #         #         # Do NOT simply read the instructions in here without understanding         # what they do.  They're here only as hints or reminders.  If you are unsure         # consult the online docs. You have been warned.           #         # The configuration directives are grouped into three basic sections:         #  1. Directives that control the operation of the Apache server process as a         #     whole (the 'global environment').         #  2. Directives that define the parameters of the 'main' or 'default' server,         #     which responds to requests that aren't handled by a virtual host.         #     These directives also provide default values for the settings         #     of all virtual hosts.         #  3. Settings for virtual hosts, which allow Web requests to be sent to         #     different IP addresses or hostnames and have them handled by the         #     same Apache server process.         #         # Configuration and logfile names: If the filenames you specify for many         # of the server's control files begin with "/" (or "drive:/" for Win32), the         # server will use that explicit path.  If the filenames do *not* begin         # with "/", the value of ServerRoot is prepended -- so "logs/foo.log"         # with ServerRoot set to "/etc/httpd" will be interpreted by the         # server as "/etc/httpd/logs/foo.log".         #              ### Section 1: Global Environment         #         # The directives in this section affect the overall operation of Apache,         # such as the number of concurrent requests it can handle or where it         # can find its configuration files.         #              #         # Don't give away too much information about all the subcomponents         # we are running.  Comment out this line if you don't mind remote sites         # finding out what major optional modules you are running         ServerTokens OS              #         # ServerRoot: The top of the directory tree under which the server's         # configuration, error, and log files are kept.         #         # NOTE!  If you intend to place this on an NFS (or otherwise network)         # mounted filesystem then please read the LockFile documentation         # (available at <URL:http://httpd.apache.org/docs/2.2/mod/mpm_common.html#lockfile>);         # you will save yourself a lot of trouble.         #         # Do NOT add a slash at the end of the directory path.         #         ServerRoot "/etc/httpd"              #         # PidFile: The file in which the server should record its process         # identification number when it starts.  Note the PIDFILE variable in         # /etc/sysconfig/httpd must be set appropriately if this location is         # changed.         #         PidFile run/httpd.pid              #         # Timeout: The number of seconds before receives and sends time out.         #         Timeout 60              #         # KeepAlive: Whether or not to allow persistent connections (more than         # one request per connection). Set to "Off" to deactivate.         #         KeepAlive Off              #         # MaxKeepAliveRequests: The maximum number of requests to allow         # during a persistent connection. Set to 0 to allow an unlimited amount.         # We recommend you leave this number high, for maximum performance.         #         MaxKeepAliveRequests 100              #         # KeepAliveTimeout: Number of seconds to wait for the next request from the         # same client on the same connection.         #         KeepAliveTimeout 15              ##         ## Server-Pool Size Regulation (MPM specific)         ##               # prefork MPM         # StartServers: number of server processes to start         # MinSpareServers: minimum number of server processes which are kept spare         # MaxSpareServers: maximum number of server processes which are kept spare         # ServerLimit: maximum value for MaxClients for the lifetime of the server         # MaxClients: maximum number of server processes allowed to start         # MaxRequestsPerChild: maximum number of requests a server process serves         <IfModule prefork.c>         StartServers       8         MinSpareServers    5         MaxSpareServers   20         ServerLimit      256         MaxClients       256         MaxRequestsPerChild  4000         </IfModule>              # worker MPM         # StartServers: initial number of server processes to start         # MaxClients: maximum number of simultaneous client connections         # MinSpareThreads: minimum number of worker threads which are kept spare         # MaxSpareThreads: maximum number of worker threads which are kept spare         # ThreadsPerChild: constant number of worker threads in each server process         # MaxRequestsPerChild: maximum number of requests a server process serves         <IfModule worker.c>         StartServers         4         MaxClients         300         MinSpareThreads     25         MaxSpareThreads     75          ThreadsPerChild     25         MaxRequestsPerChild  0         </IfModule>              #         # Listen: Allows you to bind Apache to specific IP addresses and/or         # ports, in addition to the default. See also the <VirtualHost>         # directive.         #         # Change this to Listen on specific IP addresses as shown below to          # prevent Apache from glomming onto all bound IP addresses (0.0.0.0)         #         #Listen 12.34.56.78:80         Listen 80              #         # Dynamic Shared Object (DSO) Support         #         # To be able to use the functionality of a module which was built as a DSO you         # have to place corresponding `LoadModule' lines at this location so the         # directives contained in it are actually available _before_ they are used.         # Statically compiled modules (those listed by `httpd -l') do not need         # to be loaded here.         #         # Example:         # LoadModule foo_module modules/mod_foo.so         #         #LoadModule auth_basic_module modules/mod_auth_basic.so         #LoadModule auth_digest_module modules/mod_auth_digest.so         #LoadModule authn_file_module modules/mod_authn_file.so         #LoadModule authn_alias_module modules/mod_authn_alias.so         #LoadModule authn_anon_module modules/mod_authn_anon.so         #LoadModule authn_dbm_module modules/mod_authn_dbm.so         #LoadModule authn_default_module modules/mod_authn_default.so         #LoadModule authz_host_module modules/mod_authz_host.so         #LoadModule authz_user_module modules/mod_authz_user.so         #LoadModule authz_owner_module modules/mod_authz_owner.so         #LoadModule authz_groupfile_module modules/mod_authz_groupfile.so         #LoadModule authz_dbm_module modules/mod_authz_dbm.so         LoadModule authz_default_module modules/mod_authz_default.so         LoadModule ldap_module modules/mod_ldap.so         LoadModule authnz_ldap_module modules/mod_authnz_ldap.so         LoadModule include_module modules/mod_include.so         LoadModule log_config_module modules/mod_log_config.so         LoadModule logio_module modules/mod_logio.so         LoadModule env_module modules/mod_env.so         LoadModule ext_filter_module modules/mod_ext_filter.so         LoadModule mime_magic_module modules/mod_mime_magic.so         LoadModule expires_module modules/mod_expires.so         LoadModule deflate_module modules/mod_deflate.so         LoadModule headers_module modules/mod_headers.so         LoadModule usertrack_module modules/mod_usertrack.so         LoadModule setenvif_module modules/mod_setenvif.so         LoadModule mime_module modules/mod_mime.so         #LoadModule dav_module modules/mod_dav.so         LoadModule status_module modules/mod_status.so         LoadModule autoindex_module modules/mod_autoindex.so         LoadModule info_module modules/mod_info.so         #LoadModule dav_fs_module modules/mod_dav_fs.so         LoadModule vhost_alias_module modules/mod_vhost_alias.so         #LoadModule negotiation_module modules/mod_negotiation.so         LoadModule dir_module modules/mod_dir.so         LoadModule actions_module modules/mod_actions.so         #LoadModule speling_module modules/mod_speling.so         LoadModule userdir_module modules/mod_userdir.so         LoadModule alias_module modules/mod_alias.so         #LoadModule substitute_module modules/mod_substitute.so         LoadModule rewrite_module modules/mod_rewrite.so         #LoadModule proxy_module modules/mod_proxy.so         #LoadModule proxy_balancer_module modules/mod_proxy_balancer.so         #LoadModule proxy_ftp_module modules/mod_proxy_ftp.so         #LoadModule proxy_http_module modules/mod_proxy_http.so         #LoadModule proxy_ajp_module modules/mod_proxy_ajp.so         #LoadModule proxy_connect_module modules/mod_proxy_connect.so         LoadModule cache_module modules/mod_cache.so         LoadModule suexec_module modules/mod_suexec.so         LoadModule disk_cache_module modules/mod_disk_cache.so         LoadModule cgi_module modules/mod_cgi.so         LoadModule version_module modules/mod_version.so              #         # The following modules are not loaded by default:         #         #LoadModule asis_module modules/mod_asis.so         #LoadModule authn_dbd_module modules/mod_authn_dbd.so         #LoadModule cern_meta_module modules/mod_cern_meta.so         #LoadModule cgid_module modules/mod_cgid.so         #LoadModule dbd_module modules/mod_dbd.so         #LoadModule dumpio_module modules/mod_dumpio.so         #LoadModule filter_module modules/mod_filter.so         #LoadModule ident_module modules/mod_ident.so         #LoadModule log_forensic_module modules/mod_log_forensic.so         #LoadModule unique_id_module modules/mod_unique_id.so         #              #         # Load config files from the config directory "/etc/httpd/conf.d".         #         Include conf.d/*.conf                   #         #ExtendedStatus On              #              #         User apache         Group apache                        #         ServerAdmin root@localhost                     #         # If your host doesn't have a registered DNS name, enter its IP address here.         # You will have to access it by its address anyway, and this will make          # redirections work in a sensible way.              #ServerName http://********:80                   # ServerName directive.         #         UseCanonicalName Off                     #         DocumentRoot "/var/www/html"              # First, we configure the "default" to be a very restrictive set of          # features.           #         <Directory />             Options FollowSymLinks             AllowOverride None         </Directory>              <Directory "/var/www/html">                   #             Options -Indexes FollowSymLinks                   #             AllowOverride None              #         # Controls who can get stuff from this server.         #             Order allow,deny             Allow from all              </Directory>                 #         # See also: http://httpd.apache.org/docs/misc/FAQ.html#forbidden         #         <IfModule mod_userdir.c>                  #             UserDir disabled                       #              #UserDir public_html              </IfModule>              DirectoryIndex index.html index.html.var              #         # AccessFileName: The name of the file to look for in each directory         # for additional configuration directives.  See also the AllowOverride         # directive.         #         AccessFileName .htaccess              #         # The following lines prevent .htaccess and .htpasswd files from being          # viewed by Web clients.          #         <Files ~ "^\.ht">             Order allow,deny             Deny from all             Satisfy All         </Files>              #         # TypesConfig describes where the mime.types file (or equivalent) is         # to be found.         #         TypesConfig /etc/mime.types                   # a good value.  If most of your content is binary, such as applications         # or images, you may want to use "application/octet-stream" instead to         # keep browsers from trying to display binary files as though they are         # text.         #         DefaultType text/plain                   # contents of the file itself to determine its type.  The MIMEMagicFile         # directive tells the module where the hint definitions are located.         #         <IfModule mod_mime_magic.c>         #   MIMEMagicFile /usr/share/magic.mime             MIMEMagicFile conf/magic         </IfModule>                   # nameserver.         #         HostnameLookups Off                   #         #EnableMMAP off                   #         #EnableSendfile off                   #         ErrorLog logs/error_log                   LogLevel warn                   LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined         LogFormat "%h %l %u %t \"%r\" %>s %b" common         LogFormat "%{Referer}i -> %U" referer         LogFormat "%{User-agent}i" agent              # "combinedio" includes actual counts of actual bytes received (%I) and sent (%O); this         # requires the mod_logio module to be loaded.         #LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio                   #         #CustomLog logs/access_log common              #         # If you would like to have separate agent and referer logfiles, uncomment         # the following directives.         #         #CustomLog logs/referer_log referer         #CustomLog logs/agent_log agent                   CustomLog logs/access_log combined              # Set to "EMail" to also include a mailto: link to the ServerAdmin.         # Set to one of:  On | Off | EMail         #         ServerSignature Off                   # We include the /icons/ alias for FancyIndexed directory listings.  If you         # do not use FancyIndexing, you may comment this out.         #         Alias /icons/ "/var/www/icons/"              <Directory "/var/www/icons">             Options Indexes MultiViews FollowSymLinks             AllowOverride None             Order allow,deny             Allow from all         </Directory>              #         # WebDAV module configuration section.         #          <IfModule mod_dav_fs.c>             # Location of the WebDAV lock database.             DAVLockDB /var/lib/dav/lockdb         </IfModule>                   ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"              #         # "/var/www/cgi-bin" should be changed to whatever your ScriptAliased         # CGI directory exists, if you have that configured.         #         <Directory "/var/www/cgi-bin">             AllowOverride None             Options None             Order allow,deny             Allow from all         </Directory>                   IndexOptions FancyIndexing VersionSort NameWidth=* HTMLTable Charset=UTF-8                   AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip              AddIconByType (TXT,/icons/text.gif) text/*         AddIconByType (IMG,/icons/image2.gif) image/*         AddIconByType (SND,/icons/sound2.gif) audio/*         AddIconByType (VID,/icons/movie.gif) video/*              AddIcon /icons/binary.gif .bin .exe         AddIcon /icons/binhex.gif .hqx         AddIcon /icons/tar.gif .tar         AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv         AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip         AddIcon /icons/a.gif .ps .ai .eps         AddIcon /icons/layout.gif .html .shtml .htm .pdf         AddIcon /icons/text.gif .txt         AddIcon /icons/c.gif .c         AddIcon /icons/p.gif .pl .py         AddIcon /icons/f.gif .for         AddIcon /icons/dvi.gif .dvi         AddIcon /icons/uuencoded.gif .uu         AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl         AddIcon /icons/tex.gif .tex         AddIcon /icons/bomb.gif core              AddIcon /icons/back.gif ..         AddIcon /icons/hand.right.gif README         AddIcon /icons/folder.gif ^^DIRECTORY^^         AddIcon /icons/blank.gif ^^BLANKICON^^              #         # DefaultIcon is which icon to show for files which do not have an icon         # explicitly set.         #         DefaultIcon /icons/unknown.gif                   # HeaderName is the name of a file which should be prepended to         # directory indexes.          ReadmeName README.html         HeaderName HEADER.html              #         # IndexIgnore is a set of filenames which directory indexing should ignore         # and not include in the listing.  Shell-style wildcarding is permitted.         #         IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t                   # * being a certain language than marking it with the wrong         # * language!         #         DefaultLanguage english              # Simplified Chinese (zh-CN) - Spanish (es) - Traditional Chinese (zh-TW)         #         AddLanguage ca .ca         AddLanguage cs .cz .cs         AddLanguage da .dk         AddLanguage de .de         AddLanguage el .el         AddLanguage en .en         AddLanguage eo .eo         AddLanguage es .es         AddLanguage et .et         AddLanguage fr .fr         AddLanguage he .he         AddLanguage hr .hr         AddLanguage it .it         AddLanguage ja .ja         AddLanguage ko .ko         AddLanguage ltz .ltz         AddLanguage nl .nl         AddLanguage nn .nn         AddLanguage no .no         AddLanguage pl .po         AddLanguage pt .pt         AddLanguage pt-BR .pt-br         AddLanguage ru .ru         AddLanguage sv .sv         AddLanguage zh-CN .zh-cn         AddLanguage zh-TW .zh-tw                   LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW              ForceLanguagePriority Prefer Fallback              AddDefaultCharset UTF-8              #         # AddType allows you to add to or override the MIME configuration         # file mime.types for specific file types.         #         #AddType application/x-tar .tgz              #         # AddEncoding allows you to have certain browsers uncompress         # information on the fly. Note: Not all browsers support this.         #AddEncoding x-compress .Z         #AddEncoding x-gzip .gz .tgz              # If the AddEncoding directives above are commented-out, then you         # probably should define those extensions to indicate media types:         #         AddType application/x-compress .Z         AddType application/x-gzip .gz .tgz              #         #   MIME-types for downloading Certificates and CRLs         #         AddType application/x-x509-ca-cert .crt         AddType application/x-pkcs7-crl    .crl              #         # AddHandler allows you to map certain file extensions to "handlers":         # actions unrelated to filetype. These can be either built into the server         # or added with the Action directive (see below)         #         # To use CGI scripts outside of ScriptAliased directories:         # (You will also need to add "ExecCGI" to the "Options" directive.)         #         #AddHandler cgi-script .cgi              #         # For files that include their own HTTP headers:         #         #AddHandler send-as-is asis              #         # For type maps (negotiated resources):         # (This is enabled by default to allow the Apache "It Worked" page         #  to be distributed in multiple languages.)         #         AddHandler type-map var              #         # Filters allow you to process content before it is sent to the client.         #         # To parse .shtml files for server-side includes (SSI):         # (You will also need to add "Includes" to the "Options" directive.)         #         AddType text/html .shtml         AddOutputFilter INCLUDES .shtml              # Action lets you define media types that will execute a script whenever         # Format: Action media/type /cgi-script/location         # Format: Action handler-name /cgi-script/location         #                   # Some examples:         #ErrorDocument 500 "The server made a boo boo."         #ErrorDocument 404 /missing.html         #ErrorDocument 404 "/cgi-bin/missing_handler.pl"         #ErrorDocument 402 http://www.example.com/subscription_info.html         #              #         # Putting this all together, we can internationalize error responses.         #         # We use Alias to redirect any /error/HTTP_<error>.html.var response to         # our collection of by-error message multi-language collections.  We use          # includes to substitute the appropriate text.         #         # You can modify the messages' appearance without changing any of the         # default HTTP_<error>.html.var files by adding the line:         #         #   Alias /error/include/ "/your/include/path/"         #         # which allows you to create your own set of files by starting with the         # /var/www/error/include/ files and         # copying them to /your/include/path/, even on a per-VirtualHost basis.         #              Alias /error/ "/var/www/error/"              <IfModule mod_negotiation.c>         <IfModule mod_include.c>             <Directory "/var/www/error">                 AllowOverride None                 Options IncludesNoExec                 AddOutputFilter Includes html                 AddHandler type-map var                 Order allow,deny                 Allow from all                 LanguagePriority en es de fr                 ForceLanguagePriority Prefer Fallback             </Directory>              #    ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var         #    ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var         #    ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var         #    ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var         #    ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var         #    ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var         #    ErrorDocument 410 /error/HTTP_GONE.html.var         #    ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var         #    ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var         #    ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var         #    ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var         #    ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var         #    ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var         #    ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var         #    ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var         #    ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var         #    ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var              </IfModule>         </IfModule>              #         # The following directives modify normal HTTP response behavior to         # handle known problems with browser implementations.         #         BrowserMatch "Mozilla/2" nokeepalive         BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0         BrowserMatch "RealPlayer 4\.0" force-response-1.0         BrowserMatch "Java/1\.0" force-response-1.0         BrowserMatch "JDK/1\.0" force-response-1.0              #         # The following directive disables redirects on non-GET requests for         # a directory that does not include the trailing slash.  This fixes a          # problem with Microsoft WebFolders which does not appropriately handle          # redirects for folders with DAV methods.         # Same deal with Apple's DAV filesystem and Gnome VFS support for DAV.         #         BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully         BrowserMatch "MS FrontPage" redirect-carefully         BrowserMatch "^WebDrive" redirect-carefully         BrowserMatch "^WebDAVFS/1.[0123]" redirect-carefully         BrowserMatch "^gnome-vfs/1.0" redirect-carefully         BrowserMatch "^XML Spy" redirect-carefully         BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully


Debian vs Mint?

I am new to linux and I can't decide whether to choose Debian or Linux Mint for my first distribution. Linux Mint is based on Ubuntu (if I understood right), and Ubuntu is based on Debian. But as I saw Ubutnu is really slow when works at booting has long time. I should also mention that I want to be able to tinker with it as well. I want to learn how linux (and computers) work. Thanks for the help.


How to grep recursively in order of last modified time?

`grep -r` does a recursive search in all files in a particular directory. However, if I want these files to be read by grep in the order of their last modified time, how do I do that?


SSH: "Permission denied" after changing user shell

I have an SSH server running on my Raspberry PI with ALARM (up to date). My user "gitroot" is meant to use the git-shell. However, when i set `/usr/bin/git-shell` as shell for gitroot in `/etc/passwd`, i can't login with that user anymore. `su - gitroot` works as expected. When i change the shell to `/bin/bash`, i can login as gitroot via ssh. The permissions of `/usr/bin/git-shell` and `/bin/bash` are the same. I tried changing the password, it didnt change anything. Output from `journalctl -f`:               Jul 23 09:05:27 netberry sshd[4213]: pam_unix(sshd:auth): authentication failure;logname= uid=0 euid=0 tty=ssh ruser= rhost=localhost.localdomai...r=gitroot     Jul 23 09:05:40 netberry sshd[4213]: Failed password for gitroot from 127.0.0.1 port 51969 ssh2     Jul 23 09:07:25 netberry sshd[4213]: Connection closed by 127.0.0.1 [preauth]     Jul 23 09:07:29 netberry sshd[4222]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=localhost.localdomai...r=gitroot     Jul 23 09:07:43 netberry sshd[4222]: Failed password for gitroot from 127.0.0.1 port 51970 ssh2     Jul 23 09:08:07 netberry sshd[4222]: Failed password for gitroot from 127.0.0.1 port 51970 ssh2     Jul 23 09:08:08 netberry sshd[4222]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=localhost.localdomai...r=gitroot     Jul 23 09:08:10 netberry sshd[4222]: Failed password for gitroot from 127.0.0.1 port 51970 ssh2     Jul 23 09:08:10 netberry sshd[4222]: Connection closed by 127.0.0.1 [preauth]      The log shows multiple attemps to log in as gitroot over ssh from the host itself (i just typed `ssh gitroot@localhost` into the console.


Identifier must be declared

Hi I am new to Shell scripting , and I am facing this issue for days, can someone help me out? my snippet :                  filename='somefile_Connectivity_12345.CSV'        trimfilename= echo $filename| cut -d'_' -f 2        if '$trimfilename'='Connectivity'        then         echo "loop1"        elif '$trimfilename'='Red'        then      echo " loop2"     elif ' $trimfilename'='Blue'     then     echo "loop3'     end if;      I am facing an error saying "identifier must be declared. It worked fine if I didnt have the elif parts in place.


NFS connection refused

I want to set up a filesharing server with NFS. But when I want to show the conetnts of export I get this:               manuel@server ~ $ showmount     clnt_create: RPC: Port mapper failure - Unable to receive: errno 111 (Connection refused)      What is wrong with it?


mpd: no audio output with PulseAudio, no mixing with ALSA

I am trying to use mpd with PulseAudio output. Thus I wrote the following in `/etc/mpd.conf`:               music_directory "/mnt/dados/Musicas"     playlist_directory "~/.mpd/playlists"     db_file "~/.mpd/mpd.db"     log_file "~/.mpd/mpd.log"     pid_file "~/.mpd/mpd.pid"     state_file "~/.mpd/mpdstate"     user "renan"          audio_output {        type         "pulse"        name         "MPD Output"     }          mixer_type         "software"      mpd is running as user `renan`. However, I get no output; appears this in mpd.log:               Feb 15 20:24 : output: Failed to enable "MPD Output" [pulse]: pa_context_connect() has failed: Connection refused     Feb 15 20:24 : output: Failed to enable "MPD Output" [pulse]: pa_context_connect() has failed: Connection refused     Feb 15 20:24 : output: Failed to enable "MPD Output" [pulse]: pa_context_connect() has failed: Connection refused     Feb 15 20:24 : output: Failed to enable "MPD Output" [pulse]: pa_context_connect() has failed: Connection refused     Feb 15 20:24 : output: Failed to enable "MPD Output" [pulse]: pa_context_connect() has failed: Connection refused     Feb 15 20:24 : output: Failed to enable "MPD Output" [pulse]: pa_context_connect() has failed: Connection refused      If I try to use ALSA by adding the lines below to `/etc/mpd.conf`, `mpd` works but it blocks the audio device: if I open any other software that plays sound it will be unable to play sound, and vice-versa.               audio_output {        type         "alsa"        name         "My ALSA Device"        device         "hw:0,0"          format         "44100:16:2"        }      The rest of my system has no problem outputting audio through PulseAudio. What am I doing wrong? I run x64 Arch Linux and have the following MPD/PulseAudio related packages installed:               lib32-libpulse 3.0-1     libmpd 11.8.17-1     libmpdclient 2.7-1     libpulse 3.0-2     mpd 0.17.3-1     mpdscribble 0.22-6     pulseaudio 3.0-2     pulseaudio-alsa 2-2     python2-mpd 0.3.0-4


Can ssl folder be removed without causing conflict

In `/etc/httpd` the `ssl` folder, if that is removed does that mean any site on the server if directed to `https://` will not throw warning? I got a certificate a while back but soon realized if not a paid certificate would be useless for visitors to site because a pop up would warn them of the site being untrusted. Now I simply want to remove it and am wondering if this `ssl` folder is the one to delete or if I must do other steps to ensure I've reversed the process of a "free" certificate. I'd rather have none at all than a bogus one.


Where can I "hide" easter eggs for students learning about Linux security?

I feel like this isn't the best place to ask this (since there's no single right answer), but I can't think of a better place. If you have a better recommendation, could you please recommend it and I can move the question rather than just having it closed outright? I'm teaching a class of high-school students about general Linux security. At a high level I want them to be able to take a given Linux server and know how to harden it against common security issues - e.g. closing old accounts, using a strong pw hashing algorithm, make sure no strange processes are running or run at boot. Their skill-level is a broad range, and I'm looking for ways to motivate them to use what we've been discussing (e.g. look at crontab; look at users and group configurations; look at open ports). I have been given $200 to hold a competition to encourage them, and I thought maybe I could purchase a bunch of Amazon gift cards in $10 increments. The idea would be to "hide" the redemption codes in various places on our sandbox server for the kids to find. For example, I could store the passwords in plaintext, and have one of the example user accounts assigned a password of one of the codes. Or maybe I could set up a cron job to log one of the codes to a system log every 30 seconds. What I'm looking for is places/methods to hide these codes such that someone looking to secure the server would stumble across them. Thanks!


In bash, can I asynchronously open sockets and use them later?

I had no idea that Bash supported so many advanced features! I started working on a simple network program to try and use some of these things I found. My particular program is a basic redis client written completely in Bash. Currently, I can do something like the following:               redis_command -c "ping" redis{001..100}:{6379..6400}      It will send the "ping" command to all of the instances (about 2100) and return the results. I'm currently sending the "ping" command serially, but I thought I could speed up my program by doing all of the initial socket creation in parallel. I tested my program with/without the optimization, and realized that my optimization actually slowed things down. Here's how the optimization looks:               declare -A SOCKETS     function get_socket {       # args: <hostname> <port>       # returns: the socket number, or failure return code            # verify args       if [[ -z "${1}" ]]; then         return 1       fi       if [[ -z "${2}" ]]; then         return 1       fi            local HOSTPORT="${1}:${2}"       if [[ -z ${SOCKETS[${HOSTPORT}]} ]]; then         exec {fd}<>/dev/tcp/${1}/${2}         SOCKETS[${HOSTPORT}]=${fd}         RES=${fd}       else         RES="${SOCKETS[${HOSTPORT}]}"       fi     }          if [[ ${PRECONNECT} -eq 1 ]]; then       echo -n "Pre-connecting to ${#HOSTS[@]} instances... " >&2       for HOST in ${HOSTS[@]}; do         get_socket "${HOST%%:*}" "${HOST##*:}" &         PIDS+=($!)       done            # make sure all of our async connections finished before starting       # TODO, check for errors       for PID in ${PIDS[@]}; do         wait ${PID}       done       echo "done" >&2     fi      Normally, the get_socket() function on its own works great. If I ever need to send a command to a particular server, I call get_socket() ahead of time, and pass the FD to another function that actually sends the command and parses the response. In the pre-connect scenario, I'm calling get_socket in the background via &. Since get_socket()& runs in a separate process, the FD created isn't available/accessible in the calling process, so my optimization is useless. Is there any way to send sockets in bash, or some other way that I can parallelize my connects without using a separate process?


How do you add a package (or a mirror?) if the .rpm you're looking for isn't available in your VM build of CentOS?

I have yum and rpm, and I really only know how to install packages using these commands. When I tried to yum install figlet on a new CentOS6 virtual machine it couldn't find it in the mirrors list. I tried to localinstall a figlet package but it wasn't signed and yum wouldn't install it. OR better yet how do you got about adding a package (or a mirror?) if the .rpm you're looking for isn't availabe in your VM build of CentOS? In this case I want to add figlet and toilet! **UPDATE** If I install a package manually, do I need to do it from a particular directory? or does Yum/RPM have a dir they always use automagically?


uuencode Command not found but man working fine

I am trying to mail using `uuencode` but it says `command not found` while if I check man, I get it proper without any error. Is it that my binary has gone and just docs remaining ? This is unusal though !


backupninja: password outside config file

I would like to use a `dup` rule in backupninja to make an encrypted remote backup. The configuration file format includes entries for the encryption and ftp password. I would like to move them out of the configuration file, so that I can throw the config file inside a git repository for versioning without leaking my passwords. Is there a simple way to do that?


Samba no longer allowing different guest account per share

I sure hope I don't make a fool of myself with this but here goes... I've updated Samba from 3.0.33 to 3.6.9 (well, upgraded my OS and this update came with it) and have found certain features I heavily rely on to have been removed. Samba 3.0.33 allowed me to create several guest/anonymous shares and specify the user/group ownership of newly created files in those writable shares. For example, a "www" share where new files would be owned by apache:apache, a general purpose "dropbox" share owned by smbuser:smbuser, etc. Here's a (cut down) version of my 3.0.33 `smb.conf`:               [global]       cups options = raw       server string = Network Storage       security = share       workgroup = MyWorkgroup       passdb backend = tdbsam       follow symlinks = yes       wide links = yes       unix extensions = no       public = yes       guest account = smbuser       force user = smbuser       force group = smbuser       create mask = 0664       force directory mode = 0775          [dropbox]       comment = DropBox       path = /mnt/publicstorage       writable = yes       browsable = yes          [www]       comment = Web files       path = /var/www/html       writable = yes       browsable = yes       guest account = apache       force user = apache       force group = apache       create mask = 0664       force directory mode = 0775      I put `guest account = smbuser` in `[global]` because I actually have a lot more shares where it applies but only in a few shares I would override it with, say `guest account = apache` as in the example above. Unfortunately, `security = share` is deprecated and I've been instructed to adjust it to: security = user map to guest = bad user guest account = smbuser Apparently now (according to the Samba developers), you can only have one guest account defined and it has to be in `[global]` which means all files created in each and every share will be owned by smbuser. I've been told I can use `force user` and `force group` but only `force group` seems to be working for me. It creates files with ownership: smbuser/apache in the `www` share. Spent days trying to find a solution, different settings combinations in `smb.conf`, tried Samba 4.0.0 on a test box too but no luck. If anyone knows how I can configure newer Samba versions to work like before I'd be extremely grateful.


Why do I get a 403 error when visiting /javascript on my website?

I was just playing around with a small web application I wrote today, wetagg.in. When I visit the site with a path, like http://wetagg.in/unix, it will take `unix` as input and render content accordingly. This is all great, until I visit http://wetagg.in/javascript and get a 403 error. Naturally, I check my logs and they say: > `[Wed Jul 09 00:27:43 2014] [error] [client ...] Directory index forbidden > by Options directive: /usr/share/javascript/` Why would the request be interpreted as an access to `/usr/share/javascript`? The directory exists, but the problem is not reproducible with other folders in `/usr/share`, like with http://wetagg.in/python In case it isn't obvious, I have _not_ set up any rewrite rules in this regard for the virtual host myself and this behavior actually affects all websites hosted on the server. The virtual host configuration can be inspected as a gist. But, as I said, the problem affects all sites hosted on the server. The application itself is available on GitHub.


Is it safe to delete old boot and EFI System partitions?

I have installed a new OS in the free space of the same hard disk after failing to upgrade the old one. Now there are two copies of boot partitions and EFI System partitions. After a harrowing experience deleting the partition containing the old OS where old swap is located, I am not confident to remove the rest of the partitions related to it. Despite reading up Wikipedia articles pertaining to UEFI and GPT, I don't think I have gained sufficient overview of how the booting process works. Especially how the UEFI bootloader manages to find the correct EFI System partition (I have two) to boot up the new OS. Now I hope someone can enlightenment me on this issue so that I can gain some confidence and decide whether it is safe to delete the old boot (sda1) and EFI System (sda2) partitions.


How can I access my work computer via SSH (Teamviewer works)?

I have a Ubuntu 11.10 system both at home and at work. I would like to connect to my work computer via SSH but it is inaccessible (even `ping` does not work). Teamviewer however does work, and I thought perhaps the `ssh` port 22 was blocked, so tried accepting SSH connections via ports 80 (http), 443 (https), and 5938 (tcp/udp). Still not working. Any ideas how I can connect to the computer via SSH? Also, any ideas why TeamViewer works over port 80 whereas SSH does not?


Shell Script To Find Windows Partitions and Replace Desktop Image

I am in need of a shell script that will detect Windows partitions and replace the desktop image and place an image on the Desktop. I need it to detect if there are multiple disks in on the computer, so it will do this to all disks in the computer, so if the user has two hard drives with two Windows OS and two usernames, it will do all of them. Can anyone help me with this ?


What YUM is doing after completing process

For instance when we executed               yum update     yum localinstall xyz      at the end of process when it shows               Complete!      and when we execute the next any yum command still it shows               Another app is currently holding the yum lock; waiting for it to exit...      my questions are:   * what type of process it would be doing after displaying final message of complete?   * if we kill this process does it harm to the system?


Where should xt.vim be put on osX?

Cracking xDebug open, finally and looking to add the vim formatting file from xDebug.org. It says to "copy" the file to `~/.vim/syntax`. But such a directory doesn't exist on osx 10.6. I don't see `xt.vim` on the computer either, but did find it on github. `which vim` returns `/usr/bin/vim`


What is Lintian for?

I have read https://lintian.debian.org/ but do not understand what that means in simple words. Which are examples of debian policy rules to be violated and detected by lintian?


Taking the Linux Install CD out during Installation?

I'm installing rhel and need to install a driver during installation. The plan is to 'linux dd' at the boot promt and install then. However, I just wanted to know if there would be an issue with removing the Linux install cd at that time to install the driver using a cd, and if so, if there is a workaround. This is because both the driver and Installation are on cds and I only have one disk drive. Moving 1 to different media is not an option.


How can I make Ctrl + Alt act like Alt gr in Ubuntu?

I recently switched to Ubuntu on my laptop and one thing that almost got me to switch back to windows is the fact that I can't make Ctrl + Alt to act like Alt gr. I have programmed in several years and for example I'm so used to make the sign "$" by pressing "ctrl + alt + 4". Here in Ubuntu I have to use "Alt gr + 4" witch almost makes me insane... Is there a fix for this?


LibreOffice Calc Didn't Read Data with a formula (Error?)

So I have a data like this :               (First Number) (=RIGHT(A1, 3))     19132 132     56112 112      So, the second column formula is =RIGHT(A1,3) and so on. When I created the graph, it's show zero data, there are no data in the graph. But when I tried change the second column with data (not a formula), the graph can read the data now... Why doesn't my LibreOffice Calc read any data if I put formula into the cell?


Copy file from USB drive to a desktop loaded via a LiveCD

I have booted my computer using a LiveCD and want to copy a file from a USB drive to the LiveCD loaded desktop. I want to copy a file from the USB drive to the desktop environment in memory, which has been loaded by the LiveCD. I do not want to copy a file onto the actual LiveCD itself. I appreciate the copied file will disappear, when the OS loaded via the LiveCD has been switched off. I have tried the following:               sudo cp "/location_of_usb_file/file.dat" "location_on_live_cd_environment_folder"      But I get the following error:               cp: cannot stat 'file.dat': Permission denied      If I do:               ls -l      I get :               -rw------- 1 ubuntu ubuntu 65546 May 30 12:00 file.dat      How do I copy the file?


Sorting data faster approach

I need to sort a `bed` file randomly 10000 times and take the top 1000 rows each time. Currently, I am using the following code:               for i in {1..100}; do         for j in {1..100}; do             sort -R myfile.bed_sorted | tail -n 1000 > myfile.bed.$i.$j.bed         done     done      It takes almost 6 hours to do this for each file. I have around 150 of them to be worked out. Is there a faster solution for this? A sample of the data (myfile.bed_sorted) I have:                   chr1    111763899   111766405   peak1424    1000    .   3224.030    -1  -1         chr1    144533459   144534584   peak1537    998 .   3219.260    -1  -1         chr8    42149384    42151246    peak30658   998 .   3217.620    -1  -1         chr2    70369299    70370655    peak16886   996 .   3211.600    -1  -1         chr8    11348914    11352994    peak30334   990 .   3194.180    -1  -1         chr21   26828820    26830352    peak19503   988 .   3187.820    -1  -1         chr16   68789901    68791150    peak11894   988 .   3187.360    -1  -1         chr6    11458964    11462245    peak26362   983 .   3169.750    -1  -1         chr1    235113793   235117308   peak2894    982 .   3166.000    -1  -1         chr6    16419968    16422194    peak26522   979 .   3158.520    -1  -1         chr6    315344  321339  peak26159   978 .   3156.320    -1  -1         chr1    111756584   111759633   peak1421    964 .   3110.520    -1  -1         chrX    12995098    12997685    peak33121   961 .   3100.000    -1  -1         chr9    37408601    37410262    peak32066   961 .   3100.000    -1  -1         chr9    132648603   132651523   peak32810   961 .   3100.000    -1  -1         chr8    146103178   146104943   peak31706   961 .   3100.000    -1  -1         chr8    135611963   135614649   peak31592   961 .   3100.000    -1  -1         chr8    128312253   128315935   peak31469   961 .   3100.000    -1  -1         chr8    128221486   128223644   peak31465   961 .   3100.000    -1  -1         chr8    101510621   101514237   peak31185   961 .   3100.000    -1  -1         chr8    101504210   101508005   peak31184   961 .   3100.000    -1  -1         chr7    8173062 8174642 peak28743   961 .   3100.000    -1  -1         chr7    5563424 5570618 peak28669   961 .   3100.000    -1  -1         chr7    55600455    55603724    peak29192   961 .   3100.000    -1  -1         chr7    35767878    35770820    peak28976   961 .   3100.000    -1  -1         chr7    28518260    28519837    peak28923   961 .   3100.000    -1  -1         chr7    104652502   104654747   peak29684   961 .   3100.000    -1  -1         chr6    6586316 6590136 peak26279   961 .   3100.000    -1  -1         chr6    52362185    52364270    peak27366   961 .   3100.000    -1  -1         chr6    407805  413348  peak26180   961 .   3100.000    -1  -1         chr6    32936987    32941352    peak26978   961 .   3100.000    -1  -1         chr6    226477  229964  peak26144   961 .   3100.000    -1  -1         chr6    157017923   157020836   peak28371   961 .   3100.000    -1  -1         chr6    137422769   137425128   peak28064   961 .   3100.000    -1  -1         chr5    149789084   149793727   peak25705   961 .   3100.000    -1  -1         chr5    149778033   149783125   peak25702   961 .   3100.000    -1  -1         chr5    149183766   149185906   peak25695   961 .   3100.000    -1  -1


Shell script (bash) to add or replace the license text contained within .c , .h and makefiles?

I have a set of *.c , *.h and Makefiles in a folder where some files contain the license text and some files don't have any license text. So I need a shell script where I can add license text if the file doesn't have any, and if license text is already there then I want to replace that with the new license text. ### For example               Folder1     ┣━ *.c     ┣━ *.h     ┣━ Folder2     ┃  ┣━ *.c     ┃  ┣━ *.h     ┃  ┣━ Makefiles     ┃  ┗━ Folder4     ┗━ Folder3        ┣━ *.c        ┣━ *.h        ┗━ Makefiles      **NOTE:** the license text will always be at the beginning of the files. Example of existing License text:               # Copyright (C) 2008 Jack <abc@cba.com>          # This file is free software; as a special exception the author gives     # unlimited permission to copy and/or distribute it, with or without     # modifications, as long as this notice is preserved.      and new license text should be:               /*---------------------------------------------------------------------          Copyright © 2014  Author Name          All rights reserved          ----------------------------------------------------------------------*/      and for Makefiles it should be:               # ---------------------------------------------------------------------     # Copyright © 2014  Author Name     #     # All rights reserved     # ----------------------------------------------------------------------


how to remove ctrl F in unix file

While editing a unix file I'm getting data as below in vi editor.               MGW:^FVMG107     MGW:^FVMG113     MGW:^FVMG108     MGW:^FVMG103      where in above data `^F` is not viewable in `cat` command. I have tried `dos2unix` & `sed` also, but it still exists. How can I remove `^F`


linux interface to get connected IPs

Is there an interface to get the currently connected IPs and their state in Linux? I am aware of `ss` and `netstat`, but I want to use `/proc/` or some other "official" kernel interface that already has them (if it exists). If it doesn't exist where would I start to get this information? Basically, I need an interface that has this information so I can retrieve it programmatically.


Backreferencing with sed

I have a database containing a list of unsigned longs representing a bunch of memory addresses followed by an offset within two brackets (e.g. `Mem[offset]`, `0x2322AD4[3]`), and some other data. What I am trying to achieve is separate the offset from the memory address by replacing the opening bracket with a single space and get rid of the closing bracket. The procedure I'm taking goes as follows:   1. Find every digit that is followed by an opening bracket (this is because my other data may contain a bracket that should NOT be messed with).   2. Replace ONLY the bracket with a single space.   3. Find every digit that is followed by a closing bracket, and ONLY replace the closing bracket with a single space. The brackets could be easily handled with the following two commands:               sed 's/\[/ /' #replace the opening bracket with a single space.          sed 's/\]//' #delete the closing bracket      But again, I don't want to mess with the other data stored in the database. My second guess was getting back-referencing involved to handle the job. Is it possible to tell `sed` to find every digit followed by an opening brace and back-reference the digit and add a space right after it, resulting in something like this: > 0x2322AD4 3] So then I can just go ahead and use the second command mentioned above to get rid of the closing brace? If there is a whole difference approach to solve the problem, please post.


How to perform a multiline grep across multiple files?

I'm trying to grab this pattern wherever it occurs in multiple log files (Note:these patterns can vary greatly in size, i.e. the amount of Blahs):                  Found an txt File         Blah         Blah         10019874         Blah         Blah         Processed File         Using this command line:                pcregrep -M 'Found an.*(\n|.)*10019874.*(\n|.)*Processed' log_*.txt      My regex checks out REGEX HERE I'm using pcregrep with the -M multiline flag. It will in any log files which begin 'log_' and end '.txt'. When I run this command it returns 'Segmentation Fault' Is there a simpler/better way to do this?


How do I save all vim buffers on tmux window change?

Is it possible to hook up vim save all command on tmux window change? I know that gui vim has option to save on focus lost. I'd like to have similar behavior in console.


How to create custom commands in Unix/Linux?

I'm a newbie in Unix/Linux environment. Can anyone guide me to create custom commands in Unix/Linux. Thanks in advance


How to insert lines with numbers from X to Y into another file after line Z?

I created two files:               echo -e "1\n2\n3\n4\n5" > 123.txt     echo -e "a\nb\nc\nd\ne" > abc.txt      I want to get the file `123.txt` with the following contents:               1     2     3     b     c     d     4     5      So in other words insert the rows with numbers from 2 to 4 of the file `abc.txt` into the file `123.txt` after the third line. I have reviewed the many similar questions here, but did not find a suitable answer. Nevertheless I got the lines:               sed -n '2,4p' abc.txt      and put some text into the file after the third line:               sed -i '3a\mytext' 123.txt      How to do this using the previous command stdout or/and a `sed`/`awk` single command?


VPN issues on web browsing

I'm using Ubuntu Maverick and this is the setup: Our router connects us to the company's VPN through which we can access some internal websites. I have to connect also to a customer's VPN in order to use remote desktop and their websites daily. This customer has a web interface to connect to its VPN, it launches a Java App which signs us in and lets us use the services on their network. When I do this, I loose access to my company's VPN services (websites) in all browsers. This doesn't happen in the rest of the (Windows) boxes, and I'm the only one using GNU/Linux on the office. Right now, I log out of the customer's VPN to access the company's services, but I'm sure there's some solution so that I can use both VPNs together. **Edit:** The customer's VPN is used via a Juniper Networks login (a Java Client), and I get automatically connected into the company's VPN through the router.


How to install Adobe Acrobat Reader in Debian?

I've got `deb http://debian-multimedia.org squeeze main` in " **/etc/apt/sources.list** ", but `wajig update && wajig install acroread` results in:               E: Package ‘acroread’ has no installation candidate      What’s happening? Are there alternative repos?


Difference between environment variables and exported environment variables in bash

Bash seems to differentiate between variables which have been exported and those which have not. example:               $ FOO=BAR     $ env | grep FOO     $ set | grep FOO     FOO=BAR      `set` sees the variable but `env` does not.               $ export BAR=FOO     $ env | grep FOO     BAR=FOO     $ set | grep FOO     BAR=FOO     FOO=BAR      `set` sees both variables but `env` sees only the exported variable. I know that `set` is a bash builtin and `env` is not. What are the differences between variables which are exported and those which are not?


Problem using awk

I have a problem using awk. Print, from every file given as a parameter, the number of line that has the length at least 10. Also, print the content of that line(s), except the fist 10 characters. At the end of the analysis of a file print the name of the file and the number of lines printed. This is what I've done so far:               {     if(length($0)>10)     {      print "The number of line is:" FNR      print "The content of the line is:" substr($0,10)      s=s+1     }     x= wc -l //number of lines of file     if(FNR > x)      {      print "This was the analysis of the file:" FILENAME      print "The number of lines with characters >10 are:" s     }     }      This prints the name of the file and the number of lines after every line that has at least 10 characters but I want something like this:               print "The number of line is:" 1     print "The content of the line is:" dkhflaksfdas     print "The number of line is:" 3     print "The content of the line is:" asdfdassaf     print "This was the analysis of the file:" awk.txt     print "The number of lines with characters >10 are:" 2


Priority for "always on top" X windows

I have two windows on my Xfce desktop that need to be open all the time and they are set to _always on top_. They overlap each other, whenever I click on one of them, that's expected behaviour. Is possible somehow to give one of them a certain priority, so both of them stay always on top, but window 1 stays always over window 2?


Mounting USB drive that is not recognized

Using Arch Linux / XFCE, I frequently have problems with USB drives that are not properly mounted. Sometimes they automatically show up in Thunar and I can mount them with one click. However, at other times (it's about fifty/fifty) the drive is just not recognized. I have had this problem with USB External Hard Drives, USB Memory Sticks, and cameras. If the external drive is not recognized, this is the situation:   * The drive does not show up at `fdisk -l` at all (it only shows my hard drives)   * The drive does not appear at `/dev/disk`   * The drive _DOES_ appear when running `lsusb` So there is some sort of recognition, but I do not understand why, nor do I know how to mount the drives when this happens. I just reboot and hope it works next time, which is clearly not convenient... UPDATE When I monitor `/var/log/everything.log` (no info in syslog), then I see this happen when plugging in the USB:               Dec 14 15:36:32 localhost kernel: [ 6591.042911] usb 1-3: new high speed USB device number 9 using ehci_hcd     Dec 14 15:36:32 localhost mtp-probe: checking bus 1, device 9: "/sys/devices/pci0000:00/0000:00:1d.7/usb1/1-3"     Dec 14 15:36:32 localhost mtp-probe: bus: 1, device: 9 was not an MTP device      This is another requested output:               $udevadm monitor     monitor will print the received events for:     UDEV - the event which udev sends out after rule processing     KERNEL - the kernel uevent          KERNEL[6809.192268] add      /devices/pci0000:00/0000:00:1d.7/usb1/1-3 (usb)     KERNEL[6809.193421] add      /devices/pci0000:00/0000:00:1d.7/usb1/1-3/1-3:1.0 (usb)     UDEV  [6809.299246] add      /devices/pci0000:00/0000:00:1d.7/usb1/1-3 (usb)     UDEV  [6809.306074] add      /devices/pci0000:00/0000:00:1d.7/usb1/1-3/1-3:1.0 (usb)


How do I install PHP5.4.16 on Debian Wheezy?

I used to be able to install `php-5fpm=5.4.16-1~dotdeb.1`, but it seems that this package is no longer available from the latest dotdeb packages. Here are the steps I tried.   1. Append the following two lines in `/etc/apt/sources.list`. `deb http://packages.dotdeb.org wheezy all` `deb-src http://packages.dotdeb.org wheezy all`   2. Run `apt-get update`.   3. Run `apt-get install php5-fpm=5.4.16-1~dotdeb.1`. However, this returns `E: Version '5.4.16-1~dotdeb.1' for 'php5-fpm' was not found`. I tried to avoid it by using a different respository, namely, `deb http://packages.dotdeb.org wheezy-php54 all`, but this returned the same message. How can I install that specific version of PHP?


Lightweight utility/program to run a command after a random delay

I need to randomize the time before a given command starts. I realize it's relatively trivial to do this within a script, or to write a "wrapper" script to do this, but I'm wondering if anyone knows a lightweight binary program that's already out there that will accomplish this without requiring an interpreter to be loaded. EDIT: More specifically, I do not want to involve bash in any way. Assume for the sake of argument that no shell is available and I'm invoking this from a non-interactive program.


How to get info about given webserver FAST?

$ time nmap -q -sV -P0 -p80 google.com | fgrep '80/tcp open'     80/tcp open  http    Google httpd 2.0 (GFE)          real    0m6.563s     user    0m0.280s     sys 0m0.016s     $       Are there any **faster** methods to get info about the webserver? Google httpd 2.0 (GFE) is enough


Computer logs out when resuming from sleep

When I leave my laptop for a while, after it blacks the screen (as I configured XScreensaver to do), when I return, it awakens to the login screen. When I login, there is no trace of my previous session. If I open Update Manager afterwards and it had been performing and update, it says something about a partially performed update, but doesn't go about updating; it doesn't say broken packages. This is on clean installs (except for an update manager run) of both Linux Mint 10 LXDE and Lubuntu 10.04 LTS. It didn't happen on Debian LXDE but I hadn't connected that to the internet to do an update. EDIT: My `.xsession-errors` , `Xorg.0.log` , and `Xorg.0.log.old` are hosted at this google docs .zip upload and I'm on a mac right now so I had to mv away the `.` from the beginning of the filenames and I added `.txt` to the ends. EDIT: I had a badly stated question without a question mark. My question is: How can I stop this? Is this a hardware issue? Is this an issue with Ubuntu? X.org?


What is the difference between vi and vim?

As far as I know `vi` is more commonly found on out-of-the-box unix systems while `vim` often has to be installed. Also `vim` stands for `vi improved`, but improved how? What are the main differences?


Is there such thing as a "free" equivalent to Microsoft Virtual Server?

As the title says, is there? I'm a student, I'd love to play around with this technology without the fear of my licence disappearing the day I graduate from college (as it might with the Microsoft Virtual Server licence from Dream Spark. Anyone any suggestions?


LMMS instruments don't play full notes

Here is an image of the piano01.ogg instrument in LMMS. ![enter image description here](http://i.stack.imgur.com/dQgHc.png) As you can see by the wave graph, holding down the key will play a nice note that starts out loud and smoothly decreases in volume. While, punching the key and quickly releasing will only play less than half of this waveform. This behavior seems ALL WRONG to me. I believe that by default LMMS instruments should play out the entire waveform regardless of whether the key is held down or not. Then you should have the option to do otherwise if you should choose. I assume that there is a way to get LMMS to play entire notes. Can someone tell me where this option is hidden? I would also like to know if there is a better stack exchange for getting help regarding linux audio production.


What software allows the change of runtime-environment, while keeping the same kernel running?

I know that with a GNU/Linux distribution you can switch between different distributions at runtime when they use the same kernel or the kernel is compatible between 2 or more different distributions; I never used this feature of the Linux-based OSs, but I would like to ask what is the software/s that makes this possible and how to perform this switch at runtime correctly. It will be nice to also have a list of pros and cons, for example what settings I loose and what I can keep during the switch.


Arch Linux: Strange version mismatch when trying to install UWSGI with pacman. Is this common / trivial?

When I run `pacman -S uwsgi` or `pacman -S community/uwsgi` I get the following error:               resolving dependencies...     looking for inter-conflicts...          Packages (6): jansson-2.5-2  libxml2-2.9.1-5  libyaml-0.1.4-3                   python2-2.7.6-1  sqlite-3.8.2-1  uwsgi-1.9.20-1          Total Download Size:    0.27 MiB     Total Installed Size:   69.85 MiB          :: Proceed with installation? [Y/n] Y     :: Retrieving packages ...          error: failed retrieving file 'uwsgi-1.9.20-1-x86_64.pkg.tar.xz' from         archlinux.mirrors.uk2.net : The requested URL returned         error: 404 Not Found     warning: failed to retrieve some files     error: failed to commit transaction (download library error)     Errors occurred, no packages were upgraded.      This would indicate to me that the package is not on the server. However I tried a number of mirrors and got the same result. I then investigated further, by directing my web browser to the mirror directory and confirmed that there is a `uwsgi` package there, but the version is later:               uwsgi-1.9.21.1-1-x86_64.pkg.tar.xz      I am fairly new to Arch so don't know if I'm missing something obvious here. On Debian my response would be to run `apt-get update`, but can't find a similar facility in `pacman`: My understanding is that the `-S` option will take care of that as well as installing the package. Could this be a case of mirrors not being synced properly, or am I missing something simple at the client end? If the mirror contains a later version, why isn't my `pacman` command picking that up?