sed + remove the first directory from path

Please advise on how to remove the first directory from a path by `sed`, (the inverse pf what `basename` does). For example               echo "/mnt/VPfig/Amer/AR4/Celtel/files/COM.txt" | sed ...      I should get:               /VPfig/Amer/AR4/Celtel/files/COM.txt


Insert after a second pattern in sed

I'm using sed to edit a text file. The command:               sed -n -e '/pattern1/,/pattern2/p' test01.txt      show the lines between pattern1 and pattern2. But how can I insert a new line after this `pattern2`? my sed version don't admit "i\" for line-command edition. I'm running a FreeBSD port.


Delete matching file from every subfolder of current dir

I used this one to copy file in every dir:               find -type d -maxdepth 1 -print0 | xargs -0 -n1 cp .htaccess      Now i need to do reverse one and delete file with matching name from every sub directory of one i am currently in


How to regain control of my computer?

I am running a database server on my computer. Sometimes it takes up so much memory resources that the system stop responding to keyboard and mouse inputs. Although I can move the mouse pointer and turn on and off `Caps Lock`, I can't do anything else beyond that. Surprisingly, I am able to `SSH` to the computer, run the `top` command, kill a few processes and shutdown the database server to reclaim memory space. But even having done those things, the display remains in a semi-frozen state (mouse still animated). Having reclaimed most of my memory, is it possible to regain usage of the system without having to reboot?


How do I exit a script in a conditional statement?

I'm writing a bash script where I want to exit if the user is not root. The conditional works fine, but the script does not exit.               [[ `id -u` == 0 ]] || (echo "Must be root to run script"; exit)      I've tried using `&&` instead of `;` but neither work.


mutt: trash folder

I am trying to set up `trash` in mutt. The macro at MacroSamples does not work:               set maildir_trash=yes     set wait_key=no     folder-hook . 'bind index q quit'     folder-hook inbox 'macro index q ":unset maildir_trash;push \"T~D\\n<tag-prefix-cond>m=trash\\n<end-cond><quit>\"\n"'      when I press `d` nothing happens. When I pres `q` instead of exiting, mutt asks:               Subject: <end-cond><quit>      I have to cancel it with `CTRL-c` Can somebody please advise how to set up `trash folder` that actually works?


Nemo: Forget encryption password

I have mounted an encrypted disk by selecting it in Nemo (1.1.2), then typing a password. I can unmount the disk using Nemo, but now it can be remounted without requiring the password. Probably there was a "remember" option such as demonstrated in this question. Regardless of what I selected when I initially mounted, now **I want Nemo to forget the password**. Is there a way to do this aside from logging out? _This question may also apply to Nautilus (Nemo is a fork)._


Why is redirecting STDERR to /dev/null done this way?

This does not make sense to me.               wibble > /dev/null 2>&1      I think it would make more sense if it was something like this:               wibble 2>&1 > /dev/null      In other words               Commands Output Sendall STDERRORS to STDOUT then SEND it all to /dev/null      What is the thinking behind the order of the command redirection `xxx > /dev/null 2>1`?


Why is dnsmasq putting my router IP in /etc/resolv.conf instead of 127.0.0.1?

I'm having DNS resolution issues in various contexts which appear to trace back to my networking configuration. I'm running just the dnsmasq-base installation of dnsmasq on two Linux installations (Lubuntu 12.04 and 12.10). I haven't done anything in particular to configure dnsmasq, but I think some other changes I made previously may have lead to an incorrect configuration when upgrading. The working configuration on machine 'A' running 12.04 sets `/etc/resolv.conf` to use 127.0.1.1 (which in `/etc/hosts` is set to `$HOSTNAME`) On machine 'B' where certain applications such as OpenVPN experience DNS resolution issues, `/etc/resolv.conf` is set to 192.168.1.1, which is my gateway IP. Only certain applications are affected. Web-browsing, for example, works just fine. Any idea if this difference is the cause of the DNS resolution issues, and why 'B' is behaving differently? Edits: Both 'A' and 'B' are running dnsmasq, both are using DHCP to get DNS configuration, and I'm only using dnsmasq for DNS. There is no /etc/dnsmasq.conf file. I understand that this is normal when running just dnsmasq-base. The contents of /etc/resolvconf on the two machines appear to be identical. No extraneous/missing files. Sorry I can't be more specific about the nature of the problem. "DNS resolution issue" was the end-point of my discussion with technical support at my VPN provider.


Can I switch to another process in another tty# terminal from an ssh terminal?

Here's the deal. I have a Linux Mint 15 server running a web server, an ssh server, and a minecraft server. When I go back to college after the summer, I want to leave my machine at home (6 hrs away) and just ssh in when I need to do things. I use the tty1 terminal to execute the minecraft server (always), and it constantly prints log info and accepts input from the server (this can change things in game, edit and reload the whitelist, and a few other things). So, is there a way for me to legitimately (or even by "hacking") ssh into my computer and then take control of another tty# terminal and inject my own commands into a process it is running as well as view that process's output?


How to create /dev/null?

I successfully deleted my /dev/null. How can I restore it? The OS is Ubuntu.


Cannot kill a java process

I have a java process that cannot be killed. I have tried every method I know, or that I have found on the internet to no avail. I have tried:               killall java     kill -9 <pid>     kill -11 <pid>     kill -6 <pid>       No matter what I try, I cannot kill the program. If this helps, it has a dynamic PID, and this has happened before and I somehow killed it last time.


Determine what device a directory is located on

If I do               # cd /     # ln -s /home test     # cd test     # mount --bind $PWD /mnt      the entry in `/proc/mounts` is               /dev/sda2 /mnt ext4 rw,noatime,data=ordered 0 0      which is the device that is mounted to `/home` and is not easily deducible from `$PWD` which is `/test`. How can I determine which device (i.e., /dev/sda2) is going to show up in `/proc/mounts` in general given that the bind mount may be to a directory/file that is potentially "obscured" by symlinks, other bind mounts, etc?


What disk is a file / directory stored on?

From the command line (bash) I would like to know what disk a given file is stored in. E.G.:               $ [what filesystem is this file in command] /tmp/example/file          /dev/sda1


How to configure OpenVPN to only listen on given interface?

How can I configure an OpenVPN server on a Linux machine to only listen on given interfaces? Are there any features like this in OpenVPN?


How to build a monitoring system with an infra cam?

I need to place 2 USB (?) webcams that are looking at two doors. No sound needed, just a few things:   * video files must be saved at least for 30 days (I have two eee pc's for the two webcams, so cable length doesn't matter)   * video quality must be good enough [@night too! - infra cam needed]   * timestamp on the video image I have a netbook that can do the recording. OS: **OpenBSD**


How to turn off screen under Linux/BSD?

How can I turn off my laptops screen from software side? ex.: under Scientific-linux, OpenBSD? Or the best I can do from OS side is just to show a black picture? Are there any solutions?


How to get a process uptime under different OS?

Under Linux I can get a process's uptime in seconds with:               echo $(($(cut -d "." -f1 /proc/uptime) - $(($(cut -d " " -f22 /proc/$PID/stat)/100))))      But how can I get it under different OS? ex.: SunOS, HP-UX, AIX?


How to follow (a la "tail -f") a binary file from the beginning?

Is it possible to follow a binary file from the beginning, a la `tail -f`? This is useful in some cases, for example if I'm `scp`ing a file to a remote server, and at the same time I want to feed it to another process (yes, I know I can use `ssh`+`cat` tricks). As far as I read from the FM, `tail` is written having text files in mind. Is there any simple way of doing such operations using standard posix tools?


No, I don't want persistent net rules

I have a bootable Linux memstick that I use on a lot of different PCs (but all of the same model and configuration). Trouble is that udev is renaming the eth interfaces so that what was `eth0` on the last PC is suddenly ethX, where X=1..inf. This causes if-up (called by ifplugd) to fail, since `/etc/network/interfaces` only specifies how to bring up `eth0`:               auto eth0     iface eth0 inet dhcp      It's a well-known problem; I've googled and found that this is caused by the MAC addresses changing and that it may be fixed by deleting `/etc/udev/rules.d/70-persistent-net.rules`. But that only works after a reboot, which is inconvenient and should be unneccessary, since I know what behaviour I want. What I want is _non-persistent_ net rules, or in the alternative, an `/etc/network/interfaces` script that adapts to the changing eth names, or perhaps it can be done with ifplugd. What's the best way to achieve this? Distro: Ubuntu 8.04.


How to save the results from ls to a command?

I want the results from an ls to be saved in a var inside a makefile the command is simply the following:               ls text*       and the result suppose to be something like : text1.txt What i put in my script is:               text = some commands to fetch the "text" .     com = `ls $(text)*`      What is actually saved at $com is the results of the entire ls without the $(text)* parameter.


How was the shift to 64 bits handled on Linux

How was the transition to 64 bits handled on Linux/Unix? The Windows world still seems to have issues with it and I'm curious how it was handled in the *nix world.


Is creating a sparse image using dd appropriate for backup/restore from a RAID?

I have two non-networked servers, each with 1.2TB of storage in a RAID5 config on an LSI MegaRaid 9240-8i controller. I have been trying without success to get Symantec Ghost to image one machine to the other due to driver issues, and so I was wondering if it wouldn't be easier to boot from a Linux LiveCD, plug in an external hard disk and `dd` the RAID partition to the external disk. The 1.2TB partition only has around 10GB of data on it, so I hope to generate a sparse image file (to avoid having to find a 1.2TB USB disk!). I have seen people use the `seek` parameter of `dd` to achieve this - is that an appropriate way to create an image of around 10GB size in this situation? Even if this is a sensible way to generate a sparse image, is this a sensible way to mirror one RAID to another of identical configuration, or do the commercial utilities such as Ghost and Acronis do some 'magic' that `dd` does not?


