Why are my two virtual machines getting the same IP address?

I have two virtual machines both running on a Linux host (Fedora 16). I set both adapters as attached to NAT. When I boot them up they both have their default gateway set to `10.0.2.2`. They also both have the same IP address `(10.0.2.15)`. They are both on the same adapter (adapter 1). I don't know why they are getting assigned the same IP address, and shouldn't the default gateway be `10.0.2.1` since the subnet address is `10.0.2.0` and the netmask is 255.255.255.0. Is there something I am missing, has this happened to anyone before? How do I get the VirtualBox DHCP working properly?


Is there a more elegant way to unlink two tmux clients sharing a session from inside tmux?

This is almost a code-review question, but very *nixy and more about configuration than code. For years since I switched to `tmux` from `screen` I've had a couple of nagging issues that I could not make work the way I wanted them to. Since I setup my shell to exec into a tmux session I finally decided it was time to fix this one. By default when you attach two tmux clients to the same session, they are locked together. Switch panes in one and both switch in sync. This is different from screen where the default behavior was a shared set of panes but the client itself was independent. What I've wanted was a way to un-bind two tmux clients attached to the same session. This is easy enough to do if you are outside of tmux and launching a new client. Just start a new session with a reference to the parent one:               tmux new-session -t original_session -s new_session      However try do do this _after_ you are in a client and want to unlink it from whatever other client is sharing that session and things get more complicated. I tried dozens of ways and never hit on one that worked well. The closest I got was using `bind <key> prompt-command ...` to prompt for both the old and new session names. **For whatever reason tmux does not expand the`#{session_name}` variable inside arguments for a `new-session` or `prompt- command`.** It does in arguments to many other commands (e.g. I use it in `run` below) but without that expansion this particular task becomes suddenly complicated. Even with manually entering the values, it only ever sorta worked. Today I finally got it to work. The result, however, is uglier that I would have liked. It requires a shell function to do most of the magic. In order to contain this to just the config file without involving external scripts (for dotfile portability) I'm using a hack. The config, if you crop off the first two columns, is actually executable as a shell script. With everything wrapped in functions, you can call just the part of the script you need from any keybinding. The shell script bits are comments in the config, while in shell script made the config bit is discarded with a here-doc. Todays solution came out something like this (my full `.tmux.conf` file):               # : << ENDOFCONF          # Clear the default binding     unbind C-c     # Pass the name of the current session to a function to clone it     bind C-c run "cut -c3- ~/.tmux.conf | sh -s clone #S"          # ENDOFCONF     # clone () {     #   orig=${1%-*}     #   copy="$orig-$(($( tmux list-sessions -F '#S' | sed -nE "/^${orig}-[0-9]+$/{s/[^0-9]//g;p}" | tail -n1 )+1))"     #   TMUX= tmux new-session -d -t $orig -s $copy     #   tmux switch-client -t $copy     #   tmux set -q -t $copy destroy-unattached on     # }     # $@      Mind you this works. From a running tmux client, `Ctrl`+`B` `Ctrl`+`C` creates a new session with a number appended to the name of the current one, uses the current one as a target for the panes, and switches to it. I'm happy with this except for the nagging idea that I've just made something simple much more complex than it needs to be. Is there a simpler way to achieve this?


How to install Vinux on a mac?

I have no experience with Linux, nor with installing any OS in any other way then just putting a CD-ROM in a computer and following instructions. To get some more insight into how operating systems work, I'm planning to install a Linux distro. Vinux seamed the best option for visually impaired people so that's the one I chose. The problem I'm having is that on the vinux site they only mention installing on windows. How would I install vinux on a mac? I would prefer it if it would be possible to just install it on a partition on my hard drive, or even better, on an external hard drive, so I can use it on multiple computers, but again, I have no idea if this is possible.


Mouse + network turned off after suspend

(After upgrade from Debian Wheezy to Jessie), my mouse is not turning on again, when I wake up my computer. I don't know if my computer hibernating or suspended to ram. Is there something that I can add to /etc/pm/... ? gnome-control-center and gnome-tweak-tool have no options. Also my network is turned off, but this is also so case when booting, so might be a different problem.


openSuse, not running the cron job

I have created a cron job in the `/etc/cron.d/dispatchingEmail_I` the permissions of `dispatchingEmail_I` are the following:               -rw-r--r--   1 root root    84 Sep 11 19:52 dispatchingEmail_I      content of the `dispatchingEmail_I` is:               54 19 * * * root /home/harbir/project/L_ocalRepository/smallworks/maildispatcher.sh      when I check `/var/log/messages` I can see an entry               2014-09-11T19:54:01.761269+10:00 linux-gn77-PC /USR/SBIN/CRON[4109]: (root) CMD (/home/harbir/project/L_ocalRepository/smallworks/maildispatcher.sh)      which tells me that the command has run, but no email has been received. where as when I run the script by itself, the email is received. the permissions of the file `maildispatcher.sh` are the following:               -rwxrwx---  1 harbir users      621 Sep 10 06:33 maildispatcher.sh      how can I achieve to run maildispatcher.sh with the cronjob. Contents of the `maildispatcher.sh` are the following:               java -cp ./build/classes/:./WebContent/WEB-INF/lib/commons-email-1.2.jar:./WebContent/WEB-INF/lib/mail-1.4.jar:./WebContent/WEB-INF/lib/hibernate-core-3.3.1.GA.jar:./WebContent/WEB-INF/lib/dom4j-1.6.1.jar:./WebContent/WEB-INF/lib/slf4j-api-1.5.10.jar:./WebContent/WEB-INF/lib/slf4j-jdk14-1.5.8.jar:./WebContent/WEB-INF/lib/mysql-connector-java-5.1.14.jar:./WebContent/WEB-INF/lib/commons-collections-3.2.jar:./WebContent/WEB-INF/lib/javassist-3.4.GA.jar:./WebContent/WEB-INF/lib/log4j-1.2.15.jar:./WebContent/WEB-INF/lib/transaction-api-1.1.jar:./WebContent/WEB-INF/lib/antlr-2.7.6.jar  com.smallworks.mail.MailProcessor      when I run a simple command with the cronjob it works, when the contents of the cronjob file is               50 05 * * * root echo checking >>/tmp/try2.log       I think its having trouble running the script as follows.               54 19 * * * root /home/harbir/project/L_ocalRepository/smallworks/maildispatcher.sh      can anyone suggest some changes that can be tried.


Why will the C++ Library not disable, GCC

