title: How to execute Zeo Decoder Viewer on Linux?

text: I'm trying to execute Zeo Decoder Viewer (a Java application) on Linux, and I'm not sure how I'm supposed to do this. I've put the program and required libraries (all in jar files) in /opt/zeo/ directory, and I try this:               miernik@przehyba:/opt/zeo$ ls     appframework-1.0.3.jar  joda-time-1.6.jar  swing-worker-1.1.jar  ZeoDecoderViewer.jar     miernik@przehyba:/opt/zeo$ java -jar ZeoDecoderViewer.jar     Exception in thread "main" java.lang.NoClassDefFoundError: org/jdesktop/application/SingleFrameApplication             at java.lang.ClassLoader.defineClass1(Native Method)             at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)             at java.lang.ClassLoader.defineClass(ClassLoader.java:615)             at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)             at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)             at java.net.URLClassLoader.access$000(URLClassLoader.java:58)             at java.net.URLClassLoader$1.run(URLClassLoader.java:197)             at java.security.AccessController.doPrivileged(Native Method)             at java.net.URLClassLoader.findClass(URLClassLoader.java:190)             at java.lang.ClassLoader.loadClass(ClassLoader.java:306)             at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)             at java.lang.ClassLoader.loadClass(ClassLoader.java:247)     Caused by: java.lang.ClassNotFoundException: org.jdesktop.application.SingleFrameApplication             at java.net.URLClassLoader$1.run(URLClassLoader.java:202)             at java.security.AccessController.doPrivileged(Native Method)             at java.net.URLClassLoader.findClass(URLClassLoader.java:190)             at java.lang.ClassLoader.loadClass(ClassLoader.java:306)             at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)             at java.lang.ClassLoader.loadClass(ClassLoader.java:247)             ... 12 more     Could not find the main class: com.myzeo.viewer.ZeoDecoderViewer. Program will exit.     miernik@przehyba:/opt/zeo$       Am I doing something basic horribly wrong?


title: Static routes in HP-UX

text: I need to set static route in HP-UX. I edited /etc/rc.config.d/netconf file and added new entry for my route:               ROUTE_DESTINATION[1]="10.105.2.0"     ROUTE_MASK[1]="255.255.255.0"     ROUTE_GATEWAY[1]="192.1.1.219"     ROUTE_COUNT[1]="1"     ROUTE_ARGS[1]=""      But after rebooting HP-UX I don't have this route in routing table (checked with netstat -rn). What am I doing wrong?


title: How to move files into newly created directory on condition in shell/perl

text: It was a mess of music files and directory. It is needed to perform the below operation over multiple directories at once:   1. If the directory contains ".jpg" files, then create a new directory "Covers" and move those files into it.    2. If the directory does not contain any ".jpg" files, don't create "Covers" directory    3. If the directory already contains "Covers" directory, don’t create "Covers" directory


title: Easily Share a folder with a Windows computer in Fedora 15 (Gnome 3)?

text: I was trying out Fedora 15 but couldn't figure out something: How do I share a folder? When doing some Googling all I could find were forum posts on how to manually configure samba with `smb.conf` (a place I refuse to go, it's 2011, people), and `gnome-user-share` which only shares `~/Public` and doesn't show up on my Windows computer. I do know that at least in Ubuntu 10.10 with Gnome 2 all I had to do was right click on a folder and click Sharing. I'm looking for similar ease of use in Fedora. Does anyone have any suggestions?


title: How to download specific files from some url path with wget

text: If I don't want to have to download the files found in a specific url path manually, what options do I have? Using wildcards fail:               $ wget 'http://www.shinken-monitoring.org/pub/debian/*deb'     Warning: wildcards not supported in HTTP.     ....      This of course assumes that I don't know the filenames in advance.


title: Dual boot windows 8 and Linux Mint 13 (based on Ubuntu 12.04)

text: I've searched a lot for my problem but couldn't be sure what should I do in my case. I bought my Asus N56VZ several months ago, and it came with Windows 7 and bunch of bloatwares that I don't like, so I re-install windows 7 (I don't remember how did I do it). Afterward, I saw an offer to upgrade to Windows 8 Pro, then I decided to upgrade, then I have Windows 8 Pro in my Asus at the moment. Yesterday, I was going to install LinuxMint 13 which is based on Ubuntu 12.04, and I want dual boot after installing it. So with my little experience, I divided my HDD as below: http://img837.imageshack.us/img837/8458/screenshotfrom201305191.png Then without paying attention to 2 partitions: `/dev/sda1` with flag "boot" and `/dev/sad2` with flag "msftres", I went ahead to install it as I used to install old versions of Ubuntu before, but after a few steps, I got this message: > The partition table format in use on your disks normally requires you to > create a separate partition for boot loader code. This partition should be > marked for use as a "Reserved BIOS boot area" and should be at least 1MB in > size. Note that this is not the same as a partition mounted on /boot. It got me very confused since I really don't want to reinstall my Windows 8 because of any stupid mistake, I have a lot of software on it that I don't want to reinstall and reconfigure. I've google for a while but couldn't be sure about something, so anyone please tell me:   * What do "boot" and "msftres" partition do?   * And how should I proceed with the above message to get dual boot (Windows 8 and LinuxMint 13) after installing?


title: help with script; if status is this do that if not do something else

text: I need to write a script that checks on the status of something. If the status "Copying" then exit (or retry in 60 minutes if we want to get fancy.) If all there is nothing returned (based on my second command, ie, everything is in sync) then do something else. If copying; exit or retry in 60 If NULL; do more things.               root@box:~$ ./prog status       PyDsk /home       In Sync       PyDsk /trax       Copying 85% complete       PyDsk /trax2      In Sync       PyDsk /trax3      Copying 97% complete       PyDsk /traxnl     Copying 50% complete       PyDsk /traxnl2    Copying 69% complete       PyDsk /traxnl3    Copying 56% complete       PyDsk /traxnl4    In Sync       PyDsk /traxnv     In Sync       PyDsk /traxnv2    In Sync       PyDsk /ulog       In Sync                    root@box:~$ ./prog status | grep complete | awk '{print $3;}'     Copying     Copying     Copying     Copying     Copying      edit; I'm open to any other way of getting this done. I'm not married to how I've started things... it's just the only way I could think of. If there's something more elegant, I'll take it :) edit2; redacted. I'm going dark.


title: antispam techniques in postfix on linux

text: We have an issue of incoming spam on the server hosting several domains. Its running postfix on CentOS 5.x. Please suggest the techniques that can be enabled on the server to prevent incoming spam.


title: Finding RPMs for Install

text: I'm trying to install later version of software for 2 RPM-based installations, but `yum` tells me that I already have the latest versions. When looking to install software via `RPM`, what's the best way to find it?


title: Disable user shell for security reasons

text: We have several user accounts that we create for automated tasks that require fine-grained permissions, such as file transfer across systems, monitoring, etc. How do we lock down these user accounts so that these "users" have no shell and are not able to login? We want to prevent the possibility that someone can SSH in as one of these user accounts.


title: Using Image Magick Convert to Change Channel Depth?

text: I want to change an image depth of bitmap for testing purposes. Right now I am trying to get a 2 bit palette image, and a 4444 Hicolor image. I have a true color bitmap. I used the below command line               convert -depth 2 /media/bitmap/rule.bmp lut2bpp.bmp      then when I used identify I got this               Image: lut2bpp.bmp     Format: BMP (Microsoft Windows bitmap image)     Class: PseudoClass     Geometry: 720x480     Type: Palette     Endianess: Undefined     Colorspace: RGB     Channel depth:     Red: 8-bits     Green: 8-bits     Blue: 8-bits      It changed it to a palette which is great, how do I get to change channel depth? How about changing that true color 24 bit image to hi color 4444 image?


title: Gtk2 Themes under Gentoo's Gnome 3

text: I have made it to get a nice gnome shell environment running under my new gentoo. It's all fine, except there are a whole bunch of programs built against gtk2 (Chromium, Pidgin, Thunderbird, Firefox), and they look strangely out of place. The ui of the gtk2 parts looks rather like windows 95 than gnome 3. I have not yet found out how to configure the controls and icons. The instructions found on the gnome theme sites seemed to be ignored by my gentoo system or were made for Ubuntu. Any help?


title: Is there a 'rc' configuration file for grep/egrep? (~/.egreprc?)

text: I usually do some grep when developing, and there are some extensions that I always don't want to look for (like *.pyc). Is it possible to create a ~/.egreprc or something like that, and put some filtering to always not show pyc files in result. Is this possible, or will I have to create an alias for using grep in this manner, and call the alias instead of grep?


title: Is there a way to retrieve the name of the Desktop Environment?

text: The title is quite exhaustive: is there a way to retrieve the desktop environment name (e.g. Gnome, Unity, XFCE, LXDE, KDE...) from the command line or using Python?


title: How to get name of Display Manager on Linux?

text: I want to see `Display Manager` name (Gnome, KDE etc.) via python or bash script. Is there any command for it as `uname`? (I try fedora and Debian)


title: How to check accurately the remaining disk space on a partition?

text: I have my /home partition formatted as ext3. Occassionally, some program that is part of GNOME is giving notifications about there only being 700mb of space left. Nautilius tells me I have 5.6GB. Disk Usage Analyzer tells me I have 10GB. Which of these is most accurate, or is there another program that is more accurate? What accounts for these different figures?


title: How does bash interpret the equal operator with no surrounding spaces in a conditional?

text: The following script does not behave as I would have expected. Adding spaces around the '=' in the conditional made it perform how I wanted, but it got me thinking, what is it actually doing inside the conditional?               #!/bin/bash     S1='foo'     S2='bar'     if [ $S1=$S2 ];     then         echo "S1('$S1') is equal to S2('$S2')     fi     echo $S1     echo $S2      The output is:               S1('foo') is equal to S2('bar')     foo     bar      The contents of S1 and S2 don't change from what they are assigned, so the = doesn't perform an assignment.


title: keepalive script for application daemons?

text: > **Possible Duplicate:**   >  Linux: Writing a watchdog to monitor multiple processes I'm looking for a program to keep a set of daemon processes alive. The daemon processes will be for a user application running on the host. Some desirables:   * does not have to be run as root   * like inetd/xinetd, but my daemons are not socket-oriented   * like keepalive/spawndaemon for ci-linux but works under Ubuntu   * preferably written in a scripting language so that it is easily modifiable   * controllable through a command-line interface (for instance, temporarily disable a daemon, query daemon state, etc.) Any suggestions?


title: Need help with a script to test for memory usage