emacs elpa load packages

I am using `emacs24`, and I started using `elpa` to download the packages to `~/.emacs.d/elpa` folder. How can I load these packages? For instance, I have tried (see below) for `rainbow-delimiter` but it doesn't work. I have tried commenting out a few lines and keeping others but nothing sticks.               ;; Paren checking                                                                         (add-to-list 'load-path "~/.emacs.d/elpa/")                      (require 'rainbow-delimiters)                                                            (autoloads (global-rainbow-delimiters-mode rainbow-delimiters-mode-enable                                                           rainbow-delimiters-mode)                                                                     (global-rainbow-delimiters-mode)                                                         (add-hook 'prog-mode-hook 'rainbow-delimiters-mode)                                      ;(add-hook 'emacs-lisp-mode-hook 'paredit-mode)                                           (add-hook 'emacs-lisp-mode-hook 'rainbow-delimiters-mode)


Reassemble mdadm-raid5

A friend of mine has a mdadm-raid5 with 9 disks which does not reassemble anymore. After having a look at the syslog I found that the disk sdi was kicked from the array:               Jul  6 08:43:25 nasty kernel: [   12.952194] md: bind<sdc>     Jul  6 08:43:25 nasty kernel: [   12.952577] md: bind<sdd>     Jul  6 08:43:25 nasty kernel: [   12.952683] md: bind<sde>     Jul  6 08:43:25 nasty kernel: [   12.952784] md: bind<sdf>     Jul  6 08:43:25 nasty kernel: [   12.952885] md: bind<sdg>     Jul  6 08:43:25 nasty kernel: [   12.952981] md: bind<sdh>     Jul  6 08:43:25 nasty kernel: [   12.953078] md: bind<sdi>     Jul  6 08:43:25 nasty kernel: [   12.953169] md: bind<sdj>     Jul  6 08:43:25 nasty kernel: [   12.953288] md: bind<sda>     Jul  6 08:43:25 nasty kernel: [   12.953308] md: kicking non-fresh sdi from array!     Jul  6 08:43:25 nasty kernel: [   12.953314] md: unbind<sdi>     Jul  6 08:43:25 nasty kernel: [   12.960603] md: export_rdev(sdi)     Jul  6 08:43:25 nasty kernel: [   12.969675] raid5: device sda operational as raid disk 0     Jul  6 08:43:25 nasty kernel: [   12.969679] raid5: device sdj operational as raid disk 8     Jul  6 08:43:25 nasty kernel: [   12.969682] raid5: device sdh operational as raid disk 6     Jul  6 08:43:25 nasty kernel: [   12.969684] raid5: device sdg operational as raid disk 5     Jul  6 08:43:25 nasty kernel: [   12.969687] raid5: device sdf operational as raid disk 4     Jul  6 08:43:25 nasty kernel: [   12.969689] raid5: device sde operational as raid disk 3     Jul  6 08:43:25 nasty kernel: [   12.969692] raid5: device sdd operational as raid disk 2     Jul  6 08:43:25 nasty kernel: [   12.969694] raid5: device sdc operational as raid disk 1     Jul  6 08:43:25 nasty kernel: [   12.970536] raid5: allocated 9542kB for md127     Jul  6 08:43:25 nasty kernel: [   12.973975] 0: w=1 pa=0 pr=9 m=1 a=2 r=9 op1=0 op2=0     Jul  6 08:43:25 nasty kernel: [   12.973980] 8: w=2 pa=0 pr=9 m=1 a=2 r=9 op1=0 op2=0     Jul  6 08:43:25 nasty kernel: [   12.973983] 6: w=3 pa=0 pr=9 m=1 a=2 r=9 op1=0 op2=0     Jul  6 08:43:25 nasty kernel: [   12.973986] 5: w=4 pa=0 pr=9 m=1 a=2 r=9 op1=0 op2=0     Jul  6 08:43:25 nasty kernel: [   12.973989] 4: w=5 pa=0 pr=9 m=1 a=2 r=9 op1=0 op2=0     Jul  6 08:43:25 nasty kernel: [   12.973992] 3: w=6 pa=0 pr=9 m=1 a=2 r=9 op1=0 op2=0     Jul  6 08:43:25 nasty kernel: [   12.973996] 2: w=7 pa=0 pr=9 m=1 a=2 r=9 op1=0 op2=0     Jul  6 08:43:25 nasty kernel: [   12.973999] 1: w=8 pa=0 pr=9 m=1 a=2 r=9 op1=0 op2=0     Jul  6 08:43:25 nasty kernel: [   12.974002] raid5: raid level 5 set md127 active with 8 out of 9 devices, algorithm 2      Unfortunately this wasn't recognized and now another drive was kicked (sde):               Jul 14 08:02:45 nasty kernel: [   12.918556] md: bind<sdc>     Jul 14 08:02:45 nasty kernel: [   12.919043] md: bind<sdd>     Jul 14 08:02:45 nasty kernel: [   12.919158] md: bind<sde>     Jul 14 08:02:45 nasty kernel: [   12.919260] md: bind<sdf>     Jul 14 08:02:45 nasty kernel: [   12.919361] md: bind<sdg>     Jul 14 08:02:45 nasty kernel: [   12.919461] md: bind<sdh>     Jul 14 08:02:45 nasty kernel: [   12.919556] md: bind<sdi>     Jul 14 08:02:45 nasty kernel: [   12.919641] md: bind<sdj>     Jul 14 08:02:45 nasty kernel: [   12.919756] md: bind<sda>     Jul 14 08:02:45 nasty kernel: [   12.919775] md: kicking non-fresh sdi from array!     Jul 14 08:02:45 nasty kernel: [   12.919781] md: unbind<sdi>     Jul 14 08:02:45 nasty kernel: [   12.928177] md: export_rdev(sdi)     Jul 14 08:02:45 nasty kernel: [   12.928187] md: kicking non-fresh sde from array!     Jul 14 08:02:45 nasty kernel: [   12.928198] md: unbind<sde>     Jul 14 08:02:45 nasty kernel: [   12.936064] md: export_rdev(sde)     Jul 14 08:02:45 nasty kernel: [   12.943900] raid5: device sda operational as raid disk 0     Jul 14 08:02:45 nasty kernel: [   12.943904] raid5: device sdj operational as raid disk 8     Jul 14 08:02:45 nasty kernel: [   12.943907] raid5: device sdh operational as raid disk 6     Jul 14 08:02:45 nasty kernel: [   12.943909] raid5: device sdg operational as raid disk 5     Jul 14 08:02:45 nasty kernel: [   12.943911] raid5: device sdf operational as raid disk 4     Jul 14 08:02:45 nasty kernel: [   12.943914] raid5: device sdd operational as raid disk 2     Jul 14 08:02:45 nasty kernel: [   12.943916] raid5: device sdc operational as raid disk 1     Jul 14 08:02:45 nasty kernel: [   12.944776] raid5: allocated 9542kB for md127     Jul 14 08:02:45 nasty kernel: [   12.944861] 0: w=1 pa=0 pr=9 m=1 a=2 r=9 op1=0 op2=0     Jul 14 08:02:45 nasty kernel: [   12.944864] 8: w=2 pa=0 pr=9 m=1 a=2 r=9 op1=0 op2=0     Jul 14 08:02:45 nasty kernel: [   12.944867] 6: w=3 pa=0 pr=9 m=1 a=2 r=9 op1=0 op2=0     Jul 14 08:02:45 nasty kernel: [   12.944871] 5: w=4 pa=0 pr=9 m=1 a=2 r=9 op1=0 op2=0     Jul 14 08:02:45 nasty kernel: [   12.944874] 4: w=5 pa=0 pr=9 m=1 a=2 r=9 op1=0 op2=0     Jul 14 08:02:45 nasty kernel: [   12.944877] 2: w=6 pa=0 pr=9 m=1 a=2 r=9 op1=0 op2=0     Jul 14 08:02:45 nasty kernel: [   12.944879] 1: w=7 pa=0 pr=9 m=1 a=2 r=9 op1=0 op2=0     Jul 14 08:02:45 nasty kernel: [   12.944882] raid5: not enough operational devices for md127 (2/9 failed)      And now the array does not start anymore. However it seems that every disk contains the raid metadata:               /dev/sda:               Magic : a92b4efc             Version : 1.2         Feature Map : 0x0          Array UUID : b8a04dbb:0b5dffda:601eb40d:d2dc37c9                Name : nasty:stuff  (local to host nasty)       Creation Time : Sun Mar 16 02:37:47 2014          Raid Level : raid5        Raid Devices : 9           Avail Dev Size : 7814035120 (3726.02 GiB 4000.79 GB)          Array Size : 62512275456 (29808.18 GiB 32006.29 GB)       Used Dev Size : 7814034432 (3726.02 GiB 4000.79 GB)         Data Offset : 2048 sectors        Super Offset : 8 sectors               State : clean         Device UUID : 8600bda9:18845be8:02187ecc:1bfad83a              Update Time : Mon Jul 14 00:45:35 2014            Checksum : e38d46e8 - correct              Events : 123132                   Layout : left-symmetric          Chunk Size : 512K             Device Role : Active device 0        Array State : AAA.AAA.A ('A' == active, '.' == missing)               /dev/sdc:               Magic : a92b4efc             Version : 1.2         Feature Map : 0x0          Array UUID : b8a04dbb:0b5dffda:601eb40d:d2dc37c9                Name : nasty:stuff  (local to host nasty)       Creation Time : Sun Mar 16 02:37:47 2014          Raid Level : raid5        Raid Devices : 9           Avail Dev Size : 7814035120 (3726.02 GiB 4000.79 GB)          Array Size : 62512275456 (29808.18 GiB 32006.29 GB)       Used Dev Size : 7814034432 (3726.02 GiB 4000.79 GB)         Data Offset : 2048 sectors        Super Offset : 8 sectors               State : clean         Device UUID : fe612c05:f7a45b0a:e28feafe:891b2bda              Update Time : Mon Jul 14 00:45:35 2014            Checksum : 32bb628e - correct              Events : 123132                   Layout : left-symmetric          Chunk Size : 512K             Device Role : Active device 1        Array State : AAA.AAA.A ('A' == active, '.' == missing)               /dev/sdd:               Magic : a92b4efc             Version : 1.2         Feature Map : 0x0          Array UUID : b8a04dbb:0b5dffda:601eb40d:d2dc37c9                Name : nasty:stuff  (local to host nasty)       Creation Time : Sun Mar 16 02:37:47 2014          Raid Level : raid5        Raid Devices : 9           Avail Dev Size : 7814035120 (3726.02 GiB 4000.79 GB)          Array Size : 62512275456 (29808.18 GiB 32006.29 GB)       Used Dev Size : 7814034432 (3726.02 GiB 4000.79 GB)         Data Offset : 2048 sectors        Super Offset : 8 sectors               State : clean         Device UUID : 1d14616c:d30cadc7:6d042bb3:0d7f6631              Update Time : Mon Jul 14 00:45:35 2014            Checksum : 62bd5499 - correct              Events : 123132                   Layout : left-symmetric          Chunk Size : 512K             Device Role : Active device 2        Array State : AAA.AAA.A ('A' == active, '.' == missing)               /dev/sde:               Magic : a92b4efc             Version : 1.2         Feature Map : 0x0          Array UUID : b8a04dbb:0b5dffda:601eb40d:d2dc37c9                Name : nasty:stuff  (local to host nasty)       Creation Time : Sun Mar 16 02:37:47 2014          Raid Level : raid5        Raid Devices : 9           Avail Dev Size : 7814035120 (3726.02 GiB 4000.79 GB)          Array Size : 62512275456 (29808.18 GiB 32006.29 GB)       Used Dev Size : 7814034432 (3726.02 GiB 4000.79 GB)         Data Offset : 2048 sectors        Super Offset : 8 sectors               State : active         Device UUID : a2babca3:1283654a:ef8075b5:aaf5d209              Update Time : Mon Jul 14 00:45:07 2014            Checksum : f78d6456 - correct              Events : 123123                   Layout : left-symmetric          Chunk Size : 512K             Device Role : Active device 3        Array State : AAAAAAA.A ('A' == active, '.' == missing)               /dev/sdf:               Magic : a92b4efc             Version : 1.2         Feature Map : 0x0          Array UUID : b8a04dbb:0b5dffda:601eb40d:d2dc37c9                Name : nasty:stuff  (local to host nasty)       Creation Time : Sun Mar 16 02:37:47 2014          Raid Level : raid5        Raid Devices : 9           Avail Dev Size : 7814035120 (3726.02 GiB 4000.79 GB)          Array Size : 62512275456 (29808.18 GiB 32006.29 GB)       Used Dev Size : 7814034432 (3726.02 GiB 4000.79 GB)         Data Offset : 2048 sectors        Super Offset : 8 sectors               State : clean         Device UUID : e67d566d:92aaafb4:24f5f16e:5ceb0db7              Update Time : Mon Jul 14 00:45:35 2014            Checksum : 9223b929 - correct              Events : 123132                   Layout : left-symmetric          Chunk Size : 512K             Device Role : Active device 4        Array State : AAA.AAA.A ('A' == active, '.' == missing)               /dev/sdg:               Magic : a92b4efc             Version : 1.2         Feature Map : 0x0          Array UUID : b8a04dbb:0b5dffda:601eb40d:d2dc37c9                Name : nasty:stuff  (local to host nasty)       Creation Time : Sun Mar 16 02:37:47 2014          Raid Level : raid5        Raid Devices : 9           Avail Dev Size : 7814035120 (3726.02 GiB 4000.79 GB)          Array Size : 62512275456 (29808.18 GiB 32006.29 GB)       Used Dev Size : 7814034432 (3726.02 GiB 4000.79 GB)         Data Offset : 2048 sectors        Super Offset : 8 sectors               State : clean         Device UUID : 2cee1d71:16c27acc:43e80d02:1da74eeb              Update Time : Mon Jul 14 00:45:35 2014            Checksum : 7512efd4 - correct              Events : 123132                   Layout : left-symmetric          Chunk Size : 512K             Device Role : Active device 5        Array State : AAA.AAA.A ('A' == active, '.' == missing)               /dev/sdh:               Magic : a92b4efc             Version : 1.2         Feature Map : 0x0          Array UUID : b8a04dbb:0b5dffda:601eb40d:d2dc37c9                Name : nasty:stuff  (local to host nasty)       Creation Time : Sun Mar 16 02:37:47 2014          Raid Level : raid5        Raid Devices : 9           Avail Dev Size : 7814035120 (3726.02 GiB 4000.79 GB)          Array Size : 62512275456 (29808.18 GiB 32006.29 GB)       Used Dev Size : 7814034432 (3726.02 GiB 4000.79 GB)         Data Offset : 2048 sectors        Super Offset : 8 sectors               State : clean         Device UUID : c239f0ad:336cdb88:62c5ff46:c36ea5f8              Update Time : Mon Jul 14 00:45:35 2014            Checksum : c08e8a4d - correct              Events : 123132                   Layout : left-symmetric          Chunk Size : 512K             Device Role : Active device 6        Array State : AAA.AAA.A ('A' == active, '.' == missing)               /dev/sdi:               Magic : a92b4efc             Version : 1.2         Feature Map : 0x0          Array UUID : b8a04dbb:0b5dffda:601eb40d:d2dc37c9                Name : nasty:stuff  (local to host nasty)       Creation Time : Sun Mar 16 02:37:47 2014          Raid Level : raid5        Raid Devices : 9           Avail Dev Size : 7814035120 (3726.02 GiB 4000.79 GB)          Array Size : 62512275456 (29808.18 GiB 32006.29 GB)       Used Dev Size : 7814034432 (3726.02 GiB 4000.79 GB)         Data Offset : 2048 sectors        Super Offset : 8 sectors               State : active         Device UUID : d06c58f8:370a0535:b7e51073:f121f58c              Update Time : Mon Jul 14 00:45:07 2014            Checksum : 77844dcc - correct              Events : 0                   Layout : left-symmetric          Chunk Size : 512K             Device Role : spare        Array State : AAAAAAA.A ('A' == active, '.' == missing)               /dev/sdj:               Magic : a92b4efc             Version : 1.2         Feature Map : 0x0          Array UUID : b8a04dbb:0b5dffda:601eb40d:d2dc37c9                Name : nasty:stuff  (local to host nasty)       Creation Time : Sun Mar 16 02:37:47 2014          Raid Level : raid5        Raid Devices : 9           Avail Dev Size : 7814035120 (3726.02 GiB 4000.79 GB)          Array Size : 62512275456 (29808.18 GiB 32006.29 GB)       Used Dev Size : 7814034432 (3726.02 GiB 4000.79 GB)         Data Offset : 2048 sectors        Super Offset : 8 sectors               State : clean         Device UUID : f2de262f:49d17fea:b9a475c1:b0cad0b7              Update Time : Mon Jul 14 00:45:35 2014            Checksum : dd0acfd9 - correct              Events : 123132                   Layout : left-symmetric          Chunk Size : 512K             Device Role : Active device 8        Array State : AAA.AAA.A ('A' == active, '.' == missing)      But as you can see the two drives (sde, sdi) are in active state (but raid is stopped) and sdi is a spare. While sde has a slightly lower Events-count than most of the other drives (123123 instead of 123132) sdi has an Events-count of 0. So I think sde is almost up-to-date. But sdi not ... Now we read online that a hard power-off could cause these "kicking non- fresh"-messages. And indeed my friend caused a hard power-off one or two times. So we followed the instructions we found online and tried to re-add sde to the array:               $ mdadm /dev/md127 --add /dev/sde     mdadm: add new device failed for /dev/sde as 9: Invalid argument      But that failed and now `mdadm --examine /dev/sde` shows an Events-count of 0 for sde too (+ it's a spare now like sdi):               /dev/sde:               Magic : a92b4efc             Version : 1.2         Feature Map : 0x0          Array UUID : b8a04dbb:0b5dffda:601eb40d:d2dc37c9                Name : nasty:stuff  (local to host nasty)       Creation Time : Sun Mar 16 02:37:47 2014          Raid Level : raid5        Raid Devices : 9           Avail Dev Size : 7814035120 (3726.02 GiB 4000.79 GB)          Array Size : 62512275456 (29808.18 GiB 32006.29 GB)       Used Dev Size : 7814034432 (3726.02 GiB 4000.79 GB)         Data Offset : 2048 sectors        Super Offset : 8 sectors               State : clean         Device UUID : 689e0030:142122ae:7ab37935:c80ab400              Update Time : Mon Jul 14 00:45:35 2014            Checksum : 5e6c4cf7 - correct              Events : 0                   Layout : left-symmetric          Chunk Size : 512K             Device Role : spare        Array State : AAA.AAA.A ('A' == active, '.' == missing)      We know that 2 failed drives usually means the death for a raid5. However is there a way to add at least sde to the raid so that data can be saved?