I've been up all night trying to get this to work. I got the second to latest gcc and latest binutils and am attempting to create a cross compiler on a debian system. For some reason, GCC won't compile which is something i've never had to deal with before. I get this error:               make[2]: Leaving directory `/home/dylan/Documents/cross/gcc-build/fixincludes'     Configuring in ./gmp     configure: error: invalid feature name: libstdc++-v3     make[1]: *** [configure-gmp] Error 1     make[1]: Leaving directory `/home/dylan/Documents/cross/gcc-build'     make: *** [all] Error 2      with this configuration: ../gcc-4.9.0/configure \ \--target=$TARGET \ \--prefix=$PREFIX \ \--with- sysroot=/mnt \ \--with-newlib \ \--without-headers \ \--with-local- prefix=/tools \ \--with-native-system-header-dir=/tools/include \ \--disable- nls \ \--disable-shared \ \--disable-multilib \ \--disable-decimal-float \ \--disable-threads \ \--disable-libatomic \ \--disable-libgomp \ \--disable- libitm \ \--disable-libquadmath \ \--disable-libsanitizer \ \--disable-libssp \ \--disable-libvtv \ \--disable-libcilkrts \ \--disable-libstdc++-v3 \ \--enable-languages=c,c++ I ran linux from scratches version check and got this:               bash, version 4.2.37(1)-release     /bin/sh -> /bin/bash     Binutils: (GNU Binutils for Debian) 2.22     bison (GNU Bison) 2.5     /usr/bin/yacc -> /usr/bin/bison.yacc     bzip2,  Version 1.0.6, 6-Sept-2010.     Coreutils:  8.13     diff (GNU diffutils) 3.2     find (GNU findutils) 4.4.2     GNU Awk 4.0.1     /usr/bin/awk -> /usr/bin/gawk     gcc (Debian 4.7.2-5) 4.7.2     GNU C Library (Debian EGLIBC 2.13-38+deb7u4) stable release version 2.13     grep (GNU grep) 2.12     gzip 1.5     Linux version 3.2.0-4-amd64 (debian-kernel@lists.debian.org) (gcc version 4.6.3 (Debian 4.6.3-14) ) #1 SMP Debian 3.2.60-1+deb7u3     m4 (GNU M4) 1.4.16     GNU Make 3.81     patch 2.6.1     Perl version='5.14.2';     GNU sed version 4.2.1     tar (GNU tar) 1.26     Texinfo: makeinfo (GNU texinfo) 4.13     xz (XZ Utils) 5.1.0alpha     Compilation OK      I don't think this is a bug as I see it on google, however all of these fixes and hints I see are not my problem. It seems as though the C++ library will not disable.


Copy/Paste with keyboard in rxvt

I know that I can copy and paste text in `rxvt` by using the middle mouse button, but I was wondering if there was a way to define keyboard-shortcuts in the `.Xdefaults` for copy and pasting text. Moreover it would be really awesome if it would be possible to select the text with the keyboard as well. **EDIT:** Trying to use urxvt-perls does not seem to work (maybe because of the zsh-VI- bindings?). When I try running the script from the command line I also get the following errors:               % perl keyboard-select      Bareword "urxvt::ControlMask" not allowed while "strict subs" in use at keyboard-select line 137.     Bareword "urxvt::ControlMask" not allowed while "strict subs" in use at keyboard-select line 151.     Execution of keyboard-select aborted due to compilation errors.      Unfortunately I know nothing about a perl and have no idea if this is anyhow related to it not working in urxvt itself. **strong text**


Setting up Kolab Mail Server on Cent OS. The port number '389' is not available for use error?

I use: `setup-kolab` and all goes well , except an error is returned:               The port number '389' is not avaialble for use.      This may be due to an invalid port number, or port already being in use by another program.      So I use:               netstat -lntp | grep :389      It returns:               tcp        0      0 :::389           :::*            LISTEN      15697.ns-slapd      What now? Should I exit the program, or specific a different port for Kolab (I tried this but there were no arguments to set it)


Manually adding static ip not resolved after a while

Hi Unix/Linux community, I have a small problem with a device I am connecting to my laptop, running Debian Linux. While connected to a router on my `wlan1` interface (using wicd, if that matters), I am adding a static ip to my `eth0` interface using something like `ip addr add 192.168.0.2/24 dev eth0`. The address and routes are registered correct, but I cannot contact the device until a later point in time. If I try to ping it, I get a number of 'destination host not reachable'. Eventually the device answers and I am able to communicate with it - but not after waiting for this seemingly arbitrary period. Do you have any ideas what could be causing this? Why can't it just resolve the device immediately? Thanks for your help!


Linux / Windows 8.1 : Installation on raid0

I need to install a linux distribution on my laptop (an Asus UX302LA). I tried again and again but I couldn't even begin the installation. To explain you my problem, I know that Windows 8 is installed on UEFI mode. Furthermore, I have discovered that I have a raid0, probably a software one, in my laptop. I tried to install the latest version of Ubuntu and Mint, both 64bits. I find some tutorials on the internet but I'm so afraid about formating all my datas (and also the recovery partitions). Can someone help me by giving me a good tutorial or by explaining all I have to do ? Thank you for your help !


Files that do not exist, prevent me from deleting them, corrupted filesystem

Well... It's about on an OS X system (hfs+), but that's unix after all to. :p system has become unbootable, due to a filesystem error... fsck.hfsplus fails because ....                   ...         ** Checking Catalog file.            Illegal name                 illegal name is 0xB1 03 0D 03 BB 03 BF 03 B3 03 BF 03 2F 00 C3 03 B5 03 BB 03 2E 00 33 00 37 00 2E 00 74 00 69 00 66 00                 replacement name is 0xB1 03 01 03 BB 03 BF 03 B3 03 BF 03 2F 00 C3 03 B5 03 BB 03 2E 00 33 00 37 00 2E 00 74 00 69 00 66 00         ....         ** Repairing volume.                 replacement name already exists                 duplicate name is 0xB1 03 01 03 BB 03 BF 03 B3 03 BF 03 2F 00 C3 03 B5 03 BB 03 2E 00 33 00 37 00 2E 00 74 00 69 00 66 00                 FixIllegalNames - repair failed for type 0x23B 571         ** The volume Macintosh HD could not be repaired.         ...      using find -mtime I managed to locate some problematic files, that.... do not actually exist....                   # ls -lhai         ls: cannot access USB 프린터 공유: No such file or directory         ls: cannot access 시동 디스크: No such file or directory         ls: cannot access 애플 메뉴 선택사항: No such file or directory         ls: cannot access 인터넷: No such file or directory         ls: cannot access 파일 관리자: No such file or directory         total 0         152704 drwxr-xr-x 1 root root  7 Apr 23 16:49 .         152677 drwxr-xr-x 1 root root 18 Apr 23 14:55 ..              ? -????????? ? ?    ?     ?            ? 애플 메뉴 선택사항              ? -????????? ? ?    ?     ?            ? 시동 디스크              ? -????????? ? ?    ?     ?            ? 파일 관리자              ? -????????? ? ?    ?     ?            ? 인터넷              ? -????????? ? ?    ?     ?            ? USB 프린터 공유      rm -r on them simply does not have any result or error. rmdir and rm -rf on the parent directory do not do the trick, because "the directory is not empty". Tried to touch those files and                   # ls -lhai         ls: cannot access USB 프린터 공유: No such file or directory         ls: cannot access 시동 디스크: No such file or directory         ls: cannot access 애플 메뉴 선택사항: No such file or directory         ls: cannot access 인터넷: No such file or directory         ls: cannot access 파일 관리자: No such file or directory         total 0         152704 drwxr-xr-x 1 root root  7 Apr 23 16:52 .         152677 drwxr-xr-x 1 root root 18 Apr 23 14:55 ..              ? -????????? ? ?    ?     ?            ? 애플 메뉴 선택사항              ? -????????? ? ?    ?     ?            ? 시동 디스크              ? -????????? ? ?    ?     ?            ? 파일 관리자              ? -????????? ? ?    ?     ?            ? 인터넷              ? -????????? ? ?    ?     ?            ? USB 프린터 공유         # touch USB\ 프린터\ 공유          # ls -lhai         ls: cannot access 시동 디스크: No such file or directory         ls: cannot access 애플 메뉴 선택사항: No such file or directory         ls: cannot access 인터넷: No such file or directory         ls: cannot access 파일 관리자: No such file or directory         total 0          152704 drwxr-xr-x 1 root root  8 Apr 23 17:09 .          152677 drwxr-xr-x 1 root root 18 Apr 23 14:55 ..               ? -????????? ? ?    ?     ?            ? 애플 메뉴 선택사항               ? -????????? ? ?    ?     ?            ? 시동 디스크               ? -????????? ? ?    ?     ?            ? 파일 관리자               ? -????????? ? ?    ?     ?            ? 인터넷         4641964 -rw-r--r-- 1 root root  0 Apr 23 17:09 USB 프린터 공유         4641964 -rw-r--r-- 1 root root  0 Apr 23 17:09 USB 프린터 공유      dual entries with the same inode...                   # rm -f U*      but that also brings me to the initial situation                   # ls -lhai         ls: cannot access USB 프린터 공유: No such file or directory         ls: cannot access 시동 디스크: No such file or directory         ls: cannot access 애플 메뉴 선택사항: No such file or directory         ls: cannot access 인터넷: No such file or directory         ls: cannot access 파일 관리자: No such file or directory         total 0         152704 drwxr-xr-x 1 root root  7 Apr 23 16:52 .         152677 drwxr-xr-x 1 root root 18 Apr 23 14:55 ..              ? -????????? ? ?    ?     ?            ? 애플 메뉴 선택사항              ? -????????? ? ?    ?     ?            ? 시동 디스크              ? -????????? ? ?    ?     ?            ? 파일 관리자              ? -????????? ? ?    ?     ?            ? 인터넷              ? -????????? ? ?    ?     ?            ? USB 프린터 공유      any ideas of anything I could try????


Does sudo a command temporarily change $PATH to be the root's?

1. When running `sudo <command>` under a user login session, will that change `$PATH` to be the root's `$PATH` during the running of `sudo <command>`?   2. If `<command>` relies on the user's `$PATH`, not the root's `$PATH`, how can the user run `sudo <command>` successfully?     * One way is to `sudo su` to be the root, change the root's `$PATH` to be the user's, and run `<command>` directly. This is how I solved my problem of How to specify a higher ruby version for installing a gem?.     * Any way simpler?     * Can it be done without switching to the root from the user? Thanks!


Kali tools on Ubuntu

Okay, So I am new to UBUNTU, and have little experience with Kali and Backtrack! so I wanted to install **ALL** the Kali Linux tools in UBUNTU, not one by one, or just transform the Kali Linux into Ubuntu does anyone have the answer, I couldn't find any related questions asked before :\ ## if u don't know about all the tools, so no problem But I need these tools :D : >   1. AirCrack > >   2. Burp Suite > >   3. Hydra > >   4. John the Ripper > >   5. Maltego > >   6. Metasploit Framework > >   7. Armitage > >   8. Zed Attack Proxy > >   9. Sqlmap > >   10. Wireshark > >   11. address6 > >   12. Deblaze > >   13. Tnscmd10g > >   14. BBQSQL > >   15. Blueranger > >   16. Lynis > >   17. DotDotPwn > >   18. Netgear-telnetable > >   19. Terminator > >   20. Htexploit > >   21. Jboss-autopwn > >   22. Websploit > >   23. Bluepot > >   24. Spooftooph > >   25. Smartphone-Pentest-Framework > >   26. Fern-Wifi-cracker > >   27. Wi-fihoney > >   28. Wifite > >   29. Creddump > >   30. Johnny > >   31. Manglefizz > >   32. Ophcrack > >   33. Phrasendresher > >   34. Rainbowcrack > > > > 35.Acccheck > > 36.Smbexec


How do I validate a settings(ini) file for the values expected using bash?

After I check if the ini file exists where it is expected to be, which I've learned how to do, I would like to check the file for proper formatting. I'd like to validate any number of "site" entries in the file and check that each entry adheres to the pattern below including the new line.                1| [site1]      2| shortcut=x1      3| site=example1.com      4| theme=alpha      5|      6| [site2]      7| shortcut=x2      8| site=example2.com      9| theme=beta     10|        I've got the individual values being validated as they are being read. I just want to make sure the pattern is correct before processing the file echoing the line number where the pattern breaks if it isn't.


Mint Debian Install - Thinkpad T430s Problem

I wanted to try out the Linux Mint Debian. I downloaded an iso, checked it and then dd it on a usb stick. I boot on the usb fine and Mint is starting, but then it looks like that : ![Mint live display problem on hd4000](http://i.stack.imgur.com/cmUo9.jpg) The desktop limits are halfway across the screen. The colors aren't right and are flickering. It looks like a graphic driver problem to me... Everything seems to work fine except that. I have a Lenovo t430s with HD4000 graphics. I tried to start the Mint live in compatibility mode, but the same thing happened. Could I fix this somehow?


Rsyslog Problem, Custom Template

I have a problem with `rsyslog`. bellow is my configuration ,partial. This is File Name Template:               $template DynFile,"/data/router-log/%HOSTNAME:::lowercase%/%timegenerated:1:10:date-rfc3339%_%$HOUR%"     $template SrxFile,"/data/router-log/fw-srx5800-msl-116-1/%timegenerated:1:10:date-rfc3339%_%$HOUR%"      This is File Content Template:               $template FileFormat,"%TIMESTAMP:::date-rfc3339% %HOSTNAME% [] %rawmsg:7:29:%%rawmsg:36:$%\n"     $template CGFormat,"%TIMESTAMP:::date-rfc3339% %HOSTNAME% %msg%\n"     #          #    Second Part     #     $FileOwner root     $FileGroup root     $umask 0000     $CreateDirs on     $DirCreateMode 0644     $FileCreateMode 0644     $RepeatedMsgReduction off     $EscapeControlCharactersOnReceive on     $DynaFileCacheSize 100          # Rules          :source , !isequal , "localhost" ?DynFile;FileFormat      This system was doing its job for 1 year without any problem. It was collecting log from a remote device. Log desity is arround 50k to 60k lines per second.I was using "RSYSLOG_TraditionalFileFormat". After that log was parsing with customer software. Once remote device software was upgraded, old template stopped working. That's why I build my own template. I had to use %rawmsg% instead of %msg% variable. But now I have problems. One of them is "last message repeated n times" start appearing at the end of lines. This broke the system. Second I start seeing uncompleted lines which also broke system. I got stuck and can not find what is the problem as some files are picked up fine but some are not. I want to open "$RepeatedMsgReduction on " which can help may be in reducing unwanted duplicate lines, but this time I receive "last message repeated .. " at the end and I can not parse the file Any suggestion to how can I fix this problem ? Could `rsyslog` struggle due to custom template and this cause duplication ? Using DiskQueues or MemoryQueues can fix my problem or not ?


nmcli no longer allow settings modification?

When I try to modify network manager settings with nmcli, it says `Error: 'con' command 'modify' is not valid.` So if `nmcli con modify XXX` command is no longer supported, what is the substitute? **EDIT** nmcli version: `nmcli tool, version 0.9.8.8` networkmanager version: `networkmanager 0.9.8.8-1` I'm running Arch Linux


Digital audio between Intel Atom E640 and ADAU1445

Background information: I have a ADAU1445 DSP from Analog Devices connected to multiple audio sources through the Serial Input pairs. One of these sources is an Intel Atom E640 processor running Angström Linux, connected specifically to input pair 8 on the ADAU1445. Also, the clock lines from the Intel is connected to the ADAU1445 no. 8 clock lines. Research: It appears that the ADAU1445 accepts a range of different digital audio formats (TDM2 (Stereo), TDM4, TDM8, TDM16). But the Atom E640 outputs in Intel High Definition Audio format (codename Azalia). My understanding of the specifics is not very good. But in my research, i think i have discovered that the snd_hda_intel ALSA driver in the Linux kernel is responsible for the output. Question: Is it possible to write a custom ALSA driver, that will output audio over the same pins as the original snd_hda_intel driver, but in I2S TDM2 (Stereo) format instead of Intel HDA (Azalia) format? I am not even sure whether or not my questions is valid, or if i have made some false assumptions, so any help or comments is appreciated!


Where to put wrapper scripts?

I created some scripts for administrative tasks etc, I made them to be independent from environment - every dependency is injected through arguments. However it is annoying to provide to script commonly used dependencies every time I run it, and I don't want to hardcode in it any local information, so I created wrappers. I put my general scripts in $HOME/bin but where should I put wrappers that contain local information and are only for speeding up invocation? **Example:** Think about script that makes and sends to given ftp server encrypted system backup. It was made as a generic script that can be used with any gpg public keys or ftp servers, however I'm using always only specific public key and uploading it only to specific ftp server, so I created a wrapper with this information. This generic script is actually in /root/bin as this is administrative tool, but where to put that wrapper?


RHEL6: Failed Dependencies when installing a package

Hi I'm getting errors when forcing to install unixODBC package on RHEL 6 here is the following error: http://flic.kr/p/jBEFvP I don't know where to get the following packages that were needed by the unixODBC package


How does Linux "kill" a process?

It often baffles me that, although I have been working professionally with computers for several decades and Linux for a decade, I actually treat most of the OS' functionality as a black box, not unlike magic. Today I thought about the `kill` command, and while I use it multiple times per day (both in its "normal" and `-9` flavor) I must admit that I have absolutely no idea how it works behind the scenes. From my viewpoint, if a running process is "hung", I call `kill` on its PID, and then it suddenly isn't running anymore. Magic! What really happens there? Manpages talk about "signals" but surely that's just an abstraction. Sending `kill -9` to a process doesn't require the process' cooperation (like handling a signal), it just kills it off.   * How does Linux stop the process from continuing to take up CPU time?   * Is it removed from scheduling?   * Does it disconnect the process from its open file handles?   * How is the process' virtual memory released?   * Is there something like a global table in memory, where Linux keeps references to all resources taken up by a process, and when I "kill" a process, Linux simply goes through that table and frees the resources one by one? I'd really like to know all that!


How to display the current keyboard layout?

Is there a utility that allows to graphically display the current keyboard layout? This can be useful, for example, when writing in a foreign language and having the physical keyboard only indicating the local language (positioning of symbols, etc.). I would like to get a display similar to the following: ![enter image description here](http://i.stack.imgur.com/t8Tjq.png)


At what frequency is /var/log/wtmp updated?

What daemon is in charge of updating this file and at what frequency does it run ? When I type in `last reboot` I see :               reboot   system boot  3.5.0-45-generic Wed Jan 15 16:24 - 09:49 (14+17:24)       reboot   system boot  3.5.0-45-generic Wed Jan 15 16:04 - 09:49 (14+17:45)        and one minute later I see that it changed too (09:49 -> 09:50) so I guess the file is updated frequently. Also why in this case are there 2 'reboot' sessions active ?


Smarter log rotation

I want to reduce the amount of logs in my system, but reduce them smartly. The general idea is, each time you rotate, look for any warning/error/critical level logs, and keep 2 minutes of log context (before and after), regardless of its log level. The rest of logs would be simply discarded. The current alternatives seem to be, either log _everything_ and needlessly use copious amounts of disk, or just filter by specific log levels and forget any chances you had at actually trying to debug the problems. Is there any log rotating or syslog system for Debian that can work like that?


Is a restart of cron or crond necessary after each new schedule addition or modification?

When I schedule a job, some seem to be applied immediately, while others after a reboot. So is it recommended to restart `cron` (`crond`) after adding a new cron job? How to do that properly (esp. in a Debian system), and should that be done with `sudo` (like `sudo service cron restart`) even for that of normal users'? I tried:               /etc/init.d/cron restart      which doesn't seem to work (neither does `/etc/init.d/cron stop` or `service cron stop`) and completes with return code 1. Here's a part of the message output: > Since the script you are attempting to invoke has been converted to an > Upstart job, you may also use the stop(8) utility, e.g. stop cron stop: > Rejected send message, 1 matched rules; type="method_call", sender=":1.91" > (uid=1000 pid=3647 comm="stop cron ") interface="com.ubuntu.Upstart0_6.Job" > member="Stop" error name="(unset)" requested_reply="0" > destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init") _(what does that mean?)_


Samba - releasing file lock

Our (Windows) users are starting a program from a shared subdirectory on a Debian server. They use samba to access this directory. When we want to release a new version of the program the started files (program file and libraries) are locked. To release these locks we restart the samba service. After restarting all locks are released and the new files can be copied to the directory. The only disadvantage is that the users are losing all the handles to the files in all directories which are served by samba on this server. We are starting Keepass from another subdirectory and Keepass crashes afterwards. Is there a nicer way of releasing the locks (in a single directory) ? Is there a way to separate the samba shares ?


Is there html documentation finder/searcher, like info utility for info files?

Many packages have their documentation in html. Is there some sort of `man` or `info` utility to **find** locally installed html documentation and work with it? **I mean, I need a program which would conveniently search for files of html documentation.** And then open it, and browse through it, and maybe some search engine, and cookies please. It would be the best if there were some root html file with links to all of the installed html documentation. Otherwise, I need to use `find` to find the file and then I open it in firefox. I also could look up where documentation files are in synaptic.. But all of this is not convenient in many ways. Of course, one could write a couple scripts to search through the documentation etc. But I thought since the html documentation exists for many packages (and it won't go anywhere in near future) there could be a tool to work with it already. _(the situation with html docs is like if you had only files with man pages and no`man` utility)_ **I do not mean to open html in a terminal.**


How to set Sublime Text as default text editor? The only option I see is Pluma. I'm using Mate Desktop on Fedora 19. ![enter image description here](http://i.stack.imgur.com/LpWqw.png) Edit: The Sublime Text executable (installed by hand, not a package) is at `/home/matt/sublime_text_3/sublime_text`.


How to edit context menu in Elementary OS' Files manager (pantheon-files)?

(I am new with Elementary OS and am not sure how to ask questions on their website. So this might be a cross-posting; I cannot find my question posted there.) I have seen here that the entries in the context menu of the file manager can be edited as `.contractor` files in `/usr/share/contractor/`. That case is about adding "open terminal here", and I was able , following that model, to add "open folder as root" - as presented here. A such `.contractor` file would look like this:               [Contractor Entry]     Name=Open folder as root     Icon=gksu-root-terminal     Description=Open folder as root     MimeType=inode;application/x-sh;application/x-executable;     Exec=gksudo pantheon-files -d %U     Gettext-Domain=pantheon-files      I would like to know if various (terminal) commands can be created in the same way, and what the different lines in a `.contractor` mean and how to change them for a certain purpose. I would like to add a command that would convert files, similarly to what is possible through Thunar custom actions - like here, here and here. I need to know how to restrict the context menu command to a certain type of selected files - I guess that could be done in the line`MimeType=`. Also the `Exec=` line is important. May I have a bit of advice in this sense and maybe a link to a tutorial on the matter? * * * UPDATE: A contractor file running a script that was created to open music file in foobar200 through Wine works for me in this form:               [Contractor Entry]     Name=Open in Foobar     Icon=foobar2000     Description=open in foobar     MimeType=inode;application/x-sh;application/x-executable;     Exec=/home/cipricus/scripts_var/foobar_open_in.sh %F     Gettext-Domain=pantheon-files      But this adds to foobar2000 playlist all music files in the folder (and its subfolders). How to restrict this to selected files/folders?


WGET - Authenticating root AND all children folders

Before I start the question off, I want to say that a similar question helped me get past the initial login. My issue is as stated below. There's a website that I'm trying to mirror. It is something that I have an account for. I'm using wget as my tool of choice. I tried curl, but found that while submitting post data is easy with it, wget is better equipped for the task at hand. The website has an initial login page that it redirects to. After this, you have access to everything on the website. Logins do timeout after so long, but that's it. With the wget commands below, I was able to successfully save my cookies, load them, and download all child folders. My issue, however, is that each child has an index.html of the same login page. It's like the cookie worked fine for the root folder but nothing beneath it. The commands I used were:               wget http://site.here.com/users/login --save-cookies cookies.txt --post-data 'email=example@test.com&password=*****&remember_me=1' --keep-session-cookies --delete-after     wget http://site.here.com/ --load-cookies cookies.txt --keep-session-cookies -r -np      Note that the post-data variables/ids are different and that I had to download the login page to see what they were. Secondly, note that if I didn't put remember_me value to 1 that cookies.txt would be different. Without remember_me=1               .here.com    TRUE    /   FALSE   numbershere   CAKEPHP   garbagehere      With remember_me=1               site.here.com  FALSE   /   FALSE   numbershere   CakeCookie[rememberme]   garbage     .here.com    TRUE    /   FALSE   numbershere   CAKEPHP   garbagehere      The result being that the former would only download the login page and the latter getting to all child folders, only with children containing index of login and that's it. I'm kind of stuck and my experience with wget and http is very limited. What would you do to get past this? Generate a cookie for each child? How would you automate that instead of manually creating a cookie file for each child? P.S: I'm using Linux if that reflects the answers I'm given.


Adding ALSA module in Python in Linux

I have recently started working in linux, I wanted to to add ALSA module in my Python. I have used this,               sudo apt-get install libasound2-dev      After that I've installed pyalsa package,               pyalsa installation,     wget ftp://ftp.alsa-project.org/pub/pyalsa/pyalsa-1.0.14rc3.tar.bz2          tar xf pyalsa-1.0.14rc3.tar.bz2          $ python setup.py build          # python setup.py install      but when I type help(alsaaudio) in the Python, it gives error that there is no such module According to the alsaaudio, (http://pyalsaaudio.sourceforge.net/pyalsaaudio.html) > Note: the wrappers link with the alsasound library (from the alsa-lib > package) and need the ALSA headers for compilation. Verify that you have > /usr/lib/libasound.so and /usr/include/alsa (or similar paths) before > building. I do not understand what does that mean and what I am doing wrong in adding Alsa module in Python.


Tiling windows in GNOME

How can I get tiling windows in GNOME?


FastCGI library for C#/Mono

I'd like to write a couple of fastcgi applications in c#. I know that Mono can run ASP.NET on fastcgi enabled web servers, but that is not what I need. Is there any FastCGI library working for .NET/Mono?


Help with the sort command (numeric)

I have this output I'd like to sort numerically by port (starting at the 35th column):               tcp        0      0 192.168.0.210:110       0.0.0.0:*  LISTEN  3385/dovecot     tcp        0      0 192.168.0.210:143       0.0.0.0:*  LISTEN  3385/dovecot     tcp        0      0 192.168.0.210:22        0.0.0.0:*  LISTEN  2223/sshd     tcp        0      0 192.168.0.210:25        0.0.0.0:*  LISTEN  3589/master     tcp        0      0 192.168.0.210:443       0.0.0.0:*  LISTEN  2037/apache     tcp        0      0 192.168.0.210:587       0.0.0.0:*  LISTEN  3589/master     tcp        0      0 192.168.0.210:80        0.0.0.0:*  LISTEN  2037/apache     #                                 ^     #                                 Sorted at this column (#35)      So that the new output looks like this (lowest port first):               tcp        0      0 192.168.0.210:22        0.0.0.0:*  LISTEN  2223/sshd     tcp        0      0 192.168.0.210:25        0.0.0.0:*  LISTEN  3589/master     tcp        0      0 192.168.0.210:80        0.0.0.0:*  LISTEN  2037/apache     tcp        0      0 192.168.0.210:110       0.0.0.0:*  LISTEN  3385/dovecot     tcp        0      0 192.168.0.210:143       0.0.0.0:*  LISTEN  3385/dovecot     tcp        0      0 192.168.0.210:443       0.0.0.0:*  LISTEN  2037/apache     tcp        0      0 192.168.0.210:587       0.0.0.0:*  LISTEN  3589/master     #                                 ^     #                                 Sorted at this column (#35)      I've played around with all different forms of `|sort`, including:               |sort -n         # <- I thought this would work     |sort -nk35     |sort -nk35,37      Etcetera, etcetera. Maybe I'm misunderstanding the purpose of the `-k` flag? Or maybe those colons are messing things up?


Full network logging via linux firewall ( iptables )?

How truly enable full network logging via iptables? There is an option `--log-prefix` to add a tag to log entries. But the log entries don't show all complete packets. What a grand way to enable full logging for any network packets of any OSI levels. ICMP, TCP/IP, arp, eth? I really appreciate the squert project, the front end of snort. What kind of front end for iptables does the same? I'm looking for logger. ![example of fron-end\(squert\) #1](http://i.stack.imgur.com/yG6dh.png) ![example of fron-end\(squert\) #1](http://i.stack.imgur.com/NJdEZ.png)


swap space allocation vs swaptotal

I created a Red Hat 9 virtual machine on VMware Workstion 9 by allocated the physical memory of 256MB. See pic. ![physical memory](http://i.stack.imgur.com/6P1z7.png) When installing Linux, I created the swap partition with a size of 256MB. See picture. ![Add Partition](http://i.stack.imgur.com/MKAn5.png) And got the partitioning like below. ![Partitioning list](http://i.stack.imgur.com/HJxbq.png) But after the installation completed, I checked through the command               cat /proc/meminfo      I got the result               SwapTotal:     1052248 kB     SwapFree:      1047956 kB      I got a screenshot ![enter image description here](http://i.stack.imgur.com/CbSjn.png) Which is very confusing. Is the size of the swap space decided by the "Add Partition" during OS installation process?


ethtool get permanent MAC address returns all 0's

I need to read permanent (burned-in) MAC address of network adapter. Since MAC address can be easily spoofed, I need to read the real one which is written on EEPROM. I need to do it using C++ on Linux. I tried using ethtool which is quite good and works fine. However on some systems it does not work as intented.               ethtool -P eth0      returns this:               Permanent address: 00:00:00:00:00:00      and               ethtool -e eth0      returns this:               Cannot get EEPROM data: Operation not supported      * * * Network Adapter has following info:   * driver: ucc_geth   * version: 1.1   * firmware-version: N/A   * bus-info: QUICC ENGINE Linux kernel version is: 2.6.32.13 Question is: Can i fix this issue with any update(driver, kernel etc)? Additionally, I make the same ethtool calls with `ioctl` function in C++. Is there any way to fix this inside the code? Or is there any other way to get the permanent MAC address from EEPROM?


How can I unveal files on my external hard drive?

I copied a big folder (around 110 GB) from my (Mac 10.7.5) computer onto a hard drive (exFAT). It took quite some time and afterwards I even checked that the files were actually there. After more copying of other folders, I deleted all the source folders on my computer (and also the trash can) and unplugged the harddrive. Then I saw that the big folder on my hard drive was empty, not containing any data (the other folders are still there). When analyzing the hard drive (under linux) I found this: ![Properties of the Partition Miel](http://i.stack.imgur.com/a3XWv.png) So it seems that the sum of all files only makes up 680 GB while there are actually 799 GB used! The difference is probably the exact size of my missing data. Is there any way to access or unveal this data? Additional info:   * I named the Folder MASTER. But now there are two folders there. One is named MASTER and one is named Master.    * Both folders are completly empty, there are no hidden files.


How to detect which keyboard device is being used

I'm working on a computer with two keyboards and two users. They are using different layouts. The two keyboards are identical. Their device ID can be found easily with `xinput`, but when typing we can't tell them apart. Therefore, when setting the alternative layout, we have to just try one and revert and try the other one it if it doesn't work. **Is there some way to find the keyboard ID, as understood by`setxkbmap -device`, when typing?** To elaborate, the current approach is simply to run `xinput` to find the device IDs of both keyboards. Then we change the layout of one with `setxkbmap -device [device number] -layout ...` and type a couple characters to check if it changed the right keyboard. If not we reset the keyboard with another `setxkbmap` command and run the first command with the other device ID. Ideally the solution would plug into this:               setxkbmap -device $(command which prints the device ID at the first keypress) -layout ...      I tried `xev`, but that doesn't seem to indicate which keyboard device actually sent the event.


Why can't I disable some of the services in system-config-services?

I'm developing a kiosk like PC so it doesn't need most of the services. ### Questions   1. Why can't we disable some services showed in `system-config-service`?   2. Is there any way to disable all (or at least most) of the services that show up in `system-config-services`?


Change where mlocate stores the database?

Looks like it's not configurable through `/etc/updatedb.conf`, and not mentioned in its manual as well. So can I change that?


Allowing outgoing emails that will be delivered to localhost only

I operate a Linux system where I give out free Linux shell accounts to people for educational purposes. Unfortunately, while doing so it's expected to meet abusive users who will keep sending spam emails to other servers such as Google, Zoho, etc and hence will get the IP of the server blocked. What I would like to do is allow the users on the system to send messages within localhost only. This means that when a user tries to send out an email to an external domain name, GMail for example, the request will be refused. However, if the user tries to send an email to another user on localhost (example: giovanni@localhost), the message will be sent. I don't mind receiving emails from other servers, but I don't want my server to send emails to other servers. How can I do so? I'm running **CentOS 6.5 with Postfix** installed. How can I configure this? Any suggestion will be hugely appreciated!


Is whois command safe for privacy?

I remember in the past that companies such as Network Solutions will steal your searched domain name when you perform a domain search at their website. I want to know, is the built-in command `whois` safe from this perspective? What the server the command pointed to, and do they collect information?


Xorg not working on Arch Linux

I installed Arch i686 on a VirtualBox VM (I have an nvidia GT610). I ran the following commmand as root:               pacman -S nvidia       After installation and rebooting, I ran               pacman -S xorg-server xorg-xinit xorg-server-utils xorg-twm xorg-xclock xterm      then               startx      I got a fatal error saying `No screens found`. Any help as to what should I do ?


Whitelist virtual_alias_maps

I have one mailbox in postfix and several aliases to it. Is it possible to create whitelists for specific alias in order to allow only the addresses from the list to send messages. For example: virtual hash:               test@example.com user     priv@example.com user      I would like to permit only two users(ali@comp.com ola@test.org), to send a message to priv@example.com In the other hand when someone wants to send a message to test@example.com, No restrictions are applied. Is it possible to configure postfix server this way?


How to extract the similarities between two strings

I have two strings in two different sentences: string 1: `30 mutation alanine for valine` string 2: `alanine at position 30` is there away to find the similarities between them as it is clear they both have 30 and alanine using regular expressions for example?


How to format Partition

How can I format the following partition on Redhat 5.2?               /dev/mapper/VG00-LogVol 148G  111G   36G  76% /u001/app/oracle


How to find out Hard disk first & last sector ID's?

Is that possible to find Hard disk sector's ID? If we can, how to find out Hard disk 1st & last sector ID's in windows & LINUX? As I tried to Google it, I found only hard disk sector size. If any one know about this please update.


Tuning keyboard (dead key) functionality on Gnome

My preferred keyboard configuration is US-International. When I use it on MS- Windows and type certain special characters (i.e., `~` `'` `"`) followed by `a`, `o` `n` I get `á` `ó` or `ñ` as I wish. However when I type these characters followed by a letter that doesn't match, I will get that special character followed by the letter. So if I want to type, let's say, `"q` I can do it by pressing `"``q`. However, if I do the same on Gnome I need to do it like `"``␣``q`, otherwise I get an audible bell. Also, if I want to type two single quotes, in Gnome I need to type `'` four times, instead of the two times it takes on MS-windows. I know it is a rather minor annoyance, but it does get to me, and I see Gnu+Linux as a highly customizable OS, and I'd like to learn more about how do I do such things. Changing to the normal US keyboard is not an option, because I need to use characters such as `á` `ó` or `ñ` for typing in Spanish. * * * note: I am using Debian


Empty typescript file with the script command

In the command line, I typed:               script -a myfile      Then, I typed the some standard commands. When I opened the `myfile` using `vi`, the file was empty. Why is that? And, also, any tips on using the `ttyrec` and `ttyplay` commands?


Gnome shows workspace before showing the login screen

I have used Gnome for a long time and always have seen this problem. When I close the laptop lid and re-open it, it shows my workspace for 1 second or less and then shows the login screen.I use Fedora but I have seen it in Ubuntu too. My expected behavior is not to show my workspace and windows, and to directly show the login screen. Is it a bug? If not, Why does it have this behavior?


Simple shell script needed to move database files

I am using **MySQL** on **Ubuntu** machine. I need to physically move around the database files under `/var/lib/mysql/` (this is where all the databases directories are located). Say I have two databases, **db_1** and **db_2** , so I can see two directories(`db_1/` and `db_2/`) under the path `/var/lib/mysql/` . Under each of these two database directory, there are many `.frm` `.MYD` `.MYI` files which holds all the tables' informations of the database. For example, under `db_1/` directory there are following files:               /var/lib/mysql/db_1# ls          cars.frm      cars.MYD      cars.MYI          customers.frm     customers.MYD     customers.MYI          departments.frm     departments.MYD     departments.MYI          ...       which holds _cars_ , _customers_ , _departments_ tables' info. I need a shell script to do the following simple task:   1. make a new direcotry named `db_1_temp` under `/var/lib/mysql/`   2. move files related with _cars_ and _customers_ tables in `db_1` directory to `db_1_temp` direcotry   3. move files in `db_2` directory to `db_1` direcotry **NOTE** , user need **root** privilege to access `/var/lib/mysql/` I need these things in a .sh file so I can run it in another application. Sorry that I do not know shell script, but need this thing. Appreciate if anyone can give a help, this shell script should not be hard I think. I try to extract some time to learn shell, as now I am quite busy with other software development. Thank you!


Prevent Midnight Commander opening files on mouse click?

I use to accidentally doubleclick an archive on a remote FS (in a FISH panel) and then it starts being downloaded to be opened - very annoying. Can I prevent MC opening files with the mouse to avoid this? It would also be nice to totally forbid opening remote files with `Enter` (I don't mean `F3` or `F4` \- those are fine) leaving explicit download (copy to local) the only option.


Debian squeeze post-installation automount problem, USB port confused for /dev/cdrom0

Usually when I install Linux on a laptop, I use the following command               $ dd if=installcdrom.iso of=/dev/sdX      where sdX is the inserted, unmounted USB stick (sdb usually), and installcdrom.iso is a CD-ROM image for installing Linux. That has worked fine many times. The system boots from USB, but 'thinks' its using a CD-ROM. When I boot into the new system, the drive works fine. But twice now (and last time I simply opted for a different distro, this time I don't have the option to do so), the installation procedure goes fine, everything is great, but when I try to mount media through that port, dmesg tells me that the following happens:               [18080.920173] usb 1-5: new high speed USB device using ehci_hcd and address 5     [18081.053782] usb 1-5: New USB device found, idVendor=058f, idProduct=6335     [18081.053799] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3     [18081.053813] usb 1-5: Product: Mass Storage Device     [18081.053824] usb 1-5: Manufacturer: Generic     [18081.053834] usb 1-5: SerialNumber: 058F63356336     [18081.054232] usb 1-5: configuration #1 chosen from 1 choice     [18081.055566] scsi6 : SCSI emulation for USB Mass Storage devices     [18081.057633] usb-storage: device found at 5     [18081.057644] usb-storage: waiting for device to settle before scanning     [18086.056331] usb-storage: device scan complete     [18086.057068] scsi 6:0:0:0: Direct-Access     Single   Flash Reader     1.00 PQ: 0 ANSI: 0     [18086.664768] sd 6:0:0:0: [sdb] 31291392 512-byte logical blocks: (16.0 GB/14.9 GiB)     [18086.665607] sd 6:0:0:0: [sdb] Write Protect is off     [18086.665621] sd 6:0:0:0: [sdb] Mode Sense: 03 00 00 00     [18086.665630] sd 6:0:0:0: [sdb] Assuming drive cache: write through     [18086.668922] sd 6:0:0:0: [sdb] Assuming drive cache: write through     [18086.668941]  sdb: sdb1     [18086.674627] sd 6:0:0:0: [sdb] Assuming drive cache: write through     [18086.674650] sd 6:0:0:0: [sdb] Attached SCSI removable disk     [18094.767234] UDF-fs: No anchor found     [18094.767246] UDF-fs: Rescanning with blocksize 2048     [18094.824119] UDF-fs: No anchor found     [18094.824127] UDF-fs: No partition found (1)     [18094.941911] ISOFS: Unable to identify CD-ROM format.     [18114.585119] UDF-fs: No anchor found     [18114.585133] UDF-fs: Rescanning with blocksize 2048     [18114.622291] UDF-fs: No anchor found     [18114.622303] UDF-fs: No partition found (1)     [18114.727507] ISOFS: Unable to identify CD-ROM format.     [18116.896705] UDF-fs: No anchor found     [18116.896719] UDF-fs: Rescanning with blocksize 2048     [18116.928426] UDF-fs: No anchor found     [18116.928439] UDF-fs: No partition found (1)     [18117.025404] ISOFS: Unable to identify CD-ROM format.      Everything is fine, SCSI removable disk sdb becomes sdb1, the media is mounted... and... wait, wait... what are you doing? It's not a CD-ROM! Too late. I get the message that it's wrong fs type, bad superblock, bad option. Usually this doesn't happen, but it's a problem with the Squeeze installer, I find. The problem does not appear until the file manager (Dolphin in this case, but I had the same problem with Nautilus last time I used the Squeeze netinst) attempts to mount the drive. Mounting it manually works fine, I'm not going to be the one using this computer, so it needs to mount automatically.


maximum number of files ls can list

Im using a script to delete old file in a directory, but the script kept showing               /usr/bin : Argument list too long      It turned out the number of files were 40000 and more, So I want to know what is the maximum limit of files that can be listed. Is there anyway to find it? Is it system specific?


How can I make ssh ignore .ssh/config?

I have the following in my ~/.ssh/config.               HOST 10.2.192.*             USER foo             PreferredAuthentications publickey             IdentityFile ~/.ssh/foo/id_rsa      The above configuration lets me connect to a machine while typing half as many words.                ssh 10.2.192.x      Before my ssh config, I had to type in all of this:                ssh foo@10.2.192.x -i ~/.ss/foo/id_rsa      However there is one machine in the 10.2.192.x subnet that I want to connect to with password based authentication instead of keybased authentication. Because ssh looks at my config file and finds a match for `PreferredAuthentications publickey` I am unable to login with just my password. I don't intend to ssh into this special snowflake vm often enough to warrant adding a new rule to my ssh config. How can I make ssh ignore my config file just this once, and allow me to authenticate with a password?


Bash script to adjust brightness when battery unplugged

I am trying to set up my system and to get some practice with scripting and the like. I am running Linux Mint 16 on a Samsung RC520 laptop (`Linux 3.11.0-12-generic x86_64`). I want to implement a script that will lower my screen brightness to a pre-set value when I unplug the power (and raise it when I plug it back in). I can do some very basic scripting but not near this level. I have "xbacklight" which will set the brightness from the command line, so when I unplug the power the line I want to implement would be `xbacklight -set 20`. I also know that unplugging the power is registered by acpi (this may sound completely stupid but hopefully it is clear what I mean); when I plug out and then back in the power I get the following with `acpi_listen`:               $ acpi_listen     ac_adapter ADP1 00000080 00000000     processor CPU0 00000081 00000000     processor CPU1 00000081 00000000     processor CPU2 00000081 00000000     processor CPU3 00000081 00000000     ac_adapter ADP1 00000080 00000001     processor CPU0 00000081 00000000     processor CPU1 00000081 00000000     processor CPU2 00000081 00000000     processor CPU3 00000081 00000000     battery BAT1 00000080 00000001      So I know I have to use this but I have two main problems: I wouldn't know where to put the script so that it is automatically implemented, and I don't know how I would recognise the plug in/out in acpi because all I know how to do is `acpi_listen`.


I am on OS X trying to ssh into a ubuntu 12.04 server. I was able to SSH in -- until abruptly stuff stopped working. I've read online to use the `-v` to debug this. Output is shown below. If I ssh into a different box and then ssh from that box to the server I am able to login. I have no idea how to debug this problem but would like to learn.               $ ssh -v me@server     OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011     debug1: Reading configuration data /etc/ssh_config     debug1: /etc/ssh_config line 20: Applying options for *     debug1: /etc/ssh_config line 53: Applying options for *     debug1: Connecting to server [IP] port 22.     debug1: Connection established.     debug1: identity file /Users/me/.ssh/id_rsa type 1     debug1: identity file /Users/me/.ssh/id_rsa-cert type -1     debug1: identity file /Users/me/.ssh/id_dsa type -1     debug1: identity file /Users/me/.ssh/id_dsa-cert type -1     debug1: Enabling compatibility mode for protocol 2.0     debug1: Local version string SSH-2.0-OpenSSH_6.2     ssh_exchange_identification: read: Connection reset by peer      So far (on advice of message boards) I have looked for a hosts deny file -- but there is no such file on my machine.               $ cat /etc/hosts.deny      cat: /etc/hosts.deny: No such file or directory      I have admin access on client machine but not on server.


Print job "Held for authentication"

Following the instructions here, I have installed a Samba print server on an ARM-based Udoo-quad running Udoobuntu 12.04 LTS. The Samba server is working, and (after setting `guest ok = yes` in the server's `smb.conf`) I can browse the "print$" (Printer Drivers) folder without entering credentials. I am able to browse to the printer during client-side printer installation (on Ubuntu 13.10), but print jobs do not make it to the server. They just sit in the client print queue with the status message **"Held for authentication"**. I have the server configured to allow guest access to printers with the following section in `/etc/samba/smb.conf` (as reported by `testparm`):               [printers]         comment = All Printers         path = /var/spool/samba         create mask = 0700         guest ok = Yes         printable = Yes         print ok = Yes         browseable = No      Why does the client think that authentication is required, and what is the fix?


Linux Mint root app theming breaks when changing controls

So, this is a strange occurrence, which seems similar to other questions but which I've not been able to find a reference for. Maybe my Google-Fu is not strong right now. It seems to be a common complaint that user's root apps (sudo'd apps like Synaptic) are falling back on default themes. Usually the solution is given as "copy themes from `~/.themes` to `/usr/share/themes` or `/root/.themes`," for example. This hasn't worked for me, because there's nothing listed in `~/.themes` for me. Then I figured out that changing the _controls_ setting in the Appearance dialog breaks root app theming instantly. See the following screenshots. **Before** ![Default Mint-X theme/controls selected](http://i.stack.imgur.com/5H4tN.png) **After** ![One click later, root app theme broken](http://i.stack.imgur.com/RyzAV.png) _Installing_ another themeset (such as `grey-theme` from Synaptic) appears to break this somehow too, although it goes away when uninstalled. I have not tested this extensively and it may be a fluke related to the controls changing. On a hunch, I tried running `sudo mate-appearance-properties` and/or `gksudo mate-appearance-properties`. Notably, nothing changed when I selected different controls, not even the root app. Also, `sudo` had only the default theme selected, but `gksudo` had " _Custom Theme_ " selected, which was identical to the default and also could not be changed. Unsure what this means, if anything. So, long story short, I doubt this is a bug per se, but I would like to be able to change my default theme/controls and have root apps follow it somehow.


Running sh script: «Permission denied» despite the executable bit and root rights

I installed Debian in VirtualBox (for various experiments which usually broke my system) and tried to launch the VirtualBox guest addon script. I logged in as root and tried to launch `autorun.sh`, but I got «Permission denied». `ls -l` shows that the script have an executable rights. Sorry, that I can't copy the output -- VirtualBox absolutely have no use without the addon, as neither a shared directory, nor a shared clipboard works. But just for you to be sure, I copied the rights by hands:               #ls -l ./autorun.sh     -r-xr-xr-x 1 root root 6966 Mar 26 13:56 ./autorun.sh      At first I thought that it may be that the script executes something that gave the error. I tried to replace `/bin/sh` with something like `#/pathtorealsh/sh -xv`, but I got no output — it seems the script can't even be executed. I have not even an idea what could cause it.


