Adding wallpapers in GNOME Shell

When executing `Activities → Settings → Background`, you can find three background tabs:   * [Wallpapers]   * [Pictures]   * [Colors] In [Wallpapers] you can find backgrounds under `/usr/share/backgrounds/`, but which have been previously added to an XML configuration file in `/usr/share/gnome-background-properties/`. If you put new backgrounds in `/usr/share/backgrounds/`, but you don't add them to an XML file, they won't be displayed. On the other hand, in [Pictures] you can find backgrounds under `~/Pictures/` and any new addition will automatically be detected and displayed by the application (this folder is "reloaded" or "refreshed" every time). Is there any way I could set the [Wallpapers] tab to automatically find new pictures under `/usr/share/backgrounds/` as well? If not, is there a way I could change the configuration, so that, when clicking on the [Pictures] tab, it will look under `/whatever/i/want/` instead of `~/Pictures/`? I know I could just edit the XML configuration file (myself, with a script, or even with existing GUIs), but I am not looking for that. I just feel curious about the customization level of GNOME Shell. I am using Fedora 20 with GNOME Shell 3.10.


Does exists a Linux distro that run on an AllWinner A10S cpu?

I've just bought a mini pc (a T004 Auxtek) but I would like to run a Linux distro on it so I can use as mini server Linux. Do you know if exists an AllWinner A10s distro for this type of mini PC?


Are writes to eventfd counted as io?

I am trying to reduce hard-disk activity on my system. Running `iotop` shows that Eclipse (the IDE, latest version (Luna)) is writing kilobytes of data every few seconds. So I ran `strace` on the eclipse process and the only `write`s that I can see are to a file-descriptor that points to `eventfd`. I am not familiar with `eventfd`, but it seems like an event bus of some sort. Does `write` to it get accounted as a disk write?


telinit 1 and run a command there

I need to do some maintenance on a bunch of Debian (Wheezy) systems, and it has to happen at run level 1. But not all machines have a keyboard and a screen; some are even located somewhere else. So I can't just go there and type in the root password to trigger the job. So my question is how can I tell Debian to run a command right before the "Type root password or ^D" prompt? I've tried to make a init script that only runs on run level 1, but still it was triggered before all processes where killed. Is there a way to do this?


What is the problem with the output of plink?

On my Windows7 machine, I'm traversing to the installed path of PuTTy Application and running:               plink <hostname>      to connect to my remote Linux host. I see some unrecognized characters in the output as:               -bash-3.2$ ls -lrt     ←[00mtotal 96     drwx------ 5 lg262728 lg262728  4096 Jun 10 15:32 ←[00;34mmyScripts←[00m     drwx------ 2 lg262728 lg262728  4096 Jun 12 13:19 ←[00;34mmyLangs←[00m     drwxr-xr-x 4 lg262728 lg262728  4096 Jul  1 07:43 ←[00;34mmyWorkSpace←[00m     ←[m-bash-3.2$      What is wrong here? Is it something about encoding?


Slow DNS resolve from curl/lynx etc

I have a strange issue with DNS resolving: Root of the problem is that I get curl errors: "Error executing HTTP request: name lookup timed out". Tried to ping some sites, all resolved fine (and fast). When trying Lynx with the same sites, some resolve really, really slow. Using Debian Wheezy. Now tried `gethostbyname()` in a PHP script, and that worked without problems. Why is the resolve fast with ping/php but extremely slow with Lynx/curl (curl ran from php). I had this issue some months ago but since then it was working, until now.


Manipulate color in VIM

In `hlsearch` mode, seems that you can set only one color. Now I want to use a script to get multiple colors for multiple keywords, is that possible?


How to silently get an empty string from a glob pattern with no matches

Say I have a folder with three files:               foo1     foo2     bar      **1.** If I run               list_of_files=$(print foo*)     echo $list_of_files      I get: `foo1 foo2` **2.** If I run               list_of_files=$(print bar*)     echo $list_of_files      I get: `bar` **3.** However, if I run               list_of_files=$(print other*)     echo $list_of_files      I get: `zsh: no matches found: other*` (the variable `$list_of_files` is empty though) * * * Is there a way to ask zsh to not complain if it can't match a glob expansion? My goal is to use the mechanism above to **silently** collect a list of files that match a given glob pattern. Any alternative suggestions to do this would be greatly appreciated.


Missing IPsec package in Solaris 10