Hybrid code in shell scripts. Sharing variables

This answer discusses how to run a multi-line Python snippet from the command line in a terminal. I noticed that the answer works great within shell scripts, even with nested indentation, which is very nice, e.g.               #!/bin/bash     some_text="Hello world"     echo $some_text          cat <<EOF | python -     import sys;     for r in range(3):       print r       for a in range(2):         print "hello"     EOF      prints:               0      hello     hello     1     hello     hello     2     hello     hello      However, I am having a hard time sharing variables between the shell script and the Python snippet.   1. How can I collect the output of the python subscript in the bash script? (e.g. in a variable such as `$output`).    2. How can I pass a bash variable (e.g. `$some_text`) to the Python script?


What does it mean each process has a current directory?

I'm reading "The Unix Programming Environment", but I don't comprehend the concept _current directory_ of process. > Each process, has a _current directory_ , and all filenames are implicitly > assumed to start with the name of that directory, unless they begin directly > with a slash. Does it mean that every process has a sign in which directory it was created? For example, if program `/bin/sed` was invoked from `/home/rene`, then process which was created from invoking sed has the current directory `/home/rene`?


Difference between 'sync' and 'async' mount options

What is the difference between `sync` and `async` mount options from the end- user point of view? Is file system mounted with one of these options works faster than if mounted with another one? Which option is the default one, if none of them is set? `man mount` says that `sync` option may reduce lifetime of flash memory, but it may by obsolete conventional wisdom. Anyway this concerns me a bit, because my primary hard drive, where partitions `/` and `/home` are placed, is SSD drive. Ubuntu installer (14.04) have not specified `sync` nor `async` option for `/` partition, but have set `async` for `/home` by the option `defaults`. Here is my `/etc/fstab`, I added some additional lines (see comment), but not changed anything in lines made by installer:               # / was on /dev/sda2 during installation     UUID=7e4f7654-3143-4fe7-8ced-445b0dc5b742 /     ext4  errors=remount-ro 0  1     # /home was on /dev/sda3 during installation     UUID=d29541fc-adfa-4637-936e-b5b9dbb0ba67 /home ext4  defaults          0  2     # swap was on /dev/sda4 during installation     UUID=f9b53b49-94bc-4d8c-918d-809c9cefe79f none  swap  sw                0  0          # here goes part written by me:          # /mnt/storage     UUID=4e04381d-8d01-4282-a56f-358ea299326e /mnt/storage ext4 defaults  0  2     # Windows C: /dev/sda1     UUID=2EF64975F6493DF9   /mnt/win_c    ntfs    auto,umask=0222,ro      0  0     # Windows D: /dev/sdb1     UUID=50C40C08C40BEED2   /mnt/win_d    ntfs    auto,umask=0222,ro      0  0      So if my `/dev/sda` is SSD, should I - for the sake of reducing wear - add `async` option for `/` and `/home` file systems? Should I set `sync` or `async` option for additional partitions that I defined in my `/etc/fstab`? What is recommended approach for SSD and HDD drives?