Ubuntu 14.04 LTS - USB 3.0 Low Output or not working

I have a problem with my laptop. Since I've installed Ubuntu 14.04 LTS in dual boot, my two USB 3.0 don't work anymore. Maybe you need to know: My Laptop has 2*USB 2.0 and 2*USB 3.0. One of the USB 2.0 is defect, idk why, it doesn't work under Windows either. The two 3.0 Ports work under Windows (they charge my Phone and I can connect my mouse & USB stick to them). The 2.0 port works fine, too. In Ubuntu, the 2.0 port works excellent, too. But the 3.0 Ports don't. Whenever I plug in my Phone, it says that it's charging, but it doesn't detect that it's connect to a Laptop/PC (No USB Debugging icon and no option to enable mass storage). When i plug my mouse in one of the 3.0 ports, the laser (or whatever it is) on the bottom of the mouse flickers, but it doesn't work. When i plug in an USB, it doesn't connect. Before Ubuntu 14.04 i had 13.04 and everything worked as it should (except the USB 2.0 port, of course). This is the output of `lsusb` with plugged in my mouse and my phone to my 3.0 ports:               Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub     Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 001 Device 004: ID 8087:07da Intel Corp.       Bus 001 Device 003: ID 04f2:b2bb Chicony Electronics Co., Ltd      Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub     Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub`      This is 'lsusb' with **nothing** plugged in:               Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub     Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 001 Device 004: ID 8087:07da Intel Corp.      Bus 001 Device 003: ID 04f2:b2bb Chicony Electronics Co., Ltd      Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub     Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub      I only know that `04f2:b2bb` is my Webcam. Thanks in advance, I'm helpless.