I'm running Solaris 10 v5/08. Running `svcs -a | grep ipsec` returns nothing, so I have reason to believe IPsec isn't installed (or isn't showing up for some other reason). How can I make sure it is installed and set up correctly?


How do I get svlogd to write data more often within a runit job

I currently have this log/run script as part of a runit service:               #!/bin/sh     set -e          exec svlogd -tt ./main      If I "`tail -f log/main/current`", I don't see the service output written in "real time." It seems to only dump the stdout in 4K increments. So if the service is used lightly, I can't see the most recent log data, unless I actually do an 'sv restart' on the service, in which case all data is written to the logs before the service is restarted. I've played around with the "-l" and "-b" arguments, but these did not have any effect (and I'm not even sure it matters at this point).


"Bookmarks" for bash

Navigating several layers of nested directories is often a pain. On Firefox, it is easy because they have bookmarks. So what I'd like to do to bookmarks a file is to type:               $ go --add classes "repo/www/public/util/classes"      Then, to go to this directory, I'd type:               $ go classes      Previously I've used symbolic links, to achieve something similar, but I don't want to clutter up my home directory. There are lots of other features that could prove useful. For example, I would like to able to start typing `go cl` and then hit tab to autocomplete. Sometimes I have multiple copies of a repository checked out and so it would be useful for the program to allow me to create multiple contexts and to set the bookmark relative to the context base directory. So, before I set off on cobbling my own set of scripts together, is there already something like this?


Awk - how to compare two numbers?

This example works fine:               awk -v num1=5999 -v num2=5999  'BEGIN{ print (num2==num1) ? "equal" : "not equal" }'     equal      This example does not work well:               awk -v num1=59558711052462309110012 -v num2=59558711052462309110011 'BEGIN{ print (num2==num1) ? "equal" : "not equal" }'     equal      In the second example compared numbers are different. Why not print "not equal"?


Search for "not newline" in vim?

To search for `A T\n` in vim I can just do               /A T\n      What would be the equivalent for not newline at the end?               /A T[^\n]      did not work.


Using KDE services/apps without running plasma workspace

How can I use KDE services without actually running the whole plasma workspace ? I want to use awesomewm but I couldn't manage to run KDE services without actually running `plasma-desktop`. My point is I don't want to run everything under xterm(or other terminals) and want to use KDE's GUI tools and services(like network manager, device mounter etc.) Any help will be appreciated.


`mount -o loop` changes mounted ISO image file

It looks like `mount -o loop` changes the mounted image file. I downloaded the ISO image file and checked its SHA-1 checksum. Then I mounted that ISO file and the checksum changed. Here are the exact steps I made, a copy-paste from my console, CentOS 7 x64 (note, that ISO file is read-only):               [mbartnicki@89-78-33-81 Downloads]$ ls -lh     total 3.1G     -r--r--r--. 1 mbartnicki mbartnicki 3.1G Mar 31 18:28 X17-58997.iso     [mbartnicki@89-78-33-81 Downloads]$ sha1sum X17-58997.iso      6c9058389c1e2e5122b7c933275f963edf1c07b9  X17-58997.iso     [mbartnicki@89-78-33-81 Downloads]$ sudo mount -o loop X17-58997.iso /mnt/iso/     mount: /dev/loop0 is write-protected, mounting read-only     [mbartnicki@89-78-33-81 Downloads]$ sha1sum X17-58997.iso      994944df320e9e03c032263d7b9e36157a0a587c  X17-58997.iso      I was so surprised, that I repeated above steps on another machine (Ubuntu 14.04 x64), just to get the same result: file checksum changed after `mount -o loop`. Unmounting ISO image doesn't return its checksum to original value; file change is persistent. Moreover, next mount change the checksum again to some new value. How can it be explained? **PS** Mounting explicitly read-only by adding `ro` mount option prevents file from being changed, so that if I use: `sudo mount -o ro,loop X17-58997.iso /mnt/iso` then everything is OK, and ISO image file lasts unchanged after mount. The wrong behaviour occurs only when `ro` option is not specified, even if the ISO image file is read-only on the file system level. I tried on three different ISO images: Windows 7 installation DVD (official), SystemRescueCD (small rescue Linux) and hand-made ISO created by `genisoimage` tool. I checked all that ISO files with `file` utility, and `file` said that all of them are _ISO 9660 CD-ROM filesystem data_. Files inside ISO images are not changed - I also checked it - it looks like the faulty mount scenario adds some meta-data or just garbage.


install and run new version of R

an old version of R is already installed on the server I am working with, but it is not really useful for my work. I have tried to install R 3.1.1 on my own directory (/local/data/project/behi) on the server using this command : $ wget http://cran.rstudio.com/src/base/R-3/R-3.1.1.tar.gz $ tar xvf R-3.1.1.tar.gz $ cd R-3.1.1 $ ./configure --prefix=$HOME/R $ make && make install when I tried to run R (by just typing R in my directory) again it showed me the old version of R. would somebody please let me know what the problem is and how I can **install** and **run** the new version of R? thanks in advance, Behi


Java location from /usr/bin/java

I'm trying to find my java location within my Linux system and got this               [980@b449 ~]$ which java     /usr/bin/java               [980@b449 ~]$ readlink -f $(which java)     /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/bin/java      what is the difference between the 2 commands?


Why is systemd-coredump storing the dump in memory itself?

I just noticed that most of my memory was hogged by coredump of a few processes that I had killed recently. I had a systemd-coredump process running for each crashed process (usually the processes were google-chrome, which I had force quit, which explains the large memory consumption). What I would like to know is why instead of dumping the core of the crashed process to the disk, a new process that holds the entire core in the ram is being started. Is my configuration buggy or is it supposed to be this way? If so how do I change the behavior? For now I have disabled the storing of core dump by linking `/dev/null` to `/etc/sysctl.d/coredump.conf`, though I do not see core dumps, but still would like to keep it enabled. Any ideas/hints would be appreciated. (The issue is also posted at: https://bbs.archlinux.org/viewtopic.php?pid=1246237)


Function of owning group versus ACL group permissions

Given the fact that we can give any number of groups rwx via POSIX ACL's is there any special privileges given to the owning group? For example, we can set any number of users with ACL's but only the owning user (and root) can manipulate permissions. Is it just traditionally how elevated permissions were given to a group of people or does the owning group have additional rights?


Run entire OS from flash drive

I am looking for a distribution that can run the entire OS from a flash drive. This question is NOT about being simply able to boot and/or run OS from a USB stick: what I am looking for is a distribution that specifically targets flash disk as a boot media. One example of such a distribution that comes to my mind is Android; however, I would prefer something that I could use on a server. **edit** : I feel I must explain myself, why I wrote this post. I am aware it is possible, and quite easy as a matter of fact to install many distributions onto a USB flash drive. What flash drive is missing (if you compare it to SSD) is the wear-leveling smarts built into SSD firmware. But my logic was, that this should be possible to emulate wear-levelling logic using software, this is why JFFS, YAFFS, LogFS systems came about. What I am looking for is a distribution, which is made to run from one of those systems.


How to create a VirtualBox HDD?

I need to have a file on a VirtualBox guest's HDD. What are the solutions for this? How can I put a file on a Virtualbox guest's HDD? Version: virtualbox-4.1 4.1.8-75467~Ubuntu~lucid I mean I need a solution that doesn't require to have a VirtualBox guest (when putting the file to a vbox hdd). I just need to prepare Vbox disks that contain the given files for later use. UPDATE: or it would be enough to create a vbox hdd from a physical disk! But If I:               VBoxManage internalcommands createrawvmdk -filename /home/USERNAME/Desktop/vboxhdd.vmdk -rawdisk /dev/sdb1      I get this error message after I configure a vbox guest to use the newly created disk: http://i.imgur.com/IYVKr.png


Running Plasmoid under NOTKDE (e.g. Fluxbox) - Plasma/DeviceNotifier

Is there way to run Plasma/DeviceNotifier under another WM to KWin/KDE (e.g. Fluxbox). To be more specific, I have currently configured KDE, but I work remotely thorough SSH -Y + X-forwarding. So running `plasma-desktop` might run all other Plasmoids/Widgets. I'd like to run only one : DeviceNotifier. As I see it runs thought libs, no standalone executable there:               ~$ pacman -Ql | grep devicenoti     kdebase-workspace /usr/lib/kde4/plasma_applet_devicenotifier.so     kdebase-workspace /usr/lib/kde4/plasma_engine_devicenotifications.so     kdebase-workspace /usr/share/kde4/services/plasma-applet-devicenotifier.desktop     kdebase-workspace /usr/share/kde4/services/plasma-dataengine-devicenotifications.desktop     kdebindings-python /usr/share/sip/PyKDE4/solid/devicenotifier.sip     kde-l10n-pl /usr/share/locale/pl/LC_MESSAGES/plasma_applet_devicenotifier.mo     kdelibs /usr/include/solid/devicenotifier.h      So... how to run it ? ## Update: Running `plasma-desktop` **does not work**. I run on my laptop:               laptop$ xinit;     laptop$ ssh -Y desktop;     desktop$ fluxbox #X forwarding      So I run fluxbox on remote machine ("Desktop"). When I run in such situation `plasma-desktop` I end-up with whole screen messed up with all widgets I normally use on remote machine when I work on it locally. There are few problems there : (1) On desktop I have six times more screen space, (2) when I work remotely I do not need most of stuff I need when I work locally (3) I'm afraid of running another instance remotely of all those widgets and stuff, when it's already running on desktop. That's why I am asking about running only one widget. It can be `plasma-desktop`, but running only one widget, but not whole stuff I have setup and running on desktop locally.


How does one remove items from the menu plugin on LXPanel?

How does one remove items from the menu plugin on the panel? I am using lubuntu 11.10, LXPanel 0.5.8.


virtual network interface for ShrewSoft VPN Client

I use ShrewSoft VPN Client 2.1.7 under Arch Linux (i686) to connect to the company network using IPSec. It is configured by a .vpn file. How can I make it create a virtual network interface?


Make tmux tabs arrange more like traditional tabs

Tmux is a great piece of software, which almost replaced me my terminal "terminator", especially with it's `<bindkey>-z` in recent versions. The main annoyance I have with tmux is that whenever I close a window(tab), say #2, all other tabs like #3 keep being there. And when I create a new window(tab), it stores it on place of #2. What I'd like to get is more traditional behavior, like web-browsers and other tab-based software does: when you close tab, fill free cells by moving everything from right to left. When you create tab, create it on right. Then, if I'll want to place window(tab) somewhere, I can ask tmux to do that explicitly.


Backing NTFS in linux

Is partimage ready for NTFS volumes? It said that support for NTFS is experimental, is that safe for production ?


Is using xargs faster than not using it?

Is this faster:               find /tmp -name core -type f | xargs /bin/rm -f      than doing this:               find /tmp -name core -type f -exec /bin/rm -f {} \;      So would using `xargs` increase overall speed? (I got the example from the man page of `xargs`.)


Linux network troubleshooting and debugging

From time to time Linux and Unix users faced with various network problems. Many of these problems are presented here and at some others troubleshooting forums, but the are very concrete and contains a lot of additional technical information, and sometimes it's rather difficult to understand the main point and the real reason of buggy system behavior. By asking this question, my intention is _to start a community wiki_ page which allows to generalize our network troubleshooting and debugging experience. I hope the Linux and Unix users could easier recognize and solve("divide and conquer") their network problems using this page. The parent of this page should be Best practise to diagnose problems. But here we should focus on troubleshooting **the network problems** from _user- and kernel-space._ I suppose, if you:   1. Share the information about using some great network diagnostic tool with concrete usage examples and examples of network bugs, which they help to catch.   2. Share the link to the great network tutorial connected with this subject   3. Tell about a general method or recipe which allows to tackle some class of network problems   4. Share information about your tool-set for network debugging and troubleshooting it would perfectly fits for this topic. * * * I'll begin from sharing the link to varios diagnostic tools and 12-years old simple tutorial. Also archlinux tutorial seem to have actual information about our subject. And for diving into linux networking we definetely need to visit Linux Networking-HOWTO.


Where to find and how to install Ubuntu GUI themes?

I tried Ubuntu several times, but I didn't stay with it for very long. One reason was I felt the interface was boring. Today I saw some nice themes here: the #6 in http://www.gentoo.org/main/en/shots.old-2010.xml or #2 in http://www.gentoo.org/main/en/shots.old-2011.xml But I don't know where to find these resource and install these themes? Is this available to install just as we install some official packages from terminal or package Manager? Or do I have to contact the author personally?


How to prevent ssh-agent from starting in CentOS?

How do I stop ssh-agent from starting when logging into CentOS via openssh? There are no references to ssh-agent in my bash startup scripts (.bashrc) or /etc/bashrc.


Ctrl-C does not work with pppd non-detached session

I have a Mini2440 ARM Board, and I have put a base Debian 6.0 system on it using `multistrap`. I have used `tmux` to run several processes in defferent windows from `/etc/rc.local`. I connect to the board using its serial port and an inittab entry to run `getty` on that port. I use `picocom` as serial communicator. When root logs in, `~/.bashrc` attaches him to the already running tmux server, and processes can be easily monitored. the actual command is `exec tmux attach-session -t "main"`. tmux runs with default config. Everything works, except one of the processes (a shell script around `pppd`) does not receive `Ctrl``c` from terminal, while other processes do. Also `Ctrl``\` works. **also`kill -INT <pppd_pid>` works, but `kill -INT <shellscript_pid>` does not.** I really need `Ctrl``c` to work. What is wrong with this setup? Edit: here is the output of `stty -a` in the shell script, right before `pppd`:               speed 38400 baud; rows 23; columns 80; line = 0;     intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;     eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;     werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;     -parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts     -ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff     -iuclc -ixany imaxbel -iutf8     opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0     isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt     echoctl echoke      since it's just `pppd` process that has this issue, I think it has something to do with it or its configuration, but when I run `pppd` outside of tmux, Ctrl-C works. `pppd` runs with `nodetach` option, so it stays in terminal foreground. I also tested it on my dev machine (debian 6.0 on amd64) with the same results.


Most common encoding for strings in C++ in Linux (and Unix?)

For creating a C++ program that is source code level portable between Windows and Linux and handles internationalization well, there are IMHO three main encodings to consider:   * The encoding of the C++ source code.   * The encoding of external data.   * The encoding(s) of strings and literals. For the C++ source code there is not really any alternative to UTF-8 with BOM, at least if standard input and wide string literals should work on the Windows platform. UTF-8 without BOM causes Microsoft's Visual C++ compiler to assume Windows ANSI encoding for the source code, which is nice for UTF-8 output via `std::cout`, to the limited degree that that works (Windows console windows has lots of bugs here). However, then input via `std::cin` does not work. And for the external data UTF-8 seems to be _the_ de facto standard. However, what about the internal literals and strings? Here I had the _impression_ that narrow strings encoded as UTF-8 was the common convention in Linux. But recently two different persons have claimed otherwise, one claiming that the common convention for internal strings in international applications in Linux is UTF-32, and the other just claiming that there is some unspecified difference between Unix and Linux in this area. As one who fiddles a little, on a hobby basis, with a micro-library intended to abstract away the Windows/Linux differences in this area, I … have to _ask concretely_   * what is the common Linux convention for representing strings in a program? I am pretty sure that there is a common convention that is so overwhelmingly common that this question has a Real Answer™. An example showing e.g. how to Linux-conventionally reverse a string (which is complex to do directly with UTF-8, but which presumably is done by functions that are de facto standard in Linux?), would also be nice, i.e., as a question, what is a Linux-conventional version of this C++ program (the code as given works for Latin-1 as the C++ narrow text execution character set):               #include <iostream>     #include <algorithm>     #include <string>     using namespace std;          #define STATIC_ASSERT( cond )   static_assert( cond, #cond )          int main()     {         string line;         if( getline( cin, line ) )         {             static char const aSingleChar[] = "æ";             STATIC_ASSERT( sizeof( aSingleChar ) - 1 == 1 );             reverse( line.begin(), line.end() );                  cout << line << endl;         }     }


GTK 3 apps text backdrop looks wrong, on any theme

I am having a problem with GTK 3 applications (GTK 2 apps work correctly): no matter which theme I choose, there are many places where colors are off. E.g. in the screenshot you can see that the background color of the tab doesn't match the background color of the text within that tab. ![enter image description here](http://i.stack.imgur.com/gKXbW.png) How can I fix this? I am using Arch Linux with KDE 4.


SafeCopy worked but I have a few problems

I had a 60G NTFS drive that had 28 physically bad blocks as reported by GParted. I used SafeCopy to recover to the root of an empty 500G drive using SafeCopy defaults. Everything worked as expected and I can access the data fine, but now the 500G drive has a couple of issues.   1. The bad blocks, which I guess SafeCopy filled with zeroes or whatever, are apparently still marked as bad on the 500G drive that I copied to, preventing GParted and numerous other programs from being able to work with it.   2. The 500G drive now shows the remaining free space to be the same as the 60G drive that I copied from instead of the 400G+ that it should show. I can't get access through GParted to see if I can fix this because GParted says that the drive has 28 physical errors and it won't mount it. I thought I might be able to make a backup image and restore it back to the drive but the backup software that I use, Acronis, shows that the image file would be 500G instead of the less than 60G of actual data. This drive is being used as a Windows non-system drive. Windows Explorer shows the drive as 60G but when you go into Disk Management the top pane shows 60G while the bottom pane shows a graphical image of a 500G primary partition. Since this is a non-system disk I realize that I could simply just transfer all the files over to another properly partitioned and formatted disk but for future reference I would like to know how to avoid or fix this. Is this normal behavior for a SafeCopy transfer? Did I make a mistake in using the SafeCopy defaults?


Huawei E303 internet key with Linux CentOS?

Are there any programmes, downloads, patches, drivers available to use a Huawei E303 Internet Key in CentOS?


Trouble getting VLC to record from the webcam via command line

my ~/.bashrc contains the following function               webcamrecord () {     vlc v4l2:// :v4l-vdev="/dev/video0" :v4l-adev="/dev/audio2" :v4l-norm=3 :v4l-frequency=-1 :v4l-caching=300 :v4l-chroma="" :v4l-fps=-1.000000 :v4l-samplerate=44100 :v4l-channel=0 :v4l-tuner=-1 :v4l-audio=-1 :v4l-stereo :v4l-width=640 :v4l-height=480 :v4l-brightness=-1 :v4l-colour=-1 :v4l-hue=-1 :v4l-contrast=-1 :no-v4l-mjpeg :v4l-decimation=1 :v4l-quality=100 --sout="#transcode{vfilter=adjust{gamma=1.5},vcodec=theo,vb=2000,scale=0.67,acodec=vorb,ab=128,channels=2}:standard{access=file,mux=ogg,dst="output_file.ogg"}"      }      The command works beautifully to record directly from my webcam, with one or two flaws. First, the video produced moves too quickly, between twice and three times the normal rate. Also, there is no audio. This is less of an issue, but I would still like to fix this. Can someone help me debug this command, so as to fix these issues?


globbing, sed, or awk html files

I wanted to create a script that I could check `.xhtml` files for images and add alt tags if needed. While searching I found regular expressions and did man on `glob` but I'm unsure on where or what to search within `awk` and `sed`. What would be the best option to do the following:                               I wanted the desired script to detect if an `alt=""` is present if not alt the file name. End desired format:                               I know it can be done but Im not sure where to read about it.   * Find `<img` with the ending `/>`   * Within `img` tag detect `alt=""`   * if `alt=""` is not present record name before file type and insert into `""`


Write a shell script that takes in a variable from the terminal? (~$ command variable)

I am writing a shell script that takes in a time (in minutes) and opens an online egg timer set for that amount.               #!/bin/bash     #Opens http://e.ggtimer.com/TIMEmin where TIME = number of minutes     TIME=5     xdg-open http://e.ggtimer.com/"$TIME"min      When I run the above script it opens the web page http://e.ggtimer.com/5min I would like to set the time from the terminal. For example:               eggtimer 10      Would open http://e.ggtimer.com/10min Thank you!


Perl CPAN module download fails

The download for the 'App-xml_grep2-0.14.tar.gz' `perl` module continually fails for me. `cpan http://search.cpan.org/CPAN/authors/id/M/MI/MIROD/App- xml_grep2-0.14.tar.gz`               Please login with USER and PASS          Passive mode off.     Please login with USER and PASS.     ftp: bind: Address already in use


Why Nmap fragmented scan on Linux is only working from virtual environment?

OLD QUESTION AND TITLE (Look further down for the updated question): _**Why Nmap fragmented scan is only working on Backtrack?_** _I spent quite a few hours today trying to capture and study some fragmented IPv4 packets using Wireshark and Nmap security scanner._ _I tried a couple of different OS' (Ubuntu and Debian) but to my surprise, Wireshark would only capture normal packets._ _After launching the same Nmap scan from a Backtrack live CD it worked!_ _So to my understanding if it works on Backtrack which is tweaked for security purposes, there must be something (a setting maybe) preventing fragmented packets to the other Operating Systems._ _After lots of Googling I did not manage to find the reason why this might be happening. Any ideas what this must be and if it is possible to perform an IP fragmented scan from an Ubuntu or a Debian OS?_ UPDATED QUESTION: When I initially asked this question I was thinking that it might be an operating system related problem, but it turns out it might be a hardware related question because I managed to make a fragmented scan using an Ubuntu virtual machine. So I can run nmap fragmented scans from virtual machines running on my physical machine, but not from my physical machine itself. Is there any kernel setting (under /proc ?) preventing this, or it is hardware restriction and I cannot do anything about it?


How to reverse-match a string in the Vim programming language?

I want to find the last index of any character in the `[abc]` set in the `abcabc` string but the search should start from the end of the string:               " Returns the 0th index but I want the 5th.     let a=match('abcabc', '[abc]')      I skimmed through Vim's "4. Builtin Functions" (`:h functions`) but the only method that looked promising,the `reverse` method, only operates on lists. A limitation I don't understand because functions like `len` were designed to work even with strings, numbers, and lists. To solve the problem I came up with my following function:               function! s:Rvrs(str)       let a=len(a:str)             let b=a - 1       let c=''       while b >= 0         let c.=a:str[b]         let b-=1       endwhile       return c     endfunction      So I can say `let a=match(s:Rvrs('abcabc'), '[abc]')`.


Xresources color settings

I'm using Gentoo with XMonad and set all the colors in `.Xresources` file. The problem is that for some apps setting `*.background` and `*.foreground` is not enough since they override the settings for some fields. Here's an example of what's wrong: ![enter image description here](http://i.stack.imgur.com/djDDE.png) The background should be similar to the dark window elements, but it's white and gray instead. What are some other xresources variables that set dialog window colors and what is the correct way to overcome this problem? My current `.Xresources` file:               ! Solarized colorscheme for Xresources     ! ====================================                         ! To choose between light/dark bakground:     ! - Define the choice in ``.Xresources`` by hardcoding     !   #define SOLARIZED_LIGHT     !   or     !   #define SOLARIZED_DARK     ! - Define the symbol when loading ``.Xresources`` with ``xrdb``:     !   $ xrdb -DSOLARIZED_LIGHT -merge ~/.Xresources                         #if !defined(SOLARIZED_LIGHT) && !defined(SOLARIZED_DARK)     #define SOLARIZED_DARK     #elif defined(SOLARIZED_LIGHT) && defined(SOLARIZED_DARK)     #undef SOLARIZED_LIGHT     #endif                         ! Define Solarized colors     ! -----------------------     #define S_base03    #002b36     #define S_base02    #073642     #define S_base01    #586e75     #define S_base00    #657b83     #define S_base0     #839496     #define S_base1     #93a1a1     #define S_base2     #eee8d5     #define S_base3     #fdf6e3                         #define S_yellow    #b58900     #define S_orange    #cb4b16     #define S_red       #dc322f     #define S_magenta   #d33682     #define S_violet    #6c71c4     #define S_blue      #268bd2     #define S_cyan      #2aa198     #define S_green     #859900                         #ifdef SOLARIZED_LIGHT     #define S_emph      S_base01     #define S_primary   S_base00     #define S_secondary S_base1     #define S_bgrnd_hi  S_base2     #define S_bgrnd     S_base3     #endif     #ifdef SOLARIZED_DARK     #define S_emph      S_base1     #define S_primary   S_base0     #define S_secondary S_base01     #define S_bgrnd_hi  S_base02     #define S_bgrnd     S_base03     #endif                         ! black dark/light     *color0:                S_base02     *color8:                S_base03     ! red dark/light     *color1:                S_red     *color9:                S_orange     ! green dark/light     *color2:                S_green     *color10:               S_base01     ! yellow dark/light     *color3:                S_yellow     *color11:               S_base00     ! blue dark/light     *color4:                S_blue     *color12:               S_base0     ! magenta dark/light     *color5:                S_magenta     *color13:               S_violet     ! cyan dark/light     *color6:                S_cyan     *color14:               S_base1     ! white dark/light     *color7:                S_base2     *color15:               S_base3                                             ! General Xresource settings     ! ==========================     !     #define FONT_REGULAR xft:Liberation Mono:style=Regular:pixelsize=14      #define FONT_BOLD xft:Liberation Mono:style=Bold:pixelsize=14      #define FONT_ITALIC xft:Liberation Mono:style=Italic:pixelsize=14      Xft*antialias: true                         *foreground:                S_primary     *background:                S_bgrnd     *Foreground:                S_primary     *Background:                S_bgrnd     *cursorColor:               S_emph     *pointerColorForeground:    S_emph     *pointerColorBackground:    S_secondary     *fading:                    40     *fadeColor:                 S_bgrnd                                             ! Xscreensaver     ! ============     xscreensaver.captureStderr: false     !font settings     xscreensaver.Dialog.headingFont: FONT_REGULAR     xscreensaver.Dialog.bodyFont:    FONT_REGULAR      xscreensaver.Dialog.labelFont:   FONT_REGULAR      xscreensaver.Dialog.unameFont:   FONT_REGULAR      xscreensaver.Dialog.buttonFont:  FONT_REGULAR      xscreensaver.Dialog.dateFont:    FONT_REGULAR      xscreensaver.passwd.passwdFont:  FONT_REGULAR      !general dialog box (affects main hostname, username, password text)     xscreensaver.Dialog.foreground: S_primary     xscreensaver.Dialog.background: S_bgrnd     xscreensaver.Dialog.topShadowColor: S_bgrnd     xscreensaver.Dialog.bottomShadowColor: S_bgrnd     xscreensaver.Dialog.Button.foreground: S_primary     xscreensaver.Dialog.Button.background: S_bgrnd_hi     !username/password input box and date text colour     xscreensaver.Dialog.text.foreground: S_primary     xscreensaver.Dialog.text.background: S_bgrnd_hi     xscreensaver.Dialog.internalBorderWidth: 24     xscreensaver.Dialog.borderWidth: 0     xscreensaver.Dialog.shadowThickness: 1     xscreensaver*logo.width: 1     xscreensaver*logo.height: 1     !timeout bar (background is actually determined by Dialog.text.background)     xscreensaver.passwd.thermometer.foreground: S_red     xscreensaver.passwd.thermometer.background: S_blue     xscreensaver.passwd.thermometer.width: 4                               ! rxvt-unicode terminal     ! =====================     !     URxvt*background: S_bgrnd     URxvt*foreground: S_primary     URxvt*font: FONT_REGULAR     URxvt*boldFont: FONT_BOLD     URxvt*italicFont: FONT_ITALIC     URxvt.colorIT: S_magenta     URxvt.colorBD: S_green     URxvt.colorUL: S_blue     URXVT.borderColor: S_bgrnd_hi     URxvt.highlightColor: S_bgrnd_hi     URxvt.scrollBar: false     URxvt.saveLines: 1000     URxvt.cursorBlink: true     URxvt.pointerBlank: true     URxvt.modifier: alt


How to edit grub2 to use kdump?

I was following http://fedoraproject.org/wiki/How_to_use_kdump_to_debug_kernel_crashes and in step 2 I need to add the line to grub.cfg, but grub.cfg is a shell I do not know how to edit it, most available resources tell you only the method to rearrange menu items, can anyone tell me what should be added to the file. I use 64-bit Fedora 18.


What is the default jobs argument for make?

How many jobs does `make` use by default when you don't pass it the `-j` flag?


Can't reach DNS through wireless router

I've got a Ubuntu 10.04 laptop, and recently it's had some odd networking problems. It's on the home wireless router, supplied by the phone company, and has no problem talking to anything on the wireless LAN, whether by IP number or /etc/hosts name. It's set to use the wireless connection with DHCP, and there really isn't much I can screw up after that for network entries. Right now, I can reach outside the LAN by IP number, but that doesn't do well for web surfing. When I do a nslookup, I'm getting non-authoritative answers, so I suspect I'm hitting a cache somewhere (probably the router). Any attempt to get outside the LAN with a domain name fails quietly, like a "can't find" using Firefox. The only things that might have changed since it did work right are 10.04 updates (and there's been quite a few of them) and a couple of lines added to /etc/hosts, to address fixed IPs on the LAN (in the 192.168.0.* range). The lines are in the same format as others, and it's nothing I haven't done before with no ill effects. Any ideas on what to try next?


Editing grub menu

I'd like to edit the Grub menu that comes up, to move one line and remove others. I have an Inspiron 1420 that came with Ubuntu 7.10. When it needed a new drive, I installed Windows 7, the original OS, and then it seemed that 10.04 wanted its own partition. I probably should have checked exactly what I was doing first (famous last words). What I'd like to do is remove the 7.10 lines entirely, so I can blow away everything in that partition and use it as /home for 10.04. I'd also like to move the Windows 7 line up to second from the top, so booting in Windows would be a quick two keystrokes rather than following the line all the way down. Hitting the Grub edit key came up with unclear instructions, and since this is the boot loader I'd kind of rather not screw it up too bad. So, what's the best way to do this?


org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed] while running eclipse on ubuntu

I was trying to open eclipse in my ubuntu VM with the below commmand.. And as soon as I do that, I always get the below exception -               ubuntu@username-dyn-vm1-48493:~$ eclipse     Eclipse:     An error has occurred. See the log file     /home/ubuntu/.eclipse/org.eclipse.platform_3.8_155965261/configuration/1381367113197.log.      so when I went to that particular log file, this is what I can see in the log -               ubuntu@username-dyn-vm1-48493:~$ more /home/ubuntu/.eclipse/org.eclipse.platform_3.8_155965261/configuration/1381367113197.log     !SESSION 2013-10-10 01:05:13.088 -----------------------------------------------     eclipse.buildId=debbuild     java.version=1.7.0_25     java.vendor=Oracle Corporation     BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US     Command-line arguments:  -os linux -ws gtk -arch x86_64          !ENTRY org.eclipse.osgi 4 0 2013-10-10 01:05:17.555     !MESSAGE Application error     !STACK 1     org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]             at org.eclipse.swt.SWT.error(SWT.java:4387)             at org.eclipse.swt.widgets.Display.createDisplay(Display.java:914)             at org.eclipse.swt.widgets.Display.create(Display.java:900)             at org.eclipse.swt.graphics.Device.<init>(Device.java:156)             at org.eclipse.swt.widgets.Display.<init>(Display.java:498)             at org.eclipse.swt.widgets.Display.<init>(Display.java:489)             at org.eclipse.ui.internal.Workbench.createDisplay(Workbench.java:716)             at org.eclipse.ui.PlatformUI.createDisplay(PlatformUI.java:161)             at org.eclipse.ui.internal.ide.application.IDEApplication.createDisplay(IDEApplication.java:154)             at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:96)             at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)             at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)             at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)             at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)             at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)             at java.lang.reflect.Method.invoke(Method.java:606)             at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)             at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)             at org.eclipse.equinox.launcher.Main.run(Main.java:1438)             at org.eclipse.equinox.launcher.Main.main(Main.java:1414)      Does anyone know what wrong has happened? Or what I am supposed to do to fix this issue? Thanks.. **Update:-** Version details below -               ubuntu@username-dyn-vm1-48493:~$ dpkg -l libgtk[0-9]* | grep ^i     ii  libgtk2.0-0:amd64                   2.24.17-0ubuntu2                    amd64        GTK+ graphical user interface library     ii  libgtk2.0-bin                       2.24.17-0ubuntu2                    amd64        programs for the GTK+ graphical user interface library     ii  libgtk2.0-common                    2.24.17-0ubuntu2                    all          common files for the GTK+ graphical user interface library