text: I'm trying to put up a temporary band-aid while I work out a solution for a app's memory leak. What I wrote was a small `bash` script that I put in the root on the server. This is what the script is suppose to do:   1. Get the location it's run in   2. Check to to see if the script is the crontab   3. If not in the crontab add to the crontab to run every 5mins   4. Test the memory and check to see if the % is above percent_allowed   5. If above test then restart nginx & php-fmp services `memory_protect.sh`:               #!/bin/sh     cronfile=memory_protect.sh    #NOTE THIS SHOULD DETECT IT'S SELF     path=pwd                      #this is the path to the file      percent_allowed=80            #this should be max memory before action          has_cron(){         #is the file in the cron?         return [[ crontab -l | egrep -v '^$|^#' | grep -q $cronfile ]] && return 1 || return 0     }     test_memory(){         memusage=`top -n 1 -b | grep "Mem"`         MAXMEM=`echo $memusage | cut -d" " -f2 | awk '{print substr($0,1,length($0)-1)}'`         USEDMEM=`echo $memusage | cut -d" " -f4 | awk '{print substr($0,1,length($0)-1)}'`              USEDMEM1=`expr $USEDMEM \* 100`         PERCENTAGE=`expr $USEDMEM1 / $MAXMEM`         #if it's above 80% alert         return [[ $PERCENTAG>$percent_allowed ]] && return 1 || return 0     }          if [[ has_cron -eq 0 ]]     then         #was not here so add         #run this script every 5 mins         */5 * * * $path/$cronfile     fi          if [[ test_memory ]]     then         #clear some memory         /etc/init.d/nginx restart         /etc/init.d/php-fpm restart     fi      The memory test seems to work when I run that by it's self, but this in whole doesn't seem to be working. * * * **Update** I needed to run `dos2unix` on the file, but I also realized I have a return on the conditions of each function in the end.. so that was not going to work. Right now it seems to say that `[[` on the `if` statement is not found. * * * **Update 2** Seems close, it's running the restarting of the services, but it's not putting the cron job in.. so I don't see it running               #!/bin/bash     cronfile=memory_protect.sh    #NOTE THIS SHOULD DETECT IT'S SELF     path=pwd                      #this is the path to the file      percent_allowed=80            #this should be max memory before action          has_cron(){         #is the file in the cron?         #return 0 #returning this just to test should         #be the next line but it's not working         return 0         [[ crontab -l | egrep -v '^$|^#' | grep -q $cronfile ]] && return 1 || return 0     }     test_memory(){         memusage=`top -n 1 -b | grep "Mem"`         MAXMEM=`echo $memusage | cut -d" " -f2 | awk '{print substr($0,1,length($0)-1)}'`         USEDMEM=`echo $memusage | cut -d" " -f4 | awk '{print substr($0,1,length($0)-1)}'`              USEDMEM1=`expr $USEDMEM \* 100`         PERCENTAGE=`expr $USEDMEM1 / $MAXMEM`         #if it's above 80% alert         [[ $PERCENTAG -gt $percent_allowed ]] && return 1 || return 0     }          if [[ has_cron -eq 0 ]]     then         #was not here so add         #run this script every 5 mins         #crontab -e */5 * * * $path/$cronfile         cat <(crontab -l) <(echo "*/5 * * * $path/$cronfile") | crontab -     else         echo "cron present"     fi          if [ test_memory ]     then         #clear some memory         sudo /etc/init.d/nginx restart         sudo /etc/init.d/php-fpm restart     fi      It's close now I think to being corrected.


title: Load command parameters from upper level file

text: I've come across an interesting problem that I have not yet been able to solve satisfyingly. Consider a note taking command that takes two arguments:               note $project  $note      That simply files the content of $note under a project according to the first parameter. Now I have two projects where I enter some data:               note "projectA" "asdfasdf"     note "projectB" "weradfvsaf"      This worked well when I had few projects. Then I got more projects and I had an Idea: Use the current path to determine the name of the project:               +~     +~/projects/projectA     +~/projects/projectB/subdir     +~/projects/...      So I wrote a wrapper for the above function that parses the project name out of the directory path. This worked very well, until I started to have several projects spanned across multiple paths:               +~     +~/projects/projectA     +~/projects/projectB/subdir     +~/projects/temp/projectA     +~/test/projectA      Now my problem is: How can I continue to be lazy? I thought the easiest way would be to create a file, for instance project.rc, that only contains the name of the project that is contained in the folder and all subfolders of where it is located. The wrapper simply looks in the current dir for this file and continues to traverse upwards in the directory tree until the file is found. Then the file is read and the $project parameter is set accordingly. I am not really familiar with shell scripting; Could anyone come up with a solution for this problem?


title: unrar part of a multipart rar file

text: Suppose you have a multipart rar file, say `file.part1.rar`, `file.part2.rar`, `file.part3.rar`. I know that I can extract only the first parts using for example               unrar e -kb file.part1.rar      However assume that I have only `file.part3.rar` and **not** part 1 and 2. Is then there a way to extract the content of part 3? Is this possible if the rar file contains a video file? (Extracting part 3 schould then result in a video file which contains only the last x minutes). If it is not possible, is it because it is in principle impossible or because there is currently just no program which can do it. **Edit** : Is it possible to extract say the last part if you have just the last and the first part but not the parts between?


title: Fork bomb on a Mac?

text: I just learned about a fork bomb, an interesting type of a denial of service attack. Wikipedia (and a few other places) suggest using `:(){ :|:& };:` on UNIX machines to fork the process an infine number of times. However, it doesn't seem to work on Mac OS X Lion (I remember reading that the most popular operating systems are not vulnerable to such a direct attack). I am, however, very curious about how such an attack works (and looks), and would want to try it out my Mac. Is there a way to go around the system's safeguards, or is it the case that a fork bomb is not possible on Macs?


title: installing apache httpd server on RHEL-6

text: I have 5 systems running Apache tomcat server, for load balancing i need to install Apache httpd server, how should I do this, please provide me some useful links and your opinions on this. I am using RHEL6.


title: How can I view foreign languages in Chromium?

text: I just installed the minimal version of Ubuntu. (To be specific, I installed Ubuntu 12.04 "Precise Pangolin" 32-bit.) This version does not have all the tools that are usually avaialble in normal Ubuntu. During installation, I chose "Lubuntu minimal installation", then later I installed LXDE as my desktop manager. I have Chromium already installed, but it cannot view any language fonts other than English. How can I change this so that I can view any languages on my Chromium? I want to keep everything minimal, so I want to enable this without installing unnecessary features.


title: How to copy only new files using "scp" command?

text: I was copying hundreds of files to another computer using the `scp` command that I got the `stalled` error. Now I am going to copy the files again. Is there any way to avoid copying the already copied files?


title: Why there are so many problems with the overheating and fan speed when installing Linux?

text: I don't understand it. Almost every 10th or 20th question is about fan or overheating or that the fan is too loud and the speed too big etc. And these questions are not only about laptops but often about desktop Linux systems. Why there are so many problems with fans in the Linux world? Why is it so hard to set the right fan speed in Linux distributions or during the install process?


title: limits that are set in an unmodified environment

text: If /etc/security/limits.conf has not been edited or changed, there are nothing but comments. However 'cat /proc/self/limits' shows there are some limits in effect. Are these compiled into the kernel? If no where does the system get the initial default limits in an unmodified environment?               [~]$ cat /proc/self/limits     Limit                     Soft Limit           Hard Limit           Units          Max cpu time              unlimited            unlimited            seconds        Max file size             unlimited            unlimited            bytes          Max data size             unlimited            unlimited            bytes          Max stack size            10485760             unlimited            bytes          Max core file size        0                    unlimited            bytes          Max resident set          unlimited            unlimited            bytes          Max processes             1024                 60413                processes      Max open files            1024                 4096                 files          Max locked memory         65536                65536                bytes          Max address space         unlimited            unlimited            bytes          Max file locks            unlimited            unlimited            locks          Max pending signals       60413                60413                signals        Max msgqueue size         819200               819200               bytes          Max nice priority         0                    0                         Max realtime priority     0                    0                         Max realtime timeout      unlimited            unlimited            us


title: What do the channel numbers in ssh error message refer to?

text: In the example below what do the channel numbers correspond to? Which are on the server? Which are on the client?                 $ ssh -L1570:127.0.0.1:8899 root@thehost         Password:         Last login: Fri Aug  9 13:08:44 2013 from theclientip         Sun Microsystems Inc.   SunOS 5.10      Generic January 2005         You have new mail.         # channel 2: open failed: administratively prohibited: open failed         channel 3: open failed: administratively prohibited: open failed         channel 2: open failed: administratively prohibited: open failed      The ssh client is running on Windows 7 and the server has a Tomcat server running on port 8899. Tomcat is not listening on 127.0.0.1 on the remote machine so if I change the command to `ssh -L1570:thehostpublicip:8899 root@thehost` the port forward works. So I know that port forwarding seems to be working just fine on the server. my sshd config file contains the following two lines:               # Port forwarding     AllowTcpForwarding yes          # If port forwarding is enabled, specify if the server can bind to INADDR_ANY.     # This allows the local port forwarding to work when connections are received     # from any remote host.     GatewayPorts yes      I'm trying to setup port forwarding for another process not Tomcat and I get the error messages similar to the stuff above so I'm trying to understand the meaning of the error messages.


title: Mouse pointer stuck as I login

text: I am facing this problem,and I don't know I dig into it. As I log into Ubuntu my mouse pointer get stuck. I have tried the following methods:               sudo apt-get update     sudo apt-get upgrade      I have also tried this:               sudo apt-get install -f     sudo dpkg --configure -a     sudo apt-get install -f      Also, lots of other methods. But none works for me. Please guide me how I can restore my pointer. I don't face this problem when I log in as a Guest user in Ubuntu, also my mouse starts moving when I attach an external USB mouse.   This is output of my lsmod command                   haider@ubuntu:~$ lsmod | sort          arc4                   12473  2          bcma                   25651  0          binfmt_misc            17292  1          bluetooth             158447  10 rfcomm,bnep         bnep                   17830  2          brcmsmac              540923  0          brcmutil               14675  1 brcmsmac         cfg80211              178877  2 brcmsmac,mac80211         cordic                 12518  1 brcmsmac         crc8                   12781  1 brcmsmac         dcdbas                 14098  1 dell_laptop         dell_laptop            17767  0          dell_wmi               12601  0          drm                   197641  4 i915,drm_kms_helper         drm_kms_helper         45466  1 i915         hid                    77428  1 usbhid         i2c_algo_bit           13199  1 i915         i915                  428056  8          intel_ips              17822  0          joydev                 17393  0          lp                     17455  0          mac80211              436493  1 brcmsmac         mac_hid                13077  0          mei                    36570  0          Module                  Size  Used by         parport                40930  3 parport_pc,ppdev,lp         parport_pc             32114  0          ppdev                  12849  0          psmouse                86520  0          r8169                  56396  0          rfcomm                 38139  0          serio_raw              13027  0          snd                    62218  16 snd_hda_codec_hdmi,snd_hda_codec_idt,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_rawmidi,snd_seq,snd_timer,snd_seq_device         snd_hda_codec         109562  3 snd_hda_codec_hdmi,snd_hda_codec_idt,snd_hda_intel         snd_hda_codec_hdmi     31775  1          snd_hda_codec_idt      60251  1          snd_hda_intel          32719  3          snd_hwdep              13276  1 snd_hda_codec         snd_page_alloc         14108  2 snd_hda_intel,snd_pcm         snd_pcm                80916  3 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec         snd_rawmidi            25424  1 snd_seq_midi         snd_seq                51592  2 snd_seq_midi,snd_seq_midi_event         snd_seq_device         14172  3 snd_seq_midi,snd_rawmidi,snd_seq         snd_seq_midi           13132  0          snd_seq_midi_event     14475  1 snd_seq_midi         snd_timer              28931  2 snd_pcm,snd_seq         soundcore              14635  1 snd         sparse_keymap          13658  1 dell_wmi         usbhid                 41937  0          uvcvideo               67203  0          video                  19115  1 i915         videodev               86588  1 uvcvideo         wmi                    18744  1 dell_wmi


