ext4: where did my free space go?

I just upgraded my Mageia 2 64bits VM to Mageia 3, and now my virtual disk free space is almost nil, even though less than 100% of the space is used. I am not an ext4 filesystem expert but I have extracted all relevant info that I could think of below: Output of `df -h /` command (:               Filesystem      Size  Used Avail Use% Mounted on     /dev/sda1        11G  9.9G     0 100% /      Just in case, same output without the `-h` option:               Filesystem     1K-blocks     Used Available Use% Mounted on     /dev/sda1       10645080 10353564         0 100% /      Now with the `-i` option:               Filesystem     Inodes IUsed IFree IUse% Mounted on     /dev/sda1        670K  338K  332K   51% /      In my understanding, I should have either:   -11G - 9.9G = 1.1G free space give or take rounding, up to .1G error margin, or   -11G - 9.9G - .05 * 11G = 0.55G (to take reserved blocks percentage into account (5% in my case - default distribution option) I am not even able to create any file. Also, I have deleted between 300-500 MB of files since I first ran into this "no free space" problem but the free space stills shows 0, even though I have been denied creating any file since (logged as root)! I have also rebooted system several times to account to deleted files that may still have been open while deleted, but got no change in reported free space. Finally, since the first occurrence of the problem, uptime has been at most 12 hours and `du -h /var/log` gives 38M so no log madness here. The first lines of `dumpe2fs` output give:               dumpe2fs 1.42.7 (21-Jan-2013)     Filesystem volume name:   <none>     Last mounted on:          /sysroot     Filesystem UUID:          45b03008-87fa-4684-a98a-bd5177e2b475     Filesystem magic number:  0xEF53     Filesystem revision #:    1 (dynamic)     Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize     Filesystem flags:         signed_directory_hash      Default mount options:    user_xattr acl     Filesystem state:         clean     Errors behavior:          Continue     Filesystem OS type:       Linux     Inode count:              685440     Block count:              2737066     Reserved block count:     136853     Free blocks:              88348     Free inodes:              339326     First block:              0     Block size:               4096     Fragment size:            4096     Reserved GDT blocks:      668     Blocks per group:         32768     Fragments per group:      32768     Inodes per group:         8160     Inode blocks per group:   510     Flex block group size:    16     Filesystem created:       Mon Aug 20 12:34:41 2012     Last mount time:          Wed May 29 14:29:19 2013     Last write time:          Wed May 29 14:09:03 2013     Mount count:              44     Maximum mount count:      -1     Last checked:             Mon Aug 20 12:34:41 2012     Check interval:           0 (<none>)     Lifetime writes:          66 GB     Reserved blocks uid:      0 (user root)     Reserved blocks gid:      0 (group root)     First inode:              11     Inode size:               256     Required extra isize:     28     Desired extra isize:      28     Journal inode:            8     First orphan inode:       46157     Default directory hash:   half_md4     Directory Hash Seed:      bc061f51-9d12-4851-a428-6fb59984118b     Journal backup:           inode blocks     Journal features:         journal_incompat_revoke     Journal size:             128M     Journal length:           32768     Journal sequence:         0x00015d7c     Journal start:            17427      Finally, I tried to toy with the reserved block counts just in case and here is the output:   Command: `tune2fs -m 0 /dev/sda1 && /usr/bin/df / && tune2fs -m 5 /dev/sda1 && /usr/bin/df /`               tune2fs 1.42.7 (21-Jan-2013)     Setting reserved blocks percentage to 0% (0 blocks)     Filesystem     1K-blocks     Used Available Use% Mounted on     /dev/sda1       10645080 10353576    291504  98% /     tune2fs 1.42.7 (21-Jan-2013)     Setting reserved blocks percentage to 5% (136853 blocks)     Filesystem     1K-blocks     Used Available Use% Mounted on     /dev/sda1       10645080 10353576         0 100% /      So apparently, by setting reserved blocks percentage to 0 I can recover about 285M but this doesn't match the worst case math including reserved blocks percentage as I understand it: 11G - 9.9G - .05 * 11G = 0.55G. Also doesn't tell me why after deleting 300~500M files I still can't create any file and free space shows as '0'. Remember that in any case, I'm logged in as root so I understand I should be able to use the reserved space (not a good idea but just as a principle). Any clue what's happening here? Can it be related (and how) to the huge amount of disk changes in both data size and files creations/deletions occurred during the distribution upgrade, or the `/usr` migration in Mageia 3 (can't see why, as `/usr` is on same filesystem as `/` (not a separate partition)?


Why are sort options -c (check if sorted) and -o (write to output file) not compatiable

I am sorting a large number of files one after another. Using `sort -o file file`. The for loop halted midway and before restarting I want to use sort's `-c` option to speedup sorting. But it says that `-co` options are not compatible. Why is it so?               sort --version     sort (GNU coreutils) 8.13          OS: Ubuntu 12.10


How to restore from a scrambled screen?

My screen is scrambled while reading some unexpected chars, ![enter image description here](http://i.stack.imgur.com/bMl0G.png) It happens in a local tty, so logging out won't help. Any ideas? Hopefully I don't have to reboot


LVM hangs while trying to create my root device node

Followup to How can I check for bad blocks on an LVM physical volume? The title mostly sums it up. Basically, I have a box partitioned with a regular `/boot` partition and then an LVM physical volume filling up the rest of the drive. In LVM I have one volume group with a root partition, a `/home` partition, and a swap partition. When LVM creates the device nodes in `/dev/mapper`, it creates the swap and home partitions fine. However, it usually hangs while trying to create the root device node. This happens from a live CD (`pvscan; vgscan; vgchange -ay` is what I used, IIRC) and also from the initial ramdisk, preventing the box from booting. I've also tried from the initrd recovery shell (`lvm pvscan; lvm vgscan; lvm vgchange -ay` is what I used, IIRC), which also fails in the same way. Sometimes, `vgchange -ay` actually creates the root device node (after a really long delay) but never exits, leaving me to kill it manually. When this happens I try to mount the device, but it always hangs indefinitely. Note that while both of those commands are running, the console spits out a bunch of messages about failed command "READ DMA" or something. I've run `smartctl -a /dev/sda` a couple times. Each time it gives a fair amount of errors about bad blocks (IIRC), but ultimately says that the drive is in good condition. I've put up a pastebin of `dmesg` on the affected machine. The logs come from booting an Arch Linux live cd, then running `pvscan; vgscan; vgchange -ay`. `vgchange -ay` hung forever this time, and I eventually killed it. Here's the end of `dmesg`, for posterity (and so I [don't use a pastebin2):               [   46.332920] end_request: I/O error, dev fd0, sector 0     [   58.503496] end_request: I/O error, dev fd0, sector 0     [167992.304649] EXT4-fs (sda1): recovery complete     [167992.304660] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)     [168092.874016] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)     [168163.318923] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)     [168459.839738] end_request: I/O error, dev fd0, sector 0     [168472.010337] end_request: I/O error, dev fd0, sector 0     [168614.642035] bio: create slab <bio-2> at 2     [168630.045526] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0     [168630.045649] ata1.00: BMDMA stat 0x65     [168630.045710] ata1.00: failed command: READ DMA     [168630.045787] ata1.00: cmd c8/00:08:00:10:10/00:00:00:00:00/e6 tag 0 dma 4096 in              res 51/40:08:00:10:10/00:00:00:00:00/e6 Emask 0x9 (media error)     [168630.046006] ata1.00: status: { DRDY ERR }     [168630.046071] ata1.00: error: { UNC }     [168630.066286] ata1.00: configured for UDMA/100     [168630.079493] ata1.01: configured for UDMA/66     [168630.079514] sd 0:0:0:0: [sda] Unhandled sense code     [168630.079517] sd 0:0:0:0: [sda]       [168630.079520] Result: hostbyte=0x00 driverbyte=0x08     [168630.079523] sd 0:0:0:0: [sda]       [168630.079525] Sense Key : 0x3 [current] [descriptor]     [168630.079530] Descriptor sense data with sense descriptors (in hex):     [168630.079532]         72 03 11 04 00 00 00 0c 00 0a 80 00 00 00 00 00      [168630.079544]         06 10 10 00      [168630.079549] sd 0:0:0:0: [sda]       [168630.079551] ASC=0x11 ASCQ=0x4     [168630.079554] sd 0:0:0:0: [sda] CDB:      [168630.079556] cdb[0]=0x28: 28 00 06 10 10 00 00 00 08 00     [168630.079567] end_request: I/O error, dev sda, sector 101715968     [168630.079665] Buffer I/O error on device dm-3, logical block 0     [168630.079775] ata1: EH complete     [168634.564062] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0     [168634.564165] ata1.00: BMDMA stat 0x64     [168634.564225] ata1.00: failed command: READ DMA     [168634.564301] ata1.00: cmd c8/00:08:80:0f:10/00:00:00:00:00/e6 tag 0 dma 4096 in              res 51/10:00:83:0f:10/00:00:00:00:00/e6 Emask 0x81 (invalid argument)     [168634.564527] ata1.00: status: { DRDY ERR }     [168634.564592] ata1.00: error: { IDNF }     [168634.584336] ata1.00: configured for UDMA/100     [168634.597559] ata1.01: configured for UDMA/66     [168634.597578] ata1: EH complete     [168639.087353] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0     [168639.087462] ata1.00: BMDMA stat 0x64     [168639.087521] ata1.00: failed command: READ DMA     [168639.087596] ata1.00: cmd c8/00:08:80:0f:10/00:00:00:00:00/e6 tag 0 dma 4096 in              res 51/10:00:83:0f:10/00:00:00:00:00/e6 Emask 0x81 (invalid argument)     [168639.087822] ata1.00: status: { DRDY ERR }     [168639.087886] ata1.00: error: { IDNF }     [168639.105791] ata1.00: configured for UDMA/100     [168639.118999] ata1.01: configured for UDMA/66     [168639.119017] ata1: EH complete     [168645.896986] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0     [168645.897095] ata1.00: BMDMA stat 0x64     [168645.897155] ata1.00: failed command: READ DMA     [168645.900373] ata1.00: cmd c8/00:08:80:0f:10/00:00:00:00:00/e6 tag 0 dma 4096 in              res 51/40:00:83:0f:10/00:00:00:00:00/e6 Emask 0x9 (media error)     [168645.906936] ata1.00: status: { DRDY ERR }     [168645.910263] ata1.00: error: { UNC }     [168645.931315] ata1.00: configured for UDMA/100     [168645.944504] ata1.01: configured for UDMA/66     [168645.944525] sd 0:0:0:0: [sda] Unhandled sense code     [168645.944529] sd 0:0:0:0: [sda]       [168645.944531] Result: hostbyte=0x00 driverbyte=0x08     [168645.944534] sd 0:0:0:0: [sda]       [168645.944537] Sense Key : 0x3 [current] [descriptor]     [168645.944541] Descriptor sense data with sense descriptors (in hex):     [168645.944543]         72 03 11 04 00 00 00 0c 00 0a 80 00 00 00 00 00      [168645.944554]         06 10 0f 83      [168645.944559] sd 0:0:0:0: [sda]       [168645.944561] ASC=0x11 ASCQ=0x4     [168645.944564] sd 0:0:0:0: [sda] CDB:      [168645.944566] cdb[0]=0x28: 28 00 06 10 0f 80 00 00 08 00     [168645.944578] end_request: I/O error, dev sda, sector 101715843     [168645.947946] Buffer I/O error on device dm-2, logical block 10485744     [168645.951439] ata1: EH complete     [168650.445911] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0     [168650.449275] ata1.00: BMDMA stat 0x65     [168650.452579] ata1.00: failed command: READ DMA     [168650.455873] ata1.00: cmd c8/00:08:00:10:10/00:00:00:00:00/e6 tag 0 dma 4096 in              res 51/40:08:00:10:10/00:00:00:00:00/e6 Emask 0x9 (media error)     [168650.462537] ata1.00: status: { DRDY ERR }     [168650.465714] ata1.00: error: { UNC }     [168650.486063] ata1.00: configured for UDMA/100     [168650.499326] ata1.01: configured for UDMA/66     [168650.499344] sd 0:0:0:0: [sda] Unhandled sense code     [168650.499348] sd 0:0:0:0: [sda]       [168650.499350] Result: hostbyte=0x00 driverbyte=0x08     [168650.499353] sd 0:0:0:0: [sda]       [168650.499355] Sense Key : 0x3 [current] [descriptor]     [168650.499360] Descriptor sense data with sense descriptors (in hex):     [168650.499362]         72 03 11 04 00 00 00 0c 00 0a 80 00 00 00 00 00      [168650.499373]         06 10 10 00      [168650.499378] sd 0:0:0:0: [sda]       [168650.499380] ASC=0x11 ASCQ=0x4     [168650.499383] sd 0:0:0:0: [sda] CDB:      [168650.499385] cdb[0]=0x28: 28 00 06 10 10 00 00 00 08 00     [168650.499396] end_request: I/O error, dev sda, sector 101715968     [168650.502757] Buffer I/O error on device dm-3, logical block 0     [168650.506189] ata1: EH complete     [168798.816025] usb 9-2: new high-speed USB device number 2 using ehci-pci      This is just the end of the log, where the errors began, because I hit the post limit. To see the whole thing, look at the pastebin. Apologies for not giving specific information, but I'm not in front of the affected box right now.


Why can't I specify my root fs with a UUID?

My system boots OK with this in my GRUB 2 config:               linux   /bzImage root=/dev/sda2 init=/usr/lib/systemd/systemd ro      But if I replace `/dev/sda2` with the corresponding UUID:               linux   /bzImage root=UUID=666c2eee-193d-42db-a490-4c444342bd4e init=/usr/lib/systemd/systemd ro      then it fails during boot:               kernel panic - not syncing: VFS: unable to mount root fs on unknown-block(0,0)      The UUID appears to be correct:               # blkid     /dev/sda1: UUID="97ac3744-39de-4d6d-9a81-e3a3ea08a8bb" TYPE="ext2"      /dev/sda2: UUID="666c2eee-193d-42db-a490-4c444342bd4e" TYPE="ext4"       Why doesn't it work? Is it because I'm not using an initramfs? This is x86_64 Gentoo Linux with kernel 3.10.7. I'm using a MBR partition table on `sda` and a GUID partition table on `sdb`.


how to convert number to time format in shell script?

I want to cut a video into about 10 minute parts like this.               ffmpeg -i video.mp4 -ss 00:00:00 -t 00:10:00 -c copy 01.mp4     ffmpeg -i video.mp4 -ss 00:10:00 -t 00:10:00 -c copy 02.mp4     ffmpeg -i video.mp4 -ss 00:20:00 -t 00:10:00 -c copy 03.mp4      With `for` it will be like this.               for i in `seq 10`; do ffmpeg -i video.mp4 -ss 00:${i}0:00 -t 00:10:00 -c copy ${i].mp4; done;      But it works only if duration is under a hour. How can I convert number to time format in bash shell?


Why do `cp` and `rm` treat directories separately?

Why do tools like `cp` and `rm` treat directories separately from regular files? They both require the user to explicitly specify she wants a recursive behavior, or else they won't deal with directories at all. My first interaction (a while back) with computers was on a Windows/GUI/point- and-click/drag-and-drop environment, it always seemed natural that these operations would behave the same, regardless of the target. This behavior particularly frustrates me when I give commands with wildcards. What if I want to remove everything in a directory (`*`) except for **non- empty subdirs**? I can only imagine that this is some sort of security feature to prevent the user from shooting herself in the foot, but this contradicts my understanding of a few Unix principles:   * Unix doesn't usually protect the user from herself. It has always assumed the user knows what she's doing.   * For Unix everything is a file. Isn't a directory just another file? Why are they treated differently? My questions:   * Is this behavior stemming from a technical limitation or is it a deliberate choice? And in case of the latter,   * are there any historical accounts of the reasons which motivated this choice?


Best tool for monitoring server usage

I was just wondering what the best tools for retracing logs and what logs I should be checking to work out what's going wrong with a server, or what the client has executed to get the server into it's current state. I know you can use the .bash_history file, but it seems to only list bash commands, I think. As far as I'm aware. I was just wondering if there's any handy tools that I could be using to aid me in log mining and such like? Also, I need to monitor FTP usage and such like as well, so I know what they've deleted by accident and such like. Just anything to do with general server maintenance. I'm using CentOS 6.3 Thanks.


Why are files in the map 'Desktop' not shown on the desktop?

As far as my memory goes, the map 'Desktop' contains the files which are shown on your desktop. However, my desktop is empty, while having files present in the map. Yes, I mostly prefer an empty desktop, but it seems strange to me to be _unable_ having anything on the desktop. And sometimes it just comes in handy to have certain files close. So, my question is: How to enable having files on my desktop again? I am using Debian Wheezy with Gnome 3. Edit: I am not interested in installing different desktop environments, just in a solution to get this working in Gnome3.


How to get the distribution of file sizes?

I'd like to know the distribution of file sizes under a certain directory. Please note: _distribution of file sizes_ , not _size of a directory_. That means I want to know there are 25 files of 60 bytes, 50 files of 12587 bytes, 2 files of 57kbytes, and so on. Bonus points if the data could be gathered via command line (eg. on a remote system) in a format easily useable to produce graphs.


What is the Mode_switch modifier for?

Playing with `xmodmap` I encountered a modifier key I hadn't heard of: `Mode_switch`. It seems to have something to do with inserting special characters. I assigned it to a key but it seems to have no effect. What is it for? Is it different from `ISO_Level3_Shift` (Alt Gr)?


'ls -l' file timestamp format

When I issue the command:               ls -l      The file/directory modification timestamp column (specifically the month part) is displayed in the native language of the country I'm based in instead of English. How can I force `ls` to use another 'culture' in that column? Example: ![enter image description here](http://i.stack.imgur.com/9sigZ.png)


Is swap an anachronism?

I've used unix for quite a while, and for the last couple years I've felt like swap is an anachronism, but I'd be curious what other folks think. My argument is roughly this (assuming no global ulimit or twiddling of OOM settings):               There is little value in swap because if you need to swap out to disk,      odds are it's going to be a vicious cycle where an app will continue      to eat not only real memory, but swap as well until it gets OOM      reaped (_if_ it gets OOM reaped).           If you have swap enabled, it will only prolong this death march to      the detriment of other processes - and in the worst case where the     process is not OOM reaped in a timely manner, grind the system to     a halt.          Without swap, it will probably get OOM reaped sooner (if at all)      For any service that is tuned for performance, I would think that understanding the upper limits of it's resource usage would be key to tuning it in the first place, in which case you know how much you need. I can't imagine many situations (some, but not many) where you'd suspend a running process and it could swap out to make room for other things, but you'd still lose your sockets if you did that, so forcing a core-dump via gcc or copying the memory out by hand would be functionally equivalent. I definitely wouldn't want swap on an embedded system (even though it may have a smaller available ram), if you run out of ram I'd rather have my process die than tear up a million-write-per-sector flash memory drive over a weekend by wear-leveling the sectors down to the nub. Any unix-beards out there have any compelling reasons to keep swap around? UPDATE answers && analysis:   * **CONFIRMED?** - fork() requires the same amount of memory for the child process as the parent Modern fork() is copy-on-write for children on POSIX (in general), but Linux and FreeBSD specifically, and I'm assuming OSX by extrapolation. I consider this part of the anachronistic luggage that swap carries with it. Curiously, This Solaris article claims that even though Solaris uses Copy-on- Write with fork(), that you should have at least **2x (!)** the parent process size in free virtual memory for the fork() not to crap out in the middle. While the Solaris element _somewhat_ busts the argument that swap is an anachronism - I think enough operating systems correctly implement CoW in such a way that it's more important to dispel the myth than to mark it as further justification for swap. Since. Lets face it. At this point the people who actually use Solaris are probably just Oracle guys. No offense Solaris!   * **CONFIRMED** - tmpfs/ramfs files can go to swap as a convienence when tmpfs/ramfs fills up Don't use no-limit tmpfs/ramfs! Always explicitly define the amount of ram that you want tmpfs/ramfs to use.   * **PLAUSABLE** - Have a little swap 'just in case' One of my old bosses used to have a great saying, 'you don't know what you don't know' - essentially, you can't make a decision based on information you don't have yet. This is a plausible argument for swap to me, however - I suspect that the types of things you'd do to detect if your application is swapping out or not would be heavier than checking to see if malloc() succeeds or catching the exception from a failed new(). This may be useful in cases where you're running a desktop and have a bunch of random things going on, but even still - if something goes nuts I'd rather it be OOM reaped than diving into swap-hell. That's just me.   * **BUSTED!** - On **Solaris** , swap **is** important for a couple of reasons tmpfs - states _The amount of free space available to tmpfs depends on the amount of unallocated swap space in the system. The size of a tmpfs file system grows to accommodate the files written to it, but there are some inherent tradeoffs for heavy users of tmpfs. Tmpfs shares resources with the data and stack segments of executing programs. The execution of very large programs can be affected if tmpfs file systems are close to their maximum allowable size. Tmpfs is free to allocate all but 4MB of the system’s swap space._ Solaris facts and myths about swap - states _Virtual memory today consists of the sum total of physical RAM and swap space on disk. Solaris DOES NOT require any swap space to be configured at all. If you choose this option, once RAM is full, you will not be able to start new processes._. I'm unsure if this means that the maximum virtual map you can create is **ram+swap** , or if you could still do something like mmap() a file larger than ram and rely on mmap()'s lazy initialization.. While you can probably run Solaris these days fine without swap, it seems like it's less friendly about it than other POSIXy operating systems.   * **BUSTED!** Popular Linux hibernation tools appear to rely on swap By default, TuxOnIce looks like it relies on swap for hibernation - although other backends exist. However, if you're not running a box that needs to hibernate, I would still stand behind the statement that 'swap is anacronistic on linux'


Best way to find out what Linux Version is used on a Webserver

Is this feasible? Can I find out which distro is used to host specific webpages? Whois doesn't have info for this.


Mounting multiple devices at a single mount point on Linux

Is there a way to mount multiple hard drives to a single mount point? Let's say I run out of space on `/home` and decide to add an extra hard drive to the computer. How do I scale the space on a mount point? If I use RAID, can I add drives on the fly to increase space as I run out of them? Is there an alternative to using RAID if I am not interested in maintaining a high level of redundancy?


Ssh keeps asking for passphrase several times

I have a remote machine, with which I have set up public-key ssh auth - that is, I can ssh to it without typing in password each time. And I have a set of actions in a script, which use that ssh connection. But when I run that script via cron, it keeps asking passphrase for each action - and since I have more that ten of them, it gets quite boring. I tried running ssh-add before those actions and got:               Could not open a connection to your authentication agent.      What can I do to reduce number of passphrase retypes?


How to Suppress messages generated by an application being sent to my terminal window?

When I launch an application from terminal related to the window system, for example gnome or kde, then usually these applications send all sorts of junk messages in my terminal. How do I make these applications shut up? For example if I type:                okular somepdf.pdf &       a window which shows the pdf file pops up and I can read the pdf next to my terminal, and when I am done I close. Here is a typical example:               :~$ cd Documents     :~/Documents$ okular equi.dvi &     [1] 5823      and when I close it sends this junk to the terminal:               :~/Documents$ okular(5823)/kdeui (kdelibs) KXMLGUIClient::~KXMLGUIClient: 0x2322528 deleted without having been removed from the factory first. This will leak standalone popupmenus and could lead to crashes.      d          d: command not found     [1]+  Done                    okular equi.dvi     [1]+  Done                    okular equi.dvi     :~/Documents$       The only thing I would like to see is:               :~$ cd Documents     :~/Documents$ okular equi.dvi &     :~/Documents$      Perhaps that message was some bug, I do not care and I do not want to know about it. Is it possible to suppress these messages?


running an executable in parallel by dividing the input directory tree

Commands like `find` and `grep` would benefit greatly if they were to run in parallel. Is there a utility or a program that takes a command as an argument and makes it run in parallel by running multiple threads of the command, each on a subset of the directory tree?


Why are shared libraries executable?

Why have almost all the shared libraries in `/usr/lib/` have the executable permission bit set? I don't see any use case for executing them. Some do manage to hook-up some form of `main` function to print a short copyright and version note, but many don't do even that and segfault upon execution. So, what's the point of setting this `x`? Must all library packagers do that? What will happen if I `dlopen()` a shared library that has `0644` permissions?


Second loopback network interface (for netem)

I would like to add a second loopback network device on Linux, so that I have `lo` and (e.g.) `lo2`. This is so that I can use netem to simulate a throttled network over lo2 without compromising my standard loopback interface. Note that I can not use an alias interface here (such as lo:1) since netem will affect the underlying (lo) interface, not the interface alias. How can that be done?


Parameters of optimization TCP / IP in Linux Mandriva

In the registry of `Windows XP` can find the following options to enable optimizations for `TCP/ IP`:               - MSS;     - TCP Rx Window Size;     - SACK (Selective Acknowledgment);     - ECN (Explicit Congestion Notification);     - TCP Window Scaling;     - TCP Timestamping;     - PMTU Discovery;     - TCP Fast Retransmit;     - TCP Fast Recovery;     - Delayed ACK.      For example, under `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\interfaceGUID` on parameter `IPAddress [REG_MULTI_SZ]` can find the interface and configure a specific network card. I can manipulate the values of the parameters **programmatically** and see the results. I am interested in a list of similar parameters in `Linux Mandriva`. And yet - can i change its from a `Java`-code? Thank you!


How can I disable automatic IPv6 neighbor route advertisement on a router?

I work for an ISP that's in the process of making its infrastructure IPv6-ready. Our core routers already have a working setup, but a large portion of our fiber customers are behind a router running Debian Squeeze. Enabling IPv6 capabilities on linux wasn't a problem, however, once we assigned an IPv6 address and working routes to the linux router it immediately transmitted working addresses and routes to all systems behind it, which kind of wasn't what we want. Our current plan involves setting IPv6 addresses manually on all systems, but I can't seem to find the switch or option to tell the kernel to not perform router advertisements. Any suggestions?


OMXplayer and HDMI audio on the Raspberry Pi

When I try playing video using the command: `omxplayer -o hdmi` sound will not work unless I also include the `-r` switch. The only problem with this is when the video is done it leaves a black screen up and I am unable to use the device until restart. Anyone have any ideas?


How to move the files based on Year

I need to move files based on a year. I used the `find` command               find /media/WD/backup/osool/olddata/ -mtime +470 -exec ls -lrth {} \;|sort -k6      but for this command to successfully execute i need to know the exact `mtime` now 470 is just a guess. Means if I can give the year 2012 it gives me files only related to 2012. So i need advice on how to > Find files based on year e.g 2012 and move them to other directory.               OS release 5.2          FIND version     GNU find version 4.2.27     Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION SELINUX


bash_profile stops after file call

I have the following code in my .bash_profile that automates a couple of file write tasks I need to run.               # Compile cron jobs for server     do_cron()     {     cd ~/Sites/MAMP/mywebsite/.ebextensions && sed 's/WEBSITE_URL/mywebsite.com/g' ./cron_jobs_sample.txt > ./cron_jobs.txt     }          # Compile config file so that we push to the right server     do_config()     {     cd ~/Sites/MAMP/mywebsite/.elasticbeanstalk/ && echo "[global]     ApplicationName=xxxx     DevToolsEndpoint=xxxx     EnvironmentName=xxxx     Region=xxxx" > ./config     }          # Do compiling     alias websitecompile=do_cron && do_config      I simply call:               $ websitecompile      And it runs my tasks. The issue is it runs `do_cron` just fine, but `do_config` does not run. If I switch my code to run `do_config` first, both run fine.               alias websitecompile=do_config && do_cron      So something in `do_cron` seems to kill the process. I want to keep expanding on these commands so is there any way to stop it from stopping. I am running Max OS X Mavericks. Any ideas on what I can do to make this work as expected?


Which amongst the given option is TRUE about login shell?

Which amongst the given option is TRUE about the login shell?   1. The login shell varies every time the user logs in. The kernel decides on the availability of the shell during login.    2. The login shell is fixed for all the users in a particular system. It cannot be configured.    3. The login shell can be configured by the administrator in /etc/passwd file.    4. None of the above.


ext4 used space (not -m option, not deleted files)

I'm a bit puzzled about the way ext4 reports used space. On a new Debian wheezy (testing) installation, I consistently got about 1GB extra space used with a 60GB SSD, when compared to `du`. I then network booted that computer and mounted the SSD. The network booted OS (Debian squeeze) shows only 180MB extra space used on the SSD. The journal is 128MB, so there's not much extra beyond that anymore. What is the extra used space reported by `df`, when it's not space reserved for root or deleted files? Using Google mostly results in those usual causes, which I have ruled out. And why does that amount differ on the same filesystem when mounted on different operating systems? I tested this by re-installing, and the extra usage was again ~1GB on the wheezy installation, and 180MB when I network booted and mounted that SSD. On XFS and btrfs, the extra reported usage seems negligible. I realize that the filesystem needs some overhead, but it's inconvenient when that overhead is mixed up with the real usage. Here are some detailed outputs. ### df               $ df -m on wheezy     Filesystem              1M-blocks  Used Available Use% Mounted on     rootfs                      57132  1567     52703   3% /     udev                         7899     0      7899   0% /dev     tmpfs                        1581     1      1581   1% /run     /dev/mapper/ssd-kvmhost     57132  1567     52703   3% /     tmpfs                           5     0         5   0% /run/lock     tmpfs                        3162     0      3162   0% /tmp     tmpfs                        3162     0      3162   0% /run/shm      ### du               $ du -sm /     592     /      `tune2fs` shows Inode count to be 3670016 and size 256, which indeed explains almost all of the used space. I just don't understand why this isn't subtracted from Size, since the inodes are statically reserved. Counting it as space and then always counting it as used doesn't make much sense. Here's the output for the very same filesystem, from the network booted Debian squeeze:               aufs                      7905        46      7859   1% /     tmpfs                     7905         0      7905   0% /lib/init/rw     udev                      7900         1      7900   1% /dev     tmpfs                     7905         1      7905   1% /dev/shm     172.17.172.127:/storage/private/tftp/debian-live-6.0.3-amd64-lxde-desktop                              24737     17448      7289  71% /live/image     tmpfs                     7905        46      7859   1% /live/cow     tmpfs                     7905         0      7905   0% /live     tmpfs                     7905         1      7905   1% /tmp     /dev/mapper/ssd-kvmhost                              56337       772     52703   2% /mnt      And just for confirmation, du -sm / on the network booted OS:               592     /      Maybe the older kernel wisely doesn't count the statically reserved inode space as usable, and thus doesn't have to show it as used? The difference is 795MB in both Size and Used, almost all of the space needed for the inodes. What's the 180MB then? If that is also static, wouldn't it be optimal to also subtract that from Size? Then `df` could actually show real usage, like other filesystems seem to do. The way I see it, if my filesystem needs a static amount of overhead, then it just provides less usable space than some other filesystems for the same amount of absolute space. Shouldn't df reflect that, and also show how much of the _usable space_ I have used?


Script to choose editor to open file based on the argument

I'd like to run my script `fastex` with two possible arguments (`g` or `t`), like `fastex g`. Based on the argument I want to call `geany $file` or `texstudio $file`. This is to choose the editor. I tried               editor=$1     if ["$1" = "g"]; then     geany "$file".tex     exit 1     else     linha=$(wc -l < "$file".tex)     texstudio --line $linha  "$file".tex     exit 1     fi      but the outuput of `fastex.sh g` is `/usr/bin/fastex.sh: 31: [g: not found` and it always opens `texstudio`. The same if I pass `t`.


i386 libtool conflicting with x86_64 libtool when installing Handbrake

I've been trying to install Handbrake on centos 5.8 with the help of some different guides. I'm running x86_64, and whenever I try to install packages necessary to build the binary, the arch ends up i386:               Total size: 19 M     Is this ok [y/N]: y     Downloading Packages:     Running rpm_check_debug     Running Transaction Test     Finished Transaction Test          Transaction Check Error:       file /usr/bin/libtool from install of libtool-1.5.22-7.el5_4.i386 conflicts with file               from package libtool-1.5.22-7.el5_4.x86_64          Error Summary      I've already downloaded `HandBrake-0.9.6.tar.bz2` and untared it. The whole log is available here


IPTABLES to block all outgoing connections except selected networks

There is a firewall/gateway machine with eth0 Public and eth1 Private network (`192.168.1.0`). I would like to block all OUTPUT connections for private users (eth1) except couple of networks like: `123.123.123.0/24`, `91.12.31.0/24` etc. as they are in our city network. There are a lot of questions here about iptables but I couldn't find a way to resolve this issue. It might also happen that some user, say, 192.168.1.10 would not be restricted to those networks. If I do:               IPTABLES -P OUTPUT DROP     IPTABLES -A OUTPUT -d 123.123.123.0/24 -s 192.168.1.51 -j ACCEPT     ...that would make me adding rules per user multiplied by number of networks      So is there any way to GROUP those city networks as well?


recover corrupted directory from ext3 partition

It's my mounted directory that I want to restore folder `ostani`. It contains many PHP, CSS, Javascript, etc. files. How can I access it? I use `dd_rhelper` to create an image and tried to `fsck` to repair it. But it's remove corrupted folder.               root@asgharserver:~# ls -la /root/oldhard/     ls: /root/oldhard/bina: Input/output error     ls: cannot access /root/oldhard/ostani: Input/output error     total 1187011436     drwxr-xr-x  26 root      root            4096 Jan  3 00:56 .     drwx------   4 root      root            4096 Jan 11 12:20 ..     drwxr-xr-x   2      1007      1007       4096 Aug 19 14:14 afshin     ?--------- 512       512  33554432 2256582144 Jan 24  1971 bina     drwxr-xr-x   6 superuser superuser       4096 Nov 15 07:15 mahalleha     d?????????   ? ?         ?                  ?            ? ostani     drwxr-xr-x   2      1012      1012       4096 Aug 26 08:15 tvasr


midnight commander: settings for mcview not honored

`Midnight Commander` supports skins, where custom colors can be defined. I have created my own skin with custom colors. However, I am unable to change the color for the internal viewer (`mcview`). Whatever I define, my colors are being ignored and default colors are used instead. snippet from my skin `.ini` file is below:               [core]         _default_=lightgray;blue         selected=black;cyan         marked=yellow;blue         .....          .....          [viewer]         _default_=lightgray;black         viewbold=yellow;blue         viewunderline=brightred;blue         viewselected=yellow;cyan          .....      The `_default_` parameter in the `[viewer]` section is completely ignored. Whatever I put there, the displayed colors will be the ones defined in the '[core]' section (lightgray;blue). In other words, I am unable to override the default colors in `mcview`. Can somebody please advise, how I can define different colors for the internal viewer?


What is the routing behaviour when two or more default routes?

I have two ISP at the time, connected to the same machine. I added both of them in the routing table as default. However, only one connection is used.               $ route     Kernel IP routing table     Destination     Gateway         Genmask         Flags Metric Ref    Use Iface     0.0.0.0         192.168.1.1     0.0.0.0         UG    303    0        0 eth0     0.0.0.0         192.168.0.1     0.0.0.0         UG    303    0        0 eth1     192.168.1.0     0.0.0.0         255.255.255.0   U     303    0        0 eth0     192.168.0.0     0.0.0.0         255.255.255.0   U     303    0        0 eth1      How can I balance the traffic load between the two ISP?


How to get a clean environment in a ksh shell?

I need to get rid of all the environment variables in a Ksh shell. I can fork a new instance, but it will inevitably source some init files (as far as I know `.profile`, `.kshrc`). Is there a way to bypass the sourcing of those files and any other file that might be read at init time?   * Ksh version: Version M-11/16/88i   * OS: Solaris 10 Hope I'm clear enough.


How to put some keyboard layout aside from layout switching ring?

What I need is to   1. switch between Russian and English layout with my favorite shortcut (namely `Shift-CapsLock`)   2. switch to Belarusian layout with another shortcut (say, `Ctrl-RightShift`, but actual binding doesn't matter)   3. while Belarusian layout is active, switch back to Russian/English with `Shift-CapsLock` Is it possible with xkb at all? If so, how can this be done?


.bashrc doesn't get executed

I have a user (non-root) which has a `~/.bashrc` file with some aliases in it. But it doesn't look like the file is executed at log in time. If I do `source ~/.bashrc` then it does what it's supposed to. But isn't `~/.bashrc` supposed to be executed every time I log in? Permissions are set to 644 (same as my root's `.bashrc`, which works fine). File is owned by the user in question.


Broken sudo on amazon web services ec2 linux centOS

So I had no idea of the dangers of messing with the /etc/sudoers file, and was just trying to make a simple change in there. However, I seem to have put something with incorrect syntax in there, causing this problem:               $ sudo     sudo: >>> /etc/sudoers: syntax error near line 122 <<<     sudo: parse error in /etc/sudoers near line 122     sudo: no valid sudoers sources found, quitting     sudo: unable to initialize policy plugin      I can't edit the /etc/sudoers file anymore because I don't have root access. One fix I see online is to use:               $ su -      and enter the root password. However, this amazon ec2 box doesn't seem to HAVE a root password, thus preventing me from using `su -` The other thing I see is rebooting the computer and doing some single user stuff which allows you to reset the password. Big problem is that this is amazon ec2 and I'm just SSHing into the box, I don't have physical access. Question, am I completely screwed or is there a possible workaround? This is not Ubuntu, it appears to be CentOS. I also understand now about `visudo`, but the site I had gotten the change from didn't mention that.


Cross-process dup on Linux

I'd like to dup a file descriptor running in an unrelated process on Linux. I know about _sendmsg(2)_ and `SCM_RIGHTS` (e.g. http://stackoverflow.com/questions/4489433/sending-file-descriptor-over-unix- domain-socket-and-select) , but that works only if the other process is cooperating. I need a solution which doesn't need active cooperation from the other process. I also know that I could create the file descriptor first, keep a copy, and then create the other process, but I need a solution in which the other process creates its own file descriptor. I can see the file descriptor:               $ ls -l /proc/13115/fd/3     lrwx------ 1 pts pts 64 2013-05-04 13:15 /proc/13115/fd/3 -> socket:[19445454]      However, `open("/proc/13115/fd/3", O_RDWR)` executed in another process returns the error _No such device or address_. Is there something else that would work? Probably with _ptrace_?


Linux Mint: Hibernate does not work

I have tried hibernate multiple times on my Linux Mint 14. It does not seem to work. I have added some log which I think may be useful. Can someone help me diagnose the problem? laptop model: I: TOSHIBA Satellite R630/Portable PC, BIOS Version 1.90 02/24/2011 /var/log/syslog               Feb 21 21:21:51 kernel: [ 3526.006366] PM: Marking nosave pages: [mem 0x0009e000-0x000fffff]     Feb 21 21:21:51 kernel: [ 3526.006372] PM: Marking nosave pages: [mem 0xb70d0000-0xffffffff]     Feb 21 21:21:51 kernel: [ 3526.007297] PM: Marking nosave pages: [mem 0x1fc000000-0x1ffffffff]     Feb 21 21:21:51 kernel: [ 3526.007556] PM: Basic memory bitmaps created     Feb 21 21:23:00 kernel: imklog 5.8.6, log source = /proc/kmsg started.               Feb 21 21:23:00 kernel: [    7.877813] EXT4-fs (sda5): INFO: recovery required on readonly filesystem     Feb 21 21:23:00 kernel: [    7.877817] EXT4-fs (sda5): write access will be enabled during recovery     Feb 21 21:23:00 kernel: [    8.833136] EXT4-fs (sda5): orphan cleanup on readonly fs     Feb 21 21:23:00 kernel: [    8.833146] EXT4-fs (sda5): ext4_orphan_cleanup: deleting unreferenced inode 262260     Feb 21 21:23:00 kernel: [    8.833177] EXT4-fs (sda5): ext4_orphan_cleanup: deleting unreferenced inode 262215     Feb 21 21:23:00 kernel: [    8.833216] EXT4-fs (sda5): 2 orphan inodes deleted     Feb 21 21:23:00 kernel: [    8.833217] EXT4-fs (sda5): recovery complete     Feb 21 21:23:00 kernel: [    8.920573] EXT4-fs (sda5): mounted filesystem with ordered data mode. Opts: (null)     Feb 21 21:23:00 kernel: [   19.912627] Adding 14680060k swap on /dev/mapper/vgroup1-swap.  Priority:-1 extents:1 across:14680060k       hibernate module:               $ dpkg -l | g pm-utils     ii  pm-utils                                    1.4.1-9                                   all          utilities and scripts for power management      swap               # swap on logical volume     /dev/vgroup1/swap                         none            swap    sw              0       0               Disk /dev/mapper/vgroup1-swap: 15.0 GB, 15032385536 bytes     255 heads, 63 sectors/track, 1827 cylinders, total 29360128 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     Disk identifier: 0x00000000      /var/log/pm_suspend.log               Thu Feb 21 21:21:50 GMT 2013: Running hooks for hibernate.     Running hook /usr/lib/pm-utils/sleep.d/000kernel-change hibernate hibernate:     /usr/lib/pm-utils/sleep.d/000kernel-change hibernate hibernate: success.     Running hook /usr/lib/pm-utils/sleep.d/00logging hibernate hibernate:     ...     /etc/pm/sleep.d/10_unattended-upgrades-hibernate hibernate hibernate: success.     Running hook /usr/lib/pm-utils/sleep.d/55NetworkManager hibernate hibernate:     Having NetworkManager put all interaces to sleep...Failed.     ...     /usr/lib/pm-utils/sleep.d/55NetworkManager hibernate hibernate: success.     Running hook /usr/lib/pm-utils/sleep.d/60_wpa_supplicant hibernate hibernate:     Failed to connect to wpa_supplicant - wpa_ctrl_open: No such file or directory


Why are there Firefox 3.6 in the Linux repositories

Linux repositories=I mean "in general". So why aren't there any newer version of Firefox available in the repositories? [Fedora, Ubuntu, etc.]


Suggestions for IRC Server

I am planning to setup an IRC server for our internal communication needs. Which of the IRC servers do you guys suggest? Things I am looking for:   * Should not be very complex to setup   * Should allow running of bots written in ruby.   * Integration with Hubot would be good.   * Should allow reserving nicks based on password


Kernel Modules: .o vs .ko

It seems that files containing kernel modules are called `.o`, at least that's what I figure when looking at a tutorial like this one. However, on my debian squeeze box, these files seem to be called `.ko`. Does it depend on the distribution (or verison thereof) whether the files are called `.o` or `.ko`, and are they more or less the same, otherwise?


Bash prompt keeps disappearing

I have a weird issue where my Bash prompt often completely disappears on a backspace. Doesn't make any sense to me, but it happens often: ![enter image description here](http://i.stack.imgur.com/yZNTz.png) ![enter image description here](http://i.stack.imgur.com/KcJev.png) I can't really think of why this is happening. Am I overlooking some configuration file or something? Here's my `PS1` prompt:               PS1='\[\e]2;\u@\h\a\u@\h \W \$ '


find -exec on zsh: echo works as expected, print doesn't

I thought the following two commands would output the same thing, but they don't: **Command 1:** > find . -name filename -exec print '{}' \; **Command 2:** > find . -name filename -exec echo '{}' \; In fact, **Command 2** works as I expected it to work: it prints the relative path to all instances of `filename` under `.` However, for **Command 1** I get as many lines in the output as I get for **Command 2** , but instead of giving me the path, each line says:               find: print: No such file or directory      I have also tried removing the quotes fron {}. Why doesn't the second command work as I expected it to work? And why does it fail to print the path to each instance of `filename`?


How can I generate CMYK images via the command line under Linux?

I have an application I have developed which is generating RGB PNG images with text on them via imageMagic, like so:               convert -size 1000x1000 -density 300 xc:white -pointsize 24 \       -fill "rgb(0,0,0)" -annotate +500+500 'Josh Test' Jtest.png      It's working great. However I need to be able to generate CMYK output as well, the same images, but in CMYK rather than RGB. InkScape can't do this. I thought I could just use a CMYK color:               convert -colorspace cmyk -density 300 xc:white -pointsize 24 \       -fill "cmyk(0,0,0,0)" -annotate +500+500 'Josh Test' Jtest.pdf      However the resulting image is not 100% black, but 100% cyan, 100% magenta, 100% yellow and 0% black. Actual colors look even worse. This is because ImageMagic does all drawing in an RGB space and converts to CMYK: > Drawing requires the RGBA color model. Internally, images are stored as > RGB(A) or CMY(A)K. I cannot generate RGB images and convert to CMYK, the colors won't be right. They must be CMYK the whole way through. How can I generate CMYK images under linux?


what is 'smakynet' in the netstat result?

after logging into a server, I used netstat to check out the ports of this server and wanted to find which port was communicating with me My IP is 143.248.143.198 and my search results are like below:               [kwagjj@James5 ~]$ netstat | grep 143.248.143.198     tcp        0     52 James5:smakynet             143.248.143.198:49690       ESTABLISHED     [kwagjj@James5 ~]$ netstat | smakynet     smakynet: Command not found.     [kwagjj@James5 ~]$ netstat | grep smakynet     tcp        0      0 James5:smakynet             143.248.143.199:49573       ESTABLISHED     tcp        0      0 James5:smakynet             143.248.143.198:49690       ESTABLISHED     tcp        0      0 James5:smakynet             143.248.143.212:51070       ESTABLISHED     tcp        0      0 James5:smakynet             143.248.143.210:9693        ESTABLISHED     tcp        0      0 James5:smakynet             143.248.143.217:azeti       ESTABLISHED     tcp        0      0 James5:smakynet             143.248.143.216:51892       ESTABLISHED     tcp        0      0 James5:smakynet             143.248.143.210:10599       ESTABLISHED      I tried to see if James5:smakynet lead to some other port but it looks like my side of the port is only communicating with 'James5:smakynet'. Does anyone know what this 'smakynet' is? What does this do? I googled it but it didn't give me any proper info.


Unable to connect to the samba server

I setup a samba server(`Version 3.6.9-167.el6_5`). One of the sub folder contains more than one thousand, if I delete this folder then I can connect to the server, otherwise I am getting a timeout error(`NT_STATUS_IO_TIMEOUT`). How can I prevent this error? Is it scanning the whole file system during connection?


What is a good distribution to use that is similar to Amazon Linux

I'm running the "Amazon Linux" OS/distro in production on EC2, But I'd like to do some local development/testing with VirtualBox VMs. What would be a good distribution to use that is most like Amazon Linux. I'm most interested in making sure that I have the same packages available to me. I'm most familiar with yum/rpm based distros, so that's where i'd like to stay, but if there's another distro that will have better package similarity with apt instead I suppose I can make that work. A brief list of the packages I need to run are mysql5.5, apache2.2, php5.3 and tomcat7.


How can I have cd show the directory it switches into?

I have made my command prompt (`$PS1`) to be just username.../current_directory (using the 3 dots because my directory structure has lots of levels and they were taking up too much of the command line prompt).   However this would work better if, when I cd'd into a directory, the cd command showed what directory I get changed into. How can I have this happen? btw my command prompt setting (that I don't wish to change) to do username...current_dir is:               if [ "$color_prompt" = yes ]; then         PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '     else         PS1='${debian_chroot:+($debian_chroot)}\u.../${PWD##*/}\$ '     fi


How to add an IP to hostname file

I have a Centos 5.8 server. How can I add my server IP address 192.168.20.254 so that it reflects when I run the command `hostname -i` At the moment the command only shows the loopback IP 127.0.0.1 and the software I am trying to install complains that the server IP is not reflected here.


How do I suppress a warning message?

touch ~/deleted/$(echo "directory_"$(readlink -f foo)|tr '/' '\') 2> /dev/null      where foo is a directory It's reading the full pathname of foo and creating it as a file replacing all '/' with '\' and putting a directory_ in front so the directory `/home/test/foo` would create a file `directory_\home\test\foo` It does exactly what I want except a warning keeps printing `tr: warning: an unescaped backslash at end of string is not portable` a. I don't know what that means b. I would like it to not show I tried to redirect stderr to `/dev/null` but it doesn't work. How do I suppress it?


Convert screen log to html

I would like to log actions made in a terminal window, and convert the log to html on fly. I already tried commands script/screen + ansi2html, but the result is not perfect: the escape sequences for line editing is not handled correctly, so in the resulting html I have a mixture for the old and the new version of the line. So if the output of the terminal is like               $> echo Original text     Original text     $> echo Other     Other      The resulting html is                $> echo Original text      Original text      $> echo Othernal text      Other      Any idea, how to solve the issue?


ACL defaults: files vs directories

Default ACLs on a directory are inherited by files and subdirectories created under that directory. It seems a common requirement that by default subdirectories should be executable (i.e. cd-able) but files should not. How can I set separate default (i.e. to be inherited) ACLs for subdirectories and (child-) files, or otherwise achieve this effect? Addendum:   Raspberry Pi Model B, Raspbian, get/setfacl 2.2.51               cat /proc/version     Linux version 3.6.11+ (dc4@dc4-arm-01) (gcc version 4.7.2 20120731 (prerelease) (crosstool-NG linaro-1.13.1+bzr2458 - Linaro GCC 2012.08) ) #474 PREEMPT Thu Jun 13 17:14:42 BST 2013


Install Ubuntu from the same or different partition?

Do you need more than one partition to run an Ubuntu installer? Or can you download it, save it, and install it all in the same partition? (without mounting others, nor using the Windows installer). On the partition in question there is a pretty old Ubuntu installation, but it is enough to get the installer started. The graphical stuff is not running in this version, but the command line is OK. It doesn't matter if this version gets completely deleted and there is something like that 40 GB free.


Does modprobe.d blacklist always need the prefix "blacklist-"?

In the german Ubuntu-Wiki it says, that the name of a blacklist in modprobe.d can be chosen as prefered but the filename has to begin with "blacklist-". Is that right? Because in a forum I read a blacklist was named "broadcom.conf". Will this work?


Squid3 failed to response when access certain website

My **Host** system is Ubuntu 13.10 64bit. I configured _Squid3_ almost with the default configuration file, except adding `acl localnet...` and `http_access allow localnet`. I did not configure `cache_dir` cause I don't think I will need it. So my squid is only memory cached. My **Client** is Windows 7 64bit. I use Chrome and configured _SwitchySharp_ to use the proxy. Everything works fine. I can access all the websites I want without any problem. But after some time, I cannot connect to a certain website, in this case `twitter.com`, while I can connect to other website normally. On the **Host** machine, I tried to connect to twitter without using the proxy, and it works. But if I set my browser to use the proxy, I cannot connect to twitter on the **Host** as well. And I found restart squid temporarily solve the problem. So I think there must be something wrong with my configuration. But I have no idea how to troubleshoot it.


Using while loop to ssh to multiple servers

I have a file `servers.txt`, with list of servers:               server1.mydomain.com     server2.mydomain.com     server3.mydomain.com      when I read the file line by line with `while` and echo each line, all works as expected. All lines are printed.               $ while read HOST ; do echo $HOST ; done < servers.txt     server1.mydomain.com     server2.mydomain.com     server3.mydomain.com      However, when I want to ssh to all servers and execute a command, suddenly my `while` loop stops working:               $ while read HOST ; do ssh $HOST "uname -a" ; done < servers.txt     Linux server1 2.6.30.4-1 #1 SMP Wed Aug 12 19:55:12 EDT 2009 i686 GNU/Linux      This only connects to the first server in the list, not to all of them. I don't understand what is happening here. Can somebody please explain? This is even stranger, since using `for` loop works fine:               $ for HOST in $(cat servers.txt ) ; do ssh $HOST "uname -a" ; done     Linux server1 2.6.30.4-1 #1 SMP Wed Aug 12 19:55:12 EDT 2009 i686 GNU/Linux     Linux server2 2.6.30.4-1 #1 SMP Wed Aug 12 19:55:12 EDT 2009 i686 GNU/Linux     Linux server3 2.6.30.4-1 #1 SMP Wed Aug 12 19:55:12 EDT 2009 i686 GNU/Linux      It must be something specific to `ssh`, because other commands work fine, such as `ping`:               $ while read HOST ; do ping -c 1 $HOST ; done < servers.txt


How can I colorize head, tail and less, same as I've done with cat?

I've got 'color cat' working nicely, thanks to others   (see How can i colorize cat output including unknown filetypes in b&w?). In my `.bashrc`:               cdc() {       for fn in "$@"; do       source-highlight --out-format=esc -o STDOUT -i $fn 2>/dev/null || /bin/cat $fn;       done     }     alias cat='cdc' # To be next to the cdc definition above.      I'd like to be able to use this technique for other functions like head, tail and less. How could I do that for all four functions? Any way to generalize the answer? I have an option for `gd` doing `git diff` using               gd() {         git diff -r --color=always "$@"     }


Is there a good FOSS utility for converting machine code to assembly or even C?

If I buy a piece of x86 32-bit or 64-bit software but I don't receive the source code, and I need to modify the software, I'll need to convert the machine code back into a high level language or at least assembly code. Is there a good utility to go from machine code to C? I assume that it would attempt to identify whether the program was compiled with a C compiler as opposed to C++ or Objective C or anything else. Thanks.


How to cache KDE main menu in memory?

When I click main menu button in Windows, it loads instantly. When I click K menu, it loads with a small delay. Seems, that it's loading data from disk. How to make it cache the favorites in memory? ![enter image description here](http://i.stack.imgur.com/WA8kO.png)


SSH: tunnel without shell on ssh server

I have to set up a tunnel between two hosts. For this i use `ssh` in this way:               ssh -L MY_LOCAL_PORT:FOREIGN_ADDRESS:FOREIGN_PORT MYUSER@SSH_SERVER      after that, I login into my SSH_SERVER. How can I avoid this feature?! I have only to set up a tunnel. I don't have to login into my SSH_SERVER... I've tried the -N option, but it keep my shell busy


Adding the panel to the second monitor

I have set up two monitors in my system. One is powered by the HDMI port and the other one is powered by the normal analogue port of the same GPU (Nvidia Ge-force 210). I just setup twin display in Nvidia settings but can't see cinnamon's panel on the second monitor. How can I fix this?


awk filtering live capture with file as pattern list

What I'm trying to do is quite simple. I'm generating output from `tshark` and redirecting it to `awk` with a pipe `|`. Since `tshark` gets live data, I want that `awk` search in every output for a pattern (some MAC addresses that I already have) in the first column in a file ("target.txt") and, if there's a match, `awk` should output the first and second column from this file. Example from `target.txt`:               ab:cd:ef:gh:ij:kl,Me     12:34:56:78:90:10,You     1b:2d:3f:4h:5j:6l,someone      To make it all easier, my `tshark` output has only 2 columns, and the MAC address column is the second one. 1 line of `tshark` output is like:               Jun 16, 2014 02:55:51.300286000 12:34:56:78:90:10                 ^^^^- date and MAC are separated by tab!      So if `tshark` finds `12:34:56:78:90:10`, `awk` will output               12:34:56:78:90:10 -> You      or even better:               Jun 16, 2014 02:55:51.300286000 12:34:56:78:90:10 -> You      ### EDIT #1 Well, I did some tests and find out that `tshark`s output is separated by `tab` \t. It's not a big deal, but already a small improvement. The thing is, I got samples from `tshark` output and tested with Gnoucs answer through a `echo` command before the pipe `|` . It worked. Then I changed the `echo` for `tshark` and everything stopped working =). Is it a problem with the live data or something like that? Here's my code until now:               $ tshark -I -i wlan0 -T fields -e radiotap.dbm_antsignal -e wlan.sa | awk -F'[ ,\t]' '          FNR == NR { a[$1] = $2 }          ($NF in a) { print $0" -> "a[$NF] }      ' alvos.txt -      well, it just worked! It was probably a typo. Thanks for all answers!


How to get bash to suggest a missing package?

While running Ubuntu, while trying to execute a commmand in bash, it used to suggest that the said program was missing but found in another package Y, and that I could try installing it. Now on a Debian system, that's no longer the case. If the command isnt found it doesn't suggest anything. But package manager list is updated. How can I get it to suggest a package from commands given on bash?


is there a proper syntax for the expression or is this impossible

STD_IN=&1          data=<( read data from $STD_IN  ; echo $data; )      echo $data      Target: Is to get a blocking read into the subshell like this


Best way to create RAID on an existing system drive

I want to add another disk as RAID 1 to test my database performance. I am trying to not re-do the whole system, is it possible? Currently I have a single 1TB HDD with one 100GB system partition (and `swap`, `boot`) and a 850GB `/home` partition. I want to if possible, add another 1TB drive and convert the whole system to RAID 1, or atleast raid the `/home` partition (and discard the other 150GB on the second disk). Is it possible? atleast in software RAID (on CentOS 6.4)


Graphical console applications in Emacs

I am having trouble running `htop` within an `ansi-term` in Emacs 24.2. It looks like some of the control characters are not interpreted correctly. I thought `ansi-term` was capable of handling font control characters. Is there a way to have `ansi-term` work with graphical console applications?


Task management tools with keyboard navigation that run in a terminal

I recently learned that I can use `top` with my keyboard to kill processes (`k`), show processes for a specific user only (`u`), etc. But I was wondering if there is a way of selecting processes from the menu without having to manually type their `PID` (e.g. using `C-n` and `C-p` to navigate the list would be ideal) If `top` does not let me do this, are there any tools that can help with this task?


Pulseaudio/X permission other user/SSH

My user user1 is running a graphical X session with pulse configured per-user. I need to run a graphical program that uses audio with user2.   * If I do `su user2; program` program doesn't start and I get no audio neither video   * If I do `gksu -u user2 program` the video is working, but I get no audio. Why there are these problems? What is the right way to start a pulse application that outputs sound on the pulse of my user? What the right way to start an X/audio application from another session(for example an SSH shell)?


How to force 1920x1080 resolution - Fedora 16, VMPlayer, 9800GTX

I'm running F16 on VMplayer, I don't think the drivers I'm using are for my nvidia card. I'm getting a max resolution of 1280*768. My card is EVGA 9800GTX+ --- I need instructions on how to change my xorg config (I'm assuming that's the problem). * * * In gnome display settings I'm now able to set my resolution to 1920x1080 After forcing `vmware` driver in xorg.conf My xorg.conf looks like this atm;               Section "Device"         Identifier "device0"         VendorName "VMware SVGA II Adapter"         BoardName "VMware SVGA II Adapter"         Driver "vmware"         Option "SWcursor"     EndSection          Section "Screen"         Identifier "screen0"         Device "device1"         Monitor "monitor1"         DefaultColorDepth 24     Subsection "Display"         Depth 8         Modes "1920x1080"     EndSubsection     Subsection "Display"         Depth 15         Modes "1920x1080"     EndSubsection     Subsection "Display"         Depth 16         Modes "1920x1080"     EndSubsection     Subsection "Display"         Depth 24         Modes "1920x1080"     EndSubsection     EndSection      After logging in my resolution changes to 1920x1080 The only setting being picked up by xorg.conf is driver `vmware` At login screen my resolution is 1024x768


Pass login messages to tmux

When I login, I connect to a tmux session (either by exec'ing tmux if there is no current session, or exec'ing tmux attach if there is). However this means I don't see the login messages (/etc/issue, /etc/motd, amount of mail etc., the stuff that pam provides). Is there a way to get the messages printed inside the tmux session? (The solution should only rely on POSIX shell syntax i.e. not be bash/zsh/other shell specific)


PgPool - Host Based Routing

I'm using `pgpool` to distribute my connections between my master and slave postgresql databases. What I would like to know is if there is a feature where I can tell `pgpooler` to route connections coming from a certain user to the master only. So lets say if a web application is connected to `pgpooler` with USER-A, route all the connections to master, otherwise, let `pgpooler` do it normal work. I know about white list functions and I am using them for certain cases, but I'm looking for something more complicated.


Shell Script for logging into a ssh server

I tried writing a shell script which can do automatic login into a ssh server using password which is mentioned in the script. I have written the following code:               set timeout 30     /usr/bin/ssh -p 8484 root@172.31.72.103     expect      {        "root@172.31.72.103's password"         {           send "password\r"         }     }      This code is not running properly, still it is asking for the password. Can somebody please help me in solving this


Automated SSH Login

> **Possible Duplicate:**   >  Shell Script for logging into a ssh server   >  Autentification on SSH connection in OneLine How could I make a SSH Login programmatically on a unix server, I don't have rights for generate public keys on the side server or extra-packages like expect. The client is a windows os, so I use putty to do the connections. Is there any way to use putty on my program or any java library for this?


How to Expand LVM2 Partition in Fedora Linux

I've been using Fedora 15 on a VMWare virtual machine. Over time, the disk space I initially allocated for the file system began to run out, only 12GB left. I've expanded the disk space an extra 25GB. Problem is, I need to expand the file system to take what is now 25GB of free space on the virtual disk. I tried GParted, but it doesn't support LVM2. Does anyone know of any utilities or the commands needed to expand my filesystem? Disk info: ![Logical Volume Group][1] ![Hard Disk][2] ![GParted][3] Just tried this command:               [root@localhost /]# lvextend -L+10G /dev/VolGroup/lv_root      Extending logical volume lv_root to 54.38 GiB     Insufficient free space: 320 extents needed, but only 0 available      Obviously it didn't work. How do I get at that unallocated disk space?


Getting a working chroot environment to boot with Grub2

**Question** I have a working chroot environment (inittab, fstab, init.d/rcS set up), a kernel, and grub2 installed. What more do I need to get my system working? **Background/Specifics** For educational purposes, I set out to put together a small linux environment that I can boot into and have a running shell. Using Virtualbox I attached a virtual machine to two hard drives (with just one partition each). The first one has Debian installed, and on the second one I built a small chroot environment with Busybox, using this article. I also set up `inittab`, `fstab`, `init.d/rcS`, and most of the other filesystem related stuff as directed in the article, although I didn't do anything on the second page related to `genfromfs` and `syslinux` because I figured I wasn't making a bootable floppy. To figure out how to get my chroot system to boot, I found this post, and I ran `grub-install --root-directory=/mnt /dev/sdb`. At the end it said it completed with no errors. Then I created a new virtual machine, this time with the second hard drive as its only hard drive, and started it. It gave me a grub prompt, so then I googled some more, and I typed in               set root=(hd0,msdos1)     linux /vmlinuz     boot      I had read that initrd/initramfs is optional, so I decided to overlook it for now. I built the linux kernel using `make defconfig` and `make` and copied over the bzImage under the x86 directory after the build. However, soon I get a screen that hangs:               [ 0.74.. ] md: autorun ...     [ 0.74.. ] md: ... autorun DONE.     [ 0.74.. ] Root-NFS: no NFS server address     [ 0.74.. ] VFS: Unable to mount root fs via NFS, trying floppy.     [ 0.74.. ] VFS: Cannot open root device "(null)" or unknown-block(2,0)     [ 0.74.. ] Please append a correct "root=" boot option; here are the avaialbe partitions:     [ 0.74.. ] 0800  ... sda driver: sd     [ 0.74.. ] 0801 ... sda1 ...     [ 0.74.. ] 0b00 .. sr0 driver: sr ..     [ 0.74.. ] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)     [ 0.74.. ] Pid: 1, comm: swapper/0 Not tainted 3.2.6 #1     [ 0.75.. ] Call Trae:     [ 0.75.. ]  [<c16..>] panic+0x57/0x157     [ 0.75.. ]  [<c18..>] mount_block_root+0x125/0x1a7     [ 0.75.. ]  [<c10..>] ? sys_mknod+0x27/0x30     .. a few more lines of call trace ...      I left some numbers out and the last few lines out because I had to type them in by hand, so if you need them let me know and I'll post them.


Are system calls available in a chroot environment?

I'm experiencing a lot of compilation errors regarding missing system calls (e.g. `error: '__NR_name_to_handle_at' undeclared (first use in this function)`) with different projects (ganesha 2.1.0 (https://sourceforge.net/projects/nfs-ganesha/) and qemu 2.0) compiling in a debian chroot on a Synology DS214 with DSM 5.0 with armv7l architecture - I know this is not an ideal compile environment. The pattern in the experienced errors and the lack of other information and/or a clear statement has driven me to ask this question. The compilation succeeds on another machine, but this doesn't provide an answer to the question. I haven't taken the effort to set up a compilation environment outside chroot and I don't plan to. I know that cross compiling outside chroot on another machine provides a workaround for the compilation failures.


Build Mini Linux and Embedded Linux

**How to build Mini Linux with Busybox, Kernel-3.15.3, Syslinux?** ![Boot Mini Linux Test with Qemu](http://i.stack.imgur.com/8EyPC.png) I've built my Mini Linux using these steps: > > Steps in Building Base Mini Linux Distro   >  0 . Compile the kernel and see the result in terms of size of the > compilation ;   >  1. Create rootfs image ( format as ext2 mke2fs for example ) that will > contain the root system and some basic programs (used busybox ) ;   >  2 . Mount rootfs and create basic directories and files ;   >  3 . Compile busybox and install it inside the rootfs ;   >  4 . Check the kernel size ( with or without modules enabled ) and Ciar > image (with mkdosfs applied to the image ' linux.img ' example) that contain > linux.img grub or syslinux setting the boot process of the system;   >  5 . After rootfs created and linux , copy for syslinux.cfg linux.img , > bzImage , into the linux.img. I use #find ./ cpio --create > --format='newc'>initrd (to create "initrd" of rootfs) and copy it to > linux.img;   >  6 . Applies the command ' sync' syslinux to finish the linux.img image ;   >  7 . After all settings and installations test it with qemu , for example, > the following command qemu linux.img ' ;   >  8 . If everything ok the system will boot and will fall in the basic shell > . But the current attempts can not enter the terminal ( shell ) ; I leave > here resgistred steps if it can help someone or someone can help me . However, I have failed to execute `init`, as shown in the figure. In other tests, I've obtained other problems of panic kernel, as root is not found. I used this reference:   http://www.slideshare.net/sherif_mosa/003-embedded-linuxminiosx86   http://freeelectrons.com/ Tutorial "Embbeded Linux From Scratch"


Conditional block vs conditional statement (if)

Say I have a file:               PRO 1     GLN 5.55112e-17     ILE -6.245e-17     THR 5.55112e-17      I want every line that has a number unequal to 1 in the second column to change it to 0 and keep the rest. If I use `if` (i.e conditional statement), everything is OK:               awk '{if($2!=1){print $1,"0"}else{print $0}}' file     PRO 1     GLN 0     ILE 0     THR 0      But when I use the conditional block, something undesired happens:               awk '$2!=1 {print $1,"0"} {print $0}' file     PRO 1     GLN 0     GLN 5.55112e-17     ILE 0     ILE -6.245e-17     THR 0     THR 5.55112e-17      You can see what's wrong.   * How do I fix this error?   * Why does this error occur?   * What's the different between a conditional statement and a conditional block?


Keyboard layout bug in login window after screen lock

I use Fedora 16 now, but this issue already was in Fedora 15 before I upgraded it. When I lock my screen and then want to unlock it, I have a default English layout (I am from Russia and also have Russian layout). My layout switching shortcut is `Ctrl`+`Shift`. When I try to enter my password, I get a login failure, and I must switch layouts twice (to Russian and again to English), and then login is successful. How can I fix this issue?


Extract pitch information from audio file

Is there a command-line utility which would allow me to extract pitch information from an audio file and store it in a numerical form (i.e. as a list of comma-separated values)?


How to quickly store and access often used commands?

I have a lot of commands I routinely need to execute, often with the slightest variation. Right now I'm storing them all in .bash_history and use CTRL-R to access them, but I wonder if there's a better way. What I'm looking for:   * Easy to add a new command   * Easy to search and re-execute a wanted command   * Avoid unwanted commands in suggestions Unfortunately, bash_history is not so strong on the third demand: if I do a few `cd` and `ls`, it fills the history file quickly. I have recently learned about HIST_SIZE and that you can configure the history to avoid duplicates or certain commands, but before configuring all that, I wanted to make sure it is the best way.


tabs when using 'screen'

I am using **Ubuntu** 10.04. After I installed `screen`:               sudo apt-get install screen      I made two **ssh** connections to two remote servers by doing the following things step by step (I do the following steps according to the document here): **1.** open a termnal window, run command `screen` **2.** press `Ctrl`+`A`+`c` to create a new virtual console **3.** `ssh usr@IP1` **At this point,** I have one virtual console which shows I have connected to the remote server(IP1). **4.** press `Ctrl`+`A`+`c` to create a new virtual console **5.** `ssh usr@IP2` So, now I have connected to two remote servers(IP1 & IP2). **But** , **I do not have two tabs** on one terminal window, instead, I have to use `Ctrl`+`A`+`p` and `Ctrl`+`A`+`n` to switch between the two virtual console in **one** terminal window. Isn't it so that by using `screen`, I could have **two tabs** in one terminal window, with each tab display one connection to one remote server. Why I do not have the **tabs** in my terminal window?


Google Hangouts (and Skype) does not see custom null-sinks

In an attempt to turn PulseAudio to a soundboard, I cannot make Google Hangouts or Skype see the null-sinks that I made. Do I need to trick them into thinking their inputs or something? Code for the null-sinks               pactl load-module module-null-sink sink_name=REC sink_properties=device.description=Recordings     pactl load-module module-null-sink sink_name=REC_MIC sink_properties=device.description=Recordings+Microphone          pactl load-module module-null-sink sink_name=WEB sink_properties=device.description=WebChatOutput     pactl load-module module-null-sink sink_name=WEB_MIC sink_properties=device.description=WebChatOutput+Microphone          pactl load-module module-null-sink sink_name=DUP sink_properties=device.description="Recording&WebChatOutput"     pactl load-module module-null-sink sink_name=DUP_MIC sink_properties=device.description="Recording&WebChatOutput+Microphone"          pactl load-module module-loopback source=REC.monitor sink=REC_MIC     pactl load-module module-loopback source=WEB.monitor sink=WEB_MIC     pactl load-module module-loopback source=DUP.monitor sink=DUP_MIC          pactl load-module module-loopback sink=REC_MIC     pactl load-module module-loopback sink=WEB_MIC     pactl load-module module-loopback sink=DUP_MIC          pactl load-module module-loopback source=REC.monitor sink=DUP     pactl load-module module-loopback source=WEB.monitor sink=DUP          pactl load-module module-loopback source=DUP.monitor


How to make Network alive but speed low, slow for upload, download?

I have own application written (Python, Java) which does upload/download for streaming. Now in my local office network and home network setup i can't simulate slow/low latency network (as a result i have many issues when i am using with live users) How do i tell my linux box that network interface eth0 is slow (such as lot of hops and ping reply is slow, speed like 3G simulated, without having the real thing) with that kind of network setup, i want to have some unit testing (considering i have random users, and random users low networking speed internet), before production release. _**EDIT:_** http://www.linuxfoundation.org/collaborate/workgroups/networking/netem               tc qdisc add dev lo root handle 1:0 netem delay 5sec


Struggling with XRDP (Fedora 19 connecting from Windows 7)

I am new to Linux and have a server running Fedora 19 and need to see the desltop from a Windows 7 machine. I have found a lot of conflicting advice on different methods and have plumped for the xRDP approach following this install and set up method. However, when I try to connect I get this error: ![enter image description here](http://i.stack.imgur.com/00LMM.png) I can log in via SSH using putty and have a command line terminal session but if I try tunneling the SSH connection with TightVNC (following these directions), I get this error: ![enter image description here](http://i.stack.imgur.com/KpxBX.png) I have no direct access to the actual machine and so cannot see the desktop and therefore cannot follow any of the (plentiful) advice about how to set this up using the GUI controls. The solution will have to be through the command line. I believe the Fedora box is running Gnome3 and I can get a PID for xRDP, so I know that is running. My gut feeling is that there is a vital step missing from the "how to" instructions I linked above but I don't know what. Any help for this newbie gratefully received!


ubuntu/debian: using bluetile with GNOME2-like environment?

The installation of debian wheezy defaulted to the KDE desktop environment. How do I remove it and switch to GNOME 2 (the version that is used in stable)? I fear that if I just install gnome-core, it will install GNOME 3. Can I just make sources.list point to an older version of some package? I prefer GNOME 2 because it works well with bluetile ~~(I don't want MATE, or other copies)~~.


filename matching pattern

I have a folder of 200 satellite files to process. There are three steps in the process and I want to use a shell script under ubuntu to process them. I am using a for loop. My problem is the filenames. An example is A2013290123000.L1A_LAC.Ireland.hdf. I can create variables ie.               DATE=A2013     DATE1=`date +%j` #gives me the number of days since jan 1st 2013 in example above this would be 290     .L1A_LAC.Ireland.hdf part of the name doesn't change.      My issue is with the middle part of the name, in example above:123000 There is no pattern to this part of the name. It is a time stamp but varies with each file. I want to create a variable in the script such as               TIMESTAMP=$DATE$DATE1$DATE2      Where DATE2= the middle part of the file name. Is it possible to specify this variable as a wild card something like:               DATE2=$*      I hope to have the value of the variable `TIMESTAMP= A2013209123000`               #!/bin/sh          #set -e          set -x #debug mode          <<comment     export OCSSWROOT=/home/seadas/seadas-7.0/ocssw     source $OCSSWROOT/OCSSW_bash.env     export PATH=$PATH:/home/seadas/seadas-7.0/bin     comment          DATE=A2013     DATE1=`date +%j`     DATE2=$*     TIMESTAMP=$DATE$DATE1$DATE2     LOCATION_NAME=Ireland          DATADIR=/home/MODIS     L2_DIR=/home/MODIS/L2     GEO_FILE_DIR=/home/MODIS/GEO     L1B_DIR=/home/MODIS/L1B     SCRIPTDIR=/home/seadas/seadas-7.0/ocssw/run/scripts     FILTERDIR=/home/seadas/seadas-7.0/ocssw/run/data/common     FUNCTION=/home/seadas/seadas-7.0/ocssw/run/bin/linux_64          HDFFILE=$TIMESTAMP.L1A_LAC.$LOCATIONNAME.hdf     GEOFILE=$LOCATION_NAME-$TIMESTAMP.GEO     LACFILE=$TIMESTAMP.L1B_LAC     HKMFILE=$TIMESTAMP.L1B_HKM     QKMFILE=$TIMESTAMP.L1B_QKM     L2FILE=$TIMESTAMP.L2.hdf               for i in `ls -r $DATADIR`          do         echo "Start a Process for file $i";          'Generating geolocation file' $SCRIPTDIR/modis_GEO.py -d $DATADIR/$HDFFILE -o $GEO_FILE_DIR/$TIMESTAMP.GEO --threshold=95;          'Generating L1B file' $SCRIPTDIR/modis_L1B.py $DATADIR/$HDFFILE $GEO_FILE_DIR/$TIMESTAMP.GEO -o $L1B_DIR/$LACFILE -k $L1B_DIR/$HKMFILE -q $L1B_DIR/$QKMFILE;          'Generating L2 product'$FUNCTION/l2gen ifile=$L1B_DIR/$LACFILE geofile=$GEO_FILE/$TIMESTAMP.GEO par=$FILTERDIR/msl12_defaults.par ofile=$L2_DIR/$L2FILE resolution=-1 l2prod="default,sst,qual_sst,qual_sst4,sstref,sst4" filter_opt=0 proc_ocean=1 gas_opt=15;          echo "it $i is finished..."               echo "\n"     done


How can I find the sort order for ls with my locale?

I was using `ls -l` on a directory, and was surprised that spaces and underscores were ignored for the sort order. For example,               $ echo $LANG     en_AU.UTF-8     $ ls -l     total 0     -rw-r--r-- 1 sparhawk sparhawk 0 Nov 20 21:12 a_a     -rw-r--r-- 1 sparhawk sparhawk 0 Nov 20 21:13 a b     -rw-r--r-- 1 sparhawk sparhawk 0 Nov 20 21:13 a_c     -rw-r--r-- 1 sparhawk sparhawk 0 Nov 20 21:13 a d     $ LANG=en_AU ls -l     total 0     -rw-r--r-- 1 sparhawk sparhawk 0 Nov 20 21:13 a b     -rw-r--r-- 1 sparhawk sparhawk 0 Nov 20 21:13 a d     -rw-r--r-- 1 sparhawk sparhawk 0 Nov 20 21:12 a_a     -rw-r--r-- 1 sparhawk sparhawk 0 Nov 20 21:13 a_c      In my default locale, spaces and underscores are interchangeable, and without UTF-8, spaces come before underscores. I see similar results for `en_US` and `en_US.UTF-8`. I have two questions:   1. Am I interpreting this correctly? Are they interchangeable?   2. Is there a list of my locale's sort order? I want to find a character that precedes underscore.


How does a package run without all the dependencies being installed on the target system?

I am trying to build the latest version of `subversion` on ubuntu 12.10 and was having some trouble completing `./configure` as I seemed to be getting a never ending stream of `configure: error: x not found` messages. I installed `apr` and supplied the paths to the `apr-1-config` file to get rid of the first, then I installed `sqlite` etc. and currently I am working on `configure: error: Expat not found`. Prior to attempting an install of `1.7.7`, I had just used `apt-get install subversion` which installed `1.7.5` and was working fine. My question is, why does `1.7.5` work on my machine if I didn't have `sqlite`, `apr` and all the other dependencies that seem to be needed now that I'm it from the source? does `1.7.5` not have such dependencies or were they installed during my `apt- get` command and I just needed to link to them?


How can one switch to ttyX in virtualbox?

I run VirtualBox in Linux , running CentOS in it , and I can't switch to ttyX in the CentOS since I'll go to the ttyX in my Linux. Any solutions ?


Kernel 3.3.2-6.fc16.x86_64 broadcom wireless not appearing

I'm using kernel 3.3.2-6.fc16.x86_64 and I have a Broadcom 4312. When I run `iwconfig`, I get the following:               lo        no wireless extensions.     p2p1      no wireless extensions.      I cannot use wireless, I have to use cable. How can I get my wireless network adapter up and running?


Cannot boot Fedora Linux

I cannot boot the operating system on my laptop. I have three versions of the kernel installed and none of them will boot. Booting into Windows (installed in a separate partition) still works, so I suspect the hardware is not at fault. I may have tried to update drivers before the problem occurred, so that could be the cause. I have also tried resetting the BIOS, to no effect. I am using GRUB v1.99. Selecting "Fedora (3.6.11-1.fc16.x86_64)" from the GRUB menu, the following is displayed:               Fedora (3.6.11-1.fc16.x86_64)     Loading initial ramdisk ...      Then I get the normal splash screen. But then it returns to the black screen with just the above two lines being displayed and hangs indefinitely. Enabling verbose mode yields the following:               Fedora (3.6.11-1.fc16.x86_64)     Loading initial ramdisk ...     ... (many lines - can transcribe if relevant) ...     Started Machine Check Exception Logging Daemon             [OK]     Started Install ABRT coredump hoot                         [OK]     Started Console Mouse manager                              [OK]     Started irqbalance daemon                                  [OK]     Started SSH server keys generation                         [OK]     Started Kernel Samepage Merging                            [OK]     Started Harvest vmcores for ABRT                           [OK]     Started ACPI Event Daemon                                  [OK]     Started Display Manager                                    [OK]     _     (hangs here)      No obvious errors are displayed - it just stops. The grub config looks like:               setparams 'Fedora (3.6.11-1.fc16.x86_64)'          load_video     set gfxpayload=keep     insmod gzio     insmod part_msdos     insmod ext2     set root='(hd0,msdos2)'     search --no-floppy --fs-uuid --set=root dd61afbf-2b76-44ab-b2ca-0e65f0664425     echo 'Loading Fedora (3.6.11-1.fc16.x86_64)'     linux /boot/vmlinuz-3.6.11-1.fc16.x86_64 root=UUID=dd61afbf-2b76-44ab-b2ca-0e65f0664425 ro rd.md=0 rd.lvm=0 rd.dm=0 quiet SYSFONT=latarcyrhebsun16 rhgb KEYTABLE=uk rd.luks=0 LANG=en_US.UTF-8     echo 'Loading initial ramdisk ...'     initrd /boot/initramfs-3.6.11-1.fc16.x86_64.img      /boot is in /dev/sda2; using a livedisk to inspect the directory yields the following:               cd /mnt/sda2/boot     ls -ld *     -rw-r--r--. 1 root root   119880 2012-08-15 17:01 config-3.4.9-1.fc16.x86_64     -rw-r--r--. 1 root root   122870 2012-12-17 16:33 config-3.6.11-1.fc16.x86_64     -rw-r--r--. 1 root root   122897 2012-10-31 23:53 config-3.6.5-2.fc16.x86_64     drwxr-xr-x. 2 root root     4096 2013-02-02 13:44 extlinux     drwxr-xr-x. 2 root root     4096 2011-12-03 11:22 grub     drwxr-xr-x. 3 root root     4096 2013-01-21 03:37 grub2     -rw-r--r--. 1 root root 17757091 2012-08-31 05:50 initramfs-3.4.9-1.fc16.x86_64.img     -rw-------. 1 root root 18065462 2013-01-21 03:37 initramfs-3.6.11-1.fc16.x86_64.img     -rw-------. 1 root root 18052180 2012-11-07 17:15 initramfs-3.6.5-2.fc16.x86_64.img     -rw-r--r--. 1 root root   593313 2012-01-16 17:29 initrd-plymouth.img     -rw-------. 1 root root  2444127 2012-08-15 17:01 System.map-3.4.9-1.fc16.x86_64     -rw-------. 1 root root  2497974 2012-12-17 16:33 System.map-3.6.11-1.fc16.x86_64     -rw-------. 1 root root  2496741 2012-10-31 23:53 System.map-3.6.5-2.fc16.x86_64     -rwxr-xr-x. 1 root root  4728480 2012-08-15 17:01 vmlinuz-3.4.9-1.fc16.x86_64     -rwxr-xr-x. 1 root root  4824784 2012-12-17 16:33 vmlinuz-3.6.11-1.fc16.x86_64     -rwxr-xr-x. 1 root root  4822224 2012-10-31 23:53 vmlinuz-3.6.5-2.fc16.x86_64      I'm not very good at sysadmin tasks, so I apologise if I am being stupid. However, I really cannot figure out what is going wrong - I would be incredibly grateful if anyone can help?


Mapping AltGr to left control

I mapped my `AltGr` key to `Ctrl` with the following command:               setxkbmap -option ctrl:ralt_rctrl      However, when displaying the bindings with               xmodmap -pke      I can see that the keycode is associated to                  keycode 108 = Control_R Control_R Control_R Control_R      **I would like to bind` AltGr` to LEFT Control.** Is it possible? This is important for Emacs, otherwise I don't get the same input when pressing C-S-b with the original Left Control or with AltGr.


Which was the very first music player application for Linux?

I'm writing an article about FOSS and Linux music players. What was the very first music player application for Linux? Was there ever a time when the players didn't support proprietary formats like MP3s?


Cannot make anyfs-tools. My e2fslibs package seems not to be the compatible version

anyfs-tools promises to convert a ntfs partition into ext3. That's what I want to do. (I have backed up what was necessary).    But when I try to compile anyfs-tools I get a `make` compilation error complaining about the ext2fs library. So I suppose I do not have the good version that makes this executable compile. What should I do when such case happens ?   * Should I search for the version of e2fslibs that is compatible and install it so as the `make` can succeed. Could it break my current distro ?    * Or should I **try** to modify the code of anyfs-tools (that has not been updated since 2010-06-19) This is the output of make:               gcc -O3 -Wall -Winline --param inline-unit-growth=1000 --param large-function-growth=10000 -std=gnu99 -I../../include -I/usr/include/ext2fs -I/usr/include/et   -g -O2 -o anysurrect anysurrect.o  -rdynamic -L../../lib -lany  -ldl  -lext2fs   -L. -lanysurrect     ./libanysurrect.so: undefined reference to `ext2fs_unmark_block_bitmap_range2'     ./libanysurrect.so: undefined reference to `ext2fs_inode_data_blocks2'     ./libanysurrect.so: undefined reference to `ext2fs_mark_block_bitmap_range'     ./libanysurrect.so: undefined reference to `ext2fs_unmark_generic_bitmap'     ./libanysurrect.so: undefined reference to `ext2fs_group_last_block2'     ./libanysurrect.so: undefined reference to `ext2fs_get_generic_bitmap_end'     ./libanysurrect.so: undefined reference to `ext2fs_test_block_bitmap_range2'     ./libanysurrect.so: undefined reference to `ext2fs_group_of_blk2'     ./libanysurrect.so: undefined reference to `ext2fs_get_generic_bmap_end'     ./libanysurrect.so: undefined reference to `com_err'     ./libanysurrect.so: undefined reference to `ext2fs_test_generic_bitmap'     ./libanysurrect.so: undefined reference to `ext2fs_mark_generic_bitmap'     ./libanysurrect.so: undefined reference to `ext2fs_group_first_block2'     ./libanysurrect.so: undefined reference to `ext2fs_unmark_block_bitmap_range'     ./libanysurrect.so: undefined reference to `ext2fs_get_generic_bmap_start'     ./libanysurrect.so: undefined reference to `ext2fs_unmark_generic_bmap'     ./libanysurrect.so: undefined reference to `ext2fs_test_generic_bmap'     ./libanysurrect.so: undefined reference to `ext2fs_mark_block_bitmap_range2'     ./libanysurrect.so: undefined reference to `ext2fs_test_block_bitmap_range'     ./libanysurrect.so: undefined reference to `ext2fs_mark_generic_bmap'     ./libanysurrect.so: undefined reference to `ext2fs_get_generic_bitmap_start'     collect2: ld returned 1 exit status     make[2]: *** [anysurrect] Error 1     make[2]: Leaving directory `/usr/local/src/anyfs-tools-0.85.1c/src/anysurrect'     make[1]: *** [anysurrect_util] Error 2     make[1]: Leaving directory `/usr/local/src/anyfs-tools-0.85.1c/src'     make: *** [progs] Error 2


Error: integer expression expected

I have written a script to determine the Load average on the server as follows:               #!/bin/bash          loadavg=`top -b -n1 | grep -i load | awk -F, '{print$4}'| awk -F: '{print $2}'`          if [ "${loadavg}" -le  1 ]     then     echo "OK - Load Average = ${loadavg} | Load_Average=${loadavg}"     exit 0;     elif [ "${loadavg}" -gt 1 ] && [ "${loadavg}" -le 2 ]     then     echo "WARNING - Load Average = ${loadavg} | Load_Average=${loadavg}"     exit 1;     elif [ "${loadavg}" -gt 2 ]     then     echo "CRITICAL - Load Average = ${loadavg} | Load_Average=${loadavg}"     exit 2;     else     echo "UNKNOWN - Load Average = NaN | Load_Average=NaN"     fi      When the script is executed, it displays following error:               ./loadavg.sh     ./loadavg.sh: line 5: [:  0.06: integer expression expected     ./loadavg.sh: line 9: [:  0.06: integer expression expected     ./loadavg.sh: line 13: [:  0.06: integer expression expected     UNKNOWN - Load Average = NaN | Load_Average=NaN


Is there any tools which can be used to make ports available from any firewall network?

I have been testing my application which has TCP/UDP ports for peer to peer with the help of server signalling commands for making communication, that works when I have Public IP or Lan IP and not firewall/port blocks are involved. I will name my end points here: a) PC1 - running in European commission having Lan IP and unknown Wan IP b) PC2 - running in European commission having Lan IP and unknown Wan IP c) Server 1 - running in Amazon with public IP Now the same Application I am testing in European commission/Airport/Rail way networks where there internet inbound/outbound traffics are having firewall and rules as a result it fails to communicate with server for mapping and application algorithms. On those PC1/PC2 how-ever I tested Skype and it simply works without caring firewall or all those network issues. Skype simply works. So I was thinking is there any third party tools which I can use in my PC1/PC2 to make list of ports available remotely to access via TCP/UDP (without caring what firewall or network they are located?) . So that from Server I can do the port mapping and bridge or relay there packets? (For example Skype works in such complicated network, is there any tools we have in Linux to use it as external package)


How to disable requiretty for a single command in sudoers?

I want to disable requiretty so that I can sudo within scripts, but I'd rather only disable it for a single command rather than everything. Is that possible within the sudoers config?


Arch Linux Ethernet to WiFi bridge

I want to use a Raspberry Pi running Arch Linux to extend my WiFi network. My situation is that I have a spare WiFi router that I want to use to expand my WiFi reception range as well as give me a few extra Ethernet connections to my network. I have tried setting up the router itself to create a bridge to my existing router but it seems the two different types of routers that I have to not really mesh but that's another story. What I want to do is connect my Pi to my existing WiFi network and then bridge its WiFi adapter with its Ethernet adapter and connect the Ethernet adapter to my second router. I will then disable DHCP and NAT on the second router allowing it function only as an access point and a switch. I would prefer if devices connected to the second router could be on the same subnet as those on the first but I that's not possible I guess they could be on a different subnet and then the Pi would just have to be set up as a gateway. My problem is that I cannot find any instructions for setting up either of these systems on Arch Linux. All I can find are seemingly promising instructions for Debian and ways of setting up Arch as an internet gateway. I would prefer to use Arch because I have an image for it and downloading a Raspbian one will take an eternity on my connection, I also believe that Arch has a much smaller footprint and will run faster on the Pi. PS. I have tried brctl but it tells me that adding a wlan adapter to the bridge is not supported.


How to kill tmux window automatically when terminal window closed?

I am new to tmux. I am starting a process in a tmux window in a terminal window. When I close the terminal window, the process not killing automatically but If I kill tmux window before close terminal window, the process killing. How can I kill related tmux window when the terminal window closed ? Can we bind commands the close event of the terminal window ?