Any alternative of "man -a" on UNIX?

`man -a <xyz>` opens all the man pages one by one which contain `xyz`.   On my unix servers `man -a <xyz>` doesn't work.   Is there any alternative for this on unix? EDIT: I am on HP-UX. Following message :               hemantj [109]> man -a printf     Usage: man [-M path] [-T macro-package] [ section ] name ...     or: man -k keyword ...     or: man -f file ...


How to create initrd.img from initrd.lz

I need to create `initrd.img` file from `initrd.lz` file. How may I do this?


iptables and logs

Suppose I add an IP to iptables blocking for exim, dovecot and FTP and this IP visits my server again. Is there any log of this visit so I can confirm the IP was trying to reach the server again but was blocked?


Why should /var /opt /tmp /home /boot directories be on different partitions?

As the title says, why should I split these directories across multiple partitions? Performance? Security maybe?


'kill java' doesn't kill java

I am running debian right now and sometimes I need to kill java manually from the terminal, but when I try `kill #pid#` or `pkill java` nothing happens. No console output (ok, that's normal) and java is still running (not normal). The only way to kill it is to restart the PC. Any suggestions?


What causes this green background in ls output?

![screencap of ls output on linux machine](http://i.stack.imgur.com/rQomR.png) There are two directories shown by 'ls'. Normally directories anywhere are blue on black background. But the first one is blue on green and impossible to read. Why is this? How to make it blue on black, or at least something light on something dark? This is on Ubuntu 12.04, using bash in Gnome Terminal. In Konsole, the blue is slightly darker, and possible to read, though could be way better.


vsftpd filezilla timout error

I have an vsftpd setup. When I try to upload a large number of files, a lot of files fail with a timeout error. After some analysis, I saw this pattern as follow before every error, but I don't know what is the cause. Can anyone throw some light on it?               Command:    TYPE A     Response:   200 Switching to ASCII mode.     Command:    PASV     Response:   227 Entering Passive Mode (50,16,204,201,4,7).     Command:    STOR ms-users.php     Command:    TYPE A     Response:   200 Switching to ASCII mode.     Command:    PASV     Response:   227 Entering Passive Mode (50,16,204,201,4,0).     Command:    STOR post.php      here is a more detailed process, i don't understand the format and the protocal details:                2012-03-18 13:02:52 5608 5 Status: Resolving address of majorchooser.info     2012-03-18 13:02:52 5608 5 Status: Connecting to 50.16.204.201:21...     2012-03-18 13:02:53 5608 5 Status: Connection established, waiting for welcome message...     2012-03-18 13:02:53 5608 5 Response: 220 (vsFTPd 2.2.2)     2012-03-18 13:02:53 5608 5 Command: USER majorchooser     2012-03-18 13:02:54 5608 5 Response: 331 Please specify the password.     2012-03-18 13:02:54 5608 5 Command: PASS ***********     2012-03-18 13:02:54 5608 5 Response: 230 Login successful.     2012-03-18 13:02:54 5608 5 Command: OPTS UTF8 ON     2012-03-18 13:02:55 5608 5 Response: 200 Always in UTF8 mode.     2012-03-18 13:02:55 5608 5 Status: Connected     2012-03-18 13:02:55 5608 5 Status: Retrieving directory listing...     2012-03-18 13:02:55 5608 5 Command: PWD     2012-03-18 13:02:55 5608 5 Response: 257 "/"     2012-03-18 13:02:55 5608 5 Status: Directory listing successful     2012-03-18 13:03:01 5608 1 Status: Resolving address of majorchooser.info     2012-03-18 13:03:01 5608 2 Status: Resolving address of majorchooser.info     2012-03-18 13:03:01 5608 1 Status: Connecting to 50.16.204.201:21...     2012-03-18 13:03:01 5608 2 Status: Connecting to 50.16.204.201:21...     2012-03-18 13:03:01 5608 1 Status: Connection established, waiting for welcome message...     2012-03-18 13:03:01 5608 2 Status: Connection established, waiting for welcome message...     2012-03-18 13:03:02 5608 1 Response: 220 (vsFTPd 2.2.2)     2012-03-18 13:03:02 5608 1 Command: USER majorchooser     2012-03-18 13:03:02 5608 1 Response: 331 Please specify the password.     2012-03-18 13:03:02 5608 1 Command: PASS ***********     2012-03-18 13:03:02 5608 1 Response: 230 Login successful.     2012-03-18 13:03:02 5608 1 Command: OPTS UTF8 ON     2012-03-18 13:03:03 5608 1 Response: 200 Always in UTF8 mode.     2012-03-18 13:03:03 5608 1 Status: Connected     2012-03-18 13:03:03 5608 1 Status: Starting upload of D:\websites\tedxnanjing-online\wp-admin\admin-ajax.php     2012-03-18 13:03:03 5608 1 Command: CWD /test-ftp/wp-admin     2012-03-18 13:03:03 5608 1 Response: 550 Failed to change directory.     2012-03-18 13:03:03 5608 1 Command: CWD /test-ftp     2012-03-18 13:03:04 5608 1 Response: 250 Directory successfully changed.     2012-03-18 13:03:04 5608 1 Command: MKD wp-admin     2012-03-18 13:03:04 5608 1 Response: 257 "/test-ftp/wp-admin" created     2012-03-18 13:03:04 5608 1 Command: CWD /test-ftp/wp-admin     2012-03-18 13:03:05 5608 1 Response: 250 Directory successfully changed.     2012-03-18 13:03:05 5608 1 Command: PWD     2012-03-18 13:03:05 5608 1 Response: 257 "/test-ftp/wp-admin"     2012-03-18 13:03:05 5608 1 Status: Retrieving directory listing...     2012-03-18 13:03:05 5608 1 Command: TYPE I     2012-03-18 13:03:06 5608 2 Response: 220 (vsFTPd 2.2.2)     2012-03-18 13:03:06 5608 2 Command: USER majorchooser     2012-03-18 13:03:06 5608 2 Response: 331 Please specify the password.     2012-03-18 13:03:06 5608 2 Command: PASS ***********     2012-03-18 13:03:07 5608 1 Response: 200 Switching to Binary mode.     2012-03-18 13:03:07 5608 1 Command: PASV     2012-03-18 13:03:07 5608 2 Response: 230 Login successful.     2012-03-18 13:03:07 5608 2 Command: OPTS UTF8 ON     2012-03-18 13:03:07 5608 1 Response: 227 Entering Passive Mode (50,16,204,201,4,186).     2012-03-18 13:03:07 5608 1 Command: LIST -a     2012-03-18 13:03:07 5608 2 Response: 200 Always in UTF8 mode.     2012-03-18 13:03:07 5608 2 Status: Connected     2012-03-18 13:03:07 5608 2 Status: Starting upload of D:\websites\tedxnanjing-online\wp-admin\admin-footer.php     2012-03-18 13:03:07 5608 2 Command: CWD /test-ftp/wp-admin     2012-03-18 13:03:07 5608 2 Response: 250 Directory successfully changed.     2012-03-18 13:03:07 5608 2 Status: Retrieving directory listing...     2012-03-18 13:03:08 5608 1 Response: 150 Here comes the directory listing.     2012-03-18 13:03:08 5608 1 Response: 226 Directory send OK.     2012-03-18 13:03:08 5608 1 Command: TYPE A     2012-03-18 13:03:08 5608 2 Command: TYPE A     2012-03-18 13:03:09 5608 1 Response: 200 Switching to ASCII mode.     2012-03-18 13:03:09 5608 1 Command: PASV     2012-03-18 13:03:09 5608 2 Response: 200 Switching to ASCII mode.     2012-03-18 13:03:09 5608 2 Command: PASV     2012-03-18 13:03:09 5608 1 Response: 227 Entering Passive Mode (50,16,204,201,5,251).     2012-03-18 13:03:09 5608 1 Command: STOR admin-ajax.php     2012-03-18 13:03:09 5608 2 Response: 227 Entering Passive Mode (50,16,204,201,4,185).     2012-03-18 13:03:09 5608 2 Command: STOR admin-footer.php     2012-03-18 13:03:13 5608 1 Response: 150 Ok to send data.     2012-03-18 13:03:19 5608 2 Response: 150 Ok to send data.     2012-03-18 13:03:22 5608 1 Response: 226 Transfer complete.     2012-03-18 13:03:22 5608 1 Status: File transfer successful, transferred 49,808 bytes in 13 seconds     2012-03-18 13:03:22 5608 1 Status: Starting upload of D:\websites\tedxnanjing-online\wp-admin\admin-functions.php     2012-03-18 13:03:22 5608 1 Command: PASV     2012-03-18 13:03:23 5608 1 Response: 227 Entering Passive Mode (50,16,204,201,7,142).     2012-03-18 13:03:23 5608 1 Command: STOR admin-functions.php     2012-03-18 13:03:24 5608 1 Response: 150 Ok to send data.     2012-03-18 13:03:39 5608 2 Error: Connection timed out     2012-03-18 13:03:39 5608 2 Error: File transfer failed     2012-03-18 13:03:39 5608 2 Status: Resolving address of majorchooser.info     2012-03-18 13:03:40 5608 2 Status: Connecting to 50.16.204.201:21...     2012-03-18 13:03:40 5608 2 Status: Connection established, waiting for welcome message...     2012-03-18 13:03:41 5608 2 Response: 220 (vsFTPd 2.2.2)     2012-03-18 13:03:41 5608 2 Command: USER majorchooser     2012-03-18 13:03:41 5608 2 Response: 331 Please specify the password.     2012-03-18 13:03:41 5608 2 Command: PASS ***********     2012-03-18 13:03:42 5608 2 Response: 230 Login successful.     2012-03-18 13:03:42 5608 2 Command: OPTS UTF8 ON     2012-03-18 13:03:42 5608 2 Response: 200 Always in UTF8 mode.     2012-03-18 13:03:42 5608 2 Status: Connected     2012-03-18 13:03:42 5608 2 Status: Starting upload of D:\websites\tedxnanjing-online\wp-admin\admin-footer.php     2012-03-18 13:03:42 5608 2 Command: CWD /test-ftp/wp-admin     2012-03-18 13:03:43 5608 2 Response: 250 Directory successfully changed.     2012-03-18 13:03:43 5608 2 Status: Retrieving directory listing...     2012-03-18 13:03:43 5608 2 Command: TYPE I     2012-03-18 13:03:43 5608 2 Response: 200 Switching to Binary mode.     2012-03-18 13:03:43 5608 2 Command: PASV     2012-03-18 13:03:44 5608 2 Response: 227 Entering Passive Mode (50,16,204,201,5,79).     2012-03-18 13:03:44 5608 2 Command: LIST -a     2012-03-18 13:03:45 5608 1 Error: Connection timed out     2012-03-18 13:03:45 5608 1 Error: File transfer failed


~ is $HOME, but sometimes?

This is kind of a trivial and dumb question.               cd ~      does the same thing as               cd $HOME      which is also the same as               cd /home/tandu      However,               cd ~not-tandu      changes to `/home/not-tandu` Is this purely a syntactic choice? How is this handled by the kernel (or the `cd` execuable?) Is there a special case for `~` to add the slash if everything else is omitted? That is to say, `~/` and `~` change to the same directory, but `~a` is one directory up. The same cannot be said for any other directory you change to.


programming an Atmel Board with a USB to Serial converter, in Eclipse

I am actually trying to program an `Atmel Evk1100` board directly from Mac OSX. My MCU is `UC3A0512` I used to use Atmel32 Studio on Windows, but It looks like there no Mac Version. So, from what I've found on Internet, I've downloaded `PL2303` driver to works with my `Manhattan 205146 USB to Serial converter`. Once the driver is installed, I tried it directly in `ZTerm` and It works without any problem with my board. I would be able to Build project and to burn it on my board. I've installed `Avrdude` and`Avr Eclipse Plugin` and `AVR32 Studio plugin`, directly from my Eclipse Juno Marketplace. Avrdude is installed here:               $ which avrdude     /usr/local/CrossPack-AVR/bin/avrdude      So I changed the Eclipse Toolpath to works with avrdude. But, I have this error in Eclipse: ![eerror message](http://i.stack.imgur.com/4F33p.jpg) Also, directly from avrdude, I am not able to communicate with my board. I do:               $ avrdude -c usbtiny -p ucr2      where `ucr2` is the value I got from Avrdude corresponding to: ![avr dude](http://i.stack.imgur.com/uxy79.jpg) Bu I get this error, if I check my Environnement:               avrdude: Error: Could not find USBtiny device (0x1781/0xc9f)          avrdude done.  Thank you.      Guys, how can I program my board, directly with Eclipse and my USB to Serial cable, my board? Is it possible?


How does a unix or linux system work?

I would like to know how the OS works _in a nutshell_ :   * The basic components it's built upon   * How those components work together   * What makes unix UNIX   * What makes it so different from other OSs like Windows


Renew IP with dhclient on different interfaces

I have two interfaces on my computer, `eth0` and `eth1`. Both subnets have a DHCP server on them. How could I use `dhclient` to renew IP address for both interfaces? If I do:               dhclient -r && dhclient eth0      It renews the IP on `eth0`. Then, if I want to just do:               dhclient eth1      It fails with error:               dhclient(22421) is already running - exiting.      I can do:               dhclient -r && dhclient eth1      But the `dhclient -r` part releases the lease and I loose the IP address on `eth0` as well. For now, the only way I've managed to do what I want is to run `dhclient` for `eth0`, brutally kill it, and run it on `eth1`: I end up with a renewed IP on both interfaces. I also tested with `dhclient -x` instead of `dhclient -r`, no luck. Surely, this is not the way to go! EDIT: Two answers suggested doing `dhclient -r eth0 eth1 && dhclient eth0 eth1` This, indeed, limits the broadcast calls to these interfaces. But the first DHCP server to answer will be the only one used, hence resulting in a new IP on a single interface and not both. See here, we can see `DHCPDISCOVER` calls on both interfaces, but the `DHCPREQUEST` is only done on `eth0`, first interface through which a DHCP server was found:               Listening on LPF/eth0/0a:00:27:00:00:00     Sending on   LPF/eth0/0a:00:27:00:00:00     Listening on LPF/eth1/84:8f:69:d3:d4:a1     Sending on   LPF/eth1/84:8f:69:d3:d4:a1     Sending on   Socket/fallback     DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 5 (xid=0x170fcb67)     DHCPDISCOVER on eth1 to 255.255.255.255 port 67 interval 4 (xid=0x115a24c3)     DHCPREQUEST on eth0 to 255.255.255.255 port 67 (xid=0x170fcb67)     DHCPOFFER from 192.168.1.1     DHCPACK from 192.168.1.1 (xid=0x170fcb67)     bound to 192.168.1.4 -- renewal in 1710 seconds.


extract a file from jar file and get the diff

In real world I have a xsd in a jar file across various releases I am trying to check whether xsd has changed across releases 10.x.y.z to 11.a.b.c I have different release directories which are read only like below in some /m/n/i/10.x.y.z or 11.x.y.z. I want to search for abc.jar which can be buried in my release directory 10.x.y.z or 11.x.y.z in some p/q/r/abc.jar across all those releases and extract xyz.xsd from them and do a diff between them?Also i do not have write permission to the release directories. How can I achieve it in Unix or shell script? I'm new to Unix. Directory structure               .     |-- 10.1.2.2.0     |   `-- GENERIC     |       `-- RELEASE               --  x/y/z/abc.jar     |-- 10.1.2.3.0     |   `-- GENERIC     |       `-- RELEASE               -- x/y/z/abc.jar     |-- 10.1.3.1.0     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.3.0     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.3.0-HOTPLUG     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.3.0BPA     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.3.0WEBSPHERE     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.3.1     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.4.0     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.4.0MLR1     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.4.0MLR10     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.4.0MLR2     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.4.0MLR3     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.4.0MLR4     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.4.0MLR5     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.4.0MLR6     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.4.0MLR7     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.4.0MLR8     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.4.0MLR9     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.5.0     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.5.0.QA.06012009     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.5.1     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.5.2     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3.5.3     |   `-- GENERIC     |       `-- RELEASE     |-- 10.1.3QAMLR6     |   `-- GENERIC     |       `-- RELEASE     |-- 11.1.1.1.0     |   `-- GENERIC     |       `-- RELEASE     |-- 11.1.1.1.0.BPA     |   `-- GENERIC     |       `-- RELEASE     |-- 11.1.1.1.0.CEP     |   `-- GENERIC     |       `-- RELEASE     |-- 11.1.1.2.0     |   `-- GENERIC     |       `-- RELEASE     |-- 11.1.1.3.0     |   `-- GENERIC     |       `-- RELEASE     `-- 11.1.1.4.0         `-- GENERIC             `-- RELEASE          93 directories, 0 files


Fedora 18. Centering activities on one monitor

I've recently installed Fedora 18 and the only gripe I have so far is that everything is spread between two monitors. Example: The date is currently half on one monitor, half on the other. I get 'Thu Apr 2' on one and '5, 11:16' on the other. Along with that, the activities panel is spread between both as well.


Is it possible to find the path of a running program?

I have a `xmms2d` process running, but two possible executable files (in different directories, both in the executable path) that could have spawned it. I suspect that one of those is corrupted, because sometimes this program works and sometimes it doesn't. The process running now works, so I want to delete (or rename) the other one. `ps ax|grep "xmms"` returns `8505 ? SLl 2:38 xmms2d -v` without path information. Given the PID, could I find whether it was run from `/usr/bin/xmms2d` or `/usr/local/bin/xmms2d`? Thanks!


How enable watchdog?

I'm struggling with the watchdog timer (wdt) for a while. I can't get it working. My microcontroller is a AriaG25, based on the AT91SAM925. I have used this tutorial to compile the kernel. The kernel settings related to the wdt looks like this:               CONFIG_WATCHDOG=y            CONFIG_AT91SAM9X_WATCHDOG=y         The kernel has been compiled without problem and boots succesfully. I've installed the watchdog deamon software via `apt-get`. And now I'm stuck. How do I get the watchdog working? I read a lot about `/dev/watchdog`. I don't have that file. Do I have to put the driver for my hardware there? Is this a driver?


How to upload tcpdumps in realtime to FTP?

I can do tcpdumps with this command:               tcpdump -w `date +%F-%Hh-%Mm-%Ss-%N`.pcap src 10.10.10.10 or dst 10.10.10.10      **Q** : I have an FTP server with username: FTPUSER and password FTPPASSWORD. How can I upload the tcpdump in "real time" I mean I don't have a too big storage to store the dumps, so I need to upload it to a place what I can only reach via FTP. Can I " **pipe** " somehow the output of the tcpdump to an ftp client that uploads it? [I need to preserve the filenames too: "`date +%F-%Hh-%Mm-%Ss-%N`.pcap"] so I'm searching for a solution that doesn't store any tcpdumps locally, rather it uploads the dumps in "real-time". The OS is OpenWrt 10.03 - the router where the tcpdump runs. [4MB flash on the router, that's why I can't store them locally.] UPDATE2: there is no SSH connection to the FTP server, just FTP [and FTPES, but that doesn't matter now I think]


Stracing su and ssh shows the password. Is this a security flaw or am I missing something?

I'm currently fascinated by `strace` so, being new to it, I decided to play around a little. As suggested by the question title, I tried both `strace su` and `strace ssh`. Both commands displayed the password I typed in the strace output. `su` kept complaining of an incorrect password while `ssh` managed to log in normally.   My questions:   * Is this a security flaw or am I missing something?    * Is `su` reporting an incorrect password as a security measure because it detected it was being run through `strace`? If so how can it tell that it's being invoked through `strace`? Does it check `/proc/self/cmdline` maybe?   * How much damage can be caused by something like   `alias su="strace -o /tmp/output.log su"`


Run script on screen lock/unlock

I'd like to run a screen if the Gnome session is locked and unlocked. Is there a way that I can intercept this and perform certain actions when the desktop is locked or unlocked?


How does Linux deal with a separate /boot partition?

I am interested to learn about how Linux deals with a separate boot partitions. I am **not** interested in actually doing this, but I would like to know how this works under-the-hood. Consider a hard drive `sda`, which has two partitions `sda1` and `sda2`. Let's say that `sda2` is the `root` partition `/` which contains the Linux OS. My understanding is that the bootloader `GRUB2`, is mounted to `/boot`. When the directory `/boot` is on a separate partition `sda2`, however, how is it that this can happen before `/` is actually mounted? How does the interaction between the BIOS, the Master boot record and GRUB (or the files `/boot`) successfully happen in this case? Is it that the data in `/boot` is not actually mounted to the `/` filesystem at this early stage? Note: this question deals with mounting the root partition, but does not discuss a separate boot partition.


Other than a kill command or a system kill(pid, signal) command, what can cause a SIGKILL to occur for a process?

My process is mysteriously getting a SIGKILL on AIX. Running trace on the system indicated the process got a signal sent by itself via the kill(pid, SIGNAL) system call. I checked my code and I don't have any explicit call that does this. I'm beginning to think if it's possible that a system call I made or a call to Oracle could possibly result on a getting a SIGKILL back. Since the process made the call, if the SIGKILL occurs as the call is made, it would appear that the process issued the SIGKILL to itself. What can cause the SIGKILL in this case?


Installation instructions for HP 7 tablet (also called 'Mesquite')

I'm looking at the HP 7 at Walmart (http://www.walmart.com/ip/HP-7-Tablet- Intel-Atom-Processor-with-8GB-Memory-featuring-Android-4.1-Jelly- Bean/27618120), but I don't want to purchase it unless I can install linux on it (ie: not chroot). Has anyone successfully installed a linux distro on it? If so, how? I'm assuming it's EFI, but confirmation would help.


FreeBSD Ports Broken -- Python Issue? Portmaster -a

Upgraded FreeBSD from 8.2 >> 8.4 >> 10.0-RELEASE today. In the process, I believe I have mangled my ports tree quite badly and am having issues upgrading/reinstalling ports (as the upgrade asks me to do). As stands, I think it may have something to do with Python but I'm not sure where to go from here. Upgrading ports fails here.               #portname -a          ===>>> Port directory: /usr/ports/lang/python2          make: "/usr/ports/Mk/bsd.python.mk" line 558: Malformed conditional (${PYTHON_REL} >= 320 && defined(PYTHON_PY3K_PLIST_HACK))     make: Fatal errors encountered -- cannot continuemake: "/usr/ports/Mk/bsd.python.mk" line 558: Malformed conditional (${PYTHON_REL} >= 320 && defined(PYTHON_PY3K_PLIST_HACK))     make: Fatal errors encountered -- cannot continue===>>> Launching 'make checksum' for lang/python2 in background     make: "/usr/ports/Mk/bsd.python.mk" line 558: Malformed conditional (${PYTHON_REL} >= 320 && defined(PYTHON_PY3K_PLIST_HACK))     make: Fatal errors encountered -- cannot continue      More info:               # less /etc/make.conf     # added by use.perl 2014-01-27 15:35:31     PERL_VERSION=5.10.1     WITH_PKGNG=yes          # python -V     Python 2.6.6          # uname -a     FreeBSD herp.derp.herp l 10.0-RELEASE FreeBSD 10.0-RELEASE #0 r260789: Thu Jan 16 22:34:59 UTC 2014     root@snap.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64


How to make wget download recursive combining --accept with --exclude-directories?

I'm trying to download some directories from an Apache server, but I need to ignore some directories that have huge files I don't care about The dir structure in the server is somewhat like this (simplified):               somedir/     ├── atxt.txt     ├── big_file.pdf     ├── image.jpg     └── tmp         └── tempfile.txt      So, I want to get all the `.txt` and `.jpg` files, but I DON'T want the `.pdf` files nor anything that is in a `tmp` directory. I've tried using `\--exclude-directories` together with `\--accept` and then with `\--reject`, but in both attempts it keeps downloading the `tmp` dir and its contents. These are the commands I've tried:               # with --reject     wget -nH --cut-dirs=2 -r --reject=pdf --exclude-directories=tmp \              --no-parent  http://<host>/pub/somedir/          # with --accept     wget -nH --cut-dirs=2 -r --accept=txt,jpg --exclude-directories=tmp \              --no-parent  http://<host>/pub/somedir/      Is there a way to do this? How exactly is `\--exclude-directories` supposed to work?


How to add an audio file to a shell script

How can I add an audio file (OGG vorbis) into a shell script making the script as small as possible and at the same time being able to execute it on as most systems as possible? I want the audio file be played. I don’t want it to be `uuencode`d, because sharutils are not installed on many systems. base64 is nice, but makes the file/script bigger, which I don’t want. Should I use `mplayer` or the `play` command from the sox package? Is it more common on Linux/BSD systems? Or is there another media player mostly installed? Should I convert the audio file to another format/codec (if that doesn’t make the file much bigger) to have more possible players to play the file back or is OGG vorbis a good choice?


Installed Centos 7 after Windows and can't boot into Centos

I wanted to setup a dual boot for Windows 7 and Centos 7 I had a Windows 7 machine with 500GB disk. I shrank the Windows partition to provide space for Centos 7 (roughly 230GB). I created a USB Centos 7 netinstall stick and booted from that. I ran the install configured as best I knew to install Centos 7 into the free space (rather than over the whole disk). I did the net install and all seemed to go well but when it rebooted I was back into Windows and can't get into Centos. I've rebooted from the USB and tried to fix the situation (carefully) using cfdisk, e.g. selecting what I believe is the Centos boot partition but it reports "missing operating system." Also cfdisk says it can't reread the partition table when I write it with Centos boot but starting cfdisk again seems to show the flag has been set. Currently the USB Centos 7 netinstall shows me the following partitions on the disk: > DATA   >  /home 168GB centos-home   >  SYSTEM   >  /boot 500MB sda3   >  / 51GB centos-root   >  swap 3.85GB centos-swap The "other" Windows partitions are: > ntfs 100MB sda1   >  ntfs 253GB sda2 This looks ok BUT when I go into Centos 7 Installation again it is telling me I have to create mount points for the root partition. I didn't do this originally as I thought it would be done automatically when I clicked "Click here to create them automatically" for the disk setup the first time I installed. And the partition table accessed using cfdisk from "Rescue a Centos system..." looks like this: > Unusable 1MB   >  sda1 Primary ntfs 105MB   >  sda2 Primary ntfs 265GB   >  sda3 Boot Primary xfs 525MB   >  sda5 NC Logical LVM2_member 235GB   >  Logical Free space 0.03MB As mentioned, when I try to boot with this configuration I get "missing operating system." If I change the boot flag back to sda1 then it boots into Windows 7 fine. UPDATE: I (re)installed `grub2` using `grub2-install` from the netinstall on /dev/sda and now when I boot from the disk I get the `grub` prompt.   I can using it to chain load into Windows.   However, when I try to boot into CentOS 7 I get some sort of trace/dump. I use: `linux (hd0,msdos3)/vmlinuz-3... root=/dev/sda3` (which is I believe is the primary boot partition for CentOS) `initrd (hd0,msdos3/initrd-plymouth...` `boot` but it just crashes. UPDATE 2: I installed NTFS-3G and NTFSPROGS using Yum from the EPEL repository. I ran grub2-mkconfig -o /boot/grub2/grub.cfg and then rebooted to find Windows 7 (Loader) in the boot menu :-) But when I choose it I get: error: no such device 978778... error: hd1 cannot get C/H/S values.... which doesn't sound very good at all, but at least some progress. I should also say that I now have Centos 7 only on the internal drive and I am working on this drive as an external USB drive (hence /dev/sdb). Thanks to the commenters. Can someone please help me to get Windows to boot? I have a Unix background but mostly use Mac OS X. I always come unstuck on setting up Windows and Linux dual boot. PS I have Centos 6.5 system running fine on another machine, as well as my Mac.