title: Get row data for non-matching column values

text: I want to read the file (1600 rows) and get rows only the columns have different values (sno1, sno2, sno3 & sno4-should be not be equal value) and it should be above 50%.The example of output given below **input.txt (tab-delimited)**               id sno1 sno2 sno3 sno4     R1 98.4 88.8 98.4 67.6     R2 100  100  100  100     R3 33.4 23.5 98.8 45.5     R4 53.5 78.7 88.8 67.5     R5 0    0    0    0     R6 88.8 98.8 67.6 100      **ouput.txt**               R4 53.5 78.7 88.8 67.5     R6 88.8 98.8 67.6 100      Here in R4 & R6 rows- all column values have not equal to each other and all are above 50%. Any help in awk/sed/perl is appreciated.


title: How to recover most recently deleted directories on NTFS partition

text: In Nautilus under Ubuntu 12.04, I accidentally selected several directories on a partition and deleted them at once (unfortunately, I deleted them by Shift+Delete such that they don't remain in Trash). I haven't written any new data to that partition yet since the deletion. I wonder what ways I can try to recover them? Note that the partition is NTFS, shared between Windows 7 and Ubuntu 12.04. Following is different software that I have tried so far.   1. I have also tried to use Sleuthkit, but I cannot figure out how to use it. I have been running `sudo fls -f ntfs -d -r -p /dev/sda3 > ~/deleted_files.txt` for almost a week on my 110GB 96%-used ntfs partition. It hasn't finished running yet (don't know when it will), and the file `~/deleted_files.txt` is still empty. All my work has been stalled since I don't dare to write any data to the partition. Now I wonder if my usage of sleuthkit is the quickest way to identify most recently deleted directories and files in my case?   2. I installed TestDisk 6.13 via apt-get install, and followed http://www.cgsecurity.org/wiki/Undelete_files_from_NTFS_with_TestDisk to recover the deleted directories and the files in them. But what is shown by TestDisk is not the deleted file/directory names as shown in the picture in the link, but files named by inode numbers:              TestDisk 6.13, Data Recovery Utility, November 2011     Christophe GRENIER <grenier@cgsecurity.org>     http://www.cgsecurity.org      3 P HPFS - NTFS           9291  38 28 23650 187 25  230686720 [Data]     Deleted files          >inode_13285                           30-Jan-2011 20:55     29427      inode_13285:Zone.Identifier           30-Jan-2011 20:55        26      inode_164258                          11-Aug-2011 13:16      2993      inode_307016                          12-Feb-2011 09:34      1808      inode_307017                          12-Feb-2011 09:34     10254      inode_307018                          12-Feb-2011 09:34     13155      inode_307019                          12-Feb-2011 09:34      7586      inode_307020                          12-Feb-2011 09:34      7344      inode_307021                          12-Feb-2011 09:34      6943      inode_307022                          12-Feb-2011 09:34      6081      inode_307023                          12-Feb-2011 09:34     24043      inode_314965                          12-Feb-2011 09:36    112947      inode_314983                          12-Feb-2011 09:36     23581      inode_314984                          12-Feb-2011 09:36      8486      inode_314985                          12-Feb-2011 09:36       158      inode_314986                          12-Feb-2011 09:36        45                                                        Next     Use : to select the current file, a to select/deselect all files,         C to copy the selected files, c to copy the current file, q to quit      When I hit `a` and then `C` to select and copy all the selected files, files named `inode_xxxxxx` will be copied to a directory that I specify. Also, I don't know the meaning of the date and time for each file shown by TestDisk. Does it mean the deletion date and time or last update date and time before deletion? (Note the most recent date and time shown by TestDisk is 30-Jul-2012 20:53, which is not today when the accidental deletion happened.) How can I figure out which files are my most recently deleted ones, and how can I recover them? Can I find out and recover my most recently deleted directories instead of just files?   3. I am also curious to know if these two links to How-to really work? In http://www.ehow.com/how_5202235_retrieve-deleted-files-linux.html, `grep -b 'search-text' /dev/partition > file.txt` is used to search for the deleted files. In http://www.ehow.com/how_7517984_restore-overwritten-file-linux.html, the "Isdel" command is used. What other software can I try besides TestDisk and Sleuthkit?


title: Git do not overwrite symlinked directory on branch checkout

text: How can I make directory read-only with git? The situation is - in project, I have a symlink to shared framework. I don't want it to be overwritten/changed in any way (not even mtime or atime). How can I do that - or am I viewing the thing from wrong perspective?


title: Encrypt a password the same way mysql does

text: I've created a user ... but forgotten the password               mysql> create user 'blayo'@'%' identified by 'right';      Which Linux command line tool can **encrypt the password the same way mysql 5.5 does ?**               mysql> select Password,User from mysql.user     ------------------------------------------+-------+     *920018161824B14A1067A69626595E68CB8284CB | blayo |      ...to be sure I use the right one               $ tool right     *920018161824B14A1067A69626595E68CB8284CB


title: GNU Screen does not work when su'ing from root to a normal user

text: Is it normal, that when I am logged in as root, and the used `su user`, I can't access that users screen sessions? In this case, screen complains about it not having permissions on `/dev/pts/x`. I assume that it can't control the terminal which was opened as root in the way it needs: am I right?


title: Why is Linux commonly used as operating system for supercomputers?

text: As of november 2010, Linux is used on 459 out of the 500 supercomputers of the TOP500. What are the reasons behind this massive use of Linux in the supercomputer space?


title: GRUB File Not Read Correctly

text: I was installing Gentoo when I ran into problems with the bootloader. Whether I used the automatic or manual installation method, GRUB always threw the following error: `The file /boot/grub/stage1 not read correctly.` I checked out the file with `nano`, but it was mostly unreadable and garbled as if it were using the wrong character encoding. All the other files in that directory suffered the same fate. Are these files supposed to be human-readable? Will the problem fix itself if I try installing again? If not, what can be done to correct it?


title: What is Dom0 and how can one use it?

text: I have heard that Xen is now fully included into mainline Linux, and is usable via Dom0. Bare with me: I'm no expert on virtualization, let alone virtualization _on Linux_. What is Dom0, what is its purpose? How can one use it?


title: Choosing virtual machine software on Linux

text: There are many virtual machine software out there. Even some are included into mainline Linux. What differentiates them, and what criteria should one ponder while choosing one?


title: Fail to install perf on slackware 13.1

text: I was trying to install perf on slackware 13.1 When I first ran make at /usr/src/linux/tools/perf I got some errors. And I found this patch http://www.valimar.it/repo/linux/perf_fix-2.6.33.patch And when I ran make again, it issued some different errors as below. But I've already installed perl package perl-5.10.1-i486-1               libperf.a(trace-event-perl.o): In function `define_flag_value':     /usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:125: undefined reference to `Perl_push_scope'     /usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:126: undefined reference to `Perl_save_int'     /usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:129: undefined reference to `Perl_newSVpv'     /usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:129: undefined reference to `Perl_sv_2mortal'     /usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:130: undefined reference to `Perl_newSVpv'     /usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:130: undefined reference to `Perl_sv_2mortal'     /usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:131: undefined reference to `Perl_newSVuv'     /usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:131: undefined reference to `Perl_sv_2mortal'     /usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:132: undefined reference to `Perl_newSVpv'     /usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:132: undefined reference to `Perl_sv_2mortal'     /usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:135: undefined reference to `Perl_get_cv'     /usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:136: undefined reference to `Perl_call_pv'     /usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:139: undefined reference to `Perl_free_tmps'     /usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:132: undefined reference to `Perl_stack_grow'     /usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:131: undefined reference to `Perl_stack_grow'     /usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:130: undefined reference to `Perl_stack_grow'     /usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:129: undefined reference to `Perl_stack_grow'     /usr/src/linux-2.6.33.4/tools/perf/util/trace-event-perl.c:127: undefined reference to `Perl_markstack_grow'


title: Remove files older than 5 days in UNIX (date in file name, not timestamp)

text: I want to delete log files which are older than 5 days from a directory. But deletion should not be based on the timestamp of file. It should be based on the name of file. For Example todays date is 07/05/2012 and the directory contains 10 files of names like `ABC_20120430.log`, `ABC_20120429.log`, `ABC_20120502.log`, `ABC_20120320.log` etc. I want to be able to remove the files by extracting the date from the name of the file.


title: Changing CIFS permissions on FreeNAS?

text: I'm trying to change some permissions on a folder. I'm running FreeNAS and using the windows permissions settings (not Unix). If I right click the file and go to properties and then security, it shows that the only person who can make changes is the: root(Unix user\root). **NOTE:** For obvious reasons I can't login to the windows share using the root user. So how would I go about changing the settings to allow my account to change the permissions?


title: Prevent active file removal on an NFS filesystem

text: I clear my logs using following script -               find "." -mtime 1 -type f -print0 | xargs -0 rm -rf      But it deletes the active files also and creates `.nfs…` files instead. Is there any way to prevent deletion of active files?


title: SMART extended offline test validity

text: Is it possible for the `smartctl -t long /dev/sda` to complete without error and still the drive fail? How detrimental to the disk's life expectancy is running the test daily/weekly? Thanks!


title: What is "system time" when using "time" in command line

text: Im using `time` to time a `Perl` script on standard terminal in Ubuntu 14.04. I have read that `real time` is stopwatch time; the time I, as a user, is spending looking at the program running from I start the program until it terminates. But I don't get what `user` or `sys` times are. The man page on `time` is vague, to say the least. While it is somewhat clear that the `real` time is split between `user` and `sys` it is not clear what they represent. In my script I'm benchmarking[1] C++ and Perl against each other to see the difference, and I would like to know what data I'm actually getting. An example output is:               real    0m24.198s     user    0m23.120s     sys     0m1.030s      Could someone please elaborate what the default format of time is telling the user? I'm a novice into Linux, so please don't assume too much. [1] Interestingly, while C++ is way, way faster than Perl in my benchmark with regards to `real` time, the `sys` times doesn't differ that much, with C++ actually using more `sys` time than Perl. This is why I want to know what they mean


title: Why is Aircrack-ng able to read and use a .lst file that Leafpad couldn't in a reasonable time?

text: To make myself a little more clear: I tried opening a .lst file (password list) in Kali Linux. The system was struggling to handle it and Leafpad didn't even start, but I noticed a significant performance difference. I ended up just hard rebooting. When I open the password list with Aircrack-ng to crack a password, Aircrack- ng is able to use the password list just fine. What makes Aircrack-ng more suitable to handle this large lst file without significantly impacting my laptop's performance? Is it the way Aircrack-ng reads the lst file?


title: Can I make text in xterm looks and feels like gnome-terminal?