My iptables works the opposite from what I wanted

I have this set of `iptables` rules ...               $ sudo iptables -n -L     Chain INPUT (policy ACCEPT)     target     prot opt source               destination     LOG        all  --  0.0.0.0/0            0.0.0.0/0           limit: avg 5/min bu     REJECT     tcp  --  192.168.1.134        0.0.0.0/0           tcp dpt:22 reject-w          Chain FORWARD (policy ACCEPT)     target     prot opt source               destination          Chain OUTPUT (policy ACCEPT)     target     prot opt source               destination      ... the above blocks 192.168.1.134 but it does not log attempts from 192.168.1.134. Instead connections from other clients are logged. I just want to log the dropped packets. What I want to do is log all dropped packets.


ajaxterm using proportional font

I have Ubuntu 14.04 LTS, Apache 2.4.7, Python 2.7.6 and Ajaxterm 0.10-12ubuntu1. Ajaxterm is proxied via Apache. Here's the apache.conf excerpt:               # Suppresses the Via header     ProxyVia Off     # Do not flood the log     #CustomLog /var/log/apache2/access.log combined env=!dontlog     #SetEnvIf Request_URI "^/ajaxterm/u" dontlog          ProxyRequests Off     <Proxy *>            Order deny,allow            Allow from all     </Proxy>          ProxyPass /ajaxterm/ http://localhost:8022/ retry=0     ProxyPassReverse /ajaxterm/ http://localhost:8022/ retry=0      When it was initially installed, Ajaxterm worked fine. Now, however, it uses a proportional font instead: ![Ajaxterm](http://i.stack.imgur.com/ab4Pv.png) I've uninstalled and reinstalled it, but I can't figure out what the problem is. No errors appear in the browser console or network inspector.


Why can't Vim open a 100 MB text file when I have 16 GB RAM?

I have a 100MB MySQL database backup file and I have trouble to open it in Vim on my Linux box that has 16G of RAM. Vim just hangs (at least unusable). This is something I don't understand. I have 16 GB RAM, why can't I load a 100 MB file in an editor? Is it because of Vim? I thought all the memory management is handled by the OS.


Give user permission to rm without password or sudo

I'm trying to give the `ubuntu` user on my machine the ability to `rm` folders and files (mainly in the `/www/` folder) without the need to invoke a password or the need to use `sudo`. I've been following this article and ended up trying this in my `sudoers` file.               ubuntu ALL = (ALL) NOPASSWD: /bin/rm      This unfortunately doesn't do the trick. Can anyone help me with the proper configuration?


Mutt is not able to send mail from Cygwin

I have installed mutt packages and when I tried to send mail to my email address I get the error here: > mutt 4352 child_info_fork::abort: C:\cygwin\bin\cygdb-4.8.dll: Loaded to > different address: parent(0x4E0000) != child(0x800000) Error sending > message, child exited 127 (Exec error.)


Free gnu/linux distribution for web server

I would like to ask if anyone has tried using any 100% free software distro as server OS. Either directly on hardware or through a virtual machine. What where the most important shortcomings? I came across trisquel, ututo and parabola distributions, yet they come with GUIs pre-installed and they didn't seem server oriented at all.


Always display Energy Applet?

My Stepdad uses Linux Mint and although he doesn't have a laptop, he would like the power/energy applet to be visible in the taskbar so he can keep track of his wireless mouse it's power status. Could anyone tell me how to "always display the power/energy applet" in the taskbar?


Find: Reference to Current Directory

I'm trying to use `find` with the `regex` option. However my regular expression only captures the basename of the file. Is there a reference to the "directory find is currently in" I can use in my regular expression so that I don't have to account for it by means of a leading `.*`? (I'm looking for something like the `$File::Find::dir` in `perl`'s `File::Find` module.) As an example: suppose I want to find all files matching the regular expression `baz\d` anywhere below `/foo/bar/`. Using `find /foo/bar -regex 'baz\d'` won't find a file named `baz1` at `/foo/bar/` because the pattern `baz\d` doesn't match the full filename `/foo/bar/baz1`, so instead I'm using `find /foo/bar -regex '.*baz\d'` which works, but I'm wondering whether I can replace that `.*` with something more robust?


Learning Linux for intermediate user

Here is my situation :   * I know how to compile some programs. I know how `make` and `gcc` works. I know `bash`.   * I am fairly comfortable with command-line.   * I know how it works in my computer for some programs. I am not satisfied. What I want to learn is this :   * I want to learn how programs really work, what really happens when I compile a program, which file gets copied in which directory, etc. I often find myself unable to successfully compile a program, so I end up using `apt-get` to install it. I find it to "magical" for me. I want to know what `apt-get` does to my computer.   * I want to learn where to find configuration files and how to edit them. Particularly, I want to learn how mime-types work. I want to know more about environment variables as well.   * In fact, I am looking for total control over my computer. I think installing Arch Linux would be a good thing, but I want to learn the above before. Can you show me a resource I can use which is not too technical at the same time? Do you have any suggestion, recommendation?


/etc/motd is not displayed when a named pipe?

Running Gentoo 3.4.0 Having recently heard about the /etc/motd file, i tried to have it display random cowsay fortunes. I wrote some random bash script to act as a daemon, feeding the /etc/motd as a named pipe, as seen on some forums. I don't think there's any problem with the script because cat'ing the pipe works just fine, but the MOTD won't display on login (using a regular file works) !               fira@nyan ~ % cat /etc/motd      _______________________________________      / We didn't put in ^^ because then we'd \     | have to keep telling people what it   |     | means, and then we'd have to keep     |     | telling them why it doesn't short     |     | circuit. :-/                          |     |                                       |     | -- Larry Wall in                      |     \ <199707300650.XAA05515@wall.org>      /      ---------------------------------------         \         \             .--.            |o_o |            |:_/ |           //   \ \          (|     | )         /'\_   _/`\         \___)=(___/      Am i missing something obvious ? Not using anything like a .hushlogin or whatnot, tried using several shells, pipe is readable a+r.


Debian monitor unknown and dual monitor setup

I'm running Debian on my laptop (Thinkpad T420 if it matters), and what I am trying to do is setup the native resolution. I want it to be 1366x768 but it's stuck at 1024x768 because when I go to Monitor Preferences, it says Monitor: Unknown. I've tried several things such as `xrandr --addmode VGA1 1366x768_60.00` and all the steps that contains that I've found on different websites. Some say remove `xorg.conf` but I don't have that in my X11 folder. Have any of you guys encountered this problem before? Also I'm trying to setup 2 monitors but again, they don't show up in Monitor Preferences.