How to correctly add a path to PATH?

I'm wondering where a new path has to be added to `PATH` environment variable. I know this is accomplished editing `.bash_rc` (for example), but it's not clear how to do this. This way:               export PATH=~/opt/bin:$PATH      or this?               export PATH=$PATH:~/opt/bin      Question 2 (related). What's a workable way to append more paths on different lines? Initially I thought this could do the trick:               export PATH=$PATH:~/opt/bin     export PATH=$PATH:~/opt/node/bin      but it doesn't because the second assignment doesn't only append `~/opt/node/bin`, but also the whole `PATH` previously assigned. This is a possible workaround:               export PATH=$PATH:~/opt/bin:~/opt/node/bin      but for readability I'd prefer to have one assignment for one path.


Setting PATH vs. exporting PATH in ~/.bash_profile

What's the difference and which is better to use when customizing my bash profile? Documentation on the `export` command is scarce, as it's a builtin cmd. Excerpt from version 1 of my ~/.bash_profile:               #PATH     export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:$HOME/bin          #add Homebrew’s sbin to PATH     export PATH=/usr/local/sbin:$PATH      Output from: `echo $PATH` `/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/njboot/bin` Excerpt from version 2:               #PATH     PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:$HOME/bin          #add Homebrew’s sbin to PATH     export PATH=/usr/local/sbin:$PATH      Output from `echo $PATH` is the same as in version 1. `env` is the same as well. So:   * 1) What's the benefit of using `export` vs. setting PATH explicitly?   * 2) Is there any functional difference between version 1 and version 2 when applied?   * 3) Which should I use and why?


