File system that never breaks (data loss acceptable)

There're several existing topics revolving around this issue, but what I seek is slightly different. I have an sd card on an embedded Linux and it suffers from power loss. I might be able to modify the hardware at some point, close down properly and so on, etc. But right now, I'd just like to find a file system that survives power loss without fuss. Data loss is acceptable. I'd prefer not to lose more than the file that I'm currently writing, but I'd still rather lose it all than facing an 'unable to mount', 'wait for this 10 minutes fsck' or 'unable to create new file due to this inode something something error'. The program MUST go on! I'm making a lot of effort in ensuring this. I'm using industrial grade components, I got hardware watchdogs, software watchdogs, internal, external, init restarting the programs, deamons constantly checking memory, file descriptiors and whatnot, I got watchdogs watching my watchdogs, which in turn are watched by other watchdogs... But I can't seem to guarantee that the sd card is able to mount and function? My best bet right now, is to use JFS on the sd card, include fsck and fsck.jfs in my installation. (Adding 600kb+ eating my ram and my flash. Which is bad.) And run fsck at every startup (maybe adding a lot of boot time. Which is somewhat bad.). It seems a bit sad though. Does anyone know of a better way or a better file system? UPDATE: e2fsprogs-libs (dependency to jfsutils) seems to be hellishly difficult to compile in my distribution. I'll look into ZFS (it's not native to my distribution though. And it seems to do a lot that I don't need.) UPDATE2: Some more info about my system and my tests: The sd card storage is a secondary, optional storage. The sd cards are 2Gb-8Gb industial grade microSD. The sd card is mounted through my rc with a mount -t command. Options "noatime" but not "sync". My distribution is a custom Analog Device flavored uClinux, with a 3.10 kernel and a 1.21 busybox. My primary storage is a spi flash with jffs2. I've never had any issues with that. I don't even know if there is a fsck.jffs2 available. Nand flash on the other hand ... but that's a different story. The purpose of the sd card, is to store measurement data. The 'monitor' program will append results to a file and has strategic sync placements. When the file comes above a given size a new will be created. When a given number of files have been reached the oldest one will be deleted. If the current measurement file is lost due to power loss, it's no disaster. The files are usually at 50-100kb and 1 result is usually 1kb. This is just the initial development phase. Nothing is fixed. This is the first time I've been dealing with non-flash filesystems in embedded systems. (I got ext4 at my x86 servers.) I started out with vfat. The default filesystem. (I figured that the factories might have a reason for choosing it. And if things work I don't really care that much.) I've never seen any power loss issues in my embedded vfat devices. I've experienced issues with FAT in WinCE though. However, when my 'monitor' program reached 100-200 files it refused to create any more. It seems that FAT has a special file limit issue in the root and a slightly bigger one in sub dirs. I need to be able to create 500-1000 files in 1 dir. So vfat won't do. Then I switched to ext2. I didn't insert a fsck at startup though. (Didn't know I had to do so.) Within a day my 'monitor' program were unable to create more files due to a 'inode something something' error. Disaster! My current solution is ext2 with a "e2fsck -y" at startup. So far it's seems promising. But the e2fsck and the whole concept of 'fsck at startup' is nagging at me. The e2fsck by it self is spending more than 350kb of my primary flash and ram. (When it's not running.) Which means that it's my biggest program. It's bigger than busybox. It's almost rivaling my kernel. I've been considering ext3. It has journeled meta data, which wouldn't hurt. I'm in doubt as to how much it will help though. With my small files and controled syncs I should be covered I think? It has a ordered write sequence. Meaning that data are also somewhat journeled. This however can lead to undeterministic lags. Which is bad in my situation. (Prolly it's not an issue.) It also has a scheduled sync feature. Eg. commit every 5 sec. Which is interfering with my own syncs I think. Too many writes are bad for SD cards. Even industrial ones. I cannot find any documentation on how to disable this. And ext3 _still_ requires fsck to be run at every startup! But ext3 is still a possibility. Ext4. Will fix a lot of the performance issues of ext3. I don't really need performance though. And my distribution doesn't seem to have a builtin mkfs.ext4 and a fsck.ext4. Perhaps that's not a problem. It might though. Eg. the e2progs-libs (dependency to jfsutils) seems to have a lot of compile issues. JFS, XFS, BRFSS. All supported by my kernel. Currently not included in my user space tool box. All seems to be rather big, complex systems. And they all seem to require a 'fsck' equivalent at startup? I've also considered throwing my own filesystem: Always write 2 copies of the file table. When transversing it pick the one with the correct CRC and the newest sequence number. Make a 2 stage write sequence. Allocate temporary, fix at commit. No fsck needed. I'm afraid that it might be a bit naive though. UPDATE3: Btw, the nature of embedded systems (this one at least) is that they're autonomous, unattended, out of reach and they have to run for years. Programs like fsck that _may_ require human interaction creeps me out.


concatenate or remove multiple files of a directory

In general for file concatenation with the same extension, we use cat `*.txt`. But in case we are in a different directory and trying to concatenate another directory's files how to do that ? I have written a shell script which includes this statements               cat /home/tarakaramji/*.txt      the error:               cat /home/tarakaramji/*.txt no such file or directory      and the same with removing multiple files of the same extension:               rm /home/tarakaramji/*.txt


Start Vim as my user with root privileges

I have my custom Vim files in `~/.vim` and settings in `~/.vimrc`. However, sometimes I have to edit some files in `/etc` and such.   If I start Vim like this:               $ sudo vim /etc/rc.conf      I lose my config since Vim uses its default one. So: how can I run Vim with root privileges to edit files without losing my user's settings (which are in my home directory)?   I have tried:               $ su username -c "vim /usr/lib/python2.7/setuptools/dist.py"      but Bash gives me `Permission denied`. However, the above command works for example for: `/etc/acpi/handler.sh`. Why is that? Note: _username_ is not root.


Moving from InnoDB to TokuDB

I'm running MariaDB 10.0.x and I would like to move from InnoDB to TokuDB. When using ALTER TABLE <> ENGINE=TokuDB; everything goes fine for the Wordpress websites. Unfortunately the Magento databases are using foreign keys which results in a '#1217 - Cannot delete or update a parent row: a foreign key constraint fails' message when changing tables. How to use TokuDB for my Magento websites also?


Please recommend a GUI telnet client

I'm looking for a simple GUI telnet client. I only ever used the CLI one, simply named **`telnet`**.


Can't install Flash Player on Debian Jessie

I tried to install the flashplugin-nonfree on Debian Jessie (testing) today. However, when I tr running `sudo apt-get install flashplugin-nonfree`, I get `E: Unable to locate package flashplugin-nonfree`. The same happens with Aptitude. My sources.list:               deb http://http.debian.net/debian/ jessie main contrib non-free     deb-src http://http.debian.net/debian/ jessie main          deb http://security.debian.org/ testing/updates main     deb-src http://security.debian.org/ testing/updates main          # testing-updates, previously known as 'volatile'     deb http://http.debian.net/debian/ testing-updates main     deb-src http://http.debian.net/debian/ testing-updates main          deb http://http.debian.net/debian/ testing-backports main contrib non-free      By the way, I use Chromium.


Ctrl+Alt+Backspace to kill X server can't be disabled

I would like to disable the `Ctrl`+`Alt`+`Backspace` shortcut to kill my X server. I have tried disabling it in the `gnome-keyboard-properties` "Layout Options..." dialog. When I start the dialog, the option is checked as below: ![enter image description here](http://i.stack.imgur.com/B8lx6.png) If I uncheck that box, and push the Close button, and open the "Layout Options..." dialog again, the box is still checked. How can I make unchecking that box persist, and the `Ctrl`+`Alt`+`Backspace` shortcut disabled? I know about the `xorg.conf` options but I don't always have root access, and would like this user-level setting to work. I'm using CentOS 6.5, GNOME 2.28.2, and X.Org 1.13.0.


USB Mouse and Keyboard not working in Linux 4 Tegra

I'm new to Tegra Linux development. I have a Tamontem NG Evaluation board with the Tegra 3 Chip. I installed L4T sample file system from NVIDIA Tegra resources (https://developer.nvidia.com/linux-tegra) and installed the file system as described in the documentation provided in NVIDIA site. Already there was an SD card with L4T running. I don't want to change the boot loader. So I copied the `boot.scr.uimg` to root (/) folder and `uImage` to boot (`/boot`) and it starts booting from the existing SD card. After that while booting, some errors occurred in some Bluetooth devices (there is no Bluetooth device in the board). So I disabled Bluetooth by giving the following command:               sudo mv /etc/init/bluetooth.conf /etc/init/bluetooth.conf.noexec      Now the problem is that mouse and keyboard are not working. So I can't login. Even though I installed desktop, the mouse and keyboard are not working. But mouse and keyboard are enumerating. The `lsusb` command is showing the USB mouse and keyboard.   * The installed file system is Ubuntu 13.04    * Linux Kernel version is 3.1 What to do?


What is X Window System?

I am new to the Linux environment and really got confused with “X Window system”. So can anyone please tell me what X Window System is and what it is used for?


How to count how many different word do i have in a file, in a column

I have a CSV file.               "AGNOLI Valerio","ITA","AST"      In this example, the 2nd column says "ITA". I expect there are about 100 or so different nationalities listed in this file. I want to know exactly how many different nationalities there are.


Delete last character in a word but only if the character is there - in bash

How to remove last character only if it's there? input:               OpenOffice.org/m     openOffice.org/ozm     Pers.     Pfg.     phil.     Prof.     resp.     Roonstr./m     roonstr./ozm      desired output:               OpenOffice.org     openOffice.org     Pers     Pfg     phil     Prof     resp     Roonstr     roonstr      I got it so far that only the dot is left but unfortunately the last sed command removes also letter `g` too: `$ cat filename | grep "\." | cut -d"/" -f1 | sed 's/.$//'`


Differences between UNIX, BSD and FreeBSD?

Could somebody tell me the difference between UNIX, BSD and FreeBSD? I've been using Linux from always, but now I'm curious about FreeBSD and BSD, because maybe there are more "unix-legacy"... What's exactly the difference between them? Thanks!


Share X11 with remote server where X11 are not installed

I need a GUI on a remote server to which I have an ssh connection. Is it possible to share my X11 window system with it given that there's no X11 installed on the server?


Installing Linux Mint Debian Edition into existing partitions: What's there to look out for?

I have four partitions on a hard drive, two of which are boot loaders. One is the `/boot` partition, one is the boot loader of Windows 7. Now, the Linux running on it, is an old Fedora. I'd like to install Linux Mint Debian Edition into the Fedora partition, and the boot loader that comes with it (GRUB2, iirc), while not messing up the Windows part. Is it safe to do that? I remember people talking about LMDE being overly simplified, etc. Will I be able to even select what partition to use for installation and boot loaders?


How to get clicked-on filename as argument of shell script triggered by this mouse-click

If, in Ubuntu's Nautilus, I click a midi-file, a window opens to specify an application for processing the file. Another option is a "user generated command" (UGC). (Let me choose Ubuntu, Nautilus, midi and bash for example). I know how to play midi files in the terminal using timidity, so I hope I can set up a bash script **playmidi** (example) for that purpose.   1. However, I do not know how to get the filename as a script parameter. If possible, this "mouse parameter" should go together with "ordinary" fixed ones for timidity.   2. What syntax has to be used in the UGC?   3. If UGC space allows, can I insert the timidity command directly, but once more, how do I refer to the file?


CentOS is not showing log-in prompt after removing Gnome Desktop (does not switch to correct virtual terminal automatically)

After installing CentOS 6.5 I removed Gnome Desktop Environment by running               yum groupremove Desktop      Now everything works fine, but whenever the computer starts there is no log-in prompt. The screen just shows CentOS progress bar. I have to press `Alt`+`Ctrl`+`F6` in order to switch to terminal and see the log-in prompt. How can I configure CentOS to do this automatically?


Pruning the list of running GUI applications that have been "idle" for > 24 hours?

I open lots of GUI applications -- mostly, instances of Nautilus or Terminal -- without closing them promptly. Consequently, my list of active applications gets big. Besides the drain on the RAM, switching between GUI applications that share a same icon becomes a chore. Is there a way to work more efficiently? For instance, by automatically closing the applications that haven't been used for a while, let's say 24 hours. Or by using a tool that lets users to close applications quickly, instead of having to switch to each application and press `Alt`+`F4`. ### System   * Debian GNU/Linux 6   * Gnome 2.30


Unable to boot into Mac OS after installing Fedora[Dual Boot]

I installed Fedora on my Mac and now when I boot, it says "booting in insecure mode" an then see a typical Linux "choose what to boot" screen. The List goes like: _Fedora Fedora Recovery Mac OSX 32-bit Mac OSX 64-bit Mac OSX 32-bit Mac OSX 64-bit_ Fedora starts just fine, but when I go to one of the four Mac options, it tells me some commands weren't found(I can look up which, if needed). The Mac partitions were left completely untouched during installation. Output of `fdisk -l`               Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors     Units: sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disklabel type: gpt     Disk identifier: 146AB7C4-3FB6-46B2-8538-3747383C9946          Device           Start          End   Size Type     /dev/sda1           40       409639   200M EFI System     /dev/sda2       409640    391034639 186.3G Apple HFS/HFS+     /dev/sda3    391034640    392304175 619.9M Apple boot     /dev/sda4    392304640    392816639   250M Apple HFS/HFS+     /dev/sda5    392816640    413296639   9.8G Microsoft basic data     /dev/sda6    413296640    423536639   4.9G Linux swap     /dev/sda7    423536640    956016639 253.9G Microsoft basic data               Disk /dev/sdb: 1.9 GiB, 2041577472 bytes, 3987456 sectors     Units: sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disklabel type: dos     Disk identifier: 0x5513338d          Device    Boot     Start       End Blocks  Id System     /dev/sdb1 *            0   1951743 975872   0 Empty     /dev/sdb2            172     10235   5032  ef EFI (FAT-12/16/32)     /dev/sdb3          10284     50603  20160   0 Empty               Disk /dev/sdb1: 953 MiB, 999292928 bytes, 1951744 sectors     Units: sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disklabel type: dos     Disk identifier: 0x5513338d          Device      Boot     Start       End Blocks  Id System     /dev/sdb1p1 *            0   1951743 975872   0 Empty     /dev/sdb1p2            172     10235   5032  ef EFI (FAT-12/16/32)     /dev/sdb1p3          10284     50603  20160   0 Empty      So, I thought, the active Partition was set wrong, but fdisk itself tells me that the command a does not exist and then, I tried it with parted, but that does not work either               # sudo parted /dev/sda1 set 1 boot on     Error: The flag 'boot' is not available for loop disk labels.     # sudo parted /dev/sda3 set 1 boot on                   Error: The flag 'boot' is not available for loop disk labels.      I had once installed Debian on the Mac, and it automatically booted into Linux, but when I pressed alt, I was able to access the reFind menu and boot into Mac OS. This does not work here, I just get the same "booting in insecure mode" message and so on. Also, the Fedora Partitions were supposed to be ext4, so I have no idea why it says Microsoft basic data.


How to change user name

I somehow changed my prompt (`PS1`) from `[mpatil@localhost ~]$` to `bash-4.1$`. I also have changed my user `mpatil`'s home directory from `/home/mpatil` to `/home/algo`. Now some applications are not working correctly, and I get this error when opening some application: ![enter image description here](http://i.stack.imgur.com/5NZNG.png) How can I change the prompt to what it was before, and how can I get the application to work again?


Saving files to NTFS is corrupted?

I have recently started using Fedora on my laptop. I've set it up so that it sits on a roughly 20GB encrypted partition and most of the Home folders (Downloads, Documents, Pictures) are symlinked to there Windows equivalents. It has worked well usually, at least until I start saving files in those folders While I'm in Fedora I can save all my files to the Windows partition and view them just fine. However when I boot into Windows 7, half the time the files don't even show up. Running chkdsk shows lots of errors and proceeds to delete most of the files I created in Linux If useful this is the full chkdsk log from the last run where I lost a lot of downloads among other files (its very verbose since I grabbed it from the Event Log)               Checking file system on C:     The type of the file system is NTFS.     Volume label is Windows_7.               One of your disks needs to be checked for consistency. You     may cancel the disk check, but it is strongly recommended     that you continue.     Windows will now check the disk.                                   CHKDSK is verifying files (stage 1 of 3)...     Cleaning up instance tags for file 0xf9aa.     Cleaning up instance tags for file 0xf9c5.     Attribute record of type 0x80 and instance tag 0x2 is cross linked     starting at 0x143df90 for possibly 0xf18 clusters.     Some clusters occupied by attribute of type 0x80 and instance tag 0x2     in file 0x362a8 is already in use.     Deleting corrupt attribute record (128, "")     from file record segment 221864.     Attribute record of type 0x80 and instance tag 0x2 is cross linked     starting at 0x16c94a0 for possibly 0x104 clusters.     Some clusters occupied by attribute of type 0x80 and instance tag 0x2     in file 0x362ad is already in use.     Deleting corrupt attribute record (128, "")     from file record segment 221869.     Attribute record of type 0x80 and instance tag 0x2 is cross linked     starting at 0x14376bc for possibly 0xffc clusters.     Some clusters occupied by attribute of type 0x80 and instance tag 0x2     in file 0x362b4 is already in use.     Deleting corrupt attribute record (128, "")     from file record segment 221876.     Attribute record of type 0x80 and instance tag 0x2 is cross linked     starting at 0x1f936d0 for possibly 0x354 clusters.     Some clusters occupied by attribute of type 0x80 and instance tag 0x2     in file 0x362c3 is already in use.     Deleting corrupt attribute record (128, "")     from file record segment 221891.     Attribute record of type 0x80 and instance tag 0x2 is cross linked     starting at 0x2375bc0 for possibly 0x9a9 clusters.     Some clusters occupied by attribute of type 0x80 and instance tag 0x2     in file 0x362c5 is already in use.     Deleting corrupt attribute record (128, "")     from file record segment 221893.     Attribute record of type 0x80 and instance tag 0x2 is cross linked     starting at 0x24eccb0 for possibly 0xb4 clusters.     Some clusters occupied by attribute of type 0x80 and instance tag 0x2     in file 0x362c6 is already in use.     Deleting corrupt attribute record (128, "")     from file record segment 221894.     Attribute record of type 0x80 and instance tag 0x2 is cross linked     starting at 0x22f9078 for possibly 0x134 clusters.     Some clusters occupied by attribute of type 0x80 and instance tag 0x2     in file 0x362c9 is already in use.     Deleting corrupt attribute record (128, "")     from file record segment 221897.     Attribute record of type 0x80 and instance tag 0x2 is cross linked     starting at 0x1f90048 for possibly 0x688 clusters.     Some clusters occupied by attribute of type 0x80 and instance tag 0x2     in file 0x362ca is already in use.     Deleting corrupt attribute record (128, "")     from file record segment 221898.     Attribute record of type 0x80 and instance tag 0x2 is cross linked     starting at 0x2337638 for possibly 0xa78 clusters.     Some clusters occupied by attribute of type 0x80 and instance tag 0x2     in file 0x362cf is already in use.     Deleting corrupt attribute record (128, "")     from file record segment 221903.     Attribute record of type 0x80 and instance tag 0x2 is cross linked     starting at 0x2520698 for possibly 0x90 clusters.     Some clusters occupied by attribute of type 0x80 and instance tag 0x2     in file 0x362d0 is already in use.     Deleting corrupt attribute record (128, "")     from file record segment 221904.     Attribute record of type 0x80 and instance tag 0x2 is cross linked     starting at 0x2374bc1 for possibly 0x70 clusters.     Some clusters occupied by attribute of type 0x80 and instance tag 0x2     in file 0x362d1 is already in use.     Deleted corrupt attribute list entry     with type code 128 in file 221905.     Unable to locate attribute with instance tag 0x2 and segment     reference 0x10000000362d1.  The expected attribute type is 0x80.     Deleting corrupt attribute record (128, "")     from file record segment 221905.     Attribute record of type 0x80 and instance tag 0x2 is cross linked     starting at 0x232ebe0 for possibly 0xb4 clusters.     Some clusters occupied by attribute of type 0x80 and instance tag 0x2     in file 0x362d2 is already in use.     Deleting corrupt attribute record (128, "")     from file record segment 221906.     Attribute record of type 0x80 and instance tag 0x2 is cross linked     starting at 0x247bc88 for possibly 0x74 clusters.     Some clusters occupied by attribute of type 0x80 and instance tag 0x2     in file 0x362d3 is already in use.     Deleting corrupt attribute record (128, "")     from file record segment 221907.     Attribute record of type 0x80 and instance tag 0x2 is cross linked     starting at 0x230a0d8 for possibly 0x17c clusters.     Some clusters occupied by attribute of type 0x80 and instance tag 0x2     in file 0x362d4 is already in use.     Deleting corrupt attribute record (128, "")     from file record segment 221908.     Attribute record of type 0x80 and instance tag 0x2 is cross linked     starting at 0x232abdf for possibly 0x800 clusters.     Some clusters occupied by attribute of type 0x80 and instance tag 0x2     in file 0x362d6 is already in use.     Deleting corrupt attribute record (128, "")     from file record segment 221910.     Attribute record of type 0x80 and instance tag 0x2 is cross linked     starting at 0x2341630 for possibly 0x400 clusters.     Some clusters occupied by attribute of type 0x80 and instance tag 0x2     in file 0x362d7 is already in use.     Deleting corrupt attribute record (128, "")     from file record segment 221911.     Attribute record of type 0x80 and instance tag 0x2 is cross linked     starting at 0x2321580 for possibly 0x1e1 clusters.     Some clusters occupied by attribute of type 0x80 and instance tag 0x2     in file 0x362d8 is already in use.     Deleting corrupt attribute record (128, "")     from file record segment 221912.     Attribute record of type 0x80 and instance tag 0x2 is cross linked     starting at 0x2342630 for possibly 0xc00 clusters.     Some clusters occupied by attribute of type 0x80 and instance tag 0x2     in file 0x362db is already in use.     Deleting corrupt attribute record (128, "")     from file record segment 221915.     Attribute record of type 0x80 and instance tag 0x2 is cross linked     starting at 0xa2a46a for possibly 0x5d clusters.     Some clusters occupied by attribute of type 0x80 and instance tag 0x2     in file 0x362e5 is already in use.     Deleting corrupt attribute record (128, "")     from file record segment 221925.       221952 file records processed.                                          File verification completed.       589 large file records processed.                                      0 bad file records processed.                                        2 EA records processed.                                              44 reparse records processed.                                       CHKDSK is verifying indexes (stage 2 of 3)...     Deleted invalid filename Screenshot from 2012-07-08 18:29:56.png (6790) in directory 100707.     The NTFS file name attribute in file 0x1a86 is incorrect.     53 00 63 00 72 00 65 00 65 00 6e 00 73 00 68 00  S.c.r.e.e.n.s.h.     6f 00 74 00 20 00 66 00 72 00 6f 00 6d 00 20 00  o.t. .f.r.o.m. .     32 00 30 00 31 00 32 00 2d 00 30 00 37 00 2d 00  2.0.1.2.-.0.7.-.     30 00 38 00 20 00 31 00 38 00 3a 00 32 00 39 00  0.8. .1.8.:.2.9.     3a 00 35 00 36 00 2e 00 70 00 6e 00 67 00 67 00  :.5.6...p.n.g.g.     64 00 64 00 73 00 e3 db 9f 64 df 00 00 80 16 00  d.d.s....d......     File 6790 has been orphaned since all its filenames were invalid     Windows will recover the file in the orphan recovery phase.     Correcting minor file name errors in file 6790.     Deleted invalid filename Screenshot from 2012-06-19 18:51:56.png (95798) in directory 100707.     The NTFS file name attribute in file 0x17636 is incorrect.     53 00 63 00 72 00 65 00 65 00 6e 00 73 00 68 00  S.c.r.e.e.n.s.h.     6f 00 74 00 20 00 66 00 72 00 6f 00 6d 00 20 00  o.t. .f.r.o.m. .     32 00 30 00 31 00 32 00 2d 00 30 00 36 00 2d 00  2.0.1.2.-.0.6.-.     31 00 39 00 20 00 31 00 38 00 3a 00 35 00 31 00  1.9. .1.8.:.5.1.     3a 00 35 00 36 00 2e 00 70 00 6e 00 67 00 10 00  :.5.6...p.n.g...     00 00 02 00 00 00 99 db 9f 64 df 00 00 80 20 00  .........d.... .     File 95798 has been orphaned since all its filenames were invalid     Windows will recover the file in the orphan recovery phase.     Correcting minor file name errors in file 95798.     An index entry of index $I30 in file 0xfda2 points to file 0x3633b     which is beyond the MFT.     Deleting index entry example2.mkv.trashinfo in index $I30 of file 64930.     An index entry of index $I30 in file 0xfda2 points to file 0x3633d     which is beyond the MFT.     Deleting index entry temp.asf.trashinfo in index $I30 of file 64930.     Unable to locate the file name attribute of index entry vlc-2.0.3-win32.exe     of index $I30 with parent 0xfe20 in file 0x34e10.     Deleting index entry vlc-2.0.3-win32.exe in index $I30 of file 65056.     An index entry of index $I30 in file 0x18963 points to file 0x36331     which is beyond the MFT.     Deleting index entry IMG_20120730_203055.jpg in index $I30 of file 100707.     Unable to locate the file name attribute of index entry Screenshot from 2012-06-19 18:51:56.png     of index $I30 with parent 0x18963 in file 0x17636.     Deleting index entry Screenshot from 2012-06-19 18:51:56.png in index $I30 of file 100707.     Unable to locate the file name attribute of index entry Screenshot from 2012-07-08 18:29:56.png     of index $I30 with parent 0x18963 in file 0x1a86.     Deleting index entry Screenshot from 2012-07-08 18:29:56.png in index $I30 of file 100707.     Unable to locate the file name attribute of index entry Copy of Phone Log.xlsx     of index $I30 with parent 0x18966 in file 0x8ac7.     Deleting index entry Copy of Phone Log.xlsx in index $I30 of file 100710.     Unable to locate the file name attribute of index entry COPYOF~1.XLS     of index $I30 with parent 0x18966 in file 0x8ac7.     Deleting index entry COPYOF~1.XLS in index $I30 of file 100710.     Unable to locate the file name attribute of index entry FirefoxPortable_14.0.1_English.paf.exe     of index $I30 with parent 0x18966 in file 0x10930.     Deleting index entry FirefoxPortable_14.0.1_English.paf.exe in index $I30 of file 100710.     Unable to locate the file name attribute of index entry FIREFO~1.EXE     of index $I30 with parent 0x18966 in file 0x10930.     Deleting index entry FIREFO~1.EXE in index $I30 of file 100710.     Unable to locate the file name attribute of index entry vlc-2.0.2-win32.exe     of index $I30 with parent 0x18966 in file 0xc2d.     Deleting index entry vlc-2.0.2-win32.exe in index $I30 of file 100710.     Unable to locate the file name attribute of index entry vlc-2.1.0-git-20120719-0003-win32.exe     of index $I30 with parent 0x18966 in file 0x35768.     Deleting index entry vlc-2.1.0-git-20120719-0003-win32.exe in index $I30 of file 100710.     Unable to locate the file name attribute of index entry VLC-20~1.EXE     of index $I30 with parent 0x18966 in file 0xc2d.     Deleting index entry VLC-20~1.EXE in index $I30 of file 100710.     Unable to locate the file name attribute of index entry VLC-21~1.EXE     of index $I30 with parent 0x18966 in file 0x35768.     Deleting index entry VLC-21~1.EXE in index $I30 of file 100710.     Unable to locate the file name attribute of index entry VLCPortable_2.0.2.paf.exe     of index $I30 with parent 0x18966 in file 0x8a3.     Deleting index entry VLCPortable_2.0.2.paf.exe in index $I30 of file 100710.     Unable to locate the file name attribute of index entry VLCPOR~1.EXE     of index $I30 with parent 0x18966 in file 0x8a3.     Deleting index entry VLCPOR~1.EXE in index $I30 of file 100710.     Unable to locate the file name attribute of index entry Weekly Schedule.pdf     of index $I30 with parent 0x18966 in file 0x80d.     Deleting index entry Weekly Schedule.pdf in index $I30 of file 100710.     Unable to locate the file name attribute of index entry WEEKLY~1.PDF     of index $I30 with parent 0x18966 in file 0x80d.     Deleting index entry WEEKLY~1.PDF in index $I30 of file 100710.     Index entry [Z-Z] Claymore 1-26 DVDRip (Dual Audio) of index $I30 in file 0x18966 points to unused file 0x362a2.     Deleting index entry [Z-Z] Claymore 1-26 DVDRip (Dual Audio) in index $I30 of file 100710.       319972 index entries processed.                                         Index verification completed.     CHKDSK is scanning unindexed files for reconnect to their original directory.     Recovering orphaned file [CBM] FLCL Complete (BDRip)-(Dual Audio)-(720p HD) (68323) into directory file 100710.     Recovering orphaned file Claymore(2007)DVD.H264[Eclipse] (221890) into directory file 100710.       51 unindexed files scanned.                                         CHKDSK is recovering remaining unindexed files.       49 unindexed files recovered.                                       CHKDSK is verifying security descriptors (stage 3 of 3)...       221952 file SDs/SIDs processed.                                         Cleaning up 157 unused index entries from index $SII of file 0x9.     Cleaning up 157 unused index entries from index $SDH of file 0x9.     Cleaning up 157 unused security descriptors.     Security descriptor verification completed.     Inserting data attribute into file 221864.     Inserting data attribute into file 221869.     Inserting data attribute into file 221876.     Inserting data attribute into file 221891.     Inserting data attribute into file 221893.     Inserting data attribute into file 221894.     Inserting data attribute into file 221897.     Inserting data attribute into file 221898.     Inserting data attribute into file 221903.     Inserting data attribute into file 221904.     Inserting data attribute into file 221905.     Inserting data attribute into file 221906.     Inserting data attribute into file 221907.     Inserting data attribute into file 221908.     Inserting data attribute into file 221910.     Inserting data attribute into file 221911.     Inserting data attribute into file 221912.     Inserting data attribute into file 221915.     Inserting data attribute into file 221925.       49030 data files processed.                                            CHKDSK is verifying Usn Journal...       36868184 USN bytes processed.                                             Usn Journal verification completed.     Correcting errors in the master file table's (MFT) BITMAP attribute.     Correcting errors in the Volume Bitmap.     Windows has made corrections to the file system.           291987455 KB total disk space.      185120652 KB in 171472 files.         105856 KB in 49015 indexes.              0 KB in bad sectors.         334419 KB in use by the system.          65536 KB occupied by the log file.      106426528 KB available on disk.                4096 bytes in each allocation unit.       72996863 total allocation units on disk.       26606632 allocation units available on disk.          Internal Info:     00 63 03 00 61 5d 03 00 a4 0b 06 00 00 00 00 00  .c..a]..........     ca 05 00 00 2c 00 00 00 00 00 00 00 00 00 00 00  ....,...........     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................          Windows has finished checking your disk.     Please wait while your computer restarts. This has been happening off and on since Fedora 15, which ranges from annoying ("Oh, lost some random meme gifs I downloaded") to angering ("Oh look, my programming assignment was deleted"). Its to the point where I'm about to mount the partition as read-only, which means I'll probably not use Linux at all. EDIT: Mount options               /dev/sda2 /media/win7/ ntfs rw,uid=1000,gid=1000,umask=007 0 0      Has anyone else ever experienced this problem? Are there known remedies? Is NTFS on Windows 7 even supported?


Disabling caps lock by setxkbmap makes it Shift key in Emacs

I'm using GNU Emacs 23.2.1. within Xfce 4.8.0 (both coming from the Ubuntu Natty repository). I disable the `CapsLock` by running `/usr/bin/setxkbmap -option "ctrl:nocaps"` at the beginning of the Xfce session. When I hit the `CapsLock` key with some other keys, Emacs treats it as if the `Ctrl` key and the `Shift` key is pressed (`Ctrl`-`S`-whatever). This has some unpleasant effects such as moving cursors always setting marks, and translating `Ctrl`-`h` to `Ctrl`-`?` not working. Pressing the real `Ctrl` key on the keyboard works fine, and pressing both the real `Ctrl` and `Shift` key works the same way as pressing the real `CapsLock` key only.    I'd like the `CapsLock` to be precisely same as the `Ctrl` key. What should I do? I tweaked the X server setting in vain, so I think I might want to make Emacs treat `Ctrl`-`S`-whatever as `Ctrl`-whatever.


Why is Cygwin not sourcing my .bashrc?

I'm switching to Cygwin from the bash shell that ships with Git for Windows, and for some strange reason the .bashrc file is not being sourced when I open a new Terminal. I have to               source .bashrc      manually just to get my normal settings. `echo $0 $-` returns `-bash himBH` What could be the problem?


Can a Linux distro be closed source?

According to the GPL licence, which is the one used by the Linux kernel, every modification in the source must be open source too. But, for example, if I create a new OS based on Linux, I develop my own Desktop system and all that stuff, but I **don't** make any modification to the kernel, does my project need to be open source just by using Linux? I hope this is the right site to post this.


How to find image files by content

I have a list of files and I need to **find all the image-files** from that list. For example, if my list contained the following:               pidgin.tar.gz     photo01.jpg     picture01     screenshot.gif     invoice.pdf      Then I would like only to select:               photo01.jpg     picture01     screenshot.gif      Notes:   * Method must not be dependant on file extensions   * Obscure image formats for Photoshop and Gimp can be ignored. ( If `feh` can't show it, its not a image )


Where does UNIX look for login information? eg where it finds what to do?

So I've been getting more and more into my UNIX system, a mac, and I wanted to know where it goes to execute a log-in. I know where it keeps the passwords and such, but I would like to see the script it runs at log-in. I did find `/usr/bin/login` but neither vim nor nano will show anything that looks like code(eg. it's 90% @ symbols). So if that is the file how can I read it?


Restrict ssh login from LDAP to users who have a /home directory

I have an Apache server (RHEL 6) hosting multiple user web pages which currently is connected to my Active Directory environment to authenticate users. The server is used to automatically host content the users put in their /home/<user>/public_html folder. I am also configuring this server to use chroot so the users will not be able to browse any other content on the server outside of their home folder. The login scripts do not create a home folder for the users. Those are created manually because we only want certain users to be able to host web pages from this server. The problem is, any user is currently able to log into the server and instead of going to their /home folder (because it doesn't exist) they automatically go into /. This gives them access to view any files/folders on the server their group has read access to. This is a security concern and I'd like to restrict logins to users who have a /home directory. We don't want to specify an AD group or list of users as authenticated because that list may get quite long and be difficult to manage although it may be easier than writing a PAM module. **Is there a way to restrict LDAP logins to only users who already have a /home directory?** I am not finding anything in the PAM options or documentation.


`/etc/sudoers` -- specify `env_keep` for one command only?

Is there any way to specify that `sudo` should preserve certain environment variables for specified commands only? For some purposes I'd like my `$HOME` env. variable preserved when I run certain commands -- for other purposes and other commands, I want it reset. Can this be done with `/etc/sudoers`? cheers! simon **edit:** Thank you for the answers gents -- I wonder if I might ask a follow-up question, which is "Why, then, does this not work?!" :) In the example I'm trying to get working, I want `sudo nano` to read my `$HOME/.nanorc`. If I use this:               Defaults:simon env_keep=HOME      it works perfectly. If I use this:               Defaults!/bin/nano env_keep=HOME      or this:               Cmnd_Alias      NANO = /usr/bin/nano,/bin/nano,/bin/rnano     Defaults!NANO   env_keep=HOME      it's not working at all. Any suggestions as to why? (I'm on Debian testing, btw.) (Note: I don't think it's `nano` specific, btw -- I can reproduce the behaviour with a one-line bash script that simply `echo`s `$HOME`). thanks!


nmap output: what does "uptime" mean?

If I nmap a host, then it outputs an "Uptime" too. What does it mean, is it trustable? Does it gives correct times?


Total Commander "compare content" like alternative?

I'm searching a GUI [or CLI] tool that can produce output like the Total Commander compare content function does! For example: ![Screenshot of Total Commander](http://i.stack.imgur.com/Lf3Xy.png) Are there any that do that? It's a very handy tool and I miss it


Is running "sudo sync" and removing power dangerous for my system?

I run an Ubuntu system, and it sometimes takes a while to shut down. Apparently, GNU/Linux attempts to, in a nutshell, stop all running processes, flush the filesystem journal, and then cut off the power. My reasoning is that, when power is removed, all data kept in RAM is lost, and therefore the system does not need to manually kill the processes as they will die anyway. Would running `sudo sync` and then removing power be a safe (and significantly faster) alternative to a proper shutdown (`shutdown -h now`), or would it present a hardware/security danger?


Color script output only when invoked from interactive shell

I made a bash script producing colored output. The colors are fine when the script is called from an interactive shell. However, if the output is processed in another script, or passed through a pipe, it should not be colored (I think). How is this handled usually? Should I provide an option to turn on/off the colored output, or is there a way to detect this automatically in the script? Preferably it works automatically and I only need a minimum of code to output colored / non-colored, depending on the script invocation... One problem with automatic detection seems to be that a script always runs non-interactive, so I would have to know the interactive status of the parent shell instead.


List printer's completed jobs

Is there a utility to inspect the jobs that a printer has completed?


logrotate unable to rotate logs

logrotate is unable to rotate my logs. I have checked the file permissions, they are fine. I have even tried by putting "su root root" in the configuration file, still I am facing the same issue. Please find the relevant details below: **logrotate.conf file:**               /var/log/testlog {         compress         delaycompress          maxage 180         rotate 15         size 1024M         start 1         rotate 15         missingok     }      **Debug Logs: [using "-d]**               rotating pattern: /var/log/testlog  1073741824 bytes (15 rotations)     empty log files are not rotated, old logs are removed     considering log /var/log/testlog       log needs rotating     rotating log /var/log/testlog, log->rotateCount is 15     dateext suffix '-20140708'     glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'     compressing log with: /bin/gzip     renaming /var/log/testlog.15.gz to /var/log/testlog.16.gz (rotatecount 15, logstart 1, i 15),      renaming /var/log/testlog.14.gz to /var/log/testlog.15.gz (rotatecount 15, logstart 1, i 14),      renaming /var/log/testlog.13.gz to /var/log/testlog.14.gz (rotatecount 15, logstart 1, i 13),      renaming /var/log/testlog.12.gz to /var/log/testlog.13.gz (rotatecount 15, logstart 1, i 12),      renaming /var/log/testlog.11.gz to /var/log/testlog.12.gz (rotatecount 15, logstart 1, i 11),      renaming /var/log/testlog.10.gz to /var/log/testlog.11.gz (rotatecount 15, logstart 1, i 10),      renaming /var/log/testlog.9.gz to /var/log/testlog.10.gz (rotatecount 15, logstart 1, i 9),      renaming /var/log/testlog.8.gz to /var/log/testlog.9.gz (rotatecount 15, logstart 1, i 8),      renaming /var/log/testlog.7.gz to /var/log/testlog.8.gz (rotatecount 15, logstart 1, i 7),      renaming /var/log/testlog.6.gz to /var/log/testlog.7.gz (rotatecount 15, logstart 1, i 6),      renaming /var/log/testlog.5.gz to /var/log/testlog.6.gz (rotatecount 15, logstart 1, i 5),      renaming /var/log/testlog.4.gz to /var/log/testlog.5.gz (rotatecount 15, logstart 1, i 4),      renaming /var/log/testlog.3.gz to /var/log/testlog.4.gz (rotatecount 15, logstart 1, i 3),      renaming /var/log/testlog.2.gz to /var/log/testlog.3.gz (rotatecount 15, logstart 1, i 2),      renaming /var/log/testlog.1.gz to /var/log/testlog.2.gz (rotatecount 15, logstart 1, i 1),      renaming /var/log/testlog.0.gz to /var/log/testlog.1.gz (rotatecount 15, logstart 1, i 0),      renaming /var/log/testlog to /var/log/testlog.1     removing old log /var/log/testlog.16.gz     error: error opening /var/log/testlog.16.gz: No such file or directory      **Verbose Output:**               rotating pattern: /var/log/testlog  1073741824 bytes (15 rotations)     empty log files are not rotated, old logs are removed     considering log /var/log/testlog       log needs rotating     rotating log /var/log/testlog, log->rotateCount is 15     dateext suffix '-20140625'     glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'     compressing log with: /bin/gzip     renaming /var/log/testlog.15.gz to /var/log/testlog.16.gz (rotatecount 15, logstart 1, i 15),      old log /var/log/testlog.15.gz does not exist     renaming /var/log/testlog.14.gz to /var/log/testlog.15.gz (rotatecount 15, logstart 1, i 14),      old log /var/log/testlog.14.gz does not exist     renaming /var/log/testlog.13.gz to /var/log/testlog.14.gz (rotatecount 15, logstart 1, i 13),      old log /var/log/testlog.13.gz does not exist     renaming /var/log/testlog.12.gz to /var/log/testlog.13.gz (rotatecount 15, logstart 1, i 12),      old log /var/log/testlog.12.gz does not exist     renaming /var/log/testlog.11.gz to /var/log/testlog.12.gz (rotatecount 15, logstart 1, i 11),      old log /var/log/testlog.11.gz does not exist     renaming /var/log/testlog.10.gz to /var/log/testlog.11.gz (rotatecount 15, logstart 1, i 10),      old log /var/log/testlog.10.gz does not exist     renaming /var/log/testlog.9.gz to /var/log/testlog.10.gz (rotatecount 15, logstart 1, i 9),      old log /var/log/testlog.9.gz does not exist     renaming /var/log/testlog.8.gz to /var/log/testlog.9.gz (rotatecount 15, logstart 1, i 8),      old log /var/log/testlog.8.gz does not exist     renaming /var/log/testlog.7.gz to /var/log/testlog.8.gz (rotatecount 15, logstart 1, i 7),      old log /var/log/testlog.7.gz does not exist     renaming /var/log/testlog.6.gz to /var/log/testlog.7.gz (rotatecount 15, logstart 1, i 6),      old log /var/log/testlog.6.gz does not exist     renaming /var/log/testlog.5.gz to /var/log/testlog.6.gz (rotatecount 15, logstart 1, i 5),      old log /var/log/testlog.5.gz does not exist     renaming /var/log/testlog.4.gz to /var/log/testlog.5.gz (rotatecount 15, logstart 1, i 4),      old log /var/log/testlog.4.gz does not exist     renaming /var/log/testlog.3.gz to /var/log/testlog.4.gz (rotatecount 15, logstart 1, i 3),      old log /var/log/testlog.3.gz does not exist     renaming /var/log/testlog.2.gz to /var/log/testlog.3.gz (rotatecount 15, logstart 1, i 2),      old log /var/log/testlog.2.gz does not exist     renaming /var/log/testlog.1.gz to /var/log/testlog.2.gz (rotatecount 15, logstart 1, i 1),      renaming /var/log/testlog.0.gz to /var/log/testlog.1.gz (rotatecount 15, logstart 1, i 0),      old log /var/log/testlog.0.gz does not exist     log /var/log/testlog.16.gz doesn't exist -- won't try to dispose of it     renaming /var/log/testlog to /var/log/testlog.1      **Output of ls /var/log/testlog* :**               /var/log/testlog       /var/log/testlog.1       /var/log/testlog.2.gz      Can somebody please provide me some hint to resolve this issue? Thanks


Make directory copies using find

I have a directory with a bunch of subdirectories in it. Thus               /usr/local/src/ccl/ccl-1.8/x86-headers$ ls     elf  gl  gmp  gnome2  gtk2  jni  libc      Each of these directories has a further subdirectory `C` inside it, which contains a file `populate.sh`. I want to create a parallel group of subdirectories with the same structure, but with a random value appended to the directory name (the random value should be the same in all cases), and only containing the C subdirectory with the `populate.sh` file. These directories contain other files besides the `populate.sh` file. This is for a makefile, so for simplicity should probably use standard unix utilties. I'm thinking find with the `-exec` flag, or possibly `xargs` would work, but I'm having trouble making sense of the documentation, and I have little experience with shell scripting. Perl might work, but I have not used it, and would prefer not to use it here. I've been using something like `mktemp -u --tmpdir=.` to generate a random string in the past, but it is hardly ideal, so I'm open to other suggestions. Ideally I'd like a name that looks like `libc.tmp_xw3st`. Ie. `tmp_` followed by a 5 digit alphanumeric string. So far, I've got a way of getting a listing of the top level directories. :-)               find . -maxdepth 1 -type d -print0          ../gmp./jni./gl./elf./libc./gtk2./gnome2      A fuller directory listing is at the end of this posting. To summarize, I want to create additional directories like `x86-headers/libc.tmpvalue`, which only contains the further file `x86-headers/libc.tmpvalue/C/populate.sh`. A sketch of a possible approach is to handle this in two steps as follows: Step 1: Run over the list of top level directories using `find`, and create a corresponding directory structure eg `dirname.tmpvalue/C/` using `exec` or piping to `xargs` and using `mkdir -p`. Step 2: Run over the list of top level directories again and cp `populate.sh` into the `C` subdirectories. This is a bit sloppy, because the list of directories in theory could have altered between the two invocations of `find`, but this is not an issue in this case.               /usr/local/src/ccl/ccl-1.8/x86-headers$ ls -laR          [...]          ./jni:     total 96     drwxr-sr-x 3 faheem staff  4096 Jul 31 00:53 .     drwxr-sr-x 9 faheem staff  4096 Jul 31 00:53 ..     drwxr-sr-x 2 faheem staff  4096 Jul 31 00:53 C     -rw-r--r-- 1 faheem staff 19535 Jul 31 00:53 constants.cdb     [more .cdb files]          ./jni/C:     total 12     drwxr-sr-x 2 faheem staff 4096 Jul 31 00:53 .     drwxr-sr-x 3 faheem staff 4096 Jul 31 00:53 ..     -rw-r--r-- 1 faheem staff  148 Jul 31 00:53 populate.sh          ./libc:     total 1276     drwxr-sr-x 3 faheem staff   4096 Jul 31 00:53 .     drwxr-sr-x 9 faheem staff   4096 Jul 31 00:53 ..     drwxr-sr-x 2 faheem staff   4096 Jul 31 00:53 C     -rw-r--r-- 1 faheem staff 593125 Jul 31 00:53 constants.cdb     [more .cdb files]          ./libc/C:     total 20     drwxr-sr-x 2 faheem staff  4096 Jul 31 00:53 .     drwxr-sr-x 3 faheem staff  4096 Jul 31 00:53 ..     -rwxr-xr-x 1 faheem staff 10544 Jul 31 00:53 populate.sh


mutt: rendering html emails using w3m

I occasionally receive html messages and I would like to see whether text has been formatted or colored by the sender. I can simply navigate to the attachment list and open the text/html MIME type attachment with a web browser; however, for the sake of simplicity, I would prefer for the html to be rendered as formatted text within the pager. To do this, I have enabled html rendering by `w3m` with the following line in my `.muttrc` file: `auto_view text/html`. Additionally, I have added to my config file lines such as the following to highlight text that the sender may have designated as important: `color bold brightred default`. I expect that any text that was formatted as bold by the sender will appear as `brightred` in the pager. However, this formatting is not actually applied. Instead, I see only plaintext preceded by the statement: `[-- Autoview using /usr/bin/w3m -I 'ISO-8859-1' -dump -T text/html ''/tmp/mutt.html'' --]`. What am I doing wrong? How do I enable display of html-formatted messages within pager?


Is berkeley packet filter ported to linux?

I am doing some research to figure out what distro's of linux contain kernel packet filtering and are compatible with BPF. http://kernelnewbies.org/Linux_3.0 http://lwn.net/Articles/437981/ These two articles lead me to believe there is a package somewhere taht includes the libraries, and binaries? I am specifically looking for the "pfctl" command like I have in FreeBSD Thanks


Evolution Check mail when Window is closed

In Ubuntu/Gnome under the mail icon in the tray, there are chat, mail, and broadcast. opening the chat logs into your IM accounts and keeps you logged in when closing the main window. But it appears that for the mail (ie evolution), when you open it it logs in and checks mail, but stops checking mail as soon as you close the window. I cannot find the setting to keep checking mail even when the main window is closed. This seems like a basic function and I can't figure out why it isn't the default behavior. How do I keep checking mail when the main window is closed? Running Ubuntu 10.4 Lucid X64.


Why doesn't my Bash script recognize aliases?

In my `~/.bashrc` file reside two definitions:   1. `commandA`, which is an alias to a longer path   2. `commandB`, which is an alias to a Bash script I want to process the same file with these two commands, so I wrote the following Bash script: * * *               #!/bin/bash          for file in $@         do         commandA $file         commandB $file     done      Even after logging out of my session and logging back in, Bash prompts me with `command not found` errors for both commands when I run this script. What am I doing wrong?


Generate a certificate signing request for an SSL server

I'm running CentOS 6.2 LAMP and I've just purchased an SSL certificate via Namecheap that I'm trying to install on my server. This is the certificate I purchased. How do I complete this process without the use of a web host? So far, I have installed SSL using `yum install mod_ssl openssl` and I am now being asked for a CSR via NameCheap and to choose my Server type. Are `mod_ssl` and `openssl` both in there for Apache2? ![enter image description here](http://i.stack.imgur.com/fAwip.png) What is a CSR and how do I generate one? The tutorials I've found online are all using self signed certificates, which is not what I want.


How can I use ms-dos style wildcards with ls and mv?

I have the misfortune of coming from a MS-DOS background - but at least it makes me appreciate how much more powerful Linux is. I've been working on getting my Linux-Fu up to par, but there are a couple things that could be done with DOS that I'm not sure how to accomplish _most easily_ with Linux: **Renaming Multiple Files - Using Two Wildcards**               c:\> dir          Directory of c:\         file1.txt         file2.txt         file3.txt         file4.txt          c:\>rename *.txt *.bak          c:\> dir          Directory of c:\         file1.bak         file2.bak         file3.bak         file4.bak      I know I could use `find -exec` here but it it possible to use a shorter syntax - perhaps `mv` with some special flags or syntax? I guess the key to this is the **second** `*` wildcard as linux shouldn't have a problem with the first one (i.e. i know how to select the files i want to rename using wildcards) **Renaming a Single File - Using One Wildcard**               c:\> dir          Directory of c:\         file1.txt          c:\>rename file1.txt *.bak          c:\> dir          Directory of c:\         file1.bak      This would be especially helpful when renaming long and unwieldy file names. I thought perhaps I could use `mv file1.txt $1.bak` to end up with `file1.txt.bak` which would also be acceptable but I'm not sure you can reference a the `$1` parameter inline with a shell command. Again in this particular case it is just convenient of how ms-dos bastardizes the `*` wildcard to be used as a sort of capture / replace match for part of the filename. **Filtering Directory Listings with a Wildcard**               c:\> dir          Directory of c:\         file1.txt         file2.txt         file3.txt         file4.txt         text.txt         \temp       (directory)           c:\> dir file*          Directory of c:\         file1.txt         file2.txt         file3.txt         file4.txt          c:\> t*          Directory of c:\         text.txt         \temp       (directory)       I'm not sure what the right syntax for doing that with `ls` is, or if it is even possible. If I did something like `ls t*` it will recurse into directories starting with `t`. My workaround has either been using `find . --max-depth 1 -iname "t*"` or something like `ls -al | grep t` \- neither of which are as short and simple as `dir t*` is. Finally, I know I can set up aliases to make these long commands shorter, but I'd like to learn some out-of-the-box linux-fu for doing these things because sometimes you're connected to a remote system or working on a new machine. So how can I `mv` and `ls` files the same way that I used to `dir` and `rename` files?


/etc/fstab is mounting rw filesystem as read-only

A partition of my internal hard drive (not the root partition) I want to mount automatically on boot. I've been using /etc/fstab to mount my external backup drive automatically read-only, so this is the first drive I've tried to mount read-write with fstab. Here's the relevant line:               /dev/sda3   /media/^_^    vfat    rw,sync,user    0   0      Yes, my drive is a silly face. The `^` hasn't caused me any problems before, but maybe it's interfering with something here? Though I doubt it — the drive mounts fine except that it is read-only. Any reason why this would happen? I've tried restarting multiple times.


Preprocess packets send to/from interface

Is it somehow possible to intercept packet data just before it reaches an interface, and just after it is received? E.g. preprocess it and send it back on its way? I wanted to create a custom solution like this great program called vtun. It creates a virtual device that acts as an interface. This enables it to do all sorts of things like traffic compression, encryption, shaping etc. I was wondering if it can be done easier now (vtun is quite old...). My target OS is Ubuntu 14.04.


Creating the first backup

I heard that `rsync` isn't the best one when creating the first backup in terms of performance. Instead it is the best for the later backups. So I wonder what are some better commands for creating the first backup, and what your usages for them are? Thanks! Reference: > rsync isn't a good option for copying files to an empty destination. If > you're migrating data to an empty destination, you already know all files > need to be copied so the checking rsync does is counterproductive and > actually increases the time the transfer takes. This is mentioned somewhere > in the rsync man page or FAQ or something, I think.


Windows IDE for AIX application

I'm working on a C application based on AIX 5.3 using VI as an editor, I need a windows IDE (open source or commercial) that can help me:   * modify the source code more easily   * compile as if I'm under AIX   * manage multiuser access and synchronization I found out about Rational Developer for AIX and Linux, have you any other suggestions ?


How to stop Fork Bomb out of memory error - RHEL 6

I set up test VM to test the effect of fork bombs. So I edited the `limits.conf` as follows for `root` user:               root    hard         nproc  512      Now I drop a fork bomb like so:               :(){ :|:& };:      After this, after a while (which I believe it takes to reach the 512 limit), the following error shows up: ![example](http://i.stack.imgur.com/nB9Ep.png) This continues without stopping. Is there anyway to stop this without rebooting the machine?


After I run `yum install git` it shows the error               Error: Package: git-1.7.6.1-1.el5.rf.i386 (rpmforge)            Requires: libcurl.so.3     You could try using --skip-broken to work around the problem     You could try running: rpm -Va --nofiles --nodigest      Do I need to install libcurl.so.3 or download git from the web and install?


Is there a (relatively) safe way to run CLI commands from the web?

Since I started programming LAMP apps I wanted to develop an admin control panel for my boxes. (For fun and educational purposes, otherwise I would use something already existing in the market) But what always stopped me is I always heard exec() functions (the only way I know to achieve this) are the evil....you know: "don't use them", "it's bad coding", etc. What I never hear is a safer alternative for that purpose, so my question is: Is there any? Isn't enough to run that app in a dedicated web server, with a password protected document root? Well, that's my doubt.


How do I make a gnome window only available on some workspaces?

Disclaimer: Actually using Debian here, not Ubuntu, but I am knowledgeable enough to find the right packages, and compile my own if needed. I am a rather heavy user of the Multiple Desktops (workspaces) feature of gnome. However, I would like to get a lot more use out of my screen space by being able to tell a window to only show on, say, workspaces 2 and 3, instead of all workspaces. Is there an addon to gnome or a configuration I can set somewhere to allow for this behavior?


$BASHPID And $$ differ in some cases

I'm reading "BASH pocket guide of Oreilly". It said: > The process ID of the current Bash process. In some cases, this can differ > from $$. Above explanation , explained `$BASHPID` variable. **Question:** which cases?


How to enable nano-like whitespace highlighting in vim?

`nano` has a useful bit of syntax highlighting that actually highlights whitespace (tabs and spaces), under two conditions: (1) the whitespace does not have a non-whitespace character between either the last character or the beginning of the line and it, and (2) that the file is source code and not plain, plain text (as in a shopping list). How can I emulate this kind of behavior in `vim`?


I am trying to install curl in my ubuntu server as I was getting this error whenever I am compiling my C++ code -               fatal error: curl.h: No such file or directory      Below is the error:               username@phx7b02c-ee1b:~$ sudo apt-get install libcurl4-gnutls-dev     Reading package lists... Done     Building dependency tree     Reading state information... Done     Some packages could not be installed. This may mean that you have     requested an impossible situation or if you are using the unstable     distribution that some required packages have not yet been created     or been moved out of Incoming.     The following information may help to resolve the situation:          The following packages have unmet dependencies:      libcurl4-gnutls-dev : Depends: libldap2-dev but it is not going to be installed     E: Broken packages      I am not sure what wrong I am doing here? My kernel version:               username@phx7b02c-ee1b:~$ uname -a     Linux phx7b02c-ee1b 2.6.35-22-server #33-Ubuntu SMP Sun Sep 19 20:48:58 UTC 2010 x86_64 GNU/Linux      And also whenever I do like this - I always get the curl version               curl --version           curl 7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18 Protocols: dict file ftp ftps http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz      **Update:-** This is what I got -               /etc/apt/preferences     -bash: /etc/apt/preferences: No such file or directory          /etc/apt/sources.list.d/*.list     -bash: /etc/apt/sources.list.d/ebay-packages.list: Permission denied               /etc/apt/preferences.d/*     -bash: /etc/apt/preferences.d/*: No such file or directory               /etc/apt/sources.list     -bash: /etc/apt/sources.list: Permission denied


Do redirection operators always open file descriptors in parallel?

**1\. Consider snippet#1:**               $ cat test.txt > test.txt     cat: test.txt: input file is output file      It seems that `cat` makes its input file descriptor point to test.txt and then when it tries to set its output file descriptor to test.txt it throws the above error. Here it seems that `cat` is aware of the redirect operator and so proceeds to attempt to set the output file descriptor to test.txt **2\. Consider snippet#2:**               $ cat 1.txt     1:CAT     2:dog     $ sed 's/cat/CAT/g' test.txt     1:CAT     2:dog     $ sed 's/cat/CAT/g' test.txt > test.txt     $ cat test.txt # Note that test.txt is now empty     $      Here we see that `sed` opens test.txt (last argument) in read mode and at the same time sets `test.txt` as its file output descriptor. Also the `'>'` operator overwrites the contents of the file BEFORE `sed` starts to read from it. I am aware that commands in a pipeline execute in parallel but have not come across any info on how redirection operators behave. Any supporting links would be helpful.


Linux Mint 15: Oliva can't wake from suspend/hibernate?

As most issues people have had, I can't wake my laptop from suspend or hibernate mode. The computer goes to the lock screen and then freezes up to the point where the mouse won't move, forcing me to do a hard reboot. If you're interested in my `uname -a` output, here it is:               Linux Jason-PC 3.8.0-19-generic #29-Ubuntu SMP Wed Apr 17 18:16:28 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux      Here is the update of `inxi -G`:               Graphics:  Card: NVIDIA GK107GLM [Quadro K1000M]                 X.Org: 1.13.3 drivers: (unloaded: fbdev,vesa) FAILED: nouveau Resolution: 1600x900@60.0hz                 GLX Renderer: Gallium 0.4 on NVE7 GLX Version: 3.0 Mesa 9.1.4      * * * The computer now allows me to log in, but Linux becomes all glitchy and unusable. Here are some suspicious lines of `syslog`:               Oct 12 12:42:44 Jason-PC mdm[2830]: WARNING: failed to get file info for accountService pic file: Error when getting information for file '/var/lib/AccountsService/icons/jajmo': No such file or directory     Oct 12 12:42:44 Jason-PC mdm[2830]: WARNING: failed to get file info for accountService pic file: Error when getting information for file '/home/jajmo/.face': No such file or directory     Oct 12 12:42:44 Jason-PC mdm[2830]: GLib-GIO-CRITICAL: g_file_info_get_attribute_uint64: assertion 'G_IS_FILE_INFO (info)' failed     Oct 12 12:42:44 Jason-PC mdm[2830]: GLib-GIO-CRITICAL: g_file_info_get_attribute_uint64: assertion 'G_IS_FILE_INFO (info)' failed      As well as:               Oct 12 12:42:37 Jason-PC kernel: [   28.436602] EXT4-fs (sda5): re-mounted. Opts: errors=remount-ro


How do I fix a noisy input device (Internal Mic)? snd_hda_intel - debug included

As the title says, I'm having trouble with a very noisy audio input device - the internal mic or any plugged in mics. So far I've narrowed it down to an problem in ALSA since my debug info is showing a lot of "null" values. Can anyone help? Debug Info: http://www.alsa- project.org/db/?f=e0c6fb7e10624bf7691aa2b405cf0d3968e56c63 Exert from the debug:               model : (null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null)      Using Ubuntu 12.04 (x86_64)...


Screenshot of X from tty

Using Xvfb I can launch an application and take a screenshot. What I'm wondering about is how to capture from an existing (dormant) X session. Say from tty or over ssh. From what I understand windows are unmapped and does not exist to preserve resources. Are there some tool that can map existing windows, workspaces etc in a virtual windowmanager and take a snap? Or can one perhaps use `libx11` and create a snap by using `XShmCreateImage` or similar?


How to install GNOME 3 on RHEL6?

I am using Red Hat Enterprise Linux 6, it has Gnome GUI, but it is very simple and not like Ubuntu's GUI. I want to install/upgrade my GNOME Desktop Environment to its latest release. How can I do it?


How to change gravity (win_gravity) of a window?

Skype always pops messages at lower right corner of screen. Does changing widow gravity (win_gravity, defaults to NorthWest) for Skype alters pop-ups position (what I want to do actually)? Got no success under WMII for non-supported feature (WM doesn't support _NET_MOVERESIZE_WINDOW. Gravity will be ignored). Used `xprop` and `wmctrl` but no luck:               % wmctrl -vr skype -e "X,0,0,-1,-1" ### X: 0, 1, 2...     envir_utf8: 1     Invalid type of _NET_WM_NAME property.     Invalid type of WM_NAME property.     Using window: 0x016003c2     grflags: 775     WM doesn't support _NET_MOVERESIZE_WINDOW. Gravity will be ignored.      Couldn't figure out what to set with xprop:               % xprop -name skype -set "window gravity" "NorthEast"     % xprop -name skype -set "window-gravity" "7"     % xprop -name skype -set "win_gravity" "7"     % xprop -name skype -set "win_gravity" "NorthEast"     % xprop -name skype -set "win_gravity" "NorthEastGravity"      All gave me an error:               xprop: error: unsupported conversion for win_gravity (or whatever first -set arg was)


How can I securely login remotely to my Linux box over the internet?

I'm pretty much a Linux beginner, but this question has been on my mind. What's the simplest, most secure way to connect to my computer at home from work or from the library, &c? I'm running Mint 14. I'd like to connect from a Win or Linux setup. If this has already been asked, please delete this question. ALSO is there an option to connect if you can't install software on the computer you're connecting from? Is there a browser solution?


How does the kernel "give up" control to distribution-specific initialization?

I've always wondered how the kernel passes control to third-party code, or specifically distribution-specific code, during boot. I've dug around in GRUB's configuration files, suspecting a special parameter to be passed to the kernel to let it know what to do once it has booted successfully, but unable to find anything. This leads me to suspect there may be certain files on the root partition that the kernel looks for. I'd be grateful if someone could shed some light upon this matter. How do distributions achieve this?


Search and delete .Trash

I have 4 large USB devices with lots of backups collected over the years. I want to search for all .Trash folders and delete the contents on Fedora 17. I tried the following which failed:-                   # find . -name ".Trash*"-exec rm -rf {} \;         find: paths must precede expression: rm         Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]      Any hints appreciated!


How to execute a function in the .profile file

I have a function which is supposed to remove duplicate copies of directories from my `PATH` environment variable. I have created some duplicates so I can test it but I don't know how to: 1) put the script in the `$HOME/.bashrc` file This may seem stupid but I can't figure it out.


KTorrent: Moving data in a shell script

I'm trying to make a script for my magic folder that will move files to a seeding directory without KTorrent losing track of where the data is, similar to the "Move Data" context menu action in the application. I've poked around the dbus API and this is what I have so far:               for x in `qdbus org.ktorrent.ktorrent /core org.ktorrent.core.torrents`; do         name=`qdbus org.ktorrent.ktorrent /torrent/$x org.ktorrent.torrent.name`         if [ "$name" = "$1" ]; then             # Tell KTorrent to move the data to the seeding directory         fi     done      The problem is that I can't find anything in The API to do that, or even to set the new location after moving it manually. I played with the idea of doing it by directly manipulating to GUI to activate the context menu action (if I could get that far I'd be satisfied) and found this:               qdbus org.ktorrent.ktorrent /ktorrent/MainWindow_1 org.kde.KMainWindow.activateAction view_move_data      Which does what I want but always for the currently selected torrent, and I can't even figure out the first step to selecting the torrent I actually want to move. Any ideas?


perl + combine exec command with perl one liner line

I have the following short perl script `rename.pl`. How can I translate this script to one liner perl syntax? And how to combine the perl one liner in `find` command? ### `rename.pl`               #!/usr/bin/perl          $op = shift;     for (@ARGV) {       $was = $_;       eval $op;       die $@ if $@;       rename($was,$_) unless $was eq $_;     }      My current `find` syntax:               find /tmp -name "*$NAME*" -exec \       ./rename.pl \       's/\Q$ENV{NAME_THAT_WE_WANT_TO_CHANGE}\E/$1$ENV{NEW_NAME}$2/' {} +      The `find` syntax that I want to build:               find /tmp -name "*$NAME*" -exec \       < perl one liner line ....... > \       's/\Q$ENV{NAME_THAT_WE_WANT_TO_CHANGE}\E/$1$ENV{NEW_NAME}$2/' {} +


How do I disable copy permissions?

Can we set permissions, on a Linux box OR for a particular directory (Scientific Linux in my case) that, one can read files but cannot copy, move or delete them? **Update:** My Scenario is, We developed an GUI program which are having some images which we have created by consuming lot of time and efforts. Our directory structure is :               /GUI/program/GUI.exe     /GUI/images/A/A1.jpeg A2.png .... A200.png     /GUI/images/B/B1.png B2.png .... B200.png     .     .     /GUI/images/I/I1.png I2.png .... I200.png      No need to say `./GUI.exe` calls images which required by user to interact.   Now I need to hide `/GUI/images/*`.   Is there any way?


How to identify if there is some power saving setting that powered down a processor in Linux

I have a linux server that apparently has two Intel Xeon X5670. /proc/cpuinfo shows 12 CPUs but dmidecode shows only one CPU and the other one is in the Unpopulated status like it is showing that this is other CPU is because of the hyper threading. My server is a HP Proliant DL380 G7 and it can have up to two CPUs. My question is if my server has one or two physical CPUs or if there is a setting that is powering down the second CPU so it is showing as Unpopulated in the socket.               root@linux:~ # cat /proc/cpuinfo | grep processor processor       : 0     processor       : 1 processor       : 2 processor       : 3 processor      : 4 processor       : 5 processor       : 6 processor       : 7     processor       : 8 processor       : 9 processor       : 10 processor     : 11          root@linux:~ # dmidecode --type processor| egrep     "Version|Family|Manufacturer|Socket|Status"             Socket Designation: Proc 1             Family: Xeon             Manufacturer: Intel             Signature: Type 0, Family 6, Model 44, Stepping 2             Version: Intel(R) Xeon(R) CPU X5670 @ 2.93GHz             Status: Populated, Enabled             Upgrade: Socket LGA1366             Socket Designation: Proc 2             Family: Xeon             Manufacturer: Intel             Signature: Type 0, Family 0, Model 0, Stepping 0             Version:             Status: Unpopulated             Upgrade: Socket LGA1366


Accessing the iPhone file system via Linux/Unix

My old iPhone is semi-bricked. It turns off after a few minutes and doesn't get past the load screen. It has important data on it which wasn't backed up. I'm trying to access the hard-drive's contents without resorting to a hard-drive recovery company. Someone mentioned to me that you can use a Linux machine and the program Amarok to access the drive's contents. However, my phone wasn't jailbroken nor had the usb tethering option enabled. Plus, it had a passcode on it, so I'm guessing this method wouldn't work. Are there any other ways you can think of to access the drives contents using a Unix machine? Is there any way to take it apart and connect a cable directly to the hard-drive?


Linux workstation monitoring tools

I am currently working in a company that runs Linux (openSUSE 12.1) on the workstations (about 200 computers). I am looking for a tool or methods that could allow me to monitor them remotely, upgrade the system for all of them. I was thinking creating my own repository and then allow the computers to upgrade themselves through it. Does anyone work with these kind of tools ? Or could share his/her experience?


Apt-get Command not found for OpenDaylight

I am using OpenDaylight Ubuntu Mininet, when I want to do a `sudo apt-get install` it tells me               Sudo: apt-get: command not found      Here is the official code.               [mininet@opendaylight ~]\>sudo apt-get install openjdk-7-jre     sudo: apt-get: command not found


Preventing mounting some partition by user (gnome+udisk)

I'd like to prevent automounting one partition (known UUID etc. ) on one external harddrive. Others should be automounted. Distro is 'modern' (uses lots of beta software) and uses udisk+udev for mounting.


How to shut down or reboot a machine? [on different OSes]

What parameters do the "shutdown" command [or other command?] NEED, TO BE SURE that the machine reboots or shuts down for SURE? e.x.: version for Linux:               # cat /etc/SuSE-release     SUSE Linux Enterprise Server 10 (x86_64)     VERSION = 10     PATCHLEVEL = 4      e.x.: version for AIX:               $ oslevel -s     6100-05-01-1016      e.x.: version for SunOS:               cat /etc/release                       Solaris 10 10/09 s10s_u8wos_08a SPARC            Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.                         Use is subject to license terms.                            Assembled 16 September 2009     #       e.x.: version for HP-UX:               uname -r     B.11.11      Please share experiences also with shutdown/reboot [command didn't worked, because machine was unreachable, because it got "stuck" somewhere when trying to reboot - I mean not after rebooting, "before" the machine get's rebooted...so that why can it stuck in the start/middle of reboot the process ]


Replacing multiple lines in sed or awk

I'm trying to use sed or awk to replace 5 lines in a smb file but I just don't have any idea how to deal with the newlines.


bash: integer expression expected

I have a file out.csv I have to check if the name inputed by user exists in the file(comma separated) or not. I am taking name using read but while checking for equality I am getting error                   IFS=","         while read tname tnum             do                 if [ $tname -eq $name ]; then                     flag=1                     break                 fi             done < out.csv         echo "$ch"


What is meant with terminating a process normally?

In an examination it is stated: > Give 2 different ways that a process can terminate normally. Describe the > differences. What is meant with _terminate normally_?


LoJack protection and recovery for Unix/GNU/Linux running systems?

The LoJack theft protection and recovery system looks very impressive, especially that they will find and return your computer for you, but the software is for Windows and OS X only. Is there an equivalent service (including device retrieval service) for computers running GNU/Linux? Thanks.


How to configure graphics tablet to use just one monitor with XFCE?

The graphics tablet I use, works as expected with Gnome 3. I can use absolute positioning on my multi monitor setup. I've set one of my two monitors to be used with the graphics tables. This way, if you draw a circle, you actually get a circle. On XFCE, the tablet works fine, but I can't set it to use just one monitor. This means, that on my multi monitor setup, it is quite unusable. If you draw a circle, you get a pretty squashed ellipse. I haven't found a setting for that as of yet. The tablet is a "Waltop A".


Incoming/Outgoing seperation for VPN

My situation is that I want all my _outgoing_ connections from my Debian server to pass through a commercial VPN service I've subscribed to, but I still want to run public-accessible services on this server, and not have them pass through the VPN. That is, I have BIND9 (authoritative), SMTP, Apache, SSH etc running on this server, and I want _incoming_ connections to be able to reach these services without using the VPN. To clarify, I only want to use the VPN to hide my _outgoing_ connections, but still be able to answer requests on my _real_ IP for anything that has come in that way. To make matters even more complicated--I use BIND as both an authoritative server for my domain (on the public internet), and I also have recursion turned on so I can use it as the resolver for my local network (private ip range). Is it possible to VPN the outgoing DNS connections from BIND but still allow incoming requests to reach the authoritative bit? I gather this has something to do with `iproute2`, but I can't figure out the correct config. I'm on Debian 6.0.7. The VPN is OpenVPN.


netfilter's configuration to allow openvpn

I've got a debian server at home, that I use to have a VPN access to my home computers. I've redirected the openvpn port on the port 2000 : in my file "server.conf", I've added this :               #Server      mode server      proto udp      port 2000      With the connexion tracking, I allow all the related and response connexions. I've set up a rule, allowing everybody on the port 2000 :               iptables -t filter -A INPUT -p tcp --dport 2000 -j ACCEPT      however, it doesn't allow me to connect to my VPN (if I disable the firewall, I can connect without any problem). So, what haven't I understood? does openvpn need another port?


Calculate Apache's response time for last 10 seconds

I have the next apache's log format: `LogFormat "%h %l %u %t \"%r\" %>s %b %D \"%{Referer}i\" \"%{User-Agent}i\""` where's `%D` \- The time taken to serve the request, in microseconds. I want to know how can I get an average response time for last 10 seconds. Somehow a script or something should calculate the number of requests for last 10 seconds and summarize the response time. The result should be: number_of_requests_for_last_10_seconds / sum_of_request_time_for_last_10_seconds. Is that possible to do with awk or something? Thanks **UPDATE** Log's sample:               93.182.72.47 - - [19/Aug/2014:02:24:19 -0700] "GET /test/085 HTTP/1.1" 200 1006 445 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0"     119.232.112.148 - - [19/Aug/2014:02:24:19 -0700] "GET /test/003 HTTP/1.1" 200 3 84234 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36"     85.244.38.232 - - [19/Aug/2014:02:24:19 -0700] "GET /test/332 HTTP/1.1" 200 3 75760 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36"     236.131.91.87 - - [19/Aug/2014:02:24:16 -0700] "GET /test/006 HTTP/1.1" 200 32 3640965 "-" "python-requests/2.2.1 CPython/2.7.3 Linux/2.6.32-431.17.1.el6.x86_64"     112.241.72.130 - - [19/Aug/2014:02:24:19 -0700] "GET /test/042 HTTP/1.1" 200 50 1148668 "-" "python-requests/2.2.1 CPython/2.6.6 Linux/2.6.32-431.20.3.el6.x86_64"      **UPDATE2**               tailf /var/log/httpd/access_log | perl -MTime::Piece -lne '        BEGIN{$threshold = (localtime) - 10}        if (/\[(.*?)\] ".*?" \d+ \d+ (\d+)/) {          $d = Time::Piece->strptime($1, "%d/%b/%Y:%H:%M:%S %z");print $d->datetime." ".$threshold->datetime;          if ($d >= $threshold) {$t += $2; $n++}        }        END{print $t/$n if $n}' /var/log/httpd/access_log          ...     2014-08-19T03:54:42 2014-08-19T03:54:27     2014-08-19T03:54:43 2014-08-19T03:54:27     2014-08-19T03:54:43 2014-08-19T03:54:27     2014-08-19T03:54:42 2014-08-19T03:54:27     2014-08-19T03:54:44 2014-08-19T03:54:27     2014-08-19T03:54:44 2014-08-19T03:54:27     2014-08-19T03:54:43 2014-08-19T03:54:27     2014-08-19T03:54:43 2014-08-19T03:54:27     2014-08-19T03:54:43 2014-08-19T03:54:27     2014-08-19T03:54:44 2014-08-19T03:54:27     2014-08-19T03:54:43 2014-08-19T03:54:27     2014-08-19T03:54:44 2014-08-19T03:54:27     2014-08-19T03:54:45 2014-08-19T03:54:27     2014-08-19T03:54:45 2014-08-19T03:54:27     2014-08-19T03:54:44 2014-08-19T03:54:27     2014-08-19T03:54:44 2014-08-19T03:54:27     2014-08-19T03:54:44 2014-08-19T03:54:27     2014-08-19T03:54:44 2014-08-19T03:54:27     2014-08-19T03:54:45 2014-08-19T03:54:27     2014-08-19T03:54:44 2014-08-19T03:54:27     2014-08-19T03:54:44 2014-08-19T03:54:27     2014-08-19T03:54:44 2014-08-19T03:54:27     2014-08-19T03:54:46 2014-08-19T03:54:27


.ssh/config way to spectify pseudo-tty allocation and command execution (like screen)

Is there any way to specify, in `.ssh/config`, a command like:               ssh -t remote-host "screen -dR screen_name"      so I can easily access the remote `screen` session with `ssh remote-host`? Right now I solved this problem using a custom script:               $ cat ~/bin/sssh      #!/bin/sh          /usr/bin/ssh -t $1 "screen -dR ab"      `~/bin` stays first at `$PATH`, but it is unflexible and ugly. Also I would like to find way to implement host autocompletion for my custom script.


Image size with gscan2pdf and ImageMagick `convert` bloat

I scan all my important incoming physical-mail to PDF. I am trying to move this activity to Linux as part of the process of eliminating my dependence on Windows - where I used to use the excellent but deeply proprietary NitroPDF to do the scanning and conversion. So I have moved to using `gscanpdf` v 1.2.3 under Ubuntu 14.04 x_86_64 with a Canon LiDE scanner. If I scan an image in as 300DPI line-art it gives me a sensible file-size per page (about 150 kB) but for some reason although I have the page-geometry set to A4 in `gscan2pdf` the image always comes out as A0 (i.e. massive) which confuses a lot of readers and also makes printing of stuff awkward. So to illustrate I scanned a single page of A4:               tim@MERLIN:~/Documents/Scanned$ pdfinfo sample.pdf     Title:          LabourLeaflet     Subject:        NONE     Keywords:       NONE     Author:         001-MCC     Creator:        gscan2pdf v1.2.3     Producer:       PDF::API2     CreationDate:   Mon Aug 18 00:00:00 2014     ModDate:        Mon Aug 18 00:00:00 2014     Tagged:         no     Form:           none     Pages:          1     Encrypted:      no     Page size:      2380.8 x 3366.7 pts     Page rot:       0     File size:      117573 bytes     Optimized:      no     PDF version:    1.4      which as you can see gives page geometry of A0. Now I can convert the page geometry using ImageMagick's `convert` command thus:               tim@MERLIN:~/Documents/Scanned$ convert sample.pdf -page A4 -compress zip sample1.pdf     tim@MERLIN:~/Documents/Scanned$ pdfinfo sample1.pdf     Title:          sample1     Producer:       ImageMagick 6.7.7-10 2014-03-06 Q16 http://www.imagemagick.org     CreationDate:   Tue Aug 19 10:04:36 2014     ModDate:        Tue Aug 19 10:04:36 2014     Tagged:         no     Form:           none     Pages:          1     Encrypted:      no     Page size:      595 x 842 pts (A4)     Page rot:       0     File size:      689083 bytes     Optimized:      no     PDF version:    1.4      which as you can see gets the geometry right but causes the file to bloat to six times its original size. So:   1. Is there any way I can get `gscan2pdf` to respect the A4 page geometry I've set (ideal); or    2. Can I get ImageMagick to change the page size without bloat; or    3. Is there some other package I should be thinking about other than `gscan2pdf` and `convert`?


Why does the 'w' command show phantom logged in users?

On Linux (Fedora 14), the "w" command says this:               [USERNAME@PC ~] w      23:51:32 up 13 min,  7 users,  load average: 0,22, 0,42, 0,34     USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT     USERNAME        tty1     :0               23:39   12:49  30.71s  0.08s pam: gdm-password     USERNAME        pts/1    :0.0             23:39    9:39   0.01s  0.01s bash     USERNAME        pts/0    :0.0             23:51    0.00s  0.02s  0.00s w     [USERNAME@PC ~]       Why are there 7 logged in users when it only lists 3?


Why asterisk in command result in for loop is expanding?

I want to write a script that will run               git diff --name-status master..<BRANCH>      but when I run this:               for i in $(git branch | grep -v master); do        echo $i;     done      I get echo one directory because `git branch` echo asterisk (I have one directory in current directory)               * <SELECTED BRANCH>      Why `*` is expanded and how can I prevent that expansion? **UPDATE** : I can prevent this by using this:               for i in $(git branch | tr -d '*' | grep -v master);     done;      But why is this happening? Why I need to remove asterisk?


Can I compress a compressed file more?

I have access to a server via SSH, I download files from it over SFTP or HTTP. I want to pull down a 4.4GB .mkv file but I have limited bandwidth. I have used `zip`, `gzip` and `p7zip`, but the file is always 4.4GBs after the compression process. After fiddling with some of the CLI args I managed on one attempt to get the file down to 4.3GBs. I understand that the video file I have is a compressed h.264 file. I don't understand why I can't compress this further though (perhaps a question for another Stack-exchange forum) Is there some way I can compress at a byte level so the compression tool would be agnostic of the file contents (which I presume these other tools are anyway, but they aren't working). Is there perhaps some other way I can pull this fill down using less than 4.4GBs? I have no target file size in mind, but 4.3GBs for example is pointless (only 2-3%~ less).


Create a ssh key:               $ ssh-keygen -t rsa –P ""      Moving the key to authorized key:               $ cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys          bash: /home/user/.ssh/authorized_keys: No such file or directory


How updated and relevant is "The Linux Documentation Project"?

I have been advised by many senior Unix/Linux Administrators to go through "The Linux Documentation Project" on the site www.tldp.org. Its undoubtedly a very rich site, but I saw many tutorials (as seen here and here) to be more than 3 to 5 years old. I do know and understand that it is definitely worth to go through them thoroughly at least once, but I just want to know that if for topics which are important for me as a learning linux administrator, should I also search for latest articles on same topic on internet? Hope I do not offend any one with this question.


Cinnamon crashed after nvidia drivers installation

I have installed Linux Mint 15 Cinnamon and I have installed Nvidia drivers using this question. After rebooting the system this message appeared: > Cinnamon just crashed. You are currently running in Fallback Mode. Yes/No I am a newbie but I Googled about this problem and wasn't able to find solutions about this message appeared after driver installation. Also, since my notebook has two videocards, maybe I should install drivers in some special way. Please, guide me with any useful links, but again, I'm newbie and counting on the easy-understandable answers. My notebook configuration: ![screenshot](http://i.imgur.com/LpR8gdP.jpg)


Clipboard over SSH session through VIM

I have a server running SSH, when I edit a file with vim on the remote server, `:y+` doesn't work since the VIM binary on that linux system wasn't compiled with X support. (E488: Trailing characters) So how should I share the clipboard? Just transparently like what I do on local system


Error on application install: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory

When I executed a command to install an application, the following error occurred                 /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory      I was not aware on how to fix this problem. I found the following solution online:               yum install glibc.i686      or               yum install glibc.i386      But bad luck, this did not work at all. It was throwing the following error:               Loaded plugins: fastestmirror, refresh-packagekit, security     Loading mirror speeds from cached hostfile     Setting up Install Process     No package glibc.i686 available.     Error: Nothing to do      Again I tried to resolve this and got some solutions from net > Download glibc rpm packge for centos 6 and install them. I downloaded the following packages:               glibc-2.12-1.80.el6.i686.rpm     glibc-common-2.12-1.80.el6.i686.rpm     glibc-devel-2.12-1.80.el6.i686.rpm     glibc-headers-2.12-1.80.el6.i686.rpm     glibc-static-2.12-1.80.el6.i686.rpm     glibc-utils-2.12-1.80.el6.i686.rpm      And tried to install with following command:               yum install glibc.i686     rpm -U glibc-2.12-1.80.el6.i686.rpm     rpm -ivh glibc-2.12-1.80.el6.i686.rpm      None of them solved my problem. I got following message:               [root@s7 tmp_glibc]# rpm -ivh glibc-2.12-1.80.el6.i686.rpm         error: Failed dependencies:         glibc-common = 2.12-1.80.el6 is needed by glibc-2.12-1.80.el6.i686         libfreebl3.so is needed by glibc-2.12-1.80.el6.i686         libfreebl3.so(NSSRAWHASH_3.12.3) is needed by glibc-2.12-1.80.el6.i686      To resolve the dependency problem I tried to install "glibc- common-2.12-1.80.el6.i686.rpm", but again bad luck runs and gives error:               [root@s7 tmp_glibc]# rpm -ivh glibc-common-2.12-1.80.el6.i686.rpm     error: Failed dependencies:         glibc = 2.12-1.80.el6 is needed by glibc-common-2.12-1.80.el6.i686         libc.so.6 is needed by glibc-common-2.12-1.80.el6.i686         libc.so.6(GLIBC_2.0) is needed by glibc-common-2.12-1.80.el6.i686         libc.so.6(GLIBC_2.1) is needed by glibc-common-2.12-1.80.el6.i686         libc.so.6(GLIBC_2.1.1) is needed by glibc-common-2.12-1.80.el6.i686         libc.so.6(GLIBC_2.1.3) is needed by glibc-common-2.12-1.80.el6.i686         libc.so.6(GLIBC_2.10) is needed by glibc-common-2.12-1.80.el6.i686         libc.so.6(GLIBC_2.2) is needed by glibc-common-2.12-1.80.el6.i686         libc.so.6(GLIBC_2.3) is needed by glibc-common-2.12-1.80.el6.i686         libcap.so.2 is needed by glibc-common-2.12-1.80.el6.i686         libdl.so.2 is needed by glibc-common-2.12-1.80.el6.i686         libdl.so.2(GLIBC_2.0) is needed by glibc-common-2.12-1.80.el6.i686         libdl.so.2(GLIBC_2.1) is needed by glibc-common-2.12-1.80.el6.i686      Can anyone please help me by resolving this issue? More Details: Operating System: centos 6.3 Yum installed packege list:               [root@s7 tmp_glibc]# yum list installed glibc     Loaded plugins: fastestmirror, refresh-packagekit, security     Loading mirror speeds from cached hostfile     Installed Packages     glibc.x86_64


Open xfce "window manager" settings from command line

How do you open the window manager settings from the command line? I'm trying to modify my keyboard shortcuts, but when i click the applications menu -> settings -> window manager nothing happens. Hopefully by running it from the command line I can at least see if there has been an error. Edit: I was able to find keyboard shortcuts in the file `:~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce-keyboard-shortcuts.xml`. These match the values found from `xfconf-query -c xfce4-keyboard-shortcuts -l` as suggested below. Unfortunately, only one of the keyboard shortcuts that I am trying to disable is in there. For example, super + up key is maximising windows and is not a binding that I can find using the above technique. The reason why I am doing this is because the super key is stuck when trying to access via VNC. All solutions seem to suggest simply removing any bindings that use the super key.


Virtual Machine - Using bootable Windows drive as a client

I am trying to work out a solution that allows me to use a Windows client VM as a gaming environment that I can package as a resalable solution (I own a computer store). So far, it has been extremely challenging with todays solutions. (tomorrow it will be the norm I believe). At present, unless my other posted question regarding VFIO produces fruit, I am hoping a solution that would allow me to use a bootable windows 7 drive within the virt-manager environment. For instance, I would unplug the host linux drive, and attach a fresh drive and then completely install Windows 7 on that drive. I would then reattach the linux host drive and boot to it. I would then run virt-manager from a remote computer and wish to access that same physical drive and its boot environment from the virt-manager. Is this possible ? If so, it would allow me to access Windows 7 for all the 'normal stuff' like Office, basic development IDE etc but also be available for a multi-boot directly if it was to be used for gaming purposes and needed full on graphics. What sayeth the group ? Jay / CompuMatter


boot_archive file in solaris

Does anyone know what is that boot_archive file. It is located under /platform/sun4v/               /platform/sun4v>  du -sh * | sort -rn     342M   boot_archive ****     190M   failsafe     106K   lib     71K   bootlst     12M   kernel     1.0M   wanboot      It seemed too large to me. Any idea about it ?


A drive changes device file name after resuming from suspend (Linux Mint 14)

I'm running into a very odd problem: When I resume Mint 14 from suspend, one of my drives (/dev/sdc) changes letter / device file name (to /dev/sdd). `fdisk -l` shows that it has the same partitions, but anything mounted to it becomes inaccessible (even though they are mounted by UUID). This started happening after I installed another drive, which ended up becoming /dev/sda. Any ideas what's going on?


Need explanation on Resident Set Size/Virtual Size

I found that `pidstat` would be a good tool to monitor processes. I want to calculate the average memory usage of a particular process. Here is an example output:               02:34:36 PM       PID  minflt/s  majflt/s     VSZ    RSS   %MEM  Command     02:34:37 PM      7276      2.00      0.00  349212 210176   7.14  scalpel      Should I use the Resident Set Size (RSS) or Virtual Size (VSZ) information to calculate the average memory consumption? I have read a few thing on Wikipedia and on forums but I am not sure to fully understand the differences. Plus, it seems that none of them are reliable... So, how can I monitor a process to get its memory usage? Any help on this mater would be useful.