How can I log what software I use the most?

I really like using open source software and would like to help fund further development. Unfortunately, I have limited funds to do so. Being somewhat greedy, I would like to donate to the projects I use the most, but I am uncertain what those might be as many run somewhat behind the scenes. What I would like to do is somehow log what programs I use the most but I am uncertain how. One thought I had was log the time each program spends having focus (ideally only while computer is unlocked). Logging the time a process spends actively doing something could be another metric. I'm not really sure how to track either of these. What is the best way to track which software I use the most? (For what it is worth, I generally use Arch Linux, but occasionally use Ubuntu, so portability would be appreciated.)


How to fix non-responsive Ubuntu system?

I use Ubuntu. Sometimes, the system does not have any response with mouse and keyboard. Is there any way to solve this problem except hitting the reset button on the machine?


Openldap backup restore

I am trying to setup backup and restore and make sure it works. Please note that database size on `ldap.old` is lot more then the `ldap`. The `/var/lib/ldap.old` is my existing database. I have renamed `/var/lib/ldap` for backup/restore testing. I am getting the following error when restoring. Because of this I am not sure I have successfully restored everything.               ...     added: "uid=user11123,ou=Abcd,ou=Industry Professional,dc=testdomain,dc=org" (0001cc9f)     added: "uid=user13123,ou=Abcd,ou=Industry Professional,dc=testdomain,dc=org" (0001cca0)     Error, entries missing!       entry 79870: ou=industryprofessional,dc=testdomain,dc=org       entry 79871: ou=abcd professional,ou=industryprofessional,dc=testdomain,dc=org      ### Disk usage:               [root@openldap]# du -khs ldap ldap.old/     3.3G    ldap     4.0G    ldap.old/      Here is my backup / restore process: ### Backup:               slapcat -v -l backup_openldap.ldif      ### Restore:               /etc/init.d/ldap stop     mv /var/lib/ldap /var/lib/ldap.old     mkdir /var/lib/ldap     chown ldap:ldap ldap     chmod go-rwx ldap     cp –rfp /var/lib/ldap.old/DB_CONFIG /var/lib/ldap          slapadd –v –l /backup/openldap/backup_ldap2.diff          chown ldap:ldap *     /etc/init.d/ldap start      How do I validate that I have restore all records successfully?


Grep end regex matching

On OS X, `system_profiler SPHardwareDataType` outputs:               Hardware Overview:            Model Name: MacBook Pro       Total Number of Cores: 4       L2 Cache (per Core): 256 KB       L3 Cache: 8 MB       Memory: 8 GB      I want to get the `Memory` value, trimmed of whitespaces. This is what I had:               system_profiler SPHardwareDataType | grep --color=never -E '^ +Memory: ' | cut -d ':' -f 2      Not ok. It keeps the whitespace. I switched to this:               system_profiler SPHardwareDataType | perl -ne 'if(/^ +Memory: (.*)$/){print $1;}'      and I'd like to ask:   * Could this be made more concise in Perl? The braces annoy me, often I type them wrong. Having to put the condition in `()` is also bothersome. The semicolon is bothersome.   * Could this be made as concisely using more basic UNIX tools? (grep/sed/awk)? I think this idiom "grep for pattern and replace" must be very common to extract info. I am a beginner but an experienced sysadmin/devops perhaps could recommend the best line to use? Note: I do not use this line I like..               system_profiler SPHardwareDataType | sed -Ene 's/^ +Memory: (.*)$/\1/g p'      because extended regexes (`-E` are `-r` on some platforms? possible?) and fundamentally because, although I understand that `sed` works on lines, `-n` suppresses output unless I explicitly `p` print it, `s//g` is a normal regex `substitute`.. and that commands following a `match` are only executed on matching lines.. I am puzzled by the fact that `s//g` in reality is an action in itself.. so I would expect `p` to require a `;` before it.. odd that you can both replace and use the match as a condition to execute the comand.. is that line correct at all?


Is it possible to use xsetroot and dwm to set the top and bottom bars at different time intervals?

I'm using dwm with the dualstatus patch. This adds a status bar on the bottom of the screen, in addition to the standard bar at the top. The text in each bar is set in ~/.xinitrc (for example) like this:               xsetroot -name “top text;bottom text”      Is there a way in bash to set the top text and bottom text at different intervals? For example, I have a script `topbar` that displays system information, e.g. output from the uptime command, and a script `bottombar` that displays information like weather, battery state, etc. The goal is to have the top bar update every second, while the bottom bar only updates every minute because its information comes from more expensive processes (e.g. querying my music player, checking the battery state, etc.) Right now my ~/.xinitrc looks like this:               while true; do         bottomdisp=$(bottombar)         for s in {1..60}         do             xsetroot -name "$(topbar);$bottomdisp";         sleep 1;         done     done &          xbindkeys     ( ( sleep 5 && /usr/bin/xscreensaver -no-splash -display :0.0 ) & )          exec rundwm      This updates every second, though. Is there a simpler way to do this? The ideas I could think of were   1. Maybe a way to tell xsetroot to preserve whatever's in the bottom bar? As a last resort, I may tweak some of the code in the `dualstatus` patch to allow it to preserve the current state of the top/bottom bars if something like `xsetroot -name ';bottom text'` is passed, but that's not ideal because my C is rusty and I still use the above command to clear the bars at times.   2. Use a cronjob to update a cache of the text in the bottom bar, and run that once a minute. Even though the top/bottom bars would display every second, only the top bar would actually _change_ every second.  Any other methods for this? Is there a simple(r) way to do this in bash that I missed?


Poor text editing performance from the radeon open source driver; should I install proprietary driver or try to fix this?

I followed the steps at the link below to remove the proprietary driver and install the Radeon open source driver. RadeonDriver - Community Ubuntu Documentation   https://help.ubuntu.com/community/RadeonDriver However, now I notice that when I'm editing text (such as in this website) if I delete lines a few adjacent lines may completely disappear until I scroll or edit again. This bothers me enough that I need to make a change. Should I go back to the proprietary driver? I'm running Kubuntu 12.04 with a Radeon HD 6750 card and 3 monitors (one at 2560x1600 resolution and the other 2 at 1920 x 1200). Maybe that is too much for the open source driver? Recommendations?


how to force X mouse pointer to show above rendered application cursor?

I opened a new X session at :1 I run a game that renders its own mouse pointer (that has low FPS), so the X cursor is hidden. I need to force the X cursor to show above the application self rendered cursor.   That way I know where the mouse precisely is so I can wait there for the application mouse pointer to be rendered (even if it renders with a displacement). OBS.: I am using JWM, so there is no Gnome, Compiz/Unity or KDE at :1 _Failed Attempts:_   * `DISPLAY=:1 xsetroot -cursor_name left_ptr` #trying to unhide the mouse pointer or to change its graphics so it show up again    * `xinput set-prop "A4Tech USB Mouse" "Device Enabled" 1` #but the mouse is already enabled there so did not work... (from this tip)


Adjust font size in multi-head setup with different resolutions

I have a multi monitor setting with the main screen resolution 3840x2160 and two additional screens running on 1920x1080. When I drag for example a firefox window between the screens, Windows seems to somehow automagically adjust font and image sizes, so the web page is always readable. In linux however, moving between resolutions makes the text either extremely small (on the main screen) or too large (on the additional screens). Is there a way to get windows-like behaviour in this matter? I'm currently using KDE, but I'd switch to a different window manager if that is necessary to solve the problem.


How do I use unused partition in a dual boot environment

I have Ubuntu installed as a host with Windows operating system.I have installed Ubuntu on one Windows drive having around 70 GB of space. While installing Ubuntu I just specified 30 GB of disk space and rest of 40 GB space is not used. Now for some requirement I wanted to use the remaining space 40GB. I have installed `gparted` but I can't use it for my needs. I attached the screen shot of `gparted` here. ![enter image description here](http://i.stack.imgur.com/uwRTx.png) Can anyone help me in reclaiming the unused space?


SSH connections not accepted after configuring NFS?

I have a couple of servers in a VPC in Amazon EC2. One of them acts as a NFS server, and one of them as a client. I recently noticed a problem in the client that after a reboot, it would reject all SSH connections, presumably because SSH was not running. After transferring the EBS volume to another instance and taking a peek inside, I commented out the NFS line in `/etc/fstab` and tried attaching it back to the server and booting it. Lo and behold, I was able to connect with SSH. It seems that having the following line in my fstab is breaking everything on boot:               10.0.0.1:/export/share /mnt/shared nfs auto 0 0      Why is this causing SSH to fail to start? How can I have NFS automatically mount on boot without breaking networking/SSH on the system? I've checked that `sudo mount -a` works properly, so it seems that there isn't an inherent problem in the fstab command. What's breaking and how can I fix it?


Installing multiple versions of MySQL on Oracle Linux

I have a Oracle Linux 5 server. I have to install MySQL 5.1 as well as MySQL 5.6. Is it possible to install both version of MySQL on the same machine? If yes, how can I achieve this?


Unix command to exit from command prompt

How can I exit from command prompt from shell file? shell file contains :               if(); then     // some unix code here     else     // want to exit from cmd prompt or Kill current cmd prompt     fi      can any knows @ it?


How to correctly enable sudo for user in Fedora 20