Path is there, but cannot call one program without specifying path

> **Possible Duplicate:**   >  How to correctly add a path to PATH? I installed "perf" on Linux. But I can only use it by specifying the path: `~/bin/perf` I checked path by using `echo` and I found `/bin` is there. What else should I do?


Program installed to `/home/username/bin` and added to path... not launching

I just installed newer versions of `grep` and `vim` to my local `~/bin` directory. I have the path added via `PATH=$PATH:$HOME/bin` in my `.bash_profile`. When I try to run either, the version installed in `/usr/local/bin` launches. How do I override this?


Cant get remote access to PostgreSQL

There is PostgreSQL 9.2 in Debian. My `/etc/postgresql/9.2/main/postgresql.conf` file contains:               listen_addresses = '127.0.0.0, 212.49.109.137'     password_encryption = on      '212.49.109.137' is the IP of the computer running PostgreSQL. `/etc/postgresql/9.2/main/pg_hba.conf` contains:               host    all         all        85.12.201.202         255.255.255.0  md5      85.12.201.202 is the IP address of the client that tries to connect. I try to connect using:               psql -h 212.49.109.137 -U postgres -d postgis_template      And get error:               psql: could not connect to server: Timeout     Is the server running on host "212.49.109.137" and accepting     TCP/IP connections on port 5432?      In `netstat -pln` i see:               tcp        0      0 127.0.0.0:5432          0.0.0.0:*               LISTEN      5127/postgres


