title: How to scroll the screen using the middle click?

text: On Windows, most programs with large, scrollable text containers (e.g. all browsers, most word processors and IDEs) let you press the middle mouse button and then move the mouse to scroll. This scrolling is smooth and allows you to scroll very quickly using just the mouse. When I've used Linux on _laptops_ , two-finger scrolling performs roughly the same function; it's easy to scroll down a page quickly (much more quickly than one can by scrolling a mouse wheel) but the scrolling remains smooth enough to allow precise positioning. I am unsure how to achieve the same thing when running Linux on a Desktop with a mouse. As far as I can tell after a whole bunch of Googling, there are neither application-specific settings to swap to Windows-style middle mouse button behaviour, nor any system-wide settings to achieve the same effect. Just to make this concrete, let's say - if it's relevant - that I'm asking in the context of Firefox, Google Chrome, Gedit and Eclipse on a recent version of either Mint (what I use at home) or Ubuntu (what I use at work). I suspect this is a fairly distro-agnostic and application-agnostic question, though. As far as I can tell, my options for scrolling are:   * Scroll with the mousewheel - slow!   * Use the PgUp / PgDn keys - jumps a huge distance at a time so can't be used for precise positioning, and is less comfortable than using the mouse   * Drag the scroll bar at the right hand side of the screen up and down like I used to do on old Windows PCs with two-button mice. This is what I do in practice, but it's just plain less comfortable than Windows-style middle-mouse scrolling; on a huge widescreen, it takes me most of a second just to move the cursor over from the middle of the screen to the scrollbar, and most of a second to move it back again, and I have to take my eyes off the content I'm actually scrolling to do this. None of these satisfy me! This UI issue is the single thing that poisons my enjoyment of Linux on desktops and almost makes me wish I was using a laptop touchpad instead of a mouse. It irritates me enough that I've concluded that either I'm missing some basic Linux UI feature that solves this problem, or I'm just an oversensitive freak and it doesn't even bother anyone else - but I'm not sure which. So my questions are:   1. Does Windows-style middle mouse button scrolling exist anywhere in the Linux world, or is it really purely a Windows thing? In particular, do any Linux web browsers let you use Windows-style scrolling?   2. Are there any mechanisms for scrolling pages that exist in Linux but not in Windows, especially ones that perform the role I've described?   3. Any other solutions that I'm missing?


title: How to set Cols and Lines for a Subprocess

text: I have a script that runs a series of scripts numbered 001,002,003,004... etc down to 041 right now, will be more in the future - and these scripts them selves use some cursor control to print a progress bar and other status information and get the width and height of the terminal from `tput cols` and `tput lines` respectively. Without rewriting the sub-scripts, I would like to reserve _one_ line at the bottom for _overall_ status information for the outer script. I was curious if there was a way to set what tput replies for lines and cols. There must be a way because tmux achieves it. I was thinking there may be an environmental variable but the only change I can see that tmux makes when running env is setting the $TERM to screen. Any help would be greatly appreciated


title: How to get cron to delete files with names starting with foo and file extensions ending with bar? - done with php script

text: I'm sorry to post such a question but honestly, I've spent hours reading posts and still it doesn't work... Also if this should be posted else where but this felt like the right place. I have a directory /home/username/exampledomain.com/html/cache/normal/exampledomain.com ... Inside are files created by a caching system called Boost used by Drupal. The files I'm interested in have this syntax: page-name_foo.html and page- name_foo.html.gz. There is also one of each for just page-name_.html and page- name_.html.tz ... Just incase i'm not using foo correctly above, I mean foo could be anything... So I've tried a few different things now and no success... The one that feels the closet is this:               find /home/username/exampledomain.com/html/cache/normal/exampledomain.com/  -maxdepth 1 -name 'page-name_*.html*' -type f  -exec rm {} \; > /dev/null      If I run this on the command line, it works perfectly... I have a control panel that lets me just point and click for setting the timings, that usually precede the command to run... My interpretation of cron was that you could just use it to periodically run commands. I'm clearly mis-understanding things or it would just do it... :) As always, all help or pointers are very much appreciated...


title: sudo: ./server: command not found

text: I wrote a piece of software called "server" and I am trying to run it on a different linux box. The command I am typing is:               sudo ./server      I am in the directory with 'sever' in it, and it tells me that it cannot find the command. All the other questions I've seen similar to this state that sudo wasn't installed, but sudo is installed on this machine. If I try to run               ./server      it says 'Permission denied' so it knows there is a file in this directory named 'server.' I'm a windows guy normally, so if I'm missing something basic, don't laugh too hard. What am I missing?


title: One-way-sync a directory, but leave deleted files deleted on the destination

text: I want to sync a directory between two systems. To make it more interesting the syncing must only be done in one direction, i.e.:   * if a file is deleted in the source directory, it must also be deleted in the destination, if it was previously transfered   * deleted files in the destination directory must not be deleted in the source   * partially transfered files (e.g. because of network problems) must be finished on the next sync   * new files in the source directory must be transfered to the destination   * **deleted files in the destination directory must not be re-transfered** That means the source system has basically a master role, except that deleted files in the destination will not be forced back. Both Linux systems have rsync/ssh/scp available. New files in the source directory are created in such a way that one can use their mtime to detect them, e.g.:               if mtime(file) > date-of-last-sync then: it is a new file that needs to be transfered      Also, existing files are not changed in the source directory, i.e. the sync does not need to check for differences in already (completely) transfered files.


title: Finding out whether current alias/function/script is running inside Tmux - with a twist