I followed this question in order to enable `sudo` command for my created user. So I added it into the `wheels` group and edited the `/etc/sudoers` file accordingly. But what I don't get about this is when I type for instance `sudo yum install`, it requires password of that user, not the password of `root`. This seems really insecure because if the account gets compromised, you can access `root`'s functions with that users password. Shouldn't it work in the way that if you want `root` rights, than you need to know `root`'s password?


iconv illegal input sequence- why?

While trying to convert a text file into its ASCII equivalent, I get error message that `iconv: illegal input sequence at position`. Command I use is `iconv -f UTF-8 -t ascii//TRANSLIT file` The offending character is `æ`. Text file itself is present here. Why does it say illegal sequence? The input character is proper UTF-8 character (U+00E6).


Zsh completion of hadoop commands

Hadoop has a range of commands and subcommands to specify different operations on MapReduce, HFS etc. (e.g. `hadoop dfs` can be followed by any command from this list). Is there any way to enable completion of these commands in Zsh? In case it helps, I am using Oh-my-zsh.


How to switch tty with a script / cronjob

Is it possible to switch the current tty/vt with the help of a bash script or a cronjob? I only know the physical keyboard input "Ctrl-Alt-Fx". I would like to show two virtual desktops at different daytimes (controlled by cron).


Restart sound indicator in ubuntu

When the sound crashes, I can restart it with:               sudo alsa force-reload      However, that doesn't bring the sound indicator (system tray indicator) back. I am running Ubuntu 13.10 with LightDm.


Converting windows date logic into Unix

I had coded the below logic in Windows batch scripting and I need to replicate the same in Unix.               # Calculating  Yesterday's Date          for /F "tokens=1-4 delims=/- " %%a in ('date/T') do set  DY=%%c     for /F "tokens=1-4 delims=/- " %%a in ('date/T') do set  MON=%%b     for /F "tokens=1-4 delims=/- " %%a in ('date/T') do set /a YEAR=%%d               if [ $DY=="08"  ]; then DAY=8 fi     if [  $DY=="09" ]; then  DAY=9 fi     if [ $MON=="08" ]; then  MONTH=8 fi     if [ $MON=="09" ]; then  MONTH=9 fi     if [ $DY -ne "08" ]; then  if [ $DY -ne "09" ]; then DAY=%DY% fi fi     if [ $MON -ne "08" ]; then  if [ $MON -ne "09" ]; then MONTH=%MON% fi fi                    PREVDAY=%DAY%-1     PREVMONTH=%MONTH%-1     PREVYEAR=%YEAR%-1     ds=%YEAR%_%MONTH%_%PREVDAY%-                 if [ %DAY%==1 ]; then if [ %PREVMONTH%==1 ] then ds=%YEAR%_%PREVMONTH%_31- fi fi     if [  %DAY%==1 ]; then if [ %PREVMONTH%==2 ] then ds=%YEAR%_%PREVMONTH%_28- fi fi     if [ %DAY%==1 ]; then if [ %PREVMONTH%==3 ] then ds=%YEAR%_%PREVMONTH%_31- fi fi     if [  %DAY%==1 ]; then if [ %PREVMONTH%==4 ] then ds=%YEAR%_%PREVMONTH%_30- fi fi     if [  %DAY%==1 ]; then if [ %PREVMONTH%==5 ] then ds=%YEAR%_%PREVMONTH%_31- fi fi     if [ %DAY%==1 ]; then if [ %PREVMONTH%==6 ] then  ds=%YEAR%_%PREVMONTH%_30- fi fi     if [  %DAY%==1 ]; then if [ %PREVMONTH%==7 ] then ds=%YEAR%_%PREVMONTH%_31- fi fi     if [  %DAY%==1 ]; then if [ %PREVMONTH%==8 ] then ds=%YEAR%_%PREVMONTH%_31- fi fi     if [  %DAY%==1 ]; then if [ %PREVMONTH%==9 ] then ds=%YEAR%_%PREVMONTH%_30- fi fi     if [  %DAY%==1 ]; then if [ %PREVMONTH%==10 ] then ds=%YEAR%_%PREVMONTH%_31- fi fi     if [  %DAY%==1 ]; then if [ %PREVMONTH%==11 ] then ds=%YEAR%_%PREVMONTH%_30- fi fi     if [  %DAY%==1 ]; then if [ %PREVMONTH%==0 ] then  ds=%PREVYEAR%_12_31- fi fi


Command not found problem in Linux-Ubuntu terminal

My friend is having problem in trying to call `make` to compile an application which both me and a second friend have previously successfully compiled. The file uses a "linux-devkit" pack that possess a /bin subdirectory containing lots of file called `arm-arago-linux-gnueabi-`something that are essentially executable files (e.g. one is `arm-arago-linux-gnueabi-gcc` which is essentially the GCC compiler). Part of the compile process when we call `make install` in the Makefile directories of our project consists in calls to such "linux-devkit files". When I or my second friend call the command in the Linux terminal, everything runs fine to the end. But when my friends do it, an error message appears:               arm-arago-linux-gnueabi-gcc: No such command found      (Note: translated from a Portuguese Ubuntu) After doing countless tests we did managed to find an interesting difference: if we go by Terminal to the `~/linux-devkit/bin` folder and call `arm-arago- linux-gnueabi-gcc` in one of the two working systems, the answer is one that essentially tells the file was found, but command specifications are lacking:               arm-arago-linux-gnueabi-gcc: no input files      and this was a expected error message. But when my friend with the problem executes the same command, the error message is:               bash: ./arm-arago-linux-gnueabi-gcc: File or directory not found      (Note: translated from a Portuguese Ubuntu) It is as if the Terminal simply wasn't finding the file to use it, even tough it appears when `ls` is called as well as when using Nautilus! Or user-permissions for those files are 100% equal, so it can't be a problem there. Does anybody have any guess on what's going on? * * * EDIT: Here is the answer I got, Volker Siegel: > I'm sure file is in place... > > Thats is output, thanks for help.               ~/re8k/linux-devkit/bin$ export LC_ALL=C     ~/re8k/linux-devkit/bin$ command -v arm-arago-linux-gnueabi-gcc     ~/re8k/linux-devkit/bin$ ls -ld ~/re8k/linux-devkit ~/re8k/linux-devkit/bin ./arm-arago-linux-gnueabi-gcc     -rwxr-xr-x  1 diogenes diogenes 448843 Jul  1  2011 ./arm-arago-linux-gnueabi-gcc     drwxr-xr-x 12 diogenes diogenes   4096 Apr 15 17:28 /home/diogenes/re8k/linux-devkit     drwxr-xr-x  2 diogenes diogenes   4096 Sep  3 10:59 /home/diogenes/re8k/linux-devkit/bin     ~/re8k/linux-devkit/bin$ head -1 ./arm-arago-linux-gnueabi-gcc     ELF��4�g4('$44�4�44�4������������HH�H�DDQ�tdR�td���/l!��ԟX-linux.so.2GNUGNUI������,�_�_b�     diogenes@diogenes-VirtualBox:~/re8k/linux-devkit/bin$ mount | grep "\s$(stat -c%m .)\s"     /dev/sda1 on / type ext4 (rw,errors=remount-ro)      EDIT 2:               diogenes@diogenes-VirtualBox:~/re8k/linux-devkit/bin$ ./arm-arago-linux-gnueabi-gcc     bash: ./arm-arago-linux-gnueabi-gcc: No such file or directory      A Print Screen to complement: ![Print Screen of Terminal](http://i.stack.imgur.com/blbPh.png)


Format output to a specific line length

So I have some output that has very long lines, and I want to have it formatted to lines no more than 80 columns wide, but I don't want to split words because they are in the column limit. I tried               sed 's/.\{80\}/&\n/g'       but has the problem of splitting words and making some lines begin with a space. I managed to do it with Vim, setting `textwidth` to 80, going to the beginnig of the file and executing `gqG` to format the text. But ¡ would rather do it with `sed`, `awk` or something similar to include it in a script.


Curious about strange ICMP type 3 code 10 traffic to my IP address

My firewall (`iptables`) logs some strange ICMP type 3 code 10 traffic that I am curious to understand (specifically how or if this could be an exploit of some sort). > Type 3 = Destination Unreachable   >  Code 10 = Communication with Destination Host is Administratively > Prohibited). The logged traffic (4-6 packets a few seconds apart, once a day for the last months): > **IN** =eth0 **OUT** = **MAC** = _(eth0 MAC)_ **SRC** = _(Foreign IP > address)_ **DST** = _(My IP address)_ **LEN** =72 **TOS** =0x00 **PREC** > =0x00 **TTL** =50 **ID** =35145 **PROTO** =ICMP **TYPE** =3 **CODE** =10 [ > **SRC** = _(My IP address)_ **DST** = _(Foreign IP address)_ **LEN** =44 > **TOS** =0x00 **PREC** =0x00 **TTL** =50 **ID** =0 **DF** **PROTO** =TCP > **SPT** =25 **DPT** =53454 **WINDOW** =28200 **RES** =0x00 **ACK** **SYN** > **URGP** =0] All logs indicate that _(Foreign IP address)_ only transmits the above ICMP packet.   No other traffic from _(Foreign IP address)_ is recorded in the same time period (see update below).   By default, the system logs and drops any traffic originating from the country of _(Foreign IP address)_. Could this be an exploit, perhaps to trick _(My IP address)_ into transmitting something to _(Foreign IP address)_ , assuming I did not drop the traffic by default? Any insights are welcome. **Update** : The logs show that _(Foreign IP address)_ consistently connects to port 80 and 443 prior to the ICMP packets (9 and 7 hours before the ICMP packets, respectively). Both attempts dropped by the default firewall policy.   According to Network-Tools.com the origin of _(Foreign IP address)_ is China(CN) in region Southern and Eastern Asia, and no host name is associated with the IP address.