Must pass urls in quotes

I'm trying pass a URL to `mpv` for it to play it as a network stream. This can be done in `bash` with the following syntax:               $ mpv http://myvideosite.com      However, `zsh` wants to evaluate the URL as (presumably) a file path. Running               % mpv http://myvideosite.com      gets the following response:               zsh: no matches found: http://myvideosite.com      and a return code of 1. Running               % mpv "http://myvideosite.com"      executes as expected. Does `zsh` not treat arguments as strings?


Hard disk drive spins up on laptop sleep/wake, can I stop it doing this?

I have in my Arch Linux-running laptop an SSD and an HDD; the latter I use seldom. It is mounted as /mnt/sdb5 and configured to spin down proactively when on battery (`/etc/default/tlp`, `DISK_APM_LEVEL_ON_BAT` has the value 1 for sdb). However, the disk spins up in two situations which I would rather it didn’t:   * When I suspend the machine, it spins up and them promptly down again. I can’t for the life of me imagine why it would do this when I haven’t even touched the drive since it was mounted.   * When I wake the machine, it spins up. Perhaps it is making sure it’s there or some such thing? (It also spins up at boot time, but that I understand. Of course it must read the partition table.) Can I avoid these spin-ups without removing the hard disk drive? I’m quite willing to only mount it when I want to use it or such things.


