title: Edit a file in several emacs sessions

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


title: Check values in a text file

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


title: XML parsing using xmllint and customizing the output

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


title: Backed up over wrong hard drive

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


title: How can I get the netmask from an IP address?

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


title: Resuming screen with UTF8 enabled breaks character input

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


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

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


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

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


title: Question about using pdflatex on RedHat in CentOS

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


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

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


title: Show sum of file sizes in directory listing

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


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

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


title: Pass flags to xargs

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


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


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

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


title: Bought speakers (HS-307 USB), driver issue

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


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

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


title: How to change wrong mime type for msi file?

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


title: ext4: where did my free space go?

text: 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)?


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

text: 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


title: How to restore from a scrambled screen?

text: 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


title: LVM hangs while trying to create my root device node

text: 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.


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

text: 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`.


title: how to convert number to time format in shell script?

text: 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?


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

text: 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?


title: Best tool for monitoring server usage

text: 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.


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

text: 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.


title: How to get the distribution of file sizes?

text: 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.


title: What is the Mode_switch modifier for?

text: 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)?


title: 'ls -l' file timestamp format

text: 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)


title: Is swap an anachronism?

text: 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'


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

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


title: Mounting multiple devices at a single mount point on Linux

text: 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?


title: Ssh keeps asking for passphrase several times

text: 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?


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

text: 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?


title: running an executable in parallel by dividing the input directory tree

text: 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?


title: Why are shared libraries executable?

text: 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?


title: Second loopback network interface (for netem)

text: 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?


title: Parameters of optimization TCP / IP in Linux Mandriva

text: 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!


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

text: 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?


title: OMXplayer and HDMI audio on the Raspberry Pi

text: 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?


title: How to move the files based on Year

text: 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


title: bash_profile stops after file call

text: 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?


title: Which amongst the given option is TRUE about login shell?

text: 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.


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

text: 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?


title: Script to choose editor to open file based on the argument

text: 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`.


title: i386 libtool conflicting with x86_64 libtool when installing Handbrake

text: 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


title: IPTABLES to block all outgoing connections except selected networks

text: 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?


title: recover corrupted directory from ext3 partition

text: 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


title: midnight commander: settings for mcview not honored

text: `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?


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

text: 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?


title: How to get a clean environment in a ksh shell?

text: 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.


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

text: 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?


title: .bashrc doesn't get executed

text: 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.


title: Broken sudo on amazon web services ec2 linux centOS

text: 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.


title: Cross-process dup on Linux

text: 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_?


title: Linux Mint: Hibernate does not work

text: 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


title: Why are there Firefox 3.6 in the Linux repositories

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


title: Suggestions for IRC Server

text: 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


title: Kernel Modules: .o vs .ko

text: 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?


title: Bash prompt keeps disappearing

text: 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 \$ '


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

text: 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`?


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

text: 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?


title: what is 'smakynet' in the netstat result?

text: 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.


title: Unable to connect to the samba server

text: 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?


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

text: 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.


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

text: 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


title: How to add an IP to hostname file

text: 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.


title: How do I suppress a warning message?

text: 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?


title: Convert screen log to html

text: 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?


title: ACL defaults: files vs directories

text: 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


title: Install Ubuntu from the same or different partition?

text: 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.


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

text: 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?


title: Squid3 failed to response when access certain website

text: 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.


title: Using while loop to ssh to multiple servers

text: 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


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

text: 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 "$@"     }


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

text: 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.


title: How to cache KDE main menu in memory?

text: 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)


title: SSH: tunnel without shell on ssh server

text: 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


title: Adding the panel to the second monitor

text: 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?


title: awk filtering live capture with file as pattern list

text: 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!


title: How to get bash to suggest a missing package?

text: 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?


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

text: 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


title: Best way to create RAID on an existing system drive

text: 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)


title: Graphical console applications in Emacs

text: 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?


title: Task management tools with keyboard navigation that run in a terminal

text: 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?


title: Pulseaudio/X permission other user/SSH

text: 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)?


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

text: 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


title: Pass login messages to tmux

text: 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)


title: PgPool - Host Based Routing

text: 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.


title: Shell Script for logging into a ssh server

text: 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


title: Automated SSH Login

text: > **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?


title: How to Expand LVM2 Partition in Fedora Linux

text: 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?


title: Getting a working chroot environment to boot with Grub2

text: **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.


title: Are system calls available in a chroot environment?

text: 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.


title: Build Mini Linux and Embedded Linux

text: **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"


title: Conditional block vs conditional statement (if)

text: 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?


title: Keyboard layout bug in login window after screen lock

text: 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?


title: Extract pitch information from audio file

text: 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)?


title: How to quickly store and access often used commands?

text: 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.


title: tabs when using 'screen'

text: 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?


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

text: 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


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

text: 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


title: Struggling with XRDP (Fedora 19 connecting from Windows 7)

text: 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!


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

text: 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)~~.