Ubuntu 10.04 kvm Virtual Machine guest network speed slow

i have the following situation, i have a kvm host ubuntu 10.04 LTS 64-bit network host speed is perfectly run , as i am testing network speed using iperf , the speed between any network device and the kvm host is perfect running with 1GB/s but guest network speed is slow and the test result like 500 MB/s with any network device or with the host itself , although when i migrate this guest to another kvm guest based on rhel 5.3 the network speed works perfect . and when i copied the machine to another ubuntu 10.04 lts 64-bit kvm host , the network speed returns to the speed 500 MB/s any one can help please


How to mount a flash image in Linux?

In Linux, I created an image of a flash disk as follows:               sudo dd if=/dev/sdb of=test.img      which I now want to mount directly. I tried the following command               sudo mount -t ext3 -o loop test.img /mnt/flash      which resulted in the following error:               mount: wrong fs type, bad option, bad superblock on /dev/loop0,        missing codepage or helper program, or other error        In some cases useful info is found in syslog - try        dmesg | tail  or so      `dmesg` shows the entry               EXT3-fs (loop0): error: can't find ext3 filesystem on dev loop0.      which I am not able to interpret. I get the same message when I omit the option `-o loop`. Any ideas how I am able to mount the _file_ image to `/mnt/flash`? I am not talking about mounting the actual flash disk, I want to mount the `file`.