text: **NB:** Yes, I've read How can I tell if I'm in a tmux session from a bash script? How can I find out whether I am running inside a Tmux session from my shell or shell script or shell function or alias if I used `sudo su -` in between?: ![The problem](http://i.stack.imgur.com/YOQR8.png)


title: How to display disk capacity via Samba?

text: I have a Raspberry Pi running Raspbian with a Samba 3.6.6 server. The config file:               [global]       encrypt passwords = yes       log level = 1       max log size = 1000       read only = no       security = user     [A]       browsable = yes       read only = no       create mask = 0777       directory mask = 0777       path = /mnt/a     [B]       browsable = yes       read only = no       create mask = 0777       directory mask = 0777       path = /mnt/b      Under /mnt/a and /mnt/b I have mounted 2TB NTFS drives (sda1 and sda2). Everything works but when I map those in Windows 8 it doesn't display the capacity under them. Is there a way to change this?


title: Is a -rw-rw-rw- file really inaccessible inside a drwxrwx--- directory?

text: Say I have a directory with these permissions:               drwxrwx---      Inside this directory, a file with these permissions:               -rw-rw-rw-      Is the file readable/writable by everyone or not ? If not, how secure is this access restriction? What if a random user makes a link to my file inside his home directory? Could he access the file then? Or could he access the file by guessing its inode number and using some system calls on inodes?


title: Invert colors of the active window

text: Sometimes I work in low light and I need to invert the color of specific windows to reduce my eye strain. This could be my pdf viewer to web pages for reference work. I know how to invert the entire screen:               xcalib -invert -alter      But I can't find any man pages, docs or posts how to invert _a single window only_. I did this before yet cannot find how. Bizarre! Searching the repos for other xorg tools I found xpdf, it has invert support but won't help for anything other than viewing pdf's. I don't use compositing so please don't suggest Compiz. I use Openbox WM. Thanks all. **Update** Instead of a general all-purpose tool to invert any window, I focused my search on how to invert colors for a Google Chrome tab instead. I found Color Bookmarklets, you drag them to the browser toolbar and hit them to change the page content to invert the colors (invert lightness).


title: How to play a G2M4 encoded .wmv file (Ubuntu)?

text: I was using _Ubuntu 13.04_ (end of life) - now using 13.10. I have this _.wmv_ video file. When I try to play it on _vlc_ , it shows the error below, there is no video but the audio is working properly:               No suitable decoder module:     VLC does not support the audio or video format "G2M4".     Unfortunately there is no way for you to fix this.      Do I need to install any codec? How can I play this file? * * * When I run it with _totem_ movie player, I get:               Required plugin could not be found          Videos requires to install plugins to play media files of the following     type: video/x-asf-unknown decoder      * * * > EDIT#1 This edit is after trying the answers given. 1) I installed `mplayer`. When I ran the video file it was processing something which would have taken a long time to complete. Please see the screen shot below(look at the last line). ![enter image description here](http://i.stack.imgur.com/zwmFl.png) 2) Then I installed `smplayer` (GUI). When I tried running the .wmv file, only audio came but not video (as with the case of vlc). 3) I tried upgrading my `vlc` version from the current version 2.0.8 to a higher one. I googled & tried different ways but to no avail. Then I removed it & reinstalled it.               1) sudo apt-get purge vlc          2) sudo apt-get autoremove          3) sudo apt-get install vlc      After doing all this, still the version of the `vlc` was the same 2.0.8! Why so? Is it because Ubuntu 13.04 isn't supported any more? So from Ubuntu repository, only that version can be installed? Is it that for installing latest or further versions I need to get it from website? Now also the video of the .wmv file didn't run.               4) `ubuntu-restricted-extras` are already installed.      I would like to repeat that I'm working on Ubuntu 13.04 which is not supported since last 5 months. This may be the issue. I'm preparing my laptop now for upgrading to newer versions of Ubuntu. Once I install the new OS, I will check whether the video file runs there! > EDIT#2 I've installed Ubuntu13.10 on my laptop now & removed the older unsupported one (Ubuntu 13.04). Now I tried to run the video but failed. 1) 1st I write with respect to what Seth has written. I ran `sudo apt-get install ubuntu-restricted-extras` but still the video part isn't running. 2) Now I write with respect to what Erik wrote in his answer. After installing Ubuntu13.10, I installed vlc player via `sudo apt-get install vlc`. The version of VLC was 2.0.8. (Erik, one thing to be noted. This is the same version as with ubuntu13.04.) To upgrade to 2.1.0., I ran the 3 commands (using ppa). I found the version now to be `VLC media player 2.0.10 Twoflower (revision 2.0.8+git20140326+r49189+13+8~ubuntu13.10.1)` & not 2.1.0. With this version, the .wmv file couldn't run the video part as earlier. Only audio is running as was earlier. Here the screen shot is the same as the 1st image in this Q. So, using PPA, I couldn't upgrade to 2.1.0. So, it's working the same way as with previous O.S. Only audio is functioning but not video. > EDIT#3 This edit is with reference to the answer posted by @erik I'm able to compile vlc from source (option 1 as mentioned in his answer) but still the video part couldn't be played, only the audio is working as earlier.               sudo apt-get build-dep vlc     ./configure     make     sudo make install      I didn't find any error in running the above commands. Now in this version ( 2.1.0. ) also, only audio is working and not video. So, is it that G2M4 support is there in vlc version 2.1.4 (which is in ubuntu 14.04) but not in 2.1.0.? > EDIT#4 As per illuminE's answer, I'm writing the output of the ffmpeg command below. I installed ffmpeg version 0.10 via ppa as available in one of his link. But still the command failed. I feel this version can't convert the G2M4 encoded .wmv file. I'm searching for another PPA or something else to install latest version.               ravi@ravi-Aspire-5315:~$ ffmpeg -i '/home/ravi/2014-04-12_11.39_Equity_Markets-I.wmv'  -c:v libx264 -crf 23 -c:a ac3 -q:a 100 output.mp4     ffmpeg version 0.10.12-7:0.10.12-1~saucy1 Copyright (c) 2000-2014 the FFmpeg developers       built on Apr 26 2014 10:04:40 with gcc 4.8.1       configuration: --arch=i386 --disable-stripping --enable-pthreads --enable-runtime-cpudetect --extra-version='7:0.10.12-1~saucy1' --libdir=/usr/lib/i386-linux-gnu --prefix=/usr --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc --enable-libcdio --enable-x11grab --enable-libx264 --shlibdir=/usr/lib/i386-linux-gnu --enable-shared --disable-static       avutil      configuration: --arch=i386 --disable-stripping --enable-pthreads --enable-runtime-cpudetect --extra-version='7:0.10.12-1~saucy1' --libdir=/usr/lib/i386-linux-gnu --prefix=/usr --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc --enable-libcdio --enable-x11grab --enable-libx264 --shlibdir=/usr/lib/i386-linux-gnu/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-doc       avcodec     configuration: --arch=i386 --disable-stripping --enable-pthreads --enable-runtime-cpudetect --extra-version='7:0.10.12-1~saucy1' --libdir=/usr/lib/i386-linux-gnu --prefix=/usr --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc --enable-libcdio --enable-x11grab --enable-libx264 --shlibdir=/usr/lib/i386-linux-gnu/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-doc       avformat    configuration: --arch=i386 --disable-stripping --enable-pthreads --enable-runtime-cpudetect --extra-version='7:0.10.12-1~saucy1' --libdir=/usr/lib/i386-linux-gnu --prefix=/usr --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc --enable-libcdio --enable-x11grab --enable-libx264 --shlibdir=/usr/lib/i386-linux-gnu/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-doc       avdevice    configuration: --arch=i386 --disable-stripping --enable-pthreads --enable-runtime-cpudetect --extra-version='7:0.10.12-1~saucy1' --libdir=/usr/lib/i386-linux-gnu --prefix=/usr --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc --enable-libcdio --enable-x11grab --enable-libx264 --shlibdir=/usr/lib/i386-linux-gnu/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-doc       avfilter    configuration: --arch=i386 --disable-stripping --enable-pthreads --enable-runtime-cpudetect --extra-version='7:0.10.12-1~saucy1' --libdir=/usr/lib/i386-linux-gnu --prefix=/usr --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc --enable-libcdio --enable-x11grab --enable-libx264 --shlibdir=/usr/lib/i386-linux-gnu/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-doc       swscale     configuration: --arch=i386 --disable-stripping --enable-pthreads --enable-runtime-cpudetect --extra-version='7:0.10.12-1~saucy1' --libdir=/usr/lib/i386-linux-gnu --prefix=/usr --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc --enable-libcdio --enable-x11grab --enable-libx264 --shlibdir=/usr/lib/i386-linux-gnu/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-doc       swresample  configuration: --arch=i386 --disable-stripping --enable-pthreads --enable-runtime-cpudetect --extra-version='7:0.10.12-1~saucy1' --libdir=/usr/lib/i386-linux-gnu --prefix=/usr --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc --enable-libcdio --enable-x11grab --enable-libx264 --shlibdir=/usr/lib/i386-linux-gnu/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-doc       postproc    configuration: --arch=i386 --disable-stripping --enable-pthreads --enable-runtime-cpudetect --extra-version='7:0.10.12-1~saucy1' --libdir=/usr/lib/i386-linux-gnu --prefix=/usr --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc --enable-libcdio --enable-x11grab --enable-libx264 --shlibdir=/usr/lib/i386-linux-gnu/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-doc       libavutil      51. 35.100 / 51. 35.100       libavcodec     53. 61.100 / 53. 61.100       libavformat    53. 32.100 / 53. 32.100       libavdevice    53.  4.100 / 53.  4.100       libavfilter     2. 61.100 /  2. 61.100       libswscale      2.  1.100 /  2.  1.100       libswresample   0.  6.100 /  0.  6.100       libpostproc    52.  0.100 / 52.  0.100     [asf @ 0x9396ac0] max_analyze_duration 5000000 reached at 5194000     [asf @ 0x9396ac0] decoding for stream 1 failed     [asf @ 0x9396ac0] decoding for stream 2 failed     [asf @ 0x9396ac0] Could not find codec parameters (Video: g2m (G2M4 / 0x344D3247), 1920x1080, 97 kb/s)     Input #0, asf, from '/home/ravi/2014-04-12_11.39_Equity_Markets-I.wmv':       Metadata:         WMFSDKVersion   : 12.0.9600.16384         WMFSDKNeeded    : 0.0.0.0000         IsVBR           : 1         WM/ToolVersion  : 6.2.1 Build 1350         WM/ToolName     : 㙉䜴呯䵯敥楴杮         BitRateFrom the writer: 145         Audio samples   : 612         Video samples   : 393         recording time  : Sat, 12 Apr 2014 13:26:37 India Standard Time       Duration: 01:42:11.56, start: 0.000000, bitrate: 149 kb/s         Stream #0:0: Audio: wmav2 (a[1][0][0] / 0x0161), 44100 Hz, 1 channels, s16, 48 kb/s         Stream #0:1: Data: none         Stream #0:2: Video: g2m (G2M4 / 0x344D3247), 1920x1080, 97 kb/s, 10 tbr, 1k tbn, 1k tbc     Video pixel format is unknown, stream cannot be encoded


title: reset for loop counter

text: Simple question: if I have a `for` loop (zsh) over an unreliable list, by which I mean the list contains entries that can't be predicted beforehand, then can I reset the `for` loop counter? This demonstrates what I'm asking for:               # e.g. list=(1 5 2 9)     for i in $list ; do         [[ $i = 2 ]] && i=${list[1]}     done      (This example will obviously loop forever if it worked.) I can only think of doing it like this:               for ((j=1; j<=${#list}; j++)); do         [[ ${list[$j]} = 2 ]] && j=1     done      Is there a simpler way of doing it? ("Simpler" meaning easier to follow with the eye what you're doing.)


title: Copy a folder and its content to all Nginx vhosts host

text: I am interested to know if a single command line that would allow me to recursively copy a folder to all of our NGINX Virtual Host htdocs folders: I need to copy that folder to all hosts located in vhosts :               /var/www/vhosts/*/htdocs/


title: Compare the similar file and not similar files display below output in awk?

text: I'd like to compare the following 2 files and display a comparison of the 2 files with each other. File #1:               DATE       DS      2012-08-02 1     2013-06-23 1     2013-06-27 2     2013-06-28 2     2013-06-29 779      File #2:               DATE       DE     2013-06-16 5     2013-06-17 1     2013-06-18 3     2013-06-19 1     2013-06-20 5     2013-06-21 6     2013-06-22 6     2013-06-23 6     2013-06-24 5     2013-06-25 9     2013-06-26 7     2013-06-27 22     2013-06-28 59     2013-06-29 334     2013-06-30 11      Comparison of file #1 & #2:               DATE       DS   DE      2012-08-02 -    1     2012-08-05 -    2     2013-06-16 5    -       2013-06-17 1    -       2013-06-18 3    -       2013-06-19 1    -       2013-06-20 5    -       2013-06-21 6    -     2013-06-22 6    -     2013-06-23 6    -     2013-06-24 5    -     2013-06-25 9    -     2013-06-26 7    1     2013-06-27 22   2     2013-06-28 59   2     2013-06-29 334  779     2013-06-30 11   -      Above the file1, DATE and DS means "data selected" for a particular date of how many selected. It's showing from file1 and file2 also the same, but different dates for how many "deactivated" (DE). Now I want to display from file1 & file2 using AWK. Date for $1 from both files, $2 from file1, $2 from file2. If a particular date is compared also it will display DE, DA. For example:               DATE      DE DS     2012-08-1 -   1 # Date is present in $1 from file1 but file2 is not there.                      # This is the date I want. Also I want to display a (-) for                      # DE which is not there.


title: Bash: How to get different color for the command line and its output?

text: Basically, I am trying to edit my `.bashrc` such that when I type `ls` or whatever I type on the console, it will be displayed in Green color. At the same time, all the results / output displayed by `ls` or other commands (output from a python / java script) will be displayed in a grey color. Is this possible ? What would I need to add into the `.bashrc` file ? Thanks **UPDATE:** Well. Thank you very much for the answers and comments: I saw from this this link that I just have to add the following next to the definition of `$PS1` `trap '[[ -t 1 ]] && tput sgr0' DEBUG` Then it works. I am not sure there will be any issues. But it seems to work for now.


title: What is the meaning of "stat" in the SFTP error message "Couldn't stat remote file"

text: I've seen this when using SFTP; for example when I try to remove a file that isn't on the remote server:               sftp> RM coa.dat.gz     Couldn't stat remote file: No such file or directory     Removing coa.dat.gz     Couldn't delete file: No such file or directory      Since "stat" isn't an English verb, this is a bit confusing. It is clear that this has something to do with the UNIX/Linux command `stat` or the C function `stat()`, but I welcome a more complete description.


title: Compiling PHP-FFMPEG Extension

text: cd ffmpeg-php*     phpize      ./configure --with-ffmpeg=/usr/local/cpffmpeg      make      Then I end up with the following issues on my make:               ...     ...     ...          /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c:86: warning: (near initialization for âini_entriesâ)     /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c:86: warning: excess elements in scalar initializer     /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c:86: warning: (near initialization for âini_entriesâ)     /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c:86: warning: excess elements in scalar initializer     /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c:86: warning: (near initialization for âini_entriesâ)     /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c:92: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before â{â token     /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c:130: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before â{â token     /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c:143: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before â{â token     /usr/local/cpffmpeg/include/libavformat/avio.h:266: error: old-style parameter declarations in prototyped function definition     /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c:163: error: expected â{â at end of input     make: *** [ffmpeg-php.lo] Error 1      * * * EDIT: I tried this:               CFLAGS=-I/usr/local/cpffmpeg/include/ ./configure --with-ffmpeg=/usr/local/cpffmpeg      and got:               make     /bin/sh /usr/src/ffmpeg-php-0.6.0/libtool --mode=compile cc  -I. -I/usr/src/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/usr/src/ffmpeg-php-0.6.0/include -I/usr/src/ffmpeg-php-0.6.0/main -I/usr/src/ffmpeg-php-0.6.0 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/cpffmpeg/include/libavcodec/ -I/usr/local/cpffmpeg/include/libavformat/ -I/usr/local/cpffmpeg/include/libavutil/ -I/usr/local/cpffmpeg/include/libswscale/ -I/usr/local/cpffmpeg/include/libavfilter/ -I/usr/local/cpffmpeg/include/libavdevice/  -DHAVE_CONFIG_H  -I/usr/local/cpffmpeg/include/ -Wall -fno-strict-aliasing   -c /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c -o ffmpeg-php.lo     mkdir .libs      cc -I. -I/usr/src/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/usr/src/ffmpeg-php-0.6.0/include -I/usr/src/ffmpeg-php-0.6.0/main -I/usr/src/ffmpeg-php-0.6.0 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/cpffmpeg/include/libavcodec/ -I/usr/local/cpffmpeg/include/libavformat/ -I/usr/local/cpffmpeg/include/libavutil/ -I/usr/local/cpffmpeg/include/libswscale/ -I/usr/local/cpffmpeg/include/libavfilter/ -I/usr/local/cpffmpeg/include/libavdevice/ -DHAVE_CONFIG_H -I/usr/local/cpffmpeg/include/ -Wall -fno-strict-aliasing -c /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c  -fPIC -DPIC -o .libs/ffmpeg-php.o     In file included from /usr/include/sys/stat.h:107,                      from /usr/local/include/php/main/php_streams.h:28,                      from /usr/local/include/php/main/php.h:400,                      from /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c:40:     /usr/include/bits/stat.h:91: error: field âst_atimâ has incomplete type     /usr/include/bits/stat.h:92: error: field âst_mtimâ has incomplete type     /usr/include/bits/stat.h:93: error: field âst_ctimâ has incomplete type     In file included from /usr/local/include/php/main/php_streams.h:28,                      from /usr/local/include/php/main/php.h:400,                      from /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c:40:     /usr/include/sys/stat.h:367: error: array type has incomplete element type     /usr/include/sys/stat.h:374: error: array type has incomplete element type     In file included from /usr/local/include/php/main/php.h:406,                      from /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c:40:     /usr/local/include/php/TSRM/tsrm_virtual_cwd.h:218: error: expected specifier-qualifier-list before âtime_tâ     /usr/local/include/php/TSRM/tsrm_virtual_cwd.h:246: error: expected declaration specifiers or â...â before âtime_tâ     /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c: In function âzm_startup_ffmpegâ:     /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c:94: warning: implicit declaration of function âavcodec_initâ     make: *** [ffmpeg-php.lo] Error 1      I'm not entire sure what is wrong. Been googling for some answers but so far I've got nothing. I used http://ffmpeginstaller.com/ for the FFMPRG install. Bad idea? I know autoinstaller systems are very bad ideas. EDIT: Tried other versions, same issue.


title: Insert new line after non matching pattern

text: I have following output from script               host1:101     host1:102     host2:101     host2:102     host2:103     host4:101     host5:101     host5:102     host5:103     host5:104      etc.. I wanted to insert a new line after each host group.               host1:101     host1:102          host2:101     host2:102          host3:101     host3:102      Any AWK onliners to compare each consecute line with 1st field and insert new line before non-matching 1st field?


title: udev weirdness: /dev/hda1 mounted but file not present

text: I _think_ my question is related to udev and/or udisks, but I am really not sure at all what's going on here. To start with, my system works more or less fine. The less part is due to the fact that, after some upgrades to my Debian install, the /dev folder started acting weird, in relation to what I used to think I knew about unix drive management. To get to the point, here are two commands and their output:               $ ls /dev/h*     /dev/hidraw0  /dev/hidraw1  /dev/hidraw2  /dev/hpet          $ mount     /dev/hdb1 on / type ext3 (rw,errors=remount-ro)     tmpfs on /lib/init/rw type tmpfs (rw,nosuid,size=5242880,mode=755,size=5242880,mode=755)     ....      Now, notice that `/dev/hdb1` is mounted (it really is!) but the corresponding file doesn't appear in the `/dev` directory? How can this be? If the file doesn't exist, where is it `/dev/hdb1` listed as a link to the drive? More importantly, say I want to mount a CD. I put it in the drive, but `/dev/scd0` doesn't appear, so I can't do `mount /dev/scd0 /media/cdrom` because it gives me back a `File not found` error. However, after lots of fiddling I found two ways of doing it:               $ mount /dev/disks/by-id/ata-HL-DT-ST_DVDRAM_GSA-4160B_K3H4A7E1256     $ udisks --mount /dev/scd0 /media/cdrom      Both of the commands above work. So, my question is, how does `udisks` know how to deal with a device file that doesn't actually exist and, possibly more importantly, why does `mount` think it mounted the file system at `/dev/hdb1` while the file is not even there? Finally, in case this has to do with a recent kernel upgrade:               $ uname -srv     Linux 3.1.0-1-686-pae #1 SMP Sun Dec 11 20:40:16 UTC 2011


title: Does Fedora's firewall use iptables?

text: Fedora has a Firewall Configuration interface: ![Screenshot of the interface](http://i.stack.imgur.com/wW2Il.jpg) Does this use `iptables` underneath to enforce the rules?


title: Redirect the default HTTP port to an application

text: On my CentOS server at `mydomain.com`, I have an svn web application running on port 8880. I want to hide the port: at this moment, if anybody wants to access, they need to access through `http://thisdomain.com:8880/svn`. I want to make the application accessible at `http://thisdomain.com/`.


title: Trying to install numpy, nltk to python 2.4 on CentOs 5.10 with multiple versions of python installed - python 2.4 and python 3.3

text: I've inherited a project on a hosted server and I'm trying to install and import numpy and nltk into the project. The OS is centOs 5.10 and the web app uses web.py. There are two version of python installed on the box both python 2.4 and python 3.3. The default is pointing to version 2.4, "python -V" = python 2.4.3. Eventually I will upgrade and use python 3.3, move toward Django, etc but for the time being I'm stuck with this setup. I've been researching a while on how to do this. From my research I've read about using pip to install numpy and then nltk. In the python2.4 directory I was able to use easy_install to install pip-1.4.1-py2.4.egg. When I try to use pip-2.4 to install anything I get a syntax error in the pip file. See below...               $pip-2.4 numpy          File "/home/slrp/bin/pip-2.4", line 7, in ?     sys.exit(     File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 236, in load_entry_point     return get_distribution(dist).load_entry_point(group, name)     File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 2097, in load_entry_point     return ep.load()     File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 1830, in load     entry = __import__(self.module_name, globals(),globals(), ['__name__'])     File "/home/slrp/lib/python2.4/pip-1.4.1-py2.4.egg/pip/__init__.py", line 10, in ?     from pip.util import get_installed_distributions, get_prog     File "/home/slrp/lib/python2.4/pip-1.4.1-py2.4.egg/pip/util.py", line 17, in ?     from pip.vendor.distlib import version     File "/home/slrp/lib/python2.4/pip-1.4.1-py2.4.egg/pip/vendor/__init__.py", line 8     from __future__ import absolute_import     SyntaxError: from __future__ imports must occur at the beginning of the file      Doing some research it's seems this error comes from the fact that I have multiple python installs. This lead me to install virtualenv-1.10.1-py2.4.egg in the python2.4. But when I try to run virtualenv I get the following error.               ERROR: this script requires Python 2.6 or greater.      I've also tried to install numpy using python2.4's easy install but that errors out as well.                 $easy_install-2.4 numpy            File "/usr/bin/easy_install-2.4", line 7, in ?       sys.exit(       File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 1670, in main       with_ei_usage(lambda:       File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 1659, in with_ei_usage       return f()       File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 1674, in <lambda>       distclass=DistributionWithoutHelpCommands, **kw       File "/usr/lib/python2.4/distutils/core.py", line 149, in setup       dist.run_commands()       File "/usr/lib/python2.4/distutils/dist.py", line 946, in run_commands       self.run_command(cmd)       File "/usr/lib/python2.4/distutils/dist.py", line 966, in run_command       cmd_obj.run()       File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 211, in run       self.easy_install(spec, not self.no_deps)       File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 446, in easy_install       return self.install_item(spec, dist.location, tmpdir, deps)       File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 471, in install_item       dists = self.install_eggs(spec, download, tmpdir)       File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 655, in install_eggs       return self.build_and_install(setup_script, setup_base)       File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 930, in build_and_install       self.run_setup(setup_script, setup_base, args)       File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 919, in run_setup       run_setup(setup_script, args)       File "/usr/lib/python2.4/site-packages/setuptools/sandbox.py", line 26, in run_setup       DirectorySandbox(setup_dir).run(       File "/usr/lib/python2.4/site-packages/setuptools/sandbox.py", line 63, in run       return func()       File "/usr/lib/python2.4/site-packages/setuptools/sandbox.py", line 29, in <lambda>       {'__file__':setup_script, '__name__':'__main__'}       File "setup.py", line 16       from __future__ import division, print_function       SyntaxError: future feature print_function is not defined      Again I don't want to upgrade or change the version of python. In the python3.3 directory I was able to successfully run virtualenv. I was hoping this would correct any dependency issue that I might be having because of the multiple installs, but it hasn't. My plan right now is to try and get virtualenv to successfully run for the python2.4 version. My hope is that if I can set up virtual environments for both versions of python it will resolve the problem. But as you can see I can't get virtualenv in python2.4 to successfully run. Below is some more information about what is in each python directory.               [user@server python3.3]$ ls     easy-install.pth  nltk-2.0.4-py3.3.egg  numpy-1.8.0-py3.3.egg-info  PyYAML-3.10-py3.3-linux-i686.egg     ENV               numpy                 pip-1.4.1-py3.3.egg         virtualenv-1.10.1-py3.3.egg               [user@server python2.4]$ ls     easy-install.pth  git_remote_helpers  MySQL_python-1.2.3c1-py2.4-linux-i686.egg  pip-1.4.1-py2.4.egg  virtualenv-1.10.1-py2.4.egg  web      There is a lot of stuff out there for this and I've been researching for a while. Any help is greatly appreciated! Thanks!


title: Is there a shortcut in bash to delete the last segment of a path?

text: I've become pretty proficient with a number of bash shortcut keys that make my bash-ing faster: C-a/C-e, C-u, C-w, M-f/M-b, C-r etc. One common task that I haven't found a good shortcut for though is when I want to delete the last segment of a path: Say I have               ls ~/projects/arcaneweb/libraries      and I realize I actually meant               ls ~/projects/arcaneweb/sources      Is there a way to just delete `libraries`, saving a load of keystrokes?


title: Can I launch a graphical program on another user's desktop as root?

text: Following are other questions which I think I need to know:   * From a non X Session? (meaning root isn't logged into X)   * If multiple people were logged in on X, could I auto-detect who was on which screen, and thus programmatically detect which screen I need to launch the app on?   * Can I launch the app as the user? ( ok I'm 99.999% sure this is a yes )   * Can I detect if users of group X are logged in to X?


title: Acting on a different display when using SSH

text: I am connecting to a Linux CentOS 2.6 computer via SSH wit the display deported on my screen (using MobaXterm). It is also possible to access to this computer "physically". However, I would like a way to inform people that may want to access "physically" to the computer that I am currently using it via SSH. One way would be for them to make `who` in a terminal and see whether someone is connected from another computer. However, I don't want them to have to check this manually each time (they may - and will - forget this check). Thus, I would like a way to open a window on THEIR display (i.e. the screen plugged to the computer) with a message for them. Somthing like a text into gedit would do the work. Can I do that? Can I open an application on a different display than mine?


title: X "Can't open display: :0" while DISPLAY variable is correct

text: I'm not able to start any GUI applications as a _root_ user:               # pgrep -lf Xorg     1590 /usr/bin/Xorg -br -nolisten tcp :0 vt7 -auth /var/lib/xdm/authdir/authfiles/A:0-PNnJzp     # echo $DISPLAY     :0     # xeyes     No protocol specified     Error: Can't open display: :0     # firefox     No protocol specified     No protocol specified     Error: cannot open display: :0     # xcalc     No protocol specified     Error: Can't open display: :0     #      Distribution is openSUSE 11.2(2.6.31.5-0.1-default) and X.Org X Server version is 1.6.5. My DISPLAY variable is set correctly, isn't it? Any ideas what might cause this problem?


title: X11: Client not authorized when calling with sudo

text: > **Possible Duplicate:**   >  Can I launch a graphical program on another user's desktop as root? I'm trying to do the equivalent of:               $ sudo -u myuser DISPLAY=:1 xterm      However, it give me the following error               Client is not authorized to connect to Server      On the other hand, I can do this just fine:               $ sudo -u -i myuser     $ DISPLAY=:1 xterm      Why isn't the X server allowing me to launch an X11-based app directly as a different user, and is there any way I can explicitly allow this?


title: Udev: running a shellscript that accesses an X display

text: After getting my 3g-modem to work in `Arch Linux` I wanted to eliminate some manual labour required in the process. Hence I needed to create an udev rule. After some trial and error I came up with the following rule named `11-my- rule.rules` which I placed at `/etc/udev/rules.d/`:               # start at sdb to ignore the system hard drive     KERNEL!="sd[b-z]*", GOTO="my_media_automount_end"          # run the script and create a testdir to verify the rule works     ACTION=="add", RUN+="/myscript.sh", RUN+="/bin/mkdir -p '/media/pendrive'"          #remove the testfolder on removal of usb     ACTION=="remove", RUN+="/bin/rm -R '/media/pendrive'"          # exit     LABEL="my_media_automount_end"      My testscript which is meant to be ran is as follows:               #!/bin/bash          DISPLAY=:0 xterm      Which displays xterminal. I have tested the script itself and it works. Also the second **RUN+** that creates the test-directory works as well. Hence I am at a loss just what am I doing wrong.


title: Is it possible to display a graphical application on another host/user

text: We have a small linux cluster ~12 computers and a similar number of users. Is it possible for a superuser to launch a graphical application - say firefox or even a python script on another machine that is being used by another user?


title: tmux consuming 100% of cpu

text: I've been running `byobu` for a while now, and in the last few hours it has started to consume 30-100% of the CPU on the core it's running on. This a noticeable delay when entering text, or switching windows. It does not appear to be an issue with the server (i've included the output of `top` below). Total memory and cpu usage appears fine, and if I open a new `byobu` session on the server it works fine (consuming almost 0% of the CPU). I've never experienced this before. Any advice on what is causing it, and how to fix it without killing the whole session would be appreciated!               top - 16:09:40 up 93 days,  1:59,  4 users,  load average: 42.87, 42.77, 42.78     Tasks: 792 total,  48 running, 656 sleeping,   0 stopped,  88 zombie     Cpu(s): 38.3%us, 22.4%sy,  0.0%ni, 39.2%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st     Mem:  528381020k total, 514696248k used, 13684772k free,    13172k buffers     Swap: 536855548k total, 114819772k used, 422035776k free,   501060k cached            PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                66004 scottr-u  20   0 88932  23m  888 S   52  0.0 270:36.19 tmux


title: CentOS - Issue with write permissions

text: I am running CentOS 6.4 and I have installed Wordpress on it. (along with LAMP) Now the problem is, that I cannot make any write changes to any files in the wordpress editor: eg. header.php, style.css etc. Wordpress says the following where the 'update' button is suppose to be: You need to make this file writable before you can save your changes. Notes:   * Now Apache is running as the root user (default)    * Here are the permissions on the themes folder where all the above mentioned files lie: drwxrwxr-x. 5 root bluegig 4096 Jul 7 17:32 themes drwxrwxr-x. 3 root apache 4096 Jul 7 23:15 uploads I ran the **chmod 775** command on both 'themes' and 'uploads', Now doing a _chmod 777 gets me write permissions, but I don't believe that is very safe... Is there any other/better way of doing it?_ (bluegig is the name of my domain, don't know why that is there...) What I can do:   * I can read and execute in Wordpress   * I can upload files into the uploads folder from within wordpress I cannot:   * Make any changes to files within wordpress (via the editor)   * How do I enable write permissions so that I can modify files in wordpress? Note, I did not log into an ftp account from within WP.


title: Having issues installing Kali Linux in Virtualbox

text: Trying to install Kali Linux in VB and it freezes. I believe I have the correct version and a good ISO because it comes up and allows me to navigate to "install" Once I press enter, all that happens is the options disappear, the Kali Linux logo remains, and nothing else happens. I've left it for hours and it just stays. I'm running VB on an HP Laptop. I have already enabled virtualization from the BIOS, but to seemingly no avail. I have allotted 2GB of memory and 16GB of storage, along with 2 processors. I must be missing another setting because I feel that it should be working.


title: Is it possible to insert image in gedit in Linux?

text: I'm using RHEL. Totally new to Linux. I want to insert an image in `gedit`, but I'm not able to do so. Also I'm unable to install LibreOffice because they are asking for a subscription. Any alternate to `gedit` or can we insert image in `gedit`.


title: Strange case: Text file that exist and doesn't exist

text: I'm completely puzzled about a problem with a single plain text file in my system fedora 12. I used a known software in bioinformatics, maker, to produce lots of plain text files and one of them it seems to be "inaccessible". Particularly, my file named `Clon1918K_PCC1.gff` is listed when I use `ls, ls -a, ls -li` ... commands but when I try to access it by `cat, vim, cp, ls` etc it appears always the same error `Clon1918K_PCC1.gff: No such file or directory`. However, when I copy all the files with `cp *.gff` or `cp *` this file it's also copied. Also I tried to open it with nautilus without problem and in one of two cases when I copied the content to another file with the same name the problem disappears. Interestingly in this case the strange file is not rewritten and 2 files with exactly the same name appear, one of them accessible and another inaccessible. I looked for hidden characters but all seems ok. Someone has any idea about this strange case?? Thanks!


title: KVM guest machine graphics problem

text: I'm new to KVM. I use the following way to create and start a guest KVM machine.               qemu-img create -f raw centos.img 100G     /usr/libexec/qemu-kvm -hda ./centos.img -cdrom /usr/local/CentOS_5.6_Final.iso -m 1024 -smp 1 -boot d     /usr/libexec/qemu-kvm -hda ./centos.img -m 1024 -smp 1 -boot c      When the login page appears, everything seems right. ![enter image description here](http://i.stack.imgur.com/EHydW.jpg) When I log into the system, it show me like this. Note the following image shows what I saw when I just log into the system, without move my mouse or press a key. ![enter image description here](http://i.stack.imgur.com/bng8H.jpg) Take a closer look. ![enter image description here](http://i.stack.imgur.com/Qr88d.jpg) When I click the left mouse button, it shows me this menu. ![enter image description here](http://i.stack.imgur.com/ulTB7.jpg) Anyone can help me with my problem? How to fix the graphics in the guest machine? Thanks in advance.


title: How does the power button shut the computer down without root permission?

text: When I try to shutdown the computer from a command line or terminal I must have root privileges:               amy@amy:~$ shutdown now     shutdown: Need to be root      and               amy@amy:~$ halt     halt: Need to be root      but when shutting down using the graphical user interface, i.e. shutdown button, or the hardware shutdown button, I'm not asked for the password to do so... What does that shutdown for the interface?? and why it doesn't need the password or the root privileges?? thank you... I'm using Ubuntu 11.04 Natty...


title: Why is my /home separate from /?

text: I was confused why I was getting out of space errors so I ran `df` and saw this:               [me@fedlap /]$ df -h     Filesystem                     Size  Used Avail Use% Mounted on     rootfs                          43G  9.4G   34G  23% /     ...     /dev/mapper/vg_fedlap-lv_root   43G  9.4G   34G  23% /     ...     /dev/mapper/vg_fedlap-lv_home   22G   21G   12M 100% /home      The partition is about 69GB so the sum of everything is correct, but I have no idea why `/home` is allocated this way. Gparted shows one 500MB ext4 partition and one lvm2 69Gb partition. What exactly is `/dev/mapper` and is there a way to remove it? I have no idea what the ratio of installed programs to user data will be in the future so I have no need to separate these on a single user system. This is on Fedora 16 with one physical disk.


title: Is it possible to use Internet Connection Sharing with DHCP?

text: I know it is possible to share an internet connection with another pc using ip-forwarding and masquerade. **Is it possible to set up the sharing computer as a DHCP server, so the settings (ip, gateway, dns) get configured for the client automatically?** The current way I do it, is that I setup the client NICs manually to access the internet from the client. edit: this is the setup i plan to realize -![network_setup_graphic](http://i.stack.imgur.com/mfZyh.png)


title: How do I match a string with symbols in a grep-kind of way?

text: I have a file with this contents (or similar):               # cat /var/www/htpasswd     foo:$apr1$73wJ8tiQ$HdaRYe2pUMqBf0ZpMJz6h/      and I'm trying to verify the presence of an entry in it, by matching it, like this:               # grep --fixed-string "foo:$apr1$73wJ8tiQ$HdaRYe2pUMqBf0ZpMJz6h/" /var/www/htpasswd     #      but it's not matching anything. Any ideas why and/or how to do it? I first I thought it was the dollar sign, but this one works:               # grep --fixed-string "foo:$ap" /var/www/htpasswd     foo:$apr1$73wJ8tiQ$HdaRYe2pUMqBf0ZpMJz6h/     #


title: How to sort a Diary?

text: Diary has entries with month and day, no years, in the format `%D_%M.tex` but index in wrong order because of wrong sorting and poor filename -format. How should I call my Diary -entries to get them sortable by sort -command (from old to new or the reverse)? The key is radix -sorting, notice this discussion here, but it is still open which one of them. By which Radix -sorting algorithms and when? What are the pros-and-cons? **STOP here if you know sorting -- the following part is for those wanting to reproduce the diary with small working example and intended output** > **Wrong Output** >   >   >      $ ls Days/ |sort -M >      12_4.tex >      29_3.tex >      3_4.tex >   > > **Intended Output** >   >   >      29_3.tex >      3_4.tex >      12_4.tex >   > > **Small example (with wrong sorting -order n.b. the radix -bug)** >   >   >     $ ls Days/ >     12_4.tex  29_3.tex  3_4.tex >     $ cat Makefile >     .PHONY: all >     all:   days.tex   >   >     days.tex: $(wildcard Days/*.tex) >       ls Days/*.tex | awk '{printf "\\input{%s}\n", $$1}' > days.tex >     $ make; pdflatex diary.tex >     $ cat diary.tex >     \documentclass{article}   >     \begin{document}   >     \input{days} >     \end{document} >   **Related**   1. Radix sorts in Wikipedia here.


title: recursive statistics on file types in directory?

text: I did a website scrape for a conversion project. I'd like to do some statistics on the types of files in there -- for instance, 400 .html files, 100 .gif, etc. What's an easy way to do this? It has to be recursive. **Edit:** With the script that maxschelpzig posted, I'm having some problems due to the architecture of the site I've scraped. Some of the files are of the name `*.php?blah=blah&foo=bar` with various arguments, so it counts them all as unique. So the solution needs to consider `*.php*` to be all of the same type, so to speak.


title: Boot windows from grub rescue command prompt

text: Previously I had installed the Ubuntu 10.04 and Windows 7. Now I logged on to Windows, opened thepartition editor and deleted the volume containing the Ubuntu (Thought it will delete the Ubuntu and it might help me install another OS)and I restarted the system. Grub rescue prompt is there. I want to logon to Windows. How can I do that? In Grub rescue, I tried the following:               ls     (hd0) (hd0,3) (hd0,2) (hd0,1) (hd1) (hda1,1)      Tried all combination of the ls (hdax)/, which threw me error: Unknown Filesystem. I tried this: 1) rootnoverify (hd0,0) 2) chainloader +1 3) makeactive 4) boot. It threw me Unknown command. EDIT: I installed Ubuntu from the USB. Now when I restarted the system, I got the grub, showing old Windows and the newly installed Ubuntu. I happily logged onto windows. Then I used standard procedure to remove ubuntu, so as not to have grub rescue.


title: Copy files via a complex ssh connection?

text: Suppose I have host _A_ from which I ssh to host _B_ , where I `sudo -U some_role` and from under it ssh to host _C_. My goal is an interactive shell on _C_. Assume that from _C_ I cannot ssh back to _A_. What is the best way to _copy a file_ from _A_ to _C_ using the connection built above? What preparations / changes should I introduce into the chain to make infrequent, simple file copying possible? Of course I can run `cat > target_file` inside the interactive shell and copy- paste via the terminal, but for large binary files this is not exactly convenient.


title: check if latest openssh patch provided by RHEL is installed

text: We have encountered a security threat in one of our **RHEL** servers which says the _SSH server is configured to use Cipher Block Chaining_. As far as I know, the RHEL systems provide security updates through their RHN satellite which can be achieved just by running the `yum update` command. But, how can I know if the security patch is applied to my RHEL system? **P.S** : I know the CVE number of the vulnerability/threat/issue. So my question is, is it possible for me to verify that the RHEL `yum update` command has fixed the bug in my system?


title: Unique file name for different files

text: I'm working with graphic design. I've downloaded many files (`EPS` files, `PSD` files, etc) from various websites. Because it come from various websites, after downloaded from more than 10 different websites, I got many same files with same size, and same everything but different file name (2 to 4 copies for same file). To remove the duplication by manually open one by one is very time consuming I hope there is a way to rename all downloaded files to be unique name for different files (I don't mind if the new name is not descriptive). For example, 2 same file: file `nice-sun.eps` downloaded from site 1, while `678.eps` downloaded from site 2. It will become same file name after renamed.


title: e2fsck progress bar?

text: How can I see the progress of `e2fsck` in the terminal? Are there any `pv` like ways? For example how can I see how far along this command is in progress:               e2fsck -f -y -v /dev/sdb1


title: How Can I "CAM attack" a switch/router?

text: Does someone has any script that can "CAM attack" a switch/router, so that it will act as a HUB? Are there any tools for it in the repositories?


title: Smitty like solution under Linux or BSD?

text: Are there any solutions similar to AIX smit for Linux based OSes? Basically this would be some kind of _'terminal menu-driver'_ script collection perhaps using ncurses for doing things that system administrators regurarly do.


title: Do the file descriptors get lost when remounting a file system?

text: If I remount the file system on /home with:               mount -o,remount /home      will the open file descriptors be lost?


title: How to check if a file is corrupt or not?

text: Are there any general solutions to check if a file is corrupt or not? For example, whether a video file is bad, or a compressed file is corrupt, etc.


title: Reading FreeBSD UFS formatted external drive in Mac OS X

text: I have an external USB drive with backup files formatted in FreeBSD's UFS file system. When I plug it into a computer running Mac OS X 10.9.4, I cannot read the drive's contents, and I don't have physical access to a machine running FreeBSD. Is there a way to read this drive on a Mac? I only need read-only mode to copy the files to the local filesystem. Thanks.


title: Espeak showing some warnings and Input output error

text: I am running `espeak` on Linux Mint 14. Whenever I try to run it, it shows following warnings ( Not errors as it works correctly ).               ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear     ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe     ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side     ALSA lib audio/pcm_bluetooth.c:1614:(audioservice_expect) BT_GET_CAPABILITIES failed : Input/output error(5)     ALSA lib audio/pcm_bluetooth.c:1614:(audioservice_expect) BT_GET_CAPABILITIES failed : Input/output error(5)     ALSA lib audio/pcm_bluetooth.c:1614:(audioservice_expect) BT_GET_CAPABILITIES failed : Input/output error(5)     ALSA lib audio/pcm_bluetooth.c:1614:(audioservice_expect) BT_GET_CAPABILITIES failed : Input/output error(5)     ALSA lib pcm_dmix.c:957:(snd_pcm_dmix_open) The dmix plugin supports only playback stream     Cannot connect to server socket err = No such file or directory     Cannot connect to server request channel     jack server is not running or cannot be started      I searched on the net about these kinds of error and got this answer. I tried using this :               espeak "Hello, I am Espeak, the voice synthesizer" 2>/dev/null      This shows no warnings but when I use it within my code, It shows the error.


title: How to move a directory, file by file? (instead of "copy then remove")

text: My computer has one 500GB drive. I want to move 400GB of data from `/unencrypted` to `/encrypted`. Both directories are on the same partition, but `/encrypted` is handled by ecryptfs, so `mv /uncrypted/* /encrypted` would:   1. Copy all files to destination   2. Then remove them from source ...which I can't afford, because it requires 800GB.   If files were moved one-by-one, there would be no problem (the ecryptfs zone is dynamic). Is there an `mv` option or another tool, that moves a directory file-by-file?   There is a huge number of files, so ARG_MAX might be a problem for script- based solutions.


title: Browse LDAP strcuture using Solaris pre-packaged command?

text: I have used ldapsearch to pull details on accounts but is there a way to browse the different levels in the LDAP directory just like we do with files in a directory?


title: How to install Debian package with file extension .deb

text: I am trying to install a Debian package, but it gives error as "sudo: dpkg: command not found". I installed SUDO, and it still giving the same error. I went to the dir where .deb is saved, and ran command as               sudo dkpg -i file.deb      I tried installing the debian support package from "http://packages.debian.org/wheezy/all/dpkg-dev/download", but these files also are in .deb format, so I am unable to install this. Any suggestions...


title: Build Chromium from source

text: I'm using Fedora 16 and I've successfully compiled Chromium from source (the first time I compiled something from source) a while back following these instructions: http://code.google.com/p/chromium/wiki/LinuxBuildInstructions At the end of the process, everything worked. However, after multiple attempts, I have had no luck in compiling a newer version of the program. I am stuck with _Version 20.0.1100.0 custom (132047)_. Before re-building, I follow the steps to syncing my sources. But after all of the steps, build 132047 is still what I have. Can someone help me please to building newer builds and using them as I can't seem to find anything on the internet. Thanks!


title: View notes for certain package in ArchLinux without package removal?

text: I've installed couple of packages and forget what they recommended. Now i want to view their notes, recommendations. Only way i know how to do this is remove it and install it again:               # pacman -Rdd <package>     # pacman -S <package>      I'd like to find direct way to see notes.


title: Shell from a Firefox tab

text: I have a requirement for a user in the office where they would like to open a terminal shell within a Firefox tab. Is this at all possible?


title: How do I backup everything?

text: What can I use to create a backup image of my entire system that will be saved on a LAN computer via SSH? If I break anything later, I want to be able to restore my entire system as it was before the backup in minutes. Is there a Live CD that can "save backup image to ssh://..." and "restore from backup image ssh://..."?


title: How to make a variable from a subshell available in the parent shell

text: I've written a quick-and-dirty script to time some reports from a web service:               BASE_URL='http://example.com/json/webservice/'     FIRST=1     FINAL=10000          for report_code in $(seq 1 $FINAL); do       (time -p response=$(curl --write-out %{http_code} --silent -O ${BASE_URL}/${report_code}) ) 2> ${report_code}.time            echo $response  # <------- this is out of scope!  How do I fix that?       if [[ $response = '404' ]]; then         echo "Deleting report # ${report_code}!"         rm ${report_code}       else         echo "${report_code} seems to be good!"       fi     done      I need to wrap the `time` command in a subshell so I can redirect its output, but that makes the value of `$response` unavailable to the parent shell. How do I get around this problem?


title: Debian LXDE: Theme that works for both gtk2 and gtk3 apps?

text: I've installed Debian Wheezy, with the LXDE desktop environment. The default Clearlooks theme is fine, but it doesn't work for gtk3 apps (like Transmission). Which theme can I use, so that both gtk2 and gtk3 apps will look normal?


title: How to refresh or reload rc.conf in ranger file manager?

text: At the moment I am constantly changing the `rc.conf` and `rifle.conf` files, but every time I want to test the new configuration I need to exit ranger and start again. Is there a solution for this? In vim I use `:source ~/.vimrc` to reload the configuration file, but this doesn't work in ranger.


title: What should a Linux Server Admin know about Solaris and AIX

text: I'm being considered for a new Linux Server Engineer position, but I'm told by an insider that there is a little Solaris and AIX in-house. I spend most of my time in the Debian Family, have some familiarity with the RedHat family and a few others (Slackware, etc). I don't get too wound up on the differences (for me it's akin to the different Windshield Wipers and Cruise Control buttons in different cars), but I have little experience with Solaris none with AIX. I would like to know:   * Are there assumptions or conventions diverge in these commercial offerings from Linux?   * Is there a "Solaris Way" or an "AIX Way"?   * Are the Package Managers relatively comparable to apt or yum?


title: Moving dot files using bash and creating symlinks

text: Trying to move selected `dotfiles` from `~` directory into new directory `dotfiles` and create `symbink`, with this code:                 1 #!/bin/bash.       2 # This file moves selected files to newly created .dotfile folder and creates symbolic synblinks.       3        4 # STEPS:.       5 # 1. create and array of with .dotfiles elements.       6 # 2. create a new directory .dotfiles if this directory does not exits.       7 # 3. move selected .dotfiles from step 1 into directory created in step 2.       8 # 4. create symbolic links for all .dotfiles from step 1.       9 # 5. initialize a git repo.      10       11 # 1. declare an array with .dotfiles element for versioning:.      12 declare -a Dotfiles=('bash_profile' 'bashrc' 'gitconfig' 'gitignore' 'profile' 'vimrc' 'vimrc.after' )      13       14 # inform the user and print the whole array on the screen:      15 echo 'going to move the following selected .dotfiles:'      16 echo ${Dotfiles[@]}      17       18 # 2. create a variable for new directory for storing dotfiles..      19 dir = ~/dotfiles      20 cd ~ && mkdir -p $dir      21 echo 'directory created'      22       23 # move selected dotfiles to new directory .dotfiles      24       25 for dotfile in "${Dotfiles[@]}";do      26   echo "moving $dotfile into directory $dir"      27   mv ~/.$dotfile $dir      28   echo "creating symblik for $dotfile"      29   ln -s $dir/$dotfile ~/.$dotfile      30 done      31 echo 'done'      When I run it, new directory is created, but original dotfiles are not moved and symblink are not running as well. **Questions are**   1. What is missing in this code?    2. Do you have some suggestions for refactoring?


title: What are your favorite *painful* Unix moments

text: How about sharing your favorite _lessons learned_ moments?


title: Does changing ulimit get logged Mac/FreeBSD

text: For some reason our open files ulimit (-n) is getting changes to 256 when it should be 1024. I tried searching for limit in /var/log/{system.log,secure.log} but didn't see anything useful. Any idea how to find out what changed the ulimit? Mac OS X (essentially FreeBSD Unix)


title: How to filter an array of strings in ksh

text: Please advise what's wrong in my ksh code. I want to remove the IP's as defined in "bb" array from "aa" array so the IP's **255.0.0.0** and **255.255.255.0** will be removed from the list in **aa** array. When I run my ksh code and later print the array aa, I see that the IP - **255.255.255.0** was not deleted? Please advise what's wrong in my syntax?                  echo ${aa[*]}        45.32.3.5 255.0.0.0 255.255.255.0 19.23.2.12                  echo ${bb[*]}        255.0.0.0 255.255.255.0      ksh program:                 for run in  ${bb[*]}       do        for ((i=0; i<${#aa[@]}; i++)); do        [[ ${aa[i]} == $run ]] && unset aa[i]        done       done      test:                echo ${aa[*]}        45.32.3.5 255.255.255.0 19.23.2.12                        **NOTE:** 255.255.255.0 should be deleted from the above list.


title: dm snapshot - how does it work?

text: Fedora uses dm-snapshot for making the root filesystem read-write. At least for me, when running a livecd (even without touching it), it will become unusable relatively quickly meaning it has exhausted the default 512MB tmpfs overlay. I find this hard to believe that if I just boot up to it, do nothing, and in a few days it will consume 512MB. I have other systems using aufs to do the same thing and they've been stable for months and longer. I suspect that dm-snapshot essentially requires the size of tmpfs to match the size of the source filesystem, not the size of what changes. If that is the case, dm-snapshot seems like a horrible option for making root read-write. Please clarify how dm-snapshot works. According to what I've read, it only consumes the size of the changes.


title: Joe,pico,emacs missing

text: I've installed a 'linux in a box' at home using FreeBSD and Virtual Box.But when I tryed to make a C file,joe,emacs and pico give me 'Command not found'. `joe z.c`,`emacs z.c`, `pico m.c` are the commands I've tryed.The only available editor seems to be vi,which opens a file.How can I get the other editors to work?


title: Command to restore filesystem to state after installation of the OS

text: How can I wipe all the changes to the filesystem **since** installing the OS?   It's not that I want to destroy the files because they contain sensitive data or anything like that; I just want to start over without reformatting the SD card, etc. (I'm on a Raspberry Pi, running Occidentalis, which is basically Raspbian, which is basically ARM Debian). I know about `rm`, but I don't want to delete the OS -- just all the stuff I've done since running it the first time.


title: How can I determine if someone's SSH key contains an empty passphrase?

text: Some of my Linux & FreeBSD systems have dozens of users. Staff will use these "ssh gateway" nodes to SSH into other internal servers. We're concerned that some of these people use an unencrypted private SSH key (A key without a passphrase. This is bad, because if a cracker ever gained access to their account on this machine, they could steal the private key and now have access to any machine which uses this same key. For security reasons, we require all users to encrypt their private SSH keys with a passphrase. How can I tell if a private key is not-encrypted (e.g. Does not contain a passphrase)? Is there a different method to do this on an ASCII-armored key vs. a non-ASCII-armored key? Update: To clarify, assume I have superuser access on the machine and I can read everybody's private keys.


title: How can I replace a string in a file(s)?

text: Replacing strings in files based on certain search criteria is a very common task. How can I   * replace string `foo` with `bar` in all files in the current directory?   * do the same recursively for sub directories?   * replace only if the file name matches another string?   * replace only if the string is found in a certain context?   * replace if the string is on a certain line number?   * replace multiple strings with the same replacement   * replace multiple strings with different replacements


title: VMWare tools on arch linux

text: I have a arch linux installed on a vmware player virtual machine. I'm trying to install the open-vmware-tools. I have already installed but it is not working and everytime I boot the system I get the following message: "The VMware Tools power-on script did not run successfully in this virtual machine. If you have configured a custom power-on script in this virtual machine, make sure that it contains no errors. You can also submit a support request to report this issue." Does anyone have a clue on how to solve it?


title: agonizing over the Unix epoch

text: I am having some trouble understanding what exactly `00:00:00 Coordinated Universal Time (UTC), 1 January 1970` means. Below are two possible ways to interpret `00:00:00` according to my understanding, or rather, according to my confusion:   * a point in time of zero duration, functioning as a divider between days. Under such a definition, being a divider, it belongs to no day, falls on no day in particular, and is rather defined not by a single day but rather by the two days it divides, so `00:00:00 1 January 1970` doesn't make sense. What would make sense under this definition would be to say _00:00:00 between 31 December 1969 and 1 January 1970_ , or simply (since that's redundant) _the point in time between 31 December 1969 and 1 January 1970_.   * an interval in time having a duration of 1 second starting from the beginning of 1 January 1970 and ending 1 second later. Under the second definition `00:00:00 1 January 1970` makes sense but then the concept of **seconds elapsed since`00:00:00 UTC, 1 January 1970`** doesn't make sense as you can't measure distance from an interval but only from a point. Unless what we really mean (under this definition) is **seconds elapsed since the beginning of`00:00:00 UTC, 1 January 1970`** I.e. since the beginning of the interval denoted by `00:00:00 UTC, 1 January 1970`. **UPDATE** Based on the answers I received I think the correct way to view it is a point in time of zero duration that by convention indicates the earliest point in time in the day next to which it appears. Yet I am not fully convinced that this is a rigorous definition. It's like defining 1 to be the lowest number in the set [1, 2). It's a circular definition as the duration of the day is itself defined using the `00:00:00` point in time. Maybe I am indeed reading too much into it.


title: What does the --hint option in grub2's search command do?

text: I'm looking at the official GRUB2 docs for the `search` command, as found on http://www.gnu.org/software/grub/manual/grub.html#index-search               Command: search [--file|--label|--fs-uuid] [--set [var]] [--no-floppy] name          Search devices by file (-f, --file), filesystem label (-l, --label),     or filesystem UUID (-u, --fs-uuid).          If the --set option is used, the first device found is set as the     value of environment variable var. The default variable is ‘root’.          The --no-floppy option prevents searching floppy devices, which can be slow.          The ‘search.file’, ‘search.fs_label’, and ‘search.fs_uuid’ commands are aliases     for ‘search --file’, ‘search --label’, and ‘search --fs-uuid’ respectively.      In section 5.3 there are many examples along               menuentry "FreeBSD" {           insmod zfs           search --set=root --label freepool --hint hd0,msdos7           ...     }      It appears the `\--hint` option is undocumented other than as an example. What does it do exactly? What is the exact format of the argument?


title: How can I custom rename podcasts after downloading them with gPodder?

text: I'm using Arch Linux. To download podcasts, I use gPodder 3. To listen to my podcasts, I'm using Rockbox on my iPod Classic. The thing is, the podcasts don't get sorted nicely on my iPod: everything will be sorted alphabetically. To overcome this , I'd like to change the podcast name right after downloading to something like: `YYYYMMDD_Podcast_Name.mp4` For example: `20130828_Easy_Linux_Remote_Desktop_LAS_s28e03.mp4` That way, even when sorting alphabetically, the podcasts would be in the right order. How can I get this done? I know that there is a plugin called `rename_downlad.py`, which will convert the podcast name to `<episode_title>.<ext>`, but that's not exactly what I want. I tried to modify this extension in `/usr/share/gpodder/extensions/rename_download.py`: line 45:               new_filename = str(datetime.datetime.now().strftime("%Y%b%d_")) + os.path.join(dirname, new_basename)      but for some reason, this didn't work. How can I get this done? Note that in my example, the only thing that gets added to the title is the current date. It would be nice if this could be the episode's release date instead, but I'm already happy with just adding the current date.


title: Problem with vim when logged in as root

text: When I login as root or edit a file by `sudo` mode all of the options in my `/etc/vimrc` are not working (e.g. highlight line-number etc.)


title: Scheduling command/script by specifying the exact second

text: I'm using bash and wondering how I can execute a command/script at a later specified time, with the accuracy of a second? I read the man page for the `at`-command, but as far as I could understand it's only possible specify minutes (and not seconds). Right now I first use `at` and then `sleep` to get it to execute the right second. To demonstrate, if I would like to run my_script.sh at 22.21.05 I would do:               echo "sleep 5; my_script.sh" | at 22.21      But it would be much nicer to have a command with it built in. Something like `at 22.21.05`.


title: Reverse id command, I want the User/Group Name from the uid or gid

text: I know some uid and gids that I dont know who they belong to and they are not in /etc/passwd (could be LDAP or from another system). How do I get Id info from only uid or gid preferably without using ldapsearch or any LDAP commands outside of getent or id, or something easy. Linux 2.6 Kernel, Red Hat variants.


title: Vim - Bind a key to a bash command

text: In VIM, is there a way to bind a key to a shell command? For example when F3 is pressed `git commit -a -m "test"` should be executed.


title: Using grep or awk

text: To capture a particular pattern, `awk` and `grep` can be used. Why should we use one over the other. How does this work in the background? Which is faster and why? E.g If I had a log file and I wanted to grab a certain pattern, I could do one of the following               awk '/pattern/' /var/log/messages        or               grep 'pattern' /var/log/messages      I haven't done any bench-marking, so I wouldn't know. Can someone elaborate this?


title: Errors when booting with encrypted LVM

text: When I boot my computer and I have to enter the password of the encrypted lvm, there are always a bunch of annyoing messages like: "usb string descriptor 0 read error: -22". How can I fix that? my hooks are: > HOOKS="base udev autodetect modconf block filesystems keyboard keymap > encrypt lvm2 fsck" Btw: This is cosmetic, it boots and works fine!


title: switching from user to root and revers (FreeBSD)

text: I want to make some modification with root and then with my user, in fact I want to install sudo and he give me the error in the first step:               cd /usr/ports/security/sudo     make install clean      http://imageshack.us/photo/my-images/821/errorunix.png/ I was trying to log in with root in another session `Alt+F2` but after entry the login and the password the system keep going to ask me to put again the user and the password .. so what is wrong?? I searched in the FreeBSD handbook http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ but nothing!! how this is possible?? Later EDIT: apologize., that in fact here is 2 questions., one about how to switch from user to root and then from root to user and the problem with sudo, thank you


title: Is it possible to change the order of a glob?

text: I am trying to show all instances of a particular message from the syslog in chronological order by doing something like the following:               grep squiggle /var/log/messages*      Unfortunately the glob pattern matches the currently active file first. eg.               /var/log/messages     /var/log/messages-20120220     /var/log/messages-20120227     /var/log/messages-20120305     /var/log/messages-20120312      This means that recent messages show up first followed by the historical messages in chronological order. Is it possible to adjust the glob pattern behaviour somehow to make the empty match (ie. just `messages`) show up at the end of the list? If not, what would be a good way to address this problem?


title: how to extract part of a filename before '.' or before extension

text: I have files in format below:               abc_asdfjhdsf_dfksfj_12345678.csv     hjjhk_hkjh_asd_asd_sd_98765498.csv     hgh_nn_25342134.exe      I want to get the value before the `.` and after the last `_`. The result would look like:               abc_asdfjhdsf_dfksfj_12345678.csv   ----> 12345678     hjjhk_hkjh_asd_asd_sd_98765498.csv  ----> 98765498     hgh_nn_25342134.exe                 ----> 25342134


title: How to cut everthing until a specific word / after a find in a script

text: Hello I try to get the output of files from today wich contains ERROR. I use this to find the files I want:               find /home/user/logfilesError/ -maxdepth 1 -type f -name "gandalf_*"\        -daystart -mtime -1 -exec grep -rl "ERROR" "{}" +      Current output(if ERROR found):               /home/user/logfilesError/gandalf_123.log      But the output I want is only the logfile name:               gandalf_123.log      Info: The path changes often so I cant just cut the letters before. Thanks for your help!


title: Does the Linux loader (ld.so) follow symlinks?

text: I have stumbled upon a problem by trying to move the ld.so.cache file to another location. I have tried to create a symlink for it in its previous location -- `/etc/` -- but it seems that the loader cannot follow this symlink. Also, a hardlink is not viable since the new location is on another partition. My final purpose is to have a read-only root filesystem and this is maybe the last thing which stops me from this. Thank you in advance!


title: Storing a keyfile in an encrypted LVM

text: I'm using RHEL 6.5 and I want to encrypt some of my logical volumes (LVM). In order to not have to enter the passphrase multiple times, I want to store a keyfile in an encrypted LV. Example: `/var/xxx` will be encrypted and the passphrase will be asked during the boot.   `/var/xxx/yyy` will be encrypted and the keyfile will be under `/var/xxx/keyfile` (for more security). This way the passphrase has to be entered only one time. My `crypttab`:               LogVolXxx          /dev/vg/LogVolXxx         none     LogVolXxxYyy       /dev/vg/LogVolXxxYyy      /var/xxx/keyfile  luks      My `fstab`:               [...]     /dev/mapper/vg-LogVolAaa      /Aaa           ext4    noatime        1 2     /dev/mapper/LogVolXxx         /var/Xxx       ext4    noatime        1 2     /dev/mapper/LogVolXxxYyy      /var/Xxx/Yyy   ext4    noatime        1 2     [...]      A problem appears during the boot, the keyfile is not found. I suppose the system is trying to decrypt the device before mounting it. How can I handle this?


title: Switching source and destination (or undoing the mv, cp operation)

text: `mv` or `cp` commands both expect source and destination as arguments. In case you want to undo the change you made, or just change the source and destination you supplied before, what is the quickest way to do this? I thought of creating a function that takes `command src dest` and switching `src` and `dest`, but I was wondering if there is a better way to do this.


title: Using wget to dowload images in facebook conversations

text: This look a bit harder than usual. I'm a new wget user and i was thinking that maybe it's possible to somehow login into facebook and download images from a specific conversation. I mean, i'd like to tell wget my password and user or use cookies (idk how to write the line command either) and download ONLY IMAGES from a conversation. I know that this is for sure possible but how would i do it?


title: Kermit locked after suspend

text: I use kermit to communicate through RS-232 with my embedded system target. My host is Ubuntu 14.04. Every time I suspend my host while kermit still is connected to the target, I cannot reconnect with kermit after resuming my session.               gauthier@sobel:~ $ sudo kermit     [sudo] password for gauthier:      ?SET SPEED has no effect without prior SET LINE     C-Kermit 9.0.302 OPEN SOURCE:, 20 Aug 2011, for Linux+SSL+KRB5 (64-bit)      Copyright (C) 1985, 2011,       Trustees of Columbia University in the City of New York.     Type ? or HELP for help.     (/home/gauthier/) C-Kermit>connect     Sorry, you must SET LINE or SET HOST first     (/home/gauthier/) C-Kermit>set line /dev/ttyUSB0     Sorry, write access to UUCP lockfile directory denied.          *************************     HINT (Use SET HINTS OFF to suppress future hints):     Please read the installation instructions file, ckuins.txt,     or the UNIX appendix of the manual, "Using C-Kermit"     or visit http://www.columbia.edu/kermit/ckuins.html      *************************          (/home/gauthier/) C-Kermit>         My `~/.kermrc`:               set line /dev/ttyUSB0     set speed 115200     set carrier-watch off     set handshake none     set flow-control none     robust     set file type bin     set file name lit     set rec pack 1000     set send pack 1000     set window 5      It looks like kermit cannot accept `set line`, apparently due to some kind of lock. This is why I tried to run with `sudo`. I learned there that `show comm` could show me where the lock file should be:               (/home/gauthier/) C-Kermit>show comm          Communications Parameters:      Line: /dev/tty, speed: unknown, mode: remote, modem: generic      Parity: none, duplex: full, flow: none, handshake: none      Carrier-watch: off, close-on-disconnect: off      Lockfile directory: /var/lock      Typical port device name: /dev/ttyS0      and `/var/lock` is a symlink to `/run/lock`               gauthier@sobel:/run/lock $ ll     total 0     drwxrwxrwt  3 root     root      60 Jun 18 10:01 ./     drwxr-xr-x 28 root     root     980 Jun 18 09:24 ../     drwxr-xr-x  2 whoopsie whoopsie  60 Jun 17 10:58 whoopsie/     gauthier@sobel:/run/lock $ ls whoopsie/     lock     gauthier@sobel:/run/lock $ more whoopsie/lock      whoopsie/lock: Permission denied     gauthier@sobel:/run/lock $ sudo more whoopsie/lock      gauthier@sobel:/run/lock $       I don't thinkg `whoopsie` has much to do with this particular error, but I tried to remove the `whoopsie` folder altogether and kill the `whoopsie` process. As expected, it did not help. I have read section 10 of this, but I cannot make much sense of it. Logging off and on does not help, rebooting the host does. How can I unlock kermit?


title: creating shortcuts to executables on IRIX64 6.5

text: I'm telnetting into an IRIX 64 server and I'm trying to create shortcuts to emacs, gvim, and other executables that are stored in a certain directory. I tried using the `alias` command on the command line in the following manner:               alias gvim="/usr/.../gvim"     alias emacs="/usr/.../emacs"     ...      but whenever I try this and run emacs/gvim, it still doesn't work. And when I run `alias -p`, nothing shows up. What am I doing wrong?


title: Can I use a parallel port as a CUPS input device?

text: I have an old piece of a hardware that does diagnostics on medical equipment. It prints out results over a parallel port. Is there any way to have CUPS accept jobs from a parallel port and redirect them to the default printer? Essentially I want CUPS to listen to `/dev/lp0` for incoming jobs. Reading about this problem a bit, would it be possible for me to capture the PCL data via the parallel port (`cat /dev/lp0 > out.pcl`) and then convert it to Postscript using pspc16 or somehow send the PCL to Ghostscript to interpret the PCL and dispatch to CUPS?


title: Run X clients over multi-hop ssh tunnel

text: I've recently converted my home development machine to Linux, and would like to be able to log into it from work if needed. I use a mixture of Linux and Windows machines, and I already have various gyrations of ssh/putty/Xorg/Cygwin/etc set up to launch X clients remotely and display on the local X server. My problem is, my home machines are behind a firewall, and getting to them requires tunneling through the firewall over ssh. When I was running Windows I had set up ssh port forwarding on the firewall to bounce RDC connections to the correct machine, but it appears that X tunneling is more complex. Just enabling X11 forwarding on the ssh connection to the firewall only seems to work for X clients running on that machine, not ones I start on the second "hop". Is there a way to forward/tunnel/whatever the X11 connection through the firewall and to a remote machine that's an extra hop away? Side-Note: I'm not particularly married to X11, so if there's some other option that will work better over multiple ssh hops, I'd take that as an answer (especially if you can tell me why it's better). I just happen to already have an Xorg-ish server on all of my work machines. The requirements are basically:   * Display-side-thingee (X server, RDC client, etc.) needs to run on Linux and Windows   * Application-side stuff just needs to run on Linux   * Needs to work over an ssh "tunnel" of at least 2 two hops.


title: What do you do to scan with 600 dpi while maintaing a small output file?

text: I just installed xsane which I already successfully tested with my Epson Perfection V30. When scanning with these settings ![xsane settings for a4, 600 dpi and color](http://i.stack.imgur.com/UTqN3.png) the output file is remarkably large. Is there a way to decrease the size, preferably by built-in settings/options in xsane?


title: Some errors when building Glibc LFS - are they harmless?

text: I've finished chapter 5. When I'm building glibc, I get some errors:               root:/sources/glibc-build# grep Error glibc-check-log     make[2]: *** [/sources/glibc-build/posix/tst-getaddrinfo4.out] Error 1     make[2]: [/sources/glibc-build/posix/annexc.out] Error 1 (ignored)     make[1]: *** [posix/tests] Error 2     make[2]: *** [/sources/glibc-build/nptl/tst-cond25.out] Error 1     make[1]: *** [nptl/tests] Error 2     make[2]: [/sources/glibc-build/conform/run-conformtest.out] Error 1 (ignored)     make: *** [check] Error 2      Are they harmless? My LFS version is 7.4, and glibc version is 2.18


title: How can I trigger an event in shell script when an USB device is removed?

text: I need to do some actions when a specific USB device is removed/added. I need a fast response on the order of milli-seconds. How can I do this in a shell script?


title: IMAP caching proxy for sharing connections

text: I'm trying to find an IMAP proxy in which multiple clients will share a single connection to the same server. The reason for this is because most mail providers only allow a limited number of IMAP connections. This is problematic with the IMAP protocol as each folder gets it's own connection. Once you throw in a few folders, multiplied by several clients (2 computers, phone, tablet, etc), you easily go over these connection limits. I'm looking for some sort of proxy which will let multiple clients share the same connection to the same folder. So that if 2 clients are accessing "INBOX", they'll both use the same connection to the IMAP server.   The catch is that it also needs to handle things like deletions. Such that if one client adds or deletes a message, the other client should get updated. This is under unix/linux as the proxy server needs to run on Linux. The goal is to run this proxy on a single server, and then configure all my clients to connect to it instead of the real IMAP server.


title: Secure access to remote SSH tunnel

text: So I wish to be able to access my Raspberry Pi (which I keep at home behind a firewall) remotely. One option is to use a static IP address, but as a poor student I don't want to fork out for one, and most of the free options are a bit messier (require regular maintenance etc.). As I understand it, another option is to set up a remote SSH tunnel to a server outside my firewall, which will forward connections to a specified localhost port (say 9999) on the server onwards to port 22 on my Raspberry Pi (through said remote SSH tunnel). Broadly I would be following the steps from Raspberry Pi: Phoning Home Using a Reverse Remote Ssh Tunnel, except for a different purpose. As it happens my university has a student Linux server which I have a shell account on, so setting all that up should be fine. My question is this: given that the student server is shared, will any user with a shell account be able to use the tunnel to my Pi if they happen upon whichever localhost port I've selected (9999 in the above example)? Or will it only allow me to use that port? Is it possible to create such a restriction? Obviously I'm not that keen on relying upon security by obscurity to protect the connection and would rather that it is only available to me.


title: Where is the documentation for perf events?

text: I cant seem to find documentation on the events listed when you do `perf list`; can someone point me in the right direction?


title: How to install Debian with encrypted / and passphrase required before login-screen?

text: I'm trying to install Debian in my Dell inspiron 8GB ram + 500GB HD. Althought I could install it without any problems with the regular install and even with a few modifications, I'm trying to maximize my computers security, and therefore I would like to have the / folder encrypted. Not only that, I would also like that the passphrase for it's encryption was asked before the login screen loaded. The computer will have only one user, and root permissions run trough `sudo`. So, the question is: How do I get to install Debian with a passphrase for encrypted / asked before the login screen? This is my initial idea to assure security, but I'm open to new ideas and other devices I can use for that purpose.


title: Why doesn't build of net-snmp 5.7.2. provide /etc/rc.d/init.d/snmptrapd?

text: I am packaging an RPM for RHEL6, built from net-snmp-5.7.2.tar.gz. I see that the file `/etc/rc.d/init.d/snmpd` gets created and packaged but I do not see the init file for `/etc/rc.d/init.d/snmptrapd`. Is snmptrapd depreciated? I did I forget pass the right switch to `./configure` ? Thanks


title: Newbie struggles with grep, sed, awk to filter html

text:
I am a beginner linux user, trying to teach myself how to use linux tools on a cygwin install. I decided to make up a project to try to teach myself the basics of shell scripting and simultaneously accomplish some personal education. My original project was to save the html pages from every winner of the Sakharov Prize into a folder, and to write a script that would process all the html text files and return the name, year, birth and death in a hyphenated format, and country of origin. Due to certain inconsistencies in date formatting (18 July 1918 vs January 23, 1938), as well as an inability to handle dead people vs live people with no death date or figure out how to tell a computer how to recognize country names without manually listing out all the countries myself, I've basically given up on this project. Now, I'm just trying to return the year, name, and country of origin of each recipient from the html table taken from the Sakharov Prize wikipedia page. So, given the following sample html:
     1988	     Mandela, NelsonNelson Mandela	     South Africa	     Anti-apartheid activist and later President of South Africa	     [5]

     1988	     Marchenko, AnatolyAnatoly Marchenko (posthumously)	     Soviet Union	     Soviet dissident, author and humans rights activist	     [5]
      what is the best way to return just the year, name, and country of origin of each recipient? Right now I'm thinking about just writing an awk script that returns everything that does not match /<*>/, but that is not exactly what I want. Can someone give me some pointers or ideas of how to pick out the names, year, and countries specifically? Or at least some books with better and more manageable sample problems than ones that I could come up with myself? None of this sounded unreasonable when I started...


title: What rules govern the parent-child relationship of processes launched by shell across a pipe?

text: #!/bin/ksh     # start_service: start the service     my_server_executable 2>&1 | my_pipe_following_shell_script &     exit 0      After I run the above `start_service` script from command line, it is observed using `ps` command that the `bash` process running `my_pipe_following_shell_script` is parent of `my_server_executable`, whereas I would expect, _and need_ , the latter to be owned by PID 1 (`init`) instead. **I am looking for an explanation as to why this has happened and how I can avoid this**. Also how does one go about debugging/examining what goes on behind-the-scenes? Running `start_service` with `strace` isn't very helpful. The only interesting line I could find in its output is: `clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7f05708) = 30431` where `30431` is PID of `my_pipe_following_shell_script`. * * * Linux 2.6.18-308.16.1.el5PAE ksh Version sh (AT&T Research) 93t+ 2010-02-02 GNU bash, version 3.2.25(1)-release (i686-redhat-linux-gnu)


title: What do the characters y/d/N mean?

text: Dumb question, I know, but when I am updating my system, the machine tells me the size of the packages to download and asks me: `is this ok: [y/d/N]?` I know the meaning of `y` (yes) and `N` (no), but don't what `d` stands for. Can someone please explain it to me? **Note:** In case it is needed, I am running Fedora 20.