top command on multi core processor

I am using freescale IMX6 quad processor. I want to know if the `top` command lists the CPU usage of all 4 cores or of a single core. I am seeing an application's CPU usage being the same with 4 cores and with a single core. I was guessing the CPU usage by the application will increase on a single core and decrease on 4 cores but it has not changed.


Cube not working in Fedora 20 KDE

When I switch desktops on my Fedora 20 system, with the "desktop cube" it doesn't work. Instead of showing the cube effect, it displays briefly LibreOffice with an open document which I closed 10 minutes ago, and then it displays the selected desktop. I have 4 active desktops. Libreoffice does not show up in running processes. Also when the system has turned off the display when Idle and resuming, the screen is frozen and the cube doesn't work, not until I select a different desktop does the cube work and the screen is active. What is happening here and how to resolve it?


How do I find out what filesystem drivers are compiled-in into the linux kernel?

On a running linux system, what is a portable (among linux distributions) way to find out what filesystems the current kernel has compiled-in (not through modules) support for? Consider for example my current Ubuntu x86_64 kernel: `3.11.0-24-generic #41-Ubuntu`. It has for instance no `/proc/config.gz`, which would be my first thought otherwise. The reason I'm interested is that I'd like to (programmatically) build a rescue environment with the current kernel and an initial ramdisk that the kernel will be able to load/mount. **Is is as simple as comparing** `/proc/filesystems` **with** `lsmod` **?** If so: Do the modules always have the exact same name (first column from `lsmod` output) as the filesystem name (last column in `/proc/filesystems`)? Is there perhaps a more modern way such as `/sys` instead of `/proc` to look for info? My current approach is as follows. Can someone confirm that it is correct, or advise how to do it instead?:               for fscand in $(awk '{print $NF}' /proc/filesystems)     do       if test $(lsmod | grep -c -e '^'${fscand}'[^a-z0-9_-]') -eq 0       then         candlist="${fscand} ${candlist}"       fi     done          for fscand in $candlist     do       echo $fscand is compiled-in     done


Gnome update-notifier doesn't show updates when user not in sudo group (Debian Squeeze)

Gnome desktop notifications of new updates is not working on my system. I noticed that the notifications stopped working when I removed my desktop user from the sudo group (I prefer to have a separate user with sudo privileges). I found the following post in Debian bugs which suggests that it is necessary for the desktop user to be in the sudo group for the updates notifications to work: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=613566 The update-notifier man page mentions the following commandline option: --force "Force start even if the user is not in the admin group." Should I consider adding the above option to update-notifier in the startup applications list? Doing "ps aux | grep update" shows that update-notifier is already running, so perhaps it is another process that is the source of the problem? Thanks in advance for any assistance.   * Debian Squeeze   * 2.6.32-5-686   * update-notifier 0.99.3debian8


Multiline shell script comments - how does this work?

Recently, I stumbled upon a multiline comment type I have never seen before - here is a script example:               echo a     #     : aaa      : ddd      #     echo b      This seems to work, hell, even vim syntax-highlights it. What is this style of commenting called and how to I find more info about it?


Compiling programs to OSX

I have to decide between a MacBook Pro or an iMac. I have a desktop with Ubuntu and I love it. I have experience with terminal and I install texlive, TeXstudio, Bluefish, Geogebra, wxMaxima, gnuplot and so on. My question is: if I choose to replace my desktop by an iMac would it be possible to keep using those programs? I know that there are Mac OS X versions but sometimes they don't update frequently. For example, the official TeXstudio webpage says: > The OS X version is experimental. Since none of the currently active > developers is using OS X, we cannot thoroughly test it. We do our best to > also support OS X but be prepared that there may be some issues. So, is it possible to compile the source code to obtain a version for OS X? Usually I compile these programs by myself. If I choose the MacBook I can keep my desktop (but it is not so new and widescreen like iMac 27").


How do I shut down ports remotely without shutting myself out?

I have an Ubuntu 11.04 server in a remote location on another continent, so I have no physical access to it. I only interact with it by `ssh` (and `scp`), and intend to only ever interact with it that way. For security purposes, I want to ensure that absolutely all ports on the server are closed, except for `ssh`. My understanding is still vague, despite having tried to find instructions on the web. What I've gathered so far is that I need to "flush" the "iptables", and also that I need to edit some files (`/etc/hosts`, maybe?), and reboot the machine. Obviously, though, I want to be very careful about this, because if I do it wrong, I could end up accidentally shutting down the ssh port, making the server inaccessible to me. If that happens, I have to go to the server administrator, who will reinstall the server, and make fun of me in the process. I'm not a server admin guru by any stretch, so I'm looking to establish a fool proof set of steps before I do this. So, how do I shut down all ports while still preserving my access? _**Bonus question:_** While doing this, should I, and can I, change the `ssh` port from 22 to a non-standard one? Does it really make a difference?


`$RANDOM` is not random within `find`'s `-exec`

I'm trying to find and move a whole bunch of folders on a linux box. All the folders are named the same, so I am using `echo $RANDOM` to provide a random number to use for a folder name. `echo $RANDOM`   does indeed output a random number every time is is run. However,   `find . -type d -name .AppleDouble -exec mv \'{}\' \'/raid/data/Storage/AppleDouble/`echo $RANDOM` \;`   uses the same "random" number for every folder, and as a result, only moves one folder. I think the issue is that the `$RANDOM` is being evaluated immediately when `find` begins to run. How do I escape it so the value of `$RANDOM` is not evaluated until the `-exec` option begins to run (or what is a better way to do this)? Note: I'm on busybox, so I can't really install anything.


Is Windows Linux based

Is Windows Linux based? Because I cannot find a stack exchange site for Windows. If there is not sit for Windows can anybody explain how to request a site.


Control how long Rsnapshot keeps a file after being deleted

I have an Rsnapshotting local server that takes snapshots of folders of miscellaneous computers within the local LAN. There are daily, weekly, monthly and yearly snapshots. So somebody puts a file into one of those folders being monitored by Rsnapshot and then some hours later the Rsnapshot server takes his daily snapshot. After that the user deletes this given file. And then the next day the system takes another snapshot. It seems like this file will get permanently deleted on the backup, seven days (for I have 7 dailies) after the last snapshot was taken of it. Are there any precautions for controlling how long a system keeps files that are being deleted, in Rsnapshot? How have others dealt with this issue?


Comparing two files using Unix and Awk

I need to compare two files, File1 and File2 (Separated by space) using 4 fields (Field 1, 2, 4 and 5 of File 1 with field1, 2, 4 and 5 of File2). **Logic:**   If column 1, 2 and 4 of File 1 matches with column 1, 2 and 4 of File 2 and there is a mismatch at column 5 then both the lines from File 1 and File 2 are concatenated redirected as output. Therefore, the output file only contains those lines where Column 1, 2 and 4 of File1 and File2 matches and Column 5 does not match. **File1:**               sc2/80         20      .        A       T         86       PASS     N=2     F=5;U=4     sc2/60         55      .        G       T         76       PASS     N=2     F=5;U=4      sc2/68         20      .        T       C         71       PASS     N=2     F=5;U=4     sc2/24         24      .        T       G         31       PASS     N=2     F=5;U=4      **File2:**               sc2/80         20      .        A        C        80      PASS    N=2       F=5;U=4     sc2/60         55      .        G        C        72      PASS    N=2       F=5;U=4      sc2/68         20      .        T        C        71      PASS    N=2       F=5;U=4      sc2/10         24      .        T        G        31      PASS    N=2       F=5;U=4     sc2/40         59      .        T        G        31      PASS    N=2       F=5;U=4     sc2/24         24      .        A        G        38      PASS    N=2       F=5;U=4      **Output:**               sc2/80         20      .        A       T        86      PASS     N=2      F=5;U=4     sc2/80         20      .        A       C        80      PASS     N=2      F=5;U=4          sc2/60         55      .        G       T        76      PASS     N=2      F=5;U=4      sc2/60         55      .        G       C        72      PASS     N=2      F=5;U=4      I am new in the field and I appreciate your help.


How do I take a list and remove it from a file?

I have a long list of domain names that I need to remove from /etc/remotedomains. They're probably not in any particular order in the file. Each domain is on one line. How could I iterate through the list and find that line in remote domains and remove it.


Grabbing the first [x] characters for a string from a pipe