service red5 restart FAILED

Works to start and stop but not to restart: > >     -bash-4.1# service red5 restart >        Shutting down red5:                              [FAILED] >   It was all working before had to delete red5 and JDK and reinstall and now this is happening. Have no clue why. On Linux CentOS 6


grepping foo and bar

I am looking for a command options for `grep` to find files with the occurences of `foo` and `bar`. Grepping with               grep -r -e foo -e bar .      shows files which have only `foo` or only `bar` and files which have `foo` and `bar`. Is it possible with `grep` to find only files which have both `foo` and `bar` (and display the lines that match either `foo` or `bar` or both in those files _only_ )? Example:               echo foo > file1     echo bar > file2     (echo foo;echo;echo bar) >file3     echo barfoo > file4      the grep cmd:               grepcmd -r -e foo -e bar .     ./file3:foo     ./file3:bar     ./file4:barfoo


Fast Way to Randomize HD?

I've read about how to make hard drives secure for encryption, and one of the steps is to write random bits to the drive, in order to make the encrypted data indistinguishable from the rest of the data on the hard drive. However, when I tried using `dd if=/dev/urandom of=/dev/sda` in the past, the ETA was looking to be on the order of days. I saw something about using `badblocks` in lieu of urandom, but that didn't seem to help a whole lot. I would just like to know if there are any ways that might help me speed this up, such as options for `dd` or something else I may be missing, or if the speed is just a limitation of the HD.


How to use regex as field separator in awk?

I'm trying to use regex as a field seperator in `awk`. From my reading this seems possible but I can't get the syntax right.               rpm -qa | awk '{ 'FS == [0-9]' ; print $1 }'     awk: cmd. line:1: { FS     awk: cmd. line:1:     ^ unexpected newline or end of string      Thoughts? The goal if not obviouse is to get a list of software without version number.


How to use the -t option of Unix command look

I'm learning the `look` utility and I don't understand the meaning of the `-t` option. Can someone show me some examples of it? I read the `man` page, but still don't know what it exactly means.


How to create an unprivileged user in CentOS?

I want to create an unprivileged user to run my RhodeCode server and Celery daemon on a CentOS instance. I think the accepted definition of this is no home directory, login disabled, and no shell access? Looking over the man page for adduser I just don't see an intuitive method for doing this. Any suggestions are appreciated. Thanks.


Rename Multiple files and add date before the files

I have a folder contains one or more tar.gz files. I want to add current date before each files when the script run. For example: Two file name(those files will be created each day, but the name will remain the same):               file1.tar.gz      file2.tar.gz      In first day(2011-10-07), those two files will be renamed to:               2011-10-07_file1.tar.gz     2011-10-07_file2.tar.gz      In next day(2011-10-08), they are changed to:               2011-10-08_file1.tar.gz     2011-10-08_file2.tar.gz      Finally, the folder contains the following files:               2011-10-07_file1.tar.gz     2011-10-07_file2.tar.gz     2011-10-08_file1.tar.gz     2011-10-08_file2.tar.gz      How to achieve this using one line? I tried to use "rename" command, but I can only add the date after the file, not before. ## My code               cdate=`date +"%Y-%m-%d"`; rename .gz .gz.$cdate *.gz


If ^a^b replaces "a" once in the last command, what do I use to replace all occurrences of "a"?

In bash, if I run this command:               echo aaaaaaa      I get `aaaaaaa` (duh) But then if I type in               ^a^b      I end up with `baaaaaa` What would I type to end up with `bbbbbbb` ?


Simulate keyboard input in bash OR stdin redirection where stdin remains visible

I was wondering if I could redirect a file to the stdin of a program so that I could actually see the lines of the file as they're being used. Suppose I have a CLI program with the following flow (in a loop): A) Computer asks question B) User answers it C) Computer responds Running this interactively yields output (which can be copied and pasted from the terminal) that intermixes user answers with computer generated text. I need to get the same result for a situation where the program is run non- interactively and where the answers are predefined in a file. Running program Is there a way to get the same kind of text that would appear on the terminal screen of such a program run interactively?


After researching, still confused about monitoring RAM usage

I went through this article, which explains various methods for checking your RAM usage. However, I can't reconcile the different methods and don't know which one is correct. When I first login, I'm greeted with a screen like this:                 System information as of Sun Apr 28 21:46:58 UTC 2013            System load:  0.0               Processes:           76       Usage of /:   15.6% of 7.87GB   Users logged in:     1       Memory usage: 41%               IP address for eth0:        Swap usage:   0%      This suggests to me that I am using 41% of my RAM, which seems quite high since the server isn't doing much. Or does that number refer to something besides RAM? Next I try the `free -m` method:               ubuntu@ip-:~$ free -m                  total       used       free     shared    buffers     cached     Mem:           590        513         76          0         67        315     -/+ buffers/cache:        130        459     Swap:            0          0          0      According to the explanatory graphic in the article, this implies I have 130MB of used RAM and 459MB of free RAM, which suggests I'm using about 22% of my RAM. Next I run `top`:               top - 22:14:48 up 195 days, 21:30,  2 users,  load average: 0.00, 0.01, 0.05     Tasks:  77 total,   1 running,  76 sleeping,   0 stopped,   0 zombie     Cpu(s):  1.3%us,  0.3%sy,  0.0%ni, 97.7%id,  0.7%wa,  0.0%hi,  0.0%si,  0.0%st     Mem:    604376k total,   525692k used,    78684k free,    69124k buffers     Swap:        0k total,        0k used,        0k free,   322740k cached            PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                     1 root      20   0 24332 1864  976 S  0.0  0.3   0:08.75 init                        2 root      20   0     0    0    0 S  0.0  0.0   0:00.00 kthreadd           This is the most confusing, as the summary shows me using 525MG of 604M total, and yet when is use the "m" interactive command to sort by top memory the top process is only using 0.3% of the memory??? Finally, the `ps` command seems to show very little memory usage as well:               root@ip-:/home/ubuntu# ps -o command,rss     COMMAND                       RSS     ps -o command,rss             788     sudo su root                 1764     su root                      1404     bash                         2132      I would love for someone to correct whatever misunderstandings I have that are creating these apparent conflicts. Thanks! ### EDIT for Rahul Ouput of `cat /proc/meminfo`:               MemTotal:         604376 kB     MemFree:          157564 kB     Buffers:           49640 kB     Cached:           231376 kB     SwapCached:            0 kB     Active:           290040 kB     Inactive:          97772 kB     Active(anon):     107672 kB     Inactive(anon):     4844 kB     Active(file):     182368 kB     Inactive(file):    92928 kB     Unevictable:           0 kB     Mlocked:               0 kB     SwapTotal:             0 kB     SwapFree:              0 kB     Dirty:                52 kB     Writeback:             0 kB     AnonPages:        106836 kB     Mapped:            22920 kB     Shmem:              5712 kB     Slab:              42032 kB     SReclaimable:      34016 kB     SUnreclaim:         8016 kB     KernelStack:         688 kB     PageTables:         3584 kB     NFS_Unstable:          0 kB     Bounce:                0 kB     WritebackTmp:          0 kB     CommitLimit:      302188 kB     Committed_AS:     242768 kB     VmallocTotal:   34359738367 kB     VmallocUsed:        7152 kB     VmallocChunk:   34359729008 kB     HardwareCorrupted:     0 kB     AnonHugePages:         0 kB     HugePages_Total:       0     HugePages_Free:        0     HugePages_Rsvd:        0     HugePages_Surp:        0     Hugepagesize:       2048 kB     DirectMap4k:      637952 kB     DirectMap2M:           0 kB


Why is the UNIX kernel so crucial?

More specifically, how is the UNIX kernel treated differently from other parts of the Operating System?


Scripting to domain allocation to server

I have two text files: **file #1:** domain.txt               cocacola.com     airtel.com     pepsi.com      **file #2:** servers.txt               192.0.53.42 , 4    # 4 domains already allocated on server 192.0.53.42     192.53.1.2 , 1     # 1 domains already allocated on server 192.53.1.2     192.36.155.21 , 2  # 2 domains already allocated on server  192.36.155.21      I need to write a script, which will allocate each domain (one by one from top to bottom from `domains.txt`) to the server (to `server.txt`) which has the minimum load at a given instant (if there is a tie in minimum load then the the server is allocated with FCFS). Finally I want to write a script to do as above then create a new file with modifications named: `allocation.txt`. In the above example `allocation.txt` as a output will have (after execution of script):               192.0.53.42 , 4     192.53.1.2 , 3 , cocacola.com , airtel.com     192.36.155.21 , 3 , pepsi.com      I am a newbie to scripting, and would appreciate any help/guidance! What would be your basic approach to solving this problem? Can all this be accomplished by one script?


File not found: Beautiful Soup

I am trying to run a program that I downloaded in Ubuntu latest version, but I continue getting an error everytime I try to run the program. It says:               File Not Found: BeautifulSoup      So in order to attempt to fix this, I've downloaded the bs4 beautiful soup package through the command line. I've tried running `python`, and then importing it by doing, `from bs4 import BeautifulSoup`. I have tried many different variations of this and downloading and redownloading it. I've tried running the `from bs4 import BeautifulSoup` directly from the terminal, but that did not work and returned an error. Does anyone know anyway to fix this issue or what I need to do?


Why is the following script not working?

I wrote the following script for finding the number of pdf and tex files from the current directory, including the subdirectories and hidden files. The following code is able to find the number of pdf files upto 2 levels of subdirectories below, but after that it tells that there are no sub directories....               #!/bin/bash          touch t.txt          k=`find -type d |wc -l`     k1=`expr $k - 1`          echo $k1          message1="*.pdf *.tex"     count=`ls -al $message1|wc -l`     find -type d > t.txt          i=2          while [ $i -le $k ]     do         kd=`head -$i t.txt|tail -1`         echo $kd         touch $kd/t.txt         cp t.txt $kd/t.txt         i=`expr $i + 1`     done          i=2     while [ $i -le $k ]     do         nd=`head -$i t.txt|tail -1`         set -x         echo $nd         set +x         cd $nd         j=`ls -al $message1|wc -l`         count=`expr $count + $j`         i=`expr $i + 1`     done     #set +x          echo $count


conditional expression and expansion

I don't seem to understand how to "test" the conditional operators [[ and [. I tried using various form such as               echo [[a=a]]          [[a=a]]     echo $?      and some other things I want to see what they return, to test some comparisons. How do you expand them, or execute them?


Truncating log from first line

I am making a simple IRC bot in bash and I want prevent its log from growing to infinity. For example it could be shortened always when reaching set number of lines. How can I do that easily? For example by cutting the file with removing first line(s)? If possible, I would like to avoid sed/awk this time :)