text: ![enter image description here](http://i.stack.imgur.com/Gmq1o.png) The picture on top you can see my xterm, the picture under is the gnome- terminal. Ok This is what I want to get: I use the same font in both but looks different:               Xterm*faceName: DejaVu Sans Mono Bold:size=11:antialias=true      how can I fix this?


title: Keeping multiple root directories in a single partition

text: I'm working out a partition scheme for a new install. I'd like to keep the root filesystem fairly small and static, so that I can use LVM snapshots to do backups without having to allocate a ton of space for the snapshot. However, I'd also like to keep the number of total partitions small. Even with LVM, there's inevitably some wasted space and it's still annoying and vaguely dangerous to allocate more. So there seem to be a couple of different options:   * Have the partition that will contain bulky, variable files, like `/srv`, `/var`, and `/home`, be the root partition, and arrange for the core system state — `/etc`, `/usr`, `/lib`, etc. — to live in a second partition. These files can (I think) be backed up using a different backup scheme, and I don't think LVM snapshots will be necessary for them.   * The opposite: putting the big variable directories on the second partition, and having the essential system directories live on the root FS. Either of these options require that certain directories be pointers of some variety to subdirectories of a second partition. I'm aware of two different ways to do this: symlinks and bind-mounts. Is one better than the other for this purpose? Is there another option? Do some linux distros support installation using this style of partition layout?


title: How do I delete a file named "°" in bash

text: I've accidentally created a file named `°`. Now I'm having trouble deleting it with bash.               [/opt/etc/sudoers.d] # ls -l     -r--r-----    1 admin    administ       21 Feb  3 23:54 010-root     -rw-r--r--    1 admin    administ       20 Feb  3 23:50 °      Typing `rm °` seems to only move the caret to the beginning of the line, i.e. no character is entered. (For what it's worth I'm running bash 3.2.0 on a remote machine conntected with SSH using Mac OSX Terminal) Any ideas?


title: Need for thread_info structure in Linux 2.6 Kernel

text: Prior to the Linux 2.6 kernel, `struct task_struct` was present at the end of the kernel stack of each process. There was no `thread_info struct` concept. But in Linux 2.6 kernel, instead of `task_struct` being placed at the end of the kernel stack for the process, the `thread_info struct` is placed at the end. This thread_info struct contains a pointer to the `task_struct` structure. What was the need for `thread_info` structure to be introduced ?. We could have accessed the `task_struct` structure using the `stack pointer` directly if `task_struct` was placed at the end of the kernel stack of the process. In 2.6 Kernel, `task_struct` is dynamically allocated using `slab_allocator`. Prior to 2.6 Kernel, was it statically allocated?


title: feeding input values to dpkg-reconfigure in non-interactive way

text: I would like to configure ubuntu package via dpkg-reconfigure with all the values supplied via non-interactive mode (in the script). In fact my case is firebird confiiguration (http://www.firebirdsql.org/manual/ubusetup.html), that when using command:               sudo dpkg-reconfigure firebird2.5-superclassic -freadline      asks me for the 2 values, where answers would be 'Y' and 'newpwd' . Sample output looks like this:               sudo dpkg-reconfigure firebird2.5-superclassic -freadline      * Firebird 2.5 superclassic server not running     Configuring firebird2.5-superclassic     ------------------------------------          Accept if you want Firebird server to start automatically.          If you only need the Firebird client and there are no databases that will be served by this host, decline.          Enable Firebird server? Y               Password for firebird 2.5     -------------------------          Firebird has a special user named SYSDBA, which is the user that has access to all databases. SYSDBA can also create new databases and users. Because of this, it      is necessary to secure SYSDBA with a password.          The password is stored in /etc/firebird/2.5/SYSDBA.password (readable only by root). You may modify it there (don't forget to update the security database too,      using the gsec utility), or you may use dpkg-reconfigure to update both.          To keep your existing password, leave this blank.          Password for SYSDBA:                 * Starting Firebird 2.5 superclassic server...        ...done.      * Firebird 2.5 superclassic server already running      I've tried `here strings` via bash script like this:               sudo dpkg-reconfigure firebird2.5-superclassic -f readline << EOF     Y     newpwd     EOF      However this didn't work for some reason and it asked for the values to be supplied. Any ideas how to feed the required values to script? Thanks.


title: Install specific version of X11 for xmonad?

text: I wanted to compile `xmonad` from source, so I checked out the code and ran the first command from the `README`.               $ runhaskell Setup.lhs configure --user --prefix=$HOME     Configuring xmonad-0.12...     Setup.lhs: At least the following dependencies are missing:     X11 >=1.5 && <1.7      Apparently haskell wants a specific version of `X11`. This kind of scares me, as whenever I touch video-specific items like `Xorg` or video drivers, I tend to completely bork my system.   1. Is it safe to install a specific newer version of `X11`?   2. How would I do so? Is it possible to use `apt-get`?


title: How do I fix "make: No rule to make target `config'"?

text: I am very new to Linux, running Mint 15. When I type `make config` in the terminal, the system responds with:               make: *** No rule to make target `config'.  Stop.      Any idea how to fix that problem?


title: parted: create new partition

text: I have a 3TB disk, and I understand I have to use `parted` if I want to create a partition bigger than 2TB. All right then.               parted /dev/sdb          (parted) mklabel gpt          (parted) mkpart primary                                               File system type?  [ext2]?      Say what? It does not let me to create a partition without specifying a FS type. Why does `parted` insist on specifying a FS type. AFAIU, a FS type is completly independent from a partition. In `man parted`, I read that:               fs-type can be one of "fat16", "fat32", "ext2", "linux-swap", or "reiserfs".      I don't want any of these. I want to create a partition to be used as LUKS partition. What should I select?


title: How is upstart's socket activation used?

text: Upstart has gained the ability to start a process after a socket is accessed, but I found the feature to be poorly documented. How is a socket-activated daemon and upstart config written?


title: How to get rid of power failure problems while using Linux?

text: I am using Linux. My daily working directory is present on a VFAT partition of my disk. Always I mount it and do my work. When power failure happens this directory sometimes gets corrupted and 'file saving' or 'file removal' results in an error "read-only file system'. After 2-3 unmount/mount the problem goes away. But, mostly I loose some _saved_ and unsaved changes that I have done to my files. How to get rid of such power failure problems? Very much surprised that my bios setting also getting changed sometimes, including date time! Don't know how to get rid of this as well.


title: Installing OpenGL on LMDE

text: I can't install OpenGL on LMDE, I always get errors like this: "The following packages have unmet dependencies: freeglut3-dev : Depends: libgl1-mesa-dev but it is not going to be installed" I think the problem might be with the installation of the Nvidia driver but I don't know... I can't install Steam, Wine, Virtualbox. I've been searching for solutions and trying things for hours, can anyone help me please? Edit: freeglut3 installed correctly but I'm having some trouble with freeglut3-dev, I've tried solving it with synaptic but it didn't work...               sudo apt-get install freeglut3-dev          The following packages have unmet dependencies:      freeglut3-dev : Depends: libgl1-mesa-dev but it is not going to be installed or                               libgl-dev                      Depends: libglu1-mesa-dev but it is not going to be installed or                               libglu-dev                      Depends: libxt-dev but it is not going to be installed     E: Unable to correct problems, you have held broken packages.      And when trying to install steam:               The following packages have unmet dependencies:      libgl1-mesa-dri:i386 : Depends: libdrm-intel1:i386 (>= 2.4.27) but it is not going to be installed                             Depends: libdrm-nouveau1a:i386 (>= 2.4.23) but it is not going to be installed                             Depends: libdrm-radeon1:i386 (>= 2.4.17) but it is not going to be installed                             Depends: libdrm2:i386 (>= 2.4.3) but it is not going to be installed      libgl1-mesa-glx:i386 : Depends: libdrm2:i386 (>= 2.3.1) but it is not going to be installed                             Depends: libglapi-mesa:i386 (= 8.0.4-2) but it is not going to be installed                             Depends: libx11-xcb1:i386 but it is not going to be installed                             Depends: libxdamage1:i386 (>= 1:1.1) but it is not going to be installed                             Depends: libxfixes3:i386 but it is not going to be installed                             Depends: libxxf86vm1:i386 but it is not going to be installed     E: Unable to correct problems, you have held broken packages.


title: Best method to collect a random sample from a collection of files

text: Suppose there is a directory holding 300 data files. I want to randomly select 200 of those files and move them into another directory. Is there a way to do that under Unix/Linux?


title: How can I find a rogue alias declaration?

text: I'm trying to find where a specific `alias` has been declared. I've searched all the usual places I know to look for aliases:   * ~/.bashrc   * ~/.bash_profile   * /etc/bashrc   * /etc/profile With no luck. I know it's an `alias` because when I do `which COMMAND`, I get:               alias COMMAND='/path/to/command'         /path/to/command      Is there a way to find what file declares an `alias` only knowing the `alias` name?


title: Transforming text to tabular form

text: I have a text file with the following structure:               aaa     bbb     ccc     ddd     eee     fff          1     2     3     4     5     6          1.1     1.2     1.3     1.4     1.5     1.6          ggg     hhh     iii     jjj     kkk     lll          7     8     9     10     11     12          2.1     2.2     2.3     2.4     2.5     2.6      and I want the following tabular structure:               aaa    1    1.1     bbb    2    1.2     ccc    3    1.3     ddd    4    1.4     eee    5    1.5     fff    6    1.6     ggg    7    2.1     hhh    8    2.2     iii    9    2.3     jjj    10   2.4     kkk    11   2.5     lll    12   2.6      In this example each column repeats the pattern 2 times but the actual file does it more times and has more fields.


title: Fedora 17 Data Card Installation error

text: I have installed fedora 17 recently and i am trying to install my aircell datacard but i get following error message while installing               this is linux driver installtion     make -C /lib/modules/3.5.3-1.fc17.x86_64/build M=/tmp/ONDA_driver_install_V3.41 modules     make: *** /lib/modules/3.5.3-1.fc17.x86_64/build: No such file or directory.  Stop.     make: *** [modules] Error 2     this  is customized kernel ,kernel version is: 3.5.3-1.fc17.x86_64     enter customize_driver_install function     cp: cannot stat `onda.ko': No such file or directory     FATAL: Module onda not found.     disselfirefox.pp driver_install.run nm.pp se End to /opt/Connection_Manager/driver     libsepol.scope_copy_callback: spamassassin: Duplicate declaration in module: type/attribute pyzord_exec_t (No such file or directory).     libsemanage.semanage_link_sandbox: Link packages failed (No such file or directory).     /usr/sbin/semodule:  Failed!     the return is 256     libsepol.scope_copy_callback: spamassassin: Duplicate declaration in module: type/attribute pyzord_exec_t (No such file or directory).     libsemanage.semanage_link_sandbox: Link packages failed (No such file or directory).     /usr/sbin/semodule:  Failed!     the return is 256     it's ok!     usermod: group 'netdev' does not exist      Please could somebody help me out on this


title: How to Mirror one more disk on existing filesystem

text: in my test machine i can see the filesystem list using bdf commands.               $bdf       Filesystem          kbytes    used   avail %used Mounted on       /dev/vg00/lvol3    58916864 6242747 49386840   11% /       /dev/vg00/lvol1    2003481   47996 1755136    3% /stand       /dev/vg77/stds     5120000   18753 4782427    0% /var/opt/stdenv       /dev/vg77/scrap    3584000   18684 3342490    1% /tms/vts       /dev/vg77/cmdsscrap                    3584000  530986 2862264   16% /mnt        I have a scenario where i have to test the sar(1m) command to check the disk activity. for that i need a filesystem which is mirrored and configured with more then one disk. But unfortunately the above existing filesystems are having only one disk mirrored with it.               # lvdisplay -v /dev/vg00/lvol1     --- Logical volumes ---     LV Name                     /dev/vg00/lvol1     VG Name                     /dev/vg00     LV Permission               read/write                     LV Status                   available/syncd                Mirror copies               0                 Consistency Recovery        MWC                      Schedule                    parallel           LV Size (Mbytes)            2000                 Current LE                  125            Allocated PE                125              Stripes                     0            Stripe Size (Kbytes)        0                        Bad block                   off               Allocation                  strict/contiguous              IO Timeout (Seconds)        default                       --- Distribution of logical volume ---     PV Name                 LE on PV  PE on PV       /dev/disk/disk4         125       125  <-- Only one disk is mirrored.      Can anyone please let me know, How to add another disk into these existing filesystem? Please help me with the steps for mirroring the disk with filesystem. Thanks & Regards


title: How to make Nautilus notice changes regarding group permissions

text: If I follow a process I mentioned here, I am supposed to log out and then in for the changes to take place. What about Nautilus? I tried to restart it and was still unsuccessful. The only way I have so far found that works is logging out of the desktop and then in again. That's not always convenient of course.


title: Weblogic administration console way too slow

text: I've installed weblogic 10.3.3, configured simple domain with default configuration. And after starting weblogic I cannot use it via admin console because it is starting too slow (~10 mins). It seems that admin console application is being deployed incorrectly. Even when I enable 'staging' mode in AdminConsole deployment options, it does not help. Does anybody have a solution for this problem? It really bugs me out. * * * Configuration properties: **Server:** Dell PowerEdge r410 server (Six-core Intel® Xeon® x64 CPU, 8GB RAM) **OS:** Ubuntu Maverick 10.10 x86_64 **Weblogic:** 10.3.3 x64 (used wls1033_generic.jar file for installation) **Java:** : 1.6.0_17_i586 (tried with different jdk's including x64, but it does not work either)


title: How can I build a rpm for i386 target on a x86-64 machine?

text: I am building an rpm using `rpmbuild` command as: `rpmbuild -bb --root <DIRECTORY> \--target i386 --define "_topdir <DIRECTORY>" <specfile>.spec` When I use my SLED 10 SP3 x86 machine, it runs successfully. But on my SLES 10 SP3 x64 Virtual Machine, it gives following error:               error: No compatible architectures found for build      Initially I was not using `\--target` option, still it was running on x86 machine, but same error was there in x64 machine. Please help me to resolve this error


title: Print mac address to file

text: With a bash script, can I read the mac address of my eth0 and print it to a file?


title: How to stop bash editing the history when I reuse and modify an entry?

text: Some instances of bash change the command history when you re-use and edit a previous command, others apparently don't. I've been searching and searching but can't find anything that says how to prevent commands in the history from being modified when they're reused and edited. There are questions like this one, but that seems to say how to cope with the history being edited. I've only recently come across an instance of bash that does edit the history when you reuse a command - all previous bash shells I've used have (as far as I've noticed) been configured not to change the history when you reuse and edit a command. (Perhaps I've just not been paying proper attention to my shell history for the past 15 years or so...) So that's probably the best question: CAN I tell bash NEVER to modify the history - and if so, how?


title: Linux App that monitors log and add rules to iptables

text: I used to use a linux software that monitors logs like http, ssh, etc and if it detects that someone is trying to use brute force, it blocks that ip by adding a rule to iptables. I forgot what that software is called. It's opensource and free.


title: Using X11 as a photo frame

text: I'm currently using a netbook as a small home server and I was thinking about extra uses I could set up. Currently it has Ubuntu (possibly a netbook- specific version) installed, so it contains X-Windows, but also a bunch of stuff I don't care for such as GNOME. The trackpad doesn't seem to work, which should give you an idea of how much I use it as an actual graphical terminal (although I will sometimes log into it as a console terminal). However, since the screen is there, I've been thinking it could be cool for it to display some things. I've been thinking a photo frame/general info display, showing photos that are on an SMB share elsewhere on the network, as well as home automation info like temperature and recent temperature trends. My thinking was this could all be done via DHTML so all the "photo frame" needs to show is something like Firefox in a full screen mode and ignore the keyboard. One nice feature would be to have a button I could press to get a real GUI login back, but I don't really mind that, since I'm happy to just switch to a console screen and switch X-Windows round that way if I need it. So basically, how can I make it such that instead of firing up to a login screen, X11 will start to running an app (possibly as a 'photoframe' user) which is as simple a window manager as possible (or none at all) running a full screen/kiosk mode Firefox (or just some dumb WebKit-frame-hosting app) pointing at a web server on the local machine? :)


title: How to autoboot boot0?

text: How can automatically boot FreeBSD in `boot0` and, when needed, manually load win by pressing a shortcut button?


title: Install CentOS in a VirtualBox to a Compact Flash and use it on a mini PC

text: I got into a very specific situation and want to get to know your opinions. I have got a mini PC with Intel Atom processor which should run CentOS with an upgraded kernel to 3.x and some applications. Disk is a Compact Flash card connected through SATA to CF adapter. The overall performance of this mini PC is not suitable for compiling kernel. Installing Centos takes more time & effort too so I decided to do the following:   * mount Compact Flash to VirtualBox on a high-performance PC   * install CentOS and all applications through Virtual Box to the CF card   * compile new kernel through VirtualBox   * get all other settings set   * backup the content of the CF with dd (to be able to reuse it)   * boot mini PC with a finalized OS on the CF I see two main problems:   * CentOS is installed on a different architecture than it is used on = actually I tried this and it worked   * new kernel is compiled on a different architecture than it is used on = this should not be a problem if I compile the kernel to run on all architectures Do you see other problems which I should be aware of? Do you have experience with similar sirtuation? Any other ideas?


title: When the lines of a file or directory get too long, upgrade to ls list format?

text: Is there a way I can do this? For example if a gets a long name like:               i-have-names-that-are-too-long-to-describe/     i-have-names-that-are-too-long-to-describe-2/     i-have-names-that-are-too-long-to-descri-3/      Can I "upgrade" over from `ls` to `ls -l` given that I have a name of a file or directory that is longer than than say, 20 characters? Is there a way to set up a bash function in my `.bashrc` to do this? I'll call the resulting function lls(). **@tripleee asked:** > Do you want `ls -l` when the input file name is long? Why? It will make the > output longer, not shorter. What if you receive a mix of long and short > filenames? I want it more so that reading the long filenames are systematized to a list (and easier for me to digest and read going down a fixed column); for a mix of long and short filenames, I would default to the list format.


title: Read ~/.bash_profile but not /etc/profile

text: I noticed that you can prevent reading `/etc/profile` by running               bash --noprofile      However this also stops `~/.bash_profile` from being read. Can Bash be invoked in such a way as to read `~/.bash_profile` but not `/etc/profile`?


title: FreeBSD and StrongSwan routing issue

text: Good day, gentlemen. I have recently faced a problem when a device connected to the FreeBSD server via StrongSwan can't route outside its subnet. Let me explain in details: FreeBSD 10.0-RELEASE, kernel compiled with (full config: http://pastebin.com/5PQFXqhx):               options IPSEC     options IPSEC_NAT_T     device crypto     device cryptodev      ~~Forwarding turned on in **sysctl.conf** :               net.inet.ip.forwarding=1     net.inet6.ip6.forwarding=1      ~~ We have two interfaces. The first one is 192.168.1.100, the router forwards ports 500 and 4500 from the Internet to this IP (so we can connect from anywhere to the "sweet home" network). The second one is 10.0.0.1 which is used for Samba and other services. **/etc/rc.conf** :               hostname="bsdserver"     ifconfig_igb0="inet 192.168.1.100 netmask 255.255.255.0"     ifconfig_igb1="inet 10.0.0.1 netmask 255.255.255.0"     defaultrouter="192.168.1.1"     gateway_enable="YES"     ipv6_gateway_enable="YES"      ![Network scheme](http://i.stack.imgur.com/UQ0IZ.png) **ipsec.conf** :               config setup         strictcrlpolicy = no     ca bsdserver         cacert = /usr/local/etc/ipsec.d/cacerts/bsdserver_CA.der     conn android     auto = add     dpdaction = clear     keyexchange = ikev2     esp=aes-aes256-sha-modp1024,aes256-sha512-modp4096     ike=aes-aes256-sha-modp1024,aes256-sha512-modp4096     mobike = yes     left = 192.168.1.100     leftsubnet = 0.0.0.0/0,::0/0     leftauth = pubkey     leftid = "111.111.111.111" # real "white" ip here     leftcert = /usr/local/etc/ipsec.d/certs/111.111.111.111_cert.der     leftfirewall = yes     leftsourceip = %config4,%config6     right = %any     rightsourceip = 10.0.0.3/32     rightauth = pubkey     rightid = "C=XX, ST=XX, L=XX, O=ORG, OU=UNIT, CN=111.111.111.111, E=mail@host.com"     rightcert = /usr/local/etc/ipsec.d/certs/android_cert.der      This is the output from `ipsec start --nofork`:               Starting strongSwan 5.1.1 IPsec [starter]...     no netkey IPsec stack detected     no KLIPS IPsec stack detected     no known IPsec stack detected, ignoring!     00[DMN] Starting IKE charon daemon (strongSwan 5.1.1, FreeBSD 10.0-RELEASE, amd64)     00[KNL] unable to set UDP_ENCAP: Invalid argument     00[NET] enabling UDP decapsulation for IPv6 on port 4500 failed     00[CFG] loading ca certificates from '/usr/local/etc/ipsec.d/cacerts'     00[CFG]   loaded ca certificate "C=XX, ST=XX, L=XX, O=ORG, OU=UNIT, CN=111.111.111.111, E=mail@host.com" from '/usr/local/etc/ipsec.d/cacerts/UNIT_CA.der'     00[CFG] loading aa certificates from '/usr/local/etc/ipsec.d/aacerts'     00[CFG] loading ocsp signer certificates from '/usr/local/etc/ipsec.d/ocspcerts'     00[CFG] loading attribute certificates from '/usr/local/etc/ipsec.d/acerts'     00[CFG] loading crls from '/usr/local/etc/ipsec.d/crls'     00[CFG] loading secrets from '/usr/local/etc/ipsec.secrets'     00[CFG]   loaded RSA private key from '/usr/local/etc/ipsec.d/private/111.111.111.111_key.der'     00[LIB] loaded plugins: charon test-vectors curl aes des blowfish rc2 sha1 sha2 md4 md5 random nonce x509 revocation constraints pubkey pkcs1 pkcs7 pkcs8 pkcs12 pgp dnskey sshkey pem openssl fips-prf gmp xcbc cmac hmac attr kernel-pfkey kernel-pfroute resolve socket-default stroke updown eap-identity eap-aka eap-aka-3gpp2 eap-md5 eap-mschapv2 eap-dynamic eap-tls eap-ttls eap-peap xauth-generic xauth-eap whitelist addrblock     00[LIB] unable to load 4 plugin features (4 due to unmet dependencies)     00[JOB] spawning 16 worker threads     charon (49667) started after 220 ms     16[CFG] received stroke: add connection 'android'     16[CFG] adding virtXXl IP address pool 10.0.0.3/32     16[CFG] 'android' has both left- and rightsourceip, but IKE can negotiate one virtXXl IP only, ignoring local virtXXl IP     16[CFG]   loaded certificate "C=XX, ST=XX, L=XX, O=ORG, OU=UNIT, CN=111.111.111.111, E=mail@host.com" from '/usr/local/etc/ipsec.d/certs/111.111.111.111_cert.der'     16[CFG]   loaded certificate "C=XX, ST=XX, L=XX, O=ORG, OU=UNIT, CN=111.111.111.111, E=mail@host.com" from '/usr/local/etc/ipsec.d/certs/android_cert.der'     16[CFG] added configuration 'android'     16[NET] received packet: from 22.222.222.22[16483] to 192.168.1.100[500] (660 bytes)     16[ENC] parsed IKE_SA_INIT request 0 [ SA KE No N(NATD_S_IP) N(NATD_D_IP) ]     16[IKE] 22.222.222.22 is initiating an IKE_SA     16[IKE] IKE_SA (unnamed)[1] state change: CREATED => CONNECTING     16[IKE] local host is behind NAT, sending keep alives     16[IKE] remote host is behind NAT     16[IKE] sending cert request for "C=XX, ST=XX, L=XX, O=ORG, OU=UNIT, CN=111.111.111.111, E=mail@host.com"     16[ENC] generating IKE_SA_INIT response 0 [ SA KE No N(NATD_S_IP) N(NATD_D_IP) CERTREQ N(MULT_AUTH) ]     16[NET] sending packet: from 192.168.1.100[500] to 22.222.222.22[16483] (337 bytes)     16[NET] received packet: from 22.222.222.22[16549] to 192.168.1.100[4500] (1964 bytes)     16[ENC] parsed IKE_AUTH request 1 [ IDi CERT N(INIT_CONTACT) CERTREQ AUTH CPRQ(ADDR ADDR6 DNS DNS6) N(ESP_TFC_PAD_N) SA TSi TSr N(MOBIKE_SUP) N(NO_ADD_ADDR) N(MULT_AUTH) N(EAP_ONLY) ]     16[IKE] received cert request for "C=XX, ST=XX, L=XX, O=ORG, OU=UNIT, CN=111.111.111.111, E=mail@host.com"     16[IKE] received end entity cert "C=XX, ST=XX, L=XX, O=ORG, OU=UNIT, CN=111.111.111.111, E=mail@host.com"     16[CFG] looking for peer configs matching 192.168.1.100[%any]...22.222.222.22[C=XX, ST=XX, L=XX, O=ORG, OU=UNIT, CN=111.111.111.111, E=mail@host.com]     16[CFG] selected peer config 'android'     16[CFG]   using trusted ca certificate "C=XX, ST=XX, L=XX, O=ORG, OU=UNIT, CN=111.111.111.111, E=mail@host.com"     16[CFG] checking certificate status of "C=XX, ST=XX, L=XX, O=ORG, OU=UNIT, CN=111.111.111.111, E=mail@host.com"     16[CFG] certificate status is not available     16[CFG]   reached self-signed root ca with a path length of 0     16[CFG]   using trusted certificate "C=XX, ST=XX, L=XX, O=ORG, OU=UNIT, CN=111.111.111.111, E=mail@host.com"     16[IKE] authentication of 'C=XX, ST=XX, L=XX, O=ORG, OU=UNIT, CN=111.111.111.111, E=mail@host.com' with RSA signature successful     16[IKE] processing INTERNAL_IP4_ADDRESS attribute     16[IKE] processing INTERNAL_IP6_ADDRESS attribute     16[IKE] processing INTERNAL_IP4_DNS attribute     16[IKE] processing INTERNAL_IP6_DNS attribute     16[IKE] received ESP_TFC_PADDING_NOT_SUPPORTED, not using ESPv3 TFC padding     16[IKE] peer supports MOBIKE     16[IKE] authentication of '111.111.111.111' (myself) with RSA signature successful     16[IKE] IKE_SA android[1] established between 192.168.1.100[111.111.111.111]...22.222.222.22[C=XX, ST=XX, L=XX, O=ORG, OU=UNIT, CN=111.111.111.111, E=mail@host.com]     16[IKE] IKE_SA android[1] state change: CONNECTING => ESTABLISHED     16[IKE] scheduling reauthentication in 9802s     16[IKE] maximum IKE_SA lifetime 10342s     16[IKE] sending end entity cert "C=XX, ST=XX, L=XX, O=ORG, OU=UNIT, CN=111.111.111.111, E=mail@host.com"     16[IKE] peer requested virtXXl IP %any     16[CFG] assigning new lease to 'C=XX, ST=XX, L=XX, O=ORG, OU=UNIT, CN=111.111.111.111, E=mail@host.com'     16[IKE] assigning virtXXl IP 10.0.0.3 to peer 'C=XX, ST=XX, L=XX, O=ORG, OU=UNIT, CN=111.111.111.111, E=mail@host.com'     16[IKE] peer requested virtXXl IP %any6     16[IKE] no virtXXl IP found for %any6 requested by 'C=XX, ST=XX, L=XX, O=ORG, OU=UNIT, CN=111.111.111.111, E=mail@host.com'     16[IKE] CHILD_SA android{1} established with SPIs c11f2b7e_i f7ac6573_o and TS 0.0.0.0/0 ::/0 === 10.0.0.3/32     16[CHD] updown: /usr/local/libexec/ipsec/_updown: iptables: not found     16[CHD] updown: /usr/local/libexec/ipsec/_updown: iptables: not found     16[ENC] generating IKE_AUTH response 1 [ IDr CERT AUTH CPRP(ADDR) N(ESP_TFC_PAD_N) SA TSi TSr N(AUTH_LFT) N(MOBIKE_SUP) N(ADD_4_ADDR) ]     16[NET] sending packet: from 192.168.1.100[4500] to 22.222.222.22[16549] (1596 bytes)      Looking at the `tcpdump` output: 10.0.0.3 is an IP that Android client got assigned by StrongSwan. DNS:               22:21:43.971797 IP 10.0.0.3.55123 > ns1.kyivstar.net.domain: 41221+ A? www.cdn.viber.com. (35)     22:26:00.484696 IP 10.0.0.3.25462 > gi-dns1-kie3.kyivstar.net.domain: 436+ A? mtalk.google.com. (34)     22:25:59.225291 IP 10.0.0.3.53999 > ns1.kyivstar.net.domain: 56585+ A? graph.facebook.com. (36)      OK, pinging "bsdserver" works:               22:26:06.460464 IP 22-222-222-22-gprs.kyivstar.net.16445 > bsdserver.local.sae-urn: UDP-encap: ESP(spi=0xc289c560,seq=0x96), length 132     22:26:06.460749 IP bsdserver.local.sae-urn > 46-211-183-74-gprs.kyivstar.net.16445: UDP-encap: ESP(spi=0xe77a2567,seq=0x1f), length 132      But pinging 8.8.8.8 doesn't:               22:30:51.179070 IP 10.0.0.3 > google-public-dns-a.google.com: ICMP echo request, id 3, seq 6, length 64     22:30:52.098315 IP 22-222-222-22-gprs.kyivstar.net.16445 > bsdserver.local.sae-urn: UDP-encap: ESP(spi=0xc289c560,seq=0xce), length 132     22:30:52.098825 IP 10.0.0.3 > google-public-dns-a.google.com: ICMP echo request, id 3, seq 7, length 64     22:30:52.754209 STP 802.1d, Config, Flags [none], bridge-id 8000.b0:48:7a:c2:f2:92.8001, length 43     22:30:53.078436 IP 22-222-222-22-gprs.kyivstar.net.16445 > bsdserver.local.sae-urn: UDP-encap: ESP(spi=0xc289c560,seq=0xcf), length 132     22:30:53.079070 IP 10.0.0.3 > google-public-dns-a.google.com: ICMP echo request, id 3, seq 8, length 64     22:30:53.358693 IP 22-222-222-22-gprs.kyivstar.net.16445 > bsdserver.local.sae-urn: isakmp-nat-keep-alive     22:30:53.738572 IP 22-222-222-22-gprs.kyivstar.net.16445 > bsdserver.local.sae-urn: UDP-encap: ESP(spi=0xc289c560,seq=0xd0), length 116     22:30:53.739164 IP 10.0.0.3.25984 > gi-dns1-kie3.kyivstar.net.domain: 1638+ A? www.cdn.viber.com. (35)     22:30:54.098740 IP 22-222-222-22-gprs.kyivstar.net.16445 > bsdserver.local.sae-urn: UDP-encap: ESP(spi=0xc289c560,seq=0xd1), length 132     22:30:54.099248 IP 10.0.0.3 > google-public-dns-a.google.com: ICMP echo request, id 3, seq 9, length 64     22:30:54.754083 STP 802.1d, Config, Flags [none], bridge-id 8000.b0:48:7a:c2:f2:92.8001, length 43      And routing table from Android device: ![Android route](http://i.stack.imgur.com/UZmVW.png) I feel like problem isn't exactly IPsec related. Any bright ideas about possible solution?


title: Cannot install PHP packages in CentOS

text: In CentOS 6.3 ( **Edit** : updated to 6.4) I can't install any PHP (MySQL, and many other) packages. For example output of `yum install php-devel` is:               Loaded plugins: fastestmirror     Loading mirror speeds from cached hostfile      * base: mirror.vit.com.tr      * extras: mirrors.prometeus.net      * rpmforge: mirror.nl.leaseweb.net      * updates: mirrors.prometeus.net     Setting up Install Process     No package php-devel available.     Error: Nothing to do      output of `ls /etc/yum.repos.d`:               CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo  CentOS-Vault.repo  mirrors-rpmforge  rpmforge.repo      `grep -E "name|enabled" /etc/yum.repos.d/*`:               /etc/yum.repos.d/CentOS-Base.repo:name=CentOS-$releasever - Base     /etc/yum.repos.d/CentOS-Base.repo:name=CentOS-$releasever - Updates     /etc/yum.repos.d/CentOS-Base.repo:name=CentOS-$releasever - Extras     /etc/yum.repos.d/CentOS-Base.repo:name=CentOS-$releasever - Plus     /etc/yum.repos.d/CentOS-Base.repo:enabled=0     /etc/yum.repos.d/CentOS-Base.repo:name=CentOS-$releasever - Contrib     /etc/yum.repos.d/CentOS-Base.repo:enabled=0     /etc/yum.repos.d/CentOS-Debuginfo.repo:name=CentOS-6 - Debuginfo     /etc/yum.repos.d/CentOS-Debuginfo.repo:enabled=0     /etc/yum.repos.d/CentOS-Media.repo:name=CentOS-$releasever - Media     /etc/yum.repos.d/CentOS-Media.repo:enabled=0     /etc/yum.repos.d/CentOS-Vault.repo:name=CentOS-6.0 - Base     /etc/yum.repos.d/CentOS-Vault.repo:enabled=0     /etc/yum.repos.d/CentOS-Vault.repo:name=CentOS-6.0 - Updates     /etc/yum.repos.d/CentOS-Vault.repo:enabled=0     /etc/yum.repos.d/CentOS-Vault.repo:name=CentOS-6.0 - Extras     /etc/yum.repos.d/CentOS-Vault.repo:enabled=0     /etc/yum.repos.d/CentOS-Vault.repo:name=CentOS-6.0 - Contrib     /etc/yum.repos.d/CentOS-Vault.repo:enabled=0     /etc/yum.repos.d/CentOS-Vault.repo:name=CentOS-6.0 - CentOSPlus     /etc/yum.repos.d/CentOS-Vault.repo:enabled=0     /etc/yum.repos.d/CentOS-Vault.repo:name=CentOS-6.1 - Base     /etc/yum.repos.d/CentOS-Vault.repo:enabled=0     /etc/yum.repos.d/CentOS-Vault.repo:name=CentOS-6.1 - Updates     /etc/yum.repos.d/CentOS-Vault.repo:enabled=0     /etc/yum.repos.d/CentOS-Vault.repo:name=CentOS-6.1 - Extras     /etc/yum.repos.d/CentOS-Vault.repo:enabled=0     /etc/yum.repos.d/CentOS-Vault.repo:name=CentOS-6.1 - Contrib     /etc/yum.repos.d/CentOS-Vault.repo:enabled=0     /etc/yum.repos.d/CentOS-Vault.repo:name=CentOS-6.1 - CentOSPlus     /etc/yum.repos.d/CentOS-Vault.repo:enabled=0     /etc/yum.repos.d/CentOS-Vault.repo:name=CentOS-6.2 - Base     /etc/yum.repos.d/CentOS-Vault.repo:enabled=0     /etc/yum.repos.d/CentOS-Vault.repo:name=CentOS-6.2 - Updates     /etc/yum.repos.d/CentOS-Vault.repo:enabled=0     /etc/yum.repos.d/CentOS-Vault.repo:name=CentOS-6.2 - Extras     /etc/yum.repos.d/CentOS-Vault.repo:enabled=0     /etc/yum.repos.d/CentOS-Vault.repo:name=CentOS-6.2 - Contrib     /etc/yum.repos.d/CentOS-Vault.repo:enabled=0     /etc/yum.repos.d/CentOS-Vault.repo:name=CentOS-6.2 - CentOSPlus     /etc/yum.repos.d/CentOS-Vault.repo:enabled=0     /etc/yum.repos.d/rpmforge.repo:name = Red Hat Enterprise $releasever - RPMforge.net - dag     /etc/yum.repos.d/rpmforge.repo:enabled = 1      `yum repolist`:               repo id                                           repo name                                                                          status     base                                              CentOS-6 - Base                                                                      6,296+85     extras                                            CentOS-6 - Extras                                                                          13     rpmforge                                          Red Hat Enterprise 6 - RPMforge.net - dag                                          11,131+144     updates                                           CentOS-6 - Updates                                                                     890+34      `yum list available 'php-*'`:               Loaded plugins: fastestmirror     Loading mirror speeds from cached hostfile      * base: mirror.vit.com.tr      * extras: mirrors.prometeus.net      * rpmforge: www.mirrorservice.org      * updates: mirrors.prometeus.net     Error: No matching Packages to list      This happens for all PHP packages. When I type `php-` and press tab key there is no auto completion. Any suggestions?


title: Switch between windows & tabs in Linux?

text: do we have keyboard shortcuts to switch between tabs or windows, am looking for shortcuts similar to of those available in windows (ctrl + tab to switch btw tabs & Alt + tab to swtich btw windows). Note: RHEL5.8 is accessed via CITRIX XENAPP as a window in windows xp


title: centos 6.3 apache local network not working

text: I have clean installed centos, apache, mysql, php and have my php pages running fine at 192.168.1.66. I type that ip in on another computer (macbook) on the same network and get nothing. Page time out. I also don't see the linux machine showing up in my network list in finder. I have tried adding port 80 to iptables but still no joy. Also, I tried running my xampp installation on the macbook and viewing that from my linux browser and get nothing. Basically the 2 computers are on the same network but don't want to see each other. I can't find any options in centos for sharing on the local network Any help is much appreciated.


title: Dialog - Continue in background

text: I installed this program: http://invisible-island.net/dialog/dialog.html Now I want to use this dialog: http://invisible-island.net/dialog/dialog-figures.html#demo_gauge               dialog --gauge 'Checking permissions' 20 60      It works fine, but the problem is that the bash script does not continue until this dialog has been closed (CTRL + C). But I want that my shell script continues, and I show the status with the dialog. Is this possible? ### EDIT #1               status="Initializing"         (echo 1      sleep 1      status="Loading"      echo 30      sleep 1      echo 90      sleep 1      echo 100     ) | dialog --gauge $status 10 40


title: sendmail through virtual machine

text: I am successfully performing some very basic SMTP sending in my machine with a basic Python script:               .... things ...          try:        smtpObj = smtplib.SMTP('localhost')        smtpObj.sendmail(sender, recievers, message.format(now, now))        print "Successfully sent email"     except SMTPException:        print "Error: unable to send email"      It works fine both in my machine and in a Ubuntu server I have in Virtual Box. Now I would like to send one email from one server using the other server as a host. I tried in my virtual host to change               smtpObj = smtplib.SMTP('localhost')      with               smtpObj = smtplib.SMTP('IP of my PC') #IP get from "ifconfig -a"      but does not work. Am I missing something?


title: Third cron field doesn't seem to work (job runs when I don't want it to)

text: I scheduled a job like this:               *   *    6-8  *  1-5  echo "test" >>/tmp/test.log 2>&1      I expect this job to run only on 6th,7th,8th, these 3 days. but today is 18th, it still runs. What is wrong with this job? What shall I do if I want it to run a some specific days?


title: Delete only first occurrence of character using tr

text: I want to delete the occurrence of a character in a string only for the first occurrence. Example:               echo "B123_BACK" | tr -d 'B'      This results in output:               123_ACK      How can I delete only the first occurrence of charcater `'B'` so that the output looks like               123_BACK


title: Similar method to /etc/init.d

text: I have set my script to run using the `/etc/init.d` method. All works good. The problem is that my script does packet capturing and when it restarts the machine after say the `crond` is loaded then it loads this script of mine and the packet capture process I guess starting then and it halts from going further. Is there any method where I can force it only to start when Linux is fully loaded ? Below is how my script looks like.               #!/bin/bash     # chkconfig: 2345 95 05     # myapp daemon     # description: myapp daemon     # processname: myapp          DAEMON_PATH="/usr/local/bin/"     DAEMON=pc1.c     #DAEMONOPTS="-my opts"     NAME=pc1.c     DESC="my packet capture"          PIDFILE=/var/run/$NAME.pid     SCRIPTNAME=/etc/init.d/$NAME          case "$1" in     start)         printf "%-50s" "Starting $NAME..."         insmod /usr/local/pfring/kernel/pf_ring.ko         /usr/local/bin/pc1.c &         $! > PIDFILE         ;;     status)             if [ -f $PIDFILE];              then if [ -d /proc/cat $PIDFILE ];                   then echo "Process is running";                   fi;              else echo "Error! PID file is missing!";                   fi          ;;     stop)             printf "%-50s" "Stopping $NAME"                 PID=`cat $PIDFILE`                 cd $DAEMON_PATH             if [ -f $PIDFILE ]; then                 kill -HUP $PID                 printf "%s\n" "Ok"                 rm -f $PIDFILE             else                 printf "%s\n" "pidfile not found"             fi     ;;     restart)         $0 stop         $0 start      ;;     *)             echo "Usage: $0 {status|start|stop|restart}"             exit 1     esac


title: External HDD read/write permission changing from a cron job

text: So, I run an overnight python script that runs a backup of our web data in the /var/www directory, then moves the backups to an external HDD in /media. The script in scheduled in the sudo crontab since it requires sudo commands. The script runs fine most everynight but once a week, the external HDD directory somehow gets it permissions changed from being accessible to all users to only being accessible to the root user. This causes our backups to fail, and this is no good. To further explain: the directory, /media/ gets duplicated into /media/_ which has no permission issue. It's like the name just got changed to have an underscore at the end. This one has all of the right data in it and is fine. The root one (/media/) is actually empty when I get in there. I am not heavily experienced with linux. I just know how to get around and issue simple commands. I do not know the ins and outs of the kernel and what could be causing the issue. I have no clue what is going on here. I am open to any suggestions. Please let me know if I am doing anything wrong/insecure. Let me know if this needs to be further explained. -Zac


title: svn: SSL is not supported

text: I am trying to check out code on a Unix box in the Z shell. When I run the following command svn checkout https://svn.example.net/svn/trunk/source build I get the following error message: svn: SSL is not supported The error message is in no way informative so I'd like to see if anyone has had a similar problem and even better if they have a solution. Thanks


title: Fedora 17 Freezes on Macbook Pro Install

text: So I put Fedora on my flash drive using this tutorial, and I also burned it onto a DVD. Whenever I try to boot from it or one of the EFI boots, the countdown on the install freezes at 0. whenever I try to press a key, it doesn't do anything. Any help would be appreciated. Thanks.


title: A problem with $RANDOM range in bash

text: why the code below, supposed to display a random from 2-3 range, actually works as if the range was 2-4?               echo $((RANDOM%3+2))


title: ^x^y unix trick for all instances in last command?

text: One of my favorite Unix tricks is `^x^y`, which will take the last command and replace the first instance of "x" with "y". However, I'm wondering if a similar trick works to replace _all_ instances of "x" with "y" in the last command?


title: Don't stop make'ing if a command fails, but check exit status

text: I am trying to instruct GNU Make 3.81 to not stop if a command fails (so I prefix the command with `-`) but I also want to check the exit status on the next command and print a more informative message. However my Makefile below fails:               $ cat Makefile      all:         -/bin/false         ([ $$? -eq 0 ] && echo "success!") || echo "failure!"     $     $ make     /bin/false     make: [all] Error 1 (ignored)     ([ $? -eq 0 ] && echo "success!") || echo "failure!"     success!      Why does the Makefile above echo "success!" instead of "failure!" ? **update:** Following and expanding on the accepted answer, below is how it should be written:               failure:                                                                                @-/bin/false && ([ $$? -eq 0 ] && echo "success!") || echo "failure!"                                                                                success:                                                                                @-/bin/true && ([ $$? -eq 0 ] && echo "success!") || echo "failure!"


title: How can I restore default window size in KVM/QEMU

text: In KVM/QEMU machine window size by default matches guest OS resolution. But if I resize windows (accidently) how to restore default size?


title: Why can I only run a .sh file from the parent directory, not the child directory

text: I am a Linux noob. I noticed that this does not work:               /tomcatDirectory/bin $ startup.sh //command not found      but this does work               /tomcatDirectory $ bin/startup.sh      I am used to Windows. It seems counter-intuitive to me that I can not run a program from its working directory, only from the parent folder. What's the bigger picture of what's happening here?


title: What is a command that will only show me the command syntax and options?

text: Is there a command which will just list all the options for a given command on one or two lines and not as long and words as `man` or `info` ?


title: Script using "split" in a loop over large files

text: I'm attempting to get a bash script working, and running into terrible errors along the way. The aim of the script is to break several large text files, into multiple files with a line count read from the file.               #!/bin/bash     DIR="$( cd "$( dirname "$0" )" && pwd )"      for i in 21 22 23 24 25 26 27 28 29 30 33 34 35 36 37 38 39 210 211 212 213 214 215 216 217 218 310 311 312 313 314 315 316 317 318     do         lines="`head -1 $DIR/C$i/DOPC-C$i.xyz`"         echo $lines         lines=$((lines+2))         split -a4 -d -l$lines $DIR/C$i/DOPC-C$i.xyz $DIR/C$i/DOPC-C$i-     done      The large text file has the number of molecules as its first line, so I'm using the head command to read it in, then passing this to split as the number of lines to. It has a formatting similar to:               3     Comment     C 0.41238 0.2301928 0.123123     H 0.123123 0.123233 0.5234234     H 0.123123 0.123233 0.5234234     3     Comment     C 0.41238 0.2301928 0.123123     H 0.123123 0.123233 0.5234234     H 0.123123 0.123233 0.5234234      However, when I run this from terminal, the memory usage of my system from free -m shoots up from 1.5GB to 16GB in use, and becomes extremely unresponsive. It works correctly for the first two files, and splits them how I wanted, though. Any advice? EDIT: The source files are all ~200-300MB. When I run the split command directly on any of the files it works fine. There are 30 files which need to be split in this way, C21,C22, C23, etc. I reran the script and it got through the first ten files before it hit the memory limit this time. EDIT2: So, I made a sort of very heavy handed work around. After running it through three files, I simply put               echo 3 | tee /proc/sys/vm/drop_caches      I noticed after the split command my memory in use would sharply spike according to free -m The spike also wouldn't go away when closing the terminal window where I ran the split command. I believe there is some issue in the configuration of disc caching on my system: Linux must be caching either the files I'm writing from or writing to and not cleaning up. When putting this to run every 3rd file, the script runs, albeit relatively slowly, through all of the files, and my system remains stable after. My suspicion is that this caching may also be related in part to it being a NTFS file system that I'm working on.


title: Why are packets not moving forward?

text: I have a server with forwarding turned on. I placed an iptables LOG target in the PREROUTING, INPUT, and FORWARD chains of the mangle table. I can see the LOG messages from PREROUTING, but not INPUT or FORWARD. I have no iptables rules other than the logging. Why does the packet not get past the PREROUTING chain? From various netfilter charts, it seems that the only thing that can stop it is the routing decision. I have checked that forwarding is turned on, I don't have any special routing policies setup, and I do have a route to the packet's destination. Reverse path filtering is disabled. One netfilter chart suggests the packet goes through QOS ingress at that point. I'm not too familiar with QOS, but I've not done anything special with tc. My qdiscs are pfifo_fast (the default), and there are no filters. Additional details: This is an IPsec tunnel endpoint. The packets are coming in through IPsec, getting transformed successfully, and re-entering the networking stack. It is at this stage that I see the packet get stopped after PREROUTING before either INPUT or FORWARD.


title: sensors-detect does not detect

text: I am trying to run sensors-detect in Debian6 64 bits and I get: > Sorry, no sensors were detected. Either your system has no sensors, or they > are not supported, or they are connected to an I2C or SMBus adapter that is > not supported. Sensors applet is correctly running as well as sensor cpu * * *                   root@debian:/# dmesg | grep -i error      [ 0.558964] ACPI Error (psargs-0359): [RAMB] Namespace lookup failure, AE_NOT_FOUND      [ 7.537292] PM: Error -22 checking image file      [ 9.581500] nouveau: probe of 0000:01:00.0 failed with error -22      * * *               root@debian:/# lspci     00:00.0 Host bridge: Intel Corporation Sandy Bridge DRAM Controller (rev 09)     00:01.0 PCI bridge: Intel Corporation Sandy Bridge PCI Express Root Port (rev 09)     00:02.0 Display controller: Intel Corporation Sandy Bridge Integrated Graphics Controller (rev 09)     00:16.0 Communication controller: Intel Corporation Cougar Point HECI Controller #1 (rev 04)     00:1a.0 USB Controller: Intel Corporation Cougar Point USB Enhanced Host Controller #2 (rev 05)     00:1b.0 Audio device: Intel Corporation Cougar Point High Definition Audio Controller (rev 05)     00:1c.0 PCI bridge: Intel Corporation Cougar Point PCI Express Root Port 1 (rev b5)     00:1c.5 PCI bridge: Intel Corporation Cougar Point PCI Express Root Port 6 (rev b5)     00:1c.6 PCI bridge: Intel Corporation Cougar Point PCI Express Root Port 7 (rev b5)     00:1c.7 PCI bridge: Intel Corporation 82801 PCI Bridge (rev b5)     00:1d.0 USB Controller: Intel Corporation Cougar Point USB Enhanced Host Controller #1 (rev 05)     00:1f.0 ISA bridge: Intel Corporation Cougar Point LPC Controller (rev 05)     00:1f.2 SATA controller: Intel Corporation Cougar Point 6 port SATA AHCI Controller (rev 05)     00:1f.3 SMBus: Intel Corporation Cougar Point SMBus Controller (rev 05)     01:00.0 VGA compatible controller: nVidia Corporation Device 1244 (rev a1)     01:00.1 Audio device: nVidia Corporation Device 0bee (rev a1)     03:00.0 USB Controller: Device 1b21:1042     04:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)     05:00.0 PCI bridge: Device 1b21:1080 (rev 01)      I only get the following running sensors:               root@debian:/# sensors     acpitz-virtual-0     Adapter: Virtual device     temp1:       +27.8°C  (crit = +99.0°C)                       temp2:       +29.8°C  (crit = +99.0°C)      * * * **With this proposed script (http://dl.lm-sensors.org/lm- sensors/files/sensors-detect) It seems that sensors-detect find much more, I restart Debian, or I start the service lm-sensor and I get the same outpout at sensors**


title: How to provide a "guest LAN" on one ethernet device

text: I have an always-on machine running Debian/Squeeze with a couple of ethernet ports (it's doing various serverish jobs, including DHCP) and a LAN on each. eth0 is on 192.168.7.* and has access to the internet (and the rest of the "office LAN") via a gateway (NAT-translating DSL router) on that LAN at 192.168.7.1. eth1 is on 192.168.1.* . I'm looking for a quick, easy and Debian-friendly way of configuring the machine so that anyone on the 192.168.1.* LAN only has access to the external internet, DHCP, and can't access any of the other stuff on 192.168.7.*. I'm sure this is possible using an appropriate set of iptables rules. Suspect I'm looking for one of:   * A simple guide to how to set up iptables to achieve the above (I can't be the first person to want to do this).   * A pointer to some user-friendly firewall configuring software which can do this (although note that I don't want to lock down the eth0-side and the 192.168.7.* network at all).   * Suggestion of some software which is designed to do exactly this; I have an idea there are some packages intended to achieve similar to what I want for internet cafes etc, but I'm not sure where to start looking or whether these might be overkill. Any tools being in Debian Squeeze (or Wheezy) already is a big plus.


title: show only tags of an xml document on the command line

text: Is there a command line command or utility I can use to show only the tag structure of an xml document? I looked at xmllint but I didn't see a switch to do it. For a structure like               <tag1><tag2><tag2-5>value1</tag2-5><tag3>value2</tag3></tag2></tag1>      I want to see               <tag1><tag2><tag2-5></tag2-5><tag3></tag3></tag2></tag1>


title: Streaming all local audio to Icecast Server

text: Does anyone know if it's possible to stream all audio on a computer to a local icecast server. I was able to stream individual files using ices2 but not all audio generated from my computer. Any thoughts, or is there a better way to setup some way for anyone to stream my local computers audio over the internet or local network?


title: vim "caught deadly signal HUP", what files are it preserving?

text: I logged out, apparently forgetting to bring back a vim session to the foreground. As expected, vim spat out "Vim: caught deadly signal HUP" followed by "Vim: preserving files". My question is: What files are being preserved? I guess those are the edited- but-unsaved files; where are those kept? How to I find them?


title: How can I configure xlock to find fonts?

text: Is it possible to make `xlock` to find fonts on my computer automatically? Namely, when I start xlock, it says               xlock: can not find font: -*-helvetica-medium-r-*-*-24-*-*-*-*-*-*, using fixed...      In my computer there are at least the following fonts (excerpt from `xlsfonts`):               -adobe-helvetica-medium-r-narrow--0-0-0-0-p-0-iso8859-1     -adobe-helvetica-medium-r-narrow--0-0-0-0-p-0-iso8859-15     -adobe-helvetica-medium-r-narrow--0-0-0-0-p-0-iso8859-2     -adobe-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-1     -adobe-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-15     -adobe-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-2     fixed      I know that I can use the following: `xlock -font -fixed` but I was wondering if it is possible for `xlock` to find suitable font without any parameters. And why               $ xlock -font -abobe-helvetica-medium-r-narrow--0-0-0-0-p-0-iso8859-1     xlock: can not find font: -abobe-helvetica-medium-r-narrow--0-0-0-0-p-0-iso8859-1, using fixed...`      won't work but `xlsfonts` lists that font? I tried               jaakko@jaakko-VPCEB1S1E:~$ xterm -fb -*-helvetica-medium-r-*-*-24-*-*-*-*-*-*     xterm: cannot load font '-*-helvetica-medium-r-*-*-24-*-*-*-*-*-*'     xterm: cannot load font '-*-helvetica-medium-r-*-*-24-*-*-*-*-*-*'     jaakko@jaakko-VPCEB1S1E:~$ xterm -fb -adobe-helvetica-medium-r-narrow--0-0-0-0-p-0-iso8859-43     xterm: cannot load font '-adobe-helvetica-medium-r-narrow--0-0-0-0-p-0-iso8859-43'     xterm: cannot load font '-adobe-helvetica-medium-r-narrow--0-0-0-0-p-0-iso8859-43'      and               jaakko@jaakko-VPCEB1S1E:~$ ls -l /usr/bin/xlock     -rwxr-xr-x 1 root root 129992 May 25  2012 /usr/bin/xlock


title: Getting a date format with grep

text: I've looked at similar questions and tried most suggestions, but none of them got me anywhere, even though i have a fairly simple task I think :S. I'm fairly new to this whole thing, so I've run out of ideas as to what to try or what I'm doing wrong... So the task is to get the lines of a file listed (with grep) which contain the short month name and day (like Oct 22). The file has a long format listing in it (containing files created on the current date), so there should be some results. However, I'm getting results in which only the month has been examined and found, the day hasn't. Some of the more sensible things I've tried so far:               grep $(date +"%b %e") *filename*      Then I get a line saying "grep: 22: No such file or directory" and a listing with all the results for the month ("Oct"). Same results with `+%d %e` or `+'%d %e'` or `'+%d %e'` instead of `+"%d %e";` instead of `$()`. (I also had %d for the day for a while, which made no difference, and shouldn't matter anyway as far as I know, since the date in question was now 22.) Why is the day not taken into account here?


title: How can I install Ubuntu 13.10 on Asus n56dp-dh11

text: My laptop has uefi and when I open the bios there is no clear way to tell the computer to boot from USB or CD. I'm very confused on how I'm supposed to install anything, even windows 7 can not load from a USB drive or DVD. I've seen, after a few hours of Googling that Ubuntu and other Linux distro's run great on this very exact laptop. But they have no insight as to how to do it.


title: Is there something like a lorem ipsum generator?

text: Is there something like a 'lorem ipsum generator'? I know it exists in Latex, and even in LibreOffice, but I'm looking for a terminal command. I would like to type something like `loremipsum 10 >> file1.txt` that would give me the first 10 paragraphs of lorem ipsum, each paragraph ended with one LF-character and 1 empty white line between each paragaph. And the output would be redirected to a file called file1.txt in the current directory.