If I have really long output from a command (single line) but I know I only want the first [x] (let's say 8) characters of the output, what's the easiest way to get that? There aren't any delimiters.


Cannot mount second 1TB harddrive in Linux, works fine in Windows 8.1

So I have this problem with my second hard-drive that I have been trying to fix for quite awhile now with no luck. I have searched around to try to find solutions to my problem but nothing seemed to be quite like mine. Basically, I have a Windows 8.1/Antergos (basically Arch Linux) dual boot on my 128GB SSD, and then I have a 1TB hard-drive for storing all my other data. I formatted the 1TB hard-drive through Windows because I didn't have Linux installed at the time. I cannot mount my second hard-drive because it has an "unknown" filesystem, even though I know it is NTFS. Here's what gparted shows: ![gparted output](http://i.imgur.com/xdlcfdZ.png) And some other (hopefully) useful information...               $ lsblk     NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT     sda      8:0    0 931.5G  0 disk      ├─sda1   8:1    0   128M  0 part      └─sda2   8:2    0 931.4G  0 part      sdb      8:16   0 111.8G  0 disk      ├─sdb1   8:17   0   350M  0 part      ├─sdb2   8:18   0  96.5G  0 part      ├─sdb3   8:19   0     1K  0 part      ├─sdb5   8:21   0   6.7G  0 part /     └─sdb6   8:22   0   8.3G  0 part /home          $ sudo fdisk -l /dev/sda     [sudo] password for matthieu:           Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors     Units: sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Disklabel type: gpt     Disk identifier: C96FA339-748A-11E3-BE68-BC5FF4E9FCAE     Partition 1 does not start on physical sector boundary.          Device           Start          End   Size Type     /dev/sda1           34       262177   128M Microsoft reserved     /dev/sda2       264192   1953523711 931.4G unknown      Here's what happens when I try to mount the drive...               $ sudo mount /dev/sda2 /mnt/     mount: wrong fs type, bad option, bad superblock on /dev/sda2,            missing codepage or helper program, or other error                 In some cases useful info is found in syslog - try            dmesg | tail or so.


In ext filesystems,   1. Is the content of a file always stored continuously? Or the file conent can be partitioned into different parts, with each part stored continuously, and all the parts stored not continuously? (The storage of the content of a file is pointed by its inode).   2. An inode can have several direct and indirect pointers pointing to the content of a file. Are the pointers pointing to different places within the content of the file, to make the file content somehow "randomly" accessible? Thanks.


How could I simplify this command to only use awk?

awk '/user/ {print $1 }' /etc/userdomains | sed 's/://'      the format of /etc/userdomains is               domain.tld: user     otherdomain.tld: otheruser


XFCE - find out which command is executed by a given menu item

I would like to know which command is executed when I click on a given XFCE menu item. For instance, in my menu, `Applications` contains an item `Users and Groups`, but clicking on it does nothing. I would like to run the same program in the command line to see if there are any error messages, but I do not know which command it is.


Get allocation status of a file's range in an FS which supports delayed allocation

For a very large file with delayed-allocation, some sectors may have been allocated and some may not. Delayed allocation is supported by ext4/xfs/etc.. For example, create an empty file and set to very large size using fallocate(). Now the file's size could be GBs, but using `du` you will get a zero disk usage. After some random writes, I want to get whether a specific sector/page of this file has been allocated. Some related system calls such as mincore/fincore work on vm status of page cache. However they don't serve on-disk allocation information. I wonder is there any method to do that. Thanks.


netcat echo server - possible with pipes instead of commands as strings?

I want to create an echo server without specifying any of my commands inside strings. I want all commands to be connected by pipes. This doesn't appear possible because the response gets returned before the request can be passed to the response generating logic. It seems I could use ncat but I also would prefer to avoid that. I thought it might be possible with a fifo queue but I'm having trouble getting this to work. **The "What I'm trying to do" part** Attempting to justify these restrictions is challenging with my limited verbal skills. But my ultimate goal is to maintain a master script of all my application logic with the convenience of xinetd (but without daemons). Such a master script might have dozens of lines like these:               nc -l 8080 | get_person_name.sh | create_insert_statement.sh | sqlplus     nc -l 8081 | get_person_id.sh | create_select_statement.sh | sqlplus      The 2nd one won't work because it won't be able to return the output to the client. So I'm reducing the problem to implementing an echo server with netcat. I don't want to use strings because all those commands will be dynamic and I just don't want to deal with that extra level of indirection (for a start, my text editor will have far less useful syntax highlighting). I'd be open to a here document solution though.


How to check/test internal card reader speed

I got new SD card claimed to be 10 class of speed, but internal Disk utility in linux after test showed up only 6th class of speed. How can I check my card reader speed to be sure that it's not the limit of the device, but the limit of a card? I don't have any approved SD cards to perform tests with them. My card reader shows like this in lspci:               0000:07:00.0 FireWire (IEEE 1394): Ricoh Co Ltd R5C832 IEEE 1394 Controller (rev 05)     0000:07:00.1 SD Host controller: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter (rev 22)     0000:07:00.2 System peripheral: Ricoh Co Ltd R5C592 Memory Stick Bus Host Adapter (rev 12)     0000:07:00.3 System peripheral: Ricoh Co Ltd xD-Picture Card Controller (rev 12)


Is there a way to start a VNC-server for an already running X-session?

For Windows there are VNC-"servers" that can be started by the user manually som time after log-in. Is there anything similar for Linux? A program that can be started manually in an already running X-session, and the "hijacks" the session making it VNC-controllable - or at least VNC-viewable?


Using pkg add with a NanoBSD image

I'm running into a problem on a NanoBSD installation where I cannot install openjdk7 via pkg add because it first saves to either tmp or var (not sure which) and on a NanoBSD installation, there is not enough space in this particular location. Can someone please help me either modify pkg add or recommend a different way to install openjdk7 on NanoBSD. Thank you!


How should I download Red Hat Enterprise Linux?

I am aware that RHEL is not free ie Red Hat charges money for the support it gives for RHEL and I am also aware of Fedora project of Red Hat. But I want to experience RHEL in my virtual machine for practicing commands as I just started with linux. I want to download RHEL (not from torrent as torrent doesn't work at my college) without any RedHat support as RedHat charges only for support and not the OS.


Get music from subsonic to run in headless MPD

I share a subsonic server with several colleagues, together we have around 22k songs up there. Now I want to set up a MPD on something like a raspberry pi to listen to the music from subsonic. I want to use MPD because I can control it wireless via my smartphone or something similar. The problem is that I do not know how to connect the subsonic with the MPD. I can export playlists from subsonic but the URLs are relative to the server's filesystem, so no chance here. Do you have any ideas? The subsonic is set, MPD not. Maybe there is something similar which I can use.


When merging directories with similarly-named files, how do you ensure that only smaller+earlier files are replaced?

E.g., if you want to merge two directories with each other (by moving everything from directory 1 into directory 2), and both directory 1 and directory 2 have some files with the same name. Then how can you write code such that if SharedFile is found in both directories, then replace SharedFile in directory 2 with SharedFile in directory 1 IF SharedFile is bigger in directory 1 _and_ SharedFile has a later modification date in directory 1? (but do not replace SharedFile otherwise). I'm fine with both tcsh and bash scripts.


crontab sets up user variable, redirect output, and detect connetcted network

I have three problem, all of them are about crontab.   1. Can I access `$HOME` variable in crontab ? for example, use `$HOME` like this: `PATH=$HOME/bin:$HOME/scripts:$PATH` ? or `* * * * * echo "test" > $HOME/test.txt` ?   2. I want let crontab redirect normal `stdout` to `/dev/null`, but mail `stderr` to user. For example, when computer is **not** connected to network, then an entry in crontab like `* 2 * * * getmail -n -q ...` will return error, so crontab will send email to user with this error.   3. based on upper example, `getmail` will let crontab mail user when system is **not** connected to network, so I want a method to detect whether user is connected to network. About this method of detecting, it should has bellowing:   1. fast   2. simple   3. easy to combine with other crontab jobs, (like use control: &&, ||, | etc)


Repeatably generate a read error for testing?

I'm trying to test the error handling in some software, in particular what happens when an error occurs reading from a file or pipe. Is there a simple way to send a certain amount of data to stdout and then generate an I/O error? (I.e., the process doing the reading would see read(2) return -1.) A simple shell recipe would be great, but I don't mind writing code if that's the only way.


What happened to the old files if we mount a drive to the directory?

mkdir /home      then we mount something on `/home`. Say `/home` already contains files. What happen to the old files after a new drive is mounted to that directory?


How the contents of a directory are impacted when a file system is mounted on that directory

How the contents of a directory are impacted (and when and/or if they are available for use) when a file system is mounted on that directory.


Directories are missing in recovery mode

My service provider booted my virtual server in the recovery mode and now I'm a little bit lost. I'd like to save some files from my web-directory but I can't find `/var/www`. Though there are files in `/var/` but not my `/www/` folder. Is this a normal thing in recovery mode and what do I have to do to save my files?


Script to compare directories and move files (like rsync)

I use `rsync` to sync data between two servers. If I completely rebuild the directory structure, `rsync` cannot understand this and will attempt to recopy everything. I am aware that Unison is capable of doing this however, where files have just been simply moved around and checksums aren't required, I figured a simple script would suffice (if I'm completely screwing up the use of these great tools (`rsync` & Unison) please let me know!) The bash script will compare two file lists and then move any discrepancies so the two match. The two files are TSV with the first column being the filename & the second being the full path. I'm wanting to compare the two based upon the filename and then move them from the file location specified in the first file (mirror) to the file location specificed in the second file (the source). My initial thought was to create a 2d array with the data from the first file, populate a 3rd column with the path information from the second file and then feed this line by line to the mv command. However, it's my understanding that bash can only handle 1d arrays. My second thought is to   1. parse the data in the first list line by line   2. search for the filename in the second file & return the path   3. run the command mv first-path second-path This will run numerous moves which aren't required (because the file is already in the correct place) but it will get the job done. Any thoughts on this? If the second option is the way to go, what's the best method of performing step 2 above?


Damn Small Linux on EEE PC 901

Has anyone tried to use (either install to HD or LiveUSB) Damn Small Linux on the Asus EEE PC 901 netbook? If so, does it work well? Does it have any problem with the WiFi connection?. I ask because the Asus EEE PC 901 netbook has SSD drives and I do not know if the DSL has support for such discs. Also, I know that the WiFi connection EEE PC 901 has problems on some systems.