Dropbox on Debian EAGAIN error on NTFS share

I am experiencing some weird problems, when using dropbox on my Debian install:   * I run Debian with testing repositories enabled   * I have Dropbox installed from the website   * My dropbox-location is on a shared partition that is formatted with NTFS I mount the dropbox-location in my fstab with the following line:               UUID=662058B320588C45 /media/ntfs-data ntfs-3g uid=1000,gid=users 0 0      This provides me with read/write permissions on the drive - and as long as I use a filemanager or console (or any other program) to access the drive it works. After setting up my dropbox to access the already existing location on this drive it indexed nearly all files and then stopped with the message:               Downloading 38 files ...      I tried to check what is happening by attaching `strace` to the process which yields the following results (this is an excerpt only, as the message keep on appearing):               recvfrom(12, 0x33b3ae4, 4096, 0, 0, 0)  = -1 EAGAIN (Resource temporarily unavailable)     recvfrom(12, 0x33b3ae4, 4096, 0, 0, 0)  = -1 EAGAIN (Resource temporarily unavailable)     poll([{fd=10, events=POLLIN}, {fd=12, events=POLLIN}, {fd=13, events=POLLIN}], 3, 0) = 0 (Timeout)     recvfrom(12, 0x33b3ae4, 4096, 0, 0, 0)  = -1 EAGAIN (Resource temporarily unavailable)     poll([{fd=10, events=POLLIN}, {fd=12, events=POLLIN}, {fd=13, events=POLLIN}], 3, 496) = 0 (Timeout)     futex(0x9ee784, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 49446674, {1372094398, 476504000}, ffffffff) = -1 EAGAIN (Resource temporarily unavailable)     futex(0x9ee804, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x9ee800, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) = 1     futex(0x9ee840, FUTEX_WAKE_PRIVATE, 1)  = 1     futex(0x9ee7c0, FUTEX_WAKE_PRIVATE, 1)  = 1     futex(0x9ee784, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x9ee780, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) = 1     futex(0x9ee7c0, FUTEX_WAKE_PRIVATE, 1)  = 1     futex(0x9ee784, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 49446680, {1372094398, 476765000}, ffffffff) = -1 EAGAIN (Resource temporarily unavailable)     futex(0x9ee804, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x9ee800, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) = 1     futex(0x9ee840, FUTEX_WAKE_PRIVATE, 1)  = 1     futex(0x9ee7c0, FUTEX_WAKE_PRIVATE, 1)  = 1     futex(0x9ee784, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x9ee780, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) = 1     futex(0x9ee7c0, FUTEX_WAKE_PRIVATE, 1)  = 1     futex(0x9ee784, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 49446687, {1372094398, 477169000}, ffffffff) = -1 EAGAIN (Resource temporarily unavailable)     futex(0x9ee804, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x9ee800, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) = 1     futex(0x9ee7c0, FUTEX_WAKE_PRIVATE, 1)  = 0     futex(0x9ee784, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x9ee780, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) = 1     futex(0x9ee7c0, FUTEX_WAKE_PRIVATE, 1)  = 1     recvfrom(12, 0x33b3ae4, 4096, 0, 0, 0)  = -1 EAGAIN (Resource temporarily unavailable)     poll([{fd=10, events=POLLIN}, {fd=12, events=POLLIN}, {fd=13, events=POLLIN}], 3, 0) = 0 (Timeout)     poll([{fd=12, events=POLLIN|POLLOUT}], 1, 4294967295) = 1 ([{fd=12, revents=POLLOUT}])     writev(12, [{"5\30\4\0\26\10@\1[\0@\1\17\0\17\0=\0\4\0[\0@\1\0\0\0\0\17\0\17\0"..., 96}, {NULL, 0}, {"", 0}], 3) = 96     recvfrom(12, 0x33b3ae4, 4096, 0, 0, 0)  = -1 EAGAIN (Resource temporarily unavailable)     recvfrom(12, 0x33b3ae4, 4096, 0, 0, 0)  = -1 EAGAIN (Resource temporarily unavailable)     poll([{fd=10, events=POLLIN}, {fd=12, events=POLLIN}, {fd=13, events=POLLIN}], 3, 0) = 0 (Timeout)     poll([{fd=12, events=POLLIN|POLLOUT}], 1, 4294967295) = 1 ([{fd=12, revents=POLLOUT}])     writev(12, [{"$\30\1\0&\10\2\0\341\0\0\0", 12}, {NULL, 0}, {"", 0}], 3) = 12     poll([{fd=12, events=POLLIN}], 1, 4294967295) = 1 ([{fd=12, revents=POLLIN}])     recvfrom(12, "\1\1;U\0\0\0\0\341\0\0\0\177\0\300\0\246\5S\1\246\5S\1\24\0\0\0\0\0\0\0", 4096, 0, NULL, NULL) = 32     recvfrom(12, 0x33b3ae4, 4096, 0, 0, 0)  = -1 EAGAIN (Resource temporarily unavailable)     recvfrom(12, 0x33b3ae4, 4096, 0, 0, 0)  = -1 EAGAIN (Resource temporarily unavailable)     poll([{fd=12, events=POLLIN|POLLOUT}], 1, 4294967295) = 1 ([{fd=12, revents=POLLOUT}])     writev(12, [{"&\30\2\0\177\0\300\0", 8}, {NULL, 0}, {"", 0}], 3) = 8     poll([{fd=12, events=POLLIN}], 1, 4294967295) = 1 ([{fd=12, revents=POLLIN}])     recvfrom(12, "\1\1<U\0\0\0\0\341\0\0\0G\0`\2\246\5S\1\246\0*\1\24\0\0\0\0\0\0\0", 4096, 0, NULL, NULL) = 32     recvfrom(12, 0x33b3ae4, 4096, 0, 0, 0)  = -1 EAGAIN (Resource temporarily unavailable)     recvfrom(12, 0x33b3ae4, 4096, 0, 0, 0)  = -1 EAGAIN (Resource temporarily unavailable)     poll([{fd=12, events=POLLIN|POLLOUT}], 1, 4294967295) = 1 ([{fd=12, revents=POLLOUT}])     writev(12, [{"&\30\2\0G\0`\2", 8}, {NULL, 0}, {"", 0}], 3) = 8     poll([{fd=12, events=POLLIN}], 1, 4294967295) = 1 ([{fd=12, revents=POLLIN}])     recvfrom(12, "\1\1=U\0\0\0\0\341\0\0\0N\0`\2\246\5S\1\244\0*\1\24\0\0\0\0\0\0\0", 4096, 0, NULL, NULL) = 32     recvfrom(12, 0x33b3ae4, 4096, 0, 0, 0)  = -1 EAGAIN (Resource temporarily unavailable)     recvfrom(12, 0x33b3ae4, 4096, 0, 0, 0)  = -1 EAGAIN (Resource temporarily unavailable)     poll([{fd=12, events=POLLIN|POLLOUT}], 1, 4294967295) = 1 ([{fd=12, revents=POLLOUT}])     writev(12, [{"&\30\2\0N\0`\2", 8}, {NULL, 0}, {"", 0}], 3) = 8     poll([{fd=12, events=POLLIN}], 1, 4294967295) = 1 ([{fd=12, revents=POLLIN}])     recvfrom(12, "\1\1>U\0\0\0\0\341\0\0\0\0\0\0\0\246\5S\1\244\0\25\1\24\0\0\0\0\0\0\0", 4096, 0, NULL, NULL) = 32     recvfrom(12, 0x33b3ae4, 4096, 0, 0, 0)  = -1 EAGAIN (Resource temporarily unavailable)     recvfrom(12, 0x33b3ae4, 4096, 0, 0, 0)  = -1 EAGAIN (Resource temporarily unavailable)     poll([{fd=12, events=POLLIN|POLLOUT}], 1, 4294967295) = 1 ([{fd=12, revents=POLLOUT}])     writev(12, [{"%\30\1\0", 4}, {NULL, 0}, {"", 0}], 3) = 4     recvfrom(12, 0x33b3ae4, 4096, 0, 0, 0)  = -1 EAGAIN (Resource temporarily unavailable)     recvfrom(12, 0x33b3ae4, 4096, 0, 0, 0)  = -1 EAGAIN (Resource temporarily unavailable)     poll([{fd=10, events=POLLIN}, {fd=12, events=POLLIN}, {fd=13, events=POLLIN}], 3, 0) = 0 (Timeout)     recvfrom(12, 0x33b3ae4, 4096, 0, 0, 0)  = -1 EAGAIN (Resource temporarily unavailable)     poll([{fd=10, events=POLLIN}, {fd=12, events=POLLIN}, {fd=13, events=POLLIN}], 3, 496  C-c C-c^C <unfinished ...>     Process 5687 detached      I already ran `ntfsck`:               sudo ntfsck /dev/sdb1     Unsupported: replay_log()     Unsupported: check_volume()     Checking 219648 MFT records.     Unsupported cases found.      Rebooting into Windows and running chkdsk did not solve the error neither. Anybody has any idea what this is / how I can fix it?


Which partitions should I encrypt?

My laptop is currently running Windows and Fedora, but I'm planning to install Arch Linux as my sole OS soon. This current setup is using whole disk encryption through TrueCrypt, but I'm unsure if it might be unnessesary for me. I think I'll be using a somewhat simple partition sceme, something like: `/`, `/boot`, `/home` and `swap`. I'm using my laptop for average everyday PC usage, programming, testing on local web server or on a virtual web server, audio/video playback, audio editing/recording etc. I want to encrypt my next Arch only setup as well, but I can't decide whether to partition the whole disk, just the home partition or something else. I want to encrypt the system mainly for securing eventual lost/stolen data. I'm thinking that dm-crypt with LUKS would be my best choice, but I'm not sure. What should I choose and why?


Linux chrgrp and chown remove capabilities added by setcap

I'm running a kernel derived from 2.6.32 on RHEL 6.4. If I add some capabilities to a file such as:               # setcap  CAP_AUDIT_CONTROL=eip ls     # getcap ls     ls = cap_audit_control+eip      And then I run either chown or chgrp against it:               # chown bob ls     # getcap ls     #      Those capabilities have been erased. Is this an expected behavior? I cannot find it documented anywhere (certainly not in the chown(1) or chgrp(1) man page. Nor have I found anything in the capabilities(7), or setcap(8) man page).


setting up exim4 for vep

I have exim4 running on a Debian server. A couple of applications send VERP mail from specific domains. Reading the exim docs it suggests a **router** that looks for certain domains and passes off to a special **transport** for which is sensitive to VERP (i.e. it does not mangle individual return paths by using `max_rcpt = 1`) The exim docs example use a hard-coded regex to identify the domain (and, in the example the local part suffix `-request` but I don't need that). I would like to write a router that identifies whether the return_path that is set is one from a list of given domains, and if so, use the special verp transport. I'd like to maintain the list of domains in a list rather than keep editing a regexp as I believe this will make for a more robust config file! Normally in Exim I could do something like `domains = +some_domain_list` but this only works to test the destination domain; I want to test the `return_path` domain. i.e. I want to do something like:               # domains that are used for VERP     my_domains_list = foo.example.com : bar.org          # my router     myrouter:        driver = dnslookup        return_path_domains = +my_domains_list        transport = verp_sensitive_transport


How to safely shutdown computer during boot sequence?

Due to a bug my computer has stopped in the middle of the boot sequence, just waiting. If I type anything, it prints stuff like `^[[B`. I do not want to damage the files on the computer by pressing the power button. Is there some way I can exit the boot sequence and go to a prompt so that I can type `shutdown -h now` or `reboot` to safely turn off or restart the system?


How can I control an existing remote shell?

On my remote machine, an xterm/shell has been created (by another process). I have full access to that shell through VNC. But really I would like to be using a text mode shell on my local machine. How can I control the existing remote shell from a local one? I can't create a new shell, that's the point. But I have non-privileged access to the existing remote shell.


How can I stop my Linux machine from broadcasting its name on the network?

I have a Linksys router and I've noticed that when I look for connected PC's on the router, the name of my computer and MAC address of the wireless device appears. However, I've noticed that for some devices it appears only the device MAC address, without a name. For example, Apple computers connected to the router appear without a name. The PlayStation 3 and the printer appears without a name too. So my question is, how can I stop my PC with Linux from broadcasting its name so the router can only present its MAC address and not the name? I really don't have any share utility so I don't see any use for broadcasting my PC name.


Using "${a:-b}" for variable assignment in scripts

I have been looking at a few scripts other people wrote (specifically Red Hat) and a lot of their variables are assigned using the following notation `VARIABLE1="${VARIABLE1:-some_val}"` or some expand other variables `VARIABLE2="${VARIABLE2:-`echo $VARIABLE1`}"` What is the point of using this notation instead of just declaring the values directly? e.g. `VARIABLE1=some_val` Are there benefits to this notation or possible errors that would be prevented? Does the `:-` have specific meaning in this context?


Does an in-kernel firewall sit between the network access layer and Internet layer?

_This question is a follow-up to myprevious question._ Logic for me to says that an in-kernel firewall sits between the network access layer and the Internet layer, because it needs to have access to the IP-packet header to read the source and destination IP address in order to do filtering before determining if the packet is destined for the host, or it the packet should forwarded to the next hop if it is destined elsewhere. Somehow, it also seems logical to say that firewall is part of Internet layer, because that is where routing table is and a firewall is in some respects similar to routing table rules.


Compile IMAP with certain PHP API version for MAMP

I've installed MAMP on Mac OS X (where PHP 5.3.15 with API version `20090626` is installed), but IMAP there is without SSL support. As long as MAMP using PHP v5.4.4 (API version `20100525`) I've downloaded its sources. But. When I type `phpize` the `phpize` from Mac OS X called, not from MAMP (maybe because it's installed in system when MAMP has PHP libs inside itself). So how do I compile IMAP sources with API version of MAMP's PHP?


Adding Windows user to Linux group; possible?

I have a NAS that runs on Linux and I connect to it from my Windows desktop. I noticed that all directory in that drive belongs to user 'root' and group 'root'. That effectively denies me the right to write on those directory; only read rights. Is there a way I can add my desktop username e.g. sara-laptop/sara into the Linux root group which will then give me rights to write on those directory? I was thinking about changing the ownership to nobody/nobody which will give everyone rights to write on it. But could be a bad idea as I'm worried that other users will accidentally delete some of my items. Thanks.


How can I reinstall Network Manager after uninstalling it?

I am running a version of RHCE6 on my laptop, and lately I've been trying various stuff about network configuration through command line. Last night, I tried removing the NetworkManager using               yum remove NetworkManager      from the system, so that I could have more control of the network through the command line. But the result is, I didn't manage to configure the wireless connection through `wpa_supplicant` , and I need wireless connection during my travel.   I tried to reinstall using :               yum install NetworkManager      Some version installed, but I didn't get an icon in the taskbar, and of course, the network doesn't work. The package I previously removed (about 24MB) was much larger that the one I just installed(about 2MB), I think some dependencies must be missing. How could I Reinstall network manager correctly to restore my connectivity?


How can i specify directory user & group for files inside an RPM?

I am building RPMs using FPM. When using the --rpm-user and --rpm-group, I notice as advertised that in the specfile that the %defattr(-,user,group,-) is set under %files. This does indeed set the user and group settings of files, but how do i set the directory user & group?


Can't use Control key while setting shortcut keys for compiz

I might got a problem along with my Xorg config, all control keys are now shown as `<Primary>`, what is that? I just mapped `Capslock` to `Left Control`, and I can't set the shortcut key to `Control` + `Tab` now ![enter image description here](http://i.stack.imgur.com/1Pu7q.png)


Concatenate Sequences under a Heading

I have a file like File1. With a heading for example ">Contig1" and I want to concatenate all the sequences under the respective heading. File1:               >Contig1     ACCCCATACATCCAAA     NNNNNNNNNNCATACA     AAAAAAAACTANNNNN     ACATACAAAAA     >Contig12     CCCCACAATTTTTAAA     GGGGGNNNNNCATACA     AGGAATTAACTANNAC     GGATATA      Expected Output:               >Contig1     ACCCCATACATCCAAANNNNNNNNNNCATACAAAAAAAAACTANNNNNACATACAAAAA     >Contig12     CCCCACAATTTTTAAAGGGGGNNNNNCATACAAGGAATTAACTANNACGGATATA      Can you please help me with it. Cheers!


What's the newline symbol in zsh's PS1?

I'm trying to setup a multiple line PS1, for zsh, but `\n` doesn't was parsed by zsh, `PS1="%~\n %> "` How should I set it up?


Copy multiple files into one (append, merge) in single invocation without shell redirection?

I'm looking for some sort of a command that I can use, to copy/append multiple files into one; but _without_ shell redirection (I'd like to try it in `call_usermodehelper`, see similar issue in call_usermodehelper / call_usermodehelperpipe usage - Stack Overflow). I know I could otherwise use:               cat file1 file2 > file.merge      ... but that requires shell redirection. My findings so far:   * Cannot use `cat`, as it's default stdout output cannot be redefined (through, say, command line argument) - and other than that, it's shell redirection   * Cannot use `dd` in single invocation, as it can only accept one (and only one) `if=` input file argument   * Cannot use `cp`, as it will treat multiple files individually, and cannot copy them all "merged" into a single location So - is there any standard tool, that would allow me to do something like (pseudocode):               copytool -i file1 -i file2 -o file.merge      ... such that the output `file.merge` represents `file2` appended to `file1` contents?


Ethernet-bridged OpenVPN server not accepting connections from outside

I have configured an OpenVPN server with ethernet bridging using this howto and this page regarding ethernet bridging. The server is also running Samba, Apache and Webmin.               Linux klesk 2.6.32-5-amd64 #1 SMP Sun Sep 23 10:07:46 UTC 2012 x86_64 GNU/Linux          Distributor ID: Debian     Release:    6.0.7     Codename:   squeeze      The problem is that I cannot access the server from outside of the LAN. When I connect to the webmin or Samba share internally I have no problems. The configuration on the router has not been changed and is still correct. I have tried disabling the iptables firewall with the following commands (this has been restored already)               iptables -F     iptables -X     iptables -t nat -F     iptables -t nat -X     iptables -t mangle -F     iptables -t mangle -X     iptables -P INPUT ACCEPT     iptables -P OUTPUT ACCEPT     iptables -P FORWARD ACCEPT      But still no connections from outside are allowed. I believe the problem lies with the network interfaces created for OpenVPN. When I check Webmin I get the following information: ![enter image description here](http://i.stack.imgur.com/Z3WGU.png) Currently I have iptables setup as described in the ethernet bridging setup page of OpenVPN:               iptables -A INPUT -i tap0 -j ACCEPT     iptables -A INPUT -i br0 -j ACCEPT     iptables -A FORWARD -i br0 -j ACCEPT      To summarize, with the current setup, as shown in the screenshot and iptables settings, I am able to connect to the server from within the LAN (SSH, Apache, Webmin, Samba, they all work) but from outside of the LAN the server isn't accepting any connections.


Resolving MAC Address from IP Address in Linux

I need to write a bash script wherein I have to create a file which holds the details of IP Addresses of the hosts and their mapping with corresponding MAC Addresses. Is there any possible way with which I can find out the MAC address of any (remote) host when IP address of the host is available?


looking for light weight Linux for a old 104 pc

I am looking for a light weight Linux for a PC that runs at 200 Mhz with 256 Megs of RAM. I was thinking maybe Lubuntu, as the system requirements state it needs at least a Pentium 2 generation with 128 Megs of RAM. The GUI is not all that important to have, so would I be better off going with something like Ubuntu server? I was kinda hoping to go with a Ubuntu flavor due to their great support base, but I am willing to try other flavors.


Modelsim for ubuntu

I am looking to download modelsim for ubuntu. But the site gives only .exe file. Can I still install the software? Does modelsim exist for ubuntu? If yes, where can I find it? Thank you.


Can I have my shell history record how wildcards expanded?

If I run:               $ ls *     foo bar buzz     $ history | tail -1     ls *      You can see that in my shell history it remembers that I ran `ls *` rather than `ls foo bar buzz`. Ideally, I'd like to record both in separate histories. When I wonder, "what the heck happened to file foo?", it would be nice to be able to have a way to go back and figure out that I did `rm *` in the wrong directory by searching through my history and finding 'foo'. I'm interested in solutions for both zsh and bash.


How to decide on a partitioning scheme?

I am changing my current partition scheme (personal development laptop, dual boot) to remove the Windows partition and leave only my Slackware64 instance. What thought should go into my partitioning? I have been keeping `/` and `/home` in separate partitions, as well as a `swap` partition too. How do I decide what other partitions would be good to have in their own section of the disk?


echo of a string with an exclamation point

Here are what I put in bash and the results I got about 'echo':               $ echo '!$'        !$       $ echo "!$"       echo "'!$'"       '!$'      I'd like to know how 'echo' deals with the second input. It seems to me that 'echo' would first print the strings (expand some if necessary) you entered, then execute certain if they are executable. A more mind-blowing example I can construct but am not able to understand is:               $ echo '!$'       !$       $ echo "!echo "!$""       echo "echo '!$' "'!$'""       echo '!$' !$


Compiling software with the same options as a previous install

I want to compile and install a software on a new VM. The software was installed successfully on a different VM by a different admin, but I want to duplicate the exact command with the options that he used. Is this possible? BTW, the folder from where he ran `./configure` is still intact.


Delete every number that comes before "="

i have a very, very, very long list. Like over 830,000 characters. I will of course perform said command on a copy. There are multiple lines, like this               hey1=lol     hey2=lol     hey3=lol      I want that to turn out like this               hey=lol     hey=lol     hey=lol      This must be possible with sed, awk or similar? The reason im not using Sumblime text is because all lines do not have a number before them.


find all end subdirectories in a tree

given the following structure:               oz123@debian:~/ $ tree .     .     ├── a     │   ├── a1     │   ├── a2     │   └── a3     ├── a1     │   ├── a11     │   ├── a12     │   └── a31     ├── b     │   └── b1     │       ├── b11     │       │   └── b21     │       │       └── b31     │       ├── b12     │       └── b3     └── c          16 directories, 0 files      ### How do I find all the end nodes? I found the following solutions which _seems_ to be good, but I have to proof that there is not test case which will fail it. The help page of the `-links` states: > You can also search for files that have a certain number of links, with > ‘-links’. Directories normally have at least two hard links; their . entry > is the second one. If they have subdirectories, each of those also has a > hard link called .. to its parent directory. The . and .. directory entries > are not normally searched unless they are mentioned on the find command > line. ### possible solution:               oz123@debian:~/ $ find .  -type d  -links 2     ./a/a2     ./a/a3     ./a/a1     ./c     ./a1/a31     ./a1/a11     ./a1/a12     ./b/b1/b12     ./b/b1/b3     ./b/b1/b11/b21/b31        * Can anyone provide a better solution (without using pipes and sed, this has be performant ...)   * Will it work on any filesystem?


recursive delete with sftp?

I have a host that I can only access with sftp, scp, and rsync-- no ssh. I have a large tree of directories that I want to delete, but my sftp client apparently does not support recursive `rm`s or `rmdir`s. In the help screen, it shows I can do recursive `put`s, but that doesn't help me. How can I delete my files?


Use a different shell by default in each terminal emulator

I would like to change the default shell in each terminal emulator separately. To clarify, I want Xterm to use TCSH, pterm to use pysh, gnome-terminal to use BASH, etc. Is this possible? If so, how can this be accomplished.


Troubleshooting span traffic shutdown interface?

I'm using guardium appilance, which has one of its port used to analyze span traffic. The base os is linux. The span traffic stopped coming during some time of operations. I asked the network team, and was told that port was shut down on the guardium device end. I'm convinced that this activity has taken on switch level as it was unable to handle the traffic being passed through it. Is there a command that i can run on the linux o/s that would tell exactly if the interface was shutdown ; if yes for what reason? Thanks.


Wget, downloading outdated files [debian running on Mips - malta]

I am over writing a particular file (called "demo") on my server and wget-ting it. However, sometimes wget retrieves an outdated file, despite my checking on the net that the file has been updated. I've tried deleting before re-writing, sometimes I even delete all the files; but when I try to wget "demo" I still get an outdated copy. I'm running debian on a simulated MIPS malta board (basically, linux running on MIPS) if that makes a difference. Is this a known bug and if so, is there a way around it?


Unix and Linux without a file system?

I was reading **Eric Raymond's** the **Art of Unix Programming** , (Amazon and online) and at the very beginning of the book where he analyses what Unix does wrong he says: > Having a file system at all may have been the wrong choice. **So I am asking: What could be a viable alternative to file systems? Because Unix was built upon (and therefore heavily utilises the concept of) file descriptors and file systems.**


Find packages not maintained in main repo?

> **Possible Duplicate:**   >  listing packages in Debian, a la `dpkg -l`, but including the package > origin/source E.g. Ubuntu Server offers only security updates for software contained in the main repository - how can I check, which installed packages are / are not in the main repo? Thanks!


I have recently had an incident in which my /var/mail/spool/ file grew to the size of 32G (yes, that is gigabytes), completely filling its system partition (/dev/sda2) and most of what I saw inside were Hibernate messages. When I tried to restart my laptop, I got an error message from the GUI saying that the system was unable to start. Then I went into the recovery mode (command-line only) and was able to shell into the system. I did some du investigation and found the above described anomaly. I deleted the file and then was able to log into X11 (KDE Desktop) fine. My question is: Why does X11 on Fedora 16 rely on non-boot device for startup? Can it be configured to only use the boot device or is X11 considered almost like any other application? I would like to be able to at least get inside my D.E. even if all other disk partitions are unusable but the boot partition is. RELATED: Disk size management


How to put the specific files from a directory in an array in bash?

Suppose I have a directory under which there are 3 files named: file1.txt,file2.txt and file3.txt. Now how can I fill an array with those file names(I just know that all the files have certain prefix, i.e. file, after file it can be 1,2,3 etc.


Window manager and desktop environment for touchscreens

What are some good choices for desktop environments and window manager for touchscreens? Currently I am using XFCE with custom GTK settings for making the controls larger, but that is far from optimal. What is the current state of touch-screen desktop environments, and are there any promising projects out there? **Edit:** Are there any "lightweight" touch-optimised desktop environments available?


nagios w/o apache?

I want to install nagios but instead of using apache i would like to use nginx. I installed nagios-cli and it automatically brings parts of apache which puts a script into `/etc/init.d/apache2` and annoy me on every bootup. I have nginx with php,cgi and mono working fine. But i am unsure how to remove apache from my system How do i remove apache or not get it included with nagios? I am using debian squeeze (6)


Reducing ubuntu boot time using dmesg

The boot time is 141 seconds. Here's the most interesting parts of dmesg command:               [    2.870498] usb 1-1.2: new high-speed USB device number 5 using ehci_hcd     [   80.669210] ADDRCONF(NETDEV_UP): eth0: link is not ready      I takes 78               [   86.108371] intel ips 0000:00:1f.6: i915 driver attached, reenabling gpu turbo     [  102.924783] cfg80211: All devices are disconnected, going to restore regulatory settings      16 more seconds               [  109.643299] wlan0: associated     [  140.406853] wlan0: deauthenticated from 00:3a:9a:49:27:60 (Reason: 23)      and 31 seconds. Is it possible to do something with these parts in order to reduce total boot time?


Reverse tunnelling with “stunnel” in linux

Scenario: Central Log-Server(logserv)- only private IP interfaces Multiple client servers (logclient)- has public IPs. Requirement: Need to tcp logs of syslog application from various logclients to logserv. Is this possible to achieve this using "stunnel", like its normally implemented via reverse tunnelling with ssh and autossh? Is reverse tunnelling possible with "stunnel". The idea behind going for tunnel was to avoid giving logserv a public IP to prevent public access. Once a reverse tunnel was made, then transferring logs from logclients to logserv would be possible. But not sure if it will work using stunnel. Kindly advise.


Loop over multiple addresses: ping and drop data into file

I would like to be able to have a script that will:   1. look at a list of IP addresses    2. Ping one of the addresses   3. Take the data and drop it in to a file   4. Move on to the next IP So far I have:               cd /Path/to/addressees || exit 1     for targethost in a b c; do       {ping {targethost}           echo $'\n'"finished:       } >"$log_file" 2>&1     done      When I run this I receive the errors:               ./ping_address: line 3: cd: /path/to/ip_adress: No such file or directory     ./ping_address: line 7: unexpected EOF while looking for matching `"'     ./ping_address: line 8: syntax error: unexpected end of file      I am still a little new to scripting on Unix so any help would be really helpful!


Kill only one Java process

I usually run few Java applications, one for server running locally and other for some IDE like NetBeans. And from time to time, after lots of redeployments, my server get stuck on OutOfMemoryException so I need to kill Java process in order to reboot. So I do `pkill -9 java` but this also kills my running IDE which I don't want to. So how do I kill only application linked to running server and not the other ones?I assume that they all are running under same process but there has to be some way how to distuingish them.


Can ps display only non kernel processes on Linux?

How can I ask `ps` to display only user processes and not kernel threads? See this question to see what I mean...


Pattern matching on path names in bash

I want to act on a list of subdirectories in a directory. Consider:               for x in x86-headers/*/C/populate.sh; do echo $x; done      This gives               x86-headers/elf/C/populate.sh     x86-headers/gl/C/populate.sh     x86-headers/gmp/C/populate.sh     x86-headers/gnome2/C/populate.sh     x86-headers/gtk2/C/populate.sh     x86-headers/jni/C/populate.sh     x86-headers/libc/C/populate.sh      But I want values that corresponds to the second part of the path, `elf`, `gl`, etc. I know how to strip off the leading `x86-headers`.               for x in x86-headers/*/C/populate.sh; do i=${x##x86-headers/}; echo $i; done      which gives               elf/C/populate.sh     gl/C/populate.sh     gmp/C/populate.sh     gnome2/C/populate.sh     gtk2/C/populate.sh     jni/C/populate.sh     libc/C/populate.sh      I also know how to strip off later terms in the path. I.e. going down one level:               cd x86-headers     for x in */C/populate.sh; do i=${x%%/*}; echo $i; done      gives               elf     gl     gmp     gnome2     gtk2     jni     libc      But, trying to combine these doesn't work. I.e.               for x in x86-headers/*/C/populate.sh; do i=${${x##x86-headers}%%/*}; echo $i; done      gives               bash: ${${x##x86-headers}%%/*}: bad substitution      No doubt this is incorrect syntax, but I don't know the correct syntax. Of course there might be better ways to do this. If I was using Python, I'd use split on `/`to break each path into a list, and then pick the second element, but I don't know how to do that in bash. EDIT: Thanks for the answers. I should also have asked, is it possible to do this portably, and if so, how?


How to create a PCM wav with mplayer?

I want to reencode a audiobook for my mobile with speexenc. The first step is to reencode the file with mplayer.               for i in *.mp3; do         mplayer -ao pcm:waveheader "$i" -af pan=1:0.5:0.5,resample=22050 -ao pcm:file="$i.wav";     done      Is what I found on the internet. But the outfile is not a pcm wav:               file *.wav     RIFF (little-endian) data, WAVE audio, mono 22050 Hz      Where a reference wav from xiph.org is pcm.               file wb_male.wav      RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 16000 Hz      speexenc does encode the last PCM WAV, but does not with the mplayer file. Why not? The does the Audiooutput called "pcm" does not ouput a pcm file? How to Fix it? And is there a easy way to pipe the wav directly to speexenc without a named fifo?


Removing Debian Installation Prompt

I attempted to install Debian through a CD, with the initial .exe working fine. However, when I rebooted and went through the installation procedure, my system could not tell that there was a disk there (or the media was unreadable). Now whenever I boot up my computer, I get the choice between continuing on to windows or to complete my installation. How do I remove that choice? Do I have to go through BIOS or are the files on my Windows partition?


Configure SSH keys for production and DR server

Here is the case, we have successfully configured SSH keys (and hence password-less SFTP connection) between ProdServer-A to ProdServer-B. It works, or so I thought still yesterday. Yesterday ProdServer-B failed over to DisasterServer-B. When it did, the SSH connection failed. In ProdServer-A we get an alert saying ProdServer-B has changed (known-hosts) and could be "man-in-middle" attack (which is as expected, but we know why this is happening). So, my question is, how can we add keys from two servers (same hostname, but only one active at a time) into known_hosts? Or even better, how can we successfully avoid SSH connection failures if a production server failed over to disaster server? Suggestions are welcome. Thanks!


Why is I/O uninterruptible?

What is the rationale behind making I/O uninterruptible? What would be the negative consequences if a process handling I/O were allowed to handle a signal?


increasing a logical volume

I need to increase the logical volume of the `var` directory, the maximum size of `var` right now is 10GB, I need to make it 50GB. I have a Centos 6 server. The output of `df -h` is:               Filesystem            Size  Used Avail Use% Mounted on     rootfs                 10G   10G     0 100% /     /dev/root              10G   10G     0 100% /     none                  991M  312K  990M   1% /dev     /dev/sda2             455G  3.6G  429G   1% /home     tmpfs                 991M     0  991M   0% /dev/shm     /dev/root              10G   10G     0 100% /var/named/chroot/etc/named     /dev/root              10G   10G     0 100% /var/named/chroot/var/named     /dev/root              10G   10G     0 100% /var/named/chroot/etc/named.conf     /dev/root              10G   10G     0 100% /var/named/chroot/etc/named.rfc1912.zones     /dev/root              10G   10G     0 100% /var/named/chroot/etc/rndc.key     /dev/root              10G   10G     0 100% /var/named/chroot/usr/lib64/bind     /dev/root              10G   10G     0 100% /var/named/chroot/etc/named.iscdlv.key     /dev/root              10G   10G     0 100% /var/named/chroot/etc/named.root.key      I followed this tutorial. In order to increase the volume you have to do: `lvextend -L +40G /Path/To/var` My problem is simple, I don't know where my var is located. If i do `lvextend -L +40G /dev/root/var` I get `Volume group "root" not found` If i do `lvextend -L +40G /dev/var` I get                 Path required for Logical Volume "var"       Please provide a volume group name       Run `lvextend --help' for more information.      I tried every possible path, still can't find the right path to var, so where my `var` is located? **EDIT** If i do `lvextend -L +40G /dev/root` I get                 Path required for Logical Volume "root"       Please provide a volume group name       Run `lvextend --help' for more information.      `pvs` gives no output at all. `lvs` gives this output `No volume groups found`


Wlan0 Static Ip bridge

EDIT: Even taking br0 out, still cannot get a static IP connection. I had the following /etc/network/interfaces configuration and it was working               auto lo     iface lo inet loopback          auto eth0     iface etho inet manual          allow-hotplug wlan0          auto wlan0     iface wlan0 inet dhcp     wpa-ssid "xxxx"     wpa-pskl "xxxx"          auto br0     iface br0 inet dhcp     bridge_ports wlan0 eth0      I changed the config for wlan0 to the following and now it doesn't work               auto wlan0     iface wlan0 inet static     address 192.168.1.124     netmask 255.255.255.0     network 192.168.1.1     broadcast 192.168.1.255     wpa-ssid "xxxx"     wpa-pskl "xxxx      I am trying to setup a wireless network with static IP that is also bridge to ethernet connection. Im doing this on Raspberry Pi. Thanks for help.


Why "uninterruptible sleep" is not counted as "IDLE"?

When I run `top -bi`, where the parameter -i means "ignore idle processes", the resulted list(see below) of processes are either R or D, although there're S processes at that time. So, why uninterruptible sleep is not counted as "idle"? And, it seems that "load average" equals the number of R processes plus the number of D processes?               top - 17:47:44 up 141 days, 14:29,  2 users,  load average: 4.10, 4.18, 4.17     Tasks: 224 total,   1 running, 223 sleeping,   0 stopped,   0 zombie     Cpu(s):  0.1%us,  0.4%sy,  0.0%ni, 87.2%id, 12.3%wa,  0.0%hi,  0.0%si,  0.0%st     Mem:  16432240k total, 16345816k used,    86424k free,  4934652k buffers     Swap: 16386292k total,     6996k used, 16379296k free,    71432k cached          PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                  7479 root      18   0 1357m 1.1g  904 D    1  7.0  10:27.86 rsync                                                                    7463 root      18   0 1315m 1.0g  840 D    1  6.6   9:45.83 rsync                                                                    7469 root      18   0 1088m 889m  840 D    0  5.5   8:10.20 rsync                                                                    7524 root      18   0 1106m 895m  840 D    0  5.6   8:13.60 rsync                                                                    30958 root      15   0 12720 1148  788 R    0  0.0   0:01.07 top


Simple Shell script to log disk space

I'm working on automating collecting disk space on a group of servers. In a standard terminal, if I run:               ssh server1 ssh server2 df -h       Then I get the output of the command, just fine. However, if I attempt this method from within a script using a For Loop. Then it fails. Example Script:               #!/bin/bash          GROUP="server1 server2"          for s in $GROUP; do          ssh bastion1 ssh ${s} df -h     done      In the latter example, I get no output (or errors for that matter). I've tried various escaping and quoting, but still no luck...I have a feeling it's something blatantly obvious that I am overlooking. Any pointers?


What happens when you rsync without a destination?

To make the story short, I did an rsync: `rsync -avP root@exampleserver.com:/tmp/` And I forgot to put in my source directory... :( I really meant to run: `rsync -avP /tmp/ root@exampleserver.com:/tmp/` It printed a bunch of files, but I don't know where it copied them because I didn't specify a destination. Does anyone know what happened? I did an `ls` on the folder, but I didn't find anything.


Port forwarding and masquerading

What is the relationship between port-forwarding and masquerading? If server A is configured to masquerade its clients, and client B accesses the Internet through server A, then since client B is masquerading as server A, is that essentially the same thing as having all of client B's ports forwarded?


When sh is a symlink to bash or dash, bash limits itself to POSIX-compliance, so it should be 100% compatible with sh?

From Difference between bash and sh: > ABck to the question: If you have `/bin/sh` as a link to bash, then bash > will not behave the same when called as `/bin/sh` as it does when called as > `/bin/bash`. When called as `sh`, it will limit itself to mostly POSIX- > compliance plus a limited set of extensions. Does it mean that whenever I come across a shell script in Linux with a shebang to sh: `#!/bin/sh`, even if on that distro, `bin/sh` is a symlink to another shell, like dash or bash, it should be 100% compatible with the bourne shell, since it limit itself to a limited set of extension? So I could execute them in FreeBSD? Is there are exception to that? Or I should be safe to assume that it will work? So if on a distro, `bin/sh` is a symlink to `bin/bash`, and a script use `#!/bin/sh` and the script contain bashism, it will not run, since bash will like be in sh mode?


merging all files into one file?

I was trying to merge all the text files in to one file. All the text files has one column and equal number of rows. My data file names are data_1.txt, data_2.txt, data_3.txt, . . . data_n.txt. where n is the number of text files to be merged. I want the merge from 1 to n in their order. I tried the following code, but it doesn't work as I wanted. It doesn't keep the column order. My sample data looks like data_1.txt               0.020085     0.0017361     0.77963     0.98659     0.33102     0.099835     0     0     0.073004     0.29978      data_2.txt               0.021407     0.0017191     0.82385     1.0449     0.34593     0.10535     0     0     0.078362     0.31509      data_3.txt               0.022706     0.0016876     0.85447     1.0922     0.35556     0.11063     0     0     0.083983     0.32536      required output combined.txt               0.020085    0.021407    0.022706     0.0017361   0.0017191   0.0016876     0.77963 0.82385 0.85447     0.98659 1.0449  1.0922     0.33102 0.34593 0.35556     0.099835    0.10535 0.11063     0   0   0     0   0   0     0.073004    0.078362    0.083983     0.29978 0.31509 0.32536      Would you please help me in correcting my problem.               #!/bin/bash     paste data_*.txt > combined.txt


Why does root not have /usr/local in path?

I've noticed that the default path for root on my of my vm's and servers do not include /usr/local/bin ` sudo -s   echo $PATH /sbin:/bin:/usr/sbin:/usr/bin ` Whereas normal users on the server do have /usr/local/bin               /usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/sowen/bin      Why would root not need /usr/local in the path? Where is the default path for a user defined?


What configuration can insert lines between commands?

I've noticed on some Linux servers, that bash has a very elegant feature that adds visual breaks. What program is it that appends the `\-------- <time>` after each command? ![enter image description here](http://i.stack.imgur.com/ptNiI.png)


Principle of least privilege: Does Authbind helper really need setuid root, or can it run with cap_net_bind_services?

Does Authbind's helper really need setuid root, or can it run with the CAP_NET_BIND_SERVICES capability and still work?


How to make a key simulate another key?

In my keyboard the `I` key doesn't work. So, I use an on-screen keyboard. I'm using Ubuntu 13.04. But its hectic. Is there a way so that I can make another key (for example `Home` on my keypad) to behave like `I`? Also, if you have any other easy way to achieve this please share.


Archlinux: No binaries can be executed

Yesterday I ran an archlinux system upgrade which updated a lot of things, one of them being glibc. Here's a screenshot. Obviously the upgrade of glibc failed. But as you can see on the bottom I cannot execute anything anymore. The files themselves are still there, which i can see using `echo /usr/bin/*` Since I cannot run anything on the machine: is there any way to fix this? Or am I forced to re-install the whole OS?


How to properly disable Gnome 3 shell in Debian?

I just did a Debian install on an old laptop, and I don't need Gnome shell on it. I did it with `apt-get remove gnome-shell`, and it worked after I restarted. However, later I did `apt-get autoremove`, and I was a bit tired and didn't read any of the package names it listed - turned out it removed a whole bunch of important packages from my system, forcing me to re-install Debian from scratch. Is there another way to disable Gnome shell as the default? I tried the following command from the Debian wiki, but it didn't work:               $ gconftool -s /desktop/gnome/session/required_components/windowmanager \            -t string metacity


Debian: I can't change GTK_IM_MODULE in .xprofile

I want to use `fcitx` to type Chinese in my Debian (jessie amd64). But it's wired in such a way that I can't change the value of `GTK_IM_MODULE` in `~/.xprofile`. My `.xprofile` is like this:                 1 # im       2 export GTK_IM_MODULE=fcitx       3 export XMODIFIERS=@im=fcitx       4 export QT_IM_MODULE=fcitx      Each time I rebooted, or started a new `gnome-terminal`, I got this:               benben@debian:~$ echo $GTK_IM_MODULE     scim      So I tried to figure out whether `.xprofile` still works, by modifying it to the following:                 1 # im       2 export GTK_IM_MODULE=fcitx       3 export XMODIFIERS=@im=fcitx       4 export QT_IM_MODULE=fcitx       5        6 export hello=world      Then each time I rebooted, or started a new `gnome-terminal`, I got:               benben@debian:~$ echo $hello     world      So I think `.xprofile` still works.   Is there some other application that keeps `GTK_IM_MODULE` from changing to other values?


How to configure external IP addresses for LXC guests?

I'm exploring the LXC features in Ubuntu 12.04 and I really want to set up a network like this:               client1:   192.168.56.101/24     lxc-host:  192.168.56.102/24     guest1     192.168.56.201/24     guest2     192.168.56.202/24     guest3     192.166.56.203/24      I just want a "flat" network where the guests have full access to the LAN and are visible from the clients. I'm used to bridged networking with libvirt/KVM, as described here: http://libvirt.org/formatdomain.html#elementsNICSBridge On the host:               # /etc/network/interfaces     auto br0     iface br0 inet static         address 192.168.56.102         netmask 255.255.255.0         broadcast 192.168.56.255         bridge_ports eth1      lxc.conf for the first guest:               # /var/lib/lxc/guest1/config:     lxc.network.type=veth     lxc.network.link=br0     lxc.network.flags=up     lxc.network.hwaddr=00:16:3e:13:48:4e     lxc.network.ipv4=192.168.56.201/24      It looks like 192.168.56.201 is invisible to the outside world, which isn't what I want. Seems like I have to do one of these things: 1) Manually set up routing on the host and guest 2) Do something hokey...create virtual interfaces on the host ahead of time, and configure the guests to use them `lxc.network.type=phys`. I don't know if that would actually work. I'm focused on Ubuntu, but answers for RHEL/Fedora would be useful too....


Map Control-Shift-Tab in rxvt-unicode

I'd like to map the keybinding `Ctrl`+`Shift`+`Tab` in `rxvt-unicode`. I managed to map `Ctrl`+`Tab` as follows. The corresponding entry in `.Xresources` is               URxvt.keysym.Control-Tab: \033[27;5;9~      Using `cat -v` confirms that this mapping works:               $ cat -v     ^[[27;5;9~      The sequence `^[[27;5;9~` can then be used in applications like `vim` for mapping `Ctrl`+`Tab`. I would expect the following `.Xresources` entry to work the same.               URxvt.keysym.Control-Shift-Tab: \033[27;6;9~      However, `cat` does not show the correct mapping:               $ cat -v     ^[[Z      How to set up the `Ctrl`+`Shift`+`Tab` mapping? **Edit** The mappings               URxvt.keysym.Control-ISO_Left_Tab: \033[27;6;9~         URxvt.keysym.Control-Shift-ISO_Left_Tab: \033[27;6;9~      behave the same. After first pressing `Ctrl`+`Tab`, releasing both and then pressing `Return` _twice_ and then pressing `Ctrl`+`Shift`+`Tab`, releasing all and then pressing `Return` _twice_ I get the following output:               $ cat -v     ^[[27;5;9~     ^[[27;5;9~               ^[[27;6;9~↵     ^[[27;6;9~M-bM-^FM-5        * Case `Ctrl`+`Tab`: The first return makes the input appear again as output.   * Case `Ctrl`+`Shift`+`Tab`: The first return produces the sign `↵`, the second return produces the last line shown above. **Next edit: More information** > What happens if you press ctrl-shift (release both without pressing any > keys), then enter, in a different window? In a different urxvt window? When I press Ctrl+Shift and release both keys a strident yellow box appears in the lower left corner: `KEYCAP PICTURE INSERT MODE` it seems to come from urxvt, it does not appear in other applications. > Or even just ctrl-shift-tab then enter in a different window (i mean not > rxvt, like in a gedit window or the web browser or something.) I get a new line. > What happens if you press shift+ctrl+tab [i.e. shift down, ctrl down, tab, > ctrl up, shift up] instead, or vice versa if that was what you were doing? In urxvt?               $ cat -v     shift+ctrl+tab then enter: ^[[27;6;9~     ctrl+shift+down: ↓     ctrl+shift+up: ↑     shift+down: ^[[b     shift+up: ^[[a     ctrl+down: ^[Ob     ctrl+up: ^[Oa     tab: |       | (tab)      > I'm trying to narrow down things because I think you might have some sort of > mapping on "ctrl+shift" in xcompose or something. Not that I'm aware of, but you never know. > What is the output of xev when you press "ctrl+shift+tab, enter"?               KeyPress event, serial 32, synthetic NO, window 0x4800001,         root 0xb4, subw 0x0, time 311734869, (567,395), root:(567,411),         state 0x0, keycode 66 (keysym 0xffe3, Control_L), same_screen YES,         XLookupString gives 0 bytes:          XmbLookupString gives 0 bytes:          XFilterEvent returns: False          KeyPress event, serial 35, synthetic NO, window 0x4800001,         root 0xb4, subw 0x0, time 311734971, (567,395), root:(567,411),         state 0x4, keycode 62 (keysym 0xffe2, Shift_R), same_screen YES,         XLookupString gives 0 bytes:          XmbLookupString gives 0 bytes:          XFilterEvent returns: False          KeyPress event, serial 35, synthetic NO, window 0x4800001,         root 0xb4, subw 0x0, time 311736110, (567,395), root:(567,411),         state 0x5, keycode 23 (keysym 0xfe20, ISO_Left_Tab), same_screen YES,         XLookupString gives 0 bytes:          XmbLookupString gives 0 bytes:          XFilterEvent returns: False          KeyRelease event, serial 35, synthetic NO, window 0x4800001,         root 0xb4, subw 0x0, time 311736494, (567,395), root:(567,411),         state 0x5, keycode 23 (keysym 0xfe20, ISO_Left_Tab), same_screen YES,         XLookupString gives 0 bytes:          XFilterEvent returns: False          KeyRelease event, serial 35, synthetic NO, window 0x4800001,         root 0xb4, subw 0x0, time 311736525, (567,395), root:(567,411),         state 0x5, keycode 62 (keysym 0xffe2, Shift_R), same_screen YES,         XLookupString gives 0 bytes:          XFilterEvent returns: False          KeyRelease event, serial 35, synthetic NO, window 0x4800001,         root 0xb4, subw 0x0, time 311736525, (567,395), root:(567,411),         state 0x4, keycode 66 (keysym 0xffe3, Control_L), same_screen YES,         XLookupString gives 0 bytes:          XFilterEvent returns: False          KeyPress event, serial 35, synthetic NO, window 0x4800001,         root 0xb4, subw 0x0, time 311737530, (567,395), root:(567,411),         state 0x0, keycode 36 (keysym 0xff0d, Return), same_screen YES,     "   XLookupString gives 1 bytes: (0d) "     "   XmbLookupString gives 1 bytes: (0d) "         XFilterEvent returns: False          KeyRelease event, serial 35, synthetic NO, window 0x4800001,         root 0xb4, subw 0x0, time 311737633, (567,395), root:(567,411),         state 0x0, keycode 36 (keysym 0xff0d, Return), same_screen YES,     "   XLookupString gives 1 bytes: (0d) "         XFilterEvent returns: False


How can I remove all my docker images?

Sometimes I just want to clear everything out of docker, and start with a clean slate. Is there a systematic way to just remove all my Docker containers & images? ### Containers               $ docker ps -a | head     CONTAINER ID        IMAGE                COMMAND                CREATED             STATUS                     PORTS               NAMES     7b055e9e5f1f        fedora:latest        /bin/sh                6 days ago          Exited (0) 6 days ago                          ecstatic_colden             40da968258eb        fedora:latest        /bin/sh                6 days ago          Exited (127) 6 days ago                        naughty_thompson            5be4581afad6        fedora:latest        /bin/bash              6 days ago          Exited (0) 6 days ago                          kickass_wright              4d6c33d4be6d        fedora:latest        /bin/bash              6 days ago          Exited (0) 6 days ago                          furious_fermat              db7a29bdbc2d        fedora:latest        /bin/bash              6 days ago          Exited (0) 6 days ago                          mad_hawking                 e6b7365690ce        fedora:latest        /bin/bash              6 days ago          Exited (0) 6 days ago                          trusting_ardinghelli        15655c21fcd3        8018e08e6a58         /bin/sh -c 'apt-get    3 weeks ago         Exited (100) 3 weeks ago                       drunk_bardeen               607547aabbca        f02ed0c206d5         /bin/sh -c 'apt-get    3 weeks ago         Exited (100) 3 weeks ago                       cocky_franklin              f031f28bd29a        f02ed0c206d5         /bin/sh -c 'apt-get    3 weeks ago         Exited (100) 3 weeks ago                       stoic_mcclintock            ### Images               $ docker images -a | head     REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE     docker              master              266a5746d179        2 weeks ago         1.528 GB     <none>              <none>              c1f6a4b1345c        3 weeks ago         1.526 GB     <none>              <none>              6558c36ecb3f        3 weeks ago         1.526 GB     <none>              <none>              b1b7c7a6b6a7        3 weeks ago         1.24 GB     <none>              <none>              0bf9d6bf97e9        3 weeks ago         1.182 GB     <none>              <none>              48c444f1d2e7        3 weeks ago         1.182 GB     <none>              <none>              5c5c172a0038        3 weeks ago         1.182 GB     <none>              <none>              de5e09bb86c1        3 weeks ago         1.182 GB     <none>              <none>              785aaf265f18        3 weeks ago         1.182 GB


changing current working dir with a script

I've read this question and answer, but it doesn't quit fit my problem, even tho it's similar. I'm writing a script (called cpj) that will launch one of my current projects. I have about 5 of them. When I type `$ cpj blah` I want the current working directory to change to the blah project directory (which I hold in $PROJDIR) and I want emacsclient to open the main file for that project (which I hold in $MAINFILE). The question I cited says that you can't directly change the environment of the shell running the script, but you can source a script and it will do so. To test this I wrote a shell script (called chcwd) which has one line: `cd $1` If, from the command line I do: `$ . chcwd $PROJDIR` my current working directory will change as I desire. If, on the other hand, from my cpj script, I have the same line: `. chcwd $PROJECT` it will not change the current working directory of the shell. I realize that I'm running 2 scripts (cpj and then chcwd), and so creating 2 shells, but I see no way to get done what I want. Can anyone show me how to accomplish my goal?


I want to suppress "no access to tty" error message?

I have a bash script where I use `ssh` to connect to another server and run some commands there. I found some sites that the error (`Warning: no access to tty (Bad file descriptor). Thus no job control in this shell.`) is a friendly message but my bash script gets "stuck". No other commands are executed after this message appears. Other forums said to use `ssh -t` to suppress the message but its not working for me. My code looks something like this:               .     .     .     stty -echo     sshpass "pwd" ssh -o StrictHostKeyChecking=no usr@1.1.1.1 'su -lc "rm -rf tmp"' 2>/dev/null     stty echo     .     .     .      The reason why I'm using `stty-echo` is because I need to switch users to root and the password is displayed on the terminal (which I don't want). I get the error message (`Warning: no access to tty (Bad file descriptor). Thus no job control in this shell.`) after I enter the password for root on the connect server (ip: 1.1.1.1). Any suggestions? Let me know if further explanation is required. Thanks! (My version of bash is GNU bash version 3.2.51(1)) **EDIT** The error message I get when removing `2>/dev/null` is:               Warning: no access to tty (Bad file descriptor).     Thus no job control in this shell.      stty: standard input: Invalid argument


Clone installed system by using the hardware RAID 0+1 synchronization

**Alright, following setup:**   * 2 identical machines (DELL Power Edge T320) with a hardware raid.   * one machine is running for a while now, one machine hasn't even been set up at all   * The running machine has a RAID 0+1. 4 disks (4TB each) in total all together **The task:**   * cloning the running machine with everything on there and everything like it is configured on the second machine. They will be used at two different locations but need exactly the same system and data to start from. The state, the running system is in should be used as this desired state and we want to have the complete system on the second machine as well. **The idea:**   * checking the raid to be syncronized on machine 1   * once it's syncronized, exchanging two hard drives (e.g. 1 and 3) with two empty ones   * waiting until they are syncronized again   * exchanging another two harddrives (e.g. 0 and 2) with another two empty ones   * waiting until they are syncronized again   * putting the 4 original harddrives back in machine 1   * putting the 4 copied (via RAID) harddrives in machine 2 and have a cloned copy of machine 1 on machine 2 That would you say to such idea? Thanks!


python error using an executable with Z shell

I'm getting this error from the Unix Z shell (I'm on Mac):               python: posix_spawn: /System/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python: No such file or directory      What am I doing? I'm just running a software in which I put my executable python script. My script is working without any issue, I can also run it from the shell by itself and still works. I have to mention I'm using Python 2.7, even when I launch Python from the shell it starts with Python 2.7 and not the Version2.6. I actually tried to remove Python 2.6 from the Frameworks but again the same error. Putting `python2.7 sreloc.py` as a line (instead of just `sreloc.py`) for example (this is a piece of the big code where my script lies):               do        $inv        python2.7 sreloc.py        $fmm>$diagnos        cp $ttim $mtrav      the error I'm getting is:               /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'sreloc.py': [Errno 2] No such file or directory      I'm really interested in solving this last problem, or anyway being able to run sreloc.py as a part of the main code, but any idea about the first one would be appreciated. Cheers


Best way to download dropbox folders to raspberry Pi

I'm trying to sync some folders to raspberry Pi. For now, I have a script that gets the dropbox folders using curl that runs every so often using `cron` (once every hour for most of the folders). I'm wondering if there are any better solutions (perhaps that check if the folder has changed since the past sync). I'm running a very lightweight Arch distribution and I don't want to install the official dropbox app (which I'm not even sure will work on arm), because it has a lot of prerequisites.


full-featured WLAN USB adaptor

I am searching for a WLAN USB adaptor that can be used as an Access Point as well as a mere client and in an AdHoc setup. It should support IEEE 802.11n and transmit rather fast (300Mbps). As I compile custom kernels for my machines, the driver should come as part of the current kernel (3.7.1 at the time of writing) and does not need to be built externally. If possible, I would even like to avoid installing external firmware. Driver and hardware should support power saving mode. Currently, I am using the AVM Fritz Wlan Stick N which has nearly all the features but under load crashes every few minutes and has to be restarted. So stability is also a requirement. Does such a wondrous device exist?


Reserved characters in file names

I was under the impression that the only character not allowed in file names was `/`, but I don't seem to be able to create a file whose name contains characters such as `*`, `\`, `"`, `:`, `|`, `<` or `>` either. For instance,               $ echo "*"     > *     $ touch "*"     > touch: setting times of `*': No such file or directory      I'm writing a shell script that requires the user to type a file name and I would like to make sure the name doesn't have any invalid characters. Is there a list somewhere? **Update:** I didn't realise I was doing this in a FAT32 filesystem (USB stick), which does not allow `*' and other characters in file names. No wonder it didn't work. Sorry, my bad!!


Is it possible to lock bad bits in RAM on Linux?

Recently I bought 8 GB of RAM and it has bad bits. Is it possible to lock the bad bits to make Linux avoid them?


Open a window on a remote X display (why "Cannot open display")?

Once upon a time,               DISPLAY=:0.0 totem /path/to/movie.avi      after ssh 'ing into my desktop from my laptop would cause totem to play `movie.avi` on my desktop. Now it gives the error: > >     No protocol specified >     Cannot open display: >   I reinstalled Debian squeeze when it went stable on both computers, and I guess I broke the config. I've googled on this, and cannot for the life of me figure out what I'm supposed to be doing. (VLC has an HTTP interface that works, but it isn't as convenient as ssh.)


How to start X program on local display?

I'm ssh-ing into a Raspberry Pi. I would like to start an X program remotely, on the Pi's display. I know you can `export DISPLAY` to have programs open up on your computer when you ssh-in. But I'm looking for the opposite. What I'd like to have is have a program open up on the Pi's own (HDMI connected) display, when I run a command from ssh. What I'm looking for is to have a program run on the Pi and display it on the Pi. Pretty much I'd like to just remote control the Pi, using my desktop's keyboard. I'm on Raspbian / Deb Wheezy.


Script executed from cron doesn't display GUI notifications

The script below has the name **notifyrssh.sh**.               1:  File=/home/vaios/Desktop/tempcron/liveusers.txt    //OK     2:  cd /home/vaios/Desktop/tempcron                          3:  ps -aux | grep sshd > liveusers.txt                //OK file is being updated      4:                                                     //   every minute      5:  for name in gus tom max    //***crontab-problem***                              6:  do     7:     notify-send "$name" "DEBUG_MSG"     8:     if grep -q $name "$File"; then     9:             notify-send  "$name" "ONLINE"     10:    fi     11: done      The above script is being run in crontab. I open crontab list with :               crontab -e      And then i add the line :               * * * * * bash /home/vaios/Desktop/tempcron/notifyrssh.sh      **Execution from shell prompt** The script seems to be executing fine when i run it regularly from the shell prompt. Being in the directory where the executable script is, i execute it like this :               ./notifyrssh.sh      ...and it works as i expect (updates the file liveusers.txt and gives me all the notification messages) . I again execute it like this :               bash /home/vaios/Desktop/tempcron/notifyrssh.sh      ...and again the results are correct (update file liveusers.txt etc and gives me the notification messages). **Execution from crontab, every minute** The problem when the script is being executed every minute by crontab begins from **line 5** and onwards until the end. The file **liveusers.txt** is being updated regularly every minute (I check this with : cat liveusers.txt) but then it doesn't give me the notifications i expect. Let me explain what the above script actually does:   * In the first 3 lines it updates the file liveusers.txt with the contents of the command : ps aux | grep sshd   * From line 5 onwards it checks a list of names ( **gus tom max** ) and then if it finds the name in the file liveusers.txt it gives me the notification message from line 9.    * The notification message from line 7 is being put for debugging purposes exclusively. I expected that crontab script will give me at least the notofication from line 7 but that didn't happen also. Any ideas?


Calling xrandr via SSH

> **Possible Duplicate:**   >  Open a window on a remote X display (why "Cannot open display")? I'd like to ssh to a host running an X server and use `xrandr` to query and update things related to that host's display. I don't forward X connections (no `-X`), but `xrandr` keeps saying it can't find the display. Invoked locally on that host, `xrandr` works as intended. How do I make `xrandr` ignore the fact that I'm logged in remotely, and just operate on the host on which it is running?


Notify-send not working when run from apache

I have the following script (`alert.sh)` which has been setuid'd:               DISPLAY=:0.0 notify-send --urgency=low -i python "The job has finished"      and the following PHP file `alert.php`:               <?php     echo exec("/path/to/alert.sh")      When I `su` to `www-data` and run `php alert.php`, I get an alert on my screen. All good. However, when I open `alert.php` in the browser, nothing happens. I suspect some environment variable needs to be set, but I'm not sure which.


How to access X display from a cron job when using gdm3?

> **Possible Duplicate:**   >  Open a window on a remote X display (why "Cannot open display")? I'm trying to run a cron job that needs access to my X session. I know my X session will always be :0, so part of it is easy:               /30 * * * * DISPLAY=:0 command      but the problem is that gdm3 no longer uses `$HOME/.Xauthority`; instead it uses `/var/run/gdm3/auth-for-anthony-XXXXXX/database` where the X's change each login. Other than symlinking `$HOME/.Xauthority` to the GDM3 file each login (or editing crontab each login, etc—automatically in `.xsession` of course), is there some way to get the cron job working?


Xlib: No protocol specified

> **Possible Duplicate:**   >  Open a window on a remote X display (why "Cannot open display")? I have a script that when run independently works that needs X11 Display variables to be set. When I invoke this script using a background daemon job, I get the following error.   `Xlib: connection to "localhost.localdomain:0.0" refused by server`   `Xlib: No protocol specified`   Please help me identifying the possible mistake that I have in this.   Commands given below which is inside the script.   `export DISPLAY=`hostname`:0.0`   `java ScreenCapture`   If the same script is invoked by a background daemon running as a service, I get the error.


unable to forward X11 applications

I installed a headless Debian server which has Wireshark installed. Now I would like to run Wireshark in a way that it uses X11 server running in my Linux Mint laptop. As a first step I permitted X11 forwarding in Debian SSH server configuration file:               root@A58:~# grep X11Forwarding /etc/ssh/sshd_config      X11Forwarding yes     root@A58:~#       Then I restarted SSH server with `/etc/init.d/ssh restart` and finally executed SSH client in my laptop using `-X` which enabled X11 forwarding. However, I still receive the "cannot open display" error:               root@A58:~# echo "$DISPLAY"     localhost:11.0     root@A58:~# wireshark           (wireshark:3590): Gtk-WARNING **: cannot open display: localhost:11.0     root@A58:~# time xterm     Warning: This program is an suid-root program or is being run by the root user.     The full text of the error or warning message cannot be safely formatted     in this environment. You may get a more descriptive message by running the     program as a non-root user or by removing the suid bit on the executable.     xterm: Xt error: Can't open display: %s          real    1m3.131s     user    0m0.000s     sys 0m0.000s     root@A58:~#      Is the "$DISPLAY" variable correct? At the moment it's pointing to Debian server.. If the "$DISPLAY" variable is correct, then it's probably an authorization issue with X11 server? EDIT: if it helps, then X11 in laptop is started in following manner:               root      1113  0.1  4.3 101396 89992 tty7     Rs+   2013  44:28 /usr/bin/X :0 -nr -verbose -auth /var/run/gdm/auth-for-gdm-FHVC1j/database -nolisten tcp vt7


Is there a way to get the Public DNS address of an instance?

I have a project wherein I need to update configuration files each time an EC2 instance is booted with the Public DNS address of the current instance. I'll be using Perl or Sed for this, so that's not really the question, but the real question is: is there a way that I can determine the instance's public DNS address? Is there an EC2 api that I can access from the instance to determine it?


Can a service script put inside init.d be called at startup and shutdown?

I'm running Red Hat 5.1. I have a script called sysinit that I added as a service using chkconfig --add sysinit. I have the following set in the file:               #chkconfig 4 01 01      This creates one symlink in my rc4.d directory for S01sysinit. However, I want the script to be run on startup and shutdown. No matter what I do, I cannot get a custom script (Service) to run on shutdown. I even tried separating out my functionality into two scripts, one to run at S01 and the other to run at K01 but it didn't work. I don't want to have to resort to modifying the rc.sysinit file to do what my script should be doing (I shouldn't have to touch that I would think). The reason I need to do this is because I need to unmount a samba share inside the /opt directory before the rc.sysinit file tries to unmount the /opt directory (right now I get "device is busy" failures because the cifs mount is still there). Is there something special I need to do so that my script can run on startup and on shutdown and reboot? Can I have a K01sysinit and S01sysinit in the same run level? Or am I misunderstanding how run levels work? I have the sections for )start and )stop already in the script.


How to install backtrack 5 onto a USB that doesnt mount with existing OS

I believe the title states what im mostly asking but here's the specs. Sandisk Cruzer 4GB USB 2.0 Existing OS: Windows Xp Professional SP3 Hardware: Intel Pentinium 4 Xeon Class (x86 F15 M2 S4) [1.8Ghz] IBM Thinkpad T-Series T30 So what I am wanting to do is, Put backtrack onto the usb and run it like the usb was a hard drive. This way it doesnt affect the physical machine and doesnt erase the current OS. Is there a way of doing this?


Error while loading shared libraries after installing a program

I was installing rfc5766-turn-server. But it fails to launch with an error: `error while loading shared libraries: libevent_core-2.0.so.5: cannot open shared object file: No such file or directory` Here's a copy-paste of how I did the installation:               $ cd /var/tmp;     wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz; tar xvfz libevent-2.0.21-stable.tar.gz; cd libevent-2.0.21-stable; ./configure; make; make install;     wget http://rfc5766-turn-server.googlecode.com/files/turnserver-1.8.6.3.tar.gz ; tar xvfz turnserver-1.8.6.3.tar.gz; cd turnserver-1.8.6.3; ./configure; make; make install;     /var/tmp/turnserver-1.8.6.3/bin/turnserver;      I tried this, but it didn't help (same error):               $ ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib64/libevent-2.0.so.5;     /var/tmp/turnserver-1.8.6.3/bin/turnserver ;      **EDIT:** (without changes if i run as below it runs it, but when i test with client it does not show any kind of logs that TURN is hitting or reached by client)               $ export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib/;      PATH="bin:../bin:../../bin:${PATH}" turnserver -L 176.34.x.x -a -b /usr/local/etc/turnuserdb.conf -f -r 176.34.x.x     1371111272: RFC 5389/5766/5780/6062/6156 STUN/TURN Server, version Citrix-1.8.6.3 'Black Dow'     1371111272: Config file found: /usr/local/etc/turnserver.conf     1371111272: Listener address to use: 176.34.x.x     1371111272: Config file found: /usr/local/etc/turnserver.conf     1371111272: WARNING: cannot find certificate file: turn_server_cert.pem (1)     1371111272: WARNING: cannot start TLS and DTLS listeners because certificate file is not set properly     1371111272: WARNING: cannot find private key file: turn_server_pkey.pem (1)     1371111272: WARNING: cannot start TLS and DTLS listeners because private key file is not set properly     1371111272: Relay address to use: 176.34.x.x     1371111272: IO method (listener thread): epoll     1371111272: WARNING: I cannot start alternative services of RFC 5780 because only one IP address is provided     1371111272: IO method: epoll     1371111272: IPv4. UDP listener opened on : 0.0.0.0:0     1371111272: IPv4. TCP listener opened on : 0.0.0.0:39227     1371111272: IO method (auth thread): epoll     1371111272: IO method (relay thread): epoll


Entries I can safely exclude doing backups

I'm planning a backup strategy based on rsnapshot. I want to do a full system backup excluding files and directories that would be useless for the restore to have a working system again. I already excluded:               # System:     exclude /dev/*     exclude /proc/*     exclude /sys/*     exclude /tmp/*     exclude /run/*     exclude /mnt/*     exclude /media/*     exclude /lost+found          # Application:     exclude /*.pyc     exclude /*.pyo      I wonder which other entries I can add to the exclude list without compromising the restored system. Talking about a "generic" Linux system, can you suggest further glob extensions, temporary directories, caches, etc. I can exclude safely?


Recovering files from partition (ext4)

a part of out homework assignment is to recover deleted files from the partition with the ext4 file system. I've tried using the extundelete tool, by following this tutorial. The tool recovered a lot of files, which couldn't be opened, so I guess this doesn't do me any good. Is there any other tool I could try, to recover the deleted files, or is this tool the best there is? I didn't write anything to the partition, before the recovery process, and I recovered the files to another partition.


Is there an all-in-one command for RPM to downgrade a package to an older version?

I want to downgrade a couple RPMs. Is there a switch combination for that? For example, when upgrading, I usually run `rpm -Uvh foo.rpm` but my understanding is that the `-U` switch means that it only replace the package if it's older... so it won't work for downgrades.


Kernel panic in Fedora 18 after updating to kernel-3.9

I'm really a beginner in Linux, I've installed Fedora 18 and did `yum update` to update my system. I got a bunch of updates (around 350 MB download), among them is `kernel-3.9.4-200.fc18.x86_64`. Now, when I boot my system to the new added boot entry with the new kernel I get the following kernel panic message: ![enter image description here](http://i.stack.imgur.com/3hqPj.jpg) I tried to remove the kernel by:               yum remove kernel-3.9.4-200.fc18.x86_64      Then reboot and do another update:               yum update      The kernel is re-installed but is still getting that kernel panic message. How can I fix this?


Text to yaml conversion

I have a tab separated text file in this format:               your-email  your-order-id   PayPal-transaction-id   your-first-name your-second-name     s@ess.com   12345   54321   sooky   spooky     t@tee.com   23456   23456   kiki    dee     r@arrgh.com 34567   76543   cheeky  chappy      and I'd like to use awk to convert this to yaml:               ---          your-email: s@ess.com     your-order-id: 12345     PayPal-transaction-id: 54321     your-first-name: sooky     your-second-name: spooky          your-email: t@tee.com     your-order-id: 23456     PayPal-transaction-id: 23456     your-first-name: kiki     your-second-name: dee          your-email: r@arrgh.com     your-order-id: 34567     PayPal-transaction-id: 76543     your-first-name: cheeky     your-second-name: chappy      So far my awk script looks like this               #!/usr/bin/awk     FS=="\t"     BEGIN {print "---"}      NR==1 {for (i=1;i<=NF;i++) print $i ": "}      But I can't figure out how to get each field from line 1 onwards to print after it's header and then recreate the yaml key values from the first line of the input file. In the real file there are 38 fields and 34 records (so not huge).


What are commands to find shell keywords, built in functions and user defined functions?

I was discussing with my friend on how the commands are parsed in the shell, and he told me that bash searches the command in following order   1. List of aliases    2. List of shell keywords    3. List of user defined functions    4. List of shell built in functions    5. List of directories specified in the PATH variable , from left to right. I know aliases can be found by issuing the `alias` command. PATH variable contents can be found using `echo $PATH` command. Can you please tell me which commands do I need to use ?   1. To list all shell keywords    2. To list all user defined functions    3. To list of shell built in functions


rsync and SMB share

If I'm performing an `rsync` copy operation on a file that is on an SMB (Samba) share, is the file actually being pulled down from the network onto my client, pieces at a time, and then copied back onto the share? I'm seeing file copy commands with `rsyn`c topping out at around 10 MB/s, which seems quite slow considering the enterprise storage this mount is on. Specifically I'm invoking rsync via Python.


Contentless modal windows on RHEL Gnome

I'm a Linux newbie, so please be understanding if I mix terminology. I've got a pc with RHEL 6.4 installed. I'm using Gnome for my GUI and frequently I'm having a problem with modal windows displaying without content (but with shadow). I have to hover over the active (that can be clicked or hovered over) items to see what's there. Excellent example is Network connections: ![enter image description here](http://i.stack.imgur.com/sGlnX.jpg) Although it doesn't happen often, it's happens frequently enough to be terribly annoying. What can I do to make this issue go away? I know I have Compiz installed. Ask questions if you need more details.


Relative line offsets in awk (/pattern/+1 or /pattern/-1)

When I want to print lines between two patterns, excluding the lines with those patterns, I can do it in `ex` using `+1` and `-1` after the pattern. That is awesome. Is this possible in `awk`? Right now, I kludge it by setting an `is_printing` flag. This is `ex` to get the column definitions from an SQL table creation:               $ ex schema/media.sql <<< '/^CREATE TABLE/+1,/^)/-1p'     #        id     #                SMALLINT     #                UNSIGNED     #                NOT NULL     #                AUTO_INCREMENT     #                COMMENT 'The auto-generated ID.',     #        parent_id     #                SMALLINT     #                UNSIGNED     #                NULL     #                COMMENT 'The ID of the parent album, if any.',     #        title     #                VARCHAR(255)     #                COLLATE utf8_unicode_ci     #                NOT NULL     #                DEFAULT ''     #                COMMENT 'The album title.',     #        description     #                TEXT     #                COLLATE utf8_unicode_ci     #                NOT NULL     #                COMMENT 'The album''s description.',      This is an `awk` command to do the same:               $ awk '/^\)/ { exit; } is_printing; /^CREATE TABLE/ { is_printing = 1; }' schema/media.sql      I find the awk version not as readable. Is there an idiom I am missing? Can `sed` do something like this, too? (I prefer `awk`'s syntax over `sed`'s.)


Edit a file in several emacs sessions

Emacs says > You want to modify a buffer whose disk file has changed since you last read > it in or saved it with this buffer. > > If you say `y` to go ahead and modify this buffer, you risk ruining the work > of whoever rewrote the file. If you say `r` to revert, the contents of the > buffer are refreshed from the file on disk. If you say `n`, the change you > started to make will be aborted. > > Usually, you should type `n` and then `M-x revert-buffer`, to get the latest > version of the file, then make the change again. Why does it recommend > Usually, you should type `n` and then `M-x revert-buffer`, to get the latest > version of the file, then make the change again, rather than > say `r` to revert, the contents of the buffer are refreshed from the file on > disk? Are the two really different? They seem the same to me?


Check values in a text file

Is there a simple way to check if values in the second column of a file ( File 2) exist in the second column of another file (File 1), for example by printing a star next to the concerned line? If possible using awk. File 1               A   1,2,3,4      B   15,16,17      File 2               A   3     B   18      Expected output: File 3               A   1,2,3,4     *     B   15,16,17               **EDIT** What if File 2 looks like:               A    3,8     B    18,19      but the expected output remains the same?


XML parsing using xmllint and customizing the output

I have xml file (say input.xml) of the following schema:               <?xml version="1.0"?>       <TagA>         <TagB>           <File Folder="FOLDER1M\1" File="R1.txt" />         </TagB>         <TagB>           <File Folder="FOLDER1M\2" File="R2.txt" />         </TagB>         <TagB>           <File Folder="FOLDER2M\1" File="R3.txt" />         </TagB>       </TagA>      I need to parse this file and write the output to another file. The required output should be of the following form:               www.xyz.com\FOLDER1M\1\R1.txt     www.xyz.com\FOLDER1M\2\R2.txt     www.xyz.com\FOLDER2M\1\R3.txt      What I have got so far is:               echo 'cat /TagA/TagB/File/@*[name()="Folder" or name()="File"]' | xmllint --shell input.xml | grep '=' > xml_parsed      This gives me o/p of the form:               / > cat /TagA/TagB/File/@*[name()="Folder" or name()="File"]     Folder="FOLDER1M\1"     File="R1.txt"     Folder="FOLDER1M\2"     File="R2.txt"     Folder="FOLDER2M\3"     File="R3.txt"      How should I go about getting my required output instead of this current o/p?


Backed up over wrong hard drive

I've just written over the wrong hard drive using the command:               sudo sh -c 'pv /dev/sdb >/dev/sdc'      How do I go about undoing this? I was creating the first even backup of the drive, and I backed up over the wrong drive... The drive which got written over also has no backups, I was going to backup that drive next. Both drives were dm-crypt'ed.


How can I get the netmask from an IP address?

How do I get a netmask from the IP address? Is there a command to get it?


Resuming screen with UTF8 enabled breaks character input

# Overview of UTF8 screen re-attachment issues. ## Problem: Creating a screen that uses UTF8 works perfectly until re-attaching said screen session. ## Steps:               ssh remothost     screen -U -S ttytter     [detach screen]     [exit ssh]     xterm -class 'xterm-ttytter' -geometry 175x20 \       -title 'ttytter' -e ssh -t remotehost "screen -dU -r ttytter"      ## Details I am a really big fan of ttytter and have been using it for some time now. I have recently started using xterm vs xfce4-terminal/gnome-terminal as I find it is much cleaner. I am trying to use UTF8 for personal and professional reasons and I am still trying to work out a few bugs. The initial attachment (creation) gives me UTF8 input that works like it should. $TERM is **xterm-256colors** while $LANG is **en_US.UTF-8**. This is also true once I re-attach the screen, although I am unable to use certain characters, such as backspace, which shows up as **^H**. It seems that the issue is specific to the command I am issuing to re-attach the screen. I am trying to figure out what it is that could be causing such an issue when I re-attach my UTF8 screen. I have tried _-dr_ and _-dU -r_ , both of which are failing to solve my problem. I have tried giving xterm the -u8 flag, giving me no change in behavior.               xterm -class 'xterm-ttytter' -geometry 175x20 \     -title 'ttytter' -e ssh -t remotehost "screen -dU -r ttytter"      The above causes problems.               ssh remotehost     screen -dU -r ttytter      The above works just fine. ## Settings ### .screenrc               defc1 off     defutf8 on     utf8 on      ### .Xdefaults               xterm*utf8: 1      ### .bashrc               export LANG=en_US.UTF-8      I will really appreciate any guidance on solving this issue.


Fedora 16 install from USB memory stick to Samsung NP305U1A netbook will not boot

I have installed Fedora 16 from a USB memory stick. After installing, which seems to work just fine, and after rebooting I end up in the BIOS. I can not find which BIOS settings to use and have not succeeded by using common sense. Could there be a problem with the partitions? The live version from the same USB device works fine. has anyone come across this problem and knows how to fix it? Thanks!


Delete whole line if after ":" less than 4 chars

I have a file with many lines, such as :               blue:fish     red:tomato     black:moon      I would like the whole line to be deleted if after ":", there is less than 4 chars. Thanks for your help!


Question about using pdflatex on RedHat in CentOS

I am a novice in using Linux systems. I was given an assignment of writing a document using LaTeX and converting the file into a pdf file to submit. So I tried using my CentOS to do so. The version of my Linux system is RedHat. I've looked up ways to convert .tex file into .pdf on the web, which told me to install texlive. So I did so.               [csi2102@localhost]$ yum install -y texlive     Loaded plugins: fastestmirror, refresh-packagekit     Loading mirror speeds from cached hostfile       * base: data.nicehosting.co.kr       * extras: data.nicehosting.co.kr       * updates: data.nicehosting.co.kr     Setting up Install Process     Package texlive-2007-57.e.16_2.i686 already installed and latest version     Nothing to do      So I looked up for ways to solve this problem and one of the websites suggested of using `rpm -qa | grep tex` command. But nowhere could I find the pdflatex file.               [csi2102@localhost]$ rpm -qa | grep tex     texlive-texmf-errata-dvips-2007.7.1.e16.noarch     texlive-2007.57.e16_2.i686     texlive-texmf-errata-fonts-2007.7.1e16.noarch     texlive-texmf-2007-38.e16.noarch     texlive-texmf-fonts-2007-38.e16.noarch     texlive-texmf-errata-2007-7.1.e16.noarch     texlive-texmf-dvips-2007-38.e16.noarch     [csi2102@localhost]$       This is what I saw when I typed the command. When I try to use pdflatex, latex, or pdftex command, this is what I get.               [csi2102@localhost]$ latex homework     bash: latex: command not found     [csi2102@localhost]$ pdflatex homework     bash: pdflatex: command not found     [csi2102@localhost]$ pdftex homework     This is pdfTeXk, Version 3.141592-1.40.3 (Web2C 7.5.6)      %&-line parsing enabled.     entering extended mode     (./homework1.tex     !Undefined control sequence.     1.7 \documentclass                        [pdftex,11pt] {article}     ?      I don't see why my system would not recognize unlike how other people have been saying. P.S. Oh, and just in case, I wanted to attach my .tex file wondering if what I have written in my file was creating the problem.               \documentclass[pdftex,11pt] {article}     \usepackage[utf8] {inputenc}          \usepackage{geometry}     \gemoetry{a4paper}          \usepackage[dvips]{graphicx}     \usepackage{pslatex}          \usepackage{fancyhdr}     \pagestyle{fancy}     \renewcommand{\headrulewidth}{0pt}     \lhead{}\chead{}\rhead{Introduction to Engineering Design}     \lfoot{}\cfoot{\thepage}\rfoot{}          \usepacakge{sectsty}     \allsectionsfont{\sffamily\mdseries\upshape}          \title{What is \LaTex ?}     \author{2013147549 Geun Ho Lee}     \date{}          \begin{document}     \maketitle           LaTex is a document preparation system that is most often used for medium-to-large technical or scientific documents. It is not, however, a word processor. It is based on the idea that it would be more efficient for the authors to write their documents and let the document designers to worry about the document design. LaTex consists of several features ranging from typesetting journal articles, technical reports, books, and slide presentations to automatically generating bibliographies and indexes.           LaTex is based on the TeX typesetting language or certain extensions of it. LaTex was first developed in 1985 by Leslie Lamport and is now maintained and developed by the LaTex3 Project.           (source: http://latex-project.org/intro.html)          \end{document}


Can I configure things to open new windows on the left screen?

When I attach an external (D-SUB) display and set it up (with xrandr) to be on the right to the main (built-in) display, the most of new windows opened appear on the external display and some even farther to the right of it (leaving the most of their area outside the visible area). Can I configure things the way that new windows would appear in the centre of the main (the very left) display (the same way as they do when there is no external display attached)? PS: I use XUbuntu 11.10 with XFCE 4.8 on Dell Latitude E5500 with Intel GMA X4500HD card. My built-in display has 1440x900 resolution, my external display resolution is 1024x768 (this is another problem of mine actually, I can't configure any external display for more than 1024x768, but this is a separate question).


Show sum of file sizes in directory listing

The Windows `dir` directory listing command has a line at the end showing the total amount of space taken up by the files listed. For example, `dir *.exe` shows all the `.exe` files in the current directory, their sizes, and the sum total of their sizes. I'd love to have similar functionality with my `dir` alias in bash, but I'm not sure exactly how to go about it. Currently, I have `alias dir='ls -FaGl' in my`.bash_profile`, showing               drwxr-x---+  24 mattdmo  4096 Mar 14 16:35 ./     drwxr-x--x. 256 root    12288 Apr  8 21:29 ../     -rw-------    1 mattdmo 13795 Apr  4 17:52 .bash_history     -rw-r--r--    1 mattdmo    18 May 10  2012 .bash_logout     -rw-r--r--    1 mattdmo   395 Dec  9 17:33 .bash_profile     -rw-r--r--    1 mattdmo   176 May 10  2012 .bash_profile~     -rw-r--r--    1 mattdmo   411 Dec  9 17:33 .bashrc     -rw-r--r--    1 mattdmo   124 May 10  2012 .bashrc~     drwx------    2 mattdmo  4096 Mar 24 20:03 bin/     drwxrwxr-x    2 mattdmo  4096 Mar 11 16:29 download/      for example. Taking the answers from this question gives me               dir | awk '{ total += $4 }; END { print total }'      which gives me the total, but doesn't print the directory listing itself. Is there a way to alter this into a one-liner or shell script so I can pass any `ls` arguments I want to `dir` and get a full listing plus sum total? For example, I'd like to run `dir -R *.jpg *.tif` to get the listing and total size of those file types in all subdirectories. Ideally, it would be great if I could get the size of each subdirectory, but this isn't essential.


Traceroute doesn't work on Linux, on Windows it does

I'm a Linux Mint user. I've run traceroute on Linux and tracert on Windows. On Linux, I just get asterisks. Everything seems to work fine on Windows. Here are the outputs Windows: ![Windows](http://i.stack.imgur.com/Igltu.png) Linux Mint: ![Linux Mint](http://i.stack.imgur.com/ua4i4.png) Why is this happening and is there something I can do to solve this problem?


Pass flags to xargs

I want to kill a bunch of processes using this command:               sudo ps ax | grep node | awk '{print $1}' | xargs kill      But it gives me operation not permitted even with sudo. Then I tried with `kill -9` individually for each process and it worked. Now my question is how do I pass `-9` flag to kill via xargs? Nether `xargs kill -9` or `xargs -9 kill` worked for me.


I am trying to compile an application called "iPerf" in my windows environment using cygwin. Now this is my first time with cygwin but I hope my problems with cygwin would be considered valid with Linux environment since they share the same commands. Now, when I try to do ./configure with my iPerf installation it throws following error:               configure: error: cannot guess build type; you must specify one      I am not sure what it is trying to say with it but online search did not help much if you want to replicate what I am doing then here is the link of iPerf source which I am trying to compile in my cygwin environment : > http://sourceforge.net/projects/iperf/ Any suggestions?


How can I secure my Ubuntu 13.04 to prevent network attacks?

Is there a way I could protect my pc computer from being hacked in an event where the internet conection will be opened? Thing is I am going to Campus Party Colombia 2013 and I was sugested to format my computer before going and after the event, Is that really necesary? I know Unix like systems got a higher level of securty than Windows, however as in campus party there will be people who know a lot about hacking and networking, I'd rather take some considerations. Is there a way to protect my computer? If not, What about installing another GNU/linux flavor alongside my Ubuntu installation? I'd apreciate any advice on this.


Bought speakers (HS-307 USB), driver issue

I just bought this headset.   It only states the speakers are compatible with Windows but I have bought devices before that made such statements which then turned out to work fine on Linux. Is there any way for me to get those speakers to work on Linux?


What program or feature is overriding my “Unity style” keyboard shortcuts in DockbarX?

I have DockbarX installed with the option "Use Unity style shortcuts (Super+number)" enabled. Recently I am unable to activate the 2nd application with Super+Shift+2 (I'm on azerty). When I use that shortcut, a thin white edge is shown around the window frame, or the desktop depending which is active. It's a double edge (white, black, white). It disappears once I release the Super(Win) key. Do you know what program does this, and how would I disable it or give DockbarX priority for the keyboard shortcut? (I'm on Linux Mint 14)


How to change wrong mime type for msi file?

`file -i <here msi file>` returns `application/vnd.ms-office` and I think that is wrong. I need a more specific mime type for msi files. I know about magic files but I really need some help with them. I have no internet on this PC so I need edit file manually. How can i correctly do that?