How to format a 1GB USB stick to FAT32 with 512 bytes sector?

I am trying hard to format a 1GB USB stick so that I can use it to install a new linux OS. Because the Disk utility has failed me when creating the file system. I tried to do it manually using `fdisk` by going through the following steps to create the master boot record and a 1GB partition:               # fdisk /dev/sdc          Command (m for help): p     Disk /dev/sdc: 994.5 MiB, 1042808832 bytes, 509184 sectors     Units: sectors of 1 * 2048 = 2048 bytes     Sector size (logical/physical): 2048 bytes / 2048 bytes     I/O size (minimum/optimal): 2048 bytes / 2048 bytes     Disklabel type: dos     Disk identifier: 0x967a68db          Device    Boot Start       End  Blocks  Id System     /dev/sdc1 *        1    509183 1018366   b W95 FAT32          Command (m for help): o          Created a new DOS disklabel with disk identifier 0x727b4976.          Command (m for help): n          Partition type:        p   primary (0 primary, 0 extended, 4 free)        e   extended     Select (default p): p     Partition number (1-4, default 1): 1     First sector (512-509183, default 512):      Last sector, +sectors or +size{K,M,G,T,P} (512-509183, default 509183):           Created a new partition 1 of type 'Linux' and of size 993.5 MiB.          Command (m for help): v     Partition 1: cylinder 253 greater than maximum 252     Partition 1: previous sectors 509183 disagrees with total 507835     Remaining 511 unallocated 2048-byte sectors.          Command (m for help): w          The partition table has been altered.     Calling ioctl() to re-read partition table.     Syncing disks.      Then I tried to format it to FAT32 file system with 512 bytes sector size, but it says the minimum allowed is 2048 bytes.               # mkfs.fat -v -F 32 -S 512 /dev/sdc1     mkfs.fat 3.0.26 (2014-03-07)     Warning: sector size was set to 2048 (minimal for this device)     WARNING: Not enough clusters for a 32 bit FAT!     /dev/sdc1 has 33 heads and 61 sectors per track,     hidden sectors 0x0800;     logical sector size is 2048,     using 0xf8 media descriptor, with 508672 sectors;     drive number 0x80;     filesystem has 2 32-bit FATs and 8 sectors per cluster.     FAT size is 125 sectors, and provides 63548 clusters.     There are 32 reserved sectors.     Volume ID is 1ab3abc1, no volume label.      I need 512 bytes sector as `syslinux` does not support larger sector size.