is setting a 0 permission on a directory an effective way to protect its contents?

Let's say that permissions for `user` and `group` are set up correctly on a directory. Would a 0 permission for `other` on that directory provide effective access control for the directory's files and subdirectories? Are there gotchas to consider? When you create files that are `rw` to other people (like with Unix Domain Sockets) people think of it as a security issue, since there's a race condition that a malicious user can exploit before proper permissions are applied to a file. That's why I'm looking for an "atomic" way of doing basic permissioning.


grep seems to ignore --include

`man grep` says               grep [OPTIONS] PATTERN [FILE...]          . . .             --include=GLOB               Search  only  files whose base name matches GLOB (using wildcard               matching as described under --exclude).      So I typed               grep --include="*.html" 'li' *      to search for instances of `li` in HTML files in the current directory. Instead I get a list of every use of `li` anywhere in the directory, even in the non-HTML files. What am I doing wrong? I tried all kinds of variants like               grep --include=\*.html 'li' *      but without any luck.


Invert results for "for in * do"-loops

> **Possible Duplicate:**   >  How do I reverse a for loop? Is there an easy way to invert a for in loop? For a script I want to process files in their reverse order. So instead of:               for file in *.jpg;       do echo $file;     done      with the result               001.jpg     002.jpg     003.jpg     ...     150.jpg      I want the result               150.jpg     149.jpg     148.jpg     ...     001.jpg


How to stop CACHE instance from Shell Script

I want to restart CACHE(database that I am using) Instance from shell script. What I did is created a function in the shell script named resatrt_cache.               restart_cache()     {      ccontrol stop instancename restart     }      This command is running but the control goes to cache and while stopping cache it get stuck to this question               **Do you want to broadcast a message to anyone? No =>**      How can I pass the value here through shell script


To find file received time using find command in ssh server

Below command gives syntax error               fname1=abc.txt          tim=`find /path/ -type f -name $fname1 -ls|awk '{print $8$9$10}'`          Syntax Error The source line is 1.      The error context is                      >>> {print <<<      awk: 0602-502 The statement cannot be correctly parsed. The source line is 1.      Also tried to find file time of below command it also gives `printf` is not valid:               tim=`find /path/ -type f -name $fname1 -printf "%t"`


How to match date in Perl --- assuming UNIX regex is the same as Perl's

I want to match dates of the form               Monday May 26      My attempt to do this is the following:               /(.*day Jan.*|Feb.*|Mar.*|Apr.*|May|Jun.*|Jul.*|Aug.*|Sep.*|Oct.*|Nov.*|Dec.* [1-31])/      The regex form in UNIX and Perl seem to be the same, so this is why I ask it here.


How to exit file reading mode in linux terminal?

I appologize if its something really stupid i am asking. But this is my first day on linux commands infact I dotn have linux right now I have just installed CYGWIN for my learning. SO my question is I have display file contents using **less** command and now I am unable to exit that and to type some other commands like ![enter image description here](http://i.stack.imgur.com/E2c2H.png) I want to exit this mode to type some other commands. How can I do that.


Can't edit sources.list as root

I cannot edit/move/delete the `sources.list` file, despite being root. When I do `ls -la /etc/apt` it reports this:               root@nibelung:~# ls -la /etc/apt/     total 356     drwxr-xr-x   6 root root   4096 Feb 28 21:30 .     drwxrwxr-x 100 root root   4096 Feb 28 01:29 ..     -rw-r--r--   1 root root     98 Aug 24  2013 apt.conf     drwxr-xr-x   2 root root   4096 Feb 27 14:04 apt.conf.d     -rw-r--r--   1 root root    123 Feb 28 01:52 preferences     drwxr-xr-x   2 root root   4096 Feb 27 21:01 preferences.d     -rw-------   1 root root      0 Aug 24  2013 secring.gpg     -rw-r--r--   1 root root    878 Jan 24 19:30 sources.list     -rw-r--r--   1 root root      0 Sep 27 02:00 sources.list~     -rw-r--r--   1 root root    878 Feb 28 21:30 sources.list.bk     drwxr-xr-x   2 root root   4096 Feb 27 21:01 sources.list.d     -rw-------   1 root root   1200 Jan 24 15:03 trustdb.gpg     -rw-------   1 root root 158664 Jan 24 15:03 trusted.gpg     -rw-------   1 root root 158664 Jan 24 15:03 trusted.gpg~     drwxr-xr-x   2 root root   4096 Apr 15  2011 trusted.gpg.d


solaris + fit egrep for solaris

On Linux machines I use this syntax, in order to match all VALID ip's. My question: what needs to change for egrep command in order to run the egrep on Solaris? According to egrep manual page "-o" isn't a legal option. What is the alternative for Solaris?                    regex="(1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.(1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.(1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.(1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])"               egrep  -o  `echo $regex` file      example of file               32)5.500.5.5*kjcdr     ##@$1.1.1.1+++jmjh     1.1.1.1333     33331.1.1.1     @5.5.5.??????     ~3de.ede5.5.5.5     1.1.1.13444r54     192.9.30.174     &&^#%5.5.5.5     :5.5.5.5@%%^^&*     :5.5.5.5:     **22.22.22.22     172.78.0.1()*5.4.3.277


dig @nameserver doesn't work

I have Ubuntu 12.04 with BIND9, working just as a caching server (forwarding to 8.8.8.8). When I use, for example, `dig +norecurse @l.root-servers.net www.uniroma1.it`, I obtain the following output > ; <<>> DiG 9.8.1-P1 <<>> +norecurse @l.root-servers.net www.uniroma1.it > > ; (1 server found) > > ;; global options: +cmd > > ;; connection timed out; no servers could be reached Using Wireshark I discovered that the outgoing queries are correct, but there aren't any incoming answers. Why? P.S. Using simply `dig www.uniroma1.it` I obtain the correct answers.


Mount an loop file without root permission?

Can i mount a loop file without root permission , normally i do: `mount -o loop DISK_IMAGE FOLDER` Without setting up sudo or suid mount program , is there any suitable way to do this ? I know i can use fusermount with some iso images , but that is pretty limited , even for ISO images , some of my images can't be mounted , but `mount` always works


Why arguments in braces do not expand in this case?

For example, I want to put some file names inside braces for expansion like this:               $ ls     blue_texture  blue_waves  green_light     $ ls -m | tr -d ' \n'     blue_texture,blue_waves,green_light      $ echo foo/bar/{`ls -m | tr -d ' \n'`}     foo/bar/{blue_texture,blue_waves,green_light}      My question why doesn't brace expansion work here? I expected it to work as following:               $ echo foo/bar/{blue_texture,blue_waves,green_light}     foo/bar/blue_texture foo/bar/blue_waves foo/bar/green_light


How do I easily update list of md5sums?

Sometimes I use an unreliable medium (flash) to store a good deal of data. To at least recognise bit flips I store a file with the md5sums alongside. This file is usually created by a variation of `find -type f -exec "{}" \; >MD5SUM`. Later I copy some more files on it and now I would like to add the checksums of the new files without having to recalculate the old ones. Sadly, the time of some the machines I use are screwed, so using `find -newer <file> -exec md5sum "{}"\; >>MD5SUM` is not an option. Basically I would like to get the difference between the file list created by `find -type f` and the list in the MD5SUM file. Any ideas how to do this in an easy and elegant manner? Thanks in advance!


Resume input from user after file is read

I have a program that reads user input—moves, it's a boardgame—from the user. Like so:               $ game     enter your move:      # etcetera      The first _N_ moves I need to repeat each time, so I put them in a text file, one line each. That works:               $ game < moves.txt      This works, but after these _N_ moves, how do I return to input from the command line? I realize this is probably a duplicate question, but I couldn't find it.


selective stdout , stderr and logging using the script command

> **Possible Duplicate:**   >  Show only stderr on screen but write both stdout and stderr to file   >  stdout , stderr and logging using the script command cat test.sh:               rm -v foo.tmp     date     pwd      cat test2.sh:               script bar.log -c './test.sh'      When executing test2.sh I would like to see the following for example on my terminal:               Fri Feb 17 18:04:30 PST 2012       /home/me/me      However in bar.log I would like to see:               removed 'foo.tmp'       Fri Feb 17 18:04:30 PST 2012       /home/me/me      or (in case foo.tmp does not exist)               rm: cannot remove 'foo.tmp'       Fri Feb 17 18:04:30 PST 2012       /home/me/me      Is this doable?


Show only stderr on screen but write both stdout and stderr to file

How can I use BASH magic to achieve this?   I want to only see stderr output on the screen,   but I want both stdout and stderr to be written to a file. Clarification: I want both stdout and stderr to end up in the same file. In the order they happen.   Unfortunately none of the answers below does this.


What is `^M` and how do I get rid of it?

When I open the file in vim I am seeing strange `^M` characters. Unfortunately, the world's favorite search engine does not do well with special characters in queries, so I'm asking here:   * What is this `^M`?   * How could it have got there?   * How do I get rid of it?


How can I get to a terminal or virtual console when Ctrl-Alt-F2 fails?

When X and GNOME are working normally, I can just hit `Ctrl`-`Alt`-`F2` to leave GNOME and use the terminal on the second virtual console. To switch back to GNOME, I can just hit `Alt`-`F1`. Today, X or GNOME stopped working normally for me and I was unable to get to a virtual console. I was still able to move my mouse cursor around but I wasn't able to click anything. As far as I could tell, my keyboard was unresponsive, but maybe the right keyboard shortcut would have helped. I ended up pressing the power button on the computer to gracefully shut it down, but what could I have done to avoid this? I'm using CentOS 6.0 and GNOME 2.28.