How to make Shift+Insert paste selection after closing window with selection?

Typical scenario: I want to get a snippet from a text file into my terminal (probably running a VIM). Now I open the file using mousepad, select the snippet, _close_ mousepad, switch to urxvt and hit `Shift` \+ `Insert` to paste the text. (As opposed to non-terminal applications, where the same does the "normal" paste, but let's keep that aside for now). IIRC, this work-flow used to work perfectly, until a certain moment. Now, since the moment I close the mousepad window, contents of the clipboard is lost, i.e. reverted to that _before_. Of course I don't want to keep the window open, that only leads to cluttered desktop (= random loss my concentration). _Skip this:_ Is there any rationale for this? I'm tempted to think that this is some kind of security measure, but frankly, that idea seems so scary to me: I mean, it's supposed to be clipboard, right? Not a VCS nor a password manager, just a plain old simple clipboard. (What next, are we going to have separate cursors in applications? Or separate selections? Or five hands?) How can I get my old normal clipboard behavior? And by the way, which part of the architecture (X/GTK/Xfce/mousepad) is responsible for this behavior? **After-thought:** After reading the first two great answer plus the article linked, I realized that yes, behavior might have changed, but it's more likely that I have misunderstood the clipboards for years, and it's more about changes in my work-flow (i.e. heavy use of vim, ssh and urxvt and keyboard- oriented control) that caused recent increase in my stumbling. (I feel relieved that it's not another instance of terrible trend in FOSS when developers are arbitrarily "improving" fundamentals of desktop tools.) So while I was expecting a "switch to turn it back" to behave ~~how it was~~ how I understood it, namely retaining separate "Ctrl+X/C/V" and "MMB", I'll be looking into solutions involving The Grand Unification. Maybe I'll need to tune my work-flow, but at least I'll be understanding my tools.


Run .sh file instead of opening it

I am using Zorin OS 7. I want to run a `.sh` file but I can't seem to be able to--it just opens in a text editor. Also under RMB>open with there is no other option.


understanding how to run script securely as limited user

I'm a long time dev but linux newbie. I've been building this (http://tryperl.com) to learn linux. So, my question is just about some *nix stuff I don't fully grok. One of the things I want to do is run the generated script (in my application) as a limited user. So I create a `limiteduser` . Then I can set say fork limits like this : `limiteduser hard nproc 300`. Is this then **the right way** of running a script as `limiteduser` :               sudo -u limiteduser perl myscript.pl      **Secondly** , what if I had concurrent requests that **forked and executed** and ran the above code simultaneously, with different scripts. Would that cause problems? I heard it would, if two processes ran on the same user or something? Specifically I'm running on ubuntu but I assume this applies to any *nix distro? * * * Update: Also, I plan to use Time::Out to timeout a script if it takes too long so ideally I should have a limited number of processes running.


Recursively edit files based on parent directory's name

I'm facing an issue I'm not quite sure how to overcome. I have a large directory with hundreds of folders, all following the naming scheme "a_b_x", with x being a random word. In every one of these folders there are 3 text files, all with a couple of strings containing "a_b_x" as well. I'm trying to rename all of the directories and change the strings inside the files from "a_b_x" to "a_x", meaning the "b_" is supposed to be removed. I hope to accomplish this with some sed wizardry, as manually editing all of the files would take several hours. I'd be very thankful for any help!


C Shell unfreezing using right click

I know almost nothing about Unix. I use commands like `cd`, `rm`, `mkdir`, `cp`, `get`, `put`, etc., and then simply run scripts that other people have written. I had opened C-Shell and was running a script and at some point I may have accidentally clicked on the screen or done something and my process looked like it stopped. Usually the screen is humming along (like the pic below) , every few seconds it would display progress, 91 of 199, 92 of 199 etc., and then it just stopped at 96 of 199 when I accidentally did something with my mouse. ![enter image description here](http://i.stack.imgur.com/tzhQR.jpg) After an hour of googling, I right clicked on the screen just to see if it does something and then it started moving again like before. I'm sorry if this isn't a good question but I would really like to know what happened? Why did the screen stop and why did it start moving. I have tried googling but it didn't seem to bring anything up. I would like to understand this better so I don't interrupt anything in the future.


How to enable 'Page Handling tab' in print dialog in Arch Linux

I've finally gotten around to setting up my printer in Arch Linux, but I've run into a problem. Printing works just fine, except that when I go to print a document, when I look in the options in the print dialog, the _Page Handling_ tab is missing. I know that the tab exists because in my wife's Linux Mint setup, the tab is present, and she is using the exact same print driver (screenshot from her machine below): ![](http://i.imgur.com/3er8U2o.png) How do I enable the _Page Handling_ tab in the print dialog? **Additional Details:**   * Printer is a network printer   * Attempting to print a PDF, but the behaviour appears to be consistent regardless of what is printed      * Using `zathura` though the results are the same using `chromium`   * Printer driver is `Brother HL-2140 Foomatic/hpijs-pcl5e`   * Not using a desktop environment: using a combination of `awesomewm` and other applications


What goes into a Linux distribution?

**My understanding of Linux distributions is that:** They are operating systems based on the Linux kernel, and most have default desktop environments, something that is not in the Linux kernel. Fedora uses Gnome, Ubuntu uses Unity, and so on. However, some, such as Arch Linux, do not have a default window manager. **Question:** What components go into a distribution, outside of the kernel (e.g. how is Arch Linux different from just the kernel itself)? Could a functional operating system be made with just the kernel alone?


What are the linux kernel versions incompatibilities with btrfs?

I read that usage of a btrfs volume with a newer kernel can render it unreadable when that same volume is used with an older kernel. I have a mobile storage device that will be used by different linux distributions and kernels. What are the kernel version incompatibilities I might have to worry about? The machines I will use have kernel versions 3.2.0, 3.5.0, and higher.


How to copy a long textfile to clipboard on gnome-terminal?

> **Possible Duplicate:**   >  How do I send stdin to the clipboard? What's the best way to copy a long text file to keyboard? I'm imagining something like:               cat longTextFile | straightToClipboard


Replace string with sequential index

Can someone suggest an elegant way to accomplish this? Input:               test  instant  ()          test  instant  ()          ...     test  instant  ()    //total 1000 lines      output should be:               test      instant1  ()          test      instant2  ()          test      instant1000()      The empty lines are in my input files and there are many files under the same directory that I need to process at once. I tried this to replace many files in the same dir and didn't work.               for file in ./*; do perl -i -000pe 's/instance$& . ++$n/ge' "$file"; done      errors:               Substitution replacement not terminated at -e line 1.     Substitution replacement not terminated at -e line 1.      and I also tried this: `perl -i -pe 's/instant/$& . ++$n/ge' *.vs` It worked but the index just kept incrementing from one to another file. I'd like to reset that to 1 for diff file. any good suggestions?               find . -type f -exec perl -pi -e 's/instant/$& . ++$n{$ARGV}/ge' {} +      works but it replaced all other files shouldn't be replaced. I prefer to just replace the files with "*.txt" only.


How to set laptop screen brightness just after boot with full disk encryption

my girlfriend bought `Lenovo Essential G500 i5-3230` and I installed `Linux Mint 16` on it with full disk encryption. It is standard installation with encryption using `dmcrypt` and `LUKS`. But there is a problem with screen brightness, it is set to `0` before it even ask for password to encrypted partitions. I partly fixed it by adding:               echo 50 > /sys/class/backlight/acpi_video0/brightness      to `/etc/rc.local` but it fixes brightness after typing correct password to mount encrypted partitions. I want to fix brightness before that, so I can see the password input field. `/etc/rc.local` is loaded after mounting encrypted disk so I think I need to somehow force kernel to change brightness just after it loads itself and before mounting. Is there a way to tell kernel to adjust brightness just after boot? Graphic cards on laptop are: AMD® Radeon HD 8570M + Intel HD Graphics 4000 **UPDATE** I've tried solution sugested by @derobert. I created initramfs script `/etc/initramfs-tools/scripts/init-premount/local-backlight-brightness`               #!/bin/sh     PREREQ=""     prereqs()     {         echo "$PREREQ"     }          case $1 in         prereqs)             prereqs             exit 0         ;;     esac          . /usr/share/initramfs-tools/hook-functions     # Begin real processing below this line          echo 50 > /sys/class/backlight/acpi_video0/brightness      And after this:               $ sudo chmod a+rx /etc/initramfs-tools/scripts/init-premount/local-backlight-brightness     $ sudo update-initramfs -u     $ sudo reboot      But it don't work, screen is almost black when asking for password. I'm not even sure if this script was executed. How can I check if it was executed? Maybe I should add some requirements in `PREREQ=""` to make it work? **UPDATE 2 FINALLY WORKING** Ok, I decided to read manual for initramfs-tools again to check if everything was good and it looks like I used wrong boilerplate for my script. The correct one is:               #!/bin/sh     PREREQ=""     prereqs()     {         echo "$PREREQ"     }          case $1 in     prereqs)         prereqs         exit 0         ;;     esac          . /scripts/functions     # Begin real processing below this line          echo 50 > /sys/class/backlight/acpi_video0/brightness      The problem was with `. /usr/share/initramfs-tools/hook-functions`. This line was used for hook scripts that are not included in intramfs image. It should be `. /scripts/functions`. After changing it, brightness works like I wanted. I'm marking @derobert answer as correct because it directed me to correct solution.


How I can select a partition to install fedora?

I have a problem on installing fedora. I have already installed windows 8, and I have two different partitions (C (for windows), and D(for data)). I had also shrink the size of D by 50 GB, in order to create this free space to install fedora. However the fedora installer recognises only one disc, and not all the partitions I have made. Therefore it is possible that if I install fedora, my windows installation might be lost. What should I do? I just want to install linux at that specific 50GB partition... Thanks in advance John


Colour problem when capturing a png of the top panel of the screen

I want to capture a window as a png from within a bash script, using the window's _ID_. In this case, the window is the top panel. Using `gnome- screenshot` the colours are true, as per this image... (this image is not the same size as the following image, so ignore the dark line at the bottom) ![enter image description here](http://i.stack.imgur.com/Zm954.png) However when I capture the panel via `import`, _or_ `xwd` \+ `convert`, I get the following image.. ![enter image description here](http://i.stack.imgur.com/cr9FI.png) Why would I be getting this colour aberration? `import` and `convert` both belong to the `imagemagick` package... I haven't found anything else in the Ubuntu repository which can capture a window by its _ID_... so I'm stuck. (`gnome-screenshot` doesn't have the feature)... It would be nice to know what is going on here (eg, is is something to do with _transparent_ images, which I know very little about)...but in any case, just a recommendation of a _workaround_ capture utility may do the trick ... it must be able to capture a window by it's _ID_. Here is an example of how I make and view the image capture.               import -window "$(wmctrl -l |grep "Top Expanded Edge Panel" |awk '{print $1}')" screen.png       display screen.png


Vim, context-sensitive comment/uncomment behavior

I edit a lot of PHP code with Vim, and I've run into a snag with some macros in my `.vimrc`. I currently use these two macros to comment/uncomment in C-style               "c-style (//) comment (press the [.] key)     au FileType php vnoremap . :s/^\(\s*\)\(.\+\)$/\1\/\/\2/<CR>:noh<CR>gv     "c-style (//) uncomment (press the [,] key)     au FileType php vnoremap , :s/^\(\s*\)\/\//\1/<CR>:noh<CR>gv      And these two to comment/uncomment in HTML-style               "html-style (<!-- -->) comment (press the [.] key)     au FileType html vnoremap . :s/^\(\s*\)\(.\+\)$/\1<!-- \2 -->/g<CR>:noh<CR>gv     "html-style (<!-- -->) uncomment (press the [,] key)     au FileType html vnoremap , :s/^\(\s*\)<!-- \(.*\) -->/\1\2/g<CR>:noh<CR>gv      These macros work fine when applied to their intended file-type, but since there is often HTML embedded inside a PHP file, the PHP commenting style is useless. Is there a way for Vim to detect if it's working on a chunk of HTML code inside a PHP file, and then apply the correct commenting behaviour? Edit: I know that I can manually set the filetype, and that there are plugins available for this, I was looking to learn more about writing better macros.


How to customize a backend running job completion message?

Here is the situation, I am running a command (my own executives), in bash shell (Ubuntu), say something like this:               [newbie@office currentCaseAFolder]$ FEMSolver &      So that the `FEMSolver` job is now running in backend, and let's say it needs around five to ten minutes. But I have more than one cases. so               [newbie@office currentCaseAFolder]$ cd ../currentCaseBFolder     [newbie@office currentCaseBFolder]$ FEMSolver &     [newbie@office currentCaseBFolder]$ cd ../currentCaseCFolder     [newbie@office currentCaseCFolder]$ FEMSolver &     [newbie@office currentCaseCFolder]$ cd ../currentCaseDFolder     [newbie@office currentCaseDFolder]$ FEMSolver &     [newbie@office currentCaseDFolder]$ cd ../../postprocessingFolder      After a coffee time, I come back, and hit return key, some simulations have finished. so it will show me               [2]  + Done           FEMSolver &     [4]  + Done           FEMSolver &     [newbie@office postprocessingFolder]$       But this does not give me the clear information from which folder the job was sent!! I hope it could somewhere and somehow be customized to have this effect:               [2]  + Done           FEMSolver &  (from folder currentCaseBFolder)     [2]  + Done           FEMSolver &  (from folder currentCaseDFolder)     [newbie@office postprocessingFolder]$      Any ideas?